feat(docs): suggest enabling docs once per repo at SessionStart#305
Open
efenocchi wants to merge 6 commits into
Open
feat(docs): suggest enabling docs once per repo at SessionStart#305efenocchi wants to merge 6 commits into
efenocchi wants to merge 6 commits into
Conversation
New docs-suggest.ts is the inverse gate of docsWikiContextNote: it produces a SessionStart note for a real, indexed repo that has NOT opted into docs, so the agent can surface `hivemind docs sync` if the user asks. Firing is deduped through ~/.deeplake/docs-suggested.json (sibling of docs-auto.json), keyed on (orgId, projectKey) so the note shows once per repo, never every session. Reads are hook-safe (missing/corrupt registry => empty), and docsSuggestNote is pure so the caller guards the write. Wording is descriptive capability disclosure, not an imperative to the agent, and ends with "no action needed unless the user asks" to stay clear of prompt-injection heuristics. Tests cover every gate, fail-closed behavior, dedup persistence and idempotent writes.
Compute suggestNote after docsNote: only for a logged-in session in an indexed repo (graph present) with docs off and no prior suggestion. Record the firing via markSuggested in a best-effort try/catch so a registry write can never break SessionStart, then append the note to additionalContext.
📝 WalkthroughWalkthroughAdds a one-time docs onboarding hint to the install completion flow, backed by a local sentinel file and best-effort persistence. The hint content, sentinel behavior, and failure handling are covered by tests. ChangesDocs onboarding
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Installer
participant DocsHint
participant LocalSentinel
Installer->>DocsHint: check whether hint was shown
DocsHint->>LocalSentinel: inspect sentinel file
LocalSentinel-->>DocsHint: return existence state
DocsHint-->>Installer: return shown status
Installer->>DocsHint: request onboarding lines
DocsHint-->>Installer: return hint lines
Installer->>DocsHint: mark hint as shown
DocsHint->>LocalSentinel: write timestamp sentinel
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
Coverage ReportScope: files changed in this PR. Enforced threshold: 90% per metric (per file via
File Coverage — 4 files changed
Generated for commit 9d824cd. |
`hivemind install` runs on a TTY, so it is the visible place to tell the user the docs feature exists — unlike the SessionStart note, which only the model sees. docsInstallLines() returns the block, covering BOTH directions: enable per repo with `hivemind docs sync`, turn off with `hivemind docs auto off`, and check state with `hivemind docs list`, so the user is never stuck after opting in. Test locks the enable/disable/status commands in place.
Emit docsInstallLines() near the end of runInstallAll, right before the "Done. Restart" line, so it lands in the normal install output series.
The SessionStart note was invisible to the user (additionalContext reaches only the model), so it never told a human that a repo lacks auto docs. We move the docs onboarding to the visible `hivemind install` output instead. Removes docs-suggest.ts, its test, and the session-start wiring; the docs wiki note (docsWikiContextNote) for opted-in repos is untouched.
Gate docsInstallLines() behind a sentinel (~/.deeplake/.docs-hint-shown) so the enable/disable block prints once, on the first `hivemind install`, and re-running install stays quiet. Sentinel write is best-effort — a failure just reshows the hint, never breaks install.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Onboarding so a user actually learns Hivemind can keep per-repo docs in sync — and, crucially, how to turn it on and off.
The onboarding lives in the visible
hivemind installoutput. An earlier iteration injected a SessionStart note, but that reaches only the model (invisible in the terminal), so it never told a human. That note was removed; the install hint is the single, user-facing mechanism.Behaviour
On the first
hivemind install(sentinel~/.deeplake/.docs-hint-shown), the install summary prints, right before "Done. Restart":Re-running install stays quiet. Sentinel write is best-effort — a failure just reshows the hint, never breaks install.
Verification
tscclean; unit tests for the block + the first-install sentinel.hivemind install(sandbox HOME): run 1 prints the docs block; run 2 (same HOME) suppresses it; sentinel written.Files
src/docs/install-hint.ts(new) —docsInstallLines()+ first-install sentinel helperssrc/cli/index.ts— gated print inrunInstallAlltests/shared/docs-install-hint.test.ts(new)src/docs/docs-suggest.ts+ test, and itssession-start.tswiringSession Context
Session transcript
Summary by CodeRabbit