Repository navigation
feat(cli): dirsql context prints the version-matched agent usage guide - #1266
Merged
Merged
Conversation
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.
2 tasks done
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.
Fixes #1264
dirsql contextprints a usage guide for agents, matched to the running version. The first line isdirsql <version>, followed by the sections## Usage,## Recipesand## Troubleshooting. It takes no flags and exits 0.recipes.mdandtroubleshooting.md, ported todocs/context/*.md(1,363 words) and compiled into the binary withinclude_str!. Thepackages/rust/docssymlink means the files ship in the crate.node_modulesis skipped unless the path names it..gitis entered only when named.json_eachrecipe is guarded withjson_valid.*is one level,**is any depth, a named directory lists one level,.gitignoreis respected, and--no-ignoreturns that off.contextthrough untouched, as they already do forinit. Without that, installed plugins or a config extension would append flags thatcontextrejects.docs/context/**is excluded from VitePress, andreference/cli.mddocuments the subcommand.docs/context/.gitattributesforces LF, so the Windows binary does not embed CRLF.Tests
packages/rust/tests/context_integration.rschecks 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.rsis the drift guard. It runs every fenceduvx dirsql ...example from the printed guide against a fixture that includes an emptymetadata.json, and asserts each exits 0 with a JSON array.uvx --with dirsql-plugin-embeddings) is skipped because it downloads a model.json_validguard locally made the guard fail withmalformed JSON.cli/context.rs, theCommand::Contextparse and dispatch, and both launchers.SQLite error: near "context": syntax error.Manual run
I built the binary and ran it in an unrelated directory,
/tmp/ctx1264-manual:dirsql contextexited 0. Its first line wasdirsql 0.2.7, and the three##sections appeared in order.json_eachtags query over a directory containing an emptymetadata.jsonLIKEquery'./notes', which listed one level onlydirsql context --format jsonexited 2 withunexpected 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 clifor the context tests and the drift guard: passed.just preflightwith thecolocated-test,one-function-per-file,unit-lint,integration-lint,unit-coverage,packagingande2e-verifygates: 0 failing.Changelog / Migrations
packages/rust/changelog.d/2026-10-05-cli-context.mdandmigrations.d/twinpackages/python/changelog.d/2026-10-05-cli-context.mdandmigrations.d/twinpackages/ts/changelog.d/2026-10-05-cli-context.mdandmigrations.d/twinParity
This is CLI-only. No SDK API changed, so
PARITY.mdhas no drift.Note: the guide lives under the root
docs/context/, outsidepackages/*. A later edit that touches only the guide will not trigger a release by itself.