mandrel 2.123.0 → 2.125.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/README.md +1 -1
- package/.agents/docs/agentrc-reference.json +2 -0
- package/.agents/docs/configuration.md +6 -3
- package/.agents/docs/runbooks/dispatch-board.md +174 -0
- package/.agents/docs/runbooks/dispatch.md +219 -0
- package/.agents/docs/runbooks/session-titles.md +52 -0
- package/.agents/runtime-deps.json +2 -2
- package/.agents/schemas/agentrc.schema.json +85 -3
- package/.agents/schemas/audit-rules.schema.json +1 -1
- package/.agents/schemas/story-deliver-terminal.schema.json +7 -2
- package/.agents/scripts/acceptance-eval.js +11 -2
- package/.agents/scripts/check-doc-links.js +4 -4
- package/.agents/scripts/dispatch.js +400 -0
- package/.agents/scripts/lib/audit-baselines/surface-entry.js +2 -2
- package/.agents/scripts/lib/audit-exceptions/globs.js +2 -2
- package/.agents/scripts/lib/audit-exceptions/scope.js +2 -2
- package/.agents/scripts/lib/audit-suite/selector.js +3 -3
- package/.agents/scripts/lib/baselines/bundle-size-scorer.js +3 -3
- package/.agents/scripts/lib/baselines/components.js +2 -2
- package/.agents/scripts/lib/baselines/kinds/_crap-new-method-gate.js +2 -2
- package/.agents/scripts/lib/bdd-runner-detect.js +3 -4
- package/.agents/scripts/lib/child-detached.js +48 -0
- package/.agents/scripts/lib/child-exec.js +11 -0
- package/.agents/scripts/lib/close-validation/base-sync-revalidation.js +2 -2
- package/.agents/scripts/lib/config/delivery-routing.js +15 -12
- package/.agents/scripts/lib/config/gates/coverage.schema.js +1 -1
- package/.agents/scripts/lib/config/handoff.js +21 -6
- package/.agents/scripts/lib/config/temp-paths.js +26 -0
- package/.agents/scripts/lib/config-settings-schema-delivery.js +64 -10
- package/.agents/scripts/lib/config-settings-schema-quality.js +1 -1
- package/.agents/scripts/lib/coverage-baseline.js +3 -3
- package/.agents/scripts/lib/coverage-capture-delta.js +2 -2
- package/.agents/scripts/lib/coverage-capture-own-fix.js +2 -2
- package/.agents/scripts/lib/dispatch/environments.js +135 -0
- package/.agents/scripts/lib/dispatch/launch-cloud.js +164 -0
- package/.agents/scripts/lib/dispatch/launch-local.js +77 -0
- package/.agents/scripts/lib/dispatch/liveness.js +21 -0
- package/.agents/scripts/lib/dispatch/record.js +54 -0
- package/.agents/scripts/lib/dispatch/status.js +285 -0
- package/.agents/scripts/lib/dispatch/targets.js +101 -0
- package/.agents/scripts/lib/dispatch/verdict.js +207 -0
- package/.agents/scripts/lib/generated/agentrc-validator.js +2 -2
- package/.agents/scripts/lib/git-test-guard.js +119 -0
- package/.agents/scripts/lib/git-utils.js +3 -0
- package/.agents/scripts/lib/maintainability-utils.js +4 -4
- package/.agents/scripts/lib/observability/handoff-telemetry.js +2 -0
- package/.agents/scripts/lib/observability/source-classifier.js +2 -0
- package/.agents/scripts/lib/orchestration/acceptance-eval-decision.js +3 -2
- package/.agents/scripts/lib/orchestration/block-class-recovery.js +44 -0
- package/.agents/scripts/lib/orchestration/code-review.js +35 -19
- package/.agents/scripts/lib/orchestration/diff-magnitude.js +1 -1
- package/.agents/scripts/lib/orchestration/git-cleanup/phases/filters.js +3 -3
- package/.agents/scripts/lib/orchestration/plan-persist/audit-attribution.js +3 -4
- package/.agents/scripts/lib/orchestration/review-history.js +9 -10
- package/.agents/scripts/lib/orchestration/review-providers/code-review.js +9 -2
- package/.agents/scripts/lib/orchestration/review-providers/codex-cli.js +8 -5
- package/.agents/scripts/lib/orchestration/review-providers/codex.js +3 -11
- package/.agents/scripts/lib/orchestration/review-providers/mi-exemptions.js +2 -2
- package/.agents/scripts/lib/orchestration/review-providers/review-depth.js +22 -0
- package/.agents/scripts/lib/orchestration/review-providers/security-review.js +10 -2
- package/.agents/scripts/lib/orchestration/review-providers/types.js +2 -0
- package/.agents/scripts/lib/orchestration/review-providers/ultrareview.js +13 -2
- package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +40 -15
- package/.agents/scripts/lib/orchestration/single-story-close/runner.js +2 -0
- package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +8 -1
- package/.agents/scripts/lib/orchestration/story-handoff.js +222 -54
- package/.agents/scripts/lib/orchestration/story-stage-publish.js +147 -0
- package/.agents/scripts/lib/orchestration/ticketing/reads.js +2 -0
- package/.agents/scripts/lib/test-temp.js +5 -5
- package/.agents/scripts/lib/test-tiers.js +3 -3
- package/.agents/scripts/lib/util/glob-match.js +64 -0
- package/.agents/scripts/lib/wave-runner/footprint.js +3 -3
- package/.agents/scripts/run-tests.js +2 -1
- package/.agents/scripts/session-title.js +187 -0
- package/.agents/scripts/single-story-confirm-merge.js +7 -0
- package/.agents/scripts/single-story-init.js +6 -3
- package/.agents/workflows/helpers/audit-lens-core.md +4 -0
- package/.agents/workflows/helpers/code-review.md +8 -1
- package/.agents/workflows/helpers/deliver-digest.md +22 -23
- package/.agents/workflows/helpers/deliver-light.md +4 -1
- package/.agents/workflows/helpers/deliver-reference.md +55 -24
- package/.agents/workflows/helpers/deliver-story-reference.md +10 -3
- package/.agents/workflows/helpers/deliver-story.md +27 -7
- package/.agents/workflows/helpers/qa-core.md +2 -0
- package/.agents/workflows/mandrel-deliver.md +14 -4
- package/.agents/workflows/mandrel-orchestrate.md +2 -0
- package/.agents/workflows/mandrel-plan.md +4 -0
- package/README.md +8 -0
- package/bin/mandrel.js +35 -13
- package/docs/CHANGELOG.md +29 -0
- package/lib/cli/dispatch.js +27 -0
- package/lib/cli/ui/accounts.js +81 -0
- package/lib/cli/ui/board-model.js +372 -0
- package/lib/cli/ui/board.css +525 -0
- package/lib/cli/ui/board.html +80 -0
- package/lib/cli/ui/board.js +676 -0
- package/lib/cli/ui/log-tail.js +89 -0
- package/lib/cli/ui/panel-model.js +100 -0
- package/lib/cli/ui/preferences.js +136 -0
- package/lib/cli/ui/request-guard.js +108 -0
- package/lib/cli/ui/server.js +211 -0
- package/lib/cli/ui/sources.js +202 -0
- package/lib/cli/ui/story-detail.js +92 -0
- package/lib/cli/ui.js +114 -0
- package/package.json +2 -2
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
import fs from 'node:fs';
|
|
12
12
|
import path from 'node:path';
|
|
13
|
-
import picomatch from 'picomatch';
|
|
14
13
|
import { gitSpawn } from '../git-utils.js';
|
|
14
|
+
import { globMatcher } from '../util/glob-match.js';
|
|
15
15
|
|
|
16
16
|
const GLOB_CHAR_RE = /[*?[\]{}()!]/;
|
|
17
17
|
|
|
@@ -62,7 +62,7 @@ function byDesignHint(glob) {
|
|
|
62
62
|
*/
|
|
63
63
|
function probeOne(ctx, glob) {
|
|
64
64
|
const clean = glob.replace(/^\.\//, '').replace(/^!/, '');
|
|
65
|
-
const isMatch =
|
|
65
|
+
const isMatch = globMatcher([clean, `${clean.replace(/\/+$/, '')}/**`], {
|
|
66
66
|
dot: true,
|
|
67
67
|
});
|
|
68
68
|
if (ctx.scope.files.some((f) => isMatch(f)))
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import path from 'node:path';
|
|
11
|
-
import picomatch from 'picomatch';
|
|
12
11
|
import { gitSpawn } from '../git-utils.js';
|
|
12
|
+
import { globMatcher } from '../util/glob-match.js';
|
|
13
13
|
import { readJsonc, readYaml } from './read.js';
|
|
14
14
|
|
|
15
15
|
const ALWAYS_EXCLUDED = Object.freeze([
|
|
@@ -81,7 +81,7 @@ function collectManifests(root, rootPkg, files, pnpmWorkspace) {
|
|
|
81
81
|
: [];
|
|
82
82
|
const globs = workspaceGlobs(rootPkg, pnpmWorkspace);
|
|
83
83
|
if (globs.length === 0) return manifests;
|
|
84
|
-
const isWorkspace =
|
|
84
|
+
const isWorkspace = globMatcher(globs);
|
|
85
85
|
for (const rel of files) {
|
|
86
86
|
if (path.posix.basename(rel) !== 'package.json' || rel === 'package.json')
|
|
87
87
|
continue;
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { readdirSync, readFileSync } from 'node:fs';
|
|
4
4
|
import fs from 'node:fs/promises';
|
|
5
5
|
import path from 'node:path';
|
|
6
|
-
import picomatch from 'picomatch';
|
|
7
6
|
import { getPaths, PROJECT_ROOT, resolveConfig } from '../config-resolver.js';
|
|
8
7
|
import { softFailOrThrow } from '../degraded-mode.js';
|
|
9
8
|
import { gitSpawn } from '../git-utils.js';
|
|
10
9
|
import { resolveNavConfig } from '../orchestration/plan-navigation.js';
|
|
10
|
+
import { globMatcher } from '../util/glob-match.js';
|
|
11
11
|
import { withTimeout } from '../util/with-timeout.js';
|
|
12
12
|
import { readAuditRulesSync } from './audit-rules-reader.js';
|
|
13
13
|
import { resolveSensitivePaths } from './sensitive-paths.js';
|
|
@@ -529,12 +529,12 @@ export function hasExternalDependencies({ projectRoot = PROJECT_ROOT } = {}) {
|
|
|
529
529
|
|
|
530
530
|
/** Single file × single glob, with the project's matcher semantics (`dot: true`). */
|
|
531
531
|
export function matchesFilePattern(pattern, file) {
|
|
532
|
-
return
|
|
532
|
+
return globMatcher(pattern, { dot: true })(file);
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
export function matchesAnyFilePattern(patterns, files) {
|
|
536
536
|
if (!patterns?.length || !files?.length) return false;
|
|
537
|
-
const matchers = patterns.map((p) =>
|
|
537
|
+
const matchers = patterns.map((p) => globMatcher(p, { dot: true }));
|
|
538
538
|
return files.some((file) => matchers.some((m) => m(file)));
|
|
539
539
|
}
|
|
540
540
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import nodeFs from 'node:fs';
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
import { gzipSync } from 'node:zlib';
|
|
13
|
-
import
|
|
13
|
+
import { globMatcher, scanGlob } from '../util/glob-match.js';
|
|
14
14
|
import { toPosix, walkFiles } from '../util/paths.js';
|
|
15
15
|
|
|
16
16
|
/** Directories a bundle glob never descends into. */
|
|
@@ -47,11 +47,11 @@ function staticBase(segments) {
|
|
|
47
47
|
*/
|
|
48
48
|
function resolveBundleFiles(pattern, cwd, fs = nodeFs) {
|
|
49
49
|
const posix = pattern.replace(/\\/g, '/').replace(/^\.\//, '');
|
|
50
|
-
if (!
|
|
50
|
+
if (!scanGlob(posix).isGlob) {
|
|
51
51
|
const abs = path.resolve(cwd, posix);
|
|
52
52
|
return fs.existsSync(abs) && fs.statSync(abs).isFile() ? [abs] : [];
|
|
53
53
|
}
|
|
54
|
-
const isMatch =
|
|
54
|
+
const isMatch = globMatcher(posix, { dot: true });
|
|
55
55
|
const base = staticBase(posix.split('/'));
|
|
56
56
|
return walkFiles(path.resolve(cwd, base), {
|
|
57
57
|
skipDirs: SKIPPED_DIRS,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// buckets for per-component floors. The `*` component is the whole-repo
|
|
3
3
|
// rollup and matches every row; overlap between components is allowed.
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { globMatcher } from '../util/glob-match.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Compiled matchers keyed by glob: `groupRows` runs over tens of thousands of
|
|
@@ -19,7 +19,7 @@ const GLOB_MATCHER_CACHE = new Map();
|
|
|
19
19
|
function matcherFor(glob) {
|
|
20
20
|
let matcher = GLOB_MATCHER_CACHE.get(glob);
|
|
21
21
|
if (!matcher) {
|
|
22
|
-
matcher =
|
|
22
|
+
matcher = globMatcher(glob, { dot: true });
|
|
23
23
|
GLOB_MATCHER_CACHE.set(glob, matcher);
|
|
24
24
|
}
|
|
25
25
|
return matcher;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The gate `compareCrap` applies to a method with no baseline row. A leaf. */
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { isGlobMatch } from '../../util/glob-match.js';
|
|
4
4
|
import { canonicalizeBaselinePath } from '../path-canon.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -55,7 +55,7 @@ function isUntestableWiring(file, globs) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
function matchesAny(file, globs) {
|
|
58
|
-
return
|
|
58
|
+
return isGlobMatch(canonicalizeBaselinePath(file), globs, {
|
|
59
59
|
dot: true,
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -11,9 +11,8 @@ import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
|
11
11
|
import { readFile } from 'node:fs/promises';
|
|
12
12
|
import path from 'node:path';
|
|
13
13
|
import { load } from 'js-yaml';
|
|
14
|
-
import picomatch from 'picomatch';
|
|
15
|
-
|
|
16
14
|
import { Logger } from './Logger.js';
|
|
15
|
+
import { globMatcher } from './util/glob-match.js';
|
|
17
16
|
import { toPosix } from './util/paths.js';
|
|
18
17
|
|
|
19
18
|
/** npm package name → pending tag. Preferred-first: the first match wins. */
|
|
@@ -186,7 +185,7 @@ function expandWorkspacePatterns(cwd, patterns, logger) {
|
|
|
186
185
|
const excludes = patterns
|
|
187
186
|
.filter((p) => p.startsWith('!'))
|
|
188
187
|
.map((p) => p.slice(1));
|
|
189
|
-
const excludeMatchers = excludes.map((e) =>
|
|
188
|
+
const excludeMatchers = excludes.map((e) => globMatcher(e));
|
|
190
189
|
|
|
191
190
|
const results = new Set();
|
|
192
191
|
|
|
@@ -211,7 +210,7 @@ function expandWorkspacePatterns(cwd, patterns, logger) {
|
|
|
211
210
|
const baseDir = path.join(cwd, ...literalSegments);
|
|
212
211
|
if (!existsSyncDir(baseDir, logger)) continue;
|
|
213
212
|
const recursive = segments.slice(i).includes('**');
|
|
214
|
-
const includeMatcher =
|
|
213
|
+
const includeMatcher = globMatcher(pattern);
|
|
215
214
|
walkPackages({
|
|
216
215
|
dir: baseDir,
|
|
217
216
|
relBase: literalSegments.join('/'),
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The detached half of the child-process surface; `child-exec.js` owns the
|
|
3
|
+
* `node:child_process` import and injects `spawn` as `run`.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { closeSync, openSync } from 'node:fs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Start `file` detached and unreferenced, stdout and stderr appended to
|
|
10
|
+
* `logPath`, so it outlives this process. Resolves with the pid once the
|
|
11
|
+
* child has spawned; rejects on a spawn error (e.g. ENOENT).
|
|
12
|
+
*
|
|
13
|
+
* @param {string} file
|
|
14
|
+
* @param {string[]} args
|
|
15
|
+
* @param {{ logPath: string, cwd?: string, run: Function, open?: Function, close?: Function }} opts
|
|
16
|
+
* @returns {Promise<{ pid: number }>}
|
|
17
|
+
*/
|
|
18
|
+
export function detachChild(file, args, opts) {
|
|
19
|
+
const { logPath, cwd, run, open = openSync, close = closeSync } = opts;
|
|
20
|
+
const fd = open(logPath, 'a');
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
let settled = false;
|
|
23
|
+
const settle = (fn, value) => {
|
|
24
|
+
if (settled) return;
|
|
25
|
+
settled = true;
|
|
26
|
+
close(fd);
|
|
27
|
+
fn(value);
|
|
28
|
+
};
|
|
29
|
+
let child;
|
|
30
|
+
try {
|
|
31
|
+
child = run(file, args, {
|
|
32
|
+
cwd,
|
|
33
|
+
detached: true,
|
|
34
|
+
shell: false,
|
|
35
|
+
stdio: ['ignore', fd, fd],
|
|
36
|
+
windowsHide: true,
|
|
37
|
+
});
|
|
38
|
+
} catch (err) {
|
|
39
|
+
settle(reject, err);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
child.once('error', (err) => settle(reject, err));
|
|
43
|
+
child.once('spawn', () => {
|
|
44
|
+
child.unref();
|
|
45
|
+
settle(resolve, { pid: child.pid });
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import { execFile, execFileSync, spawn, spawnSync } from 'node:child_process';
|
|
13
13
|
import { promisify } from 'node:util';
|
|
14
14
|
|
|
15
|
+
import { detachChild } from './child-detached.js';
|
|
15
16
|
import { streamChild } from './child-stream.js';
|
|
16
17
|
|
|
17
18
|
const MIB = 1024 * 1024;
|
|
@@ -170,6 +171,16 @@ export async function spawnCaptureNullableAsync(file, args, opts = {}) {
|
|
|
170
171
|
export const spawnStreamAsync = (file, args, opts = {}) =>
|
|
171
172
|
streamChild(file, args, { spawnImpl: spawn, ...opts });
|
|
172
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Start a child detached, output appended to a log; see `child-detached.js`.
|
|
176
|
+
*
|
|
177
|
+
* @param {string} file
|
|
178
|
+
* @param {string[]} args
|
|
179
|
+
* @param {{ logPath: string, cwd?: string }} opts
|
|
180
|
+
*/
|
|
181
|
+
export const spawnDetached = (file, args, opts) =>
|
|
182
|
+
detachChild(file, args, { run: spawn, ...opts });
|
|
183
|
+
|
|
173
184
|
/**
|
|
174
185
|
* `status=null` is printed verbatim: it means the child was killed.
|
|
175
186
|
*
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* the first failing rule is the reason the close re-runs everything.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import picomatch from 'picomatch';
|
|
9
8
|
import { COVERAGE_DEFERRED_REASONS } from '../coverage-deferral.js';
|
|
9
|
+
import { globMatcher } from '../util/glob-match.js';
|
|
10
10
|
import {
|
|
11
11
|
shouldSkip as defaultShouldSkip,
|
|
12
12
|
hashCommandConfig,
|
|
@@ -53,7 +53,7 @@ function mergeIneligibility(baseSync, alwaysPaths) {
|
|
|
53
53
|
return { reason: 'conflict-resolved' };
|
|
54
54
|
}
|
|
55
55
|
if (alwaysPaths.length === 0) return null;
|
|
56
|
-
const matches =
|
|
56
|
+
const matches = globMatcher(alwaysPaths, { dot: true });
|
|
57
57
|
const hit = incoming.find((path) => matches(path));
|
|
58
58
|
return hit ? { reason: 'always-revalidate-path', detail: hit } : null;
|
|
59
59
|
}
|
|
@@ -11,17 +11,20 @@ export const DELIVERY_ROUTING_DEFAULTS = Object.freeze({
|
|
|
11
11
|
ceremonyProfile: 'standard',
|
|
12
12
|
/** Land through merge in one close; opt out with `--no-wait-merge`. */
|
|
13
13
|
closeAndLand: true,
|
|
14
|
+
/** Retitle the host session with a state glyph (`session-title.js`). */
|
|
15
|
+
sessionTitles: true,
|
|
14
16
|
});
|
|
15
17
|
|
|
18
|
+
const CEREMONY_PROFILES = ['minimal', 'standard', 'strict'];
|
|
19
|
+
|
|
16
20
|
/**
|
|
17
21
|
* @param {unknown} value
|
|
18
22
|
* @returns {'minimal'|'standard'|'strict'}
|
|
19
23
|
*/
|
|
20
24
|
function normalizeCeremonyProfile(value) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return DELIVERY_ROUTING_DEFAULTS.ceremonyProfile;
|
|
25
|
+
return CEREMONY_PROFILES.includes(value)
|
|
26
|
+
? value
|
|
27
|
+
: DELIVERY_ROUTING_DEFAULTS.ceremonyProfile;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
/**
|
|
@@ -32,19 +35,19 @@ function normalizeCeremonyProfile(value) {
|
|
|
32
35
|
* roleScopedAgents: boolean,
|
|
33
36
|
* ceremonyProfile: 'minimal'|'standard'|'strict',
|
|
34
37
|
* closeAndLand: boolean,
|
|
38
|
+
* sessionTitles: boolean,
|
|
35
39
|
* }}
|
|
36
40
|
*/
|
|
37
41
|
export function getDeliveryRouting(config) {
|
|
38
42
|
const routing = config?.delivery?.routing ?? config?.routing ?? config ?? {};
|
|
43
|
+
const flag = (key) =>
|
|
44
|
+
typeof routing[key] === 'boolean'
|
|
45
|
+
? routing[key]
|
|
46
|
+
: DELIVERY_ROUTING_DEFAULTS[key];
|
|
39
47
|
return {
|
|
40
|
-
roleScopedAgents:
|
|
41
|
-
typeof routing.roleScopedAgents === 'boolean'
|
|
42
|
-
? routing.roleScopedAgents
|
|
43
|
-
: DELIVERY_ROUTING_DEFAULTS.roleScopedAgents,
|
|
48
|
+
roleScopedAgents: flag('roleScopedAgents'),
|
|
44
49
|
ceremonyProfile: normalizeCeremonyProfile(routing.ceremonyProfile),
|
|
45
|
-
closeAndLand:
|
|
46
|
-
|
|
47
|
-
? routing.closeAndLand
|
|
48
|
-
: DELIVERY_ROUTING_DEFAULTS.closeAndLand,
|
|
50
|
+
closeAndLand: flag('closeAndLand'),
|
|
51
|
+
sessionTitles: flag('sessionTitles'),
|
|
49
52
|
};
|
|
50
53
|
}
|
|
@@ -114,7 +114,7 @@ export const COVERAGE_GATE = {
|
|
|
114
114
|
type: 'array',
|
|
115
115
|
items: { ...SAFE_STRING, minLength: 1 },
|
|
116
116
|
description:
|
|
117
|
-
"Repo-relative
|
|
117
|
+
"Repo-relative globs naming paths no test reads. A matching path is dropped from both sides of the coverage delta-refresh overlap check and from the re-measured set — a delta of only matching, baseline and coverage-directory paths restamps without a run — and from the overlap check of close's `test` delta re-credit (its incoming count and emptiness test are unchanged). It never changes the suite-input filter, the tree digest or stamp freshness. Default `[]`: nothing is built in, so Markdown counts as an input unless declared here.",
|
|
118
118
|
default: [],
|
|
119
119
|
},
|
|
120
120
|
captureHandlesConfigChanges: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** `delivery.handoff`: consumer checks the handoff
|
|
1
|
+
/** `delivery.handoff`: consumer checks the handoff runs beside close's gates. */
|
|
2
2
|
|
|
3
3
|
const isStringArray = (v) =>
|
|
4
4
|
Array.isArray(v) && v.every((a) => typeof a === 'string');
|
|
@@ -9,6 +9,15 @@ const isCheck = (c) =>
|
|
|
9
9
|
c.cmd.length > 0 &&
|
|
10
10
|
(c.args === undefined || isStringArray(c.args));
|
|
11
11
|
|
|
12
|
+
/** `delivery.handoff[key]`, malformed entries dropped. */
|
|
13
|
+
function checksAt(config, key) {
|
|
14
|
+
const checks = config?.delivery?.handoff?.[key];
|
|
15
|
+
if (!Array.isArray(checks)) return [];
|
|
16
|
+
return checks
|
|
17
|
+
.filter(isCheck)
|
|
18
|
+
.map(({ cmd, args }) => ({ cmd, args: args ?? [] }));
|
|
19
|
+
}
|
|
20
|
+
|
|
12
21
|
/**
|
|
13
22
|
* `delivery.handoff.postSeatChecks`, malformed entries dropped.
|
|
14
23
|
*
|
|
@@ -16,9 +25,15 @@ const isCheck = (c) =>
|
|
|
16
25
|
* @returns {Array<{ cmd: string, args: string[] }>}
|
|
17
26
|
*/
|
|
18
27
|
export function getPostSeatChecks(config) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
return checksAt(config, 'postSeatChecks');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* `delivery.handoff.firstChecks`, malformed entries dropped.
|
|
33
|
+
*
|
|
34
|
+
* @param {object|null|undefined} config
|
|
35
|
+
* @returns {Array<{ cmd: string, args: string[] }>}
|
|
36
|
+
*/
|
|
37
|
+
export function getFirstChecks(config) {
|
|
38
|
+
return checksAt(config, 'firstChecks');
|
|
24
39
|
}
|
|
@@ -210,6 +210,32 @@ export function storyProgressPath(sid, config) {
|
|
|
210
210
|
);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
/**
|
|
214
|
+
* `<tempRoot>/dispatch/story-<id>.log`: a dispatched delivery's output.
|
|
215
|
+
*
|
|
216
|
+
* @param {number} sid
|
|
217
|
+
* @param {object} [config]
|
|
218
|
+
* @returns {string}
|
|
219
|
+
*/
|
|
220
|
+
export function dispatchLogPath(sid, config) {
|
|
221
|
+
return path.join(
|
|
222
|
+
anchorTempRoot(tempRootFrom(config)),
|
|
223
|
+
'dispatch',
|
|
224
|
+
`story-${storyId(sid)}.log`,
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* The dispatch record (`pid`, `argv`, …) beside {@link dispatchLogPath}.
|
|
230
|
+
*
|
|
231
|
+
* @param {number} sid
|
|
232
|
+
* @param {object} [config]
|
|
233
|
+
* @returns {string}
|
|
234
|
+
*/
|
|
235
|
+
export function dispatchRecordPath(sid, config) {
|
|
236
|
+
return dispatchLogPath(sid, config).replace(/\.log$/, '.json');
|
|
237
|
+
}
|
|
238
|
+
|
|
213
239
|
const runId = (id) => {
|
|
214
240
|
if (!Number.isInteger(id) || id <= 0) {
|
|
215
241
|
throw new Error(`[temp-paths] runId must be a positive integer; got ${id}`);
|
|
@@ -249,7 +249,7 @@ const CLOSE_SCHEMA = {
|
|
|
249
249
|
type: 'array',
|
|
250
250
|
items: { type: 'string', minLength: 1 },
|
|
251
251
|
description:
|
|
252
|
-
'Globs (
|
|
252
|
+
'Globs (dotfiles included) for whole-repo invariants: a base merge bringing in any matching path always re-runs every gate under `revalidateAfterBaseSync: "ci"`.',
|
|
253
253
|
},
|
|
254
254
|
},
|
|
255
255
|
additionalProperties: false,
|
|
@@ -307,6 +307,12 @@ const ROUTING_SCHEMA = {
|
|
|
307
307
|
'When true (default), single-story-close lands through merge in one close. Opt out per-run with --no-wait-merge.',
|
|
308
308
|
default: DELIVERY_ROUTING_DEFAULTS.closeAndLand,
|
|
309
309
|
},
|
|
310
|
+
sessionTitles: {
|
|
311
|
+
type: 'boolean',
|
|
312
|
+
description:
|
|
313
|
+
'When true (default), plan, deliver, orchestrate, audit and QA runs retitle the top-level host session with a state glyph (○ planning, ◐ in progress, ● done, ⊗ blocked) via session-title.js, on hosts that expose a session-title tool. False makes session-title.js answer apply: false, so no step renames anything.',
|
|
314
|
+
default: DELIVERY_ROUTING_DEFAULTS.sessionTitles,
|
|
315
|
+
},
|
|
310
316
|
agentModels: {
|
|
311
317
|
type: 'object',
|
|
312
318
|
description:
|
|
@@ -372,22 +378,31 @@ const PULL_REQUEST_DELIVERY_SCHEMA = {
|
|
|
372
378
|
additionalProperties: false,
|
|
373
379
|
};
|
|
374
380
|
|
|
381
|
+
const HANDOFF_CHECK_ITEMS = {
|
|
382
|
+
type: 'object',
|
|
383
|
+
properties: {
|
|
384
|
+
cmd: { type: 'string', minLength: 1 },
|
|
385
|
+
args: { type: 'array', items: { type: 'string' } },
|
|
386
|
+
},
|
|
387
|
+
required: ['cmd'],
|
|
388
|
+
additionalProperties: false,
|
|
389
|
+
};
|
|
390
|
+
|
|
375
391
|
const HANDOFF_SCHEMA = {
|
|
376
392
|
type: 'object',
|
|
377
393
|
description:
|
|
378
394
|
"Story #5960. What `story-handoff.js` runs beyond close's own gates.",
|
|
379
395
|
properties: {
|
|
396
|
+
firstChecks: {
|
|
397
|
+
type: 'array',
|
|
398
|
+
items: HANDOFF_CHECK_ITEMS,
|
|
399
|
+
description:
|
|
400
|
+
"Story #6099. Cheap consumer checks the handoff preflight runs first, in order, beside close's independent baseline compare: each `{ cmd, args? }` runs in the worktree without a shell, with `MANDREL_HANDOFF_STEP=preflight`. A non-zero exit settles `fix-required` naming the check and quoting its failure rows, before typecheck, lint, format, quality-preview, the ratchets or the held review start; under `--report-all` the rest still run. Default [] runs only the compare first.",
|
|
401
|
+
default: [],
|
|
402
|
+
},
|
|
380
403
|
postSeatChecks: {
|
|
381
404
|
type: 'array',
|
|
382
|
-
items:
|
|
383
|
-
type: 'object',
|
|
384
|
-
properties: {
|
|
385
|
-
cmd: { type: 'string', minLength: 1 },
|
|
386
|
-
args: { type: 'array', items: { type: 'string' } },
|
|
387
|
-
},
|
|
388
|
-
required: ['cmd'],
|
|
389
|
-
additionalProperties: false,
|
|
390
|
-
},
|
|
405
|
+
items: HANDOFF_CHECK_ITEMS,
|
|
391
406
|
description:
|
|
392
407
|
"Story #5960. Consumer checks the handoff re-runs in its post-capture step, after the seat commits the Story's new baseline rows: each `{ cmd, args? }` runs in the worktree without a shell, with `MANDREL_HANDOFF_STEP=post-capture`, and a non-zero exit settles `fix-required`. Declare the check a consumer downgrades during `preflight` (keyed on `MANDREL_HANDOFF_STEP`) here, so a row the seat did not write still fails the handoff; while any is declared the preflight `lint` credit is withheld until they pass at HEAD. Skipped under a coverage deferral. Default [] runs nothing extra.",
|
|
393
408
|
default: [],
|
|
@@ -549,6 +564,44 @@ const TEMP_RETENTION_SCHEMA = {
|
|
|
549
564
|
additionalProperties: false,
|
|
550
565
|
};
|
|
551
566
|
|
|
567
|
+
const ENVIRONMENT_CAPACITY = { type: 'integer', minimum: 1 };
|
|
568
|
+
|
|
569
|
+
const ENVIRONMENTS_SCHEMA = {
|
|
570
|
+
type: 'object',
|
|
571
|
+
description:
|
|
572
|
+
'Named delivery environments for `mandrel dispatch`, keyed by name (lowercase letters, digits and hyphens, at most 31 characters). `target` is where the delivery runs and `capacity` how many Stories may hold the environment at once (default 1). A `local` entry may set `command`, the argv started for a Story with `{id}` replaced by the Story id and `{sessionId}` by a fresh UUID per launch (default `["claude", "-p", "/mandrel-deliver {id}", "--session-id", "{sessionId}", "--name", "◐ Delivery #{id}", "--output-format", "stream-json", "--verbose"]`), spawned without a shell. A `claude-cloud` entry fires a Claude Code routine instead: it requires `routine` (the routine id, `trig_…`) and `tokenEnv` (the NAME of the environment variable holding the routine token, never the token) and takes no `command`. Unset, one implicit `local` environment with capacity 1 is used. `.agentrc.local.json` adds or overrides an entry through the usual merge.',
|
|
573
|
+
propertyNames: { pattern: '^[a-z0-9][a-z0-9-]{0,30}$' },
|
|
574
|
+
additionalProperties: {
|
|
575
|
+
oneOf: [
|
|
576
|
+
{
|
|
577
|
+
type: 'object',
|
|
578
|
+
properties: {
|
|
579
|
+
target: { const: 'local' },
|
|
580
|
+
capacity: ENVIRONMENT_CAPACITY,
|
|
581
|
+
command: {
|
|
582
|
+
type: 'array',
|
|
583
|
+
minItems: 1,
|
|
584
|
+
items: { type: 'string', minLength: 1 },
|
|
585
|
+
},
|
|
586
|
+
},
|
|
587
|
+
required: ['target'],
|
|
588
|
+
additionalProperties: false,
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
type: 'object',
|
|
592
|
+
properties: {
|
|
593
|
+
target: { const: 'claude-cloud' },
|
|
594
|
+
capacity: ENVIRONMENT_CAPACITY,
|
|
595
|
+
routine: { type: 'string', pattern: '^trig_[A-Za-z0-9_]+$' },
|
|
596
|
+
tokenEnv: { type: 'string', pattern: '^[A-Z][A-Z0-9_]*$' },
|
|
597
|
+
},
|
|
598
|
+
required: ['target', 'routine', 'tokenEnv'],
|
|
599
|
+
additionalProperties: false,
|
|
600
|
+
},
|
|
601
|
+
],
|
|
602
|
+
},
|
|
603
|
+
};
|
|
604
|
+
|
|
552
605
|
export const DELIVERY_SCHEMA = {
|
|
553
606
|
type: 'object',
|
|
554
607
|
description:
|
|
@@ -572,6 +625,7 @@ export const DELIVERY_SCHEMA = {
|
|
|
572
625
|
handoff: HANDOFF_SCHEMA,
|
|
573
626
|
orchestrate: ORCHESTRATE_SCHEMA,
|
|
574
627
|
routing: ROUTING_SCHEMA,
|
|
628
|
+
environments: ENVIRONMENTS_SCHEMA,
|
|
575
629
|
},
|
|
576
630
|
additionalProperties: false,
|
|
577
631
|
};
|
|
@@ -137,7 +137,7 @@ export const CODE_REVIEW_SCHEMA = {
|
|
|
137
137
|
sensitivePaths: {
|
|
138
138
|
type: 'object',
|
|
139
139
|
description:
|
|
140
|
-
"The project's own sensitive-path classes, merged additively over the shipped `audit-rules.json` `sensitivePaths`: a class named like a shipped one appends its patterns to it, a new name adds a class, and no shipped class or pattern can be removed or narrowed. A changed file matching any class derives a `high` change level, which drives both code-review depth (`deep`, never `light`) and plan-time routing. Patterns are
|
|
140
|
+
"The project's own sensitive-path classes, merged additively over the shipped `audit-rules.json` `sensitivePaths`: a class named like a shipped one appends its patterns to it, a new name adds a class, and no shipped class or pattern can be removed or narrowed. A changed file matching any class derives a `high` change level, which drives both code-review depth (`deep`, never `light`) and plan-time routing. Patterns are globs matched with `dot: true`.",
|
|
141
141
|
propertyNames: { pattern: '^[a-z0-9][a-z0-9-]*$' },
|
|
142
142
|
additionalProperties: {
|
|
143
143
|
type: 'object',
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import fs from 'node:fs';
|
|
7
7
|
import path from 'node:path';
|
|
8
|
-
import picomatch from 'picomatch';
|
|
9
8
|
import { write, writeFile } from './baselines/writer.js';
|
|
10
9
|
import { COVERAGE_CAPTURE_DEFAULTS } from './config/gates/coverage.schema.js';
|
|
11
10
|
import {
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
} from './coverage-capture.js';
|
|
15
14
|
import { isObject } from './json-utils.js';
|
|
16
15
|
import { isScorableSourceFile } from './source-extensions.js';
|
|
16
|
+
import { globMatcher } from './util/glob-match.js';
|
|
17
17
|
|
|
18
18
|
const COVERAGE_FINAL_PATH = COVERAGE_CAPTURE_DEFAULTS.coveragePath;
|
|
19
19
|
const COVERAGE_BASELINE_PATH = 'baselines/coverage.json';
|
|
@@ -30,9 +30,9 @@ function toForwardSlash(p) {
|
|
|
30
30
|
/** c8's scope rule: some `include` matches and no `exclude` does. */
|
|
31
31
|
export function buildScopePredicate({ include = [], exclude = [] } = {}) {
|
|
32
32
|
const inc =
|
|
33
|
-
include.length === 0 ? () => true :
|
|
33
|
+
include.length === 0 ? () => true : globMatcher(include, { dot: true });
|
|
34
34
|
const exc =
|
|
35
|
-
exclude.length === 0 ? () => false :
|
|
35
|
+
exclude.length === 0 ? () => false : globMatcher(exclude, { dot: true });
|
|
36
36
|
return (relPath) => {
|
|
37
37
|
const norm = toForwardSlash(relPath);
|
|
38
38
|
return inc(norm) && !exc(norm);
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import fs from 'node:fs';
|
|
9
9
|
import path from 'node:path';
|
|
10
|
-
import picomatch from 'picomatch';
|
|
11
10
|
import { getQuality } from './config/quality.js';
|
|
12
11
|
import {
|
|
13
12
|
captureStampPath,
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
18
17
|
} from './coverage-capture.js';
|
|
19
18
|
import { judgeOwnFix, supersededSeed } from './coverage-capture-own-fix.js';
|
|
20
19
|
import { gitSpawn } from './git-utils.js';
|
|
20
|
+
import { globMatcher } from './util/glob-match.js';
|
|
21
21
|
|
|
22
22
|
/** Basenames whose change moves coverage beyond the files it names. */
|
|
23
23
|
const COVERAGE_CONFIG_RE =
|
|
@@ -127,7 +127,7 @@ function treeIneligibility({ cwd, commit, spawn }) {
|
|
|
127
127
|
/** `nonInputGlobs` as a predicate; an unset list matches nothing. */
|
|
128
128
|
function nonInputMatcher(globs) {
|
|
129
129
|
return Array.isArray(globs) && globs.length > 0
|
|
130
|
-
?
|
|
130
|
+
? globMatcher(globs, { dot: true })
|
|
131
131
|
: () => false;
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
import fs from 'node:fs';
|
|
10
10
|
import path from 'node:path';
|
|
11
|
-
import picomatch from 'picomatch';
|
|
12
11
|
import {
|
|
13
12
|
filterSuiteInputPaths,
|
|
14
13
|
supersededArtifactPath,
|
|
15
14
|
supersededStampPath,
|
|
16
15
|
} from './coverage-capture.js';
|
|
16
|
+
import { globMatcher } from './util/glob-match.js';
|
|
17
17
|
|
|
18
18
|
const TEST_FILE_RE = /\.(test|spec)\.[cm]?[jt]sx?$/;
|
|
19
19
|
const TEST_DIR_RE = /(^|\/)(tests?|__tests__|spec|e2e)\//;
|
|
@@ -172,7 +172,7 @@ function ownFixContext({
|
|
|
172
172
|
}) {
|
|
173
173
|
const isNonInput =
|
|
174
174
|
coverage.nonInputGlobs?.length > 0
|
|
175
|
-
?
|
|
175
|
+
? globMatcher(coverage.nonInputGlobs, { dot: true })
|
|
176
176
|
: () => false;
|
|
177
177
|
const suite = (files) => filterSuiteInputPaths(files, crap.coveragePath);
|
|
178
178
|
return {
|