@outerlayer/cli 0.12.0 → 0.14.0

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 (98) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +9 -4
  3. package/dist/agent-setup-CN2HUBEJ.js +26 -0
  4. package/dist/{build-LELVCWHV.js → build-BG2YENGK.js} +2 -2
  5. package/dist/build-info.json +1 -1
  6. package/dist/{builder-OF67QKDS.js → builder-2D3WSOOY.js} +4 -4
  7. package/dist/{check-RJOJU2WA.js → check-SRGR36KI.js} +37 -37
  8. package/dist/{chunk-XR3BJN33.js → chunk-22RMZBGW.js} +20 -1
  9. package/dist/{chunk-AHZQBGD2.js → chunk-2M63GG56.js} +1 -1
  10. package/dist/{chunk-SZOVKFWB.js → chunk-3NLOVYJQ.js} +4 -4
  11. package/dist/{chunk-USO2DKBD.js → chunk-4KSQKQXE.js} +8 -2
  12. package/dist/{chunk-QEESCZ26.js → chunk-4NPZVMJU.js} +2 -2
  13. package/dist/{chunk-DVT73QJO.js → chunk-4OGPT6I2.js} +14 -14
  14. package/dist/{chunk-ZQUCTFXC.js → chunk-FOJGZYFC.js} +11 -5
  15. package/dist/{chunk-G5XY6CVG.js → chunk-HFKKFTXU.js} +12 -16
  16. package/dist/{chunk-ANW7VHMH.js → chunk-HFKQIZXL.js} +95 -16
  17. package/dist/{chunk-325272HM.js → chunk-J5M7BSJQ.js} +11 -4
  18. package/dist/{chunk-NPXQXYVA.js → chunk-JJEGKEFV.js} +6 -8
  19. package/dist/{chunk-3ZPYPFNM.js → chunk-JXYVA45C.js} +1 -1
  20. package/dist/{chunk-IBB4D4KE.js → chunk-JYIEHQIF.js} +1 -1
  21. package/dist/{chunk-5TGQHOUX.js → chunk-KFRM23WD.js} +3 -3
  22. package/dist/{chunk-GGMRZPEA.js → chunk-KMDLFI4P.js} +1 -1
  23. package/dist/{chunk-G5IEVZGI.js → chunk-LCEXHCHD.js} +1 -1
  24. package/dist/{chunk-27Y7AX2O.js → chunk-MSASO5O4.js} +44 -8
  25. package/dist/chunk-MTF3PHVZ.js +161 -0
  26. package/dist/{chunk-G4RXNF2L.js → chunk-NHDVD7DU.js} +12 -12
  27. package/dist/{chunk-GATMPAMK.js → chunk-NPQWKGUA.js} +2 -2
  28. package/dist/{chunk-YEQL54G5.js → chunk-PQUM37BK.js} +1 -1
  29. package/dist/{chunk-GEBQXUFY.js → chunk-Q2UK3C4P.js} +24 -10
  30. package/dist/{chunk-SKHN72JO.js → chunk-RBKIH5ST.js} +13 -13
  31. package/dist/{chunk-2KLBKHT4.js → chunk-RLYZLUQ7.js} +1 -1
  32. package/dist/chunk-RMWLBUCJ.js +50 -0
  33. package/dist/{chunk-PDRYXERC.js → chunk-SMHOCDCI.js} +5 -5
  34. package/dist/{chunk-6FH2AHJY.js → chunk-SWHQ4LUM.js} +30 -17
  35. package/dist/{agent-setup-52LRZ6AY.js → chunk-SXWS25JC.js} +8 -21
  36. package/dist/{chunk-VK25O2ZM.js → chunk-T5VPP6H7.js} +1 -1
  37. package/dist/{chunk-JOXYKGUV.js → chunk-WUYTWNMA.js} +4 -2
  38. package/dist/{chunk-A56PYPDF.js → chunk-XCK2YAY5.js} +14 -4
  39. package/dist/{chunk-C7N4TDHW.js → chunk-YDSMROTB.js} +5 -5
  40. package/dist/{chunk-FO7KKPYG.js → chunk-ZA5CHAFY.js} +2 -2
  41. package/dist/{cli-JSSRGA6V.js → cli-UW2H3UUW.js} +138 -85
  42. package/dist/{command-3WYZ2ML5.js → command-5LD7G2QQ.js} +27 -27
  43. package/dist/{config-MKBX2ZQD.js → config-N3C6DFQA.js} +1 -1
  44. package/dist/{connect-cmd-A5NGODCJ.js → connect-cmd-JUAW6MU4.js} +5 -5
  45. package/dist/{context-adopt-BAHGXJZV.js → context-adopt-PJUMW2EZ.js} +6 -6
  46. package/dist/{context-materialize-45OVRRK2.js → context-materialize-FDHYKNDT.js} +6 -6
  47. package/dist/{dist-EQDW7MZW.js → dist-LKDWQWZ7.js} +2 -2
  48. package/dist/{docker-VGWEJWI7.js → docker-4J77Q2BF.js} +5 -5
  49. package/dist/{doctor-4FFXTQJ2.js → doctor-H7REBSLQ.js} +29 -29
  50. package/dist/{emit-artifact-cmd-QS7XNKBT.js → emit-artifact-cmd-FOGNJXVR.js} +18 -21
  51. package/dist/emit-cmd-ZEYWLC2C.js +11 -0
  52. package/dist/{emit-criteria-cmd-XN6AKA53.js → emit-criteria-cmd-HBP6XS5C.js} +8 -11
  53. package/dist/{emit-finding-cmd-SQJSEHYS.js → emit-finding-cmd-DLI4MKMN.js} +8 -11
  54. package/dist/{emit-result-cmd-56RHPHOA.js → emit-result-cmd-MUSL7GQA.js} +12 -15
  55. package/dist/{hook-fast-HLESEJAL.js → hook-fast-WYQD6D7T.js} +1 -1
  56. package/dist/{import-capture-cmd-NHMAFDM6.js → import-capture-cmd-6QVCOIHK.js} +10 -13
  57. package/dist/{import-ruler-cmd-UYB32YUT.js → import-ruler-cmd-KLRGRBCP.js} +7 -10
  58. package/dist/index.js +3 -3
  59. package/dist/{init-UZKD4RY7.js → init-NTXA3SN7.js} +28 -28
  60. package/dist/{init-6AY5T3P6.js → init-UBXK6MF7.js} +47 -37
  61. package/dist/{init-cmd-XGSX2BCC.js → init-cmd-NARDUPIG.js} +20 -13
  62. package/dist/init-update-O5YYFGF4.js +165 -0
  63. package/dist/{install-VXXI7UR6.js → install-HDBIPHTX.js} +2 -2
  64. package/dist/{login-browser-7XGSV7MA.js → login-browser-QZCS3WW6.js} +2 -1
  65. package/dist/{loop-4NMI2USY.js → loop-SW2M5VDD.js} +37 -37
  66. package/dist/{machine-4JX2D4TS.js → machine-U66FKVDP.js} +23 -23
  67. package/dist/mcp-install-cmd-FDTPQQS6.js +9 -0
  68. package/dist/{runner-env-WAXTJXZK.js → runner-env-XTC53CHN.js} +3 -3
  69. package/dist/runner-key-3JSMDRJA.js +154 -0
  70. package/dist/{session-sender-T7PN4YRC.js → session-sender-4M247XSV.js} +7 -7
  71. package/dist/starter-pack-IB4UUIX3.js +11 -0
  72. package/dist/{status-OXBIRWJ7.js → status-STZYPU3W.js} +30 -30
  73. package/dist/{sync-cmd-EVXNR47N.js → sync-cmd-UWD5JOFU.js} +6 -6
  74. package/dist/{watch-7NSFOAL5.js → watch-DBNB7R6X.js} +6 -6
  75. package/dist/{work-claim-cmd-KR7UR2AB.js → work-claim-cmd-LY4U6QHN.js} +13 -13
  76. package/dist/{work-cmd-JPM37MLF.js → work-cmd-RVRQ32EH.js} +7 -7
  77. package/dist/{work-comment-cmd-3DC6BC34.js → work-comment-cmd-FFUM4TJU.js} +10 -13
  78. package/dist/{work-open-pr-cmd-XZQRJBNZ.js → work-open-pr-cmd-HLDWP4T2.js} +10 -13
  79. package/dist/{work-pr-cmd-WHGZOP22.js → work-pr-cmd-L77K32WK.js} +7 -7
  80. package/package.json +1 -1
  81. package/skill-pack/maintained/emitting-evidence/SKILL.md +8 -2
  82. package/skill-pack/shipped.json +70 -0
  83. package/skill-pack/template/build/SKILL.md +66 -35
  84. package/skill-pack/template/build/references/agent-briefs.md +4 -2
  85. package/skill-pack/template/build/references/release.md +36 -8
  86. package/skill-pack/template/build/references/review-loop.md +6 -2
  87. package/skill-pack/template/build/scripts/record-criteria.mjs +109 -143
  88. package/skill-pack/template/spec/SKILL.md +33 -22
  89. package/skill-pack/template/writing-specs/SKILL.md +36 -3
  90. package/skill-pack/template/writing-specs/references/agents-snippet.md +57 -0
  91. package/skill-pack/template/writing-tests/SKILL.md +117 -0
  92. package/skill-pack/validators/acceptance-criteria.yaml +35 -0
  93. package/skill-pack/validators/code-review.yaml +4 -2
  94. package/dist/chunk-T6OIJQRT.js +0 -31
  95. package/dist/emit-cmd-LXEIDKLT.js +0 -10
  96. package/dist/mcp-install-cmd-XZARXNYT.js +0 -9
  97. package/dist/starter-pack-Z22VRFPF.js +0 -11
  98. package/dist/{chunk-3FMPZPJQ.js → chunk-R7PF5OOU.js} +1 -1
@@ -1,29 +1,33 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { gatherDoctorChecks, doctorExitCode, summarizeChecks, renderDoctorText, recordWrapped, recordUnwrapped, recordRemoval, readManifest, recordInstall, recordStatusline } from './chunk-ANW7VHMH.js';
3
+ import { gatherDoctorChecks, doctorExitCode, summarizeChecks, renderDoctorText, recordWrapped, recordUnwrapped, recordRemoval, readManifest, recordInstall, recordStatusline } from './chunk-HFKQIZXL.js';
4
+ import './chunk-MTF3PHVZ.js';
5
+ import './chunk-SWHQ4LUM.js';
6
+ import './chunk-NPQWKGUA.js';
7
+ import './chunk-IP7BIBXJ.js';
4
8
  import './chunk-F47JBIAW.js';
5
9
  import './chunk-BKO6JEZI.js';
6
- import './chunk-6FH2AHJY.js';
7
- import './chunk-GATMPAMK.js';
8
- import './chunk-IP7BIBXJ.js';
9
- import './chunk-C7N4TDHW.js';
10
- import './chunk-JOXYKGUV.js';
11
- import './chunk-3ZPYPFNM.js';
12
- import './chunk-USO2DKBD.js';
10
+ import './chunk-XCK2YAY5.js';
11
+ import './chunk-FOJGZYFC.js';
12
+ import './chunk-YDSMROTB.js';
13
+ import './chunk-WUYTWNMA.js';
14
+ import './chunk-JXYVA45C.js';
15
+ import './chunk-4KSQKQXE.js';
13
16
  import './chunk-N6LURUEF.js';
14
17
  import { C, NO_COLOR_FLAG, warnDeprecated, stripNoColor, API_KEY_FLAG_DEPRECATION } from './chunk-YRYMNBGQ.js';
15
18
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
16
19
  import { settingsPath, readSettings, SettingsParseError, listHookCandidates, wrapHooks, writeSettings, unwrapHooks, REGISTERED_EVENTS, cliCommand, removeHooks, removeStatusline, cliBinResolvable, mergeHooks, repointWrappedHooks, AUTO_WRAP_EVENTS, mergeStatusline } from './chunk-5QRP3MVS.js';
17
- import { pinExists } from './chunk-G5IEVZGI.js';
18
- import './chunk-AHZQBGD2.js';
20
+ import { pinExists } from './chunk-LCEXHCHD.js';
19
21
  import './chunk-YO4PSLVB.js';
22
+ import './chunk-ZA5CHAFY.js';
23
+ import './chunk-2M63GG56.js';
20
24
  import './chunk-PLMTLGYH.js';
21
- import './chunk-325272HM.js';
25
+ import './chunk-J5M7BSJQ.js';
22
26
  import './chunk-EABW6AJQ.js';
23
27
  import { resolveVersion } from './chunk-RA3O54FC.js';
24
28
  import './chunk-V7NIVOFD.js';
25
29
  import './chunk-ZM2IMMYN.js';
26
- import { hookFiredMarkerPath, installedCliDistDir } from './chunk-YEQL54G5.js';
30
+ import { hookFiredMarkerPath, installedCliDistDir } from './chunk-PQUM37BK.js';
27
31
  import { managedHookScripts, removeJournalHooks, installPreCommitGuardHook, removePreCommitGuardHook } from './chunk-XCCLFVXM.js';
28
32
  import './chunk-BJ3KTMDH.js';
29
33
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
@@ -3617,7 +3621,7 @@ function resolveCliBin() {
3617
3621
  return "outerlayer";
3618
3622
  }
3619
3623
  }
3620
- var SUPPORT_TEXT = "\nDocs: https://github.com/outerlayerai/outerlayer#readme\nIssues: https://github.com/outerlayerai/outerlayer/issues\n";
3624
+ var SUPPORT_TEXT = "\nDocs: https://docs.outerlayer.ai\nIssues: https://github.com/outerlayerai/outerlayer/issues\n";
3621
3625
  function fail(message) {
3622
3626
  process.stderr.write(`${C.red}\u2717${C.reset} ${message}
3623
3627
  `);
@@ -3641,7 +3645,7 @@ function warnIfApiKeyFlag(opts) {
3641
3645
  if (opts.apiKey !== void 0) warnDeprecated(API_KEY_FLAG_DEPRECATION);
3642
3646
  }
3643
3647
  async function installStarterPackInRepo() {
3644
- const { installStarterPack, formatStarterPackOutput } = await import('./starter-pack-Z22VRFPF.js');
3648
+ const { installStarterPack, formatStarterPackOutput } = await import('./starter-pack-IB4UUIX3.js');
3645
3649
  const cwd = process.cwd();
3646
3650
  let repoRoot = cwd;
3647
3651
  try {
@@ -3801,8 +3805,8 @@ ${starter.output}`),
3801
3805
  }
3802
3806
  }
3803
3807
  async function realConnectDepsForCwd() {
3804
- const { realConnectDeps } = await import('./connect-cmd-A5NGODCJ.js');
3805
- const { resolveRepoIdentity } = await import('./dist-EQDW7MZW.js');
3808
+ const { realConnectDeps } = await import('./connect-cmd-JUAW6MU4.js');
3809
+ const { resolveRepoIdentity } = await import('./dist-LKDWQWZ7.js');
3806
3810
  return {
3807
3811
  ...realConnectDeps(),
3808
3812
  home: homeFromEnv(),
@@ -3818,13 +3822,26 @@ function invokedCommandToken(argv) {
3818
3822
  function buildProgram(argv = process.argv) {
3819
3823
  const program2 = new Command();
3820
3824
  program2.name("outerlayer").description("OuterLayer \u2014 see what your coding agents actually do").enablePositionalOptions().version(resolveVersion()).option(NO_COLOR_FLAG, "disable color (NO_COLOR=1 does the same)").addHelpText("after", SUPPORT_TEXT);
3821
- program2.command("init").description("Connect this repository, install hooks and agent skills, run doctor").option("--user", "install into user settings [default]").option("--project", "install into project settings (./.claude/settings.json)").option("--org", "print a managed-settings.json snippet for MDM/GPO rollout").option("--remove", "uninstall OuterLayer hooks").option("--local", "install the hooks only: no connect step and no network call").option("--factory <org/factory>", "the factory to connect this repository to (see `outerlayer connect`)").option("--gitignore", "also add .outerlayer/ to .gitignore (project scope)").option("--template <name>", "install the starter skills and a policy file (only: default)").option("--no-wrap-hooks", "leave PreToolUse/PostToolUse hooks unwrapped").option("--statusline", "install the status-line segment [default]").option("--no-statusline", "leave the statusLine slot untouched").option("--json", "machine-readable JSON output").addHelpText(
3825
+ program2.command("init").description("Connect this repository, install hooks and agent skills, run doctor").option("--user", "install into user settings [default]").option("--project", "install into project settings (./.claude/settings.json)").option("--org", "print a managed-settings.json snippet for MDM/GPO rollout").option("--remove", "uninstall OuterLayer hooks").option("--local", "install the hooks only: no connect step and no network call").option("--factory <org/factory>", "the factory to connect this repository to (see `outerlayer connect`)").option("--gitignore", "also add .outerlayer/ to .gitignore (project scope)").option("--template <name>", "install the starter skills and a policy file (only: default)").option("--update", "update the files init wrote that you have not edited, and write missing ones").option("--dry-run", "with --update: print the plan and write nothing").option("--no-wrap-hooks", "leave PreToolUse/PostToolUse hooks unwrapped").option("--statusline", "install the status-line segment [default]").option("--no-statusline", "leave the statusLine slot untouched").option("--json", "machine-readable JSON output").addHelpText(
3822
3826
  "after",
3823
- "\nIn a repository, init runs four steps: connect the repository to a\nfactory (`outerlayer connect`), install the hooks, set up the coding agent,\nand run `outerlayer doctor`. It never signs in and asks nothing. With no\nlogin it skips the connect step and says to run `outerlayer login`. With\n--json it prints one document naming the outcome of each step: done,\nskipped or failed. The exit code is 1 when a step failed.\n\nThe agent setup step installs the starter skills and the `outerlayer` skill\ninto .outerlayer/skills/, writes .outerlayer/config.json for Claude Code when\nthere is none, runs `outerlayer context emit` so the skills appear in\n.claude/skills/, and adds the outerlayer and outerlayer-docs MCP servers to\n.mcp.json. Nothing you wrote is changed: an existing config, policy, edited\nskill, MCP entry or root CLAUDE.md and AGENTS.md is left as it is, and a\nhand-written file the emit would replace is kept and listed. The files are\nleft uncommitted.\nThe step is skipped outside a git repository and in a repository whose\ncontext comes from a control plane, where it arrives at session start.\n\n--local installs only the hooks: no connect step, no agent setup and no\nnetwork call. Add `--template default` to also write the starter skills and\na policy file into .outerlayer/ without compiling them; `outerlayer context\nemit` does that.\n\nIdempotent: settings are backed up before any write, and a second run\nchanges nothing. Wrapping adds one spawn per hook firing; undo it with\n`outerlayer hooks unwrap`. An occupied status-line slot is wrapped, never\nreplaced.\n\nThree of the starter skills are copied once and are yours to edit. The\nothers are rewritten from this CLI on every `context emit`.\n"
3827
+ "\nIn a repository, init runs four steps: connect the repository to a\nfactory (`outerlayer connect`), install the hooks, set up the coding agent,\nand run `outerlayer doctor`. It never signs in and asks nothing. With no\nlogin it skips the connect step and says to run `outerlayer login`. With\n--json it prints one document naming the outcome of each step: done,\nskipped or failed. The exit code is 1 when a step failed.\n\nThe agent setup step installs the starter skills and the `outerlayer` skill\ninto .outerlayer/skills/, writes .outerlayer/config.json for Claude Code when\nthere is none, runs `outerlayer context emit` so the skills appear in\n.claude/skills/, and adds the outerlayer and outerlayer-docs MCP servers to\n.mcp.json. Nothing you wrote is changed: an existing config, policy, edited\nskill, MCP entry or root CLAUDE.md and AGENTS.md is left as it is, and a\nhand-written file the emit would replace is kept and listed. The files are\nleft uncommitted.\nThe step is skipped outside a git repository and in a repository whose\ncontext comes from a control plane, where it arrives at session start.\n\n--local installs only the hooks: no connect step, no agent setup and no\nnetwork call. Add `--template default` to also write the starter skills and\na policy file into .outerlayer/ without compiling them; `outerlayer context\nemit` does that.\n\nIdempotent: settings are backed up before any write, and a second run\nchanges nothing. Wrapping adds one spawn per hook firing; undo it with\n`outerlayer hooks unwrap`. An occupied status-line slot is wrapped, never\nreplaced.\n\nThree of the starter skills are copied once and are yours to edit. The\nothers are rewritten from this CLI on every `context emit`.\n\n--update brings the files init wrote once up to this CLI's version: the\ntemplate skills, the policy, the two starter checks and the two MCP\nentries. A file still equal to a version an earlier release wrote is\nreplaced, and a missing one is written. A file you edited is never\ntouched. It then runs `outerlayer context emit` and leaves the changes\nuncommitted. --dry-run prints the plan, with a command to compare each\nedited file, and writes nothing. `outerlayer doctor` reports the same\nstates under Starter files.\n"
3824
3828
  ).action(async (opts) => {
3829
+ if (opts.update || opts.dryRun) {
3830
+ const { runInitUpdate, formatInitUpdate, updateFlagProblem } = await import('./init-update-O5YYFGF4.js');
3831
+ const problem = updateFlagProblem(opts);
3832
+ if (problem !== void 0) {
3833
+ fail(problem);
3834
+ return;
3835
+ }
3836
+ const result = runInitUpdate({ cwd: process.cwd(), dryRun: opts.dryRun === true });
3837
+ if (opts.json) writeJson(result);
3838
+ else process.stdout.write(formatInitUpdate(result));
3839
+ if (result.status === "failed") process.exitCode = 1;
3840
+ return;
3841
+ }
3825
3842
  let starterTemplate;
3826
3843
  if (opts.template !== void 0) {
3827
- const { assertKnownTemplate, StarterPackError } = await import('./starter-pack-Z22VRFPF.js');
3844
+ const { assertKnownTemplate, StarterPackError } = await import('./starter-pack-IB4UUIX3.js');
3828
3845
  try {
3829
3846
  assertKnownTemplate(opts.template);
3830
3847
  } catch (err) {
@@ -3855,7 +3872,7 @@ function buildProgram(argv = process.argv) {
3855
3872
  else process.stdout.write(outcome.text);
3856
3873
  return;
3857
3874
  }
3858
- const { runInitCommand } = await import('./init-cmd-XGSX2BCC.js');
3875
+ const { runInitCommand } = await import('./init-cmd-NARDUPIG.js');
3859
3876
  const code = await runInitCommand(
3860
3877
  { json: opts.json, factory: opts.factory },
3861
3878
  {
@@ -3867,7 +3884,7 @@ function buildProgram(argv = process.argv) {
3867
3884
  return { ok, text, detail };
3868
3885
  },
3869
3886
  runAgentSetup: async () => {
3870
- const { runAgentSetup } = await import('./agent-setup-52LRZ6AY.js');
3887
+ const { runAgentSetup } = await import('./agent-setup-CN2HUBEJ.js');
3871
3888
  return runAgentSetup({ cwd: process.cwd() });
3872
3889
  },
3873
3890
  runDoctorChecks: gatherDoctorChecks
@@ -3879,7 +3896,7 @@ function buildProgram(argv = process.argv) {
3879
3896
  "after",
3880
3897
  "\nRun it in a repository, after `outerlayer login`. With a login, connect lists\nthe factories you can use and takes the first rule that leaves one answer:\n 1. --factory <org>/<factory>, or a factory id\n 2. the factory this repository is already connected to\n 3. the one factory this repository is linked to\n 4. the one factory you can use\n 5. on a terminal, ask; with no terminal, exit 1 and list each --factory value\n\nIt says what it chose and why. The choice is saved in this repository's git\ndirectory (outerlayer/connection.json), shared by every worktree of the\nclone and never committed. A factory key already belongs to one factory, so\nconnect changes nothing for it. Connect never links a repository.\n\nAfter it saves the choice, connect checks that this repository is linked to\nthe factory. If it is not, connect says so, prints the factory's Work page\nlink where you link it, and exits 2. The choice is saved either way. Run\nconnect again once the repository is linked. With --json, the document has\nlinked (true, false, or null when it could not be checked) and, when false,\nlinkUrl.\n"
3881
3898
  ).action(async (opts) => {
3882
- const { runConnectCommand } = await import('./connect-cmd-A5NGODCJ.js');
3899
+ const { runConnectCommand } = await import('./connect-cmd-JUAW6MU4.js');
3883
3900
  const code = await runConnectCommand({ factory: opts.factory, json: opts.json }, await realConnectDepsForCwd(), {
3884
3901
  stdout: process.stdout,
3885
3902
  stderr: process.stderr
@@ -3899,7 +3916,7 @@ function buildProgram(argv = process.argv) {
3899
3916
  "after",
3900
3917
  '\nWith no key on stdin, login prints an approve link and a code. A signed-in\nperson approves it on the dashboard. The login is a token for that person\'s\naccount, made for this machine, saved here and never printed. It picks no\nfactory: run `outerlayer connect` for that. `outerlayer logout` revokes it.\n\nWhen stdout is not a terminal, login does not wait. It prints one JSON\ndocument with the link, the code and a `login --check <id>` command, and\nexits 75. Run the check until it stops exiting 75: 0 is signed in, 1 is\ndenied or expired. A dropped connection or a 5xx also exits 75.\n\nA factory key piped on stdin is saved as it always was, never as a flag and\nnever printed back. A factory key always wins over the login, so CI and\nrunners keep acting as their key.\n\n echo "$OUTERLAYER_KEY" | outerlayer login --url <gateway url> --app-id <factory id>\n\nEvery later command reads the saved file, so none of them needs a key on\nits command line. A saved key is checked for real on the first `sync`.\n'
3901
3918
  ).action(async (opts) => {
3902
- const { runLoginCommand, realLoginDeps } = await import('./login-browser-7XGSV7MA.js');
3919
+ const { runLoginCommand, realLoginDeps } = await import('./login-browser-QZCS3WW6.js');
3903
3920
  const code = await runLoginCommand(
3904
3921
  {
3905
3922
  browser: opts.browser !== false,
@@ -3927,7 +3944,7 @@ function buildProgram(argv = process.argv) {
3927
3944
  "\nIncremental: only sessions newer than the last checkpoint ship. The tier\nis applied on this machine before anything leaves it; `--dry-run` prints\nexactly what would. The hook-triggered background sync runs `--quiet`.\nExit 2 means the server rejected at least one session.\n"
3928
3945
  ).action(async (opts) => {
3929
3946
  warnIfApiKeyFlag(opts);
3930
- const { runSync, SyncConfigError, SyncTransportError } = await import('./sync-cmd-EVXNR47N.js');
3947
+ const { runSync, SyncConfigError, SyncTransportError } = await import('./sync-cmd-UWD5JOFU.js');
3931
3948
  try {
3932
3949
  const result = await runSync({
3933
3950
  url: opts.url,
@@ -3956,7 +3973,7 @@ function buildProgram(argv = process.argv) {
3956
3973
  if (invokedCommandToken(argv) === "watch") {
3957
3974
  warnDeprecated("`outerlayer watch` is now `outerlayer daemon`; the old name will be removed in a future release.");
3958
3975
  }
3959
- const { runWatch } = await import('./watch-7NSFOAL5.js');
3976
+ const { runWatch } = await import('./watch-DBNB7R6X.js');
3960
3977
  await runWatch({ once: opts.once });
3961
3978
  });
3962
3979
  program2.command("hook <event>", { hidden: true }).description("capture-hook fast path, installed by `init`").action(() => {
@@ -4010,7 +4027,7 @@ function buildProgram(argv = process.argv) {
4010
4027
  }
4011
4028
  });
4012
4029
  program2.command("session-sender", { hidden: true }).description("stream a runner build's sessions to its work item while the build runs").action(async () => {
4013
- const { runSessionSender } = await import('./session-sender-T7PN4YRC.js');
4030
+ const { runSessionSender } = await import('./session-sender-4M247XSV.js');
4014
4031
  try {
4015
4032
  await runSessionSender();
4016
4033
  } catch (err) {
@@ -4045,7 +4062,7 @@ async function runCli(processArgv) {
4045
4062
  await buildProgram(argv).parseAsync(argv);
4046
4063
  }
4047
4064
  async function compileContext(opts) {
4048
- const { runEmit, EmitError } = await import('./emit-cmd-LXEIDKLT.js');
4065
+ const { runEmit, EmitError } = await import('./emit-cmd-ZEYWLC2C.js');
4049
4066
  try {
4050
4067
  const result = runEmit({ cwd: opts.dir, check: opts.check, json: opts.json });
4051
4068
  if (result.exitCode !== 0) process.exitCode = result.exitCode;
@@ -4068,7 +4085,7 @@ function registerEmitCommands(program2) {
4068
4085
  return;
4069
4086
  }
4070
4087
  warnIfApiKeyFlag(opts);
4071
- const { runEmitResult, EmitResultError } = await import('./emit-result-cmd-56RHPHOA.js');
4088
+ const { runEmitResult, EmitResultError } = await import('./emit-result-cmd-MUSL7GQA.js');
4072
4089
  try {
4073
4090
  const result = await runEmitResult({
4074
4091
  name,
@@ -4119,7 +4136,7 @@ locally so it never uploads. One correction can retire several duplicates.
4119
4136
  `
4120
4137
  ).action(async (file, opts) => {
4121
4138
  warnIfApiKeyFlag(opts);
4122
- const { runEmitArtifact, EmitArtifactError } = await import('./emit-artifact-cmd-QS7XNKBT.js');
4139
+ const { runEmitArtifact, EmitArtifactError } = await import('./emit-artifact-cmd-FOGNJXVR.js');
4123
4140
  let pr;
4124
4141
  if (opts.pr !== void 0) {
4125
4142
  pr = parseTrackerNumber(opts.pr);
@@ -4154,7 +4171,7 @@ locally so it never uploads. One correction can retire several duplicates.
4154
4171
  '\n outerlayer emit finding --id gate-skip --category tooling \\\n --title "The pre-push gate prints green when a step was skipped" \\\n --file scripts/git/pre-push-checks.mjs --where "build session"\n\nRecords one problem you hit in the factory: an instruction that is wrong or\nmissing (context), a flaky test, a misbehaving script (tooling), a local\nsetup trap (environment), a bug outside your own change (defect), or\nanything else. A problem in your own change is fixed, not recorded.\nA context finding needs --rule-path and --rule-relation, and --rule-quote\nunless the relation is missing. Add --cause, --detail and --suggestion, and\n--command, --error (first error line), --test or --symbol when there is one.\n\nEvery finding joins a factory-level problem. When one of its keys matches a\nknown problem it joins that problem. Otherwise nothing is stored: the command\nprints the closest problems and exits with code 3. Run it again with\n--problem <id> --link-reason <why> (repeat --problem for each problem the\nfinding reports), or with --new if none of them is the same problem.\nWithout --started-at and --ended-at it lists your recent session events with\nids and times; name the event where you hit the problem and the one where\nyou got past it to record the time it cost.\n--item names the work item; without it, inside a recorded session, the\nitem that session was launched for is used automatically.\n'
4155
4172
  ).action(async (opts) => {
4156
4173
  warnIfApiKeyFlag(opts);
4157
- const { runEmitFinding, refuseRemovedFindingFlags, EmitFindingError } = await import('./emit-finding-cmd-SQJSEHYS.js');
4174
+ const { runEmitFinding, refuseRemovedFindingFlags, EmitFindingError } = await import('./emit-finding-cmd-DLI4MKMN.js');
4158
4175
  try {
4159
4176
  refuseRemovedFindingFlags(opts);
4160
4177
  const result = await runEmitFinding({
@@ -4205,7 +4222,7 @@ locally so it never uploads. One correction can retire several duplicates.
4205
4222
  "\n outerlayer emit findings review.json --item 412\n\nRecords a whole batch at once \u2014 a FindingBatch JSON file (schemaVersion 3,\noptional headSha / contextSourceSha, and 1-500 findings), validated against\nthe same contract `emit finding` uses before anything is sent. Re-emitting\nan id already on the item replaces that row rather than adding a second one.\nFindings that need a choice between candidate problems are listed and not\nstored; the rest are stored, and the exit code is 3.\n--item names the work item; without it, inside a recorded session, the item\nthat session was launched for is used automatically.\n"
4206
4223
  ).action(async (file, opts) => {
4207
4224
  warnIfApiKeyFlag(opts);
4208
- const { runEmitFindings, EmitFindingError } = await import('./emit-finding-cmd-SQJSEHYS.js');
4225
+ const { runEmitFindings, EmitFindingError } = await import('./emit-finding-cmd-DLI4MKMN.js');
4209
4226
  try {
4210
4227
  const result = await runEmitFindings({
4211
4228
  file,
@@ -4226,10 +4243,26 @@ locally so it never uploads. One correction can retire several duplicates.
4226
4243
  });
4227
4244
  emitCmd.command("criteria <file>").description("Record a work item's acceptance criteria from a JSON file (- for stdin)").option("--item <number>", "work item to record on directly, by its number in this factory").option("--json", "machine-readable JSON output").option("--url <url>", "cloud base URL (or OUTERLAYER_URL / config)").addOption(apiKeyOption()).option("--app-id <id>", "factory id the key is bound to (or OUTERLAYER_APP_ID / config)").addHelpText(
4228
4245
  "after",
4229
- '\n outerlayer emit criteria criteria.json --item 412\n\nRecords the item\'s acceptance criteria as one list. The file is JSON:\n { "criteria": [ { "id": "AC-1", "text": "Given ...", "proof": null },\n { "id": "login.redirect", "text": "...", "proof": "screenshot" } ] }\nAn id is 1-64 characters of A-Z a-z 0-9 . _ : - and is the id evidence is bound to with\n`emit artifact --for`. proof is video, screenshot, report, log, test, file or null (any bound\nartifact proves it). The list holds 1 to 200 criteria, each text at most 2,000\ncharacters, and no id twice. The list is validated before anything is sent.\nOnce an item has a list, only a person can replace it: run the command outside an\nagent session, with your own login. A key bound to no member cannot replace it either.\n--item names the work item; without it, inside a recorded session, the item that\nsession was launched for is used automatically.\n'
4246
+ `
4247
+ outerlayer emit criteria criteria.json --item 412
4248
+
4249
+ Records the item's acceptance criteria as one list. The file is JSON:
4250
+ { "criteria": [ { "id": "AC-1", "text": "Given ...", "proof": null },
4251
+ { "id": "login.redirect", "text": "...", "proof": "screenshot" } ] }
4252
+ An id is 1-64 characters of A-Z a-z 0-9 . _ : - and is the id evidence is bound to with
4253
+ \`emit artifact --for\`. proof is video, screenshot, report, log, test, file or null (any bound
4254
+ artifact proves it). The list holds 1 to 200 criteria, each text at most 2,000
4255
+ characters, and no id twice. The list is validated before anything is sent.
4256
+ An optional top-level "drafted": true marks a list the build drafted from the issue's
4257
+ description. Only a list an agent records keeps the mark; a person's list never does.
4258
+ Once an item has a list, only a person can replace it: run the command outside an
4259
+ agent session, with your own login. A key bound to no member cannot replace it either.
4260
+ --item names the work item; without it, inside a recorded session, the item that
4261
+ session was launched for is used automatically.
4262
+ `
4230
4263
  ).action(async (file, opts) => {
4231
4264
  warnIfApiKeyFlag(opts);
4232
- const { runEmitCriteria, EmitCriteriaError } = await import('./emit-criteria-cmd-XN6AKA53.js');
4265
+ const { runEmitCriteria, EmitCriteriaError } = await import('./emit-criteria-cmd-HBP6XS5C.js');
4233
4266
  try {
4234
4267
  const result = await runEmitCriteria({
4235
4268
  file,
@@ -4256,7 +4289,7 @@ function registerWorkCommands(program2) {
4256
4289
  "\n outerlayer work build --issue 42 # a host builds it\n outerlayer work build --item 7 # retry an item already on Work\n outerlayer work build --issue 42 --local # you build it\n outerlayer work build --issue ENG-123 --tracker linear # a Linear issue\n\nWithout --local, records a build request: a host takes the item when it\nhas a free slot. It never links the calling session and never takes a\nlease, even run from inside one.\n\nWith --local, puts the item on Work with no build request, so no host\ntakes it, and prints the line that starts your session on it. That\nsession links itself and holds the item's lease while it works.\n"
4257
4290
  ).action(async (opts) => {
4258
4291
  warnIfApiKeyFlag(opts);
4259
- const { runWorkBuild, WorkCommandError } = await import('./work-cmd-JPM37MLF.js');
4292
+ const { runWorkBuild, WorkCommandError } = await import('./work-cmd-RVRQ32EH.js');
4260
4293
  try {
4261
4294
  await runWorkBuild(opts);
4262
4295
  } catch (err) {
@@ -4272,7 +4305,7 @@ function registerWorkCommands(program2) {
4272
4305
  "\n outerlayer work link-session 42\n\nNames an item that already exists on the calling session \u2014 it never\ncreates one. Create one with `outerlayer work build --local`. Linking\nthe same session to the same item twice is a no-op. Also takes or\nrenews that session's own 20-minute lease, unless --no-lease or\n--ended is given, or another worker already holds a live one.\n"
4273
4306
  ).action(async (number, opts) => {
4274
4307
  warnIfApiKeyFlag(opts);
4275
- const { runWorkLinkSession, WorkCommandError } = await import('./work-cmd-JPM37MLF.js');
4308
+ const { runWorkLinkSession, WorkCommandError } = await import('./work-cmd-RVRQ32EH.js');
4276
4309
  try {
4277
4310
  await runWorkLinkSession({ ...opts, number, noLease: opts.lease === false, logFailures: opts.logFailures === true });
4278
4311
  } catch (err) {
@@ -4297,8 +4330,8 @@ most one action flag may be given.
4297
4330
  `
4298
4331
  ).action(async (opts) => {
4299
4332
  warnIfApiKeyFlag(opts);
4300
- const { runWorkComment, WorkCommentCommandError } = await import('./work-comment-cmd-3DC6BC34.js');
4301
- const { WorkCommandError } = await import('./work-cmd-JPM37MLF.js');
4333
+ const { runWorkComment, WorkCommentCommandError } = await import('./work-comment-cmd-FFUM4TJU.js');
4334
+ const { WorkCommandError } = await import('./work-cmd-RVRQ32EH.js');
4302
4335
  try {
4303
4336
  await runWorkComment(opts);
4304
4337
  } catch (err) {
@@ -4314,8 +4347,8 @@ most one action flag may be given.
4314
4347
  "\n outerlayer work threads --item 7\n\nPrints the item's general thread, then one thread per acceptance\ncriterion that carries proof or a comment, each with who is waiting\non whom next.\n"
4315
4348
  ).action(async (opts) => {
4316
4349
  warnIfApiKeyFlag(opts);
4317
- const { runWorkThreads, WorkCommentCommandError } = await import('./work-comment-cmd-3DC6BC34.js');
4318
- const { WorkCommandError } = await import('./work-cmd-JPM37MLF.js');
4350
+ const { runWorkThreads, WorkCommentCommandError } = await import('./work-comment-cmd-FFUM4TJU.js');
4351
+ const { WorkCommandError } = await import('./work-cmd-RVRQ32EH.js');
4319
4352
  try {
4320
4353
  await runWorkThreads(opts);
4321
4354
  } catch (err) {
@@ -4337,7 +4370,7 @@ live addition remains on it.
4337
4370
  `
4338
4371
  ).action(async (opts) => {
4339
4372
  warnIfApiKeyFlag(opts);
4340
- const { runWorkRemove, WorkCommandError } = await import('./work-cmd-JPM37MLF.js');
4373
+ const { runWorkRemove, WorkCommandError } = await import('./work-cmd-RVRQ32EH.js');
4341
4374
  try {
4342
4375
  await runWorkRemove(opts);
4343
4376
  } catch (err) {
@@ -4350,7 +4383,7 @@ live addition remains on it.
4350
4383
  });
4351
4384
  workCmd.command("status").description("Show one item's stage, gate ledger, and additions").option("--item <number>", "the item's number inside this factory").option("--issue <number>", "issue number").option("--repo <owner/name>", "repository (default: the current checkout's remote)").option("--json", "machine-readable JSON output").option("--url <url>", "cloud base URL (or OUTERLAYER_URL / config)").addOption(apiKeyOption()).option("--app-id <id>", "factory id the key is bound to (or OUTERLAYER_APP_ID / config)").action(async (opts) => {
4352
4385
  warnIfApiKeyFlag(opts);
4353
- const { runWorkStatus, WorkCommandError } = await import('./work-cmd-JPM37MLF.js');
4386
+ const { runWorkStatus, WorkCommandError } = await import('./work-cmd-RVRQ32EH.js');
4354
4387
  try {
4355
4388
  await runWorkStatus(opts);
4356
4389
  } catch (err) {
@@ -4363,7 +4396,7 @@ live addition remains on it.
4363
4396
  });
4364
4397
  workCmd.command("list").description("List live work items for this factory").option("--stage <spec|build|review>", "filter by stage").option("--section <attention|waiting|flowing>", "filter by Queue section").option("--repo <owner/name>", "repository (default: the current checkout's remote)").option("--unclaimed", "only items with no live lease").option("--claimed", "only items with a live lease, held by a host or a local session").option("--startable", "only items a host can start: a build request, no open PR, no live lease").option("--needs <amend>", "only items with a thread waiting on an agent").option("--json", "machine-readable JSON output").option("--url <url>", "cloud base URL (or OUTERLAYER_URL / config)").addOption(apiKeyOption()).option("--app-id <id>", "factory id the key is bound to (or OUTERLAYER_APP_ID / config)").action(async (opts) => {
4365
4398
  warnIfApiKeyFlag(opts);
4366
- const { runWorkList, WorkCommandError } = await import('./work-cmd-JPM37MLF.js');
4399
+ const { runWorkList, WorkCommandError } = await import('./work-cmd-RVRQ32EH.js');
4367
4400
  try {
4368
4401
  await runWorkList(opts);
4369
4402
  } catch (err) {
@@ -4379,7 +4412,7 @@ live addition remains on it.
4379
4412
  "\n outerlayer work claim --item 42 --kind implement\n\nRecords a lease held by the API key that sends it. A live lease held\nby a different key is refused; claiming again with the same key extends\nit. --host is a label only.\n"
4380
4413
  ).action(async (opts) => {
4381
4414
  warnIfApiKeyFlag(opts);
4382
- const { runWorkClaim, WorkCommandError } = await import('./work-claim-cmd-KR7UR2AB.js');
4415
+ const { runWorkClaim, WorkCommandError } = await import('./work-claim-cmd-LY4U6QHN.js');
4383
4416
  try {
4384
4417
  await runWorkClaim(opts);
4385
4418
  } catch (err) {
@@ -4395,7 +4428,7 @@ live addition remains on it.
4395
4428
  "\n outerlayer work renew --item 42\n\nExtends the live lease this API key holds. Refused with a 410 if the\nlease has expired, or a 403 if a different key holds it.\n"
4396
4429
  ).action(async (opts) => {
4397
4430
  warnIfApiKeyFlag(opts);
4398
- const { runWorkRenew, WorkCommandError } = await import('./work-claim-cmd-KR7UR2AB.js');
4431
+ const { runWorkRenew, WorkCommandError } = await import('./work-claim-cmd-LY4U6QHN.js');
4399
4432
  try {
4400
4433
  await runWorkRenew(opts);
4401
4434
  } catch (err) {
@@ -4414,7 +4447,7 @@ live addition remains on it.
4414
4447
  "\n outerlayer work release --item 42 --outcome ok\n outerlayer work release --item 42\n\nMarks the lease this API key holds released, optionally with an\noutcome. A lease held by a different key is refused. Releasing an\nalready-released lease is a no-op that returns the recorded release\ntime and outcome.\n\nRun inside a session with no --host, it releases that session's own\nlease instead, so the item's review opens without ending the\nsession. It never releases another session's lease. --outcome\napplies to a host's lease only. A later tool call in the session\ntakes the lease again.\n"
4415
4448
  ).action(async (opts) => {
4416
4449
  warnIfApiKeyFlag(opts);
4417
- const { runWorkRelease, WorkCommandError } = await import('./work-claim-cmd-KR7UR2AB.js');
4450
+ const { runWorkRelease, WorkCommandError } = await import('./work-claim-cmd-LY4U6QHN.js');
4418
4451
  try {
4419
4452
  await runWorkRelease(opts);
4420
4453
  } catch (err) {
@@ -4430,7 +4463,7 @@ live addition remains on it.
4430
4463
  "\n outerlayer work pr 481\n outerlayer work pr 481 --withdraw --item 250\n\nRun inside a session already on a work item. Records that pull\nrequest 481 in the checkout's repository belongs to the item named by\nOUTERLAYER_WORK, or refuses when the session is not on it. The same\nfact a `pr-link` in the session's own transcript records on sync.\nIdempotent: declaring the same pull request twice is a no-op.\n\n--withdraw removes one item's declaration of the pull request. It\nneeds your own login; an agent session or a factory key is refused.\n"
4431
4464
  ).action(async (number, opts) => {
4432
4465
  warnIfApiKeyFlag(opts);
4433
- const { runWorkPr, WorkPrCommandError } = await import('./work-pr-cmd-WHGZOP22.js');
4466
+ const { runWorkPr, WorkPrCommandError } = await import('./work-pr-cmd-L77K32WK.js');
4434
4467
  try {
4435
4468
  await runWorkPr({ ...opts, number });
4436
4469
  } catch (err) {
@@ -4446,8 +4479,8 @@ live addition remains on it.
4446
4479
  '\n outerlayer work open-pr --title "Add the thing" --body-file pr.md\n outerlayer work open-pr --repository acme/web --title "Add the thing" --body-file pr.md\n\nIn a host build, which holds an item key, the gateway opens the pull\nrequest as the factory\'s GitHub App, from the branch the claim named,\nor edits the one already open on that branch. No gh command runs.\nIn your own session it runs `gh pr create` (or `gh pr edit`) under your\nlogin, then declares the pull request on the item, as `work pr` does.\nRun it again after a change to the title or description.\n'
4447
4480
  ).action(async (opts) => {
4448
4481
  warnIfApiKeyFlag(opts);
4449
- const { runWorkOpenPr, WorkOpenPrCommandError } = await import('./work-open-pr-cmd-XZQRJBNZ.js');
4450
- const { WorkCommandError } = await import('./work-cmd-JPM37MLF.js');
4482
+ const { runWorkOpenPr, WorkOpenPrCommandError } = await import('./work-open-pr-cmd-HLDWP4T2.js');
4483
+ const { WorkCommandError } = await import('./work-cmd-RVRQ32EH.js');
4451
4484
  try {
4452
4485
  await runWorkOpenPr(opts);
4453
4486
  } catch (err) {
@@ -4463,8 +4496,8 @@ function registerRunnerCommands(program2) {
4463
4496
  const runnerCmd = program2.command("runner").description("Take work from the implement and amend queues on this machine");
4464
4497
  const configOption = "the cloud config file to run against (default: ~/.outerlayer/config.json)";
4465
4498
  runnerCmd.command("start").description("Run the loop: claim work, run it, report, clean up, repeat").option("--config <path>", configOption).action(async (opts) => {
4466
- const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-MKBX2ZQD.js');
4467
- const { start, RunnerStartError } = await import('./loop-4NMI2USY.js');
4499
+ const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-N3C6DFQA.js');
4500
+ const { start, RunnerStartError } = await import('./loop-SW2M5VDD.js');
4468
4501
  const { RunnerAlreadyRunningError } = await import('./pidfile-UZRH774M.js');
4469
4502
  const configPath = opts.config ?? defaultRunnerConfigPath();
4470
4503
  try {
@@ -4479,8 +4512,8 @@ function registerRunnerCommands(program2) {
4479
4512
  }
4480
4513
  });
4481
4514
  runnerCmd.command("check").description("Validate the config, the hooks and the key, and print the effective settings").option("--config <path>", configOption).action(async (opts) => {
4482
- const { defaultRunnerConfigPath } = await import('./config-MKBX2ZQD.js');
4483
- const { runRunnerCheck } = await import('./check-RJOJU2WA.js');
4515
+ const { defaultRunnerConfigPath } = await import('./config-N3C6DFQA.js');
4516
+ const { runRunnerCheck } = await import('./check-SRGR36KI.js');
4484
4517
  const configPath = opts.config ?? defaultRunnerConfigPath();
4485
4518
  const result = await runRunnerCheck(configPath);
4486
4519
  if (!result.ok) {
@@ -4496,7 +4529,7 @@ function registerRunnerCommands(program2) {
4496
4529
  `);
4497
4530
  });
4498
4531
  runnerCmd.command("install").description("Put this CLI in the runner's install layout; --service adds its service").option("--config <path>", configOption).option("--service", "set up the service that keeps the runner running").option("--print", "with --service, print the unit and set up nothing").option("--user <account>", "with --service, the account the service runs as").option("--replace", "replace a unit or launcher file this command did not write").option("--allow-downgrade", "install this CLI even when it is older than the version the runner runs").option("--unit-name <name>", "with --service, the unit's name, to run a second runner beside the first").action(async (opts) => {
4499
- const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-MKBX2ZQD.js');
4532
+ const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-N3C6DFQA.js');
4500
4533
  const { runRunnerInstall, RunnerInstallError, launcherSummary, restartNote } = await import('./install-cmd-5HYMXLEW.js');
4501
4534
  const configPath = opts.config ?? defaultRunnerConfigPath();
4502
4535
  if (opts.service !== true) {
@@ -4509,7 +4542,7 @@ function registerRunnerCommands(program2) {
4509
4542
  }
4510
4543
  try {
4511
4544
  if (opts.service === true) {
4512
- const { installServiceCommand } = await import('./command-3WYZ2ML5.js');
4545
+ const { installServiceCommand } = await import('./command-5LD7G2QQ.js');
4513
4546
  const result2 = await installServiceCommand({
4514
4547
  configPath,
4515
4548
  print: opts.print,
@@ -4564,22 +4597,23 @@ To keep it running, run ${C.yellow}outerlayer runner install --service${C.reset}
4564
4597
  fail("pass --service: `outerlayer runner uninstall --service` removes the runner's service.");
4565
4598
  return;
4566
4599
  }
4567
- const { defaultRunnerConfigPath } = await import('./config-MKBX2ZQD.js');
4568
- const { uninstallServiceCommand } = await import('./command-3WYZ2ML5.js');
4600
+ const { defaultRunnerConfigPath } = await import('./config-N3C6DFQA.js');
4601
+ const { uninstallServiceCommand } = await import('./command-5LD7G2QQ.js');
4569
4602
  const result = await uninstallServiceCommand({ configPath: opts.config ?? defaultRunnerConfigPath(), unitName: opts.unitName, home: homeFromEnv() });
4570
4603
  if (result.ok) for (const line of result.lines) process.stdout.write(`${C.green}\u2713${C.reset} ${line}
4571
4604
  `);
4572
4605
  else fail(result.lines.length > 0 ? result.lines.join("\n ") : "the service was not removed");
4573
4606
  });
4574
- runnerCmd.command("init").description("Write a runner block that fits this machine; on macOS, offers a Linux VM").option("--config <path>", configOption).option("--vm", "on macOS, run the runner in a Linux VM (Lima), with container builds").option("--no-vm", "on macOS, skip the VM and run builds as unisolated processes").option("--allow-process-builds", "where builds cannot be isolated, run them as processes anyway").addOption(new Option("--config-stdin", "the VM-side hand-off: read the whole config as JSON on stdin").hideHelp()).option("--vm-cli-package <path>", "with --vm, install this packed CLI tarball in the VM").option("--unit-name <name>", "the service unit's name, to run a second runner beside the first").option("--agent <name>", "write commands that start this agent (claude); its credential comes on stdin").addHelpText(
4607
+ runnerCmd.command("init").description("Write a runner block that fits this machine; on macOS, offers a Linux VM").option("--config <path>", configOption).option("--vm", "on macOS, run the runner in a Linux VM (Lima), with container builds").option("--no-vm", "on macOS, skip the VM and run builds as unisolated processes").option("--allow-process-builds", "where builds cannot be isolated, run them as processes anyway").addOption(new Option("--config-stdin", "the VM-side hand-off: read the whole config as JSON on stdin").hideHelp()).option("--vm-cli-package <path>", "with --vm, install this packed CLI tarball in the VM").option("--unit-name <name>", "the service unit's name, to run a second runner beside the first").option("--agent <name>", "write commands that start this agent (claude); its credential comes on stdin").option("--app-id <id>", "factory id to create the runner key on, when it comes from your login").option("--key-name <name>", "name of the runner key created from your login (default: machine name)").addHelpText(
4575
4608
  "after",
4576
- "\nWith --agent claude, the queue commands start Claude Code instead of the\nplaceholder, and Claude's credential is read from stdin: a token from\n`claude setup-token` (sk-ant-oat...) or an API key (sk-ant-api...). It is\nnever printed, and is stored in the runner.env beside the config with mode\n600. Other lines in the file are kept. With nothing piped, a credential\nalready in runner.env is used.\n\n printf '%s' \"$CLAUDE_CODE_OAUTH_TOKEN\" | outerlayer runner init --agent claude\n"
4609
+ "\nWith no apiKey in the config file, and a login saved by `outerlayer login`,\nrunner init creates the runner key itself, with the Runner preset, on the\nfactory --app-id names (or OUTERLAYER_APP_ID, or this repository's\nconnection). Your login needs factory_keys.insert on that factory.\n\nWith --agent claude, the queue commands start Claude Code instead of the\nplaceholder, and Claude's credential is read from stdin: a token from\n`claude setup-token` (sk-ant-oat...) or an API key (sk-ant-api...). It is\nnever printed, and is stored in the runner.env beside the config with mode\n600. Other lines in the file are kept. With nothing piped, a credential\nalready in runner.env is used.\n\n printf '%s' \"$CLAUDE_CODE_OAUTH_TOKEN\" | outerlayer runner init --agent claude\n"
4577
4610
  ).action(async (opts) => {
4578
- const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-MKBX2ZQD.js');
4579
- const { runRunnerInit, RunnerInitError } = await import('./init-UZKD4RY7.js');
4580
- const { detectMachine } = await import('./machine-4JX2D4TS.js');
4581
- const { chooseVm, runVmInit, VmInitError } = await import('./init-6AY5T3P6.js');
4582
- const { AGENT_COMMANDS, credentialFromStdin, isAgentName, restartForCredential, RunnerEnvError } = await import('./runner-env-WAXTJXZK.js');
4611
+ const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-N3C6DFQA.js');
4612
+ const { prepareRunnerInit, runRunnerInit, RunnerInitError, writeRunnerInit } = await import('./init-NTXA3SN7.js');
4613
+ const { createRunnerKey, runnerKeyLogin } = await import('./runner-key-3JSMDRJA.js');
4614
+ const { detectMachine } = await import('./machine-U66FKVDP.js');
4615
+ const { chooseVm, runVmInit, VmInitError } = await import('./init-UBXK6MF7.js');
4616
+ const { AGENT_COMMANDS, credentialFromStdin, isAgentName, restartForCredential, RunnerEnvError } = await import('./runner-env-XTC53CHN.js');
4583
4617
  const configPath = opts.config ?? defaultRunnerConfigPath();
4584
4618
  if (opts.agent !== void 0 && !isAgentName(opts.agent)) {
4585
4619
  fail(`--agent ${opts.agent}: runner init writes commands for ${Object.keys(AGENT_COMMANDS).join(", ")}. For another agent, leave --agent out and edit runner.commands.`);
@@ -4593,7 +4627,7 @@ To keep it running, run ${C.yellow}outerlayer runner install --service${C.reset}
4593
4627
  try {
4594
4628
  let credential;
4595
4629
  if (agent !== void 0) {
4596
- const { readPipedKey } = await import('./login-browser-7XGSV7MA.js');
4630
+ const { readPipedKey } = await import('./login-browser-QZCS3WW6.js');
4597
4631
  credential = credentialFromStdin(
4598
4632
  await readPipedKey(process.stdin, {
4599
4633
  onWaiting: () => process.stderr.write(`runner init is waiting for Claude's credential on stdin; close stdin to use the one already in runner.env
@@ -4603,6 +4637,10 @@ To keep it running, run ${C.yellow}outerlayer runner install --service${C.reset}
4603
4637
  }
4604
4638
  const machine = detectMachine();
4605
4639
  if (opts.configStdin === true) {
4640
+ if (opts.appId !== void 0 || opts.keyName !== void 0) {
4641
+ fail("the VM-side hand-off carries its runner key in its config on stdin; pass no --app-id or --key-name with it.");
4642
+ return;
4643
+ }
4606
4644
  const chunks = [];
4607
4645
  for await (const chunk of process.stdin) chunks.push(Buffer.from(chunk));
4608
4646
  const result2 = runRunnerInit(configPath, { machine, configFromStdin: Buffer.concat(chunks).toString("utf8"), requireContainer: true });
@@ -4615,6 +4653,14 @@ hooks: ${result2.hooks}
4615
4653
  `);
4616
4654
  return;
4617
4655
  }
4656
+ const login = runnerKeyLogin(configPath, { appId: opts.appId });
4657
+ if (login === void 0 && opts.keyName !== void 0) {
4658
+ fail(
4659
+ `--key-name names the runner key runner init creates from your login, and it creates none here: ${configPath} already has an apiKey, or no login is saved. Run \`outerlayer login\` first, or leave --key-name out.`
4660
+ );
4661
+ return;
4662
+ }
4663
+ const makeKey = login === void 0 ? void 0 : () => createRunnerKey(login, { name: opts.keyName });
4618
4664
  let declinedVm = opts.vm === false;
4619
4665
  const useVm = await chooseVm({
4620
4666
  platform: machine.platform,
@@ -4644,6 +4690,7 @@ hooks: ${result2.hooks}
4644
4690
  cliPackage: opts.vmCliPackage,
4645
4691
  agent,
4646
4692
  credential,
4693
+ runnerKey: makeKey,
4647
4694
  progress: (line) => process.stdout.write(`${line}
4648
4695
  `)
4649
4696
  });
@@ -4652,9 +4699,15 @@ hooks: ${result2.hooks}
4652
4699
  return;
4653
4700
  }
4654
4701
  const allowProcess = opts.allowProcessBuilds === true || machine.platform === "darwin" && declinedVm;
4655
- const result = runRunnerInit(configPath, { machine, allowProcess, agent, credential });
4702
+ const prepared = prepareRunnerInit(configPath, { machine, allowProcess, agent, credential, keyFromLogin: makeKey !== void 0 });
4703
+ const created = makeKey === void 0 ? void 0 : await makeKey();
4704
+ const result = writeRunnerInit(prepared, created);
4656
4705
  const { ensureHostKey } = await import('./host-key-YMLXY6QB.js');
4657
4706
  const hostKey = await ensureHostKey(configPath);
4707
+ if (created !== void 0) {
4708
+ process.stdout.write(`${C.green}\u2713${C.reset} created the runner key ${created.name} from your login, with the Runner preset, and saved it in ${result.configPath}
4709
+ `);
4710
+ }
4658
4711
  process.stdout.write(`${C.green}\u2713${C.reset} wrote a runner block into ${result.configPath}
4659
4712
  `);
4660
4713
  if (agent !== void 0) process.stdout.write(`${C.green}\u2713${C.reset} commands: implement and amend start ${agent}
@@ -4709,7 +4762,7 @@ ${C.yellow}The runner will not update itself: ${installErr.message}${C.reset}
4709
4762
  let serviceUp = false;
4710
4763
  let restart;
4711
4764
  if (installedLayout) {
4712
- const { installServiceCommand } = await import('./command-3WYZ2ML5.js');
4765
+ const { installServiceCommand } = await import('./command-5LD7G2QQ.js');
4713
4766
  const service = await installServiceCommand({
4714
4767
  configPath,
4715
4768
  entryPath: process.argv[1] ?? "",
@@ -4753,12 +4806,12 @@ Next:
4753
4806
  "after",
4754
4807
  "\nFetches the head of the default branch into the runner's cache, reads its\n.devcontainer/devcontainer.json, and builds the image with the devcontainer CLI. Settings\nthat reach the host or widen the container's privileges are ignored and listed. The\nimage holds this CLI and a pinned Claude Code. Nothing runs inside the image.\n"
4755
4808
  ).action(async (opts) => {
4756
- const { defaultRunnerConfigPath } = await import('./config-MKBX2ZQD.js');
4757
- const { buildRepositoryImage, RecipeError } = await import('./build-LELVCWHV.js');
4809
+ const { defaultRunnerConfigPath } = await import('./config-N3C6DFQA.js');
4810
+ const { buildRepositoryImage, RecipeError } = await import('./build-BG2YENGK.js');
4758
4811
  const { currentCliBuild } = await import('./cli-build-K56DK4DS.js');
4759
- const { createDockerHost } = await import('./docker-VGWEJWI7.js');
4760
- const { builderSpec } = await import('./builder-OF67QKDS.js');
4761
- const { loadRunnerConfig } = await import('./config-MKBX2ZQD.js');
4812
+ const { createDockerHost } = await import('./docker-4J77Q2BF.js');
4813
+ const { builderSpec } = await import('./builder-2D3WSOOY.js');
4814
+ const { loadRunnerConfig } = await import('./config-N3C6DFQA.js');
4762
4815
  const configPath = opts.config ?? defaultRunnerConfigPath();
4763
4816
  const memory = (() => {
4764
4817
  try {
@@ -4819,16 +4872,16 @@ Next:
4819
4872
  }
4820
4873
  });
4821
4874
  runnerCmd.command("stop").description("Take no more work; wait for running jobs to finish, then exit").option("--config <path>", "the cloud config file naming the runner to stop").option("--now", "end running jobs immediately, with outcome stopped").action(async (opts) => {
4822
- const { defaultRunnerConfigPath } = await import('./config-MKBX2ZQD.js');
4823
- const { requestStop } = await import('./loop-4NMI2USY.js');
4875
+ const { defaultRunnerConfigPath } = await import('./config-N3C6DFQA.js');
4876
+ const { requestStop } = await import('./loop-SW2M5VDD.js');
4824
4877
  const configPath = opts.config ?? defaultRunnerConfigPath();
4825
4878
  await requestStop(configPath, Boolean(opts.now));
4826
4879
  });
4827
4880
  runnerCmd.command("status").description("List running jobs; with --recent, finished ones too").option("--config <path>", "the cloud config file naming the runner to inspect").option("--recent", "also list finished jobs, newest first, capped at 20").option("--json", "machine-readable JSON output").action(async (opts) => {
4828
- const { defaultRunnerConfigPath, loadRunnerConfig } = await import('./config-MKBX2ZQD.js');
4881
+ const { defaultRunnerConfigPath, loadRunnerConfig } = await import('./config-N3C6DFQA.js');
4829
4882
  const { jobsDir, runnerDir } = await import('./paths-OYKMVYJP.js');
4830
- const { listJobFiles, runnerProcessState } = await import('./loop-4NMI2USY.js');
4831
- const { renderStatus } = await import('./status-OXBIRWJ7.js');
4883
+ const { listJobFiles, runnerProcessState } = await import('./loop-SW2M5VDD.js');
4884
+ const { renderStatus } = await import('./status-STZYPU3W.js');
4832
4885
  const { readHousekeepingRecord } = await import('./record-C43U4PKS.js');
4833
4886
  const path2 = await import('path');
4834
4887
  const configPath = opts.config ?? defaultRunnerConfigPath();
@@ -4848,7 +4901,7 @@ Next:
4848
4901
  const service = await (async () => {
4849
4902
  if (process.platform !== "linux" || !existsSync("/run/systemd/system")) return void 0;
4850
4903
  const { inspectService, realInspectProbes } = await import('./inspect-6UYAAXH7.js');
4851
- const { DEFAULT_UNIT_NAME } = await import('./install-VXXI7UR6.js');
4904
+ const { DEFAULT_UNIT_NAME } = await import('./install-HDBIPHTX.js');
4852
4905
  const facts = inspectService(DEFAULT_UNIT_NAME, path2.dirname(configPath), realInspectProbes());
4853
4906
  return facts === void 0 ? void 0 : { unit: facts.unit, running: facts.mainPid !== void 0, delegated: facts.delegate };
4854
4907
  })();
@@ -4883,8 +4936,8 @@ Next:
4883
4936
  );
4884
4937
  });
4885
4938
  runnerCmd.command("logs").argument("<item>", "the work item's number in the factory").description("Print the newest attempt's log for one item").option("--config <path>", "the cloud config file naming the runner to inspect").option("-f, --follow", "keep printing as the log grows").action(async (itemArg, opts) => {
4886
- const { defaultRunnerConfigPath } = await import('./config-MKBX2ZQD.js');
4887
- const { listJobFiles } = await import('./loop-4NMI2USY.js');
4939
+ const { defaultRunnerConfigPath } = await import('./config-N3C6DFQA.js');
4940
+ const { listJobFiles } = await import('./loop-SW2M5VDD.js');
4888
4941
  const { newestAttempt, logPathFor, tail, RunnerLogsError } = await import('./logs-H55NWW4H.js');
4889
4942
  const configPath = opts.config ?? defaultRunnerConfigPath();
4890
4943
  const item = parseTrackerNumber(itemArg);
@@ -5108,7 +5161,7 @@ function registerMcpCommands(program2) {
5108
5161
  "after",
5109
5162
  "\nThe API key is never a flag and never written to .mcp.json as a literal value.\n stdio (default): the client spawns `outerlayer mcp serve`, which reads the key\n from ~/.outerlayer/config.json (or OUTERLAYER_API_KEY) on every connect, so a\n rotated key is picked up without rewriting the entry.\n http: the entry carries the ${OUTERLAYER_API_KEY} placeholder, which the client\n resolves from the environment it was launched with.\n\n--command: use an absolute or ${HOME}-relative path when the CLI is not on PATH.\n--url: with stdio the endpoint resolves from OUTERLAYER_URL / the config file at\nconnect time; for self-host pass your gateway-node origin + /v1/mcp.\nSelf-host deployments also need --app-id: without a key service to resolve the\ncaller from the bearer token, the gateway answers 401 without that header.\n"
5110
5163
  ).action(async (opts) => {
5111
- const { runMcpInstall, handleMcpInstallError, McpInstallError } = await import('./mcp-install-cmd-XZARXNYT.js');
5164
+ const { runMcpInstall, handleMcpInstallError, McpInstallError } = await import('./mcp-install-cmd-FDTPQQS6.js');
5112
5165
  try {
5113
5166
  if (opts.transport !== void 0 && opts.transport !== "stdio" && opts.transport !== "http") {
5114
5167
  throw new McpInstallError(`--transport must be "stdio" or "http", got "${opts.transport}"`);
@@ -5141,7 +5194,7 @@ function registerMcpCommands(program2) {
5141
5194
  function registerImportCommands(program2) {
5142
5195
  const importCmd = program2.command("import").description("Import an existing config format into .outerlayer/");
5143
5196
  importCmd.command("ruler").description("Port a .ruler/ tree into the equivalent .outerlayer/ tree").option("--dir <path>", "repo root to read from (default: cwd)").option("--json", "machine-readable JSON output").addHelpText("after", "\nRuler: https://github.com/intellectronica/ruler. Mostly a rename.\n").action(async (opts) => {
5144
- const { runImportRuler, ImportRulerError } = await import('./import-ruler-cmd-UYB32YUT.js');
5197
+ const { runImportRuler, ImportRulerError } = await import('./import-ruler-cmd-KLRGRBCP.js');
5145
5198
  try {
5146
5199
  const result = runImportRuler({ cwd: opts.dir, json: opts.json });
5147
5200
  if (result.exitCode !== 0) process.exitCode = result.exitCode;
@@ -5157,7 +5210,7 @@ function registerImportCommands(program2) {
5157
5210
  "after",
5158
5211
  "\nInstalls the four maintained skills (emitting-evidence, amend,\nreporting-findings, outerlayer) and an AGENTS.md snippet teaching agents to run\n`emit artifact`. A skill that differs from this CLI's bundle is rewritten to it, and the output says so.\n"
5159
5212
  ).action(async (opts) => {
5160
- const { runImportCapture, ImportCaptureError } = await import('./import-capture-cmd-NHMAFDM6.js');
5213
+ const { runImportCapture, ImportCaptureError } = await import('./import-capture-cmd-6QVCOIHK.js');
5161
5214
  try {
5162
5215
  runImportCapture({ cwd: opts.dir, json: opts.json });
5163
5216
  } catch (err) {
@@ -5195,12 +5248,12 @@ function registerContextCommands(program2) {
5195
5248
  const contextCmd = program2.command("context").description("Compile and materialize agent context");
5196
5249
  contextCmd.command("emit").description("Compile .outerlayer/ into each configured target tool's native files").option("--check", "compare against disk, write nothing, exit 1 on drift (CI mode)").option("--dir <path>", "repo root to read from (default: cwd)").option("--json", "machine-readable JSON output").addHelpText(
5197
5250
  "after",
5198
- '\nTargets come from .outerlayer/config.json only; there is no --target flag.\nMissing or empty config: {"targets": [...]}, e.g. {"targets": ["claude-code"]}.\nKnown targets: claude-code, cursor, codex, copilot, factory.\n\nThe maintained skills (emitting-evidence, amend, reporting-findings, outerlayer)\nfollow this CLI: emit rewrites one that differs from its bundle, and --check reports it as\ndrift. Templates (spec, writing-specs, build) are never rewritten or reported.\n\nOrphan detection (--check) only covers header-carrying outputs: every markdown\ntarget file gets a generated-by comment, but .mcp.json and .cursor/mcp.json are\nJSON with no comment syntax, so they can never be flagged as orphaned; missing\nand content drift still apply to them.\n'
5251
+ '\nTargets come from .outerlayer/config.json only; there is no --target flag.\nMissing or empty config: {"targets": [...]}, e.g. {"targets": ["claude-code"]}.\nKnown targets: claude-code, cursor, codex, copilot, factory.\n\nThe maintained skills (emitting-evidence, amend, reporting-findings, outerlayer)\nfollow this CLI: emit rewrites one that differs from its bundle, and --check reports it as\ndrift. Templates (spec, writing-specs, writing-tests, build) are never rewritten or reported.\n\nOrphan detection (--check) only covers header-carrying outputs: every markdown\ntarget file gets a generated-by comment, but .mcp.json and .cursor/mcp.json are\nJSON with no comment syntax, so they can never be flagged as orphaned; missing\nand content drift still apply to them.\n'
5199
5252
  ).action(async (opts) => {
5200
5253
  await compileContext({ dir: opts.dir, check: opts.check, json: opts.json });
5201
5254
  });
5202
5255
  contextCmd.command("adopt <stagedDir>", { hidden: true }).description("Copy context the runner staged into this checkout (container builds)").option("--json", "machine-readable JSON output").action(async (stagedDir) => {
5203
- const { runContextAdopt } = await import('./context-adopt-BAHGXJZV.js');
5256
+ const { runContextAdopt } = await import('./context-adopt-PJUMW2EZ.js');
5204
5257
  const { exitCode, stdout } = runContextAdopt(stagedDir, process.cwd());
5205
5258
  process.stdout.write(stdout);
5206
5259
  process.exitCode = exitCode;
@@ -5209,7 +5262,7 @@ function registerContextCommands(program2) {
5209
5262
  "after",
5210
5263
  "\nThe same flow SessionStart runs automatically, exposed for a manual retry or a\nfirst check outside a session. Writes AGENTS.md, .claude/**, and .outerlayer/**.\n"
5211
5264
  ).action(async (opts) => {
5212
- const { materializeContext } = await import('./context-materialize-45OVRRK2.js');
5265
+ const { materializeContext } = await import('./context-materialize-FDHYKNDT.js');
5213
5266
  const result = await materializeContext({ cwd: process.cwd(), sessionId: `manual-${Date.now()}` });
5214
5267
  const output = formatContextMaterializeOutput(result);
5215
5268
  if (output.exitCode !== void 0) process.exitCode = output.exitCode;