mandrel 2.35.0 → 2.37.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 (108) hide show
  1. package/.agents/docs/agentrc-reference.json +3 -1
  2. package/.agents/docs/configuration.md +27 -0
  3. package/.agents/rules/testing-standards.md +56 -0
  4. package/.agents/schemas/agentrc.schema.json +11 -0
  5. package/.agents/schemas/lifecycle/merge.unlanded.schema.json +2 -1
  6. package/.agents/schemas/story-deliver-terminal.schema.json +1 -0
  7. package/.agents/scripts/boot-sweep.js +7 -1
  8. package/.agents/scripts/check-context-budget.js +195 -103
  9. package/.agents/scripts/check-cyclomatic.js +112 -42
  10. package/.agents/scripts/check-doc-links.js +23 -2
  11. package/.agents/scripts/check-generated-validator.js +202 -0
  12. package/.agents/scripts/check-lifecycle-lint.js +2 -68
  13. package/.agents/scripts/check-schema-references.js +2 -28
  14. package/.agents/scripts/drain-pending-cleanup.js +18 -1
  15. package/.agents/scripts/git-cleanup.js +2 -0
  16. package/.agents/scripts/lib/baselines/components.js +32 -2
  17. package/.agents/scripts/lib/baselines/env-overrides.js +1 -1
  18. package/.agents/scripts/lib/bootstrap/branch-protection.js +1 -1
  19. package/.agents/scripts/lib/bootstrap/install-ledger.js +1 -1
  20. package/.agents/scripts/lib/bootstrap/prompt.js +1 -1
  21. package/.agents/scripts/lib/bootstrap/quality-bootstrap.js +2 -2
  22. package/.agents/scripts/lib/checks/loop-health.js +1 -1
  23. package/.agents/scripts/lib/cli-args.js +0 -2
  24. package/.agents/scripts/lib/close-validation/gates.js +1 -1
  25. package/.agents/scripts/lib/close-validation/process.js +1 -1
  26. package/.agents/scripts/lib/config/ci.js +18 -0
  27. package/.agents/scripts/lib/config/sync-agentrc.js +1 -1
  28. package/.agents/scripts/lib/config-settings-schema-delivery.js +13 -0
  29. package/.agents/scripts/lib/config-settings-schema.js +46 -6
  30. package/.agents/scripts/lib/coverage-baseline.js +2 -2
  31. package/.agents/scripts/lib/cpu-pool.js +90 -10
  32. package/.agents/scripts/lib/crap-utils.js +6 -2
  33. package/.agents/scripts/lib/cyclomatic-ceiling.js +28 -6
  34. package/.agents/scripts/lib/cyclomatic-scope.js +144 -0
  35. package/.agents/scripts/lib/dependency-version.js +86 -0
  36. package/.agents/scripts/lib/duplicate-search.js +1 -1
  37. package/.agents/scripts/lib/errors/index.js +1 -1
  38. package/.agents/scripts/lib/feedback-loop/graduator-core.js +2 -2
  39. package/.agents/scripts/lib/feedback-loop/prior-feedback-fetcher.js +1 -1
  40. package/.agents/scripts/lib/feedback-loop/retro-proposals-graduator.js +1 -1
  41. package/.agents/scripts/lib/generated/agentrc-validator.js +16 -0
  42. package/.agents/scripts/lib/install-cmd-parser.js +1 -1
  43. package/.agents/scripts/lib/knip-entry-sync.js +1 -57
  44. package/.agents/scripts/lib/maintainability-utils.js +108 -10
  45. package/.agents/scripts/lib/observability/source-classifier.js +1 -1
  46. package/.agents/scripts/lib/orchestration/git-cleanup/phases/branches.js +22 -7
  47. package/.agents/scripts/lib/orchestration/git-cleanup/phases/git-probes.js +22 -14
  48. package/.agents/scripts/lib/orchestration/git-cleanup/phases/merged-tip.js +132 -0
  49. package/.agents/scripts/lib/orchestration/git-cleanup/phases/render.js +56 -11
  50. package/.agents/scripts/lib/orchestration/merge-block-class.js +10 -1
  51. package/.agents/scripts/lib/orchestration/merge-poll.js +164 -0
  52. package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +70 -9
  53. package/.agents/scripts/lib/orchestration/pr-watch.js +1 -30
  54. package/.agents/scripts/lib/orchestration/reassert-status-column.js +2 -2
  55. package/.agents/scripts/lib/orchestration/review-providers/codex.js +3 -3
  56. package/.agents/scripts/lib/orchestration/review-providers/findings-renderer.js +1 -1
  57. package/.agents/scripts/lib/orchestration/review-providers/native.js +9 -2
  58. package/.agents/scripts/lib/orchestration/review-providers/review-depth.js +2 -2
  59. package/.agents/scripts/lib/orchestration/review-providers/security-review.js +3 -3
  60. package/.agents/scripts/lib/orchestration/single-story-close/phases/auto-merge.js +145 -0
  61. package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +96 -5
  62. package/.agents/scripts/lib/orchestration/single-story-close/phases/options.js +52 -1
  63. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +9 -1
  64. package/.agents/scripts/lib/orchestration/story-close/format-autofix.js +2 -5
  65. package/.agents/scripts/lib/orchestration/story-follow-ups.js +1 -1
  66. package/.agents/scripts/lib/orchestration/ticket-lease.js +34 -9
  67. package/.agents/scripts/lib/orchestration/ticketing/reads.js +3 -1
  68. package/.agents/scripts/lib/preflight-runner.js +3 -3
  69. package/.agents/scripts/lib/qa/qa-session.js +1 -1
  70. package/.agents/scripts/lib/runtime-deps/manifest.js +1 -7
  71. package/.agents/scripts/lib/runtime-deps/scan-imports.js +3 -58
  72. package/.agents/scripts/lib/single-story-sweep/sweep-lock.js +284 -25
  73. package/.agents/scripts/lib/skills/walk-skill-files.js +1 -1
  74. package/.agents/scripts/lib/source-text/strip-js-comments.js +115 -0
  75. package/.agents/scripts/lib/test-isolate/runner.js +3 -3
  76. package/.agents/scripts/lib/test-runner-contract.js +14 -6
  77. package/.agents/scripts/lib/test-tiers.js +135 -18
  78. package/.agents/scripts/lib/transpile.js +16 -3
  79. package/.agents/scripts/lib/worktree/lifecycle/pending-cleanup.js +169 -31
  80. package/.agents/scripts/lib/worktree/node-modules-strategy.js +2 -5
  81. package/.agents/scripts/notify.js +4 -10
  82. package/.agents/scripts/pr-watch-with-update.js +305 -137
  83. package/.agents/scripts/providers/github/tickets.js +109 -16
  84. package/.agents/scripts/quality-preview.js +162 -70
  85. package/.agents/scripts/run-test-profile.js +8 -5
  86. package/.agents/scripts/run-tests.js +79 -14
  87. package/.agents/scripts/single-story-close.js +0 -2
  88. package/.agents/scripts/single-story-init.js +5 -1
  89. package/.agents/workflows/audit-documentation.md +5 -6
  90. package/docs/CHANGELOG.md +50 -0
  91. package/lib/cli/migrate.js +100 -94
  92. package/lib/migrations/helpers/retire-agentrc-key.js +200 -0
  93. package/lib/migrations/index.js +32 -33
  94. package/lib/migrations/steps/2.1.0-retire-mi-drop-knobs.js +21 -80
  95. package/lib/migrations/steps/2.1.0-retire-verify-concurrency-cap.js +15 -87
  96. package/lib/migrations/steps/2.11.0-retire-max-seed-words.js +13 -71
  97. package/lib/migrations/steps/2.20.0-retire-codebase-snapshot.js +13 -101
  98. package/lib/migrations/steps/2.32.0-retire-lint-baseline-command.js +13 -100
  99. package/package.json +9 -5
  100. package/.agents/scripts/generate-lifecycle-docs.js +0 -237
  101. package/.agents/scripts/lib/audit-suite/frontmatter-lint.js +0 -32
  102. package/.agents/scripts/lib/baselines/maintainability-baseline-save.js +0 -37
  103. package/.agents/scripts/lib/cli/parse-numeric.js +0 -60
  104. package/.agents/scripts/lib/close-validation/telemetry.js +0 -79
  105. package/.agents/scripts/lib/orchestration/label-transitions.js +0 -44
  106. package/.agents/scripts/lib/orchestration/parked-follow-ons.js +0 -147
  107. package/.agents/scripts/lib/orchestration/phase-runner.js +0 -88
  108. package/.agents/scripts/lib/orchestration/recut.js +0 -56
@@ -0,0 +1,86 @@
1
+ /**
2
+ * dependency-version.js — read an installed package's version without
3
+ * evaluating the package (Story #5109).
4
+ *
5
+ * Baselines stamp the versions of the tools that produced them so a consumer
6
+ * can detect scorer drift. The obvious way to get one — `require(pkg).version`
7
+ * — pays the package's whole module-initialisation cost for a string that is
8
+ * sitting in a manifest a few kilobytes long. For `typescript` that was ~65 ms
9
+ * of CPU and ~75 MB of RSS on every `check-baselines --gate crap` and every
10
+ * `quality-preview` run, in a repository with no TypeScript in it at all.
11
+ *
12
+ * `require.resolve` walks the resolver without reading or executing the
13
+ * target, so everything here is path arithmetic plus one small `JSON.parse`.
14
+ *
15
+ * This deliberately does **not** replace `crap-utils.js#resolveEscomplexVersion`,
16
+ * which answers a different question: it walks `node_modules` upward from a
17
+ * caller-supplied `cwd` rather than resolving from this module's own location,
18
+ * because the escomplex stamp must describe the tree being scanned.
19
+ *
20
+ * @module lib/dependency-version
21
+ */
22
+
23
+ import fs from 'node:fs';
24
+ import path from 'node:path';
25
+
26
+ /**
27
+ * Locate a package's manifest via the module resolver, without loading it.
28
+ *
29
+ * The `<pkg>/package.json` subpath is tried first because it is a single
30
+ * resolver call. A package whose `exports` map withholds `./package.json`
31
+ * falls back to resolving the main entry and walking up to the nearest
32
+ * `package.json`, which is still evaluation-free.
33
+ *
34
+ * @param {string} name Package name, e.g. `'typescript'`.
35
+ * @param {NodeJS.Require} requireFn A `createRequire`-produced require whose
36
+ * resolution base is the calling module.
37
+ * @returns {string | null} Absolute manifest path, or `null` when unresolvable.
38
+ */
39
+ function resolveManifestPath(name, requireFn) {
40
+ try {
41
+ return requireFn.resolve(`${name}/package.json`);
42
+ } catch {
43
+ // fall through to the main-entry walk
44
+ }
45
+ let dir;
46
+ try {
47
+ dir = path.dirname(requireFn.resolve(name));
48
+ } catch {
49
+ return null;
50
+ }
51
+ const { root } = path.parse(dir);
52
+ while (true) {
53
+ const candidate = path.join(dir, 'package.json');
54
+ if (fs.existsSync(candidate)) return candidate;
55
+ if (dir === root) return null;
56
+ const parent = path.dirname(dir);
57
+ if (parent === dir) return null;
58
+ dir = parent;
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Resolve an installed package's declared version.
64
+ *
65
+ * Returns `null` — never a guess and never a throw — when the package cannot
66
+ * be resolved, its manifest cannot be read or parsed, or it declares no
67
+ * usable `version`. Callers map that onto their own sentinel (the baseline
68
+ * writers use `'0.0.0'`, meaning "unknown environment").
69
+ *
70
+ * @param {string} name Package name.
71
+ * @param {NodeJS.Require} requireFn A `createRequire`-produced require.
72
+ * @returns {string | null}
73
+ */
74
+ export function resolveDependencyVersion(name, requireFn) {
75
+ const manifest = resolveManifestPath(name, requireFn);
76
+ if (!manifest) return null;
77
+ try {
78
+ const parsed = JSON.parse(fs.readFileSync(manifest, 'utf-8'));
79
+ if (parsed && typeof parsed.version === 'string' && parsed.version) {
80
+ return parsed.version;
81
+ }
82
+ } catch {
83
+ // unreadable / unparseable manifest
84
+ }
85
+ return null;
86
+ }
@@ -207,7 +207,7 @@ function normalizeIssue(issue) {
207
207
  * }} args
208
208
  * @returns {Array<{ id: number, title: string, score: number, url: string }>}
209
209
  */
210
- export function rankOpenStoryDuplicates({
210
+ function rankOpenStoryDuplicates({
211
211
  seed,
212
212
  openStories,
213
213
  minScore = DEFAULT_MIN_SCORE,
@@ -6,7 +6,7 @@
6
6
  * message substrings.
7
7
  */
8
8
 
9
- export class ConflictingTypeLabelsError extends Error {
9
+ class ConflictingTypeLabelsError extends Error {
10
10
  constructor(message) {
11
11
  super(message);
12
12
  this.name = 'ConflictingTypeLabelsError';
@@ -60,7 +60,7 @@ import { upsertStructuredComment } from '../orchestration/ticketing.js';
60
60
  * finalize indefinitely; the walk now caps every spawn at this bound unless
61
61
  * a caller overrides it.
62
62
  */
63
- export const DEFAULT_RUN_CHILD_TIMEOUT_MS = 30000;
63
+ const DEFAULT_RUN_CHILD_TIMEOUT_MS = 30000;
64
64
 
65
65
  /**
66
66
  * Default per-run filing cap. `graduate()` files at most this many follow-up
@@ -72,7 +72,7 @@ export const DEFAULT_MAX_FILINGS_PER_RUN = 20;
72
72
  * Structured-comment type used to durably persist cross-repo-deferred
73
73
  * findings on the Epic. Registered in `STRUCTURED_COMMENT_TYPES`.
74
74
  */
75
- export const CROSS_REPO_DEFERRED_COMMENT_TYPE = 'cross-repo-deferred';
75
+ const CROSS_REPO_DEFERRED_COMMENT_TYPE = 'cross-repo-deferred';
76
76
 
77
77
  /**
78
78
  * Explicit, greppable opt-back-in to live issue filing from a context the
@@ -52,7 +52,7 @@ const FRICTION_LABEL_PREFIX = 'friction::';
52
52
  * @param {Array<{ number: number, labels?: string[] }>} issues
53
53
  * @returns {Array<{ class: string, count: number, issues: number[] }>}
54
54
  */
55
- export function extractRecurringDefectClasses(issues) {
55
+ function extractRecurringDefectClasses(issues) {
56
56
  if (!Array.isArray(issues)) return [];
57
57
  /** @type {Map<string, Set<number>>} */
58
58
  const byClass = new Map();
@@ -387,7 +387,7 @@ export function enrichRoutedProposalsWithFilings(routedProposals, filed) {
387
387
  * @param {string|null|undefined} slug
388
388
  * @returns {{ owner: string, repo: string } | null}
389
389
  */
390
- export function parseRepoSlug(slug) {
390
+ function parseRepoSlug(slug) {
391
391
  if (typeof slug !== 'string') return null;
392
392
  const parts = slug.split('/');
393
393
  if (parts.length !== 2) return null;