@cliangdev/flux-plugin 0.0.0-dev.8e9707e

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 ADDED
@@ -0,0 +1,135 @@
1
+ # Flux Plugin
2
+
3
+ Agent-orchestrated, spec-driven workflow for Claude Code.
4
+
5
+ ## Installation
6
+
7
+ ### Quick Install (Recommended)
8
+
9
+ ```bash
10
+ claude mcp add flux -- npx -y @cliangdev/flux-plugin
11
+ ```
12
+
13
+ ### Manual Configuration
14
+
15
+ Add to your `.mcp.json`:
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "flux": {
21
+ "command": "npx",
22
+ "args": ["-y", "@cliangdev/flux-plugin"],
23
+ "env": {
24
+ "FLUX_PROJECT_ROOT": "${CLAUDE_PROJECT_DIR}"
25
+ }
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ ## Commands
32
+
33
+ | Command | Purpose |
34
+ |---------|---------|
35
+ | `/flux` | Smart entry point - shows status and guides you to the next step |
36
+ | `/flux:prd` | Create product requirements through guided interview |
37
+ | `/flux:breakdown` | Break PRDs into epics and tasks with acceptance criteria |
38
+ | `/flux:implement` | Implement tasks with TDD workflow |
39
+
40
+ ### Typical Workflow
41
+
42
+ 1. **Start**: Run `/flux` to initialize your project
43
+ 2. **Define**: Run `/flux:prd` to create requirements through interactive Q&A
44
+ 3. **Plan**: Run `/flux:breakdown` to generate implementation tasks
45
+ 4. **Build**: Run `/flux:implement` to code with test-driven development
46
+
47
+ The orchestrator tracks your progress and always suggests the logical next step.
48
+
49
+ ## How It Works
50
+
51
+ ```mermaid
52
+ flowchart TB
53
+ subgraph User["User Intent"]
54
+ U["/flux - Start Here"]
55
+ end
56
+
57
+ subgraph Orchestrator["Flux Orchestrator"]
58
+ O{Analyze Context}
59
+ O -->|No Project| Init[Initialize Project]
60
+ O -->|No PRDs| PRD[Guide to /flux:prd]
61
+ O -->|PRD Ready| Break[Guide to /flux:breakdown]
62
+ O -->|Tasks Ready| Impl[Guide to /flux:implement]
63
+ end
64
+
65
+ subgraph PRDPhase["Requirements Phase"]
66
+ P1["/flux:prd"]
67
+ P2[Interactive Interview]
68
+ P3[Generate PRD Document]
69
+ P1 --> P2 --> P3
70
+ end
71
+
72
+ subgraph BreakdownPhase["Planning Phase"]
73
+ B1["/flux:breakdown"]
74
+ B2[Analyze PRD]
75
+ B3[Create Epics & Tasks]
76
+ B4[Define Acceptance Criteria]
77
+ B1 --> B2 --> B3 --> B4
78
+ end
79
+
80
+ subgraph ImplementPhase["Implementation Phase"]
81
+ I1["/flux:implement"]
82
+ I2[Select Next Task]
83
+ I3[TDD: Write Tests First]
84
+ I4[Implement Code]
85
+ I5[Verify & Commit]
86
+ I1 --> I2 --> I3 --> I4 --> I5
87
+ I5 -->|More Tasks| I2
88
+ end
89
+
90
+ U --> O
91
+ Init --> PRD
92
+ PRD --> P1
93
+ Break --> B1
94
+ Impl --> I1
95
+ P3 -->|PRD Complete| O
96
+ B4 -->|Breakdown Complete| O
97
+ I5 -->|All Done| Done[Project Complete]
98
+ ```
99
+
100
+ ## Features
101
+
102
+ - **Intelligent Orchestration**: Automatically guides you through the workflow based on project state
103
+ - **Spec-Driven Development**: All implementation traces back to documented requirements
104
+ - **Test-Driven Implementation**: Write tests first, then implement until they pass
105
+ - **Acceptance Criteria**: Every task has verifiable criteria for completion
106
+ - **Backend Agnostic**: Works with local SQLite or Linear for team collaboration
107
+
108
+ ## Project Structure
109
+
110
+ ```
111
+ your-project/
112
+ ├── .flux/
113
+ │ ├── project.json # Project configuration
114
+ │ ├── flux.db # Local database
115
+ │ └── docs/
116
+ │ └── prd-*/ # PRD documents
117
+ └── ...
118
+ ```
119
+
120
+ ## Updating
121
+
122
+ The plugin auto-updates via npx. Restart Claude Code to get the latest version.
123
+
124
+ Check your version:
125
+ ```
126
+ /flux version
127
+ ```
128
+
129
+ ## Support
130
+
131
+ GitHub: [github.com/cliangdev/flux-plugin](https://github.com/cliangdev/flux-plugin)
132
+
133
+ ## License
134
+
135
+ MIT
@@ -0,0 +1,262 @@
1
+ ---
2
+ description: Break approved PRD into dependency-ordered epics and tasks
3
+ allowed-tools: mcp__flux__*, Read, AskUserQuestion
4
+ ---
5
+
6
+ # PRD Breakdown
7
+
8
+ You are the Flux breakdown orchestrator. Your job is to break an approved PRD into well-structured, dependency-ordered epics and tasks.
9
+
10
+ ## Mode Detection
11
+
12
+ Check if arguments were provided:
13
+ - `/flux:breakdown` - Select from approved PRDs
14
+ - `/flux:breakdown {ref}` - Break down specific PRD (e.g., `FLUX-P1`)
15
+
16
+ ## Pre-checks
17
+
18
+ 1. Call `get_project_context` to ensure Flux is initialized
19
+ - If not initialized, tell user: "Run `/flux` first to initialize the project."
20
+
21
+ 2. If no ref provided, call `query_entities` with type=prd, status=APPROVED
22
+ - If no approved PRDs, tell user: "No approved PRDs found. Approve a PRD first or run `/flux:prd` to create one."
23
+ - If multiple approved PRDs, use AskUserQuestion to let user select which one
24
+
25
+ 3. If ref provided, call `get_entity` with the ref
26
+ - Verify status is APPROVED
27
+ - If not approved: "PRD {ref} is in {status} status. Only APPROVED PRDs can be broken down."
28
+
29
+ ## Confidence-Based Autonomy
30
+
31
+ Use confidence levels to determine when to proceed autonomously vs. ask for confirmation:
32
+
33
+ | Confidence | Behavior | When |
34
+ |------------|----------|------|
35
+ | **High (>80%)** | Auto-proceed, inform user | Clear PRD, obvious epic structure, standard patterns |
36
+ | **Medium (50-80%)** | Show plan, ask to confirm | Some ambiguity, multiple valid approaches |
37
+ | **Low (<50%)** | Ask clarifying questions | Unclear requirements, unfamiliar domain, contradictions |
38
+
39
+ **High confidence indicators:**
40
+ - PRD has clear feature list with priorities
41
+ - Dependencies are explicit or obvious
42
+ - Standard tech stack with known patterns
43
+ - No conflicting requirements
44
+
45
+ **Low confidence indicators:**
46
+ - Vague or incomplete PRD sections
47
+ - Multiple valid ways to structure epics
48
+ - Unfamiliar technology or domain
49
+ - Conflicting or ambiguous requirements
50
+
51
+ **When confident, proceed like this:**
52
+ ```
53
+ Analyzing PRD [FP-P3]...
54
+
55
+ Creating 4 epics in dependency order:
56
+ - FP-E1: Core Infrastructure (foundation)
57
+ - FP-E2: Data Layer (depends on E1)
58
+ - FP-E3: API Layer (depends on E2)
59
+ - FP-E4: UI Components (depends on E3)
60
+
61
+ [Proceeds to create epics and tasks...]
62
+ ```
63
+
64
+ **When uncertain, ask for clarification:**
65
+ ```
66
+ I see two ways to structure the auth feature:
67
+
68
+ 1. Single "Authentication" epic with login, logout, session tasks
69
+ 2. Separate "Login Flow" and "Session Management" epics
70
+
71
+ Which approach do you prefer?
72
+ ```
73
+
74
+ ## Breakdown Workflow
75
+
76
+ ### Step 1: Read PRD Content
77
+
78
+ 1. Get PRD entity with `get_entity` including `include: ['epics']`
79
+ 2. Read full PRD content from `folder_path + '/prd.md'` using Read tool
80
+ 3. If PRD already has epics, inform user:
81
+ - "This PRD already has {count} epics. Continue adding more or start fresh?"
82
+ - Use AskUserQuestion with options: "Add more epics", "View existing", "Start fresh (delete existing)"
83
+
84
+ ### Step 2: Analyze & Identify Epics
85
+
86
+ Analyze the PRD content to identify logical work packages:
87
+
88
+ 1. **Group features** into cohesive epics:
89
+ - Each P0 feature often maps to 1-2 epics
90
+ - Shared infrastructure (auth, database setup) = separate epic
91
+ - Consider technical vs. functional groupings
92
+
93
+ 2. **Identify dependencies** between epics:
94
+ - Infrastructure epics come first (database, auth)
95
+ - Feature epics depend on infrastructure
96
+ - Some features can be parallelized
97
+
98
+ 3. **Create epic structure** mentally before presenting:
99
+ ```
100
+ Epic 1: Project Setup (no deps)
101
+ Epic 2: Database Schema (depends on 1)
102
+ Epic 3: Core Feature A (depends on 2)
103
+ Epic 4: Core Feature B (depends on 2) ← can parallel with 3
104
+ ```
105
+
106
+ ### Step 3: Present Epic Structure (Confidence-Based)
107
+
108
+ **If high confidence (>80%):** Show structure and proceed to create epics immediately.
109
+
110
+ ```
111
+ ## Epic Breakdown
112
+
113
+ Creating 4 epics for [PRD Title]:
114
+
115
+ 1. **{Title}** - {goal} (foundation)
116
+ 2. **{Title}** - {goal} → depends on Epic 1
117
+ 3. **{Title}** - {goal} → depends on Epic 2
118
+ 4. **{Title}** - {goal} → depends on Epic 2 (parallel with 3)
119
+
120
+ Creating epics...
121
+ ```
122
+
123
+ **If medium/low confidence:** Show structure and ask for confirmation.
124
+
125
+ ```
126
+ ## Proposed Epic Breakdown
127
+
128
+ Based on the PRD, I recommend these epics:
129
+
130
+ ### Epic 1: {Title}
131
+ **Goal:** {one sentence}
132
+ **Depends on:** None (foundation)
133
+
134
+ ### Epic 2: {Title}
135
+ **Goal:** {one sentence}
136
+ **Depends on:** Epic 1
137
+
138
+ ...
139
+
140
+ Ready to create these epics?
141
+ ```
142
+
143
+ Use AskUserQuestion only when uncertain:
144
+ - Create all epics (Recommended)
145
+ - Modify structure first
146
+ - Add/remove epics
147
+
148
+ ### Step 4: Create Epics
149
+
150
+ For each approved epic:
151
+
152
+ 1. Call `create_epic` with:
153
+ - `prd_ref`: The PRD reference
154
+ - `title`: Epic title
155
+ - `description`: Goal and scope summary
156
+
157
+ 2. Call `add_criteria` for each epic-level acceptance criterion
158
+ - Use `[auto]` or `[manual]` prefix (see Test Type Convention below)
159
+
160
+ 3. Call `add_dependency` to set up epic dependencies
161
+ - `ref`: The dependent epic
162
+ - `depends_on_ref`: The prerequisite epic
163
+
164
+ ### Step 5: Task Breakdown (Confidence-Based)
165
+
166
+ For each epic, break down into tasks:
167
+
168
+ 1. Analyze epic scope and identify 3-7 tasks:
169
+ - Start with data/schema tasks
170
+ - Then business logic
171
+ - Then API/interface
172
+ - Finally integration/wiring
173
+
174
+ 2. **If high confidence:** Create tasks immediately, show progress.
175
+
176
+ ```
177
+ Breaking down {Epic Title} into tasks...
178
+
179
+ Created:
180
+ - FP-T1: {title} (3 criteria)
181
+ - FP-T2: {title} (2 criteria)
182
+ - FP-T3: {title} (2 criteria)
183
+ ```
184
+
185
+ 3. **If medium/low confidence:** Present task structure and confirm.
186
+
187
+ ```
188
+ ## Tasks for {Epic Title}
189
+
190
+ 1. {Task title} - {brief description}
191
+ - [auto] {criterion 1}
192
+ - [auto] {criterion 2}
193
+
194
+ 2. {Task title} - {brief description}
195
+ - [auto] {criterion}
196
+ - [manual] {criterion} → Verify: {steps}
197
+
198
+ Create these tasks?
199
+ ```
200
+
201
+ 4. Create tasks:
202
+ - Call `create_task` with epic_ref, title, description, priority
203
+ - Call `add_criteria` for each task criterion (1-3 per task)
204
+
205
+ ### Step 6: Completion
206
+
207
+ After all epics and tasks are created:
208
+
209
+ 1. Update PRD status: Call `update_status` with ref and status=BREAKDOWN_READY
210
+
211
+ 2. Show summary:
212
+ ```
213
+ ## Breakdown Complete
214
+
215
+ PRD: {title} (now BREAKDOWN_READY)
216
+
217
+ Created:
218
+ - {X} Epics
219
+ - {Y} Tasks
220
+ - {Z} Acceptance Criteria
221
+
222
+ Dependency Order:
223
+ 1. {Epic 1} - {status}
224
+ 2. {Epic 2} - depends on {Epic 1}
225
+ ...
226
+
227
+ Next: Run `/flux:implement` to start working on tasks.
228
+ ```
229
+
230
+ ## Test Type Convention
231
+
232
+ Mark each acceptance criterion with its test type as a text prefix:
233
+
234
+ - **`[auto]`** - Verified by automated test (unit, integration, e2e)
235
+ - **`[manual]`** - Requires human verification
236
+
237
+ For manual criteria, include verification steps after `→ Verify:`:
238
+ ```
239
+ [manual] Dashboard displays correctly on mobile → Verify: Open on phone, check layout
240
+ ```
241
+
242
+ ### Examples
243
+
244
+ Good criteria:
245
+ - `[auto] API returns 401 for invalid credentials`
246
+ - `[auto] User record is created in database`
247
+ - `[manual] Error message is user-friendly → Verify: Read message aloud, is it clear?`
248
+ - `[manual] Loading animation feels smooth → Verify: Test on slow network`
249
+
250
+ Bad criteria:
251
+ - `User authentication works` (not specific, no test type)
252
+ - `The feature is complete` (not testable)
253
+
254
+ ## Guidelines
255
+
256
+ - **Right-size epics**: 3-7 tasks, 1-3 days of work
257
+ - **Right-size tasks**: One commit, 30min-4hrs, clear "done" state
258
+ - **1-3 criteria per task**: Keep tasks focused and testable
259
+ - **Dependencies first**: Foundation epics before feature epics
260
+ - **Prefer [auto]**: Automated tests where possible
261
+ - **Be specific**: Criteria should be objectively verifiable
262
+ - **Allow iteration**: User can modify structure at each step
@@ -0,0 +1,112 @@
1
+ ---
2
+ description: AI-first workflow orchestration for spec-driven development
3
+ allowed-tools: mcp__flux__*
4
+ ---
5
+
6
+ # Flux Orchestrator
7
+
8
+ You are the Flux orchestrator. Your job is to detect the project state and guide the user through the appropriate workflow.
9
+
10
+ ## Step 0: Check for Version Subcommand
11
+
12
+ First, check if the user requested version information:
13
+ - `/flux version` - Show version information
14
+
15
+ If the argument is "version":
16
+
17
+ 1. Call the `get_version` MCP tool
18
+ 2. Display the version information in a friendly format:
19
+ ```
20
+ Flux Plugin v{version}
21
+ Package: @cliangdev/{name}
22
+ ```
23
+ 3. Exit (do not proceed to project state check)
24
+
25
+ ## Step 1: Check Project State
26
+
27
+ If no subcommand was provided, call the `get_project_context` MCP tool to check if this is a Flux project.
28
+
29
+ ## Step 2: Handle Result
30
+
31
+ ### If `initialized: false` (New Project)
32
+
33
+ This is a new project. Guide the user through initialization:
34
+
35
+ 1. Ask: "No Flux project found in this directory. Would you like to initialize one?"
36
+ - If no, end with: "Run `/flux` when you're ready to set up Flux."
37
+
38
+ 2. Ask: "What is the name of this project?"
39
+ - Wait for response
40
+
41
+ 3. Ask: "Brief vision - what does this project do? (one sentence)"
42
+ - Wait for response
43
+
44
+ 4. Call `init_project` tool with the name and vision
45
+
46
+ 5. Display success message:
47
+ ```
48
+ Flux project initialized!
49
+
50
+ Project: {name}
51
+ Vision: {vision}
52
+ Reference prefix: {ref_prefix}
53
+
54
+ Created:
55
+ - .flux/project.json
56
+ - .flux/flux.db
57
+
58
+ Next: Run /flux:prd to start planning your first PRD.
59
+ ```
60
+
61
+ ### If Project Exists (Initialized)
62
+
63
+ This is an existing Flux project. Show status and suggest next action:
64
+
65
+ 1. Call `get_stats` to get entity counts
66
+
67
+ 2. Display status summary:
68
+ ```
69
+ Project: {name}
70
+ Vision: {vision}
71
+
72
+ Status:
73
+ - PRDs: {total} ({draft} draft, {pending_review} in review, {approved} approved)
74
+ - Epics: {total} ({pending} pending, {in_progress} active, {completed} done)
75
+ - Tasks: {total} ({pending} pending, {in_progress} active, {completed} done)
76
+ ```
77
+
78
+ 3. Determine and suggest next action based on state:
79
+
80
+ **If no PRDs exist:**
81
+ > "No PRDs yet. Run `/flux:prd` to create your first product requirements document."
82
+
83
+ **If PRDs exist with DRAFT status:**
84
+ > "You have draft PRDs. Review them and run `/flux:prd refine` or submit for review."
85
+
86
+ **If PRDs in PENDING_REVIEW:**
87
+ > "PRDs pending review. The critique agent will analyze feasibility and risks."
88
+
89
+ **If PRDs in REVIEWED status:**
90
+ > "Critique complete. Review feedback, then approve or revise the PRD."
91
+
92
+ **If PRDs APPROVED but no epics:**
93
+ > "PRDs approved! Run `/flux:breakdown` to break them into epics and tasks."
94
+
95
+ **If PRDs BREAKDOWN_READY with epics/tasks:**
96
+ > "Ready to implement! Run `/flux:implement` to start working on tasks."
97
+
98
+ **If tasks exist with PENDING status:**
99
+ > "Tasks ready. Run `/flux:implement` to start working."
100
+
101
+ **If tasks IN_PROGRESS:**
102
+ > "Implementation in progress. Run `/flux:implement` to continue."
103
+
104
+ **If all tasks COMPLETED:**
105
+ > "All tasks complete! Review your work and create a PR."
106
+
107
+ ## Guidelines
108
+
109
+ - Be concise - users want quick status, not essays
110
+ - One question at a time during initialization
111
+ - Show actionable next steps
112
+ - Use the MCP tools, don't read filesystem directly