@pleri/olam-cli 0.1.70 → 0.1.72

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 (241) hide show
  1. package/dist/commands/create.d.ts.map +1 -1
  2. package/dist/commands/create.js +2 -0
  3. package/dist/commands/create.js.map +1 -1
  4. package/dist/commands/runbooks.d.ts +13 -0
  5. package/dist/commands/runbooks.d.ts.map +1 -0
  6. package/dist/commands/runbooks.js +189 -0
  7. package/dist/commands/runbooks.js.map +1 -0
  8. package/dist/commands/world-snapshot.d.ts +1 -0
  9. package/dist/commands/world-snapshot.d.ts.map +1 -1
  10. package/dist/commands/world-snapshot.js +126 -1
  11. package/dist/commands/world-snapshot.js.map +1 -1
  12. package/dist/commands/worldspec/compile.d.ts +20 -0
  13. package/dist/commands/worldspec/compile.d.ts.map +1 -0
  14. package/dist/commands/worldspec/compile.js +130 -0
  15. package/dist/commands/worldspec/compile.js.map +1 -0
  16. package/dist/commands/worldspec/index.d.ts +12 -0
  17. package/dist/commands/worldspec/index.d.ts.map +1 -0
  18. package/dist/commands/worldspec/index.js +23 -0
  19. package/dist/commands/worldspec/index.js.map +1 -0
  20. package/dist/commands/worldspec/init.d.ts +15 -0
  21. package/dist/commands/worldspec/init.d.ts.map +1 -0
  22. package/dist/commands/worldspec/init.js +166 -0
  23. package/dist/commands/worldspec/init.js.map +1 -0
  24. package/dist/commands/worldspec/schema.d.ts +11 -0
  25. package/dist/commands/worldspec/schema.d.ts.map +1 -0
  26. package/dist/commands/worldspec/schema.js +55 -0
  27. package/dist/commands/worldspec/schema.js.map +1 -0
  28. package/dist/commands/worldspec/validate.d.ts +15 -0
  29. package/dist/commands/worldspec/validate.d.ts.map +1 -0
  30. package/dist/commands/worldspec/validate.js +66 -0
  31. package/dist/commands/worldspec/validate.js.map +1 -0
  32. package/dist/exit-codes.d.ts +32 -0
  33. package/dist/exit-codes.d.ts.map +1 -1
  34. package/dist/exit-codes.js +32 -0
  35. package/dist/exit-codes.js.map +1 -1
  36. package/dist/image-digests.json +5 -5
  37. package/dist/index.js +4379 -897
  38. package/dist/index.js.map +1 -1
  39. package/dist/mcp-server.js +1252 -286
  40. package/host-cp/src/global-config-source.mjs +71 -0
  41. package/host-cp/src/listening-server-poller.mjs +1 -1
  42. package/host-cp/src/plan-orchestrator.mjs +20 -1
  43. package/host-cp/src/port-bridge-manager.mjs +1 -1
  44. package/host-cp/src/server.mjs +46 -7
  45. package/package.json +4 -2
  46. package/dist/__tests__/audit-publish-deps-contract.test.d.ts +0 -26
  47. package/dist/__tests__/audit-publish-deps-contract.test.d.ts.map +0 -1
  48. package/dist/__tests__/audit-publish-deps-contract.test.js +0 -86
  49. package/dist/__tests__/audit-publish-deps-contract.test.js.map +0 -1
  50. package/dist/__tests__/auth-status.test.d.ts +0 -2
  51. package/dist/__tests__/auth-status.test.d.ts.map +0 -1
  52. package/dist/__tests__/auth-status.test.js +0 -291
  53. package/dist/__tests__/auth-status.test.js.map +0 -1
  54. package/dist/__tests__/auth-upgrade.test.d.ts +0 -9
  55. package/dist/__tests__/auth-upgrade.test.d.ts.map +0 -1
  56. package/dist/__tests__/auth-upgrade.test.js +0 -397
  57. package/dist/__tests__/auth-upgrade.test.js.map +0 -1
  58. package/dist/__tests__/bootstrap-tag-mcp-auth.test.d.ts +0 -22
  59. package/dist/__tests__/bootstrap-tag-mcp-auth.test.d.ts.map +0 -1
  60. package/dist/__tests__/bootstrap-tag-mcp-auth.test.js +0 -63
  61. package/dist/__tests__/bootstrap-tag-mcp-auth.test.js.map +0 -1
  62. package/dist/__tests__/cli-mcp-revoke.test.d.ts +0 -8
  63. package/dist/__tests__/cli-mcp-revoke.test.d.ts.map +0 -1
  64. package/dist/__tests__/cli-mcp-revoke.test.js +0 -124
  65. package/dist/__tests__/cli-mcp-revoke.test.js.map +0 -1
  66. package/dist/__tests__/config.test.d.ts +0 -2
  67. package/dist/__tests__/config.test.d.ts.map +0 -1
  68. package/dist/__tests__/config.test.js +0 -95
  69. package/dist/__tests__/config.test.js.map +0 -1
  70. package/dist/__tests__/create-app-urls.test.d.ts +0 -2
  71. package/dist/__tests__/create-app-urls.test.d.ts.map +0 -1
  72. package/dist/__tests__/create-app-urls.test.js +0 -102
  73. package/dist/__tests__/create-app-urls.test.js.map +0 -1
  74. package/dist/__tests__/docker-host.test.d.ts +0 -14
  75. package/dist/__tests__/docker-host.test.d.ts.map +0 -1
  76. package/dist/__tests__/docker-host.test.js +0 -109
  77. package/dist/__tests__/docker-host.test.js.map +0 -1
  78. package/dist/__tests__/enter.test.d.ts +0 -2
  79. package/dist/__tests__/enter.test.d.ts.map +0 -1
  80. package/dist/__tests__/enter.test.js +0 -90
  81. package/dist/__tests__/enter.test.js.map +0 -1
  82. package/dist/__tests__/help-output.test.d.ts +0 -2
  83. package/dist/__tests__/help-output.test.d.ts.map +0 -1
  84. package/dist/__tests__/help-output.test.js +0 -74
  85. package/dist/__tests__/help-output.test.js.map +0 -1
  86. package/dist/__tests__/host-cp-gh-token.test.d.ts +0 -9
  87. package/dist/__tests__/host-cp-gh-token.test.d.ts.map +0 -1
  88. package/dist/__tests__/host-cp-gh-token.test.js +0 -129
  89. package/dist/__tests__/host-cp-gh-token.test.js.map +0 -1
  90. package/dist/__tests__/host-cp.test.d.ts +0 -9
  91. package/dist/__tests__/host-cp.test.d.ts.map +0 -1
  92. package/dist/__tests__/host-cp.test.js +0 -335
  93. package/dist/__tests__/host-cp.test.js.map +0 -1
  94. package/dist/__tests__/image-presence.test.d.ts +0 -2
  95. package/dist/__tests__/image-presence.test.d.ts.map +0 -1
  96. package/dist/__tests__/image-presence.test.js +0 -44
  97. package/dist/__tests__/image-presence.test.js.map +0 -1
  98. package/dist/__tests__/install-root.test.d.ts +0 -2
  99. package/dist/__tests__/install-root.test.d.ts.map +0 -1
  100. package/dist/__tests__/install-root.test.js +0 -119
  101. package/dist/__tests__/install-root.test.js.map +0 -1
  102. package/dist/__tests__/keys.test.d.ts +0 -9
  103. package/dist/__tests__/keys.test.d.ts.map +0 -1
  104. package/dist/__tests__/keys.test.js +0 -145
  105. package/dist/__tests__/keys.test.js.map +0 -1
  106. package/dist/__tests__/logs.test.d.ts +0 -9
  107. package/dist/__tests__/logs.test.d.ts.map +0 -1
  108. package/dist/__tests__/logs.test.js +0 -124
  109. package/dist/__tests__/logs.test.js.map +0 -1
  110. package/dist/__tests__/mcp-import.test.d.ts +0 -11
  111. package/dist/__tests__/mcp-import.test.d.ts.map +0 -1
  112. package/dist/__tests__/mcp-import.test.js +0 -134
  113. package/dist/__tests__/mcp-import.test.js.map +0 -1
  114. package/dist/__tests__/protocol-version.test.d.ts +0 -2
  115. package/dist/__tests__/protocol-version.test.d.ts.map +0 -1
  116. package/dist/__tests__/protocol-version.test.js +0 -170
  117. package/dist/__tests__/protocol-version.test.js.map +0 -1
  118. package/dist/__tests__/ps.test.d.ts +0 -2
  119. package/dist/__tests__/ps.test.d.ts.map +0 -1
  120. package/dist/__tests__/ps.test.js +0 -172
  121. package/dist/__tests__/ps.test.js.map +0 -1
  122. package/dist/__tests__/registry-allowlist.test.d.ts +0 -2
  123. package/dist/__tests__/registry-allowlist.test.d.ts.map +0 -1
  124. package/dist/__tests__/registry-allowlist.test.js +0 -129
  125. package/dist/__tests__/registry-allowlist.test.js.map +0 -1
  126. package/dist/__tests__/services.test.d.ts +0 -8
  127. package/dist/__tests__/services.test.d.ts.map +0 -1
  128. package/dist/__tests__/services.test.js +0 -185
  129. package/dist/__tests__/services.test.js.map +0 -1
  130. package/dist/__tests__/status-app-urls.test.d.ts +0 -2
  131. package/dist/__tests__/status-app-urls.test.d.ts.map +0 -1
  132. package/dist/__tests__/status-app-urls.test.js +0 -125
  133. package/dist/__tests__/status-app-urls.test.js.map +0 -1
  134. package/dist/__tests__/upgrade-gh-token-contract.test.d.ts +0 -19
  135. package/dist/__tests__/upgrade-gh-token-contract.test.d.ts.map +0 -1
  136. package/dist/__tests__/upgrade-gh-token-contract.test.js +0 -63
  137. package/dist/__tests__/upgrade-gh-token-contract.test.js.map +0 -1
  138. package/dist/__tests__/upgrade.test.d.ts +0 -9
  139. package/dist/__tests__/upgrade.test.d.ts.map +0 -1
  140. package/dist/__tests__/upgrade.test.js +0 -586
  141. package/dist/__tests__/upgrade.test.js.map +0 -1
  142. package/dist/commands/__tests__/__fixtures__/upgrade-helpers.d.ts +0 -6
  143. package/dist/commands/__tests__/__fixtures__/upgrade-helpers.d.ts.map +0 -1
  144. package/dist/commands/__tests__/__fixtures__/upgrade-helpers.js +0 -26
  145. package/dist/commands/__tests__/__fixtures__/upgrade-helpers.js.map +0 -1
  146. package/dist/commands/__tests__/begin.test.d.ts +0 -7
  147. package/dist/commands/__tests__/begin.test.d.ts.map +0 -1
  148. package/dist/commands/__tests__/begin.test.js +0 -72
  149. package/dist/commands/__tests__/begin.test.js.map +0 -1
  150. package/dist/commands/__tests__/bootstrap.test.d.ts +0 -2
  151. package/dist/commands/__tests__/bootstrap.test.d.ts.map +0 -1
  152. package/dist/commands/__tests__/bootstrap.test.js +0 -370
  153. package/dist/commands/__tests__/bootstrap.test.js.map +0 -1
  154. package/dist/commands/__tests__/carry-uncommitted.test.d.ts +0 -14
  155. package/dist/commands/__tests__/carry-uncommitted.test.d.ts.map +0 -1
  156. package/dist/commands/__tests__/carry-uncommitted.test.js +0 -83
  157. package/dist/commands/__tests__/carry-uncommitted.test.js.map +0 -1
  158. package/dist/commands/__tests__/clean.test.d.ts +0 -9
  159. package/dist/commands/__tests__/clean.test.d.ts.map +0 -1
  160. package/dist/commands/__tests__/clean.test.js +0 -105
  161. package/dist/commands/__tests__/clean.test.js.map +0 -1
  162. package/dist/commands/__tests__/crystallize.test.d.ts +0 -2
  163. package/dist/commands/__tests__/crystallize.test.d.ts.map +0 -1
  164. package/dist/commands/__tests__/crystallize.test.js +0 -133
  165. package/dist/commands/__tests__/crystallize.test.js.map +0 -1
  166. package/dist/commands/__tests__/diagnose.test.d.ts +0 -9
  167. package/dist/commands/__tests__/diagnose.test.d.ts.map +0 -1
  168. package/dist/commands/__tests__/diagnose.test.js +0 -108
  169. package/dist/commands/__tests__/diagnose.test.js.map +0 -1
  170. package/dist/commands/__tests__/openHostCpUrl.test.d.ts +0 -2
  171. package/dist/commands/__tests__/openHostCpUrl.test.d.ts.map +0 -1
  172. package/dist/commands/__tests__/openHostCpUrl.test.js +0 -63
  173. package/dist/commands/__tests__/openHostCpUrl.test.js.map +0 -1
  174. package/dist/commands/__tests__/refresh.test.d.ts +0 -13
  175. package/dist/commands/__tests__/refresh.test.d.ts.map +0 -1
  176. package/dist/commands/__tests__/refresh.test.js +0 -170
  177. package/dist/commands/__tests__/refresh.test.js.map +0 -1
  178. package/dist/commands/__tests__/status.test.d.ts +0 -8
  179. package/dist/commands/__tests__/status.test.d.ts.map +0 -1
  180. package/dist/commands/__tests__/status.test.js +0 -62
  181. package/dist/commands/__tests__/status.test.js.map +0 -1
  182. package/dist/commands/__tests__/stop.test.d.ts +0 -5
  183. package/dist/commands/__tests__/stop.test.d.ts.map +0 -1
  184. package/dist/commands/__tests__/stop.test.js +0 -30
  185. package/dist/commands/__tests__/stop.test.js.map +0 -1
  186. package/dist/commands/__tests__/update.test.d.ts +0 -7
  187. package/dist/commands/__tests__/update.test.d.ts.map +0 -1
  188. package/dist/commands/__tests__/update.test.js +0 -224
  189. package/dist/commands/__tests__/update.test.js.map +0 -1
  190. package/dist/commands/__tests__/upgrade.all-three.test.d.ts +0 -19
  191. package/dist/commands/__tests__/upgrade.all-three.test.d.ts.map +0 -1
  192. package/dist/commands/__tests__/upgrade.all-three.test.js +0 -80
  193. package/dist/commands/__tests__/upgrade.all-three.test.js.map +0 -1
  194. package/dist/commands/__tests__/upgrade.compose-path.test.d.ts +0 -20
  195. package/dist/commands/__tests__/upgrade.compose-path.test.d.ts.map +0 -1
  196. package/dist/commands/__tests__/upgrade.compose-path.test.js +0 -140
  197. package/dist/commands/__tests__/upgrade.compose-path.test.js.map +0 -1
  198. package/dist/commands/__tests__/upgrade.history.test.d.ts +0 -15
  199. package/dist/commands/__tests__/upgrade.history.test.d.ts.map +0 -1
  200. package/dist/commands/__tests__/upgrade.history.test.js +0 -199
  201. package/dist/commands/__tests__/upgrade.history.test.js.map +0 -1
  202. package/dist/commands/__tests__/upgrade.lock.test.d.ts +0 -15
  203. package/dist/commands/__tests__/upgrade.lock.test.d.ts.map +0 -1
  204. package/dist/commands/__tests__/upgrade.lock.test.js +0 -253
  205. package/dist/commands/__tests__/upgrade.lock.test.js.map +0 -1
  206. package/dist/commands/__tests__/upgrade.olam-tag.test.d.ts +0 -21
  207. package/dist/commands/__tests__/upgrade.olam-tag.test.d.ts.map +0 -1
  208. package/dist/commands/__tests__/upgrade.olam-tag.test.js +0 -114
  209. package/dist/commands/__tests__/upgrade.olam-tag.test.js.map +0 -1
  210. package/dist/commands/__tests__/upgrade.poll.test.d.ts +0 -14
  211. package/dist/commands/__tests__/upgrade.poll.test.d.ts.map +0 -1
  212. package/dist/commands/__tests__/upgrade.poll.test.js +0 -136
  213. package/dist/commands/__tests__/upgrade.poll.test.js.map +0 -1
  214. package/dist/commands/__tests__/upgrade.recreate.test.d.ts +0 -17
  215. package/dist/commands/__tests__/upgrade.recreate.test.d.ts.map +0 -1
  216. package/dist/commands/__tests__/upgrade.recreate.test.js +0 -83
  217. package/dist/commands/__tests__/upgrade.recreate.test.js.map +0 -1
  218. package/dist/commands/__tests__/upgrade.rollback.test.d.ts +0 -12
  219. package/dist/commands/__tests__/upgrade.rollback.test.d.ts.map +0 -1
  220. package/dist/commands/__tests__/upgrade.rollback.test.js +0 -255
  221. package/dist/commands/__tests__/upgrade.rollback.test.js.map +0 -1
  222. package/dist/commands/__tests__/upgrade.sha-capture.test.d.ts +0 -12
  223. package/dist/commands/__tests__/upgrade.sha-capture.test.d.ts.map +0 -1
  224. package/dist/commands/__tests__/upgrade.sha-capture.test.js +0 -63
  225. package/dist/commands/__tests__/upgrade.sha-capture.test.js.map +0 -1
  226. package/dist/commands/__tests__/upgrade.smoke.test.d.ts +0 -19
  227. package/dist/commands/__tests__/upgrade.smoke.test.d.ts.map +0 -1
  228. package/dist/commands/__tests__/upgrade.smoke.test.js +0 -87
  229. package/dist/commands/__tests__/upgrade.smoke.test.js.map +0 -1
  230. package/dist/commands/__tests__/upgrade.swap.test.d.ts +0 -19
  231. package/dist/commands/__tests__/upgrade.swap.test.d.ts.map +0 -1
  232. package/dist/commands/__tests__/upgrade.swap.test.js +0 -312
  233. package/dist/commands/__tests__/upgrade.swap.test.js.map +0 -1
  234. package/dist/commands/__tests__/world-upgrade.test.d.ts +0 -8
  235. package/dist/commands/__tests__/world-upgrade.test.d.ts.map +0 -1
  236. package/dist/commands/__tests__/world-upgrade.test.js +0 -73
  237. package/dist/commands/__tests__/world-upgrade.test.js.map +0 -1
  238. package/dist/lib/__tests__/symlink-reconcile.test.d.ts +0 -2
  239. package/dist/lib/__tests__/symlink-reconcile.test.d.ts.map +0 -1
  240. package/dist/lib/__tests__/symlink-reconcile.test.js +0 -106
  241. package/dist/lib/__tests__/symlink-reconcile.test.js.map +0 -1
@@ -0,0 +1,130 @@
1
+ /**
2
+ * `olam worldspec compile <path>... [--out <dir>] [--no-digests]` —
3
+ * compile one or more worldspec YAMLs into a deterministic execution-
4
+ * graph.json + lockfile.json. v1 SEAM contract per Decision #9.
5
+ *
6
+ * Multiple paths layer in argument order (later overrides earlier);
7
+ * matches plan body's "per-project default + orchestrator (highest
8
+ * priority) + task-level overrides" pattern.
9
+ *
10
+ * `--no-digests` skips Docker subprocess invocations (writes <digest-
11
+ * pending> sentinels). Useful for: dry-run validation, CI environments
12
+ * where Docker isn't available, deterministic-output tests.
13
+ *
14
+ * Defaults output to `./compiled/{execution-graph,lockfile}.json` if
15
+ * --out is provided; otherwise prints execution-graph to stdout (for
16
+ * piping / inspection).
17
+ */
18
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
19
+ import { resolve as resolvePath } from 'node:path';
20
+ import YAML from 'yaml';
21
+ import { canonicalStringify, compileWorldspec, dockerDigestResolver, resolveDigests, WorldspecSchema, } from '@olam/core/src/worldspec/index.js';
22
+ import { EXIT_DIGEST_UNRESOLVED, EXIT_GENERIC_ERROR, EXIT_WORLDSPEC_FILE_NOT_FOUND, EXIT_WORLDSPEC_INVALID, } from '../../exit-codes.js';
23
+ import { printError, printSuccess } from '../../output.js';
24
+ export function registerWorldspecCompile(parent) {
25
+ parent
26
+ .command('compile <path...>')
27
+ .description('Compile worldspec YAMLs into a deterministic execution-graph + lockfile')
28
+ .option('--out <dir>', 'Write artifacts to <dir>/{execution-graph,lockfile}.json')
29
+ .option('--no-digests', 'Skip Docker digest resolution (emits <digest-pending> sentinels)')
30
+ .option('--allow-pending-digests', 'Continue with <digest-pending> sentinels if Docker digest resolution fails (CI / dry-run); without this flag, digest failure exits 23 to preserve Decision #13 fail-fast invariant', false)
31
+ .action(async (paths, opts) => {
32
+ // Step 1: load + validate each worldspec
33
+ const specs = [];
34
+ const sourcePolicies = [];
35
+ for (const p of paths) {
36
+ const abs = resolvePath(process.cwd(), p);
37
+ if (!existsSync(abs)) {
38
+ printError(`worldspec not found at ${abs}`);
39
+ process.exit(EXIT_WORLDSPEC_FILE_NOT_FOUND);
40
+ }
41
+ let yaml;
42
+ try {
43
+ yaml = YAML.parse(readFileSync(abs, 'utf8'));
44
+ }
45
+ catch (err) {
46
+ printError(`${p}: YAML parse error: ${err.message}`);
47
+ process.exit(EXIT_WORLDSPEC_INVALID);
48
+ }
49
+ const parsed = WorldspecSchema.safeParse(yaml);
50
+ if (!parsed.success) {
51
+ printError(`${p}: schema violation — run 'olam worldspec validate ${p}' for details`);
52
+ process.exit(EXIT_WORLDSPEC_INVALID);
53
+ }
54
+ specs.push(parsed.data);
55
+ sourcePolicies.push(p);
56
+ }
57
+ // Step 2: read package version (compilerVersion in execution-graph)
58
+ const compilerVersion = `@pleri/olam-cli@${getPkgVersion()}`;
59
+ // Step 3: compile (synchronous; <50ms target)
60
+ let result;
61
+ try {
62
+ result = compileWorldspec(specs, {
63
+ compilerVersion,
64
+ sourcePolicies,
65
+ });
66
+ }
67
+ catch (err) {
68
+ printError(`compile failed: ${err.message}`);
69
+ process.exit(EXIT_GENERIC_ERROR);
70
+ }
71
+ // Step 4: optionally resolve digests via Docker.
72
+ // MEDIUM fix (A6 CP3 2026-05-09): default behaviour now FAILS FAST
73
+ // when digest resolution fails. Decision #13 says lockfile records
74
+ // sha256 for fail-fast at world-spawn; silently committing
75
+ // <digest-pending> regresses that invariant. Operators who want
76
+ // dry-run / no-Docker CI explicitly opt in via --allow-pending-digests.
77
+ let lockfile = result.lockfile;
78
+ if (opts.digests !== false) {
79
+ try {
80
+ lockfile = await resolveDigests(lockfile, dockerDigestResolver);
81
+ }
82
+ catch (err) {
83
+ if (opts.allowPendingDigests) {
84
+ process.stderr.write(`warn: digest resolution failed (${err.message}); ` +
85
+ `lockfile will contain <digest-pending> sentinels per --allow-pending-digests. ` +
86
+ `Re-compile with Docker reachable to populate digests before relying on world-spawn fail-fast.\n`);
87
+ }
88
+ else {
89
+ printError(`digest resolution failed: ${err.message}\n` +
90
+ `Lockfile cannot fail-fast on tampered images without sha256 records (Decision #13).\n` +
91
+ `Resolutions:\n` +
92
+ ` • Ensure Docker is running + image is locally present (\`docker pull\`)\n` +
93
+ ` • Or pass --allow-pending-digests to opt INTO <digest-pending> sentinels (CI / dry-run)\n` +
94
+ ` • Or pass --no-digests to skip resolution entirely`);
95
+ process.exit(EXIT_DIGEST_UNRESOLVED);
96
+ }
97
+ }
98
+ }
99
+ // Step 5: emit
100
+ const graphJson = canonicalStringify(result.executionGraph);
101
+ const lockfileJson = canonicalStringify(lockfile);
102
+ if (opts.out) {
103
+ const outDir = resolvePath(process.cwd(), opts.out);
104
+ try {
105
+ mkdirSync(outDir, { recursive: true });
106
+ writeFileSync(resolvePath(outDir, 'execution-graph.json'), graphJson, 'utf8');
107
+ writeFileSync(resolvePath(outDir, 'lockfile.json'), lockfileJson, 'utf8');
108
+ printSuccess(`wrote execution-graph + lockfile to ${outDir}`);
109
+ }
110
+ catch (err) {
111
+ printError(`failed to write ${outDir}: ${err.message}`);
112
+ process.exit(EXIT_GENERIC_ERROR);
113
+ }
114
+ }
115
+ else {
116
+ // Stdout: just the execution-graph (lockfile suppressed; use --out for both)
117
+ process.stdout.write(graphJson);
118
+ }
119
+ process.exit(0);
120
+ });
121
+ }
122
+ function getPkgVersion() {
123
+ // v1: static fallback. The CLI's actual version comes from its
124
+ // package.json at publish time; for execution-graph.compilerVersion
125
+ // the static value is sufficient (deterministic-output tests need a
126
+ // stable version string anyway). Phase B may wire dynamic version
127
+ // injection at bundle time.
128
+ return '0.2.0';
129
+ }
130
+ //# sourceMappingURL=compile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/commands/worldspec/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAGnD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,eAAe,GAEhB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQ3D,MAAM,UAAU,wBAAwB,CAAC,MAAe;IACtD,MAAM;SACH,OAAO,CAAC,mBAAmB,CAAC;SAC5B,WAAW,CACV,yEAAyE,CAC1E;SACA,MAAM,CAAC,aAAa,EAAE,0DAA0D,CAAC;SACjF,MAAM,CACL,cAAc,EACd,kEAAkE,CACnE;SACA,MAAM,CACL,yBAAyB,EACzB,o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AAM,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YACpD,IAAI,CAAC;gBACH,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBACvC,aAAa,CACX,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAC3C,SAAS,EACT,MAAM,CACP,CAAC;gBACF,aAAa,CACX,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,EACpC,YAAY,EACZ,MAAM,CACP,CAAC;gBACF,YAAY,CAAC,uCAAuC,MAAM,EAAE,CAAC,CAAC;YAChE,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,UAAU,CAAC,mBAAmB,MAAM,KAAM,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;gBACnE,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,6EAA6E;YAC7E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,aAAa;IACpB,+DAA+D;IAC/D,oEAAoE;IACpE,oEAAoE;IACpE,kEAAkE;IAClE,4BAA4B;IAC5B,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `olam worldspec` parent command — registers `validate`, `schema`, `init`
3
+ * subcommands. v1 catalogue. Future subcommands (e.g., `olam worldspec
4
+ * compile`) will register here.
5
+ *
6
+ * Co-exists with the existing `olam policy-check` subcommand (PR-time
7
+ * `.md` policy enforcement). Decision #10: namespace separation, not
8
+ * shared. Both surfaces remain after v1 ships.
9
+ */
10
+ import type { Command } from 'commander';
11
+ export declare function registerWorldspec(program: Command): void;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/worldspec/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAWxD"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * `olam worldspec` parent command — registers `validate`, `schema`, `init`
3
+ * subcommands. v1 catalogue. Future subcommands (e.g., `olam worldspec
4
+ * compile`) will register here.
5
+ *
6
+ * Co-exists with the existing `olam policy-check` subcommand (PR-time
7
+ * `.md` policy enforcement). Decision #10: namespace separation, not
8
+ * shared. Both surfaces remain after v1 ships.
9
+ */
10
+ import { registerWorldspecCompile } from './compile.js';
11
+ import { registerWorldspecInit } from './init.js';
12
+ import { registerWorldspecSchema } from './schema.js';
13
+ import { registerWorldspecValidate } from './validate.js';
14
+ export function registerWorldspec(program) {
15
+ const worldspec = program
16
+ .command('worldspec')
17
+ .description('Author + validate + compile .olam/worldspecs/*.yaml — declarative dev-environment contracts');
18
+ registerWorldspecValidate(worldspec);
19
+ registerWorldspecSchema(worldspec);
20
+ registerWorldspecInit(worldspec);
21
+ registerWorldspecCompile(worldspec);
22
+ }
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/worldspec/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,MAAM,SAAS,GAAG,OAAO;SACtB,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CACV,6FAA6F,CAC9F,CAAC;IAEJ,yBAAyB,CAAC,SAAS,CAAC,CAAC;IACrC,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACnC,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACjC,wBAAwB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `olam worldspec init [--from-adb-yaml]` — scaffold a `default.yaml`
3
+ * worldspec in the current repo. Detects project shape from existing
4
+ * files (package.json / Gemfile / .ruby-version / .adb.yaml) and seeds
5
+ * sensible capability defaults.
6
+ *
7
+ * Output: `<cwd>/.olam/worldspecs/default.yaml`
8
+ *
9
+ * Idempotent: refuses to overwrite an existing file unless `--force`.
10
+ * Emits a clear next-step UX line on success (closes Decision-#11
11
+ * onboarding banner gap surfaced in plan body).
12
+ */
13
+ import type { Command } from 'commander';
14
+ export declare function registerWorldspecInit(parent: Command): void;
15
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/worldspec/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBzC,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAyE3D"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * `olam worldspec init [--from-adb-yaml]` — scaffold a `default.yaml`
3
+ * worldspec in the current repo. Detects project shape from existing
4
+ * files (package.json / Gemfile / .ruby-version / .adb.yaml) and seeds
5
+ * sensible capability defaults.
6
+ *
7
+ * Output: `<cwd>/.olam/worldspecs/default.yaml`
8
+ *
9
+ * Idempotent: refuses to overwrite an existing file unless `--force`.
10
+ * Emits a clear next-step UX line on success (closes Decision-#11
11
+ * onboarding banner gap surfaced in plan body).
12
+ */
13
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
14
+ import { execSync } from 'node:child_process';
15
+ import { basename, dirname, resolve as resolvePath } from 'node:path';
16
+ import { EXIT_GENERIC_ERROR, EXIT_WORLDSPEC_EXISTS, } from '../../exit-codes.js';
17
+ import { printError, printSuccess } from '../../output.js';
18
+ export function registerWorldspecInit(parent) {
19
+ parent
20
+ .command('init')
21
+ .description('Scaffold a default.yaml worldspec in the current repo (.olam/worldspecs/)')
22
+ .option('--force', 'Overwrite an existing .olam/worldspecs/default.yaml', false)
23
+ .option('--from-adb-yaml', 'Read project shape from .adb.yaml when present', false)
24
+ .action((opts) => {
25
+ const cwd = process.cwd();
26
+ const targetDir = resolvePath(cwd, '.olam/worldspecs');
27
+ const targetFile = resolvePath(targetDir, 'default.yaml');
28
+ if (existsSync(targetFile) && !opts.force) {
29
+ printError(`${targetFile} already exists; pass --force to overwrite`);
30
+ // MEDIUM fix (A3 CP3 audit 2026-05-09): EXIT_WORLDSPEC_EXISTS
31
+ // distinguishes "you forgot --force" from EXIT_GENERIC_ERROR=1
32
+ // (internal/parse crash). Pipelines that grep $? can branch.
33
+ process.exit(EXIT_WORLDSPEC_EXISTS);
34
+ }
35
+ // MEDIUM fix (A3 CP3 audit 2026-05-09): warn-then-exit on
36
+ // --from-adb-yaml — flag was a dead stub (presence-only). Either
37
+ // ship parser or surface explicit "not yet implemented" so
38
+ // operators don't assume their .adb.yaml shape was read.
39
+ if (opts.fromAdbYaml) {
40
+ printError('--from-adb-yaml is not yet implemented (deferred to v1.1); ' +
41
+ 'remove the flag and re-run, or proceed with manual edit.');
42
+ process.exit(EXIT_GENERIC_ERROR);
43
+ }
44
+ const shape = detectProjectShape(cwd, opts.fromAdbYaml);
45
+ const yaml = renderWorldspecYaml(shape);
46
+ try {
47
+ mkdirSync(targetDir, { recursive: true });
48
+ // MEDIUM fix (A3 CP3 audit 2026-05-09): use 'wx' flag in
49
+ // non-force path AND open with 'w' explicitly when --force.
50
+ // 'wx' refuses if the path exists OR is a symlink → closes
51
+ // TOCTOU between existsSync above and writeFileSync below.
52
+ // (existsSync gate above is the user-facing UX; 'wx' is the
53
+ // race-resistant lower-bound guarantee.)
54
+ writeFileSync(targetFile, yaml, {
55
+ encoding: 'utf8',
56
+ flag: opts.force ? 'w' : 'wx',
57
+ });
58
+ }
59
+ catch (err) {
60
+ printError(`failed to scaffold ${targetFile}: ${err.message}`);
61
+ process.exit(EXIT_GENERIC_ERROR);
62
+ }
63
+ printSuccess(`scaffolded ${targetFile}`);
64
+ // Two-arg printInfo expects (label, value); craft a label-less line
65
+ // via console.log so the next-step UX renders cleanly without padding.
66
+ console.log(` Edit it to fit your repo, then run: olam worldspec validate ${relativeFromCwd(targetFile, cwd)}`);
67
+ process.exit(0);
68
+ });
69
+ }
70
+ function detectProjectShape(root, useAdbYaml) {
71
+ const hasGemfile = existsSync(resolvePath(root, 'Gemfile'));
72
+ const hasNodePackageJson = existsSync(resolvePath(root, 'package.json'));
73
+ const hasAdbYaml = existsSync(resolvePath(root, '.adb.yaml'));
74
+ let rubyVersion = null;
75
+ const rubyVersionPath = resolvePath(root, '.ruby-version');
76
+ if (existsSync(rubyVersionPath)) {
77
+ try {
78
+ const raw = readFileSync(rubyVersionPath, 'utf8').trim();
79
+ // .ruby-version can be `3.3.0` or `ruby-3.3.0`; extract the SemVer.
80
+ const match = raw.match(/(\d+\.\d+\.\d+)/);
81
+ if (match)
82
+ rubyVersion = match[1] ?? null;
83
+ }
84
+ catch {
85
+ // ignore — fall back to null
86
+ }
87
+ }
88
+ // --from-adb-yaml is a future hook (parse .adb.yaml's runtime block);
89
+ // for v1 we just record presence so the scaffolded YAML's comment
90
+ // references it correctly. Real adb-yaml parsing is deferred to v2.
91
+ void useAdbYaml;
92
+ return {
93
+ repoName: getRepoName(root),
94
+ hasGemfile,
95
+ rubyVersion,
96
+ hasNodePackageJson,
97
+ hasAdbYaml,
98
+ };
99
+ }
100
+ function getRepoName(root) {
101
+ try {
102
+ const url = execSync('git remote get-url origin', {
103
+ cwd: root,
104
+ encoding: 'utf-8',
105
+ stdio: ['ignore', 'pipe', 'ignore'],
106
+ }).trim();
107
+ const match = url.match(/\/([^/]+?)(?:\.git)?$/);
108
+ if (match && match[1])
109
+ return match[1];
110
+ }
111
+ catch {
112
+ // not a git repo or no origin; fall back to dir basename
113
+ }
114
+ return basename(root);
115
+ }
116
+ function renderWorldspecYaml(shape) {
117
+ const lines = [];
118
+ lines.push('# Scaffolded by `olam worldspec init`. Edit to fit your repo.');
119
+ if (shape.hasAdbYaml) {
120
+ lines.push('# Detected .adb.yaml — consider migrating its runtime + service blocks here.');
121
+ }
122
+ lines.push('schemaVersion: 1');
123
+ lines.push(`name: ${kebab(shape.repoName)}-default`);
124
+ lines.push('description: ""');
125
+ lines.push('repos:');
126
+ // MEDIUM fix (A3 CP3 audit 2026-05-09): kebab the repoName before
127
+ // emitting into YAML — git remote URLs can contain newlines / colons
128
+ // that smuggle YAML structure if interpolated raw (covered by name:
129
+ // line via kebab() but missed here in the first commit).
130
+ lines.push(` - ${kebab(shape.repoName)}`);
131
+ lines.push('images:');
132
+ lines.push(' devbox: ghcr.io/REPLACE_ME/olam-devbox:latest');
133
+ lines.push(' imageSource: local-first');
134
+ lines.push('capabilities:');
135
+ if (shape.hasGemfile) {
136
+ lines.push(' - type: runtime.ruby');
137
+ lines.push(` version: "${shape.rubyVersion ?? '3.3.0'}"`);
138
+ lines.push(` forRepo: ${kebab(shape.repoName)}`);
139
+ lines.push(' - type: database.postgres');
140
+ lines.push(' version: "13"');
141
+ }
142
+ if (shape.hasNodePackageJson && !shape.hasGemfile) {
143
+ lines.push(' # Node.js project detected. runtime.node is deferred to v1.1');
144
+ lines.push(' # (boot-d hook can pin node version in the meantime).');
145
+ }
146
+ lines.push(' - type: auth.ghcr');
147
+ lines.push(' scopes:');
148
+ lines.push(' - read:packages');
149
+ lines.push(' - type: dispatch.readiness');
150
+ lines.push(' mode: regex');
151
+ lines.push(' pattern: "❯"');
152
+ lines.push('');
153
+ return lines.join('\n');
154
+ }
155
+ function kebab(s) {
156
+ return s
157
+ .toLowerCase()
158
+ .replace(/[^a-z0-9]+/g, '-')
159
+ .replace(/^-+|-+$/g, '');
160
+ }
161
+ function relativeFromCwd(absPath, cwd) {
162
+ if (absPath.startsWith(cwd + '/'))
163
+ return absPath.slice(cwd.length + 1);
164
+ return absPath;
165
+ }
166
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/worldspec/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAItE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAe3D,MAAM,UAAU,qBAAqB,CAAC,MAAe;IACnD,MAAM;SACH,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,2EAA2E,CAC5E;SACA,MAAM,CACL,SAAS,EACT,qDAAqD,EACrD,KAAK,CACN;SACA,MAAM,CACL,iBAAiB,EACjB,gDAAgD,EAChD,KAAK,CACN;SACA,MAAM,CAAC,CAAC,IAAc,EAAE,EAAE;QACzB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1B,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;QACvD,MAAM,UAAU,GAAG,WAAW,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAE1D,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAA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AAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACxE,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `olam worldspec schema --version 1 [--out <path>]` — emit a composite
3
+ * JSON Schema (Draft 2019-09) for IDE integration (VS Code yaml.schemas,
4
+ * etc). Single-source-of-truth: derived from WorldspecSchema via
5
+ * zod-to-json-schema, so v1.x evolution stays in sync without drift.
6
+ *
7
+ * Defaults to stdout; pass --out to write a file.
8
+ */
9
+ import type { Command } from 'commander';
10
+ export declare function registerWorldspecSchema(parent: Command): void;
11
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/commands/worldspec/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYzC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAsD7D"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * `olam worldspec schema --version 1 [--out <path>]` — emit a composite
3
+ * JSON Schema (Draft 2019-09) for IDE integration (VS Code yaml.schemas,
4
+ * etc). Single-source-of-truth: derived from WorldspecSchema via
5
+ * zod-to-json-schema, so v1.x evolution stays in sync without drift.
6
+ *
7
+ * Defaults to stdout; pass --out to write a file.
8
+ */
9
+ import { writeFileSync } from 'node:fs';
10
+ import { resolve as resolvePath } from 'node:path';
11
+ import { zodToJsonSchema } from 'zod-to-json-schema';
12
+ import { WorldspecSchema } from '@olam/core/src/worldspec/index.js';
13
+ import { EXIT_GENERIC_ERROR } from '../../exit-codes.js';
14
+ import { printError, printSuccess } from '../../output.js';
15
+ export function registerWorldspecSchema(parent) {
16
+ parent
17
+ .command('schema')
18
+ .description('Emit composite JSON Schema for the worldspec (IDE / yaml.schemas)')
19
+ .requiredOption('--version <n>', 'Schema version to emit (currently only 1 is supported)')
20
+ .option('--out <path>', 'Write JSON Schema to this path instead of stdout')
21
+ .action((opts) => {
22
+ if (opts.version !== '1') {
23
+ printError(`unsupported schema version "${opts.version}"; only "1" is shipped in this CLI`);
24
+ process.exit(EXIT_GENERIC_ERROR);
25
+ }
26
+ // zod-to-json-schema target — explicit Draft 2019-09 (matches
27
+ // VS Code yaml.schemas + most IDE consumers in the wild;
28
+ // unevaluatedProperties from Draft 2020-12 is not yet broadly
29
+ // supported by JSON-Schema-aware editors). When IDE coverage of
30
+ // 2020-12 catches up, re-evaluate the upgrade. MEDIUM-fix (A3 CP3
31
+ // audit 2026-05-09): aligned header comment + code + test
32
+ // expectation on Draft 2019-09 (was inconsistent across all three).
33
+ const schema = zodToJsonSchema(WorldspecSchema, {
34
+ name: 'Worldspec',
35
+ target: 'jsonSchema2019-09',
36
+ $refStrategy: 'root',
37
+ });
38
+ const json = JSON.stringify(schema, null, 2);
39
+ if (opts.out) {
40
+ const absPath = resolvePath(process.cwd(), opts.out);
41
+ try {
42
+ writeFileSync(absPath, json + '\n', 'utf8');
43
+ }
44
+ catch (err) {
45
+ printError(`failed to write ${absPath}: ${err.message}`);
46
+ process.exit(EXIT_GENERIC_ERROR);
47
+ }
48
+ printSuccess(`wrote JSON Schema (v${opts.version}) to ${absPath}`);
49
+ process.exit(0);
50
+ }
51
+ process.stdout.write(json + '\n');
52
+ process.exit(0);
53
+ });
54
+ }
55
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/commands/worldspec/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAGnD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,OAAO,EAAE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AkB,CAAC,CAAC;YACnC,CAAC;YACD,YAAY,CAAC,uBAAuB,IAAI,CAAC,OAAO,QAAQ,OAAO,EAAE,CAAC,CAAC;YACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `olam worldspec validate <path>` — validate a worldspec YAML against the
3
+ * v1 schema. Exits 0 on valid, 20 on schema violation, 21 on file-not-found,
4
+ * 1 on internal error.
5
+ *
6
+ * Output format:
7
+ * - --format=human (default): location-aware error frames with hints
8
+ * - --format=json: structured ValidationError[] for IDE / CI consumption
9
+ *
10
+ * Pre-rendered errors carry attacker-controlled strings sanitised via
11
+ * stripCtrl from @olam/core/worldspec — see error-formatter.ts header.
12
+ */
13
+ import type { Command } from 'commander';
14
+ export declare function registerWorldspecValidate(parent: Command): void;
15
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/worldspec/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBzC,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA2D/D"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * `olam worldspec validate <path>` — validate a worldspec YAML against the
3
+ * v1 schema. Exits 0 on valid, 20 on schema violation, 21 on file-not-found,
4
+ * 1 on internal error.
5
+ *
6
+ * Output format:
7
+ * - --format=human (default): location-aware error frames with hints
8
+ * - --format=json: structured ValidationError[] for IDE / CI consumption
9
+ *
10
+ * Pre-rendered errors carry attacker-controlled strings sanitised via
11
+ * stripCtrl from @olam/core/worldspec — see error-formatter.ts header.
12
+ */
13
+ import { existsSync, readFileSync } from 'node:fs';
14
+ import { resolve as resolvePath } from 'node:path';
15
+ import { formatValidationErrors, validateWorldspec, } from '@olam/core/src/worldspec/index.js';
16
+ import { EXIT_GENERIC_ERROR, EXIT_WORLDSPEC_FILE_NOT_FOUND, EXIT_WORLDSPEC_INVALID, } from '../../exit-codes.js';
17
+ import { printError, printSuccess } from '../../output.js';
18
+ export function registerWorldspecValidate(parent) {
19
+ parent
20
+ .command('validate <path>')
21
+ .description('Validate a worldspec YAML against the v1 schema')
22
+ .option('--format <format>', 'Output format: human | json', (value) => {
23
+ if (value !== 'human' && value !== 'json') {
24
+ throw new Error(`--format must be 'human' or 'json' (got '${value}')`);
25
+ }
26
+ return value;
27
+ }, 'human')
28
+ .action(async (pathArg, opts) => {
29
+ const absPath = resolvePath(process.cwd(), pathArg);
30
+ if (!existsSync(absPath)) {
31
+ printError(`worldspec not found at ${absPath}`);
32
+ process.exit(EXIT_WORLDSPEC_FILE_NOT_FOUND);
33
+ }
34
+ let yamlSource;
35
+ try {
36
+ yamlSource = readFileSync(absPath, 'utf8');
37
+ }
38
+ catch (err) {
39
+ printError(`failed to read ${absPath}: ${err.message}`);
40
+ process.exit(EXIT_GENERIC_ERROR);
41
+ }
42
+ const result = validateWorldspec(yamlSource);
43
+ if (result.ok) {
44
+ if (opts.format === 'json') {
45
+ process.stdout.write(JSON.stringify({ ok: true }, null, 2) + '\n');
46
+ }
47
+ else {
48
+ printSuccess(`${pathArg}: valid worldspec (schemaVersion: 1)`);
49
+ }
50
+ process.exit(0);
51
+ }
52
+ if (opts.format === 'json') {
53
+ process.stdout.write(JSON.stringify({ ok: false, errors: result.errors }, null, 2) + '\n');
54
+ }
55
+ else {
56
+ const formatted = formatValidationErrors(result.errors, {
57
+ sourcePath: pathArg,
58
+ yamlSource,
59
+ color: process.stdout.isTTY,
60
+ });
61
+ process.stderr.write(formatted + '\n');
62
+ }
63
+ process.exit(EXIT_WORLDSPEC_INVALID);
64
+ });
65
+ }
66
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/commands/worldspec/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAGnD,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAM3D,MAAM,UAAU,yBAAyB,CAAC,MAAe;IACvD,MAAM;SACH,OAAO,CAAC,iBAAiB,CAAC;SAC1B,WAAW,CAAC,iDAAiD,CAAC;SAC9D,MAAM,CACL,mBAAmB,EACnB,6BAA6B,EAC7B,CAAC,KAAa,EAAoB,EAAE;QAClC,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,4CAA4C,KAAK,IAAI,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EACD,OAAO,CACR;SACA,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,IAAkB,EAAE,EAAE;QACpD,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QAEpD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACzB,UAAU,CAAC,0BAA0B,OAAO,EAAE,CAAC,CAAC;YAChD,OAAO,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,UAAkB,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AAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -32,4 +32,36 @@ export declare const EXIT_PROTOCOL_MISMATCH = 4;
32
32
  * attention" — distinct from EXIT_PLERI_NOT_CONFIGURED (= 2).
33
33
  */
34
34
  export declare const EXIT_AUTH_NEEDS_ATTENTION = 5;
35
+ /**
36
+ * `olam worldspec validate` failed because the worldspec violates the
37
+ * v1 schema (one or more Zod issues surfaced). Plan AC #4 reserves a
38
+ * worldspec-scoped range (20–29) so future worldspec commands can sub-
39
+ * distinguish without colliding with codes 1–5 which already carry
40
+ * CLI-wide meaning.
41
+ *
42
+ * `olam worldspec validate <path>`:
43
+ * exit 0 → worldspec valid
44
+ * exit 20 → schema violation (one or more issues)
45
+ * exit 21 → worldspec file not found / not readable
46
+ * exit 1 → internal error (parse crash, etc)
47
+ */
48
+ export declare const EXIT_WORLDSPEC_INVALID = 20;
49
+ export declare const EXIT_WORLDSPEC_FILE_NOT_FOUND = 21;
50
+ /**
51
+ * `olam worldspec compile` failed to resolve image content-digests
52
+ * (Docker unreachable / image not present locally). Distinct from
53
+ * EXIT_GENERIC_ERROR=1 so CI pipelines can fail-fast on lockfile-
54
+ * digest gaps. Decision #13 invariant: lockfile MUST record digests
55
+ * for fail-fast at world-spawn. MEDIUM-fix (A6 CP3 audit 2026-05-09):
56
+ * digest resolution failure now exits 23 by default; `--allow-pending-
57
+ * digests` opts INTO the soft-warning path for dry-run / no-Docker CI.
58
+ */
59
+ export declare const EXIT_DIGEST_UNRESOLVED = 23;
60
+ /**
61
+ * `olam worldspec init` refused to overwrite an existing default.yaml
62
+ * without `--force`. Distinct from EXIT_GENERIC_ERROR=1 (internal/parse
63
+ * crash) so pipelines can distinguish "user forgot --force" from
64
+ * "something is broken." A3 CP3 audit MEDIUM-fix 2026-05-09.
65
+ */
66
+ export declare const EXIT_WORLDSPEC_EXISTS = 22;
35
67
  //# sourceMappingURL=exit-codes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC"}
1
+ {"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC"}
@@ -32,4 +32,36 @@ export const EXIT_PROTOCOL_MISMATCH = 4;
32
32
  * attention" — distinct from EXIT_PLERI_NOT_CONFIGURED (= 2).
33
33
  */
34
34
  export const EXIT_AUTH_NEEDS_ATTENTION = 5;
35
+ /**
36
+ * `olam worldspec validate` failed because the worldspec violates the
37
+ * v1 schema (one or more Zod issues surfaced). Plan AC #4 reserves a
38
+ * worldspec-scoped range (20–29) so future worldspec commands can sub-
39
+ * distinguish without colliding with codes 1–5 which already carry
40
+ * CLI-wide meaning.
41
+ *
42
+ * `olam worldspec validate <path>`:
43
+ * exit 0 → worldspec valid
44
+ * exit 20 → schema violation (one or more issues)
45
+ * exit 21 → worldspec file not found / not readable
46
+ * exit 1 → internal error (parse crash, etc)
47
+ */
48
+ export const EXIT_WORLDSPEC_INVALID = 20;
49
+ export const EXIT_WORLDSPEC_FILE_NOT_FOUND = 21;
50
+ /**
51
+ * `olam worldspec compile` failed to resolve image content-digests
52
+ * (Docker unreachable / image not present locally). Distinct from
53
+ * EXIT_GENERIC_ERROR=1 so CI pipelines can fail-fast on lockfile-
54
+ * digest gaps. Decision #13 invariant: lockfile MUST record digests
55
+ * for fail-fast at world-spawn. MEDIUM-fix (A6 CP3 audit 2026-05-09):
56
+ * digest resolution failure now exits 23 by default; `--allow-pending-
57
+ * digests` opts INTO the soft-warning path for dry-run / no-Docker CI.
58
+ */
59
+ export const EXIT_DIGEST_UNRESOLVED = 23;
60
+ /**
61
+ * `olam worldspec init` refused to overwrite an existing default.yaml
62
+ * without `--force`. Distinct from EXIT_GENERIC_ERROR=1 (internal/parse
63
+ * crash) so pipelines can distinguish "user forgot --force" from
64
+ * "something is broken." A3 CP3 audit MEDIUM-fix 2026-05-09.
65
+ */
66
+ export const EXIT_WORLDSPEC_EXISTS = 22;
35
67
  //# sourceMappingURL=exit-codes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC"}