claude-orchestration 1.0.4 → 1.0.6
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/bin/cli.js +168 -42
- package/package.json +5 -1
- package/templates/claude/orchestration.md +52 -41
- package/templates/claude/workflows/react/bugfix.md +20 -38
- package/templates/claude/workflows/react/feature.md +23 -41
- package/templates/claude/workflows/react/pr.md +8 -13
- package/templates/claude/workflows/react/refactor.md +18 -29
- package/templates/claude/workflows/react/review.md +32 -40
package/bin/cli.js
CHANGED
|
@@ -3,39 +3,18 @@
|
|
|
3
3
|
import { promises as fs } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
import { checkbox, confirm } from "@inquirer/prompts";
|
|
6
8
|
|
|
7
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
10
|
const __dirname = path.dirname(__filename);
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Scaffolds Claude orchestration workflows into your project.
|
|
15
|
-
|
|
16
|
-
Creates a .claude/ directory with workflow templates for:
|
|
17
|
-
- feature.md Building new functionality
|
|
18
|
-
- bugfix.md Diagnosing and fixing bugs
|
|
19
|
-
- refactor.md Improving code structure
|
|
20
|
-
- pr.md Creating pull requests
|
|
21
|
-
- docs.md Writing documentation
|
|
22
|
-
|
|
23
|
-
Options:
|
|
24
|
-
-h, --help Show this help message
|
|
25
|
-
-v, --version Show version number
|
|
26
|
-
`);
|
|
27
|
-
process.exit(0);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
31
|
-
const pkg = JSON.parse(
|
|
32
|
-
await fs.readFile(path.join(__dirname, "..", "package.json"), "utf-8")
|
|
33
|
-
);
|
|
34
|
-
console.log(pkg.version);
|
|
35
|
-
process.exit(0);
|
|
36
|
-
}
|
|
12
|
+
const pkg = JSON.parse(
|
|
13
|
+
await fs.readFile(path.join(__dirname, "..", "package.json"), "utf-8")
|
|
14
|
+
);
|
|
37
15
|
|
|
38
16
|
const SOURCE_DIR = path.join(__dirname, "..", "templates", "claude");
|
|
17
|
+
const WORKFLOWS_DIR = path.join(SOURCE_DIR, "workflows");
|
|
39
18
|
const DEST_NAME = ".claude";
|
|
40
19
|
|
|
41
20
|
const ORCHESTRATION_INSTRUCTION = `
|
|
@@ -45,6 +24,38 @@ const ORCHESTRATION_INSTRUCTION = `
|
|
|
45
24
|
For complex tasks, refer to .claude/orchestration.md for available workflows.
|
|
46
25
|
`;
|
|
47
26
|
|
|
27
|
+
const ROOT_WORKFLOWS = [
|
|
28
|
+
{
|
|
29
|
+
name: "todo.md",
|
|
30
|
+
description: "Multi-step task management (uses 15-20% more tokens)",
|
|
31
|
+
checked: false,
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
async function getWorkflowFolders() {
|
|
36
|
+
const entries = await fs.readdir(WORKFLOWS_DIR, { withFileTypes: true });
|
|
37
|
+
return entries
|
|
38
|
+
.filter((entry) => entry.isDirectory())
|
|
39
|
+
.map((entry) => entry.name);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function getWorkflowFiles(folder) {
|
|
43
|
+
const folderPath = path.join(WORKFLOWS_DIR, folder);
|
|
44
|
+
const entries = await fs.readdir(folderPath, { withFileTypes: true });
|
|
45
|
+
return entries
|
|
46
|
+
.filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
|
|
47
|
+
.map((entry) => entry.name);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function formatFolderName(folder) {
|
|
51
|
+
return folder.charAt(0).toUpperCase() + folder.slice(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function formatWorkflowName(filename) {
|
|
55
|
+
const name = filename.replace(".md", "");
|
|
56
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
57
|
+
}
|
|
58
|
+
|
|
48
59
|
async function findClaudeMdFiles(projectDir) {
|
|
49
60
|
const entries = await fs.readdir(projectDir, { withFileTypes: true });
|
|
50
61
|
return entries
|
|
@@ -76,30 +87,136 @@ async function updateClaudeMd(projectDir) {
|
|
|
76
87
|
}
|
|
77
88
|
}
|
|
78
89
|
|
|
79
|
-
async function
|
|
80
|
-
await fs.mkdir(dest, { recursive: true });
|
|
81
|
-
|
|
90
|
+
async function copyFile(src, dest) {
|
|
91
|
+
await fs.mkdir(path.dirname(dest), { recursive: true });
|
|
92
|
+
await fs.copyFile(src, dest);
|
|
93
|
+
console.log(` Created: ${path.relative(process.cwd(), dest)}`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function runInteractiveSetup() {
|
|
97
|
+
console.log("Claude Orchestration Setup\n");
|
|
98
|
+
|
|
99
|
+
const folders = await getWorkflowFolders();
|
|
100
|
+
const selectedFiles = [];
|
|
101
|
+
|
|
102
|
+
// Step 1: Select workflow folders
|
|
103
|
+
const selectedFolders = await checkbox({
|
|
104
|
+
message: "Select workflow categories:",
|
|
105
|
+
choices: folders.map((folder) => ({
|
|
106
|
+
name: formatFolderName(folder),
|
|
107
|
+
value: folder,
|
|
108
|
+
checked: true,
|
|
109
|
+
})),
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Step 2: For each selected folder, select individual workflows
|
|
113
|
+
for (const folder of selectedFolders) {
|
|
114
|
+
const files = await getWorkflowFiles(folder);
|
|
115
|
+
|
|
116
|
+
const selectedWorkflows = await checkbox({
|
|
117
|
+
message: `Select ${formatFolderName(folder)} workflows:`,
|
|
118
|
+
choices: files.map((file) => ({
|
|
119
|
+
name: formatWorkflowName(file),
|
|
120
|
+
value: file,
|
|
121
|
+
checked: true,
|
|
122
|
+
})),
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
for (const file of selectedWorkflows) {
|
|
126
|
+
selectedFiles.push({ folder, file });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Step 3: Select root-level workflows (like todo.md)
|
|
131
|
+
if (ROOT_WORKFLOWS.length > 0) {
|
|
132
|
+
const selectedRootWorkflows = await checkbox({
|
|
133
|
+
message: "Select additional workflows:",
|
|
134
|
+
choices: ROOT_WORKFLOWS.map((w) => ({
|
|
135
|
+
name: `${w.name} - ${w.description}`,
|
|
136
|
+
value: w.name,
|
|
137
|
+
checked: w.checked,
|
|
138
|
+
})),
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
for (const file of selectedRootWorkflows) {
|
|
142
|
+
selectedFiles.push({ folder: null, file });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (selectedFiles.length === 0) {
|
|
147
|
+
const continueWithOrchestration = await confirm({
|
|
148
|
+
message: "No workflows selected. Install only the orchestration guide?",
|
|
149
|
+
default: true,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
if (!continueWithOrchestration) {
|
|
153
|
+
console.log("Setup cancelled.");
|
|
154
|
+
process.exit(0);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return selectedFiles;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function getAllWorkflows() {
|
|
162
|
+
const folders = await getWorkflowFolders();
|
|
163
|
+
const allFiles = [];
|
|
164
|
+
|
|
165
|
+
for (const folder of folders) {
|
|
166
|
+
const files = await getWorkflowFiles(folder);
|
|
167
|
+
for (const file of files) {
|
|
168
|
+
allFiles.push({ folder, file });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
82
171
|
|
|
83
|
-
for (const
|
|
84
|
-
|
|
85
|
-
|
|
172
|
+
for (const w of ROOT_WORKFLOWS) {
|
|
173
|
+
allFiles.push({ folder: null, file: w.name });
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return allFiles;
|
|
177
|
+
}
|
|
86
178
|
|
|
87
|
-
|
|
88
|
-
|
|
179
|
+
async function copySelectedWorkflows(selectedFiles, targetDir) {
|
|
180
|
+
const workflowsDir = path.join(targetDir, "workflows");
|
|
181
|
+
|
|
182
|
+
for (const { folder, file } of selectedFiles) {
|
|
183
|
+
if (folder) {
|
|
184
|
+
const src = path.join(WORKFLOWS_DIR, folder, file);
|
|
185
|
+
const dest = path.join(workflowsDir, folder, file);
|
|
186
|
+
await copyFile(src, dest);
|
|
89
187
|
} else {
|
|
90
|
-
|
|
91
|
-
|
|
188
|
+
const src = path.join(WORKFLOWS_DIR, file);
|
|
189
|
+
const dest = path.join(workflowsDir, file);
|
|
190
|
+
await copyFile(src, dest);
|
|
92
191
|
}
|
|
93
192
|
}
|
|
94
193
|
}
|
|
95
194
|
|
|
96
|
-
async function main() {
|
|
195
|
+
async function main(options) {
|
|
97
196
|
const targetDir = path.join(process.cwd(), DEST_NAME);
|
|
98
197
|
|
|
99
|
-
console.log("Claude Orchestration Setup\n");
|
|
100
|
-
|
|
101
198
|
try {
|
|
102
|
-
|
|
199
|
+
let selectedFiles;
|
|
200
|
+
|
|
201
|
+
if (options.all) {
|
|
202
|
+
selectedFiles = await getAllWorkflows();
|
|
203
|
+
console.log("Claude Orchestration Setup\n");
|
|
204
|
+
console.log("Installing all workflows...\n");
|
|
205
|
+
} else {
|
|
206
|
+
selectedFiles = await runInteractiveSetup();
|
|
207
|
+
console.log();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
211
|
+
|
|
212
|
+
const orchestrationSrc = path.join(SOURCE_DIR, "orchestration.md");
|
|
213
|
+
const orchestrationDest = path.join(targetDir, "orchestration.md");
|
|
214
|
+
await copyFile(orchestrationSrc, orchestrationDest);
|
|
215
|
+
|
|
216
|
+
if (selectedFiles.length > 0) {
|
|
217
|
+
await copySelectedWorkflows(selectedFiles, targetDir);
|
|
218
|
+
}
|
|
219
|
+
|
|
103
220
|
await updateClaudeMd(process.cwd());
|
|
104
221
|
console.log("\nDone! Orchestration files have been added to .claude/");
|
|
105
222
|
} catch (error) {
|
|
@@ -108,4 +225,13 @@ async function main() {
|
|
|
108
225
|
}
|
|
109
226
|
}
|
|
110
227
|
|
|
111
|
-
|
|
228
|
+
const program = new Command();
|
|
229
|
+
|
|
230
|
+
program
|
|
231
|
+
.name("claude-orchestration")
|
|
232
|
+
.description("Scaffolds Claude orchestration workflows into your project")
|
|
233
|
+
.version(pkg.version)
|
|
234
|
+
.option("-a, --all", "Install all workflows without prompting")
|
|
235
|
+
.action((options) => main(options));
|
|
236
|
+
|
|
237
|
+
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-orchestration",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "CLI tool to scaffold Claude orchestration workflows into your project",
|
|
5
5
|
"bin": {
|
|
6
6
|
"claude-orchestration": "bin/cli.js"
|
|
@@ -26,5 +26,9 @@
|
|
|
26
26
|
],
|
|
27
27
|
"engines": {
|
|
28
28
|
"node": ">=18.0.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"commander": "^13.0.0",
|
|
32
|
+
"@inquirer/prompts": "^7.0.0"
|
|
29
33
|
}
|
|
30
34
|
}
|
|
@@ -1,41 +1,52 @@
|
|
|
1
|
-
# Orchestration
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
# Orchestration Protocol
|
|
2
|
+
|
|
3
|
+
**MANDATORY: Process BEFORE any tool usage.**
|
|
4
|
+
|
|
5
|
+
## 1. CLASSIFY TASK
|
|
6
|
+
|
|
7
|
+
| Signal Words | Workflow |
|
|
8
|
+
|--------------|----------|
|
|
9
|
+
| build, create, add, implement, new | `feature.md` |
|
|
10
|
+
| fix, broken, error, crash, bug | `bugfix.md` |
|
|
11
|
+
| clean up, improve, restructure, rename | `refactor.md` |
|
|
12
|
+
| slow, optimize, performance, speed | `performance.md` |
|
|
13
|
+
| review, check, PR, merge | `review.md` |
|
|
14
|
+
| PR description, pull request title | `pr.md` |
|
|
15
|
+
| document, README, explain | `docs.md` |
|
|
16
|
+
| complex, multi-step, plan | `todo.md` |
|
|
17
|
+
|
|
18
|
+
**Complexity:** 1-2 ops = simple | 3+ ops = complex (add `todo.md`)
|
|
19
|
+
**Technology:** React (`.jsx`/`.tsx`, hooks) → `workflows/react/` | Other → `workflows/`
|
|
20
|
+
|
|
21
|
+
### Selection
|
|
22
|
+
- **Clear match:** Proceed to binding
|
|
23
|
+
- **Ambiguous:** Use `AskUserQuestion` (header: "Workflow", options: relevant workflows)
|
|
24
|
+
- **No match:** Ask user to clarify
|
|
25
|
+
|
|
26
|
+
## 2. BINDING (required before ANY tool use)
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
ORCHESTRATION_BINDING:
|
|
30
|
+
- Task: [description]
|
|
31
|
+
- Workflow: [path]
|
|
32
|
+
- Complexity: [simple/complex]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 3. EXEMPT TASKS
|
|
36
|
+
|
|
37
|
+
Requires ALL: single file, 1-2 ops, zero architecture impact, obvious correctness.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
ORCHESTRATION_BINDING:
|
|
41
|
+
- Task: [description]
|
|
42
|
+
- Classification: EXEMPT
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 4. COMPLETION
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
ORCHESTRATION_COMPLETE:
|
|
49
|
+
- Task: [description]
|
|
50
|
+
- Workflow: [used]
|
|
51
|
+
- Files: [modified]
|
|
52
|
+
```
|
|
@@ -1,50 +1,32 @@
|
|
|
1
1
|
# React Bugfix Workflow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 1. Reproduce
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- Confirm bug exists | find minimal repro
|
|
6
|
+
- Check Strict Mode behavior
|
|
7
|
+
- Answer: Expected vs actual? React 18 concurrent issue?
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
- Can I reproduce the bug?
|
|
9
|
-
- What is expected vs actual behavior?
|
|
10
|
-
- Is this related to React 18 concurrent features?
|
|
9
|
+
## 2. Locate Root Cause
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
| Common React 18 Issues |
|
|
12
|
+
|------------------------|
|
|
13
|
+
| Effects missing cleanup |
|
|
14
|
+
| Stale closures in effects |
|
|
15
|
+
| Concurrent rendering race conditions |
|
|
16
|
+
| Automatic batching changes |
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
- Confirm the bug exists
|
|
16
|
-
- Check if it only occurs in Strict Mode
|
|
17
|
-
- Find minimal reproduction case
|
|
18
|
+
## 3. Fix
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
- Keep changes within affected feature folder
|
|
21
|
+
- Add cleanup: `return () => controller.abort()`
|
|
22
|
+
- Fix stale closures with proper deps
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
- Effects missing cleanup functions
|
|
23
|
-
- Effects with stale closures
|
|
24
|
-
- Race conditions from concurrent rendering
|
|
25
|
-
- Automatic batching behavior changes
|
|
24
|
+
## 4. Verify
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
MUST keep changes within affected feature folder.
|
|
30
|
-
|
|
31
|
-
```tsx
|
|
32
|
-
// Example: Add cleanup for effects
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
const controller = new AbortController()
|
|
35
|
-
fetchData(controller.signal)
|
|
36
|
-
return () => controller.abort()
|
|
37
|
-
}, [])
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### 4. Verify
|
|
41
|
-
- Confirm bug is fixed
|
|
42
|
-
- Test with Strict Mode enabled
|
|
43
|
-
- Add test that would have caught this bug
|
|
26
|
+
- Confirm fix | test with Strict Mode
|
|
27
|
+
- Add regression test
|
|
44
28
|
|
|
45
29
|
## Constraints
|
|
46
30
|
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
- NEVER introduce barrel exports
|
|
50
|
-
- Note other issues separately—don't fix them here
|
|
31
|
+
- Smallest fix only | NO refactoring
|
|
32
|
+
- NO barrel exports | note other issues separately
|
|
@@ -1,55 +1,37 @@
|
|
|
1
1
|
# React Feature Workflow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 1. Architecture
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**IF not specified:** Use `AskUserQuestion` (header: "Architecture")
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
| Architecture | Structure |
|
|
8
|
+
|--------------|-----------|
|
|
9
|
+
| Feature-driven | `features/{name}/components\|hooks\|utils/` |
|
|
10
|
+
| Flat feature-driven | `features/{name}/` flat files |
|
|
11
|
+
| Atomic design | `atoms\|molecules\|organisms\|templates/` |
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
**IF project has patterns:** Follow existing, skip question.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
- Read related existing code
|
|
17
|
-
- Identify the target feature folder
|
|
18
|
-
- Check for similar implementations
|
|
19
|
-
- Review reusable hooks and utilities
|
|
15
|
+
## 2. Context
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- Identify shared vs feature-specific code
|
|
25
|
-
- Design state approach (local, context, or external)
|
|
17
|
+
- Read related code, identify target folder
|
|
18
|
+
- Check similar implementations, reusable hooks/utils
|
|
19
|
+
- Answer: What problem? Minimal version? Which folder?
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
## 3. Implement
|
|
28
22
|
|
|
29
|
-
**Components:**
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
**Components:** Function only | `useState`/`useReducer` for local state
|
|
24
|
+
**Hooks:** Extract logic | `hooks/{feature}/{name}.ts` | descriptive names
|
|
25
|
+
**State:** Lift only as needed | composition over prop drilling
|
|
32
26
|
|
|
33
|
-
|
|
34
|
-
- Extract reusable logic into custom hooks
|
|
35
|
-
- Components handle rendering; hooks handle logic
|
|
36
|
-
- Name descriptively: `useAuthState`, `useFormValidation`
|
|
37
|
-
- Place in `hooks/{feature}/{hookName}.ts`
|
|
27
|
+
## 4. Validate
|
|
38
28
|
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
### 4. Validate
|
|
45
|
-
- Run existing tests for regressions
|
|
46
|
-
- Add tests for new components/hooks
|
|
47
|
-
- Test loading and error states
|
|
48
|
-
- Remove debugging code and unused imports
|
|
29
|
+
- Run tests for regressions
|
|
30
|
+
- Add tests for new code
|
|
31
|
+
- Test loading/error states
|
|
32
|
+
- Remove debug code
|
|
49
33
|
|
|
50
34
|
## Constraints
|
|
51
35
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
- MUST match surrounding code style
|
|
55
|
-
- NEVER add features beyond what was requested
|
|
36
|
+
- NO `index.ts`/`index.tsx` | import from file directly
|
|
37
|
+
- Match existing style | no extra features
|
|
@@ -2,23 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## Process
|
|
4
4
|
|
|
5
|
-
1. Read
|
|
6
|
-
2. Analyze changes
|
|
7
|
-
3. Output
|
|
5
|
+
1. Read diff (current branch vs main/master)
|
|
6
|
+
2. Analyze changes
|
|
7
|
+
3. Output title + description
|
|
8
8
|
|
|
9
|
-
## Output
|
|
9
|
+
## Output
|
|
10
10
|
|
|
11
11
|
```
|
|
12
|
-
PR Title: <
|
|
13
|
-
|
|
14
|
-
Description:
|
|
15
|
-
<2-3 sentences: what changed and why>
|
|
12
|
+
PR Title: <imperative mood>
|
|
13
|
+
Description: <2-3 sentences: what + why>
|
|
16
14
|
```
|
|
17
15
|
|
|
18
16
|
## Constraints
|
|
19
17
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- Keep description focused on "what" and "why"
|
|
23
|
-
- NEVER create branches, push, or create PRs remotely
|
|
24
|
-
- ONLY output the title and description for the user to copy
|
|
18
|
+
- Imperative mood ("Add" not "Added") | mention breaking changes
|
|
19
|
+
- Output only | NO branch/push/remote PR creation
|
|
@@ -1,43 +1,32 @@
|
|
|
1
1
|
# React Refactor Workflow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 1. Safety Net
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- Run tests | add if coverage insufficient
|
|
6
|
+
- Answer: What improvement? How verify unchanged behavior?
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
- What specific improvement am I making?
|
|
9
|
-
- Is there adequate test coverage?
|
|
10
|
-
- How will I verify behavior is unchanged?
|
|
8
|
+
## 2. Plan
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### 1. Ensure Safety Net
|
|
15
|
-
- Run tests to confirm they pass
|
|
16
|
-
- Add tests if coverage is insufficient
|
|
17
|
-
|
|
18
|
-
### 2. Plan
|
|
19
|
-
- Map all imports and dependencies
|
|
20
|
-
- Identify all callers of affected code
|
|
10
|
+
- Map imports/dependencies | identify all callers
|
|
21
11
|
- Break into small, safe steps
|
|
22
12
|
|
|
23
|
-
|
|
13
|
+
## 3. Execute
|
|
24
14
|
|
|
25
|
-
|
|
15
|
+
One change type at a time | run tests after each:
|
|
26
16
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
| Change Types |
|
|
18
|
+
|--------------|
|
|
19
|
+
| Rename files to match folders |
|
|
20
|
+
| Barrel → direct imports |
|
|
21
|
+
| Extract logic into hooks |
|
|
22
|
+
| Split large components |
|
|
31
23
|
|
|
32
|
-
|
|
24
|
+
## 4. Validate
|
|
33
25
|
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
- No `index.ts` or `index.tsx` files remain
|
|
37
|
-
- All entry points match folder names
|
|
26
|
+
- All tests pass | no `index.ts`/`index.tsx`
|
|
27
|
+
- Entry points match folder names
|
|
38
28
|
|
|
39
29
|
## Constraints
|
|
40
30
|
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- MUST keep scope contained: one change type at a time
|
|
31
|
+
- Structure only, NOT behavior | NO bug fixes
|
|
32
|
+
- One change type at a time | note issues separately
|
|
@@ -1,54 +1,46 @@
|
|
|
1
1
|
# React Code Review Workflow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 1. Understand
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- Read PR description | review diff scope
|
|
6
|
+
- Answer: What is the goal? What files changed?
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
- What is this change trying to accomplish?
|
|
9
|
-
- What files are modified?
|
|
8
|
+
## 2. Architecture Checklist
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
| Check | Rule |
|
|
11
|
+
|-------|------|
|
|
12
|
+
| Barrels | No `index.ts`/`index.tsx` |
|
|
13
|
+
| Entry files | Match folder names (`Button/Button.tsx`) |
|
|
14
|
+
| Imports | Direct, not barrel |
|
|
15
|
+
| Colocation | Component + hooks + types + tests together |
|
|
16
|
+
| Placement | Correct feature folder |
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
- Read the PR description
|
|
15
|
-
- Review the diff to understand scope
|
|
16
|
-
- Check if the approach makes sense for the goal
|
|
18
|
+
## 3. React Patterns Checklist
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
| Check | Rule |
|
|
21
|
+
|-------|------|
|
|
22
|
+
| Components | Function only, no class |
|
|
23
|
+
| Hooks | No conditionals, proper deps |
|
|
24
|
+
| Effects | Cleanup where needed |
|
|
25
|
+
| Memory | No leaks (subscriptions, timers) |
|
|
26
|
+
| States | Loading + error handled |
|
|
19
27
|
|
|
20
|
-
|
|
21
|
-
- [ ] Entry files match folder names (`Button/Button.tsx`)
|
|
22
|
-
- [ ] Direct imports used, not barrel imports
|
|
23
|
-
- [ ] Files colocated properly (component, hooks, types, tests together)
|
|
24
|
-
- [ ] New code placed in correct feature folder
|
|
28
|
+
## 4. Code Quality Checklist
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
| Check | Rule |
|
|
31
|
+
|-------|------|
|
|
32
|
+
| Debug | No console.log/debugger |
|
|
33
|
+
| Imports | No unused |
|
|
34
|
+
| Types | No unjustified `any` |
|
|
35
|
+
| Tests | Cover new functionality |
|
|
36
|
+
| Scope | No unrelated changes |
|
|
27
37
|
|
|
28
|
-
|
|
29
|
-
- [ ] Hooks follow rules (no conditional hooks, proper dependencies)
|
|
30
|
-
- [ ] Effects have cleanup where needed
|
|
31
|
-
- [ ] No obvious memory leaks (subscriptions, timers)
|
|
32
|
-
- [ ] Loading and error states handled
|
|
38
|
+
## 5. Feedback
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- [ ] No debugging code left in (console.log, debugger)
|
|
37
|
-
- [ ] No unused imports or variables
|
|
38
|
-
- [ ] Types are accurate (no `any` without justification)
|
|
39
|
-
- [ ] Tests cover new functionality
|
|
40
|
-
- [ ] No unrelated changes mixed in
|
|
41
|
-
|
|
42
|
-
### 5. Provide Feedback
|
|
43
|
-
|
|
44
|
-
Categorize comments:
|
|
45
|
-
- **Blocking**: Must fix before merge (bugs, architecture violations)
|
|
46
|
-
- **Suggestion**: Improvements to consider
|
|
47
|
-
- **Question**: Clarification needed
|
|
40
|
+
- **Blocking:** Must fix (bugs, architecture violations)
|
|
41
|
+
- **Suggestion:** Improvements | **Question:** Clarification
|
|
48
42
|
|
|
49
43
|
## Constraints
|
|
50
44
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
- Keep feedback specific and actionable
|
|
54
|
-
- Suggest fixes, not just problems
|
|
45
|
+
- NO approval with violations | must understand code
|
|
46
|
+
- Specific + actionable | suggest fixes, not just problems
|