@encore-os/eos-spec 0.3.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 (256) hide show
  1. package/LICENSE +17 -0
  2. package/bin/check-dist-fresh.js +51 -0
  3. package/bin/eos-spec.js +7 -0
  4. package/dist/commands/ac-backfill.d.ts +31 -0
  5. package/dist/commands/ac-backfill.js +198 -0
  6. package/dist/commands/ac-backfill.js.map +1 -0
  7. package/dist/commands/archive.d.ts +2 -0
  8. package/dist/commands/archive.js +101 -0
  9. package/dist/commands/archive.js.map +1 -0
  10. package/dist/commands/audit.d.ts +30 -0
  11. package/dist/commands/audit.js +107 -0
  12. package/dist/commands/audit.js.map +1 -0
  13. package/dist/commands/backfill.d.ts +41 -0
  14. package/dist/commands/backfill.js +239 -0
  15. package/dist/commands/backfill.js.map +1 -0
  16. package/dist/commands/checkArtifacts.d.ts +2 -0
  17. package/dist/commands/checkArtifacts.js +48 -0
  18. package/dist/commands/checkArtifacts.js.map +1 -0
  19. package/dist/commands/checkPlacement.d.ts +2 -0
  20. package/dist/commands/checkPlacement.js +31 -0
  21. package/dist/commands/checkPlacement.js.map +1 -0
  22. package/dist/commands/claim.d.ts +4 -0
  23. package/dist/commands/claim.js +46 -0
  24. package/dist/commands/claim.js.map +1 -0
  25. package/dist/commands/complete.d.ts +2 -0
  26. package/dist/commands/complete.js +138 -0
  27. package/dist/commands/complete.js.map +1 -0
  28. package/dist/commands/conformance.d.ts +23 -0
  29. package/dist/commands/conformance.js +124 -0
  30. package/dist/commands/conformance.js.map +1 -0
  31. package/dist/commands/create.d.ts +6 -0
  32. package/dist/commands/create.js +277 -0
  33. package/dist/commands/create.js.map +1 -0
  34. package/dist/commands/deferred.d.ts +2 -0
  35. package/dist/commands/deferred.js +85 -0
  36. package/dist/commands/deferred.js.map +1 -0
  37. package/dist/commands/delta.d.ts +17 -0
  38. package/dist/commands/delta.js +292 -0
  39. package/dist/commands/delta.js.map +1 -0
  40. package/dist/commands/freshness.d.ts +13 -0
  41. package/dist/commands/freshness.js +72 -0
  42. package/dist/commands/freshness.js.map +1 -0
  43. package/dist/commands/funnel.d.ts +2 -0
  44. package/dist/commands/funnel.js +61 -0
  45. package/dist/commands/funnel.js.map +1 -0
  46. package/dist/commands/gen-tests.d.ts +2 -0
  47. package/dist/commands/gen-tests.js +53 -0
  48. package/dist/commands/gen-tests.js.map +1 -0
  49. package/dist/commands/init.d.ts +2 -0
  50. package/dist/commands/init.js +64 -0
  51. package/dist/commands/init.js.map +1 -0
  52. package/dist/commands/list.d.ts +9 -0
  53. package/dist/commands/list.js +61 -0
  54. package/dist/commands/list.js.map +1 -0
  55. package/dist/commands/metrics.d.ts +2 -0
  56. package/dist/commands/metrics.js +66 -0
  57. package/dist/commands/metrics.js.map +1 -0
  58. package/dist/commands/next.d.ts +48 -0
  59. package/dist/commands/next.js +344 -0
  60. package/dist/commands/next.js.map +1 -0
  61. package/dist/commands/precedent.d.ts +66 -0
  62. package/dist/commands/precedent.js +343 -0
  63. package/dist/commands/precedent.js.map +1 -0
  64. package/dist/commands/ready.d.ts +28 -0
  65. package/dist/commands/ready.js +147 -0
  66. package/dist/commands/ready.js.map +1 -0
  67. package/dist/commands/reconcile.d.ts +44 -0
  68. package/dist/commands/reconcile.js +187 -0
  69. package/dist/commands/reconcile.js.map +1 -0
  70. package/dist/commands/rollup.d.ts +2 -0
  71. package/dist/commands/rollup.js +43 -0
  72. package/dist/commands/rollup.js.map +1 -0
  73. package/dist/commands/scorecard.d.ts +11 -0
  74. package/dist/commands/scorecard.js +55 -0
  75. package/dist/commands/scorecard.js.map +1 -0
  76. package/dist/commands/signoff.d.ts +2 -0
  77. package/dist/commands/signoff.js +114 -0
  78. package/dist/commands/signoff.js.map +1 -0
  79. package/dist/commands/status.d.ts +2 -0
  80. package/dist/commands/status.js +100 -0
  81. package/dist/commands/status.js.map +1 -0
  82. package/dist/commands/tasks.d.ts +13 -0
  83. package/dist/commands/tasks.js +81 -0
  84. package/dist/commands/tasks.js.map +1 -0
  85. package/dist/commands/validate.d.ts +16 -0
  86. package/dist/commands/validate.js +89 -0
  87. package/dist/commands/validate.js.map +1 -0
  88. package/dist/commands/verify-acs.d.ts +15 -0
  89. package/dist/commands/verify-acs.js +196 -0
  90. package/dist/commands/verify-acs.js.map +1 -0
  91. package/dist/commands/verifyRollout.d.ts +2 -0
  92. package/dist/commands/verifyRollout.js +125 -0
  93. package/dist/commands/verifyRollout.js.map +1 -0
  94. package/dist/index.d.ts +21 -0
  95. package/dist/index.js +138 -0
  96. package/dist/index.js.map +1 -0
  97. package/dist/lib/ac-draft-prompt.d.ts +18 -0
  98. package/dist/lib/ac-draft-prompt.js +38 -0
  99. package/dist/lib/ac-draft-prompt.js.map +1 -0
  100. package/dist/lib/ac-response-parser.d.ts +18 -0
  101. package/dist/lib/ac-response-parser.js +57 -0
  102. package/dist/lib/ac-response-parser.js.map +1 -0
  103. package/dist/lib/ai-call.d.ts +13 -0
  104. package/dist/lib/ai-call.js +17 -0
  105. package/dist/lib/ai-call.js.map +1 -0
  106. package/dist/lib/archive.d.ts +21 -0
  107. package/dist/lib/archive.js +136 -0
  108. package/dist/lib/archive.js.map +1 -0
  109. package/dist/lib/artifact-integrity.d.ts +5 -0
  110. package/dist/lib/artifact-integrity.js +65 -0
  111. package/dist/lib/artifact-integrity.js.map +1 -0
  112. package/dist/lib/backfill-queue.d.ts +11 -0
  113. package/dist/lib/backfill-queue.js +14 -0
  114. package/dist/lib/backfill-queue.js.map +1 -0
  115. package/dist/lib/blockers.d.ts +66 -0
  116. package/dist/lib/blockers.js +103 -0
  117. package/dist/lib/blockers.js.map +1 -0
  118. package/dist/lib/claims.d.ts +39 -0
  119. package/dist/lib/claims.js +133 -0
  120. package/dist/lib/claims.js.map +1 -0
  121. package/dist/lib/classify-debt.d.ts +17 -0
  122. package/dist/lib/classify-debt.js +13 -0
  123. package/dist/lib/classify-debt.js.map +1 -0
  124. package/dist/lib/code-evidence.d.ts +35 -0
  125. package/dist/lib/code-evidence.js +171 -0
  126. package/dist/lib/code-evidence.js.map +1 -0
  127. package/dist/lib/coherence.d.ts +14 -0
  128. package/dist/lib/coherence.js +188 -0
  129. package/dist/lib/coherence.js.map +1 -0
  130. package/dist/lib/completion-gate.d.ts +17 -0
  131. package/dist/lib/completion-gate.js +28 -0
  132. package/dist/lib/completion-gate.js.map +1 -0
  133. package/dist/lib/compliance-signoff.d.ts +39 -0
  134. package/dist/lib/compliance-signoff.js +81 -0
  135. package/dist/lib/compliance-signoff.js.map +1 -0
  136. package/dist/lib/config.d.ts +63 -0
  137. package/dist/lib/config.js +40 -0
  138. package/dist/lib/config.js.map +1 -0
  139. package/dist/lib/cost.d.ts +12 -0
  140. package/dist/lib/cost.js +12 -0
  141. package/dist/lib/cost.js.map +1 -0
  142. package/dist/lib/debt-dashboard.d.ts +25 -0
  143. package/dist/lib/debt-dashboard.js +36 -0
  144. package/dist/lib/debt-dashboard.js.map +1 -0
  145. package/dist/lib/embedding-store.d.ts +103 -0
  146. package/dist/lib/embedding-store.js +133 -0
  147. package/dist/lib/embedding-store.js.map +1 -0
  148. package/dist/lib/embeddings-source.d.ts +36 -0
  149. package/dist/lib/embeddings-source.js +62 -0
  150. package/dist/lib/embeddings-source.js.map +1 -0
  151. package/dist/lib/enforcement-allowlist.d.ts +12 -0
  152. package/dist/lib/enforcement-allowlist.js +25 -0
  153. package/dist/lib/enforcement-allowlist.js.map +1 -0
  154. package/dist/lib/events.d.ts +47 -0
  155. package/dist/lib/events.js +75 -0
  156. package/dist/lib/events.js.map +1 -0
  157. package/dist/lib/exec.d.ts +8 -0
  158. package/dist/lib/exec.js +25 -0
  159. package/dist/lib/exec.js.map +1 -0
  160. package/dist/lib/frontmatter.d.ts +112 -0
  161. package/dist/lib/frontmatter.js +261 -0
  162. package/dist/lib/frontmatter.js.map +1 -0
  163. package/dist/lib/funnel.d.ts +22 -0
  164. package/dist/lib/funnel.js +41 -0
  165. package/dist/lib/funnel.js.map +1 -0
  166. package/dist/lib/git-mtime.d.ts +4 -0
  167. package/dist/lib/git-mtime.js +23 -0
  168. package/dist/lib/git-mtime.js.map +1 -0
  169. package/dist/lib/metrics.d.ts +42 -0
  170. package/dist/lib/metrics.js +92 -0
  171. package/dist/lib/metrics.js.map +1 -0
  172. package/dist/lib/migration-collision.d.ts +20 -0
  173. package/dist/lib/migration-collision.js +61 -0
  174. package/dist/lib/migration-collision.js.map +1 -0
  175. package/dist/lib/next-action.d.ts +44 -0
  176. package/dist/lib/next-action.js +138 -0
  177. package/dist/lib/next-action.js.map +1 -0
  178. package/dist/lib/ollama-embed.d.ts +21 -0
  179. package/dist/lib/ollama-embed.js +65 -0
  180. package/dist/lib/ollama-embed.js.map +1 -0
  181. package/dist/lib/output.d.ts +35 -0
  182. package/dist/lib/output.js +46 -0
  183. package/dist/lib/output.js.map +1 -0
  184. package/dist/lib/pipeline-config.d.ts +20 -0
  185. package/dist/lib/pipeline-config.js +208 -0
  186. package/dist/lib/pipeline-config.js.map +1 -0
  187. package/dist/lib/pipeline-map.d.ts +68 -0
  188. package/dist/lib/pipeline-map.js +256 -0
  189. package/dist/lib/pipeline-map.js.map +1 -0
  190. package/dist/lib/pipeline-schema.d.ts +48 -0
  191. package/dist/lib/pipeline-schema.js +22 -0
  192. package/dist/lib/pipeline-schema.js.map +1 -0
  193. package/dist/lib/placement.d.ts +6 -0
  194. package/dist/lib/placement.js +40 -0
  195. package/dist/lib/placement.js.map +1 -0
  196. package/dist/lib/precedent-search.d.ts +18 -0
  197. package/dist/lib/precedent-search.js +160 -0
  198. package/dist/lib/precedent-search.js.map +1 -0
  199. package/dist/lib/predicate-registry.d.ts +6 -0
  200. package/dist/lib/predicate-registry.js +40 -0
  201. package/dist/lib/predicate-registry.js.map +1 -0
  202. package/dist/lib/recall-cases.d.ts +15 -0
  203. package/dist/lib/recall-cases.js +39 -0
  204. package/dist/lib/recall-cases.js.map +1 -0
  205. package/dist/lib/repo.d.ts +20 -0
  206. package/dist/lib/repo.js +82 -0
  207. package/dist/lib/repo.js.map +1 -0
  208. package/dist/lib/requirements.d.ts +91 -0
  209. package/dist/lib/requirements.js +179 -0
  210. package/dist/lib/requirements.js.map +1 -0
  211. package/dist/lib/rollup.d.ts +24 -0
  212. package/dist/lib/rollup.js +34 -0
  213. package/dist/lib/rollup.js.map +1 -0
  214. package/dist/lib/scorecard-run.d.ts +6 -0
  215. package/dist/lib/scorecard-run.js +48 -0
  216. package/dist/lib/scorecard-run.js.map +1 -0
  217. package/dist/lib/scorecard.d.ts +69 -0
  218. package/dist/lib/scorecard.js +113 -0
  219. package/dist/lib/scorecard.js.map +1 -0
  220. package/dist/lib/semantic-search.d.ts +36 -0
  221. package/dist/lib/semantic-search.js +56 -0
  222. package/dist/lib/semantic-search.js.map +1 -0
  223. package/dist/lib/session-state.d.ts +8 -0
  224. package/dist/lib/session-state.js +25 -0
  225. package/dist/lib/session-state.js.map +1 -0
  226. package/dist/lib/spec-debt.d.ts +8 -0
  227. package/dist/lib/spec-debt.js +17 -0
  228. package/dist/lib/spec-debt.js.map +1 -0
  229. package/dist/lib/spec-pure.d.ts +59 -0
  230. package/dist/lib/spec-pure.js +215 -0
  231. package/dist/lib/spec-pure.js.map +1 -0
  232. package/dist/lib/specs.d.ts +148 -0
  233. package/dist/lib/specs.js +373 -0
  234. package/dist/lib/specs.js.map +1 -0
  235. package/dist/lib/test-generator.d.ts +5 -0
  236. package/dist/lib/test-generator.js +72 -0
  237. package/dist/lib/test-generator.js.map +1 -0
  238. package/dist/lib/user-stories.d.ts +6 -0
  239. package/dist/lib/user-stories.js +56 -0
  240. package/dist/lib/user-stories.js.map +1 -0
  241. package/dist/lib/verifies-scan.d.ts +9 -0
  242. package/dist/lib/verifies-scan.js +73 -0
  243. package/dist/lib/verifies-scan.js.map +1 -0
  244. package/dist/lib/verify-core.d.ts +23 -0
  245. package/dist/lib/verify-core.js +48 -0
  246. package/dist/lib/verify-core.js.map +1 -0
  247. package/dist/lib/with-event-log.d.ts +12 -0
  248. package/dist/lib/with-event-log.js +65 -0
  249. package/dist/lib/with-event-log.js.map +1 -0
  250. package/dist/lib/wizard-specs.d.ts +17 -0
  251. package/dist/lib/wizard-specs.js +34 -0
  252. package/dist/lib/wizard-specs.js.map +1 -0
  253. package/dist/pure.d.ts +19 -0
  254. package/dist/pure.js +31 -0
  255. package/dist/pure.js.map +1 -0
  256. package/package.json +69 -0
@@ -0,0 +1,23 @@
1
+ export type Outcome = 'passed' | 'failed' | 'skipped';
2
+ export type FileStat = {
3
+ passed: number;
4
+ failed: number;
5
+ skipped: number;
6
+ };
7
+ export type Verdict = {
8
+ proven: boolean;
9
+ reason: string;
10
+ };
11
+ /**
12
+ * Classify an item from a flat list of test outcomes. Priority:
13
+ * 1. any 'failed' → 'failed' (a failing test vetoes proof)
14
+ * 2. any 'passed' → 'passed' (≥1 real pass; mixed pass+skip counts)
15
+ * 3. all skipped / empty → 'not_run' (skip-only proves nothing)
16
+ */
17
+ export declare function classifyOutcomes(outcomes: Outcome[]): 'passed' | 'failed' | 'not_run';
18
+ /**
19
+ * Verdict for one requirement given its backing files + their per-file stats.
20
+ * A FAIL in any backing file vetoes. Proven iff ≥1 backing file is fully green
21
+ * (passed>0, 0 failed, 0 skipped). A wholly-skipped file neither proves nor vetoes.
22
+ */
23
+ export declare function verdictFor(files: string[], fileStats: Map<string, FileStat>): Verdict;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Classify an item from a flat list of test outcomes. Priority:
3
+ * 1. any 'failed' → 'failed' (a failing test vetoes proof)
4
+ * 2. any 'passed' → 'passed' (≥1 real pass; mixed pass+skip counts)
5
+ * 3. all skipped / empty → 'not_run' (skip-only proves nothing)
6
+ */
7
+ export function classifyOutcomes(outcomes) {
8
+ if (outcomes.length === 0)
9
+ return 'not_run';
10
+ if (outcomes.some((o) => o === 'failed'))
11
+ return 'failed';
12
+ if (outcomes.some((o) => o === 'passed'))
13
+ return 'passed';
14
+ return 'not_run';
15
+ }
16
+ /**
17
+ * Verdict for one requirement given its backing files + their per-file stats.
18
+ * A FAIL in any backing file vetoes. Proven iff ≥1 backing file is fully green
19
+ * (passed>0, 0 failed, 0 skipped). A wholly-skipped file neither proves nor vetoes.
20
+ */
21
+ export function verdictFor(files, fileStats) {
22
+ if (files.length === 0)
23
+ return { proven: false, reason: 'no @verifies backlink in any test' };
24
+ let seen = 0;
25
+ let totalFailed = 0;
26
+ let hasGreen = false;
27
+ let greenPassed = 0;
28
+ for (const f of files) {
29
+ const s = fileStats.get(f);
30
+ if (!s)
31
+ continue;
32
+ seen++;
33
+ totalFailed += s.failed;
34
+ if (s.passed > 0 && s.failed === 0 && s.skipped === 0) {
35
+ hasGreen = true;
36
+ greenPassed += s.passed;
37
+ }
38
+ }
39
+ if (seen === 0)
40
+ return { proven: false, reason: 'backing test(s) did not execute (lane not wired)' };
41
+ if (totalFailed > 0)
42
+ return { proven: false, reason: `${totalFailed} failing assertion(s)` };
43
+ if (hasGreen)
44
+ return { proven: true, reason: `${greenPassed} passing assertion(s)` };
45
+ // seen>0, no fails, no green ⇒ every backing file was wholly skipped.
46
+ return { proven: false, reason: 'proof only skipped (not run) — does not satisfy the gate' };
47
+ }
48
+ //# sourceMappingURL=verify-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-core.js","sourceRoot":"","sources":["../../src/lib/verify-core.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAmB;IAClD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC5C,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC1D,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC1D,OAAO,SAAS,CAAC;AACnB,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<O> = (options: O, cmd: unknown) => Promise<void> | void;
2
+ /** Wrap a commander action with event logging — records ms, ok, and (re-)throws on error.
3
+ * The wrapped action sees the same (options, cmd) signature.
4
+ *
5
+ * Note: commander actions call `emit()` which calls `process.exit()` before the
6
+ * action's promise resolves. We therefore register a one-shot `process.on('exit')`
7
+ * handler so the event is written synchronously at exit even when the action never
8
+ * returns normally. The handler is removed if the action does return (e.g. in
9
+ * tests that stub `emit`).
10
+ */
11
+ export declare function withEventLog<O extends Record<string, unknown>>(commandName: string, action: Action<O>): Action<O>;
12
+ export {};
@@ -0,0 +1,65 @@
1
+ import { logEvent, RUN_ID, redactArgs } from './events.js';
2
+ /** Wrap a commander action with event logging — records ms, ok, and (re-)throws on error.
3
+ * The wrapped action sees the same (options, cmd) signature.
4
+ *
5
+ * Note: commander actions call `emit()` which calls `process.exit()` before the
6
+ * action's promise resolves. We therefore register a one-shot `process.on('exit')`
7
+ * handler so the event is written synchronously at exit even when the action never
8
+ * returns normally. The handler is removed if the action does return (e.g. in
9
+ * tests that stub `emit`).
10
+ */
11
+ export function withEventLog(commandName, action) {
12
+ // Commander invokes the action as (…positionalArgs, options, command): for an
13
+ // option-only command that is (options, command); for a positional command like
14
+ // `claim <id>` it is (id, options, command). Read variadically and extract from
15
+ // the END so both shapes work — the Command is always last, the options object
16
+ // always second-to-last. (A rest-param fn is assignable to Action<O>, so callers
17
+ // keep their `O` inference.)
18
+ return async (...args) => {
19
+ const cmd = args[args.length - 1];
20
+ const options = (args.length >= 2 ? args[args.length - 2] : {});
21
+ const start = Date.now();
22
+ const ts = new Date().toISOString();
23
+ const base = {
24
+ ts,
25
+ command: commandName,
26
+ runId: RUN_ID,
27
+ args: redactArgs(options),
28
+ specId: typeof options.spec === 'string' ? options.spec : undefined,
29
+ core: typeof options.core === 'string' ? options.core : undefined,
30
+ };
31
+ // Register exit handler BEFORE running action — `emit()` calls process.exit()
32
+ // so the action never returns; we rely on the exit hook for the normal path.
33
+ let logged = false;
34
+ const onExit = (code) => {
35
+ if (logged)
36
+ return;
37
+ logged = true;
38
+ logEvent({ ...base, ms: Date.now() - start, ok: code === 0 });
39
+ };
40
+ process.once('exit', onExit);
41
+ try {
42
+ await action(options, cmd);
43
+ // Action returned normally (e.g. in tests where emit is stubbed).
44
+ process.removeListener('exit', onExit);
45
+ if (!logged) {
46
+ logged = true;
47
+ logEvent({ ...base, ms: Date.now() - start, ok: true });
48
+ }
49
+ }
50
+ catch (e) {
51
+ process.removeListener('exit', onExit);
52
+ if (!logged) {
53
+ logged = true;
54
+ logEvent({
55
+ ...base,
56
+ ms: Date.now() - start,
57
+ ok: false,
58
+ error: e instanceof Error ? e.message : String(e),
59
+ });
60
+ }
61
+ throw e;
62
+ }
63
+ };
64
+ }
65
+ //# sourceMappingURL=with-event-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with-event-log.js","sourceRoot":"","sources":["../../src/lib/with-event-log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI3D;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAoC,WAAmB,EAAE,MAAiB;IACpG,8EAA8E;IAC9E,gFAAgF;IAChF,gFAAgF;IAChF,+EAA+E;IAC/E,iFAAiF;IACjF,6BAA6B;IAC7B,OAAO,KAAK,EAAE,GAAG,IAAe,EAAiB,EAAE;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAClC,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAM,CAAC;QACrE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;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,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,GAAG,IAAI,CAAC;gBACd,QAAQ,CAAC;oBACP,GAAG,IAAI;oBACP,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;oBACtB,EAAE,EAAE,KAAK;oBACT,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;iBAClD,CAAC,CAAC;YACL,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ export type WizardCreateSpec = {
2
+ kind: 'create' | 'config';
3
+ wizardType: string;
4
+ targetTable: string;
5
+ core: string;
6
+ };
7
+ /**
8
+ * Load the committed spec→wizard bridge (generated from the platform registry by
9
+ * `npm run wizard:specs:gen`). eos-spec cannot import src/ across the workspace
10
+ * boundary, so it reads the JSON artifact at runtime. Missing/unreadable → {}.
11
+ * Cached per process (repoRoot is stable per run).
12
+ */
13
+ export declare function loadWizardCreateSpecs(repoRoot: string): Record<string, WizardCreateSpec>;
14
+ /** Test-only: clear the per-process cache. */
15
+ export declare function resetWizardCreateSpecsCache(): void;
16
+ /** The bridge entry for a spec id (case-insensitive), or undefined. */
17
+ export declare function getWizardCreateSpec(repoRoot: string, specId: string): WizardCreateSpec | undefined;
@@ -0,0 +1,34 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ let cache = null;
4
+ /**
5
+ * Load the committed spec→wizard bridge (generated from the platform registry by
6
+ * `npm run wizard:specs:gen`). eos-spec cannot import src/ across the workspace
7
+ * boundary, so it reads the JSON artifact at runtime. Missing/unreadable → {}.
8
+ * Cached per process (repoRoot is stable per run).
9
+ */
10
+ export function loadWizardCreateSpecs(repoRoot) {
11
+ if (cache)
12
+ return cache;
13
+ const path = join(repoRoot, 'docs/reports/wizard-create-specs.json');
14
+ if (!existsSync(path)) {
15
+ cache = {};
16
+ return cache;
17
+ }
18
+ try {
19
+ cache = JSON.parse(readFileSync(path, 'utf8'));
20
+ }
21
+ catch {
22
+ cache = {};
23
+ }
24
+ return cache;
25
+ }
26
+ /** Test-only: clear the per-process cache. */
27
+ export function resetWizardCreateSpecsCache() {
28
+ cache = null;
29
+ }
30
+ /** The bridge entry for a spec id (case-insensitive), or undefined. */
31
+ export function getWizardCreateSpec(repoRoot, specId) {
32
+ return loadWizardCreateSpecs(repoRoot)[specId.toUpperCase()];
33
+ }
34
+ //# sourceMappingURL=wizard-specs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wizard-specs.js","sourceRoot":"","sources":["../../src/lib/wizard-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AASjC,IAAI,KAAK,GAA4C,IAAI,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACpD,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,uCAAuC,CAAC,CAAC;IACrE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,KAAK,GAAG,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAqC,CAAC;IACrF,CAAC;IAAC,MAAM,CAAC;QACP,KAAK,GAAG,EAAE,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,2BAA2B;IACzC,KAAK,GAAG,IAAI,CAAC;AACf,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,MAAc;IAClE,OAAO,qBAAqB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AAC/D,CAAC"}
package/dist/pure.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Client-safe subpath: the fs-free leaves an app (e.g. Spec Studio) can import
3
+ * into a browser bundle. Everything re-exported here is guaranteed to pull NO
4
+ * node:fs / child_process / os — enforced by src/lib/pure-purity.test.ts.
5
+ * Do NOT add a module that (transitively, via a *value* import) reaches the
6
+ * filesystem; keep specs.ts and the commands/* behind the main entry only.
7
+ */
8
+ export * from './lib/pipeline-map.js';
9
+ export * from './lib/blockers.js';
10
+ export * from './lib/frontmatter.js';
11
+ export * from './lib/requirements.js';
12
+ export * from './lib/next-action.js';
13
+ export * from './lib/spec-pure.js';
14
+ export { BUILDER_PIPELINE_SCHEMA, ENCORE1_PIPELINE_SCHEMA } from './lib/pipeline-config.js';
15
+ export { DEFAULT_PREDICATES } from './lib/predicate-registry.js';
16
+ export type { PipelineSchema, PredicateRegistry } from './lib/pipeline-schema.js';
17
+ export * from './lib/completion-gate.js';
18
+ export * from './lib/compliance-signoff.js';
19
+ export type { SessionState } from './lib/session-state.js';
package/dist/pure.js ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Client-safe subpath: the fs-free leaves an app (e.g. Spec Studio) can import
3
+ * into a browser bundle. Everything re-exported here is guaranteed to pull NO
4
+ * node:fs / child_process / os — enforced by src/lib/pure-purity.test.ts.
5
+ * Do NOT add a module that (transitively, via a *value* import) reaches the
6
+ * filesystem; keep specs.ts and the commands/* behind the main entry only.
7
+ */
8
+ export * from './lib/pipeline-map.js';
9
+ export * from './lib/blockers.js';
10
+ export * from './lib/frontmatter.js';
11
+ export * from './lib/requirements.js';
12
+ export * from './lib/next-action.js';
13
+ // Fs-free spec helpers: deriveSignalsFromText + path classification +
14
+ // path-Set artifact checks — the browser-safe core a client (Spec Studio) can
15
+ // import in place of hand-mirroring the fs-bound specs.ts (epic #300, Wave-1 B1).
16
+ export * from './lib/spec-pure.js';
17
+ // Pipeline layouts + predicate registry: the building blocks a client needs to
18
+ // construct the BUILDER-layout computeStage — `buildPipeline(BUILDER_PIPELINE_SCHEMA,
19
+ // DEFAULT_PREDICATES)` — rather than the encore1 default. All pure (no node:*).
20
+ export { BUILDER_PIPELINE_SCHEMA, ENCORE1_PIPELINE_SCHEMA } from './lib/pipeline-config.js';
21
+ export { DEFAULT_PREDICATES } from './lib/predicate-registry.js';
22
+ // Deterministic gates consumed by encoreos (epic #300, Wave 3a): the
23
+ // UI-completion-evidence gate (over a SpecFile) and the compliance-signoff
24
+ // parser (over text). Both are pure — completion-gate imports only `type
25
+ // SpecFile`; compliance-signoff imports only frontmatter (already in this
26
+ // closure). `SessionState` is a type-only re-export — its module
27
+ // (session-state.ts) also has fs-reading helpers, so we surface the TYPE alone
28
+ // (erased at build) and keep the fs readers behind the main entry.
29
+ export * from './lib/completion-gate.js';
30
+ export * from './lib/compliance-signoff.js';
31
+ //# sourceMappingURL=pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../src/pure.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,sEAAsE;AACtE,8EAA8E;AAC9E,kFAAkF;AAClF,cAAc,oBAAoB,CAAC;AACnC,+EAA+E;AAC/E,sFAAsF;AACtF,gFAAgF;AAChF,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,qEAAqE;AACrE,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,iEAAiE;AACjE,+EAA+E;AAC/E,mEAAmE;AACnE,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@encore-os/eos-spec",
3
+ "version": "0.3.1",
4
+ "description": "Portable, config-driven spec-pipeline engine + quality harness. One canonical engine consumed as a library (with a client-safe /pure subpath) by every Encore-OS repo.",
5
+ "private": false,
6
+ "license": "SEE LICENSE IN LICENSE",
7
+ "author": "Encore-OS",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Encore-OS/eos-spec-core.git"
11
+ },
12
+ "type": "module",
13
+ "bin": {
14
+ "eos-spec": "./bin/eos-spec.js"
15
+ },
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ },
23
+ "./pure": {
24
+ "types": "./dist/pure.d.ts",
25
+ "import": "./dist/pure.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "bin"
31
+ ],
32
+ "engines": {
33
+ "node": ">=22"
34
+ },
35
+ "publishConfig": {
36
+ "registry": "https://registry.npmjs.org",
37
+ "access": "public"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.json",
41
+ "prepare": "npm run build",
42
+ "prepublishOnly": "npm run build && npm run typecheck && npm test",
43
+ "dev": "node --experimental-strip-types src/index.ts",
44
+ "test": "vitest run",
45
+ "typecheck": "tsc -p tsconfig.json --noEmit",
46
+ "lint": "biome check src",
47
+ "format": "biome format --write src",
48
+ "format:check": "biome format src",
49
+ "conformance": "node bin/eos-spec.js conformance",
50
+ "conformance:pack": "node scripts/conformance/pack-smoke.mjs"
51
+ },
52
+ "dependencies": {
53
+ "commander": "^15.0.0"
54
+ },
55
+ "peerDependencies": {
56
+ "yaml": "^2.8.4"
57
+ },
58
+ "optionalDependencies": {
59
+ "ai": "^6.0.175"
60
+ },
61
+ "devDependencies": {
62
+ "@biomejs/biome": "^2.3.5",
63
+ "@types/node": "^25.9.2",
64
+ "ai": "^6.0.175",
65
+ "typescript": "^6.0.3",
66
+ "vitest": "^4.1.8",
67
+ "yaml": "^2.8.4"
68
+ }
69
+ }