@cliangdev/flux-plugin 0.2.0-dev.dc5e2c4 → 0.2.0-dev.f718bcf
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 +3 -3
- package/agents/coder.md +150 -25
- package/commands/breakdown.md +47 -10
- package/commands/flux.md +92 -12
- package/commands/implement.md +166 -17
- package/commands/linear.md +6 -5
- package/commands/prd.md +996 -82
- package/manifest.json +2 -1
- package/package.json +4 -2
- package/skills/flux-orchestrator/SKILL.md +11 -3
- package/skills/prd-writer/SKILL.md +761 -0
- package/skills/ux-ui-design/SKILL.md +346 -0
- package/skills/ux-ui-design/references/design-tokens.md +359 -0
- package/src/dashboard/__tests__/api.test.ts +211 -0
- package/src/dashboard/browser.ts +35 -0
- package/src/dashboard/public/app.js +869 -0
- package/src/dashboard/public/index.html +90 -0
- package/src/dashboard/public/styles.css +807 -0
- package/src/dashboard/public/vendor/highlight.css +10 -0
- package/src/dashboard/public/vendor/highlight.min.js +8422 -0
- package/src/dashboard/public/vendor/marked.min.js +2210 -0
- package/src/dashboard/server.ts +296 -0
- package/src/dashboard/watchers.ts +83 -0
- package/src/server/adapters/__tests__/dependency-ops.test.ts +52 -18
- package/src/server/adapters/linear/adapter.ts +19 -14
- package/src/server/adapters/local-adapter.ts +48 -7
- package/src/server/db/__tests__/queries.test.ts +2 -1
- package/src/server/db/schema.ts +9 -0
- package/src/server/index.ts +0 -2
- package/src/server/tools/__tests__/crud.test.ts +111 -1
- package/src/server/tools/__tests__/mcp-interface.test.ts +100 -9
- package/src/server/tools/__tests__/query.test.ts +73 -21
- package/src/server/tools/__tests__/z-configure-linear.test.ts +1 -1
- package/src/server/tools/__tests__/z-get-linear-url.test.ts +1 -1
- package/src/server/tools/create-epic.ts +11 -2
- package/src/server/tools/create-prd.ts +11 -2
- package/src/server/tools/create-task.ts +11 -2
- package/src/server/tools/dependencies.ts +2 -2
- package/src/server/tools/get-entity.ts +12 -10
- package/src/server/tools/index.ts +53 -9
- package/src/server/tools/init-project.ts +1 -1
- package/src/server/tools/render-status.ts +38 -20
- package/src/status-line/__tests__/status-line.test.ts +1 -1
- package/src/utils/status-renderer.ts +32 -6
- package/skills/prd-template/SKILL.md +0 -242
- package/src/server/tools/get-project-context.ts +0 -33
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ The installer automatically:
|
|
|
36
36
|
| Command | Purpose |
|
|
37
37
|
|---------|---------|
|
|
38
38
|
| `/flux` | Smart entry point - shows status and guides you to the next step |
|
|
39
|
-
| `/flux:prd` | Create
|
|
39
|
+
| `/flux:prd` | Create PRDs through discovery, research, and guided writing |
|
|
40
40
|
| `/flux:breakdown` | Break PRDs into epics and tasks with acceptance criteria |
|
|
41
41
|
| `/flux:implement` | Implement tasks with TDD workflow |
|
|
42
42
|
|
|
@@ -143,7 +143,7 @@ Check your current version:
|
|
|
143
143
|
|
|
144
144
|
```bash
|
|
145
145
|
rm -rf ~/.claude/commands/flux.md ~/.claude/commands/flux
|
|
146
|
-
rm -rf ~/.claude/skills/agent-creator ~/.claude/skills/epic-template ~/.claude/skills/flux-orchestrator ~/.claude/skills/prd-
|
|
146
|
+
rm -rf ~/.claude/skills/agent-creator ~/.claude/skills/epic-template ~/.claude/skills/flux-orchestrator ~/.claude/skills/prd-writer
|
|
147
147
|
rm -f ~/.claude/flux-version
|
|
148
148
|
# Edit ~/.claude.json and remove the "flux" entry from "mcpServers"
|
|
149
149
|
```
|
|
@@ -152,7 +152,7 @@ rm -f ~/.claude/flux-version
|
|
|
152
152
|
|
|
153
153
|
```bash
|
|
154
154
|
rm -rf .claude/commands/flux.md .claude/commands/flux
|
|
155
|
-
rm -rf .claude/skills/agent-creator .claude/skills/epic-template .claude/skills/flux-orchestrator .claude/skills/prd-
|
|
155
|
+
rm -rf .claude/skills/agent-creator .claude/skills/epic-template .claude/skills/flux-orchestrator .claude/skills/prd-writer
|
|
156
156
|
rm -f .claude/flux-version
|
|
157
157
|
# Edit .claude.json and remove the "flux" entry from "mcpServers"
|
|
158
158
|
```
|
package/agents/coder.md
CHANGED
|
@@ -20,30 +20,41 @@ You receive only:
|
|
|
20
20
|
|
|
21
21
|
This keeps your context clean for high-quality code output.
|
|
22
22
|
|
|
23
|
-
## Step 1:
|
|
23
|
+
## Step 1: Apply Project Skill
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
The orchestrator should provide a **Project Skill** section in your prompt with patterns to follow. If provided, strictly follow those patterns for:
|
|
26
|
+
- Code structure and organization
|
|
27
|
+
- Error handling conventions
|
|
28
|
+
- Testing patterns
|
|
29
|
+
- Naming conventions
|
|
30
|
+
|
|
31
|
+
### Fallback: Discover Skill Yourself
|
|
32
|
+
|
|
33
|
+
If no skill was provided in your prompt, discover and load it:
|
|
26
34
|
|
|
27
35
|
```bash
|
|
28
|
-
#
|
|
36
|
+
# 1. Detect project type
|
|
29
37
|
ls -la | head -20
|
|
38
|
+
|
|
39
|
+
# 2. Check for matching skill in .claude/skills/
|
|
40
|
+
ls .claude/skills/ 2>/dev/null
|
|
30
41
|
```
|
|
31
42
|
|
|
32
|
-
| File Found | Project Type | Skill
|
|
33
|
-
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `package.json` +
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `requirements.txt` / `pyproject.toml` | Python | Python idioms |
|
|
43
|
+
| File Found | Project Type | Skill Search Pattern |
|
|
44
|
+
|------------|--------------|---------------------|
|
|
45
|
+
| `go.mod` | Go | `golang*`, `go-*` |
|
|
46
|
+
| `tsconfig.json` | TypeScript | `typescript*`, `ts-*` |
|
|
47
|
+
| `pom.xml` / `build.gradle` | Java/Spring | `java*`, `spring*` |
|
|
48
|
+
| `package.json` + react | React | `react*`, `ui-*` |
|
|
49
|
+
| `Cargo.toml` | Rust | `rust*` |
|
|
50
|
+
| `requirements.txt` | Python | `python*`, `py-*` |
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
```bash
|
|
53
|
+
# 3. Read matching skill
|
|
54
|
+
cat .claude/skills/{matched-skill}/SKILL.md
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Apply the loaded skill patterns** - if no matching skill exists, use general best practices for that language.
|
|
47
58
|
|
|
48
59
|
## Step 2: Understand the Task
|
|
49
60
|
|
|
@@ -61,10 +72,11 @@ Acceptance Criteria:
|
|
|
61
72
|
|
|
62
73
|
## Step 3: Write Tests First (TDD)
|
|
63
74
|
|
|
75
|
+
### 3.1 Tests for Acceptance Criteria
|
|
76
|
+
|
|
64
77
|
For each `[auto]` criterion, write a failing test:
|
|
65
78
|
|
|
66
79
|
```typescript
|
|
67
|
-
// Example for TypeScript
|
|
68
80
|
describe('Login API', () => {
|
|
69
81
|
it('returns 401 for invalid credentials', async () => {
|
|
70
82
|
const response = await api.post('/login', {
|
|
@@ -82,6 +94,34 @@ describe('Login API', () => {
|
|
|
82
94
|
});
|
|
83
95
|
```
|
|
84
96
|
|
|
97
|
+
### 3.2 Tests for Critical Components
|
|
98
|
+
|
|
99
|
+
Beyond acceptance criteria, also test:
|
|
100
|
+
|
|
101
|
+
- **Core business logic**: Functions that make important decisions
|
|
102
|
+
- **Data transformations**: Parsing, validation, mapping functions
|
|
103
|
+
- **Error paths**: Edge cases and failure scenarios
|
|
104
|
+
- **Integration points**: API handlers, database operations
|
|
105
|
+
- **Utilities used in multiple places**: Shared helpers and utils
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
describe('SessionManager', () => {
|
|
109
|
+
it('expires sessions after TTL', async () => {
|
|
110
|
+
const session = await sessionManager.create(userId);
|
|
111
|
+
await advanceTime(SESSION_TTL + 1000);
|
|
112
|
+
expect(await sessionManager.isValid(session.id)).toBe(false);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('handles concurrent session creation', async () => {
|
|
116
|
+
const results = await Promise.all([
|
|
117
|
+
sessionManager.create(userId),
|
|
118
|
+
sessionManager.create(userId),
|
|
119
|
+
]);
|
|
120
|
+
expect(results[0].id).not.toBe(results[1].id);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
85
125
|
Run tests to confirm they fail:
|
|
86
126
|
```bash
|
|
87
127
|
bun test login.test.ts
|
|
@@ -103,6 +143,81 @@ Write minimal code to make tests pass:
|
|
|
103
143
|
bun test
|
|
104
144
|
```
|
|
105
145
|
|
|
146
|
+
## Code Quality Standards
|
|
147
|
+
|
|
148
|
+
### Write Clean, Modular, Testable Code
|
|
149
|
+
|
|
150
|
+
**Modularity**
|
|
151
|
+
- Small, focused functions that do one thing well
|
|
152
|
+
- Clear separation of concerns (business logic vs I/O vs presentation)
|
|
153
|
+
- Dependencies injected, not hardcoded - makes testing easy
|
|
154
|
+
- Extract reusable logic into well-named helper functions
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
// ✅ Good: Modular, testable
|
|
158
|
+
function validateCredentials(email: string, password: string): ValidationResult {
|
|
159
|
+
if (!isValidEmail(email)) return { valid: false, error: 'Invalid email' };
|
|
160
|
+
if (password.length < 8) return { valid: false, error: 'Password too short' };
|
|
161
|
+
return { valid: true };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function login(credentials: Credentials, userRepo: UserRepository) {
|
|
165
|
+
const validation = validateCredentials(credentials.email, credentials.password);
|
|
166
|
+
if (!validation.valid) throw new ValidationError(validation.error);
|
|
167
|
+
return userRepo.findByEmail(credentials.email);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// ❌ Bad: Monolithic, hard to test
|
|
171
|
+
async function login(email: string, password: string) {
|
|
172
|
+
// validation mixed with business logic mixed with database calls
|
|
173
|
+
const db = getDatabase();
|
|
174
|
+
if (!email.includes('@')) throw new Error('bad email');
|
|
175
|
+
const user = await db.query('SELECT * FROM users WHERE email = ?', [email]);
|
|
176
|
+
// ... more mixed concerns
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Testability**
|
|
181
|
+
- Pure functions where possible (same input → same output)
|
|
182
|
+
- Side effects isolated and explicit
|
|
183
|
+
- Avoid global state
|
|
184
|
+
- Use interfaces/types for dependencies
|
|
185
|
+
|
|
186
|
+
### No Unnecessary Comments
|
|
187
|
+
|
|
188
|
+
Let code be self-documenting. Comments should explain **why**, not **what**.
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
// ❌ Bad: Comments that restate the code
|
|
192
|
+
// Check if user is admin
|
|
193
|
+
if (user.role === 'admin') {
|
|
194
|
+
// Grant admin access
|
|
195
|
+
grantAdminAccess(user);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ✅ Good: Code explains itself
|
|
199
|
+
if (user.role === 'admin') {
|
|
200
|
+
grantAdminAccess(user);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// ✅ Good: Comment explains non-obvious "why"
|
|
204
|
+
// Rate limit bypass for internal services to prevent cascade failures
|
|
205
|
+
if (request.source === 'internal') {
|
|
206
|
+
skipRateLimit = true;
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**When to comment:**
|
|
211
|
+
- Non-obvious business rules or edge cases
|
|
212
|
+
- Workarounds for external bugs/limitations
|
|
213
|
+
- Performance optimizations that sacrifice readability
|
|
214
|
+
- Public API documentation (JSDoc for library interfaces)
|
|
215
|
+
|
|
216
|
+
**Never comment:**
|
|
217
|
+
- What the code does (let naming convey this)
|
|
218
|
+
- Obvious operations
|
|
219
|
+
- Commented-out code (delete it, git has history)
|
|
220
|
+
|
|
106
221
|
## Step 5: Handle Manual Criteria
|
|
107
222
|
|
|
108
223
|
For `[manual]` criteria, add a comment or doc noting verification steps:
|
|
@@ -174,13 +289,23 @@ Needs:
|
|
|
174
289
|
|
|
175
290
|
## Boundaries
|
|
176
291
|
|
|
177
|
-
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
292
|
+
**DO:**
|
|
293
|
+
- Focus only on the assigned task
|
|
294
|
+
- Apply project skill patterns from your prompt (or discover them from `.claude/skills/`)
|
|
295
|
+
- Write tests before implementation
|
|
296
|
+
- Test critical components beyond just acceptance criteria
|
|
297
|
+
- Write clean, modular, testable code
|
|
298
|
+
- Use clear naming that makes code self-documenting
|
|
299
|
+
|
|
300
|
+
**DON'T:**
|
|
301
|
+
- Ignore provided skill patterns - they contain project-specific conventions
|
|
302
|
+
- Refactor unrelated code
|
|
303
|
+
- Add features not in acceptance criteria
|
|
304
|
+
- Skip tests for `[auto]` criteria
|
|
305
|
+
- Make commits without running tests
|
|
306
|
+
- Add comments that restate what code does
|
|
307
|
+
- Add unnecessary JSDoc/docstrings for simple functions
|
|
308
|
+
- Leave commented-out code
|
|
184
309
|
|
|
185
310
|
## Context Escalation
|
|
186
311
|
|
package/commands/breakdown.md
CHANGED
|
@@ -16,12 +16,26 @@ Check if arguments were provided:
|
|
|
16
16
|
|
|
17
17
|
## Pre-checks
|
|
18
18
|
|
|
19
|
-
1.
|
|
20
|
-
- If
|
|
19
|
+
1. If no ref provided, call `query_entities` with type=prd, status=APPROVED
|
|
20
|
+
- If error with `code: "PROJECT_NOT_INITIALIZED"`, tell user: "Run `/flux` first to initialize the project." and exit.
|
|
21
21
|
|
|
22
|
-
2. If
|
|
22
|
+
2. If query successful but no approved PRDs found:
|
|
23
23
|
- If no approved PRDs, tell user: "No approved PRDs found. Approve a PRD first or run `/flux:prd` to create one."
|
|
24
|
-
- If multiple approved PRDs, use AskUserQuestion to let user select
|
|
24
|
+
- If multiple approved PRDs, use AskUserQuestion to let user select:
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"questions": [{
|
|
28
|
+
"question": "Which PRD would you like to break down?",
|
|
29
|
+
"header": "Select PRD",
|
|
30
|
+
"options": [
|
|
31
|
+
{"label": "{PRD-1 title}", "description": "{ref} - {brief description}"},
|
|
32
|
+
{"label": "{PRD-2 title}", "description": "{ref} - {brief description}"}
|
|
33
|
+
],
|
|
34
|
+
"multiSelect": false
|
|
35
|
+
}]
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
Note: Dynamically populate options from the query results.
|
|
25
39
|
|
|
26
40
|
3. If ref provided, call `get_entity` with the ref
|
|
27
41
|
- Verify status is APPROVED
|
|
@@ -78,9 +92,21 @@ Which approach do you prefer?
|
|
|
78
92
|
|
|
79
93
|
1. Get PRD entity with `get_entity` including `include: ['epics']`
|
|
80
94
|
2. Read full PRD content from `folder_path + '/prd.md'` using Read tool
|
|
81
|
-
3. If PRD already has epics, inform user:
|
|
82
|
-
|
|
83
|
-
|
|
95
|
+
3. If PRD already has epics, inform user and use AskUserQuestion:
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"questions": [{
|
|
99
|
+
"question": "This PRD already has {count} epics. What would you like to do?",
|
|
100
|
+
"header": "Epics",
|
|
101
|
+
"options": [
|
|
102
|
+
{"label": "Add more epics", "description": "Keep existing epics and add new ones"},
|
|
103
|
+
{"label": "View existing", "description": "See current epic structure before deciding"},
|
|
104
|
+
{"label": "Start fresh", "description": "Delete existing epics and recreate from scratch"}
|
|
105
|
+
],
|
|
106
|
+
"multiSelect": false
|
|
107
|
+
}]
|
|
108
|
+
}
|
|
109
|
+
```
|
|
84
110
|
|
|
85
111
|
### Step 2: Analyze & Identify Epics
|
|
86
112
|
|
|
@@ -142,9 +168,20 @@ Ready to create these epics?
|
|
|
142
168
|
```
|
|
143
169
|
|
|
144
170
|
Use AskUserQuestion only when uncertain:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"questions": [{
|
|
174
|
+
"question": "Ready to create these epics?",
|
|
175
|
+
"header": "Confirm",
|
|
176
|
+
"options": [
|
|
177
|
+
{"label": "Create all epics (Recommended)", "description": "Proceed with the proposed structure"},
|
|
178
|
+
{"label": "Modify structure first", "description": "Adjust epic boundaries or dependencies"},
|
|
179
|
+
{"label": "Add/remove epics", "description": "Change the number of epics"}
|
|
180
|
+
],
|
|
181
|
+
"multiSelect": false
|
|
182
|
+
}]
|
|
183
|
+
}
|
|
184
|
+
```
|
|
148
185
|
|
|
149
186
|
### Step 4: Create Epics
|
|
150
187
|
|
package/commands/flux.md
CHANGED
|
@@ -6,27 +6,78 @@ allowed-tools: mcp__plugin_flux_flux__*, AskUserQuestion, Read, Write
|
|
|
6
6
|
|
|
7
7
|
# Flux Command
|
|
8
8
|
|
|
9
|
-
You are the Flux orchestrator
|
|
9
|
+
You are the Flux orchestrator - the main entry point for all Flux operations. Your job is to:
|
|
10
|
+
1. Detect project state and guide users to the appropriate next action
|
|
11
|
+
2. Route to specialized commands based on user input
|
|
12
|
+
3. Provide intelligent suggestions based on workflow state
|
|
13
|
+
|
|
14
|
+
## Available Commands
|
|
15
|
+
|
|
16
|
+
| Command | Description |
|
|
17
|
+
|---------|-------------|
|
|
18
|
+
| `/flux` | Show project status and suggest next action |
|
|
19
|
+
| `/flux:prd` | Create or refine PRDs through guided interview |
|
|
20
|
+
| `/flux:breakdown` | Break approved PRD into dependency-ordered epics and tasks |
|
|
21
|
+
| `/flux:implement` | Implement tasks with TDD workflow using specialized coding agents |
|
|
22
|
+
| `/flux:linear` | Connect Flux project to Linear for issue tracking |
|
|
23
|
+
|
|
24
|
+
## Subcommand Routing
|
|
25
|
+
|
|
26
|
+
When user provides arguments, route to the appropriate command:
|
|
27
|
+
|
|
28
|
+
| User Input | Action |
|
|
29
|
+
|------------|--------|
|
|
30
|
+
| `/flux` | Show status (see Main Flow) |
|
|
31
|
+
| `/flux version` | Call `get_version` and display result |
|
|
32
|
+
| `/flux status` | Call `render_status` with `{view: "full"}` |
|
|
33
|
+
| `/flux prd` or `/flux prd ...` | Delegate to `/flux:prd` with any additional args |
|
|
34
|
+
| `/flux breakdown` or `/flux breakdown ...` | Delegate to `/flux:breakdown` with any additional args |
|
|
35
|
+
| `/flux implement` or `/flux implement ...` | Delegate to `/flux:implement` with any additional args |
|
|
36
|
+
| `/flux linear` | Delegate to `/flux:linear` |
|
|
37
|
+
| `/flux help` | Show available commands and their purposes |
|
|
38
|
+
|
|
39
|
+
## Available MCP Tools
|
|
40
|
+
|
|
41
|
+
These tools are available for programmatic access:
|
|
42
|
+
|
|
43
|
+
**Entity Management:**
|
|
44
|
+
- `create_prd`, `create_epic`, `create_task` - Create entities
|
|
45
|
+
- `update_entity`, `update_status`, `delete_entity` - Modify entities
|
|
46
|
+
- `get_entity`, `query_entities` - Retrieve entities
|
|
47
|
+
|
|
48
|
+
**Project:**
|
|
49
|
+
- `init_project` - Initialize new Flux project
|
|
50
|
+
- `get_stats` - Get entity counts by status
|
|
51
|
+
- `get_version` - Get plugin version
|
|
52
|
+
- `render_status` - Visual project status with progress bars
|
|
53
|
+
|
|
54
|
+
**Relationships:**
|
|
55
|
+
- `add_dependency`, `remove_dependency` - Task/epic dependencies
|
|
56
|
+
- `add_criteria`, `mark_criteria_met` - Acceptance criteria
|
|
57
|
+
|
|
58
|
+
**Integration:**
|
|
59
|
+
- `configure_linear` - Connect to Linear (interactive mode supported)
|
|
10
60
|
|
|
11
|
-
##
|
|
61
|
+
## Main Flow
|
|
12
62
|
|
|
13
|
-
|
|
14
|
-
- `/flux linear` - Connect to Linear (delegate to `/flux:linear`)
|
|
63
|
+
### Step 0: Check for Subcommands
|
|
15
64
|
|
|
16
|
-
|
|
65
|
+
First, check if the user provided arguments (e.g., `/flux prd`, `/flux implement FP-T1`).
|
|
66
|
+
If so, route to the appropriate command as described in Subcommand Routing above.
|
|
17
67
|
|
|
18
|
-
### Step 1:
|
|
68
|
+
### Step 1: Check Project State
|
|
19
69
|
|
|
20
|
-
|
|
70
|
+
If no subcommand, call `render_status` with `{view: "summary"}` to show current state.
|
|
21
71
|
|
|
22
|
-
### Step 2: Route Based on
|
|
72
|
+
### Step 2: Route Based on Response
|
|
23
73
|
|
|
24
|
-
**If `
|
|
74
|
+
**If error with `code: "PROJECT_NOT_INITIALIZED"`:**
|
|
25
75
|
→ Guide through initialization (see Initialization Flow below)
|
|
26
76
|
|
|
27
|
-
**If
|
|
28
|
-
→
|
|
29
|
-
→
|
|
77
|
+
**If success:**
|
|
78
|
+
→ Display the rendered status
|
|
79
|
+
→ Analyze workflow state and suggest the most appropriate next action (see Workflow States)
|
|
80
|
+
→ If multiple actions are possible, use AskUserQuestion to let user choose
|
|
30
81
|
|
|
31
82
|
## Initialization Flow
|
|
32
83
|
|
|
@@ -148,9 +199,38 @@ When determining actions:
|
|
|
148
199
|
| 50-80% | Suggest action, wait for confirmation |
|
|
149
200
|
| < 50% | Ask clarifying question |
|
|
150
201
|
|
|
202
|
+
## Help Output
|
|
203
|
+
|
|
204
|
+
When user runs `/flux help`, display:
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
Flux - AI-first workflow orchestration
|
|
208
|
+
|
|
209
|
+
Commands:
|
|
210
|
+
/flux Show project status and next action
|
|
211
|
+
/flux:prd Create or refine PRDs
|
|
212
|
+
/flux:breakdown Break PRD into epics and tasks
|
|
213
|
+
/flux:implement Implement tasks with TDD
|
|
214
|
+
/flux:linear Connect to Linear
|
|
215
|
+
|
|
216
|
+
Shortcuts:
|
|
217
|
+
/flux prd Same as /flux:prd
|
|
218
|
+
/flux breakdown Same as /flux:breakdown
|
|
219
|
+
/flux implement Same as /flux:implement
|
|
220
|
+
/flux status Show detailed project status
|
|
221
|
+
/flux version Show plugin version
|
|
222
|
+
|
|
223
|
+
Workflow:
|
|
224
|
+
1. /flux Initialize project (first time)
|
|
225
|
+
2. /flux:prd Create your first PRD
|
|
226
|
+
3. /flux:breakdown Break PRD into tasks
|
|
227
|
+
4. /flux:implement Start coding with TDD
|
|
228
|
+
```
|
|
229
|
+
|
|
151
230
|
## Guidelines
|
|
152
231
|
|
|
153
232
|
- Use `AskUserQuestion` tool for all user choices during initialization
|
|
154
233
|
- Be concise - show status and one clear next action
|
|
155
234
|
- Use `render_status` for visual project overview
|
|
156
235
|
- Apply confidence-based autonomy for decisions
|
|
236
|
+
- When user input matches a subcommand pattern, delegate immediately without calling render_status first
|
package/commands/implement.md
CHANGED
|
@@ -53,8 +53,7 @@ The orchestrator resolves all refs to tasks, builds a dependency-ordered queue,
|
|
|
53
53
|
|
|
54
54
|
## Pre-checks
|
|
55
55
|
|
|
56
|
-
1.
|
|
57
|
-
2. Parse arguments and resolve to tasks:
|
|
56
|
+
1. Parse arguments and resolve to tasks (if any tool returns `PROJECT_NOT_INITIALIZED` error, tell user: "Run `/flux` first to initialize the project." and exit):
|
|
58
57
|
- No args: Query for next PENDING task with no blockers
|
|
59
58
|
- PRD ref(s): Expand to all epics → all tasks
|
|
60
59
|
- Epic ref(s): Expand to all tasks
|
|
@@ -62,8 +61,100 @@ The orchestrator resolves all refs to tasks, builds a dependency-ordered queue,
|
|
|
62
61
|
- Mixed refs: Resolve each, deduplicate, merge
|
|
63
62
|
- `tag:{name}`: Query PRDs by tag → expand all
|
|
64
63
|
|
|
64
|
+
2. Git state check (REQUIRED before any implementation):
|
|
65
|
+
- Run `git status` to check for uncommitted changes
|
|
66
|
+
- If dirty working tree: Ask user whether to commit, stash, or abort
|
|
67
|
+
- Never proceed with uncommitted changes
|
|
68
|
+
|
|
65
69
|
## Workflow
|
|
66
70
|
|
|
71
|
+
### Step 0: Git Branch Setup
|
|
72
|
+
|
|
73
|
+
**Always start from latest main with a fresh branch.** This ensures clean PRs and avoids merge conflicts.
|
|
74
|
+
|
|
75
|
+
#### 0.1 Ensure Clean State
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Check for uncommitted changes
|
|
79
|
+
git status --porcelain
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If output is non-empty, use AskUserQuestion:
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"questions": [{
|
|
86
|
+
"question": "You have uncommitted changes. How would you like to proceed?",
|
|
87
|
+
"header": "Git Status",
|
|
88
|
+
"options": [
|
|
89
|
+
{"label": "Commit them first", "description": "Stage and commit current changes before starting"},
|
|
90
|
+
{"label": "Stash them", "description": "Stash changes temporarily, restore after implementation"},
|
|
91
|
+
{"label": "Abort implementation", "description": "Stop here and handle changes manually"}
|
|
92
|
+
],
|
|
93
|
+
"multiSelect": false
|
|
94
|
+
}]
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### 0.2 Create Feature Branch from Latest Main
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Fetch latest and create branch
|
|
102
|
+
git fetch origin main
|
|
103
|
+
git checkout -b {branch-name} origin/main
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### 0.3 Branch Naming Convention
|
|
107
|
+
|
|
108
|
+
| Scope | Branch Name | Example |
|
|
109
|
+
|-------|-------------|---------|
|
|
110
|
+
| `tag:xxx` | `feat/tag-{tag}` | `feat/tag-phase-3` |
|
|
111
|
+
| Single PRD | `feat/{prd-ref}` | `feat/FLUX-P3` |
|
|
112
|
+
| Multiple PRDs | `feat/{first-prd-ref}` | `feat/FLUX-P3` |
|
|
113
|
+
| Single Epic | `feat/{epic-ref}` | `feat/FLUX-E14` |
|
|
114
|
+
| Multiple Epics | `feat/{first-epic-ref}` | `feat/FLUX-E14` |
|
|
115
|
+
| Single Task | `feat/{task-ref}` | `feat/FLUX-T31` |
|
|
116
|
+
| Multiple Tasks | `feat/{first-task-ref}` | `feat/FLUX-T31` |
|
|
117
|
+
| No args (next task) | `feat/{task-ref}` | `feat/FLUX-T42` |
|
|
118
|
+
| Mixed refs | `feat/{highest-level-ref}` | `feat/FLUX-P3` (PRD > Epic > Task) |
|
|
119
|
+
|
|
120
|
+
**Priority for mixed refs**: Use the highest-level entity (PRD > Epic > Task). If multiple of the same level, use the first one alphabetically.
|
|
121
|
+
|
|
122
|
+
#### 0.4 Handle Existing Branch
|
|
123
|
+
|
|
124
|
+
If the branch already exists:
|
|
125
|
+
```bash
|
|
126
|
+
# Check if branch exists
|
|
127
|
+
git rev-parse --verify feat/FLUX-P3 2>/dev/null
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
If branch exists, use AskUserQuestion:
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"questions": [{
|
|
134
|
+
"question": "Branch 'feat/FLUX-P3' already exists. What would you like to do?",
|
|
135
|
+
"header": "Branch",
|
|
136
|
+
"options": [
|
|
137
|
+
{"label": "Continue on existing (Recommended)", "description": "Resume work on the existing branch"},
|
|
138
|
+
{"label": "Delete and recreate", "description": "Start fresh from latest main"},
|
|
139
|
+
{"label": "Use different name", "description": "Create a new branch with a different name"}
|
|
140
|
+
],
|
|
141
|
+
"multiSelect": false
|
|
142
|
+
}]
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Example Output
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
Git Setup:
|
|
150
|
+
✓ Working tree clean
|
|
151
|
+
✓ Fetched origin/main
|
|
152
|
+
✓ Created branch: feat/tag-phase-3
|
|
153
|
+
└── Based on: origin/main (abc1234)
|
|
154
|
+
|
|
155
|
+
Ready to implement 3 PRDs (tag: phase-3)
|
|
156
|
+
```
|
|
157
|
+
|
|
67
158
|
### Step 1: Gather Context
|
|
68
159
|
|
|
69
160
|
Resolve all refs to a unified task list:
|
|
@@ -185,31 +276,87 @@ When spawning a coding subagent, provide this context:
|
|
|
185
276
|
- Epic: {epic.ref} - {epic.title}
|
|
186
277
|
- PRD: {prd.ref} (read if more context needed)
|
|
187
278
|
|
|
279
|
+
## Project Skill (APPLY THESE PATTERNS)
|
|
280
|
+
{skillContent || "No project-specific skill found. Use general best practices for this language."}
|
|
281
|
+
|
|
188
282
|
## Workflow
|
|
189
|
-
1.
|
|
283
|
+
1. Apply the project skill patterns above (if provided)
|
|
190
284
|
2. Write tests for each [auto] criterion FIRST
|
|
191
|
-
3.
|
|
192
|
-
4.
|
|
193
|
-
5.
|
|
194
|
-
6.
|
|
285
|
+
3. Write tests for critical components (business logic, data transformations, error paths)
|
|
286
|
+
4. Implement until all tests pass
|
|
287
|
+
5. For [manual] criteria, document verification steps
|
|
288
|
+
6. Commit with message: "{task.ref}: {brief description}"
|
|
289
|
+
7. Report back: COMPLETED or BLOCKED (with reason)
|
|
290
|
+
|
|
291
|
+
## Code Quality Requirements
|
|
292
|
+
- Write clean, modular, testable code
|
|
293
|
+
- Small focused functions with clear separation of concerns
|
|
294
|
+
- Inject dependencies for testability
|
|
295
|
+
- NO unnecessary comments - let code be self-documenting
|
|
296
|
+
- Comments only for non-obvious "why", never for "what"
|
|
297
|
+
- No commented-out code
|
|
195
298
|
|
|
196
299
|
## Files to Focus On
|
|
197
300
|
{relevantFiles}
|
|
198
301
|
```
|
|
199
302
|
|
|
200
|
-
|
|
303
|
+
**Note:** The orchestrator MUST discover and include skill content before spawning. See "Skill Discovery & Application" section above.
|
|
304
|
+
|
|
305
|
+
## Skill Discovery & Application
|
|
306
|
+
|
|
307
|
+
Before spawning a coding subagent, discover and load relevant project skills.
|
|
308
|
+
|
|
309
|
+
### Step 1: Detect Project Type
|
|
310
|
+
|
|
311
|
+
Check for project indicator files:
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
ls -la | head -20
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
| File Found | Project Type |
|
|
318
|
+
|------------|--------------|
|
|
319
|
+
| `go.mod` | Go |
|
|
320
|
+
| `tsconfig.json` | TypeScript |
|
|
321
|
+
| `pom.xml` / `build.gradle` | Java/Spring |
|
|
322
|
+
| `package.json` + react | React |
|
|
323
|
+
| `Cargo.toml` | Rust |
|
|
324
|
+
| `requirements.txt` / `pyproject.toml` | Python |
|
|
325
|
+
|
|
326
|
+
### Step 2: Search for Matching Skills
|
|
327
|
+
|
|
328
|
+
Check `.claude/skills/` for project-specific skills:
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
# List available skills
|
|
332
|
+
ls .claude/skills/ 2>/dev/null || echo "No skills directory"
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**Skill matching patterns:**
|
|
336
|
+
|
|
337
|
+
| Project Type | Skill Search Patterns |
|
|
338
|
+
|--------------|----------------------|
|
|
339
|
+
| Go | `golang*`, `go-*`, `go_*` |
|
|
340
|
+
| TypeScript | `typescript*`, `ts-*`, `ts_*` |
|
|
341
|
+
| Java/Spring | `java*`, `spring*`, `springboot*` |
|
|
342
|
+
| React | `react*`, `ui-*`, `frontend*` |
|
|
343
|
+
| Rust | `rust*` |
|
|
344
|
+
| Python | `python*`, `py-*` |
|
|
345
|
+
|
|
346
|
+
### Step 3: Load Skill Content
|
|
347
|
+
|
|
348
|
+
If a matching skill is found, read its content:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
# Read skill content
|
|
352
|
+
cat .claude/skills/{skill-name}/SKILL.md
|
|
353
|
+
```
|
|
201
354
|
|
|
202
|
-
|
|
355
|
+
### Step 4: Pass Skill to Subagent
|
|
203
356
|
|
|
204
|
-
|
|
205
|
-
|-----------|-------|------------------|
|
|
206
|
-
| `pom.xml` | `springboot-patterns` | DDD, transactions, Java style |
|
|
207
|
-
| `tsconfig.json` | `typescript-patterns` | Async/await, typed errors |
|
|
208
|
-
| `package.json` + React | `ui-patterns` | Components, Tailwind, dark mode |
|
|
209
|
-
| `go.mod` | Go patterns | Error handling, interfaces |
|
|
210
|
-
| `Cargo.toml` | Rust patterns | Result types, ownership |
|
|
357
|
+
Include the skill content in the coding subagent prompt (see template below).
|
|
211
358
|
|
|
212
|
-
|
|
359
|
+
**Important:** If no matching skill is found, the subagent falls back to general best practices for that language.
|
|
213
360
|
|
|
214
361
|
## Status Management
|
|
215
362
|
|
|
@@ -313,3 +460,5 @@ Action needed: Resolve blockers, then run `/flux:implement FP-T45`
|
|
|
313
460
|
- **Fail fast**: Report blockers immediately
|
|
314
461
|
- **One commit per task**: Keep history clean
|
|
315
462
|
- **TDD always**: Tests before implementation
|
|
463
|
+
- **Test critical components**: Not just acceptance criteria - test business logic, transformations, error paths
|
|
464
|
+
- **Clean code**: Modular, testable, self-documenting - no unnecessary comments
|