feat(docs): suggest enabling docs once per repo at SessionStart#305
Open
efenocchi wants to merge 4 commits into
Open
feat(docs): suggest enabling docs once per repo at SessionStart#305efenocchi wants to merge 4 commits into
efenocchi wants to merge 4 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 persistent, deduplicated docs setup suggestion selected during ChangesDocs onboarding
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant SessionStart
participant docsSuggestNote
participant isAutoEnabled
participant wasSuggested
participant markSuggested
SessionStart->>docsSuggestNote: evaluate docs suggestion inputs
docsSuggestNote->>isAutoEnabled: check docs auto-enabled state
docsSuggestNote->>wasSuggested: check org/project registry entry
docsSuggestNote-->>SessionStart: return note or empty string
SessionStart->>markSuggested: persist emitted suggestion
SessionStart-->>SessionStart: append suggestNote to additionalContext
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
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 for the docs feature, so a user actually learns Hivemind can keep per-repo docs in sync — in two complementary places.
1. Install-time hint (visible to the user)
hivemind installruns on a TTY, so it is the honest place to TELL the user.docsInstallLines()prints a block in the install summary (right before "Done. Restart") covering BOTH directions:hivemind docs synchivemind docs auto offhivemind docs listSo the user is never stuck after opting in.
2. SessionStart note (visible to the model)
Inverse gate of the existing
docsWikiContextNote: for a logged-in session in an indexed repo with docs off and no prior suggestion, inject a one-time, descriptive note so the agent can surfacehivemind docs syncif the user asks. Deduped per(org, project)via~/.deeplake/docs-suggested.json; wording is non-imperative to stay clear of prompt-injection heuristics.Verification
tscclean; unit tests for both helpers; full suite green.hivemind install(sandbox HOME) prints the docs block in the series with enable/disable/status.claude -ploading the plugin quotes the SessionStart note back verbatim; second run same registry → suppressed (dedup).Files
src/docs/install-hint.ts(new) + wired intosrc/cli/index.ts(runInstallAll)src/docs/docs-suggest.ts(new) + wired intosrc/hooks/session-start.tstests/shared/docs-install-hint.test.ts,tests/shared/docs-suggest.test.ts(new)Session Context
Session transcript
Summary by CodeRabbit
New Features
Bug Fixes
Tests