specrails-core 1.6.0 → 1.7.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/package.json +1 -1
- package/templates/agents/sr-merge-resolver.md +182 -0
- package/templates/agents/sr-performance-reviewer.md +173 -0
- package/templates/commands/sr/implement.md +61 -8
- package/templates/commands/sr/merge-resolve.md +172 -0
- package/templates/commands/sr/refactor-recommender.md +52 -9
- package/templates/settings/perf-thresholds.yml +25 -0
- package/templates/web-manager/package-lock.json +3740 -0
- package/templates/web-manager/server/queue-manager.test.ts +607 -0
- package/templates/web-manager/server/queue-manager.ts +565 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "Refactor Recommender"
|
|
3
|
-
description: "Scan the codebase for refactoring opportunities ranked by impact/effort ratio. Analyzes code for duplicates, long functions, large files, dead code, outdated patterns, and complex logic. Optionally creates GitHub Issues for tracking."
|
|
3
|
+
description: "Scan the codebase for refactoring opportunities ranked by impact/effort ratio and VPC persona value. Analyzes code for duplicates, long functions, large files, dead code, outdated patterns, and complex logic. Optionally creates GitHub Issues for tracking."
|
|
4
4
|
category: Workflow
|
|
5
|
-
tags: [workflow, refactoring, code-quality, tech-debt]
|
|
5
|
+
tags: [workflow, refactoring, code-quality, tech-debt, vpc]
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
Scan the codebase for refactoring opportunities, score each by impact/effort ratio, and optionally create GitHub Issues for the top findings in {{BACKLOG_PROVIDER_NAME}}.
|
|
8
|
+
Scan the codebase for refactoring opportunities, score each by impact/effort ratio and VPC persona value, and optionally create GitHub Issues for the top findings in {{BACKLOG_PROVIDER_NAME}}.
|
|
9
9
|
|
|
10
10
|
**Input:** `$ARGUMENTS` — optional: comma-separated paths to scope the analysis. Flags: `--dry-run` (print findings without creating issues).
|
|
11
11
|
|
|
@@ -38,6 +38,27 @@ Always exclude the following from all analysis:
|
|
|
38
38
|
|
|
39
39
|
---
|
|
40
40
|
|
|
41
|
+
## Phase 1.5: VPC Context
|
|
42
|
+
|
|
43
|
+
Check whether persona files exist at `.claude/agents/personas/`. This path is present in any repo that has run `/setup`.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
ls .claude/agents/personas/ 2>/dev/null
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If the directory exists and contains persona files, set `VPC_AVAILABLE=true`. Otherwise set `VPC_AVAILABLE=false` and skip all VPC steps (they are optional enrichment, not blockers).
|
|
50
|
+
|
|
51
|
+
When `VPC_AVAILABLE=true`, read each persona file and extract a compact VPC summary. For each persona record:
|
|
52
|
+
|
|
53
|
+
- **name** — persona display name (e.g. "Alex — The Lead Dev")
|
|
54
|
+
- **top_jobs** — up to 3 functional jobs relevant to code quality and maintainability
|
|
55
|
+
- **critical_pains** — up to 3 pains marked Critical or High related to code reliability, complexity, or developer experience
|
|
56
|
+
- **high_gains** — up to 3 gains marked High related to code clarity, speed, or confidence
|
|
57
|
+
|
|
58
|
+
Store these as an in-memory `VPC_PROFILES` list. You will use it in Phase 3 to score persona fit.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
41
62
|
## Phase 2: Analysis
|
|
42
63
|
|
|
43
64
|
Analyze the scoped files across six categories. For each finding record:
|
|
@@ -76,12 +97,24 @@ Find deeply nested conditionals (more than 3 levels) and functions with high cyc
|
|
|
76
97
|
|
|
77
98
|
## Phase 3: Score and Rank
|
|
78
99
|
|
|
79
|
-
Score every finding on
|
|
100
|
+
Score every finding on three dimensions (1–5 each):
|
|
80
101
|
|
|
81
102
|
- **Impact** — how much the refactoring improves code quality, readability, or maintainability
|
|
82
103
|
- **Effort** — how hard the refactoring is to implement (1 = trivial, 5 = major)
|
|
104
|
+
- **VPC Value** — how directly this refactoring addresses persona jobs, pains, or gains (1 = no relevance, 5 = resolves a critical persona pain or delivers a high-value gain). Set to 3 when `VPC_AVAILABLE=false`.
|
|
105
|
+
|
|
106
|
+
**Scoring VPC Value** (only when `VPC_AVAILABLE=true`):
|
|
107
|
+
|
|
108
|
+
For each finding, reason over `VPC_PROFILES`:
|
|
83
109
|
|
|
84
|
-
|
|
110
|
+
- Does fixing this reduce a **Critical/High pain** for any persona? (e.g. complex logic → harder to trust AI output → Alex's "agents go off the rails" pain) → score 4–5
|
|
111
|
+
- Does fixing this deliver a **High gain** for any persona? (e.g. extracting a function → cleaner API surface → easier onboarding → Sara's gain) → score 3–4
|
|
112
|
+
- Is there indirect persona value? (e.g. dead code removal → smaller codebase → easier contributor review → Kai) → score 2–3
|
|
113
|
+
- No clear persona relevance → score 1–2
|
|
114
|
+
|
|
115
|
+
Assign one `vpc_value` integer per finding, and note the **primary persona** and **rationale** (one sentence).
|
|
116
|
+
|
|
117
|
+
**Composite score**: `impact * 2 + (6 - effort) + vpc_value`. Higher is better.
|
|
85
118
|
|
|
86
119
|
Sort all findings by composite score descending. If the same code block was flagged by multiple categories, keep only the highest-scored entry and discard the duplicates.
|
|
87
120
|
|
|
@@ -91,7 +124,7 @@ Sort all findings by composite score descending. If the same code block was flag
|
|
|
91
124
|
|
|
92
125
|
Skip this phase if `GH_AVAILABLE=false` or `DRY_RUN=true`.
|
|
93
126
|
|
|
94
|
-
First ensure the tracking
|
|
127
|
+
First ensure the tracking labels exist:
|
|
95
128
|
|
|
96
129
|
```bash
|
|
97
130
|
gh label create "refactor-opportunity" --color "B60205" --force
|
|
@@ -111,6 +144,7 @@ For each of the **top 5** findings (by composite score) that does not already ha
|
|
|
111
144
|
**Category**: {category}
|
|
112
145
|
**File**: {file}:{line_range}
|
|
113
146
|
**Impact**: {impact}/5 | **Effort**: {effort}/5 | **Score**: {composite}
|
|
147
|
+
{vpc_line}
|
|
114
148
|
|
|
115
149
|
### Current Code
|
|
116
150
|
```{lang}
|
|
@@ -129,6 +163,9 @@ For each of the **top 5** findings (by composite score) that does not already ha
|
|
|
129
163
|
_Generated by `/sr:refactor-recommender` in {{PROJECT_NAME}}_
|
|
130
164
|
```
|
|
131
165
|
|
|
166
|
+
Where `{vpc_line}` is included only when `VPC_AVAILABLE=true`:
|
|
167
|
+
`**VPC Value**: {vpc_value}/5 — {vpc_persona}: {vpc_rationale}`
|
|
168
|
+
|
|
132
169
|
---
|
|
133
170
|
|
|
134
171
|
## Phase 5: Output Summary
|
|
@@ -139,10 +176,11 @@ Print the following report:
|
|
|
139
176
|
## Refactoring Opportunities — {{PROJECT_NAME}}
|
|
140
177
|
|
|
141
178
|
{N} opportunities found | Sorted by composite score
|
|
179
|
+
{vpc_header}
|
|
142
180
|
|
|
143
|
-
| # | Category | File | Impact | Effort | Score | Description |
|
|
144
|
-
|
|
145
|
-
| 1 | {category} | {file}:{line_range} | {impact}/5 | {effort}/5 | {composite} | {description} |
|
|
181
|
+
| # | Category | File | Impact | Effort | VPC | Score | Description |
|
|
182
|
+
|---|----------|------|--------|--------|-----|-------|-------------|
|
|
183
|
+
| 1 | {category} | {file}:{line_range} | {impact}/5 | {effort}/5 | {vpc_value}/5 | {composite} | {description} |
|
|
146
184
|
...
|
|
147
185
|
|
|
148
186
|
### Top 3 Detailed Recommendations
|
|
@@ -150,6 +188,7 @@ Print the following report:
|
|
|
150
188
|
#### 1. {description}
|
|
151
189
|
**File**: {file}:{line_range}
|
|
152
190
|
**Category**: {category} | **Score**: {composite}
|
|
191
|
+
{vpc_detail}
|
|
153
192
|
|
|
154
193
|
**Current:**
|
|
155
194
|
```{lang}
|
|
@@ -167,3 +206,7 @@ Print the following report:
|
|
|
167
206
|
|
|
168
207
|
Issues created: {N} (or "dry-run: no issues created")
|
|
169
208
|
```
|
|
209
|
+
|
|
210
|
+
Where:
|
|
211
|
+
- `{vpc_header}` is `VPC personas loaded: {persona names}` when `VPC_AVAILABLE=true`, or `VPC personas: not found (run /setup to enable)` otherwise.
|
|
212
|
+
- `{vpc_detail}` is `**VPC Value**: {vpc_value}/5 — {vpc_persona}: {vpc_rationale}` when `VPC_AVAILABLE=true`, omitted otherwise.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# SpecRails Performance Regression Thresholds
|
|
2
|
+
# Used by sr-performance-reviewer agent and the performance CI workflow.
|
|
3
|
+
# Environment variables (PERF_*) override these values.
|
|
4
|
+
|
|
5
|
+
# Execution time thresholds (percentage increase = regression)
|
|
6
|
+
execution_time_regression_pct: 20 # warn above this delta
|
|
7
|
+
execution_time_critical_pct: 50 # block CI above this delta
|
|
8
|
+
|
|
9
|
+
# Memory usage thresholds (percentage increase = regression)
|
|
10
|
+
memory_regression_pct: 15
|
|
11
|
+
memory_critical_pct: 40
|
|
12
|
+
|
|
13
|
+
# Throughput thresholds (percentage decrease = regression)
|
|
14
|
+
throughput_regression_pct: 15
|
|
15
|
+
throughput_critical_pct: 40
|
|
16
|
+
|
|
17
|
+
# Branch to use as baseline when .specrails/perf-baseline.json is absent
|
|
18
|
+
baseline_branch: main
|
|
19
|
+
|
|
20
|
+
# File patterns to always skip (in addition to agent defaults)
|
|
21
|
+
skip_patterns: []
|
|
22
|
+
# example:
|
|
23
|
+
# skip_patterns:
|
|
24
|
+
# - "scripts/**"
|
|
25
|
+
# - "migrations/**"
|