@codeledger/cli 0.8.3 → 0.8.4
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/dist/commands/activate.d.ts.map +1 -1
- package/dist/commands/activate.js +3 -0
- package/dist/commands/activate.js.map +1 -1
- package/dist/commands/apply-policy.d.ts +7 -0
- package/dist/commands/apply-policy.d.ts.map +1 -0
- package/dist/commands/apply-policy.js +40 -0
- package/dist/commands/apply-policy.js.map +1 -0
- package/dist/commands/audit.d.ts +3 -1
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +526 -9
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/auto-refresh.d.ts +8 -0
- package/dist/commands/auto-refresh.d.ts.map +1 -1
- package/dist/commands/auto-refresh.js +6 -3
- package/dist/commands/auto-refresh.js.map +1 -1
- package/dist/commands/broker.d.ts +7 -0
- package/dist/commands/broker.d.ts.map +1 -1
- package/dist/commands/broker.js +195 -1
- package/dist/commands/broker.js.map +1 -1
- package/dist/commands/complete-check.d.ts +1 -0
- package/dist/commands/complete-check.d.ts.map +1 -1
- package/dist/commands/complete-check.js +71 -5
- package/dist/commands/complete-check.js.map +1 -1
- package/dist/commands/context.d.ts +5 -0
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +103 -2
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/policy.d.ts +3 -2
- package/dist/commands/policy.d.ts.map +1 -1
- package/dist/commands/policy.js +83 -2
- package/dist/commands/policy.js.map +1 -1
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +67 -0
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +36 -1
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/truth-utils.d.ts +4 -0
- package/dist/commands/truth-utils.d.ts.map +1 -1
- package/dist/commands/truth-utils.js +19 -14
- package/dist/commands/truth-utils.js.map +1 -1
- package/dist/completion-integrity/claims.d.ts.map +1 -1
- package/dist/completion-integrity/claims.js +15 -1
- package/dist/completion-integrity/claims.js.map +1 -1
- package/dist/completion-integrity/index.d.ts.map +1 -1
- package/dist/completion-integrity/index.js +8 -0
- package/dist/completion-integrity/index.js.map +1 -1
- package/dist/completion-integrity/notary.d.ts +3 -0
- package/dist/completion-integrity/notary.d.ts.map +1 -0
- package/dist/completion-integrity/notary.js +124 -0
- package/dist/completion-integrity/notary.js.map +1 -0
- package/dist/completion-integrity/output.d.ts.map +1 -1
- package/dist/completion-integrity/output.js +13 -0
- package/dist/completion-integrity/output.js.map +1 -1
- package/dist/completion-integrity/types.d.ts +4 -0
- package/dist/completion-integrity/types.d.ts.map +1 -1
- package/dist/context-engine/contract.d.ts +12 -0
- package/dist/context-engine/contract.d.ts.map +1 -0
- package/dist/context-engine/contract.js +227 -0
- package/dist/context-engine/contract.js.map +1 -0
- package/dist/context-engine/delta.d.ts +10 -0
- package/dist/context-engine/delta.d.ts.map +1 -0
- package/dist/context-engine/delta.js +78 -0
- package/dist/context-engine/delta.js.map +1 -0
- package/dist/context-engine/index.d.ts +6 -0
- package/dist/context-engine/index.d.ts.map +1 -0
- package/dist/context-engine/index.js +5 -0
- package/dist/context-engine/index.js.map +1 -0
- package/dist/context-engine/policy-evaluator.d.ts +32 -0
- package/dist/context-engine/policy-evaluator.d.ts.map +1 -0
- package/dist/context-engine/policy-evaluator.js +69 -0
- package/dist/context-engine/policy-evaluator.js.map +1 -0
- package/dist/context-engine/renderer.d.ts +9 -0
- package/dist/context-engine/renderer.d.ts.map +1 -0
- package/dist/context-engine/renderer.js +28 -0
- package/dist/context-engine/renderer.js.map +1 -0
- package/dist/context-engine/renderers/claude.d.ts +3 -0
- package/dist/context-engine/renderers/claude.d.ts.map +1 -0
- package/dist/context-engine/renderers/claude.js +223 -0
- package/dist/context-engine/renderers/claude.js.map +1 -0
- package/dist/context-engine/renderers/cursor.d.ts +3 -0
- package/dist/context-engine/renderers/cursor.d.ts.map +1 -0
- package/dist/context-engine/renderers/cursor.js +158 -0
- package/dist/context-engine/renderers/cursor.js.map +1 -0
- package/dist/context-engine/renderers/generic.d.ts +3 -0
- package/dist/context-engine/renderers/generic.d.ts.map +1 -0
- package/dist/context-engine/renderers/generic.js +180 -0
- package/dist/context-engine/renderers/generic.js.map +1 -0
- package/dist/feedback/index.d.ts +35 -0
- package/dist/feedback/index.d.ts.map +1 -0
- package/dist/feedback/index.js +81 -0
- package/dist/feedback/index.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -8
- package/dist/index.js.map +1 -1
- package/dist/insight/emit.d.ts.map +1 -1
- package/dist/insight/emit.js +2 -0
- package/dist/insight/emit.js.map +1 -1
- package/dist/risk-detection/heuristics.d.ts +13 -0
- package/dist/risk-detection/heuristics.d.ts.map +1 -0
- package/dist/risk-detection/heuristics.js +348 -0
- package/dist/risk-detection/heuristics.js.map +1 -0
- package/dist/risk-detection/index.d.ts +20 -0
- package/dist/risk-detection/index.d.ts.map +1 -0
- package/dist/risk-detection/index.js +128 -0
- package/dist/risk-detection/index.js.map +1 -0
- package/dist/session-paths.d.ts +4 -0
- package/dist/session-paths.d.ts.map +1 -1
- package/dist/session-paths.js +8 -0
- package/dist/session-paths.js.map +1 -1
- package/dist/session-timeline.d.ts +13 -0
- package/dist/session-timeline.d.ts.map +1 -0
- package/dist/session-timeline.js +134 -0
- package/dist/session-timeline.js.map +1 -0
- package/dist/templates/claude-md.d.ts.map +1 -1
- package/dist/templates/claude-md.js +11 -2
- package/dist/templates/claude-md.js.map +1 -1
- package/dist/templates/runtime-resolution.d.ts.map +1 -1
- package/dist/templates/runtime-resolution.js +9 -0
- package/dist/templates/runtime-resolution.js.map +1 -1
- package/package.json +13 -13
package/dist/commands/audit.js
CHANGED
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
* findings, gaps, inconsistencies, and required documentation updates.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
* codeledger audit --task "..." [--summary "..."]
|
|
9
|
+
* codeledger audit [--task "..."] [--summary "..."]
|
|
10
10
|
* [--claim "desc::file1,file2"] (repeatable)
|
|
11
11
|
* [--evidence "type::content"] (repeatable)
|
|
12
12
|
* [--omit "scope::reason"] (repeatable)
|
|
13
|
+
* [--profile context-policy|release|cli-flow]
|
|
14
|
+
* [--spec <audit-spec.json>]
|
|
13
15
|
* [--task-type release_pipeline|wizard_ux|ci_change|feature|bugfix|refactor|docs]
|
|
14
16
|
* [--json] [--explain]
|
|
15
17
|
*
|
|
@@ -18,8 +20,8 @@
|
|
|
18
20
|
* 1 = findings detected
|
|
19
21
|
* 2 = internal error / invalid usage
|
|
20
22
|
*/
|
|
21
|
-
import { existsSync } from 'node:fs';
|
|
22
|
-
import { join } from 'node:path';
|
|
23
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
24
|
+
import { join, resolve } from 'node:path';
|
|
23
25
|
import { runCIC, promoteState } from '../completion-integrity/index.js';
|
|
24
26
|
const VALID_TASK_TYPES = [
|
|
25
27
|
'release_pipeline', 'wizard_ux', 'ci_change', 'feature', 'bugfix', 'refactor', 'docs', 'unknown',
|
|
@@ -32,14 +34,17 @@ export async function runAudit(cwd, flags, rawArgs) {
|
|
|
32
34
|
console.error('Not a git repository. codeledger audit requires a git repo.');
|
|
33
35
|
process.exit(2);
|
|
34
36
|
}
|
|
35
|
-
const task = flags['task'];
|
|
36
|
-
if (!task) {
|
|
37
|
-
console.error('--task is required. Usage: codeledger audit --task "your task description"');
|
|
38
|
-
process.exit(2);
|
|
39
|
-
}
|
|
40
37
|
const summary = flags['summary'];
|
|
41
38
|
const isJson = flags['json'] === 'true';
|
|
42
39
|
const explain = flags['explain'] === 'true';
|
|
40
|
+
const profile = parseAuditProfile(flags['profile']);
|
|
41
|
+
const specPath = flags['spec']?.trim();
|
|
42
|
+
if (profile && specPath) {
|
|
43
|
+
console.error('Use either --profile or --spec, not both.');
|
|
44
|
+
process.exit(2);
|
|
45
|
+
}
|
|
46
|
+
const spec = specPath ? loadAuditSpec(cwd, specPath) : null;
|
|
47
|
+
const task = flags['task']?.trim() || spec?.task?.trim() || defaultAuditTask();
|
|
43
48
|
const taskTypeFlag = flags['task-type'];
|
|
44
49
|
if (taskTypeFlag && !VALID_TASK_TYPES.includes(taskTypeFlag)) {
|
|
45
50
|
console.error(`Invalid --task-type "${taskTypeFlag}". Valid values: ${VALID_TASK_TYPES.join(', ')}`);
|
|
@@ -84,6 +89,12 @@ export async function runAudit(cwd, flags, rawArgs) {
|
|
|
84
89
|
guards: result.record.guards,
|
|
85
90
|
});
|
|
86
91
|
const report = buildAuditReport(result.record, promotion.blockers);
|
|
92
|
+
if (profile) {
|
|
93
|
+
report.profileAudit = runProfileAudit(cwd, profile);
|
|
94
|
+
}
|
|
95
|
+
else if (spec) {
|
|
96
|
+
report.profileAudit = runSpecAudit(cwd, spec, specPath);
|
|
97
|
+
}
|
|
87
98
|
if (isJson) {
|
|
88
99
|
console.log(JSON.stringify(report, null, 2));
|
|
89
100
|
}
|
|
@@ -92,7 +103,13 @@ export async function runAudit(cwd, flags, rawArgs) {
|
|
|
92
103
|
console.log(line);
|
|
93
104
|
}
|
|
94
105
|
}
|
|
95
|
-
|
|
106
|
+
const hasProfileFailures = report.profileAudit
|
|
107
|
+
? report.profileAudit.sections.some((section) => section.verdict !== 'PASS')
|
|
108
|
+
: false;
|
|
109
|
+
process.exitCode = report.findings.length === 0 && !hasProfileFailures ? 0 : 1;
|
|
110
|
+
}
|
|
111
|
+
function defaultAuditTask() {
|
|
112
|
+
return 'Run an adversarial audit: prove the work happened or expose where it didn’t. Validate claims against code, diffs, tests, and outputs. Highlight gaps, inconsistencies, or missing artifacts, and identify any required documentation updates.';
|
|
96
113
|
}
|
|
97
114
|
function buildAuditReport(record, blockers) {
|
|
98
115
|
const findings = [];
|
|
@@ -181,6 +198,461 @@ function buildAuditReport(record, blockers) {
|
|
|
181
198
|
blockers,
|
|
182
199
|
};
|
|
183
200
|
}
|
|
201
|
+
function parseAuditProfile(raw) {
|
|
202
|
+
if (!raw)
|
|
203
|
+
return null;
|
|
204
|
+
const value = raw.trim().toLowerCase();
|
|
205
|
+
if (value === 'context-policy')
|
|
206
|
+
return 'context-policy';
|
|
207
|
+
if (value === 'release')
|
|
208
|
+
return 'release';
|
|
209
|
+
if (value === 'cli-flow')
|
|
210
|
+
return 'cli-flow';
|
|
211
|
+
console.error(`Invalid --profile "${raw}". Valid values: context-policy, release, cli-flow`);
|
|
212
|
+
process.exit(2);
|
|
213
|
+
}
|
|
214
|
+
function runProfileAudit(cwd, profile) {
|
|
215
|
+
switch (profile) {
|
|
216
|
+
case 'context-policy':
|
|
217
|
+
return auditContextPolicyProfile(cwd);
|
|
218
|
+
case 'release':
|
|
219
|
+
return auditReleaseProfile(cwd);
|
|
220
|
+
case 'cli-flow':
|
|
221
|
+
return auditCliFlowProfile(cwd);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function loadAuditSpec(cwd, specPath) {
|
|
225
|
+
const resolved = resolve(cwd, specPath);
|
|
226
|
+
if (!existsSync(resolved)) {
|
|
227
|
+
console.error(`Audit spec not found: ${specPath}`);
|
|
228
|
+
process.exit(2);
|
|
229
|
+
}
|
|
230
|
+
try {
|
|
231
|
+
const parsed = JSON.parse(readFileSync(resolved, 'utf-8'));
|
|
232
|
+
if (!Array.isArray(parsed.sections) || parsed.sections.length === 0) {
|
|
233
|
+
throw new Error('spec.sections must be a non-empty array');
|
|
234
|
+
}
|
|
235
|
+
return parsed;
|
|
236
|
+
}
|
|
237
|
+
catch (err) {
|
|
238
|
+
console.error(`Failed to parse audit spec ${specPath}: ${err.message}`);
|
|
239
|
+
process.exit(2);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function runSpecAudit(cwd, spec, specPath) {
|
|
243
|
+
const sections = spec.sections.map((section) => runSpecSection(cwd, section));
|
|
244
|
+
return finalizeProfileAudit(spec.title ?? `spec:${specPath}`, sections);
|
|
245
|
+
}
|
|
246
|
+
function auditContextPolicyProfile(cwd) {
|
|
247
|
+
const sections = [
|
|
248
|
+
auditContextPolicyCommandFlow(cwd),
|
|
249
|
+
auditContextPolicyPolicyEngine(cwd),
|
|
250
|
+
auditContextPolicyContextContract(cwd),
|
|
251
|
+
auditContextPolicyRendering(cwd),
|
|
252
|
+
auditContextPolicyEnforcement(cwd),
|
|
253
|
+
auditContextPolicyIterativeSupport(cwd),
|
|
254
|
+
auditContextPolicyPerformanceReuse(cwd),
|
|
255
|
+
auditContextPolicyTestCoverage(cwd),
|
|
256
|
+
];
|
|
257
|
+
return finalizeProfileAudit('context-policy', sections);
|
|
258
|
+
}
|
|
259
|
+
function finalizeProfileAudit(profile, sections) {
|
|
260
|
+
const criticalGaps = dedupe(sections.flatMap((section) => section.verdict === 'FAIL' ? section.failures : []));
|
|
261
|
+
const weakAreas = dedupe(sections.flatMap((section) => section.weakAreas));
|
|
262
|
+
const misleadingImplementations = [];
|
|
263
|
+
if (criticalGaps.some((gap) => gap.includes('apply-policy'))) {
|
|
264
|
+
misleadingImplementations.push('Policy flow is partial: resolution exists, but there is no dedicated apply-policy command or active-policy persistence step.');
|
|
265
|
+
}
|
|
266
|
+
if (criticalGaps.some((gap) => gap.includes('context --task'))) {
|
|
267
|
+
misleadingImplementations.push('Context flow is split across subcommands; there is no single `context --task` render path despite context-oriented command naming.');
|
|
268
|
+
}
|
|
269
|
+
if (weakAreas.some((gap) => gap.includes('profile'))) {
|
|
270
|
+
misleadingImplementations.push('Profile verdicts currently rely on code-path inspection more than live command probes.');
|
|
271
|
+
}
|
|
272
|
+
const failCount = sections.filter((section) => section.verdict === 'FAIL').length;
|
|
273
|
+
const weakCount = sections.filter((section) => section.verdict === 'WEAK').length;
|
|
274
|
+
const overallVerdict = failCount > 0 ? 'NOT READY' : weakCount > 0 ? 'PARTIAL (needs fixes)' : 'PRODUCTION READY';
|
|
275
|
+
return {
|
|
276
|
+
profile,
|
|
277
|
+
sections,
|
|
278
|
+
criticalGaps,
|
|
279
|
+
weakAreas,
|
|
280
|
+
misleadingImplementations: dedupe(misleadingImplementations),
|
|
281
|
+
overallVerdict,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function auditContextPolicyCommandFlow(cwd) {
|
|
285
|
+
const indexSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'index.ts'));
|
|
286
|
+
const scanSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'commands', 'scan.ts'));
|
|
287
|
+
const policySrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'commands', 'policy.ts'));
|
|
288
|
+
const contextSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'commands', 'context.ts'));
|
|
289
|
+
const evidence = [
|
|
290
|
+
...proveContains(indexSrc, "case 'scan':", 'index.ts routes scan'),
|
|
291
|
+
...proveContains(indexSrc, "case 'policy':", 'index.ts routes policy'),
|
|
292
|
+
...proveContains(indexSrc, "case 'context':", 'index.ts routes context'),
|
|
293
|
+
...proveContains(scanSrc, 'scanRepository(cwd)', 'scan delegates to scanRepository'),
|
|
294
|
+
...proveContains(policySrc, 'resolvePolicy({', 'policy resolves effective policy'),
|
|
295
|
+
...proveContains(contextSrc, "case 'validate':", 'context exposes validate subcommand'),
|
|
296
|
+
];
|
|
297
|
+
const failures = [];
|
|
298
|
+
const weakAreas = [];
|
|
299
|
+
if (!contains(scanSrc, 'scanRepository(cwd)')) {
|
|
300
|
+
failures.push('`codeledger scan` is missing a real repository-scan execution path.');
|
|
301
|
+
}
|
|
302
|
+
if (!contains(policySrc, 'resolvePolicy({')) {
|
|
303
|
+
failures.push('`codeledger policy --print` does not clearly resolve policy from repo state.');
|
|
304
|
+
}
|
|
305
|
+
if (!contains(contextSrc, "case 'explain':") || !contains(contextSrc, "case 'validate':")) {
|
|
306
|
+
failures.push('`codeledger context` does not expose a coherent rendering/validation flow.');
|
|
307
|
+
}
|
|
308
|
+
if (!contains(indexSrc, "case 'apply-policy':")) {
|
|
309
|
+
failures.push('No `codeledger apply-policy` command exists, so recommended policy cannot be persisted through a dedicated CLI flow.');
|
|
310
|
+
}
|
|
311
|
+
if (!contains(contextSrc, 'flags[\'task\']') && !contains(indexSrc, 'context --task')) {
|
|
312
|
+
failures.push('No `codeledger context --task` path exists; context rendering is split across subcommands instead.');
|
|
313
|
+
}
|
|
314
|
+
return makeSection('command_flow', 'Command Flow Validation', failures, weakAreas, evidence, failures.length === 0
|
|
315
|
+
? 'Command flow is implemented and traceable.'
|
|
316
|
+
: 'Context and policy flow is only partially implemented relative to the expected scan → policy → context workflow.');
|
|
317
|
+
}
|
|
318
|
+
function auditContextPolicyPolicyEngine(cwd) {
|
|
319
|
+
const resolveSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'policy', 'resolve.ts'));
|
|
320
|
+
const realtimeSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'policy', 'realtime.ts'));
|
|
321
|
+
const schemaSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'policy', 'schema.ts'));
|
|
322
|
+
const evidence = [
|
|
323
|
+
...proveContains(resolveSrc, 'SAFE_DEFAULTS', 'policy starts from SAFE_DEFAULTS'),
|
|
324
|
+
...proveContains(resolveSrc, 'loadOrgDefault(policyRoot)', 'policy loads org defaults'),
|
|
325
|
+
...proveContains(resolveSrc, 'loadRepoOverride(policyRoot, repoName)', 'policy loads repo overrides'),
|
|
326
|
+
...proveContains(realtimeSrc, 'policy.min_confidence', 'realtime policy checks confidence'),
|
|
327
|
+
...proveContains(realtimeSrc, 'policy.deny_paths', 'realtime policy enforces deny_paths'),
|
|
328
|
+
...proveContains(schemaSrc, "Invalid policy mode", 'schema validates policy mode'),
|
|
329
|
+
];
|
|
330
|
+
const failures = [];
|
|
331
|
+
const weakAreas = [];
|
|
332
|
+
if (!contains(resolveSrc, 'loadOrgDefault(policyRoot)') || !contains(resolveSrc, 'loadRepoOverride(policyRoot, repoName)')) {
|
|
333
|
+
failures.push('Policy resolution is not clearly grounded in layered repo/org policy files.');
|
|
334
|
+
}
|
|
335
|
+
if (!contains(realtimeSrc, 'policy.deny_paths')) {
|
|
336
|
+
failures.push('Policy enforcement does not inspect protected path constraints.');
|
|
337
|
+
}
|
|
338
|
+
if (!contains(resolveSrc, 'toResolved(SAFE_DEFAULTS') && !contains(resolveSrc, 'SAFE_DEFAULTS')) {
|
|
339
|
+
weakAreas.push('Policy engine may fall back silently without surfacing whether repo policy is missing.');
|
|
340
|
+
}
|
|
341
|
+
weakAreas.push('There is still no recommendation-generation or apply-policy persistence path in this flow; current policy logic is resolution/enforcement only.');
|
|
342
|
+
return makeSection('policy_generation', 'Policy Generation / Resolution', failures, weakAreas, evidence, failures.length === 0
|
|
343
|
+
? 'Resolved policy logic is real and repo-grounded.'
|
|
344
|
+
: 'Policy engine is real but incomplete relative to a full recommend → apply workflow.');
|
|
345
|
+
}
|
|
346
|
+
function auditContextPolicyContextContract(cwd) {
|
|
347
|
+
const typesSrc = readIfExists(join(cwd, 'packages', 'types', 'src', 'index.ts'));
|
|
348
|
+
const contextSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'commands', 'context.ts'));
|
|
349
|
+
const evidence = [
|
|
350
|
+
...proveContains(typesSrc, 'export interface ContextBundle', 'ContextBundle is centralized in shared types'),
|
|
351
|
+
...proveContains(typesSrc, 'context_verdict?: ContextSufficiencyVerdict', 'ContextBundle carries sufficiency verdict'),
|
|
352
|
+
...proveContains(contextSrc, 'buildExplainPayload', 'context rendering consumes the bundle structure'),
|
|
353
|
+
...proveContains(contextSrc, 'computeContextDiff', 'context diff uses bundle files directly'),
|
|
354
|
+
];
|
|
355
|
+
const failures = [];
|
|
356
|
+
const weakAreas = [];
|
|
357
|
+
if (!contains(typesSrc, 'export interface ContextBundle')) {
|
|
358
|
+
failures.push('Shared ContextBundle contract is missing from packages/types.');
|
|
359
|
+
}
|
|
360
|
+
if (!contains(contextSrc, 'buildExplainPayload')) {
|
|
361
|
+
failures.push('Context rendering does not appear to consume the shared context contract.');
|
|
362
|
+
}
|
|
363
|
+
if (!contains(typesSrc, 'context_verdict?: ContextSufficiencyVerdict')) {
|
|
364
|
+
weakAreas.push('Context sufficiency metadata exists, but the contract is still bundle-centric rather than an explicit rendering contract with task/guardrails/verify-first fields.');
|
|
365
|
+
}
|
|
366
|
+
return makeSection('context_contract', 'Context Contract Validation', failures, weakAreas, evidence, failures.length === 0
|
|
367
|
+
? 'Context contract is real and used by rendering paths.'
|
|
368
|
+
: 'Context contract has gaps or is not clearly wired into rendering.');
|
|
369
|
+
}
|
|
370
|
+
function auditContextPolicyRendering(cwd) {
|
|
371
|
+
const contextSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'commands', 'context.ts'));
|
|
372
|
+
const evidence = [
|
|
373
|
+
...proveContains(contextSrc, 'console.log(`\\n📋 Context Explanation', 'human context renderer exists'),
|
|
374
|
+
...proveContains(contextSrc, 'Confidence:', 'renderer prints confidence'),
|
|
375
|
+
...proveContains(contextSrc, 'reasons:', 'renderer includes reason text'),
|
|
376
|
+
];
|
|
377
|
+
const failures = [];
|
|
378
|
+
const weakAreas = [];
|
|
379
|
+
if (!contains(contextSrc, 'console.log(`\\n📋 Context Explanation')) {
|
|
380
|
+
failures.push('Human-readable context rendering path is missing.');
|
|
381
|
+
}
|
|
382
|
+
if (contains(contextSrc, 'Confidence:')) {
|
|
383
|
+
weakAreas.push('Renderer still exposes raw confidence information directly, which may leak internal scoring into user-facing output.');
|
|
384
|
+
}
|
|
385
|
+
if (!contains(contextSrc, 'reasons:')) {
|
|
386
|
+
weakAreas.push('Rendering may be too opaque if file-level reasons are absent.');
|
|
387
|
+
}
|
|
388
|
+
return makeSection('rendering_engine', 'Rendering Engine Validation', failures, weakAreas, evidence, failures.length === 0 && weakAreas.length === 0
|
|
389
|
+
? 'Rendering looks concise and workflow-oriented.'
|
|
390
|
+
: 'Rendering exists, but current output still carries internal scoring characteristics instead of a compact developer contract.');
|
|
391
|
+
}
|
|
392
|
+
function auditContextPolicyEnforcement(cwd) {
|
|
393
|
+
const realtimeSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'policy', 'realtime.ts'));
|
|
394
|
+
const verifySrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'commands', 'verify.ts'));
|
|
395
|
+
const evidence = [
|
|
396
|
+
...proveContains(realtimeSrc, 'violations.push({', 'policy evaluation records violations'),
|
|
397
|
+
...proveContains(realtimeSrc, "severity: isBlocking ? 'error' : 'warn'", 'policy distinguishes block vs warn'),
|
|
398
|
+
...proveContains(verifySrc, 'policy', 'verify command integrates policy evaluation'),
|
|
399
|
+
];
|
|
400
|
+
const failures = [];
|
|
401
|
+
const weakAreas = [];
|
|
402
|
+
if (!contains(realtimeSrc, 'violations.push({')) {
|
|
403
|
+
failures.push('Policy enforcement does not emit concrete violation records.');
|
|
404
|
+
}
|
|
405
|
+
if (!contains(realtimeSrc, "severity: isBlocking ? 'error' : 'warn'")) {
|
|
406
|
+
failures.push('Policy mode does not clearly distinguish warn vs block behavior.');
|
|
407
|
+
}
|
|
408
|
+
if (!contains(verifySrc, 'resolvePolicy') && !contains(verifySrc, 'policy')) {
|
|
409
|
+
weakAreas.push('Enforcement appears stronger in realtime checks than in explicit command validation paths.');
|
|
410
|
+
}
|
|
411
|
+
return makeSection('policy_enforcement', 'Policy Enforcement Validation', failures, weakAreas, evidence, failures.length === 0
|
|
412
|
+
? 'Policy enforcement is real and differentiates warn/block behavior.'
|
|
413
|
+
: 'Policy enforcement is present but may be incomplete or too implicit.');
|
|
414
|
+
}
|
|
415
|
+
function auditContextPolicyIterativeSupport(cwd) {
|
|
416
|
+
const contextSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'commands', 'context.ts'));
|
|
417
|
+
const evidence = [
|
|
418
|
+
...proveContains(contextSrc, "case 'diff':", 'context exposes diff subcommand'),
|
|
419
|
+
...proveContains(contextSrc, 'computeContextDiff(', 'context diff computes added/removed files'),
|
|
420
|
+
...proveContains(contextSrc, 'added.length', 'diff reports added files'),
|
|
421
|
+
...proveContains(contextSrc, 'removed.length', 'diff reports removed files'),
|
|
422
|
+
];
|
|
423
|
+
const failures = [];
|
|
424
|
+
const weakAreas = [];
|
|
425
|
+
if (!contains(contextSrc, 'computeContextDiff(')) {
|
|
426
|
+
failures.push('No real context delta computation path exists.');
|
|
427
|
+
}
|
|
428
|
+
return makeSection('context_delta', 'Context Delta Validation', failures, weakAreas, evidence, failures.length === 0
|
|
429
|
+
? 'Iterative support is implemented via context diff.'
|
|
430
|
+
: 'Iterative support is missing or incomplete.');
|
|
431
|
+
}
|
|
432
|
+
function auditContextPolicyPerformanceReuse(cwd) {
|
|
433
|
+
const activateSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'commands', 'activate.ts'));
|
|
434
|
+
const scanSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'commands', 'scan.ts'));
|
|
435
|
+
const evidence = [
|
|
436
|
+
...proveContains(activateSrc, 'stale-after', 'activate supports stale-after reuse'),
|
|
437
|
+
...proveContains(activateSrc, 'scan-if-stale', 'activate help mentions scan-if-stale flow'),
|
|
438
|
+
...proveContains(scanSrc, 'scanRepository(cwd)', 'scan is factored behind a reusable runtime entrypoint'),
|
|
439
|
+
];
|
|
440
|
+
const failures = [];
|
|
441
|
+
const weakAreas = [];
|
|
442
|
+
if (!contains(activateSrc, 'stale-after')) {
|
|
443
|
+
weakAreas.push('Context activation does not clearly expose scan reuse controls.');
|
|
444
|
+
}
|
|
445
|
+
weakAreas.push('Profile verdicts currently rely on code-path inspection more than measured runtime benchmarks.');
|
|
446
|
+
return makeSection('performance_flow', 'Performance & Flow', failures, weakAreas, evidence, weakAreas.length === 0
|
|
447
|
+
? 'Scan reuse and flow controls are visible.'
|
|
448
|
+
: 'Performance reuse exists, but this audit still infers it from code rather than measured command timing.');
|
|
449
|
+
}
|
|
450
|
+
function auditContextPolicyTestCoverage(cwd) {
|
|
451
|
+
const tests = [
|
|
452
|
+
join(cwd, 'tests', 'policy-authoring.test.ts'),
|
|
453
|
+
join(cwd, 'tests', 'completion-integrity.test.ts'),
|
|
454
|
+
join(cwd, 'tests', 'control-plane-phase1.test.ts'),
|
|
455
|
+
];
|
|
456
|
+
const evidence = tests.filter((path) => existsSync(path)).map((path) => `Test present: ${relativeFromRepo(cwd, path)}`);
|
|
457
|
+
const failures = [];
|
|
458
|
+
const weakAreas = [];
|
|
459
|
+
if (!existsSync(tests[0])) {
|
|
460
|
+
failures.push('Policy-authoring coverage is missing.');
|
|
461
|
+
}
|
|
462
|
+
if (!existsSync(tests[1])) {
|
|
463
|
+
weakAreas.push('Adversarial/completion-integrity coverage is missing.');
|
|
464
|
+
}
|
|
465
|
+
return makeSection('test_coverage', 'Test Coverage Validation', failures, weakAreas, evidence, failures.length === 0
|
|
466
|
+
? 'Relevant tests exist for policy and audit surfaces.'
|
|
467
|
+
: 'Test coverage is too shallow for this subsystem.');
|
|
468
|
+
}
|
|
469
|
+
function auditReleaseProfile(cwd) {
|
|
470
|
+
const sections = [
|
|
471
|
+
auditReleaseFlow(cwd),
|
|
472
|
+
auditReleaseDocs(cwd),
|
|
473
|
+
auditReleaseVerification(cwd),
|
|
474
|
+
auditReleaseTests(cwd),
|
|
475
|
+
];
|
|
476
|
+
return finalizeProfileAudit('release', sections);
|
|
477
|
+
}
|
|
478
|
+
function auditCliFlowProfile(cwd) {
|
|
479
|
+
const sections = [
|
|
480
|
+
auditCliRouting(cwd),
|
|
481
|
+
auditCliAmbientFlow(cwd),
|
|
482
|
+
auditCliDocs(cwd),
|
|
483
|
+
auditCliTests(cwd),
|
|
484
|
+
];
|
|
485
|
+
return finalizeProfileAudit('cli-flow', sections);
|
|
486
|
+
}
|
|
487
|
+
function runSpecSection(cwd, section) {
|
|
488
|
+
const evidence = [];
|
|
489
|
+
const failures = [];
|
|
490
|
+
const weakAreas = [...(section.weakAreas ?? [])];
|
|
491
|
+
for (const fileCheck of section.filesContain ?? []) {
|
|
492
|
+
const path = join(cwd, fileCheck.path);
|
|
493
|
+
const content = readIfExists(path);
|
|
494
|
+
if (!content) {
|
|
495
|
+
failures.push(`Spec file missing: ${fileCheck.path}`);
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
for (const needle of fileCheck.includes) {
|
|
499
|
+
if (contains(content, needle)) {
|
|
500
|
+
evidence.push(`File ${fileCheck.path} contains: ${needle}`);
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
failures.push(`File ${fileCheck.path} missing expected content: ${needle}`);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
if ((section.commandCases ?? []).length > 0) {
|
|
508
|
+
const indexSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'index.ts'));
|
|
509
|
+
for (const commandCase of section.commandCases ?? []) {
|
|
510
|
+
const needle = `case '${commandCase}':`;
|
|
511
|
+
if (contains(indexSrc, needle)) {
|
|
512
|
+
evidence.push(`CLI routes command: ${needle}`);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
failures.push(`CLI command route missing: ${needle}`);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return makeSection(section.id, section.title, failures, weakAreas, evidence, failures.length === 0 ? 'Spec section checks passed.' : 'Spec section checks failed.');
|
|
520
|
+
}
|
|
521
|
+
function auditReleaseFlow(cwd) {
|
|
522
|
+
const runbook = readIfExists(join(cwd, 'release', 'RELEASE-RUNBOOK.md'));
|
|
523
|
+
const workflow = readIfExists(join(cwd, '.github', 'workflows', 'release-dispatch.yml'));
|
|
524
|
+
const indexSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'commands', 'release-check.ts'));
|
|
525
|
+
const evidence = [
|
|
526
|
+
...proveContains(runbook, 'Release Dispatch', 'runbook references Release Dispatch'),
|
|
527
|
+
...proveContains(workflow, 'workflow_dispatch', 'release-dispatch workflow is manually triggerable'),
|
|
528
|
+
...proveContains(indexSrc, 'runReleaseCheck({ cwd, strict })', 'release-check invokes release engine'),
|
|
529
|
+
];
|
|
530
|
+
const failures = [];
|
|
531
|
+
const weakAreas = [];
|
|
532
|
+
if (!contains(runbook, 'Release Dispatch')) {
|
|
533
|
+
failures.push('Release runbook does not point to the current dispatch workflow.');
|
|
534
|
+
}
|
|
535
|
+
if (!contains(workflow, 'workflow_dispatch')) {
|
|
536
|
+
failures.push('Release dispatch workflow is missing or not manually triggerable.');
|
|
537
|
+
}
|
|
538
|
+
return makeSection('release_flow', 'Release Flow Validation', failures, weakAreas, evidence, failures.length === 0 ? 'Release flow is wired through the documented dispatch path.' : 'Release flow has missing or stale dispatch wiring.');
|
|
539
|
+
}
|
|
540
|
+
function auditReleaseDocs(cwd) {
|
|
541
|
+
const readme = readIfExists(join(cwd, 'README.md'));
|
|
542
|
+
const publicReadme = readIfExists(join(cwd, 'release', 'public-repo', 'README.md'));
|
|
543
|
+
const evidence = [
|
|
544
|
+
...proveContains(readme, 'CLI', 'root README documents CLI'),
|
|
545
|
+
...proveContains(publicReadme, 'CLI Commands', 'public README documents CLI commands'),
|
|
546
|
+
];
|
|
547
|
+
const failures = [];
|
|
548
|
+
const weakAreas = [];
|
|
549
|
+
if (!contains(publicReadme, 'CLI Commands')) {
|
|
550
|
+
failures.push('Public release README is missing CLI command documentation.');
|
|
551
|
+
}
|
|
552
|
+
if (!contains(readme, 'Ambient Runtime')) {
|
|
553
|
+
weakAreas.push('Root README may under-document release-time runtime behavior.');
|
|
554
|
+
}
|
|
555
|
+
return makeSection('release_docs', 'Release Documentation Validation', failures, weakAreas, evidence, failures.length === 0 ? 'Release-facing docs are present.' : 'Release-facing docs are incomplete.');
|
|
556
|
+
}
|
|
557
|
+
function auditReleaseVerification(cwd) {
|
|
558
|
+
const releaseCheckCmd = readIfExists(join(cwd, 'packages', 'cli', 'src', 'commands', 'release-check.ts'));
|
|
559
|
+
const engine = readIfExists(join(cwd, 'packages', 'cli', 'src', 'release-check', 'engine.ts'));
|
|
560
|
+
const evidence = [
|
|
561
|
+
...proveContains(releaseCheckCmd, 'runReleaseCheck({ cwd, strict })', 'release-check command uses release engine'),
|
|
562
|
+
...proveContains(engine, 'return {', 'release-check engine returns structured result'),
|
|
563
|
+
];
|
|
564
|
+
const failures = [];
|
|
565
|
+
const weakAreas = [];
|
|
566
|
+
if (!contains(releaseCheckCmd, 'runReleaseCheck({ cwd, strict })')) {
|
|
567
|
+
failures.push('Release-check command is not wired to the release engine.');
|
|
568
|
+
}
|
|
569
|
+
return makeSection('release_verification', 'Release Verification Validation', failures, weakAreas, evidence, failures.length === 0 ? 'Release verification path is real.' : 'Release verification path is incomplete.');
|
|
570
|
+
}
|
|
571
|
+
function auditReleaseTests(cwd) {
|
|
572
|
+
const tests = [
|
|
573
|
+
join(cwd, 'tests', 'release-check.test.ts'),
|
|
574
|
+
join(cwd, 'tests', 'audit-command.test.ts'),
|
|
575
|
+
];
|
|
576
|
+
const evidence = tests.filter((path) => existsSync(path)).map((path) => `Test present: ${relativeFromRepo(cwd, path)}`);
|
|
577
|
+
const failures = [];
|
|
578
|
+
const weakAreas = [];
|
|
579
|
+
if (!existsSync(tests[0]))
|
|
580
|
+
failures.push('Release-check test coverage is missing.');
|
|
581
|
+
return makeSection('release_tests', 'Release Test Coverage', failures, weakAreas, evidence, failures.length === 0 ? 'Release-related tests exist.' : 'Release-related test coverage is missing.');
|
|
582
|
+
}
|
|
583
|
+
function auditCliRouting(cwd) {
|
|
584
|
+
const indexSrc = readIfExists(join(cwd, 'packages', 'cli', 'src', 'index.ts'));
|
|
585
|
+
const evidence = [
|
|
586
|
+
...proveContains(indexSrc, "case 'task':", 'task route exists'),
|
|
587
|
+
...proveContains(indexSrc, "case 'codex':", 'codex route exists'),
|
|
588
|
+
...proveContains(indexSrc, "case 'claude':", 'claude route exists'),
|
|
589
|
+
...proveContains(indexSrc, "case 'auto-refresh':", 'auto-refresh route exists'),
|
|
590
|
+
];
|
|
591
|
+
const failures = [];
|
|
592
|
+
const weakAreas = [];
|
|
593
|
+
if (!contains(indexSrc, "case 'auto-refresh':")) {
|
|
594
|
+
failures.push('auto-refresh command route is missing.');
|
|
595
|
+
}
|
|
596
|
+
return makeSection('cli_routing', 'CLI Flow Routing', failures, weakAreas, evidence, failures.length === 0 ? 'CLI flow routes are present.' : 'CLI flow routes are incomplete.');
|
|
597
|
+
}
|
|
598
|
+
function auditCliAmbientFlow(cwd) {
|
|
599
|
+
const runtime = readIfExists(join(cwd, 'packages', 'cli', 'src', 'templates', 'runtime-resolution.ts'));
|
|
600
|
+
const hooks = readIfExists(join(cwd, 'packages', 'cli', 'src', 'templates', 'hooks.ts'));
|
|
601
|
+
const evidence = [
|
|
602
|
+
...proveContains(runtime, 'run_auto_refresh()', 'ambient wrappers run auto-refresh'),
|
|
603
|
+
...proveContains(hooks, 'auto-refresh --quiet --prompt "$PROMPT"', 'hooks invoke auto-refresh on prompt submit'),
|
|
604
|
+
];
|
|
605
|
+
const failures = [];
|
|
606
|
+
const weakAreas = [];
|
|
607
|
+
if (!contains(runtime, 'run_auto_refresh()'))
|
|
608
|
+
failures.push('Ambient wrappers do not apply meaningful-task refresh before handoff.');
|
|
609
|
+
if (!contains(hooks, 'auto-refresh --quiet --prompt "$PROMPT"'))
|
|
610
|
+
weakAreas.push('Hook path does not clearly mirror ambient wrapper refresh behavior.');
|
|
611
|
+
return makeSection('cli_ambient_flow', 'Ambient Flow Validation', failures, weakAreas, evidence, failures.length === 0 ? 'Ambient flow is wired through both wrappers and hooks.' : 'Ambient flow integration is incomplete.');
|
|
612
|
+
}
|
|
613
|
+
function auditCliDocs(cwd) {
|
|
614
|
+
const readme = readIfExists(join(cwd, 'README.md'));
|
|
615
|
+
const cliRef = readIfExists(join(cwd, 'docs', 'CLI_COMMAND_REFERENCE.md'));
|
|
616
|
+
const evidence = [
|
|
617
|
+
...proveContains(readme, './.codeledger/bin/codex', 'README documents repo-local codex wrapper'),
|
|
618
|
+
...proveContains(cliRef, './.codeledger/bin/codex', 'CLI reference documents repo-local codex wrapper'),
|
|
619
|
+
];
|
|
620
|
+
const failures = [];
|
|
621
|
+
const weakAreas = [];
|
|
622
|
+
if (!contains(cliRef, './.codeledger/bin/codex'))
|
|
623
|
+
failures.push('CLI reference is missing repo-local ambient wrapper guidance.');
|
|
624
|
+
return makeSection('cli_docs', 'CLI Documentation Validation', failures, weakAreas, evidence, failures.length === 0 ? 'CLI docs describe ambient wrapper behavior.' : 'CLI docs do not match the ambient wrapper flow.');
|
|
625
|
+
}
|
|
626
|
+
function auditCliTests(cwd) {
|
|
627
|
+
const tests = [
|
|
628
|
+
join(cwd, 'tests', 'auto-refresh.test.ts'),
|
|
629
|
+
join(cwd, 'tests', 'upgrade-license.test.ts'),
|
|
630
|
+
];
|
|
631
|
+
const evidence = tests.filter((path) => existsSync(path)).map((path) => `Test present: ${relativeFromRepo(cwd, path)}`);
|
|
632
|
+
const failures = [];
|
|
633
|
+
const weakAreas = [];
|
|
634
|
+
if (!existsSync(tests[0]))
|
|
635
|
+
failures.push('auto-refresh test coverage is missing.');
|
|
636
|
+
if (!existsSync(tests[1]))
|
|
637
|
+
weakAreas.push('wrapper integration tests are missing.');
|
|
638
|
+
return makeSection('cli_tests', 'CLI Test Coverage', failures, weakAreas, evidence, failures.length === 0 ? 'CLI flow tests exist.' : 'CLI flow tests are incomplete.');
|
|
639
|
+
}
|
|
640
|
+
function makeSection(id, title, failures, weakAreas, evidence, summary) {
|
|
641
|
+
const verdict = failures.length > 0 ? 'FAIL' : weakAreas.length > 0 ? 'WEAK' : 'PASS';
|
|
642
|
+
return { id, title, verdict, summary, evidence: dedupe(evidence), failures: dedupe(failures), weakAreas: dedupe(weakAreas) };
|
|
643
|
+
}
|
|
644
|
+
function proveContains(content, needle, label) {
|
|
645
|
+
return contains(content, needle) ? [`${label}: ${needle}`] : [];
|
|
646
|
+
}
|
|
647
|
+
function contains(content, needle) {
|
|
648
|
+
return content.includes(needle);
|
|
649
|
+
}
|
|
650
|
+
function readIfExists(path) {
|
|
651
|
+
return existsSync(path) ? readFileSync(path, 'utf-8') : '';
|
|
652
|
+
}
|
|
653
|
+
function relativeFromRepo(cwd, path) {
|
|
654
|
+
return path.startsWith(cwd) ? path.slice(cwd.length + 1) : path;
|
|
655
|
+
}
|
|
184
656
|
function formatAuditHuman(report, explain) {
|
|
185
657
|
const lines = [];
|
|
186
658
|
lines.push('');
|
|
@@ -190,7 +662,13 @@ function formatAuditHuman(report, explain) {
|
|
|
190
662
|
lines.push('');
|
|
191
663
|
lines.push(` Task: ${report.task}`);
|
|
192
664
|
lines.push(` Completion State: ${report.completionState}`);
|
|
665
|
+
if (report.profileAudit) {
|
|
666
|
+
lines.push(` Audit Profile: ${report.profileAudit.profile}`);
|
|
667
|
+
}
|
|
193
668
|
lines.push('');
|
|
669
|
+
if (report.profileAudit) {
|
|
670
|
+
lines.push(...formatProfileAuditHuman(report.profileAudit));
|
|
671
|
+
}
|
|
194
672
|
lines.push(' ── Findings ────────────────────────────────────────────');
|
|
195
673
|
if (report.findings.length === 0) {
|
|
196
674
|
lines.push(' ✓ No material findings.');
|
|
@@ -236,6 +714,45 @@ function formatAuditHuman(report, explain) {
|
|
|
236
714
|
}
|
|
237
715
|
return lines;
|
|
238
716
|
}
|
|
717
|
+
function formatProfileAuditHuman(report) {
|
|
718
|
+
const lines = [];
|
|
719
|
+
lines.push(' ── Profile Verdicts ────────────────────────────────────');
|
|
720
|
+
for (const section of report.sections) {
|
|
721
|
+
lines.push(` ${section.verdict === 'PASS' ? '✓' : section.verdict === 'WEAK' ? '⚠' : '✗'} [${section.verdict}] ${section.title}`);
|
|
722
|
+
lines.push(` ${section.summary}`);
|
|
723
|
+
}
|
|
724
|
+
lines.push('');
|
|
725
|
+
lines.push(' ── Critical Gaps (Must-Fix) ────────────────────────────');
|
|
726
|
+
if (report.criticalGaps.length === 0) {
|
|
727
|
+
lines.push(' ✓ No critical gaps detected.');
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
for (const gap of report.criticalGaps)
|
|
731
|
+
lines.push(` · ${gap}`);
|
|
732
|
+
}
|
|
733
|
+
lines.push('');
|
|
734
|
+
lines.push(' ── Weak Areas (Should Improve) ─────────────────────────');
|
|
735
|
+
if (report.weakAreas.length === 0) {
|
|
736
|
+
lines.push(' ✓ No weak areas detected.');
|
|
737
|
+
}
|
|
738
|
+
else {
|
|
739
|
+
for (const gap of report.weakAreas)
|
|
740
|
+
lines.push(` · ${gap}`);
|
|
741
|
+
}
|
|
742
|
+
lines.push('');
|
|
743
|
+
lines.push(' ── Misleading Implementations ──────────────────────────');
|
|
744
|
+
if (report.misleadingImplementations.length === 0) {
|
|
745
|
+
lines.push(' ✓ No misleading implementations detected.');
|
|
746
|
+
}
|
|
747
|
+
else {
|
|
748
|
+
for (const item of report.misleadingImplementations)
|
|
749
|
+
lines.push(` · ${item}`);
|
|
750
|
+
}
|
|
751
|
+
lines.push('');
|
|
752
|
+
lines.push(` Overall Verdict: ${report.overallVerdict}`);
|
|
753
|
+
lines.push('');
|
|
754
|
+
return lines;
|
|
755
|
+
}
|
|
239
756
|
function collectOpenGaps(record) {
|
|
240
757
|
const gaps = [];
|
|
241
758
|
if (record.claims.length === 0) {
|