agentic-orchestrator 0.1.25 → 0.1.26
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/agentic/orchestrator/defaults/policy.defaults.yaml +1 -0
- package/agentic/orchestrator/policy.yaml +1 -0
- package/agentic/orchestrator/schemas/policy.schema.json +4 -0
- package/agentic/orchestrator/schemas/policy.user.schema.json +4 -0
- package/apps/control-plane/src/application/services/activity-monitor-service.ts +42 -0
- package/apps/control-plane/src/application/services/collision-queue-service.ts +48 -0
- package/apps/control-plane/src/application/services/cost-tracking-service.ts +80 -0
- package/apps/control-plane/src/application/services/feature-deletion-service.ts +57 -0
- package/apps/control-plane/src/application/services/feature-lifecycle-service.ts +65 -0
- package/apps/control-plane/src/application/services/feature-state-service.ts +87 -0
- package/apps/control-plane/src/application/services/gate-selection-service.ts +28 -0
- package/apps/control-plane/src/application/services/gate-service.ts +148 -0
- package/apps/control-plane/src/application/services/issue-tracker-service.ts +28 -0
- package/apps/control-plane/src/application/services/lock-service.ts +88 -0
- package/apps/control-plane/src/application/services/merge-service.ts +63 -0
- package/apps/control-plane/src/application/services/notifier-service.ts +70 -0
- package/apps/control-plane/src/application/services/patch-service.ts +95 -0
- package/apps/control-plane/src/application/services/performance-analytics-service.ts +90 -0
- package/apps/control-plane/src/application/services/plan-service.ts +184 -0
- package/apps/control-plane/src/application/services/pr-monitor-service.ts +58 -0
- package/apps/control-plane/src/application/services/qa-index-service.ts +68 -0
- package/apps/control-plane/src/application/services/reactions-service.ts +77 -0
- package/apps/control-plane/src/application/services/reporting-service.ts +79 -0
- package/apps/control-plane/src/application/services/run-lease-service.ts +79 -0
- package/apps/control-plane/src/application/tools/tool-router.ts +76 -0
- package/apps/control-plane/src/mcp/tool-runtime.ts +4 -0
- package/apps/control-plane/src/providers/providers.ts +96 -0
- package/apps/control-plane/src/providers/worker-provider-factory.ts +4 -0
- package/apps/control-plane/src/supervisor/build-wave-executor.ts +4 -0
- package/apps/control-plane/src/supervisor/planning-wave-executor.ts +4 -0
- package/apps/control-plane/src/supervisor/qa-wave-executor.ts +4 -0
- package/apps/control-plane/src/supervisor/run-coordinator.ts +4 -0
- package/apps/control-plane/src/supervisor/runtime.ts +4 -0
- package/apps/control-plane/src/supervisor/session-orchestrator.ts +4 -0
- package/apps/control-plane/test/dashboard-api.integration.spec.ts +310 -1
- package/apps/control-plane/test/dashboard-client.spec.ts +136 -1
- package/apps/control-plane/test/dashboard-live-feed.spec.ts +153 -0
- package/apps/control-plane/test/dashboard-ui-utils.spec.ts +132 -0
- package/apps/control-plane/test/mcp.spec.ts +96 -0
- package/apps/control-plane/test/tool-runtime.spec.ts +68 -0
- package/config/agentic/orchestrator/policy.yaml +1 -0
- package/dist/apps/control-plane/application/services/activity-monitor-service.d.ts +42 -0
- package/dist/apps/control-plane/application/services/activity-monitor-service.js +42 -0
- package/dist/apps/control-plane/application/services/activity-monitor-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/collision-queue-service.d.ts +48 -0
- package/dist/apps/control-plane/application/services/collision-queue-service.js +48 -0
- package/dist/apps/control-plane/application/services/collision-queue-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/cost-tracking-service.d.ts +79 -0
- package/dist/apps/control-plane/application/services/cost-tracking-service.js +76 -0
- package/dist/apps/control-plane/application/services/cost-tracking-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/feature-deletion-service.d.ts +57 -0
- package/dist/apps/control-plane/application/services/feature-deletion-service.js +57 -0
- package/dist/apps/control-plane/application/services/feature-deletion-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.d.ts +64 -0
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.js +61 -0
- package/dist/apps/control-plane/application/services/feature-lifecycle-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/feature-state-service.d.ts +86 -0
- package/dist/apps/control-plane/application/services/feature-state-service.js +83 -0
- package/dist/apps/control-plane/application/services/feature-state-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/gate-selection-service.d.ts +28 -0
- package/dist/apps/control-plane/application/services/gate-selection-service.js +28 -0
- package/dist/apps/control-plane/application/services/gate-selection-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/gate-service.d.ts +148 -0
- package/dist/apps/control-plane/application/services/gate-service.js +120 -0
- package/dist/apps/control-plane/application/services/gate-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/issue-tracker-service.d.ts +28 -0
- package/dist/apps/control-plane/application/services/issue-tracker-service.js +28 -0
- package/dist/apps/control-plane/application/services/issue-tracker-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/lock-service.d.ts +88 -0
- package/dist/apps/control-plane/application/services/lock-service.js +64 -0
- package/dist/apps/control-plane/application/services/lock-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/merge-service.d.ts +62 -0
- package/dist/apps/control-plane/application/services/merge-service.js +59 -0
- package/dist/apps/control-plane/application/services/merge-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/notifier-service.d.ts +70 -0
- package/dist/apps/control-plane/application/services/notifier-service.js +70 -0
- package/dist/apps/control-plane/application/services/notifier-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/patch-service.d.ts +94 -0
- package/dist/apps/control-plane/application/services/patch-service.js +91 -0
- package/dist/apps/control-plane/application/services/patch-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/performance-analytics-service.d.ts +89 -0
- package/dist/apps/control-plane/application/services/performance-analytics-service.js +86 -0
- package/dist/apps/control-plane/application/services/performance-analytics-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/plan-service.d.ts +287 -0
- package/dist/apps/control-plane/application/services/plan-service.js +207 -0
- package/dist/apps/control-plane/application/services/plan-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/pr-monitor-service.d.ts +58 -0
- package/dist/apps/control-plane/application/services/pr-monitor-service.js +58 -0
- package/dist/apps/control-plane/application/services/pr-monitor-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/qa-index-service.d.ts +67 -0
- package/dist/apps/control-plane/application/services/qa-index-service.js +64 -0
- package/dist/apps/control-plane/application/services/qa-index-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/reactions-service.d.ts +76 -0
- package/dist/apps/control-plane/application/services/reactions-service.js +73 -0
- package/dist/apps/control-plane/application/services/reactions-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/reporting-service.d.ts +78 -0
- package/dist/apps/control-plane/application/services/reporting-service.js +75 -0
- package/dist/apps/control-plane/application/services/reporting-service.js.map +1 -1
- package/dist/apps/control-plane/application/services/run-lease-service.d.ts +79 -0
- package/dist/apps/control-plane/application/services/run-lease-service.js +79 -0
- package/dist/apps/control-plane/application/services/run-lease-service.js.map +1 -1
- package/dist/apps/control-plane/application/tools/tool-router.d.ts +76 -0
- package/dist/apps/control-plane/application/tools/tool-router.js +62 -0
- package/dist/apps/control-plane/application/tools/tool-router.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-runtime.d.ts +3 -0
- package/dist/apps/control-plane/mcp/tool-runtime.js +3 -0
- package/dist/apps/control-plane/mcp/tool-runtime.js.map +1 -1
- package/dist/apps/control-plane/providers/providers.d.ts +88 -0
- package/dist/apps/control-plane/providers/providers.js.map +1 -1
- package/dist/apps/control-plane/providers/worker-provider-factory.d.ts +3 -0
- package/dist/apps/control-plane/providers/worker-provider-factory.js.map +1 -1
- package/dist/apps/control-plane/supervisor/build-wave-executor.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/build-wave-executor.js +3 -0
- package/dist/apps/control-plane/supervisor/build-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/planning-wave-executor.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/planning-wave-executor.js +3 -0
- package/dist/apps/control-plane/supervisor/planning-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/qa-wave-executor.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js +3 -0
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/run-coordinator.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/run-coordinator.js +3 -0
- package/dist/apps/control-plane/supervisor/run-coordinator.js.map +1 -1
- package/dist/apps/control-plane/supervisor/runtime.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/runtime.js +3 -0
- package/dist/apps/control-plane/supervisor/runtime.js.map +1 -1
- package/dist/apps/control-plane/supervisor/session-orchestrator.d.ts +3 -0
- package/dist/apps/control-plane/supervisor/session-orchestrator.js +3 -0
- package/dist/apps/control-plane/supervisor/session-orchestrator.js.map +1 -1
- package/package.json +1 -1
- package/packages/web-dashboard/src/app/analytics/page.tsx +451 -0
- package/packages/web-dashboard/src/app/api/analytics/route.ts +62 -0
- package/packages/web-dashboard/src/app/api/collisions/route.ts +63 -0
- package/packages/web-dashboard/src/app/api/features/[id]/cost/route.ts +29 -0
- package/packages/web-dashboard/src/app/api/features/[id]/review-brief/route.ts +31 -0
- package/packages/web-dashboard/src/app/api/features/[id]/route.ts +5 -8
- package/packages/web-dashboard/src/app/api/features/[id]/test-index/route.ts +31 -0
- package/packages/web-dashboard/src/app/api/flaky/route.ts +20 -0
- package/packages/web-dashboard/src/app/api/policy/budget/route.ts +31 -0
- package/packages/web-dashboard/src/app/api/run/route.ts +162 -0
- package/packages/web-dashboard/src/app/api/status/route.ts +2 -5
- package/packages/web-dashboard/src/app/feature/[id]/page.tsx +112 -0
- package/packages/web-dashboard/src/app/page.tsx +379 -77
- package/packages/web-dashboard/src/components/agent-pipeline-stepper.tsx +100 -0
- package/packages/web-dashboard/src/components/dependency-chains.tsx +58 -0
- package/packages/web-dashboard/src/components/detail-panel.tsx +215 -5
- package/packages/web-dashboard/src/components/feature-card.tsx +5 -0
- package/packages/web-dashboard/src/components/feature-cost-panel.tsx +66 -0
- package/packages/web-dashboard/src/components/feature-list-view.tsx +336 -0
- package/packages/web-dashboard/src/components/gate-step-drilldown.tsx +92 -0
- package/packages/web-dashboard/src/components/kanban-board.tsx +3 -0
- package/packages/web-dashboard/src/components/live-event-feed.tsx +60 -0
- package/packages/web-dashboard/src/components/lock-resource-map.tsx +73 -0
- package/packages/web-dashboard/src/components/plan-revision-timeline.tsx +55 -0
- package/packages/web-dashboard/src/components/plan-risk-annotations.tsx +63 -0
- package/packages/web-dashboard/src/components/plan-scope-tree.tsx +285 -0
- package/packages/web-dashboard/src/components/qa-coverage-map.tsx +174 -0
- package/packages/web-dashboard/src/components/quick-launch-panel.tsx +70 -0
- package/packages/web-dashboard/src/components/review-brief-panel.tsx +75 -0
- package/packages/web-dashboard/src/components/run-health-panel.tsx +85 -0
- package/packages/web-dashboard/src/components/summary-bar.tsx +59 -2
- package/packages/web-dashboard/src/components/verification-signals.tsx +167 -0
- package/packages/web-dashboard/src/lib/analytics-utils.ts +3 -0
- package/packages/web-dashboard/src/lib/aop-client.ts +510 -11
- package/packages/web-dashboard/src/lib/api-envelope.ts +48 -0
- package/packages/web-dashboard/src/lib/authz-adapter.ts +33 -0
- package/packages/web-dashboard/src/lib/dashboard-utils.ts +304 -0
- package/packages/web-dashboard/src/lib/live-feed.ts +218 -0
- package/packages/web-dashboard/src/lib/policy-reader.ts +22 -0
- package/packages/web-dashboard/src/lib/types.ts +114 -0
- package/packages/web-dashboard/src/styles/dashboard.module.css +341 -1
- package/spec-files/{outstanding → completed}/agentic_orchestrator_dashboard_advanced_ux_spec.md +1 -1
- package/spec-files/outstanding/agentic_orchestrator_evidence_integrity_doctor_spec.md +561 -0
- package/spec-files/outstanding/agentic_orchestrator_kernel_simplification_spec.md +834 -0
- package/spec-files/outstanding/agentic_orchestrator_observability_integrity_diagnostics_spec.md +12 -5
- package/spec-files/outstanding/agentic_orchestrator_observability_replay_spec.md +442 -0
- package/spec-files/progress.md +174 -1
|
@@ -8,21 +8,107 @@ type StateUpdater = (frontMatter: AnyRecord, body: string) => Promise<{
|
|
|
8
8
|
frontMatter?: AnyRecord;
|
|
9
9
|
body?: string;
|
|
10
10
|
}>;
|
|
11
|
+
/**
|
|
12
|
+
* @fileoverview Feature state persistence and version management service.
|
|
13
|
+
*/
|
|
11
14
|
export interface FeatureStateServicePort {
|
|
12
15
|
withFeatureLock<T>(featureId: string, operation: () => Promise<T>): Promise<T>;
|
|
13
16
|
readState(featureId: string): Promise<StateReadResult>;
|
|
14
17
|
writeState(featureId: string, frontMatter: AnyRecord, body?: string): Promise<void>;
|
|
15
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Manages feature state persistence with version control.
|
|
21
|
+
*
|
|
22
|
+
* ## Responsibilities
|
|
23
|
+
* - Read/write state.md files (YAML front matter + markdown body)
|
|
24
|
+
* - Parse and validate front matter
|
|
25
|
+
* - Enforce optimistic concurrency via version guards
|
|
26
|
+
* - Atomic state updates with file locking
|
|
27
|
+
*
|
|
28
|
+
* ## Dependencies
|
|
29
|
+
* Depends on {@link FeatureStateServicePort} for:
|
|
30
|
+
* - File operations and state path resolution
|
|
31
|
+
* - Feature-level locking primitives
|
|
32
|
+
*
|
|
33
|
+
* ## Key Methods
|
|
34
|
+
* - `featureStateGet()` - read parsed state
|
|
35
|
+
* - `featureStatePatch()` - update state with version guard
|
|
36
|
+
* - `updateState()` - internal atomic update with custom updater
|
|
37
|
+
*
|
|
38
|
+
* ## Error Conditions
|
|
39
|
+
* - FILE_NOT_FOUND - state file does not exist
|
|
40
|
+
* - VERSION_CONFLICT - concurrent state update detected
|
|
41
|
+
* - INVALID_STATE_TRANSITION - illegal status transition
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const stateService = new FeatureStateService(port);
|
|
46
|
+
* const state = await stateService.featureStateGet('my_feature');
|
|
47
|
+
* await stateService.featureStatePatch('my_feature', { status: 'building' }, 1);
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* ## State Format
|
|
51
|
+
* ```markdown
|
|
52
|
+
* ---
|
|
53
|
+
* feature_id: my_feature
|
|
54
|
+
* version: 5
|
|
55
|
+
* status: building
|
|
56
|
+
* ---
|
|
57
|
+
* # Feature State
|
|
58
|
+
* Body content...
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
16
61
|
export declare class FeatureStateService {
|
|
17
62
|
private readonly port;
|
|
18
63
|
constructor(port: FeatureStateServicePort);
|
|
64
|
+
/**
|
|
65
|
+
* Updates feature state atomically with version guard.
|
|
66
|
+
*
|
|
67
|
+
* Internal method used by public state operations. Acquires feature lock,
|
|
68
|
+
* validates version, applies updater function, and writes merged state.
|
|
69
|
+
*
|
|
70
|
+
* @param featureId - feature identifier
|
|
71
|
+
* @param expectedVersion - expected current version (null = no check)
|
|
72
|
+
* @param updater - function returning state updates
|
|
73
|
+
* @returns Updated state frontmatter
|
|
74
|
+
* @throws VERSION_CONFLICT - version mismatch
|
|
75
|
+
* @throws INVALID_STATE_TRANSITION - illegal status transition
|
|
76
|
+
*/
|
|
19
77
|
updateState(featureId: string, expectedVersion: number | null, updater: StateUpdater): Promise<AnyRecord>;
|
|
78
|
+
/**
|
|
79
|
+
* Reads and parses feature state.
|
|
80
|
+
*
|
|
81
|
+
* @param featureId - feature identifier
|
|
82
|
+
* @returns Parsed state with frontmatter and body
|
|
83
|
+
* @throws FILE_NOT_FOUND - state file does not exist
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const state = await stateService.featureStateGet('my_feature');
|
|
88
|
+
* console.log(state.data.frontMatter.status);
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
20
91
|
featureStateGet(featureId: string): Promise<{
|
|
21
92
|
data: {
|
|
22
93
|
front_matter: AnyRecord;
|
|
23
94
|
body: string;
|
|
24
95
|
};
|
|
25
96
|
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Updates feature state with partial updates and version guard.
|
|
99
|
+
*
|
|
100
|
+
* @param featureId - feature identifier
|
|
101
|
+
* @param updates - partial state updates
|
|
102
|
+
* @param expectedVersion - expected current version
|
|
103
|
+
* @returns Updated state
|
|
104
|
+
* @throws VERSION_CONFLICT - version mismatch
|
|
105
|
+
* @throws INVALID_STATE_TRANSITION - illegal status transition
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* await stateService.featureStatePatch('my_feature', { status: 'building' }, 1);
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
26
112
|
featureStatePatch(featureId: string, expectedVersion: number | null, patch: AnyRecord | null | undefined): Promise<{
|
|
27
113
|
data: {
|
|
28
114
|
feature_id: string;
|
|
@@ -22,11 +22,66 @@ function readVersion(frontMatter) {
|
|
|
22
22
|
}
|
|
23
23
|
return 0;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Manages feature state persistence with version control.
|
|
27
|
+
*
|
|
28
|
+
* ## Responsibilities
|
|
29
|
+
* - Read/write state.md files (YAML front matter + markdown body)
|
|
30
|
+
* - Parse and validate front matter
|
|
31
|
+
* - Enforce optimistic concurrency via version guards
|
|
32
|
+
* - Atomic state updates with file locking
|
|
33
|
+
*
|
|
34
|
+
* ## Dependencies
|
|
35
|
+
* Depends on {@link FeatureStateServicePort} for:
|
|
36
|
+
* - File operations and state path resolution
|
|
37
|
+
* - Feature-level locking primitives
|
|
38
|
+
*
|
|
39
|
+
* ## Key Methods
|
|
40
|
+
* - `featureStateGet()` - read parsed state
|
|
41
|
+
* - `featureStatePatch()` - update state with version guard
|
|
42
|
+
* - `updateState()` - internal atomic update with custom updater
|
|
43
|
+
*
|
|
44
|
+
* ## Error Conditions
|
|
45
|
+
* - FILE_NOT_FOUND - state file does not exist
|
|
46
|
+
* - VERSION_CONFLICT - concurrent state update detected
|
|
47
|
+
* - INVALID_STATE_TRANSITION - illegal status transition
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const stateService = new FeatureStateService(port);
|
|
52
|
+
* const state = await stateService.featureStateGet('my_feature');
|
|
53
|
+
* await stateService.featureStatePatch('my_feature', { status: 'building' }, 1);
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* ## State Format
|
|
57
|
+
* ```markdown
|
|
58
|
+
* ---
|
|
59
|
+
* feature_id: my_feature
|
|
60
|
+
* version: 5
|
|
61
|
+
* status: building
|
|
62
|
+
* ---
|
|
63
|
+
* # Feature State
|
|
64
|
+
* Body content...
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
25
67
|
export class FeatureStateService {
|
|
26
68
|
port;
|
|
27
69
|
constructor(port) {
|
|
28
70
|
this.port = port;
|
|
29
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Updates feature state atomically with version guard.
|
|
74
|
+
*
|
|
75
|
+
* Internal method used by public state operations. Acquires feature lock,
|
|
76
|
+
* validates version, applies updater function, and writes merged state.
|
|
77
|
+
*
|
|
78
|
+
* @param featureId - feature identifier
|
|
79
|
+
* @param expectedVersion - expected current version (null = no check)
|
|
80
|
+
* @param updater - function returning state updates
|
|
81
|
+
* @returns Updated state frontmatter
|
|
82
|
+
* @throws VERSION_CONFLICT - version mismatch
|
|
83
|
+
* @throws INVALID_STATE_TRANSITION - illegal status transition
|
|
84
|
+
*/
|
|
30
85
|
async updateState(featureId, expectedVersion, updater) {
|
|
31
86
|
return await this.port.withFeatureLock(featureId, async () => {
|
|
32
87
|
const current = await this.port.readState(featureId);
|
|
@@ -61,6 +116,19 @@ export class FeatureStateService {
|
|
|
61
116
|
return merged;
|
|
62
117
|
});
|
|
63
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Reads and parses feature state.
|
|
121
|
+
*
|
|
122
|
+
* @param featureId - feature identifier
|
|
123
|
+
* @returns Parsed state with frontmatter and body
|
|
124
|
+
* @throws FILE_NOT_FOUND - state file does not exist
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const state = await stateService.featureStateGet('my_feature');
|
|
129
|
+
* console.log(state.data.frontMatter.status);
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
64
132
|
async featureStateGet(featureId) {
|
|
65
133
|
const state = await this.port.readState(featureId);
|
|
66
134
|
return {
|
|
@@ -70,6 +138,21 @@ export class FeatureStateService {
|
|
|
70
138
|
},
|
|
71
139
|
};
|
|
72
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Updates feature state with partial updates and version guard.
|
|
143
|
+
*
|
|
144
|
+
* @param featureId - feature identifier
|
|
145
|
+
* @param updates - partial state updates
|
|
146
|
+
* @param expectedVersion - expected current version
|
|
147
|
+
* @returns Updated state
|
|
148
|
+
* @throws VERSION_CONFLICT - version mismatch
|
|
149
|
+
* @throws INVALID_STATE_TRANSITION - illegal status transition
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* await stateService.featureStatePatch('my_feature', { status: 'building' }, 1);
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
73
156
|
async featureStatePatch(featureId, expectedVersion, patch) {
|
|
74
157
|
const updated = await this.updateState(featureId, expectedVersion, (frontMatter, body) => {
|
|
75
158
|
const nextFront = { ...frontMatter, ...(patch?.front_matter ?? {}) };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-state-service.js","sourceRoot":"","sources":["../../../../../apps/control-plane/src/application/services/feature-state-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAgBjD,MAAM,iBAAiB,GAAG;IACxB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC;IACrE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC/D,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;IAC/D,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,cAAc,CAAC;IAC/E,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC;IAC/E,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;IAChC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC;CACjD,CAAC;AAEF,SAAS,iBAAiB,CAAC,IAAY,EAAE,EAAU;IACjD,MAAM,OAAO,GAAI,iBAA8C,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5E,OAAO,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,WAAW,CAAC,WAAsB;IACzC,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC;IAChC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACpD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;
|
|
1
|
+
{"version":3,"file":"feature-state-service.js","sourceRoot":"","sources":["../../../../../apps/control-plane/src/application/services/feature-state-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC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K,EAAE,IAAI,IAAI,IAAI;aAC1B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,IAAI,EAAE;gBACJ,UAAU,EAAE,SAAS;gBACrB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -17,6 +17,34 @@ export interface CanonicalizedPlanInput {
|
|
|
17
17
|
plan: AnyRecord;
|
|
18
18
|
findings: GateSelectionFinding[];
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Manages gate profile selection and resolution.
|
|
22
|
+
*
|
|
23
|
+
* ## Responsibilities
|
|
24
|
+
* - Select gate profile based on feature state
|
|
25
|
+
* - Resolve profile/mode configuration
|
|
26
|
+
* - Apply policy defaults and fallbacks
|
|
27
|
+
* - Auto-heal invalid state profiles
|
|
28
|
+
*
|
|
29
|
+
* ## Dependencies
|
|
30
|
+
* Depends on {@link GateSelectionServicePort} for:
|
|
31
|
+
* - Gates configuration
|
|
32
|
+
* - Policy snapshot
|
|
33
|
+
*
|
|
34
|
+
* ## Key Methods
|
|
35
|
+
* - `resolveProfileAndMode()` - resolve profile/mode configuration
|
|
36
|
+
* - `selectGateProfile()` - select profile from state or policy
|
|
37
|
+
* - `isAutoHealInvalidStateProfileEnabled()` - check auto-heal policy
|
|
38
|
+
*
|
|
39
|
+
* ## Error Conditions
|
|
40
|
+
* - INVALID_ARGUMENT - unknown profile or mode
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const gateSelection = new GateSelectionService(port);
|
|
45
|
+
* const resolved = gateSelection.resolveProfileAndMode('fast', 'fast');
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
20
48
|
export declare class GateSelectionService {
|
|
21
49
|
private readonly port;
|
|
22
50
|
constructor(port: GateSelectionServicePort);
|
|
@@ -26,6 +26,34 @@ function asStringArray(value) {
|
|
|
26
26
|
}
|
|
27
27
|
return normalized;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Manages gate profile selection and resolution.
|
|
31
|
+
*
|
|
32
|
+
* ## Responsibilities
|
|
33
|
+
* - Select gate profile based on feature state
|
|
34
|
+
* - Resolve profile/mode configuration
|
|
35
|
+
* - Apply policy defaults and fallbacks
|
|
36
|
+
* - Auto-heal invalid state profiles
|
|
37
|
+
*
|
|
38
|
+
* ## Dependencies
|
|
39
|
+
* Depends on {@link GateSelectionServicePort} for:
|
|
40
|
+
* - Gates configuration
|
|
41
|
+
* - Policy snapshot
|
|
42
|
+
*
|
|
43
|
+
* ## Key Methods
|
|
44
|
+
* - `resolveProfileAndMode()` - resolve profile/mode configuration
|
|
45
|
+
* - `selectGateProfile()` - select profile from state or policy
|
|
46
|
+
* - `isAutoHealInvalidStateProfileEnabled()` - check auto-heal policy
|
|
47
|
+
*
|
|
48
|
+
* ## Error Conditions
|
|
49
|
+
* - INVALID_ARGUMENT - unknown profile or mode
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const gateSelection = new GateSelectionService(port);
|
|
54
|
+
* const resolved = gateSelection.resolveProfileAndMode('fast', 'fast');
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
29
57
|
export class GateSelectionService {
|
|
30
58
|
port;
|
|
31
59
|
constructor(port) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-selection-service.js","sourceRoot":"","sources":["../../../../../apps/control-plane/src/application/services/gate-selection-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAI9C,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CA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"}
|
|
1
|
+
{"version":3,"file":"gate-selection-service.js","sourceRoot":"","sources":["../../../../../apps/control-plane/src/application/services/gate-selection-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAI9C,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAmB,CAAC,CAAC,CAAC,EAAE,CAAC;AACjG,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,SAAS;QACX,CAAC;QACD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,UAAU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BACP,oBAAoB,EAAE,cAAc;oBACpC,qBAAqB,EAAE,mBAAmB;iBAC3C;aACF,CAAC,CAAC;QACL,CAAC;QAED,aAAa,CAAC,cAAc,CAAC,GAAG,mBAAmB,CAAC;QACpD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,aAAa,CAAC,cAAc,CAAC,GAAG,WAAW,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,OAAO,aAAa,CAAC,cAAc,CAAC,CAAC;QACvC,CAAC;QAED,OAAO;YACL,IAAI,EAAE,aAAa;YACnB,QAAQ;SACT,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -3,26 +3,158 @@ type StateUpdater = (frontMatter: AnyRecord, body: string) => Promise<{
|
|
|
3
3
|
frontMatter?: AnyRecord;
|
|
4
4
|
body?: string;
|
|
5
5
|
}>;
|
|
6
|
+
/**
|
|
7
|
+
* Port interface for gate operations.
|
|
8
|
+
*
|
|
9
|
+
* ## Contract
|
|
10
|
+
* Implementations must ensure:
|
|
11
|
+
* - Access to gates configuration and policy
|
|
12
|
+
* - State read/update with version guards
|
|
13
|
+
* - Path resolution for worktrees, logs, and evidence
|
|
14
|
+
*
|
|
15
|
+
* ## Error Handling
|
|
16
|
+
* All methods throw normalized errors with stable error codes.
|
|
17
|
+
*/
|
|
6
18
|
export interface GateServicePort {
|
|
19
|
+
/** Returns repository root path. */
|
|
7
20
|
getRepoRoot(): string;
|
|
21
|
+
/** Returns gates configuration. */
|
|
8
22
|
getGatesConfig(): AnyRecord;
|
|
23
|
+
/** Returns policy snapshot. */
|
|
9
24
|
getPolicySnapshot(): AnyRecord;
|
|
25
|
+
/**
|
|
26
|
+
* Reads feature state.
|
|
27
|
+
* @throws FEATURE_NOT_FOUND - if state doesn't exist
|
|
28
|
+
*/
|
|
10
29
|
readState(featureId: string): Promise<{
|
|
11
30
|
frontMatter: AnyRecord;
|
|
12
31
|
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Updates feature state with version guard.
|
|
34
|
+
* @param featureId - feature identifier
|
|
35
|
+
* @param expectedVersion - expected version (null = no check)
|
|
36
|
+
* @param updater - function returning updated state
|
|
37
|
+
*/
|
|
13
38
|
updateState(featureId: string, expectedVersion: number | null, updater: StateUpdater): Promise<AnyRecord>;
|
|
39
|
+
/** Returns absolute path to feature worktree. */
|
|
14
40
|
worktreePath(featureId: string): string;
|
|
41
|
+
/** Returns absolute path to feature logs directory. */
|
|
15
42
|
logsPath(featureId: string): string;
|
|
43
|
+
/** Returns absolute path to feature evidence directory. */
|
|
16
44
|
evidencePath(featureId: string): string;
|
|
17
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Manages gate execution, evidence collection, and threshold enforcement.
|
|
48
|
+
*
|
|
49
|
+
* ## Responsibilities
|
|
50
|
+
* - Execute gate profiles (fast/full/merge) with command interpolation
|
|
51
|
+
* - Collect logs and evidence artifacts
|
|
52
|
+
* - Parse coverage reports and enforce thresholds
|
|
53
|
+
* - Update feature state with gate results
|
|
54
|
+
* - Transition status based on gate outcomes
|
|
55
|
+
*
|
|
56
|
+
* ## Dependencies
|
|
57
|
+
* Depends on {@link GateServicePort} for:
|
|
58
|
+
* - Gates configuration and policy access
|
|
59
|
+
* - State updates and file operations
|
|
60
|
+
* - Worktree and evidence path resolution
|
|
61
|
+
*
|
|
62
|
+
* ## Key Methods
|
|
63
|
+
* - `gatesRun()` - execute gate profile with evidence collection
|
|
64
|
+
* - `gatesList()` - list available gate profiles
|
|
65
|
+
* - `evidenceLatest()` - retrieve latest evidence summary
|
|
66
|
+
* - `gateProfileAndMode()` - resolve profile/mode configuration
|
|
67
|
+
*
|
|
68
|
+
* ## Error Conditions
|
|
69
|
+
* - GATE_FAILED - gate execution failed or thresholds not met
|
|
70
|
+
* - INVALID_ARGUMENT - unknown profile or mode
|
|
71
|
+
* - FILE_NOT_FOUND - missing evidence or coverage files
|
|
72
|
+
*
|
|
73
|
+
* ## Gate Lifecycle
|
|
74
|
+
* 1. Select profile and mode based on feature state
|
|
75
|
+
* 2. Interpolate commands with feature context
|
|
76
|
+
* 3. Execute steps (sequential or parallel)
|
|
77
|
+
* 4. Collect evidence and parse coverage
|
|
78
|
+
* 5. Enforce thresholds (minimums and targets)
|
|
79
|
+
* 6. Update state and transition status
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const gateService = new GateService(port);
|
|
84
|
+
*
|
|
85
|
+
* // Execute fast gate profile
|
|
86
|
+
* await gateService.gatesRun('my_feature', 'fast', 'fast', null);
|
|
87
|
+
*
|
|
88
|
+
* // Get latest evidence
|
|
89
|
+
* const evidence = await gateService.evidenceLatest('my_feature');
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* ## Thread Safety
|
|
93
|
+
* State updates are atomic via version guards.
|
|
94
|
+
*/
|
|
18
95
|
export declare class GateService {
|
|
19
96
|
private readonly port;
|
|
20
97
|
private readonly gateSelectionService;
|
|
21
98
|
constructor(port: GateServicePort);
|
|
99
|
+
/**
|
|
100
|
+
* Lists available gate profiles or returns specific profile configuration.
|
|
101
|
+
*
|
|
102
|
+
* @param profileName - optional profile name to retrieve
|
|
103
|
+
* @returns Profile configuration or all profiles
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* // List all profiles
|
|
108
|
+
* const all = gateService.gatesList();
|
|
109
|
+
*
|
|
110
|
+
* // Get specific profile
|
|
111
|
+
* const fast = gateService.gatesList('fast');
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
22
114
|
gatesList(profileName?: string | null): {
|
|
23
115
|
data: AnyRecord;
|
|
24
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* Resolves gate profile and mode configuration.
|
|
119
|
+
*
|
|
120
|
+
* @param profileName - profile identifier
|
|
121
|
+
* @param mode - mode identifier
|
|
122
|
+
* @returns Resolved profile/mode configuration
|
|
123
|
+
* @throws INVALID_ARGUMENT - unknown profile or mode
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const config = gateService.gateProfileAndMode('fast', 'fast');
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
25
130
|
gateProfileAndMode(profileName: string, mode: string): AnyRecord;
|
|
131
|
+
/**
|
|
132
|
+
* Executes gate profile with evidence collection and threshold enforcement.
|
|
133
|
+
*
|
|
134
|
+
* Workflow:
|
|
135
|
+
* 1. Resolve profile/mode from state or explicit parameters
|
|
136
|
+
* 2. Interpolate commands with feature context
|
|
137
|
+
* 3. Execute steps (parallel groups or sequential)
|
|
138
|
+
* 4. Collect logs and evidence artifacts
|
|
139
|
+
* 5. Parse coverage and enforce thresholds
|
|
140
|
+
* 6. Update state with results and transition status
|
|
141
|
+
*
|
|
142
|
+
* @param featureId - feature identifier
|
|
143
|
+
* @param profileName - gate profile (null = auto-select from state)
|
|
144
|
+
* @param mode - gate mode (fast/full/merge)
|
|
145
|
+
* @returns Gate execution results with coverage and evidence
|
|
146
|
+
* @throws GATE_FAILED - execution failed or thresholds not met
|
|
147
|
+
* @throws INVALID_ARGUMENT - unknown profile or mode
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* // Auto-select profile from state
|
|
152
|
+
* await gateService.gatesRun('my_feature', null, 'fast');
|
|
153
|
+
*
|
|
154
|
+
* // Explicit profile
|
|
155
|
+
* await gateService.gatesRun('my_feature', 'fast', 'fast');
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
26
158
|
gatesRun(featureId: string, profileName: string | null, mode: string): Promise<{
|
|
27
159
|
data: {
|
|
28
160
|
feature_id: string;
|
|
@@ -36,6 +168,22 @@ export declare class GateService {
|
|
|
36
168
|
log_path: string;
|
|
37
169
|
};
|
|
38
170
|
}>;
|
|
171
|
+
/**
|
|
172
|
+
* Retrieves latest evidence summary for a feature.
|
|
173
|
+
*
|
|
174
|
+
* Returns most recent gate execution evidence including logs,
|
|
175
|
+
* coverage reports, and artifact paths.
|
|
176
|
+
*
|
|
177
|
+
* @param featureId - feature identifier
|
|
178
|
+
* @returns Evidence summary with paths and metadata
|
|
179
|
+
* @throws FILE_NOT_FOUND - no evidence exists
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* const evidence = await gateService.evidenceLatest('my_feature');
|
|
184
|
+
* console.log(evidence.data.coverage);
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
39
187
|
evidenceLatest(featureId: string): Promise<{
|
|
40
188
|
data: {
|
|
41
189
|
feature_id: string;
|
|
@@ -26,6 +26,55 @@ function deriveStatusFromGateResult(currentStatus, mode, overall) {
|
|
|
26
26
|
}
|
|
27
27
|
return currentStatus;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Manages gate execution, evidence collection, and threshold enforcement.
|
|
31
|
+
*
|
|
32
|
+
* ## Responsibilities
|
|
33
|
+
* - Execute gate profiles (fast/full/merge) with command interpolation
|
|
34
|
+
* - Collect logs and evidence artifacts
|
|
35
|
+
* - Parse coverage reports and enforce thresholds
|
|
36
|
+
* - Update feature state with gate results
|
|
37
|
+
* - Transition status based on gate outcomes
|
|
38
|
+
*
|
|
39
|
+
* ## Dependencies
|
|
40
|
+
* Depends on {@link GateServicePort} for:
|
|
41
|
+
* - Gates configuration and policy access
|
|
42
|
+
* - State updates and file operations
|
|
43
|
+
* - Worktree and evidence path resolution
|
|
44
|
+
*
|
|
45
|
+
* ## Key Methods
|
|
46
|
+
* - `gatesRun()` - execute gate profile with evidence collection
|
|
47
|
+
* - `gatesList()` - list available gate profiles
|
|
48
|
+
* - `evidenceLatest()` - retrieve latest evidence summary
|
|
49
|
+
* - `gateProfileAndMode()` - resolve profile/mode configuration
|
|
50
|
+
*
|
|
51
|
+
* ## Error Conditions
|
|
52
|
+
* - GATE_FAILED - gate execution failed or thresholds not met
|
|
53
|
+
* - INVALID_ARGUMENT - unknown profile or mode
|
|
54
|
+
* - FILE_NOT_FOUND - missing evidence or coverage files
|
|
55
|
+
*
|
|
56
|
+
* ## Gate Lifecycle
|
|
57
|
+
* 1. Select profile and mode based on feature state
|
|
58
|
+
* 2. Interpolate commands with feature context
|
|
59
|
+
* 3. Execute steps (sequential or parallel)
|
|
60
|
+
* 4. Collect evidence and parse coverage
|
|
61
|
+
* 5. Enforce thresholds (minimums and targets)
|
|
62
|
+
* 6. Update state and transition status
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const gateService = new GateService(port);
|
|
67
|
+
*
|
|
68
|
+
* // Execute fast gate profile
|
|
69
|
+
* await gateService.gatesRun('my_feature', 'fast', 'fast', null);
|
|
70
|
+
*
|
|
71
|
+
* // Get latest evidence
|
|
72
|
+
* const evidence = await gateService.evidenceLatest('my_feature');
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* ## Thread Safety
|
|
76
|
+
* State updates are atomic via version guards.
|
|
77
|
+
*/
|
|
29
78
|
export class GateService {
|
|
30
79
|
port;
|
|
31
80
|
gateSelectionService;
|
|
@@ -33,6 +82,21 @@ export class GateService {
|
|
|
33
82
|
this.port = port;
|
|
34
83
|
this.gateSelectionService = new GateSelectionService(port);
|
|
35
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Lists available gate profiles or returns specific profile configuration.
|
|
87
|
+
*
|
|
88
|
+
* @param profileName - optional profile name to retrieve
|
|
89
|
+
* @returns Profile configuration or all profiles
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* // List all profiles
|
|
94
|
+
* const all = gateService.gatesList();
|
|
95
|
+
*
|
|
96
|
+
* // Get specific profile
|
|
97
|
+
* const fast = gateService.gatesList('fast');
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
36
100
|
gatesList(profileName = null) {
|
|
37
101
|
const gatesConfig = this.port.getGatesConfig();
|
|
38
102
|
if (profileName) {
|
|
@@ -49,9 +113,49 @@ export class GateService {
|
|
|
49
113
|
},
|
|
50
114
|
};
|
|
51
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Resolves gate profile and mode configuration.
|
|
118
|
+
*
|
|
119
|
+
* @param profileName - profile identifier
|
|
120
|
+
* @param mode - mode identifier
|
|
121
|
+
* @returns Resolved profile/mode configuration
|
|
122
|
+
* @throws INVALID_ARGUMENT - unknown profile or mode
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const config = gateService.gateProfileAndMode('fast', 'fast');
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
52
129
|
gateProfileAndMode(profileName, mode) {
|
|
53
130
|
return this.gateSelectionService.resolveProfileAndMode(profileName, mode);
|
|
54
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Executes gate profile with evidence collection and threshold enforcement.
|
|
134
|
+
*
|
|
135
|
+
* Workflow:
|
|
136
|
+
* 1. Resolve profile/mode from state or explicit parameters
|
|
137
|
+
* 2. Interpolate commands with feature context
|
|
138
|
+
* 3. Execute steps (parallel groups or sequential)
|
|
139
|
+
* 4. Collect logs and evidence artifacts
|
|
140
|
+
* 5. Parse coverage and enforce thresholds
|
|
141
|
+
* 6. Update state with results and transition status
|
|
142
|
+
*
|
|
143
|
+
* @param featureId - feature identifier
|
|
144
|
+
* @param profileName - gate profile (null = auto-select from state)
|
|
145
|
+
* @param mode - gate mode (fast/full/merge)
|
|
146
|
+
* @returns Gate execution results with coverage and evidence
|
|
147
|
+
* @throws GATE_FAILED - execution failed or thresholds not met
|
|
148
|
+
* @throws INVALID_ARGUMENT - unknown profile or mode
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* // Auto-select profile from state
|
|
153
|
+
* await gateService.gatesRun('my_feature', null, 'fast');
|
|
154
|
+
*
|
|
155
|
+
* // Explicit profile
|
|
156
|
+
* await gateService.gatesRun('my_feature', 'fast', 'fast');
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
55
159
|
async gatesRun(featureId, profileName, mode) {
|
|
56
160
|
const state = await this.port.readState(featureId);
|
|
57
161
|
const resolvedProfile = this.gateSelectionService.resolveProfileFromState(state.frontMatter.gate_profile);
|
|
@@ -144,6 +248,22 @@ export class GateService {
|
|
|
144
248
|
},
|
|
145
249
|
};
|
|
146
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Retrieves latest evidence summary for a feature.
|
|
253
|
+
*
|
|
254
|
+
* Returns most recent gate execution evidence including logs,
|
|
255
|
+
* coverage reports, and artifact paths.
|
|
256
|
+
*
|
|
257
|
+
* @param featureId - feature identifier
|
|
258
|
+
* @returns Evidence summary with paths and metadata
|
|
259
|
+
* @throws FILE_NOT_FOUND - no evidence exists
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```typescript
|
|
263
|
+
* const evidence = await gateService.evidenceLatest('my_feature');
|
|
264
|
+
* console.log(evidence.data.coverage);
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
147
267
|
async evidenceLatest(featureId) {
|
|
148
268
|
const repoRoot = this.port.getRepoRoot();
|
|
149
269
|
const evidenceDir = this.port.evidencePath(featureId);
|