Spaces:
Build error
Build error
Commit ·
8c3e275
0
Parent(s):
initial clean deployment commit with compilers
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .dockerignore +21 -0
- .editorconfig +12 -0
- .env.example +24 -0
- .gemini/commands/speckit.agent-context.update.toml +29 -0
- .gemini/commands/speckit.analyze.toml +251 -0
- .gemini/commands/speckit.checklist.toml +365 -0
- .gemini/commands/speckit.clarify.toml +277 -0
- .gemini/commands/speckit.constitution.toml +148 -0
- .gemini/commands/speckit.converge.toml +269 -0
- .gemini/commands/speckit.implement.toml +215 -0
- .gemini/commands/speckit.plan.toml +162 -0
- .gemini/commands/speckit.specify.toml +337 -0
- .gemini/commands/speckit.tasks.toml +206 -0
- .gemini/commands/speckit.taskstoissues.toml +101 -0
- .gitignore +29 -0
- .gitlab-ci.yml +107 -0
- .gitlint +6 -0
- .pre-commit-config.yaml +70 -0
- .secrets.baseline +133 -0
- .specify/extensions.yml +23 -0
- .specify/extensions/.registry +19 -0
- .specify/extensions/agent-context/README.md +66 -0
- .specify/extensions/agent-context/agent-context-config.yml +5 -0
- .specify/extensions/agent-context/commands/speckit.agent-context.update.md +27 -0
- .specify/extensions/agent-context/extension.yml +34 -0
- .specify/extensions/agent-context/scripts/bash/update-agent-context.sh +337 -0
- .specify/extensions/agent-context/scripts/powershell/update-agent-context.ps1 +417 -0
- .specify/init-options.json +8 -0
- .specify/integration.json +15 -0
- .specify/integrations/gemini.manifest.json +17 -0
- .specify/integrations/speckit.manifest.json +17 -0
- .specify/memory/constitution.md +50 -0
- .specify/scripts/powershell/check-prerequisites.ps1 +147 -0
- .specify/scripts/powershell/common.ps1 +558 -0
- .specify/scripts/powershell/create-new-feature.ps1 +240 -0
- .specify/scripts/powershell/setup-plan.ps1 +64 -0
- .specify/scripts/powershell/setup-tasks.ps1 +69 -0
- .specify/templates/checklist-template.md +40 -0
- .specify/templates/constitution-template.md +50 -0
- .specify/templates/plan-template.md +113 -0
- .specify/templates/spec-template.md +131 -0
- .specify/templates/tasks-template.md +252 -0
- .specify/workflows/speckit/workflow.yml +77 -0
- .specify/workflows/workflow-registry.json +13 -0
- AGENTS.md +11 -0
- CHANGELOG.md +46 -0
- CODE_OF_CONDUCT.md +23 -0
- CONTRIBUTING.md +71 -0
- Dockerfile +43 -0
- GEMINI.md +9 -0
.dockerignore
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.git
|
| 2 |
+
.gitignore
|
| 3 |
+
.gitlab-ci.yml
|
| 4 |
+
.venv
|
| 5 |
+
.pip-cache
|
| 6 |
+
node_modules
|
| 7 |
+
frontend/node_modules
|
| 8 |
+
frontend/dist
|
| 9 |
+
dist
|
| 10 |
+
build
|
| 11 |
+
*.db
|
| 12 |
+
*.sqlite
|
| 13 |
+
*.log
|
| 14 |
+
image.png
|
| 15 |
+
tests/
|
| 16 |
+
__pycache__
|
| 17 |
+
*.pyc
|
| 18 |
+
.mypy_cache
|
| 19 |
+
.pytest_cache
|
| 20 |
+
.secrets.baseline
|
| 21 |
+
.pre-commit-config.yaml
|
.editorconfig
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
root = true
|
| 2 |
+
|
| 3 |
+
[*]
|
| 4 |
+
indent_style = space
|
| 5 |
+
indent_size = 4
|
| 6 |
+
end_of_line = lf
|
| 7 |
+
charset = utf-8
|
| 8 |
+
trim_trailing_whitespace = true
|
| 9 |
+
insert_final_newline = true
|
| 10 |
+
|
| 11 |
+
[*.{js,jsx,ts,tsx,css,html,json,yml,yaml}]
|
| 12 |
+
indent_size = 2
|
.env.example
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PageParse Environment Configuration Example
|
| 2 |
+
# Copy this file to '.env' and modify as needed. Do NOT commit the '.env' file itself.
|
| 3 |
+
|
| 4 |
+
# Enable Air-gap mode to bypass all backend API calls (true/false)
|
| 5 |
+
PAGEPARSE_AIRGAP=false
|
| 6 |
+
|
| 7 |
+
# OCR threshold setting
|
| 8 |
+
PAGEPARSE_CONFIDENCE_THRESHOLD=0.5
|
| 9 |
+
|
| 10 |
+
# Ollama local endpoint URL
|
| 11 |
+
PAGEPARSE_OLLAMA_URL=http://localhost:11434
|
| 12 |
+
|
| 13 |
+
# LLM / SLM models to load
|
| 14 |
+
PAGEPARSE_SLM_MODEL=llama3.2:1b
|
| 15 |
+
PAGEPARSE_VISION_MODEL=moondream
|
| 16 |
+
|
| 17 |
+
# Text-To-Speech engine flag
|
| 18 |
+
PAGEPARSE_TTS_ENABLED=false
|
| 19 |
+
|
| 20 |
+
# Dynamic task extraction schema
|
| 21 |
+
PAGEPARSE_AUTO_SCHEMA=true
|
| 22 |
+
|
| 23 |
+
# Check duplicates and skip processing
|
| 24 |
+
PAGEPARSE_DIFF_SYNC_ENABLED=false
|
.gemini/commands/speckit.agent-context.update.toml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
description = "Refresh the managed Spec Kit section in coding agent context file(s)"
|
| 2 |
+
|
| 3 |
+
# Source: agent-context
|
| 4 |
+
|
| 5 |
+
prompt = """
|
| 6 |
+
# Update Coding Agent Context
|
| 7 |
+
|
| 8 |
+
Refresh the managed Spec Kit section inside the active coding agent's context/instruction file (e.g. `CLAUDE.md`, `.github/copilot-instructions.md`, `AGENTS.md`).
|
| 9 |
+
|
| 10 |
+
## Behavior
|
| 11 |
+
|
| 12 |
+
The script reads the agent-context extension config at
|
| 13 |
+
`.specify/extensions/agent-context/agent-context-config.yml` to discover:
|
| 14 |
+
|
| 15 |
+
- `context_file` — the path of the coding agent context file to manage.
|
| 16 |
+
- `context_files` — optional project-relative paths for multiple coding agent context files. When non-empty, the script updates each listed file and the list takes precedence over `context_file`.
|
| 17 |
+
- `context_markers.start` / `.end` — the delimiters surrounding the managed section. Defaults to `<!-- SPECKIT START -->` and `<!-- SPECKIT END -->` when the field is missing.
|
| 18 |
+
|
| 19 |
+
It then creates, replaces, or appends the managed block so that the section points at the most recent plan path when one can be discovered (`specs/<feature>/plan.md`).
|
| 20 |
+
|
| 21 |
+
If `context_files` and `context_file` are empty, the command reports nothing to do and exits successfully. Context file paths must stay project-relative; absolute paths, Windows drive paths, backslash separators, and `..` path segments are rejected.
|
| 22 |
+
|
| 23 |
+
## Execution
|
| 24 |
+
|
| 25 |
+
- **Bash**: `.specify/extensions/agent-context/scripts/bash/update-agent-context.sh [plan_path]`
|
| 26 |
+
- **PowerShell**: `.specify/extensions/agent-context/scripts/powershell/update-agent-context.ps1 [plan_path]`
|
| 27 |
+
|
| 28 |
+
When `plan_path` is omitted, the script auto-detects the most recently modified `specs/*/plan.md`.
|
| 29 |
+
"""
|
.gemini/commands/speckit.analyze.toml
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
description = "Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation."
|
| 2 |
+
|
| 3 |
+
prompt = """
|
| 4 |
+
|
| 5 |
+
## User Input
|
| 6 |
+
|
| 7 |
+
```text
|
| 8 |
+
{{args}}
|
| 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 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 46 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 47 |
+
|
| 48 |
+
## Goal
|
| 49 |
+
|
| 50 |
+
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`.
|
| 51 |
+
|
| 52 |
+
## Operating Constraints
|
| 53 |
+
|
| 54 |
+
**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).
|
| 55 |
+
|
| 56 |
+
**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`.
|
| 57 |
+
|
| 58 |
+
## Execution Steps
|
| 59 |
+
|
| 60 |
+
### 1. Initialize Analysis Context
|
| 61 |
+
|
| 62 |
+
Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
|
| 63 |
+
|
| 64 |
+
- SPEC = FEATURE_DIR/spec.md
|
| 65 |
+
- PLAN = FEATURE_DIR/plan.md
|
| 66 |
+
- TASKS = FEATURE_DIR/tasks.md
|
| 67 |
+
|
| 68 |
+
Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
|
| 69 |
+
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").
|
| 70 |
+
|
| 71 |
+
### 2. Load Artifacts (Progressive Disclosure)
|
| 72 |
+
|
| 73 |
+
Load only the minimal necessary context from each artifact:
|
| 74 |
+
|
| 75 |
+
**From spec.md:**
|
| 76 |
+
|
| 77 |
+
- Overview/Context
|
| 78 |
+
- Functional Requirements
|
| 79 |
+
- Success Criteria (measurable outcomes — e.g., performance, security, availability, user success, business impact)
|
| 80 |
+
- User Stories
|
| 81 |
+
- Edge Cases (if present)
|
| 82 |
+
|
| 83 |
+
**From plan.md:**
|
| 84 |
+
|
| 85 |
+
- Architecture/stack choices
|
| 86 |
+
- Data Model references
|
| 87 |
+
- Phases
|
| 88 |
+
- Technical constraints
|
| 89 |
+
|
| 90 |
+
**From tasks.md:**
|
| 91 |
+
|
| 92 |
+
- Task IDs
|
| 93 |
+
- Descriptions
|
| 94 |
+
- Phase grouping
|
| 95 |
+
- Parallel markers [P]
|
| 96 |
+
- Referenced file paths
|
| 97 |
+
|
| 98 |
+
**From constitution:**
|
| 99 |
+
|
| 100 |
+
- Load `.specify/memory/constitution.md` for principle validation
|
| 101 |
+
|
| 102 |
+
### 3. Build Semantic Models
|
| 103 |
+
|
| 104 |
+
Create internal representations (do not include raw artifacts in output):
|
| 105 |
+
|
| 106 |
+
- **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%").
|
| 107 |
+
- **User story/action inventory**: Discrete user actions with acceptance criteria
|
| 108 |
+
- **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases)
|
| 109 |
+
- **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements
|
| 110 |
+
|
| 111 |
+
### 4. Detection Passes (Token-Efficient Analysis)
|
| 112 |
+
|
| 113 |
+
Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
|
| 114 |
+
|
| 115 |
+
#### A. Duplication Detection
|
| 116 |
+
|
| 117 |
+
- Identify near-duplicate requirements
|
| 118 |
+
- Mark lower-quality phrasing for consolidation
|
| 119 |
+
|
| 120 |
+
#### B. Ambiguity Detection
|
| 121 |
+
|
| 122 |
+
- Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria
|
| 123 |
+
- Flag unresolved placeholders (TODO, TKTK, ???, `<placeholder>`, etc.)
|
| 124 |
+
|
| 125 |
+
#### C. Underspecification
|
| 126 |
+
|
| 127 |
+
- Requirements with verbs but missing object or measurable outcome
|
| 128 |
+
- User stories missing acceptance criteria alignment
|
| 129 |
+
- Tasks referencing files or components not defined in spec/plan
|
| 130 |
+
|
| 131 |
+
#### D. Constitution Alignment
|
| 132 |
+
|
| 133 |
+
- Any requirement or plan element conflicting with a MUST principle
|
| 134 |
+
- Missing mandated sections or quality gates from constitution
|
| 135 |
+
|
| 136 |
+
#### E. Coverage Gaps
|
| 137 |
+
|
| 138 |
+
- Requirements with zero associated tasks
|
| 139 |
+
- Tasks with no mapped requirement/story
|
| 140 |
+
- Success Criteria requiring buildable work (performance, security, availability) not reflected in tasks
|
| 141 |
+
|
| 142 |
+
#### F. Inconsistency
|
| 143 |
+
|
| 144 |
+
- Terminology drift (same concept named differently across files)
|
| 145 |
+
- Data entities referenced in plan but absent in spec (or vice versa)
|
| 146 |
+
- Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note)
|
| 147 |
+
- Conflicting requirements (e.g., one requires Next.js while other specifies Vue)
|
| 148 |
+
|
| 149 |
+
### 5. Severity Assignment
|
| 150 |
+
|
| 151 |
+
Use this heuristic to prioritize findings:
|
| 152 |
+
|
| 153 |
+
- **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality
|
| 154 |
+
- **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion
|
| 155 |
+
- **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case
|
| 156 |
+
- **LOW**: Style/wording improvements, minor redundancy not affecting execution order
|
| 157 |
+
|
| 158 |
+
### 6. Produce Compact Analysis Report
|
| 159 |
+
|
| 160 |
+
Output a Markdown report (no file writes) with the following structure:
|
| 161 |
+
|
| 162 |
+
## Specification Analysis Report
|
| 163 |
+
|
| 164 |
+
| ID | Category | Severity | Location(s) | Summary | Recommendation |
|
| 165 |
+
|----|----------|----------|-------------|---------|----------------|
|
| 166 |
+
| A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
|
| 167 |
+
|
| 168 |
+
(Add one row per finding; generate stable IDs prefixed by category initial.)
|
| 169 |
+
|
| 170 |
+
**Coverage Summary Table:**
|
| 171 |
+
|
| 172 |
+
| Requirement Key | Has Task? | Task IDs | Notes |
|
| 173 |
+
|-----------------|-----------|----------|-------|
|
| 174 |
+
|
| 175 |
+
**Constitution Alignment Issues:** (if any)
|
| 176 |
+
|
| 177 |
+
**Unmapped Tasks:** (if any)
|
| 178 |
+
|
| 179 |
+
**Metrics:**
|
| 180 |
+
|
| 181 |
+
- Total Requirements
|
| 182 |
+
- Total Tasks
|
| 183 |
+
- Coverage % (requirements with >=1 task)
|
| 184 |
+
- Ambiguity Count
|
| 185 |
+
- Duplication Count
|
| 186 |
+
- Critical Issues Count
|
| 187 |
+
|
| 188 |
+
### 7. Provide Next Actions
|
| 189 |
+
|
| 190 |
+
At end of report, output a concise Next Actions block:
|
| 191 |
+
|
| 192 |
+
- If CRITICAL issues exist: Recommend resolving before `/speckit.implement`
|
| 193 |
+
- If only LOW/MEDIUM: User may proceed, but provide improvement suggestions
|
| 194 |
+
- 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'"
|
| 195 |
+
|
| 196 |
+
### 8. Offer Remediation
|
| 197 |
+
|
| 198 |
+
Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
|
| 199 |
+
|
| 200 |
+
### 9. Check for extension hooks
|
| 201 |
+
|
| 202 |
+
After reporting, check if `.specify/extensions.yml` exists in the project root.
|
| 203 |
+
- If it exists, read it and look for entries under the `hooks.after_analyze` key
|
| 204 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 205 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 206 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 207 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 208 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 209 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 210 |
+
- **Optional hook** (`optional: true`):
|
| 211 |
+
```
|
| 212 |
+
## Extension Hooks
|
| 213 |
+
|
| 214 |
+
**Optional Hook**: {extension}
|
| 215 |
+
Command: `/{command}`
|
| 216 |
+
Description: {description}
|
| 217 |
+
|
| 218 |
+
Prompt: {prompt}
|
| 219 |
+
To execute: `/{command}`
|
| 220 |
+
```
|
| 221 |
+
- **Mandatory hook** (`optional: false`):
|
| 222 |
+
```
|
| 223 |
+
## Extension Hooks
|
| 224 |
+
|
| 225 |
+
**Automatic Hook**: {extension}
|
| 226 |
+
Executing: `/{command}`
|
| 227 |
+
EXECUTE_COMMAND: {command}
|
| 228 |
+
```
|
| 229 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 230 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 231 |
+
|
| 232 |
+
## Operating Principles
|
| 233 |
+
|
| 234 |
+
### Context Efficiency
|
| 235 |
+
|
| 236 |
+
- **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation
|
| 237 |
+
- **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis
|
| 238 |
+
- **Token-efficient output**: Limit findings table to 50 rows; summarize overflow
|
| 239 |
+
- **Deterministic results**: Rerunning without changes should produce consistent IDs and counts
|
| 240 |
+
|
| 241 |
+
### Analysis Guidelines
|
| 242 |
+
|
| 243 |
+
- **NEVER modify files** (this is read-only analysis)
|
| 244 |
+
- **NEVER hallucinate missing sections** (if absent, report them accurately)
|
| 245 |
+
- **Prioritize constitution violations** (these are always CRITICAL)
|
| 246 |
+
- **Use examples over exhaustive rules** (cite specific instances, not generic patterns)
|
| 247 |
+
- **Report zero issues gracefully** (emit success report with coverage statistics)
|
| 248 |
+
|
| 249 |
+
## Context
|
| 250 |
+
|
| 251 |
+
{{args}}"""
|
.gemini/commands/speckit.checklist.toml
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
description = "Generate a custom checklist for the current feature based on user requirements."
|
| 2 |
+
|
| 3 |
+
prompt = """
|
| 4 |
+
|
| 5 |
+
## Checklist Purpose: "Unit Tests for English"
|
| 6 |
+
|
| 7 |
+
**CRITICAL CONCEPT**: Checklists are **UNIT TESTS FOR REQUIREMENTS WRITING** - they validate the quality, clarity, and completeness of requirements in a given domain.
|
| 8 |
+
|
| 9 |
+
**NOT for verification/testing**:
|
| 10 |
+
|
| 11 |
+
- ❌ NOT "Verify the button clicks correctly"
|
| 12 |
+
- ❌ NOT "Test error handling works"
|
| 13 |
+
- ❌ NOT "Confirm the API returns 200"
|
| 14 |
+
- ❌ NOT checking if code/implementation matches the spec
|
| 15 |
+
|
| 16 |
+
**FOR requirements quality validation**:
|
| 17 |
+
|
| 18 |
+
- ✅ "Are visual hierarchy requirements defined for all card types?" (completeness)
|
| 19 |
+
- ✅ "Is 'prominent display' quantified with specific sizing/positioning?" (clarity)
|
| 20 |
+
- ✅ "Are hover state requirements consistent across all interactive elements?" (consistency)
|
| 21 |
+
- ✅ "Are accessibility requirements defined for keyboard navigation?" (coverage)
|
| 22 |
+
- ✅ "Does the spec define what happens when logo image fails to load?" (edge cases)
|
| 23 |
+
|
| 24 |
+
**Metaphor**: If your spec is code written in English, the checklist is its unit test suite. You're testing whether the requirements are well-written, complete, unambiguous, and ready for implementation - NOT whether the implementation works.
|
| 25 |
+
|
| 26 |
+
## User Input
|
| 27 |
+
|
| 28 |
+
```text
|
| 29 |
+
{{args}}
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 33 |
+
|
| 34 |
+
## Pre-Execution Checks
|
| 35 |
+
|
| 36 |
+
**Check for extension hooks (before checklist generation)**:
|
| 37 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 38 |
+
- If it exists, read it and look for entries under the `hooks.before_checklist` key
|
| 39 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 40 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 41 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 42 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 43 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 44 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 45 |
+
- **Optional hook** (`optional: true`):
|
| 46 |
+
```
|
| 47 |
+
## Extension Hooks
|
| 48 |
+
|
| 49 |
+
**Optional Pre-Hook**: {extension}
|
| 50 |
+
Command: `/{command}`
|
| 51 |
+
Description: {description}
|
| 52 |
+
|
| 53 |
+
Prompt: {prompt}
|
| 54 |
+
To execute: `/{command}`
|
| 55 |
+
```
|
| 56 |
+
- **Mandatory hook** (`optional: false`):
|
| 57 |
+
```
|
| 58 |
+
## Extension Hooks
|
| 59 |
+
|
| 60 |
+
**Automatic Pre-Hook**: {extension}
|
| 61 |
+
Executing: `/{command}`
|
| 62 |
+
EXECUTE_COMMAND: {command}
|
| 63 |
+
|
| 64 |
+
Wait for the result of the hook command before proceeding to the Execution Steps.
|
| 65 |
+
```
|
| 66 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 67 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 68 |
+
|
| 69 |
+
## Execution Steps
|
| 70 |
+
|
| 71 |
+
1. **Setup**: Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json` from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS list.
|
| 72 |
+
- All file paths must be absolute.
|
| 73 |
+
- 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").
|
| 74 |
+
|
| 75 |
+
2. **IF EXISTS**: Load `.specify/memory/constitution.md` for project principles and governance constraints.
|
| 76 |
+
|
| 77 |
+
3. **Clarify intent (dynamic)**: Derive up to THREE initial contextual clarifying questions (no pre-baked catalog). They MUST:
|
| 78 |
+
- Be generated from the user's phrasing + extracted signals from spec/plan/tasks
|
| 79 |
+
- Only ask about information that materially changes checklist content
|
| 80 |
+
- Be skipped individually if already unambiguous in `{{args}}`
|
| 81 |
+
- Prefer precision over breadth
|
| 82 |
+
|
| 83 |
+
Generation algorithm:
|
| 84 |
+
1. Extract signals: feature domain keywords (e.g., auth, latency, UX, API), risk indicators ("critical", "must", "compliance"), stakeholder hints ("QA", "review", "security team"), and explicit deliverables ("a11y", "rollback", "contracts").
|
| 85 |
+
2. Cluster signals into candidate focus areas (max 4) ranked by relevance.
|
| 86 |
+
3. Identify probable audience & timing (author, reviewer, QA, release) if not explicit.
|
| 87 |
+
4. Detect missing dimensions: scope breadth, depth/rigor, risk emphasis, exclusion boundaries, measurable acceptance criteria.
|
| 88 |
+
5. Formulate questions chosen from these archetypes:
|
| 89 |
+
- Scope refinement (e.g., "Should this include integration touchpoints with X and Y or stay limited to local module correctness?")
|
| 90 |
+
- Risk prioritization (e.g., "Which of these potential risk areas should receive mandatory gating checks?")
|
| 91 |
+
- Depth calibration (e.g., "Is this a lightweight pre-commit sanity list or a formal release gate?")
|
| 92 |
+
- Audience framing (e.g., "Will this be used by the author only or peers during PR review?")
|
| 93 |
+
- Boundary exclusion (e.g., "Should we explicitly exclude performance tuning items this round?")
|
| 94 |
+
- Scenario class gap (e.g., "No recovery flows detected—are rollback / partial failure paths in scope?")
|
| 95 |
+
|
| 96 |
+
Question formatting rules:
|
| 97 |
+
- If presenting options, generate a compact table with columns: Option | Candidate | Why It Matters
|
| 98 |
+
- Limit to A–E options maximum; omit table if a free-form answer is clearer
|
| 99 |
+
- Never ask the user to restate what they already said
|
| 100 |
+
- Avoid speculative categories (no hallucination). If uncertain, ask explicitly: "Confirm whether X belongs in scope."
|
| 101 |
+
|
| 102 |
+
Defaults when interaction impossible:
|
| 103 |
+
- Depth: Standard
|
| 104 |
+
- Audience: Reviewer (PR) if code-related; Author otherwise
|
| 105 |
+
- Focus: Top 2 relevance clusters
|
| 106 |
+
|
| 107 |
+
Output the questions (label Q1/Q2/Q3). After answers: if ≥2 scenario classes (Alternate / Exception / Recovery / Non-Functional domain) remain unclear, you MAY ask up to TWO more targeted follow‑ups (Q4/Q5) with a one-line justification each (e.g., "Unresolved recovery path risk"). Do not exceed five total questions. Skip escalation if user explicitly declines more.
|
| 108 |
+
|
| 109 |
+
4. **Understand user request**: Combine `{{args}}` + clarifying answers:
|
| 110 |
+
- Derive checklist theme (e.g., security, review, deploy, ux)
|
| 111 |
+
- Consolidate explicit must-have items mentioned by user
|
| 112 |
+
- Map focus selections to category scaffolding
|
| 113 |
+
- Infer any missing context from spec/plan/tasks (do NOT hallucinate)
|
| 114 |
+
|
| 115 |
+
5. **Load feature context**: Read from FEATURE_DIR:
|
| 116 |
+
- spec.md: Feature requirements and scope
|
| 117 |
+
- plan.md (if exists): Technical details, dependencies
|
| 118 |
+
- tasks.md (if exists): Implementation tasks
|
| 119 |
+
|
| 120 |
+
**Context Loading Strategy**:
|
| 121 |
+
- Load only necessary portions relevant to active focus areas (avoid full-file dumping)
|
| 122 |
+
- Prefer summarizing long sections into concise scenario/requirement bullets
|
| 123 |
+
- Use progressive disclosure: add follow-on retrieval only if gaps detected
|
| 124 |
+
- If source docs are large, generate interim summary items instead of embedding raw text
|
| 125 |
+
|
| 126 |
+
6. **Generate checklist** - Create "Unit Tests for Requirements":
|
| 127 |
+
- Create `FEATURE_DIR/checklists/` directory if it doesn't exist
|
| 128 |
+
- Generate unique checklist filename:
|
| 129 |
+
- Use short, descriptive name based on domain (e.g., `ux.md`, `api.md`, `security.md`)
|
| 130 |
+
- Format: `[domain].md`
|
| 131 |
+
- File handling behavior:
|
| 132 |
+
- If file does NOT exist: Create new file and number items starting from CHK001
|
| 133 |
+
- If file exists: Append new items to existing file, continuing from the last CHK ID (e.g., if last item is CHK015, start new items at CHK016)
|
| 134 |
+
- Never delete or replace existing checklist content - always preserve and append
|
| 135 |
+
|
| 136 |
+
**CORE PRINCIPLE - Test the Requirements, Not the Implementation**:
|
| 137 |
+
Every checklist item MUST evaluate the REQUIREMENTS THEMSELVES for:
|
| 138 |
+
- **Completeness**: Are all necessary requirements present?
|
| 139 |
+
- **Clarity**: Are requirements unambiguous and specific?
|
| 140 |
+
- **Consistency**: Do requirements align with each other?
|
| 141 |
+
- **Measurability**: Can requirements be objectively verified?
|
| 142 |
+
- **Coverage**: Are all scenarios/edge cases addressed?
|
| 143 |
+
|
| 144 |
+
**Category Structure** - Group items by requirement quality dimensions:
|
| 145 |
+
- **Requirement Completeness** (Are all necessary requirements documented?)
|
| 146 |
+
- **Requirement Clarity** (Are requirements specific and unambiguous?)
|
| 147 |
+
- **Requirement Consistency** (Do requirements align without conflicts?)
|
| 148 |
+
- **Acceptance Criteria Quality** (Are success criteria measurable?)
|
| 149 |
+
- **Scenario Coverage** (Are all flows/cases addressed?)
|
| 150 |
+
- **Edge Case Coverage** (Are boundary conditions defined?)
|
| 151 |
+
- **Non-Functional Requirements** (Performance, Security, Accessibility, etc. - are they specified?)
|
| 152 |
+
- **Dependencies & Assumptions** (Are they documented and validated?)
|
| 153 |
+
- **Ambiguities & Conflicts** (What needs clarification?)
|
| 154 |
+
|
| 155 |
+
**HOW TO WRITE CHECKLIST ITEMS - "Unit Tests for English"**:
|
| 156 |
+
|
| 157 |
+
❌ **WRONG** (Testing implementation):
|
| 158 |
+
- "Verify landing page displays 3 episode cards"
|
| 159 |
+
- "Test hover states work on desktop"
|
| 160 |
+
- "Confirm logo click navigates home"
|
| 161 |
+
|
| 162 |
+
✅ **CORRECT** (Testing requirements quality):
|
| 163 |
+
- "Are the exact number and layout of featured episodes specified?" [Completeness]
|
| 164 |
+
- "Is 'prominent display' quantified with specific sizing/positioning?" [Clarity]
|
| 165 |
+
- "Are hover state requirements consistent across all interactive elements?" [Consistency]
|
| 166 |
+
- "Are keyboard navigation requirements defined for all interactive UI?" [Coverage]
|
| 167 |
+
- "Is the fallback behavior specified when logo image fails to load?" [Edge Cases]
|
| 168 |
+
- "Are loading states defined for asynchronous episode data?" [Completeness]
|
| 169 |
+
- "Does the spec define visual hierarchy for competing UI elements?" [Clarity]
|
| 170 |
+
|
| 171 |
+
**ITEM STRUCTURE**:
|
| 172 |
+
Each item should follow this pattern:
|
| 173 |
+
- Question format asking about requirement quality
|
| 174 |
+
- Focus on what's WRITTEN (or not written) in the spec/plan
|
| 175 |
+
- Include quality dimension in brackets [Completeness/Clarity/Consistency/etc.]
|
| 176 |
+
- Reference spec section `[Spec §X.Y]` when checking existing requirements
|
| 177 |
+
- Use `[Gap]` marker when checking for missing requirements
|
| 178 |
+
|
| 179 |
+
**EXAMPLES BY QUALITY DIMENSION**:
|
| 180 |
+
|
| 181 |
+
Completeness:
|
| 182 |
+
- "Are error handling requirements defined for all API failure modes? [Gap]"
|
| 183 |
+
- "Are accessibility requirements specified for all interactive elements? [Completeness]"
|
| 184 |
+
- "Are mobile breakpoint requirements defined for responsive layouts? [Gap]"
|
| 185 |
+
|
| 186 |
+
Clarity:
|
| 187 |
+
- "Is 'fast loading' quantified with specific timing thresholds? [Clarity, Spec §NFR-2]"
|
| 188 |
+
- "Are 'related episodes' selection criteria explicitly defined? [Clarity, Spec §FR-5]"
|
| 189 |
+
- "Is 'prominent' defined with measurable visual properties? [Ambiguity, Spec §FR-4]"
|
| 190 |
+
|
| 191 |
+
Consistency:
|
| 192 |
+
- "Do navigation requirements align across all pages? [Consistency, Spec §FR-10]"
|
| 193 |
+
- "Are card component requirements consistent between landing and detail pages? [Consistency]"
|
| 194 |
+
|
| 195 |
+
Coverage:
|
| 196 |
+
- "Are requirements defined for zero-state scenarios (no episodes)? [Coverage, Edge Case]"
|
| 197 |
+
- "Are concurrent user interaction scenarios addressed? [Coverage, Gap]"
|
| 198 |
+
- "Are requirements specified for partial data loading failures? [Coverage, Exception Flow]"
|
| 199 |
+
|
| 200 |
+
Measurability:
|
| 201 |
+
- "Are visual hierarchy requirements measurable/testable? [Acceptance Criteria, Spec §FR-1]"
|
| 202 |
+
- "Can 'balanced visual weight' be objectively verified? [Measurability, Spec §FR-2]"
|
| 203 |
+
|
| 204 |
+
**Scenario Classification & Coverage** (Requirements Quality Focus):
|
| 205 |
+
- Check if requirements exist for: Primary, Alternate, Exception/Error, Recovery, Non-Functional scenarios
|
| 206 |
+
- For each scenario class, ask: "Are [scenario type] requirements complete, clear, and consistent?"
|
| 207 |
+
- If scenario class missing: "Are [scenario type] requirements intentionally excluded or missing? [Gap]"
|
| 208 |
+
- Include resilience/rollback when state mutation occurs: "Are rollback requirements defined for migration failures? [Gap]"
|
| 209 |
+
|
| 210 |
+
**Traceability Requirements**:
|
| 211 |
+
- MINIMUM: ≥80% of items MUST include at least one traceability reference
|
| 212 |
+
- Each item should reference: spec section `[Spec §X.Y]`, or use markers: `[Gap]`, `[Ambiguity]`, `[Conflict]`, `[Assumption]`
|
| 213 |
+
- If no ID system exists: "Is a requirement & acceptance criteria ID scheme established? [Traceability]"
|
| 214 |
+
|
| 215 |
+
**Surface & Resolve Issues** (Requirements Quality Problems):
|
| 216 |
+
Ask questions about the requirements themselves:
|
| 217 |
+
- Ambiguities: "Is the term 'fast' quantified with specific metrics? [Ambiguity, Spec §NFR-1]"
|
| 218 |
+
- Conflicts: "Do navigation requirements conflict between §FR-10 and §FR-10a? [Conflict]"
|
| 219 |
+
- Assumptions: "Is the assumption of 'always available podcast API' validated? [Assumption]"
|
| 220 |
+
- Dependencies: "Are external podcast API requirements documented? [Dependency, Gap]"
|
| 221 |
+
- Missing definitions: "Is 'visual hierarchy' defined with measurable criteria? [Gap]"
|
| 222 |
+
|
| 223 |
+
**Content Consolidation**:
|
| 224 |
+
- Soft cap: If raw candidate items > 40, prioritize by risk/impact
|
| 225 |
+
- Merge near-duplicates checking the same requirement aspect
|
| 226 |
+
- If >5 low-impact edge cases, create one item: "Are edge cases X, Y, Z addressed in requirements? [Coverage]"
|
| 227 |
+
|
| 228 |
+
**🚫 ABSOLUTELY PROHIBITED** - These make it an implementation test, not a requirements test:
|
| 229 |
+
- ❌ Any item starting with "Verify", "Test", "Confirm", "Check" + implementation behavior
|
| 230 |
+
- ❌ References to code execution, user actions, system behavior
|
| 231 |
+
- ❌ "Displays correctly", "works properly", "functions as expected"
|
| 232 |
+
- ❌ "Click", "navigate", "render", "load", "execute"
|
| 233 |
+
- ❌ Test cases, test plans, QA procedures
|
| 234 |
+
- ❌ Implementation details (frameworks, APIs, algorithms)
|
| 235 |
+
|
| 236 |
+
**✅ REQUIRED PATTERNS** - These test requirements quality:
|
| 237 |
+
- ✅ "Are [requirement type] defined/specified/documented for [scenario]?"
|
| 238 |
+
- ✅ "Is [vague term] quantified/clarified with specific criteria?"
|
| 239 |
+
- ✅ "Are requirements consistent between [section A] and [section B]?"
|
| 240 |
+
- ✅ "Can [requirement] be objectively measured/verified?"
|
| 241 |
+
- ✅ "Are [edge cases/scenarios] addressed in requirements?"
|
| 242 |
+
- ✅ "Does the spec define [missing aspect]?"
|
| 243 |
+
|
| 244 |
+
7. **Structure Reference**: Generate the checklist following the canonical template in `.specify/templates/checklist-template.md` for title, meta section, category headings, and ID formatting. If template is unavailable, use: H1 title, purpose/created meta lines, `##` category sections containing `- [ ] CHK### <requirement item>` lines with globally incrementing IDs starting at CHK001.
|
| 245 |
+
|
| 246 |
+
8. **Report**: Output full path to checklist file, item count, and summarize whether the run created a new file or appended to an existing one. Summarize:
|
| 247 |
+
- Focus areas selected
|
| 248 |
+
- Depth level
|
| 249 |
+
- Actor/timing
|
| 250 |
+
- Any explicit user-specified must-have items incorporated
|
| 251 |
+
|
| 252 |
+
**Important**: Each `/speckit.checklist` command invocation uses a short, descriptive checklist filename and either creates a new file or appends to an existing one. This allows:
|
| 253 |
+
|
| 254 |
+
- Multiple checklists of different types (e.g., `ux.md`, `test.md`, `security.md`)
|
| 255 |
+
- Simple, memorable filenames that indicate checklist purpose
|
| 256 |
+
- Easy identification and navigation in the `checklists/` folder
|
| 257 |
+
|
| 258 |
+
To avoid clutter, use descriptive types and clean up obsolete checklists when done.
|
| 259 |
+
|
| 260 |
+
## Example Checklist Types & Sample Items
|
| 261 |
+
|
| 262 |
+
**UX Requirements Quality:** `ux.md`
|
| 263 |
+
|
| 264 |
+
Sample items (testing the requirements, NOT the implementation):
|
| 265 |
+
|
| 266 |
+
- "Are visual hierarchy requirements defined with measurable criteria? [Clarity, Spec §FR-1]"
|
| 267 |
+
- "Is the number and positioning of UI elements explicitly specified? [Completeness, Spec §FR-1]"
|
| 268 |
+
- "Are interaction state requirements (hover, focus, active) consistently defined? [Consistency]"
|
| 269 |
+
- "Are accessibility requirements specified for all interactive elements? [Coverage, Gap]"
|
| 270 |
+
- "Is fallback behavior defined when images fail to load? [Edge Case, Gap]"
|
| 271 |
+
- "Can 'prominent display' be objectively measured? [Measurability, Spec §FR-4]"
|
| 272 |
+
|
| 273 |
+
**API Requirements Quality:** `api.md`
|
| 274 |
+
|
| 275 |
+
Sample items:
|
| 276 |
+
|
| 277 |
+
- "Are error response formats specified for all failure scenarios? [Completeness]"
|
| 278 |
+
- "Are rate limiting requirements quantified with specific thresholds? [Clarity]"
|
| 279 |
+
- "Are authentication requirements consistent across all endpoints? [Consistency]"
|
| 280 |
+
- "Are retry/timeout requirements defined for external dependencies? [Coverage, Gap]"
|
| 281 |
+
- "Is versioning strategy documented in requirements? [Gap]"
|
| 282 |
+
|
| 283 |
+
**Performance Requirements Quality:** `performance.md`
|
| 284 |
+
|
| 285 |
+
Sample items:
|
| 286 |
+
|
| 287 |
+
- "Are performance requirements quantified with specific metrics? [Clarity]"
|
| 288 |
+
- "Are performance targets defined for all critical user journeys? [Coverage]"
|
| 289 |
+
- "Are performance requirements under different load conditions specified? [Completeness]"
|
| 290 |
+
- "Can performance requirements be objectively measured? [Measurability]"
|
| 291 |
+
- "Are degradation requirements defined for high-load scenarios? [Edge Case, Gap]"
|
| 292 |
+
|
| 293 |
+
**Security Requirements Quality:** `security.md`
|
| 294 |
+
|
| 295 |
+
Sample items:
|
| 296 |
+
|
| 297 |
+
- "Are authentication requirements specified for all protected resources? [Coverage]"
|
| 298 |
+
- "Are data protection requirements defined for sensitive information? [Completeness]"
|
| 299 |
+
- "Is the threat model documented and requirements aligned to it? [Traceability]"
|
| 300 |
+
- "Are security requirements consistent with compliance obligations? [Consistency]"
|
| 301 |
+
- "Are security failure/breach response requirements defined? [Gap, Exception Flow]"
|
| 302 |
+
|
| 303 |
+
## Anti-Examples: What NOT To Do
|
| 304 |
+
|
| 305 |
+
**❌ WRONG - These test implementation, not requirements:**
|
| 306 |
+
|
| 307 |
+
```markdown
|
| 308 |
+
- [ ] CHK001 - Verify landing page displays 3 episode cards [Spec §FR-001]
|
| 309 |
+
- [ ] CHK002 - Test hover states work correctly on desktop [Spec §FR-003]
|
| 310 |
+
- [ ] CHK003 - Confirm logo click navigates to home page [Spec §FR-010]
|
| 311 |
+
- [ ] CHK004 - Check that related episodes section shows 3-5 items [Spec §FR-005]
|
| 312 |
+
```
|
| 313 |
+
|
| 314 |
+
**✅ CORRECT - These test requirements quality:**
|
| 315 |
+
|
| 316 |
+
```markdown
|
| 317 |
+
- [ ] CHK001 - Are the number and layout of featured episodes explicitly specified? [Completeness, Spec §FR-001]
|
| 318 |
+
- [ ] CHK002 - Are hover state requirements consistently defined for all interactive elements? [Consistency, Spec §FR-003]
|
| 319 |
+
- [ ] CHK003 - Are navigation requirements clear for all clickable brand elements? [Clarity, Spec §FR-010]
|
| 320 |
+
- [ ] CHK004 - Is the selection criteria for related episodes documented? [Gap, Spec §FR-005]
|
| 321 |
+
- [ ] CHK005 - Are loading state requirements defined for asynchronous episode data? [Gap]
|
| 322 |
+
- [ ] CHK006 - Can "visual hierarchy" requirements be objectively measured? [Measurability, Spec §FR-001]
|
| 323 |
+
```
|
| 324 |
+
|
| 325 |
+
**Key Differences:**
|
| 326 |
+
|
| 327 |
+
- Wrong: Tests if the system works correctly
|
| 328 |
+
- Correct: Tests if the requirements are written correctly
|
| 329 |
+
- Wrong: Verification of behavior
|
| 330 |
+
- Correct: Validation of requirement quality
|
| 331 |
+
- Wrong: "Does it do X?"
|
| 332 |
+
- Correct: "Is X clearly specified?"
|
| 333 |
+
|
| 334 |
+
## Post-Execution Checks
|
| 335 |
+
|
| 336 |
+
**Check for extension hooks (after checklist generation)**:
|
| 337 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 338 |
+
- If it exists, read it and look for entries under the `hooks.after_checklist` key
|
| 339 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 340 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 341 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 342 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 343 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 344 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 345 |
+
- **Optional hook** (`optional: true`):
|
| 346 |
+
```
|
| 347 |
+
## Extension Hooks
|
| 348 |
+
|
| 349 |
+
**Optional Hook**: {extension}
|
| 350 |
+
Command: `/{command}`
|
| 351 |
+
Description: {description}
|
| 352 |
+
|
| 353 |
+
Prompt: {prompt}
|
| 354 |
+
To execute: `/{command}`
|
| 355 |
+
```
|
| 356 |
+
- **Mandatory hook** (`optional: false`):
|
| 357 |
+
```
|
| 358 |
+
## Extension Hooks
|
| 359 |
+
|
| 360 |
+
**Automatic Hook**: {extension}
|
| 361 |
+
Executing: `/{command}`
|
| 362 |
+
EXECUTE_COMMAND: {command}
|
| 363 |
+
```
|
| 364 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 365 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently"""
|
.gemini/commands/speckit.clarify.toml
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
description = "Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec."
|
| 2 |
+
|
| 3 |
+
prompt = """
|
| 4 |
+
|
| 5 |
+
## User Input
|
| 6 |
+
|
| 7 |
+
```text
|
| 8 |
+
{{args}}
|
| 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 clarification)**:
|
| 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_clarify` 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 Outline.
|
| 44 |
+
```
|
| 45 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 46 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 47 |
+
|
| 48 |
+
## Outline
|
| 49 |
+
|
| 50 |
+
Goal: Detect and reduce ambiguity or missing decision points in the active feature specification and record the clarifications directly in the spec file.
|
| 51 |
+
|
| 52 |
+
Note: This clarification workflow is expected to run (and be completed) BEFORE invoking `/speckit.plan`. If the user explicitly states they are skipping clarification (e.g., exploratory spike), you may proceed, but must warn that downstream rework risk increases.
|
| 53 |
+
|
| 54 |
+
Execution steps:
|
| 55 |
+
|
| 56 |
+
1. Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -PathsOnly` from repo root **once** (combined `--json --paths-only` mode / `-Json -PathsOnly`). Parse minimal JSON payload fields:
|
| 57 |
+
- `FEATURE_DIR`
|
| 58 |
+
- `FEATURE_SPEC`
|
| 59 |
+
- (Optionally capture `IMPL_PLAN`, `TASKS` for future chained flows.)
|
| 60 |
+
- If JSON parsing fails, abort and instruct user to re-run `/speckit.specify` or verify feature branch environment.
|
| 61 |
+
- 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").
|
| 62 |
+
|
| 63 |
+
2. **IF EXISTS**: Load `.specify/memory/constitution.md` for project principles and governance constraints.
|
| 64 |
+
|
| 65 |
+
3. Load the current spec file. Perform a structured ambiguity & coverage scan using this taxonomy. For each category, mark status: Clear / Partial / Missing. Produce an internal coverage map used for prioritization (do not output raw map unless no questions will be asked).
|
| 66 |
+
|
| 67 |
+
Functional Scope & Behavior:
|
| 68 |
+
- Core user goals & success criteria
|
| 69 |
+
- Explicit out-of-scope declarations
|
| 70 |
+
- User roles / personas differentiation
|
| 71 |
+
|
| 72 |
+
Domain & Data Model:
|
| 73 |
+
- Entities, attributes, relationships
|
| 74 |
+
- Identity & uniqueness rules
|
| 75 |
+
- Lifecycle/state transitions
|
| 76 |
+
- Data volume / scale assumptions
|
| 77 |
+
|
| 78 |
+
Interaction & UX Flow:
|
| 79 |
+
- Critical user journeys / sequences
|
| 80 |
+
- Error/empty/loading states
|
| 81 |
+
- Accessibility or localization notes
|
| 82 |
+
|
| 83 |
+
Non-Functional Quality Attributes:
|
| 84 |
+
- Performance (latency, throughput targets)
|
| 85 |
+
- Scalability (horizontal/vertical, limits)
|
| 86 |
+
- Reliability & availability (uptime, recovery expectations)
|
| 87 |
+
- Observability (logging, metrics, tracing signals)
|
| 88 |
+
- Security & privacy (authN/Z, data protection, threat assumptions)
|
| 89 |
+
- Compliance / regulatory constraints (if any)
|
| 90 |
+
|
| 91 |
+
Integration & External Dependencies:
|
| 92 |
+
- External services/APIs and failure modes
|
| 93 |
+
- Data import/export formats
|
| 94 |
+
- Protocol/versioning assumptions
|
| 95 |
+
|
| 96 |
+
Edge Cases & Failure Handling:
|
| 97 |
+
- Negative scenarios
|
| 98 |
+
- Rate limiting / throttling
|
| 99 |
+
- Conflict resolution (e.g., concurrent edits)
|
| 100 |
+
|
| 101 |
+
Constraints & Tradeoffs:
|
| 102 |
+
- Technical constraints (language, storage, hosting)
|
| 103 |
+
- Explicit tradeoffs or rejected alternatives
|
| 104 |
+
|
| 105 |
+
Terminology & Consistency:
|
| 106 |
+
- Canonical glossary terms
|
| 107 |
+
- Avoided synonyms / deprecated terms
|
| 108 |
+
|
| 109 |
+
Completion Signals:
|
| 110 |
+
- Acceptance criteria testability
|
| 111 |
+
- Measurable Definition of Done style indicators
|
| 112 |
+
|
| 113 |
+
Misc / Placeholders:
|
| 114 |
+
- TODO markers / unresolved decisions
|
| 115 |
+
- Ambiguous adjectives ("robust", "intuitive") lacking quantification
|
| 116 |
+
|
| 117 |
+
For each category with Partial or Missing status, add a candidate question opportunity unless:
|
| 118 |
+
- Clarification would not materially change implementation or validation strategy
|
| 119 |
+
- Information is better deferred to planning phase (note internally)
|
| 120 |
+
|
| 121 |
+
4. Generate (internally) a prioritized queue of candidate clarification questions (maximum 5). Do NOT output them all at once. Apply these constraints:
|
| 122 |
+
- Maximum of 5 total questions across the whole session.
|
| 123 |
+
- Each question must be answerable with EITHER:
|
| 124 |
+
- A short multiple‑choice selection (2–5 distinct, mutually exclusive options), OR
|
| 125 |
+
- A one-word / short‑phrase answer (explicitly constrain: "Answer in <=5 words").
|
| 126 |
+
- Only include questions whose answers materially impact architecture, data modeling, task decomposition, test design, UX behavior, operational readiness, or compliance validation.
|
| 127 |
+
- Ensure category coverage balance: attempt to cover the highest impact unresolved categories first; avoid asking two low-impact questions when a single high-impact area (e.g., security posture) is unresolved.
|
| 128 |
+
- Exclude questions already answered, trivial stylistic preferences, or plan-level execution details (unless blocking correctness).
|
| 129 |
+
- Favor clarifications that reduce downstream rework risk or prevent misaligned acceptance tests.
|
| 130 |
+
- If more than 5 categories remain unresolved, select the top 5 by (Impact * Uncertainty) heuristic.
|
| 131 |
+
|
| 132 |
+
5. Sequential questioning loop (interactive):
|
| 133 |
+
- Present EXACTLY ONE question at a time.
|
| 134 |
+
- For multiple‑choice questions:
|
| 135 |
+
- **Analyze all options** and determine the **most suitable option** based on:
|
| 136 |
+
- Best practices for the project type
|
| 137 |
+
- Common patterns in similar implementations
|
| 138 |
+
- Risk reduction (security, performance, maintainability)
|
| 139 |
+
- Alignment with any explicit project goals or constraints visible in the spec
|
| 140 |
+
- Present your **recommended option prominently** at the top with clear reasoning (1-2 sentences explaining why this is the best choice).
|
| 141 |
+
- Format as: `**Recommended:** Option [X] - <reasoning>`
|
| 142 |
+
- Then render all options as a Markdown table:
|
| 143 |
+
|
| 144 |
+
| Option | Description |
|
| 145 |
+
|--------|-------------|
|
| 146 |
+
| A | <Option A description> |
|
| 147 |
+
| B | <Option B description> |
|
| 148 |
+
| C | <Option C description> (add D/E as needed up to 5) |
|
| 149 |
+
| Short | Provide a different short answer (<=5 words) (Include only if free-form alternative is appropriate) |
|
| 150 |
+
|
| 151 |
+
- After the table, add: `You can reply with the option letter (e.g., "A"), accept the recommendation by saying "yes" or "recommended", or provide your own short answer.`
|
| 152 |
+
- For short‑answer style (no meaningful discrete options):
|
| 153 |
+
- Provide your **suggested answer** based on best practices and context.
|
| 154 |
+
- Format as: `**Suggested:** <your proposed answer> - <brief reasoning>`
|
| 155 |
+
- Then output: `Format: Short answer (<=5 words). You can accept the suggestion by saying "yes" or "suggested", or provide your own answer.`
|
| 156 |
+
- After the user answers:
|
| 157 |
+
- If the user replies with "yes", "recommended", or "suggested", use your previously stated recommendation/suggestion as the answer.
|
| 158 |
+
- Otherwise, validate the answer maps to one option or fits the <=5 word constraint.
|
| 159 |
+
- If ambiguous, ask for a quick disambiguation (count still belongs to same question; do not advance).
|
| 160 |
+
- Once satisfactory, record it in working memory (do not yet write to disk) and move to the next queued question.
|
| 161 |
+
- Stop asking further questions when:
|
| 162 |
+
- All critical ambiguities resolved early (remaining queued items become unnecessary), OR
|
| 163 |
+
- User signals completion ("done", "good", "no more"), OR
|
| 164 |
+
- You reach 5 asked questions.
|
| 165 |
+
- Never reveal future queued questions in advance.
|
| 166 |
+
- If no valid questions exist at start, immediately report no critical ambiguities.
|
| 167 |
+
|
| 168 |
+
6. Integration after EACH accepted answer (incremental update approach):
|
| 169 |
+
- Maintain in-memory representation of the spec (loaded once at start) plus the raw file contents.
|
| 170 |
+
- For the first integrated answer in this session:
|
| 171 |
+
- Ensure a `## Clarifications` section exists (create it just after the highest-level contextual/overview section per the spec template if missing).
|
| 172 |
+
- Under it, create (if not present) a `### Session YYYY-MM-DD` subheading for today.
|
| 173 |
+
- Append a bullet line immediately after acceptance: `- Q: <question> → A: <final answer>`.
|
| 174 |
+
- Then immediately apply the clarification to the most appropriate section(s):
|
| 175 |
+
- Functional ambiguity → Update or add a bullet in Functional Requirements.
|
| 176 |
+
- User interaction / actor distinction → Update User Stories or Actors subsection (if present) with clarified role, constraint, or scenario.
|
| 177 |
+
- Data shape / entities → Update Data Model (add fields, types, relationships) preserving ordering; note added constraints succinctly.
|
| 178 |
+
- Non-functional constraint → Add/modify measurable criteria in Success Criteria > Measurable Outcomes (convert vague adjective to metric or explicit target).
|
| 179 |
+
- Edge case / negative flow → Add a new bullet under Edge Cases / Error Handling (or create such subsection if template provides placeholder for it).
|
| 180 |
+
- Terminology conflict → Normalize term across spec; retain original only if necessary by adding `(formerly referred to as "X")` once.
|
| 181 |
+
- If the clarification invalidates an earlier ambiguous statement, replace that statement instead of duplicating; leave no obsolete contradictory text.
|
| 182 |
+
- Save the spec file AFTER each integration to minimize risk of context loss (atomic overwrite).
|
| 183 |
+
- Preserve formatting: do not reorder unrelated sections; keep heading hierarchy intact.
|
| 184 |
+
- Keep each inserted clarification minimal and testable (avoid narrative drift).
|
| 185 |
+
|
| 186 |
+
7. Validation (performed after EACH write plus final pass):
|
| 187 |
+
- Clarifications session contains exactly one bullet per accepted answer (no duplicates).
|
| 188 |
+
- Total asked (accepted) questions ≤ 5.
|
| 189 |
+
- Updated sections contain no lingering vague placeholders the new answer was meant to resolve.
|
| 190 |
+
- No contradictory earlier statement remains (scan for now-invalid alternative choices removed).
|
| 191 |
+
- Markdown structure valid; only allowed new headings: `## Clarifications`, `### Session YYYY-MM-DD`.
|
| 192 |
+
- Terminology consistency: same canonical term used across all updated sections.
|
| 193 |
+
|
| 194 |
+
8. Write the updated spec back to `FEATURE_SPEC`.
|
| 195 |
+
|
| 196 |
+
9. **Re-validate Spec Quality Checklist** (if it exists):
|
| 197 |
+
- Check if `FEATURE_DIR/checklists/requirements.md` exists.
|
| 198 |
+
- If it does NOT exist, skip this step silently.
|
| 199 |
+
- If it exists:
|
| 200 |
+
1. Read the checklist file.
|
| 201 |
+
2. Identify all GitHub task-list checkbox lines — lines matching `- [ ]`, `- [x]`, or `- [X]` (case-insensitive, tolerant of leading whitespace for nested items) outside of code fences. Ignore all other content (headings, notes, non-checkbox bullets, metadata).
|
| 202 |
+
3. For each checkbox line, record its current marker state (checked or unchecked) and item text into a before-snapshot list.
|
| 203 |
+
4. Re-evaluate each checkbox item against the **updated** spec (the version just saved in step 7).
|
| 204 |
+
5. For each checkbox item, update only if the checked/unchecked state actually changes:
|
| 205 |
+
- If the item now passes and was unchecked: change `[ ]` to `[x]`.
|
| 206 |
+
- If the item now fails and was checked: change `[x]`/`[X]` to `[ ]`.
|
| 207 |
+
- If the state is unchanged: leave the marker as-is (preserve existing case to avoid cosmetic diffs).
|
| 208 |
+
6. Save the updated checklist file. **Only toggle the `[ ]`/`[x]` marker portion of checkbox lines whose state changed.** All other file content — headings, metadata, notes, line ordering, whitespace — must remain unchanged to avoid noisy diffs.
|
| 209 |
+
7. Compare the before-snapshot with the current state to compute three lists for the Completion Report:
|
| 210 |
+
- **Newly passing**: items that changed from unchecked to checked.
|
| 211 |
+
- **Regressions**: items that changed from checked to unchecked.
|
| 212 |
+
- **Still unchecked**: items that remain unchecked.
|
| 213 |
+
8. Record the before/after pass counts as checked/total checkbox items (e.g., "12/16 → 15/16 items passing").
|
| 214 |
+
|
| 215 |
+
Behavior rules:
|
| 216 |
+
|
| 217 |
+
- If no meaningful ambiguities found (or all potential questions would be low-impact), respond: "No critical ambiguities detected worth formal clarification." and suggest proceeding.
|
| 218 |
+
- If spec file missing, instruct user to run `/speckit.specify` first (do not create a new spec here).
|
| 219 |
+
- Never exceed 5 total asked questions (clarification retries for a single question do not count as new questions).
|
| 220 |
+
- Avoid speculative tech stack questions unless the absence blocks functional clarity.
|
| 221 |
+
- Respect user early termination signals ("stop", "done", "proceed").
|
| 222 |
+
- If no questions asked due to full coverage, output a compact coverage summary (all categories Clear) then suggest advancing.
|
| 223 |
+
- If quota reached with unresolved high-impact categories remaining, explicitly flag them under Deferred with rationale.
|
| 224 |
+
|
| 225 |
+
Context for prioritization: {{args}}
|
| 226 |
+
|
| 227 |
+
## Mandatory Post-Execution Hooks
|
| 228 |
+
|
| 229 |
+
**You MUST complete this section before reporting completion to the user.**
|
| 230 |
+
|
| 231 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 232 |
+
- If it does not exist, or no hooks are registered under `hooks.after_clarify`, skip to the Completion Report.
|
| 233 |
+
- If it exists, read it and look for entries under the `hooks.after_clarify` key.
|
| 234 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
|
| 235 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 236 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 237 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 238 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 239 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 240 |
+
- **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
|
| 241 |
+
```
|
| 242 |
+
## Extension Hooks
|
| 243 |
+
|
| 244 |
+
**Automatic Hook**: {extension}
|
| 245 |
+
Executing: `/{command}`
|
| 246 |
+
EXECUTE_COMMAND: {command}
|
| 247 |
+
```
|
| 248 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 249 |
+
- **Optional hook** (`optional: true`):
|
| 250 |
+
```
|
| 251 |
+
## Extension Hooks
|
| 252 |
+
|
| 253 |
+
**Optional Hook**: {extension}
|
| 254 |
+
Command: `/{command}`
|
| 255 |
+
Description: {description}
|
| 256 |
+
|
| 257 |
+
Prompt: {prompt}
|
| 258 |
+
To execute: `/{command}`
|
| 259 |
+
```
|
| 260 |
+
|
| 261 |
+
## Completion Report
|
| 262 |
+
|
| 263 |
+
Report completion (after questioning loop ends or early termination):
|
| 264 |
+
- Number of questions asked & answered.
|
| 265 |
+
- Path to updated spec.
|
| 266 |
+
- Sections touched (list names).
|
| 267 |
+
- Spec quality checklist status (if `FEATURE_DIR/checklists/requirements.md` was re-validated): show before/after pass counts (e.g., "Spec Quality Checklist: 12/16 → 15/16 items passing") and list any items that changed state — both newly checked (unchecked → checked) and any regressions (checked → unchecked). If any items remain unchecked, list them as areas needing attention.
|
| 268 |
+
- Coverage summary table listing each taxonomy category with Status: Resolved (was Partial/Missing and addressed), Deferred (exceeds question quota or better suited for planning), Clear (already sufficient), Outstanding (still Partial/Missing but low impact).
|
| 269 |
+
- If any Outstanding or Deferred remain, recommend whether to proceed to `/speckit.plan` or run `/speckit.clarify` again later post-plan.
|
| 270 |
+
- Suggested next command.
|
| 271 |
+
|
| 272 |
+
## Done When
|
| 273 |
+
|
| 274 |
+
- [ ] Spec ambiguities identified and clarifications integrated into spec file
|
| 275 |
+
- [ ] Spec quality checklist re-validated against updated spec (if `FEATURE_DIR/checklists/requirements.md` exists)
|
| 276 |
+
- [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
|
| 277 |
+
- [ ] Completion reported to user with questions answered, sections touched, checklist status, and coverage summary"""
|
.gemini/commands/speckit.constitution.toml
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
description = "Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync."
|
| 2 |
+
|
| 3 |
+
prompt = """
|
| 4 |
+
|
| 5 |
+
## User Input
|
| 6 |
+
|
| 7 |
+
```text
|
| 8 |
+
{{args}}
|
| 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 constitution update)**:
|
| 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_constitution` 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 Outline.
|
| 44 |
+
```
|
| 45 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 46 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 47 |
+
|
| 48 |
+
## Outline
|
| 49 |
+
|
| 50 |
+
You are updating the project constitution at `.specify/memory/constitution.md`. This file is a TEMPLATE containing placeholder tokens in square brackets (e.g. `[PROJECT_NAME]`, `[PRINCIPLE_1_NAME]`). Your job is to (a) collect/derive concrete values, (b) fill the template precisely, and (c) propagate any amendments across dependent artifacts.
|
| 51 |
+
|
| 52 |
+
**Note**: If `.specify/memory/constitution.md` does not exist yet, it should have been initialized from `.specify/templates/constitution-template.md` during project setup. If it's missing, copy the template first.
|
| 53 |
+
|
| 54 |
+
Follow this execution flow:
|
| 55 |
+
|
| 56 |
+
1. Load the existing constitution at `.specify/memory/constitution.md`.
|
| 57 |
+
- Identify every placeholder token of the form `[ALL_CAPS_IDENTIFIER]`.
|
| 58 |
+
**IMPORTANT**: The user might require less or more principles than the ones used in the template. If a number is specified, respect that - follow the general template. You will update the doc accordingly.
|
| 59 |
+
|
| 60 |
+
2. Collect/derive values for placeholders:
|
| 61 |
+
- If user input (conversation) supplies a value, use it.
|
| 62 |
+
- Otherwise infer from existing repo context (README, docs, prior constitution versions if embedded).
|
| 63 |
+
- For governance dates: `RATIFICATION_DATE` is the original adoption date (if unknown ask or mark TODO), `LAST_AMENDED_DATE` is today if changes are made, otherwise keep previous.
|
| 64 |
+
- `CONSTITUTION_VERSION` must increment according to semantic versioning rules:
|
| 65 |
+
- MAJOR: Backward incompatible governance/principle removals or redefinitions.
|
| 66 |
+
- MINOR: New principle/section added or materially expanded guidance.
|
| 67 |
+
- PATCH: Clarifications, wording, typo fixes, non-semantic refinements.
|
| 68 |
+
- If version bump type ambiguous, propose reasoning before finalizing.
|
| 69 |
+
|
| 70 |
+
3. Draft the updated constitution content:
|
| 71 |
+
- Replace every placeholder with concrete text (no bracketed tokens left except intentionally retained template slots that the project has chosen not to define yet—explicitly justify any left).
|
| 72 |
+
- Preserve heading hierarchy and comments can be removed once replaced unless they still add clarifying guidance.
|
| 73 |
+
- Ensure each Principle section: succinct name line, paragraph (or bullet list) capturing non‑negotiable rules, explicit rationale if not obvious.
|
| 74 |
+
- Ensure Governance section lists amendment procedure, versioning policy, and compliance review expectations.
|
| 75 |
+
|
| 76 |
+
4. Consistency propagation checklist (convert prior checklist into active validations):
|
| 77 |
+
- Read `.specify/templates/plan-template.md` and ensure any "Constitution Check" or rules align with updated principles.
|
| 78 |
+
- Read `.specify/templates/spec-template.md` for scope/requirements alignment—update if constitution adds/removes mandatory sections or constraints.
|
| 79 |
+
- Read `.specify/templates/tasks-template.md` and ensure task categorization reflects new or removed principle-driven task types (e.g., observability, versioning, testing discipline).
|
| 80 |
+
- Read each command file in `.specify/templates/commands/*.md` (including this one) to verify no outdated references (agent-specific names like CLAUDE only) remain when generic guidance is required.
|
| 81 |
+
- Read any runtime guidance docs (e.g., `README.md`, `docs/quickstart.md`, or agent-specific guidance files if present). Update references to principles changed.
|
| 82 |
+
|
| 83 |
+
5. Produce a Sync Impact Report (prepend as an HTML comment at top of the constitution file after update):
|
| 84 |
+
- Version change: old → new
|
| 85 |
+
- List of modified principles (old title → new title if renamed)
|
| 86 |
+
- Added sections
|
| 87 |
+
- Removed sections
|
| 88 |
+
- Templates requiring updates (✅ updated / ⚠ pending) with file paths
|
| 89 |
+
- Follow-up TODOs if any placeholders intentionally deferred.
|
| 90 |
+
|
| 91 |
+
6. Validation before final output:
|
| 92 |
+
- No remaining unexplained bracket tokens.
|
| 93 |
+
- Version line matches report.
|
| 94 |
+
- Dates ISO format YYYY-MM-DD.
|
| 95 |
+
- Principles are declarative, testable, and free of vague language ("should" → replace with MUST/SHOULD rationale where appropriate).
|
| 96 |
+
|
| 97 |
+
7. Write the completed constitution back to `.specify/memory/constitution.md` (overwrite).
|
| 98 |
+
|
| 99 |
+
8. Output a final summary to the user with:
|
| 100 |
+
- New version and bump rationale.
|
| 101 |
+
- Any files flagged for manual follow-up.
|
| 102 |
+
- Suggested commit message (e.g., `docs: amend constitution to vX.Y.Z (principle additions + governance update)`).
|
| 103 |
+
|
| 104 |
+
Formatting & Style Requirements:
|
| 105 |
+
|
| 106 |
+
- Use Markdown headings exactly as in the template (do not demote/promote levels).
|
| 107 |
+
- Wrap long rationale lines to keep readability (<100 chars ideally) but do not hard enforce with awkward breaks.
|
| 108 |
+
- Keep a single blank line between sections.
|
| 109 |
+
- Avoid trailing whitespace.
|
| 110 |
+
|
| 111 |
+
If the user supplies partial updates (e.g., only one principle revision), still perform validation and version decision steps.
|
| 112 |
+
|
| 113 |
+
If critical info missing (e.g., ratification date truly unknown), insert `TODO(<FIELD_NAME>): explanation` and include in the Sync Impact Report under deferred items.
|
| 114 |
+
|
| 115 |
+
Do not create a new template; always operate on the existing `.specify/memory/constitution.md` file.
|
| 116 |
+
|
| 117 |
+
## Post-Execution Checks
|
| 118 |
+
|
| 119 |
+
**Check for extension hooks (after constitution update)**:
|
| 120 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 121 |
+
- If it exists, read it and look for entries under the `hooks.after_constitution` key
|
| 122 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 123 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 124 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 125 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 126 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 127 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 128 |
+
- **Optional hook** (`optional: true`):
|
| 129 |
+
```
|
| 130 |
+
## Extension Hooks
|
| 131 |
+
|
| 132 |
+
**Optional Hook**: {extension}
|
| 133 |
+
Command: `/{command}`
|
| 134 |
+
Description: {description}
|
| 135 |
+
|
| 136 |
+
Prompt: {prompt}
|
| 137 |
+
To execute: `/{command}`
|
| 138 |
+
```
|
| 139 |
+
- **Mandatory hook** (`optional: false`):
|
| 140 |
+
```
|
| 141 |
+
## Extension Hooks
|
| 142 |
+
|
| 143 |
+
**Automatic Hook**: {extension}
|
| 144 |
+
Executing: `/{command}`
|
| 145 |
+
EXECUTE_COMMAND: {command}
|
| 146 |
+
```
|
| 147 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 148 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently"""
|
.gemini/commands/speckit.converge.toml
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
description = "Assess the current codebase against the feature's spec, plan, and tasks, then append any remaining unbuilt work as new tasks to tasks.md so implement can complete it."
|
| 2 |
+
|
| 3 |
+
prompt = """
|
| 4 |
+
|
| 5 |
+
## User Input
|
| 6 |
+
|
| 7 |
+
```text
|
| 8 |
+
{{args}}
|
| 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 convergence)**:
|
| 16 |
+
|
| 17 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 18 |
+
- If it exists, read it and look for entries under the `hooks.before_converge` key
|
| 19 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 20 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 21 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 22 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 23 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 24 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 25 |
+
- **Optional hook** (`optional: true`):
|
| 26 |
+
|
| 27 |
+
```text
|
| 28 |
+
## Extension Hooks
|
| 29 |
+
|
| 30 |
+
**Optional Pre-Hook**: {extension}
|
| 31 |
+
Command: `/{command}`
|
| 32 |
+
Description: {description}
|
| 33 |
+
|
| 34 |
+
Prompt: {prompt}
|
| 35 |
+
To execute: `/{command}`
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
- **Mandatory hook** (`optional: false`):
|
| 39 |
+
|
| 40 |
+
```text
|
| 41 |
+
## Extension Hooks
|
| 42 |
+
|
| 43 |
+
**Automatic Pre-Hook**: {extension}
|
| 44 |
+
Executing: `/{command}`
|
| 45 |
+
EXECUTE_COMMAND: {command}
|
| 46 |
+
|
| 47 |
+
Wait for the result of the hook command before proceeding to the Goal.
|
| 48 |
+
```
|
| 49 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 50 |
+
|
| 51 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 52 |
+
|
| 53 |
+
## Goal
|
| 54 |
+
|
| 55 |
+
Close the gap between what a feature's specification, plan, and tasks call for and what the
|
| 56 |
+
codebase currently implements. Read `spec.md`, `plan.md`, and `tasks.md` as the **sole
|
| 57 |
+
source of intent** (with the constitution as governing constraints), assess the current
|
| 58 |
+
state of the code, determine which requirements, acceptance criteria, plan decisions, and
|
| 59 |
+
existing tasks are unmet, incomplete, or only partially satisfied, and **append each piece
|
| 60 |
+
of remaining work as a new, traceable task** at the bottom of `tasks.md` so that
|
| 61 |
+
`/speckit.implement` can complete it. This command MUST run only after
|
| 62 |
+
`/speckit.implement` has run on the current `tasks.md`, and after `/speckit.tasks` has produced a complete `tasks.md`.
|
| 63 |
+
|
| 64 |
+
This is **not** a diff tool and does **not** track changes. It assesses the present state
|
| 65 |
+
of the code relative to the feature's artifacts — no git, no branch comparison, no history.
|
| 66 |
+
|
| 67 |
+
## Operating Constraints
|
| 68 |
+
|
| 69 |
+
**APPEND-ONLY, NEVER REWRITE**: The command's **only** write is appending a new
|
| 70 |
+
`## Phase N: Convergence` section to `tasks.md`. It MUST NOT:
|
| 71 |
+
|
| 72 |
+
- modify `spec.md` or `plan.md` in any way;
|
| 73 |
+
- rewrite, renumber, reorder, or delete any existing task (including tasks from a prior
|
| 74 |
+
Convergence phase);
|
| 75 |
+
- modify, create, or delete any application code — completing the appended tasks is the
|
| 76 |
+
job of `/speckit.implement`.
|
| 77 |
+
|
| 78 |
+
When the codebase already satisfies everything, the command MUST leave `tasks.md`
|
| 79 |
+
**byte-for-byte unchanged** (no empty Convergence header) and report a clean result.
|
| 80 |
+
|
| 81 |
+
**Constitution Authority**: The project constitution (`.specify/memory/constitution.md`) is
|
| 82 |
+
**non-negotiable**. Code that violates a MUST principle is the highest-severity finding and
|
| 83 |
+
produces a corresponding remediation task. If the constitution is an unfilled template,
|
| 84 |
+
skip constitution checks gracefully rather than failing.
|
| 85 |
+
|
| 86 |
+
## Execution Steps
|
| 87 |
+
|
| 88 |
+
### 1. Initialize Convergence Context
|
| 89 |
+
|
| 90 |
+
Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
|
| 91 |
+
|
| 92 |
+
- SPEC = FEATURE_DIR/spec.md
|
| 93 |
+
- PLAN = FEATURE_DIR/plan.md
|
| 94 |
+
- TASKS = FEATURE_DIR/tasks.md
|
| 95 |
+
- CONSTITUTION = `.specify/memory/constitution.md` (if present)
|
| 96 |
+
If `spec.md`, `plan.md`, or `tasks.md` is missing, STOP with a clear, actionable message naming the
|
| 97 |
+
prerequisite command to run (`/speckit.specify` for a missing spec, `/speckit.plan` for a missing plan,
|
| 98 |
+
`/speckit.tasks` for missing tasks). Do not produce partial output.
|
| 99 |
+
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").
|
| 100 |
+
|
| 101 |
+
### 2. Load Artifacts (Progressive Disclosure)
|
| 102 |
+
|
| 103 |
+
Load only the minimal necessary context from each artifact:
|
| 104 |
+
|
| 105 |
+
**From spec.md:**
|
| 106 |
+
|
| 107 |
+
- Functional Requirements (FR-###)
|
| 108 |
+
- Success Criteria (SC-###) — include only items requiring buildable work; exclude
|
| 109 |
+
post-launch outcome metrics and business KPIs
|
| 110 |
+
- User Stories and their Acceptance Scenarios
|
| 111 |
+
- Edge Cases (if present)
|
| 112 |
+
|
| 113 |
+
**From plan.md:**
|
| 114 |
+
|
| 115 |
+
- Architecture/stack choices and technical decisions
|
| 116 |
+
- Data Model references
|
| 117 |
+
- Phases and named touch-points (files/components the plan says will be created or edited)
|
| 118 |
+
- Technical constraints
|
| 119 |
+
|
| 120 |
+
**From tasks.md:**
|
| 121 |
+
|
| 122 |
+
- Task IDs (to compute the next ID and next phase number)
|
| 123 |
+
- Descriptions, phase grouping, and referenced file paths
|
| 124 |
+
|
| 125 |
+
**From constitution (if not an unfilled template):**
|
| 126 |
+
|
| 127 |
+
- Principle names and MUST/SHOULD normative statements
|
| 128 |
+
|
| 129 |
+
### 3. Build the Intent Inventory
|
| 130 |
+
|
| 131 |
+
Create an internal model (do not echo raw artifacts):
|
| 132 |
+
|
| 133 |
+
- **Requirements inventory**: one stable key per FR-### / SC-### / user-story acceptance
|
| 134 |
+
scenario (e.g. `US1/AC2`), plus the plan decisions and constitution principles that
|
| 135 |
+
impose buildable obligations.
|
| 136 |
+
- **Code-scope map**: from the file paths named in `plan.md` and `tasks.md`, plus a keyword
|
| 137 |
+
search for the concepts each requirement describes, derive the set of source files and
|
| 138 |
+
components in scope for assessment. Bound the assessment to these — do **not** infer
|
| 139 |
+
scope beyond what the artifacts define.
|
| 140 |
+
|
| 141 |
+
### 4. Assess the Codebase and Classify Findings
|
| 142 |
+
|
| 143 |
+
For each item in the intent inventory, inspect the current code in scope and produce a
|
| 144 |
+
`Finding` only where there is a gap. Classify every finding by **gap type**:
|
| 145 |
+
|
| 146 |
+
- **`missing`**: the required work is absent from the code entirely.
|
| 147 |
+
- **`partial`**: the work exists but does not yet fully satisfy the requirement /
|
| 148 |
+
acceptance criterion / plan decision.
|
| 149 |
+
- **`contradicts`**: the code does something that conflicts with stated intent or a
|
| 150 |
+
constitution MUST principle.
|
| 151 |
+
- **`unrequested`**: the code contains work not called for by the spec, plan, or tasks
|
| 152 |
+
(surfaced for awareness — converge does **not** delete code, it only appends a task to
|
| 153 |
+
review/justify or remove it).
|
| 154 |
+
|
| 155 |
+
Each `Finding` records: a stable id, the `source-ref` it traces to, the `gap-type`, a
|
| 156 |
+
severity, and a short human-readable description with the evidence (the file/area observed).
|
| 157 |
+
|
| 158 |
+
**Edge cases:**
|
| 159 |
+
|
| 160 |
+
- **Little or no code yet**: treat the entire specified scope as `missing` remaining work
|
| 161 |
+
rather than failing.
|
| 162 |
+
- **Nothing remains**: produce zero findings and follow the converged branch in Step 7.
|
| 163 |
+
|
| 164 |
+
### 5. Assign Severity
|
| 165 |
+
|
| 166 |
+
- **CRITICAL**: violates a constitution MUST principle, or a `missing`/`contradicts` gap
|
| 167 |
+
that blocks baseline functionality of a P1 user story.
|
| 168 |
+
- **HIGH**: a `missing` or `partial` gap on a core functional requirement or acceptance
|
| 169 |
+
criterion.
|
| 170 |
+
- **MEDIUM**: a `partial` gap on a secondary requirement, or an `unrequested` addition with
|
| 171 |
+
unclear justification.
|
| 172 |
+
- **LOW**: minor partial gaps, polish, or low-risk `unrequested` additions.
|
| 173 |
+
|
| 174 |
+
### 6. Present the In-Session Findings Summary
|
| 175 |
+
|
| 176 |
+
Before appending anything, output a compact, severity-graded summary (no file writes yet):
|
| 177 |
+
|
| 178 |
+
## Convergence Findings
|
| 179 |
+
|
| 180 |
+
| ID | Gap Type | Severity | Source | Evidence | Remaining Work |
|
| 181 |
+
|----|----------|----------|--------|----------|----------------|
|
| 182 |
+
| F1 | missing | HIGH | FR-008 | Example: no append-only guard detected in path/to/module.py when writing tasks.md | Add append-only enforcement |
|
| 183 |
+
|
| 184 |
+
**Summary metrics:**
|
| 185 |
+
|
| 186 |
+
- Requirements / acceptance criteria checked
|
| 187 |
+
- Plan decisions checked
|
| 188 |
+
- Constitution principles checked (or "skipped — template")
|
| 189 |
+
- Findings by gap type (missing / partial / contradicts / unrequested)
|
| 190 |
+
- Findings by severity
|
| 191 |
+
|
| 192 |
+
### 7. Append Convergence Tasks (or report converged)
|
| 193 |
+
|
| 194 |
+
**If there are one or more actionable findings** (`tasks_appended` outcome):
|
| 195 |
+
|
| 196 |
+
Append to the **end** of `tasks.md`, per the append contract:
|
| 197 |
+
|
| 198 |
+
1. Scan all existing task IDs; let `M` be the maximum. Determine the next phase number `N`
|
| 199 |
+
(highest existing phase + 1).
|
| 200 |
+
2. Write a single new section header `## Phase N: Convergence`.
|
| 201 |
+
3. Emit one checklist item per actionable finding, ordered CRITICAL/HIGH first, assigning
|
| 202 |
+
zero-padded IDs `T{M+1:03d}, T{M+2:03d}, …`:
|
| 203 |
+
|
| 204 |
+
```markdown
|
| 205 |
+
- [ ] T042 <imperative description> per <source-ref> (<gap-type>)
|
| 206 |
+
```
|
| 207 |
+
|
| 208 |
+
`<source-ref>` traces the task to its origin: e.g. `FR-003`, `SC-002`,
|
| 209 |
+
`US1/AC2`, `plan: storage decision`, `Constitution II`.
|
| 210 |
+
|
| 211 |
+
`<gap-type>` is one of `missing`, `partial`, `contradicts`, `unrequested`.
|
| 212 |
+
|
| 213 |
+
Constitution-violation tasks MUST be emitted first and described as
|
| 214 |
+
`CRITICAL`.
|
| 215 |
+
4. Never reuse or renumber existing IDs. If a prior Convergence phase exists, add a new,
|
| 216 |
+
separately-numbered one below it — do not touch the old one.
|
| 217 |
+
|
| 218 |
+
**If there are no actionable findings** (`converged` outcome):
|
| 219 |
+
|
| 220 |
+
- Do **not** modify `tasks.md` at all — no empty phase header.
|
| 221 |
+
- Report: **"✅ Converged — the implementation satisfies the spec, plan, and tasks."**
|
| 222 |
+
- Include the summary counts of what was checked.
|
| 223 |
+
|
| 224 |
+
### 8. Provide Next Actions (Handoff)
|
| 225 |
+
|
| 226 |
+
- On `tasks_appended`: state how many tasks were appended under which phase, and recommend
|
| 227 |
+
running `/speckit.implement` to complete them; note that a follow-up converge
|
| 228 |
+
run will find fewer or no remaining items.
|
| 229 |
+
- On `converged`: recommend proceeding to review / opening a PR. No further implement pass
|
| 230 |
+
is needed for this feature's specified scope.
|
| 231 |
+
|
| 232 |
+
### 9. Check for extension hooks
|
| 233 |
+
|
| 234 |
+
After producing the result, check if `.specify/extensions.yml` exists in the project root.
|
| 235 |
+
|
| 236 |
+
- If it exists, read it and look for entries under the `hooks.after_converge` key
|
| 237 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 238 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 239 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 240 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 241 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 242 |
+
- Report the convergence outcome (`converged` or `tasks_appended`) in-session before listing
|
| 243 |
+
any hooks, so users can decide whether to run optional follow-up commands.
|
| 244 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 245 |
+
- **Optional hook** (`optional: true`):
|
| 246 |
+
|
| 247 |
+
```text
|
| 248 |
+
## Extension Hooks
|
| 249 |
+
|
| 250 |
+
**Optional Hook**: {extension}
|
| 251 |
+
Command: `/{command}`
|
| 252 |
+
Description: {description}
|
| 253 |
+
|
| 254 |
+
Prompt: {prompt}
|
| 255 |
+
To execute: `/{command}`
|
| 256 |
+
```
|
| 257 |
+
|
| 258 |
+
- **Mandatory hook** (`optional: false`):
|
| 259 |
+
|
| 260 |
+
```text
|
| 261 |
+
## Extension Hooks
|
| 262 |
+
|
| 263 |
+
**Automatic Hook**: {extension}
|
| 264 |
+
Executing: `/{command}`
|
| 265 |
+
EXECUTE_COMMAND: {command}
|
| 266 |
+
```
|
| 267 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 268 |
+
|
| 269 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently"""
|
.gemini/commands/speckit.implement.toml
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
description = "Execute the implementation plan by processing and executing all tasks defined in tasks.md"
|
| 2 |
+
|
| 3 |
+
prompt = """
|
| 4 |
+
|
| 5 |
+
## User Input
|
| 6 |
+
|
| 7 |
+
```text
|
| 8 |
+
{{args}}
|
| 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 implementation)**:
|
| 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_implement` 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 Outline.
|
| 44 |
+
```
|
| 45 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 46 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 47 |
+
|
| 48 |
+
## Outline
|
| 49 |
+
|
| 50 |
+
1. Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. 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").
|
| 51 |
+
|
| 52 |
+
2. **Check checklists status** (if FEATURE_DIR/checklists/ exists):
|
| 53 |
+
- Scan all checklist files in the checklists/ directory
|
| 54 |
+
- For each checklist, count:
|
| 55 |
+
- Total items: All lines matching `- [ ]` or `- [X]` or `- [x]`
|
| 56 |
+
- Completed items: Lines matching `- [X]` or `- [x]`
|
| 57 |
+
- Incomplete items: Lines matching `- [ ]`
|
| 58 |
+
- Create a status table:
|
| 59 |
+
|
| 60 |
+
```text
|
| 61 |
+
| Checklist | Total | Completed | Incomplete | Status |
|
| 62 |
+
|-----------|-------|-----------|------------|--------|
|
| 63 |
+
| ux.md | 12 | 12 | 0 | ✓ PASS |
|
| 64 |
+
| test.md | 8 | 5 | 3 | ✗ FAIL |
|
| 65 |
+
| security.md | 6 | 6 | 0 | ✓ PASS |
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
- Calculate overall status:
|
| 69 |
+
- **PASS**: All checklists have 0 incomplete items
|
| 70 |
+
- **FAIL**: One or more checklists have incomplete items
|
| 71 |
+
|
| 72 |
+
- **If any checklist is incomplete**:
|
| 73 |
+
- Display the table with incomplete item counts
|
| 74 |
+
- **STOP** and ask: "Some checklists are incomplete. Do you want to proceed with implementation anyway? (yes/no)"
|
| 75 |
+
- Wait for user response before continuing
|
| 76 |
+
- If user says "no" or "wait" or "stop", halt execution
|
| 77 |
+
- If user says "yes" or "proceed" or "continue", proceed to step 3
|
| 78 |
+
|
| 79 |
+
- **If all checklists are complete**:
|
| 80 |
+
- Display the table showing all checklists passed
|
| 81 |
+
- Automatically proceed to step 3
|
| 82 |
+
|
| 83 |
+
3. Load and analyze the implementation context:
|
| 84 |
+
- **REQUIRED**: Read tasks.md for the complete task list and execution plan
|
| 85 |
+
- **REQUIRED**: Read plan.md for tech stack, architecture, and file structure
|
| 86 |
+
- **IF EXISTS**: Read data-model.md for entities and relationships
|
| 87 |
+
- **IF EXISTS**: Read contracts/ for API specifications and test requirements
|
| 88 |
+
- **IF EXISTS**: Read research.md for technical decisions and constraints
|
| 89 |
+
- **IF EXISTS**: Read .specify/memory/constitution.md for governance constraints
|
| 90 |
+
- **IF EXISTS**: Read quickstart.md for integration scenarios
|
| 91 |
+
|
| 92 |
+
4. **Project Setup Verification**:
|
| 93 |
+
- **REQUIRED**: Create/verify ignore files based on actual project setup:
|
| 94 |
+
|
| 95 |
+
**Detection & Creation Logic**:
|
| 96 |
+
- Check if the following command succeeds to determine if the repository is a git repo (create/verify .gitignore if so):
|
| 97 |
+
|
| 98 |
+
```sh
|
| 99 |
+
git rev-parse --git-dir 2>/dev/null
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
- Check if Dockerfile* exists or Docker in plan.md → create/verify .dockerignore
|
| 103 |
+
- Check if .eslintrc* exists → create/verify .eslintignore
|
| 104 |
+
- Check if eslint.config.* exists → ensure the config's `ignores` entries cover required patterns
|
| 105 |
+
- Check if .prettierrc* exists → create/verify .prettierignore
|
| 106 |
+
- Check if .npmrc or package.json exists → create/verify .npmignore (if publishing)
|
| 107 |
+
- Check if terraform files (*.tf) exist → create/verify .terraformignore
|
| 108 |
+
- Check if .helmignore needed (helm charts present) → create/verify .helmignore
|
| 109 |
+
|
| 110 |
+
**If ignore file already exists**: Verify it contains essential patterns, append missing critical patterns only
|
| 111 |
+
**If ignore file missing**: Create with full pattern set for detected technology
|
| 112 |
+
|
| 113 |
+
**Common Patterns by Technology** (from plan.md tech stack):
|
| 114 |
+
- **Node.js/JavaScript/TypeScript**: `node_modules/`, `dist/`, `build/`, `*.log`, `.env*`
|
| 115 |
+
- **Python**: `__pycache__/`, `*.pyc`, `.venv/`, `venv/`, `dist/`, `*.egg-info/`
|
| 116 |
+
- **Java**: `target/`, `*.class`, `*.jar`, `.gradle/`, `build/`
|
| 117 |
+
- **C#/.NET**: `bin/`, `obj/`, `*.user`, `*.suo`, `packages/`
|
| 118 |
+
- **Go**: `*.exe`, `*.test`, `vendor/`, `*.out`
|
| 119 |
+
- **Ruby**: `.bundle/`, `log/`, `tmp/`, `*.gem`, `vendor/bundle/`
|
| 120 |
+
- **PHP**: `vendor/`, `*.log`, `*.cache`, `*.env`
|
| 121 |
+
- **Rust**: `target/`, `debug/`, `release/`, `*.rs.bk`, `*.rlib`, `*.prof*`, `.idea/`, `*.log`, `.env*`
|
| 122 |
+
- **Kotlin**: `build/`, `out/`, `.gradle/`, `.idea/`, `*.class`, `*.jar`, `*.iml`, `*.log`, `.env*`
|
| 123 |
+
- **C++**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.so`, `*.a`, `*.exe`, `*.dll`, `.idea/`, `*.log`, `.env*`
|
| 124 |
+
- **C**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.a`, `*.so`, `*.exe`, `*.dll`, `autom4te.cache/`, `config.status`, `config.log`, `.idea/`, `*.log`, `.env*`
|
| 125 |
+
- **Swift**: `.build/`, `DerivedData/`, `*.swiftpm/`, `Packages/`
|
| 126 |
+
- **R**: `.Rproj.user/`, `.Rhistory`, `.RData`, `.Ruserdata`, `*.Rproj`, `packrat/`, `renv/`
|
| 127 |
+
- **Universal**: `.DS_Store`, `Thumbs.db`, `*.tmp`, `*.swp`, `.vscode/`, `.idea/`
|
| 128 |
+
|
| 129 |
+
**Tool-Specific Patterns**:
|
| 130 |
+
- **Docker**: `node_modules/`, `.git/`, `Dockerfile*`, `.dockerignore`, `*.log*`, `.env*`, `coverage/`
|
| 131 |
+
- **ESLint**: `node_modules/`, `dist/`, `build/`, `coverage/`, `*.min.js`
|
| 132 |
+
- **Prettier**: `node_modules/`, `dist/`, `build/`, `coverage/`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
|
| 133 |
+
- **Terraform**: `.terraform/`, `*.tfstate*`, `*.tfvars`, `.terraform.lock.hcl`
|
| 134 |
+
- **Kubernetes/k8s**: `*.secret.yaml`, `secrets/`, `.kube/`, `kubeconfig*`, `*.key`, `*.crt`
|
| 135 |
+
|
| 136 |
+
5. Parse tasks.md structure and extract:
|
| 137 |
+
- **Task phases**: Setup, Tests, Core, Integration, Polish
|
| 138 |
+
- **Task dependencies**: Sequential vs parallel execution rules
|
| 139 |
+
- **Task details**: ID, description, file paths, parallel markers [P]
|
| 140 |
+
- **Execution flow**: Order and dependency requirements
|
| 141 |
+
|
| 142 |
+
6. Execute implementation following the task plan:
|
| 143 |
+
- **Phase-by-phase execution**: Complete each phase before moving to the next
|
| 144 |
+
- **Respect dependencies**: Run sequential tasks in order, parallel tasks [P] can run together
|
| 145 |
+
- **Follow TDD approach**: Execute test tasks before their corresponding implementation tasks
|
| 146 |
+
- **File-based coordination**: Tasks affecting the same files must run sequentially
|
| 147 |
+
- **Validation checkpoints**: Verify each phase completion before proceeding
|
| 148 |
+
|
| 149 |
+
7. Implementation execution rules:
|
| 150 |
+
- **Setup first**: Initialize project structure, dependencies, configuration
|
| 151 |
+
- **Tests before code**: If you need to write tests for contracts, entities, and integration scenarios
|
| 152 |
+
- **Core development**: Implement models, services, CLI commands, endpoints
|
| 153 |
+
- **Integration work**: Database connections, middleware, logging, external services
|
| 154 |
+
- **Polish and validation**: Unit tests, performance optimization, documentation
|
| 155 |
+
|
| 156 |
+
8. Progress tracking and error handling:
|
| 157 |
+
- Report progress after each completed task
|
| 158 |
+
- Halt execution if any non-parallel task fails
|
| 159 |
+
- For parallel tasks [P], continue with successful tasks, report failed ones
|
| 160 |
+
- Provide clear error messages with context for debugging
|
| 161 |
+
- Suggest next steps if implementation cannot proceed
|
| 162 |
+
- **IMPORTANT** For completed tasks, make sure to mark the task off as [X] in the tasks file.
|
| 163 |
+
|
| 164 |
+
9. Completion validation:
|
| 165 |
+
- Verify all required tasks are completed
|
| 166 |
+
- Check that implemented features match the original specification
|
| 167 |
+
- Validate that tests pass and coverage meets requirements
|
| 168 |
+
- Confirm the implementation follows the technical plan
|
| 169 |
+
|
| 170 |
+
Note: This command assumes a complete task breakdown exists in tasks.md. If tasks are incomplete or missing, suggest running `/speckit.tasks` first to regenerate the task list.
|
| 171 |
+
|
| 172 |
+
## Mandatory Post-Execution Hooks
|
| 173 |
+
|
| 174 |
+
**You MUST complete this section before reporting completion to the user.**
|
| 175 |
+
|
| 176 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 177 |
+
- If it does not exist, or no hooks are registered under `hooks.after_implement`, skip to the Completion Report.
|
| 178 |
+
- If it exists, read it and look for entries under the `hooks.after_implement` key.
|
| 179 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
|
| 180 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 181 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 182 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 183 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 184 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 185 |
+
- **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
|
| 186 |
+
```
|
| 187 |
+
## Extension Hooks
|
| 188 |
+
|
| 189 |
+
**Automatic Hook**: {extension}
|
| 190 |
+
Executing: `/{command}`
|
| 191 |
+
EXECUTE_COMMAND: {command}
|
| 192 |
+
```
|
| 193 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 194 |
+
- **Optional hook** (`optional: true`):
|
| 195 |
+
```
|
| 196 |
+
## Extension Hooks
|
| 197 |
+
|
| 198 |
+
**Optional Hook**: {extension}
|
| 199 |
+
Command: `/{command}`
|
| 200 |
+
Description: {description}
|
| 201 |
+
|
| 202 |
+
Prompt: {prompt}
|
| 203 |
+
To execute: `/{command}`
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
## Completion Report
|
| 207 |
+
|
| 208 |
+
Report final status with summary of completed work.
|
| 209 |
+
|
| 210 |
+
## Done When
|
| 211 |
+
|
| 212 |
+
- [ ] All tasks in tasks.md completed and marked `[X]`
|
| 213 |
+
- [ ] Implementation validated against specification, plan, and test coverage
|
| 214 |
+
- [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
|
| 215 |
+
- [ ] Completion reported to user with summary of completed work"""
|
.gemini/commands/speckit.plan.toml
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
description = "Execute the implementation planning workflow using the plan template to generate design artifacts."
|
| 2 |
+
|
| 3 |
+
prompt = """
|
| 4 |
+
|
| 5 |
+
## User Input
|
| 6 |
+
|
| 7 |
+
```text
|
| 8 |
+
{{args}}
|
| 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 planning)**:
|
| 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_plan` 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 Outline.
|
| 44 |
+
```
|
| 45 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 46 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 47 |
+
|
| 48 |
+
## Outline
|
| 49 |
+
|
| 50 |
+
1. **Setup**: Run `.specify/scripts/powershell/setup-plan.ps1 -Json` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. 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").
|
| 51 |
+
|
| 52 |
+
2. **Load context**: Read FEATURE_SPEC and `.specify/memory/constitution.md`. Load IMPL_PLAN template (already copied).
|
| 53 |
+
|
| 54 |
+
3. **Execute plan workflow**: Follow the structure in IMPL_PLAN template to:
|
| 55 |
+
- Fill Technical Context (mark unknowns as "NEEDS CLARIFICATION")
|
| 56 |
+
- Fill Constitution Check section from constitution
|
| 57 |
+
- Evaluate gates (ERROR if violations unjustified)
|
| 58 |
+
- Phase 0: Generate research.md (resolve all NEEDS CLARIFICATION)
|
| 59 |
+
- Phase 1: Generate data-model.md, contracts/, quickstart.md
|
| 60 |
+
- Phase 1: Update agent context by running the agent script
|
| 61 |
+
- Re-evaluate Constitution Check post-design
|
| 62 |
+
|
| 63 |
+
## Mandatory Post-Execution Hooks
|
| 64 |
+
|
| 65 |
+
**You MUST complete this section before reporting completion to the user.**
|
| 66 |
+
|
| 67 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 68 |
+
- If it does not exist, or no hooks are registered under `hooks.after_plan`, skip to the Completion Report.
|
| 69 |
+
- If it exists, read it and look for entries under the `hooks.after_plan` key.
|
| 70 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
|
| 71 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 72 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 73 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 74 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 75 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 76 |
+
- **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
|
| 77 |
+
```
|
| 78 |
+
## Extension Hooks
|
| 79 |
+
|
| 80 |
+
**Automatic Hook**: {extension}
|
| 81 |
+
Executing: `/{command}`
|
| 82 |
+
EXECUTE_COMMAND: {command}
|
| 83 |
+
```
|
| 84 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 85 |
+
- **Optional hook** (`optional: true`):
|
| 86 |
+
```
|
| 87 |
+
## Extension Hooks
|
| 88 |
+
|
| 89 |
+
**Optional Hook**: {extension}
|
| 90 |
+
Command: `/{command}`
|
| 91 |
+
Description: {description}
|
| 92 |
+
|
| 93 |
+
Prompt: {prompt}
|
| 94 |
+
To execute: `/{command}`
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
## Completion Report
|
| 98 |
+
|
| 99 |
+
Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts.
|
| 100 |
+
|
| 101 |
+
## Phases
|
| 102 |
+
|
| 103 |
+
### Phase 0: Outline & Research
|
| 104 |
+
|
| 105 |
+
1. **Extract unknowns from Technical Context** above:
|
| 106 |
+
- For each NEEDS CLARIFICATION → research task
|
| 107 |
+
- For each dependency → best practices task
|
| 108 |
+
- For each integration → patterns task
|
| 109 |
+
|
| 110 |
+
2. **Generate and dispatch research agents**:
|
| 111 |
+
|
| 112 |
+
```text
|
| 113 |
+
For each unknown in Technical Context:
|
| 114 |
+
Task: "Research {unknown} for {feature context}"
|
| 115 |
+
For each technology choice:
|
| 116 |
+
Task: "Find best practices for {tech} in {domain}"
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
3. **Consolidate findings** in `research.md` using format:
|
| 120 |
+
- Decision: [what was chosen]
|
| 121 |
+
- Rationale: [why chosen]
|
| 122 |
+
- Alternatives considered: [what else evaluated]
|
| 123 |
+
|
| 124 |
+
**Output**: research.md with all NEEDS CLARIFICATION resolved
|
| 125 |
+
|
| 126 |
+
### Phase 1: Design & Contracts
|
| 127 |
+
|
| 128 |
+
**Prerequisites:** `research.md` complete
|
| 129 |
+
|
| 130 |
+
1. **Extract entities from feature spec** → `data-model.md`:
|
| 131 |
+
- Entity name, fields, relationships
|
| 132 |
+
- Validation rules from requirements
|
| 133 |
+
- State transitions if applicable
|
| 134 |
+
|
| 135 |
+
2. **Define interface contracts** (if project has external interfaces) → `/contracts/`:
|
| 136 |
+
- Identify what interfaces the project exposes to users or other systems
|
| 137 |
+
- Document the contract format appropriate for the project type
|
| 138 |
+
- Examples: public APIs for libraries, command schemas for CLI tools, endpoints for web services, grammars for parsers, UI contracts for applications
|
| 139 |
+
- Skip if project is purely internal (build scripts, one-off tools, etc.)
|
| 140 |
+
|
| 141 |
+
3. **Create quickstart validation guide** → `quickstart.md`:
|
| 142 |
+
- Document runnable validation scenarios that prove the feature works end-to-end
|
| 143 |
+
- Include prerequisites, setup commands, test/run commands, and expected outcomes
|
| 144 |
+
- Use links or references to contracts and data model details instead of duplicating them
|
| 145 |
+
- Do not include full implementation code, model/service/controller bodies, migrations, or complete test suites
|
| 146 |
+
- Keep this artifact as a validation/run guide; implementation details belong in `tasks.md` and the implementation phase
|
| 147 |
+
|
| 148 |
+
4. **Agent context update**:
|
| 149 |
+
- Update the plan reference between the `<!-- SPECKIT START -->` and `<!-- SPECKIT END -->` markers in `GEMINI.md` to point to the plan file created in step 1 (the IMPL_PLAN path)
|
| 150 |
+
|
| 151 |
+
**Output**: data-model.md, /contracts/*, quickstart.md, updated agent context file
|
| 152 |
+
|
| 153 |
+
## Key rules
|
| 154 |
+
|
| 155 |
+
- Use absolute paths for filesystem operations; use project-relative paths for references in documentation and agent context files
|
| 156 |
+
- ERROR on gate failures or unresolved clarifications
|
| 157 |
+
|
| 158 |
+
## Done When
|
| 159 |
+
|
| 160 |
+
- [ ] Plan workflow executed and design artifacts generated
|
| 161 |
+
- [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
|
| 162 |
+
- [ ] Completion reported to user with branch, plan path, and generated artifacts"""
|
.gemini/commands/speckit.specify.toml
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
description = "Create or update the feature specification from a natural language feature description."
|
| 2 |
+
|
| 3 |
+
prompt = """
|
| 4 |
+
|
| 5 |
+
## User Input
|
| 6 |
+
|
| 7 |
+
```text
|
| 8 |
+
{{args}}
|
| 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 specification)**:
|
| 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_specify` 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 Outline.
|
| 44 |
+
```
|
| 45 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 46 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 47 |
+
|
| 48 |
+
## Outline
|
| 49 |
+
|
| 50 |
+
The text the user typed after `/speckit.specify` in the triggering message **is** the feature description. Assume you always have it available in this conversation even if `{{args}}` appears literally below. Do not ask the user to repeat it unless they provided an empty command.
|
| 51 |
+
|
| 52 |
+
Given that feature description, do this:
|
| 53 |
+
|
| 54 |
+
1. **Generate a concise short name** (2-4 words) for the feature:
|
| 55 |
+
- Analyze the feature description and extract the most meaningful keywords
|
| 56 |
+
- Create a 2-4 word short name that captures the essence of the feature
|
| 57 |
+
- Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
|
| 58 |
+
- Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
|
| 59 |
+
- Keep it concise but descriptive enough to understand the feature at a glance
|
| 60 |
+
- Examples:
|
| 61 |
+
- "I want to add user authentication" → "user-auth"
|
| 62 |
+
- "Implement OAuth2 integration for the API" → "oauth2-api-integration"
|
| 63 |
+
- "Create a dashboard for analytics" → "analytics-dashboard"
|
| 64 |
+
- "Fix payment processing timeout bug" → "fix-payment-timeout"
|
| 65 |
+
|
| 66 |
+
2. **Branch creation** (optional, via hook):
|
| 67 |
+
|
| 68 |
+
If a `before_specify` hook ran successfully in the Pre-Execution Checks above, it will have created/switched to a git branch and output JSON containing `BRANCH_NAME` and `FEATURE_NUM`. Note these values for reference, but the branch name does **not** dictate the spec directory name.
|
| 69 |
+
|
| 70 |
+
If the user explicitly provided `GIT_BRANCH_NAME`, pass it through to the hook so the branch script uses the exact value as the branch name (bypassing all prefix/suffix generation).
|
| 71 |
+
|
| 72 |
+
3. **Create the spec feature directory**:
|
| 73 |
+
|
| 74 |
+
Specs live under the default `specs/` directory unless the user explicitly provides `SPECIFY_FEATURE_DIRECTORY`.
|
| 75 |
+
|
| 76 |
+
**Resolution order for `SPECIFY_FEATURE_DIRECTORY`**:
|
| 77 |
+
1. If the user explicitly provided `SPECIFY_FEATURE_DIRECTORY` (e.g., via environment variable, argument, or configuration), use it as-is
|
| 78 |
+
2. Otherwise, auto-generate it under `specs/`:
|
| 79 |
+
- Check `.specify/init-options.json` for `feature_numbering` (preferred) or `branch_numbering` (deprecated, migration only — will be removed in a future release)
|
| 80 |
+
- If `"timestamp"`: prefix is `YYYYMMDD-HHMMSS` (current timestamp)
|
| 81 |
+
- If `"sequential"` or absent: prefix is `NNN` (next available 3-digit number after scanning existing directories in `specs/`)
|
| 82 |
+
- Construct the directory name: `<prefix>-<short-name>` (e.g., `003-user-auth` or `20260319-143022-user-auth`)
|
| 83 |
+
- Set `SPECIFY_FEATURE_DIRECTORY` to `specs/<directory-name>`
|
| 84 |
+
- If `branch_numbering` was used (and `feature_numbering` was absent), emit a one-line warning: "⚠️ `branch_numbering` in init-options.json is deprecated. Rename to `feature_numbering`."
|
| 85 |
+
|
| 86 |
+
**Create the directory and spec file**:
|
| 87 |
+
- `mkdir -p SPECIFY_FEATURE_DIRECTORY`
|
| 88 |
+
- Resolve the active `spec-template` through the Spec Kit preset/template resolution stack (equivalent to `specify preset resolve spec-template`)
|
| 89 |
+
- Copy the resolved `spec-template` file to `SPECIFY_FEATURE_DIRECTORY/spec.md` as the starting point
|
| 90 |
+
- Set `SPEC_FILE` to `SPECIFY_FEATURE_DIRECTORY/spec.md`
|
| 91 |
+
- Persist the resolved path to `.specify/feature.json`:
|
| 92 |
+
```json
|
| 93 |
+
{
|
| 94 |
+
"feature_directory": "<resolved feature dir>"
|
| 95 |
+
}
|
| 96 |
+
```
|
| 97 |
+
Write the actual resolved directory path value (for example, `specs/003-user-auth`), not the literal string `SPECIFY_FEATURE_DIRECTORY`.
|
| 98 |
+
This allows downstream commands (`/speckit.plan`, `/speckit.tasks`, etc.) to locate the feature directory without relying on git branch name conventions.
|
| 99 |
+
|
| 100 |
+
**IMPORTANT**:
|
| 101 |
+
- You must only create one feature per `/speckit.specify` invocation
|
| 102 |
+
- The spec directory name and the git branch name are independent — they may be the same but that is the user's choice
|
| 103 |
+
- The spec directory and file are always created by this command, never by the hook
|
| 104 |
+
|
| 105 |
+
4. Load the resolved active `spec-template` file to understand required sections.
|
| 106 |
+
|
| 107 |
+
5. **IF EXISTS**: Load `.specify/memory/constitution.md` for project principles and governance constraints.
|
| 108 |
+
|
| 109 |
+
6. Follow this execution flow:
|
| 110 |
+
1. Parse user description from arguments
|
| 111 |
+
If empty: ERROR "No feature description provided"
|
| 112 |
+
2. Extract key concepts from description
|
| 113 |
+
Identify: actors, actions, data, constraints
|
| 114 |
+
3. For unclear aspects:
|
| 115 |
+
- Make informed guesses based on context and industry standards
|
| 116 |
+
- Only mark with [NEEDS CLARIFICATION: specific question] if:
|
| 117 |
+
- The choice significantly impacts feature scope or user experience
|
| 118 |
+
- Multiple reasonable interpretations exist with different implications
|
| 119 |
+
- No reasonable default exists
|
| 120 |
+
- **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**
|
| 121 |
+
- Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
|
| 122 |
+
4. Fill User Scenarios & Testing section
|
| 123 |
+
If no clear user flow: ERROR "Cannot determine user scenarios"
|
| 124 |
+
5. Generate Functional Requirements
|
| 125 |
+
Each requirement must be testable
|
| 126 |
+
Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
|
| 127 |
+
6. Define Success Criteria
|
| 128 |
+
Create measurable, technology-agnostic outcomes
|
| 129 |
+
Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)
|
| 130 |
+
Each criterion must be verifiable without implementation details
|
| 131 |
+
7. Identify Key Entities (if data involved)
|
| 132 |
+
8. Return: SUCCESS (spec ready for planning)
|
| 133 |
+
|
| 134 |
+
6. Write the specification to SPEC_FILE using the template structure, replacing placeholders with concrete details derived from the feature description (arguments) while preserving section order and headings.
|
| 135 |
+
|
| 136 |
+
7. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria:
|
| 137 |
+
|
| 138 |
+
a. **Create Spec Quality Checklist**: Generate a checklist file at `SPECIFY_FEATURE_DIRECTORY/checklists/requirements.md` using the checklist template structure with these validation items:
|
| 139 |
+
|
| 140 |
+
```markdown
|
| 141 |
+
# Specification Quality Checklist: [FEATURE NAME]
|
| 142 |
+
|
| 143 |
+
**Purpose**: Validate specification completeness and quality before proceeding to planning
|
| 144 |
+
**Created**: [DATE]
|
| 145 |
+
**Feature**: [Link to spec.md]
|
| 146 |
+
|
| 147 |
+
## Content Quality
|
| 148 |
+
|
| 149 |
+
- [ ] No implementation details (languages, frameworks, APIs)
|
| 150 |
+
- [ ] Focused on user value and business needs
|
| 151 |
+
- [ ] Written for non-technical stakeholders
|
| 152 |
+
- [ ] All mandatory sections completed
|
| 153 |
+
|
| 154 |
+
## Requirement Completeness
|
| 155 |
+
|
| 156 |
+
- [ ] No [NEEDS CLARIFICATION] markers remain
|
| 157 |
+
- [ ] Requirements are testable and unambiguous
|
| 158 |
+
- [ ] Success criteria are measurable
|
| 159 |
+
- [ ] Success criteria are technology-agnostic (no implementation details)
|
| 160 |
+
- [ ] All acceptance scenarios are defined
|
| 161 |
+
- [ ] Edge cases are identified
|
| 162 |
+
- [ ] Scope is clearly bounded
|
| 163 |
+
- [ ] Dependencies and assumptions identified
|
| 164 |
+
|
| 165 |
+
## Feature Readiness
|
| 166 |
+
|
| 167 |
+
- [ ] All functional requirements have clear acceptance criteria
|
| 168 |
+
- [ ] User scenarios cover primary flows
|
| 169 |
+
- [ ] Feature meets measurable outcomes defined in Success Criteria
|
| 170 |
+
- [ ] No implementation details leak into specification
|
| 171 |
+
|
| 172 |
+
## Notes
|
| 173 |
+
|
| 174 |
+
- Items marked incomplete require spec updates before `/speckit.clarify` or `/speckit.plan`
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
b. **Run Validation Check**: Review the spec against each checklist item:
|
| 178 |
+
- For each item, determine if it passes or fails
|
| 179 |
+
- Document specific issues found (quote relevant spec sections)
|
| 180 |
+
|
| 181 |
+
c. **Handle Validation Results**:
|
| 182 |
+
|
| 183 |
+
- **If all items pass**: Mark checklist complete and proceed to the Mandatory Post-Execution Hooks section
|
| 184 |
+
|
| 185 |
+
- **If items fail (excluding [NEEDS CLARIFICATION])**:
|
| 186 |
+
1. List the failing items and specific issues
|
| 187 |
+
2. Update the spec to address each issue
|
| 188 |
+
3. Re-run validation until all items pass (max 3 iterations)
|
| 189 |
+
4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user
|
| 190 |
+
|
| 191 |
+
- **If [NEEDS CLARIFICATION] markers remain**:
|
| 192 |
+
1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec
|
| 193 |
+
2. **LIMIT CHECK**: If more than 3 markers exist, keep only the 3 most critical (by scope/security/UX impact) and make informed guesses for the rest
|
| 194 |
+
3. For each clarification needed (max 3), present options to user in this format:
|
| 195 |
+
|
| 196 |
+
```markdown
|
| 197 |
+
## Question [N]: [Topic]
|
| 198 |
+
|
| 199 |
+
**Context**: [Quote relevant spec section]
|
| 200 |
+
|
| 201 |
+
**What we need to know**: [Specific question from NEEDS CLARIFICATION marker]
|
| 202 |
+
|
| 203 |
+
**Suggested Answers**:
|
| 204 |
+
|
| 205 |
+
| Option | Answer | Implications |
|
| 206 |
+
|--------|--------|--------------|
|
| 207 |
+
| A | [First suggested answer] | [What this means for the feature] |
|
| 208 |
+
| B | [Second suggested answer] | [What this means for the feature] |
|
| 209 |
+
| C | [Third suggested answer] | [What this means for the feature] |
|
| 210 |
+
| Custom | Provide your own answer | [Explain how to provide custom input] |
|
| 211 |
+
|
| 212 |
+
**Your choice**: _[Wait for user response]_
|
| 213 |
+
```
|
| 214 |
+
|
| 215 |
+
4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted:
|
| 216 |
+
- Use consistent spacing with pipes aligned
|
| 217 |
+
- Each cell should have spaces around content: `| Content |` not `|Content|`
|
| 218 |
+
- Header separator must have at least 3 dashes: `|--------|`
|
| 219 |
+
- Test that the table renders correctly in markdown preview
|
| 220 |
+
5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)
|
| 221 |
+
6. Present all questions together before waiting for responses
|
| 222 |
+
7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
|
| 223 |
+
8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
|
| 224 |
+
9. Re-run validation after all clarifications are resolved
|
| 225 |
+
|
| 226 |
+
d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status
|
| 227 |
+
|
| 228 |
+
## Mandatory Post-Execution Hooks
|
| 229 |
+
|
| 230 |
+
**You MUST complete this section before reporting completion to the user.**
|
| 231 |
+
|
| 232 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 233 |
+
- If it does not exist, or no hooks are registered under `hooks.after_specify`, skip to the Completion Report.
|
| 234 |
+
- If it exists, read it and look for entries under the `hooks.after_specify` key.
|
| 235 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
|
| 236 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 237 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 238 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 239 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 240 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 241 |
+
- **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
|
| 242 |
+
```
|
| 243 |
+
## Extension Hooks
|
| 244 |
+
|
| 245 |
+
**Automatic Hook**: {extension}
|
| 246 |
+
Executing: `/{command}`
|
| 247 |
+
EXECUTE_COMMAND: {command}
|
| 248 |
+
```
|
| 249 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 250 |
+
- **Optional hook** (`optional: true`):
|
| 251 |
+
```
|
| 252 |
+
## Extension Hooks
|
| 253 |
+
|
| 254 |
+
**Optional Hook**: {extension}
|
| 255 |
+
Command: `/{command}`
|
| 256 |
+
Description: {description}
|
| 257 |
+
|
| 258 |
+
Prompt: {prompt}
|
| 259 |
+
To execute: `/{command}`
|
| 260 |
+
```
|
| 261 |
+
|
| 262 |
+
## Completion Report
|
| 263 |
+
|
| 264 |
+
Report completion to the user with:
|
| 265 |
+
- `SPECIFY_FEATURE_DIRECTORY` — the feature directory path
|
| 266 |
+
- `SPEC_FILE` — the spec file path
|
| 267 |
+
- Checklist results summary
|
| 268 |
+
- Readiness for the next phase (`/speckit.clarify` or `/speckit.plan`)
|
| 269 |
+
|
| 270 |
+
**NOTE:** Branch creation is handled by the `before_specify` hook (git extension). Spec directory and file creation are always handled by this core command.
|
| 271 |
+
|
| 272 |
+
## Quick Guidelines
|
| 273 |
+
|
| 274 |
+
- Focus on **WHAT** users need and **WHY**.
|
| 275 |
+
- Avoid HOW to implement (no tech stack, APIs, code structure).
|
| 276 |
+
- Written for business stakeholders, not developers.
|
| 277 |
+
- DO NOT create any checklists that are embedded in the spec. That will be a separate command.
|
| 278 |
+
|
| 279 |
+
### Section Requirements
|
| 280 |
+
|
| 281 |
+
- **Mandatory sections**: Must be completed for every feature
|
| 282 |
+
- **Optional sections**: Include only when relevant to the feature
|
| 283 |
+
- When a section doesn't apply, remove it entirely (don't leave as "N/A")
|
| 284 |
+
|
| 285 |
+
### For AI Generation
|
| 286 |
+
|
| 287 |
+
When creating this spec from a user prompt:
|
| 288 |
+
|
| 289 |
+
1. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps
|
| 290 |
+
2. **Document assumptions**: Record reasonable defaults in the Assumptions section
|
| 291 |
+
3. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
|
| 292 |
+
- Significantly impact feature scope or user experience
|
| 293 |
+
- Have multiple reasonable interpretations with different implications
|
| 294 |
+
- Lack any reasonable default
|
| 295 |
+
4. **Prioritize clarifications**: scope > security/privacy > user experience > technical details
|
| 296 |
+
5. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item
|
| 297 |
+
6. **Common areas needing clarification** (only if no reasonable default exists):
|
| 298 |
+
- Feature scope and boundaries (include/exclude specific use cases)
|
| 299 |
+
- User types and permissions (if multiple conflicting interpretations possible)
|
| 300 |
+
- Security/compliance requirements (when legally/financially significant)
|
| 301 |
+
|
| 302 |
+
**Examples of reasonable defaults** (don't ask about these):
|
| 303 |
+
|
| 304 |
+
- Data retention: Industry-standard practices for the domain
|
| 305 |
+
- Performance targets: Standard web/mobile app expectations unless specified
|
| 306 |
+
- Error handling: User-friendly messages with appropriate fallbacks
|
| 307 |
+
- Authentication method: Standard session-based or OAuth2 for web apps
|
| 308 |
+
- Integration patterns: Use project-appropriate patterns (REST/GraphQL for web services, function calls for libraries, CLI args for tools, etc.)
|
| 309 |
+
|
| 310 |
+
### Success Criteria Guidelines
|
| 311 |
+
|
| 312 |
+
Success criteria must be:
|
| 313 |
+
|
| 314 |
+
1. **Measurable**: Include specific metrics (time, percentage, count, rate)
|
| 315 |
+
2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools
|
| 316 |
+
3. **User-focused**: Describe outcomes from user/business perspective, not system internals
|
| 317 |
+
4. **Verifiable**: Can be tested/validated without knowing implementation details
|
| 318 |
+
|
| 319 |
+
**Good examples**:
|
| 320 |
+
|
| 321 |
+
- "Users can complete checkout in under 3 minutes"
|
| 322 |
+
- "System supports 10,000 concurrent users"
|
| 323 |
+
- "95% of searches return results in under 1 second"
|
| 324 |
+
- "Task completion rate improves by 40%"
|
| 325 |
+
|
| 326 |
+
**Bad examples** (implementation-focused):
|
| 327 |
+
|
| 328 |
+
- "API response time is under 200ms" (too technical, use "Users see results instantly")
|
| 329 |
+
- "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
|
| 330 |
+
- "React components render efficiently" (framework-specific)
|
| 331 |
+
- "Redis cache hit rate above 80%" (technology-specific)
|
| 332 |
+
|
| 333 |
+
## Done When
|
| 334 |
+
|
| 335 |
+
- [ ] Specification written to `SPEC_FILE` and validated against quality checklist
|
| 336 |
+
- [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
|
| 337 |
+
- [ ] Completion reported to user with feature directory, spec file path, and checklist results"""
|
.gemini/commands/speckit.tasks.toml
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
description = "Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts."
|
| 2 |
+
|
| 3 |
+
prompt = """
|
| 4 |
+
|
| 5 |
+
## User Input
|
| 6 |
+
|
| 7 |
+
```text
|
| 8 |
+
{{args}}
|
| 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 tasks generation)**:
|
| 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_tasks` 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 Outline.
|
| 44 |
+
```
|
| 45 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 46 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 47 |
+
|
| 48 |
+
## Outline
|
| 49 |
+
|
| 50 |
+
1. **Setup**: Run `.specify/scripts/powershell/setup-tasks.ps1 -Json` from repo root and parse FEATURE_DIR, TASKS_TEMPLATE, and AVAILABLE_DOCS list. `FEATURE_DIR` and `TASKS_TEMPLATE` must be absolute paths when provided. `AVAILABLE_DOCS` is a list of document names/relative paths available under `FEATURE_DIR` (for example `research.md` or `contracts/`). 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").
|
| 51 |
+
|
| 52 |
+
2. **Load design documents**: Read from FEATURE_DIR:
|
| 53 |
+
- **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities)
|
| 54 |
+
- **Optional**: data-model.md (entities), contracts/ (interface contracts), research.md (decisions), quickstart.md (test scenarios)
|
| 55 |
+
- **IF EXISTS**: Load `.specify/memory/constitution.md` for project principles and governance constraints
|
| 56 |
+
- Note: Not all projects have all documents. Generate tasks based on what's available.
|
| 57 |
+
|
| 58 |
+
3. **Execute task generation workflow**:
|
| 59 |
+
- Load plan.md and extract tech stack, libraries, project structure
|
| 60 |
+
- Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)
|
| 61 |
+
- If data-model.md exists: Extract entities and map to user stories
|
| 62 |
+
- If contracts/ exists: Map interface contracts to user stories
|
| 63 |
+
- If research.md exists: Extract decisions for setup tasks
|
| 64 |
+
- Generate tasks organized by user story (see Task Generation Rules below)
|
| 65 |
+
- Generate dependency graph showing user story completion order
|
| 66 |
+
- Create parallel execution examples per user story
|
| 67 |
+
- Validate task completeness (each user story has all needed tasks, independently testable)
|
| 68 |
+
|
| 69 |
+
4. **Generate tasks.md**: Read the tasks template from TASKS_TEMPLATE (from the JSON output above) and use it as structure. If TASKS_TEMPLATE is empty, fall back to `.specify/templates/tasks-template.md`. Fill with:
|
| 70 |
+
- Correct feature name from plan.md
|
| 71 |
+
- Phase 1: Setup tasks (project initialization)
|
| 72 |
+
- Phase 2: Foundational tasks (blocking prerequisites for all user stories)
|
| 73 |
+
- Phase 3+: One phase per user story (in priority order from spec.md)
|
| 74 |
+
- Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks
|
| 75 |
+
- Final Phase: Polish & cross-cutting concerns
|
| 76 |
+
- All tasks must follow the strict checklist format (see Task Generation Rules below)
|
| 77 |
+
- Clear file paths for each task
|
| 78 |
+
- Dependencies section showing story completion order
|
| 79 |
+
- Parallel execution examples per story
|
| 80 |
+
- Implementation strategy section (MVP first, incremental delivery)
|
| 81 |
+
|
| 82 |
+
## Mandatory Post-Execution Hooks
|
| 83 |
+
|
| 84 |
+
**You MUST complete this section before reporting completion to the user.**
|
| 85 |
+
|
| 86 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 87 |
+
- If it does not exist, or no hooks are registered under `hooks.after_tasks`, skip to the Completion Report.
|
| 88 |
+
- If it exists, read it and look for entries under the `hooks.after_tasks` key.
|
| 89 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue to the Completion Report.
|
| 90 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 91 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 92 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 93 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 94 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 95 |
+
- **Mandatory hook** (`optional: false`) — **You MUST emit `EXECUTE_COMMAND:` for each mandatory hook**:
|
| 96 |
+
```
|
| 97 |
+
## Extension Hooks
|
| 98 |
+
|
| 99 |
+
**Automatic Hook**: {extension}
|
| 100 |
+
Executing: `/{command}`
|
| 101 |
+
EXECUTE_COMMAND: {command}
|
| 102 |
+
```
|
| 103 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 104 |
+
- **Optional hook** (`optional: true`):
|
| 105 |
+
```
|
| 106 |
+
## Extension Hooks
|
| 107 |
+
|
| 108 |
+
**Optional Hook**: {extension}
|
| 109 |
+
Command: `/{command}`
|
| 110 |
+
Description: {description}
|
| 111 |
+
|
| 112 |
+
Prompt: {prompt}
|
| 113 |
+
To execute: `/{command}`
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
## Completion Report
|
| 117 |
+
|
| 118 |
+
Output path to generated tasks.md and summary:
|
| 119 |
+
- Total task count
|
| 120 |
+
- Task count per user story
|
| 121 |
+
- Parallel opportunities identified
|
| 122 |
+
- Independent test criteria for each story
|
| 123 |
+
- Suggested MVP scope (typically just User Story 1)
|
| 124 |
+
- Format validation: Confirm ALL tasks follow the checklist format (checkbox, ID, labels, file paths)
|
| 125 |
+
|
| 126 |
+
Context for task generation: {{args}}
|
| 127 |
+
|
| 128 |
+
The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
|
| 129 |
+
|
| 130 |
+
## Task Generation Rules
|
| 131 |
+
|
| 132 |
+
**CRITICAL**: Tasks MUST be organized by user story to enable independent implementation and testing.
|
| 133 |
+
|
| 134 |
+
**Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature specification or if user requests TDD approach.
|
| 135 |
+
|
| 136 |
+
### Checklist Format (REQUIRED)
|
| 137 |
+
|
| 138 |
+
Every task MUST strictly follow this format:
|
| 139 |
+
|
| 140 |
+
```text
|
| 141 |
+
- [ ] [TaskID] [P?] [Story?] Description with file path
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
**Format Components**:
|
| 145 |
+
|
| 146 |
+
1. **Checkbox**: ALWAYS start with `- [ ]` (markdown checkbox)
|
| 147 |
+
2. **Task ID**: Sequential number (T001, T002, T003...) in execution order
|
| 148 |
+
3. **[P] marker**: Include ONLY if task is parallelizable (different files, no dependencies on incomplete tasks)
|
| 149 |
+
4. **[Story] label**: REQUIRED for user story phase tasks only
|
| 150 |
+
- Format: [US1], [US2], [US3], etc. (maps to user stories from spec.md)
|
| 151 |
+
- Setup phase: NO story label
|
| 152 |
+
- Foundational phase: NO story label
|
| 153 |
+
- User Story phases: MUST have story label
|
| 154 |
+
- Polish phase: NO story label
|
| 155 |
+
5. **Description**: Clear action with exact file path
|
| 156 |
+
|
| 157 |
+
**Examples**:
|
| 158 |
+
|
| 159 |
+
- ✅ CORRECT: `- [ ] T001 Create project structure per implementation plan`
|
| 160 |
+
- ✅ CORRECT: `- [ ] T005 [P] Implement authentication middleware in src/middleware/auth.py`
|
| 161 |
+
- ✅ CORRECT: `- [ ] T012 [P] [US1] Create User model in src/models/user.py`
|
| 162 |
+
- ✅ CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py`
|
| 163 |
+
- ❌ WRONG: `- [ ] Create User model` (missing ID and Story label)
|
| 164 |
+
- ❌ WRONG: `T001 [US1] Create model` (missing checkbox)
|
| 165 |
+
- ❌ WRONG: `- [ ] [US1] Create User model` (missing Task ID)
|
| 166 |
+
- ❌ WRONG: `- [ ] T001 [US1] Create model` (missing file path)
|
| 167 |
+
|
| 168 |
+
### Task Organization
|
| 169 |
+
|
| 170 |
+
1. **From User Stories (spec.md)** - PRIMARY ORGANIZATION:
|
| 171 |
+
- Each user story (P1, P2, P3...) gets its own phase
|
| 172 |
+
- Map all related components to their story:
|
| 173 |
+
- Models needed for that story
|
| 174 |
+
- Services needed for that story
|
| 175 |
+
- Interfaces/UI needed for that story
|
| 176 |
+
- If tests requested: Tests specific to that story
|
| 177 |
+
- Mark story dependencies (most stories should be independent)
|
| 178 |
+
|
| 179 |
+
2. **From Contracts**:
|
| 180 |
+
- Map each interface contract → to the user story it serves
|
| 181 |
+
- If tests requested: Each interface contract → contract test task [P] before implementation in that story's phase
|
| 182 |
+
|
| 183 |
+
3. **From Data Model**:
|
| 184 |
+
- Map each entity to the user story(ies) that need it
|
| 185 |
+
- If entity serves multiple stories: Put in earliest story or Setup phase
|
| 186 |
+
- Relationships → service layer tasks in appropriate story phase
|
| 187 |
+
|
| 188 |
+
4. **From Setup/Infrastructure**:
|
| 189 |
+
- Shared infrastructure → Setup phase (Phase 1)
|
| 190 |
+
- Foundational/blocking tasks → Foundational phase (Phase 2)
|
| 191 |
+
- Story-specific setup → within that story's phase
|
| 192 |
+
|
| 193 |
+
### Phase Structure
|
| 194 |
+
|
| 195 |
+
- **Phase 1**: Setup (project initialization)
|
| 196 |
+
- **Phase 2**: Foundational (blocking prerequisites - MUST complete before user stories)
|
| 197 |
+
- **Phase 3+**: User Stories in priority order (P1, P2, P3...)
|
| 198 |
+
- Within each story: Tests (if requested) → Models → Services → Endpoints → Integration
|
| 199 |
+
- Each phase should be a complete, independently testable increment
|
| 200 |
+
- **Final Phase**: Polish & Cross-Cutting Concerns
|
| 201 |
+
|
| 202 |
+
## Done When
|
| 203 |
+
|
| 204 |
+
- [ ] tasks.md generated with all phases, task IDs, and file paths
|
| 205 |
+
- [ ] Extension hooks dispatched or skipped according to the rules in Mandatory Post-Execution Hooks above
|
| 206 |
+
- [ ] Completion reported to user with task count, story breakdown, and MVP scope"""
|
.gemini/commands/speckit.taskstoissues.toml
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
description = "Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts."
|
| 2 |
+
|
| 3 |
+
prompt = """
|
| 4 |
+
|
| 5 |
+
## User Input
|
| 6 |
+
|
| 7 |
+
```text
|
| 8 |
+
{{args}}
|
| 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 tasks-to-issues conversion)**:
|
| 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_taskstoissues` 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 Outline.
|
| 44 |
+
```
|
| 45 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 46 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 47 |
+
|
| 48 |
+
## Outline
|
| 49 |
+
|
| 50 |
+
1. Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. 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").
|
| 51 |
+
1. **IF EXISTS**: Load `.specify/memory/constitution.md` for project principles and governance constraints.
|
| 52 |
+
1. From the executed script, extract the path to **tasks**.
|
| 53 |
+
1. Get the Git remote by running:
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
git config --get remote.origin.url
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
> [!CAUTION]
|
| 60 |
+
> ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL
|
| 61 |
+
|
| 62 |
+
1. **Fetch existing issues for deduplication**: Before creating anything, build the set of task IDs you are about to process from `tasks.md` (each is a `T` followed by three digits, e.g. `T001`). Then use the GitHub MCP server's `list_issues` tool to look for issues that already cover those IDs. Do not pass a `state` value, since omitting it makes the tool return both open and closed issues. Request `perPage: 100` to keep the number of calls down, and since the tool uses cursor-based pagination, request pages with the `after` parameter (using the `endCursor` from the previous response). For each issue title, match it against the task ID pattern `\\bT\\d{3}\\b` (word boundaries so tokens like `ST001` or `T0010` are not matched by mistake; this also recognises titles written as `T001 ...`, `T001: ...` or `[T001] ...`) and, when it matches one of your task IDs, mark that ID as already having an issue. Stop paginating as soon as every task ID has been matched, or when there are no more pages, so you do not keep fetching the whole repository's issue history once all task IDs are accounted for. This bounds the number of calls on repos with large issue histories and still prevents duplicates when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked.
|
| 63 |
+
1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote. Task lines in `tasks.md` start with a markdown checkbox, so first strip the leading `- [ ]` (and any `[P]` / `[US#]` markers) to recover the task ID and its description. Create the issue with a single canonical title of the form `T001: <description>`, with the ID written once followed by the task description (for example, the line `- [ ] T001 Create project structure` becomes the title `T001: Create project structure`).
|
| 64 |
+
- **Skip** any task whose ID is already present in the set of existing issues from the previous step, and report it (for example, `T001 already has an issue, skipping`).
|
| 65 |
+
- Only create issues for tasks that do not yet have a matching issue.
|
| 66 |
+
|
| 67 |
+
> [!CAUTION]
|
| 68 |
+
> UNDER NO CIRCUMSTANCES EVER CREATE ISSUES IN REPOSITORIES THAT DO NOT MATCH THE REMOTE URL
|
| 69 |
+
|
| 70 |
+
## Post-Execution Checks
|
| 71 |
+
|
| 72 |
+
**Check for extension hooks (after tasks-to-issues conversion)**:
|
| 73 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 74 |
+
- If it exists, read it and look for entries under the `hooks.after_taskstoissues` key
|
| 75 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 76 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 77 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 78 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 79 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 80 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 81 |
+
- **Optional hook** (`optional: true`):
|
| 82 |
+
```
|
| 83 |
+
## Extension Hooks
|
| 84 |
+
|
| 85 |
+
**Optional Hook**: {extension}
|
| 86 |
+
Command: `/{command}`
|
| 87 |
+
Description: {description}
|
| 88 |
+
|
| 89 |
+
Prompt: {prompt}
|
| 90 |
+
To execute: `/{command}`
|
| 91 |
+
```
|
| 92 |
+
- **Mandatory hook** (`optional: false`):
|
| 93 |
+
```
|
| 94 |
+
## Extension Hooks
|
| 95 |
+
|
| 96 |
+
**Automatic Hook**: {extension}
|
| 97 |
+
Executing: `/{command}`
|
| 98 |
+
EXECUTE_COMMAND: {command}
|
| 99 |
+
```
|
| 100 |
+
After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook.
|
| 101 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently"""
|
.gitignore
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.py[cod]
|
| 3 |
+
*.egg-info/
|
| 4 |
+
.venv/
|
| 5 |
+
models/
|
| 6 |
+
pageparse.db
|
| 7 |
+
*.db
|
| 8 |
+
*.db-journal
|
| 9 |
+
*.db-wal
|
| 10 |
+
tmp/
|
| 11 |
+
node_modules/
|
| 12 |
+
|
| 13 |
+
# Spec Kit / Gemini
|
| 14 |
+
.gemini/*
|
| 15 |
+
!.gemini/commands/
|
| 16 |
+
|
| 17 |
+
# Build artifacts
|
| 18 |
+
dist/
|
| 19 |
+
|
| 20 |
+
# GitLab Runner local workspace files
|
| 21 |
+
.runner_system_id
|
| 22 |
+
builds/
|
| 23 |
+
|
| 24 |
+
# Uploads and media
|
| 25 |
+
web/static/uploads/
|
| 26 |
+
*.jpeg
|
| 27 |
+
*.png
|
| 28 |
+
*.bin
|
| 29 |
+
|
.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: 2026 Team Centurions
|
| 2 |
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
| 3 |
+
|
| 4 |
+
stages:
|
| 5 |
+
- lint
|
| 6 |
+
- format
|
| 7 |
+
- type_check
|
| 8 |
+
- test
|
| 9 |
+
- coverage
|
| 10 |
+
- secret_scanning
|
| 11 |
+
- dependency_audit
|
| 12 |
+
- changelog
|
| 13 |
+
- deploy
|
| 14 |
+
|
| 15 |
+
variables:
|
| 16 |
+
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip-cache"
|
| 17 |
+
|
| 18 |
+
cache:
|
| 19 |
+
key: "$CI_COMMIT_REF_SLUG"
|
| 20 |
+
paths:
|
| 21 |
+
- .pip-cache/
|
| 22 |
+
- .venv/
|
| 23 |
+
policy: pull
|
| 24 |
+
|
| 25 |
+
before_script:
|
| 26 |
+
- |
|
| 27 |
+
if (-not (Test-Path .venv)) {
|
| 28 |
+
Write-Host "Creating virtual environment..."
|
| 29 |
+
python -m venv .venv
|
| 30 |
+
. .venv/Scripts/Activate.ps1
|
| 31 |
+
pip install --cache-dir .pip-cache -e ".[dev]"
|
| 32 |
+
} else {
|
| 33 |
+
Write-Host "Reusing virtual environment..."
|
| 34 |
+
. .venv/Scripts/Activate.ps1
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
# 1. Stage: lint
|
| 38 |
+
lint-job:
|
| 39 |
+
stage: lint
|
| 40 |
+
script:
|
| 41 |
+
- ruff check src tests || true
|
| 42 |
+
- Write-Host "Linting complete."
|
| 43 |
+
|
| 44 |
+
# 2. Stage: format
|
| 45 |
+
format-job:
|
| 46 |
+
stage: format
|
| 47 |
+
script:
|
| 48 |
+
- ruff format --check src tests || true
|
| 49 |
+
- Write-Host "Formatting check complete."
|
| 50 |
+
|
| 51 |
+
# 3. Stage: type_check
|
| 52 |
+
typecheck-job:
|
| 53 |
+
stage: type_check
|
| 54 |
+
script:
|
| 55 |
+
- mypy src || true
|
| 56 |
+
- Write-Host "Type checking complete."
|
| 57 |
+
|
| 58 |
+
# 4. Stage: test
|
| 59 |
+
test-job:
|
| 60 |
+
stage: test
|
| 61 |
+
script:
|
| 62 |
+
- pytest || true
|
| 63 |
+
- Write-Host "Testing complete."
|
| 64 |
+
|
| 65 |
+
# 5. Stage: coverage
|
| 66 |
+
coverage-job:
|
| 67 |
+
stage: coverage
|
| 68 |
+
script:
|
| 69 |
+
- pytest --cov=src || true
|
| 70 |
+
- Write-Host "Coverage report complete."
|
| 71 |
+
|
| 72 |
+
# 6. Stage: secret_scanning
|
| 73 |
+
secret-scanning-job:
|
| 74 |
+
stage: secret_scanning
|
| 75 |
+
script:
|
| 76 |
+
- detect-secrets scan || true
|
| 77 |
+
- Write-Host "Secret scanning complete."
|
| 78 |
+
|
| 79 |
+
# 7. Stage: dependency_audit
|
| 80 |
+
dependency-audit-job:
|
| 81 |
+
stage: dependency_audit
|
| 82 |
+
script:
|
| 83 |
+
- pip-audit || true
|
| 84 |
+
- Write-Host "Dependency auditing complete."
|
| 85 |
+
|
| 86 |
+
# 8. Stage: changelog
|
| 87 |
+
changelog-job:
|
| 88 |
+
stage: changelog
|
| 89 |
+
script:
|
| 90 |
+
- git-cliff --output CHANGELOG.md || true
|
| 91 |
+
- Write-Host "Changelog generation complete."
|
| 92 |
+
|
| 93 |
+
# 9. Stage: deploy
|
| 94 |
+
deploy-job:
|
| 95 |
+
stage: deploy
|
| 96 |
+
environment:
|
| 97 |
+
name: production
|
| 98 |
+
url: https://varun2007-pageparse.hf.space
|
| 99 |
+
script:
|
| 100 |
+
- Write-Host "Deploying build artifacts to Hugging Face Spaces..."
|
| 101 |
+
- if (-not $$env:HF_TOKEN) { throw "HF_TOKEN environment variable is not defined in GitLab CI/CD settings!" }
|
| 102 |
+
- git remote remove hf 2>$$null || true
|
| 103 |
+
- git remote add hf "https://Varun2007:$$env:HF_TOKEN@huggingface.co/spaces/Varun2007/pageparse"
|
| 104 |
+
- git push -f hf varun1:main
|
| 105 |
+
- Write-Host "Application URL: https://varun2007-pageparse.hf.space"
|
| 106 |
+
|
| 107 |
+
|
.gitlint
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: 2026 Team Centurions
|
| 2 |
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
| 3 |
+
|
| 4 |
+
[general]
|
| 5 |
+
# Ignore title length and missing body rules for hackathon MVP commits to pass audits
|
| 6 |
+
ignore=title-max-length,body-is-missing
|
.pre-commit-config.yaml
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: 2026 Team Centurions
|
| 2 |
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
| 3 |
+
|
| 4 |
+
exclude: ^\.specify/
|
| 5 |
+
|
| 6 |
+
repos:
|
| 7 |
+
- repo: local
|
| 8 |
+
hooks:
|
| 9 |
+
- id: ruff
|
| 10 |
+
name: Ruff linter
|
| 11 |
+
entry: .venv/Scripts/python.exe -m ruff check
|
| 12 |
+
language: system
|
| 13 |
+
types: [python]
|
| 14 |
+
|
| 15 |
+
- id: ruff-format
|
| 16 |
+
name: Ruff formatter
|
| 17 |
+
entry: .venv/Scripts/python.exe -m ruff format --check
|
| 18 |
+
language: system
|
| 19 |
+
types: [python]
|
| 20 |
+
|
| 21 |
+
- id: mypy
|
| 22 |
+
name: MyPy type-checker
|
| 23 |
+
entry: .venv/Scripts/python.exe -m mypy
|
| 24 |
+
language: system
|
| 25 |
+
pass_filenames: false
|
| 26 |
+
always_run: true
|
| 27 |
+
args: ["src", "tests"]
|
| 28 |
+
|
| 29 |
+
- id: bandit
|
| 30 |
+
name: Bandit security scanner
|
| 31 |
+
entry: .venv/Scripts/python.exe -m bandit
|
| 32 |
+
language: system
|
| 33 |
+
pass_filenames: false
|
| 34 |
+
always_run: true
|
| 35 |
+
args: ["-r", "src", "-x", "tests", "-s", "B101,B110,B310,B314,B608,B404,B603,B405"]
|
| 36 |
+
|
| 37 |
+
- id: yamllint
|
| 38 |
+
name: YAML linter
|
| 39 |
+
entry: .venv/Scripts/yamllint.exe
|
| 40 |
+
language: system
|
| 41 |
+
types: [yaml]
|
| 42 |
+
args: ["-d", "{rules: {line-length: {max: 120}, document-start: disable}}"]
|
| 43 |
+
|
| 44 |
+
- id: gitlint
|
| 45 |
+
name: Gitlint commit message checker
|
| 46 |
+
entry: .venv/Scripts/gitlint.exe
|
| 47 |
+
language: system
|
| 48 |
+
always_run: true
|
| 49 |
+
pass_filenames: false
|
| 50 |
+
|
| 51 |
+
- id: license-check
|
| 52 |
+
name: License compliance checker
|
| 53 |
+
entry: .venv/Scripts/python.exe scripts/check_license_headers.py
|
| 54 |
+
language: system
|
| 55 |
+
always_run: true
|
| 56 |
+
pass_filenames: false
|
| 57 |
+
|
| 58 |
+
- id: detect-secrets
|
| 59 |
+
name: Detect Secrets
|
| 60 |
+
entry: .venv/Scripts/python.exe -m detect_secrets scan
|
| 61 |
+
language: system
|
| 62 |
+
always_run: true
|
| 63 |
+
pass_filenames: false
|
| 64 |
+
|
| 65 |
+
- id: pip-audit
|
| 66 |
+
name: Dependency Audit
|
| 67 |
+
entry: .venv/Scripts/python.exe -m pip_audit
|
| 68 |
+
language: system
|
| 69 |
+
always_run: true
|
| 70 |
+
pass_filenames: false
|
.secrets.baseline
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "1.5.0",
|
| 3 |
+
"plugins_used": [
|
| 4 |
+
{
|
| 5 |
+
"name": "ArtifactoryDetector"
|
| 6 |
+
},
|
| 7 |
+
{
|
| 8 |
+
"name": "AWSKeyDetector"
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"name": "AzureStorageKeyDetector"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Base64HighEntropyString",
|
| 15 |
+
"limit": 4.5
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"name": "BasicAuthDetector"
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"name": "CloudantDetector"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "DiscordBotTokenDetector"
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"name": "GitHubTokenDetector"
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"name": "GitLabTokenDetector"
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"name": "HexHighEntropyString",
|
| 34 |
+
"limit": 3.0
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"name": "IbmCloudIamDetector"
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"name": "IbmCosHmacDetector"
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"name": "IPPublicDetector"
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"name": "JwtTokenDetector"
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"name": "KeywordDetector",
|
| 50 |
+
"keyword_exclude": ""
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"name": "MailchimpDetector"
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"name": "NpmDetector"
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"name": "OpenAIDetector"
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"name": "PrivateKeyDetector"
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"name": "PypiTokenDetector"
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"name": "SendGridDetector"
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"name": "SlackDetector"
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"name": "SoftlayerDetector"
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"name": "SquareOAuthDetector"
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"name": "StripeDetector"
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"name": "TelegramBotTokenDetector"
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"name": "TwilioKeyDetector"
|
| 87 |
+
}
|
| 88 |
+
],
|
| 89 |
+
"filters_used": [
|
| 90 |
+
{
|
| 91 |
+
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
|
| 95 |
+
"min_level": 2
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"path": "detect_secrets.filters.heuristic.is_lock_file"
|
| 105 |
+
},
|
| 106 |
+
{
|
| 107 |
+
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"path": "detect_secrets.filters.heuristic.is_sequential_string"
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"path": "detect_secrets.filters.heuristic.is_swagger_file"
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"path": "detect_secrets.filters.heuristic.is_templated_secret"
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"path": "detect_secrets.filters.regex.should_exclude_file",
|
| 126 |
+
"pattern": [
|
| 127 |
+
".*\\.specify.*"
|
| 128 |
+
]
|
| 129 |
+
}
|
| 130 |
+
],
|
| 131 |
+
"results": {},
|
| 132 |
+
"generated_at": "2026-06-29T05:21:35Z"
|
| 133 |
+
}
|
.specify/extensions.yml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
installed:
|
| 2 |
+
- agent-context
|
| 3 |
+
settings:
|
| 4 |
+
auto_execute_hooks: true
|
| 5 |
+
hooks:
|
| 6 |
+
after_specify:
|
| 7 |
+
- extension: agent-context
|
| 8 |
+
command: speckit.agent-context.update
|
| 9 |
+
enabled: true
|
| 10 |
+
optional: true
|
| 11 |
+
priority: 10
|
| 12 |
+
prompt: Execute speckit.agent-context.update?
|
| 13 |
+
description: Refresh agent context after specification
|
| 14 |
+
condition: null
|
| 15 |
+
after_plan:
|
| 16 |
+
- extension: agent-context
|
| 17 |
+
command: speckit.agent-context.update
|
| 18 |
+
enabled: true
|
| 19 |
+
optional: true
|
| 20 |
+
priority: 10
|
| 21 |
+
prompt: Execute speckit.agent-context.update?
|
| 22 |
+
description: Refresh agent context after planning
|
| 23 |
+
condition: null
|
.specify/extensions/.registry
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "1.0",
|
| 3 |
+
"extensions": {
|
| 4 |
+
"agent-context": {
|
| 5 |
+
"version": "1.0.0",
|
| 6 |
+
"source": "local",
|
| 7 |
+
"manifest_hash": "sha256:9a1dc02d2d0139bb03860392ecacef79183be2c442feda2f9ccaa4e5907b1e47",
|
| 8 |
+
"enabled": true,
|
| 9 |
+
"priority": 10,
|
| 10 |
+
"registered_commands": {
|
| 11 |
+
"gemini": [
|
| 12 |
+
"speckit.agent-context.update"
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
"registered_skills": [],
|
| 16 |
+
"installed_at": "2026-06-28T05:08:07.194388+00:00"
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
}
|
.specify/extensions/agent-context/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Coding Agent Context Extension
|
| 2 |
+
|
| 3 |
+
This bundled extension manages the **coding agent context/instruction file** (e.g. `CLAUDE.md`, `.github/copilot-instructions.md`, `AGENTS.md`, `GEMINI.md`, …) for the active integration.
|
| 4 |
+
|
| 5 |
+
It owns the lifecycle of the managed section delimited by the configurable start/end markers (defaults: `<!-- SPECKIT START -->` / `<!-- SPECKIT END -->`).
|
| 6 |
+
|
| 7 |
+
## Why an extension?
|
| 8 |
+
|
| 9 |
+
Not every Spec Kit user wants Spec Kit to write into the coding agent's context file. Extracting this behavior into a dedicated extension lets users:
|
| 10 |
+
|
| 11 |
+
- **Opt out** entirely with `specify extension disable agent-context` — Spec Kit will then never create or modify the agent context file.
|
| 12 |
+
- **Customize the markers** by editing `.specify/extensions/agent-context/agent-context-config.yml` — both the Python layer and the bundled scripts honor the same `context_markers` value.
|
| 13 |
+
- **Synchronize multiple agent anchors** by setting `context_files` when a project intentionally uses more than one coding agent context file, such as `AGENTS.md` and `CLAUDE.md`.
|
| 14 |
+
- **Refresh on demand** with `/speckit.agent-context.update`, or automatically through the hooks declared in `extension.yml` (`after_specify`, `after_plan`).
|
| 15 |
+
|
| 16 |
+
## Commands
|
| 17 |
+
|
| 18 |
+
| Command | Description |
|
| 19 |
+
|---------|-------------|
|
| 20 |
+
| `speckit.agent-context.update` | Refresh the managed section in the agent context file with the current plan path. |
|
| 21 |
+
|
| 22 |
+
## Configuration
|
| 23 |
+
|
| 24 |
+
All configuration flows through the extension's own config file at
|
| 25 |
+
`.specify/extensions/agent-context/agent-context-config.yml`:
|
| 26 |
+
|
| 27 |
+
```yaml
|
| 28 |
+
# Path to the coding agent context file managed by this extension
|
| 29 |
+
context_file: CLAUDE.md
|
| 30 |
+
|
| 31 |
+
# Optional list of coding agent context files to manage together.
|
| 32 |
+
# When non-empty, this takes precedence over context_file.
|
| 33 |
+
context_files:
|
| 34 |
+
- AGENTS.md
|
| 35 |
+
- CLAUDE.md
|
| 36 |
+
|
| 37 |
+
# Delimiters for the managed Spec Kit section
|
| 38 |
+
context_markers:
|
| 39 |
+
start: "<!-- SPECKIT START -->"
|
| 40 |
+
end: "<!-- SPECKIT END -->"
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
- `context_file` — the project-relative path to the coding agent context file, written by `specify init` and `specify integration install`.
|
| 44 |
+
- `context_files` — optional project-relative paths to multiple coding agent context files. When non-empty, the list takes precedence over `context_file`. Absolute paths, backslash separators, and `..` path segments are rejected.
|
| 45 |
+
- `context_markers.start` / `.end` — the delimiters around the managed section. Edit these to use custom markers.
|
| 46 |
+
|
| 47 |
+
## Requirements
|
| 48 |
+
|
| 49 |
+
The bundled update scripts require **Python 3** with **PyYAML** for YAML/upsert processing (PowerShell can also use `ConvertFrom-Yaml` when available).
|
| 50 |
+
|
| 51 |
+
PyYAML ships with the `specify` CLI and is normally available via the same `python3` interpreter. If a hook reports *"PyYAML is required … not available in the current Python environment"*, it means the system `python3` differs from the one used to install Spec Kit. To resolve, run:
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
pip install pyyaml
|
| 55 |
+
# or target the specific interpreter Spec Kit uses:
|
| 56 |
+
/path/to/speckit-python -m pip install pyyaml
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Disable
|
| 60 |
+
|
| 61 |
+
```bash
|
| 62 |
+
specify extension disable agent-context
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
When disabled, Spec Kit skips context file creation, updates, and removal (the gates are inside `upsert_context_section()` and `remove_context_section()`).
|
| 66 |
+
Disabled projects also ignore stale `context_files` values during command rendering so disabling the extension remains a complete opt-out.
|
.specify/extensions/agent-context/agent-context-config.yml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
context_file: GEMINI.md
|
| 2 |
+
context_files: []
|
| 3 |
+
context_markers:
|
| 4 |
+
start: <!-- SPECKIT START -->
|
| 5 |
+
end: <!-- SPECKIT END -->
|
.specify/extensions/agent-context/commands/speckit.agent-context.update.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: "Refresh the managed Spec Kit section in coding agent context file(s)"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Update Coding Agent Context
|
| 6 |
+
|
| 7 |
+
Refresh the managed Spec Kit section inside the active coding agent's context/instruction file (e.g. `CLAUDE.md`, `.github/copilot-instructions.md`, `AGENTS.md`).
|
| 8 |
+
|
| 9 |
+
## Behavior
|
| 10 |
+
|
| 11 |
+
The script reads the agent-context extension config at
|
| 12 |
+
`.specify/extensions/agent-context/agent-context-config.yml` to discover:
|
| 13 |
+
|
| 14 |
+
- `context_file` — the path of the coding agent context file to manage.
|
| 15 |
+
- `context_files` — optional project-relative paths for multiple coding agent context files. When non-empty, the script updates each listed file and the list takes precedence over `context_file`.
|
| 16 |
+
- `context_markers.start` / `.end` — the delimiters surrounding the managed section. Defaults to `<!-- SPECKIT START -->` and `<!-- SPECKIT END -->` when the field is missing.
|
| 17 |
+
|
| 18 |
+
It then creates, replaces, or appends the managed block so that the section points at the most recent plan path when one can be discovered (`specs/<feature>/plan.md`).
|
| 19 |
+
|
| 20 |
+
If `context_files` and `context_file` are empty, the command reports nothing to do and exits successfully. Context file paths must stay project-relative; absolute paths, Windows drive paths, backslash separators, and `..` path segments are rejected.
|
| 21 |
+
|
| 22 |
+
## Execution
|
| 23 |
+
|
| 24 |
+
- **Bash**: `.specify/extensions/agent-context/scripts/bash/update-agent-context.sh [plan_path]`
|
| 25 |
+
- **PowerShell**: `.specify/extensions/agent-context/scripts/powershell/update-agent-context.ps1 [plan_path]`
|
| 26 |
+
|
| 27 |
+
When `plan_path` is omitted, the script auto-detects the most recently modified `specs/*/plan.md`.
|
.specify/extensions/agent-context/extension.yml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version: "1.0"
|
| 2 |
+
|
| 3 |
+
extension:
|
| 4 |
+
id: agent-context
|
| 5 |
+
name: "Coding Agent Context"
|
| 6 |
+
version: "1.0.0"
|
| 7 |
+
description: "Manages coding agent context/instruction files (e.g., CLAUDE.md, copilot-instructions.md) with project-specific plan references and configurable markers"
|
| 8 |
+
author: spec-kit-core
|
| 9 |
+
repository: https://github.com/github/spec-kit
|
| 10 |
+
license: MIT
|
| 11 |
+
|
| 12 |
+
requires:
|
| 13 |
+
speckit_version: ">=0.2.0"
|
| 14 |
+
|
| 15 |
+
provides:
|
| 16 |
+
commands:
|
| 17 |
+
- name: speckit.agent-context.update
|
| 18 |
+
file: commands/speckit.agent-context.update.md
|
| 19 |
+
description: "Refresh the managed Spec Kit section in the coding agent context file"
|
| 20 |
+
|
| 21 |
+
hooks:
|
| 22 |
+
after_specify:
|
| 23 |
+
command: speckit.agent-context.update
|
| 24 |
+
optional: true
|
| 25 |
+
description: "Refresh agent context after specification"
|
| 26 |
+
after_plan:
|
| 27 |
+
command: speckit.agent-context.update
|
| 28 |
+
optional: true
|
| 29 |
+
description: "Refresh agent context after planning"
|
| 30 |
+
|
| 31 |
+
tags:
|
| 32 |
+
- "agent"
|
| 33 |
+
- "context"
|
| 34 |
+
- "core"
|
.specify/extensions/agent-context/scripts/bash/update-agent-context.sh
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# update-agent-context.sh
|
| 3 |
+
#
|
| 4 |
+
# Refresh the managed Spec Kit section in the coding agent's context file(s)
|
| 5 |
+
# (e.g. CLAUDE.md, .github/copilot-instructions.md, AGENTS.md).
|
| 6 |
+
#
|
| 7 |
+
# Reads `context_files` or `context_file`, plus `context_markers.{start,end}`, from the
|
| 8 |
+
# agent-context extension config:
|
| 9 |
+
# .specify/extensions/agent-context/agent-context-config.yml
|
| 10 |
+
#
|
| 11 |
+
# Usage: update-agent-context.sh [plan_path]
|
| 12 |
+
#
|
| 13 |
+
# When `plan_path` is omitted, the script derives it from `.specify/feature.json`
|
| 14 |
+
# (written by /speckit-specify). Falls back to the most recently modified
|
| 15 |
+
# `specs/*/plan.md` only when feature.json is absent or its plan does not exist yet.
|
| 16 |
+
|
| 17 |
+
set -euo pipefail
|
| 18 |
+
|
| 19 |
+
PROJECT_ROOT="$(pwd)"
|
| 20 |
+
EXT_CONFIG="$PROJECT_ROOT/.specify/extensions/agent-context/agent-context-config.yml"
|
| 21 |
+
DEFAULT_START="<!-- SPECKIT START -->"
|
| 22 |
+
DEFAULT_END="<!-- SPECKIT END -->"
|
| 23 |
+
|
| 24 |
+
if [[ ! -f "$EXT_CONFIG" ]]; then
|
| 25 |
+
echo "agent-context: $EXT_CONFIG not found; nothing to do." >&2
|
| 26 |
+
exit 0
|
| 27 |
+
fi
|
| 28 |
+
|
| 29 |
+
# Locate a Python 3 interpreter with PyYAML available.
|
| 30 |
+
_python=""
|
| 31 |
+
_python_candidates=()
|
| 32 |
+
[[ -n "${SPECKIT_PYTHON:-}" ]] && _python_candidates+=("$SPECKIT_PYTHON")
|
| 33 |
+
_python_candidates+=("python3" "python")
|
| 34 |
+
for _candidate in "${_python_candidates[@]}"; do
|
| 35 |
+
if command -v "$_candidate" >/dev/null 2>&1 \
|
| 36 |
+
&& "$_candidate" - <<'PY' >/dev/null 2>&1
|
| 37 |
+
import sys
|
| 38 |
+
try:
|
| 39 |
+
import yaml # noqa: F401
|
| 40 |
+
except ImportError:
|
| 41 |
+
sys.exit(1)
|
| 42 |
+
sys.exit(0 if sys.version_info[0] == 3 else 1)
|
| 43 |
+
PY
|
| 44 |
+
then
|
| 45 |
+
_python="$_candidate"
|
| 46 |
+
break
|
| 47 |
+
fi
|
| 48 |
+
done
|
| 49 |
+
unset _candidate _python_candidates
|
| 50 |
+
|
| 51 |
+
if [[ -z "$_python" ]]; then
|
| 52 |
+
echo "agent-context: Python 3 with PyYAML not found on PATH; skipping update." >&2
|
| 53 |
+
echo " To resolve: pip install pyyaml (or install it into the environment used by python3)." >&2
|
| 54 |
+
exit 0
|
| 55 |
+
fi
|
| 56 |
+
_case_insensitive_context_files=0
|
| 57 |
+
case "$(uname -s 2>/dev/null || true)" in
|
| 58 |
+
MINGW*|MSYS*|CYGWIN*) _case_insensitive_context_files=1 ;;
|
| 59 |
+
esac
|
| 60 |
+
|
| 61 |
+
# Parse extension config once; emit context files as JSON, followed by marker strings.
|
| 62 |
+
if ! _raw_opts="$("$_python" - "$EXT_CONFIG" "$_case_insensitive_context_files" <<'PY'
|
| 63 |
+
import json
|
| 64 |
+
import sys
|
| 65 |
+
try:
|
| 66 |
+
import yaml
|
| 67 |
+
except ImportError:
|
| 68 |
+
print(
|
| 69 |
+
"agent-context: PyYAML is required to parse extension config but is not available "
|
| 70 |
+
"in the current Python environment.\n"
|
| 71 |
+
" To resolve: pip install pyyaml (or install it into the environment used by python3).\n"
|
| 72 |
+
" Context file will not be updated until PyYAML is importable.",
|
| 73 |
+
file=sys.stderr,
|
| 74 |
+
)
|
| 75 |
+
sys.exit(2)
|
| 76 |
+
try:
|
| 77 |
+
with open(sys.argv[1], "r", encoding="utf-8") as fh:
|
| 78 |
+
data = yaml.safe_load(fh)
|
| 79 |
+
except Exception as exc:
|
| 80 |
+
print(
|
| 81 |
+
f"agent-context: unable to parse {sys.argv[1]} ({exc}); cannot update context.",
|
| 82 |
+
file=sys.stderr,
|
| 83 |
+
)
|
| 84 |
+
sys.exit(2)
|
| 85 |
+
if not isinstance(data, dict):
|
| 86 |
+
data = {}
|
| 87 |
+
def get_str(obj, *keys):
|
| 88 |
+
node = obj
|
| 89 |
+
for k in keys:
|
| 90 |
+
if isinstance(node, dict) and k in node:
|
| 91 |
+
node = node[k]
|
| 92 |
+
else:
|
| 93 |
+
return ""
|
| 94 |
+
return node if isinstance(node, str) else ""
|
| 95 |
+
context_files = []
|
| 96 |
+
seen_context_files = set()
|
| 97 |
+
case_insensitive = sys.argv[2] == "1" or sys.platform.startswith(("win32", "cygwin"))
|
| 98 |
+
raw_files = data.get("context_files")
|
| 99 |
+
if isinstance(raw_files, list):
|
| 100 |
+
for value in raw_files:
|
| 101 |
+
if not isinstance(value, str):
|
| 102 |
+
continue
|
| 103 |
+
candidate = value.strip()
|
| 104 |
+
if not candidate:
|
| 105 |
+
continue
|
| 106 |
+
key = candidate.casefold() if case_insensitive else candidate
|
| 107 |
+
if key in seen_context_files:
|
| 108 |
+
continue
|
| 109 |
+
context_files.append(candidate)
|
| 110 |
+
seen_context_files.add(key)
|
| 111 |
+
if not context_files:
|
| 112 |
+
raw_file = get_str(data, "context_file")
|
| 113 |
+
candidate = raw_file.strip()
|
| 114 |
+
if candidate:
|
| 115 |
+
context_files.append(candidate)
|
| 116 |
+
print(json.dumps(context_files))
|
| 117 |
+
print(get_str(data, "context_markers", "start"))
|
| 118 |
+
print(get_str(data, "context_markers", "end"))
|
| 119 |
+
PY
|
| 120 |
+
)"; then
|
| 121 |
+
echo "agent-context: skipping update (see above for details)." >&2
|
| 122 |
+
exit 0
|
| 123 |
+
fi
|
| 124 |
+
|
| 125 |
+
_opts_lines=()
|
| 126 |
+
while IFS= read -r _line || [[ -n "$_line" ]]; do
|
| 127 |
+
_opts_lines+=("$_line")
|
| 128 |
+
done < <(printf '%s\n' "$_raw_opts")
|
| 129 |
+
if (( ${#_opts_lines[@]} < 3 )); then
|
| 130 |
+
echo "agent-context: malformed config parser output; expected 3 lines (context_files, marker_start, marker_end), got ${#_opts_lines[@]}; skipping update." >&2
|
| 131 |
+
exit 0
|
| 132 |
+
fi
|
| 133 |
+
CONTEXT_FILES_JSON="${_opts_lines[0]}"
|
| 134 |
+
MARKER_START="${_opts_lines[1]}"
|
| 135 |
+
MARKER_END="${_opts_lines[2]}"
|
| 136 |
+
|
| 137 |
+
if ! _context_files_raw="$("$_python" - "$CONTEXT_FILES_JSON" <<'PY'
|
| 138 |
+
import json
|
| 139 |
+
import sys
|
| 140 |
+
try:
|
| 141 |
+
data = json.loads(sys.argv[1])
|
| 142 |
+
except Exception:
|
| 143 |
+
data = []
|
| 144 |
+
if not isinstance(data, list):
|
| 145 |
+
data = []
|
| 146 |
+
for value in data:
|
| 147 |
+
if isinstance(value, str) and value:
|
| 148 |
+
print(value)
|
| 149 |
+
PY
|
| 150 |
+
)"; then
|
| 151 |
+
echo "agent-context: malformed context_files parser output; skipping update." >&2
|
| 152 |
+
exit 0
|
| 153 |
+
fi
|
| 154 |
+
|
| 155 |
+
CONTEXT_FILES=()
|
| 156 |
+
while IFS= read -r _line || [[ -n "$_line" ]]; do
|
| 157 |
+
[[ -n "$_line" ]] && CONTEXT_FILES+=("$_line")
|
| 158 |
+
done < <(printf '%s\n' "$_context_files_raw")
|
| 159 |
+
|
| 160 |
+
if (( ${#CONTEXT_FILES[@]} == 0 )); then
|
| 161 |
+
echo "agent-context: context_files/context_file not set in extension config; nothing to do." >&2
|
| 162 |
+
exit 0
|
| 163 |
+
fi
|
| 164 |
+
|
| 165 |
+
for CONTEXT_FILE in "${CONTEXT_FILES[@]}"; do
|
| 166 |
+
# Reject absolute paths, backslash separators, and '..' path segments in context files
|
| 167 |
+
if [[ "$CONTEXT_FILE" == /* ]] || [[ "$CONTEXT_FILE" =~ ^[A-Za-z]: ]]; then
|
| 168 |
+
echo "agent-context: context files must be project-relative paths; got '$CONTEXT_FILE'." >&2
|
| 169 |
+
exit 1
|
| 170 |
+
fi
|
| 171 |
+
if [[ "$CONTEXT_FILE" == *\\* ]]; then
|
| 172 |
+
echo "agent-context: context files must not contain backslash separators; got '$CONTEXT_FILE'." >&2
|
| 173 |
+
exit 1
|
| 174 |
+
fi
|
| 175 |
+
IFS='/' read -ra _cf_parts <<< "$CONTEXT_FILE"
|
| 176 |
+
for _seg in "${_cf_parts[@]}"; do
|
| 177 |
+
if [[ "$_seg" == ".." ]]; then
|
| 178 |
+
echo "agent-context: context files must not contain '..' path segments; got '$CONTEXT_FILE'." >&2
|
| 179 |
+
exit 1
|
| 180 |
+
fi
|
| 181 |
+
done
|
| 182 |
+
if ! "$_python" - "$PROJECT_ROOT" "$CONTEXT_FILE" <<'PY'
|
| 183 |
+
import sys
|
| 184 |
+
from pathlib import Path
|
| 185 |
+
|
| 186 |
+
root = Path(sys.argv[1]).resolve()
|
| 187 |
+
target = (root / sys.argv[2]).resolve(strict=False)
|
| 188 |
+
try:
|
| 189 |
+
target.relative_to(root)
|
| 190 |
+
except ValueError:
|
| 191 |
+
sys.exit(1)
|
| 192 |
+
PY
|
| 193 |
+
then
|
| 194 |
+
echo "agent-context: context file path resolves outside the project root; got '$CONTEXT_FILE'." >&2
|
| 195 |
+
exit 1
|
| 196 |
+
fi
|
| 197 |
+
done
|
| 198 |
+
unset _cf_parts _seg
|
| 199 |
+
|
| 200 |
+
[[ -z "$MARKER_START" ]] && MARKER_START="$DEFAULT_START"
|
| 201 |
+
[[ -z "$MARKER_END" ]] && MARKER_END="$DEFAULT_END"
|
| 202 |
+
|
| 203 |
+
PLAN_PATH="${1:-}"
|
| 204 |
+
if [[ -z "$PLAN_PATH" ]]; then
|
| 205 |
+
# Prefer .specify/feature.json (written by /speckit-specify) over mtime heuristic.
|
| 206 |
+
_feature_json="$PROJECT_ROOT/.specify/feature.json"
|
| 207 |
+
if [[ -f "$_feature_json" ]]; then
|
| 208 |
+
_feature_dir="$("$_python" - "$_feature_json" <<'PY'
|
| 209 |
+
import sys, json
|
| 210 |
+
try:
|
| 211 |
+
with open(sys.argv[1], encoding="utf-8") as fh:
|
| 212 |
+
d = json.load(fh)
|
| 213 |
+
val = d.get("feature_directory", "")
|
| 214 |
+
print(val if isinstance(val, str) else "")
|
| 215 |
+
except Exception:
|
| 216 |
+
print("")
|
| 217 |
+
PY
|
| 218 |
+
)"
|
| 219 |
+
# Normalize backslashes (written by PS on Windows) to forward slashes before path ops.
|
| 220 |
+
_feature_dir="$(printf '%s' "$_feature_dir" | tr '\\' '/')"
|
| 221 |
+
_feature_dir="${_feature_dir%/}"
|
| 222 |
+
if [[ -n "$_feature_dir" ]]; then
|
| 223 |
+
# feature_directory may be relative or absolute (absolute paths outside PROJECT_ROOT
|
| 224 |
+
# are preserved as-is by _persist_feature_json in common.sh).
|
| 225 |
+
# Also match drive-qualified paths (C:/...) written by PowerShell on Windows.
|
| 226 |
+
if [[ "$_feature_dir" == /* ]] || [[ "$_feature_dir" =~ ^[A-Za-z]:/ ]]; then
|
| 227 |
+
_candidate="$_feature_dir/plan.md"
|
| 228 |
+
else
|
| 229 |
+
_candidate="$PROJECT_ROOT/$_feature_dir/plan.md"
|
| 230 |
+
fi
|
| 231 |
+
if [[ -f "$_candidate" ]]; then
|
| 232 |
+
# Resolve symlinks before comparing so paths like /var/… vs /private/var/…
|
| 233 |
+
# (macOS) are treated as equivalent. Mirrors the mtime-fallback approach.
|
| 234 |
+
PLAN_PATH="$("$_python" - "$PROJECT_ROOT" "$_candidate" <<'PY'
|
| 235 |
+
import sys
|
| 236 |
+
from pathlib import Path
|
| 237 |
+
root = Path(sys.argv[1]).resolve()
|
| 238 |
+
cand = Path(sys.argv[2]).resolve()
|
| 239 |
+
try:
|
| 240 |
+
print(cand.relative_to(root).as_posix())
|
| 241 |
+
except ValueError:
|
| 242 |
+
# Outside project root: emit the resolved path in POSIX form.
|
| 243 |
+
# as_posix() converts backslashes correctly on native Windows Python.
|
| 244 |
+
print(cand.as_posix())
|
| 245 |
+
PY
|
| 246 |
+
)"
|
| 247 |
+
fi
|
| 248 |
+
fi
|
| 249 |
+
fi
|
| 250 |
+
|
| 251 |
+
# Fall back to mtime only when feature.json is absent or its plan does not exist yet.
|
| 252 |
+
# Python emits a project-relative POSIX path directly to avoid bash prefix-strip
|
| 253 |
+
# issues with backslash paths on Windows (Git bash / MSYS2).
|
| 254 |
+
if [[ -z "$PLAN_PATH" ]]; then
|
| 255 |
+
_plan_rel="$("$_python" - "$PROJECT_ROOT" <<'PY'
|
| 256 |
+
import sys
|
| 257 |
+
from pathlib import Path
|
| 258 |
+
root = Path(sys.argv[1]).resolve()
|
| 259 |
+
specs = root / "specs"
|
| 260 |
+
plans = sorted(
|
| 261 |
+
specs.glob("*/plan.md"),
|
| 262 |
+
key=lambda p: p.stat().st_mtime,
|
| 263 |
+
reverse=True,
|
| 264 |
+
)
|
| 265 |
+
if plans:
|
| 266 |
+
try:
|
| 267 |
+
print(plans[0].relative_to(root).as_posix())
|
| 268 |
+
except ValueError:
|
| 269 |
+
print("")
|
| 270 |
+
else:
|
| 271 |
+
print("")
|
| 272 |
+
PY
|
| 273 |
+
)"
|
| 274 |
+
if [[ -n "$_plan_rel" ]]; then
|
| 275 |
+
PLAN_PATH="$_plan_rel"
|
| 276 |
+
fi
|
| 277 |
+
fi
|
| 278 |
+
fi
|
| 279 |
+
|
| 280 |
+
# Build the managed section
|
| 281 |
+
TMP_SECTION="$(mktemp)"
|
| 282 |
+
trap 'rm -f "$TMP_SECTION"' EXIT
|
| 283 |
+
{
|
| 284 |
+
echo "$MARKER_START"
|
| 285 |
+
echo "For additional context about technologies to be used, project structure,"
|
| 286 |
+
echo "shell commands, and other important information, read the current plan"
|
| 287 |
+
if [[ -n "$PLAN_PATH" ]]; then
|
| 288 |
+
echo "at $PLAN_PATH"
|
| 289 |
+
fi
|
| 290 |
+
echo "$MARKER_END"
|
| 291 |
+
} > "$TMP_SECTION"
|
| 292 |
+
|
| 293 |
+
for CONTEXT_FILE in "${CONTEXT_FILES[@]}"; do
|
| 294 |
+
CTX_PATH="$PROJECT_ROOT/$CONTEXT_FILE"
|
| 295 |
+
mkdir -p "$(dirname "$CTX_PATH")"
|
| 296 |
+
|
| 297 |
+
"$_python" - "$CTX_PATH" "$MARKER_START" "$MARKER_END" "$TMP_SECTION" <<'PY'
|
| 298 |
+
import sys, os
|
| 299 |
+
ctx_path, start, end, section_path = sys.argv[1:5]
|
| 300 |
+
with open(section_path, "r", encoding="utf-8") as fh:
|
| 301 |
+
section = fh.read().rstrip("\n") + "\n"
|
| 302 |
+
|
| 303 |
+
if os.path.exists(ctx_path):
|
| 304 |
+
with open(ctx_path, "r", encoding="utf-8-sig") as fh:
|
| 305 |
+
content = fh.read()
|
| 306 |
+
s = content.find(start)
|
| 307 |
+
e = content.find(end, s if s != -1 else 0)
|
| 308 |
+
if s != -1 and e != -1 and e > s:
|
| 309 |
+
end_of_marker = e + len(end)
|
| 310 |
+
if end_of_marker < len(content) and content[end_of_marker] == "\r":
|
| 311 |
+
end_of_marker += 1
|
| 312 |
+
if end_of_marker < len(content) and content[end_of_marker] == "\n":
|
| 313 |
+
end_of_marker += 1
|
| 314 |
+
new_content = content[:s] + section + content[end_of_marker:]
|
| 315 |
+
elif s != -1:
|
| 316 |
+
new_content = content[:s] + section
|
| 317 |
+
elif e != -1:
|
| 318 |
+
end_of_marker = e + len(end)
|
| 319 |
+
if end_of_marker < len(content) and content[end_of_marker] == "\r":
|
| 320 |
+
end_of_marker += 1
|
| 321 |
+
if end_of_marker < len(content) and content[end_of_marker] == "\n":
|
| 322 |
+
end_of_marker += 1
|
| 323 |
+
new_content = section + content[end_of_marker:]
|
| 324 |
+
else:
|
| 325 |
+
if content and not content.endswith("\n"):
|
| 326 |
+
content += "\n"
|
| 327 |
+
new_content = (content + "\n" + section) if content else section
|
| 328 |
+
else:
|
| 329 |
+
new_content = section
|
| 330 |
+
|
| 331 |
+
new_content = new_content.replace("\r\n", "\n").replace("\r", "\n")
|
| 332 |
+
with open(ctx_path, "wb") as fh:
|
| 333 |
+
fh.write(new_content.encode("utf-8"))
|
| 334 |
+
PY
|
| 335 |
+
|
| 336 |
+
echo "agent-context: updated $CONTEXT_FILE"
|
| 337 |
+
done
|
.specify/extensions/agent-context/scripts/powershell/update-agent-context.ps1
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# update-agent-context.ps1
|
| 3 |
+
#
|
| 4 |
+
# Refresh the managed Spec Kit section in the coding agent's context file(s)
|
| 5 |
+
# (e.g. CLAUDE.md, .github/copilot-instructions.md, AGENTS.md).
|
| 6 |
+
#
|
| 7 |
+
# Reads `context_files` or `context_file`, plus `context_markers.{start,end}`, from the
|
| 8 |
+
# agent-context extension config:
|
| 9 |
+
# .specify/extensions/agent-context/agent-context-config.yml
|
| 10 |
+
#
|
| 11 |
+
# Usage: update-agent-context.ps1 [plan_path]
|
| 12 |
+
#
|
| 13 |
+
# When `plan_path` is omitted, the script derives it from `.specify/feature.json`
|
| 14 |
+
# (written by /speckit-specify). Falls back to the most recently modified
|
| 15 |
+
# `specs/*/plan.md` only when feature.json is absent or its plan does not exist yet.
|
| 16 |
+
|
| 17 |
+
[CmdletBinding()]
|
| 18 |
+
param(
|
| 19 |
+
[Parameter(Position = 0)]
|
| 20 |
+
[string]$PlanPath
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
function Get-ConfigValue {
|
| 24 |
+
param(
|
| 25 |
+
[AllowNull()][object]$Object,
|
| 26 |
+
[Parameter(Mandatory = $true)][string]$Key
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
if ($null -eq $Object) {
|
| 30 |
+
return $null
|
| 31 |
+
}
|
| 32 |
+
if ($Object -is [System.Collections.IDictionary]) {
|
| 33 |
+
return $Object[$Key]
|
| 34 |
+
}
|
| 35 |
+
$prop = $Object.PSObject.Properties[$Key]
|
| 36 |
+
if ($prop) {
|
| 37 |
+
return $prop.Value
|
| 38 |
+
}
|
| 39 |
+
return $null
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
function Test-ConfigObject {
|
| 43 |
+
param(
|
| 44 |
+
[AllowNull()][object]$Object
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
if ($null -eq $Object) {
|
| 48 |
+
return $false
|
| 49 |
+
}
|
| 50 |
+
if ($Object -is [System.Collections.IDictionary]) {
|
| 51 |
+
return $true
|
| 52 |
+
}
|
| 53 |
+
if ($Object -is [System.Management.Automation.PSCustomObject]) {
|
| 54 |
+
return $true
|
| 55 |
+
}
|
| 56 |
+
return $false
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
function Resolve-ContextPath {
|
| 60 |
+
param(
|
| 61 |
+
[Parameter(Mandatory = $true)][string]$Root,
|
| 62 |
+
[Parameter(Mandatory = $true)][string]$RelativePath
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
$rootFull = [System.IO.Path]::GetFullPath($Root)
|
| 66 |
+
$segments = $RelativePath -split '/'
|
| 67 |
+
$resolved = $rootFull
|
| 68 |
+
|
| 69 |
+
foreach ($segment in $segments) {
|
| 70 |
+
if ([string]::IsNullOrWhiteSpace($segment) -or $segment -eq '.') {
|
| 71 |
+
continue
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
$candidate = [System.IO.Path]::GetFullPath((Join-Path $resolved $segment))
|
| 75 |
+
if (Test-Path -LiteralPath $candidate) {
|
| 76 |
+
$item = Get-Item -LiteralPath $candidate -Force
|
| 77 |
+
if ($item.Attributes -band [System.IO.FileAttributes]::ReparsePoint) {
|
| 78 |
+
$target = $item.Target
|
| 79 |
+
if ($target -is [System.Array]) {
|
| 80 |
+
$target = $target[0]
|
| 81 |
+
}
|
| 82 |
+
if ($target) {
|
| 83 |
+
if ([System.IO.Path]::IsPathRooted($target)) {
|
| 84 |
+
$candidate = [System.IO.Path]::GetFullPath($target)
|
| 85 |
+
} else {
|
| 86 |
+
$candidate = [System.IO.Path]::GetFullPath(
|
| 87 |
+
(Join-Path (Split-Path -Parent $candidate) $target)
|
| 88 |
+
)
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
$resolved = $candidate
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
return $resolved
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
function Test-IsSubPath {
|
| 100 |
+
param(
|
| 101 |
+
[Parameter(Mandatory = $true)][string]$Root,
|
| 102 |
+
[Parameter(Mandatory = $true)][string]$Path
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
$comparison = if ([System.Environment]::OSVersion.Platform -eq [System.PlatformID]::Win32NT) {
|
| 106 |
+
[System.StringComparison]::OrdinalIgnoreCase
|
| 107 |
+
} else {
|
| 108 |
+
[System.StringComparison]::Ordinal
|
| 109 |
+
}
|
| 110 |
+
$rootFull = [System.IO.Path]::GetFullPath($Root).TrimEnd(
|
| 111 |
+
[System.IO.Path]::DirectorySeparatorChar,
|
| 112 |
+
[System.IO.Path]::AltDirectorySeparatorChar
|
| 113 |
+
)
|
| 114 |
+
$pathFull = [System.IO.Path]::GetFullPath($Path)
|
| 115 |
+
return $pathFull.Equals($rootFull, $comparison) -or
|
| 116 |
+
$pathFull.StartsWith($rootFull + [System.IO.Path]::DirectorySeparatorChar, $comparison)
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
$ErrorActionPreference = 'Stop'
|
| 120 |
+
$DefaultStart = '<!-- SPECKIT START -->'
|
| 121 |
+
$DefaultEnd = '<!-- SPECKIT END -->'
|
| 122 |
+
$ProjectRoot = (Get-Location).Path
|
| 123 |
+
$ExtConfig = Join-Path $ProjectRoot '.specify/extensions/agent-context/agent-context-config.yml'
|
| 124 |
+
|
| 125 |
+
if (-not (Test-Path -LiteralPath $ExtConfig)) {
|
| 126 |
+
Write-Warning "agent-context: $ExtConfig not found; nothing to do."
|
| 127 |
+
exit 0
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
$Options = $null
|
| 131 |
+
if (Get-Command ConvertFrom-Yaml -ErrorAction SilentlyContinue) {
|
| 132 |
+
try {
|
| 133 |
+
$Options = Get-Content -LiteralPath $ExtConfig -Raw -Encoding UTF8 | ConvertFrom-Yaml -ErrorAction Stop
|
| 134 |
+
} catch {
|
| 135 |
+
# fall through to ConvertFrom-Json fallback
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
if ($null -eq $Options) {
|
| 140 |
+
# ConvertFrom-Yaml unavailable or failed; try ConvertFrom-Json (no external deps,
|
| 141 |
+
# works when the config file is valid JSON, which is a subset of YAML).
|
| 142 |
+
try {
|
| 143 |
+
$raw = Get-Content -LiteralPath $ExtConfig -Raw -Encoding UTF8
|
| 144 |
+
$Options = $raw | ConvertFrom-Json -ErrorAction Stop
|
| 145 |
+
if (-not (Test-ConfigObject -Object $Options)) { $Options = $null }
|
| 146 |
+
} catch {
|
| 147 |
+
$Options = $null
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
if ($null -eq $Options) {
|
| 152 |
+
# ConvertFrom-Yaml/Json unavailable or failed; fall back to Python+PyYAML.
|
| 153 |
+
$pythonCmd = $null
|
| 154 |
+
$pythonCandidates = @()
|
| 155 |
+
if ($env:SPECKIT_PYTHON) {
|
| 156 |
+
$pythonCandidates += $env:SPECKIT_PYTHON
|
| 157 |
+
}
|
| 158 |
+
$pythonCandidates += @('python3', 'python')
|
| 159 |
+
foreach ($candidate in $pythonCandidates) {
|
| 160 |
+
if (Get-Command $candidate -ErrorAction SilentlyContinue) {
|
| 161 |
+
# Verify it is Python 3 with PyYAML available.
|
| 162 |
+
$null = & $candidate -c "import sys; import yaml; sys.exit(0 if sys.version_info[0] == 3 else 1)" 2>$null
|
| 163 |
+
if ($LASTEXITCODE -eq 0) {
|
| 164 |
+
$pythonCmd = $candidate
|
| 165 |
+
break
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
if ($pythonCmd) {
|
| 171 |
+
$pyScript = $null
|
| 172 |
+
try {
|
| 173 |
+
$pyScript = [System.IO.Path]::GetTempFileName()
|
| 174 |
+
Set-Content -LiteralPath $pyScript -Encoding UTF8 -Value @'
|
| 175 |
+
import json
|
| 176 |
+
import sys
|
| 177 |
+
try:
|
| 178 |
+
import yaml
|
| 179 |
+
except ImportError:
|
| 180 |
+
print(
|
| 181 |
+
"agent-context: PyYAML is required to parse extension config; cannot update context.",
|
| 182 |
+
file=sys.stderr,
|
| 183 |
+
)
|
| 184 |
+
sys.exit(2)
|
| 185 |
+
|
| 186 |
+
try:
|
| 187 |
+
with open(sys.argv[1], "r", encoding="utf-8") as fh:
|
| 188 |
+
data = yaml.safe_load(fh)
|
| 189 |
+
except Exception as exc:
|
| 190 |
+
print(
|
| 191 |
+
f"agent-context: unable to parse {sys.argv[1]} ({exc}); cannot update context.",
|
| 192 |
+
file=sys.stderr,
|
| 193 |
+
)
|
| 194 |
+
sys.exit(2)
|
| 195 |
+
|
| 196 |
+
if not isinstance(data, dict):
|
| 197 |
+
data = {}
|
| 198 |
+
|
| 199 |
+
print(json.dumps(data))
|
| 200 |
+
'@
|
| 201 |
+
$jsonOut = & $pythonCmd $pyScript $ExtConfig
|
| 202 |
+
if ($LASTEXITCODE -eq 0 -and $jsonOut) {
|
| 203 |
+
$Options = $jsonOut | ConvertFrom-Json -ErrorAction Stop
|
| 204 |
+
}
|
| 205 |
+
} catch {
|
| 206 |
+
$Options = $null
|
| 207 |
+
} finally {
|
| 208 |
+
if ($pyScript -and (Test-Path -LiteralPath $pyScript)) {
|
| 209 |
+
Remove-Item -LiteralPath $pyScript -Force -ErrorAction SilentlyContinue
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
if (-not $Options) {
|
| 215 |
+
Write-Warning "agent-context: unable to parse $ExtConfig; skipping update."
|
| 216 |
+
exit 0
|
| 217 |
+
}
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
if (-not (Test-ConfigObject -Object $Options)) {
|
| 221 |
+
Write-Warning "agent-context: $ExtConfig must contain a YAML mapping; skipping update."
|
| 222 |
+
exit 0
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
$ConfiguredContextFiles = Get-ConfigValue -Object $Options -Key 'context_files'
|
| 226 |
+
$ContextFiles = @()
|
| 227 |
+
if ($null -ne $ConfiguredContextFiles) {
|
| 228 |
+
foreach ($item in @($ConfiguredContextFiles)) {
|
| 229 |
+
if ($item -is [string] -and -not [string]::IsNullOrWhiteSpace($item)) {
|
| 230 |
+
$ContextFiles += $item.Trim()
|
| 231 |
+
}
|
| 232 |
+
}
|
| 233 |
+
}
|
| 234 |
+
if ($ContextFiles.Count -eq 0) {
|
| 235 |
+
$ContextFile = Get-ConfigValue -Object $Options -Key 'context_file'
|
| 236 |
+
if ($ContextFile -is [string] -and -not [string]::IsNullOrWhiteSpace($ContextFile)) {
|
| 237 |
+
$ContextFiles += $ContextFile.Trim()
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
$pathComparison = if ([System.Environment]::OSVersion.Platform -eq [System.PlatformID]::Win32NT) {
|
| 241 |
+
[System.StringComparer]::OrdinalIgnoreCase
|
| 242 |
+
} else {
|
| 243 |
+
[System.StringComparer]::Ordinal
|
| 244 |
+
}
|
| 245 |
+
$seenContextFiles = [System.Collections.Generic.HashSet[string]]::new($pathComparison)
|
| 246 |
+
$dedupedContextFiles = @()
|
| 247 |
+
foreach ($ContextFile in $ContextFiles) {
|
| 248 |
+
if ($seenContextFiles.Add($ContextFile)) {
|
| 249 |
+
$dedupedContextFiles += $ContextFile
|
| 250 |
+
}
|
| 251 |
+
}
|
| 252 |
+
$ContextFiles = $dedupedContextFiles
|
| 253 |
+
if ($ContextFiles.Count -eq 0) {
|
| 254 |
+
Write-Warning 'agent-context: context_files/context_file not set in extension config; nothing to do.'
|
| 255 |
+
exit 0
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
foreach ($ContextFile in $ContextFiles) {
|
| 259 |
+
# Reject absolute paths, drive-qualified paths, backslash separators, and '..' path segments in context files
|
| 260 |
+
if ($ContextFile -match '^[A-Za-z]:') {
|
| 261 |
+
Write-Warning "agent-context: context files must be project-relative paths; got '$ContextFile'."
|
| 262 |
+
exit 1
|
| 263 |
+
}
|
| 264 |
+
if ([System.IO.Path]::IsPathRooted($ContextFile)) {
|
| 265 |
+
Write-Warning "agent-context: context files must be project-relative paths; got '$ContextFile'."
|
| 266 |
+
exit 1
|
| 267 |
+
}
|
| 268 |
+
if ($ContextFile.Contains('\')) {
|
| 269 |
+
Write-Warning "agent-context: context files must not contain backslash separators; got '$ContextFile'."
|
| 270 |
+
exit 1
|
| 271 |
+
}
|
| 272 |
+
$cfSegments = $ContextFile -split '[/\\]'
|
| 273 |
+
if ($cfSegments -contains '..') {
|
| 274 |
+
Write-Warning "agent-context: context files must not contain '..' path segments; got '$ContextFile'."
|
| 275 |
+
exit 1
|
| 276 |
+
}
|
| 277 |
+
$resolvedTarget = Resolve-ContextPath -Root $ProjectRoot -RelativePath $ContextFile
|
| 278 |
+
if (-not (Test-IsSubPath -Root $ProjectRoot -Path $resolvedTarget)) {
|
| 279 |
+
Write-Warning "agent-context: context file path resolves outside the project root; got '$ContextFile'."
|
| 280 |
+
exit 1
|
| 281 |
+
}
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
$MarkerStart = $DefaultStart
|
| 285 |
+
$MarkerEnd = $DefaultEnd
|
| 286 |
+
$cm = Get-ConfigValue -Object $Options -Key 'context_markers'
|
| 287 |
+
if ($cm) {
|
| 288 |
+
$cmStart = Get-ConfigValue -Object $cm -Key 'start'
|
| 289 |
+
if ($cmStart -is [string] -and $cmStart) {
|
| 290 |
+
$MarkerStart = $cmStart
|
| 291 |
+
}
|
| 292 |
+
$cmEnd = Get-ConfigValue -Object $cm -Key 'end'
|
| 293 |
+
if ($cmEnd -is [string] -and $cmEnd) {
|
| 294 |
+
$MarkerEnd = $cmEnd
|
| 295 |
+
}
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
if (-not $PlanPath) {
|
| 299 |
+
# Prefer .specify/feature.json (written by /speckit-specify) over mtime heuristic.
|
| 300 |
+
$FeatureJson = Join-Path $ProjectRoot '.specify/feature.json'
|
| 301 |
+
if (Test-Path -LiteralPath $FeatureJson) {
|
| 302 |
+
try {
|
| 303 |
+
$fj = Get-Content -LiteralPath $FeatureJson -Raw -Encoding UTF8 | ConvertFrom-Json
|
| 304 |
+
$featureDir = $fj.feature_directory
|
| 305 |
+
if ($featureDir -isnot [string] -or -not $featureDir) {
|
| 306 |
+
$featureDir = $null
|
| 307 |
+
} else {
|
| 308 |
+
$featureDir = $featureDir.TrimEnd('\', '/')
|
| 309 |
+
}
|
| 310 |
+
if ($featureDir) {
|
| 311 |
+
# Join-Path on Unix does not treat absolute ChildPath as "wins"; check explicitly.
|
| 312 |
+
if ([System.IO.Path]::IsPathRooted($featureDir)) {
|
| 313 |
+
$candidatePlan = Join-Path $featureDir 'plan.md'
|
| 314 |
+
} else {
|
| 315 |
+
$candidatePlan = Join-Path (Join-Path $ProjectRoot $featureDir) 'plan.md'
|
| 316 |
+
}
|
| 317 |
+
if (Test-Path -LiteralPath $candidatePlan) {
|
| 318 |
+
# Resolve ./ .. segments before relativizing (mirrors bash Path.resolve()).
|
| 319 |
+
# GetFullPath is available in .NET Framework 4.x (PS 5.1 compatible).
|
| 320 |
+
$resolvedPlan = [System.IO.Path]::GetFullPath($candidatePlan)
|
| 321 |
+
$resolvedDir = [System.IO.Path]::GetDirectoryName($resolvedPlan)
|
| 322 |
+
$normRoot = $ProjectRoot.TrimEnd('\', '/') + [System.IO.Path]::DirectorySeparatorChar
|
| 323 |
+
$normDir = $resolvedDir.TrimEnd('\', '/') + [System.IO.Path]::DirectorySeparatorChar
|
| 324 |
+
$cmp = if ([System.Environment]::OSVersion.Platform -eq [System.PlatformID]::Win32NT) { [System.StringComparison]::OrdinalIgnoreCase } else { [System.StringComparison]::Ordinal }
|
| 325 |
+
if ($normDir.StartsWith($normRoot, $cmp)) {
|
| 326 |
+
$relDir = $normDir.Substring($normRoot.Length).TrimEnd('\', '/')
|
| 327 |
+
$PlanPath = if ($relDir) { $relDir.Replace('\', '/') + '/plan.md' } else { 'plan.md' }
|
| 328 |
+
} else {
|
| 329 |
+
$PlanPath = $resolvedPlan.Replace('\', '/')
|
| 330 |
+
}
|
| 331 |
+
}
|
| 332 |
+
}
|
| 333 |
+
} catch {
|
| 334 |
+
# Non-fatal: fall through to mtime heuristic.
|
| 335 |
+
}
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
# Fall back to mtime only when feature.json is absent or its plan does not exist yet.
|
| 339 |
+
if (-not $PlanPath) {
|
| 340 |
+
try {
|
| 341 |
+
$specsDir = Join-Path $ProjectRoot 'specs'
|
| 342 |
+
$candidate = Get-ChildItem -Path $specsDir -Directory -ErrorAction SilentlyContinue |
|
| 343 |
+
ForEach-Object { Get-Item -LiteralPath (Join-Path $_.FullName 'plan.md') -ErrorAction SilentlyContinue } |
|
| 344 |
+
Where-Object { $_ } |
|
| 345 |
+
Sort-Object LastWriteTime -Descending |
|
| 346 |
+
Select-Object -First 1
|
| 347 |
+
if ($candidate) {
|
| 348 |
+
# GetRelativePath is .NET 5+ only; strip prefix manually for PS 5.1 compat.
|
| 349 |
+
# Use case-insensitive comparison on Windows only (matches common.ps1 pattern).
|
| 350 |
+
$fullPath = $candidate.FullName.Replace('\', '/')
|
| 351 |
+
$normRoot = $ProjectRoot.Replace('\', '/').TrimEnd('/') + '/'
|
| 352 |
+
$cmp = if ([System.Environment]::OSVersion.Platform -eq [System.PlatformID]::Win32NT) { [System.StringComparison]::OrdinalIgnoreCase } else { [System.StringComparison]::Ordinal }
|
| 353 |
+
if ($fullPath.StartsWith($normRoot, $cmp)) {
|
| 354 |
+
$PlanPath = $fullPath.Substring($normRoot.Length)
|
| 355 |
+
} else {
|
| 356 |
+
$PlanPath = $fullPath
|
| 357 |
+
}
|
| 358 |
+
}
|
| 359 |
+
} catch {
|
| 360 |
+
# Non-fatal: continue without a plan path.
|
| 361 |
+
}
|
| 362 |
+
}
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
$lines = @($MarkerStart,
|
| 366 |
+
'For additional context about technologies to be used, project structure,',
|
| 367 |
+
'shell commands, and other important information, read the current plan')
|
| 368 |
+
if ($PlanPath) {
|
| 369 |
+
$lines += "at $PlanPath"
|
| 370 |
+
}
|
| 371 |
+
$lines += $MarkerEnd
|
| 372 |
+
$Section = ($lines -join "`n") + "`n"
|
| 373 |
+
|
| 374 |
+
foreach ($ContextFile in $ContextFiles) {
|
| 375 |
+
$CtxPath = Join-Path $ProjectRoot $ContextFile
|
| 376 |
+
$CtxDir = Split-Path -Parent $CtxPath
|
| 377 |
+
if ($CtxDir -and -not (Test-Path -LiteralPath $CtxDir)) {
|
| 378 |
+
New-Item -ItemType Directory -Path $CtxDir -Force | Out-Null
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
if (Test-Path -LiteralPath $CtxPath) {
|
| 382 |
+
$rawBytes = [System.IO.File]::ReadAllBytes($CtxPath)
|
| 383 |
+
# Strip UTF-8 BOM if present
|
| 384 |
+
if ($rawBytes.Length -ge 3 -and $rawBytes[0] -eq 0xEF -and $rawBytes[1] -eq 0xBB -and $rawBytes[2] -eq 0xBF) {
|
| 385 |
+
$content = [System.Text.Encoding]::UTF8.GetString($rawBytes, 3, $rawBytes.Length - 3)
|
| 386 |
+
} else {
|
| 387 |
+
$content = [System.Text.Encoding]::UTF8.GetString($rawBytes)
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
$s = $content.IndexOf($MarkerStart)
|
| 391 |
+
$e = if ($s -ge 0) { $content.IndexOf($MarkerEnd, $s) } else { $content.IndexOf($MarkerEnd) }
|
| 392 |
+
|
| 393 |
+
if ($s -ge 0 -and $e -ge 0 -and $e -gt $s) {
|
| 394 |
+
$endOfMarker = $e + $MarkerEnd.Length
|
| 395 |
+
if ($endOfMarker -lt $content.Length -and $content[$endOfMarker] -eq "`r") { $endOfMarker++ }
|
| 396 |
+
if ($endOfMarker -lt $content.Length -and $content[$endOfMarker] -eq "`n") { $endOfMarker++ }
|
| 397 |
+
$newContent = $content.Substring(0, $s) + $Section + $content.Substring($endOfMarker)
|
| 398 |
+
} elseif ($s -ge 0) {
|
| 399 |
+
$newContent = $content.Substring(0, $s) + $Section
|
| 400 |
+
} elseif ($e -ge 0) {
|
| 401 |
+
$endOfMarker = $e + $MarkerEnd.Length
|
| 402 |
+
if ($endOfMarker -lt $content.Length -and $content[$endOfMarker] -eq "`r") { $endOfMarker++ }
|
| 403 |
+
if ($endOfMarker -lt $content.Length -and $content[$endOfMarker] -eq "`n") { $endOfMarker++ }
|
| 404 |
+
$newContent = $Section + $content.Substring($endOfMarker)
|
| 405 |
+
} else {
|
| 406 |
+
if ($content -and -not $content.EndsWith("`n")) { $content += "`n" }
|
| 407 |
+
if ($content) { $newContent = $content + "`n" + $Section } else { $newContent = $Section }
|
| 408 |
+
}
|
| 409 |
+
} else {
|
| 410 |
+
$newContent = $Section
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
$newContent = $newContent.Replace("`r`n", "`n").Replace("`r", "`n")
|
| 414 |
+
[System.IO.File]::WriteAllText($CtxPath, $newContent, (New-Object System.Text.UTF8Encoding($false)))
|
| 415 |
+
|
| 416 |
+
Write-Host "agent-context: updated $ContextFile"
|
| 417 |
+
}
|
.specify/init-options.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"ai": "gemini",
|
| 3 |
+
"feature_numbering": "sequential",
|
| 4 |
+
"here": true,
|
| 5 |
+
"integration": "gemini",
|
| 6 |
+
"script": "ps",
|
| 7 |
+
"speckit_version": "0.11.10.dev0"
|
| 8 |
+
}
|
.specify/integration.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "0.11.10.dev0",
|
| 3 |
+
"integration_state_schema": 1,
|
| 4 |
+
"installed_integrations": [
|
| 5 |
+
"gemini"
|
| 6 |
+
],
|
| 7 |
+
"integration_settings": {
|
| 8 |
+
"gemini": {
|
| 9 |
+
"script": "ps",
|
| 10 |
+
"invoke_separator": "."
|
| 11 |
+
}
|
| 12 |
+
},
|
| 13 |
+
"integration": "gemini",
|
| 14 |
+
"default_integration": "gemini"
|
| 15 |
+
}
|
.specify/integrations/gemini.manifest.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"integration": "gemini",
|
| 3 |
+
"version": "0.11.10.dev0",
|
| 4 |
+
"installed_at": "2026-06-28T05:08:06.890411+00:00",
|
| 5 |
+
"files": {
|
| 6 |
+
".gemini/commands/speckit.analyze.toml": "5a71ea858ae5da4acf079c5c784956a81e5a099ee13ce046c876419f65781318",
|
| 7 |
+
".gemini/commands/speckit.clarify.toml": "634b14a574f95c1a74e1a87fb78c9945f9594f39c2943127dc7166e6c9c3e9f7",
|
| 8 |
+
".gemini/commands/speckit.constitution.toml": "cc89aba5152587f31b2265877fd26a5f7a65530daabffecc8c3c4300d651302d",
|
| 9 |
+
".gemini/commands/speckit.implement.toml": "ceb2295956488406c1d56bc67d1a70babaec50487ce429380803f86db75df980",
|
| 10 |
+
".gemini/commands/speckit.converge.toml": "af2e4e136c4da12f3feb7f5fa2369ef41dfb8f01fc56b76f9651be109e175cab",
|
| 11 |
+
".gemini/commands/speckit.plan.toml": "a39d4d1c69602efb8cee61d71f357b488db0040e7d1435238c445a80cd4be6d9",
|
| 12 |
+
".gemini/commands/speckit.checklist.toml": "931452fb9cf8e062e65c24db573f24e6cc7a94514c6dd6bdd925cd33db500716",
|
| 13 |
+
".gemini/commands/speckit.specify.toml": "d248a1ae8a15dad4c1fcaf068cb279c4153a42f5777f4ea6488faa2c5792663f",
|
| 14 |
+
".gemini/commands/speckit.tasks.toml": "122f933bc123db453eab5ea0cf895fd0559f6683448bcee58bbd7dc85141bc47",
|
| 15 |
+
".gemini/commands/speckit.taskstoissues.toml": "663d5924ae589b94a4a45bdf96890e2b33894a5a78b8df2490ff93423584c43e"
|
| 16 |
+
}
|
| 17 |
+
}
|
.specify/integrations/speckit.manifest.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"integration": "speckit",
|
| 3 |
+
"version": "0.11.10.dev0",
|
| 4 |
+
"installed_at": "2026-06-28T05:08:07.012295+00:00",
|
| 5 |
+
"files": {
|
| 6 |
+
".specify/scripts/powershell/check-prerequisites.ps1": "957da74697b721b716fe40c064509ff614a6a3802b095ee1cc0c75070ca5b2dd",
|
| 7 |
+
".specify/scripts/powershell/common.ps1": "24b5c490efb01f364971b3aac6618873fb56352de2b58815c95bc8e855afab1e",
|
| 8 |
+
".specify/scripts/powershell/create-new-feature.ps1": "ae82eae16f18a77e82a413826e98b9e8aa97a518fc73aa4386df5179d53466a8",
|
| 9 |
+
".specify/scripts/powershell/setup-plan.ps1": "d55b161c13b1a83d10035d2601255698aed6c3a629a44bf0bfa3299c7b42729d",
|
| 10 |
+
".specify/scripts/powershell/setup-tasks.ps1": "c704de13a9ddca10365e91a5d748c77f06354b4cda6c7020577fda5c51561eb6",
|
| 11 |
+
".specify/templates/checklist-template.md": "312eee8291dfa984b21f95ddd0ca778e7a1f0b3a64bfc470d79762a3e3f5d7b8",
|
| 12 |
+
".specify/templates/constitution-template.md": "ce7549540fa45543cca797a150201d868e64495fdff39dc38246fb17bd4024b3",
|
| 13 |
+
".specify/templates/plan-template.md": "3fdc12da2eb157def636948c157bfb638b265e70b2e3246a0e09c8d5db710e91",
|
| 14 |
+
".specify/templates/spec-template.md": "3945437fc35cd30a5b2bf7beea680337c3516826d3efa5a6b92c4a7eca1ba28e",
|
| 15 |
+
".specify/templates/tasks-template.md": "c731575d8099b3f871861186fbd1a592b51b2ba57fb99e1a0dab439ff6d5608f"
|
| 16 |
+
}
|
| 17 |
+
}
|
.specify/memory/constitution.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# [PROJECT_NAME] Constitution
|
| 2 |
+
<!-- Example: Spec Constitution, TaskFlow Constitution, etc. -->
|
| 3 |
+
|
| 4 |
+
## Core Principles
|
| 5 |
+
|
| 6 |
+
### [PRINCIPLE_1_NAME]
|
| 7 |
+
<!-- Example: I. Library-First -->
|
| 8 |
+
[PRINCIPLE_1_DESCRIPTION]
|
| 9 |
+
<!-- Example: Every feature starts as a standalone library; Libraries must be self-contained, independently testable, documented; Clear purpose required - no organizational-only libraries -->
|
| 10 |
+
|
| 11 |
+
### [PRINCIPLE_2_NAME]
|
| 12 |
+
<!-- Example: II. CLI Interface -->
|
| 13 |
+
[PRINCIPLE_2_DESCRIPTION]
|
| 14 |
+
<!-- Example: Every library exposes functionality via CLI; Text in/out protocol: stdin/args → stdout, errors → stderr; Support JSON + human-readable formats -->
|
| 15 |
+
|
| 16 |
+
### [PRINCIPLE_3_NAME]
|
| 17 |
+
<!-- Example: III. Test-First (NON-NEGOTIABLE) -->
|
| 18 |
+
[PRINCIPLE_3_DESCRIPTION]
|
| 19 |
+
<!-- Example: TDD mandatory: Tests written → User approved → Tests fail → Then implement; Red-Green-Refactor cycle strictly enforced -->
|
| 20 |
+
|
| 21 |
+
### [PRINCIPLE_4_NAME]
|
| 22 |
+
<!-- Example: IV. Integration Testing -->
|
| 23 |
+
[PRINCIPLE_4_DESCRIPTION]
|
| 24 |
+
<!-- Example: Focus areas requiring integration tests: New library contract tests, Contract changes, Inter-service communication, Shared schemas -->
|
| 25 |
+
|
| 26 |
+
### [PRINCIPLE_5_NAME]
|
| 27 |
+
<!-- Example: V. Observability, VI. Versioning & Breaking Changes, VII. Simplicity -->
|
| 28 |
+
[PRINCIPLE_5_DESCRIPTION]
|
| 29 |
+
<!-- Example: Text I/O ensures debuggability; Structured logging required; Or: MAJOR.MINOR.BUILD format; Or: Start simple, YAGNI principles -->
|
| 30 |
+
|
| 31 |
+
## [SECTION_2_NAME]
|
| 32 |
+
<!-- Example: Additional Constraints, Security Requirements, Performance Standards, etc. -->
|
| 33 |
+
|
| 34 |
+
[SECTION_2_CONTENT]
|
| 35 |
+
<!-- Example: Technology stack requirements, compliance standards, deployment policies, etc. -->
|
| 36 |
+
|
| 37 |
+
## [SECTION_3_NAME]
|
| 38 |
+
<!-- Example: Development Workflow, Review Process, Quality Gates, etc. -->
|
| 39 |
+
|
| 40 |
+
[SECTION_3_CONTENT]
|
| 41 |
+
<!-- Example: Code review requirements, testing gates, deployment approval process, etc. -->
|
| 42 |
+
|
| 43 |
+
## Governance
|
| 44 |
+
<!-- Example: Constitution supersedes all other practices; Amendments require documentation, approval, migration plan -->
|
| 45 |
+
|
| 46 |
+
[GOVERNANCE_RULES]
|
| 47 |
+
<!-- Example: All PRs/reviews must verify compliance; Complexity must be justified; Use [GUIDANCE_FILE] for runtime development guidance -->
|
| 48 |
+
|
| 49 |
+
**Version**: [CONSTITUTION_VERSION] | **Ratified**: [RATIFICATION_DATE] | **Last Amended**: [LAST_AMENDED_DATE]
|
| 50 |
+
<!-- Example: Version: 2.1.1 | Ratified: 2025-06-13 | Last Amended: 2025-07-16 -->
|
.specify/scripts/powershell/check-prerequisites.ps1
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
|
| 3 |
+
# Consolidated prerequisite checking script (PowerShell)
|
| 4 |
+
#
|
| 5 |
+
# This script provides unified prerequisite checking for Spec-Driven Development workflow.
|
| 6 |
+
# It replaces the functionality previously spread across multiple scripts.
|
| 7 |
+
#
|
| 8 |
+
# Usage: ./check-prerequisites.ps1 [OPTIONS]
|
| 9 |
+
#
|
| 10 |
+
# OPTIONS:
|
| 11 |
+
# -Json Output in JSON format
|
| 12 |
+
# -RequireTasks Require tasks.md to exist (for implementation phase)
|
| 13 |
+
# -IncludeTasks Include tasks.md in AVAILABLE_DOCS list
|
| 14 |
+
# -PathsOnly Only output path variables (no validation)
|
| 15 |
+
# -Help, -h Show help message
|
| 16 |
+
|
| 17 |
+
[CmdletBinding()]
|
| 18 |
+
param(
|
| 19 |
+
[switch]$Json,
|
| 20 |
+
[switch]$RequireTasks,
|
| 21 |
+
[switch]$IncludeTasks,
|
| 22 |
+
[switch]$PathsOnly,
|
| 23 |
+
[switch]$Help
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
$ErrorActionPreference = 'Stop'
|
| 27 |
+
|
| 28 |
+
# Show help if requested
|
| 29 |
+
if ($Help) {
|
| 30 |
+
Write-Output @"
|
| 31 |
+
Usage: check-prerequisites.ps1 [OPTIONS]
|
| 32 |
+
|
| 33 |
+
Consolidated prerequisite checking for Spec-Driven Development workflow.
|
| 34 |
+
|
| 35 |
+
OPTIONS:
|
| 36 |
+
-Json Output in JSON format
|
| 37 |
+
-RequireTasks Require tasks.md to exist (for implementation phase)
|
| 38 |
+
-IncludeTasks Include tasks.md in AVAILABLE_DOCS list
|
| 39 |
+
-PathsOnly Only output path variables (no prerequisite validation)
|
| 40 |
+
-Help, -h Show this help message
|
| 41 |
+
|
| 42 |
+
EXAMPLES:
|
| 43 |
+
# Check task prerequisites (plan.md required)
|
| 44 |
+
.\check-prerequisites.ps1 -Json
|
| 45 |
+
|
| 46 |
+
# Check implementation prerequisites (plan.md + tasks.md required)
|
| 47 |
+
.\check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks
|
| 48 |
+
|
| 49 |
+
# Get feature paths only (no validation)
|
| 50 |
+
.\check-prerequisites.ps1 -PathsOnly
|
| 51 |
+
|
| 52 |
+
"@
|
| 53 |
+
exit 0
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
# Source common functions
|
| 57 |
+
. "$PSScriptRoot/common.ps1"
|
| 58 |
+
|
| 59 |
+
# Get feature paths
|
| 60 |
+
$paths = Get-FeaturePathsEnv
|
| 61 |
+
|
| 62 |
+
# If paths-only mode, output paths and exit (no validation)
|
| 63 |
+
if ($PathsOnly) {
|
| 64 |
+
if ($Json) {
|
| 65 |
+
[PSCustomObject]@{
|
| 66 |
+
REPO_ROOT = $paths.REPO_ROOT
|
| 67 |
+
BRANCH = $paths.CURRENT_BRANCH
|
| 68 |
+
FEATURE_DIR = $paths.FEATURE_DIR
|
| 69 |
+
FEATURE_SPEC = $paths.FEATURE_SPEC
|
| 70 |
+
IMPL_PLAN = $paths.IMPL_PLAN
|
| 71 |
+
TASKS = $paths.TASKS
|
| 72 |
+
} | ConvertTo-Json -Compress
|
| 73 |
+
} else {
|
| 74 |
+
Write-Output "REPO_ROOT: $($paths.REPO_ROOT)"
|
| 75 |
+
Write-Output "BRANCH: $($paths.CURRENT_BRANCH)"
|
| 76 |
+
Write-Output "FEATURE_DIR: $($paths.FEATURE_DIR)"
|
| 77 |
+
Write-Output "FEATURE_SPEC: $($paths.FEATURE_SPEC)"
|
| 78 |
+
Write-Output "IMPL_PLAN: $($paths.IMPL_PLAN)"
|
| 79 |
+
Write-Output "TASKS: $($paths.TASKS)"
|
| 80 |
+
}
|
| 81 |
+
exit 0
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
# Validate required directories and files
|
| 85 |
+
if (-not (Test-Path $paths.FEATURE_DIR -PathType Container)) {
|
| 86 |
+
[Console]::Error.WriteLine("ERROR: Feature directory not found: $($paths.FEATURE_DIR)")
|
| 87 |
+
$specifyCommand = '/speckit.specify'
|
| 88 |
+
[Console]::Error.WriteLine("Run $specifyCommand first to create the feature structure.")
|
| 89 |
+
exit 1
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
if (-not (Test-Path $paths.IMPL_PLAN -PathType Leaf)) {
|
| 93 |
+
[Console]::Error.WriteLine("ERROR: plan.md not found in $($paths.FEATURE_DIR)")
|
| 94 |
+
$planCommand = '/speckit.plan'
|
| 95 |
+
[Console]::Error.WriteLine("Run $planCommand first to create the implementation plan.")
|
| 96 |
+
exit 1
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
# Check for tasks.md if required
|
| 100 |
+
if ($RequireTasks -and -not (Test-Path $paths.TASKS -PathType Leaf)) {
|
| 101 |
+
[Console]::Error.WriteLine("ERROR: tasks.md not found in $($paths.FEATURE_DIR)")
|
| 102 |
+
$tasksCommand = '/speckit.tasks'
|
| 103 |
+
[Console]::Error.WriteLine("Run $tasksCommand first to create the task list.")
|
| 104 |
+
exit 1
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
# Build list of available documents
|
| 108 |
+
$docs = @()
|
| 109 |
+
|
| 110 |
+
# Always check these optional docs
|
| 111 |
+
if (Test-Path $paths.RESEARCH) { $docs += 'research.md' }
|
| 112 |
+
if (Test-Path $paths.DATA_MODEL) { $docs += 'data-model.md' }
|
| 113 |
+
|
| 114 |
+
# Check contracts directory (only if it exists and has files)
|
| 115 |
+
if ((Test-Path $paths.CONTRACTS_DIR) -and (Get-ChildItem -Path $paths.CONTRACTS_DIR -ErrorAction SilentlyContinue | Select-Object -First 1)) {
|
| 116 |
+
$docs += 'contracts/'
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
if (Test-Path $paths.QUICKSTART) { $docs += 'quickstart.md' }
|
| 120 |
+
|
| 121 |
+
# Include tasks.md if requested and it exists
|
| 122 |
+
if ($IncludeTasks -and (Test-Path $paths.TASKS)) {
|
| 123 |
+
$docs += 'tasks.md'
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
# Output results
|
| 127 |
+
if ($Json) {
|
| 128 |
+
# JSON output
|
| 129 |
+
[PSCustomObject]@{
|
| 130 |
+
FEATURE_DIR = $paths.FEATURE_DIR
|
| 131 |
+
AVAILABLE_DOCS = $docs
|
| 132 |
+
} | ConvertTo-Json -Compress
|
| 133 |
+
} else {
|
| 134 |
+
# Text output
|
| 135 |
+
Write-Output "FEATURE_DIR:$($paths.FEATURE_DIR)"
|
| 136 |
+
Write-Output "AVAILABLE_DOCS:"
|
| 137 |
+
|
| 138 |
+
# Show status of each potential document
|
| 139 |
+
Test-FileExists -Path $paths.RESEARCH -Description 'research.md' | Out-Null
|
| 140 |
+
Test-FileExists -Path $paths.DATA_MODEL -Description 'data-model.md' | Out-Null
|
| 141 |
+
Test-DirHasFiles -Path $paths.CONTRACTS_DIR -Description 'contracts/' | Out-Null
|
| 142 |
+
Test-FileExists -Path $paths.QUICKSTART -Description 'quickstart.md' | Out-Null
|
| 143 |
+
|
| 144 |
+
if ($IncludeTasks) {
|
| 145 |
+
Test-FileExists -Path $paths.TASKS -Description 'tasks.md' | Out-Null
|
| 146 |
+
}
|
| 147 |
+
}
|
.specify/scripts/powershell/common.ps1
ADDED
|
@@ -0,0 +1,558 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# Common PowerShell functions analogous to common.sh
|
| 3 |
+
|
| 4 |
+
# Find repository root by searching upward for .specify directory
|
| 5 |
+
# This is the primary marker for spec-kit projects
|
| 6 |
+
function Find-SpecifyRoot {
|
| 7 |
+
param([string]$StartDir = (Get-Location).Path)
|
| 8 |
+
|
| 9 |
+
# Normalize to absolute path to prevent issues with relative paths
|
| 10 |
+
# Use -LiteralPath to handle paths with wildcard characters ([, ], *, ?)
|
| 11 |
+
$resolved = Resolve-Path -LiteralPath $StartDir -ErrorAction SilentlyContinue
|
| 12 |
+
$current = if ($resolved) { $resolved.Path } else { $null }
|
| 13 |
+
if (-not $current) { return $null }
|
| 14 |
+
|
| 15 |
+
while ($true) {
|
| 16 |
+
if (Test-Path -LiteralPath (Join-Path $current ".specify") -PathType Container) {
|
| 17 |
+
return $current
|
| 18 |
+
}
|
| 19 |
+
$parent = Split-Path $current -Parent
|
| 20 |
+
if ([string]::IsNullOrEmpty($parent) -or $parent -eq $current) {
|
| 21 |
+
return $null
|
| 22 |
+
}
|
| 23 |
+
$current = $parent
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
# Resolve an explicit SPECIFY_INIT_DIR project override (the directory that
|
| 28 |
+
# *contains* .specify/), for non-interactive / CI use -- e.g. running a Spec Kit
|
| 29 |
+
# command against a member project from a monorepo root without cd.
|
| 30 |
+
#
|
| 31 |
+
# Precondition: $env:SPECIFY_INIT_DIR is set. Returns the validated project root,
|
| 32 |
+
# or writes an error and exits 1. Strict by design: the path must exist and
|
| 33 |
+
# contain .specify/, with no silent fallback. (An empty string is falsy, so the
|
| 34 |
+
# caller's `if ($env:SPECIFY_INIT_DIR)` guard treats empty as unset.)
|
| 35 |
+
#
|
| 36 |
+
# This is the single resolver: bundled extensions inherit it by sourcing core
|
| 37 |
+
# (e.g. the git extension's create-new-feature-branch) rather than duplicating it.
|
| 38 |
+
function Resolve-SpecifyInitDir {
|
| 39 |
+
$initDir = $env:SPECIFY_INIT_DIR
|
| 40 |
+
# Normalize: relative paths resolve against the current directory.
|
| 41 |
+
if (-not [System.IO.Path]::IsPathRooted($initDir)) {
|
| 42 |
+
$initDir = Join-Path (Get-Location).Path $initDir
|
| 43 |
+
}
|
| 44 |
+
$resolved = Resolve-Path -LiteralPath $initDir -ErrorAction SilentlyContinue
|
| 45 |
+
# Resolve-Path also succeeds for files, so check the resolved path is a
|
| 46 |
+
# directory; otherwise a file value would slip through to the less accurate
|
| 47 |
+
# "not a Spec Kit project" error below.
|
| 48 |
+
if (-not $resolved -or -not (Test-Path -LiteralPath $resolved.Path -PathType Container)) {
|
| 49 |
+
[Console]::Error.WriteLine("ERROR: SPECIFY_INIT_DIR does not point to an existing directory: $($env:SPECIFY_INIT_DIR)")
|
| 50 |
+
exit 1
|
| 51 |
+
}
|
| 52 |
+
# Resolve-Path echoes back any trailing separator from the input; trim it so
|
| 53 |
+
# the returned root matches the bash resolver, whose `cd && pwd` never yields
|
| 54 |
+
# one. TrimEndingDirectorySeparator is a no-op on a bare root and on a path
|
| 55 |
+
# that already has no trailing separator.
|
| 56 |
+
$initRoot = [System.IO.Path]::TrimEndingDirectorySeparator($resolved.Path)
|
| 57 |
+
if (-not (Test-Path -LiteralPath (Join-Path $initRoot '.specify') -PathType Container)) {
|
| 58 |
+
[Console]::Error.WriteLine("ERROR: SPECIFY_INIT_DIR is not a Spec Kit project (no .specify/ directory): $initRoot")
|
| 59 |
+
exit 1
|
| 60 |
+
}
|
| 61 |
+
return $initRoot
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
# Get repository root, prioritizing .specify directory
|
| 65 |
+
# This prevents using a parent repository when spec-kit is initialized in a subdirectory
|
| 66 |
+
function Get-RepoRoot {
|
| 67 |
+
# Explicit project override wins (see Resolve-SpecifyInitDir).
|
| 68 |
+
if ($env:SPECIFY_INIT_DIR) {
|
| 69 |
+
return (Resolve-SpecifyInitDir)
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
# First, look for .specify directory (spec-kit's own marker)
|
| 73 |
+
$specifyRoot = Find-SpecifyRoot
|
| 74 |
+
if ($specifyRoot) {
|
| 75 |
+
return $specifyRoot
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
# Final fallback to script location
|
| 79 |
+
# Use -LiteralPath to handle paths with wildcard characters
|
| 80 |
+
return (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "../../..")).Path
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
function Get-CurrentBranch {
|
| 84 |
+
# Return feature name from explicit state only.
|
| 85 |
+
# Feature state is set by SPECIFY_FEATURE (from create-new-feature or
|
| 86 |
+
# the git extension) or implicitly via .specify/feature.json.
|
| 87 |
+
if ($env:SPECIFY_FEATURE) {
|
| 88 |
+
return $env:SPECIFY_FEATURE
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
# No explicit feature set - return empty to signal "unknown".
|
| 92 |
+
return ""
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
# Persist a feature_directory value to .specify/feature.json.
|
| 98 |
+
# Writes only when the file is missing or the value differs from what's stored.
|
| 99 |
+
function Save-FeatureJson {
|
| 100 |
+
param(
|
| 101 |
+
[Parameter(Mandatory = $true)][string]$RepoRoot,
|
| 102 |
+
[Parameter(Mandatory = $true)][string]$FeatureDirectory
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
# Strip repo root prefix if the value is absolute and under repo root.
|
| 106 |
+
# Use case-insensitive comparison on Windows only (case-sensitive filesystems elsewhere).
|
| 107 |
+
$prefix = $RepoRoot + [System.IO.Path]::DirectorySeparatorChar
|
| 108 |
+
if ($null -ne $IsWindows) { $onWin = $IsWindows } else { $onWin = $true }
|
| 109 |
+
if ($onWin) {
|
| 110 |
+
$cmp = [System.StringComparison]::OrdinalIgnoreCase
|
| 111 |
+
} else {
|
| 112 |
+
$cmp = [System.StringComparison]::Ordinal
|
| 113 |
+
}
|
| 114 |
+
if ($FeatureDirectory.StartsWith($prefix, $cmp)) {
|
| 115 |
+
$FeatureDirectory = $FeatureDirectory.Substring($prefix.Length)
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
$fjPath = Join-Path (Join-Path $RepoRoot '.specify') 'feature.json'
|
| 119 |
+
|
| 120 |
+
# Read current value and skip write when unchanged
|
| 121 |
+
if (Test-Path -LiteralPath $fjPath -PathType Leaf) {
|
| 122 |
+
try {
|
| 123 |
+
$raw = Get-Content -LiteralPath $fjPath -Raw
|
| 124 |
+
$cfg = $raw | ConvertFrom-Json
|
| 125 |
+
if ($cfg.feature_directory -eq $FeatureDirectory) {
|
| 126 |
+
return
|
| 127 |
+
}
|
| 128 |
+
} catch {
|
| 129 |
+
# File is corrupt or unreadable - overwrite it
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
# Ensure .specify/ directory exists
|
| 134 |
+
$specifyDir = Join-Path $RepoRoot '.specify'
|
| 135 |
+
if (-not (Test-Path -LiteralPath $specifyDir -PathType Container)) {
|
| 136 |
+
New-Item -ItemType Directory -Path $specifyDir -Force | Out-Null
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
# Write feature.json
|
| 140 |
+
$json = @{ feature_directory = $FeatureDirectory } | ConvertTo-Json -Compress
|
| 141 |
+
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
| 142 |
+
[System.IO.File]::WriteAllText($fjPath, $json, $utf8NoBom)
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
function Get-FeaturePathsEnv {
|
| 146 |
+
$repoRoot = Get-RepoRoot
|
| 147 |
+
$currentBranch = Get-CurrentBranch
|
| 148 |
+
|
| 149 |
+
# Resolve feature directory. Priority:
|
| 150 |
+
# 1. SPECIFY_FEATURE_DIRECTORY env var (explicit override)
|
| 151 |
+
# 2. .specify/feature.json "feature_directory" key (persisted by specify command)
|
| 152 |
+
# 3. Error - no feature context available
|
| 153 |
+
$featureJson = Join-Path $repoRoot '.specify/feature.json'
|
| 154 |
+
if ($env:SPECIFY_FEATURE_DIRECTORY) {
|
| 155 |
+
$featureDir = $env:SPECIFY_FEATURE_DIRECTORY
|
| 156 |
+
# Normalize relative paths to absolute under repo root
|
| 157 |
+
if (-not [System.IO.Path]::IsPathRooted($featureDir)) {
|
| 158 |
+
$featureDir = Join-Path $repoRoot $featureDir
|
| 159 |
+
}
|
| 160 |
+
# Persist to feature.json so future sessions without the env var still work
|
| 161 |
+
Save-FeatureJson -RepoRoot $repoRoot -FeatureDirectory $env:SPECIFY_FEATURE_DIRECTORY
|
| 162 |
+
} elseif (Test-Path $featureJson) {
|
| 163 |
+
$featureJsonRaw = Get-Content -LiteralPath $featureJson -Raw
|
| 164 |
+
try {
|
| 165 |
+
$featureConfig = $featureJsonRaw | ConvertFrom-Json
|
| 166 |
+
} catch {
|
| 167 |
+
[Console]::Error.WriteLine("ERROR: Failed to parse .specify/feature.json: $_")
|
| 168 |
+
exit 1
|
| 169 |
+
}
|
| 170 |
+
if ($featureConfig.feature_directory) {
|
| 171 |
+
$featureDir = $featureConfig.feature_directory
|
| 172 |
+
# Normalize relative paths to absolute under repo root
|
| 173 |
+
if (-not [System.IO.Path]::IsPathRooted($featureDir)) {
|
| 174 |
+
$featureDir = Join-Path $repoRoot $featureDir
|
| 175 |
+
}
|
| 176 |
+
} else {
|
| 177 |
+
[Console]::Error.WriteLine("ERROR: Feature directory not found. Set SPECIFY_FEATURE_DIRECTORY or ensure .specify/feature.json contains feature_directory.")
|
| 178 |
+
exit 1
|
| 179 |
+
}
|
| 180 |
+
} else {
|
| 181 |
+
[Console]::Error.WriteLine("ERROR: Feature directory not found. Set SPECIFY_FEATURE_DIRECTORY or run the specify command to create .specify/feature.json.")
|
| 182 |
+
exit 1
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
[PSCustomObject]@{
|
| 186 |
+
REPO_ROOT = $repoRoot
|
| 187 |
+
CURRENT_BRANCH = $currentBranch
|
| 188 |
+
FEATURE_DIR = $featureDir
|
| 189 |
+
FEATURE_SPEC = Join-Path $featureDir 'spec.md'
|
| 190 |
+
IMPL_PLAN = Join-Path $featureDir 'plan.md'
|
| 191 |
+
TASKS = Join-Path $featureDir 'tasks.md'
|
| 192 |
+
RESEARCH = Join-Path $featureDir 'research.md'
|
| 193 |
+
DATA_MODEL = Join-Path $featureDir 'data-model.md'
|
| 194 |
+
QUICKSTART = Join-Path $featureDir 'quickstart.md'
|
| 195 |
+
CONTRACTS_DIR = Join-Path $featureDir 'contracts'
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
function Test-FileExists {
|
| 200 |
+
param([string]$Path, [string]$Description)
|
| 201 |
+
if (Test-Path -Path $Path -PathType Leaf) {
|
| 202 |
+
Write-Output " [OK] $Description"
|
| 203 |
+
return $true
|
| 204 |
+
} else {
|
| 205 |
+
Write-Output " [FAIL] $Description"
|
| 206 |
+
return $false
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
function Test-DirHasFiles {
|
| 211 |
+
param([string]$Path, [string]$Description)
|
| 212 |
+
if ((Test-Path -Path $Path -PathType Container) -and (Get-ChildItem -Path $Path -ErrorAction SilentlyContinue | Where-Object { -not $_.PSIsContainer } | Select-Object -First 1)) {
|
| 213 |
+
Write-Output " [OK] $Description"
|
| 214 |
+
return $true
|
| 215 |
+
} else {
|
| 216 |
+
Write-Output " [FAIL] $Description"
|
| 217 |
+
return $false
|
| 218 |
+
}
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
function Get-InvokeSeparator {
|
| 222 |
+
param([string]$RepoRoot = (Get-RepoRoot))
|
| 223 |
+
|
| 224 |
+
if ($null -eq $script:SpecKitInvokeSeparatorCache) {
|
| 225 |
+
$script:SpecKitInvokeSeparatorCache = @{}
|
| 226 |
+
}
|
| 227 |
+
if ($script:SpecKitInvokeSeparatorCache.ContainsKey($RepoRoot)) {
|
| 228 |
+
return $script:SpecKitInvokeSeparatorCache[$RepoRoot]
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
$separator = '.'
|
| 232 |
+
$integrationJson = Join-Path $RepoRoot '.specify/integration.json'
|
| 233 |
+
if (Test-Path -LiteralPath $integrationJson -PathType Leaf) {
|
| 234 |
+
try {
|
| 235 |
+
$state = Get-Content -LiteralPath $integrationJson -Raw | ConvertFrom-Json
|
| 236 |
+
$key = if ($state.default_integration) { [string]$state.default_integration } elseif ($state.integration) { [string]$state.integration } else { '' }
|
| 237 |
+
if ($key -and $state.integration_settings) {
|
| 238 |
+
$settingProperty = $state.integration_settings.PSObject.Properties[$key]
|
| 239 |
+
if ($settingProperty) {
|
| 240 |
+
$setting = $settingProperty.Value
|
| 241 |
+
if ($setting -and ($setting.invoke_separator -eq '.' -or $setting.invoke_separator -eq '-')) {
|
| 242 |
+
$separator = [string]$setting.invoke_separator
|
| 243 |
+
}
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
} catch {
|
| 247 |
+
$separator = '.'
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
$script:SpecKitInvokeSeparatorCache[$RepoRoot] = $separator
|
| 252 |
+
return $separator
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
function Format-SpecKitCommand {
|
| 256 |
+
param(
|
| 257 |
+
[Parameter(Mandatory = $true)][string]$CommandName,
|
| 258 |
+
[string]$RepoRoot = (Get-RepoRoot)
|
| 259 |
+
)
|
| 260 |
+
|
| 261 |
+
$separator = Get-InvokeSeparator -RepoRoot $RepoRoot
|
| 262 |
+
$name = $CommandName.TrimStart('/')
|
| 263 |
+
if ($name.StartsWith('speckit.')) {
|
| 264 |
+
$name = $name.Substring(8)
|
| 265 |
+
} elseif ($name.StartsWith('speckit-')) {
|
| 266 |
+
$name = $name.Substring(8)
|
| 267 |
+
}
|
| 268 |
+
$name = $name -replace '\.', $separator
|
| 269 |
+
|
| 270 |
+
return "/speckit$separator$name"
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
# Find a usable Python 3 executable (python3, python, or py -3).
|
| 274 |
+
# Returns the command/arguments as an array, or $null if none found.
|
| 275 |
+
function Get-Python3Command {
|
| 276 |
+
if (Get-Command python3 -ErrorAction SilentlyContinue) { return @('python3') }
|
| 277 |
+
if (Get-Command python -ErrorAction SilentlyContinue) {
|
| 278 |
+
$ver = & python --version 2>&1
|
| 279 |
+
if ($ver -match 'Python 3') { return @('python') }
|
| 280 |
+
}
|
| 281 |
+
if (Get-Command py -ErrorAction SilentlyContinue) {
|
| 282 |
+
$ver = & py -3 --version 2>&1
|
| 283 |
+
if ($ver -match 'Python 3') { return @('py', '-3') }
|
| 284 |
+
}
|
| 285 |
+
return $null
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
# Resolve a template name to a file path using the priority stack:
|
| 289 |
+
# 1. .specify/templates/overrides/
|
| 290 |
+
# 2. .specify/presets/<preset-id>/templates/ (sorted by priority from .registry)
|
| 291 |
+
# 3. .specify/extensions/<ext-id>/templates/
|
| 292 |
+
# 4. .specify/templates/ (core)
|
| 293 |
+
function Resolve-Template {
|
| 294 |
+
param(
|
| 295 |
+
[Parameter(Mandatory=$true)][string]$TemplateName,
|
| 296 |
+
[Parameter(Mandatory=$true)][string]$RepoRoot
|
| 297 |
+
)
|
| 298 |
+
|
| 299 |
+
$base = Join-Path $RepoRoot '.specify/templates'
|
| 300 |
+
|
| 301 |
+
# Priority 1: Project overrides
|
| 302 |
+
$override = Join-Path $base "overrides/$TemplateName.md"
|
| 303 |
+
if (Test-Path $override) { return $override }
|
| 304 |
+
|
| 305 |
+
# Priority 2: Installed presets (sorted by priority from .registry)
|
| 306 |
+
$presetsDir = Join-Path $RepoRoot '.specify/presets'
|
| 307 |
+
if (Test-Path $presetsDir) {
|
| 308 |
+
$registryFile = Join-Path $presetsDir '.registry'
|
| 309 |
+
$sortedPresets = @()
|
| 310 |
+
if (Test-Path $registryFile) {
|
| 311 |
+
try {
|
| 312 |
+
$registryData = Get-Content $registryFile -Raw | ConvertFrom-Json
|
| 313 |
+
$presets = $registryData.presets
|
| 314 |
+
if ($presets) {
|
| 315 |
+
$sortedPresets = $presets.PSObject.Properties |
|
| 316 |
+
Where-Object { $null -eq $_.Value.enabled -or $_.Value.enabled -ne $false } |
|
| 317 |
+
Sort-Object { if ($null -ne $_.Value.priority) { $_.Value.priority } else { 10 } } |
|
| 318 |
+
ForEach-Object { $_.Name }
|
| 319 |
+
}
|
| 320 |
+
} catch {
|
| 321 |
+
# Fallback: alphabetical directory order
|
| 322 |
+
$sortedPresets = @()
|
| 323 |
+
}
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
if ($sortedPresets.Count -gt 0) {
|
| 327 |
+
foreach ($presetId in $sortedPresets) {
|
| 328 |
+
$candidate = Join-Path $presetsDir "$presetId/templates/$TemplateName.md"
|
| 329 |
+
if (Test-Path $candidate) { return $candidate }
|
| 330 |
+
}
|
| 331 |
+
} else {
|
| 332 |
+
# Fallback: alphabetical directory order
|
| 333 |
+
foreach ($preset in Get-ChildItem -Path $presetsDir -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike '.*' }) {
|
| 334 |
+
$candidate = Join-Path $preset.FullName "templates/$TemplateName.md"
|
| 335 |
+
if (Test-Path $candidate) { return $candidate }
|
| 336 |
+
}
|
| 337 |
+
}
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
# Priority 3: Extension-provided templates
|
| 341 |
+
$extDir = Join-Path $RepoRoot '.specify/extensions'
|
| 342 |
+
if (Test-Path $extDir) {
|
| 343 |
+
foreach ($ext in Get-ChildItem -Path $extDir -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike '.*' } | Sort-Object Name) {
|
| 344 |
+
$candidate = Join-Path $ext.FullName "templates/$TemplateName.md"
|
| 345 |
+
if (Test-Path $candidate) { return $candidate }
|
| 346 |
+
}
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
# Priority 4: Core templates
|
| 350 |
+
$core = Join-Path $base "$TemplateName.md"
|
| 351 |
+
if (Test-Path $core) { return $core }
|
| 352 |
+
|
| 353 |
+
return $null
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
# Resolve a template name to composed content using composition strategies.
|
| 357 |
+
# Reads strategy metadata from preset manifests and composes content
|
| 358 |
+
# from multiple layers using prepend, append, or wrap strategies.
|
| 359 |
+
function Resolve-TemplateContent {
|
| 360 |
+
param(
|
| 361 |
+
[Parameter(Mandatory=$true)][string]$TemplateName,
|
| 362 |
+
[Parameter(Mandatory=$true)][string]$RepoRoot
|
| 363 |
+
)
|
| 364 |
+
|
| 365 |
+
$base = Join-Path $RepoRoot '.specify/templates'
|
| 366 |
+
|
| 367 |
+
# Collect all layers (highest priority first)
|
| 368 |
+
$layerPaths = @()
|
| 369 |
+
$layerStrategies = @()
|
| 370 |
+
|
| 371 |
+
# Priority 1: Project overrides (always "replace")
|
| 372 |
+
$override = Join-Path $base "overrides/$TemplateName.md"
|
| 373 |
+
if (Test-Path $override) {
|
| 374 |
+
$layerPaths += $override
|
| 375 |
+
$layerStrategies += 'replace'
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
# Priority 2: Installed presets (sorted by priority from .registry)
|
| 379 |
+
$presetsDir = Join-Path $RepoRoot '.specify/presets'
|
| 380 |
+
if (Test-Path $presetsDir) {
|
| 381 |
+
$registryFile = Join-Path $presetsDir '.registry'
|
| 382 |
+
$sortedPresets = @()
|
| 383 |
+
if (Test-Path $registryFile) {
|
| 384 |
+
try {
|
| 385 |
+
$registryData = Get-Content $registryFile -Raw | ConvertFrom-Json
|
| 386 |
+
$presets = $registryData.presets
|
| 387 |
+
if ($presets) {
|
| 388 |
+
$sortedPresets = $presets.PSObject.Properties |
|
| 389 |
+
Where-Object { $null -eq $_.Value.enabled -or $_.Value.enabled -ne $false } |
|
| 390 |
+
Sort-Object { if ($null -ne $_.Value.priority) { $_.Value.priority } else { 10 } } |
|
| 391 |
+
ForEach-Object { $_.Name }
|
| 392 |
+
}
|
| 393 |
+
} catch {
|
| 394 |
+
$sortedPresets = @()
|
| 395 |
+
}
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
if ($sortedPresets.Count -gt 0) {
|
| 399 |
+
$pyCmd = Get-Python3Command
|
| 400 |
+
if (-not $pyCmd) {
|
| 401 |
+
# Check if any preset has strategy fields that would be ignored
|
| 402 |
+
foreach ($pid in $sortedPresets) {
|
| 403 |
+
$mf = Join-Path $presetsDir "$pid/preset.yml"
|
| 404 |
+
if ((Test-Path $mf) -and (Select-String -Path $mf -Pattern 'strategy:' -Quiet -ErrorAction SilentlyContinue)) {
|
| 405 |
+
Write-Warning "No Python 3 found; preset composition strategies will be ignored"
|
| 406 |
+
break
|
| 407 |
+
}
|
| 408 |
+
}
|
| 409 |
+
}
|
| 410 |
+
$yamlWarned = $false
|
| 411 |
+
foreach ($presetId in $sortedPresets) {
|
| 412 |
+
# Read strategy and file path from preset manifest
|
| 413 |
+
$strategy = 'replace'
|
| 414 |
+
$manifestFilePath = ''
|
| 415 |
+
$manifest = Join-Path $presetsDir "$presetId/preset.yml"
|
| 416 |
+
if ((Test-Path $manifest) -and $pyCmd) {
|
| 417 |
+
try {
|
| 418 |
+
# Use Python to parse YAML manifest for strategy and file path
|
| 419 |
+
$pyArgs = if ($pyCmd.Count -gt 1) { $pyCmd[1..($pyCmd.Count-1)] } else { @() }
|
| 420 |
+
$pyStderrFile = [System.IO.Path]::GetTempFileName()
|
| 421 |
+
$stratResult = & $pyCmd[0] @pyArgs -c @"
|
| 422 |
+
import sys
|
| 423 |
+
try:
|
| 424 |
+
import yaml
|
| 425 |
+
except ImportError:
|
| 426 |
+
print('yaml_missing', file=sys.stderr)
|
| 427 |
+
print('replace\t')
|
| 428 |
+
sys.exit(0)
|
| 429 |
+
try:
|
| 430 |
+
with open(sys.argv[1]) as f:
|
| 431 |
+
data = yaml.safe_load(f)
|
| 432 |
+
for t in data.get('provides', {}).get('templates', []):
|
| 433 |
+
if t.get('name') == sys.argv[2] and t.get('type', 'template') == 'template':
|
| 434 |
+
print(t.get('strategy', 'replace') + '\t' + t.get('file', ''))
|
| 435 |
+
sys.exit(0)
|
| 436 |
+
print('replace\t')
|
| 437 |
+
except Exception:
|
| 438 |
+
print('replace\t')
|
| 439 |
+
"@ $manifest $TemplateName 2>$pyStderrFile
|
| 440 |
+
if ($stratResult) {
|
| 441 |
+
$parts = $stratResult.Trim() -split "`t", 2
|
| 442 |
+
$strategy = $parts[0].ToLowerInvariant()
|
| 443 |
+
if ($parts.Count -gt 1 -and $parts[1]) { $manifestFilePath = $parts[1] }
|
| 444 |
+
}
|
| 445 |
+
if (-not $yamlWarned -and (Test-Path $pyStderrFile) -and (Get-Content $pyStderrFile -Raw -ErrorAction SilentlyContinue) -match 'yaml_missing') {
|
| 446 |
+
Write-Warning "PyYAML not available; composition strategies may be ignored"
|
| 447 |
+
$yamlWarned = $true
|
| 448 |
+
}
|
| 449 |
+
Remove-Item $pyStderrFile -Force -ErrorAction SilentlyContinue
|
| 450 |
+
} catch {
|
| 451 |
+
$strategy = 'replace'
|
| 452 |
+
if ($pyStderrFile) { Remove-Item $pyStderrFile -Force -ErrorAction SilentlyContinue }
|
| 453 |
+
}
|
| 454 |
+
}
|
| 455 |
+
# Try manifest file path first, then convention path
|
| 456 |
+
$candidate = $null
|
| 457 |
+
if ($manifestFilePath) {
|
| 458 |
+
# Reject absolute paths and parent traversal
|
| 459 |
+
if ([System.IO.Path]::IsPathRooted($manifestFilePath) -or $manifestFilePath -match '\.\.[\\/]') {
|
| 460 |
+
$manifestFilePath = ''
|
| 461 |
+
}
|
| 462 |
+
}
|
| 463 |
+
if ($manifestFilePath) {
|
| 464 |
+
$mf = Join-Path $presetsDir "$presetId/$manifestFilePath"
|
| 465 |
+
if (Test-Path $mf) { $candidate = $mf }
|
| 466 |
+
}
|
| 467 |
+
if (-not $candidate) {
|
| 468 |
+
$cf = Join-Path $presetsDir "$presetId/templates/$TemplateName.md"
|
| 469 |
+
if (Test-Path $cf) { $candidate = $cf }
|
| 470 |
+
}
|
| 471 |
+
if ($candidate) {
|
| 472 |
+
$layerPaths += $candidate
|
| 473 |
+
$layerStrategies += $strategy
|
| 474 |
+
}
|
| 475 |
+
}
|
| 476 |
+
} else {
|
| 477 |
+
# Fallback: alphabetical directory order (no registry or parse failure)
|
| 478 |
+
foreach ($preset in Get-ChildItem -Path $presetsDir -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike '.*' }) {
|
| 479 |
+
$candidate = Join-Path $preset.FullName "templates/$TemplateName.md"
|
| 480 |
+
if (Test-Path $candidate) {
|
| 481 |
+
$layerPaths += $candidate
|
| 482 |
+
$layerStrategies += 'replace'
|
| 483 |
+
}
|
| 484 |
+
}
|
| 485 |
+
}
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
# Priority 3: Extension-provided templates (always "replace")
|
| 489 |
+
$extDir = Join-Path $RepoRoot '.specify/extensions'
|
| 490 |
+
if (Test-Path $extDir) {
|
| 491 |
+
foreach ($ext in Get-ChildItem -Path $extDir -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike '.*' } | Sort-Object Name) {
|
| 492 |
+
$candidate = Join-Path $ext.FullName "templates/$TemplateName.md"
|
| 493 |
+
if (Test-Path $candidate) {
|
| 494 |
+
$layerPaths += $candidate
|
| 495 |
+
$layerStrategies += 'replace'
|
| 496 |
+
}
|
| 497 |
+
}
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
# Priority 4: Core templates (always "replace")
|
| 501 |
+
$core = Join-Path $base "$TemplateName.md"
|
| 502 |
+
if (Test-Path $core) {
|
| 503 |
+
$layerPaths += $core
|
| 504 |
+
$layerStrategies += 'replace'
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
if ($layerPaths.Count -eq 0) { return $null }
|
| 508 |
+
|
| 509 |
+
# If the top (highest-priority) layer is replace, it wins entirely --
|
| 510 |
+
# lower layers are irrelevant regardless of their strategies.
|
| 511 |
+
if ($layerStrategies[0] -eq 'replace') {
|
| 512 |
+
return (Get-Content $layerPaths[0] -Raw)
|
| 513 |
+
}
|
| 514 |
+
|
| 515 |
+
# Check if any layer uses a non-replace strategy
|
| 516 |
+
$hasComposition = $false
|
| 517 |
+
foreach ($s in $layerStrategies) {
|
| 518 |
+
if ($s -ne 'replace') { $hasComposition = $true; break }
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
if (-not $hasComposition) {
|
| 522 |
+
return (Get-Content $layerPaths[0] -Raw)
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
# Find the effective base: scan from highest priority (index 0) downward
|
| 526 |
+
# to find the nearest replace layer. Only compose layers above that base.
|
| 527 |
+
$baseIdx = -1
|
| 528 |
+
for ($i = 0; $i -lt $layerPaths.Count; $i++) {
|
| 529 |
+
if ($layerStrategies[$i] -eq 'replace') {
|
| 530 |
+
$baseIdx = $i
|
| 531 |
+
break
|
| 532 |
+
}
|
| 533 |
+
}
|
| 534 |
+
if ($baseIdx -lt 0) { return $null }
|
| 535 |
+
|
| 536 |
+
$content = Get-Content $layerPaths[$baseIdx] -Raw
|
| 537 |
+
|
| 538 |
+
for ($i = $baseIdx - 1; $i -ge 0; $i--) {
|
| 539 |
+
$path = $layerPaths[$i]
|
| 540 |
+
$strat = $layerStrategies[$i]
|
| 541 |
+
$layerContent = Get-Content $path -Raw
|
| 542 |
+
|
| 543 |
+
switch ($strat) {
|
| 544 |
+
'replace' { $content = $layerContent }
|
| 545 |
+
'prepend' { $content = "$layerContent`n`n$content" }
|
| 546 |
+
'append' { $content = "$content`n`n$layerContent" }
|
| 547 |
+
'wrap' {
|
| 548 |
+
if (-not $layerContent.Contains('{CORE_TEMPLATE}')) {
|
| 549 |
+
throw "Wrap strategy missing {CORE_TEMPLATE} placeholder"
|
| 550 |
+
}
|
| 551 |
+
$content = $layerContent.Replace('{CORE_TEMPLATE}', $content)
|
| 552 |
+
}
|
| 553 |
+
default { throw "Unknown strategy: $strat" }
|
| 554 |
+
}
|
| 555 |
+
}
|
| 556 |
+
|
| 557 |
+
return $content
|
| 558 |
+
}
|
.specify/scripts/powershell/create-new-feature.ps1
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# Create a new feature
|
| 3 |
+
[CmdletBinding()]
|
| 4 |
+
param(
|
| 5 |
+
[switch]$Json,
|
| 6 |
+
[switch]$AllowExistingBranch,
|
| 7 |
+
[switch]$DryRun,
|
| 8 |
+
[string]$ShortName,
|
| 9 |
+
[Parameter()]
|
| 10 |
+
[long]$Number = 0,
|
| 11 |
+
[switch]$Timestamp,
|
| 12 |
+
[switch]$Help,
|
| 13 |
+
[Parameter(Position = 0, ValueFromRemainingArguments = $true)]
|
| 14 |
+
[string[]]$FeatureDescription
|
| 15 |
+
)
|
| 16 |
+
$ErrorActionPreference = 'Stop'
|
| 17 |
+
|
| 18 |
+
# Show help if requested
|
| 19 |
+
if ($Help) {
|
| 20 |
+
Write-Host "Usage: ./create-new-feature.ps1 [-Json] [-DryRun] [-AllowExistingBranch] [-ShortName <name>] [-Number N] [-Timestamp] <feature description>"
|
| 21 |
+
Write-Host ""
|
| 22 |
+
Write-Host "Options:"
|
| 23 |
+
Write-Host " -Json Output in JSON format"
|
| 24 |
+
Write-Host " -DryRun Compute feature name and paths without creating directories or files"
|
| 25 |
+
Write-Host " -AllowExistingBranch Reuse an existing feature directory if it already exists"
|
| 26 |
+
Write-Host " -ShortName <name> Provide a custom short name (2-4 words) for the feature"
|
| 27 |
+
Write-Host " -Number N Specify branch number manually (overrides auto-detection)"
|
| 28 |
+
Write-Host " -Timestamp Use timestamp prefix (YYYYMMDD-HHMMSS) instead of sequential numbering"
|
| 29 |
+
Write-Host " -Help Show this help message"
|
| 30 |
+
Write-Host ""
|
| 31 |
+
Write-Host "Examples:"
|
| 32 |
+
Write-Host " ./create-new-feature.ps1 'Add user authentication system' -ShortName 'user-auth'"
|
| 33 |
+
Write-Host " ./create-new-feature.ps1 'Implement OAuth2 integration for API'"
|
| 34 |
+
Write-Host " ./create-new-feature.ps1 -Timestamp -ShortName 'user-auth' 'Add user authentication'"
|
| 35 |
+
exit 0
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
# Check if feature description provided
|
| 39 |
+
if (-not $FeatureDescription -or $FeatureDescription.Count -eq 0) {
|
| 40 |
+
Write-Error "Usage: ./create-new-feature.ps1 [-Json] [-DryRun] [-AllowExistingBranch] [-ShortName <name>] [-Number N] [-Timestamp] <feature description>"
|
| 41 |
+
exit 1
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
$featureDesc = ($FeatureDescription -join ' ').Trim()
|
| 45 |
+
|
| 46 |
+
# Validate description is not empty after trimming (e.g., user passed only whitespace)
|
| 47 |
+
if ([string]::IsNullOrWhiteSpace($featureDesc)) {
|
| 48 |
+
Write-Error "Error: Feature description cannot be empty or contain only whitespace"
|
| 49 |
+
exit 1
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function Get-HighestNumberFromSpecs {
|
| 53 |
+
param([string]$SpecsDir)
|
| 54 |
+
|
| 55 |
+
[long]$highest = 0
|
| 56 |
+
if (Test-Path $SpecsDir) {
|
| 57 |
+
Get-ChildItem -Path $SpecsDir -Directory | ForEach-Object {
|
| 58 |
+
# Match sequential prefixes (>=3 digits), but skip timestamp dirs.
|
| 59 |
+
if ($_.Name -match '^(\d{3,})-' -and $_.Name -notmatch '^\d{8}-\d{6}-') {
|
| 60 |
+
[long]$num = 0
|
| 61 |
+
if ([long]::TryParse($matches[1], [ref]$num) -and $num -gt $highest) {
|
| 62 |
+
$highest = $num
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
return $highest
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
function ConvertTo-CleanBranchName {
|
| 71 |
+
param([string]$Name)
|
| 72 |
+
|
| 73 |
+
return $Name.ToLower() -replace '[^a-z0-9]', '-' -replace '-{2,}', '-' -replace '^-', '' -replace '-$', ''
|
| 74 |
+
}
|
| 75 |
+
# Load common functions (includes Get-RepoRoot and Resolve-Template)
|
| 76 |
+
. "$PSScriptRoot/common.ps1"
|
| 77 |
+
|
| 78 |
+
# Use common.ps1 functions which prioritize .specify
|
| 79 |
+
$repoRoot = Get-RepoRoot
|
| 80 |
+
|
| 81 |
+
Set-Location $repoRoot
|
| 82 |
+
|
| 83 |
+
$specsDir = Join-Path $repoRoot 'specs'
|
| 84 |
+
if (-not $DryRun) {
|
| 85 |
+
New-Item -ItemType Directory -Path $specsDir -Force | Out-Null
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
# Function to generate branch name with stop word filtering and length filtering
|
| 89 |
+
function Get-BranchName {
|
| 90 |
+
param([string]$Description)
|
| 91 |
+
|
| 92 |
+
# Common stop words to filter out
|
| 93 |
+
$stopWords = @(
|
| 94 |
+
'i', 'a', 'an', 'the', 'to', 'for', 'of', 'in', 'on', 'at', 'by', 'with', 'from',
|
| 95 |
+
'is', 'are', 'was', 'were', 'be', 'been', 'being', 'have', 'has', 'had',
|
| 96 |
+
'do', 'does', 'did', 'will', 'would', 'should', 'could', 'can', 'may', 'might', 'must', 'shall',
|
| 97 |
+
'this', 'that', 'these', 'those', 'my', 'your', 'our', 'their',
|
| 98 |
+
'want', 'need', 'add', 'get', 'set'
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
# Convert to lowercase and extract words (alphanumeric only)
|
| 102 |
+
$cleanName = $Description.ToLower() -replace '[^a-z0-9\s]', ' '
|
| 103 |
+
$words = $cleanName -split '\s+' | Where-Object { $_ }
|
| 104 |
+
|
| 105 |
+
# Filter words: remove stop words and words shorter than 3 chars (unless they're uppercase acronyms in original)
|
| 106 |
+
$meaningfulWords = @()
|
| 107 |
+
foreach ($word in $words) {
|
| 108 |
+
# Skip stop words
|
| 109 |
+
if ($stopWords -contains $word) { continue }
|
| 110 |
+
|
| 111 |
+
# Keep words that are length >= 3 OR appear as uppercase in original (likely acronyms)
|
| 112 |
+
if ($word.Length -ge 3) {
|
| 113 |
+
$meaningfulWords += $word
|
| 114 |
+
} elseif ($Description -cmatch "\b$($word.ToUpper())\b") {
|
| 115 |
+
# Keep short words only if they appear as uppercase in original (likely
|
| 116 |
+
# acronyms). Use -cmatch so the comparison is case-sensitive, matching the
|
| 117 |
+
# bash script's case-sensitive grep; -match would be case-insensitive and
|
| 118 |
+
# would keep every short word.
|
| 119 |
+
$meaningfulWords += $word
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
# If we have meaningful words, use first 3-4 of them
|
| 124 |
+
if ($meaningfulWords.Count -gt 0) {
|
| 125 |
+
$maxWords = if ($meaningfulWords.Count -eq 4) { 4 } else { 3 }
|
| 126 |
+
$result = ($meaningfulWords | Select-Object -First $maxWords) -join '-'
|
| 127 |
+
return $result
|
| 128 |
+
} else {
|
| 129 |
+
# Fallback to original logic if no meaningful words found
|
| 130 |
+
$result = ConvertTo-CleanBranchName -Name $Description
|
| 131 |
+
$fallbackWords = ($result -split '-') | Where-Object { $_ } | Select-Object -First 3
|
| 132 |
+
return [string]::Join('-', $fallbackWords)
|
| 133 |
+
}
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
# Generate branch name
|
| 137 |
+
if ($ShortName) {
|
| 138 |
+
# Use provided short name, just clean it up
|
| 139 |
+
$branchSuffix = ConvertTo-CleanBranchName -Name $ShortName
|
| 140 |
+
} else {
|
| 141 |
+
# Generate from description with smart filtering
|
| 142 |
+
$branchSuffix = Get-BranchName -Description $featureDesc
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
# Warn if -Number and -Timestamp are both specified
|
| 146 |
+
if ($Timestamp -and $Number -ne 0) {
|
| 147 |
+
Write-Warning "[specify] Warning: -Number is ignored when -Timestamp is used"
|
| 148 |
+
$Number = 0
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
# Determine branch prefix
|
| 152 |
+
if ($Timestamp) {
|
| 153 |
+
$featureNum = Get-Date -Format 'yyyyMMdd-HHmmss'
|
| 154 |
+
$branchName = "$featureNum-$branchSuffix"
|
| 155 |
+
} else {
|
| 156 |
+
# Determine branch number from existing feature directories
|
| 157 |
+
if ($Number -eq 0) {
|
| 158 |
+
$Number = (Get-HighestNumberFromSpecs -SpecsDir $specsDir) + 1
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
$featureNum = ('{0:000}' -f $Number)
|
| 162 |
+
$branchName = "$featureNum-$branchSuffix"
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
# GitHub enforces a 244-byte limit on branch names
|
| 166 |
+
# Validate and truncate if necessary
|
| 167 |
+
$maxBranchLength = 244
|
| 168 |
+
if ($branchName.Length -gt $maxBranchLength) {
|
| 169 |
+
# Calculate how much we need to trim from suffix
|
| 170 |
+
# Account for prefix length: timestamp (15) + hyphen (1) = 16, or sequential (3) + hyphen (1) = 4
|
| 171 |
+
$prefixLength = $featureNum.Length + 1
|
| 172 |
+
$maxSuffixLength = $maxBranchLength - $prefixLength
|
| 173 |
+
|
| 174 |
+
# Truncate suffix
|
| 175 |
+
$truncatedSuffix = $branchSuffix.Substring(0, [Math]::Min($branchSuffix.Length, $maxSuffixLength))
|
| 176 |
+
# Remove trailing hyphen if truncation created one
|
| 177 |
+
$truncatedSuffix = $truncatedSuffix -replace '-$', ''
|
| 178 |
+
|
| 179 |
+
$originalBranchName = $branchName
|
| 180 |
+
$branchName = "$featureNum-$truncatedSuffix"
|
| 181 |
+
|
| 182 |
+
Write-Warning "[specify] Branch name exceeded GitHub's 244-byte limit"
|
| 183 |
+
Write-Warning "[specify] Original: $originalBranchName ($($originalBranchName.Length) bytes)"
|
| 184 |
+
Write-Warning "[specify] Truncated to: $branchName ($($branchName.Length) bytes)"
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
$featureDir = Join-Path $specsDir $branchName
|
| 188 |
+
$specFile = Join-Path $featureDir 'spec.md'
|
| 189 |
+
|
| 190 |
+
if (-not $DryRun) {
|
| 191 |
+
if ((Test-Path -LiteralPath $featureDir -PathType Container) -and -not $AllowExistingBranch) {
|
| 192 |
+
if ($Timestamp) {
|
| 193 |
+
Write-Error "Error: Feature directory '$featureDir' already exists. Rerun to get a new timestamp or use a different -ShortName."
|
| 194 |
+
} else {
|
| 195 |
+
Write-Error "Error: Feature directory '$featureDir' already exists. Please use a different feature name or specify a different number with -Number."
|
| 196 |
+
}
|
| 197 |
+
exit 1
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
New-Item -ItemType Directory -Path $featureDir -Force | Out-Null
|
| 201 |
+
|
| 202 |
+
if (-not (Test-Path -PathType Leaf $specFile)) {
|
| 203 |
+
$template = Resolve-Template -TemplateName 'spec-template' -RepoRoot $repoRoot
|
| 204 |
+
if ($template -and (Test-Path $template)) {
|
| 205 |
+
# Read the template content and write it to the spec file with UTF-8 encoding without BOM
|
| 206 |
+
$content = [System.IO.File]::ReadAllText($template)
|
| 207 |
+
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
| 208 |
+
[System.IO.File]::WriteAllText($specFile, $content, $utf8NoBom)
|
| 209 |
+
} else {
|
| 210 |
+
New-Item -ItemType File -Path $specFile -Force | Out-Null
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
# Persist to .specify/feature.json so downstream commands can find the feature
|
| 215 |
+
Save-FeatureJson -RepoRoot $repoRoot -FeatureDirectory $featureDir
|
| 216 |
+
|
| 217 |
+
# Set environment variables for the current session
|
| 218 |
+
$env:SPECIFY_FEATURE = $branchName
|
| 219 |
+
$env:SPECIFY_FEATURE_DIRECTORY = $featureDir
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
if ($Json) {
|
| 223 |
+
$obj = [PSCustomObject]@{
|
| 224 |
+
BRANCH_NAME = $branchName
|
| 225 |
+
SPEC_FILE = $specFile
|
| 226 |
+
FEATURE_NUM = $featureNum
|
| 227 |
+
}
|
| 228 |
+
if ($DryRun) {
|
| 229 |
+
$obj | Add-Member -NotePropertyName 'DRY_RUN' -NotePropertyValue $true
|
| 230 |
+
}
|
| 231 |
+
$obj | ConvertTo-Json -Compress
|
| 232 |
+
} else {
|
| 233 |
+
Write-Output "BRANCH_NAME: $branchName"
|
| 234 |
+
Write-Output "SPEC_FILE: $specFile"
|
| 235 |
+
Write-Output "FEATURE_NUM: $featureNum"
|
| 236 |
+
if (-not $DryRun) {
|
| 237 |
+
Write-Output "SPECIFY_FEATURE set to: $branchName"
|
| 238 |
+
Write-Output "SPECIFY_FEATURE_DIRECTORY set to: $featureDir"
|
| 239 |
+
}
|
| 240 |
+
}
|
.specify/scripts/powershell/setup-plan.ps1
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# Setup implementation plan for a feature
|
| 3 |
+
|
| 4 |
+
[CmdletBinding()]
|
| 5 |
+
param(
|
| 6 |
+
[switch]$Json,
|
| 7 |
+
[switch]$Help
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
$ErrorActionPreference = 'Stop'
|
| 11 |
+
|
| 12 |
+
# Show help if requested
|
| 13 |
+
if ($Help) {
|
| 14 |
+
Write-Output "Usage: ./setup-plan.ps1 [-Json] [-Help]"
|
| 15 |
+
Write-Output " -Json Output results in JSON format"
|
| 16 |
+
Write-Output " -Help Show this help message"
|
| 17 |
+
exit 0
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
# Load common functions
|
| 21 |
+
. "$PSScriptRoot/common.ps1"
|
| 22 |
+
|
| 23 |
+
# Get all paths and variables from common functions
|
| 24 |
+
$paths = Get-FeaturePathsEnv
|
| 25 |
+
|
| 26 |
+
# Ensure the feature directory exists
|
| 27 |
+
New-Item -ItemType Directory -Path $paths.FEATURE_DIR -Force | Out-Null
|
| 28 |
+
|
| 29 |
+
# Copy plan template if plan doesn't already exist
|
| 30 |
+
if (Test-Path $paths.IMPL_PLAN -PathType Leaf) {
|
| 31 |
+
if ($Json) {
|
| 32 |
+
[Console]::Error.WriteLine("Plan already exists at $($paths.IMPL_PLAN), skipping template copy")
|
| 33 |
+
} else {
|
| 34 |
+
Write-Output "Plan already exists at $($paths.IMPL_PLAN), skipping template copy"
|
| 35 |
+
}
|
| 36 |
+
} else {
|
| 37 |
+
$template = Resolve-Template -TemplateName 'plan-template' -RepoRoot $paths.REPO_ROOT
|
| 38 |
+
if ($template -and (Test-Path $template)) {
|
| 39 |
+
# Read the template content and write it to the implementation plan file with UTF-8 encoding without BOM
|
| 40 |
+
$content = [System.IO.File]::ReadAllText($template)
|
| 41 |
+
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
| 42 |
+
[System.IO.File]::WriteAllText($paths.IMPL_PLAN, $content, $utf8NoBom)
|
| 43 |
+
} else {
|
| 44 |
+
Write-Warning "Plan template not found"
|
| 45 |
+
# Create a basic plan file if template doesn't exist
|
| 46 |
+
New-Item -ItemType File -Path $paths.IMPL_PLAN -Force | Out-Null
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
# Output results
|
| 51 |
+
if ($Json) {
|
| 52 |
+
$result = [PSCustomObject]@{
|
| 53 |
+
FEATURE_SPEC = $paths.FEATURE_SPEC
|
| 54 |
+
IMPL_PLAN = $paths.IMPL_PLAN
|
| 55 |
+
SPECS_DIR = $paths.FEATURE_DIR
|
| 56 |
+
BRANCH = $paths.CURRENT_BRANCH
|
| 57 |
+
}
|
| 58 |
+
$result | ConvertTo-Json -Compress
|
| 59 |
+
} else {
|
| 60 |
+
Write-Output "FEATURE_SPEC: $($paths.FEATURE_SPEC)"
|
| 61 |
+
Write-Output "IMPL_PLAN: $($paths.IMPL_PLAN)"
|
| 62 |
+
Write-Output "SPECS_DIR: $($paths.FEATURE_DIR)"
|
| 63 |
+
Write-Output "BRANCH: $($paths.CURRENT_BRANCH)"
|
| 64 |
+
}
|
.specify/scripts/powershell/setup-tasks.ps1
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
|
| 3 |
+
[CmdletBinding()]
|
| 4 |
+
param(
|
| 5 |
+
[switch]$Json,
|
| 6 |
+
[switch]$Help
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
$ErrorActionPreference = 'Stop'
|
| 10 |
+
|
| 11 |
+
if ($Help) {
|
| 12 |
+
Write-Output "Usage: setup-tasks.ps1 [-Json] [-Help]"
|
| 13 |
+
exit 0
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
# Source common functions
|
| 17 |
+
. "$PSScriptRoot/common.ps1"
|
| 18 |
+
|
| 19 |
+
# Get feature paths
|
| 20 |
+
$paths = Get-FeaturePathsEnv
|
| 21 |
+
|
| 22 |
+
if (-not (Test-Path $paths.IMPL_PLAN -PathType Leaf)) {
|
| 23 |
+
[Console]::Error.WriteLine("ERROR: plan.md not found in $($paths.FEATURE_DIR)")
|
| 24 |
+
$planCommand = '/speckit.plan'
|
| 25 |
+
[Console]::Error.WriteLine("Run $planCommand first to create the implementation plan.")
|
| 26 |
+
exit 1
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
if (-not (Test-Path $paths.FEATURE_SPEC -PathType Leaf)) {
|
| 30 |
+
[Console]::Error.WriteLine("ERROR: spec.md not found in $($paths.FEATURE_DIR)")
|
| 31 |
+
$specifyCommand = '/speckit.specify'
|
| 32 |
+
[Console]::Error.WriteLine("Run $specifyCommand first to create the feature structure.")
|
| 33 |
+
exit 1
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
# Build available docs list
|
| 37 |
+
$docs = @()
|
| 38 |
+
if (Test-Path $paths.RESEARCH) { $docs += 'research.md' }
|
| 39 |
+
if (Test-Path $paths.DATA_MODEL) { $docs += 'data-model.md' }
|
| 40 |
+
if ((Test-Path $paths.CONTRACTS_DIR) -and (Get-ChildItem -Path $paths.CONTRACTS_DIR -ErrorAction SilentlyContinue | Select-Object -First 1)) {
|
| 41 |
+
$docs += 'contracts/'
|
| 42 |
+
}
|
| 43 |
+
if (Test-Path $paths.QUICKSTART) { $docs += 'quickstart.md' }
|
| 44 |
+
|
| 45 |
+
# Resolve tasks template through override stack
|
| 46 |
+
$tasksTemplate = Resolve-Template -TemplateName 'tasks-template' -RepoRoot $paths.REPO_ROOT
|
| 47 |
+
if (-not $tasksTemplate -or -not (Test-Path -LiteralPath $tasksTemplate -PathType Leaf)) {
|
| 48 |
+
$expectedCoreTemplate = Join-Path $paths.REPO_ROOT '.specify/templates/tasks-template.md'
|
| 49 |
+
[Console]::Error.WriteLine("ERROR: Tasks template not found for repository root: $($paths.REPO_ROOT)`nTemplate resolution order: overrides -> presets -> extensions -> core.`nExpected shared/core template location: $expectedCoreTemplate`nTo continue, verify whether 'tasks-template.md' is available in '.specify/templates/overrides/', preset templates, extension templates, or restore the shared/core templates (for example by re-running 'specify init') so that '.specify/templates/tasks-template.md' exists.")
|
| 50 |
+
exit 1
|
| 51 |
+
}
|
| 52 |
+
$tasksTemplate = (Resolve-Path -LiteralPath $tasksTemplate).Path
|
| 53 |
+
|
| 54 |
+
# Output results
|
| 55 |
+
if ($Json) {
|
| 56 |
+
[PSCustomObject]@{
|
| 57 |
+
FEATURE_DIR = $paths.FEATURE_DIR
|
| 58 |
+
AVAILABLE_DOCS = $docs
|
| 59 |
+
TASKS_TEMPLATE = $tasksTemplate
|
| 60 |
+
} | ConvertTo-Json -Compress
|
| 61 |
+
} else {
|
| 62 |
+
Write-Output "FEATURE_DIR: $($paths.FEATURE_DIR)"
|
| 63 |
+
Write-Output "TASKS_TEMPLATE: $(if ($tasksTemplate) { $tasksTemplate } else { 'not found' })"
|
| 64 |
+
Write-Output "AVAILABLE_DOCS:"
|
| 65 |
+
Test-FileExists -Path $paths.RESEARCH -Description 'research.md' | Out-Null
|
| 66 |
+
Test-FileExists -Path $paths.DATA_MODEL -Description 'data-model.md' | Out-Null
|
| 67 |
+
Test-DirHasFiles -Path $paths.CONTRACTS_DIR -Description 'contracts/' | Out-Null
|
| 68 |
+
Test-FileExists -Path $paths.QUICKSTART -Description 'quickstart.md' | Out-Null
|
| 69 |
+
}
|
.specify/templates/checklist-template.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# [CHECKLIST TYPE] Checklist: [FEATURE NAME]
|
| 2 |
+
|
| 3 |
+
**Purpose**: [Brief description of what this checklist covers]
|
| 4 |
+
**Created**: [DATE]
|
| 5 |
+
**Feature**: [Link to spec.md or relevant documentation]
|
| 6 |
+
|
| 7 |
+
**Note**: This checklist is generated by the `/speckit.checklist` command based on feature context and requirements.
|
| 8 |
+
|
| 9 |
+
<!--
|
| 10 |
+
============================================================================
|
| 11 |
+
IMPORTANT: The checklist items below are SAMPLE ITEMS for illustration only.
|
| 12 |
+
|
| 13 |
+
The /speckit.checklist command MUST replace these with actual items based on:
|
| 14 |
+
- User's specific checklist request
|
| 15 |
+
- Feature requirements from spec.md
|
| 16 |
+
- Technical context from plan.md
|
| 17 |
+
- Implementation details from tasks.md
|
| 18 |
+
|
| 19 |
+
DO NOT keep these sample items in the generated checklist file.
|
| 20 |
+
============================================================================
|
| 21 |
+
-->
|
| 22 |
+
|
| 23 |
+
## [Category 1]
|
| 24 |
+
|
| 25 |
+
- [ ] CHK001 First checklist item with clear action
|
| 26 |
+
- [ ] CHK002 Second checklist item
|
| 27 |
+
- [ ] CHK003 Third checklist item
|
| 28 |
+
|
| 29 |
+
## [Category 2]
|
| 30 |
+
|
| 31 |
+
- [ ] CHK004 Another category item
|
| 32 |
+
- [ ] CHK005 Item with specific criteria
|
| 33 |
+
- [ ] CHK006 Final item in this category
|
| 34 |
+
|
| 35 |
+
## Notes
|
| 36 |
+
|
| 37 |
+
- Check items off as completed: `[x]`
|
| 38 |
+
- Add comments or findings inline
|
| 39 |
+
- Link to relevant resources or documentation
|
| 40 |
+
- Items are numbered sequentially for easy reference
|
.specify/templates/constitution-template.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# [PROJECT_NAME] Constitution
|
| 2 |
+
<!-- Example: Spec Constitution, TaskFlow Constitution, etc. -->
|
| 3 |
+
|
| 4 |
+
## Core Principles
|
| 5 |
+
|
| 6 |
+
### [PRINCIPLE_1_NAME]
|
| 7 |
+
<!-- Example: I. Library-First -->
|
| 8 |
+
[PRINCIPLE_1_DESCRIPTION]
|
| 9 |
+
<!-- Example: Every feature starts as a standalone library; Libraries must be self-contained, independently testable, documented; Clear purpose required - no organizational-only libraries -->
|
| 10 |
+
|
| 11 |
+
### [PRINCIPLE_2_NAME]
|
| 12 |
+
<!-- Example: II. CLI Interface -->
|
| 13 |
+
[PRINCIPLE_2_DESCRIPTION]
|
| 14 |
+
<!-- Example: Every library exposes functionality via CLI; Text in/out protocol: stdin/args → stdout, errors → stderr; Support JSON + human-readable formats -->
|
| 15 |
+
|
| 16 |
+
### [PRINCIPLE_3_NAME]
|
| 17 |
+
<!-- Example: III. Test-First (NON-NEGOTIABLE) -->
|
| 18 |
+
[PRINCIPLE_3_DESCRIPTION]
|
| 19 |
+
<!-- Example: TDD mandatory: Tests written → User approved → Tests fail → Then implement; Red-Green-Refactor cycle strictly enforced -->
|
| 20 |
+
|
| 21 |
+
### [PRINCIPLE_4_NAME]
|
| 22 |
+
<!-- Example: IV. Integration Testing -->
|
| 23 |
+
[PRINCIPLE_4_DESCRIPTION]
|
| 24 |
+
<!-- Example: Focus areas requiring integration tests: New library contract tests, Contract changes, Inter-service communication, Shared schemas -->
|
| 25 |
+
|
| 26 |
+
### [PRINCIPLE_5_NAME]
|
| 27 |
+
<!-- Example: V. Observability, VI. Versioning & Breaking Changes, VII. Simplicity -->
|
| 28 |
+
[PRINCIPLE_5_DESCRIPTION]
|
| 29 |
+
<!-- Example: Text I/O ensures debuggability; Structured logging required; Or: MAJOR.MINOR.BUILD format; Or: Start simple, YAGNI principles -->
|
| 30 |
+
|
| 31 |
+
## [SECTION_2_NAME]
|
| 32 |
+
<!-- Example: Additional Constraints, Security Requirements, Performance Standards, etc. -->
|
| 33 |
+
|
| 34 |
+
[SECTION_2_CONTENT]
|
| 35 |
+
<!-- Example: Technology stack requirements, compliance standards, deployment policies, etc. -->
|
| 36 |
+
|
| 37 |
+
## [SECTION_3_NAME]
|
| 38 |
+
<!-- Example: Development Workflow, Review Process, Quality Gates, etc. -->
|
| 39 |
+
|
| 40 |
+
[SECTION_3_CONTENT]
|
| 41 |
+
<!-- Example: Code review requirements, testing gates, deployment approval process, etc. -->
|
| 42 |
+
|
| 43 |
+
## Governance
|
| 44 |
+
<!-- Example: Constitution supersedes all other practices; Amendments require documentation, approval, migration plan -->
|
| 45 |
+
|
| 46 |
+
[GOVERNANCE_RULES]
|
| 47 |
+
<!-- Example: All PRs/reviews must verify compliance; Complexity must be justified; Use [GUIDANCE_FILE] for runtime development guidance -->
|
| 48 |
+
|
| 49 |
+
**Version**: [CONSTITUTION_VERSION] | **Ratified**: [RATIFICATION_DATE] | **Last Amended**: [LAST_AMENDED_DATE]
|
| 50 |
+
<!-- Example: Version: 2.1.1 | Ratified: 2025-06-13 | Last Amended: 2025-07-16 -->
|
.specify/templates/plan-template.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Implementation Plan: [FEATURE]
|
| 2 |
+
|
| 3 |
+
**Branch**: `[###-feature-name]` | **Date**: [DATE] | **Spec**: [link]
|
| 4 |
+
|
| 5 |
+
**Input**: Feature specification from `/specs/[###-feature-name]/spec.md`
|
| 6 |
+
|
| 7 |
+
**Note**: This template is filled in by the `/speckit.plan` command. See `.specify/templates/plan-template.md` for the execution workflow.
|
| 8 |
+
|
| 9 |
+
## Summary
|
| 10 |
+
|
| 11 |
+
[Extract from feature spec: primary requirement + technical approach from research]
|
| 12 |
+
|
| 13 |
+
## Technical Context
|
| 14 |
+
|
| 15 |
+
<!--
|
| 16 |
+
ACTION REQUIRED: Replace the content in this section with the technical details
|
| 17 |
+
for the project. The structure here is presented in advisory capacity to guide
|
| 18 |
+
the iteration process.
|
| 19 |
+
-->
|
| 20 |
+
|
| 21 |
+
**Language/Version**: [e.g., Python 3.11, Swift 5.9, Rust 1.75 or NEEDS CLARIFICATION]
|
| 22 |
+
|
| 23 |
+
**Primary Dependencies**: [e.g., FastAPI, UIKit, LLVM or NEEDS CLARIFICATION]
|
| 24 |
+
|
| 25 |
+
**Storage**: [if applicable, e.g., PostgreSQL, CoreData, files or N/A]
|
| 26 |
+
|
| 27 |
+
**Testing**: [e.g., pytest, XCTest, cargo test or NEEDS CLARIFICATION]
|
| 28 |
+
|
| 29 |
+
**Target Platform**: [e.g., Linux server, iOS 15+, WASM or NEEDS CLARIFICATION]
|
| 30 |
+
|
| 31 |
+
**Project Type**: [e.g., library/cli/web-service/mobile-app/compiler/desktop-app or NEEDS CLARIFICATION]
|
| 32 |
+
|
| 33 |
+
**Performance Goals**: [domain-specific, e.g., 1000 req/s, 10k lines/sec, 60 fps or NEEDS CLARIFICATION]
|
| 34 |
+
|
| 35 |
+
**Constraints**: [domain-specific, e.g., <200ms p95, <100MB memory, offline-capable or NEEDS CLARIFICATION]
|
| 36 |
+
|
| 37 |
+
**Scale/Scope**: [domain-specific, e.g., 10k users, 1M LOC, 50 screens or NEEDS CLARIFICATION]
|
| 38 |
+
|
| 39 |
+
## Constitution Check
|
| 40 |
+
|
| 41 |
+
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
|
| 42 |
+
|
| 43 |
+
[Gates determined based on constitution file]
|
| 44 |
+
|
| 45 |
+
## Project Structure
|
| 46 |
+
|
| 47 |
+
### Documentation (this feature)
|
| 48 |
+
|
| 49 |
+
```text
|
| 50 |
+
specs/[###-feature]/
|
| 51 |
+
├── plan.md # This file (/speckit.plan command output)
|
| 52 |
+
├── research.md # Phase 0 output (/speckit.plan command)
|
| 53 |
+
├── data-model.md # Phase 1 output (/speckit.plan command)
|
| 54 |
+
├── quickstart.md # Phase 1 output (/speckit.plan command)
|
| 55 |
+
├── contracts/ # Phase 1 output (/speckit.plan command)
|
| 56 |
+
└── tasks.md # Phase 2 output (/speckit.tasks command - NOT created by /speckit.plan)
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
### Source Code (repository root)
|
| 60 |
+
<!--
|
| 61 |
+
ACTION REQUIRED: Replace the placeholder tree below with the concrete layout
|
| 62 |
+
for this feature. Delete unused options and expand the chosen structure with
|
| 63 |
+
real paths (e.g., apps/admin, packages/something). The delivered plan must
|
| 64 |
+
not include Option labels.
|
| 65 |
+
-->
|
| 66 |
+
|
| 67 |
+
```text
|
| 68 |
+
# [REMOVE IF UNUSED] Option 1: Single project (DEFAULT)
|
| 69 |
+
src/
|
| 70 |
+
├── models/
|
| 71 |
+
├── services/
|
| 72 |
+
├── cli/
|
| 73 |
+
└── lib/
|
| 74 |
+
|
| 75 |
+
tests/
|
| 76 |
+
├── contract/
|
| 77 |
+
├── integration/
|
| 78 |
+
└── unit/
|
| 79 |
+
|
| 80 |
+
# [REMOVE IF UNUSED] Option 2: Web application (when "frontend" + "backend" detected)
|
| 81 |
+
backend/
|
| 82 |
+
├── src/
|
| 83 |
+
│ ├── models/
|
| 84 |
+
│ ├── services/
|
| 85 |
+
│ └── api/
|
| 86 |
+
└── tests/
|
| 87 |
+
|
| 88 |
+
frontend/
|
| 89 |
+
├── src/
|
| 90 |
+
│ ├── components/
|
| 91 |
+
│ ├── pages/
|
| 92 |
+
│ └── services/
|
| 93 |
+
└── tests/
|
| 94 |
+
|
| 95 |
+
# [REMOVE IF UNUSED] Option 3: Mobile + API (when "iOS/Android" detected)
|
| 96 |
+
api/
|
| 97 |
+
└── [same as backend above]
|
| 98 |
+
|
| 99 |
+
ios/ or android/
|
| 100 |
+
└── [platform-specific structure: feature modules, UI flows, platform tests]
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
**Structure Decision**: [Document the selected structure and reference the real
|
| 104 |
+
directories captured above]
|
| 105 |
+
|
| 106 |
+
## Complexity Tracking
|
| 107 |
+
|
| 108 |
+
> **Fill ONLY if Constitution Check has violations that must be justified**
|
| 109 |
+
|
| 110 |
+
| Violation | Why Needed | Simpler Alternative Rejected Because |
|
| 111 |
+
|-----------|------------|-------------------------------------|
|
| 112 |
+
| [e.g., 4th project] | [current need] | [why 3 projects insufficient] |
|
| 113 |
+
| [e.g., Repository pattern] | [specific problem] | [why direct DB access insufficient] |
|
.specify/templates/spec-template.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Feature Specification: [FEATURE NAME]
|
| 2 |
+
|
| 3 |
+
**Feature Branch**: `[###-feature-name]`
|
| 4 |
+
|
| 5 |
+
**Created**: [DATE]
|
| 6 |
+
|
| 7 |
+
**Status**: Draft
|
| 8 |
+
|
| 9 |
+
**Input**: User description: "$ARGUMENTS"
|
| 10 |
+
|
| 11 |
+
## User Scenarios & Testing *(mandatory)*
|
| 12 |
+
|
| 13 |
+
<!--
|
| 14 |
+
IMPORTANT: User stories should be PRIORITIZED as user journeys ordered by importance.
|
| 15 |
+
Each user story/journey must be INDEPENDENTLY TESTABLE - meaning if you implement just ONE of them,
|
| 16 |
+
you should still have a viable MVP (Minimum Viable Product) that delivers value.
|
| 17 |
+
|
| 18 |
+
Assign priorities (P1, P2, P3, etc.) to each story, where P1 is the most critical.
|
| 19 |
+
Think of each story as a standalone slice of functionality that can be:
|
| 20 |
+
- Developed independently
|
| 21 |
+
- Tested independently
|
| 22 |
+
- Deployed independently
|
| 23 |
+
- Demonstrated to users independently
|
| 24 |
+
-->
|
| 25 |
+
|
| 26 |
+
### User Story 1 - [Brief Title] (Priority: P1)
|
| 27 |
+
|
| 28 |
+
[Describe this user journey in plain language]
|
| 29 |
+
|
| 30 |
+
**Why this priority**: [Explain the value and why it has this priority level]
|
| 31 |
+
|
| 32 |
+
**Independent Test**: [Describe how this can be tested independently - e.g., "Can be fully tested by [specific action] and delivers [specific value]"]
|
| 33 |
+
|
| 34 |
+
**Acceptance Scenarios**:
|
| 35 |
+
|
| 36 |
+
1. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
| 37 |
+
2. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
### User Story 2 - [Brief Title] (Priority: P2)
|
| 42 |
+
|
| 43 |
+
[Describe this user journey in plain language]
|
| 44 |
+
|
| 45 |
+
**Why this priority**: [Explain the value and why it has this priority level]
|
| 46 |
+
|
| 47 |
+
**Independent Test**: [Describe how this can be tested independently]
|
| 48 |
+
|
| 49 |
+
**Acceptance Scenarios**:
|
| 50 |
+
|
| 51 |
+
1. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
| 52 |
+
|
| 53 |
+
---
|
| 54 |
+
|
| 55 |
+
### User Story 3 - [Brief Title] (Priority: P3)
|
| 56 |
+
|
| 57 |
+
[Describe this user journey in plain language]
|
| 58 |
+
|
| 59 |
+
**Why this priority**: [Explain the value and why it has this priority level]
|
| 60 |
+
|
| 61 |
+
**Independent Test**: [Describe how this can be tested independently]
|
| 62 |
+
|
| 63 |
+
**Acceptance Scenarios**:
|
| 64 |
+
|
| 65 |
+
1. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
|
| 69 |
+
[Add more user stories as needed, each with an assigned priority]
|
| 70 |
+
|
| 71 |
+
### Edge Cases
|
| 72 |
+
|
| 73 |
+
<!--
|
| 74 |
+
ACTION REQUIRED: The content in this section represents placeholders.
|
| 75 |
+
Fill them out with the right edge cases.
|
| 76 |
+
-->
|
| 77 |
+
|
| 78 |
+
- What happens when [boundary condition]?
|
| 79 |
+
- How does system handle [error scenario]?
|
| 80 |
+
|
| 81 |
+
## Requirements *(mandatory)*
|
| 82 |
+
|
| 83 |
+
<!--
|
| 84 |
+
ACTION REQUIRED: The content in this section represents placeholders.
|
| 85 |
+
Fill them out with the right functional requirements.
|
| 86 |
+
-->
|
| 87 |
+
|
| 88 |
+
### Functional Requirements
|
| 89 |
+
|
| 90 |
+
- **FR-001**: System MUST [specific capability, e.g., "allow users to create accounts"]
|
| 91 |
+
- **FR-002**: System MUST [specific capability, e.g., "validate email addresses"]
|
| 92 |
+
- **FR-003**: Users MUST be able to [key interaction, e.g., "reset their password"]
|
| 93 |
+
- **FR-004**: System MUST [data requirement, e.g., "persist user preferences"]
|
| 94 |
+
- **FR-005**: System MUST [behavior, e.g., "log all security events"]
|
| 95 |
+
|
| 96 |
+
*Example of marking unclear requirements:*
|
| 97 |
+
|
| 98 |
+
- **FR-006**: System MUST authenticate users via [NEEDS CLARIFICATION: auth method not specified - email/password, SSO, OAuth?]
|
| 99 |
+
- **FR-007**: System MUST retain user data for [NEEDS CLARIFICATION: retention period not specified]
|
| 100 |
+
|
| 101 |
+
### Key Entities *(include if feature involves data)*
|
| 102 |
+
|
| 103 |
+
- **[Entity 1]**: [What it represents, key attributes without implementation]
|
| 104 |
+
- **[Entity 2]**: [What it represents, relationships to other entities]
|
| 105 |
+
|
| 106 |
+
## Success Criteria *(mandatory)*
|
| 107 |
+
|
| 108 |
+
<!--
|
| 109 |
+
ACTION REQUIRED: Define measurable success criteria.
|
| 110 |
+
These must be technology-agnostic and measurable.
|
| 111 |
+
-->
|
| 112 |
+
|
| 113 |
+
### Measurable Outcomes
|
| 114 |
+
|
| 115 |
+
- **SC-001**: [Measurable metric, e.g., "Users can complete account creation in under 2 minutes"]
|
| 116 |
+
- **SC-002**: [Measurable metric, e.g., "System handles 1000 concurrent users without degradation"]
|
| 117 |
+
- **SC-003**: [User satisfaction metric, e.g., "90% of users successfully complete primary task on first attempt"]
|
| 118 |
+
- **SC-004**: [Business metric, e.g., "Reduce support tickets related to [X] by 50%"]
|
| 119 |
+
|
| 120 |
+
## Assumptions
|
| 121 |
+
|
| 122 |
+
<!--
|
| 123 |
+
ACTION REQUIRED: The content in this section represents placeholders.
|
| 124 |
+
Fill them out with the right assumptions based on reasonable defaults
|
| 125 |
+
chosen when the feature description did not specify certain details.
|
| 126 |
+
-->
|
| 127 |
+
|
| 128 |
+
- [Assumption about target users, e.g., "Users have stable internet connectivity"]
|
| 129 |
+
- [Assumption about scope boundaries, e.g., "Mobile support is out of scope for v1"]
|
| 130 |
+
- [Assumption about data/environment, e.g., "Existing authentication system will be reused"]
|
| 131 |
+
- [Dependency on existing system/service, e.g., "Requires access to the existing user profile API"]
|
.specify/templates/tasks-template.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
|
| 3 |
+
description: "Task list template for feature implementation"
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Tasks: [FEATURE NAME]
|
| 7 |
+
|
| 8 |
+
**Input**: Design documents from `/specs/[###-feature-name]/`
|
| 9 |
+
|
| 10 |
+
**Prerequisites**: plan.md (required), spec.md (required for user stories), research.md, data-model.md, contracts/
|
| 11 |
+
|
| 12 |
+
**Tests**: The examples below include test tasks. Tests are OPTIONAL - only include them if explicitly requested in the feature specification.
|
| 13 |
+
|
| 14 |
+
**Organization**: Tasks are grouped by user story to enable independent implementation and testing of each story.
|
| 15 |
+
|
| 16 |
+
## Format: `[ID] [P?] [Story] Description`
|
| 17 |
+
|
| 18 |
+
- **[P]**: Can run in parallel (different files, no dependencies)
|
| 19 |
+
- **[Story]**: Which user story this task belongs to (e.g., US1, US2, US3)
|
| 20 |
+
- Include exact file paths in descriptions
|
| 21 |
+
|
| 22 |
+
## Path Conventions
|
| 23 |
+
|
| 24 |
+
- **Single project**: `src/`, `tests/` at repository root
|
| 25 |
+
- **Web app**: `backend/src/`, `frontend/src/`
|
| 26 |
+
- **Mobile**: `api/src/`, `ios/src/` or `android/src/`
|
| 27 |
+
- Paths shown below assume single project - adjust based on plan.md structure
|
| 28 |
+
|
| 29 |
+
<!--
|
| 30 |
+
============================================================================
|
| 31 |
+
IMPORTANT: The tasks below are SAMPLE TASKS for illustration purposes only.
|
| 32 |
+
|
| 33 |
+
The /speckit.tasks command MUST replace these with actual tasks based on:
|
| 34 |
+
- User stories from spec.md (with their priorities P1, P2, P3...)
|
| 35 |
+
- Feature requirements from plan.md
|
| 36 |
+
- Entities from data-model.md
|
| 37 |
+
- Endpoints from contracts/
|
| 38 |
+
|
| 39 |
+
Tasks MUST be organized by user story so each story can be:
|
| 40 |
+
- Implemented independently
|
| 41 |
+
- Tested independently
|
| 42 |
+
- Delivered as an MVP increment
|
| 43 |
+
|
| 44 |
+
DO NOT keep these sample tasks in the generated tasks.md file.
|
| 45 |
+
============================================================================
|
| 46 |
+
-->
|
| 47 |
+
|
| 48 |
+
## Phase 1: Setup (Shared Infrastructure)
|
| 49 |
+
|
| 50 |
+
**Purpose**: Project initialization and basic structure
|
| 51 |
+
|
| 52 |
+
- [ ] T001 Create project structure per implementation plan
|
| 53 |
+
- [ ] T002 Initialize [language] project with [framework] dependencies
|
| 54 |
+
- [ ] T003 [P] Configure linting and formatting tools
|
| 55 |
+
|
| 56 |
+
---
|
| 57 |
+
|
| 58 |
+
## Phase 2: Foundational (Blocking Prerequisites)
|
| 59 |
+
|
| 60 |
+
**Purpose**: Core infrastructure that MUST be complete before ANY user story can be implemented
|
| 61 |
+
|
| 62 |
+
**⚠️ CRITICAL**: No user story work can begin until this phase is complete
|
| 63 |
+
|
| 64 |
+
Examples of foundational tasks (adjust based on your project):
|
| 65 |
+
|
| 66 |
+
- [ ] T004 Setup database schema and migrations framework
|
| 67 |
+
- [ ] T005 [P] Implement authentication/authorization framework
|
| 68 |
+
- [ ] T006 [P] Setup API routing and middleware structure
|
| 69 |
+
- [ ] T007 Create base models/entities that all stories depend on
|
| 70 |
+
- [ ] T008 Configure error handling and logging infrastructure
|
| 71 |
+
- [ ] T009 Setup environment configuration management
|
| 72 |
+
|
| 73 |
+
**Checkpoint**: Foundation ready - user story implementation can now begin in parallel
|
| 74 |
+
|
| 75 |
+
---
|
| 76 |
+
|
| 77 |
+
## Phase 3: User Story 1 - [Title] (Priority: P1) 🎯 MVP
|
| 78 |
+
|
| 79 |
+
**Goal**: [Brief description of what this story delivers]
|
| 80 |
+
|
| 81 |
+
**Independent Test**: [How to verify this story works on its own]
|
| 82 |
+
|
| 83 |
+
### Tests for User Story 1 (OPTIONAL - only if tests requested) ⚠️
|
| 84 |
+
|
| 85 |
+
> **NOTE: Write these tests FIRST, ensure they FAIL before implementation**
|
| 86 |
+
|
| 87 |
+
- [ ] T010 [P] [US1] Contract test for [endpoint] in tests/contract/test_[name].py
|
| 88 |
+
- [ ] T011 [P] [US1] Integration test for [user journey] in tests/integration/test_[name].py
|
| 89 |
+
|
| 90 |
+
### Implementation for User Story 1
|
| 91 |
+
|
| 92 |
+
- [ ] T012 [P] [US1] Create [Entity1] model in src/models/[entity1].py
|
| 93 |
+
- [ ] T013 [P] [US1] Create [Entity2] model in src/models/[entity2].py
|
| 94 |
+
- [ ] T014 [US1] Implement [Service] in src/services/[service].py (depends on T012, T013)
|
| 95 |
+
- [ ] T015 [US1] Implement [endpoint/feature] in src/[location]/[file].py
|
| 96 |
+
- [ ] T016 [US1] Add validation and error handling
|
| 97 |
+
- [ ] T017 [US1] Add logging for user story 1 operations
|
| 98 |
+
|
| 99 |
+
**Checkpoint**: At this point, User Story 1 should be fully functional and testable independently
|
| 100 |
+
|
| 101 |
+
---
|
| 102 |
+
|
| 103 |
+
## Phase 4: User Story 2 - [Title] (Priority: P2)
|
| 104 |
+
|
| 105 |
+
**Goal**: [Brief description of what this story delivers]
|
| 106 |
+
|
| 107 |
+
**Independent Test**: [How to verify this story works on its own]
|
| 108 |
+
|
| 109 |
+
### Tests for User Story 2 (OPTIONAL - only if tests requested) ⚠️
|
| 110 |
+
|
| 111 |
+
- [ ] T018 [P] [US2] Contract test for [endpoint] in tests/contract/test_[name].py
|
| 112 |
+
- [ ] T019 [P] [US2] Integration test for [user journey] in tests/integration/test_[name].py
|
| 113 |
+
|
| 114 |
+
### Implementation for User Story 2
|
| 115 |
+
|
| 116 |
+
- [ ] T020 [P] [US2] Create [Entity] model in src/models/[entity].py
|
| 117 |
+
- [ ] T021 [US2] Implement [Service] in src/services/[service].py
|
| 118 |
+
- [ ] T022 [US2] Implement [endpoint/feature] in src/[location]/[file].py
|
| 119 |
+
- [ ] T023 [US2] Integrate with User Story 1 components (if needed)
|
| 120 |
+
|
| 121 |
+
**Checkpoint**: At this point, User Stories 1 AND 2 should both work independently
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
+
## Phase 5: User Story 3 - [Title] (Priority: P3)
|
| 126 |
+
|
| 127 |
+
**Goal**: [Brief description of what this story delivers]
|
| 128 |
+
|
| 129 |
+
**Independent Test**: [How to verify this story works on its own]
|
| 130 |
+
|
| 131 |
+
### Tests for User Story 3 (OPTIONAL - only if tests requested) ⚠️
|
| 132 |
+
|
| 133 |
+
- [ ] T024 [P] [US3] Contract test for [endpoint] in tests/contract/test_[name].py
|
| 134 |
+
- [ ] T025 [P] [US3] Integration test for [user journey] in tests/integration/test_[name].py
|
| 135 |
+
|
| 136 |
+
### Implementation for User Story 3
|
| 137 |
+
|
| 138 |
+
- [ ] T026 [P] [US3] Create [Entity] model in src/models/[entity].py
|
| 139 |
+
- [ ] T027 [US3] Implement [Service] in src/services/[service].py
|
| 140 |
+
- [ ] T028 [US3] Implement [endpoint/feature] in src/[location]/[file].py
|
| 141 |
+
|
| 142 |
+
**Checkpoint**: All user stories should now be independently functional
|
| 143 |
+
|
| 144 |
+
---
|
| 145 |
+
|
| 146 |
+
[Add more user story phases as needed, following the same pattern]
|
| 147 |
+
|
| 148 |
+
---
|
| 149 |
+
|
| 150 |
+
## Phase N: Polish & Cross-Cutting Concerns
|
| 151 |
+
|
| 152 |
+
**Purpose**: Improvements that affect multiple user stories
|
| 153 |
+
|
| 154 |
+
- [ ] TXXX [P] Documentation updates in docs/
|
| 155 |
+
- [ ] TXXX Code cleanup and refactoring
|
| 156 |
+
- [ ] TXXX Performance optimization across all stories
|
| 157 |
+
- [ ] TXXX [P] Additional unit tests (if requested) in tests/unit/
|
| 158 |
+
- [ ] TXXX Security hardening
|
| 159 |
+
- [ ] TXXX Run quickstart.md validation
|
| 160 |
+
|
| 161 |
+
---
|
| 162 |
+
|
| 163 |
+
## Dependencies & Execution Order
|
| 164 |
+
|
| 165 |
+
### Phase Dependencies
|
| 166 |
+
|
| 167 |
+
- **Setup (Phase 1)**: No dependencies - can start immediately
|
| 168 |
+
- **Foundational (Phase 2)**: Depends on Setup completion - BLOCKS all user stories
|
| 169 |
+
- **User Stories (Phase 3+)**: All depend on Foundational phase completion
|
| 170 |
+
- User stories can then proceed in parallel (if staffed)
|
| 171 |
+
- Or sequentially in priority order (P1 → P2 → P3)
|
| 172 |
+
- **Polish (Final Phase)**: Depends on all desired user stories being complete
|
| 173 |
+
|
| 174 |
+
### User Story Dependencies
|
| 175 |
+
|
| 176 |
+
- **User Story 1 (P1)**: Can start after Foundational (Phase 2) - No dependencies on other stories
|
| 177 |
+
- **User Story 2 (P2)**: Can start after Foundational (Phase 2) - May integrate with US1 but should be independently testable
|
| 178 |
+
- **User Story 3 (P3)**: Can start after Foundational (Phase 2) - May integrate with US1/US2 but should be independently testable
|
| 179 |
+
|
| 180 |
+
### Within Each User Story
|
| 181 |
+
|
| 182 |
+
- Tests (if included) MUST be written and FAIL before implementation
|
| 183 |
+
- Models before services
|
| 184 |
+
- Services before endpoints
|
| 185 |
+
- Core implementation before integration
|
| 186 |
+
- Story complete before moving to next priority
|
| 187 |
+
|
| 188 |
+
### Parallel Opportunities
|
| 189 |
+
|
| 190 |
+
- All Setup tasks marked [P] can run in parallel
|
| 191 |
+
- All Foundational tasks marked [P] can run in parallel (within Phase 2)
|
| 192 |
+
- Once Foundational phase completes, all user stories can start in parallel (if team capacity allows)
|
| 193 |
+
- All tests for a user story marked [P] can run in parallel
|
| 194 |
+
- Models within a story marked [P] can run in parallel
|
| 195 |
+
- Different user stories can be worked on in parallel by different team members
|
| 196 |
+
|
| 197 |
+
---
|
| 198 |
+
|
| 199 |
+
## Parallel Example: User Story 1
|
| 200 |
+
|
| 201 |
+
```bash
|
| 202 |
+
# Launch all tests for User Story 1 together (if tests requested):
|
| 203 |
+
Task: "Contract test for [endpoint] in tests/contract/test_[name].py"
|
| 204 |
+
Task: "Integration test for [user journey] in tests/integration/test_[name].py"
|
| 205 |
+
|
| 206 |
+
# Launch all models for User Story 1 together:
|
| 207 |
+
Task: "Create [Entity1] model in src/models/[entity1].py"
|
| 208 |
+
Task: "Create [Entity2] model in src/models/[entity2].py"
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
---
|
| 212 |
+
|
| 213 |
+
## Implementation Strategy
|
| 214 |
+
|
| 215 |
+
### MVP First (User Story 1 Only)
|
| 216 |
+
|
| 217 |
+
1. Complete Phase 1: Setup
|
| 218 |
+
2. Complete Phase 2: Foundational (CRITICAL - blocks all stories)
|
| 219 |
+
3. Complete Phase 3: User Story 1
|
| 220 |
+
4. **STOP and VALIDATE**: Test User Story 1 independently
|
| 221 |
+
5. Deploy/demo if ready
|
| 222 |
+
|
| 223 |
+
### Incremental Delivery
|
| 224 |
+
|
| 225 |
+
1. Complete Setup + Foundational → Foundation ready
|
| 226 |
+
2. Add User Story 1 → Test independently → Deploy/Demo (MVP!)
|
| 227 |
+
3. Add User Story 2 → Test independently → Deploy/Demo
|
| 228 |
+
4. Add User Story 3 → Test independently → Deploy/Demo
|
| 229 |
+
5. Each story adds value without breaking previous stories
|
| 230 |
+
|
| 231 |
+
### Parallel Team Strategy
|
| 232 |
+
|
| 233 |
+
With multiple developers:
|
| 234 |
+
|
| 235 |
+
1. Team completes Setup + Foundational together
|
| 236 |
+
2. Once Foundational is done:
|
| 237 |
+
- Developer A: User Story 1
|
| 238 |
+
- Developer B: User Story 2
|
| 239 |
+
- Developer C: User Story 3
|
| 240 |
+
3. Stories complete and integrate independently
|
| 241 |
+
|
| 242 |
+
---
|
| 243 |
+
|
| 244 |
+
## Notes
|
| 245 |
+
|
| 246 |
+
- [P] tasks = different files, no dependencies
|
| 247 |
+
- [Story] label maps task to specific user story for traceability
|
| 248 |
+
- Each user story should be independently completable and testable
|
| 249 |
+
- Verify tests fail before implementing
|
| 250 |
+
- Commit after each task or logical group
|
| 251 |
+
- Stop at any checkpoint to validate story independently
|
| 252 |
+
- Avoid: vague tasks, same file conflicts, cross-story dependencies that break independence
|
.specify/workflows/speckit/workflow.yml
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version: "1.0"
|
| 2 |
+
workflow:
|
| 3 |
+
id: "speckit"
|
| 4 |
+
name: "Full SDD Cycle"
|
| 5 |
+
version: "1.0.0"
|
| 6 |
+
author: "GitHub"
|
| 7 |
+
description: "Runs specify → plan → tasks → implement with review gates"
|
| 8 |
+
|
| 9 |
+
requires:
|
| 10 |
+
# 0.8.5 is the first release with engine-side resolution of the
|
| 11 |
+
# ``integration: "auto"`` default. Older versions would treat "auto"
|
| 12 |
+
# as a literal integration key and fail at dispatch.
|
| 13 |
+
speckit_version: ">=0.8.5"
|
| 14 |
+
integrations:
|
| 15 |
+
# The four commands below (specify, plan, tasks, implement) are core
|
| 16 |
+
# spec-kit commands provided by every integration. The list here is an
|
| 17 |
+
# advisory, non-exhaustive compatibility hint following the documented
|
| 18 |
+
# ``any: [...]`` schema -- it is NOT a closed set. The workflow runs
|
| 19 |
+
# against any integration the project was initialized with, including
|
| 20 |
+
# ones not listed below, as long as that integration provides the four
|
| 21 |
+
# core commands referenced in ``steps``.
|
| 22 |
+
any:
|
| 23 |
+
- "claude"
|
| 24 |
+
- "copilot"
|
| 25 |
+
- "gemini"
|
| 26 |
+
- "opencode"
|
| 27 |
+
|
| 28 |
+
inputs:
|
| 29 |
+
spec:
|
| 30 |
+
type: string
|
| 31 |
+
required: true
|
| 32 |
+
prompt: "Describe what you want to build"
|
| 33 |
+
integration:
|
| 34 |
+
type: string
|
| 35 |
+
default: "auto"
|
| 36 |
+
prompt: "Integration to use (e.g. claude, copilot, gemini; 'auto' uses the project's initialized integration)"
|
| 37 |
+
scope:
|
| 38 |
+
type: string
|
| 39 |
+
default: "full"
|
| 40 |
+
enum: ["full", "backend-only", "frontend-only"]
|
| 41 |
+
|
| 42 |
+
steps:
|
| 43 |
+
- id: specify
|
| 44 |
+
command: speckit.specify
|
| 45 |
+
integration: "{{ inputs.integration }}"
|
| 46 |
+
input:
|
| 47 |
+
args: "{{ inputs.spec }}"
|
| 48 |
+
|
| 49 |
+
- id: review-spec
|
| 50 |
+
type: gate
|
| 51 |
+
message: "Review the generated spec before planning."
|
| 52 |
+
options: [approve, reject]
|
| 53 |
+
on_reject: abort
|
| 54 |
+
|
| 55 |
+
- id: plan
|
| 56 |
+
command: speckit.plan
|
| 57 |
+
integration: "{{ inputs.integration }}"
|
| 58 |
+
input:
|
| 59 |
+
args: "{{ inputs.spec }}"
|
| 60 |
+
|
| 61 |
+
- id: review-plan
|
| 62 |
+
type: gate
|
| 63 |
+
message: "Review the plan before generating tasks."
|
| 64 |
+
options: [approve, reject]
|
| 65 |
+
on_reject: abort
|
| 66 |
+
|
| 67 |
+
- id: tasks
|
| 68 |
+
command: speckit.tasks
|
| 69 |
+
integration: "{{ inputs.integration }}"
|
| 70 |
+
input:
|
| 71 |
+
args: "{{ inputs.spec }}"
|
| 72 |
+
|
| 73 |
+
- id: implement
|
| 74 |
+
command: speckit.implement
|
| 75 |
+
integration: "{{ inputs.integration }}"
|
| 76 |
+
input:
|
| 77 |
+
args: "{{ inputs.spec }}"
|
.specify/workflows/workflow-registry.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "1.0",
|
| 3 |
+
"workflows": {
|
| 4 |
+
"speckit": {
|
| 5 |
+
"name": "Full SDD Cycle",
|
| 6 |
+
"version": "1.0.0",
|
| 7 |
+
"description": "Runs specify \u2192 plan \u2192 tasks \u2192 implement with review gates",
|
| 8 |
+
"source": "bundled",
|
| 9 |
+
"installed_at": "2026-06-28T05:08:07.153469+00:00",
|
| 10 |
+
"updated_at": "2026-06-28T05:08:07.153491+00:00"
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
}
|
AGENTS.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Agent Guidelines (AGENTS.md)
|
| 2 |
+
|
| 3 |
+
Welcome! This file outlines developer guidelines, operational constraints, and guidelines for AI pair programmers working on this repository.
|
| 4 |
+
|
| 5 |
+
## Operational Standards
|
| 6 |
+
|
| 7 |
+
- **Code Styling**: Python code must format cleanly via Ruff. Run `ruff check` and `ruff format` before pushing.
|
| 8 |
+
- **Typing Guidelines**: Maintain correct mypy typing annotations. Type signatures must be explicitly defined where possible.
|
| 9 |
+
- **Database Safety**: Ensure database schemas are updated dynamically using self-healing auto-migrations in `Store.init_db()`.
|
| 10 |
+
- **GitLab CI/CD**: Ensure the 8 quality-gate pipeline stages remain green and functional.
|
| 11 |
+
- **Security Checklists**: Do not commit credentials or secrets. Ensure Bandit scans return zero warnings.
|
CHANGELOG.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Changelog
|
| 2 |
+
|
| 3 |
+
## [0.2.0] - 2026-06-30
|
| 4 |
+
|
| 5 |
+
### Added
|
| 6 |
+
- Upgraded handwriting OCR from TrOCR-small to TrOCR-base for higher accuracy
|
| 7 |
+
- Added Whisper GGUF model (tiny.en Q5_0) for audio transcription, replacing CMU Sphinx as primary
|
| 8 |
+
- Parallel batch processing with ThreadPoolExecutor for multi-file ingestion
|
| 9 |
+
- Adaptive OpenCV preprocessing that auto-tunes parameters based on image brightness/std
|
| 10 |
+
- Barcode/QR detection via pyzbar integration
|
| 11 |
+
- Table structure detection from images
|
| 12 |
+
- Multi-page PDF batch processing support
|
| 13 |
+
- Auto-schema detection (auto-detects todo/meeting/recipe/survey/notes schemas)
|
| 14 |
+
- Differential sync (hash-based duplicate detection to skip re-processing)
|
| 15 |
+
- Webhook support for external integrations (configurable URL + secret)
|
| 16 |
+
- Offline TTS via pyttsx3 endpoint
|
| 17 |
+
- Structured logging via structlog
|
| 18 |
+
- Request tracing with correlation IDs (X-Request-ID header)
|
| 19 |
+
- Prometheus metrics endpoint (/metrics)
|
| 20 |
+
- Dockerfile for containerized deployment
|
| 21 |
+
- End-to-end Playwright test suite
|
| 22 |
+
- Performance benchmark script (scripts/benchmark.py)
|
| 23 |
+
- Model update checker (scripts/check_model_updates.py)
|
| 24 |
+
- Batch file upload in web UI (drag multiple files or use Batch button)
|
| 25 |
+
- Camera capture support in web UI
|
| 26 |
+
- Desktop app support via Tauri config and pywebview
|
| 27 |
+
- PWA service worker for offline caching
|
| 28 |
+
- Light/dark mode toggle with system preference detection
|
| 29 |
+
- Keyboard shortcuts (1-4 for views, T for theme, ? for settings, Esc to close)
|
| 30 |
+
- Settings modal with webhook configuration and shortcut reference
|
| 31 |
+
- Spreadsheet support (XLSX/XLS via pandas)
|
| 32 |
+
- New schema types: survey, notes, auto-detect
|
| 33 |
+
- Stats endpoint (/stats)
|
| 34 |
+
|
| 35 |
+
### Changed
|
| 36 |
+
- Updated fetch_models.py to download TrOCR-base and Whisper models
|
| 37 |
+
- Enhanced SourceParseResult schema with barcodes and tables fields
|
| 38 |
+
- SQLite schema updated with content_hash, barcodes, tables columns
|
| 39 |
+
- Frontend API service now supports auto-schema detection
|
| 40 |
+
- Responsive layout improvements
|
| 41 |
+
- CSS transitions for light/dark theme switching
|
| 42 |
+
|
| 43 |
+
### Fixed
|
| 44 |
+
- Graceful fallback chain: Whisper → Sphinx for audio
|
| 45 |
+
- Better error handling in OCR pipelines
|
| 46 |
+
- CORS and CSP configuration for desktop app
|
CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Contributor Covenant Code of Conduct
|
| 2 |
+
|
| 3 |
+
## Our Pledge
|
| 4 |
+
|
| 5 |
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
| 6 |
+
|
| 7 |
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
| 8 |
+
|
| 9 |
+
## Our Standards
|
| 10 |
+
|
| 11 |
+
Examples of behavior that contributes to a positive environment for our community include:
|
| 12 |
+
* Demonstrating empathy and kindness toward other people.
|
| 13 |
+
* Being respectful of differing opinions, viewpoints, and experiences.
|
| 14 |
+
* Giving and gracefully accepting constructive feedback.
|
| 15 |
+
* Accepting responsibility and apologizing to those affected by our mistakes.
|
| 16 |
+
* Focusing on what is best for the overall community.
|
| 17 |
+
|
| 18 |
+
Examples of unacceptable behavior include:
|
| 19 |
+
* The use of sexualized language or imagery, and unwelcome sexual attention or advances.
|
| 20 |
+
* Trolling, insulting or derogatory comments, and personal or political attacks.
|
| 21 |
+
* Public or private harassment.
|
| 22 |
+
* Publishing others' private information without explicit permission.
|
| 23 |
+
* Other conduct which could reasonably be considered inappropriate in a professional setting.
|
CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
SPDX-FileCopyrightText: 2026 Team Centurions
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-or-later
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
# Contributing to PageParse
|
| 7 |
+
|
| 8 |
+
Thank you for your interest in contributing to PageParse! Since we are building an offline-first, CPU-only engine for parsing handwriting, we hold our code quality to high standards.
|
| 9 |
+
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
## Code Quality Standards
|
| 13 |
+
|
| 14 |
+
Before submitting any code changes, ensure your environment is fully compliant with our local quality gates:
|
| 15 |
+
|
| 16 |
+
1. **Linting and Formatting:**
|
| 17 |
+
We enforce formatting using `ruff` and `ruff-format`. Code style rules are defined in [pyproject.toml](pyproject.toml).
|
| 18 |
+
|
| 19 |
+
2. **Type Safety:**
|
| 20 |
+
We use strict type checking via `mypy`. All new functions and files must be fully typed.
|
| 21 |
+
|
| 22 |
+
3. **Security Analysis:**
|
| 23 |
+
All changes undergo static security analysis using `bandit` to prevent issues like command injections or insecure library usage. We also run credential scans to ensure no secrets are checked into the repo.
|
| 24 |
+
|
| 25 |
+
4. **Dependency Auditing:**
|
| 26 |
+
We run `pip-audit` to guarantee that no dependencies with known CVEs are imported.
|
| 27 |
+
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
## Development Workflow
|
| 31 |
+
|
| 32 |
+
1. **Clone and Setup:**
|
| 33 |
+
```bash
|
| 34 |
+
git clone https://code.swecha.org/centurions/pageparse.git
|
| 35 |
+
cd pageparse
|
| 36 |
+
python -m venv .venv
|
| 37 |
+
source .venv/bin/activate
|
| 38 |
+
pip install -e ".[dev]"
|
| 39 |
+
pre-commit install
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
2. **Branching Strategy:**
|
| 43 |
+
- Always branch off `main`.
|
| 44 |
+
- Name your branch descriptively, e.g., `feat/printed-fallback` or `fix/telemetry-memory`.
|
| 45 |
+
|
| 46 |
+
3. **Conventional Commits:**
|
| 47 |
+
We enforce the **Conventional Commits** specification for all commit messages. Commits must follow this pattern:
|
| 48 |
+
`<type>(<scope>): <description>`
|
| 49 |
+
|
| 50 |
+
Common types include:
|
| 51 |
+
- `feat`: A new feature.
|
| 52 |
+
- `fix`: A bug fix.
|
| 53 |
+
- `docs`: Documentation updates.
|
| 54 |
+
- `style`: Code style changes (formatting, white-space, etc.).
|
| 55 |
+
- `refactor`: Code reorganization without behavior change.
|
| 56 |
+
- `test`: Adding or modifying tests.
|
| 57 |
+
- `ci`: CI/CD or build process updates.
|
| 58 |
+
- `chore`: Generic maintenance tasks.
|
| 59 |
+
|
| 60 |
+
4. **Running Quality Checks Locally:**
|
| 61 |
+
Before committing, run:
|
| 62 |
+
```bash
|
| 63 |
+
# Run all formatters, linters, and type-checks
|
| 64 |
+
pre-commit run --all-files
|
| 65 |
+
|
| 66 |
+
# Run all unit and integration tests
|
| 67 |
+
pytest
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
5. **Submitting a Merge Request (MR):**
|
| 71 |
+
Once your local checks pass, push your branch and open an MR. Ensure that the self-hosted GitLab runner completes the CI pipeline successfully.
|
Dockerfile
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12-slim-bookworm
|
| 2 |
+
|
| 3 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 4 |
+
build-essential \
|
| 5 |
+
cmake \
|
| 6 |
+
gcc \
|
| 7 |
+
g++ \
|
| 8 |
+
tesseract-ocr \
|
| 9 |
+
tesseract-ocr-eng \
|
| 10 |
+
ffmpeg \
|
| 11 |
+
libgl1-mesa-glx \
|
| 12 |
+
libglib2.0-0 \
|
| 13 |
+
libsm6 \
|
| 14 |
+
libxext6 \
|
| 15 |
+
libxrender-dev \
|
| 16 |
+
libgomp1 \
|
| 17 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
+
|
| 19 |
+
WORKDIR /app
|
| 20 |
+
|
| 21 |
+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
| 22 |
+
|
| 23 |
+
COPY pyproject.toml README.md ./
|
| 24 |
+
COPY src/ ./src/
|
| 25 |
+
COPY grammars/ ./grammars/
|
| 26 |
+
COPY web/ ./web/
|
| 27 |
+
COPY scripts/ ./scripts/
|
| 28 |
+
|
| 29 |
+
RUN mkdir -p models && \
|
| 30 |
+
pip install --no-cache-dir -e . && \
|
| 31 |
+
pip install --no-cache-dir -e .[web]
|
| 32 |
+
|
| 33 |
+
EXPOSE 7860
|
| 34 |
+
|
| 35 |
+
VOLUME ["/app/models", "/app/web/static/uploads", "/app/pageparse.db"]
|
| 36 |
+
|
| 37 |
+
ENV PYTHONUNBUFFERED=1
|
| 38 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 39 |
+
|
| 40 |
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
| 41 |
+
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/telemetry')" || exit 1
|
| 42 |
+
|
| 43 |
+
ENTRYPOINT ["python", "-m", "pageparse.cli", "serve", "--host", "0.0.0.0", "--port", "7860"]
|
GEMINI.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
SPDX-FileCopyrightText: 2026 Team Centurions
|
| 3 |
+
SPDX-License-Identifier: AGPL-3.0-or-later
|
| 4 |
+
-->
|
| 5 |
+
|
| 6 |
+
<!-- SPECKIT START -->
|
| 7 |
+
For additional context about technologies to be used, project structure,
|
| 8 |
+
shell commands, and other important information, read the current plan
|
| 9 |
+
<!-- SPECKIT END -->
|