mandrel 2.82.0 → 2.84.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 (60) hide show
  1. package/.agents/README.md +65 -20
  2. package/.agents/docs/configuration.md +40 -3
  3. package/.agents/docs/runbooks/mods.md +98 -54
  4. package/.agents/docs/workflows.md +14 -0
  5. package/.agents/instructions.md +4 -1
  6. package/.agents/mods/mandrel-status/hooks/register.tsx +579 -204
  7. package/.agents/mods/mandrel-status/types/index.d.ts +58 -13
  8. package/.agents/schemas/agentrc.schema.json +1 -1
  9. package/.agents/scripts/boot-sweep.js +42 -13
  10. package/.agents/scripts/coverage-capture.js +55 -24
  11. package/.agents/scripts/evidence-gate.js +7 -1
  12. package/.agents/scripts/generate-workflows-doc.js +14 -0
  13. package/.agents/scripts/lib/baselines/duplication-scanner.js +26 -2
  14. package/.agents/scripts/lib/bootstrap/agents-md-fold.js +99 -16
  15. package/.agents/scripts/lib/bootstrap/manifest.js +4 -4
  16. package/.agents/scripts/lib/bootstrap/project-bootstrap.js +16 -1
  17. package/.agents/scripts/lib/close-lock-events.js +109 -0
  18. package/.agents/scripts/lib/close-validation/commands.js +12 -0
  19. package/.agents/scripts/lib/close-validation/gates.js +6 -0
  20. package/.agents/scripts/lib/close-validation/process.js +5 -2
  21. package/.agents/scripts/lib/close-validation/runner.js +14 -4
  22. package/.agents/scripts/lib/codex/agents-projection.js +284 -0
  23. package/.agents/scripts/lib/codex/skills-projection.js +291 -0
  24. package/.agents/scripts/lib/config/agentrc-overlay.js +91 -0
  25. package/.agents/scripts/lib/config/sync-agentrc.js +39 -19
  26. package/.agents/scripts/lib/config-resolver.js +5 -42
  27. package/.agents/scripts/lib/config-settings-schema-quality.js +1 -1
  28. package/.agents/scripts/lib/config-settings-schema.js +1 -1
  29. package/.agents/scripts/lib/full-suite-lock.js +20 -0
  30. package/.agents/scripts/lib/full-suite-queue.js +24 -56
  31. package/.agents/scripts/lib/generated/agentrc-validator.js +1 -1
  32. package/.agents/scripts/lib/observability/source-classifier.js +2 -0
  33. package/.agents/scripts/lib/orchestration/review-providers/codex-cli.js +152 -0
  34. package/.agents/scripts/lib/orchestration/review-providers/codex.js +33 -105
  35. package/.agents/scripts/lib/orchestration/review-providers/provider-severity.js +30 -0
  36. package/.agents/scripts/lib/orchestration/review-providers/security-review.js +3 -17
  37. package/.agents/scripts/lib/orchestration/single-story-close/phases/close-validation.js +73 -63
  38. package/.agents/scripts/lib/orchestration/single-story-close/phases/reconcile-done.js +70 -0
  39. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +3 -0
  40. package/.agents/scripts/lib/single-story-sweep/reconcile-closing.js +89 -0
  41. package/.agents/scripts/lib/supervised-suite.js +8 -28
  42. package/.agents/scripts/single-story-init.js +20 -5
  43. package/.agents/scripts/sync-agentrc.js +5 -3
  44. package/.agents/scripts/sync-claude-agents.js +20 -0
  45. package/.agents/scripts/sync-claude-commands.js +64 -27
  46. package/.agents/scripts/sync-codex-agents.js +36 -0
  47. package/.agents/scripts/sync-codex-skills.js +36 -0
  48. package/.agents/workflows/helpers/mandrel-sync-config.md +16 -9
  49. package/.agents/workflows/mandrel-update.md +2 -1
  50. package/README.md +167 -216
  51. package/docs/CHANGELOG.md +25 -0
  52. package/lib/cli/guarded-sync.js +3 -2
  53. package/lib/cli/registry.js +248 -0
  54. package/lib/cli/sync-agents.js +5 -2
  55. package/lib/cli/sync-commands.js +5 -2
  56. package/lib/cli/sync.js +45 -14
  57. package/lib/cli/uninstall.js +8 -1
  58. package/lib/migrations/index.js +2 -0
  59. package/lib/migrations/steps/2.84.0-hoist-system-prompt-block.js +64 -0
  60. package/package.json +3 -2
@@ -167,50 +167,6 @@ function describeHolder({ ownerId, pid, ageSeconds }) {
167
167
  return `holder ${ownerId ?? 'unknown'}, pid ${pid ?? 'unknown'}, lock age ${ageSeconds ?? 'unknown'}s`;
168
168
  }
169
169
 
170
- const HOLDER_RE =
171
- /holder ([^,\s]+), pid (\d+|unknown), lock age (\d+|unknown)s/u;
172
-
173
- /**
174
- * Log lines are the one channel that reaches close from a child capture.
175
- *
176
- * @param {string} line
177
- * @returns {{ waitedSeconds: number, expired: boolean, holder?: LockHolder }|null}
178
- */
179
- export function parseLockWaitOutcome(line) {
180
- const text = String(line ?? '');
181
- const match = /\[full-suite-lock\] (✅|⌛) [^\n]*\(waited (\d+)s[,)]/u.exec(
182
- text,
183
- );
184
- if (!match) return null;
185
- return withHolder(
186
- { waitedSeconds: Number(match[2]), expired: match[1] === '⌛' },
187
- text,
188
- );
189
- }
190
-
191
- /** An expiry line also names the holder it gave up on. */
192
- function withHolder(outcome, text) {
193
- const holder = outcome.expired ? HOLDER_RE.exec(text) : null;
194
- if (!holder) return outcome;
195
- const [, ownerId, pid, ageSeconds] = holder.map(unknownAsNull);
196
- return {
197
- ...outcome,
198
- holder: {
199
- ownerId,
200
- pid: numberOrNull(pid),
201
- ageSeconds: numberOrNull(ageSeconds),
202
- },
203
- };
204
- }
205
-
206
- function unknownAsNull(raw) {
207
- return raw === 'unknown' ? null : raw;
208
- }
209
-
210
- function numberOrNull(raw) {
211
- return raw === null ? null : Number(raw);
212
- }
213
-
214
170
  function holderLabel(lockPath, fsImpl) {
215
171
  return `holding pid ${readLockHolderPid(lockPath, fsImpl) ?? 'unknown'}`;
216
172
  }
@@ -225,17 +181,9 @@ function holderLabel(lockPath, fsImpl) {
225
181
  * @returns {Promise<{ held: object|null, expired: boolean, waited: true, waitedMs: number, holder?: LockHolder }>}
226
182
  */
227
183
  export async function waitInLine(opts) {
228
- const { lockPath, waitMs, fsImpl, nowFn, log } = opts;
229
- const startedAt = nowFn();
230
- const clock = {
231
- deadline: startedAt + Math.max(0, waitMs),
232
- nextReport: startedAt + opts.reportMs,
233
- waitedMs: () => Math.max(0, nowFn() - startedAt),
234
- waited: () => Math.round((nowFn() - startedAt) / 1000),
235
- };
236
- log(
237
- `${LOCK_TAG} ⏳ another full suite is already running on this host (${holderLabel(lockPath, fsImpl)}) — waiting up to ${Math.round(waitMs / 1000)}s for it to finish before spawning.`,
238
- );
184
+ const { lockPath, fsImpl, nowFn } = opts;
185
+ const clock = waitClock(opts);
186
+ announceWait(opts);
239
187
  const ticket = enqueueWaiter({ lockPath, nowFn, fsImpl });
240
188
  try {
241
189
  const outcome = await pollForTurn(opts, ticket, clock);
@@ -244,9 +192,29 @@ export async function waitInLine(opts) {
244
192
  } finally {
245
193
  dequeueWaiter(ticket, { fsImpl });
246
194
  }
195
+ return giveUp(opts, clock);
196
+ }
197
+
198
+ function waitClock({ waitMs, reportMs, nowFn }) {
199
+ const startedAt = nowFn();
200
+ return {
201
+ deadline: startedAt + Math.max(0, waitMs),
202
+ nextReport: startedAt + reportMs,
203
+ waitedMs: () => Math.max(0, nowFn() - startedAt),
204
+ waited: () => Math.round((nowFn() - startedAt) / 1000),
205
+ };
206
+ }
207
+
208
+ function announceWait({ lockPath, waitMs, fsImpl, log }) {
209
+ log(
210
+ `${LOCK_TAG} ⏳ another full suite is already running on this host (${holderLabel(lockPath, fsImpl)}) — waiting up to ${Math.round(waitMs / 1000)}s for it to finish before spawning.`,
211
+ );
212
+ }
213
+
214
+ function giveUp({ lockPath, fsImpl, nowFn, log, rerunCommand }, clock) {
247
215
  const holder = readLockHolder(lockPath, { fsImpl, nowFn });
248
216
  log(
249
- `${LOCK_TAG} ⌛ gave up waiting for the full-suite lock (waited ${clock.waited()}s, ${describeHolder(holder)}) — not spawning, so two full suites never overlap. Re-run once it finishes: ${opts.rerunCommand}`,
217
+ `${LOCK_TAG} ⌛ gave up waiting for the full-suite lock (waited ${clock.waited()}s, ${describeHolder(holder)}) — not spawning, so two full suites never overlap. Re-run once it finishes: ${rerunCommand}`,
250
218
  );
251
219
  return {
252
220
  held: null,