specrails-core 4.11.3 → 5.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.
- package/README.md +96 -89
- package/bin/specrails-core.mjs +282 -39
- package/bin/tui-installer.mjs +117 -149
- package/commands/doctor.md +1 -1
- package/dist/installer/cli.js +13 -3
- package/dist/installer/cli.js.map +1 -1
- package/dist/installer/commands/doctor.js +487 -27
- package/dist/installer/commands/doctor.js.map +1 -1
- package/dist/installer/commands/framework.js +49 -7
- package/dist/installer/commands/framework.js.map +1 -1
- package/dist/installer/commands/init.js +443 -41
- package/dist/installer/commands/init.js.map +1 -1
- package/dist/installer/commands/update.js +51 -23
- package/dist/installer/commands/update.js.map +1 -1
- package/dist/installer/commands/v5-migration.js +119 -0
- package/dist/installer/commands/v5-migration.js.map +1 -0
- package/dist/installer/phases/framework-lifecycle.js +125 -0
- package/dist/installer/phases/framework-lifecycle.js.map +1 -0
- package/dist/installer/phases/install-config.js +160 -11
- package/dist/installer/phases/install-config.js.map +1 -1
- package/dist/installer/phases/manifest.js +29 -8
- package/dist/installer/phases/manifest.js.map +1 -1
- package/dist/installer/phases/prereqs.js +57 -3
- package/dist/installer/phases/prereqs.js.map +1 -1
- package/dist/installer/phases/provider-detect.js +116 -6
- package/dist/installer/phases/provider-detect.js.map +1 -1
- package/dist/installer/phases/scaffold.js +1217 -117
- package/dist/installer/phases/scaffold.js.map +1 -1
- package/dist/installer/runtime/kimi.js +255 -0
- package/dist/installer/runtime/kimi.js.map +1 -0
- package/dist/installer/util/paths.js +12 -0
- package/dist/installer/util/paths.js.map +1 -1
- package/dist/installer/util/registry.js +234 -14
- package/dist/installer/util/registry.js.map +1 -1
- package/docs/README.md +1 -0
- package/docs/deployment.md +6 -7
- package/docs/getting-started.md +11 -7
- package/docs/installation.md +34 -16
- package/docs/plugin-architecture.md +11 -8
- package/docs/updating.md +21 -3
- package/docs/user-docs/cli-reference.md +43 -22
- package/docs/user-docs/codex-vs-claude-code.md +11 -9
- package/docs/user-docs/faq.md +1 -1
- package/docs/user-docs/getting-started-codex.md +5 -8
- package/docs/user-docs/getting-started-kimi.md +423 -0
- package/docs/user-docs/installation.md +49 -14
- package/docs/user-docs/quick-start.md +11 -8
- package/docs/windows.md +29 -4
- package/integration-contract.json +85 -13
- package/package.json +9 -5
- package/schemas/profile.v1.json +68 -6
- package/templates/agents/sr-architect.md +30 -0
- package/templates/agents/sr-developer.md +21 -8
- package/templates/agents/sr-reviewer.md +44 -31
- package/templates/codex-skills/batch-implement/SKILL.md +9 -32
- package/templates/codex-skills/implement/SKILL.md +61 -143
- package/templates/codex-skills/rails/sr-architect/SKILL.md +38 -20
- package/templates/codex-skills/rails/sr-developer/SKILL.md +29 -10
- package/templates/codex-skills/rails/sr-reviewer/SKILL.md +21 -10
- package/templates/commands/specrails/doctor.md +1 -1
- package/templates/commands/specrails/implement.md +117 -288
- package/templates/commands/specrails/memory-inspect.md +6 -4
- package/templates/commands/specrails/propose-spec.md +1 -1
- package/templates/commands/specrails/refactor-recommender.md +8 -51
- package/templates/commands/specrails/retry.md +12 -48
- package/templates/commands/specrails/telemetry.md +1 -1
- package/templates/gemini-commands/implement.toml +9 -0
- package/templates/kimi/specrails/run-skill.mjs +3005 -0
- package/templates/kimi/specrails/vendor/js-yaml/LICENSE +21 -0
- package/templates/kimi/specrails/vendor/js-yaml/NOTICE.md +16 -0
- package/templates/kimi/specrails/vendor/js-yaml/js-yaml.mjs +3856 -0
- package/templates/profiles/default.json +5 -18
- package/templates/profiles/kimi-default.json +15 -0
- package/commands/enrich.md +0 -1456
- package/templates/agents/sr-backend-developer.md +0 -91
- package/templates/agents/sr-backend-reviewer.md +0 -152
- package/templates/agents/sr-doc-sync.md +0 -247
- package/templates/agents/sr-frontend-developer.md +0 -85
- package/templates/agents/sr-frontend-reviewer.md +0 -145
- package/templates/agents/sr-merge-resolver.md +0 -195
- package/templates/agents/sr-performance-reviewer.md +0 -186
- package/templates/agents/sr-product-analyst.md +0 -36
- package/templates/agents/sr-product-manager.md +0 -148
- package/templates/agents/sr-security-reviewer.md +0 -191
- package/templates/agents/sr-test-writer.md +0 -176
- package/templates/codex-skills/enrich/SKILL.md +0 -191
- package/templates/codex-skills/merge-resolve/SKILL.md +0 -88
- package/templates/codex-skills/rails/sr-backend-developer/SKILL.md +0 -93
- package/templates/codex-skills/rails/sr-backend-reviewer/SKILL.md +0 -120
- package/templates/codex-skills/rails/sr-doc-sync/SKILL.md +0 -124
- package/templates/codex-skills/rails/sr-frontend-developer/SKILL.md +0 -106
- package/templates/codex-skills/rails/sr-frontend-reviewer/SKILL.md +0 -111
- package/templates/codex-skills/rails/sr-merge-resolver/SKILL.md +0 -156
- package/templates/codex-skills/rails/sr-performance-reviewer/SKILL.md +0 -109
- package/templates/codex-skills/rails/sr-product-analyst/SKILL.md +0 -85
- package/templates/codex-skills/rails/sr-product-manager/SKILL.md +0 -131
- package/templates/codex-skills/rails/sr-security-reviewer/SKILL.md +0 -121
- package/templates/codex-skills/rails/sr-test-writer/SKILL.md +0 -115
- package/templates/commands/specrails/auto-propose-backlog-specs.md +0 -312
- package/templates/commands/specrails/enrich.md +0 -1456
- package/templates/commands/specrails/get-backlog-specs.md +0 -226
- package/templates/commands/specrails/merge-resolve.md +0 -172
- package/templates/commands/specrails/reconfig.md +0 -80
- package/templates/commands/specrails/vpc-drift.md +0 -405
- package/templates/commands/test.md +0 -58
- package/templates/personas/persona.md +0 -43
- package/templates/personas/the-maintainer.md +0 -98
- package/templates/settings/perf-thresholds.yml +0 -25
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: "Product Backlog"
|
|
3
|
-
description: "View product-driven backlog from GitHub Issues and propose top 3 for implementation"
|
|
4
|
-
category: Workflow
|
|
5
|
-
tags: [workflow, backlog, viewer, product-driven]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
Display the product-driven backlog by reading issues/tickets from the configured backlog provider ({{BACKLOG_PROVIDER_NAME}}). These are feature ideas generated through VPC-based product discovery — evaluated against user personas. Use `/specrails:auto-propose-backlog-specs` to generate new ideas.
|
|
9
|
-
|
|
10
|
-
**Input:** $ARGUMENTS (optional: comma-separated areas to filter. If empty, show all.)
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Phase 0: Environment Pre-flight
|
|
15
|
-
|
|
16
|
-
Verify the backlog provider is accessible:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
{{BACKLOG_PREFLIGHT}}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
If the backlog provider is unavailable, stop and inform the user.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## Execution
|
|
27
|
-
|
|
28
|
-
Launch a **single** sr-product-analyst agent (`subagent_type: sr-product-analyst`) to read and prioritize the backlog.
|
|
29
|
-
|
|
30
|
-
The product-analyst receives this prompt:
|
|
31
|
-
|
|
32
|
-
> You are reading the product-driven backlog from {{BACKLOG_PROVIDER_NAME}} and producing a prioritized view.
|
|
33
|
-
|
|
34
|
-
1. **Fetch all open product-driven backlog items:**
|
|
35
|
-
```bash
|
|
36
|
-
{{BACKLOG_FETCH_CMD}}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
2. **Parse each issue/ticket** to extract metadata from the body:
|
|
40
|
-
- **Area**: from `area:*` label
|
|
41
|
-
- **Persona Fit**: from the body's Overview table — extract per-persona scores and total
|
|
42
|
-
- **Effort**: from the body's Overview table (High/Medium/Low)
|
|
43
|
-
- **Description**: from the body's "Feature Description" section
|
|
44
|
-
- **User Story**: from the body's "User Story" section
|
|
45
|
-
|
|
46
|
-
3. **Parse prerequisites for each issue:**
|
|
47
|
-
- Locate the row whose first cell matches `**Prerequisites**` in the issue body's Overview table.
|
|
48
|
-
- If the cell value is `None`, `-`, or empty: set `prereqs = []` for this issue.
|
|
49
|
-
- Otherwise: extract all tokens matching `#\d+` from the cell and set `prereqs = [<numbers>]`.
|
|
50
|
-
- If a prerequisite number does not appear in the fetched issue list, treat it as already satisfied (externally closed). Do not include it in the DAG.
|
|
51
|
-
|
|
52
|
-
4. **Build dependency graph and detect cycles:**
|
|
53
|
-
- Construct a directed graph where edge `(A → B)` means "issue A must complete before issue B".
|
|
54
|
-
- For each issue with a non-empty `prereqs` list, add an edge from each prerequisite to the issue.
|
|
55
|
-
- Run depth-first cycle detection:
|
|
56
|
-
- Maintain `visited` and `rec_stack` sets.
|
|
57
|
-
- For each unvisited node, run DFS. If a node in `rec_stack` is encountered, a cycle exists.
|
|
58
|
-
- Collect all cycle members into `CYCLE_MEMBERS`.
|
|
59
|
-
- If `CYCLE_MEMBERS` is non-empty, prepare a warning block to render before the backlog table:
|
|
60
|
-
```
|
|
61
|
-
> **Warning: Circular dependency detected in backlog.**
|
|
62
|
-
> The following issues form a cycle and cannot be safely ordered:
|
|
63
|
-
> #A -> #B -> #A
|
|
64
|
-
> Review these issues and correct the Prerequisites fields.
|
|
65
|
-
```
|
|
66
|
-
- Compute `in_degree[issue]` for all issues (count of prerequisite edges pointing to each issue from other open backlog issues).
|
|
67
|
-
|
|
68
|
-
5. **Compute safe implementation order (Kahn's topological sort):**
|
|
69
|
-
- Exclude `CYCLE_MEMBERS` from this computation.
|
|
70
|
-
- Initialize `ready` = all non-cycle issues where `in_degree == 0`.
|
|
71
|
-
- Sort `ready` by Total Persona Score descending.
|
|
72
|
-
- Build `WAVES = []`:
|
|
73
|
-
```
|
|
74
|
-
while ready is non-empty:
|
|
75
|
-
WAVES.append(copy of ready)
|
|
76
|
-
next_ready = []
|
|
77
|
-
for each issue in ready:
|
|
78
|
-
for each dependent D of issue (edges issue → D):
|
|
79
|
-
in_degree[D] -= 1
|
|
80
|
-
if in_degree[D] == 0: next_ready.append(D)
|
|
81
|
-
sort next_ready by Total Persona Score descending
|
|
82
|
-
ready = next_ready
|
|
83
|
-
```
|
|
84
|
-
- Store `WAVE_1 = WAVES[0]` (the set of immediately startable features).
|
|
85
|
-
|
|
86
|
-
6. **Group by area**.
|
|
87
|
-
|
|
88
|
-
7. **Sort within each area by Total Persona Score (descending)**, then by Effort (Low > Medium > High) as tiebreaker.
|
|
89
|
-
|
|
90
|
-
8. **Display** as a formatted table per area, then **propose the top 3 items from `WAVE_1`** (features with all prerequisites satisfied) for implementation. If fewer than 3 are in `WAVE_1`, show as many as available and add: "Note: Only {N} feature(s) are available to start immediately — remaining features have unmet prerequisites."
|
|
91
|
-
|
|
92
|
-
[If `CYCLE_MEMBERS` is non-empty, render the cycle warning block immediately before the first area table.]
|
|
93
|
-
|
|
94
|
-
Render each area table with the following format:
|
|
95
|
-
- Append `[blocked]` to the issue title cell if `in_degree[issue] > 0` and the issue is not in `CYCLE_MEMBERS`.
|
|
96
|
-
- Append `[cycle]` to the issue title cell if the issue is in `CYCLE_MEMBERS`.
|
|
97
|
-
- `Prereqs` cell: list prerequisite issue numbers as `#N, #M`, or `—` if none.
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
## Product-Driven Backlog
|
|
101
|
-
|
|
102
|
-
{N} open issues | Source: VPC-based product discovery
|
|
103
|
-
Personas: {{PERSONA_NAMES_WITH_ROLES}}
|
|
104
|
-
|
|
105
|
-
### {Area Name}
|
|
106
|
-
|
|
107
|
-
| # | Issue | {{PERSONA_SCORE_HEADERS}} | Total | Effort | Prereqs |
|
|
108
|
-
|---|-------|{{PERSONA_SCORE_SEPARATORS}}|-------|--------|---------|
|
|
109
|
-
| 1 | #42 Feature name [blocked] | ... | X/{{MAX_SCORE}} | Low | #12, #17 |
|
|
110
|
-
| 2 | #43 Other feature | ... | X/{{MAX_SCORE}} | High | — |
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
## Recommended Next Sprint (Top 3)
|
|
115
|
-
|
|
116
|
-
Ranked by VPC persona score / effort ratio:
|
|
117
|
-
|
|
118
|
-
| Priority | Issue | Area | {{PERSONA_SCORE_HEADERS}} | Total | Effort | Rationale |
|
|
119
|
-
|----------|-------|------|{{PERSONA_SCORE_SEPARATORS}}|-------|--------|-----------|
|
|
120
|
-
|
|
121
|
-
### Selection criteria
|
|
122
|
-
- Cross-persona features (both 4+/5) prioritized over single-persona
|
|
123
|
-
- Low effort preferred over high effort at same score
|
|
124
|
-
- Critical pain relief weighted higher than gain creation
|
|
125
|
-
|
|
126
|
-
Run `/specrails:implement` to start implementing these items.
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
9. **Render Safe Implementation Order section** after the Recommended Next Sprint table:
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Safe Implementation Order
|
|
135
|
-
|
|
136
|
-
Features grouped by wave. All features in a wave can start in parallel.
|
|
137
|
-
Features in wave N must complete before wave N+1 begins.
|
|
138
|
-
|
|
139
|
-
| Wave | Issue | Title | Prereqs | Score | Effort |
|
|
140
|
-
|------|-------|-------|---------|-------|--------|
|
|
141
|
-
| 1 | #N | ... | — | X/{{MAX_SCORE}} | Low |
|
|
142
|
-
| 2 | #M | ... | #N | X/{{MAX_SCORE}} | Medium |
|
|
143
|
-
|
|
144
|
-
To implement in this order:
|
|
145
|
-
/specrails:batch-implement <issue-refs in wave order> --deps "<A> -> <B>, <C> -> <D>, ..."
|
|
146
|
-
|
|
147
|
-
[If no edges exist in the DAG, omit the --deps clause:]
|
|
148
|
-
/specrails:batch-implement <issue-refs>
|
|
149
|
-
|
|
150
|
-
[If CYCLE_MEMBERS is non-empty, append:]
|
|
151
|
-
Cycle members excluded from ordering: #A, #B
|
|
152
|
-
Fix the Prerequisites fields in these issues to include them.
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Issue refs in the `/specrails:batch-implement` command are listed in wave order (wave 1 first, then wave 2, etc.), sorted by persona score within each wave. The `--deps` string is constructed from all edges in the DAG: `"A -> B"` for each edge, comma-separated. If the backlog has no dependencies at all (DAG has no edges), the section still renders showing all features in wave 1 and the `--deps` clause is omitted.
|
|
156
|
-
|
|
157
|
-
10. If no issues exist:
|
|
158
|
-
```
|
|
159
|
-
No product-driven backlog issues found. Run `/specrails:auto-propose-backlog-specs` to generate feature ideas.
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
7. **[Orchestrator]** After the product-analyst completes, write issue snapshots to `.claude/backlog-cache.json`.
|
|
163
|
-
|
|
164
|
-
#### If provider=local — Cache from Local Tickets
|
|
165
|
-
|
|
166
|
-
Read `.specrails/local-tickets.json` and parse the `tickets` map. For each ticket with `"product-driven-backlog"` in its `labels` array and `status` not `"cancelled"`, build a snapshot object:
|
|
167
|
-
- `number`: ticket `id` (integer)
|
|
168
|
-
- `title`: ticket `title` string
|
|
169
|
-
- `state`: map ticket `status` — `"done"` or `"cancelled"` → `"closed"`, otherwise → `"open"`
|
|
170
|
-
- `assignees`: `[ticket.assignee]` if non-null, else `[]`
|
|
171
|
-
- `labels`: ticket `labels` array, sorted alphabetically
|
|
172
|
-
- `body_sha`: SHA-256 of the ticket `description` string — compute with:
|
|
173
|
-
```bash
|
|
174
|
-
echo -n "{description}" | sha256sum | cut -d' ' -f1
|
|
175
|
-
```
|
|
176
|
-
If `sha256sum` is not available, fall back to `openssl dgst -sha256 -r` or `shasum -a 256`.
|
|
177
|
-
- `updated_at`: ticket `updated_at` value
|
|
178
|
-
- `captured_at`: current local time in ISO 8601 format
|
|
179
|
-
|
|
180
|
-
Write to `.claude/backlog-cache.json` with:
|
|
181
|
-
- `schema_version`: `"1"`
|
|
182
|
-
- `provider`: `"local"`
|
|
183
|
-
- `last_updated`: current ISO 8601 timestamp
|
|
184
|
-
- `written_by`: `"get-backlog-specs"`
|
|
185
|
-
- `issues`: the map keyed by string ticket ID
|
|
186
|
-
|
|
187
|
-
If the write fails: print `[backlog-cache] Warning: could not write cache. Continuing.` Do not abort.
|
|
188
|
-
|
|
189
|
-
#### If provider=github — Cache from GitHub Issues
|
|
190
|
-
|
|
191
|
-
**Guard:** If `GH_AVAILABLE=false` (from Phase 0 pre-flight), print `[backlog-cache] Skipped — GH unavailable.` and return. Do not attempt the write.
|
|
192
|
-
|
|
193
|
-
**Fetch all open backlog issues in one call:**
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
gh issue list --label "product-driven-backlog" --state open --json number,title,state,assignees,labels,body,updatedAt
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
For each issue in the result, build a snapshot object:
|
|
200
|
-
- `number`: integer issue number
|
|
201
|
-
- `title`: issue title string
|
|
202
|
-
- `state`: `"open"` or `"closed"`
|
|
203
|
-
- `assignees`: array of assignee login names, sorted alphabetically
|
|
204
|
-
- `labels`: array of label names, sorted alphabetically
|
|
205
|
-
- `body_sha`: SHA-256 of the raw body string — compute with:
|
|
206
|
-
```bash
|
|
207
|
-
echo -n "{body}" | sha256sum | cut -d' ' -f1
|
|
208
|
-
```
|
|
209
|
-
If `sha256sum` is not available, fall back to `openssl dgst -sha256 -r` or `shasum -a 256`.
|
|
210
|
-
- `updated_at`: the `updatedAt` value from the GitHub API response
|
|
211
|
-
- `captured_at`: current local time in ISO 8601 format
|
|
212
|
-
|
|
213
|
-
**Merge strategy:** If `.claude/backlog-cache.json` already exists and is valid JSON, read it and merge: new snapshot entries overwrite existing entries by issue number key; entries for issue numbers not in the current fetch are preserved (they may be needed by an in-progress `/specrails:implement` run). If the file does not exist or is malformed, create it fresh.
|
|
214
|
-
|
|
215
|
-
Write the merged result back to `.claude/backlog-cache.json` with:
|
|
216
|
-
- `schema_version`: `"1"`
|
|
217
|
-
- `provider`: `"github"`
|
|
218
|
-
- `last_updated`: current ISO 8601 timestamp
|
|
219
|
-
- `written_by`: `"get-backlog-specs"`
|
|
220
|
-
- `issues`: the merged map keyed by string issue number
|
|
221
|
-
|
|
222
|
-
If the write fails (e.g., `.claude/` directory does not exist): print `[backlog-cache] Warning: could not write cache. Continuing.` Do not abort.
|
|
223
|
-
|
|
224
|
-
#### If provider=jira or provider=none
|
|
225
|
-
|
|
226
|
-
Print `[backlog-cache] Skipped — provider does not support cache.` Do not attempt the write.
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
# Smart Merge Conflict Resolver
|
|
2
|
-
|
|
3
|
-
Resolves git conflict markers in working tree files using AI-powered context analysis. For each conflict block, reads OpenSpec context bundles from the features that produced the conflict, infers the correct resolution, and writes it in place — or preserves clean markers for conflicts it cannot safely resolve.
|
|
4
|
-
|
|
5
|
-
**IMPORTANT: Always follow this procedure exactly as written. Launch the sr-merge-resolver agent as specified. Do NOT attempt to resolve conflicts yourself in the main conversation.**
|
|
6
|
-
|
|
7
|
-
**Input:** `$ARGUMENTS` — flags controlling which files to process, where to find context, and resolution behavior.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Step 1: Parse flags
|
|
12
|
-
|
|
13
|
-
Scan `$ARGUMENTS` for the following flags:
|
|
14
|
-
|
|
15
|
-
### `--files <paths>`
|
|
16
|
-
|
|
17
|
-
**Type:** space-separated file paths or glob patterns
|
|
18
|
-
**Default:** auto-detect (scan working tree)
|
|
19
|
-
|
|
20
|
-
Explicit list of files to process. If a path contains `*` or `?`, treat it as a glob and expand it. Strip this flag and its value from `$ARGUMENTS` before further processing.
|
|
21
|
-
|
|
22
|
-
### `--context <directory>`
|
|
23
|
-
|
|
24
|
-
**Type:** directory path
|
|
25
|
-
**Default:** `openspec/changes/`
|
|
26
|
-
|
|
27
|
-
Directory to scan for context bundles. The command globs `<directory>/*/context-bundle.md`. Strip this flag and its value from `$ARGUMENTS` before further processing.
|
|
28
|
-
|
|
29
|
-
### `--threshold N`
|
|
30
|
-
|
|
31
|
-
**Type:** integer 0–100
|
|
32
|
-
**Default:** 70
|
|
33
|
-
|
|
34
|
-
Minimum confidence score for the resolver to apply an AI resolution. Below this threshold, the resolver preserves conflict markers in normalized format. Strip this flag and its value from `$ARGUMENTS` before further processing.
|
|
35
|
-
|
|
36
|
-
### `--mode auto|manual-fallback-only`
|
|
37
|
-
|
|
38
|
-
**Type:** enum
|
|
39
|
-
**Default:** `auto`
|
|
40
|
-
|
|
41
|
-
- `auto`: attempt AI resolution for each conflict block
|
|
42
|
-
- `manual-fallback-only`: only normalize conflict marker format; do not attempt AI resolution
|
|
43
|
-
|
|
44
|
-
Strip this flag and its value from `$ARGUMENTS` before further processing.
|
|
45
|
-
|
|
46
|
-
After parsing, if any unrecognized flags remain in `$ARGUMENTS`: print a warning:
|
|
47
|
-
```
|
|
48
|
-
[merge-resolve] Warning: unrecognized flags ignored: <remaining>
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Step 2: Detect conflicted files
|
|
54
|
-
|
|
55
|
-
### If `--files` was provided:
|
|
56
|
-
|
|
57
|
-
For each path (or expanded glob): check that the file exists. If a path does not exist: print `[merge-resolve] Warning: <path> not found — skipped.` and remove it from the list.
|
|
58
|
-
|
|
59
|
-
Filter to only files containing `<<<<<<<`. For any file in the provided list that does NOT contain `<<<<<<<`: print `[merge-resolve] <path>: no conflict markers found — skipped.`
|
|
60
|
-
|
|
61
|
-
### If `--files` was NOT provided:
|
|
62
|
-
|
|
63
|
-
Scan the entire working tree for files containing `<<<<<<<`:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
grep -rl "<<<<<<< " . --include="*" 2>/dev/null
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Exclude `.git/` directory from results.
|
|
70
|
-
|
|
71
|
-
If no conflicted files are found (either from explicit list or auto-detect):
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
[merge-resolve] No conflict markers found in the working tree.
|
|
75
|
-
Nothing to do.
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Exit cleanly.
|
|
79
|
-
|
|
80
|
-
Otherwise, print:
|
|
81
|
-
```
|
|
82
|
-
[merge-resolve] Found N conflicted file(s):
|
|
83
|
-
- path/to/file.ts
|
|
84
|
-
- path/to/other.md
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Step 3: Load context bundles
|
|
90
|
-
|
|
91
|
-
Glob `<context-directory>/*/context-bundle.md`.
|
|
92
|
-
|
|
93
|
-
Build `CONTEXT_BUNDLES` map: for each matched path, the key is the subdirectory name (the feature name), the value is the file path.
|
|
94
|
-
|
|
95
|
-
Example:
|
|
96
|
-
```
|
|
97
|
-
openspec/changes/feature-a/context-bundle.md → { "feature-a": "openspec/changes/feature-a/context-bundle.md" }
|
|
98
|
-
openspec/changes/feature-b/context-bundle.md → { "feature-b": "openspec/changes/feature-b/context-bundle.md" }
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
If no context bundles are found:
|
|
102
|
-
```
|
|
103
|
-
[merge-resolve] No context bundles found at <context-directory>.
|
|
104
|
-
The resolver will use structural analysis only (no feature-intent context).
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Set `CONTEXT_BUNDLES = {}`.
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## Step 4: Launch sr-merge-resolver agent
|
|
112
|
-
|
|
113
|
-
Construct the agent prompt with:
|
|
114
|
-
|
|
115
|
-
- `CONFLICTED_FILES`: the list of conflicted file paths
|
|
116
|
-
- `CONTEXT_BUNDLES`: the map built in Step 3
|
|
117
|
-
- `CONFIDENCE_THRESHOLD`: the `--threshold` value (default 70)
|
|
118
|
-
- `RESOLUTION_MODE`: the `--mode` value (default `auto`)
|
|
119
|
-
- `REPORT_PATH`: `openspec/changes/<first-feature>/merge-resolution-report.md` if CONTEXT_BUNDLES has entries; otherwise `merge-resolution-report.md` in the working directory root
|
|
120
|
-
|
|
121
|
-
Launch the **sr-merge-resolver** agent (`subagent_type: sr-merge-resolver`, foreground, `run_in_background: false`). Wait for it to complete.
|
|
122
|
-
|
|
123
|
-
Read the final `MERGE_RESOLUTION_STATUS` line from the agent's output.
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## Step 5: Print summary
|
|
128
|
-
|
|
129
|
-
After the agent completes, print:
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
## Merge Resolution Complete
|
|
133
|
-
|
|
134
|
-
| Metric | Count |
|
|
135
|
-
|--------|-------|
|
|
136
|
-
| Files processed | N |
|
|
137
|
-
| Conflicts found | N |
|
|
138
|
-
| Auto-resolved | N |
|
|
139
|
-
| Low-confidence (kept) | N |
|
|
140
|
-
| Skipped | N |
|
|
141
|
-
|
|
142
|
-
Resolution report: <REPORT_PATH>
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
If `MERGE_RESOLUTION_STATUS = PARTIAL` or `UNRESOLVED`:
|
|
146
|
-
|
|
147
|
-
```
|
|
148
|
-
## Remaining Conflicts
|
|
149
|
-
|
|
150
|
-
The following files still contain conflict markers that require manual resolution:
|
|
151
|
-
|
|
152
|
-
- path/to/file.ts (N block(s))
|
|
153
|
-
|
|
154
|
-
Search for `<<<<<<<` in each file to locate the markers.
|
|
155
|
-
Run `/specrails:merge-resolve` again after addressing the low-confidence conflicts,
|
|
156
|
-
or resolve them manually and commit.
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
If `MERGE_RESOLUTION_STATUS = CLEAN`:
|
|
160
|
-
|
|
161
|
-
```
|
|
162
|
-
All conflict markers resolved. Working tree is clean.
|
|
163
|
-
You can now stage and commit the resolved files.
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## Error Handling
|
|
169
|
-
|
|
170
|
-
- If the agent fails or times out: print `[merge-resolve] Error: sr-merge-resolver did not complete. Files may be partially modified — check for remaining conflict markers before committing.` Exit with a non-zero status.
|
|
171
|
-
- If a file becomes unreadable mid-run (e.g. deleted): log `[merge-resolve] Warning: <path> disappeared during processing — skipped.`
|
|
172
|
-
- Never abort silently. Always print a final status.
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# Reconfig: Apply Agent Config to Generated Files
|
|
2
|
-
|
|
3
|
-
Reads `.specrails/agents.yaml` and updates the `model:` frontmatter field in all generated `.claude/agents/sr-*.md` files to match. No full re-setup needed — only model frontmatter is changed.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Step 1: Locate generated agents directory
|
|
8
|
-
|
|
9
|
-
This command targets the Claude install: set `$AGENTS_DIR = .claude/agents`. (Codex agents are codex-native rails under `.codex/skills/rails/` and carry no per-agent `model:` config — codex `spawn_agent` forks don't accept a model — so reconfig does not apply to codex projects.)
|
|
10
|
-
|
|
11
|
-
## Step 2: Read agent config
|
|
12
|
-
|
|
13
|
-
Read `.specrails/agents.yaml`.
|
|
14
|
-
|
|
15
|
-
If the file does not exist, stop and display:
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
No .specrails/agents.yaml found.
|
|
19
|
-
|
|
20
|
-
Run /specrails:enrich to generate the config file, then edit it before running /specrails:reconfig.
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
If the file exists, parse it. Validate all `model:` values — only `opus`, `sonnet`, and `haiku` are accepted. If an invalid value is found, display a warning and skip that agent:
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
Warning: unknown model "gpt-4" for sr-developer — skipping (valid values: opus, sonnet, haiku)
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Step 3: Resolve model for each agent
|
|
30
|
-
|
|
31
|
-
For each agent file found in `$AGENTS_DIR/sr-*.md`:
|
|
32
|
-
|
|
33
|
-
1. Extract the agent name from the filename (e.g., `sr-developer.md` → `sr-developer`)
|
|
34
|
-
2. Resolve the target model:
|
|
35
|
-
- Check `agents.<agent-name>.model` in config (per-agent override)
|
|
36
|
-
- If not present, check `defaults.model` in config (global default)
|
|
37
|
-
- If neither is present, skip this agent
|
|
38
|
-
3. Read the current `model:` value from the file's YAML frontmatter
|
|
39
|
-
4. If the current model matches the target model, mark as **unchanged**
|
|
40
|
-
5. If they differ, record the change: `sr-<name>: <current> → <target>`
|
|
41
|
-
|
|
42
|
-
## Step 4: Apply changes
|
|
43
|
-
|
|
44
|
-
For each agent with a recorded change:
|
|
45
|
-
|
|
46
|
-
1. Read the file
|
|
47
|
-
2. Replace the `model:` line in the YAML frontmatter with the resolved value
|
|
48
|
-
3. Write the file back
|
|
49
|
-
|
|
50
|
-
The `model:` line is always in the frontmatter block (between the first `---` and second `---`). Replace only that specific line — do not modify any other content.
|
|
51
|
-
|
|
52
|
-
## Step 5: Report results
|
|
53
|
-
|
|
54
|
-
Display a summary of what changed:
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
## Reconfig complete
|
|
58
|
-
|
|
59
|
-
Updated 2 agent(s):
|
|
60
|
-
sr-developer: sonnet → opus
|
|
61
|
-
sr-product-analyst: haiku → sonnet
|
|
62
|
-
|
|
63
|
-
Unchanged (3):
|
|
64
|
-
sr-architect, sr-reviewer, sr-product-manager
|
|
65
|
-
|
|
66
|
-
Skipped (1):
|
|
67
|
-
sr-custom-agent (not in config)
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
If nothing changed:
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
All agents already match .specrails/agents.yaml — nothing to update.
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
If all agents were skipped due to validation errors, display:
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
No agents updated. Fix the validation errors in .specrails/agents.yaml and retry.
|
|
80
|
-
```
|