@codeledger/cli 0.7.3 → 0.7.6
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 +34 -1
- package/dist/commands/activate.js.map +1 -1
- package/dist/commands/broker.d.ts +15 -0
- package/dist/commands/broker.d.ts.map +1 -0
- package/dist/commands/broker.js +283 -0
- package/dist/commands/broker.js.map +1 -0
- package/dist/commands/complete-check.d.ts +23 -0
- package/dist/commands/complete-check.d.ts.map +1 -0
- package/dist/commands/complete-check.js +198 -0
- package/dist/commands/complete-check.js.map +1 -0
- package/dist/commands/guardrails.d.ts +11 -0
- package/dist/commands/guardrails.d.ts.map +1 -0
- package/dist/commands/guardrails.js +112 -0
- package/dist/commands/guardrails.js.map +1 -0
- package/dist/commands/init.d.ts +10 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +21 -44
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/lessons.d.ts +14 -0
- package/dist/commands/lessons.d.ts.map +1 -0
- package/dist/commands/lessons.js +196 -0
- package/dist/commands/lessons.js.map +1 -0
- package/dist/commands/memory.d.ts +16 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +315 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/pre-pr.d.ts +14 -0
- package/dist/commands/pre-pr.d.ts.map +1 -0
- package/dist/commands/pre-pr.js +57 -0
- package/dist/commands/pre-pr.js.map +1 -0
- package/dist/commands/release-check.d.ts +14 -0
- package/dist/commands/release-check.d.ts.map +1 -0
- package/dist/commands/release-check.js +44 -0
- package/dist/commands/release-check.js.map +1 -0
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +116 -0
- package/dist/commands/serve.js.map +1 -1
- package/dist/completion-integrity/claims.d.ts +21 -0
- package/dist/completion-integrity/claims.d.ts.map +1 -0
- package/dist/completion-integrity/claims.js +85 -0
- package/dist/completion-integrity/claims.js.map +1 -0
- package/dist/completion-integrity/confidence.d.ts +30 -0
- package/dist/completion-integrity/confidence.d.ts.map +1 -0
- package/dist/completion-integrity/confidence.js +86 -0
- package/dist/completion-integrity/confidence.js.map +1 -0
- package/dist/completion-integrity/ghost-detector.d.ts +37 -0
- package/dist/completion-integrity/ghost-detector.d.ts.map +1 -0
- package/dist/completion-integrity/ghost-detector.js +93 -0
- package/dist/completion-integrity/ghost-detector.js.map +1 -0
- package/dist/completion-integrity/history.d.ts +19 -0
- package/dist/completion-integrity/history.d.ts.map +1 -0
- package/dist/completion-integrity/history.js +44 -0
- package/dist/completion-integrity/history.js.map +1 -0
- package/dist/completion-integrity/index.d.ts +25 -0
- package/dist/completion-integrity/index.d.ts.map +1 -0
- package/dist/completion-integrity/index.js +243 -0
- package/dist/completion-integrity/index.js.map +1 -0
- package/dist/completion-integrity/neighborhood.d.ts +21 -0
- package/dist/completion-integrity/neighborhood.d.ts.map +1 -0
- package/dist/completion-integrity/neighborhood.js +274 -0
- package/dist/completion-integrity/neighborhood.js.map +1 -0
- package/dist/completion-integrity/output.d.ts +11 -0
- package/dist/completion-integrity/output.d.ts.map +1 -0
- package/dist/completion-integrity/output.js +215 -0
- package/dist/completion-integrity/output.js.map +1 -0
- package/dist/completion-integrity/self-audit.d.ts +28 -0
- package/dist/completion-integrity/self-audit.d.ts.map +1 -0
- package/dist/completion-integrity/self-audit.js +194 -0
- package/dist/completion-integrity/self-audit.js.map +1 -0
- package/dist/completion-integrity/semantic-drift.d.ts +22 -0
- package/dist/completion-integrity/semantic-drift.d.ts.map +1 -0
- package/dist/completion-integrity/semantic-drift.js +138 -0
- package/dist/completion-integrity/semantic-drift.js.map +1 -0
- package/dist/completion-integrity/state-machine.d.ts +36 -0
- package/dist/completion-integrity/state-machine.d.ts.map +1 -0
- package/dist/completion-integrity/state-machine.js +138 -0
- package/dist/completion-integrity/state-machine.js.map +1 -0
- package/dist/completion-integrity/types.d.ts +65 -0
- package/dist/completion-integrity/types.d.ts.map +1 -0
- package/dist/completion-integrity/types.js +4 -0
- package/dist/completion-integrity/types.js.map +1 -0
- package/dist/guardrails/adversarial-trigger.d.ts +15 -0
- package/dist/guardrails/adversarial-trigger.d.ts.map +1 -0
- package/dist/guardrails/adversarial-trigger.js +86 -0
- package/dist/guardrails/adversarial-trigger.js.map +1 -0
- package/dist/guardrails/export-collision.d.ts +11 -0
- package/dist/guardrails/export-collision.d.ts.map +1 -0
- package/dist/guardrails/export-collision.js +141 -0
- package/dist/guardrails/export-collision.js.map +1 -0
- package/dist/guardrails/index.d.ts +24 -0
- package/dist/guardrails/index.d.ts.map +1 -0
- package/dist/guardrails/index.js +24 -0
- package/dist/guardrails/index.js.map +1 -0
- package/dist/guardrails/release-tag.d.ts +10 -0
- package/dist/guardrails/release-tag.d.ts.map +1 -0
- package/dist/guardrails/release-tag.js +99 -0
- package/dist/guardrails/release-tag.js.map +1 -0
- package/dist/guardrails/rename-integrity.d.ts +13 -0
- package/dist/guardrails/rename-integrity.d.ts.map +1 -0
- package/dist/guardrails/rename-integrity.js +111 -0
- package/dist/guardrails/rename-integrity.js.map +1 -0
- package/dist/guardrails/runner.d.ts +10 -0
- package/dist/guardrails/runner.d.ts.map +1 -0
- package/dist/guardrails/runner.js +36 -0
- package/dist/guardrails/runner.js.map +1 -0
- package/dist/guardrails/stale-artifact.d.ts +11 -0
- package/dist/guardrails/stale-artifact.d.ts.map +1 -0
- package/dist/guardrails/stale-artifact.js +69 -0
- package/dist/guardrails/stale-artifact.js.map +1 -0
- package/dist/guardrails/unused-parameter.d.ts +11 -0
- package/dist/guardrails/unused-parameter.d.ts.map +1 -0
- package/dist/guardrails/unused-parameter.js +105 -0
- package/dist/guardrails/unused-parameter.js.map +1 -0
- package/dist/guardrails/workspace-validation.d.ts +12 -0
- package/dist/guardrails/workspace-validation.d.ts.map +1 -0
- package/dist/guardrails/workspace-validation.js +92 -0
- package/dist/guardrails/workspace-validation.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +265 -305
- package/dist/index.js.map +1 -1
- package/dist/insight/emit.d.ts +19 -0
- package/dist/insight/emit.d.ts.map +1 -0
- package/dist/insight/emit.js +105 -0
- package/dist/insight/emit.js.map +1 -0
- package/dist/insight/engine-bridge.d.ts +7 -0
- package/dist/insight/engine-bridge.d.ts.map +1 -0
- package/dist/insight/engine-bridge.js +6 -0
- package/dist/insight/engine-bridge.js.map +1 -0
- package/dist/insight/index.d.ts +3 -0
- package/dist/insight/index.d.ts.map +1 -0
- package/dist/insight/index.js +2 -0
- package/dist/insight/index.js.map +1 -0
- package/dist/memory/evidence-gates.d.ts +32 -0
- package/dist/memory/evidence-gates.d.ts.map +1 -0
- package/dist/memory/evidence-gates.js +168 -0
- package/dist/memory/evidence-gates.js.map +1 -0
- package/dist/memory/index.d.ts +9 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +9 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/lessons.d.ts +88 -0
- package/dist/memory/lessons.d.ts.map +1 -0
- package/dist/memory/lessons.js +370 -0
- package/dist/memory/lessons.js.map +1 -0
- package/dist/memory/ontology.d.ts +34 -0
- package/dist/memory/ontology.d.ts.map +1 -0
- package/dist/memory/ontology.js +125 -0
- package/dist/memory/ontology.js.map +1 -0
- package/dist/memory/preamble.d.ts +35 -0
- package/dist/memory/preamble.d.ts.map +1 -0
- package/dist/memory/preamble.js +104 -0
- package/dist/memory/preamble.js.map +1 -0
- package/dist/memory/recent-truth.d.ts +21 -0
- package/dist/memory/recent-truth.d.ts.map +1 -0
- package/dist/memory/recent-truth.js +78 -0
- package/dist/memory/recent-truth.js.map +1 -0
- package/dist/memory/storage.d.ts +25 -0
- package/dist/memory/storage.d.ts.map +1 -0
- package/dist/memory/storage.js +182 -0
- package/dist/memory/storage.js.map +1 -0
- package/dist/memory/structural-trust.d.ts +36 -0
- package/dist/memory/structural-trust.d.ts.map +1 -0
- package/dist/memory/structural-trust.js +77 -0
- package/dist/memory/structural-trust.js.map +1 -0
- package/dist/memory/validation-ledger.d.ts +28 -0
- package/dist/memory/validation-ledger.d.ts.map +1 -0
- package/dist/memory/validation-ledger.js +90 -0
- package/dist/memory/validation-ledger.js.map +1 -0
- package/dist/onboarding.d.ts +36 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +107 -0
- package/dist/onboarding.js.map +1 -0
- package/dist/pre-pr/checks.d.ts +18 -0
- package/dist/pre-pr/checks.d.ts.map +1 -0
- package/dist/pre-pr/checks.js +440 -0
- package/dist/pre-pr/checks.js.map +1 -0
- package/dist/pre-pr/orchestrator.d.ts +30 -0
- package/dist/pre-pr/orchestrator.d.ts.map +1 -0
- package/dist/pre-pr/orchestrator.js +104 -0
- package/dist/pre-pr/orchestrator.js.map +1 -0
- package/dist/release-check/engine.d.ts +30 -0
- package/dist/release-check/engine.d.ts.map +1 -0
- package/dist/release-check/engine.js +722 -0
- package/dist/release-check/engine.js.map +1 -0
- package/dist/release-check/index.d.ts +16 -0
- package/dist/release-check/index.d.ts.map +1 -0
- package/dist/release-check/index.js +16 -0
- package/dist/release-check/index.js.map +1 -0
- package/dist/release-check/output.d.ts +7 -0
- package/dist/release-check/output.d.ts.map +1 -0
- package/dist/release-check/output.js +123 -0
- package/dist/release-check/output.js.map +1 -0
- package/dist/templates/claude-md.js +1 -1
- package/dist/templates/claude-md.js.map +1 -1
- package/package.json +10 -10
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ghost File Detector
|
|
3
|
+
*
|
|
4
|
+
* For each claim's alleged files, checks whether they appear in `git diff --name-only`.
|
|
5
|
+
* If a claimed file is absent from the diff → RealityMismatch, claim marked unverified,
|
|
6
|
+
* completionState forced to "incomplete".
|
|
7
|
+
*
|
|
8
|
+
* This is a HARD rule: no ghost file may survive to the "implemented" state.
|
|
9
|
+
*/
|
|
10
|
+
import { execSync } from 'node:child_process';
|
|
11
|
+
/**
|
|
12
|
+
* Retrieve files currently changed relative to HEAD (staged + unstaged).
|
|
13
|
+
* Falls back to an empty set if git is unavailable or not a git repo.
|
|
14
|
+
*/
|
|
15
|
+
export function getDiffFiles(cwd) {
|
|
16
|
+
try {
|
|
17
|
+
// Include both staged and unstaged changes
|
|
18
|
+
const staged = execSync('git diff --name-only --cached', {
|
|
19
|
+
cwd,
|
|
20
|
+
encoding: 'utf-8',
|
|
21
|
+
timeout: 10_000,
|
|
22
|
+
}).trim();
|
|
23
|
+
const unstaged = execSync('git diff --name-only', {
|
|
24
|
+
cwd,
|
|
25
|
+
encoding: 'utf-8',
|
|
26
|
+
timeout: 10_000,
|
|
27
|
+
}).trim();
|
|
28
|
+
const files = new Set();
|
|
29
|
+
for (const line of [...staged.split('\n'), ...unstaged.split('\n')]) {
|
|
30
|
+
const trimmed = line.trim();
|
|
31
|
+
if (trimmed)
|
|
32
|
+
files.add(trimmed);
|
|
33
|
+
}
|
|
34
|
+
return files;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return new Set();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Also retrieve files that have been committed since the last push / since session start.
|
|
42
|
+
* Uses git diff against the remote tracking branch when available.
|
|
43
|
+
*/
|
|
44
|
+
export function getCommittedFiles(cwd) {
|
|
45
|
+
try {
|
|
46
|
+
const output = execSync('git diff --name-only @{upstream} HEAD 2>/dev/null || git diff --name-only HEAD~1 HEAD 2>/dev/null || echo ""', { cwd, encoding: 'utf-8', timeout: 10_000, shell: '/bin/sh' }).trim();
|
|
47
|
+
const files = new Set();
|
|
48
|
+
for (const line of output.split('\n')) {
|
|
49
|
+
const trimmed = line.trim();
|
|
50
|
+
if (trimmed)
|
|
51
|
+
files.add(trimmed);
|
|
52
|
+
}
|
|
53
|
+
return files;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return new Set();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** All modified files: staged + unstaged + recently committed */
|
|
60
|
+
export function getAllModifiedFiles(cwd) {
|
|
61
|
+
const diff = getDiffFiles(cwd);
|
|
62
|
+
const committed = getCommittedFiles(cwd);
|
|
63
|
+
return new Set([...diff, ...committed]);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Run ghost file detection on all claims.
|
|
67
|
+
* Mutates claims in-place: sets `verified = false` for any claim
|
|
68
|
+
* whose files are absent from the git diff.
|
|
69
|
+
*/
|
|
70
|
+
export function detectGhostFiles(cwd, claims) {
|
|
71
|
+
const modifiedFiles = getAllModifiedFiles(cwd);
|
|
72
|
+
const diffFiles = [...modifiedFiles];
|
|
73
|
+
const mismatches = [];
|
|
74
|
+
const updatedClaims = claims.map((claim) => {
|
|
75
|
+
if (!claim.files || claim.files.length === 0) {
|
|
76
|
+
// No files claimed → cannot verify; leave as is
|
|
77
|
+
return { ...claim, verified: false };
|
|
78
|
+
}
|
|
79
|
+
const ghostFiles = claim.files.filter((f) => !modifiedFiles.has(f));
|
|
80
|
+
for (const ghost of ghostFiles) {
|
|
81
|
+
mismatches.push({
|
|
82
|
+
claim: claim.description,
|
|
83
|
+
expectedTarget: ghost,
|
|
84
|
+
actualDiffPresence: false,
|
|
85
|
+
severity: 'critical',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const allPresent = ghostFiles.length === 0;
|
|
89
|
+
return { ...claim, verified: allPresent };
|
|
90
|
+
});
|
|
91
|
+
return { claims: updatedClaims, mismatches, diffFiles };
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=ghost-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ghost-detector.js","sourceRoot":"","sources":["../../src/completion-integrity/ghost-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,IAAI,CAAC;QACH,2CAA2C;QAC3C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,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;QAC3C,OAAO,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion History Ledger
|
|
3
|
+
*
|
|
4
|
+
* Appends each CIC run to .codeledger/completion/completion-history.jsonl
|
|
5
|
+
* as an append-only record. Each line is a CompletionHistoryEntry.
|
|
6
|
+
*
|
|
7
|
+
* This becomes:
|
|
8
|
+
* - memory of completion truth
|
|
9
|
+
* - training signal for future runs
|
|
10
|
+
*/
|
|
11
|
+
import type { CompletionRecord } from './types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Append a completion record to the history ledger.
|
|
14
|
+
* Creates the directory if needed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function appendCompletionHistory(cwd: string, record: CompletionRecord): void;
|
|
17
|
+
/** Path to the history file (for display purposes) */
|
|
18
|
+
export declare function historyFilePath(cwd: string): string;
|
|
19
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/completion-integrity/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAMnD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,gBAAgB,GACvB,IAAI,CAuBN;AAED,sDAAsD;AACtD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion History Ledger
|
|
3
|
+
*
|
|
4
|
+
* Appends each CIC run to .codeledger/completion/completion-history.jsonl
|
|
5
|
+
* as an append-only record. Each line is a CompletionHistoryEntry.
|
|
6
|
+
*
|
|
7
|
+
* This becomes:
|
|
8
|
+
* - memory of completion truth
|
|
9
|
+
* - training signal for future runs
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, mkdirSync, appendFileSync } from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
const HISTORY_DIR = join('.codeledger', 'completion');
|
|
14
|
+
const HISTORY_FILE = 'completion-history.jsonl';
|
|
15
|
+
/**
|
|
16
|
+
* Append a completion record to the history ledger.
|
|
17
|
+
* Creates the directory if needed.
|
|
18
|
+
*/
|
|
19
|
+
export function appendCompletionHistory(cwd, record) {
|
|
20
|
+
const dir = join(cwd, HISTORY_DIR);
|
|
21
|
+
if (!existsSync(dir)) {
|
|
22
|
+
mkdirSync(dir, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
const entry = {
|
|
25
|
+
run_id: record.run_id,
|
|
26
|
+
checked_at: record.checked_at,
|
|
27
|
+
task: record.task,
|
|
28
|
+
taskType: record.taskType,
|
|
29
|
+
completionState: record.completionState,
|
|
30
|
+
claim_count: record.claims.length,
|
|
31
|
+
verified_claim_count: record.claims.filter((c) => c.verified).length,
|
|
32
|
+
mismatch_count: (record.realityMismatches ?? []).length,
|
|
33
|
+
drift_warning_count: (record.semanticDriftWarnings ?? []).length,
|
|
34
|
+
audit_pass_count: record.audits.filter((a) => a.outcome === 'pass').length,
|
|
35
|
+
audit_fail_count: record.audits.filter((a) => a.outcome === 'fail').length,
|
|
36
|
+
};
|
|
37
|
+
const line = JSON.stringify(entry);
|
|
38
|
+
appendFileSync(join(dir, HISTORY_FILE), line + '\n', 'utf-8');
|
|
39
|
+
}
|
|
40
|
+
/** Path to the history file (for display purposes) */
|
|
41
|
+
export function historyFilePath(cwd) {
|
|
42
|
+
return join(cwd, HISTORY_DIR, HISTORY_FILE);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/completion-integrity/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AACtD,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,GAAW,EACX,MAAwB;IAExB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAEnC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,KAAK,GAA2B;QACpC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;QACjC,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM;QACpE,cAAc,EAAE,CAAC,MAAM,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,MAAM;QACvD,mBAAmB,EAAE,CAAC,MAAM,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC,MAAM;QAChE,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,MAAM;QAC1E,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,MAAM;KAC3E,CAAC;IAEF,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion Integrity Check (CIC v2) — Main Orchestration
|
|
3
|
+
*
|
|
4
|
+
* Pipeline:
|
|
5
|
+
* 1. Parse / normalize claims from summary or structured input
|
|
6
|
+
* 2. Ghost file detection (git diff vs claimed files)
|
|
7
|
+
* 3. Neighborhood evaluation (task-type surface checks)
|
|
8
|
+
* 4. Semantic drift audit
|
|
9
|
+
* 5. Confidence gap assessment
|
|
10
|
+
* 6. Pre-completion self-audits (5 types)
|
|
11
|
+
* 7. State promotion ladder
|
|
12
|
+
* 8. Ledger append
|
|
13
|
+
* 9. Output formatting
|
|
14
|
+
*/
|
|
15
|
+
import type { CICOptions, CICResult } from './types.js';
|
|
16
|
+
export type { CICOptions, CICResult } from './types.js';
|
|
17
|
+
export { inferTaskType } from './neighborhood.js';
|
|
18
|
+
export { detectGhostFiles } from './ghost-detector.js';
|
|
19
|
+
export { promoteState } from './state-machine.js';
|
|
20
|
+
/**
|
|
21
|
+
* Run the full CIC pipeline and return structured results.
|
|
22
|
+
*/
|
|
23
|
+
export declare function runCIC(options: CICOptions): CICResult;
|
|
24
|
+
export { formatHumanOutput, formatJsonOutput } from './output.js';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/completion-integrity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA0BxD,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CA8OrD;AAcD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion Integrity Check (CIC v2) — Main Orchestration
|
|
3
|
+
*
|
|
4
|
+
* Pipeline:
|
|
5
|
+
* 1. Parse / normalize claims from summary or structured input
|
|
6
|
+
* 2. Ghost file detection (git diff vs claimed files)
|
|
7
|
+
* 3. Neighborhood evaluation (task-type surface checks)
|
|
8
|
+
* 4. Semantic drift audit
|
|
9
|
+
* 5. Confidence gap assessment
|
|
10
|
+
* 6. Pre-completion self-audits (5 types)
|
|
11
|
+
* 7. State promotion ladder
|
|
12
|
+
* 8. Ledger append
|
|
13
|
+
* 9. Output formatting
|
|
14
|
+
*/
|
|
15
|
+
import { randomUUID } from 'node:crypto';
|
|
16
|
+
import { execSync } from 'node:child_process';
|
|
17
|
+
import { detectGhostFiles } from './ghost-detector.js';
|
|
18
|
+
import { promoteState } from './state-machine.js';
|
|
19
|
+
import { inferTaskType, evaluateNeighborhood, computeNeighborhoodSummary } from './neighborhood.js';
|
|
20
|
+
import { auditSemanticDrift } from './semantic-drift.js';
|
|
21
|
+
import { assessConfidenceGap, inferClaimConfidence } from './confidence.js';
|
|
22
|
+
import { runAllAudits } from './self-audit.js';
|
|
23
|
+
import { appendCompletionHistory } from './history.js';
|
|
24
|
+
import { formatHumanOutput } from './output.js';
|
|
25
|
+
import { parseClaimsFromSummary, normalizeRawClaims, normalizeRawEvidence, } from './claims.js';
|
|
26
|
+
import { runAllGuardrails } from '../guardrails/runner.js';
|
|
27
|
+
import { evaluateTrigger, getActiveLessons, computeRiskMultiplier, getEffectiveSeverity, recordEvent, proposeFromGuardFailure, } from '../memory/lessons.js';
|
|
28
|
+
import { loadLessonsLedger, saveLessonsLedger } from '../memory/storage.js';
|
|
29
|
+
export { inferTaskType } from './neighborhood.js';
|
|
30
|
+
export { detectGhostFiles } from './ghost-detector.js';
|
|
31
|
+
export { promoteState } from './state-machine.js';
|
|
32
|
+
/**
|
|
33
|
+
* Run the full CIC pipeline and return structured results.
|
|
34
|
+
*/
|
|
35
|
+
export function runCIC(options) {
|
|
36
|
+
const { cwd, task, summary, claims: rawClaims, evidence: rawEvidence, omissions: rawOmissions, taskType: overrideTaskType, } = options;
|
|
37
|
+
const runId = `cic-${randomUUID().slice(0, 8)}`;
|
|
38
|
+
const checkedAt = new Date().toISOString();
|
|
39
|
+
// ── Step 1: Parse / normalize claims ───────────────────────────────────────
|
|
40
|
+
let claims = rawClaims && rawClaims.length > 0
|
|
41
|
+
? normalizeRawClaims(rawClaims)
|
|
42
|
+
: summary
|
|
43
|
+
? parseClaimsFromSummary(summary)
|
|
44
|
+
: [];
|
|
45
|
+
const evidence = rawEvidence ? normalizeRawEvidence(rawEvidence) : [];
|
|
46
|
+
// ── Step 2: Normalize omissions ────────────────────────────────────────────
|
|
47
|
+
const omissions = (rawOmissions ?? []).map((o, i) => ({
|
|
48
|
+
id: `omit-${i}`,
|
|
49
|
+
description: o.description,
|
|
50
|
+
scope: o.scope ?? [],
|
|
51
|
+
reason: o.reason,
|
|
52
|
+
}));
|
|
53
|
+
// ── Step 3: Ghost file detection ───────────────────────────────────────────
|
|
54
|
+
const ghostResult = detectGhostFiles(cwd, claims);
|
|
55
|
+
claims = ghostResult.claims;
|
|
56
|
+
const mismatches = ghostResult.mismatches;
|
|
57
|
+
const diffFiles = ghostResult.diffFiles;
|
|
58
|
+
// ── Step 4: Task type inference ────────────────────────────────────────────
|
|
59
|
+
const taskType = overrideTaskType ?? inferTaskType(task);
|
|
60
|
+
// ── Step 5: Neighborhood evaluation ───────────────────────────────────────
|
|
61
|
+
const diffSet = new Set(diffFiles);
|
|
62
|
+
const neighborhood = evaluateNeighborhood(cwd, taskType, diffSet, omissions);
|
|
63
|
+
const { completed, unchecked } = computeNeighborhoodSummary(neighborhood);
|
|
64
|
+
// ── Step 6: Semantic drift audit ───────────────────────────────────────────
|
|
65
|
+
const summaryText = summary ?? claims.map((c) => c.description).join('. ');
|
|
66
|
+
const driftResult = auditSemanticDrift(summaryText, diffFiles);
|
|
67
|
+
const driftWarnings = driftResult.warnings;
|
|
68
|
+
// ── Step 7: Self-audits ────────────────────────────────────────────────────
|
|
69
|
+
const claimConfidence = inferClaimConfidence(summaryText);
|
|
70
|
+
const audits = runAllAudits({
|
|
71
|
+
claims,
|
|
72
|
+
mismatches,
|
|
73
|
+
diffFiles,
|
|
74
|
+
neighborhood,
|
|
75
|
+
taskType,
|
|
76
|
+
driftWarnings,
|
|
77
|
+
});
|
|
78
|
+
// ── Step 8: Confidence gap assessment (with audit results) ─────────────────
|
|
79
|
+
const confidenceAssessment = assessConfidenceGap(claimConfidence, evidence, audits);
|
|
80
|
+
// ── Step 8.5: Guardrails ──────────────────────────────────────────────────
|
|
81
|
+
const guardrailsReport = runAllGuardrails({
|
|
82
|
+
cwd,
|
|
83
|
+
task,
|
|
84
|
+
taskType,
|
|
85
|
+
diffFiles,
|
|
86
|
+
claims,
|
|
87
|
+
});
|
|
88
|
+
const guards = guardrailsReport.guards;
|
|
89
|
+
// ── Step 8.6: Lessons evaluation ──────────────────────────────────────────
|
|
90
|
+
let lessonsLedger = loadLessonsLedger(cwd);
|
|
91
|
+
const activeLessons = getActiveLessons(lessonsLedger);
|
|
92
|
+
const triggeredLessons = [];
|
|
93
|
+
// Build aggregated diff content for content_contains matching
|
|
94
|
+
let diffContent;
|
|
95
|
+
const needsContent = activeLessons.some((l) => l.triggerCriteria.content_contains && l.triggerCriteria.content_contains.length > 0);
|
|
96
|
+
if (needsContent) {
|
|
97
|
+
try {
|
|
98
|
+
diffContent = execSync('git diff HEAD', { cwd, encoding: 'utf-8', timeout: 10_000 });
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// Non-fatal — content matching unavailable
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
for (const lesson of activeLessons) {
|
|
105
|
+
if (evaluateTrigger(lesson, { files: diffFiles, task, content: diffContent, cwd })) {
|
|
106
|
+
const riskMultiplier = computeRiskMultiplier(lesson.id, lessonsLedger.events);
|
|
107
|
+
const effectiveSeverity = getEffectiveSeverity(lesson, lessonsLedger.events);
|
|
108
|
+
triggeredLessons.push({ lesson, effectiveSeverity, riskMultiplier });
|
|
109
|
+
// Record trigger event
|
|
110
|
+
lessonsLedger = recordEvent(lessonsLedger, {
|
|
111
|
+
id: `evt-${runId}-${lesson.id}`,
|
|
112
|
+
lessonId: lesson.id,
|
|
113
|
+
timestamp: checkedAt,
|
|
114
|
+
eventType: 'triggered',
|
|
115
|
+
riskMultiplier,
|
|
116
|
+
detail: `Triggered during CIC for task: ${task}`,
|
|
117
|
+
relatedFiles: diffFiles.slice(0, 10),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// ── Step 8.7: Guard → Lesson bridge ────────────────────────────────────────
|
|
122
|
+
// When guards fail, ensure a lesson exists and record events for escalation.
|
|
123
|
+
for (const guard of guards) {
|
|
124
|
+
if (guard.outcome !== 'pass') {
|
|
125
|
+
const guardLessonId = `guard:${guard.category}`;
|
|
126
|
+
// Auto-propose a lesson if one doesn't exist for this guard category
|
|
127
|
+
lessonsLedger = proposeFromGuardFailure(lessonsLedger, guard, checkedAt);
|
|
128
|
+
// Record trigger event against the actual lesson
|
|
129
|
+
lessonsLedger = recordEvent(lessonsLedger, {
|
|
130
|
+
id: `evt-guard-${runId}-${guard.id}`,
|
|
131
|
+
lessonId: guardLessonId,
|
|
132
|
+
timestamp: checkedAt,
|
|
133
|
+
eventType: 'triggered',
|
|
134
|
+
riskMultiplier: guard.outcome === 'fail' ? 1.5 : 1.0,
|
|
135
|
+
detail: `Guard ${guard.id} ${guard.outcome}: ${guard.detail}`,
|
|
136
|
+
relatedFiles: guard.files?.slice(0, 10),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// Persist updated events (before promotion, so state machine can read latest risk)
|
|
141
|
+
try {
|
|
142
|
+
saveLessonsLedger(cwd, lessonsLedger);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
// Non-fatal — don't break CIC for ledger write errors
|
|
146
|
+
}
|
|
147
|
+
// ── Step 9: State promotion ────────────────────────────────────────────────
|
|
148
|
+
const promotionResult = promoteState({
|
|
149
|
+
claims,
|
|
150
|
+
mismatches,
|
|
151
|
+
diffFiles,
|
|
152
|
+
neighborhood,
|
|
153
|
+
audits,
|
|
154
|
+
evidence,
|
|
155
|
+
guards,
|
|
156
|
+
triggeredLessons,
|
|
157
|
+
});
|
|
158
|
+
// If confidence mismatch, cap state at implemented (cannot be verified without evidence alignment)
|
|
159
|
+
const effectiveState = confidenceAssessment.mismatch &&
|
|
160
|
+
isHigherThan(promotionResult.state, 'implemented')
|
|
161
|
+
? 'implemented'
|
|
162
|
+
: promotionResult.state;
|
|
163
|
+
// ── Step 9.5: Record ignored events (amnesia engine) ────────────────────────
|
|
164
|
+
// If a lesson triggered but completion proceeded past it (not blocked),
|
|
165
|
+
// record an 'ignored' event. This feeds the escalation pipeline:
|
|
166
|
+
// 3+ triggers + 1 ignore within 14 days → severity escalation.
|
|
167
|
+
for (const t of triggeredLessons) {
|
|
168
|
+
if (t.effectiveSeverity !== 'high' || t.lesson.status !== 'verified') {
|
|
169
|
+
// This lesson triggered but did not block — record as ignored
|
|
170
|
+
lessonsLedger = recordEvent(lessonsLedger, {
|
|
171
|
+
id: `evt-ign-${runId}-${t.lesson.id}`,
|
|
172
|
+
lessonId: t.lesson.id,
|
|
173
|
+
timestamp: checkedAt,
|
|
174
|
+
eventType: 'ignored',
|
|
175
|
+
riskMultiplier: t.riskMultiplier,
|
|
176
|
+
detail: `Triggered but completion proceeded at state: ${effectiveState}`,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Persist after ignored events
|
|
181
|
+
if (triggeredLessons.length > 0) {
|
|
182
|
+
try {
|
|
183
|
+
saveLessonsLedger(cwd, lessonsLedger);
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
// Non-fatal
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// ── Step 10: Build record ──────────────────────────────────────────────────
|
|
190
|
+
const record = {
|
|
191
|
+
run_id: runId,
|
|
192
|
+
checked_at: checkedAt,
|
|
193
|
+
task,
|
|
194
|
+
taskType,
|
|
195
|
+
completionState: effectiveState,
|
|
196
|
+
claims,
|
|
197
|
+
diffFiles,
|
|
198
|
+
neighborhood,
|
|
199
|
+
audits,
|
|
200
|
+
remainingUnchecked: unchecked,
|
|
201
|
+
completed,
|
|
202
|
+
intentionalOmissions: omissions.length > 0 ? omissions : undefined,
|
|
203
|
+
confidenceAssessment,
|
|
204
|
+
semanticDriftWarnings: driftWarnings.length > 0 ? driftWarnings : undefined,
|
|
205
|
+
realityMismatches: mismatches.length > 0 ? mismatches : undefined,
|
|
206
|
+
guards: guards.length > 0 ? guards : undefined,
|
|
207
|
+
triggeredLessons: triggeredLessons.length > 0
|
|
208
|
+
? triggeredLessons.map((t) => ({
|
|
209
|
+
lessonId: t.lesson.id,
|
|
210
|
+
title: t.lesson.title,
|
|
211
|
+
severity: t.effectiveSeverity,
|
|
212
|
+
detail: t.lesson.summary,
|
|
213
|
+
}))
|
|
214
|
+
: undefined,
|
|
215
|
+
};
|
|
216
|
+
// ── Step 11: Ledger append ─────────────────────────────────────────────────
|
|
217
|
+
try {
|
|
218
|
+
appendCompletionHistory(cwd, record);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
// Never fail the run due to ledger write errors
|
|
222
|
+
}
|
|
223
|
+
// ── Step 12: Format output ─────────────────────────────────────────────────
|
|
224
|
+
const humanOutput = options.json
|
|
225
|
+
? []
|
|
226
|
+
: formatHumanOutput(record, promotionResult.blockers);
|
|
227
|
+
return {
|
|
228
|
+
record,
|
|
229
|
+
humanOutput,
|
|
230
|
+
isVerified: ['verified', 'audited', 'release_safe'].includes(effectiveState),
|
|
231
|
+
hasGhostFiles: mismatches.length > 0,
|
|
232
|
+
isReleaseSafe: effectiveState === 'release_safe',
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
236
|
+
const STATE_ORDER = [
|
|
237
|
+
'incomplete', 'edited', 'implemented', 'wired', 'verified', 'audited', 'release_safe',
|
|
238
|
+
];
|
|
239
|
+
function isHigherThan(state, than) {
|
|
240
|
+
return STATE_ORDER.indexOf(state) > STATE_ORDER.indexOf(than);
|
|
241
|
+
}
|
|
242
|
+
export { formatHumanOutput, formatJsonOutput } from './output.js';
|
|
243
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/completion-integrity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;A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EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion Neighborhood
|
|
3
|
+
*
|
|
4
|
+
* Based on the inferred task type, defines which surfaces must be checked
|
|
5
|
+
* for a complete implementation. Agents may declare intentional omissions
|
|
6
|
+
* to avoid penalization for surfaces they knowingly skipped.
|
|
7
|
+
*/
|
|
8
|
+
import type { CICTaskType, IntentionalOmission, NeighborhoodSurface } from './types.js';
|
|
9
|
+
export declare function inferTaskType(task: string): CICTaskType;
|
|
10
|
+
/**
|
|
11
|
+
* Build the neighborhood for a task type, checking which surfaces have
|
|
12
|
+
* files present in the diff and which are covered by omissions.
|
|
13
|
+
*/
|
|
14
|
+
export declare function evaluateNeighborhood(cwd: string, taskType: CICTaskType, diffFiles: Set<string>, omissions: IntentionalOmission[]): NeighborhoodSurface[];
|
|
15
|
+
/** Compute which surfaces are complete vs unchecked */
|
|
16
|
+
export declare function computeNeighborhoodSummary(surfaces: NeighborhoodSurface[]): {
|
|
17
|
+
completed: string[];
|
|
18
|
+
unchecked: string[];
|
|
19
|
+
intentional: string[];
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=neighborhood.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neighborhood.d.ts","sourceRoot":"","sources":["../../src/completion-integrity/neighborhood.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EAEpB,MAAM,YAAY,CAAC;AAsJpB,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAcvD;AAID;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,EACtB,SAAS,EAAE,mBAAmB,EAAE,GAC/B,mBAAmB,EAAE,CAwDvB;AAED,uDAAuD;AACvD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,mBAAmB,EAAE,GAC9B;IAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAgBrE"}
|