Skip to content

Commit c2646ed

Browse files
committed
feat: add review subcommand, Copilot agent integration, and auto-detect improvements
- Add 'rustyspec review' with preflight heuristics (7 dimensions, scoring, markdown report) - Add Copilot agents (.github/agents/) and prompts (.github/prompts/) for all 9 commands - Add copilot-instructions.md with project guidelines - Improve agent auto-detection: register agents with available CLI (not just existing dirs) - Add --agent flag to 'rustyspec init' for explicit agent targeting - Consolidate find_binary() (nvm-aware) into registry.rs, reuse from invoker.rs - Add Copilot CLI format rendering (render_copilot_agent/prompt) - Fix review .test.txt file detection for generic test scaffolds - Fix pipeline execute_phase missing review arm - Fix registry {{arg}} literal interpolation bug - Fix security check wrongly gated on constitution presence - Fix grade/score rounding mismatch (truncation vs round) - Fix ambiguous language detection false positives (word-boundary regex) - Update README with 8-step workflow, review command, install docs - Update .gitignore to exclude generated artifacts
1 parent 65b89b5 commit c2646ed

33 files changed

Lines changed: 1580 additions & 53 deletions
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
description: "Validate cross-artifact consistency"
3+
tools: [read, edit, search, execute]
4+
argument-hint: "Feature ID (e.g. 001-feature-name)"
5+
---
6+
7+
Read the project context from .rustyspec/AGENT.md.
8+
9+
Feature ID: $ARGUMENTS
10+
Find the matching directory under specs/.
11+
12+
Validate cross-artifact consistency:
13+
1. Check that plan.md addresses all requirements from spec.md
14+
2. Check that tasks.md covers all planned work
15+
3. Check that tests cover all acceptance scenarios
16+
4. Report any gaps or inconsistencies
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
description: "Generate a quality validation checklist"
3+
tools: [read, edit, search, execute]
4+
argument-hint: "Feature ID (e.g. 001-feature-name)"
5+
---
6+
7+
Read the project context from .rustyspec/AGENT.md, then execute the 'checklist' workflow for the feature specified by $ARGUMENTS.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
description: "Resolve ambiguities in a specification"
3+
tools: [read, edit, search, execute]
4+
argument-hint: "Feature ID (e.g. 001-feature-name)"
5+
---
6+
7+
Read the project context from .rustyspec/AGENT.md.
8+
9+
Feature ID: $ARGUMENTS
10+
Find the matching directory under specs/.
11+
12+
Read spec.md and find all [NEEDS CLARIFICATION] markers.
13+
For each marker:
14+
1. Identify the ambiguity
15+
2. Propose a resolution based on best practices
16+
3. Update spec.md with the resolution
17+
4. Remove the [NEEDS CLARIFICATION] marker
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
description: "Execute tasks from the task breakdown"
3+
tools: [read, edit, search, execute]
4+
argument-hint: "Feature ID (e.g. 001-feature-name)"
5+
---
6+
7+
Read the project context from .rustyspec/AGENT.md, then implement the feature.
8+
9+
The feature ID is: $ARGUMENTS
10+
Find the matching directory under specs/ (e.g. specs/001-feature-name/).
11+
12+
Steps:
13+
1. Read the feature's tasks.md for the task list
14+
2. Read the feature's spec.md for requirements and acceptance criteria
15+
3. Read the feature's plan.md for architecture decisions
16+
4. Execute each task in order, respecting phase dependencies
17+
5. Tasks marked [P] can be done in parallel
18+
6. After completing each task, update tasks.md: change `- [ ]` to `- [x]` for that task
19+
7. When all tasks are done, run /rustyspec-analyze to validate
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
description: "Generate an architecture plan from a specification"
3+
tools: [read, edit, search, execute]
4+
argument-hint: "Feature ID (e.g. 001-feature-name)"
5+
---
6+
7+
Read the project context from .rustyspec/AGENT.md.
8+
9+
Feature ID: $ARGUMENTS
10+
Find the matching directory under specs/ and read spec.md for requirements.
11+
12+
Fill in the planning documents with real content:
13+
1. plan.md — Architecture decisions, tech stack, project structure, constitution check
14+
2. research.md — Technology investigation findings
15+
3. data-model.md — Entity definitions and relationships
16+
4. contracts/api.md — API contracts if applicable
17+
5. quickstart.md — Key validation scenarios
18+
19+
Complete the Constitution Check in plan.md.
20+
Fill all [NEEDS CLARIFICATION] and [To be filled] sections with concrete content.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
description: "Review spec quality with preflight heuristics"
3+
tools: [read, edit, search, execute]
4+
argument-hint: "Feature ID (e.g. 001-feature-name)"
5+
---
6+
7+
Read the project context from .rustyspec/AGENT.md.
8+
9+
Feature ID: $ARGUMENTS
10+
Find the matching directory under specs/.
11+
12+
Perform a comprehensive spec quality review:
13+
1. Check for placeholder text and incomplete sections
14+
2. Validate requirement quality and testability
15+
3. Check cross-artifact consistency (spec → plan → tasks)
16+
4. Assess security, performance, and maintainability concerns
17+
5. Write findings to $ARGUMENTS/review-report.md
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
description: "Create a new feature specification"
3+
tools: [read, edit, search, execute]
4+
argument-hint: "Feature ID (e.g. 001-feature-name)"
5+
---
6+
7+
Read the project context from .rustyspec/AGENT.md.
8+
9+
Feature ID: $ARGUMENTS
10+
Find the matching directory under specs/ (e.g. specs/001-feature-name/).
11+
12+
Fill in the feature's spec.md with real content:
13+
1. Replace [Brief Title] with a descriptive story title
14+
2. Write user stories with clear Given/When/Then acceptance scenarios
15+
3. Define functional requirements (FR-001, FR-002, etc.)
16+
4. Identify key entities and their relationships
17+
5. Define measurable success criteria
18+
6. List edge cases
19+
20+
Keep requirements technology-agnostic. Focus on WHAT, not HOW.
21+
Only edit the existing spec.md — do not create new files.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
description: "Generate a story-driven task breakdown from the plan"
3+
tools: [read, edit, search, execute]
4+
argument-hint: "Feature ID (e.g. 001-feature-name)"
5+
---
6+
7+
Read the project context from .rustyspec/AGENT.md.
8+
9+
Feature ID: $ARGUMENTS
10+
Find the matching directory under specs/.
11+
Read spec.md and plan.md.
12+
13+
Fill in tasks.md with concrete, actionable tasks:
14+
1. Define specific tasks with clear deliverables
15+
2. Organize by phases (Setup → Foundational → User Stories → Polish)
16+
3. Mark parallel-safe tasks with [P]
17+
4. Link tasks to user stories with [US1], [US2], etc.
18+
5. Replace all placeholder text with real content
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
description: "Generate test scaffolds from acceptance scenarios"
3+
tools: [read, edit, search, execute]
4+
argument-hint: "Feature ID (e.g. 001-feature-name)"
5+
---
6+
7+
Read the project context from .rustyspec/AGENT.md.
8+
9+
Feature ID: $ARGUMENTS
10+
Find the matching directory under specs/.
11+
Read spec.md for acceptance scenarios.
12+
13+
Review and enhance test scaffolds in the feature's tests/ directory:
14+
1. Add concrete test implementations for each Given/When/Then scenario
15+
2. Replace placeholder text with real test assertions
16+
3. Add edge case tests based on the spec
17+
4. Ensure tests are runnable with the project's test framework

.github/copilot-instructions.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# RustySpec Project Guidelines
2+
3+
## What This Project Is
4+
5+
RustySpec is a Rust CLI tool (`rustyspec`) implementing Specification-Driven Development (SDD) — it transforms feature descriptions into structured specs, plans, tasks, and test scaffolds, then orchestrates AI agents to implement them.
6+
7+
See [docs/ARCHITECTURE.md](../docs/ARCHITECTURE.md) for full system architecture and data flows.
8+
9+
## Build and Test
10+
11+
```bash
12+
# Build
13+
cargo build --release
14+
15+
# Test (uses assert_cmd + tempfile for CLI integration tests)
16+
cargo test
17+
18+
# Run locally
19+
cargo run -- [subcommand]
20+
```
21+
22+
Rust edition: **2024**. No Makefile or justfile — Cargo is the sole build tool.
23+
24+
## Architecture
25+
26+
The codebase has a strict layered separation:
27+
28+
| Layer | Location | Rule |
29+
|-------|----------|------|
30+
| CLI | `src/cli/` | **No business logic** — thin handlers only; delegate to core/agents/templates |
31+
| Domain | `src/core/` | Pure logic, no CLI imports — library-ready |
32+
| Agent integration | `src/agents/` | 21 AI agents, data-driven config, CLI invocation with fallback to handoff |
33+
| Templating | `src/templates/` | Tera rendering; 4-layer resolution (see below) |
34+
| Config | `src/config/` | TOML-based; `RootConfig` + `PipelineConfig` |
35+
| Extensions/Presets | `src/extensions/`, `src/presets/` | CRUD + cross-platform hook execution |
36+
37+
Each `src/cli/` file maps 1-to-1 to a subcommand. Never add business logic there.
38+
39+
## Key Conventions
40+
41+
**Errors:** Use `RustySpecError` (`src/core/errors.rs`) with `thiserror`. Every error variant must include a `fix` field with a human-actionable suggestion. Use `anyhow::Result` in fallible functions.
42+
43+
**CLI parsing:** Clap derive macros (`#[derive(Parser)]`). Global `--debug` flag lives on the root `Cli` struct.
44+
45+
**Serialization:** `serde` with `#[derive(Serialize, Deserialize)]` for all config/manifest types.
46+
47+
**Embedded templates:** Use `include_str!()` to embed templates from `templates/` into the binary. Template resolution priority:
48+
```
49+
1. .rustyspec/templates/overrides/ ← project-level tweaks (highest)
50+
2. .rustyspec/presets/<id>/templates/
51+
3. .rustyspec/extensions/<id>/templates/
52+
4. Binary-embedded defaults ← fallback
53+
```
54+
55+
**Runtime config locations:**
56+
- `rustyspec.toml` — project config (root)
57+
- `.rustyspec/` — constitution, templates, extensions, presets, internal state
58+
- `.rustyspec/project-config.json``ProjectInternalConfig` (internal state, not user-facing)
59+
60+
**Feature resolution** cascades: explicit CLI arg → env var → current git branch → latest `specs/` directory.
61+
62+
## Module Organization
63+
64+
- Max 2 directory levels under `src/`
65+
- `mod.rs` re-exports public symbols; sub-files are focused on a single concern
66+
- `src/core/` modules: `spec_parser`, `task_generator`, `test_generator`, `constitution`, `analyzer`, `review`, `git`, `feature`, `errors`, `token`, `vscode`, `pipeline`
67+
68+
## Documentation
69+
70+
Don't duplicate — link:
71+
- Architecture details → [docs/ARCHITECTURE.md](../docs/ARCHITECTURE.md)
72+
- SDD methodology → [docs/rusty-specification.md](../docs/rusty-specification.md)
73+
- Pipeline orchestration → [docs/multi-agent-pipeline.md](../docs/multi-agent-pipeline.md)
74+
- Test scaffold generation → [docs/spec-to-test-generation.md](../docs/spec-to-test-generation.md)
75+
- Feature backlog → [docs/KILLER_FEATURE_IDEAS.md](../docs/KILLER_FEATURE_IDEAS.md)

0 commit comments

Comments
 (0)