mandrel 2.87.0 → 2.88.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 +29 -0
- package/.agents/agents/auditor.md +4 -3
- package/.agents/docs/agentrc-reference.json +2 -1
- package/.agents/docs/configuration.md +12 -8
- package/.agents/docs/workflows.md +1 -1
- package/.agents/schemas/agentrc.schema.json +11 -5
- package/.agents/schemas/story-deliver-terminal.schema.json +1 -1
- package/.agents/schemas/story-progress.schema.json +5 -0
- package/.agents/scripts/audit-to-stories.js +3 -2
- package/.agents/scripts/boot-sweep.js +3 -2
- package/.agents/scripts/check-arch-cycles.js +19 -41
- package/.agents/scripts/check-context-budget.js +16 -44
- package/.agents/scripts/check-cyclomatic.js +13 -37
- package/.agents/scripts/check-dead-exports.js +16 -46
- package/.agents/scripts/clean-worktrees.js +1 -6
- package/.agents/scripts/deliver-run.js +11 -0
- package/.agents/scripts/diagnose-friction.js +3 -3
- package/.agents/scripts/lib/baselines/coverage-updater-cli.js +6 -14
- package/.agents/scripts/lib/baselines/crap-updater-cli.js +36 -26
- package/.agents/scripts/lib/baselines/duplication-scanner.js +20 -1
- package/.agents/scripts/lib/baselines/env-overrides.js +39 -34
- package/.agents/scripts/lib/baselines/kernel.js +3 -2
- package/.agents/scripts/lib/baselines/kinds/crap.js +14 -38
- package/.agents/scripts/lib/baselines/preview-gates.js +4 -1
- package/.agents/scripts/lib/baselines/refresh-service.js +65 -22
- package/.agents/scripts/lib/baselines/writer.js +5 -1
- package/.agents/scripts/lib/bdd-runner-detect.js +7 -10
- package/.agents/scripts/lib/child-exec.js +14 -1
- package/.agents/scripts/lib/child-stream.js +122 -0
- package/.agents/scripts/lib/clean-temp.js +19 -13
- package/.agents/scripts/lib/cli-args.js +49 -0
- package/.agents/scripts/lib/codex/skills-projection.js +1 -12
- package/.agents/scripts/lib/config/gates/mutation.schema.js +2 -2
- package/.agents/scripts/lib/config/gh-config-dir.js +63 -0
- package/.agents/scripts/lib/config/github.js +2 -0
- package/.agents/scripts/lib/config/paths.js +14 -3
- package/.agents/scripts/lib/config-resolver.js +78 -64
- package/.agents/scripts/lib/config-settings-schema-delivery.js +4 -3
- package/.agents/scripts/lib/config-settings-schema.js +7 -0
- package/.agents/scripts/lib/coverage-baseline.js +2 -2
- package/.agents/scripts/lib/coverage-capture.js +16 -1
- package/.agents/scripts/lib/crap-utils.js +59 -47
- package/.agents/scripts/lib/full-suite-lock.js +1 -10
- package/.agents/scripts/lib/gates/baseline-store.js +10 -0
- package/.agents/scripts/lib/generated/agentrc-validator.js +1 -1
- package/.agents/scripts/lib/gh-exec.js +45 -2
- package/.agents/scripts/lib/gh-transport.js +27 -0
- package/.agents/scripts/lib/git-utils.js +16 -9
- package/.agents/scripts/lib/maintainability-engine.js +27 -6
- package/.agents/scripts/lib/maintainability-utils.js +14 -1
- package/.agents/scripts/lib/orchestration/check-baselines/phases/evaluate.js +4 -1
- package/.agents/scripts/lib/orchestration/evidence-stream.js +186 -0
- package/.agents/scripts/lib/orchestration/file-assumptions.js +2 -19
- package/.agents/scripts/lib/orchestration/git-cleanup/phases/branches-reap.js +3 -7
- package/.agents/scripts/lib/orchestration/git-cleanup/phases/git-probes-ff.js +34 -40
- package/.agents/scripts/lib/orchestration/git-cleanup/phases/git-probes.js +4 -3
- package/.agents/scripts/lib/orchestration/plan-persist/persist-helpers.js +2 -19
- package/.agents/scripts/lib/orchestration/pr-watch.js +1 -5
- package/.agents/scripts/lib/orchestration/project-meta-cache.js +17 -4
- package/.agents/scripts/lib/orchestration/reassert-status-column.js +1 -8
- package/.agents/scripts/lib/orchestration/resolve-stories.js +1 -0
- package/.agents/scripts/lib/orchestration/review-providers/native.js +2 -2
- package/.agents/scripts/lib/orchestration/single-story-close/phase-timer.js +43 -0
- package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +37 -13
- package/.agents/scripts/lib/orchestration/single-story-close/phases/finish.js +264 -0
- package/.agents/scripts/lib/orchestration/single-story-close/phases/open-pr.js +68 -0
- package/.agents/scripts/lib/orchestration/single-story-close/phases/pre-push.js +106 -0
- package/.agents/scripts/lib/orchestration/single-story-close/phases/reconcile-done.js +43 -35
- package/.agents/scripts/lib/orchestration/single-story-close/phases/review-halt.js +52 -0
- package/.agents/scripts/lib/orchestration/single-story-close/result.js +273 -0
- package/.agents/scripts/lib/orchestration/single-story-close/runner.js +68 -776
- package/.agents/scripts/lib/orchestration/story-close/context-budget-writeback.js +20 -9
- package/.agents/scripts/lib/orchestration/story-close/duplication-close-rescore.js +2 -2
- package/.agents/scripts/lib/orchestration/story-close/ratchet-shrink-writeback.js +20 -12
- package/.agents/scripts/lib/orchestration/story-handoff.js +50 -21
- package/.agents/scripts/lib/orchestration/story-progress.js +32 -12
- package/.agents/scripts/lib/orchestration/ticket-validator.js +3 -13
- package/.agents/scripts/lib/qa/resolve-selection.js +1 -8
- package/.agents/scripts/lib/single-story/confirm-and-land.js +33 -0
- package/.agents/scripts/lib/single-story-sweep/reconcile-closing.js +43 -11
- package/.agents/scripts/lib/single-story-sweep/sweep-lock.js +130 -30
- package/.agents/scripts/lib/skills/parse-skill.js +1 -4
- package/.agents/scripts/lib/story-body/story-body.js +12 -1
- package/.agents/scripts/lib/suite-admission.js +3 -11
- package/.agents/scripts/lib/temp-retention.js +25 -11
- package/.agents/scripts/lib/test-run-credit.js +2 -5
- package/.agents/scripts/lib/transpile.js +193 -31
- package/.agents/scripts/lib/util/paths.js +31 -0
- package/.agents/scripts/lib/util/sleep.js +15 -0
- package/.agents/scripts/lib/validation-evidence.js +29 -3
- package/.agents/scripts/lib/wave-runner/live-probe.js +24 -0
- package/.agents/scripts/lib/workers/crap-worker.js +23 -12
- package/.agents/scripts/lib/workers/maintainability-report-worker.js +18 -12
- package/.agents/scripts/lib/workflow-closure.js +1 -8
- package/.agents/scripts/notify.js +83 -90
- package/.agents/scripts/plan-context.js +8 -4
- package/.agents/scripts/providers/github/auth.js +14 -30
- package/.agents/scripts/providers/github/blocked-by-add.js +11 -27
- package/.agents/scripts/providers/github/compose.js +1 -0
- package/.agents/scripts/providers/github/gh-token-diagnostics.js +130 -0
- package/.agents/scripts/providers/github/identity.js +158 -0
- package/.agents/scripts/providers/github/issues.js +2 -2
- package/.agents/scripts/providers/github/mappers.js +16 -19
- package/.agents/scripts/providers/github/projects-v2-graphql.js +4 -36
- package/.agents/scripts/providers/github/request-helpers.js +44 -0
- package/.agents/scripts/providers/github/sub-issue-add.js +11 -28
- package/.agents/scripts/providers/github.js +10 -2
- package/.agents/scripts/quality-preview.js +6 -19
- package/.agents/scripts/single-story-confirm-merge.js +8 -20
- package/.agents/scripts/single-story-init.js +0 -1
- package/.agents/scripts/stories-wave-tick.js +60 -46
- package/.agents/scripts/story-handoff.js +2 -23
- package/.agents/scripts/story-review-compute.js +3 -22
- package/.agents/scripts/sync-claude-agents.js +1 -12
- package/.agents/scripts/sync-claude-commands.js +1 -12
- package/.agents/scripts/update-crap-baseline.js +10 -19
- package/.agents/scripts/update-ticket-state.js +44 -45
- package/.agents/templates/docs/audit-sweep-runbook.md +1 -1
- package/.agents/workflows/audit-accessibility.md +1 -1
- package/.agents/workflows/audit-adrs.md +1 -1
- package/.agents/workflows/audit-architecture.md +1 -1
- package/.agents/workflows/audit-baselines.md +2 -2
- package/.agents/workflows/audit-clean-code.md +1 -1
- package/.agents/workflows/audit-data-model.md +1 -1
- package/.agents/workflows/audit-dependencies.md +1 -1
- package/.agents/workflows/audit-devops.md +1 -1
- package/.agents/workflows/audit-documentation.md +1 -1
- package/.agents/workflows/audit-exceptions.md +2 -2
- package/.agents/workflows/audit-mobile.md +1 -1
- package/.agents/workflows/audit-navigability.md +1 -1
- package/.agents/workflows/audit-performance.md +1 -1
- package/.agents/workflows/audit-privacy.md +1 -1
- package/.agents/workflows/audit-quality.md +1 -1
- package/.agents/workflows/audit-security.md +1 -1
- package/.agents/workflows/audit-seo.md +1 -1
- package/.agents/workflows/audit-sre.md +1 -1
- package/.agents/workflows/audit-to-stories.md +9 -7
- package/.agents/workflows/audit-ux-ui.md +1 -1
- package/.agents/workflows/helpers/audit-lens-core.md +8 -5
- package/.agents/workflows/helpers/deliver-digest.md +4 -5
- package/.agents/workflows/helpers/deliver-story-reference.md +4 -4
- package/.agents/workflows/mandrel-deliver.md +3 -1
- package/README.md +6 -3
- package/docs/CHANGELOG.md +29 -0
- package/lib/cli/doctor-checks/codex.js +240 -0
- package/lib/cli/doctor-checks/merge-driver.js +79 -0
- package/lib/cli/doctor-checks/payload.js +201 -0
- package/lib/cli/doctor-checks/read-json.js +16 -0
- package/lib/cli/doctor-checks/runtime-deps.js +146 -0
- package/lib/cli/doctor-checks/spawn.js +18 -0
- package/lib/cli/doctor-checks/sync-parity.js +205 -0
- package/lib/cli/doctor-checks/test-credit-path.js +270 -0
- package/lib/cli/doctor-checks/toolchain.js +137 -0
- package/lib/cli/doctor-checks/version-current.js +82 -0
- package/lib/cli/registry.js +40 -1330
- package/package.json +1 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// lib/cli/doctor-checks/toolchain.js — Doctor checks: node-version, git-available, gh-available, github-token, gh-auth.
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
REQUIRED_NODE_CEILING_MAJOR,
|
|
5
|
+
REQUIRED_NODE_FLOOR,
|
|
6
|
+
satisfiesNodeEngine,
|
|
7
|
+
} from '../../../.agents/scripts/lib/bootstrap/project-bootstrap.js';
|
|
8
|
+
import { spawn } from './spawn.js';
|
|
9
|
+
|
|
10
|
+
// check: node-version
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {{ nodeVersion?: string }} [opts]
|
|
14
|
+
* @returns {{ ok: boolean, detail: string, remedy?: string }}
|
|
15
|
+
*/
|
|
16
|
+
export function runNodeVersion({ nodeVersion = process.versions.node } = {}) {
|
|
17
|
+
const ok = satisfiesNodeEngine(nodeVersion);
|
|
18
|
+
const detail = `v${nodeVersion} (required >=${REQUIRED_NODE_FLOOR} <${REQUIRED_NODE_CEILING_MAJOR})`;
|
|
19
|
+
if (ok) return { ok: true, detail };
|
|
20
|
+
return {
|
|
21
|
+
ok: false,
|
|
22
|
+
detail,
|
|
23
|
+
remedy: `Upgrade Node to >=${REQUIRED_NODE_FLOOR} <${REQUIRED_NODE_CEILING_MAJOR}: https://nodejs.org/`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// check: git-available
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {{ runner?: (cmd: string, args: string[]) => { status: number|null, stdout: string, stderr: string, error?: NodeJS.ErrnoException } }} [opts]
|
|
31
|
+
* @returns {{ ok: boolean, detail: string, remedy?: string }}
|
|
32
|
+
*/
|
|
33
|
+
export function runGitAvailable({ runner = spawn } = {}) {
|
|
34
|
+
const r = runner('git', ['--version']);
|
|
35
|
+
if (r.error?.code === 'ENOENT' || r.status !== 0) {
|
|
36
|
+
const snippet = (r.stderr || r.stdout || '').trim().slice(0, 120);
|
|
37
|
+
return {
|
|
38
|
+
ok: false,
|
|
39
|
+
detail: snippet || 'git not found on PATH',
|
|
40
|
+
remedy: 'Install git: https://git-scm.com/downloads — then re-run.',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return { ok: true, detail: r.stdout.trim().split('\n')[0] };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// check: gh-available
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @param {{ runner?: (cmd: string, args: string[]) => { status: number|null, stdout: string, stderr: string, error?: NodeJS.ErrnoException } }} [opts]
|
|
50
|
+
* @returns {{ ok: boolean, detail: string, remedy?: string }}
|
|
51
|
+
*/
|
|
52
|
+
export function runGhAvailable({ runner = spawn } = {}) {
|
|
53
|
+
const r = runner('gh', ['--version']);
|
|
54
|
+
if (r.error?.code === 'ENOENT' || r.status !== 0) {
|
|
55
|
+
const snippet = (r.stderr || r.stdout || '').trim().slice(0, 120);
|
|
56
|
+
return {
|
|
57
|
+
ok: false,
|
|
58
|
+
detail: snippet || 'gh not found on PATH',
|
|
59
|
+
remedy: 'Install gh CLI: https://cli.github.com/ — then re-run.',
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return { ok: true, detail: r.stdout.trim().split('\n')[0] };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// check: github-token
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Resolve a token the way `providers/github/auth.js#resolveToken` does: env
|
|
69
|
+
* `GITHUB_TOKEN`/`GH_TOKEN`, else `gh auth token`. The CLI does not load
|
|
70
|
+
* `.env`, so an env-only check would false-block `gh auth login` users.
|
|
71
|
+
*
|
|
72
|
+
* @param {{ env?: Record<string,string|undefined>,
|
|
73
|
+
* runner?: (cmd: string, args: string[]) => {
|
|
74
|
+
* status: number|null, stdout: string, stderr: string,
|
|
75
|
+
* error?: NodeJS.ErrnoException } }} [opts]
|
|
76
|
+
* @returns {{ ok: boolean, detail: string, remedy?: string }}
|
|
77
|
+
*/
|
|
78
|
+
export function runGithubToken({ env = process.env, runner = spawn } = {}) {
|
|
79
|
+
const envToken = env.GITHUB_TOKEN || env.GH_TOKEN;
|
|
80
|
+
if (envToken && envToken.length > 0) {
|
|
81
|
+
return { ok: true, detail: 'GITHUB_TOKEN set' };
|
|
82
|
+
}
|
|
83
|
+
const r = runner('gh', ['auth', 'token']);
|
|
84
|
+
const ghToken = !r.error && r.status === 0 ? (r.stdout || '').trim() : '';
|
|
85
|
+
if (ghToken.length > 0) {
|
|
86
|
+
return { ok: true, detail: 'token resolved via `gh auth token`' };
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
ok: false,
|
|
90
|
+
detail: 'no GitHub token (env unset, `gh auth token` returned nothing)',
|
|
91
|
+
remedy:
|
|
92
|
+
'Run `gh auth login` (the CLI resolves the token via `gh auth token`), or export GITHUB_TOKEN=<your-token>.',
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// check: gh-auth
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* `gh auth status` live-validates the token, which an Actions installation
|
|
100
|
+
* token (and some fine-grained tokens) cannot pass even though they work for
|
|
101
|
+
* everything mandrel does. The runtime never consults it, so a failing status
|
|
102
|
+
* with an env token present is warn-and-skip (ok); only "no token and not
|
|
103
|
+
* logged in" fails.
|
|
104
|
+
*
|
|
105
|
+
* @param {{ runner?: (cmd: string, args: string[]) => { status: number|null, stdout: string, stderr: string, error?: NodeJS.ErrnoException }, env?: Record<string,string|undefined> }} [opts]
|
|
106
|
+
* @returns {{ ok: boolean, detail: string, remedy?: string }}
|
|
107
|
+
*/
|
|
108
|
+
export function runGhAuth({ runner = spawn, env = process.env } = {}) {
|
|
109
|
+
const r = runner('gh', ['auth', 'status']);
|
|
110
|
+
if (r.error?.code === 'ENOENT') {
|
|
111
|
+
return {
|
|
112
|
+
ok: false,
|
|
113
|
+
detail: 'gh not found — auth check skipped',
|
|
114
|
+
remedy: 'Install the GitHub CLI: https://cli.github.com',
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (r.status !== 0) {
|
|
118
|
+
const envToken = env.GITHUB_TOKEN || env.GH_TOKEN;
|
|
119
|
+
if (envToken && envToken.length > 0) {
|
|
120
|
+
return {
|
|
121
|
+
ok: true,
|
|
122
|
+
detail:
|
|
123
|
+
'`gh auth status` could not validate the active token, but GITHUB_TOKEN/GH_TOKEN is set (the runtime authenticates non-interactively with it)',
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
ok: false,
|
|
128
|
+
detail: 'not logged in',
|
|
129
|
+
remedy:
|
|
130
|
+
'Run `gh auth login` (choose GitHub.com → HTTPS → login with a web browser), then re-run.',
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const output = (r.stdout + r.stderr).trim();
|
|
134
|
+
const match = /Logged in to \S+ as (\S+)/i.exec(output);
|
|
135
|
+
const detail = match ? `logged in as ${match[1]}` : 'logged in';
|
|
136
|
+
return { ok: true, detail };
|
|
137
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// lib/cli/doctor-checks/version-current.js — Doctor check: version-current.
|
|
2
|
+
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { readCache } from '../version-check.js';
|
|
7
|
+
import { compareVersions as compareSemver } from '../version-helpers.js';
|
|
8
|
+
|
|
9
|
+
// check: version-current
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {typeof fs} fsImpl
|
|
13
|
+
* @returns {string}
|
|
14
|
+
*/
|
|
15
|
+
function defaultInstalledVersion(fsImpl) {
|
|
16
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const manifestPath = path.resolve(here, '..', '..', '..', 'package.json');
|
|
18
|
+
const parsed = JSON.parse(fsImpl.readFileSync(manifestPath, 'utf8'));
|
|
19
|
+
return String(parsed.version);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Mirrors `version-check.js#DEFAULT_CACHE_FILENAME`. */
|
|
23
|
+
const DEFAULT_VERSION_CACHE_FILENAME = 'version-check.json';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Anchored at the consumer root so the cache survives reinstalls that
|
|
27
|
+
* replace `node_modules/`.
|
|
28
|
+
*
|
|
29
|
+
* @returns {string}
|
|
30
|
+
*/
|
|
31
|
+
function defaultVersionCachePath() {
|
|
32
|
+
return path.join(process.cwd(), 'temp', DEFAULT_VERSION_CACHE_FILENAME);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Cache-only stale-version advisory: reads the freshness cache and never hits
|
|
37
|
+
* the network. Always `ok: true`, so it can never fail doctor or CI.
|
|
38
|
+
*
|
|
39
|
+
* @param {{
|
|
40
|
+
* cachePath?: string,
|
|
41
|
+
* installedVersion?: string,
|
|
42
|
+
* fsImpl?: typeof fs,
|
|
43
|
+
* }} [opts]
|
|
44
|
+
* @returns {{ ok: boolean, detail: string, remedy?: string }}
|
|
45
|
+
*/
|
|
46
|
+
export function runVersionCurrent({
|
|
47
|
+
cachePath,
|
|
48
|
+
installedVersion,
|
|
49
|
+
fsImpl = fs,
|
|
50
|
+
} = {}) {
|
|
51
|
+
const resolvedPath = cachePath ?? defaultVersionCachePath();
|
|
52
|
+
|
|
53
|
+
let current = installedVersion;
|
|
54
|
+
if (!current) {
|
|
55
|
+
try {
|
|
56
|
+
current = defaultInstalledVersion(fsImpl);
|
|
57
|
+
} catch {
|
|
58
|
+
return {
|
|
59
|
+
ok: true,
|
|
60
|
+
detail: 'installed version unknown — advisory skipped',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const cached = readCache({ cachePath: resolvedPath, fs: fsImpl });
|
|
66
|
+
if (!cached) {
|
|
67
|
+
return {
|
|
68
|
+
ok: true,
|
|
69
|
+
detail: `v${current} (no cached freshness check yet)`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (compareSemver(cached.latestVersion, current) > 0) {
|
|
74
|
+
return {
|
|
75
|
+
ok: true,
|
|
76
|
+
detail: `a newer version is available: v${current} → v${cached.latestVersion} (advisory)`,
|
|
77
|
+
remedy: 'Run `mandrel update` to upgrade to the latest version.',
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return { ok: true, detail: `v${current} is up to date` };
|
|
82
|
+
}
|