Skip to content

feat(cli): dirsql context prints the version-matched agent usage guide - #1266

Merged
thekevinbot merged 5 commits into
mainfrom
claude/1264-context
Oct 5, 2026
Merged

thekevinbot merged 5 commits into
mainfrom
claude/1264-context

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1264

dirsql context prints a usage guide for agents, matched to the running version. The first line is dirsql <version>, followed by the sections ## Usage, ## Recipes and ## Troubleshooting. It takes no flags and exits 0.

Tests

  • packages/rust/tests/context_integration.rs checks the output contract: exit 0 with empty stderr, the version line, the three sections in order, and that a flag is a usage error (exit 2).
  • packages/rust/tests/context_examples_e2e.rs is the drift guard. It runs every fenced uvx dirsql ... example from the printed guide against a fixture that includes an empty metadata.json, and asserts each exits 0 with a JSON array.
    • The plugin example (uvx --with dirsql-plugin-embeddings) is skipped because it downloads a model.
    • Removing the json_valid guard locally made the guard fail with malformed JSON.
  • Unit tests cover cli/context.rs, the Command::Context parse and dispatch, and both launchers.
  • Red CI run for the test-only commit: https://github.com/thekevinscott/dirsql/actions/runs/37316706463. All four integration tests and the drift guard failed with SQLite error: near "context": syntax error.

Manual run

I built the binary and ran it in an unrelated directory, /tmp/ctx1264-manual:

  • dirsql context exited 0. Its first line was dirsql 0.2.7, and the three ## sections appeared in order.
  • I ran these printed examples, and each returned the expected JSON:
    • the largest files
    • the json_each tags query over a directory containing an empty metadata.json
    • the frontmatter LIKE query
    • './notes', which listed one level only
  • dirsql context --format json exited 2 with unexpected argument '--format'.

E2E Verification

  • just e2e-attest-python: 39 passed, 1 xfailed. The receipt is committed.
  • just e2e-attest-ts: passed. The receipt is committed.
  • cargo test --features cli for the context tests and the drift guard: passed.
  • just preflight with the colocated-test, one-function-per-file, unit-lint, integration-lint, unit-coverage, packaging and e2e-verify gates: 0 failing.
  • An earlier Python e2e attempt failed one speed-of-light timing test while the host load average was over 70. It passed once the load dropped.

Changelog / Migrations

  • packages/rust/changelog.d/2026-10-05-cli-context.md and migrations.d/ twin
  • packages/python/changelog.d/2026-10-05-cli-context.md and migrations.d/ twin
  • packages/ts/changelog.d/2026-10-05-cli-context.md and migrations.d/ twin

Parity

This is CLI-only. No SDK API changed, so PARITY.md has no drift.

Note: the guide lives under the root docs/context/, outside packages/*. A later edit that touches only the guide will not trigger a release by itself.

Red: the subcommand does not exist yet, so `dirsql context` runs the
word as SQL and fails. The drift guard runs every fenced example the
guide prints against a fixture tree that holds an empty metadata.json.
The guide is three markdown files under docs/context, compiled into the binary. The Python and TS launchers pass context through untouched, as they do init.
@thekevinbot
thekevinbot merged commit 434dfe2 into main Oct 5, 2026
84 checks passed
@thekevinbot
thekevinbot deleted the claude/1264-context branch October 5, 2026 16:38
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.

feat(cli): dirsql context prints the version-matched agent usage guide

1 participant