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,194 @@
1
+ ---
2
+ name: rpi:test
3
+ description: Run TDD (Red-Green-Refactor) on a specific task or set of tasks from the plan. Writes one failing test, verifies failure, implements minimal code, verifies pass, refactors.
4
+ argument-hint: "<feature-slug> [--task <id>] [--all]"
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 strict TDD cycles (RED → GREEN → REFACTOR) for tasks in a feature's PLAN.md. One test at a time, verify fail, implement, verify pass.
18
+ </objective>
19
+
20
+ <process>
21
+
22
+ ## 1. Load config and parse arguments
23
+
24
+ Read `.rpi.yaml` for configuration (folder, test_runner).
25
+ Parse `$ARGUMENTS`:
26
+ - First argument: `{feature-slug}` (required)
27
+ - `--task <id>`: run TDD for a specific task (e.g., `1.2`)
28
+ - `--all`: run TDD for all uncompleted tasks sequentially
29
+
30
+ If no `--task` or `--all`, ask the user which task to work on.
31
+
32
+ ## 2. Validate prerequisites
33
+
34
+ Read `{folder}/{feature-slug}/plan/PLAN.md`. If missing:
35
+ ```
36
+ Plan not found. Run /rpi:plan {feature-slug} first.
37
+ ```
38
+
39
+ Read `{folder}/{feature-slug}/plan/eng.md` for technical context (especially Testing Strategy section).
40
+
41
+ ## 3. Detect test infrastructure
42
+
43
+ Scan the project for existing test setup:
44
+ - Look for test config files: `jest.config.*`, `vitest.config.*`, `pytest.ini`, `pyproject.toml [tool.pytest]`, `*.test.*`, `*.spec.*`
45
+ - Identify the test runner command (from config `test_runner` or auto-detect)
46
+ - Identify test file naming convention (`*.test.ts`, `*.spec.ts`, `*_test.py`, etc.)
47
+ - Identify assertion style (`expect`, `assert`, etc.)
48
+
49
+ If no test infrastructure found, ask the user:
50
+ "No test setup detected. What test framework and runner should I use?"
51
+
52
+ ## 4. For each target task, run TDD cycle
53
+
54
+ ### Phase RED: Write failing test
55
+
56
+ Launch test-engineer agent:
57
+ ```
58
+ You are the test-engineer agent for the RPI workflow.
59
+
60
+ Read these files:
61
+ - {folder}/{feature-slug}/plan/PLAN.md
62
+ - {folder}/{feature-slug}/plan/eng.md
63
+
64
+ Current task:
65
+ **{task_id}** {task_description}
66
+ Files: {files}
67
+
68
+ Test infrastructure:
69
+ - Framework: {detected_framework}
70
+ - File convention: {convention}
71
+ - Assertion style: {style}
72
+
73
+ Write ONE failing test for this task:
74
+ 1. Create or edit the appropriate test file following project conventions
75
+ 2. Write a single test that describes the expected behavior
76
+ 3. The test must exercise real code through the public interface
77
+ 4. Use clear, behavior-describing test name
78
+ 5. Minimal assertions — one logical check
79
+
80
+ Do NOT write any implementation code. Only the test.
81
+
82
+ Follow test-engineer rules from RPI agent guidelines.
83
+ ```
84
+
85
+ ### Phase VERIFY RED: Confirm correct failure
86
+
87
+ Run the test:
88
+ ```bash
89
+ {test_runner} {test_file}
90
+ ```
91
+
92
+ Check the output:
93
+ - **Test fails with expected reason** (function/module not found, assertion fails) → proceed to GREEN
94
+ - **Test errors** (syntax error, import error, typo) → fix the test, re-run
95
+ - **Test passes** → the behavior already exists. Either the test is wrong or the task is already done. Ask the user.
96
+
97
+ Report to user:
98
+ ```
99
+ RED: Test fails correctly.
100
+ Test: {test_name}
101
+ Failure: {failure_reason}
102
+ ```
103
+
104
+ ### Phase GREEN: Minimal implementation
105
+
106
+ Launch plan-executor agent:
107
+ ```
108
+ You are implementing a single task using TDD.
109
+
110
+ The following test is currently FAILING:
111
+ {test_file}:{test_name}
112
+ Failure reason: {failure_reason}
113
+
114
+ Write the MINIMAL code to make this test pass.
115
+ - Only touch files listed for this task
116
+ - Do NOT add features beyond what the test requires
117
+ - Do NOT write additional tests
118
+ - Match existing code style
119
+
120
+ Task context:
121
+ **{task_id}** {task_description}
122
+ Files: {files}
123
+ ```
124
+
125
+ ### Phase VERIFY GREEN: Confirm pass
126
+
127
+ Run the test again:
128
+ ```bash
129
+ {test_runner} {test_file}
130
+ ```
131
+
132
+ Also run the full test suite to check for regressions:
133
+ ```bash
134
+ {test_runner}
135
+ ```
136
+
137
+ Check:
138
+ - **Target test passes** → proceed to REFACTOR
139
+ - **Target test fails** → fix implementation, re-run (do NOT change the test)
140
+ - **Other tests break** → fix regressions before proceeding
141
+
142
+ Report to user:
143
+ ```
144
+ GREEN: Test passes.
145
+ Test: {test_name}
146
+ All tests: {pass_count}/{total_count} passing
147
+ ```
148
+
149
+ ### Phase REFACTOR: Clean up
150
+
151
+ Review the implementation just written:
152
+ - Remove duplication
153
+ - Improve names
154
+ - Extract helpers if warranted (3+ uses)
155
+ - Do NOT add new behavior
156
+
157
+ After refactoring, re-run tests to confirm still green:
158
+ ```bash
159
+ {test_runner}
160
+ ```
161
+
162
+ ### Commit
163
+
164
+ If all tests pass:
165
+ ```bash
166
+ git add {changed_files}
167
+ git commit -m "{type}({task_id}): {task_description}"
168
+ ```
169
+
170
+ ## 5. Check for additional tests needed
171
+
172
+ After the first TDD cycle for a task, check eng.md for additional test scenarios:
173
+ - Edge cases mentioned in the plan
174
+ - Error handling paths
175
+ - Boundary conditions
176
+
177
+ If more tests are needed, ask the user:
178
+ "Task {task_id} has additional test scenarios. Continue with next test cycle?"
179
+
180
+ If yes, repeat the TDD cycle (RED → GREEN → REFACTOR) for each additional test.
181
+
182
+ ## 6. Report results
183
+
184
+ ```
185
+ TDD complete for task {task_id}:
186
+ - Tests written: {N}
187
+ - All passing: {pass_count}/{total_count}
188
+ - Files changed: {list}
189
+
190
+ {If --all: proceed to next task}
191
+ {If single task: suggest next task or /rpi:implement to continue}
192
+ ```
193
+
194
+ </process>
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "rpi-kit",
3
+ "version": "1.0.0",
4
+ "description": "Research → Plan → Implement. A systematic feature development workflow for Claude Code.",
5
+ "license": "MIT",
6
+ "author": "Daniel Mendes",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dmend3z/rpi-kit.git"
10
+ },
11
+ "keywords": [
12
+ "claude-code",
13
+ "claude",
14
+ "ai",
15
+ "workflow",
16
+ "feature-development",
17
+ "tdd",
18
+ "codex",
19
+ "agents"
20
+ ],
21
+ "bin": {
22
+ "rpi-kit": "./bin/cli.js"
23
+ },
24
+ "files": [
25
+ "bin/",
26
+ "commands/",
27
+ "agents/",
28
+ "AGENTS.md",
29
+ "README.md",
30
+ "LICENSE"
31
+ ],
32
+ "scripts": {
33
+ "postinstall": "node bin/cli.js install --silent"
34
+ }
35
+ }