fix(import): expose JSON output for cache commands (#580)

This commit is contained in:
Ruifeng Xue
2026-09-16 15:23:09 +08:00
committed by GitHub
parent 119f3d2c1b
commit 4bc8542ddd
3 changed files with 34 additions and 0 deletions
+1
View File
@@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. See [standa
### 🐛 Bug Fixes
- `teamai import --cache-status` and `--cache-gc` now expose their existing JSON output through the CLI `--json` option.
- Course-correction matching normalizes prompts and keywords to Unicode NFC, so composed and decomposed accents match. Stored prompt summaries and the 60-second correction window are unchanged. Fixes [#573](https://github.com/Tencent/teamai-cli/issues/573).
- Course-correction detection matches keywords in space-separated scripts as whole words, so Spanish "segundo" no longer counts as `undo` (for [#564](https://github.com/Tencent/teamai-cli/issues/564)).
- MCP `requires` is resolved from `PATH` (including Windows `PATHEXT`), so `teamai mcp inject` no longer skips servers such as `uvx` on Windows ([#540](https://github.com/Tencent/teamai-cli/pull/540), for [#539](https://github.com/Tencent/teamai-cli/issues/539)).
+32
View File
@@ -0,0 +1,32 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
const originalArgv = process.argv;
afterEach(() => {
process.argv = originalArgv;
vi.restoreAllMocks();
vi.resetModules();
});
async function readImportHelp(): Promise<string> {
let output = '';
process.argv = ['node', 'teamai', 'import', '--help'];
vi.spyOn(process.stdout, 'write').mockImplementation((chunk) => {
output += String(chunk);
return true;
});
vi.spyOn(process, 'exit').mockImplementation(((code?: string | number | null) => {
throw new Error(`process.exit(${code})`);
}) as never);
await expect(import('../index.js')).rejects.toThrow('process.exit(0)');
return output;
}
describe('import command registration', () => {
it('lists JSON output for cache status and GC', async () => {
const output = await readImportHelp();
expect(output).toContain('--json');
expect(output).toContain('Output cache status or GC result as JSON');
});
});
+1
View File
@@ -878,6 +878,7 @@ program
.addOption(new Option('--require-review', 'Defer codebase section writes to .teamai/pending-review.jsonl for human review').hideHelp())
.option('--cache-status', 'Show import cache status (repos cached, disk usage)')
.option('--cache-gc', 'Garbage-collect stale import cache entries')
.option('--json', 'Output cache status or GC result as JSON')
.addOption(new Option('--max-bytes <n>', 'Override capacity cap for --cache-gc').hideHelp())
.addOption(new Option('--stale-days <n>', 'Threshold for stale-eviction in days (default 30)').default('30').hideHelp())
.action(async (cmdOpts) => {