rpi-kit 2.2.2 → 2.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/.claude-plugin/marketplace.json +3 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.gemini/commands/opsx/apply.toml +149 -0
- package/.gemini/commands/opsx/archive.toml +154 -0
- package/.gemini/commands/opsx/bulk-archive.toml +239 -0
- package/.gemini/commands/opsx/continue.toml +111 -0
- package/.gemini/commands/opsx/explore.toml +170 -0
- package/.gemini/commands/opsx/ff.toml +94 -0
- package/.gemini/commands/opsx/new.toml +66 -0
- package/.gemini/commands/opsx/onboard.toml +547 -0
- package/.gemini/commands/opsx/propose.toml +103 -0
- package/.gemini/commands/opsx/sync.toml +131 -0
- package/.gemini/commands/opsx/verify.toml +161 -0
- package/.gemini/commands/rpi/archive.toml +140 -0
- package/.gemini/commands/rpi/docs-gen.toml +210 -0
- package/.gemini/commands/rpi/docs.toml +153 -0
- package/.gemini/commands/rpi/evolve.toml +411 -0
- package/.gemini/commands/rpi/fix.toml +290 -0
- package/.gemini/commands/rpi/implement.toml +272 -0
- package/.gemini/commands/rpi/init.toml +180 -0
- package/.gemini/commands/rpi/learn.toml +105 -0
- package/.gemini/commands/rpi/new.toml +158 -0
- package/.gemini/commands/rpi/onboarding.toml +236 -0
- package/.gemini/commands/rpi/party.toml +204 -0
- package/.gemini/commands/rpi/plan.toml +623 -0
- package/.gemini/commands/rpi/research.toml +265 -0
- package/.gemini/commands/rpi/review.toml +443 -0
- package/.gemini/commands/rpi/rpi.toml +114 -0
- package/.gemini/commands/rpi/simplify.toml +214 -0
- package/.gemini/commands/rpi/status.toml +194 -0
- package/.gemini/commands/rpi/update.toml +107 -0
- package/.gemini/skills/openspec-apply-change/SKILL.md +156 -0
- package/.gemini/skills/openspec-archive-change/SKILL.md +114 -0
- package/.gemini/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.gemini/skills/openspec-continue-change/SKILL.md +118 -0
- package/.gemini/skills/openspec-explore/SKILL.md +288 -0
- package/.gemini/skills/openspec-ff-change/SKILL.md +101 -0
- package/.gemini/skills/openspec-new-change/SKILL.md +74 -0
- package/.gemini/skills/openspec-onboard/SKILL.md +554 -0
- package/.gemini/skills/openspec-propose/SKILL.md +110 -0
- package/.gemini/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.gemini/skills/openspec-verify-change/SKILL.md +168 -0
- package/CHANGELOG.md +15 -0
- package/README.md +6 -6
- package/agents/atlas.md +40 -0
- package/agents/clara.md +40 -0
- package/agents/forge.md +40 -0
- package/agents/hawk.md +40 -0
- package/agents/luna.md +40 -0
- package/agents/mestre.md +46 -0
- package/agents/nexus.md +52 -0
- package/agents/pixel.md +40 -0
- package/agents/quill.md +40 -0
- package/agents/razor.md +40 -0
- package/agents/sage.md +46 -0
- package/agents/scout.md +40 -0
- package/agents/shield.md +40 -0
- package/bin/cli.js +60 -18
- package/commands/rpi/docs.md +29 -1
- package/commands/rpi/fix.md +301 -0
- package/commands/rpi/implement.md +37 -0
- package/commands/rpi/plan.md +66 -1
- package/commands/rpi/research.md +48 -1
- package/commands/rpi/review.md +48 -1
- package/commands/rpi/rpi.md +1 -1
- package/commands/rpi/simplify.md +31 -1
- package/commands/rpi/status.md +69 -0
- package/marketplace.json +3 -2
- package/package.json +2 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
description = "Sync delta specs from a change to main specs"
|
|
2
|
+
|
|
3
|
+
prompt = """
|
|
4
|
+
Sync delta specs from a change to main specs.
|
|
5
|
+
|
|
6
|
+
This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
|
|
7
|
+
|
|
8
|
+
**Input**: Optionally specify a change name after `/opsx:sync` (e.g., `/opsx:sync add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
9
|
+
|
|
10
|
+
**Steps**
|
|
11
|
+
|
|
12
|
+
1. **If no change name provided, prompt for selection**
|
|
13
|
+
|
|
14
|
+
Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
|
|
15
|
+
|
|
16
|
+
Show changes that have delta specs (under `specs/` directory).
|
|
17
|
+
|
|
18
|
+
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
|
|
19
|
+
|
|
20
|
+
2. **Find delta specs**
|
|
21
|
+
|
|
22
|
+
Look for delta spec files in `openspec/changes/<name>/specs/*/spec.md`.
|
|
23
|
+
|
|
24
|
+
Each delta spec file contains sections like:
|
|
25
|
+
- `## ADDED Requirements` - New requirements to add
|
|
26
|
+
- `## MODIFIED Requirements` - Changes to existing requirements
|
|
27
|
+
- `## REMOVED Requirements` - Requirements to remove
|
|
28
|
+
- `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
|
|
29
|
+
|
|
30
|
+
If no delta specs found, inform user and stop.
|
|
31
|
+
|
|
32
|
+
3. **For each delta spec, apply changes to main specs**
|
|
33
|
+
|
|
34
|
+
For each capability with a delta spec at `openspec/changes/<name>/specs/<capability>/spec.md`:
|
|
35
|
+
|
|
36
|
+
a. **Read the delta spec** to understand the intended changes
|
|
37
|
+
|
|
38
|
+
b. **Read the main spec** at `openspec/specs/<capability>/spec.md` (may not exist yet)
|
|
39
|
+
|
|
40
|
+
c. **Apply changes intelligently**:
|
|
41
|
+
|
|
42
|
+
**ADDED Requirements:**
|
|
43
|
+
- If requirement doesn't exist in main spec → add it
|
|
44
|
+
- If requirement already exists → update it to match (treat as implicit MODIFIED)
|
|
45
|
+
|
|
46
|
+
**MODIFIED Requirements:**
|
|
47
|
+
- Find the requirement in main spec
|
|
48
|
+
- Apply the changes - this can be:
|
|
49
|
+
- Adding new scenarios (don't need to copy existing ones)
|
|
50
|
+
- Modifying existing scenarios
|
|
51
|
+
- Changing the requirement description
|
|
52
|
+
- Preserve scenarios/content not mentioned in the delta
|
|
53
|
+
|
|
54
|
+
**REMOVED Requirements:**
|
|
55
|
+
- Remove the entire requirement block from main spec
|
|
56
|
+
|
|
57
|
+
**RENAMED Requirements:**
|
|
58
|
+
- Find the FROM requirement, rename to TO
|
|
59
|
+
|
|
60
|
+
d. **Create new main spec** if capability doesn't exist yet:
|
|
61
|
+
- Create `openspec/specs/<capability>/spec.md`
|
|
62
|
+
- Add Purpose section (can be brief, mark as TBD)
|
|
63
|
+
- Add Requirements section with the ADDED requirements
|
|
64
|
+
|
|
65
|
+
4. **Show summary**
|
|
66
|
+
|
|
67
|
+
After applying all changes, summarize:
|
|
68
|
+
- Which capabilities were updated
|
|
69
|
+
- What changes were made (requirements added/modified/removed/renamed)
|
|
70
|
+
|
|
71
|
+
**Delta Spec Format Reference**
|
|
72
|
+
|
|
73
|
+
```markdown
|
|
74
|
+
## ADDED Requirements
|
|
75
|
+
|
|
76
|
+
### Requirement: New Feature
|
|
77
|
+
The system SHALL do something new.
|
|
78
|
+
|
|
79
|
+
#### Scenario: Basic case
|
|
80
|
+
- **WHEN** user does X
|
|
81
|
+
- **THEN** system does Y
|
|
82
|
+
|
|
83
|
+
## MODIFIED Requirements
|
|
84
|
+
|
|
85
|
+
### Requirement: Existing Feature
|
|
86
|
+
#### Scenario: New scenario to add
|
|
87
|
+
- **WHEN** user does A
|
|
88
|
+
- **THEN** system does B
|
|
89
|
+
|
|
90
|
+
## REMOVED Requirements
|
|
91
|
+
|
|
92
|
+
### Requirement: Deprecated Feature
|
|
93
|
+
|
|
94
|
+
## RENAMED Requirements
|
|
95
|
+
|
|
96
|
+
- FROM: `### Requirement: Old Name`
|
|
97
|
+
- TO: `### Requirement: New Name`
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Key Principle: Intelligent Merging**
|
|
101
|
+
|
|
102
|
+
Unlike programmatic merging, you can apply **partial updates**:
|
|
103
|
+
- To add a scenario, just include that scenario under MODIFIED - don't copy existing scenarios
|
|
104
|
+
- The delta represents *intent*, not a wholesale replacement
|
|
105
|
+
- Use your judgment to merge changes sensibly
|
|
106
|
+
|
|
107
|
+
**Output On Success**
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
## Specs Synced: <change-name>
|
|
111
|
+
|
|
112
|
+
Updated main specs:
|
|
113
|
+
|
|
114
|
+
**<capability-1>**:
|
|
115
|
+
- Added requirement: "New Feature"
|
|
116
|
+
- Modified requirement: "Existing Feature" (added 1 scenario)
|
|
117
|
+
|
|
118
|
+
**<capability-2>**:
|
|
119
|
+
- Created new spec file
|
|
120
|
+
- Added requirement: "Another Feature"
|
|
121
|
+
|
|
122
|
+
Main specs are now updated. The change remains active - archive when implementation is complete.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Guardrails**
|
|
126
|
+
- Read both delta and main specs before making changes
|
|
127
|
+
- Preserve existing content not mentioned in delta
|
|
128
|
+
- If something is unclear, ask for clarification
|
|
129
|
+
- Show what you're changing as you go
|
|
130
|
+
- The operation should be idempotent - running twice should give same result
|
|
131
|
+
"""
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
description = "Verify implementation matches change artifacts before archiving"
|
|
2
|
+
|
|
3
|
+
prompt = """
|
|
4
|
+
Verify that an implementation matches the change artifacts (specs, tasks, design).
|
|
5
|
+
|
|
6
|
+
**Input**: Optionally specify a change name after `/opsx:verify` (e.g., `/opsx:verify add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
7
|
+
|
|
8
|
+
**Steps**
|
|
9
|
+
|
|
10
|
+
1. **If no change name provided, prompt for selection**
|
|
11
|
+
|
|
12
|
+
Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
|
|
13
|
+
|
|
14
|
+
Show changes that have implementation tasks (tasks artifact exists).
|
|
15
|
+
Include the schema used for each change if available.
|
|
16
|
+
Mark changes with incomplete tasks as "(In Progress)".
|
|
17
|
+
|
|
18
|
+
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
|
|
19
|
+
|
|
20
|
+
2. **Check status to understand the schema**
|
|
21
|
+
```bash
|
|
22
|
+
openspec status --change "<name>" --json
|
|
23
|
+
```
|
|
24
|
+
Parse the JSON to understand:
|
|
25
|
+
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
|
26
|
+
- Which artifacts exist for this change
|
|
27
|
+
|
|
28
|
+
3. **Get the change directory and load artifacts**
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
openspec instructions apply --change "<name>" --json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This returns the change directory and context files. Read all available artifacts from `contextFiles`.
|
|
35
|
+
|
|
36
|
+
4. **Initialize verification report structure**
|
|
37
|
+
|
|
38
|
+
Create a report structure with three dimensions:
|
|
39
|
+
- **Completeness**: Track tasks and spec coverage
|
|
40
|
+
- **Correctness**: Track requirement implementation and scenario coverage
|
|
41
|
+
- **Coherence**: Track design adherence and pattern consistency
|
|
42
|
+
|
|
43
|
+
Each dimension can have CRITICAL, WARNING, or SUGGESTION issues.
|
|
44
|
+
|
|
45
|
+
5. **Verify Completeness**
|
|
46
|
+
|
|
47
|
+
**Task Completion**:
|
|
48
|
+
- If tasks.md exists in contextFiles, read it
|
|
49
|
+
- Parse checkboxes: `- [ ]` (incomplete) vs `- [x]` (complete)
|
|
50
|
+
- Count complete vs total tasks
|
|
51
|
+
- If incomplete tasks exist:
|
|
52
|
+
- Add CRITICAL issue for each incomplete task
|
|
53
|
+
- Recommendation: "Complete task: <description>" or "Mark as done if already implemented"
|
|
54
|
+
|
|
55
|
+
**Spec Coverage**:
|
|
56
|
+
- If delta specs exist in `openspec/changes/<name>/specs/`:
|
|
57
|
+
- Extract all requirements (marked with "### Requirement:")
|
|
58
|
+
- For each requirement:
|
|
59
|
+
- Search codebase for keywords related to the requirement
|
|
60
|
+
- Assess if implementation likely exists
|
|
61
|
+
- If requirements appear unimplemented:
|
|
62
|
+
- Add CRITICAL issue: "Requirement not found: <requirement name>"
|
|
63
|
+
- Recommendation: "Implement requirement X: <description>"
|
|
64
|
+
|
|
65
|
+
6. **Verify Correctness**
|
|
66
|
+
|
|
67
|
+
**Requirement Implementation Mapping**:
|
|
68
|
+
- For each requirement from delta specs:
|
|
69
|
+
- Search codebase for implementation evidence
|
|
70
|
+
- If found, note file paths and line ranges
|
|
71
|
+
- Assess if implementation matches requirement intent
|
|
72
|
+
- If divergence detected:
|
|
73
|
+
- Add WARNING: "Implementation may diverge from spec: <details>"
|
|
74
|
+
- Recommendation: "Review <file>:<lines> against requirement X"
|
|
75
|
+
|
|
76
|
+
**Scenario Coverage**:
|
|
77
|
+
- For each scenario in delta specs (marked with "#### Scenario:"):
|
|
78
|
+
- Check if conditions are handled in code
|
|
79
|
+
- Check if tests exist covering the scenario
|
|
80
|
+
- If scenario appears uncovered:
|
|
81
|
+
- Add WARNING: "Scenario not covered: <scenario name>"
|
|
82
|
+
- Recommendation: "Add test or implementation for scenario: <description>"
|
|
83
|
+
|
|
84
|
+
7. **Verify Coherence**
|
|
85
|
+
|
|
86
|
+
**Design Adherence**:
|
|
87
|
+
- If design.md exists in contextFiles:
|
|
88
|
+
- Extract key decisions (look for sections like "Decision:", "Approach:", "Architecture:")
|
|
89
|
+
- Verify implementation follows those decisions
|
|
90
|
+
- If contradiction detected:
|
|
91
|
+
- Add WARNING: "Design decision not followed: <decision>"
|
|
92
|
+
- Recommendation: "Update implementation or revise design.md to match reality"
|
|
93
|
+
- If no design.md: Skip design adherence check, note "No design.md to verify against"
|
|
94
|
+
|
|
95
|
+
**Code Pattern Consistency**:
|
|
96
|
+
- Review new code for consistency with project patterns
|
|
97
|
+
- Check file naming, directory structure, coding style
|
|
98
|
+
- If significant deviations found:
|
|
99
|
+
- Add SUGGESTION: "Code pattern deviation: <details>"
|
|
100
|
+
- Recommendation: "Consider following project pattern: <example>"
|
|
101
|
+
|
|
102
|
+
8. **Generate Verification Report**
|
|
103
|
+
|
|
104
|
+
**Summary Scorecard**:
|
|
105
|
+
```
|
|
106
|
+
## Verification Report: <change-name>
|
|
107
|
+
|
|
108
|
+
### Summary
|
|
109
|
+
| Dimension | Status |
|
|
110
|
+
|--------------|------------------|
|
|
111
|
+
| Completeness | X/Y tasks, N reqs|
|
|
112
|
+
| Correctness | M/N reqs covered |
|
|
113
|
+
| Coherence | Followed/Issues |
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Issues by Priority**:
|
|
117
|
+
|
|
118
|
+
1. **CRITICAL** (Must fix before archive):
|
|
119
|
+
- Incomplete tasks
|
|
120
|
+
- Missing requirement implementations
|
|
121
|
+
- Each with specific, actionable recommendation
|
|
122
|
+
|
|
123
|
+
2. **WARNING** (Should fix):
|
|
124
|
+
- Spec/design divergences
|
|
125
|
+
- Missing scenario coverage
|
|
126
|
+
- Each with specific recommendation
|
|
127
|
+
|
|
128
|
+
3. **SUGGESTION** (Nice to fix):
|
|
129
|
+
- Pattern inconsistencies
|
|
130
|
+
- Minor improvements
|
|
131
|
+
- Each with specific recommendation
|
|
132
|
+
|
|
133
|
+
**Final Assessment**:
|
|
134
|
+
- If CRITICAL issues: "X critical issue(s) found. Fix before archiving."
|
|
135
|
+
- If only warnings: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."
|
|
136
|
+
- If all clear: "All checks passed. Ready for archive."
|
|
137
|
+
|
|
138
|
+
**Verification Heuristics**
|
|
139
|
+
|
|
140
|
+
- **Completeness**: Focus on objective checklist items (checkboxes, requirements list)
|
|
141
|
+
- **Correctness**: Use keyword search, file path analysis, reasonable inference - don't require perfect certainty
|
|
142
|
+
- **Coherence**: Look for glaring inconsistencies, don't nitpick style
|
|
143
|
+
- **False Positives**: When uncertain, prefer SUGGESTION over WARNING, WARNING over CRITICAL
|
|
144
|
+
- **Actionability**: Every issue must have a specific recommendation with file/line references where applicable
|
|
145
|
+
|
|
146
|
+
**Graceful Degradation**
|
|
147
|
+
|
|
148
|
+
- If only tasks.md exists: verify task completion only, skip spec/design checks
|
|
149
|
+
- If tasks + specs exist: verify completeness and correctness, skip design
|
|
150
|
+
- If full artifacts: verify all three dimensions
|
|
151
|
+
- Always note which checks were skipped and why
|
|
152
|
+
|
|
153
|
+
**Output Format**
|
|
154
|
+
|
|
155
|
+
Use clear markdown with:
|
|
156
|
+
- Table for summary scorecard
|
|
157
|
+
- Grouped lists for issues (CRITICAL/WARNING/SUGGESTION)
|
|
158
|
+
- Code references in format: `file.ts:123`
|
|
159
|
+
- Specific, actionable recommendations
|
|
160
|
+
- No vague suggestions like "consider reviewing"
|
|
161
|
+
"""
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
description = "Merge delta specs into main specs and clean up the feature directory."
|
|
2
|
+
|
|
3
|
+
prompt = """
|
|
4
|
+
# /rpi:archive — Archive Feature
|
|
5
|
+
|
|
6
|
+
Merge the feature's delta specs into the main `rpi/specs/` directory, preserve any solutions worth saving, and delete the feature directory. History is preserved in git.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Step 1: Load config and validate
|
|
11
|
+
|
|
12
|
+
1. Read `.rpi.yaml` for config. Apply defaults if missing:
|
|
13
|
+
- `folder`: `rpi/features`
|
|
14
|
+
- `specs_dir`: `rpi/specs`
|
|
15
|
+
- `solutions_dir`: `rpi/solutions`
|
|
16
|
+
2. Parse `$ARGUMENTS` to extract `{slug}`.
|
|
17
|
+
3. Validate `rpi/features/{slug}/` exists. If not:
|
|
18
|
+
```
|
|
19
|
+
Feature '{slug}' not found. Nothing to archive.
|
|
20
|
+
```
|
|
21
|
+
Stop.
|
|
22
|
+
|
|
23
|
+
## Step 2: Validate review verdict
|
|
24
|
+
|
|
25
|
+
1. Read `rpi/features/{slug}/implement/IMPLEMENT.md`.
|
|
26
|
+
2. Look for a `## Review` section with a verdict of `PASS` or `PASS with concerns`.
|
|
27
|
+
3. If verdict is `FAIL`:
|
|
28
|
+
```
|
|
29
|
+
Review verdict is FAIL for '{slug}'.
|
|
30
|
+
Fix the issues and re-run: /rpi:review {slug}
|
|
31
|
+
Cannot archive a feature that hasn't passed review.
|
|
32
|
+
```
|
|
33
|
+
Stop.
|
|
34
|
+
4. If no review section or verdict is found:
|
|
35
|
+
```
|
|
36
|
+
No review verdict found for '{slug}'.
|
|
37
|
+
Run /rpi:review {slug} before archiving.
|
|
38
|
+
```
|
|
39
|
+
Stop.
|
|
40
|
+
|
|
41
|
+
## Step 3: Read delta contents
|
|
42
|
+
|
|
43
|
+
1. Scan `rpi/features/{slug}/delta/ADDED/` for all files — store as `$ADDED_FILES`.
|
|
44
|
+
2. Scan `rpi/features/{slug}/delta/MODIFIED/` for all files — store as `$MODIFIED_FILES`.
|
|
45
|
+
3. Scan `rpi/features/{slug}/delta/REMOVED/` for all files — store as `$REMOVED_FILES`.
|
|
46
|
+
4. Read the contents of each file found.
|
|
47
|
+
|
|
48
|
+
If all three directories are empty:
|
|
49
|
+
```
|
|
50
|
+
No delta specs found for '{slug}'. Skipping specs merge.
|
|
51
|
+
```
|
|
52
|
+
Proceed to Step 5.
|
|
53
|
+
|
|
54
|
+
## Step 4: Launch Nexus to merge delta into specs
|
|
55
|
+
|
|
56
|
+
Use the Agent tool to launch Nexus for the merge:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
You are Nexus. Merge the delta specs for feature '{slug}' into the main specs directory.
|
|
60
|
+
|
|
61
|
+
## ADDED Files (copy to rpi/specs/)
|
|
62
|
+
{for each file in $ADDED_FILES: filename and full contents}
|
|
63
|
+
|
|
64
|
+
## MODIFIED Files (apply changes to existing rpi/specs/ files)
|
|
65
|
+
{for each file in $MODIFIED_FILES: filename, delta contents, and current contents of the target spec file in rpi/specs/}
|
|
66
|
+
|
|
67
|
+
## REMOVED Files (delete from rpi/specs/)
|
|
68
|
+
{for each file in $REMOVED_FILES: filename}
|
|
69
|
+
|
|
70
|
+
Your task:
|
|
71
|
+
1. For each ADDED file: determine the correct path under rpi/specs/ and write the file there.
|
|
72
|
+
- Use the file's content as-is. Preserve the directory structure (e.g. delta/ADDED/auth/oauth.md → rpi/specs/auth/oauth.md).
|
|
73
|
+
2. For each MODIFIED file: read the current spec at rpi/specs/{path}, apply the changes from the delta version.
|
|
74
|
+
- The delta file contains the updated version of the spec. Merge it intelligently:
|
|
75
|
+
- Preserve any sections in the original that aren't addressed by the delta
|
|
76
|
+
- Update sections that the delta modifies
|
|
77
|
+
- Add new sections from the delta
|
|
78
|
+
3. For each REMOVED file: note the path under rpi/specs/ that should be deleted.
|
|
79
|
+
|
|
80
|
+
Output format:
|
|
81
|
+
## Merge Plan
|
|
82
|
+
### Files to Write
|
|
83
|
+
- {path}: {action: created | updated} — {brief description}
|
|
84
|
+
|
|
85
|
+
### Files to Delete
|
|
86
|
+
- {path} — {reason}
|
|
87
|
+
|
|
88
|
+
### Warnings
|
|
89
|
+
- {any conflicts or issues detected}
|
|
90
|
+
(or "No warnings.")
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Store the output as `$NEXUS_MERGE`.
|
|
94
|
+
|
|
95
|
+
After Nexus responds, execute the merge plan:
|
|
96
|
+
1. **ADDED**: Write each file to `rpi/specs/{path}` (create directories as needed).
|
|
97
|
+
2. **MODIFIED**: Write the merged content to `rpi/specs/{path}`.
|
|
98
|
+
3. **REMOVED**: Delete the files from `rpi/specs/`.
|
|
99
|
+
|
|
100
|
+
## Step 5: Check for solutions worth saving
|
|
101
|
+
|
|
102
|
+
1. Read `rpi/features/{slug}/implement/IMPLEMENT.md` for the review section.
|
|
103
|
+
2. If the review flagged solutions saved to `rpi/solutions/`:
|
|
104
|
+
- Verify each referenced solution file exists in `rpi/solutions/`.
|
|
105
|
+
- If any are missing, warn:
|
|
106
|
+
```
|
|
107
|
+
Warning: Solution '{path}' referenced in review but not found.
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Step 6: Delete feature directory
|
|
111
|
+
|
|
112
|
+
Remove the entire feature directory:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
rm -rf rpi/features/{slug}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Step 7: Commit
|
|
119
|
+
|
|
120
|
+
Stage all changes and commit:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
git add -A
|
|
124
|
+
git commit -m "chore: archive {slug} — delta merged, feature complete"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Step 8: Output summary
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
Archive complete: {slug}
|
|
131
|
+
|
|
132
|
+
Specs merged:
|
|
133
|
+
- Added: {N} files
|
|
134
|
+
- Modified: {N} files
|
|
135
|
+
- Removed: {N} files
|
|
136
|
+
|
|
137
|
+
Feature directory deleted: rpi/features/{slug}/
|
|
138
|
+
History preserved in git.
|
|
139
|
+
```
|
|
140
|
+
"""
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
description = "Analyze the codebase and generate a CLAUDE.md with project rules, conventions, and architecture."
|
|
2
|
+
|
|
3
|
+
prompt = """
|
|
4
|
+
# /rpi:docs-gen — Generate CLAUDE.md
|
|
5
|
+
|
|
6
|
+
Standalone utility command — uses Atlas for codebase analysis and Quill for writing. Does not require the RPI feature pipeline.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Step 1: Load config
|
|
11
|
+
|
|
12
|
+
Read `.rpi.yaml` from the project root. Extract:
|
|
13
|
+
- `commit_style` (default: `conventional`)
|
|
14
|
+
|
|
15
|
+
If `.rpi.yaml` does not exist, use defaults silently.
|
|
16
|
+
|
|
17
|
+
## Step 2: Check for existing CLAUDE.md
|
|
18
|
+
|
|
19
|
+
Check if `CLAUDE.md` exists at the project root.
|
|
20
|
+
|
|
21
|
+
- If it exists: read it and store as `$EXISTING_CLAUDE_MD`. Proceed to Step 3.
|
|
22
|
+
- If it does not exist: set `$EXISTING_CLAUDE_MD` to empty. Skip to Step 4.
|
|
23
|
+
|
|
24
|
+
## Step 3: Handle existing CLAUDE.md
|
|
25
|
+
|
|
26
|
+
Ask with AskUserQuestion:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
CLAUDE.md already exists ({line_count} lines). What would you like to do?
|
|
30
|
+
A) Overwrite — generate a new CLAUDE.md from scratch (existing content will be replaced)
|
|
31
|
+
B) Cancel — keep the existing file unchanged
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- If A (overwrite): proceed to Step 4.
|
|
35
|
+
- If B (cancel): output "No changes made." and stop.
|
|
36
|
+
|
|
37
|
+
## Step 4: Launch Atlas for codebase analysis
|
|
38
|
+
|
|
39
|
+
Launch Atlas agent with the following prompt:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
You are Atlas. Analyze this entire codebase and produce a structured analysis for generating a CLAUDE.md file.
|
|
43
|
+
|
|
44
|
+
Your task:
|
|
45
|
+
1. Read config files first: package.json, tsconfig.json, pyproject.toml, Cargo.toml, go.mod, Gemfile, composer.json, Makefile, Dockerfile, or whatever exists
|
|
46
|
+
2. Scan the directory structure to understand architecture and layering
|
|
47
|
+
3. Find 5-10 representative source files across different directories
|
|
48
|
+
4. Detect naming conventions, component patterns, import style, error handling
|
|
49
|
+
5. Check for existing CLAUDE.md, .cursorrules, .clinerules, or similar project rules files — if found, note their content for reference
|
|
50
|
+
6. Identify the testing framework and test patterns
|
|
51
|
+
7. Identify styling/CSS approach if frontend
|
|
52
|
+
8. List the 10-15 most important files in the project with one-line descriptions
|
|
53
|
+
9. Detect useful developer commands: scripts in package.json, Makefile targets, common commands for running, testing, building, linting
|
|
54
|
+
|
|
55
|
+
Produce your analysis with this EXACT structure:
|
|
56
|
+
|
|
57
|
+
## Stack
|
|
58
|
+
- Language: {language} {version}
|
|
59
|
+
- Framework: {framework} {version}
|
|
60
|
+
- Database: {db} via {orm} (or "None detected")
|
|
61
|
+
- Testing: {test_framework}
|
|
62
|
+
- Styling: {approach} (or "N/A")
|
|
63
|
+
- Build: {build_tool}
|
|
64
|
+
- Package Manager: {package_manager}
|
|
65
|
+
|
|
66
|
+
## Architecture
|
|
67
|
+
- Pattern: {description — e.g., "layered MVC", "monorepo with packages/", "plugin system"}
|
|
68
|
+
- Key directories:
|
|
69
|
+
- {directory}: {purpose}
|
|
70
|
+
- {directory}: {purpose}
|
|
71
|
+
- ...
|
|
72
|
+
- Entry points: {list}
|
|
73
|
+
|
|
74
|
+
## Conventions
|
|
75
|
+
- File naming: {pattern — e.g., "kebab-case.ts", "PascalCase.tsx for components"}
|
|
76
|
+
- Components: {pattern} (or "N/A")
|
|
77
|
+
- Import style: {pattern — e.g., "absolute imports via @/", "relative imports"}
|
|
78
|
+
- Error handling: {pattern — e.g., "try/catch with custom AppError class", "Result types"}
|
|
79
|
+
- API: {pattern} (or "N/A")
|
|
80
|
+
- Commits: {pattern detected from git log — e.g., "conventional commits", "freeform"}
|
|
81
|
+
|
|
82
|
+
## Key Files
|
|
83
|
+
- {file}: {one-line description}
|
|
84
|
+
- {file}: {one-line description}
|
|
85
|
+
- ...
|
|
86
|
+
|
|
87
|
+
## Commands
|
|
88
|
+
- {command}: {what it does}
|
|
89
|
+
- {command}: {what it does}
|
|
90
|
+
- ...
|
|
91
|
+
|
|
92
|
+
## Rules
|
|
93
|
+
- {rule 1 derived from codebase analysis or existing rules files}
|
|
94
|
+
- {rule 2}
|
|
95
|
+
- ...
|
|
96
|
+
|
|
97
|
+
RULES:
|
|
98
|
+
- Be specific — cite actual patterns you found, not generic advice
|
|
99
|
+
- Only include what you can verify from the code
|
|
100
|
+
- If a section doesn't apply (e.g., no database), write "N/A" and move on
|
|
101
|
+
- Keep each section concise
|
|
102
|
+
- For Rules: derive actionable rules from what you observed, not generic software engineering advice
|
|
103
|
+
- If you found an existing CLAUDE.md or similar rules file, incorporate its rules (they are the team's explicit preferences)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Wait for Atlas to complete. Store the output as `$ATLAS_ANALYSIS`.
|
|
107
|
+
|
|
108
|
+
## Step 5: Launch Quill to generate CLAUDE.md
|
|
109
|
+
|
|
110
|
+
Launch Quill agent with the following prompt:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
You are Quill. Generate a CLAUDE.md file for this project based on the codebase analysis below.
|
|
114
|
+
|
|
115
|
+
## Codebase Analysis (from Atlas)
|
|
116
|
+
{$ATLAS_ANALYSIS}
|
|
117
|
+
|
|
118
|
+
## Project Config
|
|
119
|
+
- Commit style: {commit_style from .rpi.yaml or "conventional"}
|
|
120
|
+
|
|
121
|
+
{If $EXISTING_CLAUDE_MD is not empty:}
|
|
122
|
+
## Previous CLAUDE.md (being replaced)
|
|
123
|
+
{$EXISTING_CLAUDE_MD}
|
|
124
|
+
Note: The user chose to overwrite. You may incorporate relevant rules from the previous version if they are still valid based on Atlas's analysis.
|
|
125
|
+
{End if}
|
|
126
|
+
|
|
127
|
+
Your task: generate a complete CLAUDE.md file. Output only the file content — the command will handle writing to disk after user confirmation.
|
|
128
|
+
|
|
129
|
+
Target structure:
|
|
130
|
+
|
|
131
|
+
# Project Rules
|
|
132
|
+
|
|
133
|
+
## Behavior
|
|
134
|
+
{3-6 rules about development behavior: how to handle errors, when to ask vs assume, commit practices.
|
|
135
|
+
Derive these from the codebase analysis — e.g., if conventional commits are used, state it.
|
|
136
|
+
If an existing CLAUDE.md had behavior rules, preserve the ones still relevant.}
|
|
137
|
+
|
|
138
|
+
## Code
|
|
139
|
+
{3-6 rules about code style: naming, patterns, imports, error handling.
|
|
140
|
+
These come directly from Atlas's Conventions section.
|
|
141
|
+
Be specific — "Use kebab-case for file names" not "Follow naming conventions."}
|
|
142
|
+
|
|
143
|
+
## Stack
|
|
144
|
+
{Direct copy of Atlas's Stack section, formatted as a concise list.}
|
|
145
|
+
|
|
146
|
+
## Architecture
|
|
147
|
+
{Direct copy of Atlas's Architecture section.
|
|
148
|
+
Include directory map with purposes.}
|
|
149
|
+
|
|
150
|
+
## Conventions
|
|
151
|
+
{Merge of Atlas's Conventions section with any additional patterns.
|
|
152
|
+
Focus on things another developer or AI assistant would need to know to write consistent code.}
|
|
153
|
+
|
|
154
|
+
## Commands
|
|
155
|
+
{Useful developer commands from Atlas's Commands section.
|
|
156
|
+
Format: `command` — description
|
|
157
|
+
Include: run, test, build, lint, format, deploy — whatever exists.}
|
|
158
|
+
|
|
159
|
+
Rules for writing:
|
|
160
|
+
- Every rule must be actionable — "Use X" not "Consider X"
|
|
161
|
+
- No generic software engineering advice — only project-specific rules
|
|
162
|
+
- If a convention is obvious from the language/framework default, omit it
|
|
163
|
+
- Keep the file under 80 lines total — CLAUDE.md is read on every AI invocation, brevity matters
|
|
164
|
+
- Match the tone of existing project documentation if any exists
|
|
165
|
+
- If the code says WHAT, the docs should say WHY
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Wait for Quill to complete. Store the output as `$CLAUDE_MD_CONTENT`.
|
|
169
|
+
|
|
170
|
+
## Step 6: Preview and confirm
|
|
171
|
+
|
|
172
|
+
Output the generated content to the user:
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
Generated CLAUDE.md preview:
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
{$CLAUDE_MD_CONTENT}
|
|
179
|
+
---
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Ask with AskUserQuestion:
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
Write this to CLAUDE.md at the project root?
|
|
186
|
+
A) Yes — write the file
|
|
187
|
+
B) No — discard (you can copy the content above manually if you want)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
- If A (yes): proceed to Step 7.
|
|
191
|
+
- If B (no): output "No changes made." and stop.
|
|
192
|
+
|
|
193
|
+
## Step 7: Write CLAUDE.md
|
|
194
|
+
|
|
195
|
+
Write `$CLAUDE_MD_CONTENT` to `CLAUDE.md` at the project root.
|
|
196
|
+
|
|
197
|
+
## Step 8: Output summary
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
CLAUDE.md generated ({line_count} lines)
|
|
201
|
+
|
|
202
|
+
Sections: Behavior, Code, Stack, Architecture, Conventions, Commands
|
|
203
|
+
|
|
204
|
+
{If $EXISTING_CLAUDE_MD was not empty:}
|
|
205
|
+
Previous CLAUDE.md was replaced.
|
|
206
|
+
{End if}
|
|
207
|
+
|
|
208
|
+
Tip: Review and edit CLAUDE.md to add project-specific rules that automated analysis might miss.
|
|
209
|
+
```
|
|
210
|
+
"""
|