fix(backend): tht --config is per-command, append after subcommand (not global -c)
Live end-to-end surfaced a 500 on every tht call: ThtRunner prepended
'-c <config>' before the subcommand, but tht has no global -c option
('No such option: -c'). --config/-c is a per-command option, so it must be
appended AFTER the subcommand. Extracted buildArgv() and fixed the unit test
that had codified the wrong (prepended) order.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -37,7 +37,16 @@ test("sessionNew with missing workspace file falls back to default configPath ar
|
||||
await r.sessionNew({ question: "q", workspace: "foo" });
|
||||
const [bin, argv] = (spawn as any).mock.calls[0];
|
||||
expect(bin).toBe("tht");
|
||||
expect(argv).toEqual(["-c", "config/tht.yaml", "session", "new", "q", "--json"]);
|
||||
// `--config`/`-c` is a PER-COMMAND option in tht (no global -c): it MUST follow
|
||||
// the subcommand, never precede it. (Prepending it caused a live 500 "No such option: -c".)
|
||||
expect(argv).toEqual(["session", "new", "q", "--json", "-c", "config/tht.yaml"]);
|
||||
});
|
||||
|
||||
test("buildArgv appends -c AFTER the subcommand (never a global -c)", () => {
|
||||
const r = new ThtRunner({ thtBin: "tht", harnessDir: "/nope", configPath: "config/tht.yaml" });
|
||||
expect(r.buildArgv(["session", "list", "--json"])).toEqual([
|
||||
"session", "list", "--json", "-c", "config/tht.yaml",
|
||||
]);
|
||||
});
|
||||
|
||||
test("sqlPreview argv has no positional file — uses --session to resolve path", async () => {
|
||||
|
||||
Reference in New Issue
Block a user