Skip to content

Commit 5c92f5c

Browse files
committed
feat(cli): deprecation-warn raw-JSON args + full flag-ops smoke coverage
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>
1 parent 4a42285 commit 5c92f5c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎src/main.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,13 @@ static int run_cli(int argc, char **argv) {
343343
}
344344
args_json = heap_args;
345345
} else if (rem_argc >= SKIP_ONE && cli_first_nonspace_is_brace(rem_argv[0])) {
346-
/* raw-JSON back-compat: cli <tool> '{"k":"v"}' */
346+
/* raw-JSON back-compat: cli <tool> '{"k":"v"}' (deprecated path). Warn on
347+
* STDERR only — stdout must stay clean JSON for piping. */
348+
(void)fprintf(stderr,
349+
"warning: passing raw JSON to 'cli %s' is deprecated and "
350+
"will be removed in a future release; use flags (run 'cli "
351+
"%s --help'), --args-file <path>, or piped stdin.\n",
352+
tool_name, tool_name);
347353
args_json = rem_argv[0];
348354
} else if (rem_argc >= SKIP_ONE && strncmp(rem_argv[0], "--", 2) == 0) {
349355
/* flag form: cli <tool> --flag value --bare-bool ... */

0 commit comments

Comments
 (0)