@memnexus-ai/mx-agent-cli 0.1.302 → 0.1.304

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 (163) hide show
  1. package/dist/agent-config/.mx-config-generation.json +2 -2
  2. package/dist/agent-config/AGENTS.md.template +1 -1
  3. package/dist/agent-config/agents/bar-raiser.md +41 -1
  4. package/dist/agent-config/agents/git-expert.md +58 -54
  5. package/dist/agent-config/claude-md/CLAUDE.core.md +1 -1
  6. package/dist/agent-config/hooks/session-idle-gate.sh +14 -1
  7. package/dist/agent-config/hooks/subagent-write-guard.sh +198 -12
  8. package/dist/agent-config/hooks/worktree-guard.sh +8 -6
  9. package/dist/agent-config/skills/mx-post-merge-sync/SKILL.md +57 -51
  10. package/dist/commands/codex-agent-gate.d.ts +1 -2
  11. package/dist/commands/codex-agent-gate.d.ts.map +1 -1
  12. package/dist/commands/codex-agent-gate.js +1 -2
  13. package/dist/commands/codex-agent-gate.js.map +1 -1
  14. package/dist/commands/codex-deploy-config.d.ts +6 -0
  15. package/dist/commands/codex-deploy-config.d.ts.map +1 -1
  16. package/dist/commands/codex-deploy-config.js +28 -8
  17. package/dist/commands/codex-deploy-config.js.map +1 -1
  18. package/dist/commands/codex-prove-guards.d.ts +2 -0
  19. package/dist/commands/codex-prove-guards.d.ts.map +1 -1
  20. package/dist/commands/codex-prove-guards.js +31 -3
  21. package/dist/commands/codex-prove-guards.js.map +1 -1
  22. package/dist/commands/codex-trust-keys.d.ts +2 -0
  23. package/dist/commands/codex-trust-keys.d.ts.map +1 -1
  24. package/dist/commands/codex-trust-keys.js +27 -7
  25. package/dist/commands/codex-trust-keys.js.map +1 -1
  26. package/dist/commands/coordination.d.ts +16 -0
  27. package/dist/commands/coordination.d.ts.map +1 -1
  28. package/dist/commands/coordination.js +24 -2
  29. package/dist/commands/coordination.js.map +1 -1
  30. package/dist/commands/create.d.ts +164 -7
  31. package/dist/commands/create.d.ts.map +1 -1
  32. package/dist/commands/create.js +293 -91
  33. package/dist/commands/create.js.map +1 -1
  34. package/dist/commands/doctor.d.ts +17 -0
  35. package/dist/commands/doctor.d.ts.map +1 -1
  36. package/dist/commands/doctor.js +33 -0
  37. package/dist/commands/doctor.js.map +1 -1
  38. package/dist/commands/gh.d.ts +3 -2
  39. package/dist/commands/gh.d.ts.map +1 -1
  40. package/dist/commands/gh.js +3 -2
  41. package/dist/commands/gh.js.map +1 -1
  42. package/dist/commands/new.d.ts +151 -13
  43. package/dist/commands/new.d.ts.map +1 -1
  44. package/dist/commands/new.js +486 -62
  45. package/dist/commands/new.js.map +1 -1
  46. package/dist/commands/start.d.ts +6 -0
  47. package/dist/commands/start.d.ts.map +1 -1
  48. package/dist/commands/start.js +105 -17
  49. package/dist/commands/start.js.map +1 -1
  50. package/dist/commands/status.d.ts +7 -0
  51. package/dist/commands/status.d.ts.map +1 -1
  52. package/dist/commands/status.js +21 -1
  53. package/dist/commands/status.js.map +1 -1
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +28 -4
  56. package/dist/index.js.map +1 -1
  57. package/dist/lib/agent-session.d.ts +11 -0
  58. package/dist/lib/agent-session.d.ts.map +1 -1
  59. package/dist/lib/agent-session.js +26 -7
  60. package/dist/lib/agent-session.js.map +1 -1
  61. package/dist/lib/behavioral-injection.d.ts.map +1 -1
  62. package/dist/lib/behavioral-injection.js +25 -7
  63. package/dist/lib/behavioral-injection.js.map +1 -1
  64. package/dist/lib/catalog-commit.d.ts.map +1 -1
  65. package/dist/lib/catalog-commit.js +17 -14
  66. package/dist/lib/catalog-commit.js.map +1 -1
  67. package/dist/lib/catalog.d.ts +93 -2
  68. package/dist/lib/catalog.d.ts.map +1 -1
  69. package/dist/lib/catalog.js +116 -9
  70. package/dist/lib/catalog.js.map +1 -1
  71. package/dist/lib/claude.d.ts.map +1 -1
  72. package/dist/lib/claude.js +28 -4
  73. package/dist/lib/claude.js.map +1 -1
  74. package/dist/lib/fleet-data.d.ts +98 -9
  75. package/dist/lib/fleet-data.d.ts.map +1 -1
  76. package/dist/lib/fleet-data.js +353 -34
  77. package/dist/lib/fleet-data.js.map +1 -1
  78. package/dist/lib/fleet-render.d.ts +8 -1
  79. package/dist/lib/fleet-render.d.ts.map +1 -1
  80. package/dist/lib/fleet-render.js +10 -3
  81. package/dist/lib/fleet-render.js.map +1 -1
  82. package/dist/lib/gh-remote.d.ts +15 -1
  83. package/dist/lib/gh-remote.d.ts.map +1 -1
  84. package/dist/lib/gh-remote.js +27 -2
  85. package/dist/lib/gh-remote.js.map +1 -1
  86. package/dist/lib/gh-token-run.d.ts +140 -14
  87. package/dist/lib/gh-token-run.d.ts.map +1 -1
  88. package/dist/lib/gh-token-run.js +187 -15
  89. package/dist/lib/gh-token-run.js.map +1 -1
  90. package/dist/lib/git-identity.d.ts +6 -2
  91. package/dist/lib/git-identity.d.ts.map +1 -1
  92. package/dist/lib/git-identity.js +17 -8
  93. package/dist/lib/git-identity.js.map +1 -1
  94. package/dist/lib/git-scrub-env.d.ts +35 -0
  95. package/dist/lib/git-scrub-env.d.ts.map +1 -0
  96. package/dist/lib/git-scrub-env.js +54 -0
  97. package/dist/lib/git-scrub-env.js.map +1 -0
  98. package/dist/lib/guarded-read.d.ts +15 -0
  99. package/dist/lib/guarded-read.d.ts.map +1 -0
  100. package/dist/lib/guarded-read.js +73 -0
  101. package/dist/lib/guarded-read.js.map +1 -0
  102. package/dist/lib/machine-setup.d.ts +165 -0
  103. package/dist/lib/machine-setup.d.ts.map +1 -0
  104. package/dist/lib/machine-setup.js +441 -0
  105. package/dist/lib/machine-setup.js.map +1 -0
  106. package/dist/lib/native-realpath.d.ts +70 -0
  107. package/dist/lib/native-realpath.d.ts.map +1 -0
  108. package/dist/lib/native-realpath.js +95 -0
  109. package/dist/lib/native-realpath.js.map +1 -0
  110. package/dist/lib/project-config.d.ts +2 -6
  111. package/dist/lib/project-config.d.ts.map +1 -1
  112. package/dist/lib/project-config.js.map +1 -1
  113. package/dist/lib/project-name.d.ts +15 -0
  114. package/dist/lib/project-name.d.ts.map +1 -0
  115. package/dist/lib/project-name.js +22 -0
  116. package/dist/lib/project-name.js.map +1 -0
  117. package/dist/lib/push-to.d.ts +113 -0
  118. package/dist/lib/push-to.d.ts.map +1 -0
  119. package/dist/lib/push-to.js +240 -0
  120. package/dist/lib/push-to.js.map +1 -0
  121. package/dist/lib/runtime/claude-gateway-routing.d.ts +161 -0
  122. package/dist/lib/runtime/claude-gateway-routing.d.ts.map +1 -0
  123. package/dist/lib/runtime/claude-gateway-routing.js +466 -0
  124. package/dist/lib/runtime/claude-gateway-routing.js.map +1 -0
  125. package/dist/lib/runtime/codex-adapter.d.ts +91 -5
  126. package/dist/lib/runtime/codex-adapter.d.ts.map +1 -1
  127. package/dist/lib/runtime/codex-adapter.js +204 -44
  128. package/dist/lib/runtime/codex-adapter.js.map +1 -1
  129. package/dist/lib/runtime/codex-config.d.ts +6 -12
  130. package/dist/lib/runtime/codex-config.d.ts.map +1 -1
  131. package/dist/lib/runtime/codex-config.js +17 -24
  132. package/dist/lib/runtime/codex-config.js.map +1 -1
  133. package/dist/lib/runtime/codex-guard-proof.d.ts +4 -7
  134. package/dist/lib/runtime/codex-guard-proof.d.ts.map +1 -1
  135. package/dist/lib/runtime/codex-guard-proof.js +16 -14
  136. package/dist/lib/runtime/codex-guard-proof.js.map +1 -1
  137. package/dist/lib/runtime/codex-hooks-list.d.ts +20 -0
  138. package/dist/lib/runtime/codex-hooks-list.d.ts.map +1 -1
  139. package/dist/lib/runtime/codex-hooks-list.js +20 -8
  140. package/dist/lib/runtime/codex-hooks-list.js.map +1 -1
  141. package/dist/lib/runtime/types.d.ts +1 -1
  142. package/dist/lib/runtime/types.d.ts.map +1 -1
  143. package/dist/lib/standards.d.ts +3 -0
  144. package/dist/lib/standards.d.ts.map +1 -1
  145. package/dist/lib/standards.js +1 -0
  146. package/dist/lib/standards.js.map +1 -1
  147. package/dist/lib/team-identity.d.ts.map +1 -1
  148. package/dist/lib/team-identity.js +18 -53
  149. package/dist/lib/team-identity.js.map +1 -1
  150. package/dist/lib/team-restore.d.ts +281 -0
  151. package/dist/lib/team-restore.d.ts.map +1 -0
  152. package/dist/lib/team-restore.js +533 -0
  153. package/dist/lib/team-restore.js.map +1 -0
  154. package/dist/lib/window-view.d.ts +5 -0
  155. package/dist/lib/window-view.d.ts.map +1 -1
  156. package/dist/lib/window-view.js +67 -6
  157. package/dist/lib/window-view.js.map +1 -1
  158. package/dist/lib/worktree-sync.d.ts +139 -11
  159. package/dist/lib/worktree-sync.d.ts.map +1 -1
  160. package/dist/lib/worktree-sync.js +327 -46
  161. package/dist/lib/worktree-sync.js.map +1 -1
  162. package/dist/standards/merge-gates.md +26 -0
  163. package/package.json +2 -2
@@ -50,6 +50,9 @@ export declare const INJECTED_STANDARDS: readonly [{
50
50
  }, {
51
51
  readonly file: "decision-request.md";
52
52
  readonly title: "Decision request";
53
+ }, {
54
+ readonly file: "merge-gates.md";
55
+ readonly title: "Merge gates";
53
56
  }];
54
57
  /** Bytes the rendered block may reach before it is dropped rather than injected. */
55
58
  export declare const MAX_STANDARDS_BLOCK_BYTES: number;
@@ -1 +1 @@
1
- {"version":3,"file":"standards.d.ts","sourceRoot":"","sources":["../../src/lib/standards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAOH;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAKrB,CAAC;AAEX,oFAAoF;AACpF,eAAO,MAAM,yBAAyB,QAAY,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAiB/C;AAED,MAAM,MAAM,eAAe,GACvB,aAAa,GACb,cAAc,GACd,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,4BAA4B,CAAC;AAEjC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,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AA4B,CAAC;AAEjC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,QAAQ,EAAE,OAAO,CAAC;IAClB,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,oEAAoE;AACpE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa,CAqCzF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,mBAAmB,CA4D1E;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAc/D"}
@@ -47,6 +47,7 @@ export const INJECTED_STANDARDS = [
47
47
  { file: 'writing-standard.md', title: 'Writing standard' },
48
48
  { file: 'report-format.md', title: 'Report format' },
49
49
  { file: 'decision-request.md', title: 'Decision request' },
50
+ { file: 'merge-gates.md', title: 'Merge gates' },
50
51
  ];
51
52
  /** Bytes the rendered block may reach before it is dropped rather than injected. */
52
53
  export const MAX_STANDARDS_BLOCK_BYTES = 16 * 1024;
@@ -1 +1 @@
1
- {"version":3,"file":"standards.js","sourceRoot":"","sources":["../../src/lib/standards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA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EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,uBAAuB,CAWzB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;AAEzE,8DAA8D;AAC9D,MAAM,MAAM,wBAAwB;AAClC,oFAAoF;AAClF,wBAAwB;AAC1B,yEAAyE;GACvE,8BAA8B;AAChC,8FAA8F;GAC5F,gCAAgC,CAAC;AAErC,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,wBAAwB,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,uBAAuB,CAAC;IACpC,6FAA6F;IAC7F,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,sFAAsF;IACtF,QAAQ,EAAE,oBAAoB,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,wBAAwB;IACvC,sDAAsD;IACtD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,uGAAuG;IACvG,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,4FAA4F;IAC5F,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,wBAAwB,GAAG,iBAAiB,CAuExF"}
@@ -126,66 +126,31 @@ export function checkStartTeamIdentity(opts) {
126
126
  `"${sanitizeForMessage(resolution.slug, 80)}" in its own. Session continues.`,
127
127
  });
128
128
  }
129
- // THE REMEDIATION IS A COMMAND THAT RUNS, and it was measured rather than
130
- // read off the argument parser (security re-review, Should Fix 1 on #429).
131
- // `mx-agent create <slug>` does not run: `--roleguide` is a `requiredOption`
132
- // (`src/index.ts:185`) and commander exits 1 during parse, before any action.
133
- // Measured 2026-09-05: `node dist/index.js create platform` exits 1 with
134
- // `error: required option '--roleguide <path>' not specified`, and `create`
135
- // is a deprecated alias of `provision` besides (`src/index.ts:184`).
129
+ // THE REMEDIATION IS `mx-agent start <slug>` (#1155 slice 1, M12). Since
130
+ // #1155, start writes `.mx-code-context.json` itself when the worktree lacks
131
+ // it and never overwrites one (`lib/team-restore.ts`, `ensureStartCodeContext`).
132
+ // So this warning prints only when something is at the path that does not
133
+ // record a team (it does not parse, holds no team, or is a symlink), or when
134
+ // the worktree's directory is not named `<slug>` or `<slug>-YYYYMMDD` and the
135
+ // write was skipped. Moving the file aside and starting again repairs the
136
+ // first case.
136
137
  //
137
- // `mx-agent provision --roleguide <path> --name <slug>` is the one that
138
- // repairs this state. A worktree that already exists is RESUMED
139
- // (`commands/create.ts:5218-5219`) and step 6a rewrites the file
140
- // (`commands/create.ts:5307`). Measured 2026-09-05 against a sandbox project
141
- // outside this repository, twice: with the worktree holding neither file
142
- // (`Identity: neither .mx-code-context.json nor CLAUDE.local.md exists yet`)
143
- // and with `CLAUDE.local.md` present and the scope file removed, which is the
144
- // state real team worktrees are in. Both wrote the file and both then
145
- // reported row 8 asserted. It works from inside the worktree too: the run
146
- // resolves the main checkout as its root. `--recheck` is NOT the repair. It
147
- // writes nothing (`src/index.ts:135`), and the file stayed absent when run.
148
- //
149
- // THE MESSAGE STATES THE SCOPE OF THAT COMMAND, because a resume does far
150
- // more than rewrite one file and an operator clearing this warning has not
151
- // asked for the rest (security re-review, Should Fix 1 on #429). The
152
- // `if (resuming)` block closes at `commands/create.ts:5231`; the only later
153
- // `resuming` branches are step 7's memory-attribution rows (`:5628`) and
154
- // step 8's catalog entry (`:5751`). Everything else runs unconditionally.
155
- // Read at `42b2f5d`, not carried from the review:
156
- // step 5 (`:5253`) `syncClaudeConfig` regenerates the WHOLE `.claude/`
157
- // tree — settings.json, hooks, agents, skills, commands, rules —
158
- // from `origin/<baseBranch>` via the generator's `--from-git` mode
159
- // (`lib/claude.ts:1150`, `:1203-1215`), then `deployClaudeMd`
160
- // rewrites CLAUDE.md (`:5254`).
161
- // step 6 (`:5264`) `writeClaudeLocal` rewrites CLAUDE.local.md.
162
- // step 6e (`:5493`) `buildCliInWorktree` runs npm ci and npm run build in
163
- // the worktree, skipped only when row 13 or the anchors refuse.
164
- // step 8b (`:5813`, call at `:5832`) requests a coordination credential when
165
- // `usesCredentialEndpoint(cfg.projectSlug)` and the team is on the
166
- // roster. `KEY_VAULT_PROJECTS` does not hold `'mx-agent'`
167
- // (`lib/coordination-token.ts:145`, #507) and this project's slug is
168
- // `mx-agent` (`mx-agent.config.json:8`), so it fires here. The
169
- // message says "where the project uses one" because this library
170
- // also runs for projects that take the Key Vault path instead.
171
- // TWO ITEMS FROM THE REVIEW ARE NOT IN THE MESSAGE. Step 6d (`:5443`) does
172
- // NOT edit the roleguide's anchors table: `anchorStage` (`:1753`) only stats,
173
- // reads and parses, and contains no write call. And a resume neither
174
- // overwrites a memory that already exists nor rewrites an existing catalog
175
- // entry (`:5764`, "a resume leaves it byte for byte"), so naming those as
176
- // effects would overstate what an operator gets.
138
+ // It no longer names `mx-agent provision`. `docs/onboarding/setup.md` says
139
+ // not to run provision on an existing team, and a resume does far more than
140
+ // write one file: it regenerates `.claude/` and CLAUDE.md, rewrites
141
+ // CLAUDE.local.md, rebuilds the CLI and requests a coordination credential
142
+ // (the scope this comment recorded before #1155, at `42b2f5d`).
177
143
  if (verdict === 'unresolvable' && opts.worktreePath && resolution.slug !== '') {
178
144
  warnings.push({
179
145
  code: 'start-team-identity-unreadable',
180
146
  message: `Team identity NOT CHECKED: ${CODE_CONTEXT_FILENAME} in this worktree records no readable ` +
181
147
  `team, so the resolved team "${sanitizeForMessage(resolution.slug, 80)}" (from the ` +
182
148
  `${resolution.source}) was not compared against anything. The file is missing, does not ` +
183
- `parse, holds no team, or is a symlink, which is not followed. Fix: run mx-agent provision ` +
184
- `--roleguide <path> --name ${sanitizeForMessage(resolution.slug, 80)}. That RE-PROVISIONS ` +
185
- `this worktree rather than restoring one file: it also regenerates .claude/ (settings.json ` +
186
- `and hooks) and CLAUDE.md from origin, rewrites CLAUDE.local.md, rebuilds the CLI here, and ` +
187
- `requests this team's coordination credential where the project uses one. To repair only ` +
188
- `this file, restore it by hand. Session continues.`,
149
+ `parse, holds no team, or is a symlink, which is not followed. Fix: move ` +
150
+ `${CODE_CONTEXT_FILENAME} aside if it is there, then run mx-agent start ` +
151
+ `${sanitizeForMessage(resolution.slug, 80)} again. start writes the file when it is missing, ` +
152
+ `in a worktree named ${sanitizeForMessage(resolution.slug, 80)} or ` +
153
+ `${sanitizeForMessage(resolution.slug, 80)}-YYYYMMDD, and never overwrites one. Session continues.`,
189
154
  });
190
155
  }
191
156
  return { resolution, recorded, verdict, warnings };
@@ -1 +1 @@
1
- {"version":3,"file":"team-identity.js","sourceRoot":"","sources":["../../src/lib/team-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,0EAA0E;AAC1E,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAehD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAA2B,EAC3B,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,OAAO,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC;IAC3C,MAAM,GAAG,GAAG,OAAO,IAAI,EAAE,CAAC;IAE1B,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,KAAK,IAA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CAAC,IAAI,KAAK,EAAE,EAAE,CAAC;QAC9E,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,gCAAgC;YACtC,OAAO,EACL,8BAA8B,qBAAqB,wCAAwC;gBAC3F,+BAA+B,kBAAkB,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc;gBACpF,GAAG,UAAU,CAAC,MAAM,qEAAqE;gBACzF,0EAA0E;gBAC1E,GAAG,qBAAqB,iDAAiD;gBACzE,GAAG,kBAAkB,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,oDAAoD;gBAC9F,uBAAuB,kBAAkB,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM;gBACpE,GAAG,kBAAkB,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,yDAAyD;SACtG,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AACrD,CAAC"}
@@ -0,0 +1,281 @@
1
+ /**
2
+ * team-restore -- `mx-agent start <team>` restores a team's missing worktree
3
+ * from its catalog entry (#1155 slice 1).
4
+ *
5
+ * WHAT THIS FIXES. A fresh clone holds every team's catalog entry and roleguide
6
+ * and no `.worktrees/` at all. Before this module, `start` refused there and
7
+ * named `agent create`, a command that no longer exists (R0, #1155 comment
8
+ * 6920543727). The only path left was to add a worktree by hand.
9
+ *
10
+ * SPEC. Plan comment 6959122500 on #1155 and amendment 1, comment 6959177678.
11
+ * The amendment governs where they differ. The mutation ids M1 to M12 in the
12
+ * comments below are the amendment's table, and each names the call site the
13
+ * mutation targets.
14
+ *
15
+ * THREE DECISIONS, IN ORDER.
16
+ * 1. `decideStartWorktree` reads the catalog. Only an entry whose `Status:`
17
+ * reads `active` can be restored (M6a, M6b). For such a team the worktree
18
+ * lookup is `findTeamWorktree`, which accepts `<slug>` and
19
+ * `<slug>-YYYYMMDD` only (M1, M9), so `start team` never resolves to a
20
+ * `team-builder-*` worktree. Every other slug keeps the prefix lookup
21
+ * `findWorktreePath`, which is how same-machine starts have always worked.
22
+ * 2. `restoreTeamWorktree` fetches `origin/<base>` and the team's
23
+ * `worktree/<slug>-*` branches (M10, M13b). By default it creates today's
24
+ * `worktree/<slug>-<date>` and lists every other branch of the team with
25
+ * its `--resume-branch` command; it refuses only when today's name exists
26
+ * without `--resume-branch` (M2, M2b, M13, M13c). It assigns a slot (M7),
27
+ * prunes stale worktree entries only when no sibling link is left broken
28
+ * (M14, M18), and runs its own `git worktree add -b <branch> <path>
29
+ * refs/remotes/origin/<base>` (M11, M17). It does NOT call
30
+ * `createGitWorktree`, which reuses an existing branch by default
31
+ * (`lib/worktree.ts:365-369`).
32
+ * 3. It writes `.mx-code-context.json` when the file is absent (M4a, M5), and
33
+ * the per-team git identity only when `extensions.worktreeConfig` is on
34
+ * (M3, M3b). `ensureStartCodeContext` writes the same file on any start
35
+ * whose worktree lacks it (M4b).
36
+ *
37
+ * WHAT IT WRITES OUTSIDE THE NEW WORKTREE. Into the clone's shared
38
+ * `.git/config`, exactly the two keys `git worktree add -b` writes for a branch
39
+ * that tracks a remote-tracking ref: `branch.<branch>.remote=origin` and
40
+ * `branch.<branch>.merge=refs/heads/<base>` (or the resumed branch's own name).
41
+ * `createGitWorktree` writes the same two for every provisioned branch. Into
42
+ * `$GIT_COMMON_DIR/worktrees/<name>/`, git's own admin entry. Into
43
+ * `<worktreeDir>/.slots.json`, the slot. Remote-tracking refs under
44
+ * `refs/remotes/origin/<base>` and `refs/remotes/origin/worktree/<slug>-*`,
45
+ * from the fetch. `git worktree prune` drops the admin entries of worktrees
46
+ * whose directories are gone.
47
+ *
48
+ * WHAT IT NEVER WRITES. No global git config: no `safe.directory` entry, unlike
49
+ * provisioning's `addToGitSafeDirectory`. No `user.*`, no `extensions.*` and no
50
+ * `core.hooksPath`: with `extensions.worktreeConfig` off it prints one line
51
+ * naming the one-time command and writes no identity anywhere. No CLI build:
52
+ * the build exists only for the pre-push hook, so it prints one line naming
53
+ * what that hook needs instead.
54
+ *
55
+ * NOTHING HERE PRINTS. Every function returns the lines for `start` to print,
56
+ * so a test can read them without capturing a terminal.
57
+ */
58
+ import { type TeamEntry } from './catalog.js';
59
+ /** The `start` flag that lets a restore reuse a branch that already exists. */
60
+ export declare const RESUME_BRANCH_FLAG = "--resume-branch";
61
+ /** The command a refusal names for a team that is not in the catalog. */
62
+ export declare const NEW_TEAM_COMMAND = "mx-agent new team";
63
+ /** The start of the line `start` prints when the pre-push check cannot run in a restored worktree. */
64
+ export declare const PRE_PUSH_BUILD_LINE = "pre-push checks run only once core.hooksPath is set to .githooks and the CLI is built in this worktree";
65
+ export interface StartWorktreeOptions {
66
+ projectRoot: string;
67
+ slug: string;
68
+ worktreeDir: string;
69
+ teamsDir: string;
70
+ }
71
+ export type StartWorktreeDecision =
72
+ /** A worktree is already here. `start` uses it as before. */
73
+ {
74
+ kind: 'existing';
75
+ path: string;
76
+ }
77
+ /** No worktree, and the catalog entry is active: restore one. */
78
+ | {
79
+ kind: 'restore';
80
+ entry: TeamEntry;
81
+ }
82
+ /** No worktree and nothing to restore from. `lines` is the refusal. */
83
+ | {
84
+ kind: 'refused';
85
+ lines: string[];
86
+ };
87
+ /**
88
+ * Whether a catalog entry's `Status:` lines let `start` restore it (#1155
89
+ * red-team finding 5).
90
+ *
91
+ * Restorable: no `Status:` line in the header, or exactly one whose whole value
92
+ * is `active` (trimmed, any case). Everything else is not: `retired`,
93
+ * `dormant`, `retired.`, `archived`, `**active**`, two `Status:` lines.
94
+ *
95
+ * WHY NOT `TeamEntry.status`. That field follows the roster check, which reads
96
+ * the first token and treats any near-miss as active, because for a roster the
97
+ * safe mistake is to keep a team. A restore creates a worktree and a branch, so
98
+ * here the safe mistake is to refuse, and only the two exact forms pass.
99
+ */
100
+ export declare function restorableStatus(entry: Pick<TeamEntry, 'statusValues'>): {
101
+ ok: true;
102
+ } | {
103
+ ok: false;
104
+ why: string;
105
+ };
106
+ /**
107
+ * The two lines every "team not found" message ends with: where restorable
108
+ * teams come from, and the command that creates a new one. `start`'s refusal
109
+ * and `mx-agent status` print the same pair (#1155 red-team finding 7).
110
+ */
111
+ export declare function catalogPointerLines(projectRoot: string, teamsDir: string): string[];
112
+ /**
113
+ * Where `start <slug>` runs, or that it must restore, or that it must refuse.
114
+ *
115
+ * ONLY A RESTORABLE ENTRY IS RESTORED (`restorableStatus`): no `Status:` line,
116
+ * or `Status: active` exactly. The values come from `TeamEntry.statusValues`
117
+ * (`lib/catalog.ts`, `catalogStatusValues`).
118
+ *
119
+ * WHY THE PREFIX LOOKUP IS NOT CONSULTED FOR AN ACTIVE TEAM. `findWorktreePath`
120
+ * matches any entry starting `<slug>-`, so for `team` it returns
121
+ * `team-builder-20260101`, another team's worktree. For a team the catalog
122
+ * names, `findTeamWorktree` decides: its own worktree, or a restore (M1, M9).
123
+ * A slug with no restorable entry keeps the prefix lookup, because a
124
+ * same-machine team without a catalog file still has to start.
125
+ */
126
+ export declare function decideStartWorktree(opts: StartWorktreeOptions): StartWorktreeDecision;
127
+ export interface RestoreTeamWorktreeOptions {
128
+ projectRoot: string;
129
+ slug: string;
130
+ entry: TeamEntry;
131
+ worktreeDir: string;
132
+ baseBranch: string;
133
+ /** The configured project slug, the `product` value of `.mx-code-context.json`. */
134
+ projectSlug: string;
135
+ /**
136
+ * `--resume-branch`: false when absent; true for the bare flag, which reuses
137
+ * the team's one existing branch; a branch name to choose one of several.
138
+ */
139
+ resumeBranch: boolean | string;
140
+ }
141
+ export type RestoreTeamWorktreeResult = {
142
+ kind: 'restored';
143
+ worktreePath: string;
144
+ branch: string;
145
+ slot: number;
146
+ /** The commit the new worktree's HEAD was at right after `git worktree add`. */
147
+ headSha: string;
148
+ /** The `origin/<base>` commit this run fetched. */
149
+ baseSha: string;
150
+ reusedBranch: boolean;
151
+ /** Lines for `start` to print, in order. */
152
+ lines: string[];
153
+ } | {
154
+ kind: 'refused';
155
+ lines: string[];
156
+ };
157
+ /** One existing branch of this team, and where it was found. */
158
+ export interface TeamBranch {
159
+ /** `worktree/<slug>-YYYYMMDD`. */
160
+ name: string;
161
+ local: boolean;
162
+ remote: boolean;
163
+ }
164
+ /**
165
+ * Every `worktree/<slug>-YYYYMMDD` branch, local or on origin's remote-tracking
166
+ * refs, sorted by name (#1155 red-team finding 1).
167
+ *
168
+ * Any date, not only today's: a team whose worktree was made on another day
169
+ * has its work on a branch with that day's name, and a restore that checked
170
+ * only today's name would start the team on a fresh branch beside it without a
171
+ * word. The exact shape is matched, so `worktree/team-builder-*` is not a
172
+ * branch of `team`. Reads local refs only; the caller fetches first.
173
+ */
174
+ export declare function listTeamBranches(projectRoot: string, slug: string): TeamBranch[];
175
+ /**
176
+ * Create the team's worktree on a new branch from a freshly fetched
177
+ * `origin/<base>`, or on its existing branch with `--resume-branch`, then write
178
+ * its scope file and, when it can, its identity.
179
+ *
180
+ * Every refusal comes before the first write except a failed `git worktree
181
+ * add`, which follows the slot write. `assignSlot` is idempotent by name
182
+ * (`lib/worktree.ts:111-113`), so a retry is handed the same slot.
183
+ */
184
+ export declare function restoreTeamWorktree(opts: RestoreTeamWorktreeOptions): RestoreTeamWorktreeResult;
185
+ /**
186
+ * The one line naming what the pre-push check needs in this worktree, or null.
187
+ *
188
+ * Printed when the worktree holds the CLI source and `.githooks/pre-push`, and
189
+ * either `core.hooksPath` is not `.githooks` or the CLI is not built. Nothing is
190
+ * set or built here.
191
+ */
192
+ export declare function prePushLine(projectRoot: string, worktreePath: string): string | null;
193
+ /**
194
+ * The four `.mx-code-context.json` values for a team, from the same helper
195
+ * provisioning uses (`teamMemorySpecs`, `lib/memory.ts`; `commands/create.ts`
196
+ * step 6a passes `nameCheckSpecs[0].codeContext`). The scope does not depend on
197
+ * the display name or the roleguide, which only feed the seeded memory text.
198
+ */
199
+ export declare function codeContextFor(slug: string, entry: Pick<TeamEntry, 'displayName' | 'roleguide'> | null, projectSlug: string): Record<string, string>;
200
+ export type CodeContextWrite = {
201
+ kind: 'written';
202
+ path: string;
203
+ }
204
+ /** Something is already at the path. It is never overwritten (M5). */
205
+ | {
206
+ kind: 'present';
207
+ path: string;
208
+ }
209
+ /** This worktree's name is not the team's own shape, so the file was not written. */
210
+ | {
211
+ kind: 'skipped';
212
+ path: string;
213
+ why: string;
214
+ } | {
215
+ kind: 'failed';
216
+ path: string;
217
+ why: string;
218
+ };
219
+ /**
220
+ * Write `.mx-code-context.json` unless something is already at the path.
221
+ *
222
+ * THE GUARD IS THE NEVER-OVERWRITE RULE (M5). `writeCodeContextFile` refuses a
223
+ * non-regular file but overwrites a regular one, and a file a person or an
224
+ * earlier provisioning run wrote is theirs. `lstat`, so a symlink, dangling or
225
+ * not, counts as present and is not followed.
226
+ */
227
+ export declare function writeCodeContextIfAbsent(worktreePath: string, values: unknown): CodeContextWrite;
228
+ /** The line, if any, `start` prints for a scope-file outcome. */
229
+ export declare function describeCodeContextWrite(w: CodeContextWrite): string[];
230
+ /**
231
+ * On any start, write the scope file when the worktree lacks it (M4b, #66).
232
+ *
233
+ * Only into the team's own worktree: a directory named `<slug>` or
234
+ * `<slug>-YYYYMMDD`, the two names `findTeamWorktree` accepts. A slug with no
235
+ * catalog entry still resolves through the prefix lookup, so `start team` can
236
+ * land in `team-builder-20260101`, and writing `team: team` there would label
237
+ * another team's memories. The plan does not name this case; the narrower rule
238
+ * is the one that cannot write another team's scope.
239
+ */
240
+ export declare function ensureStartCodeContext(opts: {
241
+ worktreePath: string;
242
+ slug: string;
243
+ projectSlug: string;
244
+ entry: Pick<TeamEntry, 'displayName' | 'roleguide'> | null;
245
+ }): CodeContextWrite;
246
+ export type RestoreGitIdentity = {
247
+ kind: 'written';
248
+ lines: string[];
249
+ }
250
+ /** `extensions.worktreeConfig` is off or unreadable. Nothing was written anywhere. */
251
+ | {
252
+ kind: 'extension-off';
253
+ lines: string[];
254
+ }
255
+ /** `writeTeamGitIdentity` ran and refused. */
256
+ | {
257
+ kind: 'refused';
258
+ lines: string[];
259
+ };
260
+ /**
261
+ * Write the team's identity into the restored worktree only when
262
+ * `extensions.worktreeConfig` is on (M3, M3b).
263
+ *
264
+ * WHY THE CHECK IS HERE AS WELL AS IN `writeTeamGitIdentity`. That function
265
+ * refuses with the extension off, and its refusal is a paragraph written for
266
+ * provisioning's completion table. `start` prints one line instead, and does
267
+ * not call the writer at all (red-team condition 3).
268
+ *
269
+ * WHO ENABLES THE EXTENSION (#1155 slice 2). `start` runs `ensureMachineSetup`
270
+ * (`lib/machine-setup.ts`) before the restore. It enables the extension only on
271
+ * a clone with no linked worktree other than the main one, and only when the
272
+ * pre-flight passes. So on a fresh clone this function finds it on. It is off
273
+ * here only when the clone already has other worktrees or the pre-flight
274
+ * refused, and then an operator runs the named command once.
275
+ */
276
+ export declare function ensureRestoreGitIdentity(opts: {
277
+ projectRoot: string;
278
+ worktreePath: string;
279
+ slug: string;
280
+ }): RestoreGitIdentity;
281
+ //# sourceMappingURL=team-restore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team-restore.d.ts","sourceRoot":"","sources":["../../src/lib/team-restore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAMH,OAAO,EAAuD,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAmBnG,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAEpD,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD,sGAAsG;AACtG,eAAO,MAAM,mBAAmB,2GAC0E,CAAC;AAgD3G,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,qBAAqB;AAC/B,6DAA6D;AAC3D;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAA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