mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-30 22:13:28 +08:00
fix: harden consult argument parsing
This commit is contained in:
committed by
Affaan Mustafa
parent
9a3f72712b
commit
08d6c82989
@@ -48,6 +48,13 @@ function runTests() {
|
||||
assert.match(result.stdout, /node scripts\/consult\.js "security reviews"/);
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('shows help even when other flags would be invalid', () => {
|
||||
const result = run(['--help', '--target', 'not-a-target']);
|
||||
|
||||
assert.strictEqual(result.status, 0, result.stderr);
|
||||
assert.match(result.stdout, /Consult ECC install components/);
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('recommends security components and profile for a natural language query', () => {
|
||||
const result = run(['security', 'reviews', '--json']);
|
||||
|
||||
@@ -108,6 +115,13 @@ function runTests() {
|
||||
assert.match(result.stderr, /Unknown install target/);
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('rejects flag-like target values as missing target names', () => {
|
||||
const result = run(['security', '--target', '--json']);
|
||||
|
||||
assert.strictEqual(result.status, 1);
|
||||
assert.match(result.stderr, /Missing value for --target/);
|
||||
})) passed++; else failed++;
|
||||
|
||||
console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);
|
||||
process.exit(failed > 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user