@hanhnd/agent-kit 1.0.1 → 1.0.5
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/README.md +1 -1
- package/package.json +5 -1
- package/dist/tools/gemini.d.ts +0 -9
- package/dist/tools/gemini.js +0 -111
- package/dist/tools/orchestration.d.ts +0 -9
- package/dist/tools/orchestration.js +0 -168
- package/dist/workflows.d.ts +0 -2
- package/dist/workflows.js +0 -268
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
| `/ak:plan [file or idea]` | Create an implementation blueprint |
|
|
13
13
|
| `/ak:code [file or task]` | Implement from a plan |
|
|
14
14
|
| `/ak:review-pr [PR URL]` | Review a pull request |
|
|
15
|
-
| `/ak:review
|
|
15
|
+
| `/ak:review` | Review uncommitted local changes |
|
|
16
16
|
| `/ak:ticket [ID]` | Fetch a Jira ticket and plan from it |
|
|
17
17
|
| `/ak:git` | Git commit, branch, and PR workflow |
|
|
18
18
|
| `/ak:init` | Create the project overview file |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanhnd/agent-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Super Engineer - Team of AI Agents for software development (Claude Code Plugin)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/kit-server.js",
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/hanh-nd/agent-kit.git"
|
|
19
|
+
},
|
|
16
20
|
"scripts": {
|
|
17
21
|
"prepublishOnly": "npm run build",
|
|
18
22
|
"build": "tsc && npm run bundle",
|
package/dist/tools/gemini.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Delegation Tools - Invoke external agent CLIs (Gemini, Claude)
|
|
3
|
-
* Supports handoff file injection and automatic fallback
|
|
4
|
-
*/
|
|
5
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
-
/**
|
|
7
|
-
* Register agent delegation tools with MCP server
|
|
8
|
-
*/
|
|
9
|
-
export declare function registerGeminiTools(server: McpServer): void;
|
package/dist/tools/gemini.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Delegation Tools - Invoke external agent CLIs (Gemini, Claude)
|
|
3
|
-
* Supports handoff file injection and automatic fallback
|
|
4
|
-
*/
|
|
5
|
-
import { execFileSync } from 'child_process';
|
|
6
|
-
import * as fs from 'fs';
|
|
7
|
-
import * as path from 'path';
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
import { getWorkspaceRoot } from '../utils.js';
|
|
10
|
-
import { commandExists, validatePath } from './security.js';
|
|
11
|
-
// Configurable timeout via environment variable (default: 5 minutes)
|
|
12
|
-
const AGENT_TIMEOUT = parseInt(process.env.KIT_AGENT_TIMEOUT || '300000', 10);
|
|
13
|
-
/**
|
|
14
|
-
* Register agent delegation tools with MCP server
|
|
15
|
-
*/
|
|
16
|
-
export function registerGeminiTools(server) {
|
|
17
|
-
// ═══════════════════════════════════════════════════════════════
|
|
18
|
-
// TOOL: TRIGGER AGENT
|
|
19
|
-
// Delegates a task to an external agent CLI (gemini or claude).
|
|
20
|
-
// Auto-detects if task is a file path and reads it as context.
|
|
21
|
-
// Falls back to the alternate agent if requested one is missing.
|
|
22
|
-
// ═══════════════════════════════════════════════════════════════
|
|
23
|
-
server.tool('kit_trigger_agent', 'Delegate a task to an external agent CLI (gemini or claude). The task can be a direct message or a path to a handoff file (.agent-kit/handoffs/plans/plan-xyz.md). Falls back to the other agent CLI if the requested one is not installed.', {
|
|
24
|
-
agent: z.enum(['gemini', 'claude']).describe('The agent CLI to invoke: "gemini" or "claude"'),
|
|
25
|
-
task: z
|
|
26
|
-
.string()
|
|
27
|
-
.describe('Task message or path to a handoff file (e.g., ".agent-kit/handoffs/plans/plan-xyz.md")'),
|
|
28
|
-
}, async ({ agent, task }) => {
|
|
29
|
-
try {
|
|
30
|
-
const workspaceRoot = getWorkspaceRoot();
|
|
31
|
-
// Detect if task is a file path — resolve and read if it exists
|
|
32
|
-
let prompt = task;
|
|
33
|
-
const resolvedTask = path.resolve(workspaceRoot, task);
|
|
34
|
-
if (fs.existsSync(resolvedTask) && fs.statSync(resolvedTask).isFile()) {
|
|
35
|
-
try {
|
|
36
|
-
validatePath(task, workspaceRoot);
|
|
37
|
-
prompt = fs.readFileSync(resolvedTask, 'utf-8');
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
return {
|
|
41
|
-
content: [{ type: 'text', text: `Error reading task file: ${err}` }],
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
// Determine which agent to use — fallback if requested not available
|
|
46
|
-
let usedAgent = agent;
|
|
47
|
-
let fallbackReason;
|
|
48
|
-
if (!commandExists(agent)) {
|
|
49
|
-
const fallback = agent === 'gemini' ? 'claude' : 'gemini';
|
|
50
|
-
if (commandExists(fallback)) {
|
|
51
|
-
usedAgent = fallback;
|
|
52
|
-
fallbackReason = `${agent} CLI not installed, fell back to ${fallback}`;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
const installHint = agent === 'gemini'
|
|
56
|
-
? 'Install Gemini CLI: https://github.com/google-gemini/gemini-cli'
|
|
57
|
-
: 'Install Claude CLI: npm install -g @anthropic-ai/claude-code';
|
|
58
|
-
return {
|
|
59
|
-
content: [
|
|
60
|
-
{
|
|
61
|
-
type: 'text',
|
|
62
|
-
text: JSON.stringify({
|
|
63
|
-
agent,
|
|
64
|
-
status: 'error',
|
|
65
|
-
output: '',
|
|
66
|
-
error: `Neither ${agent} nor the fallback agent CLI is installed. ${installHint}`,
|
|
67
|
-
}, null, 2),
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
// Execute the agent CLI with the prompt
|
|
74
|
-
const output = execFileSync(usedAgent, ['-p', prompt], {
|
|
75
|
-
encoding: 'utf8',
|
|
76
|
-
timeout: AGENT_TIMEOUT,
|
|
77
|
-
maxBuffer: 10 * 1024 * 1024, // 10MB
|
|
78
|
-
cwd: workspaceRoot,
|
|
79
|
-
});
|
|
80
|
-
return {
|
|
81
|
-
content: [
|
|
82
|
-
{
|
|
83
|
-
type: 'text',
|
|
84
|
-
text: JSON.stringify({
|
|
85
|
-
agent: usedAgent,
|
|
86
|
-
status: fallbackReason ? 'fallback' : 'success',
|
|
87
|
-
output,
|
|
88
|
-
...(fallbackReason && { fallback_reason: fallbackReason }),
|
|
89
|
-
}, null, 2),
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
96
|
-
return {
|
|
97
|
-
content: [
|
|
98
|
-
{
|
|
99
|
-
type: 'text',
|
|
100
|
-
text: JSON.stringify({
|
|
101
|
-
agent,
|
|
102
|
-
status: 'error',
|
|
103
|
-
output: '',
|
|
104
|
-
error: msg,
|
|
105
|
-
}, null, 2),
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core Tools - Project context, handoff, and artifact management
|
|
3
|
-
* Extracted from kit-server.ts for better modularity
|
|
4
|
-
*/
|
|
5
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
-
/**
|
|
7
|
-
* Register core tools with MCP server
|
|
8
|
-
*/
|
|
9
|
-
export declare function registrerOrchestrationTools(server: McpServer): void;
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core Tools - Project context, handoff, and artifact management
|
|
3
|
-
* Extracted from kit-server.ts for better modularity
|
|
4
|
-
*/
|
|
5
|
-
import * as fs from 'fs';
|
|
6
|
-
import * as path from 'path';
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
import { getExtensionRoot, getWorkspaceRoot } from '../utils.js';
|
|
9
|
-
import { WORKFLOWS } from '../workflows.js';
|
|
10
|
-
/**
|
|
11
|
-
* Resolve lifecycle configuration (Project > Extension)
|
|
12
|
-
*/
|
|
13
|
-
function getWorkflows() {
|
|
14
|
-
return WORKFLOWS;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Register core tools with MCP server
|
|
18
|
-
*/
|
|
19
|
-
export function registrerOrchestrationTools(server) {
|
|
20
|
-
// ═══════════════════════════════════════════════════════════════
|
|
21
|
-
// TOOL: GET NEXT PHASE
|
|
22
|
-
// Persists the rolling summary and returns transition instructions
|
|
23
|
-
// ═══════════════════════════════════════════════════════════════
|
|
24
|
-
server.tool('kit_get_next_phase', 'Persists the rolling summary and returns transition instructions. currentPhase format: "workflow:phase" (e.g., "code:ANALYSIS")', {
|
|
25
|
-
summary: z.object({
|
|
26
|
-
original_goal: z.string(),
|
|
27
|
-
completed_tasks: z.array(z.string()),
|
|
28
|
-
pending_tasks: z.array(z.string()),
|
|
29
|
-
current_context_brief: z.string(),
|
|
30
|
-
}),
|
|
31
|
-
transitionTo: z
|
|
32
|
-
.string()
|
|
33
|
-
.optional()
|
|
34
|
-
.describe('Force transition to a specific phase (e.g., "INGESTION")'),
|
|
35
|
-
currentPhase: z.string().describe('The current workflow and phase (e.g., "code:ANALYSIS")'),
|
|
36
|
-
}, async ({ summary, transitionTo, currentPhase }) => {
|
|
37
|
-
try {
|
|
38
|
-
const [workflowId, phaseId] = currentPhase.split(':');
|
|
39
|
-
if (!workflowId) {
|
|
40
|
-
return {
|
|
41
|
-
content: [
|
|
42
|
-
{
|
|
43
|
-
type: 'text',
|
|
44
|
-
text: '❌ Invalid currentPhase format. Use "workflowId" or "workflow:phase".',
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
const handoffDir = path.join(getWorkspaceRoot(), '.claude-kit', 'handoffs', 'active');
|
|
50
|
-
const summaryPath = path.join(handoffDir, `${workflowId}-summary.md`);
|
|
51
|
-
// 1. Ensure directory exists
|
|
52
|
-
if (!fs.existsSync(handoffDir)) {
|
|
53
|
-
fs.mkdirSync(handoffDir, { recursive: true });
|
|
54
|
-
}
|
|
55
|
-
// 2. Format Markdown
|
|
56
|
-
const markdown = `
|
|
57
|
-
# 📝 Rolling Summary: ${workflowId.toUpperCase()} Workflow
|
|
58
|
-
|
|
59
|
-
## 🎯 Original Goal
|
|
60
|
-
${summary.original_goal}
|
|
61
|
-
|
|
62
|
-
## ✅ Completed Tasks
|
|
63
|
-
${summary.completed_tasks.map((t) => `- ${t}`).join('\n')}
|
|
64
|
-
|
|
65
|
-
## ⏳ Pending Tasks
|
|
66
|
-
${summary.pending_tasks.map((t) => `- ${t}`).join('\n')}
|
|
67
|
-
|
|
68
|
-
## 🧠 Current Context Brief
|
|
69
|
-
${summary.current_context_brief}
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
*Updated: ${new Date().toLocaleString()}*
|
|
73
|
-
`;
|
|
74
|
-
// 3. Persist summary
|
|
75
|
-
fs.writeFileSync(summaryPath, markdown, 'utf8');
|
|
76
|
-
// 4. Resolve next state
|
|
77
|
-
const workflows = getWorkflows();
|
|
78
|
-
let nextPhaseId = null;
|
|
79
|
-
if (workflows[workflowId]) {
|
|
80
|
-
const workflow = workflows[workflowId];
|
|
81
|
-
const currentState = phaseId ? workflow.states[phaseId] : null;
|
|
82
|
-
// Handle bootstrap case: if phaseId is missing, fallback to initial
|
|
83
|
-
if (!currentState) {
|
|
84
|
-
nextPhaseId = transitionTo || workflow.initial;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
nextPhaseId = transitionTo || currentState?.next || null;
|
|
88
|
-
}
|
|
89
|
-
if (nextPhaseId && !workflow.states[nextPhaseId]) {
|
|
90
|
-
nextPhaseId = null;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
// 5. Persist machine-readable state
|
|
94
|
-
const statePath = path.join(handoffDir, `${workflowId}-state.json`);
|
|
95
|
-
const stateData = {
|
|
96
|
-
workflowId,
|
|
97
|
-
currentPhase: phaseId || 'START',
|
|
98
|
-
nextPhase: nextPhaseId,
|
|
99
|
-
summary,
|
|
100
|
-
updatedAt: new Date().toISOString(),
|
|
101
|
-
};
|
|
102
|
-
fs.writeFileSync(statePath, JSON.stringify(stateData, null, 2), 'utf8');
|
|
103
|
-
// 6. Return transition instructions
|
|
104
|
-
if (!workflows[workflowId]) {
|
|
105
|
-
return {
|
|
106
|
-
content: [
|
|
107
|
-
{
|
|
108
|
-
type: 'text',
|
|
109
|
-
text: `✅ Summary persisted to ${summaryPath}.\n⚠️ Warning: Workflow "${workflowId}" not found in lifecycle.json.`,
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
const workflow = workflows[workflowId];
|
|
115
|
-
if (!nextPhaseId || !workflow.states[nextPhaseId]) {
|
|
116
|
-
return {
|
|
117
|
-
content: [
|
|
118
|
-
{
|
|
119
|
-
type: 'text',
|
|
120
|
-
text: `✅ Summary persisted. Workflow: ${workflowId}, Phase: ${phaseId || 'START'}. No next phase defined.`,
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
const currentState = phaseId ? workflow.states[phaseId] : null;
|
|
126
|
-
const nextState = workflow.states[nextPhaseId];
|
|
127
|
-
const extensionRoot = getExtensionRoot();
|
|
128
|
-
// Resolve agent content only if it changes
|
|
129
|
-
const currentAgent = currentState?.agent || workflow.agent;
|
|
130
|
-
const nextAgent = nextState.agent || workflow.agent;
|
|
131
|
-
let agentContent = '[UNCHANGED]';
|
|
132
|
-
if (nextAgent && nextAgent !== currentAgent) {
|
|
133
|
-
const agentPath = path.join(extensionRoot, 'agents', nextAgent + '.md');
|
|
134
|
-
if (fs.existsSync(agentPath)) {
|
|
135
|
-
agentContent = fs.readFileSync(agentPath, 'utf8');
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
agentContent = `⚠️ Warning: Agent persona file not found at ${agentPath}`;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else if (nextAgent && !currentState) {
|
|
142
|
-
// First phase transition (bootstrap)
|
|
143
|
-
const agentPath = path.join(extensionRoot, 'agents', nextAgent + '.md');
|
|
144
|
-
if (fs.existsSync(agentPath)) {
|
|
145
|
-
agentContent = fs.readFileSync(agentPath, 'utf8');
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const nextInstructions = `${nextState.instructions}\n\n**PHASE_STOP:** You MUST STOP immediately after completing the instructions above. Do not speculate, do not perform any "extra" work, and do not initiate the next phase. Summarize your progress and call 'kit_get_next_phase' to transition, or WAIT for user feedback if you need to ask_user or a gate is present.`;
|
|
149
|
-
return {
|
|
150
|
-
content: [
|
|
151
|
-
{
|
|
152
|
-
type: 'text',
|
|
153
|
-
text: `PHASE_TRANSITION:
|
|
154
|
-
Next Phase: ${workflowId}:${nextPhaseId}
|
|
155
|
-
Agent Content: ${agentContent}
|
|
156
|
-
Skills: ${JSON.stringify(nextState.skills || [])}
|
|
157
|
-
Instructions: ${nextInstructions}`,
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
catch (error) {
|
|
163
|
-
return {
|
|
164
|
-
content: [{ type: 'text', text: `Error updating summary/transition: ${error}` }],
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
}
|
package/dist/workflows.d.ts
DELETED
package/dist/workflows.js
DELETED
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import dedent from 'dedent';
|
|
2
|
-
const CODE_WORKFLOW = {
|
|
3
|
-
initial: 'PLAN_ANALYSIS',
|
|
4
|
-
agent: 'coder',
|
|
5
|
-
states: {
|
|
6
|
-
PLAN_ANALYSIS: {
|
|
7
|
-
instructions: dedent `
|
|
8
|
-
1. **Mandate:** You must understand the target and the constraints.
|
|
9
|
-
2. **Action:** Read the 'Target Input' (Implementation Plan). If the input is a file path, use 'read_file' to ingest its content.
|
|
10
|
-
`,
|
|
11
|
-
next: 'EXECUTION_AND_TESTING',
|
|
12
|
-
skills: [],
|
|
13
|
-
},
|
|
14
|
-
EXECUTION_AND_TESTING: {
|
|
15
|
-
instructions: dedent `
|
|
16
|
-
1. **Mandate:** You must now implement the changes defined in the 'Implementation Plan'.
|
|
17
|
-
2. **Execution:**
|
|
18
|
-
- For each file listed in the plan, use 'read_file' to get the current content.
|
|
19
|
-
- Apply the necessary modifications (additions, deletions, replacements).
|
|
20
|
-
- Use 'write_file' to save the updated content.
|
|
21
|
-
3. **Constraint:** Do not invent new files or change file paths unless explicitly required by the plan.
|
|
22
|
-
4. **Testing:**
|
|
23
|
-
- Decide whether to create unit tests based on '.claude-kit/stats.json' (hasUnitTests).
|
|
24
|
-
- If hasUnitTests is true, create or update '.test' or '.spec' files for the modified logic, covering primary paths and edge cases.
|
|
25
|
-
`,
|
|
26
|
-
next: 'VALIDATION_AND_HANDOFF',
|
|
27
|
-
skills: ['coding-common'],
|
|
28
|
-
},
|
|
29
|
-
VALIDATION_AND_HANDOFF: {
|
|
30
|
-
instructions: dedent `
|
|
31
|
-
1. **Self-Check:** Review the generated code for syntax errors, missing imports, or logic gaps.
|
|
32
|
-
- You MUST rely on the project's standard task runners with auto-fix priority (e.g., 'npm run lint', 'yarn test', 'make lint').
|
|
33
|
-
- FORBIDDEN: DO NOT attempt to guess or directly invoke underlying binary tools (like eslint, prettier, gulp, webpack, etc.).
|
|
34
|
-
- FORBIDDEN: DO NOT reverse-engineer or inspect build configuration files (e.g., webpack.config, gulpfile, settings.json) to understand how the project compiles.
|
|
35
|
-
2. **Synthesis:** Confirm if the Plan is 100% complete or if certain parts were blocked.
|
|
36
|
-
3. **Formatting:** Structure the entire output strictly according to the 'Output Format'.
|
|
37
|
-
4. **Persistence:** If required, save modified files or provide instructions for the user to apply the diff.
|
|
38
|
-
`,
|
|
39
|
-
next: null,
|
|
40
|
-
skills: [],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
const BRAINSTORM_WORKFLOW = {
|
|
45
|
-
initial: 'CONTEXT_INGESTION',
|
|
46
|
-
agent: 'brainstormer',
|
|
47
|
-
states: {
|
|
48
|
-
CONTEXT_INGESTION: {
|
|
49
|
-
instructions: dedent `
|
|
50
|
-
1. **Objective:** Understand the "Why" and the "Status Quo".
|
|
51
|
-
2. **Action:** Read provided context, previous files, or user prompts. Output **State 1**.
|
|
52
|
-
3. **Questions to ask:**
|
|
53
|
-
- What is the specific pain point? (Desperate Specificity)
|
|
54
|
-
- What happens if we do nothing? (Status Quo)
|
|
55
|
-
- Is there existing code/infrastructure we can leverage?
|
|
56
|
-
4. **Gate:** Do not proceed to the next phase until the user clearly defines the core problem and agrees on the premise.
|
|
57
|
-
`,
|
|
58
|
-
next: 'EXPANSION_VS_MINIMUM',
|
|
59
|
-
skills: [],
|
|
60
|
-
},
|
|
61
|
-
EXPANSION_VS_MINIMUM: {
|
|
62
|
-
instructions: dedent `
|
|
63
|
-
1. **Objective:** Stretch the idea to its maximum potential, then compress it to its most actionable form.
|
|
64
|
-
2. **Action:** Output **State 1**. Present the "10-Star Vision" (Scope Expansion) alongside the "Narrowest Wedge" (Scope Reduction).
|
|
65
|
-
3. **Questions to ask:**
|
|
66
|
-
- Do we build the Minimum Viable version for speed, or do we invest in the 10x Architecture now?
|
|
67
|
-
- What is the "Delight factor" (What makes the user say "whoa")?
|
|
68
|
-
4. **Gate:** The user MUST make a decision on the scope mode (Expansion, Selective, or Minimum Wedge). Lock the scope.
|
|
69
|
-
`,
|
|
70
|
-
next: 'ARCH_ALTERNATIVES',
|
|
71
|
-
skills: [],
|
|
72
|
-
},
|
|
73
|
-
ARCH_ALTERNATIVES: {
|
|
74
|
-
instructions: dedent `
|
|
75
|
-
1. **Objective:** Propose concrete ways to build the locked scope.
|
|
76
|
-
2. **Action:** Present exactly 2 to 3 distinct implementation approaches using the 'AskUserQuestion' format.
|
|
77
|
-
- *Approach A (Minimal):* Quickest time-to-market, leverages existing tools heavily.
|
|
78
|
-
- *Approach B (Ideal):* Scalable, robust, "boring by default" technology.
|
|
79
|
-
- *Approach C (Creative):* A lateral thinking approach (if applicable).
|
|
80
|
-
3. **Gate:** User must explicitly choose one approach.
|
|
81
|
-
`,
|
|
82
|
-
next: 'BOUNDARIES_MAPPING',
|
|
83
|
-
skills: [],
|
|
84
|
-
},
|
|
85
|
-
BOUNDARIES_MAPPING: {
|
|
86
|
-
instructions: dedent `
|
|
87
|
-
1. **Objective:** Map the shadow paths. Ideas are easy; handling failures is hard.
|
|
88
|
-
2. **Action:** Analyze the chosen approach. What happens on 'nil'? What happens on 'timeout'? What happens on 'empty state'? What features are tempting but dangerous to include right now?
|
|
89
|
-
3. **Output:** Define the strict "NOT in scope" list.
|
|
90
|
-
`,
|
|
91
|
-
next: 'HANDOFF',
|
|
92
|
-
skills: [],
|
|
93
|
-
},
|
|
94
|
-
HANDOFF: {
|
|
95
|
-
instructions: dedent `
|
|
96
|
-
1. **Objective:** Consolidate all decisions into a single source of truth for engineering.
|
|
97
|
-
2. **Action:** Transition to **State 2: Engineer-Ready PRD & HLD**.
|
|
98
|
-
3. **Constraint:** Ensure the document is brutally clear. The ASCII diagram must exist. The Failure Modes table must be populated based on the previous phase.
|
|
99
|
-
4. **Persistence:** Save the finalized decision, including the ASCII diagram and reasoning, to '.claude-kit/handoffs/brainstorms/brainstorm-[timestamp]-[slug].md'.
|
|
100
|
-
5. **Handoff:** Request explicit user approval ("Approve") before ending the pipeline.
|
|
101
|
-
`,
|
|
102
|
-
next: null,
|
|
103
|
-
skills: [],
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
const REVIEW_WORKFLOW = {
|
|
108
|
-
initial: 'CONTEXT_DRIFT',
|
|
109
|
-
agent: 'reviewer',
|
|
110
|
-
states: {
|
|
111
|
-
CONTEXT_DRIFT: {
|
|
112
|
-
instructions: dedent `
|
|
113
|
-
1. **Objective:** Understand *what* is being built and *why*, before looking at *how*.
|
|
114
|
-
2. **Action:** Read the Jira ticket description or PR summary provided in the context. Run the 'diff' to analyze the files changed.
|
|
115
|
-
3. **Decision Gate:**
|
|
116
|
-
- Compare the actual code changes against the Jira ticket intent.
|
|
117
|
-
- Identify **Scope Drift**: Are there new features, unrelated refactors, or massive architecture changes not requested in the ticket?
|
|
118
|
-
- Identify **Missing Requirements**: Did they skip a core acceptance criteria from the ticket?
|
|
119
|
-
4. **Persistence:** Store the "Scope Check" result in memory for the final report.
|
|
120
|
-
`,
|
|
121
|
-
next: 'MACRO_REVIEW',
|
|
122
|
-
skills: [],
|
|
123
|
-
},
|
|
124
|
-
MACRO_REVIEW: {
|
|
125
|
-
instructions: dedent `
|
|
126
|
-
1. **Objective:** Evaluate the forest before the trees.
|
|
127
|
-
2. **Action:** Analyze the overall architectural choices.
|
|
128
|
-
- Does this PR introduce new complexity that isn't justified?
|
|
129
|
-
- Are models/services interacting correctly?
|
|
130
|
-
- Is there over-engineering?
|
|
131
|
-
3. **Rule:** If the design is fundamentally flawed, record this as a **BLOCKER** and proceed to the next phase with a strict lens.
|
|
132
|
-
`,
|
|
133
|
-
next: 'MICRO_BLOCKERS',
|
|
134
|
-
skills: [],
|
|
135
|
-
},
|
|
136
|
-
MICRO_BLOCKERS: {
|
|
137
|
-
instructions: dedent `
|
|
138
|
-
1. **Objective:** Hunt for system-breaking bugs.
|
|
139
|
-
2. **Action:** Scan the diff specifically for:
|
|
140
|
-
- **SQL & Data Safety**: Direct DB writes bypassing validations, SQL string interpolation.
|
|
141
|
-
- **Race Conditions**: Check-then-set patterns, lack of atomic operations.
|
|
142
|
-
- **LLM/Trust Boundaries**: Unvalidated output from LLMs or external APIs being executed or persisted.
|
|
143
|
-
- **Enum/Completeness**: Did they add a new status but forget to handle it in existing switch statements?
|
|
144
|
-
3. **Classification:** Every finding here must be logged as a **BLOCKER**.
|
|
145
|
-
`,
|
|
146
|
-
next: 'MICRO_NITPICKS',
|
|
147
|
-
skills: [],
|
|
148
|
-
},
|
|
149
|
-
MICRO_NITPICKS: {
|
|
150
|
-
instructions: dedent `
|
|
151
|
-
1. **Objective:** Enforce codebase health, readability, and test parity.
|
|
152
|
-
2. **Action:** Scan the diff for:
|
|
153
|
-
- **Test Gaps**: New logic paths without corresponding unit/integration tests.
|
|
154
|
-
- **Side Effects**: Hidden state mutations in seemingly pure functions.
|
|
155
|
-
- **Dead Code**: Unused variables, lingering 'console.log' or debug statements.
|
|
156
|
-
- **Clean Code**: Magic numbers, poor naming conventions, bloated controllers.
|
|
157
|
-
3. **Classification:** Findings here are logged as **CONCERNS** (if tests are missing) or **NITPICKS** (for style/naming).
|
|
158
|
-
`,
|
|
159
|
-
next: 'HANDOFF',
|
|
160
|
-
skills: [],
|
|
161
|
-
},
|
|
162
|
-
HANDOFF: {
|
|
163
|
-
instructions: dedent `
|
|
164
|
-
1. **Objective:** Deliver the final actionable verdict to the developer.
|
|
165
|
-
2. **Action:** Synthesize findings from previous phases.
|
|
166
|
-
3. **Constraint:** Format the output STRICTLY matching the 'Final PR Review Report' state defined in the 'code-reviewer' persona.
|
|
167
|
-
- If there is at least one BLOCKER, the Verdict MUST be 'REQUEST CHANGES'.
|
|
168
|
-
- If there are only NITPICKS, the Verdict can be 'APPROVE' with comments.
|
|
169
|
-
4. **Handoff:** Conclude the review. No further code generation is allowed unless the user explicitly requests a code patch.
|
|
170
|
-
`,
|
|
171
|
-
next: null,
|
|
172
|
-
skills: [],
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
};
|
|
176
|
-
const PLAN_WORKFLOW = {
|
|
177
|
-
initial: 'CONTEXT_SCOPE',
|
|
178
|
-
agent: 'planner',
|
|
179
|
-
states: {
|
|
180
|
-
CONTEXT_SCOPE: {
|
|
181
|
-
instructions: dedent `
|
|
182
|
-
1. **Objective:** Gather comprehensive context to understand the structural impact of the request.
|
|
183
|
-
2. **Action:**
|
|
184
|
-
- Deep-dive into arguments, attached files, and JSON schemas.
|
|
185
|
-
- Identify exactly which modules will be affected (Blast Radius Assessment).
|
|
186
|
-
- Answer: What already exists? Are we over-engineering? Are we adhering to the Completeness Principle?
|
|
187
|
-
`,
|
|
188
|
-
next: 'ENG_REVIEW',
|
|
189
|
-
skills: [],
|
|
190
|
-
},
|
|
191
|
-
ENG_REVIEW: {
|
|
192
|
-
instructions: dedent `
|
|
193
|
-
1. **Action:** Evaluate 4 critical pillars:
|
|
194
|
-
- **Architecture**: Dependency graphs, module boundaries.
|
|
195
|
-
- **Code Quality**: DRY violations, error handling patterns.
|
|
196
|
-
- **Tests**: Ensure every new branch/logic path has a test requirement.
|
|
197
|
-
- **Performance**: N+1 issues, memory, caching.
|
|
198
|
-
2. **Decision Gate:** Use the 'ask_user' format to resolve architectural ambiguities or scope bloat.
|
|
199
|
-
3. **Constraint:** Never batch questions. Wait for the user's explicit response before proceeding.
|
|
200
|
-
`,
|
|
201
|
-
next: 'SKILL_ROUTING',
|
|
202
|
-
skills: [],
|
|
203
|
-
},
|
|
204
|
-
SKILL_ROUTING: {
|
|
205
|
-
instructions: dedent `
|
|
206
|
-
1. **Action:** Route to specific internal domain skills if necessary (e.g., 'frontend-arch', 'backend-arch', 'security') to validate the final approach.
|
|
207
|
-
2. **Action:** Map out the exact failure modes and the ASCII diagram representing the data flow.
|
|
208
|
-
`,
|
|
209
|
-
next: 'BLUEPRINT_GEN',
|
|
210
|
-
skills: [],
|
|
211
|
-
},
|
|
212
|
-
BLUEPRINT_GEN: {
|
|
213
|
-
instructions: dedent `
|
|
214
|
-
1. **Action:** Transition to 'Intern-Proof Blueprint State'.
|
|
215
|
-
2. **Constraint:** Draft the Work Breakdown Structure (WBS) strictly from the bottom up.
|
|
216
|
-
- Tasks must be granular enough for a Junior Engineer.
|
|
217
|
-
- Use explicit instructions like "Map the array of 'User' objects to 'UserDTO'..."
|
|
218
|
-
3. **Constraint:** Ensure the **Test Plan Artifact** and **NOT in Scope** sections are strictly populated.
|
|
219
|
-
`,
|
|
220
|
-
next: 'PERSISTENCE_HANDOFF',
|
|
221
|
-
skills: [],
|
|
222
|
-
},
|
|
223
|
-
PERSISTENCE_HANDOFF: {
|
|
224
|
-
instructions: dedent `
|
|
225
|
-
1. **Constraint Check:** Verify that NO source code has been modified during the planning session.
|
|
226
|
-
2. **Action:** Save the generated blueprint to '.claude-kit/handoffs/plans/plan-[timestamp]-[feature].md'.
|
|
227
|
-
3. **Handoff:** Request explicit user approval. Upon receiving "Approve", output the exact command for the coder agent: '/code @.claude-kit/handoffs/plans/[filename].md'.
|
|
228
|
-
`,
|
|
229
|
-
next: null,
|
|
230
|
-
skills: [],
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
};
|
|
234
|
-
const TICKET_WORKFLOW = {
|
|
235
|
-
initial: 'DATA_ACQUISITION',
|
|
236
|
-
states: {
|
|
237
|
-
DATA_ACQUISITION: {
|
|
238
|
-
instructions: dedent `
|
|
239
|
-
1. **Input Normalization:** Extract TICKET_ID (regex [A-Z]+-[0-9]+).
|
|
240
|
-
2. **Fetch Data:** Use 'kit_jira_get_ticket' with the TICKET_ID to retrieve ticket details.
|
|
241
|
-
3. **Persistence:** Save raw ticket data to '.claude-kit/handoffs/tickets/{{TICKET_ID}}.md'.
|
|
242
|
-
`,
|
|
243
|
-
next: 'HANDOFF',
|
|
244
|
-
skills: [],
|
|
245
|
-
},
|
|
246
|
-
HANDOFF: {
|
|
247
|
-
instructions: dedent `
|
|
248
|
-
1. **Objective:** Output ONLY the Report using the template.
|
|
249
|
-
2. **Template:**
|
|
250
|
-
### 🎟️ Ticket Report: {{TICKET_ID}}
|
|
251
|
-
- **Type:** [Classified Intent or Incomplete Requirement]
|
|
252
|
-
- **Summary:** [1-sentence technical summary]
|
|
253
|
-
---
|
|
254
|
-
### 🚀 Recommended Next Action
|
|
255
|
-
/plan @.claude-kit/handoffs/tickets/{{TICKET_ID}}.md
|
|
256
|
-
`,
|
|
257
|
-
next: null,
|
|
258
|
-
skills: [],
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
};
|
|
262
|
-
export const WORKFLOWS = {
|
|
263
|
-
brainstorm: BRAINSTORM_WORKFLOW,
|
|
264
|
-
review: REVIEW_WORKFLOW,
|
|
265
|
-
plan: PLAN_WORKFLOW,
|
|
266
|
-
code: CODE_WORKFLOW,
|
|
267
|
-
ticket: TICKET_WORKFLOW,
|
|
268
|
-
};
|