Skip to content

feat(docs): suggest enabling docs once per repo at SessionStart#305

Open
efenocchi wants to merge 6 commits into
mainfrom
feat/docs-onboarding-suggest
Open

feat(docs): suggest enabling docs once per repo at SessionStart#305
efenocchi wants to merge 6 commits into
mainfrom
feat/docs-onboarding-suggest

Conversation

@efenocchi

@efenocchi efenocchi commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

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 install output. 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":

Docs (optional): keep per-file and per-subsystem documentation in sync with your code on every commit.
  Enable in a repo:  hivemind docs sync    (one-time consent; opt into per-commit auto-sync when asked)
  Turn it off later: hivemind docs auto off
  Check status:      hivemind docs list

Re-running install stays quiet. Sentinel write is best-effort — a failure just reshows the hint, never breaks install.

Verification

  • tsc clean; unit tests for the block + the first-install sentinel.
  • Real 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 helpers
  • src/cli/index.ts — gated print in runInstallAll
  • tests/shared/docs-install-hint.test.ts (new)
  • Removed: src/docs/docs-suggest.ts + test, and its session-start.ts wiring

Session Context

Session transcript

Summary by CodeRabbit

  • New Features
    • Added an installation-time onboarding message for the documentation feature.
    • The message includes guidance for enabling or disabling documentation support and provides a command for checking its status.
    • The onboarding message appears only after the first installation, keeping future installation output concise.
  • Reliability
    • Recording whether the message was shown is handled safely and will not interrupt or block installation if it fails.

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.
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds 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.

Changes

Docs onboarding

Layer / File(s) Summary
Install-time docs guidance
src/docs/install-hint.ts, tests/shared/docs-install-hint.test.ts
Adds enable, disable, and status guidance; tracks display state with a local sentinel; validates content, state transitions, and non-throwing writes.
Install completion integration
src/cli/index.ts
Prints the docs hint once during runInstallAll before the existing completion message and records it as shown.

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
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions a SessionStart suggestion, but the PR actually moves the docs hint into visible install output and removes SessionStart wiring. Rename it to reflect the install-time docs onboarding change, e.g. 'feat(docs): show a one-time docs hint during install'.
Description check ⚠️ Warning The description is detailed, but it does not follow the repository template and is missing the required Summary, Version Bump, and Test plan sections. Add the template sections: Summary, Version Bump, and a Test plan checklist with local tests, new tests, and whether a release bump is needed.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/docs-onboarding-suggest

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Scope: files changed in this PR. Enforced threshold: 90% per metric (per file via vitest.config.ts).

Status Category Percentage Covered / Total
🟢 Lines 91.14% (🎯 90%) 319 / 350
🟢 Statements 91.28% (🎯 90%) 377 / 413
🟢 Functions 100.00% (🎯 90%) 36 / 36
🔴 Branches 88.16% (🎯 90%) 283 / 321
File Coverage — 4 files changed
File Stmts Branches Functions Lines
src/cli/index.ts 🔴 87.9% 🔴 85.1% 🟢 100.0% 🔴 87.0%
src/docs/docs-suggest.ts 🟢 97.0% 🟢 96.0% 🟢 100.0% 🟢 100.0%
src/docs/install-hint.ts 🟢 100.0% 🟢 100.0% 🟢 100.0% 🟢 100.0%
src/hooks/session-start.ts 🟢 99.0% 🟢 92.1% 🟢 100.0% 🟢 98.9%

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant