@jterrats/open-orchestra 1.0.7 → 1.0.9

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 (131) hide show
  1. package/AGENTS.md +12 -2
  2. package/CHANGELOG.md +41 -0
  3. package/CLAUDE.md +13 -2
  4. package/dist/acceptance-criteria-quality.d.ts +12 -0
  5. package/dist/acceptance-criteria-quality.js +137 -0
  6. package/dist/acceptance-criteria-quality.js.map +1 -0
  7. package/dist/architecture-debt-inventory.d.ts +31 -0
  8. package/dist/architecture-debt-inventory.js +200 -0
  9. package/dist/architecture-debt-inventory.js.map +1 -0
  10. package/dist/architecture-debt-report.d.ts +2 -0
  11. package/dist/architecture-debt-report.js +28 -0
  12. package/dist/architecture-debt-report.js.map +1 -0
  13. package/dist/autonomous-phase-lifecycle.d.ts +5 -1
  14. package/dist/autonomous-phase-lifecycle.js +87 -17
  15. package/dist/autonomous-phase-lifecycle.js.map +1 -1
  16. package/dist/cli-payloads.d.ts +4 -0
  17. package/dist/cli-payloads.js +24 -0
  18. package/dist/cli-payloads.js.map +1 -0
  19. package/dist/cli.js +4 -446
  20. package/dist/cli.js.map +1 -1
  21. package/dist/command-manifest.js +3 -1
  22. package/dist/command-manifest.js.map +1 -1
  23. package/dist/command-route-utils.d.ts +18 -0
  24. package/dist/command-route-utils.js +18 -0
  25. package/dist/command-route-utils.js.map +1 -0
  26. package/dist/command-routes-integrations.d.ts +2 -0
  27. package/dist/command-routes-integrations.js +82 -0
  28. package/dist/command-routes-integrations.js.map +1 -0
  29. package/dist/command-routes.d.ts +2 -0
  30. package/dist/command-routes.js +175 -0
  31. package/dist/command-routes.js.map +1 -0
  32. package/dist/commands.d.ts +1 -1
  33. package/dist/commands.js +16 -3
  34. package/dist/commands.js.map +1 -1
  35. package/dist/github.js +22 -7
  36. package/dist/github.js.map +1 -1
  37. package/dist/metrics-commands.js +69 -17
  38. package/dist/metrics-commands.js.map +1 -1
  39. package/dist/phase-executor.js +5 -169
  40. package/dist/phase-executor.js.map +1 -1
  41. package/dist/phase-playbooks.js +17 -0
  42. package/dist/phase-playbooks.js.map +1 -1
  43. package/dist/qa-e2e-artifacts.d.ts +7 -0
  44. package/dist/qa-e2e-artifacts.js +225 -0
  45. package/dist/qa-e2e-artifacts.js.map +1 -0
  46. package/dist/quality-contracts.d.ts +83 -0
  47. package/dist/quality-contracts.js +463 -0
  48. package/dist/quality-contracts.js.map +1 -0
  49. package/dist/refresh-generated.js +87 -45
  50. package/dist/refresh-generated.js.map +1 -1
  51. package/dist/runtime-bootstrap-targets.d.ts +15 -0
  52. package/dist/runtime-bootstrap-targets.js +68 -0
  53. package/dist/runtime-bootstrap-targets.js.map +1 -0
  54. package/dist/runtime-bootstrap.js +3 -0
  55. package/dist/runtime-bootstrap.js.map +1 -1
  56. package/dist/runtime-commands.d.ts +2 -0
  57. package/dist/runtime-commands.js +187 -2
  58. package/dist/runtime-commands.js.map +1 -1
  59. package/dist/runtime-context-manifest.d.ts +27 -0
  60. package/dist/runtime-context-manifest.js +151 -0
  61. package/dist/runtime-context-manifest.js.map +1 -0
  62. package/dist/runtime-execution-renderer.d.ts +3 -1
  63. package/dist/runtime-execution-renderer.js +17 -53
  64. package/dist/runtime-execution-renderer.js.map +1 -1
  65. package/dist/runtime-execution.d.ts +2 -1
  66. package/dist/runtime-execution.js +166 -4
  67. package/dist/runtime-execution.js.map +1 -1
  68. package/dist/runtime-guardrails.js +9 -1
  69. package/dist/runtime-guardrails.js.map +1 -1
  70. package/dist/runtime-lifecycle-watch.d.ts +93 -0
  71. package/dist/runtime-lifecycle-watch.js +391 -0
  72. package/dist/runtime-lifecycle-watch.js.map +1 -0
  73. package/dist/runtime-parent-actions.d.ts +7 -2
  74. package/dist/runtime-parent-actions.js +132 -1
  75. package/dist/runtime-parent-actions.js.map +1 -1
  76. package/dist/runtime-renderer-lines.d.ts +5 -0
  77. package/dist/runtime-renderer-lines.js +58 -0
  78. package/dist/runtime-renderer-lines.js.map +1 -0
  79. package/dist/runtime-spawn-bridge.js +40 -10
  80. package/dist/runtime-spawn-bridge.js.map +1 -1
  81. package/dist/runtime-spawn-quality.d.ts +2 -0
  82. package/dist/runtime-spawn-quality.js +11 -0
  83. package/dist/runtime-spawn-quality.js.map +1 -0
  84. package/dist/sonar-insights.d.ts +1 -0
  85. package/dist/sonar-insights.js +6 -2
  86. package/dist/sonar-insights.js.map +1 -1
  87. package/dist/types/model-config.d.ts +6 -0
  88. package/dist/types/runtime.d.ts +26 -2
  89. package/dist/types/tasks.d.ts +12 -0
  90. package/dist/types.d.ts +1 -1
  91. package/dist/types.js.map +1 -1
  92. package/dist/web-api.js +8 -0
  93. package/dist/web-api.js.map +1 -1
  94. package/dist/web-console/assets/index-DXbrxR_d.js +11 -0
  95. package/dist/web-console/index.html +1 -1
  96. package/dist/workflow-handoff-assessment.d.ts +3 -0
  97. package/dist/workflow-handoff-assessment.js +246 -0
  98. package/dist/workflow-handoff-assessment.js.map +1 -0
  99. package/dist/workflow-handoff-contract.d.ts +32 -0
  100. package/dist/workflow-handoff-contract.js +123 -0
  101. package/dist/workflow-handoff-contract.js.map +1 -0
  102. package/dist/workflow-phase-transition.d.ts +16 -0
  103. package/dist/workflow-phase-transition.js +76 -0
  104. package/dist/workflow-phase-transition.js.map +1 -0
  105. package/dist/workflow-run-commands.js +47 -12
  106. package/dist/workflow-run-commands.js.map +1 -1
  107. package/dist/workflow-services.js +57 -27
  108. package/dist/workflow-services.js.map +1 -1
  109. package/dist/workspace-init-artifacts.d.ts +17 -0
  110. package/dist/workspace-init-artifacts.js +81 -0
  111. package/dist/workspace-init-artifacts.js.map +1 -0
  112. package/dist/workspace-runtime-bootstrap.d.ts +12 -0
  113. package/dist/workspace-runtime-bootstrap.js +64 -0
  114. package/dist/workspace-runtime-bootstrap.js.map +1 -0
  115. package/dist/workspace.d.ts +5 -2
  116. package/dist/workspace.js +43 -145
  117. package/dist/workspace.js.map +1 -1
  118. package/docs/architecture-debt-inventory.md +25 -0
  119. package/docs/autonomous-workflow.md +7 -0
  120. package/docs/e2e-test-batteries.md +106 -0
  121. package/docs/orchestra-mvp.md +8 -0
  122. package/docs/release-test-matrix.md +7 -0
  123. package/docs/runtime-adapters.md +86 -9
  124. package/docs/site-manifest.json +2 -0
  125. package/docs/sonar-quality-gates.md +133 -11
  126. package/package.json +5 -1
  127. package/rules/delivery-quality-gates.mdc +6 -0
  128. package/rules/devops-tooling.mdc +1 -0
  129. package/rules/security-guardrails.mdc +3 -0
  130. package/rules/testing-discipline.mdc +9 -0
  131. package/dist/web-console/assets/index-CgSKcay8.js +0 -11
package/AGENTS.md CHANGED
@@ -156,13 +156,13 @@
156
156
  - Mark breaking changes with `!` and a `BREAKING CHANGE:` footer.
157
157
  - Keep PRs <400 lines. Review your own diff before requesting review.
158
158
 
159
- <!-- open-orchestra:start block-id="runtime-bootstrap" generator="open-orchestra runtime bootstrap" version="1" target="codex" source-manifest="open-orchestra command-manifest,runtime-bootstrap" content-sha256="1699a3b284078cede5d7c960ee773e8a758eb28fc4c3a668400890cb7b1a27db" updated-at="2026-05-17T20:32:42.512Z" -->
159
+ <!-- open-orchestra:start block-id="runtime-bootstrap" generator="open-orchestra runtime bootstrap" version="1" target="codex" source-manifest="open-orchestra command-manifest,runtime-bootstrap" content-sha256="7a5f273757296b408cc7681f35f89457055336b539c5e7b5bfbeb07ca3aa352e" updated-at="2026-05-20T15:28:50.449Z" -->
160
160
  # Open Orchestra Runtime Bootstrap
161
161
 
162
162
  Runtime target: Codex. Reference Open Orchestra from AGENTS.md so local CLI work follows workflow gates.
163
163
 
164
164
  Use Open Orchestra as the local control plane when `.agent-workflow/` exists.
165
- The active LLM runtime is the parent agent. Do not assume automatic real subagent spawning or real provider execution.
165
+ The active LLM runtime is the parent agent. Orchestra renders spawn requests and records lifecycle; it does not call provider APIs directly.
166
166
 
167
167
  ## Orchestra Workflow — Required for All Work
168
168
 
@@ -222,6 +222,16 @@ orchestra benchmark --task <ID>
222
222
  - Run `orchestra validate --pre-run --task <ID> --json` before implementation; resolve missing estimate, workflow run, evidence, or review checks.
223
223
  - If a user accepts a smaller/advisory path, record it with `orchestra validate --pre-run --task <ID> --bypass --bypass-rationale "..."`.
224
224
 
225
+ ## Runtime-Native Background Spawn
226
+ - When a workflow phase returns `completionMode=detached`, keep the parent conversation available and do not block on the child unless the user explicitly asks to wait.
227
+ - After `orchestra workflow run` reports a pending parent runtime action, immediately inspect `orchestra runtime parent-actions --task <ID> --json` and consume safe actions supported by the active runtime.
228
+ - Codex parent runtimes should call `spawn_agent` for `codex-spawn-agent` actions using the `promptArtifact`, then record `spawned` with the returned agent id.
229
+ - Do not auto-consume actions when the user explicitly asked to pause, when the action is queued, or when the runtime/tool is unavailable or unsafe.
230
+ - Use `orchestra runtime spawn-request --task <ID> --role <role> --phase <phase> --run-id <run-id>` to render the assignment packet.
231
+ - Record child state with `orchestra runtime spawn-lifecycle --session <session-id> --status <spawned|active|completed|failed> --agent-id <id>`.
232
+ - Resume the workflow after the child completes with `orchestra workflow run --task <ID> --resume <run-id>`.
233
+ - Codex parent runtimes should use `spawn_agent` for the rendered packet and avoid waiting by default.
234
+
225
235
  ## Task Loop
226
236
  - `orchestra health` - Check local tools and workflow readiness.
227
237
  - `orchestra task list` - List local workflow tasks. Workflow phase subtasks are hidden by default.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,47 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 1.0.8 - 2026-05-19
6
+
7
+ ### Added
8
+
9
+ - Added a release-blocking runtime manual queue E2E:
10
+ `npm run test:e2e:runtime` now creates a temporary workspace, initializes
11
+ Open Orchestra, starts two manual runtime sessions, and verifies a third
12
+ manual `spawn-request` materializes as `queued` with lifecycle commands and
13
+ session visibility.
14
+ - Added an E2E test battery catalog documenting P0, P1, and P2 validation
15
+ surfaces for source quality, installed CLI, temporary workspaces, browser
16
+ console, public site, runtime delegation, recovery, security, provider, Sonar,
17
+ and package release dry-run coverage.
18
+
19
+ ### Changed
20
+
21
+ - Runtime-native spawn requests are fully asynchronous by default: parent
22
+ runtimes receive session ids, prompt artifacts, expected result artifacts,
23
+ lifecycle commands, and quality warnings without waiting on child completion.
24
+ - Release matrix now includes `runtime-manual-queue-e2e` so queued runtime
25
+ delegation behavior is part of the documented release validation surface.
26
+ - CLI routing and refresh helpers were split into smaller modules while keeping
27
+ public command behavior stable.
28
+
29
+ ### Fixed
30
+
31
+ - Manual `runtime spawn-request` now follows queue guardrails consistently:
32
+ `limitAction=queue` returns a queued artifact/session instead of failing,
33
+ while `limitAction=reject` still fails before creating a delegation artifact.
34
+
35
+ ### Validation
36
+
37
+ - `npm run test:e2e:runtime` passed.
38
+ - `npm run test:e2e` passed.
39
+ - `ORCHESTRA_NODE_SCRIPT=/Users/polux/dev/open-orchestra/bin/orchestra.js npm run test:e2e:init`
40
+ passed.
41
+ - `npm run precommit` passed.
42
+ - `npm pack --dry-run --json` produced `jterrats-open-orchestra-1.0.8.tgz`.
43
+ - `orchestra release check --json` passed and reported package version `1.0.8`
44
+ ahead of latest tag `v1.0.7`, ready for CI-owned tag creation.
45
+
5
46
  ## 0.5.1 - 2026-05-11
6
47
 
7
48
  ### Changed
package/CLAUDE.md CHANGED
@@ -169,13 +169,13 @@ Do NOT start implementation without a registered task and workflow run. Use `orc
169
169
  - Correct mistakes directly without apologizing.
170
170
  - **No Ninja Edits.** Summarize proposed changes and get agreement before modifying files.
171
171
 
172
- <!-- open-orchestra:start block-id="runtime-bootstrap" generator="open-orchestra runtime bootstrap" version="1" target="claude" source-manifest="open-orchestra command-manifest,runtime-bootstrap" content-sha256="24829d53d8697ae7e56c17f5d853452570c456ee948738a9f5174788f7d99f0d" updated-at="2026-05-17T20:32:42.510Z" -->
172
+ <!-- open-orchestra:start block-id="runtime-bootstrap" generator="open-orchestra runtime bootstrap" version="1" target="claude" source-manifest="open-orchestra command-manifest,runtime-bootstrap" content-sha256="a6b4a8288f93b5aa641780b68a503274d48f53363b3142a24158da1722d0cb42" updated-at="2026-05-20T15:29:05.492Z" -->
173
173
  # Open Orchestra Runtime Bootstrap
174
174
 
175
175
  Runtime target: Claude. Reference compact Open Orchestra blocks from CLAUDE.md and load task skills on demand.
176
176
 
177
177
  Use Open Orchestra as the local control plane when `.agent-workflow/` exists.
178
- The active LLM runtime is the parent agent. Do not assume automatic real subagent spawning or real provider execution.
178
+ The active LLM runtime is the parent agent. Orchestra renders spawn requests and records lifecycle; it does not call provider APIs directly.
179
179
 
180
180
  ## Orchestra Workflow — Required for All Work
181
181
 
@@ -235,6 +235,17 @@ orchestra benchmark --task <ID>
235
235
  - Run `orchestra validate --pre-run --task <ID> --json` before implementation; resolve missing estimate, workflow run, evidence, or review checks.
236
236
  - If a user accepts a smaller/advisory path, record it with `orchestra validate --pre-run --task <ID> --bypass --bypass-rationale "..."`.
237
237
 
238
+ ## Runtime-Native Background Spawn
239
+ - When a workflow phase returns `completionMode=detached`, keep the parent conversation available and do not block on the child unless the user explicitly asks to wait.
240
+ - After `orchestra workflow run` reports a pending parent runtime action, immediately inspect `orchestra runtime parent-actions --task <ID> --json` and consume safe actions supported by the active runtime.
241
+ - Codex parent runtimes should call `spawn_agent` for `codex-spawn-agent` actions using the `promptArtifact`, then record `spawned` with the returned agent id.
242
+ - Do not auto-consume actions when the user explicitly asked to pause, when the action is queued, or when the runtime/tool is unavailable or unsafe.
243
+ - Use `orchestra runtime spawn-request --task <ID> --role <role> --phase <phase> --run-id <run-id>` to render the assignment packet.
244
+ - Record child state with `orchestra runtime spawn-lifecycle --session <session-id> --status <spawned|active|completed|failed> --agent-id <id>`.
245
+ - Resume the workflow after the child completes with `orchestra workflow run --task <ID> --resume <run-id>`.
246
+ - Claude Code parent runtimes should launch the rendered packet with the native Agent/Subagent tool; use Task only when that is the exposed legacy alias.
247
+ - Prefer a role-named Claude subagent and record the resulting id or label in spawn lifecycle.
248
+
238
249
  ## Task Loop
239
250
  - `orchestra health` - Check local tools and workflow readiness.
240
251
  - `orchestra task list` - List local workflow tasks. Workflow phase subtasks are hidden by default.
@@ -0,0 +1,12 @@
1
+ import type { Task } from "./types.js";
2
+ export interface AcceptanceCriteriaQualityIssue {
3
+ criterion: string;
4
+ index: number;
5
+ reason: string;
6
+ }
7
+ export interface AcceptanceCriteriaQualityReport {
8
+ valid: string[];
9
+ issues: AcceptanceCriteriaQualityIssue[];
10
+ }
11
+ export declare function assessAcceptanceCriteriaQuality(task: Pick<Task, "acceptanceCriteria"> | undefined): AcceptanceCriteriaQualityReport;
12
+ export declare function hasAcceptanceCriteriaQualityIssues(task: Pick<Task, "acceptanceCriteria"> | undefined): boolean;
@@ -0,0 +1,137 @@
1
+ const MIN_ACTIONABLE_WORDS = 4;
2
+ const ROLE_OR_PHASE_FRAGMENTS = new Set([
3
+ "architect",
4
+ "developer",
5
+ "development",
6
+ "qa",
7
+ "release",
8
+ "release manager",
9
+ "po",
10
+ "pm",
11
+ "ba",
12
+ "product owner",
13
+ "business analyst",
14
+ "qa planning",
15
+ "qa execution",
16
+ ]);
17
+ const VERIFIABLE_SIGNALS = new Set([
18
+ "allow",
19
+ "allowed",
20
+ "allows",
21
+ "are",
22
+ "block",
23
+ "blocks",
24
+ "can",
25
+ "compare",
26
+ "compares",
27
+ "cover",
28
+ "covered",
29
+ "covers",
30
+ "create",
31
+ "creates",
32
+ "detect",
33
+ "detects",
34
+ "display",
35
+ "displays",
36
+ "exclude",
37
+ "excluded",
38
+ "excludes",
39
+ "expose",
40
+ "exposes",
41
+ "fail",
42
+ "fails",
43
+ "generate",
44
+ "generates",
45
+ "include",
46
+ "included",
47
+ "includes",
48
+ "is",
49
+ "list",
50
+ "lists",
51
+ "load",
52
+ "loads",
53
+ "map",
54
+ "maps",
55
+ "must",
56
+ "pass",
57
+ "passes",
58
+ "persist",
59
+ "persists",
60
+ "prevent",
61
+ "prevents",
62
+ "produce",
63
+ "produces",
64
+ "record",
65
+ "records",
66
+ "reject",
67
+ "rejected",
68
+ "rejects",
69
+ "render",
70
+ "renders",
71
+ "report",
72
+ "reports",
73
+ "require",
74
+ "required",
75
+ "requires",
76
+ "resume",
77
+ "resumes",
78
+ "return",
79
+ "returns",
80
+ "route",
81
+ "routes",
82
+ "save",
83
+ "saves",
84
+ "should",
85
+ "show",
86
+ "shows",
87
+ "update",
88
+ "updates",
89
+ "validate",
90
+ "validates",
91
+ ]);
92
+ export function assessAcceptanceCriteriaQuality(task) {
93
+ const criteria = task?.acceptanceCriteria ?? [];
94
+ const issues = [];
95
+ const valid = [];
96
+ criteria.forEach((criterion, index) => {
97
+ const reason = acceptanceCriterionIssue(criterion);
98
+ if (reason) {
99
+ issues.push({ criterion, index, reason });
100
+ }
101
+ else {
102
+ valid.push(criterion);
103
+ }
104
+ });
105
+ return { valid, issues };
106
+ }
107
+ export function hasAcceptanceCriteriaQualityIssues(task) {
108
+ return assessAcceptanceCriteriaQuality(task).issues.length > 0;
109
+ }
110
+ function acceptanceCriterionIssue(criterion) {
111
+ const normalized = criterion.trim();
112
+ if (!normalized)
113
+ return "empty acceptance criterion";
114
+ if (isRoleOrPhaseFragment(normalized)) {
115
+ return "fragment looks like a role or phase name, not a verifiable outcome";
116
+ }
117
+ if (wordCount(normalized) < MIN_ACTIONABLE_WORDS) {
118
+ return "criterion is too short to be independently verifiable";
119
+ }
120
+ if (!hasVerifiableSignal(normalized)) {
121
+ return "criterion lacks an observable verification verb";
122
+ }
123
+ return undefined;
124
+ }
125
+ function isRoleOrPhaseFragment(value) {
126
+ return ROLE_OR_PHASE_FRAGMENTS.has(value.toLowerCase());
127
+ }
128
+ function hasVerifiableSignal(value) {
129
+ return words(value).some((word) => VERIFIABLE_SIGNALS.has(word));
130
+ }
131
+ function wordCount(value) {
132
+ return value.split(/\s+/).filter(Boolean).length;
133
+ }
134
+ function words(value) {
135
+ return value.toLowerCase().match(/[a-z]+/g) ?? [];
136
+ }
137
+ //# sourceMappingURL=acceptance-criteria-quality.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acceptance-criteria-quality.js","sourceRoot":"","sources":["../src/acce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BAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;AACnD,CAAC;AAED,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;AACpD,CAAC"}
@@ -0,0 +1,31 @@
1
+ export { renderArchitectureDebtInventory } from "./architecture-debt-report.js";
2
+ export type ArchitectureDebtFindingKind = "large-file" | "long-function" | "command-module-logic" | "module-boundary";
3
+ export interface ArchitectureDebtThresholds {
4
+ largeFileLines: number;
5
+ longFunctionLines: number;
6
+ commandModuleLines: number;
7
+ }
8
+ export interface ArchitectureDebtFinding {
9
+ kind: ArchitectureDebtFindingKind;
10
+ file: string;
11
+ line?: number;
12
+ name?: string;
13
+ metric: number;
14
+ threshold: number;
15
+ status: "warn";
16
+ message: string;
17
+ }
18
+ export interface ArchitectureDebtInventoryOptions {
19
+ root: string;
20
+ roots?: string[];
21
+ thresholds?: Partial<ArchitectureDebtThresholds>;
22
+ }
23
+ export interface ArchitectureDebtInventoryReport {
24
+ root: string;
25
+ mode: "report-only";
26
+ thresholds: ArchitectureDebtThresholds;
27
+ scannedFiles: number;
28
+ findings: ArchitectureDebtFinding[];
29
+ summary: Record<ArchitectureDebtFindingKind, number>;
30
+ }
31
+ export declare function buildArchitectureDebtInventory(options: ArchitectureDebtInventoryOptions): Promise<ArchitectureDebtInventoryReport>;
@@ -0,0 +1,200 @@
1
+ import { readdir, readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ export { renderArchitectureDebtInventory } from "./architecture-debt-report.js";
4
+ const DEFAULT_ROOTS = ["bin", "scripts", "src"];
5
+ const SOURCE_EXTENSIONS = new Set([".js", ".mjs", ".cjs", ".ts"]);
6
+ const DEFAULT_THRESHOLDS = {
7
+ largeFileLines: 300,
8
+ longFunctionLines: 30,
9
+ commandModuleLines: 220,
10
+ };
11
+ const EXCLUDED_DIRECTORIES = new Set([
12
+ ".git",
13
+ ".agent-workflow",
14
+ "coverage",
15
+ "dist",
16
+ "node_modules",
17
+ ]);
18
+ const COMMAND_LOGIC_TOKENS = [
19
+ "addTask(",
20
+ "appendEvent(",
21
+ "completeWithProviderFallback(",
22
+ "createHandoff(",
23
+ "createValidatedPhaseHandoff(",
24
+ "readEvents(",
25
+ "updateTask(",
26
+ "writeArtifact(",
27
+ ];
28
+ export async function buildArchitectureDebtInventory(options) {
29
+ const thresholds = { ...DEFAULT_THRESHOLDS, ...options.thresholds };
30
+ const files = await discoverSourceFiles(options.root, options.roots);
31
+ const findings = (await Promise.all(files.map(async (file) => inspectSourceFile(options.root, file, thresholds))))
32
+ .flat()
33
+ .sort(compareFindings);
34
+ return {
35
+ root: options.root,
36
+ mode: "report-only",
37
+ thresholds,
38
+ scannedFiles: files.length,
39
+ findings,
40
+ summary: summarizeFindings(findings),
41
+ };
42
+ }
43
+ async function discoverSourceFiles(root, roots = DEFAULT_ROOTS) {
44
+ const files = [];
45
+ for (const scanRoot of roots) {
46
+ await walk(path.join(root, scanRoot), root, files);
47
+ }
48
+ return files.sort();
49
+ }
50
+ async function walk(directory, root, files) {
51
+ const entries = await readdir(directory, { withFileTypes: true }).catch(() => []);
52
+ for (const entry of entries) {
53
+ if (EXCLUDED_DIRECTORIES.has(entry.name))
54
+ continue;
55
+ const absolute = path.join(directory, entry.name);
56
+ if (entry.isDirectory()) {
57
+ await walk(absolute, root, files);
58
+ continue;
59
+ }
60
+ if (SOURCE_EXTENSIONS.has(path.extname(entry.name))) {
61
+ files.push(path.relative(root, absolute));
62
+ }
63
+ }
64
+ }
65
+ async function inspectSourceFile(root, file, thresholds) {
66
+ const content = await readFile(path.join(root, file), "utf8");
67
+ const lines = content.split(/\r?\n/);
68
+ return [
69
+ ...largeFileFinding(file, lines, thresholds),
70
+ ...longFunctionFindings(file, lines, thresholds),
71
+ ...commandModuleFindings(file, content, lines, thresholds),
72
+ ...moduleBoundaryFindings(file, content),
73
+ ];
74
+ }
75
+ function largeFileFinding(file, lines, thresholds) {
76
+ if (lines.length <= thresholds.largeFileLines)
77
+ return [];
78
+ return [
79
+ {
80
+ kind: "large-file",
81
+ file,
82
+ metric: lines.length,
83
+ threshold: thresholds.largeFileLines,
84
+ status: "warn",
85
+ message: "File exceeds the preferred module size.",
86
+ },
87
+ ];
88
+ }
89
+ function longFunctionFindings(file, lines, thresholds) {
90
+ const findings = [];
91
+ for (let index = 0; index < lines.length; index += 1) {
92
+ const name = functionName(lines[index] ?? "");
93
+ if (!name)
94
+ continue;
95
+ const length = functionLength(lines, index);
96
+ if (length > thresholds.longFunctionLines) {
97
+ findings.push({
98
+ kind: "long-function",
99
+ file,
100
+ line: index + 1,
101
+ name,
102
+ metric: length,
103
+ threshold: thresholds.longFunctionLines,
104
+ status: "warn",
105
+ message: "Function exceeds the preferred size.",
106
+ });
107
+ }
108
+ }
109
+ return findings;
110
+ }
111
+ function commandModuleFindings(file, content, lines, thresholds) {
112
+ if (!isCommandModule(file))
113
+ return [];
114
+ const hasLogicToken = COMMAND_LOGIC_TOKENS.some((token) => content.includes(token));
115
+ if (lines.length <= thresholds.commandModuleLines && !hasLogicToken) {
116
+ return [];
117
+ }
118
+ return [
119
+ {
120
+ kind: "command-module-logic",
121
+ file,
122
+ metric: lines.length,
123
+ threshold: thresholds.commandModuleLines,
124
+ status: "warn",
125
+ message: "Command-facing module may contain orchestration logic that belongs in domain or service helpers.",
126
+ },
127
+ ];
128
+ }
129
+ function moduleBoundaryFindings(file, content) {
130
+ const concerns = new Set();
131
+ if (/^(bin|scripts)\//.test(file) ||
132
+ /\b(process\.argv|runCli)\b/.test(content)) {
133
+ concerns.add("cli");
134
+ }
135
+ if (/node:fs|node:path|readFile|writeFile/.test(content)) {
136
+ concerns.add("filesystem");
137
+ }
138
+ if (/workflow|handoff|phase|task/i.test(file + content)) {
139
+ concerns.add("workflow");
140
+ }
141
+ if (/validate|assess|policy|contract|criteria/i.test(file + content)) {
142
+ concerns.add("domain");
143
+ }
144
+ if (concerns.size < 3)
145
+ return [];
146
+ return [
147
+ {
148
+ kind: "module-boundary",
149
+ file,
150
+ metric: concerns.size,
151
+ threshold: 3,
152
+ status: "warn",
153
+ message: `Module mixes concerns: ${[...concerns].sort().join(", ")}.`,
154
+ },
155
+ ];
156
+ }
157
+ function functionName(line) {
158
+ return (line.match(/^\s*(?:export\s+)?(?:async\s+)?function\s+([A-Za-z0-9_$]+)/)?.[1] ??
159
+ line.match(/^\s*(?:const|let|var)\s+([A-Za-z0-9_$]+)\s*=\s*(?:async\s*)?\([^)]*\)\s*=>\s*\{/)?.[1]);
160
+ }
161
+ function functionLength(lines, startIndex) {
162
+ let depth = 0;
163
+ let opened = false;
164
+ for (let index = startIndex; index < lines.length; index += 1) {
165
+ for (const char of lines[index] ?? "") {
166
+ if (char === "{") {
167
+ opened = true;
168
+ depth += 1;
169
+ }
170
+ else if (char === "}") {
171
+ depth -= 1;
172
+ }
173
+ }
174
+ if (opened && depth <= 0)
175
+ return index - startIndex + 1;
176
+ }
177
+ return 1;
178
+ }
179
+ function isCommandModule(file) {
180
+ return /^(bin|scripts)\//.test(file) || /commands?\.ts$/.test(file);
181
+ }
182
+ function summarizeFindings(findings) {
183
+ const summary = Object.fromEntries([
184
+ "large-file",
185
+ "long-function",
186
+ "command-module-logic",
187
+ "module-boundary",
188
+ ].map((kind) => [
189
+ kind,
190
+ findings.filter((item) => item.kind === kind).length,
191
+ ]));
192
+ return summary;
193
+ }
194
+ function compareFindings(left, right) {
195
+ return (left.kind.localeCompare(right.kind) ||
196
+ left.file.localeCompare(right.file) ||
197
+ (left.line ?? 0) - (right.line ?? 0) ||
198
+ (left.name ?? "").localeCompare(right.name ?? ""));
199
+ }
200
+ //# sourceMappingURL=architecture-debt-inventory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architecture-debt-inventory.js","sourceRoot":"","sources":["../src/architecture-debt-inventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAwChF,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AAChD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAClE,MAAM,kBAAkB,GAA+B;IACrD,cAAc,EAAE,GAAG;IACnB,iBAAiB,EAAE,EAAE;IACrB,kBAAkB,EAAE,GAAG;CACxB,CAAC;AACF,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,MAAM;IACN,iBAAiB;IACjB,UAAU;IACV,MAAM;IACN,cAAc;CACf,CAAC,CAAC;AACH,MAAM,oBAAoB,GAAG;IAC3B,UAAU;IACV,cAAc;IACd,+BAA+B;IAC/B,gBAAgB;IAChB,8BAA8B;IAC9B,aAAa;IACb,aAAa;IACb,gBAAgB;CACjB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,OAAyC;IAEzC,MAAM,UAAU,GAAG,EAAE,GAAG,kBAAkB,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IACpE,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,CACf,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,GAAG,CAAC,KAAK,EAA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I,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC;QACnC,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC;QACpC,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAClD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ArchitectureDebtInventoryReport } from "./architecture-debt-inventory.js";
2
+ export declare function renderArchitectureDebtInventory(report: ArchitectureDebtInventoryReport): string;
@@ -0,0 +1,28 @@
1
+ export function renderArchitectureDebtInventory(report) {
2
+ const lines = [
3
+ "# Architecture Debt Inventory",
4
+ "",
5
+ `Mode: ${report.mode}`,
6
+ `Scanned files: ${report.scannedFiles}`,
7
+ "",
8
+ "## Summary",
9
+ ...Object.entries(report.summary).map(([kind, count]) => `- ${kind}: ${count}`),
10
+ "",
11
+ "## Findings",
12
+ ];
13
+ if (report.findings.length === 0) {
14
+ lines.push("- No findings.");
15
+ }
16
+ else {
17
+ for (const finding of report.findings) {
18
+ const location = finding.line
19
+ ? `${finding.file}:${finding.line}`
20
+ : finding.file;
21
+ const name = finding.name ? ` ${finding.name}` : "";
22
+ lines.push(`- [${finding.status}] ${finding.kind}: ${location}${name} (${finding.metric}/${finding.threshold}) - ${finding.message}`);
23
+ }
24
+ }
25
+ lines.push("");
26
+ return lines.join("\n");
27
+ }
28
+ //# sourceMappingURL=architecture-debt-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architecture-debt-report.js","sourceRoot":"","sources":["../src/architecture-debt-report.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,+BAA+B,CAC7C,MAAuC;IAEvC,MAAM,KAAK,GAAG;QACZ,+BAA+B;QAC/B,EAAE;QACF,SAAS,MAAM,CAAC,IAAI,EAAE;QACtB,kBAAkB,MAAM,CAAC,YAAY,EAAE;QACvC,EAAE;QACF,YAAY;QACZ,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CACnC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,KAAK,KAAK,EAAE,CACzC;QACD,EAAE;QACF,aAAa;KACd,CAAC;IACF,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACtC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI;gBAC3B,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE;gBACnC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;YACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACpD,KAAK,CAAC,IAAI,CACR,MAAM,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,IAAI,KAAK,QAAQ,GAAG,IAAI,KAAK,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,SAAS,OAAO,OAAO,CAAC,OAAO,EAAE,CAC1H,CAAC;QACJ,CAAC;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { AutonomousPhaseDefinition } from "./autonomous-workflow-constants.js";
2
- import type { AutonomousPhase, AutonomousRun, SizingLabel } from "./types.js";
2
+ import type { AutonomousPhase, AutonomousRun, PhaseStructuredOutput, SizingLabel } from "./types.js";
3
3
  export type SizingCheckResult = {
4
4
  found: true;
5
5
  sizing: SizingLabel;
@@ -11,12 +11,16 @@ export declare function checkArchitectSizing(root: string, taskId: string): Prom
11
11
  export type PhaseOutcome = {
12
12
  kind: "done";
13
13
  notes: string;
14
+ output?: PhaseStructuredOutput;
14
15
  } | {
15
16
  kind: "gate_pause";
16
17
  reviewArtifact: string;
17
18
  } | {
18
19
  kind: "qa_fail";
19
20
  notes: string;
21
+ } | {
22
+ kind: "blocked";
23
+ notes: string;
20
24
  };
21
25
  export declare function initPhase(root: string, run: AutonomousRun, phaseIndex: number, retryContext?: string, sequence?: AutonomousPhaseDefinition[]): Promise<AutonomousPhase>;
22
26
  export declare function closePhase(root: string, run: AutonomousRun, phaseIndex: number, outcome: PhaseOutcome, sequence?: AutonomousPhaseDefinition[]): Promise<{