Skip to content

feat(daemon): kb CLI switchover to daemon-aware store selection (phase 5)#27

Merged
vilosource merged 1 commit into
developfrom
feature/v2-cli-switchover
May 16, 2026
Merged

feat(daemon): kb CLI switchover to daemon-aware store selection (phase 5)#27
vilosource merged 1 commit into
developfrom
feature/v2-cli-switchover

Conversation

@vilosource
Copy link
Copy Markdown
Owner

Phase 5 of the v2 privileged-write-channel (issue #1). The operator kb
CLI now routes through the daemon when its socket is present, and keeps
the direct-disk local path otherwise. Builds on merged Phases 1–4.

What landed (TDD red→green)

  • withStore() + the checkpoint path use selectKnowledgeStore() in
    place of MykbStore.open(). Contract §2.4 — "when the daemon is
    running the operator CLI MUST use RpcKnowledgeStore" (else two writers
    race ~/.mykb) — is encoded once in the selector, reused by both
    the extension (P4) and the CLI (P5). No daemon ⇒ LocalMykbStore
    direct-disk operator path preserved.
  • DIP: cli.ts retyped from concrete MykbStore to the
    KnowledgeStore interface. Audit: every store.* call in
    cli.ts is an interface method; the sole non-interface call was
    close() (lifecycle) — moved onto SelectedStore.close() so callers
    stay interface-pure.
  • +1 scenario test: the real kb CLI binary, with a daemon socket
    present, writes a fact that lands in the JSONL the separate daemon
    process
    owns (CLI never touches the file — only the socket); read
    verb round-trips too.

Evidence

Full suite 646/646 across 2 runs; every existing CLI subcommand test
green through the selector (LSP audit). tsc + lint clean. 229/229
daemon+cli post-rebase.

Remaining: P6 container topology (RO brain mount, socket bind-mount,
systemd unit, SO_PEERCRED resolver), P7 regression closure (flip
bash-bypass-known-gap 🐛→✅ — the acceptance criterion for #1).

…e 5)

TDD red→green. The operator kb CLI now routes through the daemon when
its socket is present (contract §2.4: when the daemon runs, the operator
CLI MUST use RpcKnowledgeStore, else two writers race ~/.mykb), and
keeps the LocalMykbStore direct-disk path when it is not.

- withStore() and the checkpoint path now use selectKnowledgeStore()
  instead of MykbStore.open(); the §2.4 policy is encoded once in the
  selector and reused by both the extension (P4) and the CLI (P5).
- DIP: cli.ts retyped from concrete MykbStore to the KnowledgeStore
  interface. Audit: every store.* call in cli.ts is an interface method;
  the only non-interface call was close() (a lifecycle concern) — moved
  onto SelectedStore.close() so callers stay interface-pure.
- store-selection.ts: SelectedStore gains close() owning the underlying
  resource (local DB handle / RPC worker).
- +1 scenario test (cli-over-daemon): the real kb CLI binary, with a
  daemon socket present, writes a fact that lands in the JSONL the
  SEPARATE daemon process owns — the CLI never touches the file, only
  the socket. Read-path verb round-trips too.

Full suite 646/646 across 2 runs; every existing CLI subcommand test
green through the selector (LSP audit evidence). tsc + lint clean.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

Warning

Rate limit exceeded

@vilosource has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minute and 10 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8a58b48c-bd7c-4f47-8b36-c14a245d1ed5

📥 Commits

Reviewing files that changed from the base of the PR and between b487726 and e05aba7.

📒 Files selected for processing (3)
  • src/cli/cli.ts
  • src/daemon/store-selection.ts
  • tests/daemon/cli-over-daemon.scenario.test.ts

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 and usage tips.

@vilosource vilosource merged commit 653fb54 into develop May 16, 2026
3 checks passed
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