Skip to content

Commit dd065b1

Browse files
jamesarichCopilot
andauthored
chore: add spec-kit configuration and project-tailored templates (#2)
* chore: add spec-kit configuration and project-tailored templates - Initialize .specify/ with constitution (v1.0.0), customized templates (spec, plan, tasks, checklist), extensions (git, brownfield), and workflow registry - Add speckit agent definitions (.github/agents/speckit.*.agent.md) - Add speckit prompt definitions (.github/prompts/speckit.*.prompt.md) - Add plan-integration marker to copilot-instructions.md - Templates reference actual module structure, Gradle tasks, source paths, ADRs, and KMP conventions - Validated against codebase: all paths, commands, and dependencies verified accurate Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: James Rich <james.a.rich@gmail.com> * fix(transport-ble,docs): remove dead code and align SPEC plugin names - Remove unused GattErrorCategory import from BleTransport.kt - Remove dead GATT_RETRY_BACKOFF_MS property (backoff handled by GattErrorCategory.backoffMs) - Add ADR-012 lifecycle-idempotency annotations to BLE transport atomics - Update docs/SPEC.md convention plugin references from meshtastic.radio.* to actual names (meshtastic.kmp.library, meshtastic.android.library, meshtastic.publishing, etc.) - Update Appendix A class name to KmpLibraryConventionPlugin Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: James Rich <james.a.rich@gmail.com> * docs: sync SPEC.md v2.2 with shipped implementation (post-audit) Comprehensive audit of SPEC.md against the actual codebase revealed significant drift. This revision synchronizes the spec with reality. Key changes: - Pin toolchain/SDK versions (JVM 21, Android SDK 36, Kotlin 2.3.20) - Document full RadioClient surface (configBundle, channels, sendReaction, requestNodeInfo, sendRaw, connectAndAwaitReady, AutoReconnectConfig) - Expand AdminApi from 15 to 45 methods; add AdminResult extensions - Add StoreForwardApi, SendDSL, SendOutcome - Expand MeshEvent (13+ variants) and NodeChange (WentOffline/CameOnline) - Add DeviceStorage passkey + heartbeat persistence methods - Update engine internals to match inline implementation - Expand anchor invariants 11-17 - Update Appendix A/B to match actual convention plugins and versions - Fix heartbeat nonce semantics (nonce=0, not incrementing) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: James Rich <james.a.rich@gmail.com> * Update documentation and specifications to v2.2 Synchronize all documentation with the v2.2 specification to reflect recent SDK additions and architectural refinements: - **New Features:** Introduced the Send DSL, `autoReconnect` configuration, and heartbeat-based presence tracking (`WentOffline`/`CameOnline`). - **API Extensions:** Added convenience extensions for `AdminResult` and `ConnectionState`, plus a new `connectAndAwaitReady()` lifecycle method. - **Error Handling:** Expanded `SendFailure` types (IdCollision, AckTimeout) and added `CongestionWarning`, `ExternalConfigChange`, and `StorageDegraded` to `MeshEvent`. - **Storage & State:** Updated `StorageProvider` for session passkey persistence and added `configBundle` and `channels` flows to the client. - **Maintenance:** Bumped Android SDK requirement to API 36, updated the project roadmap, and documented new parity sample applications in the module graph. * feat(core): add neighborInfoFlow and neighborInfoMessages extensions on RadioClient Add typed Flow<NeighborInfo> and raw Flow<MeshPacket> convenience extensions on RadioClient, matching the existing textMessages pattern. Enables consumers to collect pre-decoded NeighborInfo domain objects without manual packet filtering or proto ADAPTER.decode calls. - neighborInfoMessages: filtered Flow<MeshPacket> for NEIGHBORINFO_APP port - neighborInfoFlow: mapped Flow<NeighborInfo> with full proto decoding Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: James Rich <james.a.rich@gmail.com> * docs: sync project documentation with SPEC.md v2.2 updates Update api-reference, error-taxonomy, module-graph, roadmap, README, CONTRIBUTING, and CHANGELOG to align with SPEC.md v2.2 revisions. Refresh Spec Kit agent definitions, templates, and workflow registry. Signed-off-by: James Rich <james.a.rich@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix(tooling): add description frontmatter to speckit prompts and relax markdownlint rules All 18 speckit.*.prompt.md files were missing the required 'description' key in their YAML frontmatter. The tooling check.sh validates 'has("description")' on every .prompt.md file, causing CI failure. Fix: copy each agent's description into its matching prompt file. Also disable MD029/MD031/MD040 in the markdownlint invocation — these fire on vendored speckit agent files whose fenced‐block style we do not control. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: James Rich <james.a.rich@gmail.com> --------- Signed-off-by: James Rich <james.a.rich@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e6b1b99 commit dd065b1

94 files changed

Lines changed: 8726 additions & 204 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
---
2+
description: Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.
3+
---
4+
5+
## User Input
6+
7+
```text
8+
$ARGUMENTS
9+
```
10+
11+
You **MUST** consider the user input before proceeding (if not empty).
12+
13+
## Pre-Execution Checks
14+
15+
**Check for extension hooks (before analysis)**:
16+
- Check if `.specify/extensions.yml` exists in the project root.
17+
- If it exists, read it and look for entries under the `hooks.before_analyze` key
18+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
19+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
20+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
21+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
22+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
23+
- For each executable hook, output the following based on its `optional` flag:
24+
- **Optional hook** (`optional: true`):
25+
```
26+
## Extension Hooks
27+
28+
**Optional Pre-Hook**: {extension}
29+
Command: `/{command}`
30+
Description: {description}
31+
32+
Prompt: {prompt}
33+
To execute: `/{command}`
34+
```
35+
- **Mandatory hook** (`optional: false`):
36+
```
37+
## Extension Hooks
38+
39+
**Automatic Pre-Hook**: {extension}
40+
Executing: `/{command}`
41+
EXECUTE_COMMAND: {command}
42+
43+
Wait for the result of the hook command before proceeding to the Goal.
44+
```
45+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
46+
47+
## Goal
48+
49+
Identify inconsistencies, duplications, ambiguities, and underspecified items across the three core artifacts (`spec.md`, `plan.md`, `tasks.md`) before implementation. This command MUST run only after `/speckit.tasks` has successfully produced a complete `tasks.md`.
50+
51+
## Operating Constraints
52+
53+
**STRICTLY READ-ONLY**: Do **not** modify any files. Output a structured analysis report. Offer an optional remediation plan (user must explicitly approve before any follow-up editing commands would be invoked manually).
54+
55+
**Constitution Authority**: The project constitution (`.specify/memory/constitution.md`) is **non-negotiable** within this analysis scope. Constitution conflicts are automatically CRITICAL and require adjustment of the spec, plan, or tasks—not dilution, reinterpretation, or silent ignoring of the principle. If a principle itself needs to change, that must occur in a separate, explicit constitution update outside `/speckit.analyze`.
56+
57+
## Execution Steps
58+
59+
### 1. Initialize Analysis Context
60+
61+
Run `.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
62+
63+
- SPEC = FEATURE_DIR/spec.md
64+
- PLAN = FEATURE_DIR/plan.md
65+
- TASKS = FEATURE_DIR/tasks.md
66+
67+
Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
68+
For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
69+
70+
### 2. Load Artifacts (Progressive Disclosure)
71+
72+
Load only the minimal necessary context from each artifact:
73+
74+
**From spec.md:**
75+
76+
- Overview/Context
77+
- Functional Requirements
78+
- Success Criteria (measurable outcomes — e.g., performance, security, availability, user success, business impact)
79+
- User Stories
80+
- Edge Cases (if present)
81+
82+
**From plan.md:**
83+
84+
- Architecture/stack choices
85+
- Data Model references
86+
- Phases
87+
- Technical constraints
88+
89+
**From tasks.md:**
90+
91+
- Task IDs
92+
- Descriptions
93+
- Phase grouping
94+
- Parallel markers [P]
95+
- Referenced file paths
96+
97+
**From constitution:**
98+
99+
- Load `.specify/memory/constitution.md` for principle validation
100+
101+
### 3. Build Semantic Models
102+
103+
Create internal representations (do not include raw artifacts in output):
104+
105+
- **Requirements inventory**: For each Functional Requirement (FR-###) and Success Criterion (SC-###), record a stable key. Use the explicit FR-/SC- identifier as the primary key when present, and optionally also derive an imperative-phrase slug for readability (e.g., "User can upload file" → `user-can-upload-file`). Include only Success Criteria items that require buildable work (e.g., load-testing infrastructure, security audit tooling), and exclude post-launch outcome metrics and business KPIs (e.g., "Reduce support tickets by 50%").
106+
- **User story/action inventory**: Discrete user actions with acceptance criteria
107+
- **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases)
108+
- **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements
109+
110+
### 4. Detection Passes (Token-Efficient Analysis)
111+
112+
Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
113+
114+
#### A. Duplication Detection
115+
116+
- Identify near-duplicate requirements
117+
- Mark lower-quality phrasing for consolidation
118+
119+
#### B. Ambiguity Detection
120+
121+
- Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria
122+
- Flag unresolved placeholders (TODO, TKTK, ???, `<placeholder>`, etc.)
123+
124+
#### C. Underspecification
125+
126+
- Requirements with verbs but missing object or measurable outcome
127+
- User stories missing acceptance criteria alignment
128+
- Tasks referencing files or components not defined in spec/plan
129+
130+
#### D. Constitution Alignment
131+
132+
- Any requirement or plan element conflicting with a MUST principle
133+
- Missing mandated sections or quality gates from constitution
134+
135+
#### E. Coverage Gaps
136+
137+
- Requirements with zero associated tasks
138+
- Tasks with no mapped requirement/story
139+
- Success Criteria requiring buildable work (performance, security, availability) not reflected in tasks
140+
141+
#### F. Inconsistency
142+
143+
- Terminology drift (same concept named differently across files)
144+
- Data entities referenced in plan but absent in spec (or vice versa)
145+
- Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note)
146+
- Conflicting requirements (e.g., one requires Next.js while other specifies Vue)
147+
148+
### 5. Severity Assignment
149+
150+
Use this heuristic to prioritize findings:
151+
152+
- **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality
153+
- **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion
154+
- **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case
155+
- **LOW**: Style/wording improvements, minor redundancy not affecting execution order
156+
157+
### 6. Produce Compact Analysis Report
158+
159+
Output a Markdown report (no file writes) with the following structure:
160+
161+
## Specification Analysis Report
162+
163+
| ID | Category | Severity | Location(s) | Summary | Recommendation |
164+
|----|----------|----------|-------------|---------|----------------|
165+
| A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
166+
167+
(Add one row per finding; generate stable IDs prefixed by category initial.)
168+
169+
**Coverage Summary Table:**
170+
171+
| Requirement Key | Has Task? | Task IDs | Notes |
172+
|-----------------|-----------|----------|-------|
173+
174+
**Constitution Alignment Issues:** (if any)
175+
176+
**Unmapped Tasks:** (if any)
177+
178+
**Metrics:**
179+
180+
- Total Requirements
181+
- Total Tasks
182+
- Coverage % (requirements with >=1 task)
183+
- Ambiguity Count
184+
- Duplication Count
185+
- Critical Issues Count
186+
187+
### 7. Provide Next Actions
188+
189+
At end of report, output a concise Next Actions block:
190+
191+
- If CRITICAL issues exist: Recommend resolving before `/speckit.implement`
192+
- If only LOW/MEDIUM: User may proceed, but provide improvement suggestions
193+
- Provide explicit command suggestions: e.g., "Run /speckit.specify with refinement", "Run /speckit.plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'"
194+
195+
### 8. Offer Remediation
196+
197+
Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
198+
199+
### 9. Check for extension hooks
200+
201+
After reporting, check if `.specify/extensions.yml` exists in the project root.
202+
- If it exists, read it and look for entries under the `hooks.after_analyze` key
203+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
204+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
205+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
206+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
207+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
208+
- For each executable hook, output the following based on its `optional` flag:
209+
- **Optional hook** (`optional: true`):
210+
```
211+
## Extension Hooks
212+
213+
**Optional Hook**: {extension}
214+
Command: `/{command}`
215+
Description: {description}
216+
217+
Prompt: {prompt}
218+
To execute: `/{command}`
219+
```
220+
- **Mandatory hook** (`optional: false`):
221+
```
222+
## Extension Hooks
223+
224+
**Automatic Hook**: {extension}
225+
Executing: `/{command}`
226+
EXECUTE_COMMAND: {command}
227+
```
228+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
229+
230+
## Operating Principles
231+
232+
### Context Efficiency
233+
234+
- **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation
235+
- **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis
236+
- **Token-efficient output**: Limit findings table to 50 rows; summarize overflow
237+
- **Deterministic results**: Rerunning without changes should produce consistent IDs and counts
238+
239+
### Analysis Guidelines
240+
241+
- **NEVER modify files** (this is read-only analysis)
242+
- **NEVER hallucinate missing sections** (if absent, report them accurately)
243+
- **Prioritize constitution violations** (these are always CRITICAL)
244+
- **Use examples over exhaustive rules** (cite specific instances, not generic patterns)
245+
- **Report zero issues gracefully** (emit success report with coverage statistics)
246+
247+
## Context
248+
249+
$ARGUMENTS
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
description: Generate spec-kit configuration tailored to the existing codebase
3+
---
4+
5+
6+
<!-- Extension: brownfield -->
7+
<!-- Config: .specify/extensions/brownfield/ -->
8+
# Bootstrap Spec-Kit
9+
10+
Generate a customized spec-kit configuration for an existing codebase. Uses the project profile from `/speckit.brownfield.scan` (or performs a scan if none exists) to create a constitution, templates, and agent configuration that match the project's actual architecture, tech stack, and conventions.
11+
12+
## User Input
13+
14+
```text
15+
$ARGUMENTS
16+
```
17+
18+
You **MUST** consider the user input before proceeding (if not empty). The user may specify preferences (e.g., "strict TDD", "minimal constitution"), a target directory for a monorepo module, or request specific template customizations.
19+
20+
## Prerequisites
21+
22+
1. Verify the current directory is a git repository
23+
2. Verify a spec-kit project exists by checking for `.specify/` directory (run `specify init` first if missing)
24+
3. Check if a project profile exists from a previous scan — if not, run a scan first
25+
26+
## Outline
27+
28+
1. **Load or generate project profile**: Check if `/speckit.brownfield.scan` has been run:
29+
- If a project profile exists, use it
30+
- If not, perform an inline scan to gather tech stack, architecture, and conventions
31+
- Confirm the profile with the user before proceeding
32+
33+
2. **Generate constitution**: Create `.specify/memory/constitution.md` tailored to the project:
34+
35+
The constitution **MUST** include:
36+
- **Project identity**: Name, purpose, primary language(s), architecture pattern
37+
- **Code boundaries**: Which directories contain which types of code (e.g., "frontend code lives in `client/`, backend in `server/`")
38+
- **Naming conventions**: File naming, variable naming, branch naming as detected
39+
- **Testing requirements**: Test framework, test location, coverage expectations
40+
- **Dependency rules**: How modules depend on each other, what imports are allowed
41+
- **Quality gates**: Linting, formatting, CI checks that must pass
42+
43+
The constitution **MUST NOT**:
44+
- Override existing project standards without user confirmation
45+
- Invent conventions that don't exist in the codebase
46+
- Include generic boilerplate unrelated to the actual project
47+
48+
3. **Customize spec template**: Modify `.specify/templates/spec-template.md` to reflect the project:
49+
- Add project-specific sections (e.g., "Database Migrations" for projects with ORMs)
50+
- Include architecture-aware requirements (e.g., "Frontend Requirements" and "API Requirements" for full-stack projects)
51+
- Reference actual module paths instead of generic placeholders
52+
53+
4. **Customize plan template**: Modify `.specify/templates/plan-template.md` to reflect the project:
54+
- Include module-aware implementation sections (e.g., separate phases for frontend/backend)
55+
- Reference actual test frameworks and build tools
56+
- Include project-specific complexity factors
57+
58+
5. **Customize tasks template**: Modify `.specify/templates/tasks-template.md` to reflect the project:
59+
- Task phases should map to the project's actual module structure
60+
- Include project-specific setup tasks (e.g., database migration, dependency install)
61+
- Reference actual test commands (e.g., `npm test`, `pytest`, `go test ./...`)
62+
63+
6. **Generate AGENTS.md** (if multi-module): For monorepos and multi-module projects:
64+
- Define agent boundaries per module
65+
- Specify which agent owns which directories
66+
- Set up inter-agent communication rules
67+
68+
7. **Present changes**: Show the user what will be created or modified:
69+
70+
```markdown
71+
# Bootstrap Plan
72+
73+
| File | Action | Description |
74+
|------|--------|-------------|
75+
| `.specify/memory/constitution.md` | Create | Project-specific constitution with detected conventions |
76+
| `.specify/templates/spec-template.md` | Modify | Add project-specific sections (Database Migrations, API Contract) |
77+
| `.specify/templates/plan-template.md` | Modify | Add module-aware phases (frontend, backend, shared) |
78+
| `.specify/templates/tasks-template.md` | Modify | Add actual test commands and build steps |
79+
| `AGENTS.md` | Create | Agent boundaries for frontend and backend modules |
80+
81+
Proceed with bootstrap? (confirm before writing)
82+
```
83+
84+
8. **Execute bootstrap**: After user confirmation, write all files.
85+
86+
9. **Report**:
87+
88+
```markdown
89+
# Bootstrap Complete
90+
91+
| Artifact | Status |
92+
|----------|--------|
93+
| Constitution | ✅ Created — 12 rules from detected conventions |
94+
| Spec template | ✅ Customized — added Database Migrations, API Contract sections |
95+
| Plan template | ✅ Customized — frontend/backend phase split |
96+
| Tasks template | ✅ Customized — actual test commands included |
97+
| AGENTS.md | ✅ Created — 2 agents (frontend, backend) |
98+
99+
## Next Steps
100+
- Review `.specify/memory/constitution.md` and adjust any rules
101+
- Run `/speckit.brownfield.validate` to verify configuration matches project
102+
- Run `/speckit.brownfield.migrate` to reverse-engineer specs for existing features
103+
- Start new features with `/speckit.specify` — templates are now project-aware
104+
```
105+
106+
## Rules
107+
108+
- **Always confirm before writing** — show the bootstrap plan and wait for approval
109+
- **Never overwrite without asking** — if constitution or templates already exist, show a diff and ask
110+
- **Derive from reality** — every constitution rule must trace to something detected in the codebase
111+
- **No invented conventions** — if the project has no consistent pattern for something, say so instead of guessing
112+
- **Respect existing spec-kit setup** — if `.specify/` already has customizations, merge rather than replace
113+
- **Module-aware** — for monorepos, generate configuration that respects module boundaries

0 commit comments

Comments
 (0)