@memnexus-ai/mx-agent-cli 0.1.303 → 0.1.305

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 (159) 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 +59 -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 +132 -17
  43. package/dist/commands/new.d.ts.map +1 -1
  44. package/dist/commands/new.js +426 -74
  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/guarded-read.d.ts +15 -0
  95. package/dist/lib/guarded-read.d.ts.map +1 -0
  96. package/dist/lib/guarded-read.js +73 -0
  97. package/dist/lib/guarded-read.js.map +1 -0
  98. package/dist/lib/machine-setup.d.ts +165 -0
  99. package/dist/lib/machine-setup.d.ts.map +1 -0
  100. package/dist/lib/machine-setup.js +441 -0
  101. package/dist/lib/machine-setup.js.map +1 -0
  102. package/dist/lib/native-realpath.d.ts +70 -0
  103. package/dist/lib/native-realpath.d.ts.map +1 -0
  104. package/dist/lib/native-realpath.js +95 -0
  105. package/dist/lib/native-realpath.js.map +1 -0
  106. package/dist/lib/project-config.d.ts +2 -6
  107. package/dist/lib/project-config.d.ts.map +1 -1
  108. package/dist/lib/project-config.js.map +1 -1
  109. package/dist/lib/project-name.d.ts +15 -0
  110. package/dist/lib/project-name.d.ts.map +1 -0
  111. package/dist/lib/project-name.js +22 -0
  112. package/dist/lib/project-name.js.map +1 -0
  113. package/dist/lib/push-to.d.ts +113 -0
  114. package/dist/lib/push-to.d.ts.map +1 -0
  115. package/dist/lib/push-to.js +240 -0
  116. package/dist/lib/push-to.js.map +1 -0
  117. package/dist/lib/runtime/claude-gateway-routing.d.ts +161 -0
  118. package/dist/lib/runtime/claude-gateway-routing.d.ts.map +1 -0
  119. package/dist/lib/runtime/claude-gateway-routing.js +466 -0
  120. package/dist/lib/runtime/claude-gateway-routing.js.map +1 -0
  121. package/dist/lib/runtime/codex-adapter.d.ts +91 -5
  122. package/dist/lib/runtime/codex-adapter.d.ts.map +1 -1
  123. package/dist/lib/runtime/codex-adapter.js +204 -44
  124. package/dist/lib/runtime/codex-adapter.js.map +1 -1
  125. package/dist/lib/runtime/codex-config.d.ts +6 -12
  126. package/dist/lib/runtime/codex-config.d.ts.map +1 -1
  127. package/dist/lib/runtime/codex-config.js +17 -24
  128. package/dist/lib/runtime/codex-config.js.map +1 -1
  129. package/dist/lib/runtime/codex-guard-proof.d.ts +4 -7
  130. package/dist/lib/runtime/codex-guard-proof.d.ts.map +1 -1
  131. package/dist/lib/runtime/codex-guard-proof.js +16 -14
  132. package/dist/lib/runtime/codex-guard-proof.js.map +1 -1
  133. package/dist/lib/runtime/codex-hooks-list.d.ts +20 -0
  134. package/dist/lib/runtime/codex-hooks-list.d.ts.map +1 -1
  135. package/dist/lib/runtime/codex-hooks-list.js +20 -8
  136. package/dist/lib/runtime/codex-hooks-list.js.map +1 -1
  137. package/dist/lib/runtime/types.d.ts +1 -1
  138. package/dist/lib/runtime/types.d.ts.map +1 -1
  139. package/dist/lib/standards.d.ts +3 -0
  140. package/dist/lib/standards.d.ts.map +1 -1
  141. package/dist/lib/standards.js +1 -0
  142. package/dist/lib/standards.js.map +1 -1
  143. package/dist/lib/team-identity.d.ts.map +1 -1
  144. package/dist/lib/team-identity.js +18 -53
  145. package/dist/lib/team-identity.js.map +1 -1
  146. package/dist/lib/team-restore.d.ts +281 -0
  147. package/dist/lib/team-restore.d.ts.map +1 -0
  148. package/dist/lib/team-restore.js +533 -0
  149. package/dist/lib/team-restore.js.map +1 -0
  150. package/dist/lib/window-view.d.ts +5 -0
  151. package/dist/lib/window-view.d.ts.map +1 -1
  152. package/dist/lib/window-view.js +67 -6
  153. package/dist/lib/window-view.js.map +1 -1
  154. package/dist/lib/worktree-sync.d.ts +139 -11
  155. package/dist/lib/worktree-sync.d.ts.map +1 -1
  156. package/dist/lib/worktree-sync.js +327 -46
  157. package/dist/lib/worktree-sync.js.map +1 -1
  158. package/dist/standards/merge-gates.md +26 -0
  159. package/package.json +2 -2
@@ -0,0 +1,533 @@
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 { spawnSync } from 'child_process';
59
+ import { existsSync, lstatSync } from 'fs';
60
+ import { basename, join } from 'path';
61
+ import { getTeamWithStatus, getTeamsCatalogDir, TEAM_SLUG_RE } from './catalog.js';
62
+ import { CodeContextFileError, CODE_CONTEXT_FILENAME, writeCodeContextFile } from './code-context-file.js';
63
+ import { checkWorktreeConfigPreflight, describePreflight, readWorktreeConfigExtension, teamGitEmail, writeTeamGitIdentity, } from './git-identity.js';
64
+ import { teamMemorySpecs } from './memory.js';
65
+ import { assignSlot, findTeamWorktree, findWorktreePath, generateWorktreeDirName, hasOriginRemote, repairSiblingWorktreeLinks, } from './worktree.js';
66
+ /** The `start` flag that lets a restore reuse a branch that already exists. */
67
+ export const RESUME_BRANCH_FLAG = '--resume-branch';
68
+ /** The command a refusal names for a team that is not in the catalog. */
69
+ export const NEW_TEAM_COMMAND = 'mx-agent new team';
70
+ /** The start of the line `start` prints when the pre-push check cannot run in a restored worktree. */
71
+ export 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';
72
+ /**
73
+ * The base-branch shape this module passes to git. The value is project
74
+ * config, not operator input, but it reaches a refspec and a revision, so a
75
+ * leading dash, a space or a `:` is refused rather than quoted.
76
+ */
77
+ const BASE_BRANCH_RE = /^(?!-)[A-Za-z0-9._/-]{1,200}$/;
78
+ // ── Output hygiene (the pattern at `commands/start.ts:780-800`) ──────────────
79
+ /** Strip control characters and cap the length, so a value cannot forge terminal output. */
80
+ function safe(s) {
81
+ return (s ?? 'unknown').replace(/[\x00-\x1f\x7f]/g, '?').slice(0, 300);
82
+ }
83
+ /** Single-quote a value that lands inside a command an operator may paste into a shell. */
84
+ function shq(s) {
85
+ return `'${s.replace(/'/g, "'\\''")}'`;
86
+ }
87
+ /** One git call with piped output. Never throws. */
88
+ function git(args, cwd) {
89
+ const r = spawnSync('git', args, { cwd, encoding: 'utf-8', stdio: 'pipe' });
90
+ return {
91
+ ok: !r.error && r.status === 0,
92
+ out: String(r.stdout ?? '').trim(),
93
+ err: String(r.stderr ?? '').trim() || (r.error ? r.error.message : ''),
94
+ };
95
+ }
96
+ /** Whether a fully qualified ref exists. `show-ref --verify` reads it literally. */
97
+ function refPresent(fullRef, cwd) {
98
+ return git(['show-ref', '--verify', '--quiet', fullRef], cwd).ok;
99
+ }
100
+ /** True when something, including a dangling symlink, is at `path`. */
101
+ function pathOccupied(path) {
102
+ try {
103
+ lstatSync(path);
104
+ return true;
105
+ }
106
+ catch {
107
+ return false;
108
+ }
109
+ }
110
+ /**
111
+ * Whether a catalog entry's `Status:` lines let `start` restore it (#1155
112
+ * red-team finding 5).
113
+ *
114
+ * Restorable: no `Status:` line in the header, or exactly one whose whole value
115
+ * is `active` (trimmed, any case). Everything else is not: `retired`,
116
+ * `dormant`, `retired.`, `archived`, `**active**`, two `Status:` lines.
117
+ *
118
+ * WHY NOT `TeamEntry.status`. That field follows the roster check, which reads
119
+ * the first token and treats any near-miss as active, because for a roster the
120
+ * safe mistake is to keep a team. A restore creates a worktree and a branch, so
121
+ * here the safe mistake is to refuse, and only the two exact forms pass.
122
+ */
123
+ export function restorableStatus(entry) {
124
+ const values = entry.statusValues ?? [];
125
+ if (values.length === 0)
126
+ return { ok: true };
127
+ if (values.length === 1 && values[0].trim().toLowerCase() === 'active')
128
+ return { ok: true };
129
+ if (values.length > 1) {
130
+ return { ok: false, why: `its catalog entry holds ${values.length} Status: lines, so start does not restore it` };
131
+ }
132
+ return {
133
+ ok: false,
134
+ why: `its catalog entry reads "Status: ${safe(values[0]).slice(0, 80)}", and start restores only an entry with no Status: line or Status: active`,
135
+ };
136
+ }
137
+ /**
138
+ * The two lines every "team not found" message ends with: where restorable
139
+ * teams come from, and the command that creates a new one. `start`'s refusal
140
+ * and `mx-agent status` print the same pair (#1155 red-team finding 7).
141
+ */
142
+ export function catalogPointerLines(projectRoot, teamsDir) {
143
+ return [
144
+ `start restores a team's worktree from its active entry in the team catalog: ${safe(getTeamsCatalogDir(projectRoot, teamsDir))}/<slug>.md`,
145
+ `To create a new team: ${NEW_TEAM_COMMAND}`,
146
+ ];
147
+ }
148
+ /**
149
+ * Where `start <slug>` runs, or that it must restore, or that it must refuse.
150
+ *
151
+ * ONLY A RESTORABLE ENTRY IS RESTORED (`restorableStatus`): no `Status:` line,
152
+ * or `Status: active` exactly. The values come from `TeamEntry.statusValues`
153
+ * (`lib/catalog.ts`, `catalogStatusValues`).
154
+ *
155
+ * WHY THE PREFIX LOOKUP IS NOT CONSULTED FOR AN ACTIVE TEAM. `findWorktreePath`
156
+ * matches any entry starting `<slug>-`, so for `team` it returns
157
+ * `team-builder-20260101`, another team's worktree. For a team the catalog
158
+ * names, `findTeamWorktree` decides: its own worktree, or a restore (M1, M9).
159
+ * A slug with no restorable entry keeps the prefix lookup, because a
160
+ * same-machine team without a catalog file still has to start.
161
+ */
162
+ export function decideStartWorktree(opts) {
163
+ const { projectRoot, slug, worktreeDir, teamsDir } = opts;
164
+ // An invalid slug never reaches a path join or a catalog read.
165
+ const read = TEAM_SLUG_RE.test(slug)
166
+ ? getTeamWithStatus(projectRoot, slug, teamsDir)
167
+ : { kind: 'absent' };
168
+ const status = read.kind === 'ok' ? restorableStatus(read.entry) : null;
169
+ if (read.kind === 'ok' && status?.ok === true) {
170
+ const own = findTeamWorktree(projectRoot, slug, worktreeDir);
171
+ return own ? { kind: 'existing', path: own } : { kind: 'restore', entry: read.entry };
172
+ }
173
+ const legacy = findWorktreePath(projectRoot, slug, worktreeDir);
174
+ if (legacy)
175
+ return { kind: 'existing', path: legacy };
176
+ let why;
177
+ if (!TEAM_SLUG_RE.test(slug)) {
178
+ why = 'it is not a team slug (lowercase letters, digits and hyphens, 2 to 50 characters)';
179
+ }
180
+ else if (read.kind === 'absent') {
181
+ why = 'the team catalog has no entry for it';
182
+ }
183
+ else if (read.kind === 'refused') {
184
+ why = `its catalog entry was not read: ${safe(read.reason)}`;
185
+ }
186
+ else {
187
+ why = status && status.ok === false ? status.why : 'its catalog entry is not restorable';
188
+ }
189
+ const shownSlug = safe(slug).slice(0, 80);
190
+ return {
191
+ kind: 'refused',
192
+ lines: [
193
+ `Team '${shownSlug}' not found.`,
194
+ ` No worktree in ${safe(join(projectRoot, worktreeDir))}/ matches '${shownSlug}' or '${shownSlug}-*', and ${why}.`,
195
+ ...catalogPointerLines(projectRoot, teamsDir).map((l) => ` ${l}`),
196
+ ],
197
+ };
198
+ }
199
+ /**
200
+ * Every `worktree/<slug>-YYYYMMDD` branch, local or on origin's remote-tracking
201
+ * refs, sorted by name (#1155 red-team finding 1).
202
+ *
203
+ * Any date, not only today's: a team whose worktree was made on another day
204
+ * has its work on a branch with that day's name, and a restore that checked
205
+ * only today's name would start the team on a fresh branch beside it without a
206
+ * word. The exact shape is matched, so `worktree/team-builder-*` is not a
207
+ * branch of `team`. Reads local refs only; the caller fetches first.
208
+ */
209
+ export function listTeamBranches(projectRoot, slug) {
210
+ if (!TEAM_SLUG_RE.test(slug))
211
+ return [];
212
+ const r = git(['for-each-ref', '--format=%(refname)', 'refs/heads/worktree/', 'refs/remotes/origin/worktree/'], projectRoot);
213
+ if (!r.ok)
214
+ return [];
215
+ const shape = new RegExp(`^refs/(heads|remotes/origin)/(worktree/${slug}-\\d{8})$`);
216
+ const found = new Map();
217
+ for (const ref of r.out.split('\n')) {
218
+ const m = shape.exec(ref.trim());
219
+ if (!m)
220
+ continue;
221
+ const b = found.get(m[2]) ?? { name: m[2], local: false, remote: false };
222
+ if (m[1] === 'heads')
223
+ b.local = true;
224
+ else
225
+ b.remote = true;
226
+ found.set(m[2], b);
227
+ }
228
+ return [...found.values()].sort((a, b) => a.name.localeCompare(b.name));
229
+ }
230
+ /** `name (local)`, `name (origin)`, or `name (local and origin)`. */
231
+ function describeBranch(b) {
232
+ return `${b.name} (${b.local && b.remote ? 'local and origin' : b.local ? 'local' : 'origin'})`;
233
+ }
234
+ /**
235
+ * Create the team's worktree on a new branch from a freshly fetched
236
+ * `origin/<base>`, or on its existing branch with `--resume-branch`, then write
237
+ * its scope file and, when it can, its identity.
238
+ *
239
+ * Every refusal comes before the first write except a failed `git worktree
240
+ * add`, which follows the slot write. `assignSlot` is idempotent by name
241
+ * (`lib/worktree.ts:111-113`), so a retry is handed the same slot.
242
+ */
243
+ export function restoreTeamWorktree(opts) {
244
+ const { projectRoot, slug, entry, worktreeDir, baseBranch, projectSlug, resumeBranch } = opts;
245
+ const refuse = (...lines) => ({
246
+ kind: 'refused',
247
+ lines: [`Could not restore the worktree for team '${safe(slug).slice(0, 80)}'.`, ...lines.map((l) => ` ${l}`)],
248
+ });
249
+ if (!TEAM_SLUG_RE.test(slug))
250
+ return refuse('The team slug is not valid, so nothing was written.');
251
+ if (!BASE_BRANCH_RE.test(baseBranch)) {
252
+ return refuse(`The configured base branch ${JSON.stringify(safe(baseBranch).slice(0, 80))} is not a branch name this command passes to git, so nothing was written.`);
253
+ }
254
+ // A restore builds on the base branch as `origin` holds it now. A project
255
+ // with no `origin` has nothing to restore from, and the local base branch is
256
+ // not a substitute: it can be any age (M11).
257
+ if (!hasOriginRemote(projectRoot)) {
258
+ return refuse(`This project has no remote named origin, so there is no origin/${baseBranch} to restore from. Nothing was written.`);
259
+ }
260
+ // M10 and M13. Fetched by this run: the base, so the new branch's base is not
261
+ // a ref of unknown age, and every `worktree/<slug>-*` branch on origin, so a
262
+ // branch pushed from another machine is seen. Explicit refspecs, so the
263
+ // clone's fetch configuration does not matter. `--prune` drops a
264
+ // remote-tracking ref in these two namespaces only when origin no longer has
265
+ // the branch, so a deleted branch is not offered for resuming. The slug was
266
+ // validated above and holds no glob or refspec character.
267
+ const fetch = git([
268
+ 'fetch', '--prune', 'origin',
269
+ `+refs/heads/${baseBranch}:refs/remotes/origin/${baseBranch}`,
270
+ `+refs/heads/worktree/${slug}-*:refs/remotes/origin/worktree/${slug}-*`,
271
+ ], projectRoot);
272
+ if (!fetch.ok) {
273
+ return refuse(`git fetch origin ${baseBranch} failed, so origin/${baseBranch} and this team's branches on origin could be stale. A restore builds only on refs this run fetched. Nothing was written.`, `git said: ${safe(fetch.err.split('\n').pop())}`);
274
+ }
275
+ const base = git(['rev-parse', '--verify', '--quiet', '--end-of-options', `refs/remotes/origin/${baseBranch}^{commit}`], projectRoot);
276
+ if (!base.ok || !base.out) {
277
+ return refuse(`origin/${baseBranch} does not resolve to a commit after the fetch. Nothing was written.`);
278
+ }
279
+ const baseSha = base.out;
280
+ // M2, M2b, M13, M13c. Product's R1 rule on #1155: a NEW branch from
281
+ // origin/<base> by default, `--resume-branch` to opt in, no auto-resume.
282
+ // Without the flag, only today's name can collide, and that refuses: the
283
+ // branch holds commits somebody made today, and `git worktree add -b` would
284
+ // fail on it anyway. Every other `worktree/<slug>-<date>` branch is listed as
285
+ // information with the command that resumes it, and the start continues, so
286
+ // a clone of a repository whose origin keeps old team branches still starts
287
+ // (red-team re-check on #1169, caveat 1).
288
+ const lines = [];
289
+ const branches = listTeamBranches(projectRoot, slug);
290
+ const todayDir = generateWorktreeDirName(slug);
291
+ const todayBranch = `worktree/${todayDir}`;
292
+ const named = typeof resumeBranch === 'string'
293
+ ? (resumeBranch.startsWith('worktree/') ? resumeBranch : `worktree/${resumeBranch}`)
294
+ : null;
295
+ let chosen = null;
296
+ if (resumeBranch === false) {
297
+ const collision = branches.find((b) => b.name === todayBranch);
298
+ if (collision) {
299
+ return refuse(`Branch ${describeBranch(collision)} already exists. start creates a NEW branch for a restore and will not reuse one silently. Nothing was written.`, `To restore onto it and keep its commits: mx-agent start ${slug} ${RESUME_BRANCH_FLAG} ${todayBranch}`);
300
+ }
301
+ for (const b of branches) {
302
+ lines.push(`This team also has branch ${describeBranch(b)}. To restore onto it instead: mx-agent start ${slug} ${RESUME_BRANCH_FLAG} ${b.name}`);
303
+ }
304
+ }
305
+ else if (branches.length === 0) {
306
+ if (named !== null) {
307
+ return refuse(`${RESUME_BRANCH_FLAG} names ${JSON.stringify(safe(named).slice(0, 80))}, and this team has no worktree/${slug}-YYYYMMDD branch locally or on origin. Nothing was written.`);
308
+ }
309
+ }
310
+ else if (named === null) {
311
+ if (branches.length > 1) {
312
+ return refuse(`This team has ${branches.length} branches: ${branches.map(describeBranch).join(', ')}. ${RESUME_BRANCH_FLAG} without a name cannot choose. Nothing was written.`, ...branches.map((b) => `To restore onto ${b.name}: mx-agent start ${slug} ${RESUME_BRANCH_FLAG} ${b.name}`));
313
+ }
314
+ chosen = branches[0];
315
+ }
316
+ else {
317
+ chosen = branches.find((b) => b.name === named) ?? null;
318
+ if (chosen === null) {
319
+ return refuse(`${RESUME_BRANCH_FLAG} names ${JSON.stringify(safe(named).slice(0, 80))}, which is not one of this team's branches: ${branches.map(describeBranch).join(', ')}. Nothing was written.`);
320
+ }
321
+ }
322
+ // A resumed branch keeps its own date in the directory name; a new one gets
323
+ // today's. One date for both names, so they cannot straddle midnight.
324
+ const dirName = chosen ? chosen.name.slice('worktree/'.length) : todayDir;
325
+ const branch = chosen ? chosen.name : todayBranch;
326
+ const worktreePath = join(projectRoot, worktreeDir, dirName);
327
+ // `decideStartWorktree` found no worktree of this team, so anything at this
328
+ // path is not one. `git worktree add` would fail on it after the slot write.
329
+ if (pathOccupied(worktreePath)) {
330
+ return refuse(`${safe(worktreePath)} already exists and is not a git worktree. Nothing was written.`, 'Move it aside, then run start again.');
331
+ }
332
+ // M7.
333
+ let slot;
334
+ try {
335
+ slot = assignSlot(projectRoot, slug, worktreeDir);
336
+ }
337
+ catch (err) {
338
+ return refuse(`Slot allocation failed: ${safe(err instanceof Error ? err.message : String(err))}. Nothing else was written.`);
339
+ }
340
+ // M14. A worktree whose directory was deleted is still registered, and git
341
+ // refuses to add a worktree at its path or on its branch until the entry is
342
+ // pruned (red-team finding 4). Siblings are repaired first, as
343
+ // `createGitWorktree` does (`lib/worktree.ts:340-362`): a sibling whose
344
+ // `.git` link points at a host path is otherwise pruned too, and a pruned
345
+ // entry has no automated recovery (#4485).
346
+ const sweep = repairSiblingWorktreeLinks(projectRoot, join(projectRoot, worktreeDir), { skipName: dirName });
347
+ for (const name of sweep.repaired)
348
+ lines.push(`Repaired broken git link for worktree '${safe(name)}'`);
349
+ for (const r of sweep.refusals) {
350
+ lines.push(`Worktree '${safe(r.name)}' has a broken git link that was NOT repaired (${r.status}). Run mx-agent start for that team for details.`);
351
+ }
352
+ if (sweep.skipped.length > 0)
353
+ lines.push(`Worktree link repair budget exhausted; skipped ${sweep.skipped.length} worktree(s).`);
354
+ // M18. Prune only when every sibling link is healthy or was repaired. A
355
+ // refused or skipped sibling still has a broken link, and prune would drop
356
+ // its admin entry, which has no automated recovery (#4485; red-team re-check
357
+ // on #1169, caveat 2). A worktree registered at this restore's own path then
358
+ // stays registered, and `git worktree add` says so below.
359
+ const unsettled = [...sweep.refusals.map((r) => r.name), ...sweep.skipped];
360
+ if (unsettled.length > 0) {
361
+ lines.push(`git worktree prune skipped: ${unsettled.length} sibling worktree link(s) are broken and were not repaired or checked `
362
+ + `(${unsettled.map((n) => safe(n).slice(0, 80)).join(', ')}), and prune would drop their entries.`);
363
+ }
364
+ else {
365
+ git(['worktree', 'prune'], projectRoot);
366
+ }
367
+ // M11 and M17. `origin/<base>`, never the local base branch, and always by
368
+ // its full ref name: a tag or a local branch named `origin/main` makes the
369
+ // short form ambiguous, and git refuses after the slot is written (security
370
+ // review on #1169, comment 6959797489, Should Fix). The full remote-tracking
371
+ // name still sets up tracking, as `createGitWorktree`'s short form does.
372
+ let addArgs;
373
+ if (chosen?.local) {
374
+ addArgs = ['worktree', 'add', worktreePath, branch];
375
+ }
376
+ else if (chosen) {
377
+ // Only on origin: a local branch tracking it.
378
+ addArgs = ['worktree', 'add', '--track', '-b', branch, worktreePath, `refs/remotes/origin/${branch}`];
379
+ }
380
+ else {
381
+ addArgs = ['worktree', 'add', '-b', branch, worktreePath, `refs/remotes/origin/${baseBranch}`];
382
+ }
383
+ const add = git(addArgs, projectRoot);
384
+ if (!add.ok) {
385
+ return refuse(...lines, `git worktree add failed. Slot ${slot} is assigned to ${slug} in ${safe(join(projectRoot, worktreeDir))}/.slots.json and is reused on the next try.`, `git said: ${safe(add.err.split('\n').pop())}`);
386
+ }
387
+ const head = git(['rev-parse', 'HEAD'], worktreePath);
388
+ const reusedBranch = chosen !== null;
389
+ lines.push(`Restored worktree ${worktreePath} on ${reusedBranch ? 'existing' : 'new'} branch ${branch}${reusedBranch ? '' : ` from origin/${baseBranch} (${baseSha.slice(0, 7)})`}, slot ${slot}.`);
390
+ // M4a.
391
+ lines.push(...describeCodeContextWrite(writeCodeContextIfAbsent(worktreePath, codeContextFor(slug, entry, projectSlug))));
392
+ // M3 and M3b.
393
+ lines.push(...ensureRestoreGitIdentity({ projectRoot, worktreePath, slug }).lines);
394
+ // Per-worktree CLI build: dropped from the restore (plan item 6). The build
395
+ // exists only for `.githooks/pre-push`, and that hook runs only when
396
+ // `core.hooksPath` names it (red-team finding 6). Both are named, neither is
397
+ // done: `core.hooksPath` is shared config (slice 3).
398
+ const preLine = prePushLine(projectRoot, worktreePath);
399
+ if (preLine)
400
+ lines.push(preLine);
401
+ return {
402
+ kind: 'restored',
403
+ worktreePath,
404
+ branch,
405
+ slot,
406
+ headSha: head.ok ? head.out : '',
407
+ baseSha,
408
+ reusedBranch,
409
+ lines,
410
+ };
411
+ }
412
+ /**
413
+ * The one line naming what the pre-push check needs in this worktree, or null.
414
+ *
415
+ * Printed when the worktree holds the CLI source and `.githooks/pre-push`, and
416
+ * either `core.hooksPath` is not `.githooks` or the CLI is not built. Nothing is
417
+ * set or built here.
418
+ */
419
+ export function prePushLine(projectRoot, worktreePath) {
420
+ const cliDir = join(worktreePath, 'mx-agent-system', 'cli');
421
+ if (!existsSync(join(cliDir, 'package.json')) || !existsSync(join(worktreePath, '.githooks', 'pre-push')))
422
+ return null;
423
+ const hooksPath = git(['config', '--get', 'core.hooksPath'], worktreePath);
424
+ const hooked = hooksPath.ok && hooksPath.out === '.githooks';
425
+ const built = existsSync(join(cliDir, 'dist', 'index.js'));
426
+ if (hooked && built)
427
+ return null;
428
+ return `${PRE_PUSH_BUILD_LINE}: git -C ${shq(projectRoot)} config core.hooksPath .githooks (shared by every worktree of this repository)`
429
+ + ` and cd ${shq(cliDir)} && npm ci && npm run build`;
430
+ }
431
+ // ── 3. The scope file ────────────────────────────────────────────────────────
432
+ /**
433
+ * The four `.mx-code-context.json` values for a team, from the same helper
434
+ * provisioning uses (`teamMemorySpecs`, `lib/memory.ts`; `commands/create.ts`
435
+ * step 6a passes `nameCheckSpecs[0].codeContext`). The scope does not depend on
436
+ * the display name or the roleguide, which only feed the seeded memory text.
437
+ */
438
+ export function codeContextFor(slug, entry, projectSlug) {
439
+ return teamMemorySpecs(slug, entry?.displayName ?? slug, entry?.roleguide ?? '', projectSlug)[0].codeContext;
440
+ }
441
+ /**
442
+ * Write `.mx-code-context.json` unless something is already at the path.
443
+ *
444
+ * THE GUARD IS THE NEVER-OVERWRITE RULE (M5). `writeCodeContextFile` refuses a
445
+ * non-regular file but overwrites a regular one, and a file a person or an
446
+ * earlier provisioning run wrote is theirs. `lstat`, so a symlink, dangling or
447
+ * not, counts as present and is not followed.
448
+ */
449
+ export function writeCodeContextIfAbsent(worktreePath, values) {
450
+ const path = join(worktreePath, CODE_CONTEXT_FILENAME);
451
+ if (pathOccupied(path))
452
+ return { kind: 'present', path };
453
+ try {
454
+ return { kind: 'written', path: writeCodeContextFile(worktreePath, values) };
455
+ }
456
+ catch (err) {
457
+ const why = err instanceof CodeContextFileError ? err.message : `the write failed: ${err instanceof Error ? err.message : String(err)}`;
458
+ return { kind: 'failed', path, why: safe(why) };
459
+ }
460
+ }
461
+ /** The line, if any, `start` prints for a scope-file outcome. */
462
+ export function describeCodeContextWrite(w) {
463
+ switch (w.kind) {
464
+ case 'written':
465
+ return [`Scope file written: ${safe(w.path)}`];
466
+ case 'failed':
467
+ return [`Scope file NOT written: ${w.why}`];
468
+ default:
469
+ return [];
470
+ }
471
+ }
472
+ /**
473
+ * On any start, write the scope file when the worktree lacks it (M4b, #66).
474
+ *
475
+ * Only into the team's own worktree: a directory named `<slug>` or
476
+ * `<slug>-YYYYMMDD`, the two names `findTeamWorktree` accepts. A slug with no
477
+ * catalog entry still resolves through the prefix lookup, so `start team` can
478
+ * land in `team-builder-20260101`, and writing `team: team` there would label
479
+ * another team's memories. The plan does not name this case; the narrower rule
480
+ * is the one that cannot write another team's scope.
481
+ */
482
+ export function ensureStartCodeContext(opts) {
483
+ const { worktreePath, slug, projectSlug, entry } = opts;
484
+ const path = join(worktreePath, CODE_CONTEXT_FILENAME);
485
+ if (!TEAM_SLUG_RE.test(slug))
486
+ return { kind: 'skipped', path, why: 'the team slug is not valid' };
487
+ const own = new RegExp(`^${slug}(-\\d{8})?$`);
488
+ if (!own.test(basename(worktreePath))) {
489
+ return { kind: 'skipped', path, why: `the worktree directory is not named ${slug} or ${slug}-YYYYMMDD` };
490
+ }
491
+ return writeCodeContextIfAbsent(worktreePath, codeContextFor(slug, entry, projectSlug));
492
+ }
493
+ /**
494
+ * Write the team's identity into the restored worktree only when
495
+ * `extensions.worktreeConfig` is on (M3, M3b).
496
+ *
497
+ * WHY THE CHECK IS HERE AS WELL AS IN `writeTeamGitIdentity`. That function
498
+ * refuses with the extension off, and its refusal is a paragraph written for
499
+ * provisioning's completion table. `start` prints one line instead, and does
500
+ * not call the writer at all (red-team condition 3).
501
+ *
502
+ * WHO ENABLES THE EXTENSION (#1155 slice 2). `start` runs `ensureMachineSetup`
503
+ * (`lib/machine-setup.ts`) before the restore. It enables the extension only on
504
+ * a clone with no linked worktree other than the main one, and only when the
505
+ * pre-flight passes. So on a fresh clone this function finds it on. It is off
506
+ * here only when the clone already has other worktrees or the pre-flight
507
+ * refused, and then an operator runs the named command once.
508
+ */
509
+ export function ensureRestoreGitIdentity(opts) {
510
+ const { projectRoot, worktreePath, slug } = opts;
511
+ const extension = readWorktreeConfigExtension(worktreePath);
512
+ if (extension !== true) {
513
+ const preflight = checkWorktreeConfigPreflight(projectRoot);
514
+ const enable = preflight.safe
515
+ ? `git -C ${shq(projectRoot)} config extensions.worktreeConfig true`
516
+ : `a migration first (git-worktree(1), CONFIGURATION FILE; ${safe(describePreflight(preflight))})`;
517
+ return {
518
+ kind: 'extension-off',
519
+ lines: [
520
+ `Per-team git identity not written: extensions.worktreeConfig is ${extension === null ? 'unreadable' : 'off'} in this repository. `
521
+ + 'start enables it only on a clone with no other worktrees and a passing pre-flight, and this clone is not one. '
522
+ + `One-time fix an operator runs: ${enable}, then git -C ${shq(worktreePath)} config --worktree user.name ${slug} && `
523
+ + `git -C ${shq(worktreePath)} config --worktree user.email ${teamGitEmail(slug)}`,
524
+ ],
525
+ };
526
+ }
527
+ const outcome = writeTeamGitIdentity({ worktreePath, slug });
528
+ if (outcome.kind === 'written') {
529
+ return { kind: 'written', lines: [`Git identity for this worktree: ${outcome.name} <${outcome.email}>`] };
530
+ }
531
+ return { kind: 'refused', lines: [`Per-team git identity NOT written: ${safe(outcome.detail)}`] };
532
+ }
533
+ //# sourceMappingURL=team-restore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team-restore.js","sourceRoot":"","sources":["../../src/lib/team-restore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,EAAkB,MAAM,cAAc,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,EACL,4BAA4B,EAC5B,iBAAiB,EACjB,2BAA2B,EAC3B,YAAY,EACZ,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AAEvB,+EAA+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,i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SAAS,EAAE,KAAK,EAAE,CAAC,sCAAsC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;AACpG,CAAC"}
@@ -17,6 +17,11 @@ export interface TeamHead {
17
17
  /** Status marker. Same glyph the terminal prints. */
18
18
  mark: string;
19
19
  markTone: Tone;
20
+ /**
21
+ * Why the mark reads `?` or `○`. Absent when the mark is a status. Optional,
22
+ * so a renderer that does not read it keeps working.
23
+ */
24
+ markNote?: string;
20
25
  /** True when this team should outrank the quiet ones. */
21
26
  needsPerson: boolean;
22
27
  /** The four questions, in the order `docs/legibility-plan.md` asks them. */
@@ -1 +1 @@
1
- {"version":3,"file":"window-view.d.ts","sourceRoot":"","sources":["../../src/lib/window-view.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAe,aAAa,EAAmB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGjG;;;GAGG;AACH,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAoC1D,kFAAkF;AAClF,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,IAAI,CAAC;IACf,yDAAyD;IACzD,WAAW,EAAE,OAAO,CAAC;IACrB,4EAA4E;IAC5E,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,uEAAuE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