feat(cli): deprecation-warn raw-JSON args + full flag-ops smoke coverage#736
Merged
Conversation
Raw JSON (cli <tool> '{...}') still works for back-compat, but now emits a
deprecation warning to STDERR (stdout stays clean JSON for piping) nudging
users to flags / --args-file / stdin. Only the raw-JSON path warns.
Also make scripts/smoke-test.sh exercise the whole new CLI input surface
end-to-end against the built binary: every tool call migrated from raw JSON to
FLAG form (index_repository / search_graph / trace_path / get_graph_schema /
query_graph incl. all Cypher checks / get_architecture / search_code /
delete_project -- flag form passes the query as one argv token, so the old
JSON-escaping dance is gone), plus dedicated guards for an integer flag
(--limit / --depth), a bare boolean (--exclude-entry-points), a repeated array
flag (--semantic-query -> JSON array), piped stdin, --args-file, and per-tool
--help (RC 0 + shows a flag; unknown tool -> RC!=0). One raw-JSON call is kept
as the deprecation guard (asserts the warning fires; the flag form asserts it
does not).
Reproduce-first: reverting the warning makes the raw-JSON smoke assertion fail
("did not emit a deprecation warning"); restored -> green. Full smoke ALL
PASSED; C unit suite 5735/0 (unchanged -- only main.c + the smoke script).
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Companion to the raw-JSON deprecation warning committed on this branch (adds the
smoke coverage that was meant to land with it).
Migrate scripts/smoke-test.sh from raw-JSON `cli <tool> '{...}'` invocations to
FLAG form for every tool (index_repository / search_graph / trace_path /
get_graph_schema / query_graph incl. all Cypher checks / get_architecture /
search_code / delete_project), with identical results verified against a prior
run; flag form passes the Cypher query as one argv token, so the old
JSON-escaping helper is removed. Add dedicated guards for an integer flag
(--limit / --depth), a bare boolean (--exclude-entry-points), a repeated array
flag (--semantic-query -> JSON array), piped stdin, --args-file, and per-tool
--help (RC 0 + shows a flag; unknown tool -> RC!=0), plus the deprecation guard
(raw JSON warns on stderr; flag form does not). Non-CLI phases (incl. Phase 10
binary security) unchanged. Full smoke: ALL PASSED.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
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.
Keeps raw-JSON CLI back-compat but deprecation-warns it (per request), and turns the smoke test into a full end-to-end guard for the new flag surface.
Deprecation warning (
src/main.c,run_cliraw-JSON branch):cli <tool> '{...json...}'still works but prints to STDERR (stdout stays clean for piping):Only the raw-JSON path warns — flags /
--args-file/ stdin / empty don't.Comprehensive CLI smoke coverage (
scripts/smoke-test.sh) — now exercises the whole new input surface on the built binary:index_repository,search_graph(--name-pattern,--label),trace_path(--function-name --direction --depth),get_graph_schema,query_graph(all Cypher checks — flag form passes the query as one argv token, so the JSON-escaping dance is removed),get_architecture,search_code,delete_project.--limit/--depth), bare boolean (--exclude-entry-points), repeated array flag (--semantic-query send --semantic-query publish→ JSON array), piped stdin,--args-file, and per-tool--help(RC 0 + shows a flag; unknown tool → RC≠0).Reproduce-first: reverting the warning fails the raw-JSON smoke assertion ("did not emit a deprecation warning"); restored → green. Full
smoke-test.shALL PASSED; C unit suite 5735/0 (unchanged — onlymain.c+ the smoke script changed).Follow-up to the CLI-reliability series (#640/#680/#704/#719, + the
available_projectstruncation fix #735).