@codeledger/cli 0.2.1 → 0.5.1

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.
Files changed (137) hide show
  1. package/dist/artifacts/summary.d.ts +6 -0
  2. package/dist/artifacts/summary.d.ts.map +1 -0
  3. package/dist/artifacts/summary.js +49 -0
  4. package/dist/artifacts/summary.js.map +1 -0
  5. package/dist/commands/activate.d.ts.map +1 -1
  6. package/dist/commands/activate.js +155 -19
  7. package/dist/commands/activate.js.map +1 -1
  8. package/dist/commands/bundle.d.ts.map +1 -1
  9. package/dist/commands/bundle.js +28 -5
  10. package/dist/commands/bundle.js.map +1 -1
  11. package/dist/commands/checkpoint.d.ts +26 -0
  12. package/dist/commands/checkpoint.d.ts.map +1 -0
  13. package/dist/commands/checkpoint.js +382 -0
  14. package/dist/commands/checkpoint.js.map +1 -0
  15. package/dist/commands/cowork-snapshot.d.ts.map +1 -1
  16. package/dist/commands/cowork-snapshot.js +3 -2
  17. package/dist/commands/cowork-snapshot.js.map +1 -1
  18. package/dist/commands/doctor.d.ts +9 -0
  19. package/dist/commands/doctor.d.ts.map +1 -0
  20. package/dist/commands/doctor.js +169 -0
  21. package/dist/commands/doctor.js.map +1 -0
  22. package/dist/commands/init.d.ts.map +1 -1
  23. package/dist/commands/init.js +46 -12
  24. package/dist/commands/init.js.map +1 -1
  25. package/dist/commands/intent.d.ts +37 -0
  26. package/dist/commands/intent.d.ts.map +1 -0
  27. package/dist/commands/intent.js +408 -0
  28. package/dist/commands/intent.js.map +1 -0
  29. package/dist/commands/manifest.d.ts +8 -0
  30. package/dist/commands/manifest.d.ts.map +1 -0
  31. package/dist/commands/manifest.js +144 -0
  32. package/dist/commands/manifest.js.map +1 -0
  33. package/dist/commands/policy.d.ts +8 -0
  34. package/dist/commands/policy.d.ts.map +1 -0
  35. package/dist/commands/policy.js +27 -0
  36. package/dist/commands/policy.js.map +1 -0
  37. package/dist/commands/refine.d.ts.map +1 -1
  38. package/dist/commands/refine.js +16 -0
  39. package/dist/commands/refine.js.map +1 -1
  40. package/dist/commands/review-coverage.d.ts +12 -0
  41. package/dist/commands/review-coverage.d.ts.map +1 -0
  42. package/dist/commands/review-coverage.js +142 -0
  43. package/dist/commands/review-coverage.js.map +1 -0
  44. package/dist/commands/review-gate.d.ts +12 -0
  45. package/dist/commands/review-gate.d.ts.map +1 -0
  46. package/dist/commands/review-gate.js +130 -0
  47. package/dist/commands/review-gate.js.map +1 -0
  48. package/dist/commands/session-cleanup.js +1 -0
  49. package/dist/commands/session-cleanup.js.map +1 -1
  50. package/dist/commands/session-progress.d.ts.map +1 -1
  51. package/dist/commands/session-progress.js +29 -1
  52. package/dist/commands/session-progress.js.map +1 -1
  53. package/dist/commands/session-summary.d.ts.map +1 -1
  54. package/dist/commands/session-summary.js +620 -37
  55. package/dist/commands/session-summary.js.map +1 -1
  56. package/dist/commands/setup-ci.d.ts +9 -0
  57. package/dist/commands/setup-ci.d.ts.map +1 -0
  58. package/dist/commands/setup-ci.js +139 -0
  59. package/dist/commands/setup-ci.js.map +1 -0
  60. package/dist/commands/shared-summary.d.ts +15 -0
  61. package/dist/commands/shared-summary.d.ts.map +1 -0
  62. package/dist/commands/shared-summary.js +194 -0
  63. package/dist/commands/shared-summary.js.map +1 -0
  64. package/dist/commands/sign-manifest.d.ts +8 -0
  65. package/dist/commands/sign-manifest.d.ts.map +1 -0
  66. package/dist/commands/sign-manifest.js +58 -0
  67. package/dist/commands/sign-manifest.js.map +1 -0
  68. package/dist/commands/verify.d.ts +13 -0
  69. package/dist/commands/verify.d.ts.map +1 -0
  70. package/dist/commands/verify.js +288 -0
  71. package/dist/commands/verify.js.map +1 -0
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +153 -2
  74. package/dist/index.js.map +1 -1
  75. package/dist/integrations/github-actions.d.ts +17 -0
  76. package/dist/integrations/github-actions.d.ts.map +1 -0
  77. package/dist/integrations/github-actions.js +64 -0
  78. package/dist/integrations/github-actions.js.map +1 -0
  79. package/dist/manifest/build.d.ts +19 -0
  80. package/dist/manifest/build.d.ts.map +1 -0
  81. package/dist/manifest/build.js +82 -0
  82. package/dist/manifest/build.js.map +1 -0
  83. package/dist/manifest/schema.d.ts +2 -0
  84. package/dist/manifest/schema.d.ts.map +1 -0
  85. package/dist/manifest/schema.js +2 -0
  86. package/dist/manifest/schema.js.map +1 -0
  87. package/dist/manifest/write.d.ts +13 -0
  88. package/dist/manifest/write.d.ts.map +1 -0
  89. package/dist/manifest/write.js +69 -0
  90. package/dist/manifest/write.js.map +1 -0
  91. package/dist/policy/load.d.ts +21 -0
  92. package/dist/policy/load.d.ts.map +1 -0
  93. package/dist/policy/load.js +63 -0
  94. package/dist/policy/load.js.map +1 -0
  95. package/dist/policy/resolve.d.ts +18 -0
  96. package/dist/policy/resolve.d.ts.map +1 -0
  97. package/dist/policy/resolve.js +86 -0
  98. package/dist/policy/resolve.js.map +1 -0
  99. package/dist/policy/schema.d.ts +22 -0
  100. package/dist/policy/schema.d.ts.map +1 -0
  101. package/dist/policy/schema.js +82 -0
  102. package/dist/policy/schema.js.map +1 -0
  103. package/dist/session-paths.d.ts +8 -0
  104. package/dist/session-paths.d.ts.map +1 -1
  105. package/dist/session-paths.js +16 -0
  106. package/dist/session-paths.js.map +1 -1
  107. package/dist/signing/canonicalize.d.ts +17 -0
  108. package/dist/signing/canonicalize.d.ts.map +1 -0
  109. package/dist/signing/canonicalize.js +50 -0
  110. package/dist/signing/canonicalize.js.map +1 -0
  111. package/dist/signing/hmac.d.ts +8 -0
  112. package/dist/signing/hmac.d.ts.map +1 -0
  113. package/dist/signing/hmac.js +16 -0
  114. package/dist/signing/hmac.js.map +1 -0
  115. package/dist/signing/signer.d.ts +16 -0
  116. package/dist/signing/signer.d.ts.map +1 -0
  117. package/dist/signing/signer.js +2 -0
  118. package/dist/signing/signer.js.map +1 -0
  119. package/dist/templates/claude-md.d.ts.map +1 -1
  120. package/dist/templates/claude-md.js +9 -2
  121. package/dist/templates/claude-md.js.map +1 -1
  122. package/dist/templates/config.d.ts.map +1 -1
  123. package/dist/templates/config.js +48 -10
  124. package/dist/templates/config.js.map +1 -1
  125. package/dist/verify/evaluate.d.ts +10 -0
  126. package/dist/verify/evaluate.d.ts.map +1 -0
  127. package/dist/verify/evaluate.js +117 -0
  128. package/dist/verify/evaluate.js.map +1 -0
  129. package/dist/verify/policy-snapshot.d.ts +7 -0
  130. package/dist/verify/policy-snapshot.d.ts.map +1 -0
  131. package/dist/verify/policy-snapshot.js +36 -0
  132. package/dist/verify/policy-snapshot.js.map +1 -0
  133. package/dist/verify/report.d.ts +11 -0
  134. package/dist/verify/report.d.ts.map +1 -0
  135. package/dist/verify/report.js +64 -0
  136. package/dist/verify/report.js.map +1 -0
  137. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"session-paths.d.ts","sourceRoot":"","sources":["../src/session-paths.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAK3E;AAED,2DAA2D;AAC3D,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAElF;AAED,6DAA6D;AAC7D,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAEnF;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAEhF;AAED,6CAA6C;AAC7C,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAEpF;AAED,wCAAwC;AACxC,wBAAgB,uBA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AI,GAAG,MAAM,CAEvF;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,+BAA+B;AAC/B,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,0BAA0B;AAC1B,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAEnF;AAED,sEAAsE;AACtE,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAExF;AAED,sEAAsE;AACtE,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAE1F"}
@@ -29,6 +29,10 @@ export function sessionProgressPath(cwd, sessionId) {
29
29
  export function sessionHookRemindedPath(cwd, sessionId) {
30
30
  return join(sessionDir(cwd, sessionId), '.hook-reminded');
31
31
  }
32
+ /** Path to the per-task activation history (JSONL, one record per activate call). */
33
+ export function sessionTaskHistoryPath(cwd, sessionId) {
34
+ return join(sessionDir(cwd, sessionId), '.task-history.jsonl');
35
+ }
32
36
  /** Legacy fallback bundle path (always .codeledger/active-bundle.md). */
33
37
  export function legacyBundlePath(cwd) {
34
38
  return join(cwd, '.codeledger', 'active-bundle.md');
@@ -41,4 +45,16 @@ export function sessionsRootDir(cwd) {
41
45
  export function registryPath(cwd) {
42
46
  return join(cwd, '.codeledger', 'sessions', 'registry.json');
43
47
  }
48
+ /** Path to the read log (JSONL, one record per file read). */
49
+ export function sessionReadLogPath(cwd, sessionId) {
50
+ return join(sessionDir(cwd, sessionId), '.read-log.jsonl');
51
+ }
52
+ /** Path to the review config (written when --mode review is used). */
53
+ export function sessionReviewConfigPath(cwd, sessionId) {
54
+ return join(sessionDir(cwd, sessionId), '.review-config.json');
55
+ }
56
+ /** Path to the coverage report checkpoint (written by gatekeeper). */
57
+ export function sessionCoverageReportPath(cwd, sessionId) {
58
+ return join(sessionDir(cwd, sessionId), '.coverage-report.json');
59
+ }
44
60
  //# sourceMappingURL=session-paths.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-paths.js","sourceRoot":"","sources":["../src/session-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,SAA2B;IACjE,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;AAClC,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,iBAAiB,CAAC,GAAW,EAAE,SAA2B;IACxE,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAC9D,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,kBAAkB,CAAC,GAAW,EAAE,SAA2B;IACzE,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,eAAe,CAAC,CAAC;AAC3D,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,SAA2B;IACtE,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,oBAAoB,CAAC,CAAC;AAChE,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,mBAAmB,CAAC,GAAW,EAAE,SAA2B;IAC1E,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,qBAAqB,CAAC,CAA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S,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAC7D,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,uBAAuB,CAAC,GAAW,EAAE,SAA2B;IAC9E,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,qBAAqB,CAAC,CAAC;AACjE,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,yBAAyB,CAAC,GAAW,EAAE,SAA2B;IAChF,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,uBAAuB,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * JCS-compatible canonical JSON serialization (RFC 8785).
3
+ *
4
+ * Rules:
5
+ * - Objects: keys sorted lexicographically by Unicode code point
6
+ * - Arrays: preserve element order
7
+ * - Numbers: shortest JSON numeric form (no trailing zeros, no leading +, no NaN/Infinity)
8
+ * - Strings: standard JSON string escaping
9
+ * - No whitespace between tokens
10
+ * - Output is UTF-8
11
+ *
12
+ * This is a standalone, pure function. It will be reimplemented by the
13
+ * ingestion worker (potentially in a different language). The algorithm
14
+ * must be documented and deterministic.
15
+ */
16
+ export declare function canonicalize(value: unknown): string;
17
+ //# sourceMappingURL=canonicalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize.d.ts","sourceRoot":"","sources":["../../src/signing/canonicalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAqCnD"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * JCS-compatible canonical JSON serialization (RFC 8785).
3
+ *
4
+ * Rules:
5
+ * - Objects: keys sorted lexicographically by Unicode code point
6
+ * - Arrays: preserve element order
7
+ * - Numbers: shortest JSON numeric form (no trailing zeros, no leading +, no NaN/Infinity)
8
+ * - Strings: standard JSON string escaping
9
+ * - No whitespace between tokens
10
+ * - Output is UTF-8
11
+ *
12
+ * This is a standalone, pure function. It will be reimplemented by the
13
+ * ingestion worker (potentially in a different language). The algorithm
14
+ * must be documented and deterministic.
15
+ */
16
+ export function canonicalize(value) {
17
+ if (value === null)
18
+ return 'null';
19
+ if (value === undefined)
20
+ return 'null';
21
+ switch (typeof value) {
22
+ case 'boolean':
23
+ return value ? 'true' : 'false';
24
+ case 'number': {
25
+ if (!Number.isFinite(value)) {
26
+ throw new Error(`Cannot canonicalize non-finite number: ${value}`);
27
+ }
28
+ // JSON.stringify produces shortest form for finite numbers
29
+ return JSON.stringify(value);
30
+ }
31
+ case 'string':
32
+ return JSON.stringify(value);
33
+ case 'object': {
34
+ if (Array.isArray(value)) {
35
+ const items = value.map((item) => canonicalize(item));
36
+ return '[' + items.join(',') + ']';
37
+ }
38
+ // Object: sort keys lexicographically by Unicode code point
39
+ const obj = value;
40
+ const keys = Object.keys(obj).sort();
41
+ const pairs = keys.map((key) => {
42
+ return JSON.stringify(key) + ':' + canonicalize(obj[key]);
43
+ });
44
+ return '{' + pairs.join(',') + '}';
45
+ }
46
+ default:
47
+ throw new Error(`Cannot canonicalize type: ${typeof value}`);
48
+ }
49
+ }
50
+ //# sourceMappingURL=canonicalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize.js","sourceRoot":"","sources":["../../src/signing/canonicalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAEvC,QAAQ,OAAO,KAAK,EAAE,CAAC;QACrB,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;QAElC,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,0CAA0C,KAAK,EAAE,CAAC,CAAC;YACrE,CAAC;YACD,2DAA2D;YAC3D,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAED,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAE/B,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;gBACtD,OAAO,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;YACrC,CAAC;YAED,4DAA4D;YAC5D,MAAM,GAAG,GAAG,KAAgC,CAAC;YAC7C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACrC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;YACH,OAAO,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;QACrC,CAAC;QAED;YACE,MAAM,IAAI,KAAK,CAAC,6BAA6B,OAAO,KAAK,EAAE,CAAC,CAAC;IACjE,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ManifestSigner } from './signer.js';
2
+ /**
3
+ * HMAC-SHA256 signer using a shared secret from env var.
4
+ *
5
+ * Signature value is base64-encoded.
6
+ */
7
+ export declare function createHmacSigner(secret: string): ManifestSigner;
8
+ //# sourceMappingURL=hmac.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../src/signing/hmac.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAQ/D"}
@@ -0,0 +1,16 @@
1
+ import { createHmac } from 'node:crypto';
2
+ /**
3
+ * HMAC-SHA256 signer using a shared secret from env var.
4
+ *
5
+ * Signature value is base64-encoded.
6
+ */
7
+ export function createHmacSigner(secret) {
8
+ return {
9
+ alg: 'HS256',
10
+ keyId: 'env:CODELEDGER_SIGNING_SECRET',
11
+ async sign(data) {
12
+ return createHmac('sha256', secret).update(data).digest('base64');
13
+ },
14
+ };
15
+ }
16
+ //# sourceMappingURL=hmac.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../src/signing/hmac.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO;QACL,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,+BAA+B;QACtC,KAAK,CAAC,IAAI,CAAC,IAAY;YACrB,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpE,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Abstract signer interface for manifest signing.
3
+ *
4
+ * Mustang v1 uses HMAC-SHA256 with a shared secret. The interface is
5
+ * abstract to support future KMS-backed signers without changing the
6
+ * signing pipeline.
7
+ */
8
+ export interface ManifestSigner {
9
+ /** Sign the given data and return a base64-encoded signature. */
10
+ sign(data: Buffer): Promise<string>;
11
+ /** Algorithm identifier (e.g., "HS256" for HMAC-SHA256). */
12
+ alg: string;
13
+ /** Key identifier for provenance (e.g., "env:CODELEDGER_SIGNING_SECRET"). */
14
+ keyId: string;
15
+ }
16
+ //# sourceMappingURL=signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src/signing/signer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=signer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src/signing/signer.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"claude-md.d.ts","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wBAAgB,eAAe,IAAI,MAAM,CAiGxC"}
1
+ {"version":3,"file":"claude-md.d.ts","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wBAAgB,eAAe,IAAI,MAAM,CAwGxC"}
@@ -40,12 +40,19 @@ export function claudeMdSection() {
40
40
  '',
41
41
  '| Command | What It Does |',
42
42
  '|---------|-------------|',
43
- '| `npx codeledger activate --task "..."` | Scan repo (if stale), generate context bundle, write `.codeledger/active-bundle.md` |',
43
+ '| `npx codeledger init [--force]` | Initialize CodeLedger in a repo (creates `.codeledger/`, config, hooks) |',
44
44
  '| `npx codeledger scan` | Rebuild the repo index (dependency graph, churn, test map) |',
45
+ '| `npx codeledger activate --task "..."` | Scan repo (if stale), generate context bundle, write `.codeledger/active-bundle.md` |',
45
46
  '| `npx codeledger bundle --task "..."` | Generate a context bundle (JSON only, no active-bundle write) |',
47
+ '| `npx codeledger refine --learned "..."` | Re-score bundle mid-session with new context, keywords, or file exclusions |',
46
48
  '| `npx codeledger session-progress` | Write a ground-truth session progress snapshot |',
47
49
  '| `npx codeledger session-summary` | Show session-end value recap (recall, precision, token savings) |',
48
- '| `npx codeledger init` | Initialize CodeLedger in a repo (creates `.codeledger/`, config, hooks) |',
50
+ '| `npx codeledger doctor` | Integration health check (config, hooks, index, ledger) |',
51
+ '| `npx codeledger setup-ci [--mode ...]` | Generate GitHub Actions workflow + policy for CI integration |',
52
+ '| `npx codeledger manifest --task "..."` | Generate deterministic context manifest (evidence payload) |',
53
+ '| `npx codeledger verify --task "..."` | CI enforcement: evaluate policy, emit artifacts, return exit code |',
54
+ '| `npx codeledger intent init\\|show\\|set\\|ack` | Intent governance (deterministic drift detection) |',
55
+ '| `npx codeledger checkpoint create\\|restore\\|list` | Save/restore incremental session checkpoints |',
49
56
  '',
50
57
  '**Trigger phrases:** If the user asks for a "session summary", "session recap", "codeledger summary", "how did the bundle do", or anything similar — run `npx codeledger session-summary` in your shell. Do not construct the output yourself.',
51
58
  '',
@@ -1 +1 @@
1
- {"version":3,"file":"claude-md.js","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,2BAA2B;QAC3B,EAAE;QACF,wHAAwH;QACxH,kGAAkG;QAClG,EAAE;QACF,sCAAsC;QACtC,EAAE;QACF,oGAAoG;QACpG,oCAAoC;QACpC,EAAE;QACF,6CAA6C;QAC7C,4DAA4D;QAC5D,mDAAmD;QACnD,iEAAiE;QACjE,4DAA4D;QAC5D,6DAA6D;QAC7D,EAAE;QACF,0EAA0E;QAC1E,EAAE;QACF,4CAA4C;QAC5C,EAAE;QACF,yEAAyE;QACzE,iEAAiE;QACjE,EAAE;QACF,2CAA2C;QAC3C,+CAA+C;QAC/C,uEAAuE;QACvE,EAAE;QACF,wBAAwB;QACxB,EAAE;QACF,4BAA4B;QAC5B,2BAA2B;QAC3B,kIAAkI;QAClI,wFAAwF;QACxF,0GAA0G;QAC1G,wFAAwF;QACxF,wGAAwG;QACxG,qGAAqG;QACrG,EAAE;QACF,gPAAgP;QAChP,EAAE;QACF,iDAAiD;QACjD,EAAE;QACF,oEAAoE;QACpE,0GAA0G;QAC1G,EAAE;QACF,iDAAiD;QACjD,gDAAgD;QAChD,6EAA6E;QAC7E,2EAA2E;QAC3E,wFAAwF;QACxF,+DAA+D;QAC/D,EAAE;QACF,uBAAuB;QACvB,EAAE;QACF,4DAA4D;QAC5D,EAAE;QACF,8EAA8E;QAC9E,yEAAyE;QACzE,kFAAkF;QAClF,mDAAmD;QACnD,EAAE;QACF,gJAAgJ;QAChJ,EAAE;QACF,8BAA8B;QAC9B,EAAE;QACF,6IAA6I;QAC7I,iJAAiJ;QACjJ,EAAE;QACF,uCAAuC;QACvC,EAAE;QACF,SAAS;QACT,yDAAyD;QACzD,KAAK;QACL,EAAE;QACF,6BAA6B;QAC7B,EAAE;QACF,6FAA6F;QAC7F,+EAA+E;QAC/E,0FAA0F;QAC1F,2EAA2E;QAC3E,EAAE;QACF,uDAAuD;QACvD,EAAE;QACF,wBAAwB;QACxB,EAAE;QACF,gDAAgD;QAChD,EAAE;QACF,SAAS;QACT,0BAA0B;QAC1B,KAAK;QACL,EAAE;QACF,8FAA8F;QAC9F,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"claude-md.js","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,2BAA2B;QAC3B,EAAE;QACF,wHAAwH;QACxH,kGAAkG;QAClG,EAAE;QACF,sCAAs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AAS;QACT,0BAA0B;QAC1B,KAAK;QACL,EAAE;QACF,8FAA8F;QAC9F,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/templates/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,wBAAgB,aAAa,IAAI,gBAAgB,CAgFhD"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/templates/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,wBAAgB,aAAa,IAAI,gBAAgB,CAsHhD"}
@@ -10,31 +10,66 @@ export function defaultConfig() {
10
10
  worktree_root: '.codeledger/worktrees',
11
11
  },
12
12
  repo: {
13
- include: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.mjs', '**/*.cjs'],
13
+ include: ['**/*'],
14
14
  exclude: [
15
+ // Version control
16
+ '.git/**',
17
+ // Package managers / vendored deps
15
18
  'node_modules/**',
19
+ 'vendor/**',
20
+ '.venv/**',
21
+ 'venv/**',
22
+ // Build output
16
23
  'dist/**',
17
24
  'build/**',
18
- '.git/**',
25
+ 'out/**',
26
+ 'target/**',
27
+ 'bin/**',
28
+ // Caches
19
29
  '.codeledger/**',
20
30
  'coverage/**',
31
+ '__pycache__/**',
32
+ '.tox/**',
33
+ '.mypy_cache/**',
34
+ '.pytest_cache/**',
35
+ // Generated / minified
21
36
  '*.min.js',
22
37
  '*.bundle.js',
38
+ '*.pyc',
39
+ '*.pyo',
40
+ // IDE
41
+ '.idea/**',
42
+ '.vscode/**',
43
+ // Lock files (large, not useful for context)
44
+ 'package-lock.json',
45
+ 'yarn.lock',
46
+ 'pnpm-lock.yaml',
47
+ 'Pipfile.lock',
48
+ 'poetry.lock',
49
+ 'go.sum',
50
+ 'Cargo.lock',
23
51
  ],
24
52
  test_patterns: [
53
+ // JS/TS
25
54
  '**/*.test.*',
26
55
  '**/*.spec.*',
27
56
  '**/__tests__/**',
28
57
  '**/test/**',
58
+ // Python
59
+ '**/test_*.py',
60
+ '**/*_test.py',
61
+ '**/tests/**/*.py',
62
+ // Go
63
+ '**/*_test.go',
64
+ // Java/Kotlin
65
+ '**/src/test/**',
66
+ // Rust
67
+ '**/tests/**/*.rs',
68
+ // Ruby
69
+ '**/spec/**/*_spec.rb',
70
+ '**/test/**/*_test.rb',
29
71
  ],
30
- language_extensions: {
31
- '.ts': 'typescript',
32
- '.tsx': 'typescript-react',
33
- '.js': 'javascript',
34
- '.jsx': 'javascript-react',
35
- '.mjs': 'javascript',
36
- '.cjs': 'javascript',
37
- },
72
+ language_extensions: {},
38
73
  },
39
74
  selector: {
40
75
  weights: {
@@ -78,6 +113,9 @@ export function defaultConfig() {
78
113
  badge: true,
79
114
  share_pack: false,
80
115
  },
116
+ suggestions: {
117
+ prefill_task: false,
118
+ },
81
119
  };
82
120
  }
83
121
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/templates/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,SAAS,EAAE;YACT,OAAO,EAAE,uBAAuB;YAChC,SAAS,EAAE,mBAAmB;YAC9B,aAAa,EAAE,uBAAuB;YACtC,WAAW,EAAE,qBAAqB;YAClC,aAAa,EAAE,uBAAuB;SACvC;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC;YAC/E,OAAO,EAAE;gBACP,iBAAiB;gBACjB,SAAS;gBACT,UAAU;gBACV,SAAS;gBACT,gBAAgB;gBACh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,KAAK,EAAE,IAAI;gBACX,YAAY,EAAE,IAAI;gBAClB,cAAc,EAAE,IAAI;gBACpB,YAAY,EAAE,IAAI;gBAClB,aAAa,EAAE,IAAI;gBACnB,UAAU,EAAE,IAAI;gBAChB,oBAAoB,EAAE,IAAI;gBAC1B,cAAc,EAAE,IAAI;aACrB;YACD,cAAc,EAAE;gBACd,MAAM,EAAE,IAAI;gBACZ,SAAS,EAAE,EAAE;aACd;YACD,qBAAqB,EAAE,IAAI;YAC3B,cAAc,EAAE,EAAE;YAClB,gBAAgB,EAAE,CAAC;YACnB,uBAAuB,EAAE,EAAE;YAC3B,2BAA2B,EAAE,GAAG;YAChC,oBAAoB,EAAE,EAAE;SACzB;QACD,SAAS,EAAE;YACT,YAAY,EAAE,gBAAgB;YAC9B,cAAc,EAAE,8BAA8B;SAC/C;QACD,OAAO,EAAE;YACP,eAAe,EAAE,CAAC;YAClB,mBAAmB,EAAE,IAAI;YACzB,kBAAkB,EAAE,GAAG;YACvB,wBAAwB,EAAE,SAAS;SACpC;QACD,SAAS,EAAE;YACT,gBAAgB,EAAE,KAAK;SACxB;QACD,SAAS,EAAE;YACT,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,IAAI;YACX,UAAU,EAAE,KAAK;SAClB;QACD,WAAW,EAAE;YACX,YAAY,EAAE,KAAK;SACpB;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ResolvedPolicyV1, ContextManifestV1, ViolationV1, CoverageAttestationV1 } from '@codeledger/types';
2
+ /**
3
+ * Evaluate a manifest against a resolved policy. Returns violations sorted
4
+ * by code then path for deterministic output.
5
+ *
6
+ * This function does NOT make pass/fail decisions — it only detects violations.
7
+ * The calling code decides exit codes based on policy mode.
8
+ */
9
+ export declare function evaluatePolicy(manifest: ContextManifestV1, policy: ResolvedPolicyV1, coverageAttestation?: CoverageAttestationV1): ViolationV1[];
10
+ //# sourceMappingURL=evaluate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/verify/evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,gBAAgB,EACxB,mBAAmB,CAAC,EAAE,qBAAqB,GAC1C,WAAW,EAAE,CAsGf"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Evaluate a manifest against a resolved policy. Returns violations sorted
3
+ * by code then path for deterministic output.
4
+ *
5
+ * This function does NOT make pass/fail decisions — it only detects violations.
6
+ * The calling code decides exit codes based on policy mode.
7
+ */
8
+ export function evaluatePolicy(manifest, policy, coverageAttestation) {
9
+ const violations = [];
10
+ // LOW_CONFIDENCE — overall_confidence < min_confidence
11
+ if (manifest.confidence.overall < policy.min_confidence) {
12
+ violations.push({
13
+ code: 'LOW_CONFIDENCE',
14
+ message: `Overall confidence ${manifest.confidence.overall.toFixed(2)} below minimum ${policy.min_confidence.toFixed(2)}`,
15
+ value: manifest.confidence.overall,
16
+ threshold: policy.min_confidence,
17
+ });
18
+ }
19
+ // HIGH_DRIFT — drift_score > max_drift
20
+ if (manifest.intent.drift_score > policy.max_drift) {
21
+ violations.push({
22
+ code: 'HIGH_DRIFT',
23
+ message: `Drift score ${manifest.intent.drift_score.toFixed(2)} exceeds maximum ${policy.max_drift.toFixed(2)}`,
24
+ value: manifest.intent.drift_score,
25
+ threshold: policy.max_drift,
26
+ });
27
+ }
28
+ // DENY_PATH_MATCH — selected file matches deny_paths pattern
29
+ for (const file of manifest.bundle.files) {
30
+ for (const pattern of policy.deny_paths) {
31
+ if (matchDenyPattern(file.path, pattern)) {
32
+ violations.push({
33
+ code: 'DENY_PATH_MATCH',
34
+ message: `Selected file ${file.path} matches deny pattern ${pattern}`,
35
+ path: file.path,
36
+ pattern,
37
+ });
38
+ }
39
+ }
40
+ }
41
+ // MISSING_TESTS — test_presence below threshold when require_tests is true
42
+ if (policy.require_tests) {
43
+ const testPresence = manifest.confidence.envelope.test_presence;
44
+ // require_tests uses a fixed threshold of 0.50
45
+ const threshold = 0.50;
46
+ if (testPresence < threshold) {
47
+ violations.push({
48
+ code: 'MISSING_TESTS',
49
+ message: `Test presence ${testPresence.toFixed(2)} below required threshold ${threshold.toFixed(2)}`,
50
+ value: testPresence,
51
+ threshold,
52
+ });
53
+ }
54
+ }
55
+ // BUNDLE_TOO_LARGE — file count or byte count exceeds policy limits
56
+ if (manifest.bundle.file_count > policy.bundle_max_files) {
57
+ violations.push({
58
+ code: 'BUNDLE_TOO_LARGE',
59
+ message: `Bundle file count ${manifest.bundle.file_count} exceeds limit ${policy.bundle_max_files}`,
60
+ dimension: 'file_count',
61
+ value: manifest.bundle.file_count,
62
+ threshold: policy.bundle_max_files,
63
+ });
64
+ }
65
+ if (manifest.bundle.total_bytes > policy.bundle_max_bytes) {
66
+ violations.push({
67
+ code: 'BUNDLE_TOO_LARGE',
68
+ message: `Bundle byte size ${manifest.bundle.total_bytes} exceeds limit ${policy.bundle_max_bytes}`,
69
+ dimension: 'byte_size',
70
+ value: manifest.bundle.total_bytes,
71
+ threshold: policy.bundle_max_bytes,
72
+ });
73
+ }
74
+ // INSUFFICIENT_COVERAGE — review coverage below policy minimum
75
+ if (coverageAttestation && policy.min_review_coverage !== undefined) {
76
+ if (coverageAttestation.file_coverage < policy.min_review_coverage) {
77
+ violations.push({
78
+ code: 'INSUFFICIENT_COVERAGE',
79
+ message: `Review file coverage ${coverageAttestation.file_coverage.toFixed(2)} below minimum ${policy.min_review_coverage.toFixed(2)}`,
80
+ value: coverageAttestation.file_coverage,
81
+ threshold: policy.min_review_coverage,
82
+ });
83
+ }
84
+ }
85
+ // POST_HOC_READS — reads that occurred after claims were written
86
+ if (coverageAttestation && policy.block_post_hoc_reads && coverageAttestation.post_hoc_read_count > 0) {
87
+ violations.push({
88
+ code: 'POST_HOC_READS',
89
+ message: `${coverageAttestation.post_hoc_read_count} file(s) were read after review claims were written`,
90
+ value: coverageAttestation.post_hoc_read_count,
91
+ });
92
+ }
93
+ // Sort by code, then by path (if present) for deterministic output
94
+ violations.sort((a, b) => {
95
+ const codeCmp = a.code.localeCompare(b.code);
96
+ if (codeCmp !== 0)
97
+ return codeCmp;
98
+ return (a.path ?? '').localeCompare(b.path ?? '');
99
+ });
100
+ return violations;
101
+ }
102
+ /**
103
+ * Match a file path against a deny pattern.
104
+ * Supports simple glob patterns with * wildcard.
105
+ */
106
+ function matchDenyPattern(filePath, pattern) {
107
+ // Convert glob pattern to regex
108
+ const escaped = pattern
109
+ .replace(/[.+^${}()|[\]\\]/g, '\\$&')
110
+ .replace(/\*/g, '.*');
111
+ const regex = new RegExp(`^${escaped}$|/${escaped}$|^${escaped}/|/${escaped}/`);
112
+ // Also match against the basename
113
+ const basename = filePath.split('/').pop() ?? filePath;
114
+ const baseRegex = new RegExp(`^${escaped}$`);
115
+ return regex.test(filePath) || baseRegex.test(basename);
116
+ }
117
+ //# sourceMappingURL=evaluate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../src/verify/evaluate.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,QAA2B,EAC3B,MAAwB,EACxB,mBAA2C;IAE3C,MAAM,UAAU,GAAkB,EAAE,CAAC;IAErC,uDAAuD;IACvD,IAAI,QAAQ,CAAC,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,cAAc,EAAE,CAAC;QACxD,UAAU,CAAC,IAAI,CAAC;YACd,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,sBAAsB,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACzH,KAAK,EA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,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,QAAQ,CAAC;IACvD,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC;IAE7C,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ResolvedPolicyV1 } from '@codeledger/types';
2
+ /**
3
+ * Build and write a policy snapshot — records the resolved policy used
4
+ * during a verify run, including its hash for audit trail.
5
+ */
6
+ export declare function writePolicySnapshot(policy: ResolvedPolicyV1, outPath: string): void;
7
+ //# sourceMappingURL=policy-snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-snapshot.d.ts","sourceRoot":"","sources":["../../src/verify/policy-snapshot.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAqC,MAAM,mBAAmB,CAAC;AAG7F;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,MAAM,GACd,IAAI,CA6BN"}
@@ -0,0 +1,36 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { writeFileSync, mkdirSync } from 'node:fs';
3
+ import { dirname } from 'node:path';
4
+ import { canonicalize } from '../signing/canonicalize.js';
5
+ /**
6
+ * Build and write a policy snapshot — records the resolved policy used
7
+ * during a verify run, including its hash for audit trail.
8
+ */
9
+ export function writePolicySnapshot(policy, outPath) {
10
+ // Strip resolved_from to get the base policy for hashing
11
+ const basePolicyForHash = {
12
+ schema_version: policy.schema_version,
13
+ mode: policy.mode,
14
+ min_confidence: policy.min_confidence,
15
+ max_drift: policy.max_drift,
16
+ require_tests: policy.require_tests,
17
+ deny_paths: policy.deny_paths,
18
+ bundle_max_files: policy.bundle_max_files,
19
+ bundle_max_bytes: policy.bundle_max_bytes,
20
+ redact_actor_identity: policy.redact_actor_identity,
21
+ store_file_paths: policy.store_file_paths,
22
+ };
23
+ const hash = createHash('sha256')
24
+ .update(canonicalize(basePolicyForHash))
25
+ .digest('hex');
26
+ const snapshot = {
27
+ schema_version: 'mustang/policy-snapshot/v1',
28
+ policy: basePolicyForHash,
29
+ hash,
30
+ resolved_from: policy.resolved_from,
31
+ resolved_at: new Date().toISOString(),
32
+ };
33
+ mkdirSync(dirname(outPath), { recursive: true });
34
+ writeFileSync(outPath, JSON.stringify(snapshot, null, 2) + '\n');
35
+ }
36
+ //# sourceMappingURL=policy-snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-snapshot.js","sourceRoot":"","sources":["../../src/verify/policy-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAwB,EACxB,OAAe;IAEf,yDAAyD;IACzD,MAAM,iBAAiB,GAAoB;QACzC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;QACnD,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;KAC1C,CAAC;IAEF,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC;SAC9B,MAAM,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;SACvC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjB,MAAM,QAAQ,GAAqB;QACjC,cAAc,EAAE,4BAA4B;QAC5C,MAAM,EAAE,iBAAiB;QACzB,IAAI;QACJ,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACtC,CAAC;IAEF,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ContextManifestV1, ResolvedPolicyV1, ViolationV1, VerifyReportV1 } from '@codeledger/types';
2
+ /**
3
+ * Build a verify report from manifest, policy, and violations.
4
+ */
5
+ export declare function buildVerifyReport(opts: {
6
+ manifest: ContextManifestV1;
7
+ policy: ResolvedPolicyV1;
8
+ violations: ViolationV1[];
9
+ codeledgerVersion: string;
10
+ }): VerifyReportV1;
11
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/verify/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAI3B;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,EAAE,WAAW,EAAE,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,cAAc,CA+CjB"}
@@ -0,0 +1,64 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { canonicalize } from '../signing/canonicalize.js';
3
+ /**
4
+ * Build a verify report from manifest, policy, and violations.
5
+ */
6
+ export function buildVerifyReport(opts) {
7
+ const { manifest, policy, violations, codeledgerVersion } = opts;
8
+ // Compute policy hash using Phase 2 canonicalization
9
+ const policyForHash = {
10
+ schema_version: policy.schema_version,
11
+ mode: policy.mode,
12
+ min_confidence: policy.min_confidence,
13
+ max_drift: policy.max_drift,
14
+ require_tests: policy.require_tests,
15
+ deny_paths: policy.deny_paths,
16
+ bundle_max_files: policy.bundle_max_files,
17
+ bundle_max_bytes: policy.bundle_max_bytes,
18
+ redact_actor_identity: policy.redact_actor_identity,
19
+ store_file_paths: policy.store_file_paths,
20
+ };
21
+ const policyHash = createHash('sha256')
22
+ .update(canonicalize(policyForHash))
23
+ .digest('hex');
24
+ // Determine decision based on mode
25
+ const passed = determineDecision(policy.mode, violations);
26
+ return {
27
+ schema_version: 'mustang/verify-report/v1',
28
+ codeledger_version: codeledgerVersion,
29
+ repo: {
30
+ name: manifest.repo.name,
31
+ commit_sha: manifest.repo.commit_sha,
32
+ },
33
+ policy: {
34
+ schema_version: 'mustang/policy/v1',
35
+ mode: policy.mode,
36
+ hash: policyHash,
37
+ },
38
+ metrics: {
39
+ overall_confidence: manifest.confidence.overall,
40
+ drift_score: manifest.intent.drift_score,
41
+ bundle_file_count: manifest.bundle.file_count,
42
+ bundle_total_bytes: manifest.bundle.total_bytes,
43
+ },
44
+ decision: {
45
+ passed,
46
+ mode: policy.mode,
47
+ },
48
+ violations,
49
+ };
50
+ }
51
+ /**
52
+ * Determine pass/fail based on mode and violations.
53
+ *
54
+ * - observe: always true (violations are informational only)
55
+ * - warn: always true (violations printed as warnings)
56
+ * - block: true only if no violations
57
+ */
58
+ function determineDecision(mode, violations) {
59
+ if (mode === 'block') {
60
+ return violations.length === 0;
61
+ }
62
+ return true; // observe and warn always pass
63
+ }
64
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version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