mandrel 2.65.0 → 2.67.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.
- package/.agents/agents/acceptance-critic.md +7 -7
- package/.agents/agents/auditor.md +17 -18
- package/.agents/agents/plan-critic.md +5 -5
- package/.agents/agents/story-worker.md +5 -5
- package/.agents/docs/agentrc-reference.json +2 -1
- package/.agents/docs/configuration.md +2 -1
- package/.agents/docs/execution-reference.md +27 -5
- package/.agents/docs/workflows.md +4 -2
- package/.agents/instructions.md +12 -13
- package/.agents/rules/ci-remediation.md +3 -3
- package/.agents/rules/gherkin-standards.md +3 -2
- package/.agents/rules/git-conventions-reference.md +17 -8
- package/.agents/rules/git-conventions.md +10 -8
- package/.agents/rules/testing-standards.md +8 -7
- package/.agents/runtime-deps.json +1 -1
- package/.agents/schemas/agentrc.schema.json +6 -1
- package/.agents/scripts/boot-sweep.js +97 -9
- package/.agents/scripts/bootstrap.js +94 -89
- package/.agents/scripts/{git-cleanup.js → clean-git.js} +2 -2
- package/.agents/scripts/clean-temp.js +54 -0
- package/.agents/scripts/clean-worktrees.js +593 -0
- package/.agents/scripts/drain-pending-cleanup.js +5 -4
- package/.agents/scripts/lib/baselines/duplication-scanner.js +17 -7
- package/.agents/scripts/lib/bootstrap/project-bootstrap.js +78 -78
- package/.agents/scripts/lib/clean-temp.js +440 -0
- package/.agents/scripts/lib/cli/standard-args.js +60 -76
- package/.agents/scripts/lib/cli-args.js +26 -0
- package/.agents/scripts/lib/config/gates/shared.js +3 -3
- package/.agents/scripts/lib/config-settings-schema-delivery.js +11 -2
- package/.agents/scripts/lib/feedback-loop/graduate-steps.js +205 -0
- package/.agents/scripts/lib/feedback-loop/graduator-core.js +47 -782
- package/.agents/scripts/lib/feedback-loop/graduator-gh.js +449 -0
- package/.agents/scripts/lib/generated/agentrc-validator.js +1 -1
- package/.agents/scripts/lib/observability/close-telemetry.js +330 -0
- package/.agents/scripts/lib/observability/runtime-friction.js +2 -0
- package/.agents/scripts/lib/observability/signal-validator.js +17 -5
- package/.agents/scripts/lib/observability/source-classifier.js +3 -1
- package/.agents/scripts/lib/orchestration/code-review.js +22 -0
- package/.agents/scripts/lib/orchestration/git-cleanup/phases/cli.js +1 -1
- package/.agents/scripts/lib/orchestration/plan-metrics.js +76 -63
- package/.agents/scripts/lib/orchestration/plan-runner/worktree-sweep.js +149 -97
- package/.agents/scripts/lib/orchestration/review-providers/review-provider-factory.js +23 -0
- package/.agents/scripts/lib/orchestration/run-epilogue.js +6 -0
- package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +2 -0
- package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +349 -263
- package/.agents/scripts/lib/orchestration/single-story-close/phases/options.js +21 -7
- package/.agents/scripts/lib/orchestration/single-story-close/phases/review-override.js +4 -0
- package/.agents/scripts/lib/orchestration/single-story-close/runner.js +327 -314
- package/.agents/scripts/lib/orchestration/ticket-validator.js +19 -36
- package/.agents/scripts/lib/signals/detectors/common.js +63 -51
- package/.agents/scripts/lib/single-story-sweep.js +2 -2
- package/.agents/scripts/lib/temp-removal.js +110 -0
- package/.agents/scripts/lib/temp-retention.js +122 -73
- package/.agents/scripts/lib/transpile.js +28 -3
- package/.agents/scripts/lib/worktree/canonical-path.js +34 -0
- package/.agents/scripts/lib/worktree/lifecycle/reap.js +15 -4
- package/.agents/scripts/single-story-close.js +10 -2
- package/.agents/scripts/single-story-confirm-merge.js +267 -238
- package/.agents/scripts/single-story-init.js +120 -17
- package/.agents/skills/core/idea-refinement/SKILL.md +6 -6
- package/.agents/skills/stack/qa/qa-harness/SKILL.md +1 -2
- package/.agents/workflows/audit-architecture.md +5 -4
- package/.agents/workflows/audit-documentation.md +5 -5
- package/.agents/workflows/audit-performance.md +10 -10
- package/.agents/workflows/{git-cleanup.md → clean-git.md} +10 -10
- package/.agents/workflows/clean-temp.md +67 -0
- package/.agents/workflows/clean-worktrees.md +63 -0
- package/.agents/workflows/git-deliver.md +1 -1
- package/.agents/workflows/helpers/acceptance-self-eval.md +11 -10
- package/.agents/workflows/helpers/audit-lens-core.md +30 -57
- package/.agents/workflows/helpers/deliver-digest.md +2 -2
- package/.agents/workflows/helpers/deliver-reference.md +3 -1
- package/.agents/workflows/helpers/deliver-story-reference.md +2 -2
- package/.agents/workflows/helpers/deliver-story.md +6 -1
- package/.agents/workflows/helpers/parallel-tooling.md +16 -18
- package/.agents/workflows/mandrel-deliver.md +1 -1
- package/.agents/workflows/mandrel-plan.md +6 -5
- package/docs/CHANGELOG.md +39 -0
- package/lib/cli/guarded-sync.js +87 -0
- package/lib/cli/sync-agents.js +9 -92
- package/lib/cli/sync-commands.js +9 -101
- package/package.json +2 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* worktree/canonical-path.js — the on-disk identity of a path, for every
|
|
3
|
+
* worktree identity and containment comparison.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* `realpathSync.native` resolves symlinks (macOS `/var` ↔ `/private/var`) and
|
|
11
|
+
* expands Windows 8.3 short names (`RUNNER~1` ↔ `runneradmin`) — `git
|
|
12
|
+
* worktree list` reports the long form while `os.tmpdir()` / `process.cwd()`
|
|
13
|
+
* may carry the short one. A path that no longer exists canonicalises its
|
|
14
|
+
* nearest existing ancestor and re-appends the rest.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} p
|
|
17
|
+
* @param {{ realpath?: (p: string) => string }} [deps]
|
|
18
|
+
* @returns {string}
|
|
19
|
+
*/
|
|
20
|
+
export function canonicalPath(p, { realpath = fs.realpathSync.native } = {}) {
|
|
21
|
+
const resolved = path.resolve(p);
|
|
22
|
+
const tail = [];
|
|
23
|
+
let current = resolved;
|
|
24
|
+
for (;;) {
|
|
25
|
+
try {
|
|
26
|
+
return path.join(realpath(current), ...tail);
|
|
27
|
+
} catch {
|
|
28
|
+
const parent = path.dirname(current);
|
|
29
|
+
if (parent === current) return resolved;
|
|
30
|
+
tail.unshift(path.basename(current));
|
|
31
|
+
current = parent;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import { rm as fsPromisesRm } from 'node:fs/promises';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { canonicalPath } from '../canonical-path.js';
|
|
10
11
|
import { isInsideWorktree, samePath } from '../inspector.js';
|
|
11
12
|
import { sleepSync } from '../node-modules-strategy.js';
|
|
12
13
|
import { checkMergeReachability } from './merge-reachability.js';
|
|
@@ -441,15 +442,25 @@ function runningCodePaths() {
|
|
|
441
442
|
* The running-code path inside `wtPath`, or `null`. Reaping the tree the
|
|
442
443
|
* running script was loaded from kills the process later, at its first lazy
|
|
443
444
|
* read or dynamic `import()`; refusing only defers the tree to the next sweep.
|
|
445
|
+
* Shared by every reaper (close, the boot worktree sweep, `/clean-worktrees`).
|
|
446
|
+
* Both sides are canonicalised first: a short-name or symlinked spelling of
|
|
447
|
+
* the same tree must still be recognised.
|
|
444
448
|
*
|
|
445
|
-
* @param {
|
|
449
|
+
* @param {{ platform?: string }} ctx
|
|
446
450
|
* @param {string} wtPath
|
|
451
|
+
* @param {string[]} [extraPaths] Further paths to guard (e.g. `process.cwd()`).
|
|
447
452
|
* @returns {string|null}
|
|
448
453
|
*/
|
|
449
|
-
function findRunningCodeInside(ctx, wtPath) {
|
|
454
|
+
export function findRunningCodeInside(ctx, wtPath, extraPaths = []) {
|
|
455
|
+
const guarded = [...runningCodePaths(), ...extraPaths];
|
|
456
|
+
const target = canonicalPath(wtPath);
|
|
450
457
|
return (
|
|
451
|
-
|
|
452
|
-
|
|
458
|
+
guarded.find(
|
|
459
|
+
(p) =>
|
|
460
|
+
typeof p === 'string' &&
|
|
461
|
+
p !== '' &&
|
|
462
|
+
isInsideWorktree(canonicalPath(p), target, ctx.platform),
|
|
463
|
+
) ?? null
|
|
453
464
|
);
|
|
454
465
|
}
|
|
455
466
|
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
* [--merge-watch-mode <sync|async>]
|
|
17
17
|
* [--rerun-advisory <n>]
|
|
18
18
|
* [--override-review-block <reason>]
|
|
19
|
+
* [--worker-tokens <n>]
|
|
19
20
|
*
|
|
21
|
+
* `--worker-tokens <n>` is the story-worker's host-reported token total,
|
|
22
|
+
* recorded best-effort in the close result's `telemetry` (absent or invalid →
|
|
23
|
+
* `null` plus a warning; never a change of status or exit code).
|
|
20
24
|
* `--override-review-block <reason>` is the audited escape past a code-review
|
|
21
25
|
* CRITICAL blocker (instead of a hand-merge with no record).
|
|
22
26
|
* `--merge-watch-mode async` is passed per close by the orchestrator, the only
|
|
@@ -35,7 +39,7 @@ import { parseSprintArgsTolerant } from './lib/cli-args.js';
|
|
|
35
39
|
import { runAsCli } from './lib/cli-utils.js';
|
|
36
40
|
import { formatCliError } from './lib/error-redactor.js';
|
|
37
41
|
import { Logger } from './lib/Logger.js';
|
|
38
|
-
import {
|
|
42
|
+
import { emitCloseTerminalSignals } from './lib/observability/close-telemetry.js';
|
|
39
43
|
import { resolveRunScopedConfig } from './lib/orchestration/run-scoped-config.js';
|
|
40
44
|
import {
|
|
41
45
|
failedTerminalFor,
|
|
@@ -91,7 +95,7 @@ async function main() {
|
|
|
91
95
|
// Mirrors runAsCli's default error line, which this catch pre-empts.
|
|
92
96
|
Logger.error(`[single-story-close] Fatal error: ${formatCliError(err)}`);
|
|
93
97
|
emitTerminalEnvelope(terminal);
|
|
94
|
-
await
|
|
98
|
+
await emitCloseTerminalSignals({ envelope: terminal });
|
|
95
99
|
return exitCodeForTerminal(terminal);
|
|
96
100
|
}
|
|
97
101
|
}
|
|
@@ -130,6 +134,10 @@ runAsCli(import.meta.url, main, {
|
|
|
130
134
|
// forbids that literal outside `phases/auto-merge.js`.
|
|
131
135
|
'Land despite a Story-scope code-review CRITICAL blocker you have reviewed and judged wrong. The reason is mandatory (≥12 chars) and is recorded on the Story, on the PR, and as a `review-block-overridden` friction signal; the terminal envelope reports `gates.codeReview: "overridden"`. Use this instead of merging the PR by hand with the GitHub CLI — a hand-merge bypasses the gate with no record at all.',
|
|
132
136
|
],
|
|
137
|
+
[
|
|
138
|
+
'--worker-tokens <n>',
|
|
139
|
+
'The story-worker’s host-reported total tokens, recorded in the close result’s `telemetry.workerTokens`. Best-effort: an absent or non-integer value records null with a warning and never changes the status or exit code.',
|
|
140
|
+
],
|
|
133
141
|
],
|
|
134
142
|
notes: [
|
|
135
143
|
'Exit codes:\n 0 landed\n 1 blocked or failed\n 3 pending (resumable — run the envelope’s nextCommand)',
|