@orchestrator-claude/definitions 3.19.0 → 3.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hooks/gate-guardian.ts +137 -39
- package/hooks/lib/gate-logic.ts +58 -0
- package/manifest.json +3 -36
- package/package.json +1 -1
- package/workflows/bug-fix.json +0 -74
- package/workflows/feature-development.json +0 -88
- package/workflows/legacy-analysis.json +0 -304
- package/workflows/refactoring.json +0 -74
package/hooks/gate-guardian.ts
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* gate-guardian.ts — PreToolUse[advancePhase] hook (
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* gate-guardian.ts — PreToolUse[advancePhase] hook (ADR-017 Phase 4)
|
|
3
|
+
* Adaptive Gate Engine: replaces binary IMPLEMENT-only gate with risk-based engine.
|
|
4
|
+
*
|
|
5
|
+
* Flow:
|
|
6
|
+
* 1. readStdin() → workflowId, targetPhase
|
|
7
|
+
* 2. getWorkflowMode() → quick/interactive: ALLOW immediately
|
|
8
|
+
* 3. validate parse → fail: DENY fail-closed
|
|
9
|
+
* 4. getToken() → fail: DENY fail-closed
|
|
10
|
+
* 5. if targetPhase matches /implement/i → getNextAction() pending-action check:
|
|
11
|
+
* - approved/awaiting_agent → ALLOW (short-circuit, skip classifyRisk)
|
|
12
|
+
* - not approved → DENY
|
|
13
|
+
* 6. classifyRisk(targetPhase) → riskLevel
|
|
14
|
+
* 7. buildGateContext() + deriveGateStrategy() → GateDecision
|
|
15
|
+
* 8. switch strategy:
|
|
16
|
+
* AUTO_APPROVE → allow + telemetry context
|
|
17
|
+
* ASK_HUMAN → deny + approval instructions
|
|
18
|
+
* BLOCK_AND_REQUIRE → deny + requiredAction
|
|
19
|
+
* 9. log(HOOK, JSON summary)
|
|
7
20
|
*/
|
|
8
21
|
|
|
9
22
|
import {
|
|
@@ -14,11 +27,41 @@ import {
|
|
|
14
27
|
getWorkflowMode,
|
|
15
28
|
getNextAction,
|
|
16
29
|
outputPreToolUse,
|
|
30
|
+
type PendingAction,
|
|
17
31
|
} from "./lib/api-client.js";
|
|
32
|
+
import { classifyRisk, deriveGateStrategy, type GateContext } from "./lib/gate-logic.js";
|
|
18
33
|
|
|
19
34
|
const HOOK = "GATE-GUARDIAN";
|
|
20
35
|
|
|
21
|
-
|
|
36
|
+
// ─────────────────────────────────────────────────────────────
|
|
37
|
+
// Dependency injection interface (enables testing without IO)
|
|
38
|
+
// ─────────────────────────────────────────────────────────────
|
|
39
|
+
|
|
40
|
+
export interface HookDeps {
|
|
41
|
+
readStdin: () => Promise<Record<string, unknown>>;
|
|
42
|
+
getWorkflowMode: (id: string) => Promise<string | null>;
|
|
43
|
+
getToken: () => Promise<string | null>;
|
|
44
|
+
getNextAction: (id: string) => Promise<PendingAction | null>;
|
|
45
|
+
output: (opts: { decision: "allow" | "deny"; reason?: string; context?: string }) => void;
|
|
46
|
+
log: (prefix: string, msg: string) => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const defaultDeps: HookDeps = {
|
|
50
|
+
readStdin,
|
|
51
|
+
getWorkflowMode,
|
|
52
|
+
getToken,
|
|
53
|
+
getNextAction,
|
|
54
|
+
output: outputPreToolUse,
|
|
55
|
+
log,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// ─────────────────────────────────────────────────────────────
|
|
59
|
+
// Core logic (exported for testing)
|
|
60
|
+
// ─────────────────────────────────────────────────────────────
|
|
61
|
+
|
|
62
|
+
export async function mainWithDeps(deps: HookDeps): Promise<void> {
|
|
63
|
+
const { readStdin, getWorkflowMode, getToken, getNextAction, output, log } = deps;
|
|
64
|
+
|
|
22
65
|
const stdin = await readStdin();
|
|
23
66
|
log(HOOK, "PreToolUse advancePhase triggered");
|
|
24
67
|
|
|
@@ -27,31 +70,34 @@ async function main(): Promise<void> {
|
|
|
27
70
|
|
|
28
71
|
log(HOOK, `workflow=${workflowId} targetPhase=${targetPhase}`);
|
|
29
72
|
|
|
30
|
-
//
|
|
73
|
+
// ── Step 2: Mode check — quick/interactive bypass gate entirely ──────────
|
|
31
74
|
if (workflowId) {
|
|
32
75
|
const mode = await getWorkflowMode(workflowId);
|
|
33
|
-
log(HOOK, `workflow=${workflowId} mode=${mode
|
|
76
|
+
log(HOOK, `workflow=${workflowId} mode=${mode ?? "legacy"}`);
|
|
34
77
|
|
|
35
78
|
if (mode === "quick") {
|
|
36
|
-
|
|
79
|
+
output({
|
|
37
80
|
decision: "allow",
|
|
38
|
-
context: `
|
|
81
|
+
context: `[GATE] AUTO_APPROVE: quick mode skips gate evaluation for '${targetPhase}'.`,
|
|
39
82
|
});
|
|
83
|
+
log(HOOK, `ALLOW quick mode phase=${targetPhase}`);
|
|
40
84
|
return;
|
|
41
85
|
}
|
|
86
|
+
|
|
42
87
|
if (mode === "interactive") {
|
|
43
|
-
|
|
88
|
+
output({
|
|
44
89
|
decision: "allow",
|
|
45
|
-
context: `
|
|
90
|
+
context: `[GATE] AUTO_APPROVE: interactive mode skips artifact gate evaluation for '${targetPhase}'.`,
|
|
46
91
|
});
|
|
92
|
+
log(HOOK, `ALLOW interactive mode phase=${targetPhase}`);
|
|
47
93
|
return;
|
|
48
94
|
}
|
|
49
95
|
}
|
|
50
96
|
|
|
51
|
-
//
|
|
97
|
+
// ── Step 3: Parse validation — FAIL-CLOSED ───────────────────────────────
|
|
52
98
|
if (!workflowId || !targetPhase) {
|
|
53
99
|
log(HOOK, "DENY (could not parse input)");
|
|
54
|
-
|
|
100
|
+
output({
|
|
55
101
|
decision: "deny",
|
|
56
102
|
reason: "Gate Guardian: Could not parse workflowId or targetPhase.",
|
|
57
103
|
context: "Ensure you pass both workflowId and targetPhase to advancePhase.",
|
|
@@ -59,44 +105,96 @@ async function main(): Promise<void> {
|
|
|
59
105
|
return;
|
|
60
106
|
}
|
|
61
107
|
|
|
62
|
-
// Auth check — FAIL-CLOSED
|
|
108
|
+
// ── Step 4: Auth check — FAIL-CLOSED ────────────────────────────────────
|
|
63
109
|
const token = await getToken();
|
|
64
110
|
if (!token) {
|
|
65
111
|
log(HOOK, "DENY (auth failed)");
|
|
66
|
-
|
|
112
|
+
output({
|
|
67
113
|
decision: "deny",
|
|
68
114
|
reason: "Gate Guardian: Authentication failed.",
|
|
69
|
-
context:
|
|
70
|
-
"Check ORCHESTRATOR_ADMIN_EMAIL, ORCHESTRATOR_ADMIN_PASSWORD, ORCHESTRATOR_PROJECT_ID env vars.",
|
|
115
|
+
context: "Check ORCHESTRATOR_ADMIN_EMAIL, ORCHESTRATOR_ADMIN_PASSWORD, ORCHESTRATOR_PROJECT_ID env vars.",
|
|
71
116
|
});
|
|
72
117
|
return;
|
|
73
118
|
}
|
|
74
119
|
|
|
75
|
-
// IMPLEMENT
|
|
76
|
-
|
|
77
|
-
|
|
120
|
+
// ── Step 5: IMPLEMENT short-circuit (RF-008) ─────────────────────────────
|
|
121
|
+
// If targetPhase contains "implement", check pending-action BEFORE classifyRisk.
|
|
122
|
+
// This prevents AUTO_APPROVE from being applied to implement phases.
|
|
123
|
+
//
|
|
124
|
+
// Phase 4: Only 'implement' phases have the approval path (via pending-action).
|
|
125
|
+
// Other HIGH-risk phases (deploy, migrate, delete) will always ASK_HUMAN → DENY.
|
|
126
|
+
// An approval path for these will be added in Phase 5 (Adaptive Gate V2).
|
|
127
|
+
if (/implement/i.test(targetPhase)) {
|
|
128
|
+
log(HOOK, "Checking approval for IMPLEMENT-type phase");
|
|
78
129
|
const action = await getNextAction(workflowId);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
130
|
+
const status = action?.pendingAction?.status ?? "";
|
|
131
|
+
|
|
132
|
+
if (status === "approved" || status === "awaiting_agent") {
|
|
133
|
+
output({
|
|
134
|
+
decision: "allow",
|
|
135
|
+
context: `[GATE] IMPLEMENT approved (status=${status}): proceeding to phase '${targetPhase}'.`,
|
|
136
|
+
});
|
|
137
|
+
log(HOOK, JSON.stringify({ hook: "gate-guardian", strategy: "IMPLEMENT_APPROVED", targetPhase, workflowId }));
|
|
138
|
+
return;
|
|
91
139
|
}
|
|
140
|
+
|
|
141
|
+
output({
|
|
142
|
+
decision: "deny",
|
|
143
|
+
reason: `Gate Guardian: IMPLEMENT requires human approval. Status: ${status || "not-set"}.`,
|
|
144
|
+
context: "Ask the user for approval first. Then call mcp__orchestrator-tools__approveAction.",
|
|
145
|
+
});
|
|
146
|
+
log(HOOK, JSON.stringify({ hook: "gate-guardian", strategy: "IMPLEMENT_DENIED", targetPhase, workflowId, reason: "pending-action not approved" }));
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// ── Steps 6–8: Adaptive engine for non-implement phases ──────────────────
|
|
151
|
+
const riskLevel = classifyRisk(targetPhase);
|
|
152
|
+
|
|
153
|
+
const ctx: GateContext = {
|
|
154
|
+
workflowId,
|
|
155
|
+
targetPhase,
|
|
156
|
+
// Reserved for Phase 5+6 — will be populated when OLAP integration provides
|
|
157
|
+
// workflow context. Currently unused by deriveGateStrategy().
|
|
158
|
+
currentPhase: "",
|
|
159
|
+
executionMode: null,
|
|
160
|
+
workflowMode: null,
|
|
161
|
+
riskLevel,
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const decision = deriveGateStrategy(ctx);
|
|
165
|
+
|
|
166
|
+
log(HOOK, JSON.stringify({ strategy: decision.strategy, targetPhase, riskLevel, reason: decision.reason }));
|
|
167
|
+
|
|
168
|
+
switch (decision.strategy) {
|
|
169
|
+
case "AUTO_APPROVE":
|
|
170
|
+
output({
|
|
171
|
+
decision: "allow",
|
|
172
|
+
context: `[GATE] AUTO_APPROVE: ${decision.reason}`,
|
|
173
|
+
});
|
|
174
|
+
break;
|
|
175
|
+
|
|
176
|
+
case "ASK_HUMAN":
|
|
177
|
+
output({
|
|
178
|
+
decision: "deny",
|
|
179
|
+
reason: `Gate Guardian: ${decision.reason} Ask user for approval.`,
|
|
180
|
+
});
|
|
181
|
+
break;
|
|
182
|
+
|
|
183
|
+
case "BLOCK_AND_REQUIRE":
|
|
184
|
+
output({
|
|
185
|
+
decision: "deny",
|
|
186
|
+
reason: `Gate Guardian BLOCKED: ${decision.reason}. Required: ${decision.requiredAction ?? "unspecified"}.`,
|
|
187
|
+
});
|
|
188
|
+
break;
|
|
92
189
|
}
|
|
190
|
+
}
|
|
93
191
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
192
|
+
// ─────────────────────────────────────────────────────────────
|
|
193
|
+
// Entry point (production use)
|
|
194
|
+
// ─────────────────────────────────────────────────────────────
|
|
195
|
+
|
|
196
|
+
async function main(): Promise<void> {
|
|
197
|
+
await mainWithDeps(defaultDeps);
|
|
100
198
|
}
|
|
101
199
|
|
|
102
200
|
main().catch(() => process.exit(0));
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gate-logic.ts — Pure gate logic functions for Adaptive Gate Engine (ADR-017 Phase 4)
|
|
3
|
+
* Zero IO — no imports from node:fs, fetch, or api-client.
|
|
4
|
+
* Fully testable without any mocks.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type RiskLevel = "HIGH" | "LOW";
|
|
8
|
+
export type GateStrategy = "AUTO_APPROVE" | "ASK_HUMAN" | "BLOCK_AND_REQUIRE";
|
|
9
|
+
|
|
10
|
+
export interface GateContext {
|
|
11
|
+
workflowId: string;
|
|
12
|
+
targetPhase: string;
|
|
13
|
+
currentPhase: string;
|
|
14
|
+
executionMode: string | null;
|
|
15
|
+
workflowMode: string | null;
|
|
16
|
+
riskLevel: RiskLevel;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface GateDecision {
|
|
20
|
+
strategy: GateStrategy;
|
|
21
|
+
reason: string;
|
|
22
|
+
requiredAction?: string; // only for BLOCK_AND_REQUIRE
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Classify the risk level of a target phase.
|
|
27
|
+
* HIGH risk: implement, deploy, migrate, delete (case-insensitive, substring match).
|
|
28
|
+
* LOW risk: everything else.
|
|
29
|
+
*/
|
|
30
|
+
export function classifyRisk(targetPhase: string): RiskLevel {
|
|
31
|
+
if (/implement|deploy|migrate|delete/i.test(targetPhase)) {
|
|
32
|
+
return "HIGH";
|
|
33
|
+
}
|
|
34
|
+
return "LOW";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Derive the gate strategy based on context.
|
|
39
|
+
* Rules (evaluated in order):
|
|
40
|
+
* 1. HIGH risk → ASK_HUMAN
|
|
41
|
+
* 2. default → AUTO_APPROVE
|
|
42
|
+
*
|
|
43
|
+
* BLOCK_AND_REQUIRE exists as a type but has no trigger rule yet.
|
|
44
|
+
*/
|
|
45
|
+
export function deriveGateStrategy(ctx: GateContext): GateDecision {
|
|
46
|
+
if (ctx.riskLevel === "HIGH") {
|
|
47
|
+
return {
|
|
48
|
+
strategy: "ASK_HUMAN",
|
|
49
|
+
reason: `Phase '${ctx.targetPhase}' is high-risk and requires human approval before proceeding.`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Default: AUTO_APPROVE
|
|
54
|
+
return {
|
|
55
|
+
strategy: "AUTO_APPROVE",
|
|
56
|
+
reason: `Phase '${ctx.targetPhase}' is low-risk — auto-approved.`,
|
|
57
|
+
};
|
|
58
|
+
}
|
package/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "orchestrator-definitions/v1",
|
|
3
3
|
"namespace": "orchestrator",
|
|
4
|
-
"version": "3.
|
|
5
|
-
"generatedAt": "2026-03-
|
|
4
|
+
"version": "3.21.0",
|
|
5
|
+
"generatedAt": "2026-03-26T15:20:18.549Z",
|
|
6
6
|
"definitions": {
|
|
7
7
|
"agents": [
|
|
8
8
|
{
|
|
@@ -233,40 +233,7 @@
|
|
|
233
233
|
}
|
|
234
234
|
],
|
|
235
235
|
"hooks": [],
|
|
236
|
-
"workflows": [
|
|
237
|
-
{
|
|
238
|
-
"slug": "bug-fix",
|
|
239
|
-
"file": "workflows/bug-fix.json",
|
|
240
|
-
"version": "1.0.0",
|
|
241
|
-
"checksum": "sha256:787fad52ecfb0c910387706ecb191bed43ef1179e6ef388672d14fefcc9e86d6",
|
|
242
|
-
"supersedes": null,
|
|
243
|
-
"metadata": {}
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
"slug": "feature-development",
|
|
247
|
-
"file": "workflows/feature-development.json",
|
|
248
|
-
"version": "1.0.0",
|
|
249
|
-
"checksum": "sha256:6995d95b8e58a4a1c393a6e68d36d68cc75c7dfddbb56ed2c5e3e6ec2767a4fc",
|
|
250
|
-
"supersedes": null,
|
|
251
|
-
"metadata": {}
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
"slug": "legacy-analysis",
|
|
255
|
-
"file": "workflows/legacy-analysis.json",
|
|
256
|
-
"version": "1.0.0",
|
|
257
|
-
"checksum": "sha256:603585476d2e4c5db0ad2b3fb8e43797bac4a137d1c9b624b794966b907f22ec",
|
|
258
|
-
"supersedes": null,
|
|
259
|
-
"metadata": {}
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
"slug": "refactoring",
|
|
263
|
-
"file": "workflows/refactoring.json",
|
|
264
|
-
"version": "1.0.0",
|
|
265
|
-
"checksum": "sha256:8df38b1039e00cb3ed753acec555cc158e7b3172d8c1261b45b30e0832e274f5",
|
|
266
|
-
"supersedes": null,
|
|
267
|
-
"metadata": {}
|
|
268
|
-
}
|
|
269
|
-
],
|
|
236
|
+
"workflows": [],
|
|
270
237
|
"kb": [
|
|
271
238
|
{
|
|
272
239
|
"slug": "auth-strategies",
|
package/package.json
CHANGED
package/workflows/bug-fix.json
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "bug-fix",
|
|
3
|
-
"type": "bug_fix",
|
|
4
|
-
"displayName": "Bug Fix",
|
|
5
|
-
"description": "Workflow for fixing bugs and issues",
|
|
6
|
-
"version": "1.0.0",
|
|
7
|
-
"triggers": [
|
|
8
|
-
"bug",
|
|
9
|
-
"fix",
|
|
10
|
-
"issue",
|
|
11
|
-
"error",
|
|
12
|
-
"broken",
|
|
13
|
-
"crash",
|
|
14
|
-
"problem"
|
|
15
|
-
],
|
|
16
|
-
"phases": [
|
|
17
|
-
{
|
|
18
|
-
"name": "ANALYZE",
|
|
19
|
-
"displayName": "Analysis",
|
|
20
|
-
"agent": "researcher",
|
|
21
|
-
"artifact": "bug-analysis.md",
|
|
22
|
-
"gates": []
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "REPRODUCE",
|
|
26
|
-
"displayName": "Reproduction",
|
|
27
|
-
"agent": "implementer",
|
|
28
|
-
"artifact": "reproduction-steps.md",
|
|
29
|
-
"gates": [
|
|
30
|
-
{
|
|
31
|
-
"type": "artifact",
|
|
32
|
-
"config": {
|
|
33
|
-
"required": true
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"name": "FIX",
|
|
40
|
-
"displayName": "Fix Implementation",
|
|
41
|
-
"agent": "implementer",
|
|
42
|
-
"artifact": "fix-report.md",
|
|
43
|
-
"requiresApproval": true,
|
|
44
|
-
"gates": [
|
|
45
|
-
{
|
|
46
|
-
"type": "tests",
|
|
47
|
-
"config": {
|
|
48
|
-
"mustPass": true
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"name": "VERIFY",
|
|
55
|
-
"displayName": "Verification",
|
|
56
|
-
"agent": "reviewer",
|
|
57
|
-
"artifact": "verification-report.md",
|
|
58
|
-
"gates": [
|
|
59
|
-
{
|
|
60
|
-
"type": "tests",
|
|
61
|
-
"config": {
|
|
62
|
-
"mustPass": true
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"type": "artifact",
|
|
67
|
-
"config": {
|
|
68
|
-
"required": true
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "feature-development",
|
|
3
|
-
"type": "feature_development",
|
|
4
|
-
"displayName": "Feature Development",
|
|
5
|
-
"description": "Standard workflow for implementing new features",
|
|
6
|
-
"version": "1.0.0",
|
|
7
|
-
"triggers": [
|
|
8
|
-
"feature",
|
|
9
|
-
"new feature",
|
|
10
|
-
"implement",
|
|
11
|
-
"create",
|
|
12
|
-
"add",
|
|
13
|
-
"build"
|
|
14
|
-
],
|
|
15
|
-
"phases": [
|
|
16
|
-
{
|
|
17
|
-
"name": "RESEARCH",
|
|
18
|
-
"displayName": "Research",
|
|
19
|
-
"agent": "researcher",
|
|
20
|
-
"artifact": "research-context.md",
|
|
21
|
-
"optional": true,
|
|
22
|
-
"gates": []
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "SPECIFY",
|
|
26
|
-
"displayName": "Specification",
|
|
27
|
-
"agent": "specifier",
|
|
28
|
-
"artifact": "spec.md",
|
|
29
|
-
"gates": [
|
|
30
|
-
{
|
|
31
|
-
"type": "artifact",
|
|
32
|
-
"config": {
|
|
33
|
-
"required": true
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"name": "PLAN",
|
|
40
|
-
"displayName": "Technical Plan",
|
|
41
|
-
"agent": "planner",
|
|
42
|
-
"artifact": "plan.md",
|
|
43
|
-
"gates": [
|
|
44
|
-
{
|
|
45
|
-
"type": "artifact",
|
|
46
|
-
"config": {
|
|
47
|
-
"required": true
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"name": "TASKS",
|
|
54
|
-
"displayName": "Task Generation",
|
|
55
|
-
"agent": "task-generator",
|
|
56
|
-
"artifact": "tasks.md",
|
|
57
|
-
"gates": [
|
|
58
|
-
{
|
|
59
|
-
"type": "artifact",
|
|
60
|
-
"config": {
|
|
61
|
-
"required": true
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"name": "IMPLEMENT",
|
|
68
|
-
"displayName": "Implementation",
|
|
69
|
-
"agent": "implementer",
|
|
70
|
-
"artifact": "implementation-report.md",
|
|
71
|
-
"requiresApproval": true,
|
|
72
|
-
"gates": [
|
|
73
|
-
{
|
|
74
|
-
"type": "tests",
|
|
75
|
-
"config": {
|
|
76
|
-
"mustPass": true
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"type": "coverage",
|
|
81
|
-
"config": {
|
|
82
|
-
"minimum": 80
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
}
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "legacy-analysis",
|
|
3
|
-
"name": "Legacy Application Analysis",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"type": "legacy_analysis",
|
|
6
|
-
"description": "Systematic analysis of legacy codebases to extract documentation, identify technical debt, and generate modernization roadmaps",
|
|
7
|
-
"triggers": [
|
|
8
|
-
"analyze legacy",
|
|
9
|
-
"legacy analysis",
|
|
10
|
-
"legacy application",
|
|
11
|
-
"modernize application",
|
|
12
|
-
"reverse engineer",
|
|
13
|
-
"discover APIs",
|
|
14
|
-
"map database",
|
|
15
|
-
"analisar legado",
|
|
16
|
-
"analise de legado",
|
|
17
|
-
"aplicacao legada",
|
|
18
|
-
"modernizar aplicacao",
|
|
19
|
-
"engenharia reversa",
|
|
20
|
-
"descobrir APIs",
|
|
21
|
-
"mapear banco"
|
|
22
|
-
],
|
|
23
|
-
"phases": [
|
|
24
|
-
{
|
|
25
|
-
"id": "discover",
|
|
26
|
-
"name": "Discovery",
|
|
27
|
-
"description": "Explore codebase structure and detect technology stack",
|
|
28
|
-
"agent": "legacy-discoverer",
|
|
29
|
-
"artifacts": ["discovery-report.md"],
|
|
30
|
-
"gates": {
|
|
31
|
-
"required": ["discovery-report.md"],
|
|
32
|
-
"validations": [
|
|
33
|
-
"has-stack-detected",
|
|
34
|
-
"has-confidence-score",
|
|
35
|
-
"has-directory-structure"
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
"requiresApproval": false,
|
|
39
|
-
"estimatedDuration": "30-60min"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"id": "inventory",
|
|
43
|
-
"name": "Inventory",
|
|
44
|
-
"description": "Catalog all assets, files, and components",
|
|
45
|
-
"agent": "legacy-discoverer",
|
|
46
|
-
"artifacts": ["inventory.json"],
|
|
47
|
-
"gates": {
|
|
48
|
-
"required": ["inventory.json"],
|
|
49
|
-
"validations": [
|
|
50
|
-
"has-asset-counts",
|
|
51
|
-
"has-metrics",
|
|
52
|
-
"json-valid"
|
|
53
|
-
]
|
|
54
|
-
},
|
|
55
|
-
"requiresApproval": false,
|
|
56
|
-
"estimatedDuration": "30-60min"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"id": "analyze",
|
|
60
|
-
"name": "Analysis",
|
|
61
|
-
"description": "Deep analysis of code quality, technical debt, and security issues",
|
|
62
|
-
"agent": "code-archaeologist",
|
|
63
|
-
"artifacts": [
|
|
64
|
-
"analysis-report.md",
|
|
65
|
-
"dead-code-report.md",
|
|
66
|
-
"tech-debt.md"
|
|
67
|
-
],
|
|
68
|
-
"gates": {
|
|
69
|
-
"required": ["analysis-report.md"],
|
|
70
|
-
"validations": [
|
|
71
|
-
"has-severity-classification",
|
|
72
|
-
"has-findings",
|
|
73
|
-
"no-secrets-exposed"
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
"requiresApproval": false,
|
|
77
|
-
"estimatedDuration": "1-2h"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"id": "map",
|
|
81
|
-
"name": "Mapping",
|
|
82
|
-
"description": "Extract API specifications and database schema",
|
|
83
|
-
"agent": "api-extractor",
|
|
84
|
-
"secondaryAgents": ["schema-extractor"],
|
|
85
|
-
"parallelizable": true,
|
|
86
|
-
"artifacts": [
|
|
87
|
-
"api-spec.yaml",
|
|
88
|
-
"database-schema.md",
|
|
89
|
-
"integrations.md"
|
|
90
|
-
],
|
|
91
|
-
"gates": {
|
|
92
|
-
"required": ["api-spec.yaml", "database-schema.md"],
|
|
93
|
-
"validations": [
|
|
94
|
-
"openapi-valid",
|
|
95
|
-
"has-mermaid-diagram",
|
|
96
|
-
"has-endpoints"
|
|
97
|
-
]
|
|
98
|
-
},
|
|
99
|
-
"requiresApproval": false,
|
|
100
|
-
"estimatedDuration": "1-2h"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"id": "document",
|
|
104
|
-
"name": "Documentation",
|
|
105
|
-
"description": "Extract and document business rules and domain logic",
|
|
106
|
-
"agent": "business-rule-miner",
|
|
107
|
-
"artifacts": [
|
|
108
|
-
"business-rules.md",
|
|
109
|
-
"glossary.md",
|
|
110
|
-
"flow-diagrams.md"
|
|
111
|
-
],
|
|
112
|
-
"gates": {
|
|
113
|
-
"required": ["business-rules.md"],
|
|
114
|
-
"validations": [
|
|
115
|
-
"has-rules-by-domain",
|
|
116
|
-
"has-locations",
|
|
117
|
-
"has-glossary"
|
|
118
|
-
]
|
|
119
|
-
},
|
|
120
|
-
"requiresApproval": false,
|
|
121
|
-
"estimatedDuration": "1-2h"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"id": "recommend",
|
|
125
|
-
"name": "Recommendations",
|
|
126
|
-
"description": "Synthesize findings and generate migration roadmap",
|
|
127
|
-
"agent": "legacy-synthesizer",
|
|
128
|
-
"artifacts": [
|
|
129
|
-
"migration-roadmap.md",
|
|
130
|
-
"architecture-proposal.md",
|
|
131
|
-
"final-report.md"
|
|
132
|
-
],
|
|
133
|
-
"gates": {
|
|
134
|
-
"required": ["migration-roadmap.md", "final-report.md"],
|
|
135
|
-
"validations": [
|
|
136
|
-
"has-phases",
|
|
137
|
-
"has-estimates",
|
|
138
|
-
"has-risks",
|
|
139
|
-
"has-quick-wins"
|
|
140
|
-
]
|
|
141
|
-
},
|
|
142
|
-
"requiresApproval": true,
|
|
143
|
-
"estimatedDuration": "1-2h"
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
|
-
"transitions": {
|
|
147
|
-
"discover": ["inventory"],
|
|
148
|
-
"inventory": ["analyze"],
|
|
149
|
-
"analyze": ["map"],
|
|
150
|
-
"map": ["document"],
|
|
151
|
-
"document": ["recommend"],
|
|
152
|
-
"recommend": []
|
|
153
|
-
},
|
|
154
|
-
"configuration": {
|
|
155
|
-
"patternSets": {
|
|
156
|
-
"basePath": ".orchestrator/patterns/legacy",
|
|
157
|
-
"fallbackBehavior": "heuristic",
|
|
158
|
-
"defaultStack": null
|
|
159
|
-
},
|
|
160
|
-
"templates": {
|
|
161
|
-
"basePath": ".orchestrator/templates/legacy"
|
|
162
|
-
},
|
|
163
|
-
"artifactPath": ".orchestrator/artifacts/legacy-analysis",
|
|
164
|
-
"allowParallelPhases": true,
|
|
165
|
-
"tokenBudgetPerPhase": 50000,
|
|
166
|
-
"checkpointFrequency": "per-phase"
|
|
167
|
-
},
|
|
168
|
-
"gates": {
|
|
169
|
-
"discover": {
|
|
170
|
-
"has-stack-detected": {
|
|
171
|
-
"type": "content-check",
|
|
172
|
-
"description": "Discovery report must identify technology stack",
|
|
173
|
-
"pattern": "Stack Detected:|Technology Stack:",
|
|
174
|
-
"severity": "CRITICAL"
|
|
175
|
-
},
|
|
176
|
-
"has-confidence-score": {
|
|
177
|
-
"type": "content-check",
|
|
178
|
-
"description": "Must include confidence score for stack detection",
|
|
179
|
-
"pattern": "Confidence:|confidence.*\\d+",
|
|
180
|
-
"severity": "HIGH"
|
|
181
|
-
},
|
|
182
|
-
"has-directory-structure": {
|
|
183
|
-
"type": "content-check",
|
|
184
|
-
"description": "Must document directory structure",
|
|
185
|
-
"pattern": "Directory Structure:|Structure:",
|
|
186
|
-
"severity": "MEDIUM"
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
"inventory": {
|
|
190
|
-
"has-asset-counts": {
|
|
191
|
-
"type": "json-field",
|
|
192
|
-
"description": "Must include counts for all asset types",
|
|
193
|
-
"field": "assets",
|
|
194
|
-
"severity": "CRITICAL"
|
|
195
|
-
},
|
|
196
|
-
"has-metrics": {
|
|
197
|
-
"type": "json-field",
|
|
198
|
-
"description": "Must include code metrics",
|
|
199
|
-
"field": "metrics",
|
|
200
|
-
"severity": "HIGH"
|
|
201
|
-
},
|
|
202
|
-
"json-valid": {
|
|
203
|
-
"type": "json-validation",
|
|
204
|
-
"description": "Inventory must be valid JSON",
|
|
205
|
-
"severity": "CRITICAL"
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
"analyze": {
|
|
209
|
-
"has-severity-classification": {
|
|
210
|
-
"type": "content-check",
|
|
211
|
-
"description": "Must classify findings by severity",
|
|
212
|
-
"pattern": "CRITICAL|HIGH|MEDIUM|LOW",
|
|
213
|
-
"severity": "CRITICAL"
|
|
214
|
-
},
|
|
215
|
-
"has-findings": {
|
|
216
|
-
"type": "content-check",
|
|
217
|
-
"description": "Must document findings",
|
|
218
|
-
"pattern": "Findings|Issues Identified",
|
|
219
|
-
"severity": "HIGH"
|
|
220
|
-
},
|
|
221
|
-
"no-secrets-exposed": {
|
|
222
|
-
"type": "security-check",
|
|
223
|
-
"description": "Must not expose secrets in reports",
|
|
224
|
-
"pattern": "password|api[_-]?key|secret|token",
|
|
225
|
-
"action": "fail-if-found",
|
|
226
|
-
"severity": "CRITICAL"
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
"map": {
|
|
230
|
-
"openapi-valid": {
|
|
231
|
-
"type": "openapi-validation",
|
|
232
|
-
"description": "API spec must be valid OpenAPI 3.0",
|
|
233
|
-
"version": "3.0",
|
|
234
|
-
"severity": "CRITICAL"
|
|
235
|
-
},
|
|
236
|
-
"has-mermaid-diagram": {
|
|
237
|
-
"type": "content-check",
|
|
238
|
-
"description": "Database schema must include Mermaid ER diagram",
|
|
239
|
-
"pattern": "```mermaid|erDiagram",
|
|
240
|
-
"severity": "HIGH"
|
|
241
|
-
},
|
|
242
|
-
"has-endpoints": {
|
|
243
|
-
"type": "content-check",
|
|
244
|
-
"description": "API spec must document endpoints",
|
|
245
|
-
"pattern": "paths:",
|
|
246
|
-
"severity": "CRITICAL"
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
"document": {
|
|
250
|
-
"has-rules-by-domain": {
|
|
251
|
-
"type": "content-check",
|
|
252
|
-
"description": "Business rules must be categorized by domain",
|
|
253
|
-
"pattern": "Domain:|Category:",
|
|
254
|
-
"severity": "HIGH"
|
|
255
|
-
},
|
|
256
|
-
"has-locations": {
|
|
257
|
-
"type": "content-check",
|
|
258
|
-
"description": "Rules must include source file locations",
|
|
259
|
-
"pattern": "Location:|File:",
|
|
260
|
-
"severity": "MEDIUM"
|
|
261
|
-
},
|
|
262
|
-
"has-glossary": {
|
|
263
|
-
"type": "artifact-exists",
|
|
264
|
-
"description": "Glossary of domain terms must exist",
|
|
265
|
-
"artifact": "glossary.md",
|
|
266
|
-
"severity": "MEDIUM"
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
"recommend": {
|
|
270
|
-
"has-phases": {
|
|
271
|
-
"type": "content-check",
|
|
272
|
-
"description": "Roadmap must include migration phases",
|
|
273
|
-
"pattern": "Phase \\d+|Migration Phase",
|
|
274
|
-
"severity": "CRITICAL"
|
|
275
|
-
},
|
|
276
|
-
"has-estimates": {
|
|
277
|
-
"type": "content-check",
|
|
278
|
-
"description": "Must include effort estimates",
|
|
279
|
-
"pattern": "Estimate:|Duration:|Effort:",
|
|
280
|
-
"severity": "HIGH"
|
|
281
|
-
},
|
|
282
|
-
"has-risks": {
|
|
283
|
-
"type": "content-check",
|
|
284
|
-
"description": "Must document risks and mitigations",
|
|
285
|
-
"pattern": "Risk:|Mitigation:",
|
|
286
|
-
"severity": "HIGH"
|
|
287
|
-
},
|
|
288
|
-
"has-quick-wins": {
|
|
289
|
-
"type": "content-check",
|
|
290
|
-
"description": "Should identify quick win opportunities",
|
|
291
|
-
"pattern": "Quick Win|Low Effort",
|
|
292
|
-
"severity": "MEDIUM"
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
"metadata": {
|
|
297
|
-
"author": "implementer-agent",
|
|
298
|
-
"created": "2026-01-23",
|
|
299
|
-
"lastUpdated": "2026-01-23",
|
|
300
|
-
"rfc": "RFC-004-LEGACY-ANALYSIS-WORKFLOW",
|
|
301
|
-
"targetVersion": "v1.7.0",
|
|
302
|
-
"status": "active"
|
|
303
|
-
}
|
|
304
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "refactoring",
|
|
3
|
-
"type": "refactoring",
|
|
4
|
-
"displayName": "Refactoring",
|
|
5
|
-
"description": "Workflow for code refactoring and improvements",
|
|
6
|
-
"version": "1.0.0",
|
|
7
|
-
"triggers": [
|
|
8
|
-
"refactor",
|
|
9
|
-
"improve",
|
|
10
|
-
"cleanup",
|
|
11
|
-
"optimize",
|
|
12
|
-
"restructure",
|
|
13
|
-
"simplify"
|
|
14
|
-
],
|
|
15
|
-
"phases": [
|
|
16
|
-
{
|
|
17
|
-
"name": "ANALYZE",
|
|
18
|
-
"displayName": "Analysis",
|
|
19
|
-
"agent": "researcher",
|
|
20
|
-
"artifact": "refactoring-analysis.md",
|
|
21
|
-
"gates": []
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"name": "PLAN",
|
|
25
|
-
"displayName": "Refactoring Plan",
|
|
26
|
-
"agent": "planner",
|
|
27
|
-
"artifact": "refactoring-plan.md",
|
|
28
|
-
"gates": [
|
|
29
|
-
{
|
|
30
|
-
"type": "artifact",
|
|
31
|
-
"config": {
|
|
32
|
-
"required": true
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"name": "REFACTOR",
|
|
39
|
-
"displayName": "Refactoring",
|
|
40
|
-
"agent": "implementer",
|
|
41
|
-
"artifact": "refactoring-report.md",
|
|
42
|
-
"requiresApproval": true,
|
|
43
|
-
"gates": [
|
|
44
|
-
{
|
|
45
|
-
"type": "tests",
|
|
46
|
-
"config": {
|
|
47
|
-
"mustPass": true
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"type": "coverage",
|
|
52
|
-
"config": {
|
|
53
|
-
"minimum": 80,
|
|
54
|
-
"maintainCurrent": true
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"name": "VERIFY",
|
|
61
|
-
"displayName": "Verification",
|
|
62
|
-
"agent": "reviewer",
|
|
63
|
-
"artifact": "verification-report.md",
|
|
64
|
-
"gates": [
|
|
65
|
-
{
|
|
66
|
-
"type": "tests",
|
|
67
|
-
"config": {
|
|
68
|
-
"mustPass": true
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
}
|