@xenonbyte/req-2-plan 0.4.4 → 0.5.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.
- package/README.md +170 -125
- package/README.zh-CN.md +154 -108
- package/package.json +1 -1
- package/tools/r2p-archive +10 -0
- package/tools/r2p-execute +10 -0
- package/tools/workflow_cli/agent_shortcuts.py +310 -26
- package/tools/workflow_cli/agent_templates/claude/SKILL.md +2 -1
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-archive.md +10 -0
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-continue.md +1 -0
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-execute.md +122 -0
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-reopen.md +2 -2
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-archive/SKILL.md +14 -0
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-continue/SKILL.md +2 -0
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-execute/SKILL.md +123 -0
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-reopen/SKILL.md +2 -2
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-archive.toml +4 -0
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-continue.toml +1 -1
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-execute.toml +4 -0
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-reopen.toml +1 -1
- package/tools/workflow_cli/artifact.py +5 -2
- package/tools/workflow_cli/atomic.py +50 -0
- package/tools/workflow_cli/cli.py +229 -31
- package/tools/workflow_cli/gates.py +149 -2
- package/tools/workflow_cli/install.py +56 -3
- package/tools/workflow_cli/link_expander.py +9 -25
- package/tools/workflow_cli/markdown.py +18 -0
- package/tools/workflow_cli/models.py +19 -1
- package/tools/workflow_cli/stage_templates.py +2 -1
- package/tools/workflow_cli/state.py +5 -6
- package/tools/workflow_cli/tier.py +1 -1
- package/tools/workflow_cli/version.py +1 -1
- package/tools/workflow_cli/workspace.py +112 -0
package/README.md
CHANGED
|
@@ -6,38 +6,66 @@ English | [简体中文](README.zh-CN.md)
|
|
|
6
6
|
[](https://nodejs.org)
|
|
7
7
|
[](./LICENSE)
|
|
8
8
|
|
|
9
|
-
> Turn a raw requirement into an approved, executor-neutral implementation PLAN
|
|
9
|
+
> Turn a raw requirement into an approved, executor-neutral implementation PLAN across Claude Code, Codex, Gemini, and opencode.
|
|
10
10
|
|
|
11
|
-
`req-2-plan` installs
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
The result is a plan another agent or engineer can execute without re-deciding
|
|
16
|
-
scope.
|
|
11
|
+
`req-2-plan` installs the `r2p` workflow for AI coding agents. It takes a rough
|
|
12
|
+
requirement through a staged, gated process - **requirement brief**, **risk
|
|
13
|
+
discovery**, **DESIGN**, **SPEC**, and **PLAN** - so the final plan is grounded,
|
|
14
|
+
reviewed, and ready for another agent or engineer to execute.
|
|
17
15
|
|
|
18
|
-
The npm package is
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
The npm package is the lifecycle installer. It currently supports four agent
|
|
17
|
+
platforms - **Claude Code**, **Codex**, **Gemini**, and **opencode**. From one
|
|
18
|
+
shared source it generates platform-specific agent surfaces, installs the shared
|
|
19
|
+
`r2p-*` wrappers, and keeps an owned manifest so uninstall only removes files
|
|
20
|
+
managed by `r2p`.
|
|
21
|
+
|
|
22
|
+
**Contents:** [Why r2p](#why-r2p) · [Features](#features) · [Installation](#installation) · [Quick start](#quick-start) · [Workflow commands](#workflow-commands) · [Development](#development)
|
|
23
|
+
|
|
24
|
+
## Why r2p
|
|
25
|
+
|
|
26
|
+
AI agents are fast at implementation, but weak requirements tend to leak into
|
|
27
|
+
ambiguous plans, hidden scope choices, and repeated rework. `r2p` makes the
|
|
28
|
+
planning phase explicit:
|
|
29
|
+
|
|
30
|
+
- the requirement is preserved as the source of truth;
|
|
31
|
+
- risks and unknowns are surfaced before implementation planning;
|
|
32
|
+
- DESIGN, SPEC, and PLAN each pass structural quality gates;
|
|
33
|
+
- human decisions are recorded instead of guessed;
|
|
34
|
+
- execution can start from a PLAN without re-deciding scope.
|
|
35
|
+
|
|
36
|
+
Use it when the requirement is more than a one-line edit, when a change touches
|
|
37
|
+
important behavior, or when you want a durable handoff between agents.
|
|
21
38
|
|
|
22
39
|
## Features
|
|
23
40
|
|
|
24
|
-
- **Staged
|
|
25
|
-
- **
|
|
26
|
-
- **
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
41
|
+
- **Staged requirement-to-PLAN workflow**: requirement brief, risk discovery, DESIGN, SPEC, and PLAN.
|
|
42
|
+
- **Quality gates and checkpoints**: each stage must clear validation before handoff.
|
|
43
|
+
- **Four supported platforms**: installs matching surfaces for Claude Code (`claude`), Codex (`codex`), Gemini (`gemini`), and opencode (`opencode`).
|
|
44
|
+
- **One lifecycle CLI**: `r2p install`, `r2p uninstall`, `r2p status`, `r2p version`, and `r2p help`.
|
|
45
|
+
- **Manifest-backed install safety**: pre-existing files are backed up, and uninstall removes only managed paths.
|
|
46
|
+
- **Project Context Pack**: `--repo-path` captures real repository facts for tiering and PLAN checks.
|
|
47
|
+
- **Repair paths**: reopen closed runs, route upstream gaps, and resolve repaired decisions.
|
|
48
|
+
- **Execution handoff**: `r2p-execute` can drive an approved PLAN through an in-place implementation loop.
|
|
29
49
|
|
|
30
50
|
## Supported platforms
|
|
31
51
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
|
35
|
-
|
|
36
|
-
| `
|
|
52
|
+
`r2p` currently supports 4 platforms. Use the platform ID with `--platform`.
|
|
53
|
+
|
|
54
|
+
| Agent platform | Platform ID | Installed surface |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| Claude Code | `claude` | `skills/r2p/SKILL.md` plus `commands/r2p-*.md` |
|
|
57
|
+
| Codex | `codex` | `skills/r2p-*/SKILL.md` |
|
|
58
|
+
| Gemini | `gemini` | `commands/r2p-*.toml` |
|
|
59
|
+
| opencode | `opencode` | `commands/r2p-*.md` |
|
|
37
60
|
|
|
38
61
|
## Installation
|
|
39
62
|
|
|
40
|
-
Requirements:
|
|
63
|
+
Requirements:
|
|
64
|
+
|
|
65
|
+
- Node.js 18+
|
|
66
|
+
- Python 3 as `python3` or `python`
|
|
67
|
+
|
|
68
|
+
Install the package globally:
|
|
41
69
|
|
|
42
70
|
```bash
|
|
43
71
|
npm install -g @xenonbyte/req-2-plan
|
|
@@ -52,152 +80,169 @@ r2p help
|
|
|
52
80
|
```
|
|
53
81
|
|
|
54
82
|
> [!NOTE]
|
|
55
|
-
>
|
|
56
|
-
>
|
|
83
|
+
> Lifecycle commands use only the Python standard library. Daily workflow
|
|
84
|
+
> wrappers use `pyyaml`; from a checkout, install it with
|
|
57
85
|
> `python3 -m pip install --user -r requirements.txt`, or directly with
|
|
58
86
|
> `python3 -m pip install --user "pyyaml>=6.0"`.
|
|
59
87
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
`~/.req-to-plan/install/<platform>.yaml`. The manifest records every managed path
|
|
63
|
-
so uninstall removes only files `r2p` created and restores backups for files that
|
|
64
|
-
existed beforehand.
|
|
88
|
+
Install all supported agent integrations. This is the default when `--platform`
|
|
89
|
+
is omitted:
|
|
65
90
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
91
|
+
```bash
|
|
92
|
+
r2p install
|
|
93
|
+
```
|
|
69
94
|
|
|
70
|
-
Install
|
|
95
|
+
Install only selected platforms with `--platform`:
|
|
71
96
|
|
|
72
97
|
```bash
|
|
73
|
-
r2p install
|
|
74
|
-
r2p
|
|
98
|
+
r2p install --platform claude
|
|
99
|
+
r2p install --platform claude,codex,gemini,opencode
|
|
75
100
|
```
|
|
76
101
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
102
|
+
> [!WARNING]
|
|
103
|
+
> `r2p install` overwrites an existing `r2p` install for the selected platform(s).
|
|
104
|
+
> Existing user files are backed up first, and `r2p uninstall` removes only paths
|
|
105
|
+
> recorded in the install manifest.
|
|
106
|
+
|
|
107
|
+
## Quick start
|
|
108
|
+
|
|
109
|
+
Install the platform skills, then start a workflow from your agent:
|
|
80
110
|
|
|
81
111
|
```text
|
|
82
|
-
/r2p-start --repo-path . "Add rate limiting"
|
|
83
|
-
/r2p-
|
|
84
|
-
/r2p-continue # advance it stage by stage
|
|
112
|
+
/r2p-start --repo-path . "Add rate limiting"
|
|
113
|
+
/r2p-continue
|
|
85
114
|
```
|
|
86
115
|
|
|
87
|
-
|
|
88
|
-
(the two are mutually exclusive). **Whenever a code repository is the
|
|
89
|
-
requirement's context, pass `--repo-path`** — `.` for the current project,
|
|
90
|
-
the target repo's path for cross-repo work; it generates the Project Context
|
|
91
|
-
Pack that grounds tier estimation and PLAN file-reference checks. Keep options
|
|
92
|
-
before the requirement text (as above) so a quoting slip in free-form text can
|
|
93
|
-
never swallow an option. If a standard-tier PLAN gate later reports a missing
|
|
94
|
-
or unusable Context Pack, build it mid-run with
|
|
95
|
-
the `PYTHONPATH=... <python> -m tools.workflow_cli context-build ...` command printed
|
|
96
|
-
by the gate (there is no standalone `context-build` executable).
|
|
116
|
+
Start from a requirement file instead of inline text:
|
|
97
117
|
|
|
98
|
-
|
|
118
|
+
```text
|
|
119
|
+
/r2p-start --repo-path . --file change-req.md
|
|
120
|
+
```
|
|
99
121
|
|
|
100
|
-
|
|
122
|
+
For repositories used as requirement context, pass `--repo-path`. Use `.` for the
|
|
123
|
+
current repository or a path to the target repository for cross-project work.
|
|
124
|
+
This builds the Project Context Pack used by tier estimation and PLAN reference
|
|
125
|
+
checks.
|
|
101
126
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
r2p
|
|
106
|
-
|
|
127
|
+
The workflow stops whenever it needs a human or agent action: tier lock,
|
|
128
|
+
artifact content, quality-gate repair, checkpoint approval, subagent review, or
|
|
129
|
+
gap resolution. Run the printed `next:` command exactly, then resume with
|
|
130
|
+
`r2p-continue`.
|
|
131
|
+
|
|
132
|
+
> [!TIP]
|
|
133
|
+
> Add `~/.req-to-plan/bin` to your `PATH` to run the wrappers directly:
|
|
134
|
+
>
|
|
135
|
+
> ```bash
|
|
136
|
+
> export PATH="$HOME/.req-to-plan/bin:$PATH"
|
|
137
|
+
> ```
|
|
138
|
+
|
|
139
|
+
## Workflow commands
|
|
140
|
+
|
|
141
|
+
After installation, the agent-facing commands call shared wrappers under
|
|
142
|
+
`~/.req-to-plan/bin`.
|
|
143
|
+
|
|
144
|
+
| Command | Purpose |
|
|
145
|
+
|---|---|
|
|
146
|
+
| `r2p-start` | Start a new run from inline requirement text or `--file <path>`. |
|
|
147
|
+
| `r2p-continue` | Advance the active run to the next stop or completed state. |
|
|
148
|
+
| `r2p-status` | Inspect the active run, or all runs with `--all`, without changing state. |
|
|
149
|
+
| `r2p-switch` | Select a different active `--work-id`. |
|
|
150
|
+
| `r2p-tier-lock` | Lock the tier with `--base light\|standard` and optional modifiers. |
|
|
151
|
+
| `r2p-reopen` | Reopen a closed or executing run from a specific stage and select the reopened run. |
|
|
152
|
+
| `r2p-gap-open` | Route an upstream gap on an open run back to the owner stage. |
|
|
153
|
+
| `r2p-gap-resolve` | Close a repaired upstream-gap route. |
|
|
154
|
+
| `r2p-archive` | Move a closed run under `.req-to-plan/archive/` and untrack its active path. |
|
|
155
|
+
| `r2p-execute` | Execute a closed PLAN in place on the current branch, then archive the run. |
|
|
156
|
+
|
|
157
|
+
Most runs only need `r2p-start` and repeated `r2p-continue`. Use the specialized
|
|
158
|
+
commands when the workflow prints them or when you intentionally need to switch,
|
|
159
|
+
repair, reopen, execute, or archive a run.
|
|
160
|
+
|
|
161
|
+
> [!IMPORTANT]
|
|
162
|
+
> `r2p-execute` assumes the host agent can dispatch subagents. It works on the
|
|
163
|
+
> current branch and does not push or open pull requests.
|
|
164
|
+
|
|
165
|
+
> [!NOTE]
|
|
166
|
+
> Closing a run at the PLAN checkpoint and archiving a run perform best-effort,
|
|
167
|
+
> path-limited commits for that run's `.req-to-plan/<work-id>` state. They never
|
|
168
|
+
> run `git add -A`, never force-add ignored paths, and never push.
|
|
107
169
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
170
|
+
## Lifecycle commands
|
|
171
|
+
|
|
172
|
+
Use lifecycle commands from a terminal to manage installed integrations:
|
|
111
173
|
|
|
112
174
|
```bash
|
|
175
|
+
r2p install
|
|
176
|
+
r2p install --platform codex
|
|
177
|
+
|
|
113
178
|
r2p status
|
|
114
179
|
r2p status --json
|
|
115
|
-
```
|
|
116
180
|
|
|
117
|
-
Uninstall one platform, a list, or all (omit `--platform`):
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
181
|
r2p uninstall --platform claude
|
|
121
|
-
r2p uninstall
|
|
182
|
+
r2p uninstall
|
|
183
|
+
|
|
184
|
+
r2p version
|
|
185
|
+
r2p help
|
|
122
186
|
```
|
|
123
187
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
> Pre-existing user files are backed up before any overwrite, and uninstall never
|
|
127
|
-
> deletes a file `r2p` did not create.
|
|
188
|
+
Omitting `--platform` targets all supported platforms for both `r2p install` and
|
|
189
|
+
`r2p uninstall`.
|
|
128
190
|
|
|
129
|
-
|
|
191
|
+
`r2p status` is read-only. With `--json`, it reports machine-readable platform
|
|
192
|
+
state, installed version, and manifest issues.
|
|
130
193
|
|
|
131
|
-
|
|
132
|
-
step of running a workflow:
|
|
194
|
+
## How the workflow works
|
|
133
195
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
| `r2p-continue` | Continue the active run — advance it to its next stop (gate, checkpoint, or repair). |
|
|
138
|
-
| `r2p-status` | Inspect the current run, or all runs, read-only. |
|
|
139
|
-
| `r2p-switch` | Point the active run at a different `--work-id`. |
|
|
140
|
-
| `r2p-tier-lock` | Lock the active run's complexity tier (`--base light\|standard`). |
|
|
141
|
-
| `r2p-reopen` | Reopen a closed run from a specific `--stage`. |
|
|
142
|
-
| `r2p-gap-open` | Route an upstream gap on an open run back to its `--owner-stage`; downstream artifacts become stale and must be re-derived. |
|
|
143
|
-
| `r2p-gap-resolve` | Close a gap `--route-id` after the owner stage is re-worked and passes `gate-quality`. |
|
|
196
|
+
Every run lives in `.req-to-plan/<work-id>/` inside the target workspace. The
|
|
197
|
+
agent writes semantic content; the CLI owns state, files, gates, and structured
|
|
198
|
+
validation.
|
|
144
199
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
200
|
+
| Stage | Output |
|
|
201
|
+
|---|---|
|
|
202
|
+
| Raw requirement | Original user requirement |
|
|
203
|
+
| Requirement brief | Scope, goals, non-goals, and acceptance direction |
|
|
204
|
+
| Risk discovery | Unknowns, constraints, dependencies, and risk areas |
|
|
205
|
+
| DESIGN | Technical approach and decision requests |
|
|
206
|
+
| SPEC | Detailed behavior and interfaces |
|
|
207
|
+
| PLAN | Ordered implementation tasks with verification criteria |
|
|
151
208
|
|
|
152
|
-
|
|
209
|
+
Standard-tier DESIGN/SPEC/PLAN stages can require subagent review, especially
|
|
210
|
+
when tier modifiers such as `migration`, `safety`, or `cross_project` are
|
|
211
|
+
present. If a later stage discovers an upstream decision gap, use
|
|
212
|
+
`r2p-gap-open`, repair the owner stage, then close the route with
|
|
213
|
+
`r2p-gap-resolve`.
|
|
153
214
|
|
|
154
|
-
|
|
155
|
-
cover specific situations.
|
|
215
|
+
## Development
|
|
156
216
|
|
|
157
|
-
|
|
217
|
+
Install development dependencies:
|
|
158
218
|
|
|
159
219
|
```bash
|
|
160
|
-
|
|
220
|
+
python3 -m pip install -r requirements-dev.txt
|
|
161
221
|
```
|
|
162
222
|
|
|
163
|
-
|
|
164
|
-
`cross_project` modifiers force a subagent review at the DESIGN / SPEC / PLAN
|
|
165
|
-
checkpoints.
|
|
166
|
-
|
|
167
|
-
**Reopen a closed run** — revisit a run that was closed at the PLAN checkpoint,
|
|
168
|
-
restarting from an earlier stage (this seeds a new linked run):
|
|
223
|
+
Run the test suite:
|
|
169
224
|
|
|
170
225
|
```bash
|
|
171
|
-
|
|
226
|
+
npm test
|
|
227
|
+
# or, when using the checked-in virtual environment:
|
|
228
|
+
npm run test:local
|
|
172
229
|
```
|
|
173
230
|
|
|
174
|
-
|
|
175
|
-
earlier stage owns a wrong or missing decision. `gap-open` sends the run back to
|
|
176
|
-
the owner stage and marks everything downstream stale; after you re-work the
|
|
177
|
-
owner past `gate-quality`, `gap-resolve` closes the route so the owner can be
|
|
178
|
-
re-approved and the downstream re-derived:
|
|
231
|
+
Useful local checks:
|
|
179
232
|
|
|
180
233
|
```bash
|
|
181
|
-
r2p
|
|
182
|
-
|
|
183
|
-
|
|
234
|
+
node bin/r2p.js version
|
|
235
|
+
node bin/r2p.js help
|
|
236
|
+
.venv/bin/python -m tools.workflow_cli --help
|
|
237
|
+
.venv/bin/python -m tools.workflow_cli.agent_shortcuts --help
|
|
184
238
|
```
|
|
185
239
|
|
|
186
|
-
|
|
187
|
-
> Reopen is for a *closed* run; gap routing is for an *open* one. `r2p-continue`
|
|
188
|
-
> walks you through both repair flows with `needs_repair` and `needs_gap_resolve`
|
|
189
|
-
> stops.
|
|
240
|
+
Project layout:
|
|
190
241
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
> `Status: selected` with `Selected:` and `Rationale:` lines.
|
|
199
|
-
> Write exactly `none` in that section when no human decision is needed.
|
|
200
|
-
|
|
201
|
-
## License
|
|
202
|
-
|
|
203
|
-
[MIT](./LICENSE) © xenonbyte
|
|
242
|
+
| Path | Purpose |
|
|
243
|
+
|---|---|
|
|
244
|
+
| `bin/r2p.js` | npm binary that invokes the Python lifecycle CLI |
|
|
245
|
+
| `tools/r2p-*` | installed workflow wrapper scripts |
|
|
246
|
+
| `tools/workflow_cli/` | state machine, gates, templates, installer, and command routing |
|
|
247
|
+
| `tools/workflow_cli/agent_templates/` | generated surfaces for Claude Code, Codex, and Gemini |
|
|
248
|
+
| `tests/` | regression tests for CLI behavior, state, gates, install safety, packaging, and README consistency |
|