@khoavu882/doflow 2.0.0-beta.3 → 2.0.0-beta.4

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 (167) hide show
  1. package/bin/doflow.js +2 -2
  2. package/core/.claude-plugin/plugin.json +1 -1
  3. package/core/.codex-plugin/plugin.json +1 -1
  4. package/core/.plugin/plugin.json +1 -1
  5. package/core/registry/storage.json +87 -83
  6. package/core/registry/verification.json +1 -1
  7. package/core/shared/scripts/doflow/bash/render-puml.sh +2 -2
  8. package/core/shared/skills/do-execute-plan/references/scaffold.md +2 -2
  9. package/package.json +4 -2
  10. package/src/adapters/antigravity/{index.ts → index.js} +60 -60
  11. package/src/adapters/claude/{index.ts → index.js} +48 -48
  12. package/src/adapters/claude/{mcp.ts → mcp.js} +16 -16
  13. package/src/adapters/codex/{agents.ts → agents.js} +24 -24
  14. package/src/adapters/codex/{config.ts → config.js} +49 -49
  15. package/src/adapters/codex/{hooks.ts → hooks.js} +23 -23
  16. package/src/adapters/codex/{index.ts → index.js} +98 -98
  17. package/src/adapters/codex/{mcp.ts → mcp.js} +38 -38
  18. package/src/adapters/codex/{native-projection.ts → native-projection.js} +5 -5
  19. package/src/adapters/copilot/{index.ts → index.js} +42 -42
  20. package/src/adapters/{copy-tree.ts → copy-tree.js} +70 -70
  21. package/src/adapters/gemini/{hooks.ts → hooks.js} +24 -24
  22. package/src/adapters/gemini/{index.ts → index.js} +41 -41
  23. package/src/adapters/{hook-commands.ts → hook-commands.js} +8 -8
  24. package/src/adapters/{index.ts → index.js} +13 -13
  25. package/src/adapters/kiro/{index.ts → index.js} +34 -34
  26. package/src/adapters/{mcp-entries.ts → mcp-entries.js} +55 -55
  27. package/src/adapters/opencode/{index.ts → index.js} +52 -52
  28. package/src/adapters/pi/{index.ts → index.js} +30 -30
  29. package/src/adapters/pi/{json-members.ts → json-members.js} +23 -23
  30. package/src/adapters/pi/{mcp.ts → mcp.js} +70 -70
  31. package/src/adapters/{resolve-source.ts → resolve-source.js} +1 -1
  32. package/src/cli/commands/{install.ts → install.js} +24 -24
  33. package/src/cli/commands/{list-backups.ts → list-backups.js} +4 -4
  34. package/src/cli/commands/{reconcile.ts → reconcile.js} +19 -19
  35. package/src/cli/commands/{remove.ts → remove.js} +10 -10
  36. package/src/cli/commands/{rollback.ts → rollback.js} +17 -17
  37. package/src/cli/commands/{self-update.ts → self-update.js} +3 -3
  38. package/src/cli/commands/{status.ts → status.js} +24 -24
  39. package/src/cli/commands/{tools.ts → tools.js} +16 -16
  40. package/src/cli/commands/{update.ts → update.js} +19 -19
  41. package/src/cli/{index.ts → index.js} +26 -26
  42. package/src/cli/{runtime-commands.ts → runtime-commands.js} +48 -48
  43. package/src/cli/{shared.ts → shared.js} +40 -40
  44. package/src/helper/{bash-helper.ts → bash-helper.js} +7 -7
  45. package/src/helper/{git.ts → git.js} +2 -2
  46. package/src/helper/{guardrails.ts → guardrails.js} +10 -10
  47. package/src/helper/{harness-paths.ts → harness-paths.js} +24 -24
  48. package/src/helper/{marker-merge.ts → marker-merge.js} +4 -4
  49. package/src/helper/{prompt.ts → prompt.js} +5 -5
  50. package/src/helper/{repo-root.ts → repo-root.js} +2 -2
  51. package/src/helper/{settings-merge.ts → settings-merge.js} +27 -27
  52. package/src/helper/{settings-scope.ts → settings-scope.js} +3 -3
  53. package/src/helper/{toml.ts → toml.js} +48 -48
  54. package/src/install/{backup-set.ts → backup-set.js} +16 -16
  55. package/src/install/{backup.ts → backup.js} +65 -65
  56. package/src/install/{context.ts → context.js} +15 -15
  57. package/src/install/{manifest.ts → manifest.js} +27 -27
  58. package/src/install/{mcp.ts → mcp.js} +30 -30
  59. package/src/install/{paths.ts → paths.js} +15 -15
  60. package/src/install/{targets.ts → targets.js} +10 -10
  61. package/src/install/{tool-lifecycle.ts → tool-lifecycle.js} +20 -20
  62. package/src/lifecycle/{bash-availability.ts → bash-availability.js} +1 -1
  63. package/src/lifecycle/{index.ts → index.js} +140 -140
  64. package/src/lifecycle/{mcp-index.ts → mcp-index.js} +1 -1
  65. package/src/lifecycle/{policies.ts → policies.js} +11 -11
  66. package/src/lifecycle/{view.ts → view.js} +28 -28
  67. package/src/registry/{index.ts → index.js} +60 -60
  68. package/src/release/build-package.js +91 -0
  69. package/src/release/changelog-section.js +70 -0
  70. package/src/release/{sync-plugin-versions.ts → sync-plugin-versions.js} +4 -4
  71. package/src/runtime/advice/{cli.ts → cli.js} +31 -31
  72. package/src/runtime/advice/{client.ts → client.js} +44 -44
  73. package/src/runtime/advice/{config.ts → config.js} +16 -16
  74. package/src/runtime/advice/{doctor.ts → doctor.js} +32 -32
  75. package/src/runtime/advice/{endpoint-guard.ts → endpoint-guard.js} +20 -20
  76. package/src/runtime/advice/{kinds.ts → kinds.js} +16 -16
  77. package/src/runtime/advice/providers/{ollama-systemone.ts → ollama-systemone.js} +21 -21
  78. package/src/runtime/advice/{record.ts → record.js} +19 -19
  79. package/src/runtime/advice/{registry.ts → registry.js} +16 -16
  80. package/src/runtime/advice/{strength.ts → strength.js} +7 -7
  81. package/src/runtime/{brief-tools.ts → brief-tools.js} +50 -50
  82. package/src/runtime/{c4-project.ts → c4-project.js} +27 -27
  83. package/src/runtime/{capability-router.ts → capability-router.js} +39 -39
  84. package/src/runtime/{checkouts.ts → checkouts.js} +21 -21
  85. package/src/runtime/{claims.ts → claims.js} +30 -30
  86. package/src/runtime/{cli-result.ts → cli-result.js} +4 -4
  87. package/src/runtime/{cli.ts → cli.js} +37 -37
  88. package/src/runtime/{command-detect.ts → command-detect.js} +47 -47
  89. package/src/runtime/{context-pack.ts → context-pack.js} +20 -20
  90. package/src/runtime/{decision-register.ts → decision-register.js} +67 -67
  91. package/src/runtime/{evidence-ledger.ts → evidence-ledger.js} +25 -25
  92. package/src/runtime/failure/{capture.ts → capture.js} +29 -29
  93. package/src/runtime/failure/{classifier.ts → classifier.js} +4 -4
  94. package/src/runtime/failure/{cli.ts → cli.js} +30 -30
  95. package/src/runtime/failure/{home.ts → home.js} +6 -6
  96. package/src/runtime/failure/{store.ts → store.js} +32 -32
  97. package/src/runtime/{feature-resolve.ts → feature-resolve.js} +6 -6
  98. package/src/runtime/{freshness.ts → freshness.js} +15 -15
  99. package/src/runtime/{health.ts → health.js} +72 -72
  100. package/src/runtime/{history-compactor.ts → history-compactor.js} +25 -25
  101. package/src/runtime/{implementation-gate.ts → implementation-gate.js} +30 -30
  102. package/src/runtime/inventory/{coverage.ts → coverage.js} +10 -10
  103. package/src/runtime/inventory/{identity.ts → identity.js} +2 -2
  104. package/src/runtime/inventory/{index.ts → index.js} +36 -36
  105. package/src/runtime/inventory/{precedence.ts → precedence.js} +2 -2
  106. package/src/runtime/inventory/{read-scopes.ts → read-scopes.js} +9 -9
  107. package/src/runtime/inventory/{siblings.ts → siblings.js} +15 -15
  108. package/src/runtime/knowledge/{chunker.ts → chunker.js} +12 -12
  109. package/src/runtime/knowledge/{hybrid.ts → hybrid.js} +17 -17
  110. package/src/runtime/knowledge/{index-store.ts → index-store.js} +23 -23
  111. package/src/runtime/knowledge/{retrieval.ts → retrieval.js} +27 -27
  112. package/src/runtime/{leak-scan.ts → leak-scan.js} +12 -12
  113. package/src/runtime/lifecycle/{cli.ts → cli.js} +32 -32
  114. package/src/runtime/lifecycle/{event-store.ts → event-store.js} +48 -48
  115. package/src/runtime/lifecycle/{fold.ts → fold.js} +41 -41
  116. package/src/runtime/lifecycle/{followup.ts → followup.js} +54 -54
  117. package/src/runtime/lifecycle/{goal.ts → goal.js} +50 -50
  118. package/src/runtime/lifecycle/{intent-writer.ts → intent-writer.js} +5 -5
  119. package/src/runtime/lifecycle/{overview.ts → overview.js} +47 -47
  120. package/src/runtime/lifecycle/{release.ts → release.js} +29 -29
  121. package/src/runtime/lifecycle/{report-store.ts → report-store.js} +25 -25
  122. package/src/runtime/lifecycle/{retention.ts → retention.js} +37 -37
  123. package/src/runtime/lifecycle/{root.ts → root.js} +9 -9
  124. package/src/runtime/lifecycle/{status.ts → status.js} +64 -64
  125. package/src/runtime/lifecycle/{store-upkeep.ts → store-upkeep.js} +46 -46
  126. package/src/runtime/{locator-resolve.ts → locator-resolve.js} +7 -7
  127. package/src/runtime/{mask.ts → mask.js} +22 -22
  128. package/src/runtime/{mcp-consultations.ts → mcp-consultations.js} +54 -54
  129. package/src/runtime/{mcp-reach.ts → mcp-reach.js} +24 -24
  130. package/src/runtime/{model-router.ts → model-router.js} +20 -20
  131. package/src/runtime/{outcome.ts → outcome.js} +27 -27
  132. package/src/runtime/{reach.ts → reach.js} +21 -21
  133. package/src/runtime/{readiness-record.ts → readiness-record.js} +12 -12
  134. package/src/runtime/{readiness.ts → readiness.js} +35 -35
  135. package/src/runtime/{recovery.ts → recovery.js} +15 -15
  136. package/src/runtime/{research-request.ts → research-request.js} +34 -34
  137. package/src/runtime/{retrieval-plan.ts → retrieval-plan.js} +40 -40
  138. package/src/runtime/scaffold/{artifacts.ts → artifacts.js} +19 -19
  139. package/src/runtime/scaffold/{fingerprint.ts → fingerprint.js} +3 -3
  140. package/src/runtime/scaffold/{generate.ts → generate.js} +109 -109
  141. package/src/runtime/scaffold/{languages.ts → languages.js} +34 -34
  142. package/src/runtime/storage/{cli.ts → cli.js} +9 -9
  143. package/src/runtime/storage/{engine.ts → engine.js} +37 -37
  144. package/src/runtime/storage/{registry.ts → registry.js} +19 -19
  145. package/src/runtime/storage/{roots.ts → roots.js} +8 -8
  146. package/src/runtime/storage/{rules.ts → rules.js} +26 -26
  147. package/src/runtime/storage/{upkeep.ts → upkeep.js} +35 -35
  148. package/src/runtime/storage/{work-status.ts → work-status.js} +39 -39
  149. package/src/runtime/{task-attempts.ts → task-attempts.js} +61 -61
  150. package/src/runtime/{task-classifier.ts → task-classifier.js} +34 -34
  151. package/src/runtime/{task-scope.ts → task-scope.js} +13 -13
  152. package/src/runtime/{task-state.ts → task-state.js} +15 -15
  153. package/src/runtime/trace/{indicators.ts → indicators.js} +22 -22
  154. package/src/runtime/trace/{ledger.ts → ledger.js} +42 -42
  155. package/src/runtime/trace/{render.ts → render.js} +7 -7
  156. package/src/runtime/trace/{views.ts → views.js} +40 -40
  157. package/src/runtime/verification/{contract-runner.ts → contract-runner.js} +23 -23
  158. package/src/runtime/verification/{engine.ts → engine.js} +143 -143
  159. package/src/runtime/verification/{registry.ts → registry.js} +6 -6
  160. package/src/runtime/verification/{scope-bound.ts → scope-bound.js} +50 -50
  161. package/src/runtime/verification/{test-selection.ts → test-selection.js} +28 -28
  162. package/src/runtime/{workflow-engine.ts → workflow-engine.js} +50 -50
  163. package/src/runtime/{workflow-orchestrator.ts → workflow-orchestrator.js} +91 -91
  164. package/src/runtime/{worktree.ts → worktree.js} +31 -31
  165. package/src/state/{index.ts → index.js} +26 -26
  166. package/src/state/{lockfile.ts → lockfile.js} +20 -20
  167. package/src/state/{run-lock.ts → run-lock.js} +44 -44
@@ -32,7 +32,7 @@ const path = require('node:path');
32
32
 
33
33
  /** The roles a tier in `verification.json` can ask for. Anything else in an override is an error,
34
34
  * because a typo'd key that is silently ignored is a command the user believes is running. */
35
- const COMMAND_ROLES: readonly string[] = Object.freeze([
35
+ const COMMAND_ROLES = Object.freeze([
36
36
  'parse',
37
37
  'build',
38
38
  'lint',
@@ -60,14 +60,14 @@ const GLOB_CHARS = /[*?[{]/;
60
60
  * segment that has one (`test/**\/*.test.js` -> `test`, `**\/*.test.js` -> `.`); a plain file or
61
61
  * directory is kept as written. Duplicates are dropped.
62
62
  */
63
- function testRootsFromArgs(args: Array<string>): Array<string> {
64
- const roots: Array<string> = [];
63
+ function testRootsFromArgs(args ) {
64
+ const roots = [];
65
65
  for (const arg of args) {
66
66
  const bare = arg.replace(/^(["'])(.*)\1$/, '$2');
67
67
  let root = bare;
68
68
  if (GLOB_CHARS.test(bare)) {
69
69
  const segments = bare.split('/');
70
- const firstGlob = segments.findIndex((segment: string) => GLOB_CHARS.test(segment));
70
+ const firstGlob = segments.findIndex((segment ) => GLOB_CHARS.test(segment));
71
71
  root = segments.slice(0, firstGlob).join('/') || (bare.startsWith('/') ? '/' : '.');
72
72
  }
73
73
  if (!roots.includes(root)) roots.push(root);
@@ -85,19 +85,19 @@ const SHELL_SYNTAX = /[&|;<>$`()\\]/;
85
85
  * while leaving a targeted variant behind would report a tier as runnable that the plan just said
86
86
  * does not exist.
87
87
  */
88
- const DERIVED_ROLES: Readonly<Record<string, string>> = Object.freeze({ testTargeted: 'test' });
88
+ const DERIVED_ROLES = Object.freeze({ testTargeted: 'test' });
89
89
 
90
90
  /**
91
91
  * How a command was arrived at. `declared` means a human or a manifest script named it exactly;
92
92
  * `inferred` means this module constructed it from the toolchain's conventions and it may be wrong.
93
93
  * Kept out of any numeric form on purpose — FR-008 forbids numeric confidence in output paths.
94
94
  */
95
- const DERIVATIONS: readonly string[] = Object.freeze(['declared', 'inferred', 'override']);
95
+ const DERIVATIONS = Object.freeze(['declared', 'inferred', 'override']);
96
96
 
97
- function readFileIfPresent(filePath: string, fsImpl: any): string | null {
97
+ function readFileIfPresent(filePath , fsImpl ) {
98
98
  try {
99
99
  return fsImpl.readFileSync(filePath, 'utf8');
100
- } catch (error: any) {
100
+ } catch (error ) {
101
101
  if (error && (error.code === 'ENOENT' || error.code === 'ENOTDIR' || error.code === 'EISDIR')) {
102
102
  return null;
103
103
  }
@@ -105,7 +105,7 @@ function readFileIfPresent(filePath: string, fsImpl: any): string | null {
105
105
  }
106
106
  }
107
107
 
108
- function exists(filePath: string, fsImpl: any): boolean {
108
+ function exists(filePath , fsImpl ) {
109
109
  try {
110
110
  fsImpl.statSync(filePath);
111
111
  return true;
@@ -119,7 +119,7 @@ function exists(filePath: string, fsImpl: any): boolean {
119
119
  * workspace usually works and occasionally installs a second, divergent `node_modules`.
120
120
  * @returns {{ run: string, test: string, manager: string }}
121
121
  */
122
- function nodePackageManager(root: string, fsImpl: any): { run: string; test: string; manager: string } {
122
+ function nodePackageManager(root , fsImpl ) {
123
123
  if (exists(path.join(root, 'pnpm-lock.yaml'), fsImpl)) {
124
124
  return { run: 'pnpm run', test: 'pnpm test', manager: 'pnpm' };
125
125
  }
@@ -135,14 +135,14 @@ function nodePackageManager(root: string, fsImpl: any): { run: string; test: str
135
135
  /**
136
136
  * @returns {{ id: string, roles: Object, absent: Array<string> }|null}
137
137
  */
138
- function detectNode(root: string, fsImpl: any): any {
138
+ function detectNode(root , fsImpl ) {
139
139
  const raw = readFileIfPresent(path.join(root, 'package.json'), fsImpl);
140
140
  if (raw === null) return null;
141
141
 
142
- let pkg: any;
142
+ let pkg ;
143
143
  try {
144
144
  pkg = JSON.parse(raw);
145
- } catch (error: any) {
145
+ } catch (error ) {
146
146
  // A malformed manifest is not an absent manifest. Reporting it as "no build script" would
147
147
  // hand the caller a confident answer derived from a file it failed to read.
148
148
  return { id: 'package.json', roles: {}, absent: [], error: `package.json is not valid JSON: ${error.message}` };
@@ -150,14 +150,14 @@ function detectNode(root: string, fsImpl: any): any {
150
150
 
151
151
  const scripts = (pkg && typeof pkg.scripts === 'object' && pkg.scripts) || {};
152
152
  const pm = nodePackageManager(root, fsImpl);
153
- const roles: Record<string, any> = {};
153
+ const roles = {};
154
154
  // Node has no project-wide parse step distinct from type-checking or running the code; `node
155
155
  // --check` needs an explicit file list this module does not have. Reporting it absent (rather
156
156
  // than leaving it undetected) lets the parse tier resolve NOT_APPLICABLE instead of stalling
157
157
  // every contract in every plain-JavaScript repository on a step that does not exist.
158
- const absent: string[] = ['parse'];
158
+ const absent = ['parse'];
159
159
 
160
- const script = (...names: string[]) => names.find((n) => typeof scripts[n] === 'string' && scripts[n].trim() !== '');
160
+ const script = (...names ) => names.find((n) => typeof scripts[n] === 'string' && scripts[n].trim() !== '');
161
161
 
162
162
  const buildScript = script('build');
163
163
  if (buildScript) roles.build = { command: `${pm.run} ${buildScript}`, derivation: 'declared' };
@@ -180,7 +180,7 @@ function detectNode(root: string, fsImpl: any): any {
180
180
  const testText = scripts[testScript].trim();
181
181
  const scriptArgs = testText.split(' ').slice(2);
182
182
  // A flag (`--require ./setup.js`) would be dropped by the targeted form, so it is not declared.
183
- if (NODE_TEST_SCRIPT.test(testText) && !SHELL_SYNTAX.test(testText) && !scriptArgs.some((arg: string) => arg.startsWith('-'))) {
183
+ if (NODE_TEST_SCRIPT.test(testText) && !SHELL_SYNTAX.test(testText) && !scriptArgs.some((arg ) => arg.startsWith('-'))) {
184
184
  // The runner is named by the script itself, so the targeted form is declared, not guessed.
185
185
  // `testDirs` are the roots the script's arguments name: where its test files live. A quoted
186
186
  // argument loses its quotes and a glob keeps only the path before its first glob segment.
@@ -197,7 +197,7 @@ function detectNode(root: string, fsImpl: any): any {
197
197
  return { id: 'package.json', roles, absent };
198
198
  }
199
199
 
200
- function detectRust(root: string, fsImpl: any): any {
200
+ function detectRust(root , fsImpl ) {
201
201
  if (!exists(path.join(root, 'Cargo.toml'), fsImpl)) return null;
202
202
  return {
203
203
  id: 'Cargo.toml',
@@ -212,7 +212,7 @@ function detectRust(root: string, fsImpl: any): any {
212
212
  };
213
213
  }
214
214
 
215
- function detectGo(root: string, fsImpl: any): any {
215
+ function detectGo(root , fsImpl ) {
216
216
  if (!exists(path.join(root, 'go.mod'), fsImpl)) return null;
217
217
  return {
218
218
  id: 'go.mod',
@@ -231,13 +231,13 @@ function detectGo(root: string, fsImpl: any): any {
231
231
  * dependency for tool-table presence detection is not worth it. Only the presence of a `[tool.X]`
232
232
  * table is used, which is robust to the parts of TOML this does not understand.
233
233
  */
234
- function detectPython(root: string, fsImpl: any): any {
234
+ function detectPython(root , fsImpl ) {
235
235
  const raw = readFileIfPresent(path.join(root, 'pyproject.toml'), fsImpl);
236
236
  if (raw === null) return null;
237
237
 
238
- const hasTable = (name: string) => new RegExp(`^\\s*\\[tool\\.${name}[\\].]`, 'm').test(raw);
239
- const roles: Record<string, any> = {};
240
- const absent: string[] = [];
238
+ const hasTable = (name ) => new RegExp(`^\\s*\\[tool\\.${name}[\\].]`, 'm').test(raw);
239
+ const roles = {};
240
+ const absent = [];
241
241
 
242
242
  if (hasTable('pytest') || exists(path.join(root, 'pytest.ini'), fsImpl) || exists(path.join(root, 'tests'), fsImpl)) {
243
243
  roles.test = { command: 'pytest', derivation: 'inferred' };
@@ -259,7 +259,7 @@ function detectPython(root: string, fsImpl: any): any {
259
259
  }
260
260
 
261
261
  /** Makefile target name → the role it serves. Only unambiguous names are mapped. */
262
- const MAKE_TARGET_ROLES: Readonly<Record<string, string>> = Object.freeze({
262
+ const MAKE_TARGET_ROLES = Object.freeze({
263
263
  build: 'build',
264
264
  compile: 'build',
265
265
  test: 'test',
@@ -271,14 +271,14 @@ const MAKE_TARGET_ROLES: Readonly<Record<string, string>> = Object.freeze({
271
271
  check: 'parse',
272
272
  });
273
273
 
274
- function detectMake(root: string, fsImpl: any): any {
274
+ function detectMake(root , fsImpl ) {
275
275
  const raw = readFileIfPresent(path.join(root, 'Makefile'), fsImpl) ??
276
276
  readFileIfPresent(path.join(root, 'makefile'), fsImpl);
277
277
  if (raw === null) return null;
278
278
 
279
- const roles: Record<string, any> = {};
280
- const absent: string[] = [];
281
- const targets = new Set<string>();
279
+ const roles = {};
280
+ const absent = [];
281
+ const targets = new Set ();
282
282
  // Target lines only: a leading tab means a recipe line, and `:=` is a variable assignment.
283
283
  for (const line of raw.split('\n')) {
284
284
  const m = /^([A-Za-z0-9_.\-/]+)\s*:(?!=)/.exec(line);
@@ -302,7 +302,7 @@ function detectMake(root: string, fsImpl: any): any {
302
302
  * and a repository where it is the real entrypoint is precisely the case the `plan.md` override
303
303
  * exists for.
304
304
  */
305
- const DETECTORS: readonly ((root: string, fsImpl: any) => any)[] = Object.freeze([detectNode, detectRust, detectGo, detectPython, detectMake]);
305
+ const DETECTORS = Object.freeze([detectNode, detectRust, detectGo, detectPython, detectMake]);
306
306
 
307
307
  /**
308
308
  * Extracts the override object from a feature's `plan.md`.
@@ -312,25 +312,25 @@ const DETECTORS: readonly ((root: string, fsImpl: any) => any)[] = Object.freeze
312
312
  * @param {string} planText
313
313
  * @returns {{ override: Object|null, errors: Array<string> }}
314
314
  */
315
- function parsePlanOverride(planText: any): { override: any; errors: string[] } {
315
+ function parsePlanOverride(planText ) {
316
316
  if (typeof planText !== 'string' || planText === '') return { override: null, errors: [] };
317
317
 
318
318
  const fence = new RegExp(`^[ \\t]*\`\`\`${PLAN_OVERRIDE_BLOCK}[ \\t]*\\n([\\s\\S]*?)^[ \\t]*\`\`\``, 'm');
319
319
  const match = fence.exec(planText);
320
320
  if (!match) return { override: null, errors: [] };
321
321
 
322
- let parsed: any;
322
+ let parsed ;
323
323
  try {
324
324
  parsed = JSON.parse(match[1]);
325
- } catch (error: any) {
325
+ } catch (error ) {
326
326
  return { override: null, errors: [`plan.md '${PLAN_OVERRIDE_BLOCK}' block is not valid JSON: ${error.message}`] };
327
327
  }
328
328
  if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
329
329
  return { override: null, errors: [`plan.md '${PLAN_OVERRIDE_BLOCK}' block must be a JSON object mapping command roles to commands`] };
330
330
  }
331
331
 
332
- const errors: string[] = [];
333
- for (const [key, value] of Object.entries(parsed) as [string, any][]) {
332
+ const errors = [];
333
+ for (const [key, value] of Object.entries(parsed) ) {
334
334
  if (!COMMAND_ROLES.includes(key)) {
335
335
  errors.push(`plan.md override declares unknown command role '${key}'; known roles: ${COMMAND_ROLES.join(', ')}`);
336
336
  continue;
@@ -362,21 +362,21 @@ function parsePlanOverride(planText: any): { override: any; errors: string[] } {
362
362
  * errors: Array<string>
363
363
  * }}
364
364
  */
365
- function detectCommands(options: any = {}): any {
365
+ function detectCommands(options = {}) {
366
366
  const fsImpl = options.fsImpl || fs;
367
367
  const projectRoot = options.projectRoot || process.cwd();
368
368
 
369
- const manifests: string[] = [];
370
- const commands: Record<string, any> = {};
371
- const alternatives: any[] = [];
372
- const absentByRole = new Map<string, string>();
373
- const errors: string[] = [];
369
+ const manifests = [];
370
+ const commands = {};
371
+ const alternatives = [];
372
+ const absentByRole = new Map ();
373
+ const errors = [];
374
374
 
375
375
  for (const detector of DETECTORS) {
376
- let found: any;
376
+ let found ;
377
377
  try {
378
378
  found = detector(projectRoot, fsImpl);
379
- } catch (error: any) {
379
+ } catch (error ) {
380
380
  errors.push(`Detector failed while reading ${projectRoot}: ${error.message}`);
381
381
  continue;
382
382
  }
@@ -386,7 +386,7 @@ function detectCommands(options: any = {}): any {
386
386
  errors.push(found.error);
387
387
  continue;
388
388
  }
389
- for (const [role, entry] of Object.entries(found.roles) as [string, any][]) {
389
+ for (const [role, entry] of Object.entries(found.roles) ) {
390
390
  if (commands[role]) {
391
391
  alternatives.push({ role, command: entry.command, source: found.id, derivation: entry.derivation });
392
392
  } else {
@@ -401,7 +401,7 @@ function detectCommands(options: any = {}): any {
401
401
  // A role another manifest supplied is not absent, whatever the manifest that lacked it said.
402
402
  for (const role of Object.keys(commands)) absentByRole.delete(role);
403
403
 
404
- let planText: any = options.planText;
404
+ let planText = options.planText;
405
405
  if (typeof planText !== 'string' && options.planPath) {
406
406
  planText = readFileIfPresent(options.planPath, fsImpl);
407
407
  if (planText === null) {
@@ -410,12 +410,12 @@ function detectCommands(options: any = {}): any {
410
410
  }
411
411
  }
412
412
 
413
- const declaredNone: string[] = [];
413
+ const declaredNone = [];
414
414
  const { override, errors: overrideErrors } = parsePlanOverride(planText);
415
415
  errors.push(...overrideErrors);
416
416
 
417
417
  if (override && overrideErrors.length === 0) {
418
- for (const [role, value] of Object.entries(override) as [string, any][]) {
418
+ for (const [role, value] of Object.entries(override) ) {
419
419
  if (value === null) {
420
420
  delete commands[role];
421
421
  absentByRole.delete(role);
@@ -494,7 +494,7 @@ function detectCommands(options: any = {}): any {
494
494
  * @param {string} [pattern]
495
495
  * @returns {{ command: string, substituted: boolean }}
496
496
  */
497
- function applyTargetPattern(command: any, pattern?: string): { command: string | null; substituted: boolean } {
497
+ function applyTargetPattern(command , pattern ) {
498
498
  if (typeof command !== 'string' || !command.includes(TARGET_PATTERN_TOKEN)) {
499
499
  return { command, substituted: false };
500
500
  }
@@ -2,16 +2,16 @@
2
2
 
3
3
  // TypeScript migration (agent-docs/BRIEF_GOAL_DOFLOW.md): run directly by Node native type-stripping.
4
4
 
5
- const { EvidenceLedger } = require('./evidence-ledger.ts');
6
- const { ClaimsManager } = require('./claims.ts');
7
- const { ResearchRequestStore } = require('./research-request.ts');
8
- const { finishRuntime, usageError } = require('./cli-result.ts');
9
- const { resolveActiveFeature } = require('./feature-resolve.ts');
10
- const { readRegister } = require('./decision-register.ts');
5
+ const { EvidenceLedger } = require('./evidence-ledger.js');
6
+ const { ClaimsManager } = require('./claims.js');
7
+ const { ResearchRequestStore } = require('./research-request.js');
8
+ const { finishRuntime, usageError } = require('./cli-result.js');
9
+ const { resolveActiveFeature } = require('./feature-resolve.js');
10
+ const { readRegister } = require('./decision-register.js');
11
11
 
12
12
  const NO_DECISIONS = Object.freeze({ available: false, live: [], liveCount: 0 });
13
13
 
14
- const TASK_CLASS_BUDGETS: Record<string, any> = Object.freeze({
14
+ const TASK_CLASS_BUDGETS = Object.freeze({
15
15
  feature: 225000,
16
16
  'dependency-change': 85000,
17
17
  bug: 71000,
@@ -32,23 +32,23 @@ const TASK_CLASS_BUDGETS: Record<string, any> = Object.freeze({
32
32
  * @param {{projectRoot:string, slug?:string|null}} options
33
33
  * @returns {{available:boolean, live:Array<Object>, liveCount:number, reason?:string}}
34
34
  */
35
- function loadLiveDecisions({ projectRoot, slug = null }: any) {
35
+ function loadLiveDecisions({ projectRoot, slug = null } ) {
36
36
  try {
37
37
  const feature = resolveActiveFeature({ projectRoot, slug });
38
38
  if (feature.error) return { ...NO_DECISIONS };
39
39
  let register;
40
40
  try {
41
41
  register = readRegister(feature.featureDir);
42
- } catch (error: any) {
42
+ } catch (error ) {
43
43
  // The register exists but cannot be trusted. Stay unavailable, but say why, so a stage
44
44
  // sees the corruption instead of reading "no decisions".
45
45
  return { ...NO_DECISIONS, reason: `register unreadable: ${error.message}` };
46
46
  }
47
47
  if (!register) return { ...NO_DECISIONS };
48
48
  const live = register.decisions
49
- .filter((d: any) => d.status === 'live')
50
- .sort((a: any, b: any) => (a.topic < b.topic ? -1 : a.topic > b.topic ? 1 : 0))
51
- .map(({ id, topic, statement, decidedBy, stage }: any) => ({ id, topic, statement, decidedBy, stage }));
49
+ .filter((d ) => d.status === 'live')
50
+ .sort((a , b ) => (a.topic < b.topic ? -1 : a.topic > b.topic ? 1 : 0))
51
+ .map(({ id, topic, statement, decidedBy, stage } ) => ({ id, topic, statement, decidedBy, stage }));
52
52
  return { available: true, live, liveCount: live.length };
53
53
  } catch {
54
54
  return { ...NO_DECISIONS };
@@ -56,14 +56,14 @@ function loadLiveDecisions({ projectRoot, slug = null }: any) {
56
56
  }
57
57
 
58
58
  class ContextPackCompiler {
59
- declare options: any;
59
+
60
60
  /**
61
61
  * @param {Object} [defaultOptions]
62
62
  * @param {number} [defaultOptions.maxFiles=15]
63
63
  * @param {number} [defaultOptions.maxClaims=20]
64
64
  * @param {number} [defaultOptions.maxEvidenceItems=25]
65
65
  */
66
- constructor(defaultOptions: any = {}) {
66
+ constructor(defaultOptions = {}) {
67
67
  this.options = {
68
68
  maxFiles: defaultOptions.maxFiles || 15,
69
69
  maxClaims: defaultOptions.maxClaims || 20,
@@ -85,7 +85,7 @@ class ContextPackCompiler {
85
85
  * @param {Object} [budgetOverrides={}]
86
86
  * @returns {Object} ContextPack
87
87
  */
88
- compileContextPack(params: any, budgetOverrides: any = {}) {
88
+ compileContextPack(params , budgetOverrides = {}) {
89
89
  const {
90
90
  taskId,
91
91
  taskClass = 'feature',
@@ -204,7 +204,7 @@ class ContextPackCompiler {
204
204
  * @param {Object} pack
205
205
  * @returns {string}
206
206
  */
207
- formatMarkdown(pack: any) {
207
+ formatMarkdown(pack ) {
208
208
  let md = `## ContextPack: [${pack.taskClass.toUpperCase()}] ${pack.taskId}\n`;
209
209
  if (pack.objective) {
210
210
  md += `**Objective:** ${pack.objective}\n\n`;
@@ -271,7 +271,7 @@ class ContextPackCompiler {
271
271
  * @param {Array<string>} [options.optional.unverifiedClaims]
272
272
  * @returns {Object} ContextPackResult
273
273
  */
274
- compileBoundedContextPack(options: any = {}) {
274
+ compileBoundedContextPack(options = {}) {
275
275
  const {
276
276
  taskId = 'default',
277
277
  taskClass = 'feature',
@@ -351,7 +351,7 @@ class ContextPackCompiler {
351
351
  const keptNarrative = [];
352
352
  const omissions = [];
353
353
 
354
- const buildPayload = (hList: any, cList: any, nList: any) => {
354
+ const buildPayload = (hList , cList , nList ) => {
355
355
  let md = mandatoryMd;
356
356
  if (hList.length > 0) {
357
357
  md += `### Active Hypotheses (Unverified)\n`;
@@ -424,7 +424,7 @@ class ContextPackCompiler {
424
424
  /**
425
425
  * Alias for compileBoundedContextPack.
426
426
  */
427
- compileBoundedPayload(options: any = {}) {
427
+ compileBoundedPayload(options = {}) {
428
428
  return this.compileBoundedContextPack(options);
429
429
  }
430
430
  }
@@ -446,7 +446,7 @@ class ContextPackCompiler {
446
446
  * @param {string} [options.slug] feature slug, when the task id is not the feature's own
447
447
  * @returns {number} exit code
448
448
  */
449
- function handleContextPackCommand({ taskId, taskClass, objective, json = false, stateRoot, slug }: any = {}) {
449
+ function handleContextPackCommand({ taskId, taskClass, objective, json = false, stateRoot, slug } = {}) {
450
450
  const root = stateRoot || process.cwd();
451
451
  const ledger = new EvidenceLedger({ repoRoot: root, slug });
452
452
  ledger.load(taskId);