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:
2026-06-28 14:52:39 +02:00
co-authored by Claude Opus 4.8
parent 18843d7421
commit 1ee692cdb1
2 changed files with 20 additions and 2 deletions
+10 -1
View File
@@ -33,9 +33,18 @@ export class ThtRunner {
return ["-c", this.cfg.configPath];
}
/**
* Build the full argv for a `tht` invocation. `--config`/`-c` is a PER-COMMAND
* option in the `tht` CLI (there is NO global `-c`), so it MUST be appended
* AFTER the subcommand + its flags, never prepended.
*/
buildArgv(args: string[], workspace?: string): string[] {
return [...args, ...this.configArg(workspace)];
}
run(args: string[], workspace?: string): Promise<{ code: number; stdout: string; stderr: string }> {
return new Promise((resolve) => {
const ch = spawn(this.cfg.thtBin, [...this.configArg(workspace), ...args], {
const ch = spawn(this.cfg.thtBin, this.buildArgv(args, workspace), {
cwd: this.cfg.harnessDir,
});
let stdout = "";