@agimon-ai/doompi 0.0.1-alpha.0 → 0.0.1-alpha.2

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 (176) hide show
  1. package/README.md +42 -7
  2. package/dist/bin/cli.cjs +1 -1
  3. package/dist/bin/cli.cjs.map +1 -1
  4. package/dist/bin/cli.mjs +1 -1
  5. package/dist/bin/cli.mjs.map +1 -1
  6. package/dist/cli/cliApp.cjs +1 -1
  7. package/dist/cli/cliApp.cjs.map +1 -1
  8. package/dist/cli/cliApp.d.cts +9 -14
  9. package/dist/cli/cliApp.d.cts.map +1 -1
  10. package/dist/cli/cliApp.d.mts +9 -14
  11. package/dist/cli/cliApp.d.mts.map +1 -1
  12. package/dist/cli/cliApp.mjs +1 -1
  13. package/dist/cli/cliApp.mjs.map +1 -1
  14. package/dist/cli/compatibilityOptions.cjs +1 -1
  15. package/dist/cli/compatibilityOptions.cjs.map +1 -1
  16. package/dist/cli/compatibilityOptions.d.cts +1 -1
  17. package/dist/cli/compatibilityOptions.d.cts.map +1 -1
  18. package/dist/cli/compatibilityOptions.d.mts +1 -1
  19. package/dist/cli/compatibilityOptions.d.mts.map +1 -1
  20. package/dist/cli/compatibilityOptions.mjs +1 -1
  21. package/dist/cli/compatibilityOptions.mjs.map +1 -1
  22. package/dist/cli/help.cjs +2 -0
  23. package/dist/cli/help.cjs.map +1 -1
  24. package/dist/cli/help.mjs +2 -0
  25. package/dist/cli/help.mjs.map +1 -1
  26. package/dist/cli/index.cjs +1 -1
  27. package/dist/cli/index.mjs +1 -1
  28. package/dist/cli/matrixOptions.cjs +1 -1
  29. package/dist/cli/matrixOptions.cjs.map +1 -1
  30. package/dist/cli/matrixOptions.d.cts +5 -5
  31. package/dist/cli/matrixOptions.d.cts.map +1 -1
  32. package/dist/cli/matrixOptions.d.mts +5 -5
  33. package/dist/cli/matrixOptions.d.mts.map +1 -1
  34. package/dist/cli/matrixOptions.mjs +1 -1
  35. package/dist/cli/matrixOptions.mjs.map +1 -1
  36. package/dist/cli/options.cjs +1 -1
  37. package/dist/cli/options.cjs.map +1 -1
  38. package/dist/cli/options.d.cts +1 -1
  39. package/dist/cli/options.d.cts.map +1 -1
  40. package/dist/cli/options.d.mts +1 -1
  41. package/dist/cli/options.d.mts.map +1 -1
  42. package/dist/cli/options.mjs +1 -1
  43. package/dist/cli/options.mjs.map +1 -1
  44. package/dist/commands/buildCommand.cjs +3 -0
  45. package/dist/commands/buildCommand.cjs.map +1 -0
  46. package/dist/commands/buildCommand.d.cts +23 -0
  47. package/dist/commands/buildCommand.d.cts.map +1 -0
  48. package/dist/commands/buildCommand.d.mts +23 -0
  49. package/dist/commands/buildCommand.d.mts.map +1 -0
  50. package/dist/commands/buildCommand.mjs +3 -0
  51. package/dist/commands/buildCommand.mjs.map +1 -0
  52. package/dist/commands/compatibilityCommand.cjs +1 -1
  53. package/dist/commands/compatibilityCommand.cjs.map +1 -1
  54. package/dist/commands/compatibilityCommand.d.cts.map +1 -1
  55. package/dist/commands/compatibilityCommand.d.mts.map +1 -1
  56. package/dist/commands/compatibilityCommand.mjs +1 -1
  57. package/dist/commands/compatibilityCommand.mjs.map +1 -1
  58. package/dist/commands/explainCommand.cjs +4 -4
  59. package/dist/commands/explainCommand.cjs.map +1 -1
  60. package/dist/commands/explainCommand.mjs +4 -4
  61. package/dist/commands/explainCommand.mjs.map +1 -1
  62. package/dist/commands/index.cjs +1 -1
  63. package/dist/commands/index.d.cts +2 -1
  64. package/dist/commands/index.d.mts +2 -1
  65. package/dist/commands/index.mjs +1 -1
  66. package/dist/commands/initCommand.cjs +2 -2
  67. package/dist/commands/initCommand.cjs.map +1 -1
  68. package/dist/commands/initCommand.mjs +2 -2
  69. package/dist/commands/launchCommand.cjs +1 -1
  70. package/dist/commands/launchCommand.cjs.map +1 -1
  71. package/dist/commands/launchCommand.d.cts.map +1 -1
  72. package/dist/commands/launchCommand.d.mts.map +1 -1
  73. package/dist/commands/launchCommand.mjs +1 -1
  74. package/dist/commands/launchCommand.mjs.map +1 -1
  75. package/dist/commands/syncCommand.cjs +5 -5
  76. package/dist/commands/syncCommand.cjs.map +1 -1
  77. package/dist/commands/syncCommand.d.cts.map +1 -1
  78. package/dist/commands/syncCommand.d.mts.map +1 -1
  79. package/dist/commands/syncCommand.mjs +5 -5
  80. package/dist/commands/syncCommand.mjs.map +1 -1
  81. package/dist/entries/addDirCompatibility.cjs +2 -0
  82. package/dist/entries/addDirCompatibility.cjs.map +1 -0
  83. package/dist/entries/addDirCompatibility.d.cts +13 -0
  84. package/dist/entries/addDirCompatibility.d.cts.map +1 -0
  85. package/dist/entries/addDirCompatibility.d.mts +14 -0
  86. package/dist/entries/addDirCompatibility.d.mts.map +1 -0
  87. package/dist/entries/addDirCompatibility.mjs +2 -0
  88. package/dist/entries/addDirCompatibility.mjs.map +1 -0
  89. package/dist/entries/persona.cjs +1 -1
  90. package/dist/entries/persona.cjs.map +1 -1
  91. package/dist/entries/persona.mjs +1 -1
  92. package/dist/entries/repositoryHooks.cjs +1 -1
  93. package/dist/entries/repositoryHooks.mjs +1 -1
  94. package/dist/entries/styleSystem.cjs +2 -2
  95. package/dist/entries/styleSystem.mjs +2 -2
  96. package/dist/index.cjs +1 -1
  97. package/dist/index.d.cts +7 -5
  98. package/dist/index.d.mts +7 -5
  99. package/dist/index.mjs +1 -1
  100. package/dist/interfaces/harness.d.cts +1 -0
  101. package/dist/interfaces/harness.d.cts.map +1 -1
  102. package/dist/interfaces/harness.d.mts +1 -0
  103. package/dist/interfaces/harness.d.mts.map +1 -1
  104. package/dist/logSinkTelemetry.cjs +1 -1
  105. package/dist/logSinkTelemetry.cjs.map +1 -1
  106. package/dist/logSinkTelemetry.d.cts +2 -0
  107. package/dist/logSinkTelemetry.d.cts.map +1 -1
  108. package/dist/logSinkTelemetry.d.mts +2 -0
  109. package/dist/logSinkTelemetry.d.mts.map +1 -1
  110. package/dist/logSinkTelemetry.mjs +1 -1
  111. package/dist/logSinkTelemetry.mjs.map +1 -1
  112. package/dist/services/composer.cjs +1 -1
  113. package/dist/services/composer.cjs.map +1 -1
  114. package/dist/services/composer.d.cts +3 -1
  115. package/dist/services/composer.d.cts.map +1 -1
  116. package/dist/services/composer.d.mts +3 -1
  117. package/dist/services/composer.d.mts.map +1 -1
  118. package/dist/services/composer.mjs +1 -1
  119. package/dist/services/composer.mjs.map +1 -1
  120. package/dist/services/extensionAssembler.cjs +1 -1
  121. package/dist/services/extensionAssembler.cjs.map +1 -1
  122. package/dist/services/extensionAssembler.d.cts.map +1 -1
  123. package/dist/services/extensionAssembler.d.mts.map +1 -1
  124. package/dist/services/extensionAssembler.mjs +1 -1
  125. package/dist/services/extensionAssembler.mjs.map +1 -1
  126. package/dist/services/extensionCompiler.cjs +2 -1
  127. package/dist/services/extensionCompiler.cjs.map +1 -1
  128. package/dist/services/extensionCompiler.mjs +2 -1
  129. package/dist/services/extensionCompiler.mjs.map +1 -1
  130. package/dist/services/harnessContext.cjs +1 -1
  131. package/dist/services/harnessContext.mjs +1 -1
  132. package/dist/services/index.cjs +1 -1
  133. package/dist/services/index.d.cts +2 -1
  134. package/dist/services/index.d.mts +2 -1
  135. package/dist/services/index.mjs +1 -1
  136. package/dist/services/matrixSwitcher.cjs +1 -1
  137. package/dist/services/matrixSwitcher.mjs +1 -1
  138. package/dist/services/mcpFilter.cjs +2 -2
  139. package/dist/services/mcpFilter.mjs +2 -2
  140. package/dist/services/piSettings.cjs +1 -1
  141. package/dist/services/piSettings.cjs.map +1 -1
  142. package/dist/services/piSettings.d.cts.map +1 -1
  143. package/dist/services/piSettings.d.mts.map +1 -1
  144. package/dist/services/piSettings.mjs +1 -1
  145. package/dist/services/piSettings.mjs.map +1 -1
  146. package/dist/services/resourceCollector.cjs +2 -2
  147. package/dist/services/resourceCollector.cjs.map +1 -1
  148. package/dist/services/resourceCollector.d.cts +8 -1
  149. package/dist/services/resourceCollector.d.cts.map +1 -1
  150. package/dist/services/resourceCollector.d.mts +8 -1
  151. package/dist/services/resourceCollector.d.mts.map +1 -1
  152. package/dist/services/resourceCollector.mjs +2 -2
  153. package/dist/services/resourceCollector.mjs.map +1 -1
  154. package/dist/services/runtimeBundle.cjs +2 -0
  155. package/dist/services/runtimeBundle.cjs.map +1 -0
  156. package/dist/services/runtimeBundle.d.cts +64 -0
  157. package/dist/services/runtimeBundle.d.cts.map +1 -0
  158. package/dist/services/runtimeBundle.d.mts +64 -0
  159. package/dist/services/runtimeBundle.d.mts.map +1 -0
  160. package/dist/services/runtimeBundle.mjs +2 -0
  161. package/dist/services/runtimeBundle.mjs.map +1 -0
  162. package/dist/services/skillCatalog.cjs +1 -1
  163. package/dist/services/skillCatalog.cjs.map +1 -1
  164. package/dist/services/skillCatalog.d.cts +1 -1
  165. package/dist/services/skillCatalog.d.mts +1 -1
  166. package/dist/services/skillCatalog.mjs +1 -1
  167. package/dist/services/skillCatalog.mjs.map +1 -1
  168. package/dist/services/syncState.cjs +1 -1
  169. package/dist/services/syncState.cjs.map +1 -1
  170. package/dist/services/syncState.d.cts +7 -4
  171. package/dist/services/syncState.d.cts.map +1 -1
  172. package/dist/services/syncState.d.mts +7 -4
  173. package/dist/services/syncState.d.mts.map +1 -1
  174. package/dist/services/syncState.mjs +1 -1
  175. package/dist/services/syncState.mjs.map +1 -1
  176. package/package.json +26 -16
package/README.md CHANGED
@@ -102,6 +102,7 @@ result where Pi looks, then run `pi` yourself.
102
102
 
103
103
  ```bash
104
104
  doompi init # seed ~/.pi/.doom, once per machine
105
+ doompi build # warm the selected launch bundle and skill cache
105
106
  doompi sync # resolve the selection into .pi/
106
107
  pi # the agent
107
108
 
@@ -117,6 +118,14 @@ Both paths compose the extension set from the same function, `assembleExtensions
117
118
  owns load order. Two things differ. A synced session forces `--auto-stop` off, and it
118
119
  reads mute from `DOOMPI_MUTE` instead of an argument.
119
120
 
121
+ `doompi build` is the launcher warm-up step, analogous to `doom build`: it resolves the
122
+ selected matrix, compiles its exact extension graph into one `.pi/doom/dist` ESM file,
123
+ and warms the persistent skill manifest without starting Pi or changing
124
+ `.pi/settings.json`. A sidecar manifest retains every original extension and exact
125
+ `SKILL.md` path, so resource discovery never depends on the bundle's location.
126
+ Launch still builds on a cache miss, so the command is optional; run it after installing
127
+ or upgrading Doom packages when first-input latency matters.
128
+
120
129
  Syncing does not disturb the launcher. Pi merges the extensions a project declares with
121
130
  the ones passed on the command line, so the synced entry stands down whenever it sees the
122
131
  composed set already there, which is what the launcher and every detached subagent pass.
@@ -228,7 +237,18 @@ layer wants it.
228
237
  **A major mode is the one you actually pick.** You do not assemble layers one by one at the
229
238
  prompt. You select one named major mode with `--major-mode <name>`, and
230
239
  `.doom/modes.yaml` says which layers it contains. A session has exactly one, the way
231
- an Emacs buffer has exactly one major mode.
240
+ an Emacs buffer has exactly one major mode. The file can choose the fallback without
241
+ renaming that mode:
242
+
243
+ ```yaml
244
+ defaultMajorMode: minimal
245
+ majorMode:
246
+ minimal: [guardrails, team]
247
+ copilot: [guardrails, team, plan-mode, runner]
248
+ ```
249
+
250
+ An explicit `--major-mode` wins, then `DOOMPI_MAJOR_MODE`, then
251
+ `defaultMajorMode`. Omitting the field preserves the compatible `copilot` fallback.
232
252
 
233
253
  The flag is `--major-mode` and not `--mode` because Pi already owns `--mode` for its output
234
254
  mode (`text`, `json`, `rpc`), and for any other value it consumes the argument and ignores
@@ -238,7 +258,19 @@ it without a diagnostic. Use `--output-format` for Pi's output mode.
238
258
  plugins contribute their skills and subagents, which MCP servers the session can reach,
239
259
  and whether the always-on shared skills apply. A domain can take a whole plugin or a named
240
260
  subset of one. This is the choice that decides how much the agent can see, so it is also
241
- the lever for keeping context small.
261
+ the lever for keeping context small. Defaults are plural because domains compose:
262
+
263
+ ```yaml
264
+ defaultDomains: [development, qa]
265
+ domains:
266
+ development:
267
+ plugins: [plugins/development]
268
+ qa:
269
+ plugins: [plugins/qa]
270
+ ```
271
+
272
+ Explicit `--domain` or `--domains` flags win, then `DOOMPI_DOMAINS`, then
273
+ `defaultDomains`.
242
274
 
243
275
  **Profiles are a persona and a brand.** `.doom/profiles.yaml` points at a directory under
244
276
  `agents/<brand>/<person>/`, and doom concatenates that person's `profile.md`, `SOUL.md`,
@@ -510,9 +542,10 @@ exactly one name, reject a comma, and can be given only once. The removed `--lay
510
542
  does the removed `DOOMPI_LAYER` variable: a stale export is worth an error rather than a
511
543
  session quietly starting on the default.
512
544
 
513
- Defaults when you name nothing: major mode `copilot`, domains `default`. The `marketing`
514
- major mode is the one exception and defaults to the `marketing` domain. That is the only
515
- place where one choice influences another.
545
+ Defaults when you name nothing: `defaultMajorMode` from `.doom/modes.yaml` and the
546
+ `defaultDomains` list from `.doom/domains.yaml`. Omitting those fields preserves the
547
+ compatible fallbacks: major mode `copilot`, plus domain `marketing` for the legacy
548
+ `marketing` mode or `default` for every other mode.
516
549
 
517
550
  Environment equivalents are `DOOMPI_MAJOR_MODE`, `DOOMPI_DOMAINS`, and `DOOMPI_PROFILE`.
518
551
  `DOOMPI_PRESET` and `DOOMPI_ADDITIONAL_DIRS` work the same way for `--preset` and
@@ -530,8 +563,10 @@ export in a shell profile is worth an error.
530
563
  `DOOMPI_LAYERS`, plural, is a different variable from `DOOMPI_LAYER`. It carries the
531
564
  resolved layer components rather than the mode that selected them.
532
565
 
533
- A repository can declare what it selects by default, which is what a bare `doompi sync`
534
- pins. A flag still wins, then an exported variable, then this:
566
+ A repository can also pin the full selection used by a bare `doompi sync` or
567
+ `doompi build`. A flag still wins, then an exported variable, then the matching
568
+ `selection` field, then `modes.yaml`'s `defaultMajorMode` or `domains.yaml`'s
569
+ `defaultDomains`:
535
570
 
536
571
  ```yaml
537
572
  # .doom/config.yaml
package/dist/bin/cli.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- const e=require(`../cli/cliApp.cjs`);require(`../cli/index.cjs`),e.runCli(process.argv.slice(2)).then(e=>{process.exitCode=e},e=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(`[doompi] ${t}\n`),process.exitCode=1});
2
+ const e=require(`../cli/help.cjs`),t=process.argv.slice(2),n=t[0],r=n===`init`||n===`sync`||n===`build`||n===`compat`,i=!r&&t.some(e=>e===`--help`||e===`-h`)?(e.printHelp(),0):!r&&t.some(e=>e===`--version`||e===`-v`)?(process.stdout.write(`${e.HARNESS_VERSION}\n`),0):void 0;(i===void 0?Promise.resolve().then(()=>require(`../cli/cliApp.cjs`)).then(({runCli:e})=>e(t)):Promise.resolve(i)).then(e=>{process.exitCode=e},e=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(`[doompi] ${t}\n`),process.exitCode=1});
3
3
  //# sourceMappingURL=cli.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","names":["runCli"],"sources":["../../src/bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for doom-pi\n *\n * The executable installed as the `doom-pi` binary, and the file the repository\n * launchers (pi.sh, claude.sh, codex.sh) invoke directly from source.\n */\n\nimport { runCli } from '../cli/index.ts';\n\nrunCli(process.argv.slice(2)).then(\n (exitCode) => {\n process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[doompi] ${message}\\n`);\n process.exitCode = 1;\n },\n);\n"],"mappings":";iEAWAA,EAAAA,OAAO,QAAQ,KAAK,MAAM,EAAE,CAAC,CAAC,KAC3B,GAAa,CACZ,QAAQ,SAAW,GAEpB,GAAmB,CAClB,IAAM,EAAU,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CACtE,QAAQ,OAAO,MAAM,YAAY,EAAQ,IAAI,CAC7C,QAAQ,SAAW,GAEtB"}
1
+ {"version":3,"file":"cli.cjs","names":["HARNESS_VERSION"],"sources":["../../src/bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for doom-pi\n *\n * The executable installed as the `doom-pi` binary, and the file the repository\n * launchers (pi.sh, claude.sh, codex.sh) invoke directly from source.\n */\n\nimport { HARNESS_VERSION, printHelp } from '../cli/help.ts';\n\nconst args = process.argv.slice(2);\nconst command = args[0];\nconst ownsArguments = command === 'init' || command === 'sync' || command === 'build' || command === 'compat';\n\n// Keep informational startup independent from telemetry, configuration, Pi,\n// and the extension compiler. Those graphs are useful for a real command but\n// used to account for almost all of `doompi --help` and `doompi --version`.\nconst informationalExit =\n !ownsArguments && args.some((argument) => argument === '--help' || argument === '-h')\n ? (() => {\n printHelp();\n return 0;\n })()\n : !ownsArguments && args.some((argument) => argument === '--version' || argument === '-v')\n ? (() => {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n })()\n : undefined;\n\nconst run =\n informationalExit === undefined\n ? import('../cli/cliApp.ts').then(({ runCli }) => runCli(args))\n : Promise.resolve(informationalExit);\n\nrun.then(\n (exitCode) => {\n process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[doompi] ${message}\\n`);\n process.exitCode = 1;\n },\n);\n"],"mappings":";mCAWM,EAAO,QAAQ,KAAK,MAAM,EAAE,CAC5B,EAAU,EAAK,GACf,EAAgB,IAAY,QAAU,IAAY,QAAU,IAAY,SAAW,IAAY,SAK/F,EACJ,CAAC,GAAiB,EAAK,KAAM,GAAa,IAAa,UAAY,IAAa,KAAK,EAE/E,EAAA,WAAW,CACJ,GAET,CAAC,GAAiB,EAAK,KAAM,GAAa,IAAa,aAAe,IAAa,KAAK,EAEpF,QAAQ,OAAO,MAAM,GAAGA,EAAAA,gBAAgB,IAAI,CACrC,GAET,IAAA,IAGN,IAAsB,IAAA,GAAA,QAAA,SAAA,CAAA,SAAA,QAClB,oBAAA,CAAA,CAA2B,MAAM,CAAE,YAAa,EAAO,EAAK,CAAC,CAC7D,QAAQ,QAAQ,EAAkB,EAEpC,KACD,GAAa,CACZ,QAAQ,SAAW,GAEpB,GAAmB,CAClB,IAAM,EAAU,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CACtE,QAAQ,OAAO,MAAM,YAAY,EAAQ,IAAI,CAC7C,QAAQ,SAAW,GAEtB"}
package/dist/bin/cli.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{runCli as e}from"../cli/cliApp.mjs";import"../cli/index.mjs";e(process.argv.slice(2)).then(e=>{process.exitCode=e},e=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(`[doompi] ${t}\n`),process.exitCode=1});export{};
2
+ import{HARNESS_VERSION as e,printHelp as t}from"../cli/help.mjs";const n=process.argv.slice(2),r=n[0],i=r===`init`||r===`sync`||r===`build`||r===`compat`,a=!i&&n.some(e=>e===`--help`||e===`-h`)?(t(),0):!i&&n.some(e=>e===`--version`||e===`-v`)?(process.stdout.write(`${e}\n`),0):void 0;(a===void 0?import(`../cli/cliApp.mjs`).then(({runCli:e})=>e(n)):Promise.resolve(a)).then(e=>{process.exitCode=e},e=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(`[doompi] ${t}\n`),process.exitCode=1});export{};
3
3
  //# sourceMappingURL=cli.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../../src/bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for doom-pi\n *\n * The executable installed as the `doom-pi` binary, and the file the repository\n * launchers (pi.sh, claude.sh, codex.sh) invoke directly from source.\n */\n\nimport { runCli } from '../cli/index.ts';\n\nrunCli(process.argv.slice(2)).then(\n (exitCode) => {\n process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[doompi] ${message}\\n`);\n process.exitCode = 1;\n },\n);\n"],"mappings":";oEAWA,EAAO,QAAQ,KAAK,MAAM,EAAE,CAAC,CAAC,KAC3B,GAAa,CACZ,QAAQ,SAAW,GAEpB,GAAmB,CAClB,IAAM,EAAU,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CACtE,QAAQ,OAAO,MAAM,YAAY,EAAQ,IAAI,CAC7C,QAAQ,SAAW,GAEtB"}
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../../src/bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for doom-pi\n *\n * The executable installed as the `doom-pi` binary, and the file the repository\n * launchers (pi.sh, claude.sh, codex.sh) invoke directly from source.\n */\n\nimport { HARNESS_VERSION, printHelp } from '../cli/help.ts';\n\nconst args = process.argv.slice(2);\nconst command = args[0];\nconst ownsArguments = command === 'init' || command === 'sync' || command === 'build' || command === 'compat';\n\n// Keep informational startup independent from telemetry, configuration, Pi,\n// and the extension compiler. Those graphs are useful for a real command but\n// used to account for almost all of `doompi --help` and `doompi --version`.\nconst informationalExit =\n !ownsArguments && args.some((argument) => argument === '--help' || argument === '-h')\n ? (() => {\n printHelp();\n return 0;\n })()\n : !ownsArguments && args.some((argument) => argument === '--version' || argument === '-v')\n ? (() => {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n })()\n : undefined;\n\nconst run =\n informationalExit === undefined\n ? import('../cli/cliApp.ts').then(({ runCli }) => runCli(args))\n : Promise.resolve(informationalExit);\n\nrun.then(\n (exitCode) => {\n process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[doompi] ${message}\\n`);\n process.exitCode = 1;\n },\n);\n"],"mappings":";iEAWA,MAAM,EAAO,QAAQ,KAAK,MAAM,EAAE,CAC5B,EAAU,EAAK,GACf,EAAgB,IAAY,QAAU,IAAY,QAAU,IAAY,SAAW,IAAY,SAK/F,EACJ,CAAC,GAAiB,EAAK,KAAM,GAAa,IAAa,UAAY,IAAa,KAAK,EAE/E,GAAW,CACJ,GAET,CAAC,GAAiB,EAAK,KAAM,GAAa,IAAa,aAAe,IAAa,KAAK,EAEpF,QAAQ,OAAO,MAAM,GAAG,EAAgB,IAAI,CACrC,GAET,IAAA,IAGN,IAAsB,IAAA,GAClB,OAAO,qBAAoB,MAAM,CAAE,YAAa,EAAO,EAAK,CAAC,CAC7D,QAAQ,QAAQ,EAAkB,EAEpC,KACD,GAAa,CACZ,QAAQ,SAAW,GAEpB,GAAmB,CAClB,IAAM,EAAU,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CACtE,QAAQ,OAAO,MAAM,YAAY,EAAQ,IAAI,CAC7C,QAAQ,SAAW,GAEtB"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../logSinkTelemetry.cjs`),n=require(`../config/harnessState.cjs`);require(`../config/index.cjs`);const r=require(`../utils/repository.cjs`);require(`../utils/index.cjs`);const i=require(`../services/harnessContext.cjs`);require(`../services/index.cjs`);const a=require(`../commands/compatibilityCommand.cjs`),o=require(`../commands/emitMcpCommand.cjs`),s=require(`../commands/explainCommand.cjs`),c=require(`../commands/initCommand.cjs`),l=require(`../commands/launchCommand.cjs`),u=require(`./options.cjs`),d=require(`../commands/syncCommand.cjs`);require(`../commands/index.cjs`);const f=require(`./help.cjs`);let p=require(`node:path`);p=e.__toESM(p,1);var m=class{commands=[];compatibilityCommand;initCommand;syncCommand;telemetry;constructor(e=t.createHarnessTelemetry()){this.telemetry=e,this.compatibilityCommand=new a.CompatibilityCommand(e),this.initCommand=new c.InitCommand,this.syncCommand=new d.SyncCommand,this.initializeCommands()}initializeCommands(){this.commands.push(new o.EmitMcpCommand),this.commands.push(new s.ExplainCommand),this.commands.push(new l.LaunchCommand)}selectCommand(e){let t=this.commands.find(t=>t.matches(e));if(!t)throw Error(`No command matched the given options`);return t}async runHarness(e){return this.telemetry.runInSpan(`doom_pi.run`,{"harness.major_mode":e.majorMode,"harness.domain_count":e.domains.length,"harness.agents":e.agents,"harness.mcp":e.mcp,"harness.hooks":e.hooks,...e.profile?{"harness.profile":e.profile}:{},...e.preset?{"harness.preset":e.preset}:{}},async()=>{let n=await i.buildHarnessContext(e,this.telemetry),r=this.selectCommand(n.options);try{return await r.execute(n,this.telemetry)}catch(e){throw await this.telemetry.recordError(t.HARNESS_EVENT.cliFailed,e),e}finally{await n.cleanup()}})}async run(e){if(this.initCommand.matches(e))return this.initCommand.execute(e);if(this.syncCommand.matches(e))return this.syncCommand.execute(e);if(this.compatibilityCommand.matches(e))return this.compatibilityCommand.execute(e);let i=u.parseHarnessArgs(e);if(i.help)return f.printHelp(),0;if(i.version)return process.stdout.write(`${f.HARNESS_VERSION}\n`),0;let a=n.readHarnessState(process.env,t.toFailureReporter(this.telemetry)).root,o=a?p.default.resolve(a):r.findRepositoryRoot(i.options.cwd);return this.runHarness({repoRoot:o,...i.options})}};async function h(e){let n=t.createHarnessTelemetry();try{return await new m(n).run(e)}finally{await n.shutdown()}}async function g(e){let n=t.createHarnessTelemetry();try{return await new m(n).runHarness(e)}finally{await n.shutdown()}}exports.CliApp=m,exports.runCli=h,exports.runHarness=g;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`./help.cjs`),n=require(`./options.cjs`);let r=require(`node:path`);r=e.__toESM(r,1);var i=class{telemetry;ownsTelemetry=!1;constructor(e){this.telemetry=e}async getTelemetry(){if(this.telemetry)return this.telemetry;let{createHarnessTelemetry:e}=await Promise.resolve().then(()=>require(`../logSinkTelemetry.cjs`));return this.telemetry=e({deferSpans:!0}),this.ownsTelemetry=!0,this.telemetry}async selectCommand(e){if(e.emitMcp){let{EmitMcpCommand:e}=await Promise.resolve().then(()=>require(`../commands/emitMcpCommand.cjs`));return new e}if(e.explain){let{ExplainCommand:e}=await Promise.resolve().then(()=>require(`../commands/explainCommand.cjs`));return new e}let{LaunchCommand:t}=await Promise.resolve().then(()=>require(`../commands/launchCommand.cjs`));return new t}async runHarness(e){let t=await this.getTelemetry(),[{buildHarnessContext:n},{HARNESS_EVENT:r}]=await Promise.all([Promise.resolve().then(()=>require(`../services/harnessContext.cjs`)),Promise.resolve().then(()=>require(`../logSinkTelemetry.cjs`))]);return t.runInSpan(`doom_pi.run`,{"harness.major_mode":e.majorMode,"harness.domain_count":e.domains.length,"harness.agents":e.agents,"harness.mcp":e.mcp,"harness.hooks":e.hooks,...e.profile?{"harness.profile":e.profile}:{},...e.preset?{"harness.preset":e.preset}:{}},async()=>{let i=await n(e,t),a=await this.selectCommand(i.options);try{return await a.execute(i,t)}catch(e){throw await t.recordError(r.cliFailed,e),e}finally{await i.cleanup()}})}async run(e){if(e[0]===`init`){let{InitCommand:t}=await Promise.resolve().then(()=>require(`../commands/initCommand.cjs`));return new t().execute(e)}if(e[0]===`sync`){let{SyncCommand:t}=await Promise.resolve().then(()=>require(`../commands/syncCommand.cjs`));return new t().execute(e)}if(e[0]===`build`){let[{BuildCommand:t},n]=await Promise.all([Promise.resolve().then(()=>require(`../commands/buildCommand.cjs`)),this.getTelemetry()]);return new t(n).execute(e)}if(e[0]===`compat`){let[{CompatibilityCommand:t},n]=await Promise.all([Promise.resolve().then(()=>require(`../commands/compatibilityCommand.cjs`)),this.getTelemetry()]);return new t(n).execute(e)}let i=n.parseHarnessArgs(e);if(i.help)return t.printHelp(),0;if(i.version)return process.stdout.write(`${t.HARNESS_VERSION}\n`),0;let a=await this.getTelemetry(),[{readHarnessState:o},{loadDomains:s},{loadMajorModesConfig:c},{toFailureReporter:l},{findRepositoryRoot:u}]=await Promise.all([Promise.resolve().then(()=>require(`../config/harnessState.cjs`)),import(`@agimon-ai/doompi-config/domains`),import(`@agimon-ai/doompi-config/majorModes`),Promise.resolve().then(()=>require(`../logSinkTelemetry.cjs`)),Promise.resolve().then(()=>require(`../utils/repository.cjs`))]),d=o(process.env,l(a)).root,f=d?r.default.resolve(d):u(i.options.cwd),p=n.parseHarnessArgs(e,process.env,process.cwd(),c(f).defaultMajorMode,s(f).defaultDomains);return this.runHarness({repoRoot:f,...p.options})}async shutdown(){this.ownsTelemetry&&await this.telemetry?.shutdown()}};async function a(e){let t=new i;try{return await t.run(e)}finally{await t.shutdown()}}async function o(e){let t=new i;try{return await t.runHarness(e)}finally{await t.shutdown()}}exports.CliApp=i,exports.runCli=a,exports.runHarness=o;
2
2
  //# sourceMappingURL=cliApp.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cliApp.cjs","names":["createHarnessTelemetry","CompatibilityCommand","InitCommand","SyncCommand","EmitMcpCommand","ExplainCommand","LaunchCommand","buildHarnessContext","HARNESS_EVENT","parseHarnessArgs","HARNESS_VERSION","readHarnessState","toFailureReporter","path","findRepositoryRoot"],"sources":["../../src/cli/cliApp.ts"],"sourcesContent":["import path from 'node:path';\nimport {\n BaseCommand,\n CompatibilityCommand,\n EmitMcpCommand,\n ExplainCommand,\n InitCommand,\n LaunchCommand,\n SyncCommand,\n} from '../commands/index.ts';\nimport { readHarnessState } from '../config/index.ts';\nimport type { HarnessOptions } from '../interfaces/index.ts';\nimport { buildHarnessContext } from '../services/index.ts';\nimport {\n createHarnessTelemetry,\n HARNESS_EVENT,\n toFailureReporter,\n type HarnessTelemetry,\n} from '../logSinkTelemetry.ts';\nimport { findRepositoryRoot } from '../utils/index.ts';\nimport { HARNESS_VERSION, printHelp } from './help.ts';\nimport { parseHarnessArgs } from './options.ts';\n\n/**\n * Main CLI Application\n *\n * Owns command registration and dispatch. Preparation is shared: the context\n * is built once and handed to whichever command claims the run.\n */\nexport class CliApp {\n private readonly commands: BaseCommand[] = [];\n private readonly compatibilityCommand: CompatibilityCommand;\n private readonly initCommand: InitCommand;\n private readonly syncCommand: SyncCommand;\n private readonly telemetry: HarnessTelemetry;\n\n // Fields are declared and assigned explicitly rather than as constructor\n // parameter properties: the launcher scripts run this file straight from\n // source under Node's strip-only TypeScript mode, which rejects them.\n constructor(telemetry: HarnessTelemetry = createHarnessTelemetry()) {\n this.telemetry = telemetry;\n this.compatibilityCommand = new CompatibilityCommand(telemetry);\n this.initCommand = new InitCommand();\n this.syncCommand = new SyncCommand();\n this.initializeCommands();\n }\n\n /**\n * Initialize all available commands.\n *\n * Order matters. The first match wins and LaunchCommand matches everything,\n * so the diagnostic commands have to come before it.\n */\n private initializeCommands(): void {\n this.commands.push(new EmitMcpCommand());\n this.commands.push(new ExplainCommand());\n this.commands.push(new LaunchCommand());\n }\n\n /** Picks the command the parsed options select. */\n selectCommand(options: HarnessOptions): BaseCommand {\n const command = this.commands.find((candidate) => candidate.matches(options));\n if (!command) throw new Error('No command matched the given options');\n return command;\n }\n\n /**\n * Builds the context, runs the selected command, and always cleans up.\n *\n * The whole run is one span so the sink shows preparation and the child\n * process as a single timeline: a slow launch is almost always a slow stage\n * inside here, and that is only visible when the stages share a trace.\n */\n async runHarness(options: HarnessOptions): Promise<number> {\n return this.telemetry.runInSpan(\n 'doom_pi.run',\n {\n 'harness.major_mode': options.majorMode,\n 'harness.domain_count': options.domains.length,\n 'harness.agents': options.agents,\n 'harness.mcp': options.mcp,\n 'harness.hooks': options.hooks,\n ...(options.profile ? { 'harness.profile': options.profile } : {}),\n ...(options.preset ? { 'harness.preset': options.preset } : {}),\n },\n async () => {\n const context = await buildHarnessContext(options, this.telemetry);\n const command = this.selectCommand(context.options);\n try {\n // Selection uses the same resolved options used to build the context.\n return await command.execute(context, this.telemetry);\n } catch (error) {\n await this.telemetry.recordError(HARNESS_EVENT.cliFailed, error);\n throw error;\n } finally {\n await context.cleanup();\n }\n },\n );\n }\n\n /** Entry point for raw process arguments. */\n async run(args: string[]): Promise<number> {\n if (this.initCommand.matches(args)) return this.initCommand.execute(args);\n // Config management rather than a launch: it resolves the matrix and writes\n // it out for plain Pi, so it never builds a launch context of its own.\n if (this.syncCommand.matches(args)) return this.syncCommand.execute(args);\n if (this.compatibilityCommand.matches(args)) return this.compatibilityCommand.execute(args);\n\n const parsed = parseHarnessArgs(args);\n if (parsed.help) {\n printHelp();\n return 0;\n }\n if (parsed.version) {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n }\n // An inherited root wins, which is how a nested run stays pinned to the\n // outer repository rather than re-deriving one from its own cwd.\n const inheritedRoot = readHarnessState(process.env, toFailureReporter(this.telemetry)).root;\n const repoRoot = inheritedRoot ? path.resolve(inheritedRoot) : findRepositoryRoot(parsed.options.cwd);\n return this.runHarness({ repoRoot, ...parsed.options });\n }\n}\n\n/**\n * Convenience wrapper kept so the binary and tests need no CliApp knowledge.\n *\n * Telemetry is shut down here rather than inside runHarness, because this is\n * the only scope that owns the process: flushing earlier would drop the records\n * a later command still emits.\n */\nexport async function runCli(args: string[]): Promise<number> {\n const telemetry = createHarnessTelemetry();\n try {\n return await new CliApp(telemetry).run(args);\n } finally {\n await telemetry.shutdown();\n }\n}\n\n/** Runs an already-resolved option set, skipping argument parsing. */\nexport async function runHarness(options: HarnessOptions): Promise<number> {\n const telemetry = createHarnessTelemetry();\n try {\n return await new CliApp(telemetry).runHarness(options);\n } finally {\n await telemetry.shutdown();\n }\n}\n"],"mappings":"mxBA6BA,IAAa,EAAb,KAAoB,CAClB,SAA2C,EAAE,CAC7C,qBACA,YACA,YACA,UAKA,YAAY,EAA8BA,EAAAA,wBAAwB,CAAE,CAClE,KAAK,UAAY,EACjB,KAAK,qBAAuB,IAAIC,EAAAA,qBAAqB,EAAU,CAC/D,KAAK,YAAc,IAAIC,EAAAA,YACvB,KAAK,YAAc,IAAIC,EAAAA,YACvB,KAAK,oBAAoB,CAS3B,oBAAmC,CACjC,KAAK,SAAS,KAAK,IAAIC,EAAAA,eAAiB,CACxC,KAAK,SAAS,KAAK,IAAIC,EAAAA,eAAiB,CACxC,KAAK,SAAS,KAAK,IAAIC,EAAAA,cAAgB,CAIzC,cAAc,EAAsC,CAClD,IAAM,EAAU,KAAK,SAAS,KAAM,GAAc,EAAU,QAAQ,EAAQ,CAAC,CAC7E,GAAI,CAAC,EAAS,MAAU,MAAM,uCAAuC,CACrE,OAAO,EAUT,MAAM,WAAW,EAA0C,CACzD,OAAO,KAAK,UAAU,UACpB,cACA,CACE,qBAAsB,EAAQ,UAC9B,uBAAwB,EAAQ,QAAQ,OACxC,iBAAkB,EAAQ,OAC1B,cAAe,EAAQ,IACvB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AK,QACpC,CACR,MAAM,EAAU,UAAU,EAK9B,eAAsB,EAAW,EAA0C,CACzE,IAAM,EAAYA,EAAAA,wBAAwB,CAC1C,GAAI,CACF,OAAO,MAAM,IAAI,EAAO,EAAU,CAAC,WAAW,EAAQ,QAC9C,CACR,MAAM,EAAU,UAAU"}
1
+ {"version":3,"file":"cliApp.cjs","names":["parseHarnessArgs","HARNESS_VERSION","path"],"sources":["../../src/cli/cliApp.ts"],"sourcesContent":["import path from 'node:path';\nimport type { BaseCommand } from '../commands/baseCommand.ts';\nimport type { HarnessOptions } from '../interfaces/index.ts';\nimport type { HarnessTelemetry } from '../logSinkTelemetry.ts';\nimport { HARNESS_VERSION, printHelp } from './help.ts';\nimport { parseHarnessArgs } from './options.ts';\n\n/**\n * Main CLI Application\n *\n * Owns command registration and dispatch. Preparation is shared: the context\n * is built once and handed to whichever command claims the run.\n */\nexport class CliApp {\n private telemetry: HarnessTelemetry | undefined;\n private ownsTelemetry = false;\n\n // Fields are declared and assigned explicitly rather than as constructor\n // parameter properties: the launcher scripts run this file straight from\n // source under Node's strip-only TypeScript mode, which rejects them.\n constructor(telemetry?: HarnessTelemetry) {\n this.telemetry = telemetry;\n }\n\n /** Creates telemetry only for commands that actually report a run. */\n private async getTelemetry(): Promise<HarnessTelemetry> {\n if (this.telemetry) return this.telemetry;\n const { createHarnessTelemetry } = await import('../logSinkTelemetry.ts');\n // Telemetry's transport graph costs roughly one launcher budget slice by\n // itself. Startup callbacks and lifecycle events buffer until shutdown, so\n // transport initialization cannot compete with the Pi child for input.\n this.telemetry = createHarnessTelemetry({ deferSpans: true });\n this.ownsTelemetry = true;\n return this.telemetry;\n }\n\n /** Picks and imports only the command the parsed options select. */\n async selectCommand(options: HarnessOptions): Promise<BaseCommand> {\n if (options.emitMcp) {\n const { EmitMcpCommand } = await import('../commands/emitMcpCommand.ts');\n return new EmitMcpCommand();\n }\n if (options.explain) {\n const { ExplainCommand } = await import('../commands/explainCommand.ts');\n return new ExplainCommand();\n }\n const { LaunchCommand } = await import('../commands/launchCommand.ts');\n return new LaunchCommand();\n }\n\n /**\n * Builds the context, runs the selected command, and always cleans up.\n *\n * The whole run is one span so the sink shows preparation and the child\n * process as a single timeline: a slow launch is almost always a slow stage\n * inside here, and that is only visible when the stages share a trace.\n */\n async runHarness(options: HarnessOptions): Promise<number> {\n const telemetry = await this.getTelemetry();\n const [{ buildHarnessContext }, { HARNESS_EVENT }] = await Promise.all([\n import('../services/harnessContext.ts'),\n import('../logSinkTelemetry.ts'),\n ]);\n return telemetry.runInSpan(\n 'doom_pi.run',\n {\n 'harness.major_mode': options.majorMode,\n 'harness.domain_count': options.domains.length,\n 'harness.agents': options.agents,\n 'harness.mcp': options.mcp,\n 'harness.hooks': options.hooks,\n ...(options.profile ? { 'harness.profile': options.profile } : {}),\n ...(options.preset ? { 'harness.preset': options.preset } : {}),\n },\n async () => {\n const context = await buildHarnessContext(options, telemetry);\n const command = await this.selectCommand(context.options);\n try {\n // Selection uses the same resolved options used to build the context.\n return await command.execute(context, telemetry);\n } catch (error) {\n await telemetry.recordError(HARNESS_EVENT.cliFailed, error);\n throw error;\n } finally {\n await context.cleanup();\n }\n },\n );\n }\n\n /** Entry point for raw process arguments. */\n async run(args: string[]): Promise<number> {\n if (args[0] === 'init') {\n const { InitCommand } = await import('../commands/initCommand.ts');\n return new InitCommand().execute(args);\n }\n // Config management rather than a launch: it resolves the matrix and writes\n // it out for plain Pi, so it never builds a launch context of its own.\n if (args[0] === 'sync') {\n const { SyncCommand } = await import('../commands/syncCommand.ts');\n return new SyncCommand().execute(args);\n }\n if (args[0] === 'build') {\n const [{ BuildCommand }, telemetry] = await Promise.all([\n import('../commands/buildCommand.ts'),\n this.getTelemetry(),\n ]);\n return new BuildCommand(telemetry).execute(args);\n }\n if (args[0] === 'compat') {\n const [{ CompatibilityCommand }, telemetry] = await Promise.all([\n import('../commands/compatibilityCommand.ts'),\n this.getTelemetry(),\n ]);\n return new CompatibilityCommand(telemetry).execute(args);\n }\n\n // The first pass resolves --cwd without touching repository configuration,\n // which keeps help and version available even when modes.yaml is malformed.\n const initial = parseHarnessArgs(args);\n if (initial.help) {\n printHelp();\n return 0;\n }\n if (initial.version) {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n }\n // An inherited root wins, which is how a nested run stays pinned to the\n // outer repository rather than re-deriving one from its own cwd.\n const telemetry = await this.getTelemetry();\n const [\n { readHarnessState },\n { loadDomains },\n { loadMajorModesConfig },\n { toFailureReporter },\n { findRepositoryRoot },\n ] = await Promise.all([\n import('../config/harnessState.ts'),\n import('@agimon-ai/doompi-config/domains'),\n import('@agimon-ai/doompi-config/majorModes'),\n import('../logSinkTelemetry.ts'),\n import('../utils/repository.ts'),\n ]);\n const inheritedRoot = readHarnessState(process.env, toFailureReporter(telemetry)).root;\n const repoRoot = inheritedRoot ? path.resolve(inheritedRoot) : findRepositoryRoot(initial.options.cwd);\n const parsed = parseHarnessArgs(\n args,\n process.env,\n process.cwd(),\n loadMajorModesConfig(repoRoot).defaultMajorMode,\n loadDomains(repoRoot).defaultDomains,\n );\n return this.runHarness({ repoRoot, ...parsed.options });\n }\n\n /** Flushes telemetry if this application created it lazily. */\n async shutdown(): Promise<void> {\n if (this.ownsTelemetry) await this.telemetry?.shutdown();\n }\n}\n\n/**\n * Convenience wrapper kept so the binary and tests need no CliApp knowledge.\n *\n * Telemetry is shut down here rather than inside runHarness, because this is\n * the only scope that owns the process: flushing earlier would drop the records\n * a later command still emits.\n */\nexport async function runCli(args: string[]): Promise<number> {\n const app = new CliApp();\n try {\n return await app.run(args);\n } finally {\n await app.shutdown();\n }\n}\n\n/** Runs an already-resolved option set, skipping argument parsing. */\nexport async function runHarness(options: HarnessOptions): Promise<number> {\n const app = new CliApp();\n try {\n return await app.runHarness(options);\n } finally {\n await app.shutdown();\n }\n}\n"],"mappings":"uNAaA,IAAa,EAAb,KAAoB,CAClB,UACA,cAAwB,GAKxB,YAAY,EAA8B,CACxC,KAAK,UAAY,EAInB,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A,CAAA,CACD,CAAC,CACI,EAAgB,EAAiB,QAAQ,IAAK,EAAkB,EAAU,CAAC,CAAC,KAC5E,EAAW,EAAgBC,EAAAA,QAAK,QAAQ,EAAc,CAAG,EAAmB,EAAQ,QAAQ,IAAI,CAChG,EAASF,EAAAA,iBACb,EACA,QAAQ,IACR,QAAQ,KAAK,CACb,EAAqB,EAAS,CAAC,iBAC/B,EAAY,EAAS,CAAC,eACvB,CACD,OAAO,KAAK,WAAW,CAAE,WAAU,GAAG,EAAO,QAAS,CAAC,CAIzD,MAAM,UAA0B,CAC1B,KAAK,eAAe,MAAM,KAAK,WAAW,UAAU,GAW5D,eAAsB,EAAO,EAAiC,CAC5D,IAAM,EAAM,IAAI,EAChB,GAAI,CACF,OAAO,MAAM,EAAI,IAAI,EAAK,QAClB,CACR,MAAM,EAAI,UAAU,EAKxB,eAAsB,EAAW,EAA0C,CACzE,IAAM,EAAM,IAAI,EAChB,GAAI,CACF,OAAO,MAAM,EAAI,WAAW,EAAQ,QAC5B,CACR,MAAM,EAAI,UAAU"}
@@ -1,6 +1,7 @@
1
1
  import { HarnessOptions } from "../interfaces/harness.cjs";
2
2
  import { HarnessTelemetry } from "../logSinkTelemetry.cjs";
3
3
  import { BaseCommand } from "../commands/baseCommand.cjs";
4
+
4
5
  //#region src/cli/cliApp.d.ts
5
6
  /**
6
7
  * Main CLI Application
@@ -9,21 +10,13 @@ import { BaseCommand } from "../commands/baseCommand.cjs";
9
10
  * is built once and handed to whichever command claims the run.
10
11
  */
11
12
  declare class CliApp {
12
- private readonly commands;
13
- private readonly compatibilityCommand;
14
- private readonly initCommand;
15
- private readonly syncCommand;
16
- private readonly telemetry;
13
+ private telemetry;
14
+ private ownsTelemetry;
17
15
  constructor(telemetry?: HarnessTelemetry);
18
- /**
19
- * Initialize all available commands.
20
- *
21
- * Order matters. The first match wins and LaunchCommand matches everything,
22
- * so the diagnostic commands have to come before it.
23
- */
24
- private initializeCommands;
25
- /** Picks the command the parsed options select. */
26
- selectCommand(options: HarnessOptions): BaseCommand;
16
+ /** Creates telemetry only for commands that actually report a run. */
17
+ private getTelemetry;
18
+ /** Picks and imports only the command the parsed options select. */
19
+ selectCommand(options: HarnessOptions): Promise<BaseCommand>;
27
20
  /**
28
21
  * Builds the context, runs the selected command, and always cleans up.
29
22
  *
@@ -34,6 +27,8 @@ declare class CliApp {
34
27
  runHarness(options: HarnessOptions): Promise<number>;
35
28
  /** Entry point for raw process arguments. */
36
29
  run(args: string[]): Promise<number>;
30
+ /** Flushes telemetry if this application created it lazily. */
31
+ shutdown(): Promise<void>;
37
32
  }
38
33
  /**
39
34
  * Convenience wrapper kept so the binary and tests need no CliApp knowledge.
@@ -1 +1 @@
1
- {"version":3,"file":"cliApp.d.cts","names":[],"sources":["../../src/cli/cliApp.ts"],"mappings":";;;;;;;AA6BA;;;cAAa,MAAA;EAAA,iBACM,QAAA;EAAA,iBACA,oBAAA;EAAA,iBACA,WAAA;EAAA,iBACA,WAAA;EAAA,iBACA,SAAA;cAKL,SAAA,GAAW,gBAAA;EA+DW;;;;;;EAAA,QAjD1B,kBAAA;EAde;EAqBvB,aAAA,CAAc,OAAA,EAAS,cAAA,GAAiB,WAAA;EAPhC;;;;;;;EAoBF,UAAA,CAAW,OAAA,EAAS,cAAA,GAAiB,OAAA;EAAA;EA6BrC,GAAA,CAAI,IAAA,aAAiB,OAAA;AAAA;;;;AA+B7B;;;;iBAAsB,MAAA,CAAO,IAAA,aAAiB,OAAA;AAU9C;AAAA,iBAAsB,UAAA,CAAW,OAAA,EAAS,cAAA,GAAiB,OAAA"}
1
+ {"version":3,"file":"cliApp.d.cts","names":[],"sources":["../../src/cli/cliApp.ts"],"mappings":";;;;;;;AAaA;;;;cAAa,MAAA;EAAA,QACH,SAAA;EAAA,QACA,aAAA;cAKI,SAAA,GAAY,gBAAA;EAqCmB;EAAA,QAhC7B,YAAA;EAoII;EAxHZ,aAAA,CAAc,OAAA,EAAS,cAAA,GAAiB,OAAA,CAAQ,WAAA;EAwH7B;;;;;;;EApGnB,UAAA,CAAW,OAAA,EAAS,cAAA,GAAiB,OAAA;EApBd;EAsDvB,GAAA,CAAI,IAAA,aAAiB,OAAA;EAtDmB;EAwHxC,QAAA,CAAA,GAAY,OAAA;AAAA;;;;;;;;iBAYE,MAAA,CAAO,IAAA,aAAiB,OAAA;;iBAUxB,UAAA,CAAW,OAAA,EAAS,cAAA,GAAiB,OAAA"}
@@ -1,6 +1,7 @@
1
1
  import { HarnessOptions } from "../interfaces/harness.mjs";
2
2
  import { HarnessTelemetry } from "../logSinkTelemetry.mjs";
3
3
  import { BaseCommand } from "../commands/baseCommand.mjs";
4
+
4
5
  //#region src/cli/cliApp.d.ts
5
6
  /**
6
7
  * Main CLI Application
@@ -9,21 +10,13 @@ import { BaseCommand } from "../commands/baseCommand.mjs";
9
10
  * is built once and handed to whichever command claims the run.
10
11
  */
11
12
  declare class CliApp {
12
- private readonly commands;
13
- private readonly compatibilityCommand;
14
- private readonly initCommand;
15
- private readonly syncCommand;
16
- private readonly telemetry;
13
+ private telemetry;
14
+ private ownsTelemetry;
17
15
  constructor(telemetry?: HarnessTelemetry);
18
- /**
19
- * Initialize all available commands.
20
- *
21
- * Order matters. The first match wins and LaunchCommand matches everything,
22
- * so the diagnostic commands have to come before it.
23
- */
24
- private initializeCommands;
25
- /** Picks the command the parsed options select. */
26
- selectCommand(options: HarnessOptions): BaseCommand;
16
+ /** Creates telemetry only for commands that actually report a run. */
17
+ private getTelemetry;
18
+ /** Picks and imports only the command the parsed options select. */
19
+ selectCommand(options: HarnessOptions): Promise<BaseCommand>;
27
20
  /**
28
21
  * Builds the context, runs the selected command, and always cleans up.
29
22
  *
@@ -34,6 +27,8 @@ declare class CliApp {
34
27
  runHarness(options: HarnessOptions): Promise<number>;
35
28
  /** Entry point for raw process arguments. */
36
29
  run(args: string[]): Promise<number>;
30
+ /** Flushes telemetry if this application created it lazily. */
31
+ shutdown(): Promise<void>;
37
32
  }
38
33
  /**
39
34
  * Convenience wrapper kept so the binary and tests need no CliApp knowledge.
@@ -1 +1 @@
1
- {"version":3,"file":"cliApp.d.mts","names":[],"sources":["../../src/cli/cliApp.ts"],"mappings":";;;;;;;AA6BA;;;cAAa,MAAA;EAAA,iBACM,QAAA;EAAA,iBACA,oBAAA;EAAA,iBACA,WAAA;EAAA,iBACA,WAAA;EAAA,iBACA,SAAA;cAKL,SAAA,GAAW,gBAAA;EA+DW;;;;;;EAAA,QAjD1B,kBAAA;EAde;EAqBvB,aAAA,CAAc,OAAA,EAAS,cAAA,GAAiB,WAAA;EAPhC;;;;;;;EAoBF,UAAA,CAAW,OAAA,EAAS,cAAA,GAAiB,OAAA;EAAA;EA6BrC,GAAA,CAAI,IAAA,aAAiB,OAAA;AAAA;;;;AA+B7B;;;;iBAAsB,MAAA,CAAO,IAAA,aAAiB,OAAA;AAU9C;AAAA,iBAAsB,UAAA,CAAW,OAAA,EAAS,cAAA,GAAiB,OAAA"}
1
+ {"version":3,"file":"cliApp.d.mts","names":[],"sources":["../../src/cli/cliApp.ts"],"mappings":";;;;;;;AAaA;;;;cAAa,MAAA;EAAA,QACH,SAAA;EAAA,QACA,aAAA;cAKI,SAAA,GAAY,gBAAA;EAqCmB;EAAA,QAhC7B,YAAA;EAoII;EAxHZ,aAAA,CAAc,OAAA,EAAS,cAAA,GAAiB,OAAA,CAAQ,WAAA;EAwH7B;;;;;;;EApGnB,UAAA,CAAW,OAAA,EAAS,cAAA,GAAiB,OAAA;EApBd;EAsDvB,GAAA,CAAI,IAAA,aAAiB,OAAA;EAtDmB;EAwHxC,QAAA,CAAA,GAAY,OAAA;AAAA;;;;;;;;iBAYE,MAAA,CAAO,IAAA,aAAiB,OAAA;;iBAUxB,UAAA,CAAW,OAAA,EAAS,cAAA,GAAiB,OAAA"}
@@ -1,2 +1,2 @@
1
- import{HARNESS_EVENT as e,createHarnessTelemetry as t,toFailureReporter as n}from"../logSinkTelemetry.mjs";import{readHarnessState as r}from"../config/harnessState.mjs";import"../config/index.mjs";import{findRepositoryRoot as i}from"../utils/repository.mjs";import"../utils/index.mjs";import{buildHarnessContext as a}from"../services/harnessContext.mjs";import"../services/index.mjs";import{CompatibilityCommand as o}from"../commands/compatibilityCommand.mjs";import{EmitMcpCommand as s}from"../commands/emitMcpCommand.mjs";import{ExplainCommand as c}from"../commands/explainCommand.mjs";import{InitCommand as l}from"../commands/initCommand.mjs";import{LaunchCommand as u}from"../commands/launchCommand.mjs";import{parseHarnessArgs as d}from"./options.mjs";import{SyncCommand as f}from"../commands/syncCommand.mjs";import"../commands/index.mjs";import{HARNESS_VERSION as p,printHelp as m}from"./help.mjs";import h from"node:path";var g=class{commands=[];compatibilityCommand;initCommand;syncCommand;telemetry;constructor(e=t()){this.telemetry=e,this.compatibilityCommand=new o(e),this.initCommand=new l,this.syncCommand=new f,this.initializeCommands()}initializeCommands(){this.commands.push(new s),this.commands.push(new c),this.commands.push(new u)}selectCommand(e){let t=this.commands.find(t=>t.matches(e));if(!t)throw Error(`No command matched the given options`);return t}async runHarness(t){return this.telemetry.runInSpan(`doom_pi.run`,{"harness.major_mode":t.majorMode,"harness.domain_count":t.domains.length,"harness.agents":t.agents,"harness.mcp":t.mcp,"harness.hooks":t.hooks,...t.profile?{"harness.profile":t.profile}:{},...t.preset?{"harness.preset":t.preset}:{}},async()=>{let n=await a(t,this.telemetry),r=this.selectCommand(n.options);try{return await r.execute(n,this.telemetry)}catch(t){throw await this.telemetry.recordError(e.cliFailed,t),t}finally{await n.cleanup()}})}async run(e){if(this.initCommand.matches(e))return this.initCommand.execute(e);if(this.syncCommand.matches(e))return this.syncCommand.execute(e);if(this.compatibilityCommand.matches(e))return this.compatibilityCommand.execute(e);let t=d(e);if(t.help)return m(),0;if(t.version)return process.stdout.write(`${p}\n`),0;let a=r(process.env,n(this.telemetry)).root,o=a?h.resolve(a):i(t.options.cwd);return this.runHarness({repoRoot:o,...t.options})}};async function _(e){let n=t();try{return await new g(n).run(e)}finally{await n.shutdown()}}async function v(e){let n=t();try{return await new g(n).runHarness(e)}finally{await n.shutdown()}}export{g as CliApp,_ as runCli,v as runHarness};
1
+ import{HARNESS_VERSION as e,printHelp as t}from"./help.mjs";import{parseHarnessArgs as n}from"./options.mjs";import r from"node:path";var i=class{telemetry;ownsTelemetry=!1;constructor(e){this.telemetry=e}async getTelemetry(){if(this.telemetry)return this.telemetry;let{createHarnessTelemetry:e}=await import(`../logSinkTelemetry.mjs`);return this.telemetry=e({deferSpans:!0}),this.ownsTelemetry=!0,this.telemetry}async selectCommand(e){if(e.emitMcp){let{EmitMcpCommand:e}=await import(`../commands/emitMcpCommand.mjs`);return new e}if(e.explain){let{ExplainCommand:e}=await import(`../commands/explainCommand.mjs`);return new e}let{LaunchCommand:t}=await import(`../commands/launchCommand.mjs`);return new t}async runHarness(e){let t=await this.getTelemetry(),[{buildHarnessContext:n},{HARNESS_EVENT:r}]=await Promise.all([import(`../services/harnessContext.mjs`),import(`../logSinkTelemetry.mjs`)]);return t.runInSpan(`doom_pi.run`,{"harness.major_mode":e.majorMode,"harness.domain_count":e.domains.length,"harness.agents":e.agents,"harness.mcp":e.mcp,"harness.hooks":e.hooks,...e.profile?{"harness.profile":e.profile}:{},...e.preset?{"harness.preset":e.preset}:{}},async()=>{let i=await n(e,t),a=await this.selectCommand(i.options);try{return await a.execute(i,t)}catch(e){throw await t.recordError(r.cliFailed,e),e}finally{await i.cleanup()}})}async run(i){if(i[0]===`init`){let{InitCommand:e}=await import(`../commands/initCommand.mjs`);return new e().execute(i)}if(i[0]===`sync`){let{SyncCommand:e}=await import(`../commands/syncCommand.mjs`);return new e().execute(i)}if(i[0]===`build`){let[{BuildCommand:e},t]=await Promise.all([import(`../commands/buildCommand.mjs`),this.getTelemetry()]);return new e(t).execute(i)}if(i[0]===`compat`){let[{CompatibilityCommand:e},t]=await Promise.all([import(`../commands/compatibilityCommand.mjs`),this.getTelemetry()]);return new e(t).execute(i)}let a=n(i);if(a.help)return t(),0;if(a.version)return process.stdout.write(`${e}\n`),0;let o=await this.getTelemetry(),[{readHarnessState:s},{loadDomains:c},{loadMajorModesConfig:l},{toFailureReporter:u},{findRepositoryRoot:d}]=await Promise.all([import(`../config/harnessState.mjs`),import(`@agimon-ai/doompi-config/domains`),import(`@agimon-ai/doompi-config/majorModes`),import(`../logSinkTelemetry.mjs`),import(`../utils/repository.mjs`)]),f=s(process.env,u(o)).root,p=f?r.resolve(f):d(a.options.cwd),m=n(i,process.env,process.cwd(),l(p).defaultMajorMode,c(p).defaultDomains);return this.runHarness({repoRoot:p,...m.options})}async shutdown(){this.ownsTelemetry&&await this.telemetry?.shutdown()}};async function a(e){let t=new i;try{return await t.run(e)}finally{await t.shutdown()}}async function o(e){let t=new i;try{return await t.runHarness(e)}finally{await t.shutdown()}}export{i as CliApp,a as runCli,o as runHarness};
2
2
  //# sourceMappingURL=cliApp.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cliApp.mjs","names":[],"sources":["../../src/cli/cliApp.ts"],"sourcesContent":["import path from 'node:path';\nimport {\n BaseCommand,\n CompatibilityCommand,\n EmitMcpCommand,\n ExplainCommand,\n InitCommand,\n LaunchCommand,\n SyncCommand,\n} from '../commands/index.ts';\nimport { readHarnessState } from '../config/index.ts';\nimport type { HarnessOptions } from '../interfaces/index.ts';\nimport { buildHarnessContext } from '../services/index.ts';\nimport {\n createHarnessTelemetry,\n HARNESS_EVENT,\n toFailureReporter,\n type HarnessTelemetry,\n} from '../logSinkTelemetry.ts';\nimport { findRepositoryRoot } from '../utils/index.ts';\nimport { HARNESS_VERSION, printHelp } from './help.ts';\nimport { parseHarnessArgs } from './options.ts';\n\n/**\n * Main CLI Application\n *\n * Owns command registration and dispatch. Preparation is shared: the context\n * is built once and handed to whichever command claims the run.\n */\nexport class CliApp {\n private readonly commands: BaseCommand[] = [];\n private readonly compatibilityCommand: CompatibilityCommand;\n private readonly initCommand: InitCommand;\n private readonly syncCommand: SyncCommand;\n private readonly telemetry: HarnessTelemetry;\n\n // Fields are declared and assigned explicitly rather than as constructor\n // parameter properties: the launcher scripts run this file straight from\n // source under Node's strip-only TypeScript mode, which rejects them.\n constructor(telemetry: HarnessTelemetry = createHarnessTelemetry()) {\n this.telemetry = telemetry;\n this.compatibilityCommand = new CompatibilityCommand(telemetry);\n this.initCommand = new InitCommand();\n this.syncCommand = new SyncCommand();\n this.initializeCommands();\n }\n\n /**\n * Initialize all available commands.\n *\n * Order matters. The first match wins and LaunchCommand matches everything,\n * so the diagnostic commands have to come before it.\n */\n private initializeCommands(): void {\n this.commands.push(new EmitMcpCommand());\n this.commands.push(new ExplainCommand());\n this.commands.push(new LaunchCommand());\n }\n\n /** Picks the command the parsed options select. */\n selectCommand(options: HarnessOptions): BaseCommand {\n const command = this.commands.find((candidate) => candidate.matches(options));\n if (!command) throw new Error('No command matched the given options');\n return command;\n }\n\n /**\n * Builds the context, runs the selected command, and always cleans up.\n *\n * The whole run is one span so the sink shows preparation and the child\n * process as a single timeline: a slow launch is almost always a slow stage\n * inside here, and that is only visible when the stages share a trace.\n */\n async runHarness(options: HarnessOptions): Promise<number> {\n return this.telemetry.runInSpan(\n 'doom_pi.run',\n {\n 'harness.major_mode': options.majorMode,\n 'harness.domain_count': options.domains.length,\n 'harness.agents': options.agents,\n 'harness.mcp': options.mcp,\n 'harness.hooks': options.hooks,\n ...(options.profile ? { 'harness.profile': options.profile } : {}),\n ...(options.preset ? { 'harness.preset': options.preset } : {}),\n },\n async () => {\n const context = await buildHarnessContext(options, this.telemetry);\n const command = this.selectCommand(context.options);\n try {\n // Selection uses the same resolved options used to build the context.\n return await command.execute(context, this.telemetry);\n } catch (error) {\n await this.telemetry.recordError(HARNESS_EVENT.cliFailed, error);\n throw error;\n } finally {\n await context.cleanup();\n }\n },\n );\n }\n\n /** Entry point for raw process arguments. */\n async run(args: string[]): Promise<number> {\n if (this.initCommand.matches(args)) return this.initCommand.execute(args);\n // Config management rather than a launch: it resolves the matrix and writes\n // it out for plain Pi, so it never builds a launch context of its own.\n if (this.syncCommand.matches(args)) return this.syncCommand.execute(args);\n if (this.compatibilityCommand.matches(args)) return this.compatibilityCommand.execute(args);\n\n const parsed = parseHarnessArgs(args);\n if (parsed.help) {\n printHelp();\n return 0;\n }\n if (parsed.version) {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n }\n // An inherited root wins, which is how a nested run stays pinned to the\n // outer repository rather than re-deriving one from its own cwd.\n const inheritedRoot = readHarnessState(process.env, toFailureReporter(this.telemetry)).root;\n const repoRoot = inheritedRoot ? path.resolve(inheritedRoot) : findRepositoryRoot(parsed.options.cwd);\n return this.runHarness({ repoRoot, ...parsed.options });\n }\n}\n\n/**\n * Convenience wrapper kept so the binary and tests need no CliApp knowledge.\n *\n * Telemetry is shut down here rather than inside runHarness, because this is\n * the only scope that owns the process: flushing earlier would drop the records\n * a later command still emits.\n */\nexport async function runCli(args: string[]): Promise<number> {\n const telemetry = createHarnessTelemetry();\n try {\n return await new CliApp(telemetry).run(args);\n } finally {\n await telemetry.shutdown();\n }\n}\n\n/** Runs an already-resolved option set, skipping argument parsing. */\nexport async function runHarness(options: HarnessOptions): Promise<number> {\n const telemetry = createHarnessTelemetry();\n try {\n return await new CliApp(telemetry).runHarness(options);\n } finally {\n await telemetry.shutdown();\n }\n}\n"],"mappings":"k6BA6BA,IAAa,EAAb,KAAoB,CAClB,SAA2C,EAAE,CAC7C,qBACA,YACA,YACA,UAKA,YAAY,EAA8B,GAAwB,CAAE,CAClE,KAAK,UAAY,EACjB,KAAK,qBAAuB,IAAI,EAAqB,EAAU,CAC/D,KAAK,YAAc,IAAI,EACvB,KAAK,YAAc,IAAI,EACvB,KAAK,oBAAoB,CAS3B,oBAAmC,CACjC,KAAK,SAAS,KAAK,IAAI,EAAiB,CACxC,KAAK,SAAS,KAAK,IAAI,EAAiB,CACxC,KAAK,SAAS,KAAK,IAAI,EAAgB,CAIzC,cAAc,EAAsC,CAClD,IAAM,EAAU,KAAK,SAAS,KAAM,GAAc,EAAU,QAAQ,EAAQ,CAAC,CAC7E,GAAI,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3D,eAAsB,EAAO,EAAiC,CAC5D,IAAM,EAAY,GAAwB,CAC1C,GAAI,CACF,OAAO,MAAM,IAAI,EAAO,EAAU,CAAC,IAAI,EAAK,QACpC,CACR,MAAM,EAAU,UAAU,EAK9B,eAAsB,EAAW,EAA0C,CACzE,IAAM,EAAY,GAAwB,CAC1C,GAAI,CACF,OAAO,MAAM,IAAI,EAAO,EAAU,CAAC,WAAW,EAAQ,QAC9C,CACR,MAAM,EAAU,UAAU"}
1
+ {"version":3,"file":"cliApp.mjs","names":[],"sources":["../../src/cli/cliApp.ts"],"sourcesContent":["import path from 'node:path';\nimport type { BaseCommand } from '../commands/baseCommand.ts';\nimport type { HarnessOptions } from '../interfaces/index.ts';\nimport type { HarnessTelemetry } from '../logSinkTelemetry.ts';\nimport { HARNESS_VERSION, printHelp } from './help.ts';\nimport { parseHarnessArgs } from './options.ts';\n\n/**\n * Main CLI Application\n *\n * Owns command registration and dispatch. Preparation is shared: the context\n * is built once and handed to whichever command claims the run.\n */\nexport class CliApp {\n private telemetry: HarnessTelemetry | undefined;\n private ownsTelemetry = false;\n\n // Fields are declared and assigned explicitly rather than as constructor\n // parameter properties: the launcher scripts run this file straight from\n // source under Node's strip-only TypeScript mode, which rejects them.\n constructor(telemetry?: HarnessTelemetry) {\n this.telemetry = telemetry;\n }\n\n /** Creates telemetry only for commands that actually report a run. */\n private async getTelemetry(): Promise<HarnessTelemetry> {\n if (this.telemetry) return this.telemetry;\n const { createHarnessTelemetry } = await import('../logSinkTelemetry.ts');\n // Telemetry's transport graph costs roughly one launcher budget slice by\n // itself. Startup callbacks and lifecycle events buffer until shutdown, so\n // transport initialization cannot compete with the Pi child for input.\n this.telemetry = createHarnessTelemetry({ deferSpans: true });\n this.ownsTelemetry = true;\n return this.telemetry;\n }\n\n /** Picks and imports only the command the parsed options select. */\n async selectCommand(options: HarnessOptions): Promise<BaseCommand> {\n if (options.emitMcp) {\n const { EmitMcpCommand } = await import('../commands/emitMcpCommand.ts');\n return new EmitMcpCommand();\n }\n if (options.explain) {\n const { ExplainCommand } = await import('../commands/explainCommand.ts');\n return new ExplainCommand();\n }\n const { LaunchCommand } = await import('../commands/launchCommand.ts');\n return new LaunchCommand();\n }\n\n /**\n * Builds the context, runs the selected command, and always cleans up.\n *\n * The whole run is one span so the sink shows preparation and the child\n * process as a single timeline: a slow launch is almost always a slow stage\n * inside here, and that is only visible when the stages share a trace.\n */\n async runHarness(options: HarnessOptions): Promise<number> {\n const telemetry = await this.getTelemetry();\n const [{ buildHarnessContext }, { HARNESS_EVENT }] = await Promise.all([\n import('../services/harnessContext.ts'),\n import('../logSinkTelemetry.ts'),\n ]);\n return telemetry.runInSpan(\n 'doom_pi.run',\n {\n 'harness.major_mode': options.majorMode,\n 'harness.domain_count': options.domains.length,\n 'harness.agents': options.agents,\n 'harness.mcp': options.mcp,\n 'harness.hooks': options.hooks,\n ...(options.profile ? { 'harness.profile': options.profile } : {}),\n ...(options.preset ? { 'harness.preset': options.preset } : {}),\n },\n async () => {\n const context = await buildHarnessContext(options, telemetry);\n const command = await this.selectCommand(context.options);\n try {\n // Selection uses the same resolved options used to build the context.\n return await command.execute(context, telemetry);\n } catch (error) {\n await telemetry.recordError(HARNESS_EVENT.cliFailed, error);\n throw error;\n } finally {\n await context.cleanup();\n }\n },\n );\n }\n\n /** Entry point for raw process arguments. */\n async run(args: string[]): Promise<number> {\n if (args[0] === 'init') {\n const { InitCommand } = await import('../commands/initCommand.ts');\n return new InitCommand().execute(args);\n }\n // Config management rather than a launch: it resolves the matrix and writes\n // it out for plain Pi, so it never builds a launch context of its own.\n if (args[0] === 'sync') {\n const { SyncCommand } = await import('../commands/syncCommand.ts');\n return new SyncCommand().execute(args);\n }\n if (args[0] === 'build') {\n const [{ BuildCommand }, telemetry] = await Promise.all([\n import('../commands/buildCommand.ts'),\n this.getTelemetry(),\n ]);\n return new BuildCommand(telemetry).execute(args);\n }\n if (args[0] === 'compat') {\n const [{ CompatibilityCommand }, telemetry] = await Promise.all([\n import('../commands/compatibilityCommand.ts'),\n this.getTelemetry(),\n ]);\n return new CompatibilityCommand(telemetry).execute(args);\n }\n\n // The first pass resolves --cwd without touching repository configuration,\n // which keeps help and version available even when modes.yaml is malformed.\n const initial = parseHarnessArgs(args);\n if (initial.help) {\n printHelp();\n return 0;\n }\n if (initial.version) {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n }\n // An inherited root wins, which is how a nested run stays pinned to the\n // outer repository rather than re-deriving one from its own cwd.\n const telemetry = await this.getTelemetry();\n const [\n { readHarnessState },\n { loadDomains },\n { loadMajorModesConfig },\n { toFailureReporter },\n { findRepositoryRoot },\n ] = await Promise.all([\n import('../config/harnessState.ts'),\n import('@agimon-ai/doompi-config/domains'),\n import('@agimon-ai/doompi-config/majorModes'),\n import('../logSinkTelemetry.ts'),\n import('../utils/repository.ts'),\n ]);\n const inheritedRoot = readHarnessState(process.env, toFailureReporter(telemetry)).root;\n const repoRoot = inheritedRoot ? path.resolve(inheritedRoot) : findRepositoryRoot(initial.options.cwd);\n const parsed = parseHarnessArgs(\n args,\n process.env,\n process.cwd(),\n loadMajorModesConfig(repoRoot).defaultMajorMode,\n loadDomains(repoRoot).defaultDomains,\n );\n return this.runHarness({ repoRoot, ...parsed.options });\n }\n\n /** Flushes telemetry if this application created it lazily. */\n async shutdown(): Promise<void> {\n if (this.ownsTelemetry) await this.telemetry?.shutdown();\n }\n}\n\n/**\n * Convenience wrapper kept so the binary and tests need no CliApp knowledge.\n *\n * Telemetry is shut down here rather than inside runHarness, because this is\n * the only scope that owns the process: flushing earlier would drop the records\n * a later command still emits.\n */\nexport async function runCli(args: string[]): Promise<number> {\n const app = new CliApp();\n try {\n return await app.run(args);\n } finally {\n await app.shutdown();\n }\n}\n\n/** Runs an already-resolved option set, skipping argument parsing. */\nexport async function runHarness(options: HarnessOptions): Promise<number> {\n const app = new CliApp();\n try {\n return await app.runHarness(options);\n } finally {\n await app.shutdown();\n }\n}\n"],"mappings":"sIAaA,IAAa,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CAC1B,KAAK,eAAe,MAAM,KAAK,WAAW,UAAU,GAW5D,eAAsB,EAAO,EAAiC,CAC5D,IAAM,EAAM,IAAI,EAChB,GAAI,CACF,OAAO,MAAM,EAAI,IAAI,EAAK,QAClB,CACR,MAAM,EAAI,UAAU,EAKxB,eAAsB,EAAW,EAA0C,CACzE,IAAM,EAAM,IAAI,EAChB,GAAI,CACF,OAAO,MAAM,EAAI,WAAW,EAAQ,QAC5B,CACR,MAAM,EAAI,UAAU"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./matrixOptions.cjs`),t=new Set([`antigravity`,`claude`,`codex`]);function n(e){if(!e||!t.has(e))throw Error(`compat requires one of: ${[...t].join(`, `)}`);return e}function r(t,n=process.env,r=process.cwd()){let i=e.resolveInheritedProfile(n),a=!1,o=e.resolveInheritedMajorMode(n),s=!1,c=[],l=[];for(let n=0;n<t.length;n+=1){let r=t[n];if(r===`--`){l.push(...t.slice(n+1));break}if(e.matchesOption(r,`--target`))throw Error(`${e.REMOVED_TARGET_OPTION} was replaced by ${e.MAJOR_MODE_OPTION}`);if(e.matchesOption(r,`--layer`))throw Error(`${e.REMOVED_LAYER_OPTION} was replaced by ${e.MAJOR_MODE_OPTION}`);if(e.matchesOption(r,`--layers`))throw Error(`${e.REMOVED_LAYERS_OPTION} was removed; select one major mode with ${e.MAJOR_MODE_OPTION}`);let u=e.readOption(t,n,e.MAJOR_MODE_OPTION);if(u){if(s)throw Error(`${e.MAJOR_MODE_OPTION} can only be provided once`);o=e.parseMajorMode(u.value,e.MAJOR_MODE_OPTION),s=!0,n=u.nextIndex;continue}let d=e.readOption(t,n,e.PROFILE_OPTION);if(d){if(a)throw Error(`${e.PROFILE_OPTION} can only be provided once`);i=e.parseProfileValue(d.value,e.PROFILE_OPTION),a=!0,n=d.nextIndex;continue}let f=e.readOption(t,n,`--domains`)??e.readOption(t,n,`--domain`);if(f){c.push(...e.parseRequiredCsv(f.value,e.matchesOption(r,`--domains`)?e.DOMAINS_OPTION:e.DOMAIN_OPTION)),n=f.nextIndex;continue}l.push(r)}return c.length===0&&c.push(...e.defaultDomainsForMajorMode(o,n)),{options:{currentDirectory:r,profile:i,domains:c,majorMode:o,providerArgs:l,additionalDirectories:[...new Set(e.resolveAdditionalDirectories(n,r))]}}}exports.parseCompatibilityArgs=r,exports.parseCompatibilityProvider=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./matrixOptions.cjs`),t=new Set([`antigravity`,`claude`,`codex`]);function n(e){if(!e||!t.has(e))throw Error(`compat requires one of: ${[...t].join(`, `)}`);return e}function r(t,n=process.env,r=process.cwd(),i,a){let o=e.resolveInheritedProfile(n),s=!1,c=e.resolveInheritedMajorMode(n,i),l=!1,u=[],d=[];for(let n=0;n<t.length;n+=1){let r=t[n];if(r===`--`){d.push(...t.slice(n+1));break}if(e.matchesOption(r,`--target`))throw Error(`${e.REMOVED_TARGET_OPTION} was replaced by ${e.MAJOR_MODE_OPTION}`);if(e.matchesOption(r,`--layer`))throw Error(`${e.REMOVED_LAYER_OPTION} was replaced by ${e.MAJOR_MODE_OPTION}`);if(e.matchesOption(r,`--layers`))throw Error(`${e.REMOVED_LAYERS_OPTION} was removed; select one major mode with ${e.MAJOR_MODE_OPTION}`);let i=e.readOption(t,n,e.MAJOR_MODE_OPTION);if(i){if(l)throw Error(`${e.MAJOR_MODE_OPTION} can only be provided once`);c=e.parseMajorMode(i.value,e.MAJOR_MODE_OPTION),l=!0,n=i.nextIndex;continue}let a=e.readOption(t,n,e.PROFILE_OPTION);if(a){if(s)throw Error(`${e.PROFILE_OPTION} can only be provided once`);o=e.parseProfileValue(a.value,e.PROFILE_OPTION),s=!0,n=a.nextIndex;continue}let f=e.readOption(t,n,`--domains`)??e.readOption(t,n,`--domain`);if(f){u.push(...e.parseRequiredCsv(f.value,e.matchesOption(r,`--domains`)?e.DOMAINS_OPTION:e.DOMAIN_OPTION)),n=f.nextIndex;continue}d.push(r)}return u.length===0&&u.push(...e.defaultDomainsForMajorMode(c,n,a)),{options:{currentDirectory:r,profile:o,domains:u,majorMode:c,providerArgs:d,additionalDirectories:[...new Set(e.resolveAdditionalDirectories(n,r))]}}}exports.parseCompatibilityArgs=r,exports.parseCompatibilityProvider=n;
2
2
  //# sourceMappingURL=compatibilityOptions.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"compatibilityOptions.cjs","names":["resolveInheritedProfile","resolveInheritedMajorMode","matchesOption","REMOVED_TARGET_OPTION","MAJOR_MODE_OPTION","REMOVED_LAYER_OPTION","REMOVED_LAYERS_OPTION","readOption","parseMajorMode","PROFILE_OPTION","parseProfileValue","parseRequiredCsv","DOMAINS_OPTION","DOMAIN_OPTION","defaultDomainsForMajorMode","resolveAdditionalDirectories"],"sources":["../../src/cli/compatibilityOptions.ts"],"sourcesContent":["import type { CompatibilityProvider, ParsedCompatibilityArgs } from '../interfaces/index.ts';\nimport {\n DOMAIN_OPTION,\n DOMAINS_OPTION,\n MAJOR_MODE_OPTION,\n PROFILE_OPTION,\n REMOVED_LAYER_OPTION,\n REMOVED_LAYERS_OPTION,\n REMOVED_TARGET_OPTION,\n defaultDomainsForMajorMode,\n matchesOption,\n parseMajorMode,\n parseProfileValue,\n parseRequiredCsv,\n readOption,\n resolveAdditionalDirectories,\n resolveInheritedMajorMode,\n resolveInheritedProfile,\n} from './matrixOptions.ts';\n\nconst COMPATIBILITY_PROVIDERS = new Set<CompatibilityProvider>(['antigravity', 'claude', 'codex']);\nconst PROVIDER_ARGUMENT_SEPARATOR = '--';\n\nexport function parseCompatibilityProvider(value: string | undefined): CompatibilityProvider {\n if (!value || !COMPATIBILITY_PROVIDERS.has(value as CompatibilityProvider)) {\n throw new Error(`compat requires one of: ${[...COMPATIBILITY_PROVIDERS].join(', ')}`);\n }\n return value as CompatibilityProvider;\n}\n\n/**\n * Parses only the matrix options shared by every frontend.\n *\n * Every other argument remains untouched for the selected provider. In\n * particular, Pi aliases such as --effort and --output-format are not rewritten.\n * Use -- to pass a provider-native --profile, --domain, or --major-mode option.\n */\nexport function parseCompatibilityArgs(\n args: string[],\n environment: NodeJS.ProcessEnv = process.env,\n currentDirectory = process.cwd(),\n): ParsedCompatibilityArgs {\n let profile = resolveInheritedProfile(environment);\n let profileProvided = false;\n let majorMode = resolveInheritedMajorMode(environment);\n let majorModeProvided = false;\n const domains: string[] = [];\n const providerArgs: string[] = [];\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index]!;\n if (arg === PROVIDER_ARGUMENT_SEPARATOR) {\n providerArgs.push(...args.slice(index + 1));\n break;\n }\n if (matchesOption(arg, REMOVED_TARGET_OPTION)) {\n throw new Error(`${REMOVED_TARGET_OPTION} was replaced by ${MAJOR_MODE_OPTION}`);\n }\n if (matchesOption(arg, REMOVED_LAYER_OPTION)) {\n throw new Error(`${REMOVED_LAYER_OPTION} was replaced by ${MAJOR_MODE_OPTION}`);\n }\n if (matchesOption(arg, REMOVED_LAYERS_OPTION)) {\n throw new Error(`${REMOVED_LAYERS_OPTION} was removed; select one major mode with ${MAJOR_MODE_OPTION}`);\n }\n\n const majorModeMatch = readOption(args, index, MAJOR_MODE_OPTION);\n if (majorModeMatch) {\n if (majorModeProvided) throw new Error(`${MAJOR_MODE_OPTION} can only be provided once`);\n majorMode = parseMajorMode(majorModeMatch.value, MAJOR_MODE_OPTION);\n majorModeProvided = true;\n index = majorModeMatch.nextIndex;\n continue;\n }\n\n const profileMatch = readOption(args, index, PROFILE_OPTION);\n if (profileMatch) {\n if (profileProvided) throw new Error(`${PROFILE_OPTION} can only be provided once`);\n profile = parseProfileValue(profileMatch.value, PROFILE_OPTION);\n profileProvided = true;\n index = profileMatch.nextIndex;\n continue;\n }\n\n const domainMatch = readOption(args, index, DOMAINS_OPTION) ?? readOption(args, index, DOMAIN_OPTION);\n if (domainMatch) {\n domains.push(\n ...parseRequiredCsv(domainMatch.value, matchesOption(arg, DOMAINS_OPTION) ? DOMAINS_OPTION : DOMAIN_OPTION),\n );\n index = domainMatch.nextIndex;\n continue;\n }\n\n providerArgs.push(arg);\n }\n\n if (domains.length === 0) domains.push(...defaultDomainsForMajorMode(majorMode, environment));\n\n return {\n options: {\n currentDirectory,\n profile,\n domains,\n majorMode,\n providerArgs,\n additionalDirectories: [...new Set(resolveAdditionalDirectories(environment, currentDirectory))],\n },\n };\n}\n"],"mappings":"0GAoBM,EAA0B,IAAI,IAA2B,CAAC,cAAe,SAAU,QAAQ,CAAC,CAGlG,SAAgB,EAA2B,EAAkD,CAC3F,GAAI,CAAC,GAAS,CAAC,EAAwB,IAAI,EAA+B,CACxE,MAAU,MAAM,2BAA2B,CAAC,GAAG,EAAwB,CAAC,KAAK,KAAK,GAAG,CAEvF,OAAO,EAUT,SAAgB,EACd,EACA,EAAiC,QAAQ,IACzC,EAAmB,QAAQ,KAAK,CACP,CACzB,IAAI,EAAUA,EAAAA,wBAAwB,EAAY,CAC9C,EAAkB,GAClB,EAAYC,EAAAA,0BAA0B,EAAY,CAClD,EAAoB,GAClB,EAAoB,EAAE,CACtB,EAAyB,EAAE,CAEjC,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAK,OAAQ,GAAS,EAAG,CACnD,IAAM,EAAM,EAAK,GACjB,GAAI,IAAQ,KAA6B,CACvC,EAAa,KAAK,GAAG,EAAK,MAAM,EAAQ,EAAE,CAAC,CAC3C,MAEF,GAAIC,EAAAA,cAAc,EAAA,WAA2B,CAC3C,MAAU,MAAM,GAAGC,EAAAA,sBAAsB,mBAAmBC,EAAAA,oBAAoB,CAElF,GAAIF,EAAAA,cAAc,EAAA,UAA0B,CAC1C,MAAU,MAAM,GAAGG,EAAAA,qBAAqB,mBAAmBD,EAAAA,oBAAoB,CAEjF,GAAIF,EAAAA,cAAc,EAAA,WAA2B,CAC3C,MAAU,MAAM,GAAGI,EAAAA,sBAAsB,2CAA2CF,EAAAA,oBAAoB,CAG1G,IAAM,EAAiBG,EAAAA,WAAW,EAAM,EAAOH,EAAAA,kBAAkB,CACjE,GAAI,EAAgB,CAClB,GAAI,EAAmB,MAAU,MAAM,GAAGA,EAAAA,kBAAkB,4BAA4B,CACxF,EAAYI,EAAAA,eAAe,EAAe,MAAOJ,EAAAA,kBAAkB,CACnE,EAAoB,GACpB,EAAQ,EAAe,UACvB,SAGF,IAAM,EAAeG,EAAAA,WAAW,EAAM,EAAOE,EAAAA,eAAe,CAC5D,GAAI,EAAc,CAChB,GAAI,EAAiB,MAAU,MAAM,GAAGA,EAAAA,eAAe,4BAA4B,CACnF,EAAUC,EAAAA,kBAAkB,EAAa,MAAOD,EAAAA,eAAe,CAC/D,EAAkB,GAClB,EAAQ,EAAa,UACrB,SAGF,IAAM,EAAcF,EAAAA,WAAW,EAAM,EAAA,YAAsB,EAAIA,EAAAA,WAAW,EAAM,EAAA,WAAqB,CACrG,GAAI,EAAa,CACf,EAAQ,KACN,GAAGI,EAAAA,iBAAiB,EAAY,MAAOT,EAAAA,cAAc,EAAA,YAAoB,CAAGU,EAAAA,eAAiBC,EAAAA,cAAc,CAC5G,CACD,EAAQ,EAAY,UACpB,SAGF,EAAa,KAAK,EAAI,CAKxB,OAFI,EAAQ,SAAW,GAAG,EAAQ,KAAK,GAAGC,EAAAA,2BAA2B,EAAW,EAAY,CAAC,CAEtF,CACL,QAAS,CACP,mBACA,UACA,UACA,YACA,eACA,sBAAuB,CAAC,GAAG,IAAI,IAAIC,EAAAA,6BAA6B,EAAa,EAAiB,CAAC,CAAC,CACjG,CACF"}
1
+ {"version":3,"file":"compatibilityOptions.cjs","names":["resolveInheritedProfile","resolveInheritedMajorMode","matchesOption","REMOVED_TARGET_OPTION","MAJOR_MODE_OPTION","REMOVED_LAYER_OPTION","REMOVED_LAYERS_OPTION","readOption","parseMajorMode","PROFILE_OPTION","parseProfileValue","parseRequiredCsv","DOMAINS_OPTION","DOMAIN_OPTION","defaultDomainsForMajorMode","resolveAdditionalDirectories"],"sources":["../../src/cli/compatibilityOptions.ts"],"sourcesContent":["import type { CompatibilityProvider, ParsedCompatibilityArgs } from '../interfaces/index.ts';\nimport {\n DOMAIN_OPTION,\n DOMAINS_OPTION,\n defaultDomainsForMajorMode,\n MAJOR_MODE_OPTION,\n matchesOption,\n PROFILE_OPTION,\n parseMajorMode,\n parseProfileValue,\n parseRequiredCsv,\n REMOVED_LAYER_OPTION,\n REMOVED_LAYERS_OPTION,\n REMOVED_TARGET_OPTION,\n readOption,\n resolveAdditionalDirectories,\n resolveInheritedMajorMode,\n resolveInheritedProfile,\n} from './matrixOptions.ts';\n\nconst COMPATIBILITY_PROVIDERS = new Set<CompatibilityProvider>(['antigravity', 'claude', 'codex']);\nconst PROVIDER_ARGUMENT_SEPARATOR = '--';\n\nexport function parseCompatibilityProvider(value: string | undefined): CompatibilityProvider {\n if (!value || !COMPATIBILITY_PROVIDERS.has(value as CompatibilityProvider)) {\n throw new Error(`compat requires one of: ${[...COMPATIBILITY_PROVIDERS].join(', ')}`);\n }\n return value as CompatibilityProvider;\n}\n\n/**\n * Parses only the matrix options shared by every frontend.\n *\n * Every other argument remains untouched for the selected provider. In\n * particular, Pi aliases such as --effort and --output-format are not rewritten.\n * Use -- to pass a provider-native --profile, --domain, or --major-mode option.\n */\nexport function parseCompatibilityArgs(\n args: string[],\n environment: NodeJS.ProcessEnv = process.env,\n currentDirectory = process.cwd(),\n defaultMajorMode?: string,\n defaultDomains?: readonly string[],\n): ParsedCompatibilityArgs {\n let profile = resolveInheritedProfile(environment);\n let profileProvided = false;\n let majorMode = resolveInheritedMajorMode(environment, defaultMajorMode);\n let majorModeProvided = false;\n const domains: string[] = [];\n const providerArgs: string[] = [];\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index]!;\n if (arg === PROVIDER_ARGUMENT_SEPARATOR) {\n providerArgs.push(...args.slice(index + 1));\n break;\n }\n if (matchesOption(arg, REMOVED_TARGET_OPTION)) {\n throw new Error(`${REMOVED_TARGET_OPTION} was replaced by ${MAJOR_MODE_OPTION}`);\n }\n if (matchesOption(arg, REMOVED_LAYER_OPTION)) {\n throw new Error(`${REMOVED_LAYER_OPTION} was replaced by ${MAJOR_MODE_OPTION}`);\n }\n if (matchesOption(arg, REMOVED_LAYERS_OPTION)) {\n throw new Error(`${REMOVED_LAYERS_OPTION} was removed; select one major mode with ${MAJOR_MODE_OPTION}`);\n }\n\n const majorModeMatch = readOption(args, index, MAJOR_MODE_OPTION);\n if (majorModeMatch) {\n if (majorModeProvided) throw new Error(`${MAJOR_MODE_OPTION} can only be provided once`);\n majorMode = parseMajorMode(majorModeMatch.value, MAJOR_MODE_OPTION);\n majorModeProvided = true;\n index = majorModeMatch.nextIndex;\n continue;\n }\n\n const profileMatch = readOption(args, index, PROFILE_OPTION);\n if (profileMatch) {\n if (profileProvided) throw new Error(`${PROFILE_OPTION} can only be provided once`);\n profile = parseProfileValue(profileMatch.value, PROFILE_OPTION);\n profileProvided = true;\n index = profileMatch.nextIndex;\n continue;\n }\n\n const domainMatch = readOption(args, index, DOMAINS_OPTION) ?? readOption(args, index, DOMAIN_OPTION);\n if (domainMatch) {\n domains.push(\n ...parseRequiredCsv(domainMatch.value, matchesOption(arg, DOMAINS_OPTION) ? DOMAINS_OPTION : DOMAIN_OPTION),\n );\n index = domainMatch.nextIndex;\n continue;\n }\n\n providerArgs.push(arg);\n }\n\n if (domains.length === 0) domains.push(...defaultDomainsForMajorMode(majorMode, environment, defaultDomains));\n\n return {\n options: {\n currentDirectory,\n profile,\n domains,\n majorMode,\n providerArgs,\n additionalDirectories: [...new Set(resolveAdditionalDirectories(environment, currentDirectory))],\n },\n };\n}\n"],"mappings":"0GAoBM,EAA0B,IAAI,IAA2B,CAAC,cAAe,SAAU,QAAQ,CAAC,CAGlG,SAAgB,EAA2B,EAAkD,CAC3F,GAAI,CAAC,GAAS,CAAC,EAAwB,IAAI,EAA+B,CACxE,MAAU,MAAM,2BAA2B,CAAC,GAAG,EAAwB,CAAC,KAAK,KAAK,GAAG,CAEvF,OAAO,EAUT,SAAgB,EACd,EACA,EAAiC,QAAQ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AA,WAAW,EAAM,EAAA,WAAqB,CACrG,GAAI,EAAa,CACf,EAAQ,KACN,GAAGI,EAAAA,iBAAiB,EAAY,MAAOT,EAAAA,cAAc,EAAA,YAAoB,CAAGU,EAAAA,eAAiBC,EAAAA,cAAc,CAC5G,CACD,EAAQ,EAAY,UACpB,SAGF,EAAa,KAAK,EAAI,CAKxB,OAFI,EAAQ,SAAW,GAAG,EAAQ,KAAK,GAAGC,EAAAA,2BAA2B,EAAW,EAAa,EAAe,CAAC,CAEtG,CACL,QAAS,CACP,mBACA,UACA,UACA,YACA,eACA,sBAAuB,CAAC,GAAG,IAAI,IAAIC,EAAAA,6BAA6B,EAAa,EAAiB,CAAC,CAAC,CACjG,CACF"}
@@ -9,7 +9,7 @@ declare function parseCompatibilityProvider(value: string | undefined): Compatib
9
9
  * particular, Pi aliases such as --effort and --output-format are not rewritten.
10
10
  * Use -- to pass a provider-native --profile, --domain, or --major-mode option.
11
11
  */
12
- declare function parseCompatibilityArgs(args: string[], environment?: NodeJS.ProcessEnv, currentDirectory?: string): ParsedCompatibilityArgs;
12
+ declare function parseCompatibilityArgs(args: string[], environment?: NodeJS.ProcessEnv, currentDirectory?: string, defaultMajorMode?: string, defaultDomains?: readonly string[]): ParsedCompatibilityArgs;
13
13
  //#endregion
14
14
  export { parseCompatibilityArgs, parseCompatibilityProvider };
15
15
  //# sourceMappingURL=compatibilityOptions.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compatibilityOptions.d.cts","names":[],"sources":["../../src/cli/compatibilityOptions.ts"],"mappings":";;;iBAuBgB,0BAAA,CAA2B,KAAA,uBAA4B,qBAAA;;AAAvE;;;;;AAcA;iBAAgB,sBAAA,CACd,IAAA,YACA,WAAA,GAAa,MAAA,CAAO,UAAA,EACpB,gBAAA,YACC,uBAAA"}
1
+ {"version":3,"file":"compatibilityOptions.d.cts","names":[],"sources":["../../src/cli/compatibilityOptions.ts"],"mappings":";;;iBAuBgB,0BAAA,CAA2B,KAAA,uBAA4B,qBAAA;;AAAvE;;;;;AAcA;iBAAgB,sBAAA,CACd,IAAA,YACA,WAAA,GAAa,MAAA,CAAO,UAAA,EACpB,gBAAA,WACA,gBAAA,WACA,cAAA,uBACC,uBAAA"}
@@ -9,7 +9,7 @@ declare function parseCompatibilityProvider(value: string | undefined): Compatib
9
9
  * particular, Pi aliases such as --effort and --output-format are not rewritten.
10
10
  * Use -- to pass a provider-native --profile, --domain, or --major-mode option.
11
11
  */
12
- declare function parseCompatibilityArgs(args: string[], environment?: NodeJS.ProcessEnv, currentDirectory?: string): ParsedCompatibilityArgs;
12
+ declare function parseCompatibilityArgs(args: string[], environment?: NodeJS.ProcessEnv, currentDirectory?: string, defaultMajorMode?: string, defaultDomains?: readonly string[]): ParsedCompatibilityArgs;
13
13
  //#endregion
14
14
  export { parseCompatibilityArgs, parseCompatibilityProvider };
15
15
  //# sourceMappingURL=compatibilityOptions.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compatibilityOptions.d.mts","names":[],"sources":["../../src/cli/compatibilityOptions.ts"],"mappings":";;;iBAuBgB,0BAAA,CAA2B,KAAA,uBAA4B,qBAAA;;AAAvE;;;;;AAcA;iBAAgB,sBAAA,CACd,IAAA,YACA,WAAA,GAAa,MAAA,CAAO,UAAA,EACpB,gBAAA,YACC,uBAAA"}
1
+ {"version":3,"file":"compatibilityOptions.d.mts","names":[],"sources":["../../src/cli/compatibilityOptions.ts"],"mappings":";;;iBAuBgB,0BAAA,CAA2B,KAAA,uBAA4B,qBAAA;;AAAvE;;;;;AAcA;iBAAgB,sBAAA,CACd,IAAA,YACA,WAAA,GAAa,MAAA,CAAO,UAAA,EACpB,gBAAA,WACA,gBAAA,WACA,cAAA,uBACC,uBAAA"}
@@ -1,2 +1,2 @@
1
- import{DOMAINS_OPTION as e,DOMAIN_OPTION as t,MAJOR_MODE_OPTION as n,PROFILE_OPTION as r,REMOVED_LAYERS_OPTION as i,REMOVED_LAYER_OPTION as a,REMOVED_TARGET_OPTION as o,defaultDomainsForMajorMode as s,matchesOption as c,parseMajorMode as l,parseProfileValue as u,parseRequiredCsv as d,readOption as f,resolveAdditionalDirectories as p,resolveInheritedMajorMode as m,resolveInheritedProfile as h}from"./matrixOptions.mjs";const g=new Set([`antigravity`,`claude`,`codex`]);function _(e){if(!e||!g.has(e))throw Error(`compat requires one of: ${[...g].join(`, `)}`);return e}function v(g,_=process.env,v=process.cwd()){let y=h(_),b=!1,x=m(_),S=!1,C=[],w=[];for(let s=0;s<g.length;s+=1){let p=g[s];if(p===`--`){w.push(...g.slice(s+1));break}if(c(p,`--target`))throw Error(`${o} was replaced by ${n}`);if(c(p,`--layer`))throw Error(`${a} was replaced by ${n}`);if(c(p,`--layers`))throw Error(`${i} was removed; select one major mode with ${n}`);let m=f(g,s,n);if(m){if(S)throw Error(`${n} can only be provided once`);x=l(m.value,n),S=!0,s=m.nextIndex;continue}let h=f(g,s,r);if(h){if(b)throw Error(`${r} can only be provided once`);y=u(h.value,r),b=!0,s=h.nextIndex;continue}let _=f(g,s,`--domains`)??f(g,s,`--domain`);if(_){C.push(...d(_.value,c(p,`--domains`)?e:t)),s=_.nextIndex;continue}w.push(p)}return C.length===0&&C.push(...s(x,_)),{options:{currentDirectory:v,profile:y,domains:C,majorMode:x,providerArgs:w,additionalDirectories:[...new Set(p(_,v))]}}}export{v as parseCompatibilityArgs,_ as parseCompatibilityProvider};
1
+ import{DOMAINS_OPTION as e,DOMAIN_OPTION as t,MAJOR_MODE_OPTION as n,PROFILE_OPTION as r,REMOVED_LAYERS_OPTION as i,REMOVED_LAYER_OPTION as a,REMOVED_TARGET_OPTION as o,defaultDomainsForMajorMode as s,matchesOption as c,parseMajorMode as l,parseProfileValue as u,parseRequiredCsv as d,readOption as f,resolveAdditionalDirectories as p,resolveInheritedMajorMode as m,resolveInheritedProfile as h}from"./matrixOptions.mjs";const g=new Set([`antigravity`,`claude`,`codex`]);function _(e){if(!e||!g.has(e))throw Error(`compat requires one of: ${[...g].join(`, `)}`);return e}function v(g,_=process.env,v=process.cwd(),y,b){let x=h(_),S=!1,C=m(_,y),w=!1,T=[],E=[];for(let s=0;s<g.length;s+=1){let p=g[s];if(p===`--`){E.push(...g.slice(s+1));break}if(c(p,`--target`))throw Error(`${o} was replaced by ${n}`);if(c(p,`--layer`))throw Error(`${a} was replaced by ${n}`);if(c(p,`--layers`))throw Error(`${i} was removed; select one major mode with ${n}`);let m=f(g,s,n);if(m){if(w)throw Error(`${n} can only be provided once`);C=l(m.value,n),w=!0,s=m.nextIndex;continue}let h=f(g,s,r);if(h){if(S)throw Error(`${r} can only be provided once`);x=u(h.value,r),S=!0,s=h.nextIndex;continue}let _=f(g,s,`--domains`)??f(g,s,`--domain`);if(_){T.push(...d(_.value,c(p,`--domains`)?e:t)),s=_.nextIndex;continue}E.push(p)}return T.length===0&&T.push(...s(C,_,b)),{options:{currentDirectory:v,profile:x,domains:T,majorMode:C,providerArgs:E,additionalDirectories:[...new Set(p(_,v))]}}}export{v as parseCompatibilityArgs,_ as parseCompatibilityProvider};
2
2
  //# sourceMappingURL=compatibilityOptions.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"compatibilityOptions.mjs","names":[],"sources":["../../src/cli/compatibilityOptions.ts"],"sourcesContent":["import type { CompatibilityProvider, ParsedCompatibilityArgs } from '../interfaces/index.ts';\nimport {\n DOMAIN_OPTION,\n DOMAINS_OPTION,\n MAJOR_MODE_OPTION,\n PROFILE_OPTION,\n REMOVED_LAYER_OPTION,\n REMOVED_LAYERS_OPTION,\n REMOVED_TARGET_OPTION,\n defaultDomainsForMajorMode,\n matchesOption,\n parseMajorMode,\n parseProfileValue,\n parseRequiredCsv,\n readOption,\n resolveAdditionalDirectories,\n resolveInheritedMajorMode,\n resolveInheritedProfile,\n} from './matrixOptions.ts';\n\nconst COMPATIBILITY_PROVIDERS = new Set<CompatibilityProvider>(['antigravity', 'claude', 'codex']);\nconst PROVIDER_ARGUMENT_SEPARATOR = '--';\n\nexport function parseCompatibilityProvider(value: string | undefined): CompatibilityProvider {\n if (!value || !COMPATIBILITY_PROVIDERS.has(value as CompatibilityProvider)) {\n throw new Error(`compat requires one of: ${[...COMPATIBILITY_PROVIDERS].join(', ')}`);\n }\n return value as CompatibilityProvider;\n}\n\n/**\n * Parses only the matrix options shared by every frontend.\n *\n * Every other argument remains untouched for the selected provider. In\n * particular, Pi aliases such as --effort and --output-format are not rewritten.\n * Use -- to pass a provider-native --profile, --domain, or --major-mode option.\n */\nexport function parseCompatibilityArgs(\n args: string[],\n environment: NodeJS.ProcessEnv = process.env,\n currentDirectory = process.cwd(),\n): ParsedCompatibilityArgs {\n let profile = resolveInheritedProfile(environment);\n let profileProvided = false;\n let majorMode = resolveInheritedMajorMode(environment);\n let majorModeProvided = false;\n const domains: string[] = [];\n const providerArgs: string[] = [];\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index]!;\n if (arg === PROVIDER_ARGUMENT_SEPARATOR) {\n providerArgs.push(...args.slice(index + 1));\n break;\n }\n if (matchesOption(arg, REMOVED_TARGET_OPTION)) {\n throw new Error(`${REMOVED_TARGET_OPTION} was replaced by ${MAJOR_MODE_OPTION}`);\n }\n if (matchesOption(arg, REMOVED_LAYER_OPTION)) {\n throw new Error(`${REMOVED_LAYER_OPTION} was replaced by ${MAJOR_MODE_OPTION}`);\n }\n if (matchesOption(arg, REMOVED_LAYERS_OPTION)) {\n throw new Error(`${REMOVED_LAYERS_OPTION} was removed; select one major mode with ${MAJOR_MODE_OPTION}`);\n }\n\n const majorModeMatch = readOption(args, index, MAJOR_MODE_OPTION);\n if (majorModeMatch) {\n if (majorModeProvided) throw new Error(`${MAJOR_MODE_OPTION} can only be provided once`);\n majorMode = parseMajorMode(majorModeMatch.value, MAJOR_MODE_OPTION);\n majorModeProvided = true;\n index = majorModeMatch.nextIndex;\n continue;\n }\n\n const profileMatch = readOption(args, index, PROFILE_OPTION);\n if (profileMatch) {\n if (profileProvided) throw new Error(`${PROFILE_OPTION} can only be provided once`);\n profile = parseProfileValue(profileMatch.value, PROFILE_OPTION);\n profileProvided = true;\n index = profileMatch.nextIndex;\n continue;\n }\n\n const domainMatch = readOption(args, index, DOMAINS_OPTION) ?? readOption(args, index, DOMAIN_OPTION);\n if (domainMatch) {\n domains.push(\n ...parseRequiredCsv(domainMatch.value, matchesOption(arg, DOMAINS_OPTION) ? DOMAINS_OPTION : DOMAIN_OPTION),\n );\n index = domainMatch.nextIndex;\n continue;\n }\n\n providerArgs.push(arg);\n }\n\n if (domains.length === 0) domains.push(...defaultDomainsForMajorMode(majorMode, environment));\n\n return {\n options: {\n currentDirectory,\n profile,\n domains,\n majorMode,\n providerArgs,\n additionalDirectories: [...new Set(resolveAdditionalDirectories(environment, currentDirectory))],\n },\n };\n}\n"],"mappings":"qaAoBA,MAAM,EAA0B,IAAI,IAA2B,CAAC,cAAe,SAAU,QAAQ,CAAC,CAGlG,SAAgB,EAA2B,EAAkD,CAC3F,GAAI,CAAC,GAAS,CAAC,EAAwB,IAAI,EAA+B,CACxE,MAAU,MAAM,2BAA2B,CAAC,GAAG,EAAwB,CAAC,KAAK,KAAK,GAAG,CAEvF,OAAO,EAUT,SAAgB,EACd,EACA,EAAiC,QAAQ,IACzC,EAAmB,QAAQ,KAAK,CACP,CACzB,IAAI,EAAU,EAAwB,EAAY,CAC9C,EAAkB,GAClB,EAAY,EAA0B,EAAY,CAClD,EAAoB,GAClB,EAAoB,EAAE,CACtB,EAAyB,EAAE,CAEjC,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAK,OAAQ,GAAS,EAAG,CACnD,IAAM,EAAM,EAAK,GACjB,GAAI,IAAQ,KAA6B,CACvC,EAAa,KAAK,GAAG,EAAK,MAAM,EAAQ,EAAE,CAAC,CAC3C,MAEF,GAAI,EAAc,EAAA,WAA2B,CAC3C,MAAU,MAAM,GAAG,EAAsB,mBAAmB,IAAoB,CAElF,GAAI,EAAc,EAAA,UAA0B,CAC1C,MAAU,MAAM,GAAG,EAAqB,mBAAmB,IAAoB,CAEjF,GAAI,EAAc,EAAA,WAA2B,CAC3C,MAAU,MAAM,GAAG,EAAsB,2CAA2C,IAAoB,CAG1G,IAAM,EAAiB,EAAW,EAAM,EAAO,EAAkB,CACjE,GAAI,EAAgB,CAClB,GAAI,EAAmB,MAAU,MAAM,GAAG,EAAkB,4BAA4B,CACxF,EAAY,EAAe,EAAe,MAAO,EAAkB,CACnE,EAAoB,GACpB,EAAQ,EAAe,UACvB,SAGF,IAAM,EAAe,EAAW,EAAM,EAAO,EAAe,CAC5D,GAAI,EAAc,CAChB,GAAI,EAAiB,MAAU,MAAM,GAAG,EAAe,4BAA4B,CACnF,EAAU,EAAkB,EAAa,MAAO,EAAe,CAC/D,EAAkB,GAClB,EAAQ,EAAa,UACrB,SAGF,IAAM,EAAc,EAAW,EAAM,EAAA,YAAsB,EAAI,EAAW,EAAM,EAAA,WAAqB,CACrG,GAAI,EAAa,CACf,EAAQ,KACN,GAAG,EAAiB,EAAY,MAAO,EAAc,EAAA,YAAoB,CAAG,EAAiB,EAAc,CAC5G,CACD,EAAQ,EAAY,UACpB,SAGF,EAAa,KAAK,EAAI,CAKxB,OAFI,EAAQ,SAAW,GAAG,EAAQ,KAAK,GAAG,EAA2B,EAAW,EAAY,CAAC,CAEtF,CACL,QAAS,CACP,mBACA,UACA,UACA,YACA,eACA,sBAAuB,CAAC,GAAG,IAAI,IAAI,EAA6B,EAAa,EAAiB,CAAC,CAAC,CACjG,CACF"}
1
+ {"version":3,"file":"compatibilityOptions.mjs","names":[],"sources":["../../src/cli/compatibilityOptions.ts"],"sourcesContent":["import type { CompatibilityProvider, ParsedCompatibilityArgs } from '../interfaces/index.ts';\nimport {\n DOMAIN_OPTION,\n DOMAINS_OPTION,\n defaultDomainsForMajorMode,\n MAJOR_MODE_OPTION,\n matchesOption,\n PROFILE_OPTION,\n parseMajorMode,\n parseProfileValue,\n parseRequiredCsv,\n REMOVED_LAYER_OPTION,\n REMOVED_LAYERS_OPTION,\n REMOVED_TARGET_OPTION,\n readOption,\n resolveAdditionalDirectories,\n resolveInheritedMajorMode,\n resolveInheritedProfile,\n} from './matrixOptions.ts';\n\nconst COMPATIBILITY_PROVIDERS = new Set<CompatibilityProvider>(['antigravity', 'claude', 'codex']);\nconst PROVIDER_ARGUMENT_SEPARATOR = '--';\n\nexport function parseCompatibilityProvider(value: string | undefined): CompatibilityProvider {\n if (!value || !COMPATIBILITY_PROVIDERS.has(value as CompatibilityProvider)) {\n throw new Error(`compat requires one of: ${[...COMPATIBILITY_PROVIDERS].join(', ')}`);\n }\n return value as CompatibilityProvider;\n}\n\n/**\n * Parses only the matrix options shared by every frontend.\n *\n * Every other argument remains untouched for the selected provider. In\n * particular, Pi aliases such as --effort and --output-format are not rewritten.\n * Use -- to pass a provider-native --profile, --domain, or --major-mode option.\n */\nexport function parseCompatibilityArgs(\n args: string[],\n environment: NodeJS.ProcessEnv = process.env,\n currentDirectory = process.cwd(),\n defaultMajorMode?: string,\n defaultDomains?: readonly string[],\n): ParsedCompatibilityArgs {\n let profile = resolveInheritedProfile(environment);\n let profileProvided = false;\n let majorMode = resolveInheritedMajorMode(environment, defaultMajorMode);\n let majorModeProvided = false;\n const domains: string[] = [];\n const providerArgs: string[] = [];\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index]!;\n if (arg === PROVIDER_ARGUMENT_SEPARATOR) {\n providerArgs.push(...args.slice(index + 1));\n break;\n }\n if (matchesOption(arg, REMOVED_TARGET_OPTION)) {\n throw new Error(`${REMOVED_TARGET_OPTION} was replaced by ${MAJOR_MODE_OPTION}`);\n }\n if (matchesOption(arg, REMOVED_LAYER_OPTION)) {\n throw new Error(`${REMOVED_LAYER_OPTION} was replaced by ${MAJOR_MODE_OPTION}`);\n }\n if (matchesOption(arg, REMOVED_LAYERS_OPTION)) {\n throw new Error(`${REMOVED_LAYERS_OPTION} was removed; select one major mode with ${MAJOR_MODE_OPTION}`);\n }\n\n const majorModeMatch = readOption(args, index, MAJOR_MODE_OPTION);\n if (majorModeMatch) {\n if (majorModeProvided) throw new Error(`${MAJOR_MODE_OPTION} can only be provided once`);\n majorMode = parseMajorMode(majorModeMatch.value, MAJOR_MODE_OPTION);\n majorModeProvided = true;\n index = majorModeMatch.nextIndex;\n continue;\n }\n\n const profileMatch = readOption(args, index, PROFILE_OPTION);\n if (profileMatch) {\n if (profileProvided) throw new Error(`${PROFILE_OPTION} can only be provided once`);\n profile = parseProfileValue(profileMatch.value, PROFILE_OPTION);\n profileProvided = true;\n index = profileMatch.nextIndex;\n continue;\n }\n\n const domainMatch = readOption(args, index, DOMAINS_OPTION) ?? readOption(args, index, DOMAIN_OPTION);\n if (domainMatch) {\n domains.push(\n ...parseRequiredCsv(domainMatch.value, matchesOption(arg, DOMAINS_OPTION) ? DOMAINS_OPTION : DOMAIN_OPTION),\n );\n index = domainMatch.nextIndex;\n continue;\n }\n\n providerArgs.push(arg);\n }\n\n if (domains.length === 0) domains.push(...defaultDomainsForMajorMode(majorMode, environment, defaultDomains));\n\n return {\n options: {\n currentDirectory,\n profile,\n domains,\n majorMode,\n providerArgs,\n additionalDirectories: [...new Set(resolveAdditionalDirectories(environment, currentDirectory))],\n },\n };\n}\n"],"mappings":"qaAoBA,MAAM,EAA0B,IAAI,IAA2B,CAAC,cAAe,SAAU,QAAQ,CAAC,CAGlG,SAAgB,EAA2B,EAAkD,CAC3F,GAAI,CAAC,GAAS,CAAC,EAAwB,IAAI,EAA+B,CACxE,MAAU,MAAM,2BAA2B,CAAC,GAAG,EAAwB,CAAC,KAAK,KAAK,GAAG,CAEvF,OAAO,EAUT,SAAgB,EACd,EACA,EAAiC,QAAQ,IACzC,EAAmB,QAAQ,KAAK,CAChC,EACA,EACyB,CACzB,IAAI,EAAU,EAAwB,EAAY,CAC9C,EAAkB,GAClB,EAAY,EAA0B,EAAa,EAAiB,CACpE,EAAoB,GAClB,EAAoB,EAAE,CACtB,EAAyB,EAAE,CAEjC,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAK,OAAQ,GAAS,EAAG,CACnD,IA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Tag,{value:`Module`}),require(`../_
3
3
  Usage: doompi [harness options] [Pi options] [prompt]
4
4
  doompi init
5
5
  doompi sync [matrix options] [--check]
6
+ doompi build [matrix options]
6
7
  doompi compat <codex|claude|antigravity> [matrix options] [provider arguments]
7
8
 
8
9
  Initialization:
9
10
  doompi init Fill missing files in ~/.pi/.doom
10
11
  doompi sync Resolve the matrix into .pi so plain pi can load it
11
12
  doompi sync --check Exit non-zero when the synced config is out of date
13
+ doompi build Prebuild startup caches without launching Pi
12
14
 
13
15
  After a sync, run pi directly. The synced session accepts --major-mode,
14
16
  --domains, --profile, and --mute, and /major-mode, /domains, and /profile switch
@@ -1 +1 @@
1
- {"version":3,"file":"help.cjs","names":["require"],"sources":["../../src/cli/help.ts"],"sourcesContent":["import { createRequire } from 'node:module';\n\n// createRequire rather than a JSON import: this file runs both from src under\n// Node's strip-only TypeScript mode (how pi.sh starts it) and from dist, and\n// resolves package.json relative to itself in either case.\nconst require = createRequire(import.meta.url);\n\nexport const HARNESS_VERSION = (require('../../package.json') as { version: string }).version;\n\nexport function printHelp(): void {\n process.stdout.write(`doompi\n\nUsage: doompi [harness options] [Pi options] [prompt]\n doompi init\n doompi sync [matrix options] [--check]\n doompi compat <codex|claude|antigravity> [matrix options] [provider arguments]\n\nInitialization:\n doompi init Fill missing files in ~/.pi/.doom\n doompi sync Resolve the matrix into .pi so plain pi can load it\n doompi sync --check Exit non-zero when the synced config is out of date\n\nAfter a sync, run pi directly. The synced session accepts --major-mode,\n--domains, --profile, and --mute, and /major-mode, /domains, and /profile switch\nwithout a restart. Selection defaults come from the selection block in\n.doom/config.yaml.\n\nCompatibility matrix options:\n --profile <name> Persona and env from .doom/profiles.yaml\n --domains <names> Comma-separated content domains\n --major-mode <name> Named major mode from .doom/modes.yaml\n -- Pass following matrix-named flags to the provider\n\nAll other compatibility arguments pass to the provider unchanged.\n\nHarness options:\n --major-mode <name> Named major mode from .doom/modes.yaml\n (default: copilot). Not --mode: Pi owns that one.\n --profile <name> Persona and env from .doom/profiles.yaml\n --domains <names> Comma-separated domains (content: plugins, skills)\n --no-domains Load no content domains\n --explain Print the resolved matrix and exit\n --emit-mcp <dir> Write the resolved MCP config to a directory and exit\n --plugin-dir <path> Load an explicit plugin directory, repeatable\n --add-dir <path> Add an accessible directory, repeatable\n --preset <name> default, kimi, or ollama\n --cwd <path> Run Pi in this directory\n --automation Use print mode, JSON output, and project approval\n --output-format vibe-lint Read a vibe-lint request from stdin and emit one JSON response\n --mute Disable the notification extension for this run\n --auto-stop Exit interactive Pi when the agent settles\n --allow-protected-writes Allow writes to protected repository paths\n --hooks, --no-hooks Enable or disable repository and plugin hooks\n --mcp, --no-mcp Enable or disable MCP configuration\n --agents, --no-agents Enable or disable spawnable agents\n -h, --help Show harness help\n -v, --version Show harness version\n\nInteractive commands:\n /loop Open the loop launcher picker\n /loops List active loops and stop future scheduling\n /workflow [on|off] Toggle workflow tools for the agent\n /effort <level> Set and persist the thinking effort\n /plan [on|off|status] Toggle repository read-only plan mode\n /major-mode Pick a named major mode\n /domains [names] Show the selected domains or pick a different set\n /profile List or switch persona and environment profiles\n\nAll remaining options are passed to Pi.\n`);\n}\n"],"mappings":"gHAOA,MAAa,GAFPA,wBAAAA,CAAAA,eAAAA,QAAAA,MAAAA,CAAAA,cAAAA,WAAAA,CAAAA,KAE0BA,CAAQ,qBAAqB,CAAyB,QAEtF,SAAgB,GAAkB,CAChC,QAAQ,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DrB"}
1
+ {"version":3,"file":"help.cjs","names":["require"],"sources":["../../src/cli/help.ts"],"sourcesContent":["import { createRequire } from 'node:module';\n\n// createRequire rather than a JSON import: this file runs both from src under\n// Node's strip-only TypeScript mode (how pi.sh starts it) and from dist, and\n// resolves package.json relative to itself in either case.\nconst require = createRequire(import.meta.url);\n\nexport const HARNESS_VERSION = (require('../../package.json') as { version: string }).version;\n\nexport function printHelp(): void {\n process.stdout.write(`doompi\n\nUsage: doompi [harness options] [Pi options] [prompt]\n doompi init\n doompi sync [matrix options] [--check]\n doompi build [matrix options]\n doompi compat <codex|claude|antigravity> [matrix options] [provider arguments]\n\nInitialization:\n doompi init Fill missing files in ~/.pi/.doom\n doompi sync Resolve the matrix into .pi so plain pi can load it\n doompi sync --check Exit non-zero when the synced config is out of date\n doompi build Prebuild startup caches without launching Pi\n\nAfter a sync, run pi directly. The synced session accepts --major-mode,\n--domains, --profile, and --mute, and /major-mode, /domains, and /profile switch\nwithout a restart. Selection defaults come from the selection block in\n.doom/config.yaml.\n\nCompatibility matrix options:\n --profile <name> Persona and env from .doom/profiles.yaml\n --domains <names> Comma-separated content domains\n --major-mode <name> Named major mode from .doom/modes.yaml\n -- Pass following matrix-named flags to the provider\n\nAll other compatibility arguments pass to the provider unchanged.\n\nHarness options:\n --major-mode <name> Named major mode from .doom/modes.yaml\n (default: copilot). Not --mode: Pi owns that one.\n --profile <name> Persona and env from .doom/profiles.yaml\n --domains <names> Comma-separated domains (content: plugins, skills)\n --no-domains Load no content domains\n --explain Print the resolved matrix and exit\n --emit-mcp <dir> Write the resolved MCP config to a directory and exit\n --plugin-dir <path> Load an explicit plugin directory, repeatable\n --add-dir <path> Add an accessible directory, repeatable\n --preset <name> default, kimi, or ollama\n --cwd <path> Run Pi in this directory\n --automation Use print mode, JSON output, and project approval\n --output-format vibe-lint Read a vibe-lint request from stdin and emit one JSON response\n --mute Disable the notification extension for this run\n --auto-stop Exit interactive Pi when the agent settles\n --allow-protected-writes Allow writes to protected repository paths\n --hooks, --no-hooks Enable or disable repository and plugin hooks\n --mcp, --no-mcp Enable or disable MCP configuration\n --agents, --no-agents Enable or disable spawnable agents\n -h, --help Show harness help\n -v, --version Show harness version\n\nInteractive commands:\n /loop Open the loop launcher picker\n /loops List active loops and stop future scheduling\n /workflow [on|off] Toggle workflow tools for the agent\n /effort <level> Set and persist the thinking effort\n /plan [on|off|status] Toggle repository read-only plan mode\n /major-mode Pick a named major mode\n /domains [names] Show the selected domains or pick a different set\n /profile List or switch persona and environment profiles\n\nAll remaining options are passed to Pi.\n`);\n}\n"],"mappings":"gHAOA,MAAa,GAFPA,wBAAAA,CAAAA,eAAAA,QAAAA,MAAAA,CAAAA,cAAAA,WAAAA,CAAAA,KAE0BA,CAAQ,qBAAqB,CAAyB,QAEtF,SAAgB,GAAkB,CAChC,QAAQ,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6DrB"}
package/dist/cli/help.mjs CHANGED
@@ -3,12 +3,14 @@ import{createRequire as e}from"node:module";const t=e(import.meta.url)(`../../pa
3
3
  Usage: doompi [harness options] [Pi options] [prompt]
4
4
  doompi init
5
5
  doompi sync [matrix options] [--check]
6
+ doompi build [matrix options]
6
7
  doompi compat <codex|claude|antigravity> [matrix options] [provider arguments]
7
8
 
8
9
  Initialization:
9
10
  doompi init Fill missing files in ~/.pi/.doom
10
11
  doompi sync Resolve the matrix into .pi so plain pi can load it
11
12
  doompi sync --check Exit non-zero when the synced config is out of date
13
+ doompi build Prebuild startup caches without launching Pi
12
14
 
13
15
  After a sync, run pi directly. The synced session accepts --major-mode,
14
16
  --domains, --profile, and --mute, and /major-mode, /domains, and /profile switch
@@ -1 +1 @@
1
- {"version":3,"file":"help.mjs","names":[],"sources":["../../src/cli/help.ts"],"sourcesContent":["import { createRequire } from 'node:module';\n\n// createRequire rather than a JSON import: this file runs both from src under\n// Node's strip-only TypeScript mode (how pi.sh starts it) and from dist, and\n// resolves package.json relative to itself in either case.\nconst require = createRequire(import.meta.url);\n\nexport const HARNESS_VERSION = (require('../../package.json') as { version: string }).version;\n\nexport function printHelp(): void {\n process.stdout.write(`doompi\n\nUsage: doompi [harness options] [Pi options] [prompt]\n doompi init\n doompi sync [matrix options] [--check]\n doompi compat <codex|claude|antigravity> [matrix options] [provider arguments]\n\nInitialization:\n doompi init Fill missing files in ~/.pi/.doom\n doompi sync Resolve the matrix into .pi so plain pi can load it\n doompi sync --check Exit non-zero when the synced config is out of date\n\nAfter a sync, run pi directly. The synced session accepts --major-mode,\n--domains, --profile, and --mute, and /major-mode, /domains, and /profile switch\nwithout a restart. Selection defaults come from the selection block in\n.doom/config.yaml.\n\nCompatibility matrix options:\n --profile <name> Persona and env from .doom/profiles.yaml\n --domains <names> Comma-separated content domains\n --major-mode <name> Named major mode from .doom/modes.yaml\n -- Pass following matrix-named flags to the provider\n\nAll other compatibility arguments pass to the provider unchanged.\n\nHarness options:\n --major-mode <name> Named major mode from .doom/modes.yaml\n (default: copilot). Not --mode: Pi owns that one.\n --profile <name> Persona and env from .doom/profiles.yaml\n --domains <names> Comma-separated domains (content: plugins, skills)\n --no-domains Load no content domains\n --explain Print the resolved matrix and exit\n --emit-mcp <dir> Write the resolved MCP config to a directory and exit\n --plugin-dir <path> Load an explicit plugin directory, repeatable\n --add-dir <path> Add an accessible directory, repeatable\n --preset <name> default, kimi, or ollama\n --cwd <path> Run Pi in this directory\n --automation Use print mode, JSON output, and project approval\n --output-format vibe-lint Read a vibe-lint request from stdin and emit one JSON response\n --mute Disable the notification extension for this run\n --auto-stop Exit interactive Pi when the agent settles\n --allow-protected-writes Allow writes to protected repository paths\n --hooks, --no-hooks Enable or disable repository and plugin hooks\n --mcp, --no-mcp Enable or disable MCP configuration\n --agents, --no-agents Enable or disable spawnable agents\n -h, --help Show harness help\n -v, --version Show harness version\n\nInteractive commands:\n /loop Open the loop launcher picker\n /loops List active loops and stop future scheduling\n /workflow [on|off] Toggle workflow tools for the agent\n /effort <level> Set and persist the thinking effort\n /plan [on|off|status] Toggle repository read-only plan mode\n /major-mode Pick a named major mode\n /domains [names] Show the selected domains or pick a different set\n /profile List or switch persona and environment profiles\n\nAll remaining options are passed to Pi.\n`);\n}\n"],"mappings":"4CAOA,MAAa,EAFG,EAAc,OAAO,KAAK,IAEV,CAAQ,qBAAqB,CAAyB,QAEtF,SAAgB,GAAkB,CAChC,QAAQ,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DrB"}
1
+ {"version":3,"file":"help.mjs","names":[],"sources":["../../src/cli/help.ts"],"sourcesContent":["import { createRequire } from 'node:module';\n\n// createRequire rather than a JSON import: this file runs both from src under\n// Node's strip-only TypeScript mode (how pi.sh starts it) and from dist, and\n// resolves package.json relative to itself in either case.\nconst require = createRequire(import.meta.url);\n\nexport const HARNESS_VERSION = (require('../../package.json') as { version: string }).version;\n\nexport function printHelp(): void {\n process.stdout.write(`doompi\n\nUsage: doompi [harness options] [Pi options] [prompt]\n doompi init\n doompi sync [matrix options] [--check]\n doompi build [matrix options]\n doompi compat <codex|claude|antigravity> [matrix options] [provider arguments]\n\nInitialization:\n doompi init Fill missing files in ~/.pi/.doom\n doompi sync Resolve the matrix into .pi so plain pi can load it\n doompi sync --check Exit non-zero when the synced config is out of date\n doompi build Prebuild startup caches without launching Pi\n\nAfter a sync, run pi directly. The synced session accepts --major-mode,\n--domains, --profile, and --mute, and /major-mode, /domains, and /profile switch\nwithout a restart. Selection defaults come from the selection block in\n.doom/config.yaml.\n\nCompatibility matrix options:\n --profile <name> Persona and env from .doom/profiles.yaml\n --domains <names> Comma-separated content domains\n --major-mode <name> Named major mode from .doom/modes.yaml\n -- Pass following matrix-named flags to the provider\n\nAll other compatibility arguments pass to the provider unchanged.\n\nHarness options:\n --major-mode <name> Named major mode from .doom/modes.yaml\n (default: copilot). Not --mode: Pi owns that one.\n --profile <name> Persona and env from .doom/profiles.yaml\n --domains <names> Comma-separated domains (content: plugins, skills)\n --no-domains Load no content domains\n --explain Print the resolved matrix and exit\n --emit-mcp <dir> Write the resolved MCP config to a directory and exit\n --plugin-dir <path> Load an explicit plugin directory, repeatable\n --add-dir <path> Add an accessible directory, repeatable\n --preset <name> default, kimi, or ollama\n --cwd <path> Run Pi in this directory\n --automation Use print mode, JSON output, and project approval\n --output-format vibe-lint Read a vibe-lint request from stdin and emit one JSON response\n --mute Disable the notification extension for this run\n --auto-stop Exit interactive Pi when the agent settles\n --allow-protected-writes Allow writes to protected repository paths\n --hooks, --no-hooks Enable or disable repository and plugin hooks\n --mcp, --no-mcp Enable or disable MCP configuration\n --agents, --no-agents Enable or disable spawnable agents\n -h, --help Show harness help\n -v, --version Show harness version\n\nInteractive commands:\n /loop Open the loop launcher picker\n /loops List active loops and stop future scheduling\n /workflow [on|off] Toggle workflow tools for the agent\n /effort <level> Set and persist the thinking effort\n /plan [on|off|status] Toggle repository read-only plan mode\n /major-mode Pick a named major mode\n /domains [names] Show the selected domains or pick a different set\n /profile List or switch persona and environment profiles\n\nAll remaining options are passed to Pi.\n`);\n}\n"],"mappings":"4CAOA,MAAa,EAFG,EAAc,OAAO,KAAK,IAEV,CAAQ,qBAAqB,CAAyB,QAEtF,SAAgB,GAAkB,CAChC,QAAQ,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6DrB"}
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./compatibilityOptions.cjs`),t=require(`./options.cjs`),n=require(`./help.cjs`),r=require(`./cliApp.cjs`);exports.CliApp=r.CliApp,exports.HARNESS_VERSION=n.HARNESS_VERSION,exports.parseCompatibilityArgs=e.parseCompatibilityArgs,exports.parseCompatibilityProvider=e.parseCompatibilityProvider,exports.parseHarnessArgs=t.parseHarnessArgs,exports.printHelp=n.printHelp,exports.runCli=r.runCli,exports.runHarness=r.runHarness;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./help.cjs`),t=require(`./options.cjs`),n=require(`./cliApp.cjs`),r=require(`./compatibilityOptions.cjs`);exports.CliApp=n.CliApp,exports.HARNESS_VERSION=e.HARNESS_VERSION,exports.parseCompatibilityArgs=r.parseCompatibilityArgs,exports.parseCompatibilityProvider=r.parseCompatibilityProvider,exports.parseHarnessArgs=t.parseHarnessArgs,exports.printHelp=e.printHelp,exports.runCli=n.runCli,exports.runHarness=n.runHarness;