feat(cli): surface stored-query @description/@instruction in queries list#280
Merged
Merged
Conversation
Add end-to-end tests pinning the two annotation surfaces as they exist today, at their real boundaries: - engine (lifecycle.rs): schema-level @description (node/edge/property) and @Instruction (node/edge) persist verbatim into the on-disk _schema.ir.json through Omnigraph::init; property-level @Instruction aborts init and writes no schema IR. - server (stored_queries.rs): query-level @description/@Instruction on a stored query surface as typed QueryCatalogEntry fields over GET /queries, and a query declaring neither omits both fields. No behavior change — these document the current contract. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… list` A stored query's @description/@Instruction are its catalog metadata — what it does and how to invoke it. The HTTP GET /queries catalog already carries them, but `omnigraph queries list` dropped both fields in human and --json output even though they were available on the registry entry. Carry description/instruction on QueriesListItem (Option, skipped when None) and copy them from the query decl. Human output prints an indented `description:` / `instruction:` line per query when present; --json includes the fields when present and omits them otherwise — matching the HTTP catalog shape documented in docs/user/operations/server.md. Tests (cli_queries.rs): a query with both annotations surfaces them in human + --json; a query with neither prints no annotation lines and omits both JSON fields. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Per AGENTS.md maintenance Rule 1, document the user-visible `queries list` output alongside the field addition. The `queries` command family had no row in the CLI reference top-level table; add one covering `list` (human + --json shapes, with description/instruction shown only when declared, matching the HTTP GET /queries catalog) and `validate`. Addresses the Greptile P2 review finding on PR #280. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
martin-g
reviewed
Jun 19, 2026
A `@description`/`@instruction` value can be multiline (GQ string literals admit newlines), which made the human `queries list` output break back to the left margin on continuation lines. Indent continuation lines to align under the first via a `print_query_annotation` helper. Addresses review feedback from @martin-g on PR #280. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-description-instruction
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
omnigraph queries listnow surfaces a stored query's@descriptionand@instruction— its catalog metadata (what the query does and how to invoke it) — in both human and--jsonoutput.Previously the CLI dropped both fields even though they were available on the registry entry, while the HTTP
GET /queriescatalog already carried them. This closes that asymmetry.Behavior (the agreed shape)
@description→ prints thedescription:line and the JSONdescriptionfield.@instruction→ prints theinstruction:line and the JSONinstructionfield.skip_serializing_if = "Option::is_none").This matches the HTTP catalog shape documented in
docs/user/operations/server.md({ name, tool_name, description, instruction, mutation, params }).Example human output:
Commits
@description/@instructionpersisting into_schema.ir.json(enginelifecycle.rs) and query-level annotations surfacing overGET /queries(serverstored_queries.rs). No behavior change.queries listchange + CLI tests for both halves of the contract (present → shown, absent → omitted).Scope note
Only the query-catalog surface changed. Schema-type-level
@description/@instruction(on nodes/edges/props) still have no dedicated CLI surface beyond rawschema showsource — that's a separate use case (schema documentation, not invocation guidance) and was intentionally left out.Tests
All green (full files):
omnigraph-enginelifecycle: 14 passedomnigraph-serverstored_queries: 14 passedomnigraph-clicli_queries: 12 passed🤖 Generated with Claude Code
Greptile Summary
This PR surfaces stored-query
@descriptionand@instructionannotations inomnigraph queries list, closing the asymmetry between the CLI catalog and the HTTPGET /queriesendpoint that already carried both fields. The change is purely additive — new optional fields inQueriesListItemwithskip_serializing_if, a small formatting helper for multiline values in human output, and a documentation row in the CLI reference.helpers.rs/output.rs: wiresq.decl.descriptionandq.decl.instructioninto theQueriesListItemDTO and prints them as indented annotation lines in human mode;--jsonoutput omits both fields when absent, matching theQueryCatalogEntryshape already inomnigraph-api-types..gqsource throughGET /queries.queries list | validaterow indocs/user/cli/reference.mddocuments the human and--jsonoutput shapes, including when optional fields appear.Confidence Score: 5/5
Safe to merge — purely additive output change with no modifications to storage, server logic, or existing behavior.
The change reads two already-populated fields from an existing struct, adds them to a display DTO with skip_serializing_if, and prints them conditionally. No data path, mutation path, or auth path is touched. Tests cover both the presence and absence contract in human and JSON modes.
No files require special attention.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[".gq source file\n@description / @instruction"] -->|parsed by compiler| B["QueryDecl\n(decl.description, decl.instruction)"] B -->|stored in registry| C["Cluster snapshot\n(queries registry)"] C -->|HTTP GET /queries| D["QueryCatalogEntry\n{name, tool_name, description?, instruction?, mutation, params}"] C -->|CLI: queries list| E["QueriesListItem\n{name, mcp_expose, tool_name, mutation, description?, instruction?, params}"] E -->|human output| F["kind name(params)\n description: …\n instruction: …"] E -->|--json output| G["JSON: fields omitted\nwhen None"] D -->|omnigraph-ts SDK| H["TypeScript QueryCatalogEntry\n{description?, instruction?, …}"]%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% flowchart TD A[".gq source file\n@description / @instruction"] -->|parsed by compiler| B["QueryDecl\n(decl.description, decl.instruction)"] B -->|stored in registry| C["Cluster snapshot\n(queries registry)"] C -->|HTTP GET /queries| D["QueryCatalogEntry\n{name, tool_name, description?, instruction?, mutation, params}"] C -->|CLI: queries list| E["QueriesListItem\n{name, mcp_expose, tool_name, mutation, description?, instruction?, params}"] E -->|human output| F["kind name(params)\n description: …\n instruction: …"] E -->|--json output| G["JSON: fields omitted\nwhen None"] D -->|omnigraph-ts SDK| H["TypeScript QueryCatalogEntry\n{description?, instruction?, …}"]Reviews (5): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile