specrails-core 5.6.0 → 6.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 +27 -145
- package/bin/specrails-core.mjs +12 -554
- package/dist/agent-runtime/capabilities.js +0 -1
- package/dist/agent-runtime/cli-executor.d.ts +1 -1
- package/dist/agent-runtime/cli-executor.js +1 -2
- package/dist/agent-runtime/cli-process.js +0 -1
- package/dist/agent-runtime/cli.js +3 -4
- package/dist/agent-runtime/codex-schema.js +0 -1
- package/dist/agent-runtime/compact/architect.d.ts +3 -272
- package/dist/agent-runtime/compact/architect.js +8 -9
- package/dist/agent-runtime/compact/chat-client.d.ts +3 -3
- package/dist/agent-runtime/compact/chat-client.js +1 -2
- package/dist/agent-runtime/compact/developer.d.ts +3 -70
- package/dist/agent-runtime/compact/developer.js +13 -14
- package/dist/agent-runtime/compact/environment.d.ts +4 -5
- package/dist/agent-runtime/compact/environment.js +1 -2
- package/dist/agent-runtime/compact/exit-code-honesty.d.ts +2 -1
- package/dist/agent-runtime/compact/exit-code-honesty.js +0 -1
- package/dist/agent-runtime/compact/guarded-loop.d.ts +2 -18
- package/dist/agent-runtime/compact/guarded-loop.js +7 -8
- package/dist/agent-runtime/compact/prompt-inputs.d.ts +0 -2
- package/dist/agent-runtime/compact/prompt-inputs.js +1 -2
- package/dist/agent-runtime/compact/reviewer.d.ts +0 -13
- package/dist/agent-runtime/compact/reviewer.js +5 -6
- package/dist/agent-runtime/compact/step.d.ts +0 -1
- package/dist/agent-runtime/compact/step.js +1 -2
- package/dist/agent-runtime/compact/test-reachability.js +0 -1
- package/dist/agent-runtime/config.js +0 -1
- package/dist/agent-runtime/core-host.d.ts +1 -1
- package/dist/agent-runtime/core-host.js +1 -2
- package/dist/agent-runtime/durable-store.d.ts +0 -1
- package/dist/agent-runtime/durable-store.js +1 -2
- package/dist/agent-runtime/efficiency-summary.d.ts +2 -2
- package/dist/agent-runtime/efficiency-summary.js +1 -2
- package/dist/agent-runtime/efficiency-types.js +0 -1
- package/dist/agent-runtime/efficiency.js +0 -1
- package/dist/agent-runtime/evaluation-corpus.js +0 -1
- package/dist/agent-runtime/evaluation.d.ts +2 -1
- package/dist/agent-runtime/evaluation.js +1 -2
- package/dist/agent-runtime/executor-types.d.ts +1 -1
- package/dist/agent-runtime/executor-types.js +0 -1
- package/dist/agent-runtime/executors.js +0 -1
- package/dist/agent-runtime/gemini-policy.js +0 -1
- package/dist/agent-runtime/graph/artifacts.d.ts +1 -1
- package/dist/agent-runtime/graph/artifacts.js +1 -2
- package/dist/agent-runtime/graph/nodes.d.ts +1 -1
- package/dist/agent-runtime/graph/nodes.js +1 -2
- package/dist/agent-runtime/graph/review-policy.js +0 -1
- package/dist/agent-runtime/graph/roles.d.ts +2 -5
- package/dist/agent-runtime/graph/roles.js +2 -8
- package/dist/agent-runtime/graph/state.d.ts +1 -1
- package/dist/agent-runtime/graph/state.js +0 -1
- package/dist/agent-runtime/graph-checkpointer.d.ts +2 -1
- package/dist/agent-runtime/graph-checkpointer.js +0 -1
- package/dist/agent-runtime/guardrails.d.ts +3 -3
- package/dist/agent-runtime/guardrails.js +1 -2
- package/dist/agent-runtime/index.d.ts +1 -1
- package/dist/agent-runtime/index.js +1 -2
- package/dist/agent-runtime/kimi-acp.js +1 -2
- package/dist/agent-runtime/kimi-model.d.ts +6 -0
- package/dist/agent-runtime/kimi-model.js +12 -0
- package/dist/agent-runtime/openai-executor.d.ts +0 -9
- package/dist/agent-runtime/openai-executor.js +6 -7
- package/dist/agent-runtime/openspec-tool-server.js +1 -2
- package/dist/agent-runtime/openspec.d.ts +0 -2
- package/dist/agent-runtime/openspec.js +1 -6
- package/dist/agent-runtime/prompts.d.ts +4 -3
- package/dist/agent-runtime/prompts.js +0 -1
- package/dist/agent-runtime/provider-diagnostic.js +1 -2
- package/dist/agent-runtime/recovery.js +1 -2
- package/dist/agent-runtime/repository-context.d.ts +1 -1
- package/dist/agent-runtime/repository-context.js +0 -1
- package/dist/agent-runtime/review-context.d.ts +1 -1
- package/dist/agent-runtime/review-context.js +0 -1
- package/dist/agent-runtime/role-routing.js +0 -1
- package/dist/agent-runtime/role-state.js +0 -1
- package/dist/agent-runtime/runtime-identity.js +1 -2
- package/dist/agent-runtime/tool-event.js +0 -1
- package/dist/agent-runtime/verification-plan.d.ts +5 -4
- package/dist/agent-runtime/verification-plan.js +1 -2
- package/dist/agent-runtime/workflow-types.js +0 -1
- package/dist/agent-runtime/workflow.js +0 -1
- package/dist/agent-runtime/workspace-tools.d.ts +2 -2
- package/dist/agent-runtime/workspace-tools.js +1 -2
- package/dist/installer/cli.d.ts +3 -32
- package/dist/installer/cli.js +26 -101
- package/dist/installer/commands/framework.d.ts +4 -3
- package/dist/installer/commands/framework.js +0 -1
- package/dist/installer/commands/init.d.ts +4 -25
- package/dist/installer/commands/init.js +5 -8
- package/dist/installer/phases/framework-lifecycle.d.ts +3 -17
- package/dist/installer/phases/framework-lifecycle.js +2 -3
- package/dist/installer/phases/install-config.d.ts +7 -8
- package/dist/installer/phases/install-config.js +2 -7
- package/dist/installer/phases/manifest.d.ts +6 -7
- package/dist/installer/phases/manifest.js +2 -7
- package/dist/installer/phases/prereqs.d.ts +6 -7
- package/dist/installer/phases/prereqs.js +4 -6
- package/dist/installer/phases/provider-detect.d.ts +6 -7
- package/dist/installer/phases/provider-detect.js +2 -4
- package/dist/installer/phases/scaffold.d.ts +9 -10
- package/dist/installer/phases/scaffold.js +82 -805
- package/dist/installer/util/errors.js +0 -1
- package/dist/installer/util/exec.d.ts +3 -2
- package/dist/installer/util/exec.js +0 -1
- package/dist/installer/util/fs.d.ts +0 -10
- package/dist/installer/util/fs.js +1 -2
- package/dist/installer/util/git.js +0 -1
- package/dist/installer/util/install-transaction.d.ts +2 -2
- package/dist/installer/util/install-transaction.js +1 -2
- package/dist/installer/util/logger.d.ts +1 -3
- package/dist/installer/util/logger.js +0 -1
- package/dist/installer/util/paths.js +0 -1
- package/dist/installer/util/registry.d.ts +4 -8
- package/dist/installer/util/registry.js +2 -3
- package/dist/{installer/runtime → pipeline}/pipeline-state.js +0 -3
- package/dist/shared/args.d.ts +18 -0
- package/dist/shared/args.js +53 -0
- package/integration-contract.json +10 -46
- package/package.json +3 -10
- package/templates/agents/sr-architect.md +15 -310
- package/templates/agents/sr-developer.md +15 -269
- package/templates/agents/sr-reviewer.md +13 -367
- package/templates/codex-skills/rails/sr-architect/SKILL.md +14 -308
- package/templates/codex-skills/rails/sr-developer/SKILL.md +14 -201
- package/templates/codex-skills/rails/sr-reviewer/SKILL.md +15 -289
- package/templates/kimi/specrails/run-skill.mjs +91 -2173
- package/bin/tui-installer.mjs +0 -430
- package/commands/doctor.md +0 -62
- package/dist/agent-runtime/capabilities.js.map +0 -1
- package/dist/agent-runtime/cli-executor.js.map +0 -1
- package/dist/agent-runtime/cli-process.js.map +0 -1
- package/dist/agent-runtime/cli.js.map +0 -1
- package/dist/agent-runtime/codex-schema.js.map +0 -1
- package/dist/agent-runtime/compact/architect.js.map +0 -1
- package/dist/agent-runtime/compact/chat-client.js.map +0 -1
- package/dist/agent-runtime/compact/developer.js.map +0 -1
- package/dist/agent-runtime/compact/environment.js.map +0 -1
- package/dist/agent-runtime/compact/exit-code-honesty.js.map +0 -1
- package/dist/agent-runtime/compact/guarded-loop.js.map +0 -1
- package/dist/agent-runtime/compact/prompt-inputs.js.map +0 -1
- package/dist/agent-runtime/compact/reviewer.js.map +0 -1
- package/dist/agent-runtime/compact/step.js.map +0 -1
- package/dist/agent-runtime/compact/test-reachability.js.map +0 -1
- package/dist/agent-runtime/config.js.map +0 -1
- package/dist/agent-runtime/core-host.js.map +0 -1
- package/dist/agent-runtime/durable-store.js.map +0 -1
- package/dist/agent-runtime/efficiency-summary.js.map +0 -1
- package/dist/agent-runtime/efficiency-types.js.map +0 -1
- package/dist/agent-runtime/efficiency.js.map +0 -1
- package/dist/agent-runtime/evaluation-corpus.js.map +0 -1
- package/dist/agent-runtime/evaluation.js.map +0 -1
- package/dist/agent-runtime/executor-types.js.map +0 -1
- package/dist/agent-runtime/executors.js.map +0 -1
- package/dist/agent-runtime/gemini-policy.js.map +0 -1
- package/dist/agent-runtime/graph/artifacts.js.map +0 -1
- package/dist/agent-runtime/graph/nodes.js.map +0 -1
- package/dist/agent-runtime/graph/review-policy.js.map +0 -1
- package/dist/agent-runtime/graph/roles.js.map +0 -1
- package/dist/agent-runtime/graph/state.js.map +0 -1
- package/dist/agent-runtime/graph-checkpointer.js.map +0 -1
- package/dist/agent-runtime/guardrails.js.map +0 -1
- package/dist/agent-runtime/index.js.map +0 -1
- package/dist/agent-runtime/kimi-acp.js.map +0 -1
- package/dist/agent-runtime/openai-executor.js.map +0 -1
- package/dist/agent-runtime/openspec-tool-server.js.map +0 -1
- package/dist/agent-runtime/openspec.js.map +0 -1
- package/dist/agent-runtime/prompts.js.map +0 -1
- package/dist/agent-runtime/provider-diagnostic.js.map +0 -1
- package/dist/agent-runtime/recovery.js.map +0 -1
- package/dist/agent-runtime/repository-context.js.map +0 -1
- package/dist/agent-runtime/review-context.js.map +0 -1
- package/dist/agent-runtime/role-routing.js.map +0 -1
- package/dist/agent-runtime/role-state.js.map +0 -1
- package/dist/agent-runtime/runtime-identity.js.map +0 -1
- package/dist/agent-runtime/tool-event.js.map +0 -1
- package/dist/agent-runtime/verification-plan.js.map +0 -1
- package/dist/agent-runtime/workflow-types.js.map +0 -1
- package/dist/agent-runtime/workflow.js.map +0 -1
- package/dist/agent-runtime/workspace-tools.js.map +0 -1
- package/dist/installer/cli.js.map +0 -1
- package/dist/installer/commands/doctor.d.ts +0 -27
- package/dist/installer/commands/doctor.js +0 -615
- package/dist/installer/commands/doctor.js.map +0 -1
- package/dist/installer/commands/framework.js.map +0 -1
- package/dist/installer/commands/init.js.map +0 -1
- package/dist/installer/commands/update.d.ts +0 -56
- package/dist/installer/commands/update.js +0 -257
- package/dist/installer/commands/update.js.map +0 -1
- package/dist/installer/commands/v5-migration.d.ts +0 -32
- package/dist/installer/commands/v5-migration.js +0 -133
- package/dist/installer/commands/v5-migration.js.map +0 -1
- package/dist/installer/phases/framework-lifecycle.js.map +0 -1
- package/dist/installer/phases/install-config.js.map +0 -1
- package/dist/installer/phases/manifest.js.map +0 -1
- package/dist/installer/phases/prereqs.js.map +0 -1
- package/dist/installer/phases/provider-detect.js.map +0 -1
- package/dist/installer/phases/scaffold.js.map +0 -1
- package/dist/installer/runtime/kimi.d.ts +0 -84
- package/dist/installer/runtime/kimi.js +0 -255
- package/dist/installer/runtime/kimi.js.map +0 -1
- package/dist/installer/runtime/pipeline-state.js.map +0 -1
- package/dist/installer/util/errors.js.map +0 -1
- package/dist/installer/util/exec.js.map +0 -1
- package/dist/installer/util/fs.js.map +0 -1
- package/dist/installer/util/git.js.map +0 -1
- package/dist/installer/util/install-transaction.js.map +0 -1
- package/dist/installer/util/logger.js.map +0 -1
- package/dist/installer/util/paths.js.map +0 -1
- package/dist/installer/util/prompts.d.ts +0 -23
- package/dist/installer/util/prompts.js +0 -49
- package/dist/installer/util/prompts.js.map +0 -1
- package/dist/installer/util/registry.js.map +0 -1
- package/dist/installer/util/template.d.ts +0 -23
- package/dist/installer/util/template.js +0 -60
- package/dist/installer/util/template.js.map +0 -1
- package/docs/README.md +0 -40
- package/docs/agent-runtime-efficiency.md +0 -65
- package/docs/agent-runtime.md +0 -393
- package/docs/agents.md +0 -315
- package/docs/changelog.md +0 -168
- package/docs/ci-cd.md +0 -60
- package/docs/concepts.md +0 -183
- package/docs/customization.md +0 -363
- package/docs/deployment.md +0 -234
- package/docs/getting-started.md +0 -122
- package/docs/installation.md +0 -395
- package/docs/local-tickets.md +0 -191
- package/docs/migration-guide.md +0 -140
- package/docs/playbook-oss-maintainer.md +0 -112
- package/docs/playbook-parallel-dev.md +0 -124
- package/docs/playbook-product-discovery.md +0 -115
- package/docs/plugin-architecture.md +0 -144
- package/docs/research/codex-compatibility-analysis.md +0 -365
- package/docs/research/mcp-feasibility-analysis.md +0 -382
- package/docs/testing/test-matrix-codex.md +0 -130
- package/docs/updating.md +0 -89
- package/docs/user-docs/cli-reference.md +0 -428
- package/docs/user-docs/codex-vs-claude-code.md +0 -23
- package/docs/user-docs/core-updates.md +0 -70
- package/docs/user-docs/faq.md +0 -146
- package/docs/user-docs/getting-started-codex.md +0 -194
- package/docs/user-docs/getting-started-kimi.md +0 -423
- package/docs/user-docs/installation.md +0 -237
- package/docs/user-docs/provider-pipelines.md +0 -96
- package/docs/user-docs/quick-start.md +0 -161
- package/docs/windows.md +0 -78
- package/docs/workflows.md +0 -463
- package/schemas/profile.v1.json +0 -207
- package/templates/claude-md/CLAUDE-quickstart.md +0 -54
- package/templates/claude-md/root.md +0 -50
- package/templates/codex-skills/batch-implement/SKILL.md +0 -38
- package/templates/codex-skills/implement/SKILL.md +0 -38
- package/templates/codex-skills/retry/SKILL.md +0 -16
- package/templates/commands/specrails/compat-check.md +0 -271
- package/templates/commands/specrails/doctor.md +0 -62
- package/templates/commands/specrails/explore-spec.md +0 -173
- package/templates/commands/specrails/health-check.md +0 -527
- package/templates/commands/specrails/memory-inspect.md +0 -261
- package/templates/commands/specrails/opsx-diff.md +0 -419
- package/templates/commands/specrails/propose-spec.md +0 -102
- package/templates/commands/specrails/refactor-recommender.md +0 -169
- package/templates/commands/specrails/telemetry.md +0 -553
- package/templates/commands/specrails/why.md +0 -96
- package/templates/gemini-commands/batch-implement.toml +0 -37
- package/templates/gemini-commands/implement.toml +0 -37
- package/templates/gemini-commands/retry.toml +0 -15
- package/templates/profiles/default.json +0 -14
- package/templates/profiles/kimi-default.json +0 -15
- package/templates/rules/layer.md +0 -8
- package/templates/runtime/provider-pipeline.md +0 -113
- package/templates/security/security-exemptions.yaml +0 -20
- package/templates/settings/confidence-config.json +0 -17
- package/templates/settings/settings.json +0 -15
- /package/dist/{installer/runtime → pipeline}/pipeline-state.d.ts +0 -0
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Explore a spec idea and produce a structured proposal
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
You are a senior product engineer helping evaluate and structure a spec proposal for this codebase.
|
|
6
|
-
|
|
7
|
-
The user's raw idea is:
|
|
8
|
-
|
|
9
|
-
$ARGUMENTS
|
|
10
|
-
|
|
11
|
-
## Your Task
|
|
12
|
-
|
|
13
|
-
Before proposing anything, explore the codebase to understand:
|
|
14
|
-
1. What already exists that relates to this idea
|
|
15
|
-
2. What the current architecture looks like in the relevant area
|
|
16
|
-
3. What constraints or patterns you must respect
|
|
17
|
-
|
|
18
|
-
Use Read, Glob, and Grep to explore. Take at least 3 codebase reads before writing the proposal.
|
|
19
|
-
|
|
20
|
-
## Required Output
|
|
21
|
-
|
|
22
|
-
Output ONLY the following structured markdown. Do not add any preamble or explanation outside these sections.
|
|
23
|
-
|
|
24
|
-
## Spec Title
|
|
25
|
-
[A concise, action-oriented title, e.g., "Add Real-Time Cost Alerts"]
|
|
26
|
-
|
|
27
|
-
## Problem Statement
|
|
28
|
-
[2-3 sentences: what problem does this solve? Who experiences it? What is the current workaround?]
|
|
29
|
-
|
|
30
|
-
## Proposed Solution
|
|
31
|
-
[3-5 sentences: what exactly will be built? Be specific about the UI, API, and data changes.]
|
|
32
|
-
|
|
33
|
-
## Out of Scope
|
|
34
|
-
[Bullet list of things this proposal deliberately does NOT cover]
|
|
35
|
-
|
|
36
|
-
## Acceptance Criteria
|
|
37
|
-
[Numbered list of testable outcomes. Each criterion must be independently verifiable.]
|
|
38
|
-
|
|
39
|
-
## Technical Considerations
|
|
40
|
-
[Bullet list of implementation notes, constraints from the existing architecture, risks, and dependencies]
|
|
41
|
-
|
|
42
|
-
## Estimated Complexity
|
|
43
|
-
[One of: Low (< 1 day) / Medium (1-3 days) / High (3-7 days) / Very High (> 1 week)]
|
|
44
|
-
[One sentence justifying the estimate]
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Backlog Sync
|
|
49
|
-
|
|
50
|
-
After generating the proposal, read `.specrails/backlog-config.json` to determine `BACKLOG_PROVIDER` and `BACKLOG_WRITE`.
|
|
51
|
-
|
|
52
|
-
If `.specrails/backlog-config.json` does not exist, default to `provider=local` and `write_access=true`. Initialize `.specrails/local-tickets.json` if it does not exist (empty store with `schema_version: "1.0"`, `revision: 0`, `next_id: 1`, `tickets: {}`).
|
|
53
|
-
|
|
54
|
-
### If provider=local — Create Local Ticket
|
|
55
|
-
|
|
56
|
-
Create a local ticket from the proposal output:
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
{{BACKLOG_CREATE_CMD}}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Set the following fields:
|
|
63
|
-
- `title`: The Spec Title from the proposal
|
|
64
|
-
- `description`: The full structured proposal markdown (all sections from Problem Statement through Estimated Complexity)
|
|
65
|
-
- `status`: `"todo"`
|
|
66
|
-
- `priority`: Map Estimated Complexity — Low → `"low"`, Medium → `"medium"`, High/Very High → `"high"`
|
|
67
|
-
- `labels`: `["spec-proposal"]`
|
|
68
|
-
- `source`: `"propose-spec"`
|
|
69
|
-
- `created_by`: `"sr-architect"`
|
|
70
|
-
|
|
71
|
-
Print: `Created local ticket #{id}: {title}`
|
|
72
|
-
|
|
73
|
-
### If provider=github and BACKLOG_WRITE=true — Create GitHub Issue
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
{{BACKLOG_CREATE_CMD}}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Create a GitHub Issue with:
|
|
80
|
-
- Title: The Spec Title
|
|
81
|
-
- Body: Full structured proposal markdown
|
|
82
|
-
- Labels: `spec-proposal`
|
|
83
|
-
|
|
84
|
-
Print: `Created GitHub Issue #{number}: {title}`
|
|
85
|
-
|
|
86
|
-
### If provider=jira and BACKLOG_WRITE=true — Create JIRA Story
|
|
87
|
-
|
|
88
|
-
Create a JIRA Story using the same authentication and API pattern as `/specrails:auto-propose-backlog-specs`:
|
|
89
|
-
- Summary: The Spec Title
|
|
90
|
-
- Description: Full structured proposal in Atlassian Document Format
|
|
91
|
-
- Labels: `spec-proposal`
|
|
92
|
-
|
|
93
|
-
Print: `Created JIRA ticket {key}: {title}`
|
|
94
|
-
|
|
95
|
-
### If BACKLOG_WRITE=false or provider=none
|
|
96
|
-
|
|
97
|
-
Do NOT create any tickets. Print:
|
|
98
|
-
```
|
|
99
|
-
Spec proposal ready. Create a ticket manually if desired:
|
|
100
|
-
Title: {Spec Title}
|
|
101
|
-
Complexity: {Estimated Complexity}
|
|
102
|
-
```
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
---
|
|
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."
|
|
4
|
-
category: Workflow
|
|
5
|
-
tags: [workflow, refactoring, code-quality, tech-debt]
|
|
6
|
-
---
|
|
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}}.
|
|
9
|
-
|
|
10
|
-
**Input:** `$ARGUMENTS` — optional: comma-separated paths to scope the analysis. Flags: `--dry-run` (print findings without creating issues).
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Phase 0: Pre-flight
|
|
15
|
-
|
|
16
|
-
Check whether the GitHub CLI is available:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
{{BACKLOG_PREFLIGHT}}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Set `GH_AVAILABLE=true` if the command succeeds, `GH_AVAILABLE=false` otherwise. Do not stop — analysis proceeds regardless. Parse `--dry-run` from `$ARGUMENTS` and set `DRY_RUN=true` if present.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## Phase 1: Scope
|
|
27
|
-
|
|
28
|
-
Parse paths from `$ARGUMENTS` after stripping any flags. If no paths are provided, scan the entire repository.
|
|
29
|
-
|
|
30
|
-
Always exclude the following from all analysis:
|
|
31
|
-
|
|
32
|
-
- `node_modules/`
|
|
33
|
-
- `.git/`
|
|
34
|
-
- `.claude/`
|
|
35
|
-
- `vendor/`
|
|
36
|
-
- `dist/`
|
|
37
|
-
- `build/`
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## Phase 2: Analysis
|
|
42
|
-
|
|
43
|
-
Analyze the scoped files across six categories. For each finding record:
|
|
44
|
-
|
|
45
|
-
- **file** — relative path
|
|
46
|
-
- **line_range** — start and end line numbers
|
|
47
|
-
- **current_snippet** — the problematic code as-is
|
|
48
|
-
- **proposed_snippet** — concrete refactored version
|
|
49
|
-
- **rationale** — one sentence explaining the improvement
|
|
50
|
-
|
|
51
|
-
### Duplicate Code
|
|
52
|
-
|
|
53
|
-
Find code blocks larger than 10 lines that are substantially similar across two or more files. Consolidation into a shared function or module is the expected refactoring.
|
|
54
|
-
|
|
55
|
-
### Long Functions
|
|
56
|
-
|
|
57
|
-
Find functions or methods exceeding 50 lines. Extraction into smaller, single-purpose functions is the expected refactoring.
|
|
58
|
-
|
|
59
|
-
### Large Files
|
|
60
|
-
|
|
61
|
-
Find files exceeding 300 lines. Splitting into cohesive modules is the expected refactoring.
|
|
62
|
-
|
|
63
|
-
### Dead Code
|
|
64
|
-
|
|
65
|
-
Find unused exports, unreferenced functions, and commented-out blocks that have not been active for the lifetime of the file. Deletion or archival is the expected refactoring.
|
|
66
|
-
|
|
67
|
-
### Outdated Patterns
|
|
68
|
-
|
|
69
|
-
Find deprecated APIs and old language syntax: `var` instead of `let`/`const`, callbacks instead of `async`/`await`, legacy framework APIs with documented replacements, etc. Modernisation to current idioms is the expected refactoring.
|
|
70
|
-
|
|
71
|
-
### Complex Logic
|
|
72
|
-
|
|
73
|
-
Find deeply nested conditionals (more than 3 levels) and functions with high cyclomatic complexity. Extraction, early-return guards, or strategy patterns are the expected refactoring.
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## Phase 3: Score and Rank
|
|
78
|
-
|
|
79
|
-
Score every finding on two dimensions (1–5 each):
|
|
80
|
-
|
|
81
|
-
- **Impact** — how much the refactoring improves code quality, readability, or maintainability
|
|
82
|
-
- **Effort** — how hard the refactoring is to implement (1 = trivial, 5 = major)
|
|
83
|
-
|
|
84
|
-
**Composite score**: `impact * 2 + (6 - effort)`. Higher is better.
|
|
85
|
-
|
|
86
|
-
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
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## Phase 4: Create GitHub Issues
|
|
91
|
-
|
|
92
|
-
Skip this phase if `GH_AVAILABLE=false` or `DRY_RUN=true`.
|
|
93
|
-
|
|
94
|
-
First ensure the tracking labels exist:
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
gh label create "refactor-opportunity" --color "B60205" --force
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Fetch existing open issues that already carry the label to avoid duplicates:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
gh issue list --label "refactor-opportunity" --state open --limit 100 --json number,title
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
For each of the **top 5** findings (by composite score) that does not already have a matching open issue, create a GitHub Issue with the following body:
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
## Refactoring Opportunity: {description}
|
|
110
|
-
|
|
111
|
-
**Category**: {category}
|
|
112
|
-
**File**: {file}:{line_range}
|
|
113
|
-
**Impact**: {impact}/5 | **Effort**: {effort}/5 | **Score**: {composite}
|
|
114
|
-
|
|
115
|
-
### Current Code
|
|
116
|
-
```{lang}
|
|
117
|
-
{current_snippet}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Proposed Refactoring
|
|
121
|
-
```{lang}
|
|
122
|
-
{proposed_snippet}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Rationale
|
|
126
|
-
{rationale}
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
_Generated by `/specrails:refactor-recommender` in {{PROJECT_NAME}}_
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Phase 5: Output Summary
|
|
135
|
-
|
|
136
|
-
Print the following report:
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
## Refactoring Opportunities — {{PROJECT_NAME}}
|
|
140
|
-
|
|
141
|
-
{N} opportunities found | Sorted by composite score
|
|
142
|
-
|
|
143
|
-
| # | Category | File | Impact | Effort | Score | Description |
|
|
144
|
-
|---|----------|------|--------|--------|-------|-------------|
|
|
145
|
-
| 1 | {category} | {file}:{line_range} | {impact}/5 | {effort}/5 | {composite} | {description} |
|
|
146
|
-
...
|
|
147
|
-
|
|
148
|
-
### Top 3 Detailed Recommendations
|
|
149
|
-
|
|
150
|
-
#### 1. {description}
|
|
151
|
-
**File**: {file}:{line_range}
|
|
152
|
-
**Category**: {category} | **Score**: {composite}
|
|
153
|
-
|
|
154
|
-
**Current:**
|
|
155
|
-
```{lang}
|
|
156
|
-
{current_snippet}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
**Proposed:**
|
|
160
|
-
```{lang}
|
|
161
|
-
{proposed_snippet}
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
**Rationale:** {rationale}
|
|
165
|
-
|
|
166
|
-
(repeat for #2 and #3)
|
|
167
|
-
|
|
168
|
-
Issues created: {N} (or "dry-run: no issues created")
|
|
169
|
-
```
|