rpi-kit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,193 @@
1
+ ---
2
+ name: rpi:docs
3
+ description: Generate code documentation from implementation artifacts. Adds inline docs, updates README, generates API docs, and creates changelog entry. Final step in the RPI pipeline.
4
+ argument-hint: "<feature-slug> [--skip-inline] [--skip-readme] [--skip-changelog]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+
16
+ <objective>
17
+ Generate documentation for a completed feature using all RPI artifacts as source. Adds inline code documentation, updates project README if needed, generates API docs for new endpoints, and creates a changelog entry.
18
+ </objective>
19
+
20
+ <process>
21
+
22
+ ## 1. Load config and parse arguments
23
+
24
+ Read `.rpi.yaml` for folder path.
25
+ Parse `$ARGUMENTS`:
26
+ - First argument: `{feature-slug}` (required)
27
+ - `--skip-inline`: skip adding inline code documentation
28
+ - `--skip-readme`: skip README updates
29
+ - `--skip-changelog`: skip changelog entry
30
+
31
+ ## 2. Validate prerequisites
32
+
33
+ Verify the feature has passed review. Read `{folder}/{feature-slug}/implement/IMPLEMENT.md`.
34
+
35
+ Check for review verdict:
36
+ - If verdict is PASS → proceed
37
+ - If verdict is FAIL → error:
38
+ ```
39
+ Feature has not passed review. Run /rpi:review {feature-slug} first.
40
+ ```
41
+ - If IMPLEMENT.md doesn't exist → error:
42
+ ```
43
+ Implementation not found. Run /rpi:implement {feature-slug} first.
44
+ ```
45
+
46
+ ## 3. Gather all artifacts
47
+
48
+ Read all feature artifacts for context:
49
+ - `{folder}/{feature-slug}/REQUEST.md` — what was requested
50
+ - `{folder}/{feature-slug}/research/RESEARCH.md` — decisions and trade-offs
51
+ - `{folder}/{feature-slug}/plan/eng.md` — technical spec (APIs, models, architecture)
52
+ - `{folder}/{feature-slug}/plan/pm.md` — acceptance criteria (if exists)
53
+ - `{folder}/{feature-slug}/plan/PLAN.md` — task list with files
54
+ - `{folder}/{feature-slug}/implement/IMPLEMENT.md` — what was actually built, deviations
55
+
56
+ ## 4. Identify documentation targets
57
+
58
+ From IMPLEMENT.md and PLAN.md, collect:
59
+ - All files created or modified
60
+ - New public functions, classes, types, and exports
61
+ - New API endpoints or routes
62
+ - New configuration options or environment variables
63
+ - Deviations from the plan (may need extra documentation)
64
+
65
+ Use Glob and Grep to read the actual implemented files and identify what needs documentation.
66
+
67
+ ## 5. Launch parallel documentation agents
68
+
69
+ Use the Agent tool to launch applicable agents concurrently.
70
+
71
+ ### Agent 1: Inline Documentation (unless --skip-inline)
72
+
73
+ ```
74
+ You are documenting code for a completed feature.
75
+
76
+ Read these artifacts for context:
77
+ - {folder}/{feature-slug}/plan/eng.md
78
+ - {folder}/{feature-slug}/implement/IMPLEMENT.md
79
+
80
+ Then read each implemented file listed in IMPLEMENT.md.
81
+
82
+ Add inline documentation ONLY where it adds value:
83
+ 1. Public functions/methods: brief JSDoc/docstring with params and return type
84
+ 2. Complex logic: short comment explaining WHY, not WHAT
85
+ 3. Non-obvious design decisions: reference the trade-off from eng.md
86
+ 4. New types/interfaces: brief description of purpose
87
+
88
+ Rules:
89
+ - Do NOT add obvious comments ("// returns the user" on a getUser function)
90
+ - Do NOT document private/internal helpers unless logic is non-trivial
91
+ - Match the project's existing documentation style and conventions
92
+ - If the project has no inline docs convention, use minimal JSDoc/docstrings only on public APIs
93
+ - Do NOT modify any behavior — documentation only
94
+ ```
95
+
96
+ ### Agent 2: API Documentation (if new endpoints exist)
97
+
98
+ ```
99
+ You are generating API documentation for new endpoints.
100
+
101
+ Read these artifacts:
102
+ - {folder}/{feature-slug}/plan/eng.md (API design section)
103
+ - {folder}/{feature-slug}/implement/IMPLEMENT.md
104
+
105
+ Find all new API endpoints/routes in the implemented files using Grep.
106
+
107
+ For each endpoint, document:
108
+ - Method and path
109
+ - Request parameters/body with types
110
+ - Response format with types
111
+ - Error responses
112
+ - Authentication requirements
113
+ - Example request/response
114
+
115
+ Check if the project has an existing API docs file or pattern (e.g., docs/api.md, swagger/openapi spec, README API section). If yes, extend it. If no, create `{folder}/{feature-slug}/implement/API.md`.
116
+
117
+ Use the format that matches existing project conventions.
118
+ ```
119
+
120
+ ### Agent 3: README & Changelog (unless both skipped)
121
+
122
+ ```
123
+ You are updating project documentation for a completed feature.
124
+
125
+ Read these artifacts:
126
+ - {folder}/{feature-slug}/REQUEST.md (feature summary)
127
+ - {folder}/{feature-slug}/implement/IMPLEMENT.md (what was built, deviations)
128
+ - {folder}/{feature-slug}/plan/eng.md (new dependencies, config)
129
+
130
+ Tasks:
131
+
132
+ 1. README update (unless --skip-readme):
133
+ - Read the project's existing README.md
134
+ - Determine if the feature needs to be mentioned (new user-facing capability, new config, new dependency)
135
+ - If yes, add a concise entry in the appropriate section
136
+ - If the feature is purely internal/refactor, skip README update
137
+ - Do NOT rewrite the README — only add what's necessary
138
+
139
+ 2. Changelog entry (unless --skip-changelog):
140
+ - Check if CHANGELOG.md exists. If not, create it with Keep a Changelog format
141
+ - Add an entry under [Unreleased]:
142
+ - Added: new features
143
+ - Changed: modifications to existing features
144
+ - Fixed: bug fixes
145
+ - Keep entries concise — one line per change
146
+ - Reference the feature slug for traceability
147
+ ```
148
+
149
+ ## 6. Write DOCS.md summary
150
+
151
+ After all agents complete, write `{folder}/{feature-slug}/implement/DOCS.md`:
152
+
153
+ ```markdown
154
+ # Documentation: {Feature Title}
155
+
156
+ Generated: {timestamp}
157
+
158
+ ## Inline Documentation
159
+ - Files documented: {N}
160
+ - Public APIs documented: {list}
161
+ {Or: "Skipped (--skip-inline)"}
162
+
163
+ ## API Documentation
164
+ - New endpoints: {N}
165
+ - Docs location: {path}
166
+ {Or: "No new endpoints"}
167
+
168
+ ## README
169
+ - Updated: yes/no
170
+ - Changes: {brief description}
171
+ {Or: "Skipped (--skip-readme)"}
172
+
173
+ ## Changelog
174
+ - Entry added: yes/no
175
+ - Section: Added/Changed/Fixed
176
+ {Or: "Skipped (--skip-changelog)"}
177
+ ```
178
+
179
+ ## 7. Present result
180
+
181
+ Output:
182
+ ```
183
+ Documentation complete for {feature-slug}:
184
+ - Inline docs: {N} files documented
185
+ - API docs: {endpoint count or "none"}
186
+ - README: {updated or skipped}
187
+ - Changelog: {entry added or skipped}
188
+
189
+ Feature {feature-slug} is fully complete.
190
+ All artifacts: {folder}/{feature-slug}/
191
+ ```
192
+
193
+ </process>
@@ -0,0 +1,275 @@
1
+ ---
2
+ name: rpi:implement
3
+ description: Execute the implementation plan with task-level tracking, smart parallelism, automatic simplification, and mandatory code review.
4
+ argument-hint: "<feature-slug> [--sequential|--parallel] [--skip-simplify] [--skip-review] [--resume]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+
16
+ <objective>
17
+ Execute tasks from PLAN.md with per-task commits, automatic code simplification, and mandatory code review. Track everything in IMPLEMENT.md.
18
+ </objective>
19
+
20
+ <process>
21
+
22
+ ## 1. Load config and parse arguments
23
+
24
+ Read `.rpi.yaml` for configuration.
25
+ Parse `$ARGUMENTS`:
26
+ - First argument: `{feature-slug}` (required)
27
+ - `--sequential`: force single agent mode
28
+ - `--parallel`: force parallel wave mode
29
+ - `--skip-simplify`: skip the simplify step (overrides config)
30
+ - `--skip-review`: skip the review step (overrides config)
31
+ - `--resume`: resume from last completed task in existing IMPLEMENT.md
32
+
33
+ ## 2. Validate prerequisites
34
+
35
+ Read `{folder}/{feature-slug}/plan/PLAN.md`. If missing:
36
+ ```
37
+ Plan not found. Run /rpi:plan {feature-slug} first.
38
+ ```
39
+
40
+ Also read eng.md (and pm.md, ux.md if they exist) for full context.
41
+
42
+ ## 3. Handle resume
43
+
44
+ If `--resume` or IMPLEMENT.md already exists:
45
+ - Read IMPLEMENT.md
46
+ - Parse completed tasks (lines with `[x]`)
47
+ - Identify next uncompleted task
48
+ - Inform user: "Resuming from task {id}: {name}"
49
+
50
+ If IMPLEMENT.md exists and no `--resume`:
51
+ - Ask user: "Implementation in progress ({N}/{total} tasks). Resume or restart?"
52
+
53
+ ## 4. Initialize IMPLEMENT.md
54
+
55
+ If starting fresh, create `{folder}/{feature-slug}/implement/IMPLEMENT.md`:
56
+
57
+ ```markdown
58
+ # Implementation: {Feature Title}
59
+
60
+ Started: {timestamp}
61
+
62
+ ## Tasks
63
+
64
+ {Copy task checklist from PLAN.md with all boxes unchecked}
65
+
66
+ ## Deviations
67
+
68
+ _None yet._
69
+
70
+ ## Simplify Findings
71
+
72
+ _Pending._
73
+
74
+ ## Review
75
+
76
+ _Pending._
77
+ ```
78
+
79
+ ## 5. Determine execution mode
80
+
81
+ Count total uncompleted tasks.
82
+
83
+ If `--sequential` flag: single agent mode.
84
+ If `--parallel` flag: wave mode.
85
+ Otherwise, use smart default:
86
+ - < {parallel_threshold from config, default 8} tasks → single agent
87
+ - >= threshold → parallel waves
88
+
89
+ ## 6. Execute tasks
90
+
91
+ ### Single agent mode:
92
+
93
+ For each task in order (respecting dependencies):
94
+
95
+ 1. Read PLAN.md task details (files, deps, test spec if present)
96
+ 2. Read eng.md for technical context
97
+
98
+ #### If TDD is enabled (`tdd: true` in config):
99
+
100
+ Follow strict RED → GREEN → REFACTOR per task:
101
+
102
+ **RED — Write failing test:**
103
+ 3a. Launch test-engineer agent:
104
+ ```
105
+ You are the test-engineer agent for the RPI workflow.
106
+
107
+ Read these files for context:
108
+ - {folder}/{feature-slug}/plan/PLAN.md
109
+ - {folder}/{feature-slug}/plan/eng.md
110
+
111
+ Current task:
112
+ **{task_id}** {task_description}
113
+ Files: {files}
114
+ Test: {test_spec from PLAN.md, if present}
115
+
116
+ Write ONE failing test for this task.
117
+ - Exercise real code through public interfaces
118
+ - Clear, behavior-describing test name
119
+ - Minimal assertions — one logical check
120
+ - Follow project test conventions
121
+ - Do NOT write implementation code
122
+ ```
123
+
124
+ **VERIFY RED — Confirm correct failure:**
125
+ 3b. Run the test:
126
+ ```bash
127
+ {test_runner} {test_file}
128
+ ```
129
+ - Test fails for expected reason → proceed
130
+ - Test errors (syntax/import) → fix test, re-run
131
+ - Test passes → behavior exists already, skip or ask user
132
+
133
+ **GREEN — Minimal implementation:**
134
+ 3c. Launch plan-executor agent:
135
+ ```
136
+ You are implementing a single task using TDD.
137
+
138
+ The following test is currently FAILING:
139
+ {test_file}:{test_name}
140
+ Failure: {failure_reason}
141
+
142
+ Write the MINIMAL code to make this test pass.
143
+ - Only touch files listed for this task
144
+ - Do NOT add features beyond what the test requires
145
+ - Match existing code style
146
+ - If blocked, report the blocker — don't improvise
147
+ ```
148
+
149
+ **VERIFY GREEN — Confirm pass:**
150
+ 3d. Run the test again:
151
+ ```bash
152
+ {test_runner} {test_file}
153
+ ```
154
+ Run full suite to check regressions:
155
+ ```bash
156
+ {test_runner}
157
+ ```
158
+ - All pass → proceed to REFACTOR
159
+ - Target fails → fix implementation (not the test), re-run
160
+ - Other tests break → fix regressions first
161
+
162
+ **REFACTOR — Clean up:**
163
+ 3e. Review implementation: remove duplication, improve names, extract helpers if 3+ uses.
164
+ Re-run tests to confirm still green.
165
+
166
+ **Additional test cycles:**
167
+ 3f. If the task has multiple test scenarios (from test spec or eng.md edge cases), repeat RED → GREEN → REFACTOR for each additional test before moving to next task.
168
+
169
+ #### If TDD is disabled (default):
170
+
171
+ 3. Launch plan-executor agent:
172
+ ```
173
+ You are implementing a single task from the RPI plan.
174
+
175
+ Read these files for context:
176
+ - {folder}/{feature-slug}/plan/PLAN.md
177
+ - {folder}/{feature-slug}/plan/eng.md
178
+ - {additional plan files if they exist}
179
+
180
+ Current task:
181
+ **{task_id}** {task_description}
182
+ Effort: {effort} | Files: {files}
183
+
184
+ Rules:
185
+ - Only touch files listed for this task
186
+ - Match existing code style
187
+ - If blocked, report the blocker — don't improvise
188
+ - When done, report: files changed, any deviations
189
+ ```
190
+
191
+ #### After task completion (both modes):
192
+
193
+ 4. Update IMPLEMENT.md:
194
+ - Mark task as `[x]` with timestamp
195
+ - Record files changed
196
+ - Record any deviations
197
+ - If TDD: record tests written and pass/fail status
198
+ 5. If config `commit_style` is `conventional`:
199
+ - Stage changed files
200
+ - Commit: `{type}({task_id}): {task_description}`
201
+
202
+ ### Parallel wave mode:
203
+
204
+ 1. Group tasks by phase from PLAN.md
205
+ 2. Within each phase, identify dependency waves:
206
+ - Wave 1: tasks with no deps (or deps already completed)
207
+ - Wave 2: tasks depending only on wave 1
208
+ - Wave 3: tasks depending on waves 1-2
209
+ 3. For each wave, launch all tasks as parallel agents
210
+ 4. Wait for all wave agents to complete
211
+ 5. Update IMPLEMENT.md with all completed tasks
212
+ 6. Proceed to next wave
213
+
214
+ ## 7. Phase checkpoint
215
+
216
+ After all tasks in a phase complete:
217
+
218
+ Output:
219
+ ```
220
+ Phase {N}: {Phase Name}
221
+ Tasks: {completed}/{total}
222
+ Commits: {list}
223
+ ```
224
+
225
+ If any tasks failed or were blocked, ask user how to proceed.
226
+
227
+ ## 8. Run simplify (unless --skip-simplify)
228
+
229
+ If `auto_simplify` is true in config (and no `--skip-simplify`):
230
+
231
+ Run the simplify process as defined in `/rpi:simplify {feature-slug}`.
232
+ Record findings in IMPLEMENT.md under "## Simplify Findings".
233
+
234
+ ## 9. Run review (unless --skip-review)
235
+
236
+ If `review_after_implement` is true in config (and no `--skip-review`):
237
+
238
+ Run the review process as defined in `/rpi:review {feature-slug}`.
239
+ Record verdict in IMPLEMENT.md under "## Review".
240
+
241
+ ## 10. Finalize IMPLEMENT.md
242
+
243
+ Update IMPLEMENT.md with:
244
+ ```markdown
245
+ ## Summary
246
+
247
+ Completed: {timestamp}
248
+ Total tasks: {N}
249
+ Commits: {list with hashes}
250
+ Phases: {M}
251
+
252
+ ## Review Verdict: {PASS|FAIL}
253
+ {details}
254
+ ```
255
+
256
+ ## 11. Present result
257
+
258
+ If PASS:
259
+ ```
260
+ Feature {feature-slug} implemented.
261
+ {N} tasks completed across {M} phases.
262
+ Review: PASS
263
+
264
+ All artifacts: {folder}/{feature-slug}/
265
+ ```
266
+
267
+ If FAIL:
268
+ ```
269
+ Feature {feature-slug} implementation complete but review found issues:
270
+ {list issues}
271
+
272
+ Fix and re-run: /rpi:review {feature-slug}
273
+ ```
274
+
275
+ </process>
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: rpi:init
3
+ description: Initialize RPI workflow configuration for this project. Sets up feature folder location, default research tier, and preferences.
4
+ argument-hint: ""
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - AskUserQuestion
11
+ ---
12
+
13
+ <objective>
14
+ Create a `.rpi.yaml` configuration file at the project root with user preferences for the RPI workflow.
15
+ </objective>
16
+
17
+ <process>
18
+
19
+ ## 1. Check for existing config
20
+
21
+ Use Glob to search for `.rpi.yaml` at the project root. If it exists, read it and ask the user if they want to reconfigure or keep existing settings.
22
+
23
+ ## 2. Interview the user
24
+
25
+ Use AskUserQuestion to gather preferences. Ask up to 4 questions at a time:
26
+
27
+ **Batch 1:**
28
+ - "Where should feature folders live?" — Options: `rpi/` (Recommended), `.rpi/`, `docs/features/`, custom path
29
+ - "What's your default research tier?" — Options: `standard` (Recommended), `quick`, `deep`
30
+
31
+ **Batch 2:**
32
+ - "Should code simplification run automatically before review?" — Options: Yes (Recommended), No
33
+ - "What commit message style do you prefer?" — Options: `conventional` (Recommended, e.g., feat(1.1): task name), `descriptive` (plain English)
34
+
35
+ **Batch 3:**
36
+ - "Task count threshold for parallel execution?" — Options: 8 (Recommended), 5, 12, always sequential
37
+ - "Create a git branch per feature?" — Options: No (Recommended), Yes
38
+
39
+ **Batch 4 (TDD):**
40
+ - "Enable Test-Driven Development during implementation?" — Options: No (default), Yes
41
+ - If yes: "What command runs your tests?" — Options: auto-detect (Recommended), `npm test`, `npx vitest`, `pytest`, custom
42
+
43
+ ## 3. Create .rpi.yaml
44
+
45
+ Write the config file at the project root:
46
+
47
+ ```yaml
48
+ # RPI Workflow Configuration
49
+ # Docs: https://github.com/mndz/rpi-kit
50
+
51
+ folder: {user_choice}
52
+ tier: {user_choice}
53
+ auto_simplify: {true|false}
54
+ commit_style: {conventional|descriptive}
55
+ parallel_threshold: {number}
56
+ skip_artifacts: []
57
+ review_after_implement: true
58
+ branch_per_feature: {true|false}
59
+ tdd: {true|false}
60
+ test_runner: {auto|command}
61
+ ```
62
+
63
+ ## 4. Create feature folder
64
+
65
+ Create the configured folder directory if it doesn't exist:
66
+ ```bash
67
+ mkdir -p {folder}
68
+ ```
69
+
70
+ ## 5. Confirm
71
+
72
+ Output a brief confirmation:
73
+ ```
74
+ RPI initialized.
75
+ Config: .rpi.yaml
76
+ Features: {folder}/
77
+ Tier: {tier}
78
+
79
+ Next: /rpi:new to start your first feature.
80
+ ```
81
+
82
+ </process>
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: rpi:new
3
+ description: Start a new feature with an adaptive interview. Generates a structured REQUEST.md in the feature folder.
4
+ argument-hint: "[feature-name]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - AskUserQuestion
11
+ ---
12
+
13
+ <objective>
14
+ Interview the user about a new feature and generate a structured REQUEST.md in `{folder}/{feature-slug}/`.
15
+ </objective>
16
+
17
+ <process>
18
+
19
+ ## 1. Load config
20
+
21
+ Read `.rpi.yaml` from the project root. If it doesn't exist, use defaults:
22
+ - folder: `rpi`
23
+ - tier: `standard`
24
+
25
+ ## 2. Determine feature slug
26
+
27
+ If `$ARGUMENTS` contains a feature name, convert to kebab-case slug.
28
+ If no argument, ask: "What feature do you want to build?" and derive the slug from the answer.
29
+
30
+ ## 3. Check for existing feature
31
+
32
+ Check if `{folder}/{feature-slug}/` already exists. If yes, warn the user and ask if they want to continue (overwrite REQUEST.md) or pick a different name.
33
+
34
+ ## 4. Adaptive interview
35
+
36
+ Start with core questions, then ask follow-ups based on answers.
37
+
38
+ **Core (always ask):**
39
+ - "What feature do you want to build?" (skip if already answered from slug)
40
+ - "What problem does this solve? Who benefits?"
41
+
42
+ **Adaptive follow-ups (based on answers):**
43
+ - If feature involves UI: "Any specific UX requirements or references?"
44
+ - If feature involves data: "What data models or schemas are affected?"
45
+ - If feature sounds complex: "What's the rough complexity you expect? (S/M/L/XL)"
46
+ - If mentions external services: "Any API constraints or rate limits to consider?"
47
+ - Always offer: "Any other constraints, references, or inspiration? (links, screenshots, examples)"
48
+
49
+ Use AskUserQuestion for structured questions. Keep it conversational — 2-3 questions per batch, max 3 batches. Stop when you have enough to write a clear REQUEST.md.
50
+
51
+ ## 5. Generate REQUEST.md
52
+
53
+ Create the feature folder and write REQUEST.md:
54
+
55
+ ```bash
56
+ mkdir -p {folder}/{feature-slug}/research
57
+ mkdir -p {folder}/{feature-slug}/plan
58
+ mkdir -p {folder}/{feature-slug}/implement
59
+ ```
60
+
61
+ Write `{folder}/{feature-slug}/REQUEST.md` with this structure:
62
+
63
+ ```markdown
64
+ # {Feature Title}
65
+
66
+ ## Summary
67
+ {1-3 sentence description of the feature}
68
+
69
+ ## Problem
70
+ {What problem does this solve? Who is affected?}
71
+
72
+ ## Target Users
73
+ {Who will use this feature?}
74
+
75
+ ## Constraints
76
+ - {Technical constraints}
77
+ - {Business constraints}
78
+ - {Dependencies}
79
+
80
+ ## References
81
+ - {Links, screenshots, examples, inspiration}
82
+
83
+ ## Complexity Estimate
84
+ {S | M | L | XL} — {brief justification}
85
+ ```
86
+
87
+ ## 6. Next step
88
+
89
+ Output:
90
+ ```
91
+ Feature created: {folder}/{feature-slug}/REQUEST.md
92
+
93
+ Next: /rpi:research {feature-slug}
94
+ Options:
95
+ --quick Feasibility check only (fast)
96
+ --standard Scope + technical approach (default)
97
+ --deep Full analysis with strategic review
98
+ ```
99
+
100
+ </process>