[defer] fix embedded CLIProxyAPI config handling (#6877)

* fix embedded CLIProxyAPI config flag

* preserve embedded CLIProxyAPI config

* test(services): add fs-backed regression test for cliproxy resolveSpawnArgs (#6877)

The existing cliproxy.test.ts only re-asserted string literals and never
called the real resolveSpawnArgs() against a filesystem, so it could not
have caught the -c/--config flag mismatch or the config.yaml clobbering
bug this PR fixes. Add a test that imports the real function against a
temp DATA_DIR and asserts: the spawn args always use --config (never -c),
a missing config.yaml gets the default template, and an existing
operator-customized config.yaml is left byte-identical.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
This commit is contained in:
NSK
2026-07-22 04:30:31 +09:00
committed by GitHub
parent edbce2e35b
commit 0844163966
2 changed files with 108 additions and 2 deletions

View File

@@ -105,11 +105,13 @@ export function resolveSpawnArgs(port: number): SpawnArgs {
fs.mkdirSync(CONFIG_DIR, { recursive: true });
const configPath = path.join(CONFIG_DIR, "config.yaml");
fs.writeFileSync(configPath, `port: ${port}\nhost: 127.0.0.1\nlog_level: warn\n`, "utf8");
if (!fs.existsSync(configPath)) {
fs.writeFileSync(configPath, `port: ${port}\nhost: 127.0.0.1\nlog_level: warn\n`, "utf8");
}
return {
command: symlinkPath,
args: ["-c", configPath],
args: ["--config", configPath],
env: { ...process.env },
cwd: CONFIG_DIR,
};