code-auditor-mcp 3.9.0 โ 3.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +95 -0
- package/README.md +1 -0
- package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.d.ts +14 -0
- package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.js +16 -0
- package/dist/__tests__/fixtures/spec-52/item-01-prepare-in-loop.js.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.d.ts +15 -0
- package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.js +17 -0
- package/dist/__tests__/fixtures/spec-52/item-02-prepare-bind-accumulate-batch.js.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts +14 -0
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js +13 -0
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts +24 -0
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js +19 -0
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.d.ts +19 -0
- package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.js +19 -0
- package/dist/__tests__/fixtures/spec-52/item-05-upsert-forms.js.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts +17 -0
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.js +19 -0
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.js.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts +25 -0
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.js +21 -0
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.js.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.d.ts +15 -0
- package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.js +19 -0
- package/dist/__tests__/fixtures/spec-52/item-08-promise-all-of-statements-in-loop.js.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.d.ts +14 -0
- package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.js +14 -0
- package/dist/__tests__/fixtures/spec-52/item-09-promise-all-map-of-statements-in-loop.js.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts +15 -0
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts.map +1 -0
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.js +16 -0
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.js.map +1 -0
- package/dist/analyzers/analyzerUtils.js +2 -2
- package/dist/analyzers/analyzerUtils.js.map +1 -1
- package/dist/analyzers/applicability.d.ts +38 -0
- package/dist/analyzers/applicability.d.ts.map +1 -1
- package/dist/analyzers/applicability.js +55 -0
- package/dist/analyzers/applicability.js.map +1 -1
- package/dist/analyzers/cross-language/APIContractAnalyzer.js +5 -5
- package/dist/analyzers/cross-language/APIContractAnalyzer.js.map +1 -1
- package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts +1 -1
- package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts.map +1 -1
- package/dist/analyzers/cross-language/DependencyGraphBuilder.js +7 -7
- package/dist/analyzers/cross-language/DependencyGraphBuilder.js.map +1 -1
- package/dist/analyzers/cross-language/SchemaValidator.d.ts +11 -0
- package/dist/analyzers/cross-language/SchemaValidator.d.ts.map +1 -1
- package/dist/analyzers/cross-language/SchemaValidator.js +35 -59
- package/dist/analyzers/cross-language/SchemaValidator.js.map +1 -1
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.d.ts +3 -2
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js +9 -8
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js.map +1 -1
- package/dist/analyzers/documentationAnalyzer.js +5 -5
- package/dist/analyzers/documentationAnalyzer.js.map +1 -1
- package/dist/analyzers/invariantsAnalyzer.js +1 -1
- package/dist/analyzers/invariantsAnalyzer.js.map +1 -1
- package/dist/analyzers/reactAnalyzer.d.ts +1 -1
- package/dist/analyzers/reactAnalyzer.js +13 -13
- package/dist/analyzers/reactAnalyzer.js.map +1 -1
- package/dist/analyzers/ruleRegistry.d.ts +3 -4
- package/dist/analyzers/ruleRegistry.d.ts.map +1 -1
- package/dist/analyzers/ruleRegistry.js.map +1 -1
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts +2 -2
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.js +7 -7
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts +6 -6
- package/dist/analyzers/universal/UniversalDRYAnalyzer.js +12 -12
- package/dist/analyzers/universal/UniversalDRYAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts +7 -0
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +118 -12
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.d.ts +2 -2
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js +8 -8
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts +9 -2
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js +77 -15
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts +1 -1
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.js +2 -2
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts +1 -1
- package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalStylesAnalyzer.js +12 -24
- package/dist/analyzers/universal/UniversalStylesAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/schema/codeAnalysis.d.ts +19 -5
- package/dist/analyzers/universal/schema/codeAnalysis.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/codeAnalysis.js +42 -19
- package/dist/analyzers/universal/schema/codeAnalysis.js.map +1 -1
- package/dist/analyzers/universal/schema/discovery.js +1 -1
- package/dist/analyzers/universal/schema/discovery.js.map +1 -1
- package/dist/analyzers/universal/schema/jsonSchema.js +19 -19
- package/dist/analyzers/universal/schema/jsonSchema.js.map +1 -1
- package/dist/analyzers/universal/schema/violations.d.ts +1 -1
- package/dist/analyzers/universal/schema/violations.d.ts.map +1 -1
- package/dist/auditRouter.d.ts.map +1 -1
- package/dist/auditRouter.js +4 -6
- package/dist/auditRouter.js.map +1 -1
- package/dist/auditRunner.d.ts.map +1 -1
- package/dist/auditRunner.js +11 -12
- package/dist/auditRunner.js.map +1 -1
- package/dist/cli.js +42 -80
- package/dist/cli.js.map +1 -1
- package/dist/config/configLoader.d.ts.map +1 -1
- package/dist/config/configLoader.js +1 -16
- package/dist/config/configLoader.js.map +1 -1
- package/dist/config/defaults.d.ts +1 -8
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +8 -31
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/effectiveConfig.d.ts +4 -4
- package/dist/config/effectiveConfig.js +4 -4
- package/dist/daemon/lspServer.js +2 -2
- package/dist/daemon/lspServer.js.map +1 -1
- package/dist/enforcement/gate.d.ts +1 -1
- package/dist/enforcement/gate.d.ts.map +1 -1
- package/dist/enforcement/gate.js +10 -9
- package/dist/enforcement/gate.js.map +1 -1
- package/dist/generators/AWSQConfigGenerator.js +1 -1
- package/dist/generators/AWSQConfigGenerator.js.map +1 -1
- package/dist/generators/AiderConfigGenerator.js +1 -1
- package/dist/generators/AiderConfigGenerator.js.map +1 -1
- package/dist/generators/ClaudeConfigGenerator.js +1 -1
- package/dist/generators/ClaudeConfigGenerator.js.map +1 -1
- package/dist/generators/ClineConfigGenerator.js +1 -1
- package/dist/generators/ClineConfigGenerator.js.map +1 -1
- package/dist/generators/CodeiumConfigGenerator.js +1 -1
- package/dist/generators/CodeiumConfigGenerator.js.map +1 -1
- package/dist/generators/CodexConfigGenerator.js +1 -1
- package/dist/generators/CodexConfigGenerator.js.map +1 -1
- package/dist/generators/ConfigGeneratorFactory.d.ts.map +1 -1
- package/dist/generators/ConfigGeneratorFactory.js +2 -0
- package/dist/generators/ConfigGeneratorFactory.js.map +1 -1
- package/dist/generators/ContinueConfigGenerator.js +1 -1
- package/dist/generators/CopilotConfigGenerator.js +1 -1
- package/dist/generators/CopilotConfigGenerator.js.map +1 -1
- package/dist/generators/CursorConfigGenerator.js +1 -1
- package/dist/generators/CursorConfigGenerator.js.map +1 -1
- package/dist/generators/GeminiConfigGenerator.js +2 -2
- package/dist/generators/GeminiConfigGenerator.js.map +1 -1
- package/dist/generators/JetBrainsConfigGenerator.js +1 -1
- package/dist/generators/JetBrainsConfigGenerator.js.map +1 -1
- package/dist/generators/VSCodeConfigGenerator.js +1 -1
- package/dist/generators/VSCodeConfigGenerator.js.map +1 -1
- package/dist/generators/ZCodeConfigGenerator.d.ts +21 -0
- package/dist/generators/ZCodeConfigGenerator.d.ts.map +1 -0
- package/dist/generators/ZCodeConfigGenerator.js +64 -0
- package/dist/generators/ZCodeConfigGenerator.js.map +1 -0
- package/dist/generators/index.d.ts +3 -2
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +3 -2
- package/dist/generators/index.js.map +1 -1
- package/dist/hooks/codex.d.ts +2 -2
- package/dist/hooks/codex.d.ts.map +1 -1
- package/dist/hooks/codex.js +22 -37
- package/dist/hooks/codex.js.map +1 -1
- package/dist/hooks/core.d.ts +2 -2
- package/dist/hooks/core.d.ts.map +1 -1
- package/dist/hooks/core.js +6 -6
- package/dist/hooks/core.js.map +1 -1
- package/dist/hooks/cursor.d.ts +1 -1
- package/dist/hooks/cursor.d.ts.map +1 -1
- package/dist/hooks/cursor.js +18 -37
- package/dist/hooks/cursor.js.map +1 -1
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +8 -0
- package/dist/installer.js.map +1 -1
- package/dist/invariants/invariant-rules.schema.json +1 -1
- package/dist/invariants/ruleValidator.js +1 -1
- package/dist/invariants/ruleValidator.js.map +1 -1
- package/dist/invariants/types.d.ts +1 -1
- package/dist/invariants/types.d.ts.map +1 -1
- package/dist/languages/LanguageOrchestrator.d.ts +2 -19
- package/dist/languages/LanguageOrchestrator.d.ts.map +1 -1
- package/dist/languages/LanguageOrchestrator.js +23 -50
- package/dist/languages/LanguageOrchestrator.js.map +1 -1
- package/dist/languages/RuntimeManager.js +2 -2
- package/dist/languages/RuntimeManager.js.map +1 -1
- package/dist/languages/UniversalAnalyzer.d.ts +2 -13
- package/dist/languages/UniversalAnalyzer.d.ts.map +1 -1
- package/dist/languages/UniversalAnalyzer.js +2 -23
- package/dist/languages/UniversalAnalyzer.js.map +1 -1
- package/dist/languages/go/analyzer +0 -0
- package/dist/languages/go/analyzer-src/analyzer.go +8 -8
- package/dist/languages/go/analyzer-src/solid.go +6 -6
- package/dist/ledger.js +1 -1
- package/dist/ledger.js.map +1 -1
- package/dist/mcp-tools/projectTasks.d.ts.map +1 -1
- package/dist/mcp-tools/projectTasks.js +4 -5
- package/dist/mcp-tools/projectTasks.js.map +1 -1
- package/dist/mcp-tools/whitelistTools.d.ts +1 -1
- package/dist/mcp-tools/workflowGuide.js +3 -3
- package/dist/mcp-tools/workflowGuide.js.map +1 -1
- package/dist/mcp-tools-shared.d.ts.map +1 -1
- package/dist/mcp-tools-shared.js +22 -21
- package/dist/mcp-tools-shared.js.map +1 -1
- package/dist/mcp-ui-simple.js +15 -15
- package/dist/mcp-ui-simple.js.map +1 -1
- package/dist/mcp.js +24 -22
- package/dist/mcp.js.map +1 -1
- package/dist/mcpAuditJobs.js +14 -14
- package/dist/mcpAuditJobs.js.map +1 -1
- package/dist/mcpAutoIndex.js +1 -1
- package/dist/mcpAutoIndex.js.map +1 -1
- package/dist/nextFile.d.ts +2 -2
- package/dist/nextFile.d.ts.map +1 -1
- package/dist/nextFile.js +4 -5
- package/dist/nextFile.js.map +1 -1
- package/dist/nextFileIncremental.d.ts +2 -2
- package/dist/nextFileIncremental.d.ts.map +1 -1
- package/dist/nextFileIncremental.js +7 -7
- package/dist/nextFileIncremental.js.map +1 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +16 -9
- package/dist/pipeline.js.map +1 -1
- package/dist/pipelineAdapters.d.ts.map +1 -1
- package/dist/pipelineAdapters.js +25 -11
- package/dist/pipelineAdapters.js.map +1 -1
- package/dist/reporting/csvReportGenerator.js +7 -7
- package/dist/reporting/csvReportGenerator.js.map +1 -1
- package/dist/reporting/htmlReportGenerator.js +18 -18
- package/dist/reporting/htmlReportGenerator.js.map +1 -1
- package/dist/reporting/jsonReportGenerator.js +3 -3
- package/dist/reporting/jsonReportGenerator.js.map +1 -1
- package/dist/reporting/sarifReportGenerator.js +3 -3
- package/dist/reporting/sarifReportGenerator.js.map +1 -1
- package/dist/scripts/benchmarkWorkers.js +1 -1
- package/dist/scripts/benchmarkWorkers.js.map +1 -1
- package/dist/types/crossLanguage.d.ts +1 -1
- package/dist/types/crossLanguage.d.ts.map +1 -1
- package/dist/types.d.ts +26 -24
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -1
- package/package.json +6 -3
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/skills/code-auditor/SKILL-RULE-KINDS.md +25 -23
- package/plugin/skills/code-auditor/SKILL.md +9 -9
- package/server.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,6 @@ import { promises as fs } from 'fs';
|
|
|
13
13
|
import { createInterface } from 'readline';
|
|
14
14
|
import { fileURLToPath } from 'url';
|
|
15
15
|
import { dirname, isAbsolute, join, relative, resolve } from 'path';
|
|
16
|
-
import { DEFAULT_PORT } from './constants.js';
|
|
17
16
|
import inquirer from 'inquirer';
|
|
18
17
|
import { CodeMapGenerator } from './services/CodeMapGenerator.js';
|
|
19
18
|
import { initParsers } from './languages/index.js';
|
|
@@ -23,7 +22,7 @@ import { getFilesProcessed, getFactsConsumed, isVisitorStatus, isReducerStatus }
|
|
|
23
22
|
import { createBaselineFromFindings, saveBaseline, loadBaseline, diffBaselines } from './baseline.js';
|
|
24
23
|
import { ALL_ANALYZERS } from './analyzers/ruleRegistry.js';
|
|
25
24
|
import { computeGatingDecision } from './enforcement/gate.js';
|
|
26
|
-
import {
|
|
25
|
+
import { BLOCKING_SEVERITIES } from './types.js';
|
|
27
26
|
import { rankFilesByPriority, orderFindingsWithinFile } from './nextFile.js';
|
|
28
27
|
import { runNextFile } from './nextFileIncremental.js';
|
|
29
28
|
import { describeSqliteBackend } from './sqlite/driver.js';
|
|
@@ -114,7 +113,7 @@ program
|
|
|
114
113
|
try {
|
|
115
114
|
await initParsers();
|
|
116
115
|
// Validate --fail-on severity
|
|
117
|
-
const validSeverities = ['critical', '
|
|
116
|
+
const validSeverities = ['critical', 'severe', 'high'];
|
|
118
117
|
const failOnSeverity = options.failOn;
|
|
119
118
|
if (failOnSeverity && !validSeverities.includes(failOnSeverity)) {
|
|
120
119
|
console.error(chalk.red(`Invalid --fail-on severity: "${failOnSeverity}". Must be one of: ${validSeverities.join(', ')}`));
|
|
@@ -173,7 +172,7 @@ program
|
|
|
173
172
|
console.log(chalk.gray(`\nโโ New readings (${newViolations.length}) โโโโโโโโโโโโโโโโโโโโโโโโโโ`));
|
|
174
173
|
for (const v of newViolations) {
|
|
175
174
|
const icon = v.severity === 'critical' ? '๐ด' :
|
|
176
|
-
v.severity === '
|
|
175
|
+
v.severity === 'severe' ? '๐ ' : '๐ก';
|
|
177
176
|
console.log(`${icon} ${chalk.bold(v.file)}${v.line ? `:${v.line}` : ''} [${v.severity}] ${v.message}`);
|
|
178
177
|
}
|
|
179
178
|
}
|
|
@@ -218,18 +217,18 @@ program
|
|
|
218
217
|
// No baseline: current behavior + hint
|
|
219
218
|
console.log(`\nFound ${result.summary.totalViolations} readings`);
|
|
220
219
|
console.log(`Critical: ${result.summary.criticalIssues}`);
|
|
221
|
-
console.log(`
|
|
222
|
-
console.log(`
|
|
223
|
-
console.log(chalk.gray(`\nEvery reading is a
|
|
220
|
+
console.log(`Severe: ${result.summary.severe}`);
|
|
221
|
+
console.log(`High: ${result.summary.high}`);
|
|
222
|
+
console.log(chalk.gray(`\nEvery reading is a defect โ severity is urgency, the order to act.`));
|
|
224
223
|
console.log(chalk.gray(`\n๐ก Run ${chalk.cyan('code-audit baseline')} to adopt the ratchet and track changes over time.`));
|
|
225
224
|
}
|
|
226
225
|
else {
|
|
227
226
|
// --full with baseline: full itemized inventory (current behavior)
|
|
228
227
|
console.log(`\nFound ${result.summary.totalViolations} readings`);
|
|
229
228
|
console.log(`Critical: ${result.summary.criticalIssues}`);
|
|
230
|
-
console.log(`
|
|
231
|
-
console.log(`
|
|
232
|
-
console.log(chalk.gray(`\nEvery reading is a
|
|
229
|
+
console.log(`Severe: ${result.summary.severe}`);
|
|
230
|
+
console.log(`High: ${result.summary.high}`);
|
|
231
|
+
console.log(chalk.gray(`\nEvery reading is a defect โ severity is urgency, the order to act.`));
|
|
233
232
|
}
|
|
234
233
|
// Spec 44 R4 โ file accounting: analyzed/dropped totals + optional breakdown.
|
|
235
234
|
printFileAccounting(result, !!options.explainSkipped);
|
|
@@ -319,11 +318,12 @@ program
|
|
|
319
318
|
}
|
|
320
319
|
}
|
|
321
320
|
// Spec-20 R4: built-in profile visibility โ silent behavior changes
|
|
322
|
-
// are never acceptable. Notify when scripts-and-tests
|
|
321
|
+
// are never acceptable. Notify when scripts-and-tests excludes findings
|
|
322
|
+
// from the blocking gate.
|
|
323
323
|
const builtinCapped = Object.values(result.analyzerResults)
|
|
324
324
|
.reduce((count, ar) => count + ar.violations.filter(v => v.profile === 'scripts-and-tests').length, 0);
|
|
325
325
|
if (builtinCapped > 0) {
|
|
326
|
-
console.log(chalk.blue(`\nโน๏ธ ${builtinCapped.toLocaleString()} readings
|
|
326
|
+
console.log(chalk.blue(`\nโน๏ธ ${builtinCapped.toLocaleString()} readings excluded from the blocking gate by built-in profile "scripts-and-tests" (scripts/tests/fixtures).`));
|
|
327
327
|
console.log(chalk.gray(` Set ${chalk.cyan('"builtin": false')} in .codeauditor.json to disable.`));
|
|
328
328
|
}
|
|
329
329
|
// Generate formatted report if --format is specified
|
|
@@ -378,7 +378,7 @@ program
|
|
|
378
378
|
const evaluableViolations = (baseline && !options.includeBaseline)
|
|
379
379
|
? violations.filter((v) => v.new || v.analyzer === 'invariants')
|
|
380
380
|
: violations;
|
|
381
|
-
const severityOrder = ['critical', '
|
|
381
|
+
const severityOrder = ['critical', 'severe', 'high'];
|
|
382
382
|
const failIndex = severityOrder.indexOf(failOnSeverity);
|
|
383
383
|
const hasAtOrAbove = evaluableViolations.some((v) => {
|
|
384
384
|
const vIndex = severityOrder.indexOf(v.severity);
|
|
@@ -466,16 +466,13 @@ program
|
|
|
466
466
|
}
|
|
467
467
|
// Collect all violations
|
|
468
468
|
const violations = Object.values(result.analyzerResults).flatMap((r) => r.violations || []);
|
|
469
|
-
// Blocking gate decision (Spec 45 R1/
|
|
469
|
+
// Blocking gate decision (Spec 45 R1/R4, Spec 54 R3), computed once so the
|
|
470
470
|
// agent-facing before/after count (Spec 45 A2) and the exit code agree on
|
|
471
|
-
// the same number. Every registered rule participates (R1);
|
|
472
|
-
//
|
|
473
|
-
//
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
? configuredGateSeverities
|
|
477
|
-
: DEFAULT_BLOCKING_SEVERITIES);
|
|
478
|
-
const { blocking, resolutionGaps } = computeGatingDecision(violations, blockingSeverities);
|
|
471
|
+
// the same number. Every registered rule participates (R1); enforcement is
|
|
472
|
+
// not diff-scoped (R4). Spec 54: the blocking set is the fixed all-three
|
|
473
|
+
// {critical, severe, high} โ every finding is a defect and every finding
|
|
474
|
+
// blocks; there is no configurable gate.
|
|
475
|
+
const { blocking, resolutionGaps } = computeGatingDecision(violations, BLOCKING_SEVERITIES);
|
|
479
476
|
// JSON output
|
|
480
477
|
if (options.format === 'sarif') {
|
|
481
478
|
const { generateSARIFReport } = await import('./reporting/sarifReportGenerator.js');
|
|
@@ -528,7 +525,7 @@ program
|
|
|
528
525
|
console.log(chalk.gray('โโ Violations โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ'));
|
|
529
526
|
for (const v of violations) {
|
|
530
527
|
const icon = v.severity === 'critical' ? '๐ด' :
|
|
531
|
-
v.severity === '
|
|
528
|
+
v.severity === 'severe' ? '๐ ' : '๐ก';
|
|
532
529
|
const statusTag = v.new === false
|
|
533
530
|
? chalk.dim(' [known โ still open]')
|
|
534
531
|
: '';
|
|
@@ -631,9 +628,8 @@ function printCountSummary(violations) {
|
|
|
631
628
|
}
|
|
632
629
|
/**
|
|
633
630
|
* Reconstruct a `changed`-compatible result from daemon-served diagnostics so the
|
|
634
|
-
* gate/output logic below stays identical to the in-process path.
|
|
635
|
-
*
|
|
636
|
-
* `gateSeverities` never diverges from what the in-process run would have used.
|
|
631
|
+
* gate/output logic below stays identical to the in-process path. The blocking
|
|
632
|
+
* set is the fixed all-three set (Spec 54 R3) โ there is no config to read.
|
|
637
633
|
*/
|
|
638
634
|
async function buildChangedResultFromDiagnostics(violations, projectRoot) {
|
|
639
635
|
const analyzerResults = {};
|
|
@@ -641,23 +637,11 @@ async function buildChangedResultFromDiagnostics(violations, projectRoot) {
|
|
|
641
637
|
const key = v.analyzer || 'unknown';
|
|
642
638
|
(analyzerResults[key] = analyzerResults[key] || { violations: [] }).violations.push(v);
|
|
643
639
|
}
|
|
644
|
-
|
|
645
|
-
try {
|
|
646
|
-
const { findConfigFileUp, loadConfig } = await import('./config/configLoader.js');
|
|
647
|
-
const configPath = await findConfigFileUp(projectRoot);
|
|
648
|
-
const config = await loadConfig({ configPath: configPath ?? undefined });
|
|
649
|
-
if (Array.isArray(config.gateSeverities) && config.gateSeverities.length > 0) {
|
|
650
|
-
configUsed = { gateSeverities: config.gateSeverities };
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
catch {
|
|
654
|
-
// No config โ the gate falls back to DEFAULT_BLOCKING_SEVERITIES, matching in-process.
|
|
655
|
-
}
|
|
656
|
-
return { analyzerResults, metadata: { configUsed, diagnostics: [] } };
|
|
640
|
+
return { analyzerResults, metadata: { configUsed: undefined, diagnostics: [] } };
|
|
657
641
|
}
|
|
658
642
|
// Self-audit gate (Spec 33 Item 15 + Spec 44 remediation). Runs the full
|
|
659
643
|
// analyzer pipeline over the tool's own production source and asserts zero
|
|
660
|
-
// *blocking* (critical/
|
|
644
|
+
// *blocking* (critical/severe/high) findings in the self-audit scope โ the same
|
|
661
645
|
// scope + severity contract as scripts/verify-self.mjs, but callable from the
|
|
662
646
|
// shipped CLI so the edit-time plugin hook can enforce it. `verify:self` (the
|
|
663
647
|
// release gate) stays authoritative; this command is its per-edit sibling.
|
|
@@ -690,11 +674,11 @@ program
|
|
|
690
674
|
.option('--json', 'Output violations as machine-readable JSON to stdout')
|
|
691
675
|
.option('--stdin', 'Read file paths from stdin (one per line)')
|
|
692
676
|
.option('-p, --path <projectPath>', 'Project root path', process.cwd())
|
|
693
|
-
.option('--fail-on <severity>', 'Blocking severity floor: critical,
|
|
677
|
+
.option('--fail-on <severity>', 'Blocking severity floor: critical, severe, or high', 'high')
|
|
694
678
|
.action(async (paths, options) => {
|
|
695
679
|
try {
|
|
696
680
|
await initParsers();
|
|
697
|
-
const validSeverities = ['critical', '
|
|
681
|
+
const validSeverities = ['critical', 'severe', 'high'];
|
|
698
682
|
const failOnSeverity = options.failOn;
|
|
699
683
|
if (!validSeverities.includes(failOnSeverity)) {
|
|
700
684
|
console.error(chalk.red(`Invalid --fail-on severity: "${failOnSeverity}". Must be one of: ${validSeverities.join(', ')}`));
|
|
@@ -731,7 +715,7 @@ program
|
|
|
731
715
|
});
|
|
732
716
|
const result = await runner.run();
|
|
733
717
|
const violations = Object.values(result.analyzerResults).flatMap((r) => r.violations || []);
|
|
734
|
-
const severityOrder = ['critical', '
|
|
718
|
+
const severityOrder = ['critical', 'severe', 'high'];
|
|
735
719
|
const failIndex = severityOrder.indexOf(failOnSeverity);
|
|
736
720
|
const blocking = violations.filter((v) => {
|
|
737
721
|
if (!isSelfAuditInScope(v.file ?? ''))
|
|
@@ -771,7 +755,7 @@ program
|
|
|
771
755
|
printCountSummary(blocking);
|
|
772
756
|
for (const v of blocking) {
|
|
773
757
|
const icon = v.severity === 'critical' ? '๐ด' :
|
|
774
|
-
v.severity === '
|
|
758
|
+
v.severity === 'severe' ? '๐ ' : '๐ก';
|
|
775
759
|
console.log(`${icon} ${v.file}${v.line ? `:${v.line}` : ''} [${v.severity}] ${v.message}`);
|
|
776
760
|
}
|
|
777
761
|
}
|
|
@@ -848,7 +832,7 @@ function printNextFile(violations, summary, projectDir, json) {
|
|
|
848
832
|
return;
|
|
849
833
|
}
|
|
850
834
|
const top = ranked[0];
|
|
851
|
-
// Every issue on the file, ordered critical โ
|
|
835
|
+
// Every issue on the file, ordered critical โ severe โ high.
|
|
852
836
|
const ordered = orderFindingsWithinFile(top.violations);
|
|
853
837
|
const relativize = (filePath) => {
|
|
854
838
|
if (!filePath)
|
|
@@ -892,7 +876,7 @@ function printNextFile(violations, summary, projectDir, json) {
|
|
|
892
876
|
console.log(chalk.gray(`${ranked.length - 1} more file(s) with readings ยท ${violations.length - top.count} remaining reading(s)`));
|
|
893
877
|
console.log(chalk.gray('\nโโ Readings โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ'));
|
|
894
878
|
for (const v of ordered) {
|
|
895
|
-
const icon = v.severity === 'critical' ? '๐ด' : v.severity === '
|
|
879
|
+
const icon = v.severity === 'critical' ? '๐ด' : v.severity === 'severe' ? '๐ ' : '๐ก';
|
|
896
880
|
console.log(`${icon} ${chalk.bold(relativize(v.file || ''))}${v.line ? `:${v.line}` : ''} [${v.severity}] ${v.rule} โ ${v.message}`);
|
|
897
881
|
}
|
|
898
882
|
}
|
|
@@ -983,19 +967,6 @@ program
|
|
|
983
967
|
process.exit(1);
|
|
984
968
|
}
|
|
985
969
|
});
|
|
986
|
-
// Start server command (placeholder - will be implemented later)
|
|
987
|
-
program
|
|
988
|
-
.command('start')
|
|
989
|
-
.description('Start the MCP server')
|
|
990
|
-
.option('-p, --port <port>', 'Server port', String(DEFAULT_PORT))
|
|
991
|
-
.option('-m, --mcp-mode', 'Start in MCP stdio mode')
|
|
992
|
-
.option('-r, --rest-api', 'Enable REST API endpoints')
|
|
993
|
-
.option('-i, --index <path>', 'Path to index on startup')
|
|
994
|
-
.action(async (options) => {
|
|
995
|
-
console.log(chalk.yellow('Server start will be implemented in a future task'));
|
|
996
|
-
console.log('Options:', options);
|
|
997
|
-
// TODO: Implement server start
|
|
998
|
-
});
|
|
999
970
|
// Index command
|
|
1000
971
|
const indexCmd = program
|
|
1001
972
|
.command('index')
|
|
@@ -1205,7 +1176,7 @@ configCmd
|
|
|
1205
1176
|
console.log(chalk.blue(`\n${rules.length} rule(s) in ${configPath}`));
|
|
1206
1177
|
console.log(chalk.gray('โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ'));
|
|
1207
1178
|
for (const r of rules) {
|
|
1208
|
-
const sevIcon = r.severity === 'critical' ? '๐ด' : r.severity === '
|
|
1179
|
+
const sevIcon = r.severity === 'critical' ? '๐ด' : r.severity === 'severe' ? '๐ ' : '๐ก';
|
|
1209
1180
|
console.log(`${sevIcon} ${chalk.bold(r.id)} [${r.kind}] ${chalk.dim(r.severity)}`);
|
|
1210
1181
|
if (r.message)
|
|
1211
1182
|
console.log(` ${r.message}`);
|
|
@@ -1565,15 +1536,6 @@ program
|
|
|
1565
1536
|
process.exit(1);
|
|
1566
1537
|
}
|
|
1567
1538
|
});
|
|
1568
|
-
// Test command (placeholder - will be implemented later)
|
|
1569
|
-
program
|
|
1570
|
-
.command('test <tool>')
|
|
1571
|
-
.description('Test connection to AI tool')
|
|
1572
|
-
.action(async (tool) => {
|
|
1573
|
-
console.log(chalk.yellow('Test command will be implemented in a future task'));
|
|
1574
|
-
console.log('Tool:', tool);
|
|
1575
|
-
// TODO: Implement connection testing
|
|
1576
|
-
});
|
|
1577
1539
|
// Code map command
|
|
1578
1540
|
program
|
|
1579
1541
|
.command('map')
|
|
@@ -1842,7 +1804,7 @@ tasksCmd
|
|
|
1842
1804
|
.command('from-audit')
|
|
1843
1805
|
.description('Populate tasks from audit violations')
|
|
1844
1806
|
.option('--auditJobId <id>', 'Specific audit result ID')
|
|
1845
|
-
.option('--severities <severities>', 'Comma-separated severities (critical,
|
|
1807
|
+
.option('--severities <severities>', 'Comma-separated severities (critical,severe,high)', 'critical,severe,high')
|
|
1846
1808
|
.option('--json', 'Output as JSON')
|
|
1847
1809
|
.action(async (options) => {
|
|
1848
1810
|
try {
|
|
@@ -2204,7 +2166,7 @@ function spec41StatusBadge(status) {
|
|
|
2204
2166
|
function spec41SeverityColor(severity) {
|
|
2205
2167
|
if (severity === 'critical')
|
|
2206
2168
|
return chalk.red;
|
|
2207
|
-
if (severity === '
|
|
2169
|
+
if (severity === 'severe')
|
|
2208
2170
|
return chalk.yellow;
|
|
2209
2171
|
return chalk.gray;
|
|
2210
2172
|
}
|
|
@@ -2272,7 +2234,7 @@ async function runDetachedAudit(options) {
|
|
|
2272
2234
|
});
|
|
2273
2235
|
const defaultsJson = JSON.stringify({
|
|
2274
2236
|
defaultAnalyzers: DETACHED_DEFAULT_ANALYZERS,
|
|
2275
|
-
defaultMinSeverity: '
|
|
2237
|
+
defaultMinSeverity: 'high',
|
|
2276
2238
|
defaultGenerateCodeMap: false,
|
|
2277
2239
|
});
|
|
2278
2240
|
patchLedgerRun(db.rawDb, job.jobId, { stderrLog: logPath });
|
|
@@ -2353,7 +2315,7 @@ program
|
|
|
2353
2315
|
.option('--rule <rule>', 'Filter by rule id')
|
|
2354
2316
|
.option('--analyzer <analyzer>', 'Filter by analyzer')
|
|
2355
2317
|
.option('--file <file>', 'Filter by file path (substring match)')
|
|
2356
|
-
.option('--severity <severity>', 'Filter by severity (critical|
|
|
2318
|
+
.option('--severity <severity>', 'Filter by severity (critical|severe|high)')
|
|
2357
2319
|
.option('--state [state]', 'Query coverage by state (fired|clean|notApplicable|cannot-fire|unassessed); omit value for all')
|
|
2358
2320
|
.option('--count', 'Group findings by analyzer/rule with counts')
|
|
2359
2321
|
.option('--limit <n>', 'Max findings to return (0 = unbounded)', '50')
|
|
@@ -2658,7 +2620,7 @@ function getNamingPattern(caseName) {
|
|
|
2658
2620
|
program
|
|
2659
2621
|
.command('install')
|
|
2660
2622
|
.description('Install the code-auditor skill for AI coding tools')
|
|
2661
|
-
.option('--agent <agent>', 'Target agent: claude, cursor, codex, gemini, agents, or all', 'all')
|
|
2623
|
+
.option('--agent <agent>', 'Target agent: claude, cursor, codex, gemini, agents, zcode, or all', 'all')
|
|
2662
2624
|
.option('--scope <scope>', 'Install scope: user (~) or project (.)', 'user')
|
|
2663
2625
|
.option('--hooks', 'Offer hook wiring (default)', true)
|
|
2664
2626
|
.option('--no-hooks', 'Skip hook wiring prompt')
|
|
@@ -3089,7 +3051,7 @@ program
|
|
|
3089
3051
|
console.log('');
|
|
3090
3052
|
for (const v of sorted) {
|
|
3091
3053
|
const icon = v.severity === 'critical' ? '๐ด' :
|
|
3092
|
-
v.severity === '
|
|
3054
|
+
v.severity === 'severe' ? '๐ ' : '๐ก';
|
|
3093
3055
|
console.log(`${icon} ${chalk.bold(v.file)}${v.line ? `:${v.line}` : ''} [${v.rule || v.severity}] ${v.message}`);
|
|
3094
3056
|
}
|
|
3095
3057
|
}
|
|
@@ -3303,7 +3265,7 @@ const SCAFFOLD_CONFIG = {
|
|
|
3303
3265
|
{
|
|
3304
3266
|
id: 'api-routes-naming',
|
|
3305
3267
|
kind: 'naming',
|
|
3306
|
-
severity: '
|
|
3268
|
+
severity: 'severe',
|
|
3307
3269
|
message: 'API route files must export a handler matching the HTTP method.',
|
|
3308
3270
|
path: 'src/api/**',
|
|
3309
3271
|
exports: '^(get|post|put|delete|patch)\\b',
|
|
@@ -3439,11 +3401,11 @@ async function buildRulesInteractively() {
|
|
|
3439
3401
|
type: 'list',
|
|
3440
3402
|
message: 'Severity:',
|
|
3441
3403
|
choices: [
|
|
3442
|
-
{ name: chalk.red('Critical โ
|
|
3443
|
-
{ name: chalk.yellow('
|
|
3444
|
-
{ name: chalk.blue('
|
|
3404
|
+
{ name: chalk.red('Critical โ exploitable or broken now'), value: 'critical' },
|
|
3405
|
+
{ name: chalk.yellow('Severe โ wrong, and it will surface'), value: 'severe' },
|
|
3406
|
+
{ name: chalk.blue('High โ wrong, and it has not bitten yet'), value: 'high' },
|
|
3445
3407
|
],
|
|
3446
|
-
default: '
|
|
3408
|
+
default: 'high',
|
|
3447
3409
|
},
|
|
3448
3410
|
message: {
|
|
3449
3411
|
type: 'input',
|