Spaces:
Paused
Paused
Commit Β·
5fa2c7a
1
Parent(s): 6817f18
fix(layout,components): legal positioning and component cleanup
Browse filesThis view is limited to 50 files because it contains too many changes. Β See raw diff
- .specify/extensions.yml +149 -0
- .specify/extensions/.registry +15 -0
- .specify/extensions/git/README.md +100 -0
- .specify/extensions/git/commands/speckit.git.commit.md +48 -0
- .specify/extensions/git/commands/speckit.git.feature.md +67 -0
- .specify/extensions/git/commands/speckit.git.initialize.md +49 -0
- .specify/extensions/git/commands/speckit.git.remote.md +45 -0
- .specify/extensions/git/commands/speckit.git.validate.md +49 -0
- .specify/extensions/git/config-template.yml +62 -0
- .specify/extensions/git/extension.yml +140 -0
- .specify/extensions/git/git-config.yml +62 -0
- .specify/extensions/git/scripts/bash/auto-commit.sh +140 -0
- .specify/extensions/git/scripts/bash/create-new-feature.sh +453 -0
- .specify/extensions/git/scripts/bash/git-common.sh +54 -0
- .specify/extensions/git/scripts/bash/initialize-repo.sh +54 -0
- .specify/extensions/git/scripts/powershell/auto-commit.ps1 +169 -0
- .specify/extensions/git/scripts/powershell/create-new-feature.ps1 +403 -0
- .specify/extensions/git/scripts/powershell/git-common.ps1 +51 -0
- .specify/extensions/git/scripts/powershell/initialize-repo.ps1 +69 -0
- .specify/init-options.json +9 -0
- .specify/integration.json +19 -0
- .specify/integrations/generic.manifest.json +16 -0
- .specify/integrations/speckit.manifest.json +17 -0
- .specify/memory/constitution.md +48 -0
- .specify/scripts/powershell/check-prerequisites.ps1 +148 -0
- .specify/scripts/powershell/common.ps1 +643 -0
- .specify/scripts/powershell/create-new-feature.ps1 +385 -0
- .specify/scripts/powershell/setup-plan.ps1 +65 -0
- .specify/scripts/powershell/setup-tasks.ps1 +74 -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 +5 -0
- app/layout.tsx +3 -3
- components/DeveloperWorkflowsSection.tsx +1 -1
- components/LLMProviderIconCloud.tsx +1 -1
- components/TrustSection.tsx +2 -2
- components/faq-accordion.tsx +1 -1
- components/header.tsx +2 -2
- components/hero-section.tsx +2 -0
- components/waitlist-form.tsx +2 -2
- data/ecosystem-catalog.ts +2 -2
- specs/status-page-i18n/analysis.md +61 -0
- specs/status-page-i18n/checklists/code-quality.md +20 -0
- specs/status-page-i18n/checklists/data.md +10 -0
- specs/status-page-i18n/checklists/security.md +10 -0
.specify/extensions.yml
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
installed:
|
| 2 |
+
- git
|
| 3 |
+
settings:
|
| 4 |
+
auto_execute_hooks: true
|
| 5 |
+
hooks:
|
| 6 |
+
before_constitution:
|
| 7 |
+
- extension: git
|
| 8 |
+
command: speckit.git.initialize
|
| 9 |
+
enabled: true
|
| 10 |
+
optional: false
|
| 11 |
+
prompt: Execute speckit.git.initialize?
|
| 12 |
+
description: Initialize Git repository before constitution setup
|
| 13 |
+
condition: null
|
| 14 |
+
before_specify:
|
| 15 |
+
- extension: git
|
| 16 |
+
command: speckit.git.feature
|
| 17 |
+
enabled: true
|
| 18 |
+
optional: false
|
| 19 |
+
prompt: Execute speckit.git.feature?
|
| 20 |
+
description: Create feature branch before specification
|
| 21 |
+
condition: null
|
| 22 |
+
before_clarify:
|
| 23 |
+
- extension: git
|
| 24 |
+
command: speckit.git.commit
|
| 25 |
+
enabled: true
|
| 26 |
+
optional: true
|
| 27 |
+
prompt: Commit outstanding changes before clarification?
|
| 28 |
+
description: Auto-commit before spec clarification
|
| 29 |
+
condition: null
|
| 30 |
+
before_plan:
|
| 31 |
+
- extension: git
|
| 32 |
+
command: speckit.git.commit
|
| 33 |
+
enabled: true
|
| 34 |
+
optional: true
|
| 35 |
+
prompt: Commit outstanding changes before planning?
|
| 36 |
+
description: Auto-commit before implementation planning
|
| 37 |
+
condition: null
|
| 38 |
+
before_tasks:
|
| 39 |
+
- extension: git
|
| 40 |
+
command: speckit.git.commit
|
| 41 |
+
enabled: true
|
| 42 |
+
optional: true
|
| 43 |
+
prompt: Commit outstanding changes before task generation?
|
| 44 |
+
description: Auto-commit before task generation
|
| 45 |
+
condition: null
|
| 46 |
+
before_implement:
|
| 47 |
+
- extension: git
|
| 48 |
+
command: speckit.git.commit
|
| 49 |
+
enabled: true
|
| 50 |
+
optional: true
|
| 51 |
+
prompt: Commit outstanding changes before implementation?
|
| 52 |
+
description: Auto-commit before implementation
|
| 53 |
+
condition: null
|
| 54 |
+
before_checklist:
|
| 55 |
+
- extension: git
|
| 56 |
+
command: speckit.git.commit
|
| 57 |
+
enabled: true
|
| 58 |
+
optional: true
|
| 59 |
+
prompt: Commit outstanding changes before checklist?
|
| 60 |
+
description: Auto-commit before checklist generation
|
| 61 |
+
condition: null
|
| 62 |
+
before_analyze:
|
| 63 |
+
- extension: git
|
| 64 |
+
command: speckit.git.commit
|
| 65 |
+
enabled: true
|
| 66 |
+
optional: true
|
| 67 |
+
prompt: Commit outstanding changes before analysis?
|
| 68 |
+
description: Auto-commit before analysis
|
| 69 |
+
condition: null
|
| 70 |
+
before_taskstoissues:
|
| 71 |
+
- extension: git
|
| 72 |
+
command: speckit.git.commit
|
| 73 |
+
enabled: true
|
| 74 |
+
optional: true
|
| 75 |
+
prompt: Commit outstanding changes before issue sync?
|
| 76 |
+
description: Auto-commit before tasks-to-issues conversion
|
| 77 |
+
condition: null
|
| 78 |
+
after_constitution:
|
| 79 |
+
- extension: git
|
| 80 |
+
command: speckit.git.commit
|
| 81 |
+
enabled: true
|
| 82 |
+
optional: true
|
| 83 |
+
prompt: Commit constitution changes?
|
| 84 |
+
description: Auto-commit after constitution update
|
| 85 |
+
condition: null
|
| 86 |
+
after_specify:
|
| 87 |
+
- extension: git
|
| 88 |
+
command: speckit.git.commit
|
| 89 |
+
enabled: true
|
| 90 |
+
optional: true
|
| 91 |
+
prompt: Commit specification changes?
|
| 92 |
+
description: Auto-commit after specification
|
| 93 |
+
condition: null
|
| 94 |
+
after_clarify:
|
| 95 |
+
- extension: git
|
| 96 |
+
command: speckit.git.commit
|
| 97 |
+
enabled: true
|
| 98 |
+
optional: true
|
| 99 |
+
prompt: Commit clarification changes?
|
| 100 |
+
description: Auto-commit after spec clarification
|
| 101 |
+
condition: null
|
| 102 |
+
after_plan:
|
| 103 |
+
- extension: git
|
| 104 |
+
command: speckit.git.commit
|
| 105 |
+
enabled: true
|
| 106 |
+
optional: true
|
| 107 |
+
prompt: Commit plan changes?
|
| 108 |
+
description: Auto-commit after implementation planning
|
| 109 |
+
condition: null
|
| 110 |
+
after_tasks:
|
| 111 |
+
- extension: git
|
| 112 |
+
command: speckit.git.commit
|
| 113 |
+
enabled: true
|
| 114 |
+
optional: true
|
| 115 |
+
prompt: Commit task changes?
|
| 116 |
+
description: Auto-commit after task generation
|
| 117 |
+
condition: null
|
| 118 |
+
after_implement:
|
| 119 |
+
- extension: git
|
| 120 |
+
command: speckit.git.commit
|
| 121 |
+
enabled: true
|
| 122 |
+
optional: true
|
| 123 |
+
prompt: Commit implementation changes?
|
| 124 |
+
description: Auto-commit after implementation
|
| 125 |
+
condition: null
|
| 126 |
+
after_checklist:
|
| 127 |
+
- extension: git
|
| 128 |
+
command: speckit.git.commit
|
| 129 |
+
enabled: true
|
| 130 |
+
optional: true
|
| 131 |
+
prompt: Commit checklist changes?
|
| 132 |
+
description: Auto-commit after checklist generation
|
| 133 |
+
condition: null
|
| 134 |
+
after_analyze:
|
| 135 |
+
- extension: git
|
| 136 |
+
command: speckit.git.commit
|
| 137 |
+
enabled: true
|
| 138 |
+
optional: true
|
| 139 |
+
prompt: Commit analysis results?
|
| 140 |
+
description: Auto-commit after analysis
|
| 141 |
+
condition: null
|
| 142 |
+
after_taskstoissues:
|
| 143 |
+
- extension: git
|
| 144 |
+
command: speckit.git.commit
|
| 145 |
+
enabled: true
|
| 146 |
+
optional: true
|
| 147 |
+
prompt: Commit after syncing issues?
|
| 148 |
+
description: Auto-commit after tasks-to-issues conversion
|
| 149 |
+
condition: null
|
.specify/extensions/.registry
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "1.0",
|
| 3 |
+
"extensions": {
|
| 4 |
+
"git": {
|
| 5 |
+
"version": "1.0.0",
|
| 6 |
+
"source": "local",
|
| 7 |
+
"manifest_hash": "sha256:9731aa8143a72fbebfdb440f155038ab42642517c2b2bdbbf67c8fdbe076ed79",
|
| 8 |
+
"enabled": true,
|
| 9 |
+
"priority": 10,
|
| 10 |
+
"registered_commands": {},
|
| 11 |
+
"registered_skills": [],
|
| 12 |
+
"installed_at": "2026-05-22T14:36:15.765184+00:00"
|
| 13 |
+
}
|
| 14 |
+
}
|
| 15 |
+
}
|
.specify/extensions/git/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Git Branching Workflow Extension
|
| 2 |
+
|
| 3 |
+
Git repository initialization, feature branch creation, numbering (sequential/timestamp), validation, remote detection, and auto-commit for Spec Kit.
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
|
| 7 |
+
This extension provides Git operations as an optional, self-contained module. It manages:
|
| 8 |
+
|
| 9 |
+
- **Repository initialization** with configurable commit messages
|
| 10 |
+
- **Feature branch creation** with sequential (`001-feature-name`) or timestamp (`20260319-143022-feature-name`) numbering
|
| 11 |
+
- **Branch validation** to ensure branches follow naming conventions
|
| 12 |
+
- **Git remote detection** for GitHub integration (e.g., issue creation)
|
| 13 |
+
- **Auto-commit** after core commands (configurable per-command with custom messages)
|
| 14 |
+
|
| 15 |
+
## Commands
|
| 16 |
+
|
| 17 |
+
| Command | Description |
|
| 18 |
+
|---------|-------------|
|
| 19 |
+
| `speckit.git.initialize` | Initialize a Git repository with a configurable commit message |
|
| 20 |
+
| `speckit.git.feature` | Create a feature branch with sequential or timestamp numbering |
|
| 21 |
+
| `speckit.git.validate` | Validate current branch follows feature branch naming conventions |
|
| 22 |
+
| `speckit.git.remote` | Detect Git remote URL for GitHub integration |
|
| 23 |
+
| `speckit.git.commit` | Auto-commit changes (configurable per-command enable/disable and messages) |
|
| 24 |
+
|
| 25 |
+
## Hooks
|
| 26 |
+
|
| 27 |
+
| Event | Command | Optional | Description |
|
| 28 |
+
|-------|---------|----------|-------------|
|
| 29 |
+
| `before_constitution` | `speckit.git.initialize` | No | Init git repo before constitution |
|
| 30 |
+
| `before_specify` | `speckit.git.feature` | No | Create feature branch before specification |
|
| 31 |
+
| `before_clarify` | `speckit.git.commit` | Yes | Commit outstanding changes before clarification |
|
| 32 |
+
| `before_plan` | `speckit.git.commit` | Yes | Commit outstanding changes before planning |
|
| 33 |
+
| `before_tasks` | `speckit.git.commit` | Yes | Commit outstanding changes before task generation |
|
| 34 |
+
| `before_implement` | `speckit.git.commit` | Yes | Commit outstanding changes before implementation |
|
| 35 |
+
| `before_checklist` | `speckit.git.commit` | Yes | Commit outstanding changes before checklist |
|
| 36 |
+
| `before_analyze` | `speckit.git.commit` | Yes | Commit outstanding changes before analysis |
|
| 37 |
+
| `before_taskstoissues` | `speckit.git.commit` | Yes | Commit outstanding changes before issue sync |
|
| 38 |
+
| `after_constitution` | `speckit.git.commit` | Yes | Auto-commit after constitution update |
|
| 39 |
+
| `after_specify` | `speckit.git.commit` | Yes | Auto-commit after specification |
|
| 40 |
+
| `after_clarify` | `speckit.git.commit` | Yes | Auto-commit after clarification |
|
| 41 |
+
| `after_plan` | `speckit.git.commit` | Yes | Auto-commit after planning |
|
| 42 |
+
| `after_tasks` | `speckit.git.commit` | Yes | Auto-commit after task generation |
|
| 43 |
+
| `after_implement` | `speckit.git.commit` | Yes | Auto-commit after implementation |
|
| 44 |
+
| `after_checklist` | `speckit.git.commit` | Yes | Auto-commit after checklist |
|
| 45 |
+
| `after_analyze` | `speckit.git.commit` | Yes | Auto-commit after analysis |
|
| 46 |
+
| `after_taskstoissues` | `speckit.git.commit` | Yes | Auto-commit after issue sync |
|
| 47 |
+
|
| 48 |
+
## Configuration
|
| 49 |
+
|
| 50 |
+
Configuration is stored in `.specify/extensions/git/git-config.yml`:
|
| 51 |
+
|
| 52 |
+
```yaml
|
| 53 |
+
# Branch numbering strategy: "sequential" or "timestamp"
|
| 54 |
+
branch_numbering: sequential
|
| 55 |
+
|
| 56 |
+
# Custom commit message for git init
|
| 57 |
+
init_commit_message: "[Spec Kit] Initial commit"
|
| 58 |
+
|
| 59 |
+
# Auto-commit per command (all disabled by default)
|
| 60 |
+
# Example: enable auto-commit after specify
|
| 61 |
+
auto_commit:
|
| 62 |
+
default: false
|
| 63 |
+
after_specify:
|
| 64 |
+
enabled: true
|
| 65 |
+
message: "[Spec Kit] Add specification"
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Installation
|
| 69 |
+
|
| 70 |
+
```bash
|
| 71 |
+
# Install the bundled git extension (no network required)
|
| 72 |
+
specify extension add git
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## Disabling
|
| 76 |
+
|
| 77 |
+
```bash
|
| 78 |
+
# Disable the git extension (spec creation continues without branching)
|
| 79 |
+
specify extension disable git
|
| 80 |
+
|
| 81 |
+
# Re-enable it
|
| 82 |
+
specify extension enable git
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
## Graceful Degradation
|
| 86 |
+
|
| 87 |
+
When Git is not installed or the directory is not a Git repository:
|
| 88 |
+
- Spec directories are still created under `specs/`
|
| 89 |
+
- Branch creation is skipped with a warning
|
| 90 |
+
- Branch validation is skipped with a warning
|
| 91 |
+
- Remote detection returns empty results
|
| 92 |
+
|
| 93 |
+
## Scripts
|
| 94 |
+
|
| 95 |
+
The extension bundles cross-platform scripts:
|
| 96 |
+
|
| 97 |
+
- `scripts/bash/create-new-feature.sh` β Bash implementation
|
| 98 |
+
- `scripts/bash/git-common.sh` β Shared Git utilities (Bash)
|
| 99 |
+
- `scripts/powershell/create-new-feature.ps1` β PowerShell implementation
|
| 100 |
+
- `scripts/powershell/git-common.ps1` β Shared Git utilities (PowerShell)
|
.specify/extensions/git/commands/speckit.git.commit.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: "Auto-commit changes after a Spec Kit command completes"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Auto-Commit Changes
|
| 6 |
+
|
| 7 |
+
Automatically stage and commit all changes after a Spec Kit command completes.
|
| 8 |
+
|
| 9 |
+
## Behavior
|
| 10 |
+
|
| 11 |
+
This command is invoked as a hook after (or before) core commands. It:
|
| 12 |
+
|
| 13 |
+
1. Determines the event name from the hook context (e.g., if invoked as an `after_specify` hook, the event is `after_specify`; if `before_plan`, the event is `before_plan`)
|
| 14 |
+
2. Checks `.specify/extensions/git/git-config.yml` for the `auto_commit` section
|
| 15 |
+
3. Looks up the specific event key to see if auto-commit is enabled
|
| 16 |
+
4. Falls back to `auto_commit.default` if no event-specific key exists
|
| 17 |
+
5. Uses the per-command `message` if configured, otherwise a default message
|
| 18 |
+
6. If enabled and there are uncommitted changes, runs `git add .` + `git commit`
|
| 19 |
+
|
| 20 |
+
## Execution
|
| 21 |
+
|
| 22 |
+
Determine the event name from the hook that triggered this command, then run the script:
|
| 23 |
+
|
| 24 |
+
- **Bash**: `.specify/extensions/git/scripts/bash/auto-commit.sh <event_name>`
|
| 25 |
+
- **PowerShell**: `.specify/extensions/git/scripts/powershell/auto-commit.ps1 <event_name>`
|
| 26 |
+
|
| 27 |
+
Replace `<event_name>` with the actual hook event (e.g., `after_specify`, `before_plan`, `after_implement`).
|
| 28 |
+
|
| 29 |
+
## Configuration
|
| 30 |
+
|
| 31 |
+
In `.specify/extensions/git/git-config.yml`:
|
| 32 |
+
|
| 33 |
+
```yaml
|
| 34 |
+
auto_commit:
|
| 35 |
+
default: false # Global toggle β set true to enable for all commands
|
| 36 |
+
after_specify:
|
| 37 |
+
enabled: true # Override per-command
|
| 38 |
+
message: "[Spec Kit] Add specification"
|
| 39 |
+
after_plan:
|
| 40 |
+
enabled: false
|
| 41 |
+
message: "[Spec Kit] Add implementation plan"
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
## Graceful Degradation
|
| 45 |
+
|
| 46 |
+
- If Git is not available or the current directory is not a repository: skips with a warning
|
| 47 |
+
- If no config file exists: skips (disabled by default)
|
| 48 |
+
- If no changes to commit: skips with a message
|
.specify/extensions/git/commands/speckit.git.feature.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: "Create a feature branch with sequential or timestamp numbering"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Create Feature Branch
|
| 6 |
+
|
| 7 |
+
Create and switch to a new git feature branch for the given specification. This command handles **branch creation only** β the spec directory and files are created by the core `__SPECKIT_COMMAND_SPECIFY__` workflow.
|
| 8 |
+
|
| 9 |
+
## User Input
|
| 10 |
+
|
| 11 |
+
```text
|
| 12 |
+
$ARGUMENTS
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 16 |
+
|
| 17 |
+
## Environment Variable Override
|
| 18 |
+
|
| 19 |
+
If the user explicitly provided `GIT_BRANCH_NAME` (e.g., via environment variable, argument, or in their request), pass it through to the script by setting the `GIT_BRANCH_NAME` environment variable before invoking the script. When `GIT_BRANCH_NAME` is set:
|
| 20 |
+
- The script uses the exact value as the branch name, bypassing all prefix/suffix generation
|
| 21 |
+
- `--short-name`, `--number`, and `--timestamp` flags are ignored
|
| 22 |
+
- `FEATURE_NUM` is extracted from the name if it starts with a numeric prefix, otherwise set to the full branch name
|
| 23 |
+
|
| 24 |
+
## Prerequisites
|
| 25 |
+
|
| 26 |
+
- Verify Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
| 27 |
+
- If Git is not available, warn the user and skip branch creation
|
| 28 |
+
|
| 29 |
+
## Branch Numbering Mode
|
| 30 |
+
|
| 31 |
+
Determine the branch numbering strategy by checking configuration in this order:
|
| 32 |
+
|
| 33 |
+
1. Check `.specify/extensions/git/git-config.yml` for `branch_numbering` value
|
| 34 |
+
2. Check `.specify/init-options.json` for `branch_numbering` value (backward compatibility)
|
| 35 |
+
3. Default to `sequential` if neither exists
|
| 36 |
+
|
| 37 |
+
## Execution
|
| 38 |
+
|
| 39 |
+
Generate a concise short name (2-4 words) for the branch:
|
| 40 |
+
- Analyze the feature description and extract the most meaningful keywords
|
| 41 |
+
- Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
|
| 42 |
+
- Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
|
| 43 |
+
|
| 44 |
+
Run the appropriate script based on your platform:
|
| 45 |
+
|
| 46 |
+
- **Bash**: `.specify/extensions/git/scripts/bash/create-new-feature.sh --json --short-name "<short-name>" "<feature description>"`
|
| 47 |
+
- **Bash (timestamp)**: `.specify/extensions/git/scripts/bash/create-new-feature.sh --json --timestamp --short-name "<short-name>" "<feature description>"`
|
| 48 |
+
- **PowerShell**: `.specify/extensions/git/scripts/powershell/create-new-feature.ps1 -Json -ShortName "<short-name>" "<feature description>"`
|
| 49 |
+
- **PowerShell (timestamp)**: `.specify/extensions/git/scripts/powershell/create-new-feature.ps1 -Json -Timestamp -ShortName "<short-name>" "<feature description>"`
|
| 50 |
+
|
| 51 |
+
**IMPORTANT**:
|
| 52 |
+
- Do NOT pass `--number` β the script determines the correct next number automatically
|
| 53 |
+
- Always include the JSON flag (`--json` for Bash, `-Json` for PowerShell) so the output can be parsed reliably
|
| 54 |
+
- You must only ever run this script once per feature
|
| 55 |
+
- The JSON output will contain `BRANCH_NAME` and `FEATURE_NUM`
|
| 56 |
+
|
| 57 |
+
## Graceful Degradation
|
| 58 |
+
|
| 59 |
+
If Git is not installed or the current directory is not a Git repository:
|
| 60 |
+
- Branch creation is skipped with a warning: `[specify] Warning: Git repository not detected; skipped branch creation`
|
| 61 |
+
- The script still outputs `BRANCH_NAME` and `FEATURE_NUM` so the caller can reference them
|
| 62 |
+
|
| 63 |
+
## Output
|
| 64 |
+
|
| 65 |
+
The script outputs JSON with:
|
| 66 |
+
- `BRANCH_NAME`: The branch name (e.g., `003-user-auth` or `20260319-143022-user-auth`)
|
| 67 |
+
- `FEATURE_NUM`: The numeric or timestamp prefix used
|
.specify/extensions/git/commands/speckit.git.initialize.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: "Initialize a Git repository with an initial commit"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Initialize Git Repository
|
| 6 |
+
|
| 7 |
+
Initialize a Git repository in the current project directory if one does not already exist.
|
| 8 |
+
|
| 9 |
+
## Execution
|
| 10 |
+
|
| 11 |
+
Run the appropriate script from the project root:
|
| 12 |
+
|
| 13 |
+
- **Bash**: `.specify/extensions/git/scripts/bash/initialize-repo.sh`
|
| 14 |
+
- **PowerShell**: `.specify/extensions/git/scripts/powershell/initialize-repo.ps1`
|
| 15 |
+
|
| 16 |
+
If the extension scripts are not found, fall back to:
|
| 17 |
+
- **Bash**: `git init && git add . && git commit -m "Initial commit from Specify template"`
|
| 18 |
+
- **PowerShell**: `git init; git add .; git commit -m "Initial commit from Specify template"`
|
| 19 |
+
|
| 20 |
+
The script handles all checks internally:
|
| 21 |
+
- Skips if Git is not available
|
| 22 |
+
- Skips if already inside a Git repository
|
| 23 |
+
- Runs `git init`, `git add .`, and `git commit` with an initial commit message
|
| 24 |
+
|
| 25 |
+
## Customization
|
| 26 |
+
|
| 27 |
+
Replace the script to add project-specific Git initialization steps:
|
| 28 |
+
- Custom `.gitignore` templates
|
| 29 |
+
- Default branch naming (`git config init.defaultBranch`)
|
| 30 |
+
- Git LFS setup
|
| 31 |
+
- Git hooks installation
|
| 32 |
+
- Commit signing configuration
|
| 33 |
+
- Git Flow initialization
|
| 34 |
+
|
| 35 |
+
## Output
|
| 36 |
+
|
| 37 |
+
On success:
|
| 38 |
+
- `β Git repository initialized`
|
| 39 |
+
|
| 40 |
+
## Graceful Degradation
|
| 41 |
+
|
| 42 |
+
If Git is not installed:
|
| 43 |
+
- Warn the user
|
| 44 |
+
- Skip repository initialization
|
| 45 |
+
- The project continues to function without Git (specs can still be created under `specs/`)
|
| 46 |
+
|
| 47 |
+
If Git is installed but `git init`, `git add .`, or `git commit` fails:
|
| 48 |
+
- Surface the error to the user
|
| 49 |
+
- Stop this command rather than continuing with a partially initialized repository
|
.specify/extensions/git/commands/speckit.git.remote.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: "Detect Git remote URL for GitHub integration"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Detect Git Remote URL
|
| 6 |
+
|
| 7 |
+
Detect the Git remote URL for integration with GitHub services (e.g., issue creation).
|
| 8 |
+
|
| 9 |
+
## Prerequisites
|
| 10 |
+
|
| 11 |
+
- Check if Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
| 12 |
+
- If Git is not available, output a warning and return empty:
|
| 13 |
+
```
|
| 14 |
+
[specify] Warning: Git repository not detected; cannot determine remote URL
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## Execution
|
| 18 |
+
|
| 19 |
+
Run the following command to get the remote URL:
|
| 20 |
+
|
| 21 |
+
```bash
|
| 22 |
+
git config --get remote.origin.url
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
## Output
|
| 26 |
+
|
| 27 |
+
Parse the remote URL and determine:
|
| 28 |
+
|
| 29 |
+
1. **Repository owner**: Extract from the URL (e.g., `github` from `https://github.com/github/spec-kit.git`)
|
| 30 |
+
2. **Repository name**: Extract from the URL (e.g., `spec-kit` from `https://github.com/github/spec-kit.git`)
|
| 31 |
+
3. **Is GitHub**: Whether the remote points to a GitHub repository
|
| 32 |
+
|
| 33 |
+
Supported URL formats:
|
| 34 |
+
- HTTPS: `https://github.com/<owner>/<repo>.git`
|
| 35 |
+
- SSH: `git@github.com:<owner>/<repo>.git`
|
| 36 |
+
|
| 37 |
+
> [!CAUTION]
|
| 38 |
+
> ONLY report a GitHub repository if the remote URL actually points to github.com.
|
| 39 |
+
> Do NOT assume the remote is GitHub if the URL format doesn't match.
|
| 40 |
+
|
| 41 |
+
## Graceful Degradation
|
| 42 |
+
|
| 43 |
+
If Git is not installed, the directory is not a Git repository, or no remote is configured:
|
| 44 |
+
- Return an empty result
|
| 45 |
+
- Do NOT error β other workflows should continue without Git remote information
|
.specify/extensions/git/commands/speckit.git.validate.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: "Validate current branch follows feature branch naming conventions"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Validate Feature Branch
|
| 6 |
+
|
| 7 |
+
Validate that the current Git branch follows the expected feature branch naming conventions.
|
| 8 |
+
|
| 9 |
+
## Prerequisites
|
| 10 |
+
|
| 11 |
+
- Check if Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
| 12 |
+
- If Git is not available, output a warning and skip validation:
|
| 13 |
+
```
|
| 14 |
+
[specify] Warning: Git repository not detected; skipped branch validation
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## Validation Rules
|
| 18 |
+
|
| 19 |
+
Get the current branch name:
|
| 20 |
+
|
| 21 |
+
```bash
|
| 22 |
+
git rev-parse --abbrev-ref HEAD
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
The branch name must match one of these patterns:
|
| 26 |
+
|
| 27 |
+
1. **Sequential**: `^[0-9]{3,}-` (e.g., `001-feature-name`, `042-fix-bug`, `1000-big-feature`)
|
| 28 |
+
2. **Timestamp**: `^[0-9]{8}-[0-9]{6}-` (e.g., `20260319-143022-feature-name`)
|
| 29 |
+
|
| 30 |
+
## Execution
|
| 31 |
+
|
| 32 |
+
If on a feature branch (matches either pattern):
|
| 33 |
+
- Output: `β On feature branch: <branch-name>`
|
| 34 |
+
- Check if the corresponding spec directory exists under `specs/`:
|
| 35 |
+
- For sequential branches, look for `specs/<prefix>-*` where prefix matches the numeric portion
|
| 36 |
+
- For timestamp branches, look for `specs/<prefix>-*` where prefix matches the `YYYYMMDD-HHMMSS` portion
|
| 37 |
+
- If spec directory exists: `β Spec directory found: <path>`
|
| 38 |
+
- If spec directory missing: `β No spec directory found for prefix <prefix>`
|
| 39 |
+
|
| 40 |
+
If NOT on a feature branch:
|
| 41 |
+
- Output: `β Not on a feature branch. Current branch: <branch-name>`
|
| 42 |
+
- Output: `Feature branches should be named like: 001-feature-name or 20260319-143022-feature-name`
|
| 43 |
+
|
| 44 |
+
## Graceful Degradation
|
| 45 |
+
|
| 46 |
+
If Git is not installed or the directory is not a Git repository:
|
| 47 |
+
- Check the `SPECIFY_FEATURE` environment variable as a fallback
|
| 48 |
+
- If set, validate that value against the naming patterns
|
| 49 |
+
- If not set, skip validation with a warning
|
.specify/extensions/git/config-template.yml
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Git Branching Workflow Extension Configuration
|
| 2 |
+
# Copied to .specify/extensions/git/git-config.yml on install
|
| 3 |
+
|
| 4 |
+
# Branch numbering strategy: "sequential" (001, 002, ...) or "timestamp" (YYYYMMDD-HHMMSS)
|
| 5 |
+
branch_numbering: sequential
|
| 6 |
+
|
| 7 |
+
# Commit message used by `git commit` during repository initialization
|
| 8 |
+
init_commit_message: "[Spec Kit] Initial commit"
|
| 9 |
+
|
| 10 |
+
# Auto-commit before/after core commands.
|
| 11 |
+
# Set "default" to enable for all commands, then override per-command.
|
| 12 |
+
# Each key can be true/false. Message is customizable per-command.
|
| 13 |
+
auto_commit:
|
| 14 |
+
default: false
|
| 15 |
+
before_clarify:
|
| 16 |
+
enabled: false
|
| 17 |
+
message: "[Spec Kit] Save progress before clarification"
|
| 18 |
+
before_plan:
|
| 19 |
+
enabled: false
|
| 20 |
+
message: "[Spec Kit] Save progress before planning"
|
| 21 |
+
before_tasks:
|
| 22 |
+
enabled: false
|
| 23 |
+
message: "[Spec Kit] Save progress before task generation"
|
| 24 |
+
before_implement:
|
| 25 |
+
enabled: false
|
| 26 |
+
message: "[Spec Kit] Save progress before implementation"
|
| 27 |
+
before_checklist:
|
| 28 |
+
enabled: false
|
| 29 |
+
message: "[Spec Kit] Save progress before checklist"
|
| 30 |
+
before_analyze:
|
| 31 |
+
enabled: false
|
| 32 |
+
message: "[Spec Kit] Save progress before analysis"
|
| 33 |
+
before_taskstoissues:
|
| 34 |
+
enabled: false
|
| 35 |
+
message: "[Spec Kit] Save progress before issue sync"
|
| 36 |
+
after_constitution:
|
| 37 |
+
enabled: false
|
| 38 |
+
message: "[Spec Kit] Add project constitution"
|
| 39 |
+
after_specify:
|
| 40 |
+
enabled: false
|
| 41 |
+
message: "[Spec Kit] Add specification"
|
| 42 |
+
after_clarify:
|
| 43 |
+
enabled: false
|
| 44 |
+
message: "[Spec Kit] Clarify specification"
|
| 45 |
+
after_plan:
|
| 46 |
+
enabled: false
|
| 47 |
+
message: "[Spec Kit] Add implementation plan"
|
| 48 |
+
after_tasks:
|
| 49 |
+
enabled: false
|
| 50 |
+
message: "[Spec Kit] Add tasks"
|
| 51 |
+
after_implement:
|
| 52 |
+
enabled: false
|
| 53 |
+
message: "[Spec Kit] Implementation progress"
|
| 54 |
+
after_checklist:
|
| 55 |
+
enabled: false
|
| 56 |
+
message: "[Spec Kit] Add checklist"
|
| 57 |
+
after_analyze:
|
| 58 |
+
enabled: false
|
| 59 |
+
message: "[Spec Kit] Add analysis report"
|
| 60 |
+
after_taskstoissues:
|
| 61 |
+
enabled: false
|
| 62 |
+
message: "[Spec Kit] Sync tasks to issues"
|
.specify/extensions/git/extension.yml
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version: "1.0"
|
| 2 |
+
|
| 3 |
+
extension:
|
| 4 |
+
id: git
|
| 5 |
+
name: "Git Branching Workflow"
|
| 6 |
+
version: "1.0.0"
|
| 7 |
+
description: "Feature branch creation, numbering (sequential/timestamp), validation, and Git remote detection"
|
| 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 |
+
tools:
|
| 15 |
+
- name: git
|
| 16 |
+
required: false
|
| 17 |
+
|
| 18 |
+
provides:
|
| 19 |
+
commands:
|
| 20 |
+
- name: speckit.git.feature
|
| 21 |
+
file: commands/speckit.git.feature.md
|
| 22 |
+
description: "Create a feature branch with sequential or timestamp numbering"
|
| 23 |
+
- name: speckit.git.validate
|
| 24 |
+
file: commands/speckit.git.validate.md
|
| 25 |
+
description: "Validate current branch follows feature branch naming conventions"
|
| 26 |
+
- name: speckit.git.remote
|
| 27 |
+
file: commands/speckit.git.remote.md
|
| 28 |
+
description: "Detect Git remote URL for GitHub integration"
|
| 29 |
+
- name: speckit.git.initialize
|
| 30 |
+
file: commands/speckit.git.initialize.md
|
| 31 |
+
description: "Initialize a Git repository with an initial commit"
|
| 32 |
+
- name: speckit.git.commit
|
| 33 |
+
file: commands/speckit.git.commit.md
|
| 34 |
+
description: "Auto-commit changes after a Spec Kit command completes"
|
| 35 |
+
|
| 36 |
+
config:
|
| 37 |
+
- name: "git-config.yml"
|
| 38 |
+
template: "config-template.yml"
|
| 39 |
+
description: "Git branching configuration"
|
| 40 |
+
required: false
|
| 41 |
+
|
| 42 |
+
hooks:
|
| 43 |
+
before_constitution:
|
| 44 |
+
command: speckit.git.initialize
|
| 45 |
+
optional: false
|
| 46 |
+
description: "Initialize Git repository before constitution setup"
|
| 47 |
+
before_specify:
|
| 48 |
+
command: speckit.git.feature
|
| 49 |
+
optional: false
|
| 50 |
+
description: "Create feature branch before specification"
|
| 51 |
+
before_clarify:
|
| 52 |
+
command: speckit.git.commit
|
| 53 |
+
optional: true
|
| 54 |
+
prompt: "Commit outstanding changes before clarification?"
|
| 55 |
+
description: "Auto-commit before spec clarification"
|
| 56 |
+
before_plan:
|
| 57 |
+
command: speckit.git.commit
|
| 58 |
+
optional: true
|
| 59 |
+
prompt: "Commit outstanding changes before planning?"
|
| 60 |
+
description: "Auto-commit before implementation planning"
|
| 61 |
+
before_tasks:
|
| 62 |
+
command: speckit.git.commit
|
| 63 |
+
optional: true
|
| 64 |
+
prompt: "Commit outstanding changes before task generation?"
|
| 65 |
+
description: "Auto-commit before task generation"
|
| 66 |
+
before_implement:
|
| 67 |
+
command: speckit.git.commit
|
| 68 |
+
optional: true
|
| 69 |
+
prompt: "Commit outstanding changes before implementation?"
|
| 70 |
+
description: "Auto-commit before implementation"
|
| 71 |
+
before_checklist:
|
| 72 |
+
command: speckit.git.commit
|
| 73 |
+
optional: true
|
| 74 |
+
prompt: "Commit outstanding changes before checklist?"
|
| 75 |
+
description: "Auto-commit before checklist generation"
|
| 76 |
+
before_analyze:
|
| 77 |
+
command: speckit.git.commit
|
| 78 |
+
optional: true
|
| 79 |
+
prompt: "Commit outstanding changes before analysis?"
|
| 80 |
+
description: "Auto-commit before analysis"
|
| 81 |
+
before_taskstoissues:
|
| 82 |
+
command: speckit.git.commit
|
| 83 |
+
optional: true
|
| 84 |
+
prompt: "Commit outstanding changes before issue sync?"
|
| 85 |
+
description: "Auto-commit before tasks-to-issues conversion"
|
| 86 |
+
after_constitution:
|
| 87 |
+
command: speckit.git.commit
|
| 88 |
+
optional: true
|
| 89 |
+
prompt: "Commit constitution changes?"
|
| 90 |
+
description: "Auto-commit after constitution update"
|
| 91 |
+
after_specify:
|
| 92 |
+
command: speckit.git.commit
|
| 93 |
+
optional: true
|
| 94 |
+
prompt: "Commit specification changes?"
|
| 95 |
+
description: "Auto-commit after specification"
|
| 96 |
+
after_clarify:
|
| 97 |
+
command: speckit.git.commit
|
| 98 |
+
optional: true
|
| 99 |
+
prompt: "Commit clarification changes?"
|
| 100 |
+
description: "Auto-commit after spec clarification"
|
| 101 |
+
after_plan:
|
| 102 |
+
command: speckit.git.commit
|
| 103 |
+
optional: true
|
| 104 |
+
prompt: "Commit plan changes?"
|
| 105 |
+
description: "Auto-commit after implementation planning"
|
| 106 |
+
after_tasks:
|
| 107 |
+
command: speckit.git.commit
|
| 108 |
+
optional: true
|
| 109 |
+
prompt: "Commit task changes?"
|
| 110 |
+
description: "Auto-commit after task generation"
|
| 111 |
+
after_implement:
|
| 112 |
+
command: speckit.git.commit
|
| 113 |
+
optional: true
|
| 114 |
+
prompt: "Commit implementation changes?"
|
| 115 |
+
description: "Auto-commit after implementation"
|
| 116 |
+
after_checklist:
|
| 117 |
+
command: speckit.git.commit
|
| 118 |
+
optional: true
|
| 119 |
+
prompt: "Commit checklist changes?"
|
| 120 |
+
description: "Auto-commit after checklist generation"
|
| 121 |
+
after_analyze:
|
| 122 |
+
command: speckit.git.commit
|
| 123 |
+
optional: true
|
| 124 |
+
prompt: "Commit analysis results?"
|
| 125 |
+
description: "Auto-commit after analysis"
|
| 126 |
+
after_taskstoissues:
|
| 127 |
+
command: speckit.git.commit
|
| 128 |
+
optional: true
|
| 129 |
+
prompt: "Commit after syncing issues?"
|
| 130 |
+
description: "Auto-commit after tasks-to-issues conversion"
|
| 131 |
+
|
| 132 |
+
tags:
|
| 133 |
+
- "git"
|
| 134 |
+
- "branching"
|
| 135 |
+
- "workflow"
|
| 136 |
+
|
| 137 |
+
config:
|
| 138 |
+
defaults:
|
| 139 |
+
branch_numbering: sequential
|
| 140 |
+
init_commit_message: "[Spec Kit] Initial commit"
|
.specify/extensions/git/git-config.yml
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Git Branching Workflow Extension Configuration
|
| 2 |
+
# Copied to .specify/extensions/git/git-config.yml on install
|
| 3 |
+
|
| 4 |
+
# Branch numbering strategy: "sequential" (001, 002, ...) or "timestamp" (YYYYMMDD-HHMMSS)
|
| 5 |
+
branch_numbering: sequential
|
| 6 |
+
|
| 7 |
+
# Commit message used by `git commit` during repository initialization
|
| 8 |
+
init_commit_message: "[Spec Kit] Initial commit"
|
| 9 |
+
|
| 10 |
+
# Auto-commit before/after core commands.
|
| 11 |
+
# Set "default" to enable for all commands, then override per-command.
|
| 12 |
+
# Each key can be true/false. Message is customizable per-command.
|
| 13 |
+
auto_commit:
|
| 14 |
+
default: false
|
| 15 |
+
before_clarify:
|
| 16 |
+
enabled: false
|
| 17 |
+
message: "[Spec Kit] Save progress before clarification"
|
| 18 |
+
before_plan:
|
| 19 |
+
enabled: false
|
| 20 |
+
message: "[Spec Kit] Save progress before planning"
|
| 21 |
+
before_tasks:
|
| 22 |
+
enabled: false
|
| 23 |
+
message: "[Spec Kit] Save progress before task generation"
|
| 24 |
+
before_implement:
|
| 25 |
+
enabled: false
|
| 26 |
+
message: "[Spec Kit] Save progress before implementation"
|
| 27 |
+
before_checklist:
|
| 28 |
+
enabled: false
|
| 29 |
+
message: "[Spec Kit] Save progress before checklist"
|
| 30 |
+
before_analyze:
|
| 31 |
+
enabled: false
|
| 32 |
+
message: "[Spec Kit] Save progress before analysis"
|
| 33 |
+
before_taskstoissues:
|
| 34 |
+
enabled: false
|
| 35 |
+
message: "[Spec Kit] Save progress before issue sync"
|
| 36 |
+
after_constitution:
|
| 37 |
+
enabled: false
|
| 38 |
+
message: "[Spec Kit] Add project constitution"
|
| 39 |
+
after_specify:
|
| 40 |
+
enabled: false
|
| 41 |
+
message: "[Spec Kit] Add specification"
|
| 42 |
+
after_clarify:
|
| 43 |
+
enabled: false
|
| 44 |
+
message: "[Spec Kit] Clarify specification"
|
| 45 |
+
after_plan:
|
| 46 |
+
enabled: false
|
| 47 |
+
message: "[Spec Kit] Add implementation plan"
|
| 48 |
+
after_tasks:
|
| 49 |
+
enabled: false
|
| 50 |
+
message: "[Spec Kit] Add tasks"
|
| 51 |
+
after_implement:
|
| 52 |
+
enabled: false
|
| 53 |
+
message: "[Spec Kit] Implementation progress"
|
| 54 |
+
after_checklist:
|
| 55 |
+
enabled: false
|
| 56 |
+
message: "[Spec Kit] Add checklist"
|
| 57 |
+
after_analyze:
|
| 58 |
+
enabled: false
|
| 59 |
+
message: "[Spec Kit] Add analysis report"
|
| 60 |
+
after_taskstoissues:
|
| 61 |
+
enabled: false
|
| 62 |
+
message: "[Spec Kit] Sync tasks to issues"
|
.specify/extensions/git/scripts/bash/auto-commit.sh
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Git extension: auto-commit.sh
|
| 3 |
+
# Automatically commit changes after a Spec Kit command completes.
|
| 4 |
+
# Checks per-command config keys in git-config.yml before committing.
|
| 5 |
+
#
|
| 6 |
+
# Usage: auto-commit.sh <event_name>
|
| 7 |
+
# e.g.: auto-commit.sh after_specify
|
| 8 |
+
|
| 9 |
+
set -e
|
| 10 |
+
|
| 11 |
+
EVENT_NAME="${1:-}"
|
| 12 |
+
if [ -z "$EVENT_NAME" ]; then
|
| 13 |
+
echo "Usage: $0 <event_name>" >&2
|
| 14 |
+
exit 1
|
| 15 |
+
fi
|
| 16 |
+
|
| 17 |
+
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 18 |
+
|
| 19 |
+
_find_project_root() {
|
| 20 |
+
local dir="$1"
|
| 21 |
+
while [ "$dir" != "/" ]; do
|
| 22 |
+
if [ -d "$dir/.specify" ] || [ -d "$dir/.git" ]; then
|
| 23 |
+
echo "$dir"
|
| 24 |
+
return 0
|
| 25 |
+
fi
|
| 26 |
+
dir="$(dirname "$dir")"
|
| 27 |
+
done
|
| 28 |
+
return 1
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
REPO_ROOT=$(_find_project_root "$SCRIPT_DIR") || REPO_ROOT="$(pwd)"
|
| 32 |
+
cd "$REPO_ROOT"
|
| 33 |
+
|
| 34 |
+
# Check if git is available
|
| 35 |
+
if ! command -v git >/dev/null 2>&1; then
|
| 36 |
+
echo "[specify] Warning: Git not found; skipped auto-commit" >&2
|
| 37 |
+
exit 0
|
| 38 |
+
fi
|
| 39 |
+
|
| 40 |
+
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
| 41 |
+
echo "[specify] Warning: Not a Git repository; skipped auto-commit" >&2
|
| 42 |
+
exit 0
|
| 43 |
+
fi
|
| 44 |
+
|
| 45 |
+
# Read per-command config from git-config.yml
|
| 46 |
+
_config_file="$REPO_ROOT/.specify/extensions/git/git-config.yml"
|
| 47 |
+
_enabled=false
|
| 48 |
+
_commit_msg=""
|
| 49 |
+
|
| 50 |
+
if [ -f "$_config_file" ]; then
|
| 51 |
+
# Parse the auto_commit section for this event.
|
| 52 |
+
# Look for auto_commit.<event_name>.enabled and .message
|
| 53 |
+
# Also check auto_commit.default as fallback.
|
| 54 |
+
_in_auto_commit=false
|
| 55 |
+
_in_event=false
|
| 56 |
+
_default_enabled=false
|
| 57 |
+
|
| 58 |
+
while IFS= read -r _line; do
|
| 59 |
+
# Detect auto_commit: section
|
| 60 |
+
if echo "$_line" | grep -q '^auto_commit:'; then
|
| 61 |
+
_in_auto_commit=true
|
| 62 |
+
_in_event=false
|
| 63 |
+
continue
|
| 64 |
+
fi
|
| 65 |
+
|
| 66 |
+
# Exit auto_commit section on next top-level key
|
| 67 |
+
if $_in_auto_commit && echo "$_line" | grep -Eq '^[a-z]'; then
|
| 68 |
+
break
|
| 69 |
+
fi
|
| 70 |
+
|
| 71 |
+
if $_in_auto_commit; then
|
| 72 |
+
# Check default key
|
| 73 |
+
if echo "$_line" | grep -Eq "^[[:space:]]+default:[[:space:]]"; then
|
| 74 |
+
_val=$(echo "$_line" | sed 's/^[^:]*:[[:space:]]*//' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]')
|
| 75 |
+
[ "$_val" = "true" ] && _default_enabled=true
|
| 76 |
+
fi
|
| 77 |
+
|
| 78 |
+
# Detect our event subsection
|
| 79 |
+
if echo "$_line" | grep -Eq "^[[:space:]]+${EVENT_NAME}:"; then
|
| 80 |
+
_in_event=true
|
| 81 |
+
continue
|
| 82 |
+
fi
|
| 83 |
+
|
| 84 |
+
# Inside our event subsection
|
| 85 |
+
if $_in_event; then
|
| 86 |
+
# Exit on next sibling key (same indent level as event name)
|
| 87 |
+
if echo "$_line" | grep -Eq '^[[:space:]]{2}[a-z]' && ! echo "$_line" | grep -Eq '^[[:space:]]{4}'; then
|
| 88 |
+
_in_event=false
|
| 89 |
+
continue
|
| 90 |
+
fi
|
| 91 |
+
if echo "$_line" | grep -Eq '[[:space:]]+enabled:'; then
|
| 92 |
+
_val=$(echo "$_line" | sed 's/^[^:]*:[[:space:]]*//' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]')
|
| 93 |
+
[ "$_val" = "true" ] && _enabled=true
|
| 94 |
+
[ "$_val" = "false" ] && _enabled=false
|
| 95 |
+
fi
|
| 96 |
+
if echo "$_line" | grep -Eq '[[:space:]]+message:'; then
|
| 97 |
+
_commit_msg=$(echo "$_line" | sed 's/^[^:]*:[[:space:]]*//' | sed 's/^["'\'']//' | sed 's/["'\'']*$//')
|
| 98 |
+
fi
|
| 99 |
+
fi
|
| 100 |
+
fi
|
| 101 |
+
done < "$_config_file"
|
| 102 |
+
|
| 103 |
+
# If event-specific key not found, use default
|
| 104 |
+
if [ "$_enabled" = "false" ] && [ "$_default_enabled" = "true" ]; then
|
| 105 |
+
# Only use default if the event wasn't explicitly set to false
|
| 106 |
+
# Check if event section existed at all
|
| 107 |
+
if ! grep -q "^[[:space:]]*${EVENT_NAME}:" "$_config_file" 2>/dev/null; then
|
| 108 |
+
_enabled=true
|
| 109 |
+
fi
|
| 110 |
+
fi
|
| 111 |
+
else
|
| 112 |
+
# No config file β auto-commit disabled by default
|
| 113 |
+
exit 0
|
| 114 |
+
fi
|
| 115 |
+
|
| 116 |
+
if [ "$_enabled" != "true" ]; then
|
| 117 |
+
exit 0
|
| 118 |
+
fi
|
| 119 |
+
|
| 120 |
+
# Check if there are changes to commit
|
| 121 |
+
if git diff --quiet HEAD 2>/dev/null && git diff --cached --quiet 2>/dev/null && [ -z "$(git ls-files --others --exclude-standard 2>/dev/null)" ]; then
|
| 122 |
+
echo "[specify] No changes to commit after $EVENT_NAME" >&2
|
| 123 |
+
exit 0
|
| 124 |
+
fi
|
| 125 |
+
|
| 126 |
+
# Derive a human-readable command name from the event
|
| 127 |
+
# e.g., after_specify -> specify, before_plan -> plan
|
| 128 |
+
_command_name=$(echo "$EVENT_NAME" | sed 's/^after_//' | sed 's/^before_//')
|
| 129 |
+
_phase=$(echo "$EVENT_NAME" | grep -q '^before_' && echo 'before' || echo 'after')
|
| 130 |
+
|
| 131 |
+
# Use custom message if configured, otherwise default
|
| 132 |
+
if [ -z "$_commit_msg" ]; then
|
| 133 |
+
_commit_msg="[Spec Kit] Auto-commit ${_phase} ${_command_name}"
|
| 134 |
+
fi
|
| 135 |
+
|
| 136 |
+
# Stage and commit
|
| 137 |
+
_git_out=$(git add . 2>&1) || { echo "[specify] Error: git add failed: $_git_out" >&2; exit 1; }
|
| 138 |
+
_git_out=$(git commit -q -m "$_commit_msg" 2>&1) || { echo "[specify] Error: git commit failed: $_git_out" >&2; exit 1; }
|
| 139 |
+
|
| 140 |
+
echo "[OK] Changes committed ${_phase} ${_command_name}" >&2
|
.specify/extensions/git/scripts/bash/create-new-feature.sh
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Git extension: create-new-feature.sh
|
| 3 |
+
# Adapted from core scripts/bash/create-new-feature.sh for extension layout.
|
| 4 |
+
# Sources common.sh from the project's installed scripts, falling back to
|
| 5 |
+
# git-common.sh for minimal git helpers.
|
| 6 |
+
|
| 7 |
+
set -e
|
| 8 |
+
|
| 9 |
+
JSON_MODE=false
|
| 10 |
+
DRY_RUN=false
|
| 11 |
+
ALLOW_EXISTING=false
|
| 12 |
+
SHORT_NAME=""
|
| 13 |
+
BRANCH_NUMBER=""
|
| 14 |
+
USE_TIMESTAMP=false
|
| 15 |
+
ARGS=()
|
| 16 |
+
i=1
|
| 17 |
+
while [ $i -le $# ]; do
|
| 18 |
+
arg="${!i}"
|
| 19 |
+
case "$arg" in
|
| 20 |
+
--json)
|
| 21 |
+
JSON_MODE=true
|
| 22 |
+
;;
|
| 23 |
+
--dry-run)
|
| 24 |
+
DRY_RUN=true
|
| 25 |
+
;;
|
| 26 |
+
--allow-existing-branch)
|
| 27 |
+
ALLOW_EXISTING=true
|
| 28 |
+
;;
|
| 29 |
+
--short-name)
|
| 30 |
+
if [ $((i + 1)) -gt $# ]; then
|
| 31 |
+
echo 'Error: --short-name requires a value' >&2
|
| 32 |
+
exit 1
|
| 33 |
+
fi
|
| 34 |
+
i=$((i + 1))
|
| 35 |
+
next_arg="${!i}"
|
| 36 |
+
if [[ "$next_arg" == --* ]]; then
|
| 37 |
+
echo 'Error: --short-name requires a value' >&2
|
| 38 |
+
exit 1
|
| 39 |
+
fi
|
| 40 |
+
SHORT_NAME="$next_arg"
|
| 41 |
+
;;
|
| 42 |
+
--number)
|
| 43 |
+
if [ $((i + 1)) -gt $# ]; then
|
| 44 |
+
echo 'Error: --number requires a value' >&2
|
| 45 |
+
exit 1
|
| 46 |
+
fi
|
| 47 |
+
i=$((i + 1))
|
| 48 |
+
next_arg="${!i}"
|
| 49 |
+
if [[ "$next_arg" == --* ]]; then
|
| 50 |
+
echo 'Error: --number requires a value' >&2
|
| 51 |
+
exit 1
|
| 52 |
+
fi
|
| 53 |
+
BRANCH_NUMBER="$next_arg"
|
| 54 |
+
if [[ ! "$BRANCH_NUMBER" =~ ^[0-9]+$ ]]; then
|
| 55 |
+
echo 'Error: --number must be a non-negative integer' >&2
|
| 56 |
+
exit 1
|
| 57 |
+
fi
|
| 58 |
+
;;
|
| 59 |
+
--timestamp)
|
| 60 |
+
USE_TIMESTAMP=true
|
| 61 |
+
;;
|
| 62 |
+
--help|-h)
|
| 63 |
+
echo "Usage: $0 [--json] [--dry-run] [--allow-existing-branch] [--short-name <name>] [--number N] [--timestamp] <feature_description>"
|
| 64 |
+
echo ""
|
| 65 |
+
echo "Options:"
|
| 66 |
+
echo " --json Output in JSON format"
|
| 67 |
+
echo " --dry-run Compute branch name without creating the branch"
|
| 68 |
+
echo " --allow-existing-branch Switch to branch if it already exists instead of failing"
|
| 69 |
+
echo " --short-name <name> Provide a custom short name (2-4 words) for the branch"
|
| 70 |
+
echo " --number N Specify branch number manually (overrides auto-detection)"
|
| 71 |
+
echo " --timestamp Use timestamp prefix (YYYYMMDD-HHMMSS) instead of sequential numbering"
|
| 72 |
+
echo " --help, -h Show this help message"
|
| 73 |
+
echo ""
|
| 74 |
+
echo "Environment variables:"
|
| 75 |
+
echo " GIT_BRANCH_NAME Use this exact branch name, bypassing all prefix/suffix generation"
|
| 76 |
+
echo ""
|
| 77 |
+
echo "Examples:"
|
| 78 |
+
echo " $0 'Add user authentication system' --short-name 'user-auth'"
|
| 79 |
+
echo " $0 'Implement OAuth2 integration for API' --number 5"
|
| 80 |
+
echo " $0 --timestamp --short-name 'user-auth' 'Add user authentication'"
|
| 81 |
+
echo " GIT_BRANCH_NAME=my-branch $0 'feature description'"
|
| 82 |
+
exit 0
|
| 83 |
+
;;
|
| 84 |
+
*)
|
| 85 |
+
ARGS+=("$arg")
|
| 86 |
+
;;
|
| 87 |
+
esac
|
| 88 |
+
i=$((i + 1))
|
| 89 |
+
done
|
| 90 |
+
|
| 91 |
+
FEATURE_DESCRIPTION="${ARGS[*]}"
|
| 92 |
+
if [ -z "$FEATURE_DESCRIPTION" ]; then
|
| 93 |
+
echo "Usage: $0 [--json] [--dry-run] [--allow-existing-branch] [--short-name <name>] [--number N] [--timestamp] <feature_description>" >&2
|
| 94 |
+
exit 1
|
| 95 |
+
fi
|
| 96 |
+
|
| 97 |
+
# Trim whitespace and validate description is not empty
|
| 98 |
+
FEATURE_DESCRIPTION=$(echo "$FEATURE_DESCRIPTION" | sed -E 's/^[[:space:]]+|[[:space:]]+$//g')
|
| 99 |
+
if [ -z "$FEATURE_DESCRIPTION" ]; then
|
| 100 |
+
echo "Error: Feature description cannot be empty or contain only whitespace" >&2
|
| 101 |
+
exit 1
|
| 102 |
+
fi
|
| 103 |
+
|
| 104 |
+
# Function to get highest number from specs directory
|
| 105 |
+
get_highest_from_specs() {
|
| 106 |
+
local specs_dir="$1"
|
| 107 |
+
local highest=0
|
| 108 |
+
|
| 109 |
+
if [ -d "$specs_dir" ]; then
|
| 110 |
+
for dir in "$specs_dir"/*; do
|
| 111 |
+
[ -d "$dir" ] || continue
|
| 112 |
+
dirname=$(basename "$dir")
|
| 113 |
+
# Match sequential prefixes (>=3 digits), but skip timestamp dirs.
|
| 114 |
+
if echo "$dirname" | grep -Eq '^[0-9]{3,}-' && ! echo "$dirname" | grep -Eq '^[0-9]{8}-[0-9]{6}-'; then
|
| 115 |
+
number=$(echo "$dirname" | grep -Eo '^[0-9]+')
|
| 116 |
+
number=$((10#$number))
|
| 117 |
+
if [ "$number" -gt "$highest" ]; then
|
| 118 |
+
highest=$number
|
| 119 |
+
fi
|
| 120 |
+
fi
|
| 121 |
+
done
|
| 122 |
+
fi
|
| 123 |
+
|
| 124 |
+
echo "$highest"
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
# Function to get highest number from git branches
|
| 128 |
+
get_highest_from_branches() {
|
| 129 |
+
git branch -a 2>/dev/null | sed 's/^[* ]*//; s|^remotes/[^/]*/||' | _extract_highest_number
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
# Extract the highest sequential feature number from a list of ref names (one per line).
|
| 133 |
+
_extract_highest_number() {
|
| 134 |
+
local highest=0
|
| 135 |
+
while IFS= read -r name; do
|
| 136 |
+
[ -z "$name" ] && continue
|
| 137 |
+
if echo "$name" | grep -Eq '^[0-9]{3,}-' && ! echo "$name" | grep -Eq '^[0-9]{8}-[0-9]{6}-'; then
|
| 138 |
+
number=$(echo "$name" | grep -Eo '^[0-9]+' || echo "0")
|
| 139 |
+
number=$((10#$number))
|
| 140 |
+
if [ "$number" -gt "$highest" ]; then
|
| 141 |
+
highest=$number
|
| 142 |
+
fi
|
| 143 |
+
fi
|
| 144 |
+
done
|
| 145 |
+
echo "$highest"
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
# Function to get highest number from remote branches without fetching (side-effect-free)
|
| 149 |
+
get_highest_from_remote_refs() {
|
| 150 |
+
local highest=0
|
| 151 |
+
|
| 152 |
+
for remote in $(git remote 2>/dev/null); do
|
| 153 |
+
local remote_highest
|
| 154 |
+
remote_highest=$(GIT_TERMINAL_PROMPT=0 git ls-remote --heads "$remote" 2>/dev/null | sed 's|.*refs/heads/||' | _extract_highest_number)
|
| 155 |
+
if [ "$remote_highest" -gt "$highest" ]; then
|
| 156 |
+
highest=$remote_highest
|
| 157 |
+
fi
|
| 158 |
+
done
|
| 159 |
+
|
| 160 |
+
echo "$highest"
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
# Function to check existing branches and return next available number.
|
| 164 |
+
check_existing_branches() {
|
| 165 |
+
local specs_dir="$1"
|
| 166 |
+
local skip_fetch="${2:-false}"
|
| 167 |
+
|
| 168 |
+
if [ "$skip_fetch" = true ]; then
|
| 169 |
+
local highest_remote=$(get_highest_from_remote_refs)
|
| 170 |
+
local highest_branch=$(get_highest_from_branches)
|
| 171 |
+
if [ "$highest_remote" -gt "$highest_branch" ]; then
|
| 172 |
+
highest_branch=$highest_remote
|
| 173 |
+
fi
|
| 174 |
+
else
|
| 175 |
+
git fetch --all --prune >/dev/null 2>&1 || true
|
| 176 |
+
local highest_branch=$(get_highest_from_branches)
|
| 177 |
+
fi
|
| 178 |
+
|
| 179 |
+
local highest_spec=$(get_highest_from_specs "$specs_dir")
|
| 180 |
+
|
| 181 |
+
local max_num=$highest_branch
|
| 182 |
+
if [ "$highest_spec" -gt "$max_num" ]; then
|
| 183 |
+
max_num=$highest_spec
|
| 184 |
+
fi
|
| 185 |
+
|
| 186 |
+
echo $((max_num + 1))
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
# Function to clean and format a branch name
|
| 190 |
+
clean_branch_name() {
|
| 191 |
+
local name="$1"
|
| 192 |
+
echo "$name" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/-\+/-/g' | sed 's/^-//' | sed 's/-$//'
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
# ---------------------------------------------------------------------------
|
| 196 |
+
# Source common.sh for resolve_template, json_escape, get_repo_root, has_git.
|
| 197 |
+
#
|
| 198 |
+
# Search locations in priority order:
|
| 199 |
+
# 1. .specify/scripts/bash/common.sh under the project root (installed project)
|
| 200 |
+
# 2. scripts/bash/common.sh under the project root (source checkout fallback)
|
| 201 |
+
# 3. git-common.sh next to this script (minimal fallback β lacks resolve_template)
|
| 202 |
+
# ---------------------------------------------------------------------------
|
| 203 |
+
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 204 |
+
|
| 205 |
+
# Find project root by walking up from the script location
|
| 206 |
+
_find_project_root() {
|
| 207 |
+
local dir="$1"
|
| 208 |
+
while [ "$dir" != "/" ]; do
|
| 209 |
+
if [ -d "$dir/.specify" ] || [ -d "$dir/.git" ]; then
|
| 210 |
+
echo "$dir"
|
| 211 |
+
return 0
|
| 212 |
+
fi
|
| 213 |
+
dir="$(dirname "$dir")"
|
| 214 |
+
done
|
| 215 |
+
return 1
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
_common_loaded=false
|
| 219 |
+
_PROJECT_ROOT=$(_find_project_root "$SCRIPT_DIR") || true
|
| 220 |
+
|
| 221 |
+
if [ -n "$_PROJECT_ROOT" ] && [ -f "$_PROJECT_ROOT/.specify/scripts/bash/common.sh" ]; then
|
| 222 |
+
source "$_PROJECT_ROOT/.specify/scripts/bash/common.sh"
|
| 223 |
+
_common_loaded=true
|
| 224 |
+
elif [ -n "$_PROJECT_ROOT" ] && [ -f "$_PROJECT_ROOT/scripts/bash/common.sh" ]; then
|
| 225 |
+
source "$_PROJECT_ROOT/scripts/bash/common.sh"
|
| 226 |
+
_common_loaded=true
|
| 227 |
+
elif [ -f "$SCRIPT_DIR/git-common.sh" ]; then
|
| 228 |
+
source "$SCRIPT_DIR/git-common.sh"
|
| 229 |
+
_common_loaded=true
|
| 230 |
+
fi
|
| 231 |
+
|
| 232 |
+
if [ "$_common_loaded" != "true" ]; then
|
| 233 |
+
echo "Error: Could not locate common.sh or git-common.sh. Please ensure the Specify core scripts are installed." >&2
|
| 234 |
+
exit 1
|
| 235 |
+
fi
|
| 236 |
+
|
| 237 |
+
# Resolve repository root
|
| 238 |
+
if type get_repo_root >/dev/null 2>&1; then
|
| 239 |
+
REPO_ROOT=$(get_repo_root)
|
| 240 |
+
elif git rev-parse --show-toplevel >/dev/null 2>&1; then
|
| 241 |
+
REPO_ROOT=$(git rev-parse --show-toplevel)
|
| 242 |
+
elif [ -n "$_PROJECT_ROOT" ]; then
|
| 243 |
+
REPO_ROOT="$_PROJECT_ROOT"
|
| 244 |
+
else
|
| 245 |
+
echo "Error: Could not determine repository root." >&2
|
| 246 |
+
exit 1
|
| 247 |
+
fi
|
| 248 |
+
|
| 249 |
+
# Check if git is available at this repo root
|
| 250 |
+
if type has_git >/dev/null 2>&1; then
|
| 251 |
+
if has_git "$REPO_ROOT"; then
|
| 252 |
+
HAS_GIT=true
|
| 253 |
+
else
|
| 254 |
+
HAS_GIT=false
|
| 255 |
+
fi
|
| 256 |
+
elif git -C "$REPO_ROOT" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
| 257 |
+
HAS_GIT=true
|
| 258 |
+
else
|
| 259 |
+
HAS_GIT=false
|
| 260 |
+
fi
|
| 261 |
+
|
| 262 |
+
cd "$REPO_ROOT"
|
| 263 |
+
|
| 264 |
+
SPECS_DIR="$REPO_ROOT/specs"
|
| 265 |
+
|
| 266 |
+
# Function to generate branch name with stop word filtering
|
| 267 |
+
generate_branch_name() {
|
| 268 |
+
local description="$1"
|
| 269 |
+
|
| 270 |
+
local stop_words="^(i|a|an|the|to|for|of|in|on|at|by|with|from|is|are|was|were|be|been|being|have|has|had|do|does|did|will|would|should|could|can|may|might|must|shall|this|that|these|those|my|your|our|their|want|need|add|get|set)$"
|
| 271 |
+
|
| 272 |
+
local clean_name=$(echo "$description" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/ /g')
|
| 273 |
+
|
| 274 |
+
local meaningful_words=()
|
| 275 |
+
for word in $clean_name; do
|
| 276 |
+
[ -z "$word" ] && continue
|
| 277 |
+
if ! echo "$word" | grep -qiE "$stop_words"; then
|
| 278 |
+
if [ ${#word} -ge 3 ]; then
|
| 279 |
+
meaningful_words+=("$word")
|
| 280 |
+
elif echo "$description" | grep -qw -- "${word^^}"; then
|
| 281 |
+
meaningful_words+=("$word")
|
| 282 |
+
fi
|
| 283 |
+
fi
|
| 284 |
+
done
|
| 285 |
+
|
| 286 |
+
if [ ${#meaningful_words[@]} -gt 0 ]; then
|
| 287 |
+
local max_words=3
|
| 288 |
+
if [ ${#meaningful_words[@]} -eq 4 ]; then max_words=4; fi
|
| 289 |
+
|
| 290 |
+
local result=""
|
| 291 |
+
local count=0
|
| 292 |
+
for word in "${meaningful_words[@]}"; do
|
| 293 |
+
if [ $count -ge $max_words ]; then break; fi
|
| 294 |
+
if [ -n "$result" ]; then result="$result-"; fi
|
| 295 |
+
result="$result$word"
|
| 296 |
+
count=$((count + 1))
|
| 297 |
+
done
|
| 298 |
+
echo "$result"
|
| 299 |
+
else
|
| 300 |
+
local cleaned=$(clean_branch_name "$description")
|
| 301 |
+
echo "$cleaned" | tr '-' '\n' | grep -v '^$' | head -3 | tr '\n' '-' | sed 's/-$//'
|
| 302 |
+
fi
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
# Check for GIT_BRANCH_NAME env var override (exact branch name, no prefix/suffix)
|
| 306 |
+
if [ -n "${GIT_BRANCH_NAME:-}" ]; then
|
| 307 |
+
BRANCH_NAME="$GIT_BRANCH_NAME"
|
| 308 |
+
# Extract FEATURE_NUM from the branch name if it starts with a numeric prefix
|
| 309 |
+
# Check timestamp pattern first (YYYYMMDD-HHMMSS-) since it also matches the simpler ^[0-9]+ pattern
|
| 310 |
+
if echo "$BRANCH_NAME" | grep -Eq '^[0-9]{8}-[0-9]{6}-'; then
|
| 311 |
+
FEATURE_NUM=$(echo "$BRANCH_NAME" | grep -Eo '^[0-9]{8}-[0-9]{6}')
|
| 312 |
+
BRANCH_SUFFIX="${BRANCH_NAME#${FEATURE_NUM}-}"
|
| 313 |
+
elif echo "$BRANCH_NAME" | grep -Eq '^[0-9]+-'; then
|
| 314 |
+
FEATURE_NUM=$(echo "$BRANCH_NAME" | grep -Eo '^[0-9]+')
|
| 315 |
+
BRANCH_SUFFIX="${BRANCH_NAME#${FEATURE_NUM}-}"
|
| 316 |
+
else
|
| 317 |
+
FEATURE_NUM="$BRANCH_NAME"
|
| 318 |
+
BRANCH_SUFFIX="$BRANCH_NAME"
|
| 319 |
+
fi
|
| 320 |
+
else
|
| 321 |
+
# Generate branch name
|
| 322 |
+
if [ -n "$SHORT_NAME" ]; then
|
| 323 |
+
BRANCH_SUFFIX=$(clean_branch_name "$SHORT_NAME")
|
| 324 |
+
else
|
| 325 |
+
BRANCH_SUFFIX=$(generate_branch_name "$FEATURE_DESCRIPTION")
|
| 326 |
+
fi
|
| 327 |
+
|
| 328 |
+
# Warn if --number and --timestamp are both specified
|
| 329 |
+
if [ "$USE_TIMESTAMP" = true ] && [ -n "$BRANCH_NUMBER" ]; then
|
| 330 |
+
>&2 echo "[specify] Warning: --number is ignored when --timestamp is used"
|
| 331 |
+
BRANCH_NUMBER=""
|
| 332 |
+
fi
|
| 333 |
+
|
| 334 |
+
# Determine branch prefix
|
| 335 |
+
if [ "$USE_TIMESTAMP" = true ]; then
|
| 336 |
+
FEATURE_NUM=$(date +%Y%m%d-%H%M%S)
|
| 337 |
+
BRANCH_NAME="${FEATURE_NUM}-${BRANCH_SUFFIX}"
|
| 338 |
+
else
|
| 339 |
+
if [ -z "$BRANCH_NUMBER" ]; then
|
| 340 |
+
if [ "$DRY_RUN" = true ] && [ "$HAS_GIT" = true ]; then
|
| 341 |
+
BRANCH_NUMBER=$(check_existing_branches "$SPECS_DIR" true)
|
| 342 |
+
elif [ "$DRY_RUN" = true ]; then
|
| 343 |
+
HIGHEST=$(get_highest_from_specs "$SPECS_DIR")
|
| 344 |
+
BRANCH_NUMBER=$((HIGHEST + 1))
|
| 345 |
+
elif [ "$HAS_GIT" = true ]; then
|
| 346 |
+
BRANCH_NUMBER=$(check_existing_branches "$SPECS_DIR")
|
| 347 |
+
else
|
| 348 |
+
HIGHEST=$(get_highest_from_specs "$SPECS_DIR")
|
| 349 |
+
BRANCH_NUMBER=$((HIGHEST + 1))
|
| 350 |
+
fi
|
| 351 |
+
fi
|
| 352 |
+
|
| 353 |
+
FEATURE_NUM=$(printf "%03d" "$((10#$BRANCH_NUMBER))")
|
| 354 |
+
BRANCH_NAME="${FEATURE_NUM}-${BRANCH_SUFFIX}"
|
| 355 |
+
fi
|
| 356 |
+
fi
|
| 357 |
+
|
| 358 |
+
# GitHub enforces a 244-byte limit on branch names
|
| 359 |
+
MAX_BRANCH_LENGTH=244
|
| 360 |
+
_byte_length() { printf '%s' "$1" | LC_ALL=C wc -c | tr -d ' '; }
|
| 361 |
+
BRANCH_BYTE_LEN=$(_byte_length "$BRANCH_NAME")
|
| 362 |
+
if [ -n "${GIT_BRANCH_NAME:-}" ] && [ "$BRANCH_BYTE_LEN" -gt $MAX_BRANCH_LENGTH ]; then
|
| 363 |
+
>&2 echo "Error: GIT_BRANCH_NAME must be 244 bytes or fewer in UTF-8. Provided value is ${BRANCH_BYTE_LEN} bytes."
|
| 364 |
+
exit 1
|
| 365 |
+
elif [ "$BRANCH_BYTE_LEN" -gt $MAX_BRANCH_LENGTH ]; then
|
| 366 |
+
PREFIX_LENGTH=$(( ${#FEATURE_NUM} + 1 ))
|
| 367 |
+
MAX_SUFFIX_LENGTH=$((MAX_BRANCH_LENGTH - PREFIX_LENGTH))
|
| 368 |
+
|
| 369 |
+
TRUNCATED_SUFFIX=$(echo "$BRANCH_SUFFIX" | cut -c1-$MAX_SUFFIX_LENGTH)
|
| 370 |
+
TRUNCATED_SUFFIX=$(echo "$TRUNCATED_SUFFIX" | sed 's/-$//')
|
| 371 |
+
|
| 372 |
+
ORIGINAL_BRANCH_NAME="$BRANCH_NAME"
|
| 373 |
+
BRANCH_NAME="${FEATURE_NUM}-${TRUNCATED_SUFFIX}"
|
| 374 |
+
|
| 375 |
+
>&2 echo "[specify] Warning: Branch name exceeded GitHub's 244-byte limit"
|
| 376 |
+
>&2 echo "[specify] Original: $ORIGINAL_BRANCH_NAME (${#ORIGINAL_BRANCH_NAME} bytes)"
|
| 377 |
+
>&2 echo "[specify] Truncated to: $BRANCH_NAME (${#BRANCH_NAME} bytes)"
|
| 378 |
+
fi
|
| 379 |
+
|
| 380 |
+
if [ "$DRY_RUN" != true ]; then
|
| 381 |
+
if [ "$HAS_GIT" = true ]; then
|
| 382 |
+
branch_create_error=""
|
| 383 |
+
if ! branch_create_error=$(git checkout -q -b "$BRANCH_NAME" 2>&1); then
|
| 384 |
+
current_branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)"
|
| 385 |
+
if git branch --list "$BRANCH_NAME" | grep -q .; then
|
| 386 |
+
if [ "$ALLOW_EXISTING" = true ]; then
|
| 387 |
+
if [ "$current_branch" = "$BRANCH_NAME" ]; then
|
| 388 |
+
:
|
| 389 |
+
elif ! switch_branch_error=$(git checkout -q "$BRANCH_NAME" 2>&1); then
|
| 390 |
+
>&2 echo "Error: Failed to switch to existing branch '$BRANCH_NAME'. Please resolve any local changes or conflicts and try again."
|
| 391 |
+
if [ -n "$switch_branch_error" ]; then
|
| 392 |
+
>&2 printf '%s\n' "$switch_branch_error"
|
| 393 |
+
fi
|
| 394 |
+
exit 1
|
| 395 |
+
fi
|
| 396 |
+
elif [ "$USE_TIMESTAMP" = true ]; then
|
| 397 |
+
>&2 echo "Error: Branch '$BRANCH_NAME' already exists. Rerun to get a new timestamp or use a different --short-name."
|
| 398 |
+
exit 1
|
| 399 |
+
else
|
| 400 |
+
>&2 echo "Error: Branch '$BRANCH_NAME' already exists. Please use a different feature name or specify a different number with --number."
|
| 401 |
+
exit 1
|
| 402 |
+
fi
|
| 403 |
+
else
|
| 404 |
+
>&2 echo "Error: Failed to create git branch '$BRANCH_NAME'."
|
| 405 |
+
if [ -n "$branch_create_error" ]; then
|
| 406 |
+
>&2 printf '%s\n' "$branch_create_error"
|
| 407 |
+
else
|
| 408 |
+
>&2 echo "Please check your git configuration and try again."
|
| 409 |
+
fi
|
| 410 |
+
exit 1
|
| 411 |
+
fi
|
| 412 |
+
fi
|
| 413 |
+
else
|
| 414 |
+
>&2 echo "[specify] Warning: Git repository not detected; skipped branch creation for $BRANCH_NAME"
|
| 415 |
+
fi
|
| 416 |
+
|
| 417 |
+
printf '# To persist: export SPECIFY_FEATURE=%q\n' "$BRANCH_NAME" >&2
|
| 418 |
+
fi
|
| 419 |
+
|
| 420 |
+
if $JSON_MODE; then
|
| 421 |
+
if command -v jq >/dev/null 2>&1; then
|
| 422 |
+
if [ "$DRY_RUN" = true ]; then
|
| 423 |
+
jq -cn \
|
| 424 |
+
--arg branch_name "$BRANCH_NAME" \
|
| 425 |
+
--arg feature_num "$FEATURE_NUM" \
|
| 426 |
+
'{BRANCH_NAME:$branch_name,FEATURE_NUM:$feature_num,DRY_RUN:true}'
|
| 427 |
+
else
|
| 428 |
+
jq -cn \
|
| 429 |
+
--arg branch_name "$BRANCH_NAME" \
|
| 430 |
+
--arg feature_num "$FEATURE_NUM" \
|
| 431 |
+
'{BRANCH_NAME:$branch_name,FEATURE_NUM:$feature_num}'
|
| 432 |
+
fi
|
| 433 |
+
else
|
| 434 |
+
if type json_escape >/dev/null 2>&1; then
|
| 435 |
+
_je_branch=$(json_escape "$BRANCH_NAME")
|
| 436 |
+
_je_num=$(json_escape "$FEATURE_NUM")
|
| 437 |
+
else
|
| 438 |
+
_je_branch="$BRANCH_NAME"
|
| 439 |
+
_je_num="$FEATURE_NUM"
|
| 440 |
+
fi
|
| 441 |
+
if [ "$DRY_RUN" = true ]; then
|
| 442 |
+
printf '{"BRANCH_NAME":"%s","FEATURE_NUM":"%s","DRY_RUN":true}\n' "$_je_branch" "$_je_num"
|
| 443 |
+
else
|
| 444 |
+
printf '{"BRANCH_NAME":"%s","FEATURE_NUM":"%s"}\n' "$_je_branch" "$_je_num"
|
| 445 |
+
fi
|
| 446 |
+
fi
|
| 447 |
+
else
|
| 448 |
+
echo "BRANCH_NAME: $BRANCH_NAME"
|
| 449 |
+
echo "FEATURE_NUM: $FEATURE_NUM"
|
| 450 |
+
if [ "$DRY_RUN" != true ]; then
|
| 451 |
+
printf '# To persist in your shell: export SPECIFY_FEATURE=%q\n' "$BRANCH_NAME"
|
| 452 |
+
fi
|
| 453 |
+
fi
|
.specify/extensions/git/scripts/bash/git-common.sh
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Git-specific common functions for the git extension.
|
| 3 |
+
# Extracted from scripts/bash/common.sh β contains only git-specific
|
| 4 |
+
# branch validation and detection logic.
|
| 5 |
+
|
| 6 |
+
# Check if we have git available at the repo root
|
| 7 |
+
has_git() {
|
| 8 |
+
local repo_root="${1:-$(pwd)}"
|
| 9 |
+
{ [ -d "$repo_root/.git" ] || [ -f "$repo_root/.git" ]; } && \
|
| 10 |
+
command -v git >/dev/null 2>&1 && \
|
| 11 |
+
git -C "$repo_root" rev-parse --is-inside-work-tree >/dev/null 2>&1
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
# Strip a single optional path segment (e.g. gitflow "feat/004-name" -> "004-name").
|
| 15 |
+
# Only when the full name is exactly two slash-free segments; otherwise returns the raw name.
|
| 16 |
+
spec_kit_effective_branch_name() {
|
| 17 |
+
local raw="$1"
|
| 18 |
+
if [[ "$raw" =~ ^([^/]+)/([^/]+)$ ]]; then
|
| 19 |
+
printf '%s\n' "${BASH_REMATCH[2]}"
|
| 20 |
+
else
|
| 21 |
+
printf '%s\n' "$raw"
|
| 22 |
+
fi
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
# Validate that a branch name matches the expected feature branch pattern.
|
| 26 |
+
# Accepts sequential (###-* with >=3 digits) or timestamp (YYYYMMDD-HHMMSS-*) formats.
|
| 27 |
+
# Logic aligned with scripts/bash/common.sh check_feature_branch after effective-name normalization.
|
| 28 |
+
check_feature_branch() {
|
| 29 |
+
local raw="$1"
|
| 30 |
+
local has_git_repo="$2"
|
| 31 |
+
|
| 32 |
+
# For non-git repos, we can't enforce branch naming but still provide output
|
| 33 |
+
if [[ "$has_git_repo" != "true" ]]; then
|
| 34 |
+
echo "[specify] Warning: Git repository not detected; skipped branch validation" >&2
|
| 35 |
+
return 0
|
| 36 |
+
fi
|
| 37 |
+
|
| 38 |
+
local branch
|
| 39 |
+
branch=$(spec_kit_effective_branch_name "$raw")
|
| 40 |
+
|
| 41 |
+
# Accept sequential prefix (3+ digits) but exclude malformed timestamps
|
| 42 |
+
# Malformed: 7-or-8 digit date + 6-digit time with no trailing slug (e.g. "2026031-143022" or "20260319-143022")
|
| 43 |
+
local is_sequential=false
|
| 44 |
+
if [[ "$branch" =~ ^[0-9]{3,}- ]] && [[ ! "$branch" =~ ^[0-9]{7}-[0-9]{6}- ]] && [[ ! "$branch" =~ ^[0-9]{7,8}-[0-9]{6}$ ]]; then
|
| 45 |
+
is_sequential=true
|
| 46 |
+
fi
|
| 47 |
+
if [[ "$is_sequential" != "true" ]] && [[ ! "$branch" =~ ^[0-9]{8}-[0-9]{6}- ]]; then
|
| 48 |
+
echo "ERROR: Not on a feature branch. Current branch: $raw" >&2
|
| 49 |
+
echo "Feature branches should be named like: 001-feature-name, 1234-feature-name, or 20260319-143022-feature-name" >&2
|
| 50 |
+
return 1
|
| 51 |
+
fi
|
| 52 |
+
|
| 53 |
+
return 0
|
| 54 |
+
}
|
.specify/extensions/git/scripts/bash/initialize-repo.sh
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Git extension: initialize-repo.sh
|
| 3 |
+
# Initialize a Git repository with an initial commit.
|
| 4 |
+
# Customizable β replace this script to add .gitignore templates,
|
| 5 |
+
# default branch config, git-flow, LFS, signing, etc.
|
| 6 |
+
|
| 7 |
+
set -e
|
| 8 |
+
|
| 9 |
+
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 10 |
+
|
| 11 |
+
# Find project root
|
| 12 |
+
_find_project_root() {
|
| 13 |
+
local dir="$1"
|
| 14 |
+
while [ "$dir" != "/" ]; do
|
| 15 |
+
if [ -d "$dir/.specify" ] || [ -d "$dir/.git" ]; then
|
| 16 |
+
echo "$dir"
|
| 17 |
+
return 0
|
| 18 |
+
fi
|
| 19 |
+
dir="$(dirname "$dir")"
|
| 20 |
+
done
|
| 21 |
+
return 1
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
REPO_ROOT=$(_find_project_root "$SCRIPT_DIR") || REPO_ROOT="$(pwd)"
|
| 25 |
+
cd "$REPO_ROOT"
|
| 26 |
+
|
| 27 |
+
# Read commit message from extension config, fall back to default
|
| 28 |
+
COMMIT_MSG="[Spec Kit] Initial commit"
|
| 29 |
+
_config_file="$REPO_ROOT/.specify/extensions/git/git-config.yml"
|
| 30 |
+
if [ -f "$_config_file" ]; then
|
| 31 |
+
_msg=$(grep '^init_commit_message:' "$_config_file" 2>/dev/null | sed 's/^init_commit_message:[[:space:]]*//' | sed 's/^["'\'']//' | sed 's/["'\'']*$//')
|
| 32 |
+
if [ -n "$_msg" ]; then
|
| 33 |
+
COMMIT_MSG="$_msg"
|
| 34 |
+
fi
|
| 35 |
+
fi
|
| 36 |
+
|
| 37 |
+
# Check if git is available
|
| 38 |
+
if ! command -v git >/dev/null 2>&1; then
|
| 39 |
+
echo "[specify] Warning: Git not found; skipped repository initialization" >&2
|
| 40 |
+
exit 0
|
| 41 |
+
fi
|
| 42 |
+
|
| 43 |
+
# Check if already a git repo
|
| 44 |
+
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
| 45 |
+
echo "[specify] Git repository already initialized; skipping" >&2
|
| 46 |
+
exit 0
|
| 47 |
+
fi
|
| 48 |
+
|
| 49 |
+
# Initialize
|
| 50 |
+
_git_out=$(git init -q 2>&1) || { echo "[specify] Error: git init failed: $_git_out" >&2; exit 1; }
|
| 51 |
+
_git_out=$(git add . 2>&1) || { echo "[specify] Error: git add failed: $_git_out" >&2; exit 1; }
|
| 52 |
+
_git_out=$(git commit --allow-empty -q -m "$COMMIT_MSG" 2>&1) || { echo "[specify] Error: git commit failed: $_git_out" >&2; exit 1; }
|
| 53 |
+
|
| 54 |
+
echo "β Git repository initialized" >&2
|
.specify/extensions/git/scripts/powershell/auto-commit.ps1
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# Git extension: auto-commit.ps1
|
| 3 |
+
# Automatically commit changes after a Spec Kit command completes.
|
| 4 |
+
# Checks per-command config keys in git-config.yml before committing.
|
| 5 |
+
#
|
| 6 |
+
# Usage: auto-commit.ps1 <event_name>
|
| 7 |
+
# e.g.: auto-commit.ps1 after_specify
|
| 8 |
+
param(
|
| 9 |
+
[Parameter(Position = 0, Mandatory = $true)]
|
| 10 |
+
[string]$EventName
|
| 11 |
+
)
|
| 12 |
+
$ErrorActionPreference = 'Stop'
|
| 13 |
+
|
| 14 |
+
function Find-ProjectRoot {
|
| 15 |
+
param([string]$StartDir)
|
| 16 |
+
$current = Resolve-Path $StartDir
|
| 17 |
+
while ($true) {
|
| 18 |
+
foreach ($marker in @('.specify', '.git')) {
|
| 19 |
+
if (Test-Path (Join-Path $current $marker)) {
|
| 20 |
+
return $current
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
$parent = Split-Path $current -Parent
|
| 24 |
+
if ($parent -eq $current) { return $null }
|
| 25 |
+
$current = $parent
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
$repoRoot = Find-ProjectRoot -StartDir $PSScriptRoot
|
| 30 |
+
if (-not $repoRoot) { $repoRoot = Get-Location }
|
| 31 |
+
Set-Location $repoRoot
|
| 32 |
+
|
| 33 |
+
# Check if git is available
|
| 34 |
+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
| 35 |
+
Write-Warning "[specify] Warning: Git not found; skipped auto-commit"
|
| 36 |
+
exit 0
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
# Temporarily relax ErrorActionPreference so git stderr warnings
|
| 40 |
+
# (e.g. CRLF notices on Windows) do not become terminating errors.
|
| 41 |
+
$savedEAP = $ErrorActionPreference
|
| 42 |
+
$ErrorActionPreference = 'Continue'
|
| 43 |
+
try {
|
| 44 |
+
git rev-parse --is-inside-work-tree 2>$null | Out-Null
|
| 45 |
+
$isRepo = $LASTEXITCODE -eq 0
|
| 46 |
+
} finally {
|
| 47 |
+
$ErrorActionPreference = $savedEAP
|
| 48 |
+
}
|
| 49 |
+
if (-not $isRepo) {
|
| 50 |
+
Write-Warning "[specify] Warning: Not a Git repository; skipped auto-commit"
|
| 51 |
+
exit 0
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
# Read per-command config from git-config.yml
|
| 55 |
+
$configFile = Join-Path $repoRoot ".specify/extensions/git/git-config.yml"
|
| 56 |
+
$enabled = $false
|
| 57 |
+
$commitMsg = ""
|
| 58 |
+
|
| 59 |
+
if (Test-Path $configFile) {
|
| 60 |
+
# Parse YAML to find auto_commit section
|
| 61 |
+
$inAutoCommit = $false
|
| 62 |
+
$inEvent = $false
|
| 63 |
+
$defaultEnabled = $false
|
| 64 |
+
|
| 65 |
+
foreach ($line in Get-Content $configFile) {
|
| 66 |
+
# Detect auto_commit: section
|
| 67 |
+
if ($line -match '^auto_commit:') {
|
| 68 |
+
$inAutoCommit = $true
|
| 69 |
+
$inEvent = $false
|
| 70 |
+
continue
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
# Exit auto_commit section on next top-level key
|
| 74 |
+
if ($inAutoCommit -and $line -match '^[a-z]') {
|
| 75 |
+
break
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
if ($inAutoCommit) {
|
| 79 |
+
# Check default key
|
| 80 |
+
if ($line -match '^\s+default:\s*(.+)$') {
|
| 81 |
+
$val = $matches[1].Trim().ToLower()
|
| 82 |
+
if ($val -eq 'true') { $defaultEnabled = $true }
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
# Detect our event subsection
|
| 86 |
+
if ($line -match "^\s+${EventName}:") {
|
| 87 |
+
$inEvent = $true
|
| 88 |
+
continue
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
# Inside our event subsection
|
| 92 |
+
if ($inEvent) {
|
| 93 |
+
# Exit on next sibling key (2-space indent, not 4+)
|
| 94 |
+
if ($line -match '^\s{2}[a-z]' -and $line -notmatch '^\s{4}') {
|
| 95 |
+
$inEvent = $false
|
| 96 |
+
continue
|
| 97 |
+
}
|
| 98 |
+
if ($line -match '\s+enabled:\s*(.+)$') {
|
| 99 |
+
$val = $matches[1].Trim().ToLower()
|
| 100 |
+
if ($val -eq 'true') { $enabled = $true }
|
| 101 |
+
if ($val -eq 'false') { $enabled = $false }
|
| 102 |
+
}
|
| 103 |
+
if ($line -match '\s+message:\s*(.+)$') {
|
| 104 |
+
$commitMsg = $matches[1].Trim() -replace '^["'']' -replace '["'']$'
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
# If event-specific key not found, use default
|
| 111 |
+
if (-not $enabled -and $defaultEnabled) {
|
| 112 |
+
$hasEventKey = Select-String -Path $configFile -Pattern "^\s*${EventName}:" -Quiet
|
| 113 |
+
if (-not $hasEventKey) {
|
| 114 |
+
$enabled = $true
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
} else {
|
| 118 |
+
# No config file β auto-commit disabled by default
|
| 119 |
+
exit 0
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
if (-not $enabled) {
|
| 123 |
+
exit 0
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
# Check if there are changes to commit
|
| 127 |
+
# Relax ErrorActionPreference so CRLF warnings on stderr do not terminate.
|
| 128 |
+
$savedEAP = $ErrorActionPreference
|
| 129 |
+
$ErrorActionPreference = 'Continue'
|
| 130 |
+
try {
|
| 131 |
+
git diff --quiet HEAD 2>$null; $d1 = $LASTEXITCODE
|
| 132 |
+
git diff --cached --quiet 2>$null; $d2 = $LASTEXITCODE
|
| 133 |
+
$untracked = git ls-files --others --exclude-standard 2>$null
|
| 134 |
+
} finally {
|
| 135 |
+
$ErrorActionPreference = $savedEAP
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
if ($d1 -eq 0 -and $d2 -eq 0 -and -not $untracked) {
|
| 139 |
+
Write-Host "[specify] No changes to commit after $EventName" -ForegroundColor DarkGray
|
| 140 |
+
exit 0
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
# Derive a human-readable command name from the event
|
| 144 |
+
$commandName = $EventName -replace '^after_', '' -replace '^before_', ''
|
| 145 |
+
$phase = if ($EventName -match '^before_') { 'before' } else { 'after' }
|
| 146 |
+
|
| 147 |
+
# Use custom message if configured, otherwise default
|
| 148 |
+
if (-not $commitMsg) {
|
| 149 |
+
$commitMsg = "[Spec Kit] Auto-commit $phase $commandName"
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
# Stage and commit
|
| 153 |
+
# Relax ErrorActionPreference so CRLF warnings on stderr do not terminate,
|
| 154 |
+
# while still allowing redirected error output to be captured for diagnostics.
|
| 155 |
+
$savedEAP = $ErrorActionPreference
|
| 156 |
+
$ErrorActionPreference = 'Continue'
|
| 157 |
+
try {
|
| 158 |
+
$out = git add . 2>&1 | Out-String
|
| 159 |
+
if ($LASTEXITCODE -ne 0) { throw "git add failed: $out" }
|
| 160 |
+
$out = git commit -q -m $commitMsg 2>&1 | Out-String
|
| 161 |
+
if ($LASTEXITCODE -ne 0) { throw "git commit failed: $out" }
|
| 162 |
+
} catch {
|
| 163 |
+
Write-Warning "[specify] Error: $_"
|
| 164 |
+
exit 1
|
| 165 |
+
} finally {
|
| 166 |
+
$ErrorActionPreference = $savedEAP
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
Write-Host "[OK] Changes committed $phase $commandName"
|
.specify/extensions/git/scripts/powershell/create-new-feature.ps1
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# Git extension: create-new-feature.ps1
|
| 3 |
+
# Adapted from core scripts/powershell/create-new-feature.ps1 for extension layout.
|
| 4 |
+
# Sources common.ps1 from the project's installed scripts, falling back to
|
| 5 |
+
# git-common.ps1 for minimal git helpers.
|
| 6 |
+
[CmdletBinding()]
|
| 7 |
+
param(
|
| 8 |
+
[switch]$Json,
|
| 9 |
+
[switch]$AllowExistingBranch,
|
| 10 |
+
[switch]$DryRun,
|
| 11 |
+
[string]$ShortName,
|
| 12 |
+
[Parameter()]
|
| 13 |
+
[long]$Number = 0,
|
| 14 |
+
[switch]$Timestamp,
|
| 15 |
+
[switch]$Help,
|
| 16 |
+
[Parameter(Position = 0, ValueFromRemainingArguments = $true)]
|
| 17 |
+
[string[]]$FeatureDescription
|
| 18 |
+
)
|
| 19 |
+
$ErrorActionPreference = 'Stop'
|
| 20 |
+
|
| 21 |
+
if ($Help) {
|
| 22 |
+
Write-Host "Usage: ./create-new-feature.ps1 [-Json] [-DryRun] [-AllowExistingBranch] [-ShortName <name>] [-Number N] [-Timestamp] <feature description>"
|
| 23 |
+
Write-Host ""
|
| 24 |
+
Write-Host "Options:"
|
| 25 |
+
Write-Host " -Json Output in JSON format"
|
| 26 |
+
Write-Host " -DryRun Compute branch name without creating the branch"
|
| 27 |
+
Write-Host " -AllowExistingBranch Switch to branch if it already exists instead of failing"
|
| 28 |
+
Write-Host " -ShortName <name> Provide a custom short name (2-4 words) for the branch"
|
| 29 |
+
Write-Host " -Number N Specify branch number manually (overrides auto-detection)"
|
| 30 |
+
Write-Host " -Timestamp Use timestamp prefix (YYYYMMDD-HHMMSS) instead of sequential numbering"
|
| 31 |
+
Write-Host " -Help Show this help message"
|
| 32 |
+
Write-Host ""
|
| 33 |
+
Write-Host "Environment variables:"
|
| 34 |
+
Write-Host " GIT_BRANCH_NAME Use this exact branch name, bypassing all prefix/suffix generation"
|
| 35 |
+
Write-Host ""
|
| 36 |
+
exit 0
|
| 37 |
+
}
|
| 38 |
+
|
| 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 |
+
if ([string]::IsNullOrWhiteSpace($featureDesc)) {
|
| 47 |
+
Write-Error "Error: Feature description cannot be empty or contain only whitespace"
|
| 48 |
+
exit 1
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
function Get-HighestNumberFromSpecs {
|
| 52 |
+
param([string]$SpecsDir)
|
| 53 |
+
|
| 54 |
+
[long]$highest = 0
|
| 55 |
+
if (Test-Path $SpecsDir) {
|
| 56 |
+
Get-ChildItem -Path $SpecsDir -Directory | ForEach-Object {
|
| 57 |
+
if ($_.Name -match '^(\d{3,})-' -and $_.Name -notmatch '^\d{8}-\d{6}-') {
|
| 58 |
+
[long]$num = 0
|
| 59 |
+
if ([long]::TryParse($matches[1], [ref]$num) -and $num -gt $highest) {
|
| 60 |
+
$highest = $num
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
return $highest
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
function Get-HighestNumberFromNames {
|
| 69 |
+
param([string[]]$Names)
|
| 70 |
+
|
| 71 |
+
[long]$highest = 0
|
| 72 |
+
foreach ($name in $Names) {
|
| 73 |
+
if ($name -match '^(\d{3,})-' -and $name -notmatch '^\d{8}-\d{6}-') {
|
| 74 |
+
[long]$num = 0
|
| 75 |
+
if ([long]::TryParse($matches[1], [ref]$num) -and $num -gt $highest) {
|
| 76 |
+
$highest = $num
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
return $highest
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
function Get-HighestNumberFromBranches {
|
| 84 |
+
param()
|
| 85 |
+
|
| 86 |
+
try {
|
| 87 |
+
$branches = git branch -a 2>$null
|
| 88 |
+
if ($LASTEXITCODE -eq 0 -and $branches) {
|
| 89 |
+
$cleanNames = $branches | ForEach-Object {
|
| 90 |
+
$_.Trim() -replace '^\*?\s+', '' -replace '^remotes/[^/]+/', ''
|
| 91 |
+
}
|
| 92 |
+
return Get-HighestNumberFromNames -Names $cleanNames
|
| 93 |
+
}
|
| 94 |
+
} catch {
|
| 95 |
+
Write-Verbose "Could not check Git branches: $_"
|
| 96 |
+
}
|
| 97 |
+
return 0
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
function Get-HighestNumberFromRemoteRefs {
|
| 101 |
+
[long]$highest = 0
|
| 102 |
+
try {
|
| 103 |
+
$remotes = git remote 2>$null
|
| 104 |
+
if ($remotes) {
|
| 105 |
+
foreach ($remote in $remotes) {
|
| 106 |
+
$env:GIT_TERMINAL_PROMPT = '0'
|
| 107 |
+
$refs = git ls-remote --heads $remote 2>$null
|
| 108 |
+
$env:GIT_TERMINAL_PROMPT = $null
|
| 109 |
+
if ($LASTEXITCODE -eq 0 -and $refs) {
|
| 110 |
+
$refNames = $refs | ForEach-Object {
|
| 111 |
+
if ($_ -match 'refs/heads/(.+)$') { $matches[1] }
|
| 112 |
+
} | Where-Object { $_ }
|
| 113 |
+
$remoteHighest = Get-HighestNumberFromNames -Names $refNames
|
| 114 |
+
if ($remoteHighest -gt $highest) { $highest = $remoteHighest }
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
} catch {
|
| 119 |
+
Write-Verbose "Could not query remote refs: $_"
|
| 120 |
+
}
|
| 121 |
+
return $highest
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
function Get-NextBranchNumber {
|
| 125 |
+
param(
|
| 126 |
+
[string]$SpecsDir,
|
| 127 |
+
[switch]$SkipFetch
|
| 128 |
+
)
|
| 129 |
+
|
| 130 |
+
if ($SkipFetch) {
|
| 131 |
+
$highestBranch = Get-HighestNumberFromBranches
|
| 132 |
+
$highestRemote = Get-HighestNumberFromRemoteRefs
|
| 133 |
+
$highestBranch = [Math]::Max($highestBranch, $highestRemote)
|
| 134 |
+
} else {
|
| 135 |
+
try {
|
| 136 |
+
git fetch --all --prune 2>$null | Out-Null
|
| 137 |
+
} catch { }
|
| 138 |
+
$highestBranch = Get-HighestNumberFromBranches
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
$highestSpec = Get-HighestNumberFromSpecs -SpecsDir $SpecsDir
|
| 142 |
+
$maxNum = [Math]::Max($highestBranch, $highestSpec)
|
| 143 |
+
return $maxNum + 1
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
function ConvertTo-CleanBranchName {
|
| 147 |
+
param([string]$Name)
|
| 148 |
+
return $Name.ToLower() -replace '[^a-z0-9]', '-' -replace '-{2,}', '-' -replace '^-', '' -replace '-$', ''
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
# ---------------------------------------------------------------------------
|
| 152 |
+
# Source common.ps1 from the project's installed scripts.
|
| 153 |
+
# Search locations in priority order:
|
| 154 |
+
# 1. .specify/scripts/powershell/common.ps1 under the project root
|
| 155 |
+
# 2. scripts/powershell/common.ps1 under the project root (source checkout)
|
| 156 |
+
# 3. git-common.ps1 next to this script (minimal fallback)
|
| 157 |
+
# ---------------------------------------------------------------------------
|
| 158 |
+
function Find-ProjectRoot {
|
| 159 |
+
param([string]$StartDir)
|
| 160 |
+
$current = Resolve-Path $StartDir
|
| 161 |
+
while ($true) {
|
| 162 |
+
foreach ($marker in @('.specify', '.git')) {
|
| 163 |
+
if (Test-Path (Join-Path $current $marker)) {
|
| 164 |
+
return $current
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
$parent = Split-Path $current -Parent
|
| 168 |
+
if ($parent -eq $current) { return $null }
|
| 169 |
+
$current = $parent
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
$projectRoot = Find-ProjectRoot -StartDir $PSScriptRoot
|
| 174 |
+
$commonLoaded = $false
|
| 175 |
+
|
| 176 |
+
if ($projectRoot) {
|
| 177 |
+
$candidates = @(
|
| 178 |
+
(Join-Path $projectRoot ".specify/scripts/powershell/common.ps1"),
|
| 179 |
+
(Join-Path $projectRoot "scripts/powershell/common.ps1")
|
| 180 |
+
)
|
| 181 |
+
foreach ($candidate in $candidates) {
|
| 182 |
+
if (Test-Path $candidate) {
|
| 183 |
+
. $candidate
|
| 184 |
+
$commonLoaded = $true
|
| 185 |
+
break
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
if (-not $commonLoaded -and (Test-Path "$PSScriptRoot/git-common.ps1")) {
|
| 191 |
+
. "$PSScriptRoot/git-common.ps1"
|
| 192 |
+
$commonLoaded = $true
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
if (-not $commonLoaded) {
|
| 196 |
+
throw "Unable to locate common script file. Please ensure the Specify core scripts are installed."
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
# Resolve repository root
|
| 200 |
+
if (Get-Command Get-RepoRoot -ErrorAction SilentlyContinue) {
|
| 201 |
+
$repoRoot = Get-RepoRoot
|
| 202 |
+
} elseif ($projectRoot) {
|
| 203 |
+
$repoRoot = $projectRoot
|
| 204 |
+
} else {
|
| 205 |
+
throw "Could not determine repository root."
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
# Check if git is available
|
| 209 |
+
if (Get-Command Test-HasGit -ErrorAction SilentlyContinue) {
|
| 210 |
+
# Call without parameters for compatibility with core common.ps1 (no -RepoRoot param)
|
| 211 |
+
# and git-common.ps1 (has -RepoRoot param with default).
|
| 212 |
+
$hasGit = Test-HasGit
|
| 213 |
+
} else {
|
| 214 |
+
try {
|
| 215 |
+
git -C $repoRoot rev-parse --is-inside-work-tree 2>$null | Out-Null
|
| 216 |
+
$hasGit = ($LASTEXITCODE -eq 0)
|
| 217 |
+
} catch {
|
| 218 |
+
$hasGit = $false
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
Set-Location $repoRoot
|
| 223 |
+
|
| 224 |
+
$specsDir = Join-Path $repoRoot 'specs'
|
| 225 |
+
|
| 226 |
+
function Get-BranchName {
|
| 227 |
+
param([string]$Description)
|
| 228 |
+
|
| 229 |
+
$stopWords = @(
|
| 230 |
+
'i', 'a', 'an', 'the', 'to', 'for', 'of', 'in', 'on', 'at', 'by', 'with', 'from',
|
| 231 |
+
'is', 'are', 'was', 'were', 'be', 'been', 'being', 'have', 'has', 'had',
|
| 232 |
+
'do', 'does', 'did', 'will', 'would', 'should', 'could', 'can', 'may', 'might', 'must', 'shall',
|
| 233 |
+
'this', 'that', 'these', 'those', 'my', 'your', 'our', 'their',
|
| 234 |
+
'want', 'need', 'add', 'get', 'set'
|
| 235 |
+
)
|
| 236 |
+
|
| 237 |
+
$cleanName = $Description.ToLower() -replace '[^a-z0-9\s]', ' '
|
| 238 |
+
$words = $cleanName -split '\s+' | Where-Object { $_ }
|
| 239 |
+
|
| 240 |
+
$meaningfulWords = @()
|
| 241 |
+
foreach ($word in $words) {
|
| 242 |
+
if ($stopWords -contains $word) { continue }
|
| 243 |
+
if ($word.Length -ge 3) {
|
| 244 |
+
$meaningfulWords += $word
|
| 245 |
+
} elseif ($Description -match "\b$($word.ToUpper())\b") {
|
| 246 |
+
$meaningfulWords += $word
|
| 247 |
+
}
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
if ($meaningfulWords.Count -gt 0) {
|
| 251 |
+
$maxWords = if ($meaningfulWords.Count -eq 4) { 4 } else { 3 }
|
| 252 |
+
$result = ($meaningfulWords | Select-Object -First $maxWords) -join '-'
|
| 253 |
+
return $result
|
| 254 |
+
} else {
|
| 255 |
+
$result = ConvertTo-CleanBranchName -Name $Description
|
| 256 |
+
$fallbackWords = ($result -split '-') | Where-Object { $_ } | Select-Object -First 3
|
| 257 |
+
return [string]::Join('-', $fallbackWords)
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
# Check for GIT_BRANCH_NAME env var override (exact branch name, no prefix/suffix)
|
| 262 |
+
if ($env:GIT_BRANCH_NAME) {
|
| 263 |
+
$branchName = $env:GIT_BRANCH_NAME
|
| 264 |
+
# Check 244-byte limit (UTF-8) for override names
|
| 265 |
+
$branchNameUtf8ByteCount = [System.Text.Encoding]::UTF8.GetByteCount($branchName)
|
| 266 |
+
if ($branchNameUtf8ByteCount -gt 244) {
|
| 267 |
+
throw "GIT_BRANCH_NAME must be 244 bytes or fewer in UTF-8. Provided value is $branchNameUtf8ByteCount bytes; please supply a shorter override branch name."
|
| 268 |
+
}
|
| 269 |
+
# Extract FEATURE_NUM from the branch name if it starts with a numeric prefix
|
| 270 |
+
# Check timestamp pattern first (YYYYMMDD-HHMMSS-) since it also matches the simpler ^\d+ pattern
|
| 271 |
+
if ($branchName -match '^(\d{8}-\d{6})-') {
|
| 272 |
+
$featureNum = $matches[1]
|
| 273 |
+
} elseif ($branchName -match '^(\d+)-') {
|
| 274 |
+
$featureNum = $matches[1]
|
| 275 |
+
} else {
|
| 276 |
+
$featureNum = $branchName
|
| 277 |
+
}
|
| 278 |
+
} else {
|
| 279 |
+
if ($ShortName) {
|
| 280 |
+
$branchSuffix = ConvertTo-CleanBranchName -Name $ShortName
|
| 281 |
+
} else {
|
| 282 |
+
$branchSuffix = Get-BranchName -Description $featureDesc
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
if ($Timestamp -and $Number -ne 0) {
|
| 286 |
+
Write-Warning "[specify] Warning: -Number is ignored when -Timestamp is used"
|
| 287 |
+
$Number = 0
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
if ($Timestamp) {
|
| 291 |
+
$featureNum = Get-Date -Format 'yyyyMMdd-HHmmss'
|
| 292 |
+
$branchName = "$featureNum-$branchSuffix"
|
| 293 |
+
} else {
|
| 294 |
+
if ($Number -eq 0) {
|
| 295 |
+
if ($DryRun -and $hasGit) {
|
| 296 |
+
$Number = Get-NextBranchNumber -SpecsDir $specsDir -SkipFetch
|
| 297 |
+
} elseif ($DryRun) {
|
| 298 |
+
$Number = (Get-HighestNumberFromSpecs -SpecsDir $specsDir) + 1
|
| 299 |
+
} elseif ($hasGit) {
|
| 300 |
+
$Number = Get-NextBranchNumber -SpecsDir $specsDir
|
| 301 |
+
} else {
|
| 302 |
+
$Number = (Get-HighestNumberFromSpecs -SpecsDir $specsDir) + 1
|
| 303 |
+
}
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
$featureNum = ('{0:000}' -f $Number)
|
| 307 |
+
$branchName = "$featureNum-$branchSuffix"
|
| 308 |
+
}
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
$maxBranchLength = 244
|
| 312 |
+
if ($branchName.Length -gt $maxBranchLength) {
|
| 313 |
+
$prefixLength = $featureNum.Length + 1
|
| 314 |
+
$maxSuffixLength = $maxBranchLength - $prefixLength
|
| 315 |
+
|
| 316 |
+
$truncatedSuffix = $branchSuffix.Substring(0, [Math]::Min($branchSuffix.Length, $maxSuffixLength))
|
| 317 |
+
$truncatedSuffix = $truncatedSuffix -replace '-$', ''
|
| 318 |
+
|
| 319 |
+
$originalBranchName = $branchName
|
| 320 |
+
$branchName = "$featureNum-$truncatedSuffix"
|
| 321 |
+
|
| 322 |
+
Write-Warning "[specify] Branch name exceeded GitHub's 244-byte limit"
|
| 323 |
+
Write-Warning "[specify] Original: $originalBranchName ($($originalBranchName.Length) bytes)"
|
| 324 |
+
Write-Warning "[specify] Truncated to: $branchName ($($branchName.Length) bytes)"
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
if (-not $DryRun) {
|
| 328 |
+
if ($hasGit) {
|
| 329 |
+
$branchCreated = $false
|
| 330 |
+
$branchCreateError = ''
|
| 331 |
+
try {
|
| 332 |
+
$branchCreateError = git checkout -q -b $branchName 2>&1 | Out-String
|
| 333 |
+
if ($LASTEXITCODE -eq 0) {
|
| 334 |
+
$branchCreated = $true
|
| 335 |
+
}
|
| 336 |
+
} catch {
|
| 337 |
+
$branchCreateError = $_.Exception.Message
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
if (-not $branchCreated) {
|
| 341 |
+
$currentBranch = ''
|
| 342 |
+
try { $currentBranch = (git rev-parse --abbrev-ref HEAD 2>$null).Trim() } catch {}
|
| 343 |
+
$existingBranch = git branch --list $branchName 2>$null
|
| 344 |
+
if ($existingBranch) {
|
| 345 |
+
if ($AllowExistingBranch) {
|
| 346 |
+
if ($currentBranch -eq $branchName) {
|
| 347 |
+
# Already on the target branch
|
| 348 |
+
} else {
|
| 349 |
+
$switchBranchError = git checkout -q $branchName 2>&1 | Out-String
|
| 350 |
+
if ($LASTEXITCODE -ne 0) {
|
| 351 |
+
if ($switchBranchError) {
|
| 352 |
+
Write-Error "Error: Branch '$branchName' exists but could not be checked out.`n$($switchBranchError.Trim())"
|
| 353 |
+
} else {
|
| 354 |
+
Write-Error "Error: Branch '$branchName' exists but could not be checked out. Resolve any uncommitted changes or conflicts and try again."
|
| 355 |
+
}
|
| 356 |
+
exit 1
|
| 357 |
+
}
|
| 358 |
+
}
|
| 359 |
+
} elseif ($Timestamp) {
|
| 360 |
+
Write-Error "Error: Branch '$branchName' already exists. Rerun to get a new timestamp or use a different -ShortName."
|
| 361 |
+
exit 1
|
| 362 |
+
} else {
|
| 363 |
+
Write-Error "Error: Branch '$branchName' already exists. Please use a different feature name or specify a different number with -Number."
|
| 364 |
+
exit 1
|
| 365 |
+
}
|
| 366 |
+
} else {
|
| 367 |
+
if ($branchCreateError) {
|
| 368 |
+
Write-Error "Error: Failed to create git branch '$branchName'.`n$($branchCreateError.Trim())"
|
| 369 |
+
} else {
|
| 370 |
+
Write-Error "Error: Failed to create git branch '$branchName'. Please check your git configuration and try again."
|
| 371 |
+
}
|
| 372 |
+
exit 1
|
| 373 |
+
}
|
| 374 |
+
}
|
| 375 |
+
} else {
|
| 376 |
+
if ($Json) {
|
| 377 |
+
[Console]::Error.WriteLine("[specify] Warning: Git repository not detected; skipped branch creation for $branchName")
|
| 378 |
+
} else {
|
| 379 |
+
Write-Warning "[specify] Warning: Git repository not detected; skipped branch creation for $branchName"
|
| 380 |
+
}
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
$env:SPECIFY_FEATURE = $branchName
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
if ($Json) {
|
| 387 |
+
$obj = [PSCustomObject]@{
|
| 388 |
+
BRANCH_NAME = $branchName
|
| 389 |
+
FEATURE_NUM = $featureNum
|
| 390 |
+
HAS_GIT = $hasGit
|
| 391 |
+
}
|
| 392 |
+
if ($DryRun) {
|
| 393 |
+
$obj | Add-Member -NotePropertyName 'DRY_RUN' -NotePropertyValue $true
|
| 394 |
+
}
|
| 395 |
+
$obj | ConvertTo-Json -Compress
|
| 396 |
+
} else {
|
| 397 |
+
Write-Output "BRANCH_NAME: $branchName"
|
| 398 |
+
Write-Output "FEATURE_NUM: $featureNum"
|
| 399 |
+
Write-Output "HAS_GIT: $hasGit"
|
| 400 |
+
if (-not $DryRun) {
|
| 401 |
+
Write-Output "SPECIFY_FEATURE environment variable set to: $branchName"
|
| 402 |
+
}
|
| 403 |
+
}
|
.specify/extensions/git/scripts/powershell/git-common.ps1
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# Git-specific common functions for the git extension.
|
| 3 |
+
# Extracted from scripts/powershell/common.ps1 β contains only git-specific
|
| 4 |
+
# branch validation and detection logic.
|
| 5 |
+
|
| 6 |
+
function Test-HasGit {
|
| 7 |
+
param([string]$RepoRoot = (Get-Location))
|
| 8 |
+
try {
|
| 9 |
+
if (-not (Test-Path (Join-Path $RepoRoot '.git'))) { return $false }
|
| 10 |
+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) { return $false }
|
| 11 |
+
git -C $RepoRoot rev-parse --is-inside-work-tree 2>$null | Out-Null
|
| 12 |
+
return ($LASTEXITCODE -eq 0)
|
| 13 |
+
} catch {
|
| 14 |
+
return $false
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
function Get-SpecKitEffectiveBranchName {
|
| 19 |
+
param([string]$Branch)
|
| 20 |
+
if ($Branch -match '^([^/]+)/([^/]+)$') {
|
| 21 |
+
return $Matches[2]
|
| 22 |
+
}
|
| 23 |
+
return $Branch
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
function Test-FeatureBranch {
|
| 27 |
+
param(
|
| 28 |
+
[string]$Branch,
|
| 29 |
+
[bool]$HasGit = $true
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
# For non-git repos, we can't enforce branch naming but still provide output
|
| 33 |
+
if (-not $HasGit) {
|
| 34 |
+
Write-Warning "[specify] Warning: Git repository not detected; skipped branch validation"
|
| 35 |
+
return $true
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
$raw = $Branch
|
| 39 |
+
$Branch = Get-SpecKitEffectiveBranchName $raw
|
| 40 |
+
|
| 41 |
+
# Accept sequential prefix (3+ digits) but exclude malformed timestamps
|
| 42 |
+
# Malformed: 7-or-8 digit date + 6-digit time with no trailing slug (e.g. "2026031-143022" or "20260319-143022")
|
| 43 |
+
$hasMalformedTimestamp = ($Branch -match '^[0-9]{7}-[0-9]{6}-') -or ($Branch -match '^(?:\d{7}|\d{8})-\d{6}$')
|
| 44 |
+
$isSequential = ($Branch -match '^[0-9]{3,}-') -and (-not $hasMalformedTimestamp)
|
| 45 |
+
if (-not $isSequential -and $Branch -notmatch '^\d{8}-\d{6}-') {
|
| 46 |
+
[Console]::Error.WriteLine("ERROR: Not on a feature branch. Current branch: $raw")
|
| 47 |
+
[Console]::Error.WriteLine("Feature branches should be named like: 001-feature-name, 1234-feature-name, or 20260319-143022-feature-name")
|
| 48 |
+
return $false
|
| 49 |
+
}
|
| 50 |
+
return $true
|
| 51 |
+
}
|
.specify/extensions/git/scripts/powershell/initialize-repo.ps1
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# Git extension: initialize-repo.ps1
|
| 3 |
+
# Initialize a Git repository with an initial commit.
|
| 4 |
+
# Customizable β replace this script to add .gitignore templates,
|
| 5 |
+
# default branch config, git-flow, LFS, signing, etc.
|
| 6 |
+
$ErrorActionPreference = 'Stop'
|
| 7 |
+
|
| 8 |
+
# Find project root
|
| 9 |
+
function Find-ProjectRoot {
|
| 10 |
+
param([string]$StartDir)
|
| 11 |
+
$current = Resolve-Path $StartDir
|
| 12 |
+
while ($true) {
|
| 13 |
+
foreach ($marker in @('.specify', '.git')) {
|
| 14 |
+
if (Test-Path (Join-Path $current $marker)) {
|
| 15 |
+
return $current
|
| 16 |
+
}
|
| 17 |
+
}
|
| 18 |
+
$parent = Split-Path $current -Parent
|
| 19 |
+
if ($parent -eq $current) { return $null }
|
| 20 |
+
$current = $parent
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
$repoRoot = Find-ProjectRoot -StartDir $PSScriptRoot
|
| 25 |
+
if (-not $repoRoot) { $repoRoot = Get-Location }
|
| 26 |
+
Set-Location $repoRoot
|
| 27 |
+
|
| 28 |
+
# Read commit message from extension config, fall back to default
|
| 29 |
+
$commitMsg = "[Spec Kit] Initial commit"
|
| 30 |
+
$configFile = Join-Path $repoRoot ".specify/extensions/git/git-config.yml"
|
| 31 |
+
if (Test-Path $configFile) {
|
| 32 |
+
foreach ($line in Get-Content $configFile) {
|
| 33 |
+
if ($line -match '^init_commit_message:\s*(.+)$') {
|
| 34 |
+
$val = $matches[1].Trim() -replace '^["'']' -replace '["'']$'
|
| 35 |
+
if ($val) { $commitMsg = $val }
|
| 36 |
+
break
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
# Check if git is available
|
| 42 |
+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
| 43 |
+
Write-Warning "[specify] Warning: Git not found; skipped repository initialization"
|
| 44 |
+
exit 0
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
# Check if already a git repo
|
| 48 |
+
try {
|
| 49 |
+
git rev-parse --is-inside-work-tree 2>$null | Out-Null
|
| 50 |
+
if ($LASTEXITCODE -eq 0) {
|
| 51 |
+
Write-Warning "[specify] Git repository already initialized; skipping"
|
| 52 |
+
exit 0
|
| 53 |
+
}
|
| 54 |
+
} catch { }
|
| 55 |
+
|
| 56 |
+
# Initialize
|
| 57 |
+
try {
|
| 58 |
+
$out = git init -q 2>&1 | Out-String
|
| 59 |
+
if ($LASTEXITCODE -ne 0) { throw "git init failed: $out" }
|
| 60 |
+
$out = git add . 2>&1 | Out-String
|
| 61 |
+
if ($LASTEXITCODE -ne 0) { throw "git add failed: $out" }
|
| 62 |
+
$out = git commit --allow-empty -q -m $commitMsg 2>&1 | Out-String
|
| 63 |
+
if ($LASTEXITCODE -ne 0) { throw "git commit failed: $out" }
|
| 64 |
+
} catch {
|
| 65 |
+
Write-Warning "[specify] Error: $_"
|
| 66 |
+
exit 1
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
Write-Host "β Git repository initialized"
|
.specify/init-options.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"ai": "generic",
|
| 3 |
+
"branch_numbering": "sequential",
|
| 4 |
+
"context_file": "AGENTS.md",
|
| 5 |
+
"here": true,
|
| 6 |
+
"integration": "generic",
|
| 7 |
+
"script": "ps",
|
| 8 |
+
"speckit_version": "0.8.14.dev0"
|
| 9 |
+
}
|
.specify/integration.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "0.8.14.dev0",
|
| 3 |
+
"integration_state_schema": 1,
|
| 4 |
+
"installed_integrations": [
|
| 5 |
+
"generic"
|
| 6 |
+
],
|
| 7 |
+
"integration_settings": {
|
| 8 |
+
"generic": {
|
| 9 |
+
"script": "ps",
|
| 10 |
+
"raw_options": "--commands-dir .hermes/commands",
|
| 11 |
+
"parsed_options": {
|
| 12 |
+
"commands_dir": ".hermes/commands"
|
| 13 |
+
},
|
| 14 |
+
"invoke_separator": "."
|
| 15 |
+
}
|
| 16 |
+
},
|
| 17 |
+
"integration": "generic",
|
| 18 |
+
"default_integration": "generic"
|
| 19 |
+
}
|
.specify/integrations/generic.manifest.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"integration": "generic",
|
| 3 |
+
"version": "0.8.14.dev0",
|
| 4 |
+
"installed_at": "2026-05-22T14:39:47.901320+00:00",
|
| 5 |
+
"files": {
|
| 6 |
+
".hermes/commands/speckit.analyze.md": "56285817b93f55ae926eade0528673d25ffcf441e8109492323bfbe8941be8f7",
|
| 7 |
+
".hermes/commands/speckit.checklist.md": "53ce35462c1df402780e730ea54150a30872e6e0d6d44a8bd38dd8b5d42900a9",
|
| 8 |
+
".hermes/commands/speckit.clarify.md": "97b14836d6174f0ef51d8bbda0b731c87ef0b011aa36ccd4171a2fc3d7e3280a",
|
| 9 |
+
".hermes/commands/speckit.constitution.md": "58d35eb026f56bb7364d91b8b0382d5dd1249ded6c1449a2b69546693afb85f7",
|
| 10 |
+
".hermes/commands/speckit.implement.md": "ea8e0ce5b01147da298c49603da8c68322ab8f4c029d1a54b3c2436f6180a7bb",
|
| 11 |
+
".hermes/commands/speckit.plan.md": "b9534d77d040b2ec242e8c60718f52b6ad32b736aecd8970b993449ccc8d35e8",
|
| 12 |
+
".hermes/commands/speckit.specify.md": "c7b1ab7ceafc42607e86dd6c0dab0b5cb74462a93a3cdd3b5e7173468cc88bdf",
|
| 13 |
+
".hermes/commands/speckit.tasks.md": "7aa5300dd7387f7c418243f70904b618d01984760d2337a50124a1371d5a0dbf",
|
| 14 |
+
".hermes/commands/speckit.taskstoissues.md": "12532e50c8f9aeb453a565aec6aa6f53abe53cf92926ca553b3d2c61b6b7b6e3"
|
| 15 |
+
}
|
| 16 |
+
}
|
.specify/integrations/speckit.manifest.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"integration": "speckit",
|
| 3 |
+
"version": "0.8.14.dev0",
|
| 4 |
+
"installed_at": "2026-05-22T14:36:15.559918+00:00",
|
| 5 |
+
"files": {
|
| 6 |
+
".specify/scripts/powershell/check-prerequisites.ps1": "bcb37804b0757c37799b65a9321c1d3fb7b7ddcab6703c55c5b9a142c9166bf1",
|
| 7 |
+
".specify/scripts/powershell/common.ps1": "916b3ea1e29ef626a353f0ec011f906c6afff6818a97d560a0321b8557d970ec",
|
| 8 |
+
".specify/scripts/powershell/create-new-feature.ps1": "0a7fc929db81b6318205ab3506187762bae1c4d3b2184f15e903ca54b78511e2",
|
| 9 |
+
".specify/scripts/powershell/setup-plan.ps1": "137af47d79085d2770714ece307ed8f56f0d4cb1e9ec0c17db5c5c0d0b8a8c4c",
|
| 10 |
+
".specify/scripts/powershell/setup-tasks.ps1": "aa7b19077dc4f6feee1dae47f68dc3e6d8ac75adf572a949443f3322b753cfa2",
|
| 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,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# HUBAPI Pre-Launch Website Constitution
|
| 2 |
+
|
| 3 |
+
## Core Principles
|
| 4 |
+
|
| 5 |
+
### I. Pre-Launch Honesty
|
| 6 |
+
All product features, API endpoints, dashboard metrics, and network indicators must be clearly labeled as "planned", "preview", "simulated", or "beta" where the feature is not yet live. No claims of "LIVE" status on simulated data. No compliance claims without a compliance roadmap.
|
| 7 |
+
|
| 8 |
+
### II. Bilingual Symmetry
|
| 9 |
+
English and Arabic content must convey identical semantic meaning. Arabic is not a translation afterthought β both locales are first-class citizens. Badges, CTAs, and technical labels must have equivalent strength in both languages.
|
| 10 |
+
|
| 11 |
+
### III. Data-Driven Content
|
| 12 |
+
All text content lives in `lib/languages.ts` β the single source of truth. Components never hardcode display strings. Changes to copy go ONLY through `languages.ts`.
|
| 13 |
+
|
| 14 |
+
### IV. Kebab-Case Components
|
| 15 |
+
Component files use kebab-case filenames. PascalCase is a deployment risk on Linux (Hostinger). Any PascalCase file that has a kebab-case counterpart must be resolved to kebab-case via `git mv`.
|
| 16 |
+
|
| 17 |
+
### V. Build-Before-Commit
|
| 18 |
+
Every change must pass `npm run build` before git commit. No exceptions.
|
| 19 |
+
|
| 20 |
+
## Tech Stack
|
| 21 |
+
- Next.js 16.2.6 + Turbopack
|
| 22 |
+
- React 19.2.4
|
| 23 |
+
- TypeScript 5
|
| 24 |
+
- Tailwind CSS 4
|
| 25 |
+
- Framer Motion 12
|
| 26 |
+
- MySQL2 (optional fallback to JSON)
|
| 27 |
+
- Hostinger Shared Hosting (Node.js hPanel)
|
| 28 |
+
|
| 29 |
+
## Deployment
|
| 30 |
+
- Host: Hostinger Shared Hosting
|
| 31 |
+
- Domain: `darkslategrey-nightingale-132659.hostingersite.com`
|
| 32 |
+
- Node.js version: 20.x
|
| 33 |
+
- Build: `npm run build` β `.next/` directory
|
| 34 |
+
- Startup: `npm start` (or custom server.js)
|
| 35 |
+
|
| 36 |
+
## Quality Gates
|
| 37 |
+
1. Build passes without errors or warnings
|
| 38 |
+
2. No hardcoded strings outside `languages.ts`
|
| 39 |
+
3. No "LIVE" labels on simulated/preview data
|
| 40 |
+
4. No compliance claims without disclaimer
|
| 41 |
+
5. Arabic and English have matching content
|
| 42 |
+
6. Import paths resolve correctly on case-sensitive FS (Linux)
|
| 43 |
+
7. No duplicate component files (same inode different case)
|
| 44 |
+
|
| 45 |
+
## Governance
|
| 46 |
+
This constitution was established during the Pre-Launch audit (May 2026). All PRs must verify compliance. Complexity must be justified against YAGNI.
|
| 47 |
+
|
| 48 |
+
**Version**: 1.0.0 | **Ratified**: 2026-05-22 | **Last Amended**: 2026-05-22
|
.specify/scripts/powershell/check-prerequisites.ps1
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 and validate branch
|
| 60 |
+
$paths = Get-FeaturePathsEnv
|
| 61 |
+
|
| 62 |
+
if (-not (Test-FeatureBranch -Branch $paths.CURRENT_BRANCH -HasGit:$paths.HAS_GIT)) {
|
| 63 |
+
exit 1
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
# If paths-only mode, output paths and exit (support combined -Json -PathsOnly)
|
| 67 |
+
if ($PathsOnly) {
|
| 68 |
+
if ($Json) {
|
| 69 |
+
[PSCustomObject]@{
|
| 70 |
+
REPO_ROOT = $paths.REPO_ROOT
|
| 71 |
+
BRANCH = $paths.CURRENT_BRANCH
|
| 72 |
+
FEATURE_DIR = $paths.FEATURE_DIR
|
| 73 |
+
FEATURE_SPEC = $paths.FEATURE_SPEC
|
| 74 |
+
IMPL_PLAN = $paths.IMPL_PLAN
|
| 75 |
+
TASKS = $paths.TASKS
|
| 76 |
+
} | ConvertTo-Json -Compress
|
| 77 |
+
} else {
|
| 78 |
+
Write-Output "REPO_ROOT: $($paths.REPO_ROOT)"
|
| 79 |
+
Write-Output "BRANCH: $($paths.CURRENT_BRANCH)"
|
| 80 |
+
Write-Output "FEATURE_DIR: $($paths.FEATURE_DIR)"
|
| 81 |
+
Write-Output "FEATURE_SPEC: $($paths.FEATURE_SPEC)"
|
| 82 |
+
Write-Output "IMPL_PLAN: $($paths.IMPL_PLAN)"
|
| 83 |
+
Write-Output "TASKS: $($paths.TASKS)"
|
| 84 |
+
}
|
| 85 |
+
exit 0
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
# Validate required directories and files
|
| 89 |
+
if (-not (Test-Path $paths.FEATURE_DIR -PathType Container)) {
|
| 90 |
+
Write-Output "ERROR: Feature directory not found: $($paths.FEATURE_DIR)"
|
| 91 |
+
Write-Output "Run /speckit.specify first to create the feature structure."
|
| 92 |
+
exit 1
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
if (-not (Test-Path $paths.IMPL_PLAN -PathType Leaf)) {
|
| 96 |
+
Write-Output "ERROR: plan.md not found in $($paths.FEATURE_DIR)"
|
| 97 |
+
Write-Output "Run /speckit.plan first to create the implementation plan."
|
| 98 |
+
exit 1
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
# Check for tasks.md if required
|
| 102 |
+
if ($RequireTasks -and -not (Test-Path $paths.TASKS -PathType Leaf)) {
|
| 103 |
+
Write-Output "ERROR: tasks.md not found in $($paths.FEATURE_DIR)"
|
| 104 |
+
Write-Output "Run /speckit.tasks first to create the task list."
|
| 105 |
+
exit 1
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
# Build list of available documents
|
| 109 |
+
$docs = @()
|
| 110 |
+
|
| 111 |
+
# Always check these optional docs
|
| 112 |
+
if (Test-Path $paths.RESEARCH) { $docs += 'research.md' }
|
| 113 |
+
if (Test-Path $paths.DATA_MODEL) { $docs += 'data-model.md' }
|
| 114 |
+
|
| 115 |
+
# Check contracts directory (only if it exists and has files)
|
| 116 |
+
if ((Test-Path $paths.CONTRACTS_DIR) -and (Get-ChildItem -Path $paths.CONTRACTS_DIR -ErrorAction SilentlyContinue | Select-Object -First 1)) {
|
| 117 |
+
$docs += 'contracts/'
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
if (Test-Path $paths.QUICKSTART) { $docs += 'quickstart.md' }
|
| 121 |
+
|
| 122 |
+
# Include tasks.md if requested and it exists
|
| 123 |
+
if ($IncludeTasks -and (Test-Path $paths.TASKS)) {
|
| 124 |
+
$docs += 'tasks.md'
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
# Output results
|
| 128 |
+
if ($Json) {
|
| 129 |
+
# JSON output
|
| 130 |
+
[PSCustomObject]@{
|
| 131 |
+
FEATURE_DIR = $paths.FEATURE_DIR
|
| 132 |
+
AVAILABLE_DOCS = $docs
|
| 133 |
+
} | ConvertTo-Json -Compress
|
| 134 |
+
} else {
|
| 135 |
+
# Text output
|
| 136 |
+
Write-Output "FEATURE_DIR:$($paths.FEATURE_DIR)"
|
| 137 |
+
Write-Output "AVAILABLE_DOCS:"
|
| 138 |
+
|
| 139 |
+
# Show status of each potential document
|
| 140 |
+
Test-FileExists -Path $paths.RESEARCH -Description 'research.md' | Out-Null
|
| 141 |
+
Test-FileExists -Path $paths.DATA_MODEL -Description 'data-model.md' | Out-Null
|
| 142 |
+
Test-DirHasFiles -Path $paths.CONTRACTS_DIR -Description 'contracts/' | Out-Null
|
| 143 |
+
Test-FileExists -Path $paths.QUICKSTART -Description 'quickstart.md' | Out-Null
|
| 144 |
+
|
| 145 |
+
if ($IncludeTasks) {
|
| 146 |
+
Test-FileExists -Path $paths.TASKS -Description 'tasks.md' | Out-Null
|
| 147 |
+
}
|
| 148 |
+
}
|
.specify/scripts/powershell/common.ps1
ADDED
|
@@ -0,0 +1,643 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Get repository root, prioritizing .specify directory over git
|
| 28 |
+
# This prevents using a parent git repo when spec-kit is initialized in a subdirectory
|
| 29 |
+
function Get-RepoRoot {
|
| 30 |
+
# First, look for .specify directory (spec-kit's own marker)
|
| 31 |
+
$specifyRoot = Find-SpecifyRoot
|
| 32 |
+
if ($specifyRoot) {
|
| 33 |
+
return $specifyRoot
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
# Fallback to git if no .specify found
|
| 37 |
+
try {
|
| 38 |
+
$result = git rev-parse --show-toplevel 2>$null
|
| 39 |
+
if ($LASTEXITCODE -eq 0) {
|
| 40 |
+
return $result
|
| 41 |
+
}
|
| 42 |
+
} catch {
|
| 43 |
+
# Git command failed
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
# Final fallback to script location for non-git repos
|
| 47 |
+
# Use -LiteralPath to handle paths with wildcard characters
|
| 48 |
+
return (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "../../..")).Path
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
function Get-CurrentBranch {
|
| 52 |
+
# First check if SPECIFY_FEATURE environment variable is set
|
| 53 |
+
if ($env:SPECIFY_FEATURE) {
|
| 54 |
+
return $env:SPECIFY_FEATURE
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
# Then check git if available at the spec-kit root (not parent)
|
| 58 |
+
$repoRoot = Get-RepoRoot
|
| 59 |
+
if (Test-HasGit) {
|
| 60 |
+
try {
|
| 61 |
+
$result = git -C $repoRoot rev-parse --abbrev-ref HEAD 2>$null
|
| 62 |
+
if ($LASTEXITCODE -eq 0) {
|
| 63 |
+
return $result
|
| 64 |
+
}
|
| 65 |
+
} catch {
|
| 66 |
+
# Git command failed
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
# For non-git repos, try to find the latest feature directory
|
| 71 |
+
$specsDir = Join-Path $repoRoot "specs"
|
| 72 |
+
|
| 73 |
+
if (Test-Path $specsDir) {
|
| 74 |
+
$latestFeature = ""
|
| 75 |
+
$highest = 0
|
| 76 |
+
$latestTimestamp = ""
|
| 77 |
+
|
| 78 |
+
Get-ChildItem -Path $specsDir -Directory | ForEach-Object {
|
| 79 |
+
if ($_.Name -match '^(\d{8}-\d{6})-') {
|
| 80 |
+
# Timestamp-based branch: compare lexicographically
|
| 81 |
+
$ts = $matches[1]
|
| 82 |
+
if ($ts -gt $latestTimestamp) {
|
| 83 |
+
$latestTimestamp = $ts
|
| 84 |
+
$latestFeature = $_.Name
|
| 85 |
+
}
|
| 86 |
+
} elseif ($_.Name -match '^(\d{3,})-') {
|
| 87 |
+
$num = [long]$matches[1]
|
| 88 |
+
if ($num -gt $highest) {
|
| 89 |
+
$highest = $num
|
| 90 |
+
# Only update if no timestamp branch found yet
|
| 91 |
+
if (-not $latestTimestamp) {
|
| 92 |
+
$latestFeature = $_.Name
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
if ($latestFeature) {
|
| 99 |
+
return $latestFeature
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
# Final fallback
|
| 104 |
+
return "main"
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
# Check if we have git available at the spec-kit root level
|
| 108 |
+
# Returns true only if git is installed and the repo root is inside a git work tree
|
| 109 |
+
# Handles both regular repos (.git directory) and worktrees/submodules (.git file)
|
| 110 |
+
function Test-HasGit {
|
| 111 |
+
# First check if git command is available (before calling Get-RepoRoot which may use git)
|
| 112 |
+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
| 113 |
+
return $false
|
| 114 |
+
}
|
| 115 |
+
$repoRoot = Get-RepoRoot
|
| 116 |
+
# Check if .git exists (directory or file for worktrees/submodules)
|
| 117 |
+
# Use -LiteralPath to handle paths with wildcard characters
|
| 118 |
+
if (-not (Test-Path -LiteralPath (Join-Path $repoRoot ".git"))) {
|
| 119 |
+
return $false
|
| 120 |
+
}
|
| 121 |
+
# Verify it's actually a valid git work tree
|
| 122 |
+
try {
|
| 123 |
+
$null = git -C $repoRoot rev-parse --is-inside-work-tree 2>$null
|
| 124 |
+
return ($LASTEXITCODE -eq 0)
|
| 125 |
+
} catch {
|
| 126 |
+
return $false
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
# Strip a single optional path segment (e.g. gitflow "feat/004-name" -> "004-name").
|
| 131 |
+
# Only when the full name is exactly two slash-free segments; otherwise returns the raw name.
|
| 132 |
+
function Get-SpecKitEffectiveBranchName {
|
| 133 |
+
param([string]$Branch)
|
| 134 |
+
if ($Branch -match '^([^/]+)/([^/]+)$') {
|
| 135 |
+
return $Matches[2]
|
| 136 |
+
}
|
| 137 |
+
return $Branch
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
function Test-FeatureBranch {
|
| 141 |
+
param(
|
| 142 |
+
[string]$Branch,
|
| 143 |
+
[bool]$HasGit = $true
|
| 144 |
+
)
|
| 145 |
+
|
| 146 |
+
# For non-git repos, we can't enforce branch naming but still provide output
|
| 147 |
+
if (-not $HasGit) {
|
| 148 |
+
Write-Warning "[specify] Warning: Git repository not detected; skipped branch validation"
|
| 149 |
+
return $true
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
$raw = $Branch
|
| 153 |
+
$Branch = Get-SpecKitEffectiveBranchName $raw
|
| 154 |
+
|
| 155 |
+
# Accept sequential prefix (3+ digits) but exclude malformed timestamps
|
| 156 |
+
# Malformed: 7-or-8 digit date + 6-digit time with no trailing slug (e.g. "2026031-143022" or "20260319-143022")
|
| 157 |
+
$hasMalformedTimestamp = ($Branch -match '^[0-9]{7}-[0-9]{6}-') -or ($Branch -match '^(?:\d{7}|\d{8})-\d{6}$')
|
| 158 |
+
$isSequential = ($Branch -match '^[0-9]{3,}-') -and (-not $hasMalformedTimestamp)
|
| 159 |
+
if (-not $isSequential -and $Branch -notmatch '^\d{8}-\d{6}-') {
|
| 160 |
+
[Console]::Error.WriteLine("ERROR: Not on a feature branch. Current branch: $raw")
|
| 161 |
+
[Console]::Error.WriteLine("Feature branches should be named like: 001-feature-name, 1234-feature-name, or 20260319-143022-feature-name")
|
| 162 |
+
return $false
|
| 163 |
+
}
|
| 164 |
+
return $true
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
# True when .specify/feature.json pins an existing feature directory that matches the
|
| 168 |
+
# active FEATURE_DIR from Get-FeaturePathsEnv (so /speckit.plan can skip git branch pattern checks).
|
| 169 |
+
function Test-FeatureJsonMatchesFeatureDir {
|
| 170 |
+
param(
|
| 171 |
+
[Parameter(Mandatory = $true)][string]$RepoRoot,
|
| 172 |
+
[Parameter(Mandatory = $true)][string]$ActiveFeatureDir
|
| 173 |
+
)
|
| 174 |
+
|
| 175 |
+
$featureJson = Join-Path (Join-Path $RepoRoot '.specify') 'feature.json'
|
| 176 |
+
if (-not (Test-Path -LiteralPath $featureJson -PathType Leaf)) {
|
| 177 |
+
return $false
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
try {
|
| 181 |
+
$raw = Get-Content -LiteralPath $featureJson -Raw
|
| 182 |
+
$cfg = $raw | ConvertFrom-Json
|
| 183 |
+
} catch {
|
| 184 |
+
return $false
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
$fd = $cfg.feature_directory
|
| 188 |
+
if ([string]::IsNullOrWhiteSpace([string]$fd)) {
|
| 189 |
+
return $false
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
if (-not [System.IO.Path]::IsPathRooted($fd)) {
|
| 193 |
+
$fd = Join-Path $RepoRoot $fd
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
if (-not (Test-Path -LiteralPath $fd -PathType Container)) {
|
| 197 |
+
return $false
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
# Resolve both paths to canonical absolute form. Prefer Resolve-Path (follows
|
| 201 |
+
# symlinks and is the canonical PS way); fall back to [Path]::GetFullPath when
|
| 202 |
+
# Resolve-Path can't produce a value. Mirrors the pattern used by Find-SpecifyRoot.
|
| 203 |
+
$resolvedJson = Resolve-Path -LiteralPath $fd -ErrorAction SilentlyContinue
|
| 204 |
+
if ($resolvedJson) {
|
| 205 |
+
$normJson = $resolvedJson.Path
|
| 206 |
+
} else {
|
| 207 |
+
$normJson = [System.IO.Path]::GetFullPath($fd)
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
$resolvedActive = Resolve-Path -LiteralPath $ActiveFeatureDir -ErrorAction SilentlyContinue
|
| 211 |
+
if ($resolvedActive) {
|
| 212 |
+
$normActive = $resolvedActive.Path
|
| 213 |
+
} else {
|
| 214 |
+
$normActive = [System.IO.Path]::GetFullPath($ActiveFeatureDir)
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
# Use case-insensitive compare only on Windows; POSIX filesystems are case-sensitive.
|
| 218 |
+
# PowerShell 5.1 is Windows-only and does not define $IsWindows, so treat its
|
| 219 |
+
# absence as "we're on Windows".
|
| 220 |
+
if ($null -ne $IsWindows) {
|
| 221 |
+
$onWindows = $IsWindows
|
| 222 |
+
} else {
|
| 223 |
+
$onWindows = $true
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
if ($onWindows) {
|
| 227 |
+
$comparison = [System.StringComparison]::OrdinalIgnoreCase
|
| 228 |
+
} else {
|
| 229 |
+
$comparison = [System.StringComparison]::Ordinal
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
return [string]::Equals($normJson, $normActive, $comparison)
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
# Resolve specs/<feature-dir> by numeric/timestamp prefix (mirrors scripts/bash/common.sh find_feature_dir_by_prefix).
|
| 236 |
+
function Find-FeatureDirByPrefix {
|
| 237 |
+
param(
|
| 238 |
+
[Parameter(Mandatory = $true)][string]$RepoRoot,
|
| 239 |
+
[Parameter(Mandatory = $true)][string]$Branch
|
| 240 |
+
)
|
| 241 |
+
$specsDir = Join-Path $RepoRoot 'specs'
|
| 242 |
+
$branchName = Get-SpecKitEffectiveBranchName $Branch
|
| 243 |
+
|
| 244 |
+
$prefix = $null
|
| 245 |
+
if ($branchName -match '^(\d{8}-\d{6})-') {
|
| 246 |
+
$prefix = $Matches[1]
|
| 247 |
+
} elseif ($branchName -match '^(\d{3,})-') {
|
| 248 |
+
$prefix = $Matches[1]
|
| 249 |
+
} else {
|
| 250 |
+
return (Join-Path $specsDir $branchName)
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
$dirMatches = @()
|
| 254 |
+
if (Test-Path -LiteralPath $specsDir -PathType Container) {
|
| 255 |
+
$dirMatches = @(Get-ChildItem -LiteralPath $specsDir -Filter "$prefix-*" -Directory -ErrorAction SilentlyContinue)
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
if ($dirMatches.Count -eq 0) {
|
| 259 |
+
return (Join-Path $specsDir $branchName)
|
| 260 |
+
}
|
| 261 |
+
if ($dirMatches.Count -eq 1) {
|
| 262 |
+
return $dirMatches[0].FullName
|
| 263 |
+
}
|
| 264 |
+
$names = ($dirMatches | ForEach-Object { $_.Name }) -join ' '
|
| 265 |
+
[Console]::Error.WriteLine("ERROR: Multiple spec directories found with prefix '$prefix': $names")
|
| 266 |
+
[Console]::Error.WriteLine('Please ensure only one spec directory exists per prefix.')
|
| 267 |
+
return $null
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
# Branch-based prefix resolution; mirrors bash get_feature_paths failure (stderr + exit 1).
|
| 271 |
+
function Get-FeatureDirFromBranchPrefixOrExit {
|
| 272 |
+
param(
|
| 273 |
+
[Parameter(Mandatory = $true)][string]$RepoRoot,
|
| 274 |
+
[Parameter(Mandatory = $true)][string]$CurrentBranch
|
| 275 |
+
)
|
| 276 |
+
$resolved = Find-FeatureDirByPrefix -RepoRoot $RepoRoot -Branch $CurrentBranch
|
| 277 |
+
if ($null -eq $resolved) {
|
| 278 |
+
[Console]::Error.WriteLine('ERROR: Failed to resolve feature directory')
|
| 279 |
+
exit 1
|
| 280 |
+
}
|
| 281 |
+
return $resolved
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
function Get-FeaturePathsEnv {
|
| 285 |
+
$repoRoot = Get-RepoRoot
|
| 286 |
+
$currentBranch = Get-CurrentBranch
|
| 287 |
+
$hasGit = Test-HasGit
|
| 288 |
+
|
| 289 |
+
# Resolve feature directory. Priority:
|
| 290 |
+
# 1. SPECIFY_FEATURE_DIRECTORY env var (explicit override)
|
| 291 |
+
# 2. .specify/feature.json "feature_directory" key (persisted by /speckit.specify)
|
| 292 |
+
# 3. Branch-name-based prefix lookup (same as scripts/bash/common.sh)
|
| 293 |
+
$featureJson = Join-Path $repoRoot '.specify/feature.json'
|
| 294 |
+
if ($env:SPECIFY_FEATURE_DIRECTORY) {
|
| 295 |
+
$featureDir = $env:SPECIFY_FEATURE_DIRECTORY
|
| 296 |
+
# Normalize relative paths to absolute under repo root
|
| 297 |
+
if (-not [System.IO.Path]::IsPathRooted($featureDir)) {
|
| 298 |
+
$featureDir = Join-Path $repoRoot $featureDir
|
| 299 |
+
}
|
| 300 |
+
} elseif (Test-Path $featureJson) {
|
| 301 |
+
$featureJsonRaw = Get-Content -LiteralPath $featureJson -Raw
|
| 302 |
+
try {
|
| 303 |
+
$featureConfig = $featureJsonRaw | ConvertFrom-Json
|
| 304 |
+
} catch {
|
| 305 |
+
[Console]::Error.WriteLine("ERROR: Failed to parse .specify/feature.json: $_")
|
| 306 |
+
exit 1
|
| 307 |
+
}
|
| 308 |
+
if ($featureConfig.feature_directory) {
|
| 309 |
+
$featureDir = $featureConfig.feature_directory
|
| 310 |
+
# Normalize relative paths to absolute under repo root
|
| 311 |
+
if (-not [System.IO.Path]::IsPathRooted($featureDir)) {
|
| 312 |
+
$featureDir = Join-Path $repoRoot $featureDir
|
| 313 |
+
}
|
| 314 |
+
} else {
|
| 315 |
+
$featureDir = Get-FeatureDirFromBranchPrefixOrExit -RepoRoot $repoRoot -CurrentBranch $currentBranch
|
| 316 |
+
}
|
| 317 |
+
} else {
|
| 318 |
+
$featureDir = Get-FeatureDirFromBranchPrefixOrExit -RepoRoot $repoRoot -CurrentBranch $currentBranch
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
[PSCustomObject]@{
|
| 322 |
+
REPO_ROOT = $repoRoot
|
| 323 |
+
CURRENT_BRANCH = $currentBranch
|
| 324 |
+
HAS_GIT = $hasGit
|
| 325 |
+
FEATURE_DIR = $featureDir
|
| 326 |
+
FEATURE_SPEC = Join-Path $featureDir 'spec.md'
|
| 327 |
+
IMPL_PLAN = Join-Path $featureDir 'plan.md'
|
| 328 |
+
TASKS = Join-Path $featureDir 'tasks.md'
|
| 329 |
+
RESEARCH = Join-Path $featureDir 'research.md'
|
| 330 |
+
DATA_MODEL = Join-Path $featureDir 'data-model.md'
|
| 331 |
+
QUICKSTART = Join-Path $featureDir 'quickstart.md'
|
| 332 |
+
CONTRACTS_DIR = Join-Path $featureDir 'contracts'
|
| 333 |
+
}
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
function Test-FileExists {
|
| 337 |
+
param([string]$Path, [string]$Description)
|
| 338 |
+
if (Test-Path -Path $Path -PathType Leaf) {
|
| 339 |
+
Write-Output " β $Description"
|
| 340 |
+
return $true
|
| 341 |
+
} else {
|
| 342 |
+
Write-Output " β $Description"
|
| 343 |
+
return $false
|
| 344 |
+
}
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
function Test-DirHasFiles {
|
| 348 |
+
param([string]$Path, [string]$Description)
|
| 349 |
+
if ((Test-Path -Path $Path -PathType Container) -and (Get-ChildItem -Path $Path -ErrorAction SilentlyContinue | Where-Object { -not $_.PSIsContainer } | Select-Object -First 1)) {
|
| 350 |
+
Write-Output " β $Description"
|
| 351 |
+
return $true
|
| 352 |
+
} else {
|
| 353 |
+
Write-Output " β $Description"
|
| 354 |
+
return $false
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
# Find a usable Python 3 executable (python3, python, or py -3).
|
| 359 |
+
# Returns the command/arguments as an array, or $null if none found.
|
| 360 |
+
function Get-Python3Command {
|
| 361 |
+
if (Get-Command python3 -ErrorAction SilentlyContinue) { return @('python3') }
|
| 362 |
+
if (Get-Command python -ErrorAction SilentlyContinue) {
|
| 363 |
+
$ver = & python --version 2>&1
|
| 364 |
+
if ($ver -match 'Python 3') { return @('python') }
|
| 365 |
+
}
|
| 366 |
+
if (Get-Command py -ErrorAction SilentlyContinue) {
|
| 367 |
+
$ver = & py -3 --version 2>&1
|
| 368 |
+
if ($ver -match 'Python 3') { return @('py', '-3') }
|
| 369 |
+
}
|
| 370 |
+
return $null
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
# Resolve a template name to a file path using the priority stack:
|
| 374 |
+
# 1. .specify/templates/overrides/
|
| 375 |
+
# 2. .specify/presets/<preset-id>/templates/ (sorted by priority from .registry)
|
| 376 |
+
# 3. .specify/extensions/<ext-id>/templates/
|
| 377 |
+
# 4. .specify/templates/ (core)
|
| 378 |
+
function Resolve-Template {
|
| 379 |
+
param(
|
| 380 |
+
[Parameter(Mandatory=$true)][string]$TemplateName,
|
| 381 |
+
[Parameter(Mandatory=$true)][string]$RepoRoot
|
| 382 |
+
)
|
| 383 |
+
|
| 384 |
+
$base = Join-Path $RepoRoot '.specify/templates'
|
| 385 |
+
|
| 386 |
+
# Priority 1: Project overrides
|
| 387 |
+
$override = Join-Path $base "overrides/$TemplateName.md"
|
| 388 |
+
if (Test-Path $override) { return $override }
|
| 389 |
+
|
| 390 |
+
# Priority 2: Installed presets (sorted by priority from .registry)
|
| 391 |
+
$presetsDir = Join-Path $RepoRoot '.specify/presets'
|
| 392 |
+
if (Test-Path $presetsDir) {
|
| 393 |
+
$registryFile = Join-Path $presetsDir '.registry'
|
| 394 |
+
$sortedPresets = @()
|
| 395 |
+
if (Test-Path $registryFile) {
|
| 396 |
+
try {
|
| 397 |
+
$registryData = Get-Content $registryFile -Raw | ConvertFrom-Json
|
| 398 |
+
$presets = $registryData.presets
|
| 399 |
+
if ($presets) {
|
| 400 |
+
$sortedPresets = $presets.PSObject.Properties |
|
| 401 |
+
Where-Object { $null -eq $_.Value.enabled -or $_.Value.enabled -ne $false } |
|
| 402 |
+
Sort-Object { if ($null -ne $_.Value.priority) { $_.Value.priority } else { 10 } } |
|
| 403 |
+
ForEach-Object { $_.Name }
|
| 404 |
+
}
|
| 405 |
+
} catch {
|
| 406 |
+
# Fallback: alphabetical directory order
|
| 407 |
+
$sortedPresets = @()
|
| 408 |
+
}
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
if ($sortedPresets.Count -gt 0) {
|
| 412 |
+
foreach ($presetId in $sortedPresets) {
|
| 413 |
+
$candidate = Join-Path $presetsDir "$presetId/templates/$TemplateName.md"
|
| 414 |
+
if (Test-Path $candidate) { return $candidate }
|
| 415 |
+
}
|
| 416 |
+
} else {
|
| 417 |
+
# Fallback: alphabetical directory order
|
| 418 |
+
foreach ($preset in Get-ChildItem -Path $presetsDir -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike '.*' }) {
|
| 419 |
+
$candidate = Join-Path $preset.FullName "templates/$TemplateName.md"
|
| 420 |
+
if (Test-Path $candidate) { return $candidate }
|
| 421 |
+
}
|
| 422 |
+
}
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
# Priority 3: Extension-provided templates
|
| 426 |
+
$extDir = Join-Path $RepoRoot '.specify/extensions'
|
| 427 |
+
if (Test-Path $extDir) {
|
| 428 |
+
foreach ($ext in Get-ChildItem -Path $extDir -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike '.*' } | Sort-Object Name) {
|
| 429 |
+
$candidate = Join-Path $ext.FullName "templates/$TemplateName.md"
|
| 430 |
+
if (Test-Path $candidate) { return $candidate }
|
| 431 |
+
}
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
# Priority 4: Core templates
|
| 435 |
+
$core = Join-Path $base "$TemplateName.md"
|
| 436 |
+
if (Test-Path $core) { return $core }
|
| 437 |
+
|
| 438 |
+
return $null
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
# Resolve a template name to composed content using composition strategies.
|
| 442 |
+
# Reads strategy metadata from preset manifests and composes content
|
| 443 |
+
# from multiple layers using prepend, append, or wrap strategies.
|
| 444 |
+
function Resolve-TemplateContent {
|
| 445 |
+
param(
|
| 446 |
+
[Parameter(Mandatory=$true)][string]$TemplateName,
|
| 447 |
+
[Parameter(Mandatory=$true)][string]$RepoRoot
|
| 448 |
+
)
|
| 449 |
+
|
| 450 |
+
$base = Join-Path $RepoRoot '.specify/templates'
|
| 451 |
+
|
| 452 |
+
# Collect all layers (highest priority first)
|
| 453 |
+
$layerPaths = @()
|
| 454 |
+
$layerStrategies = @()
|
| 455 |
+
|
| 456 |
+
# Priority 1: Project overrides (always "replace")
|
| 457 |
+
$override = Join-Path $base "overrides/$TemplateName.md"
|
| 458 |
+
if (Test-Path $override) {
|
| 459 |
+
$layerPaths += $override
|
| 460 |
+
$layerStrategies += 'replace'
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
# Priority 2: Installed presets (sorted by priority from .registry)
|
| 464 |
+
$presetsDir = Join-Path $RepoRoot '.specify/presets'
|
| 465 |
+
if (Test-Path $presetsDir) {
|
| 466 |
+
$registryFile = Join-Path $presetsDir '.registry'
|
| 467 |
+
$sortedPresets = @()
|
| 468 |
+
if (Test-Path $registryFile) {
|
| 469 |
+
try {
|
| 470 |
+
$registryData = Get-Content $registryFile -Raw | ConvertFrom-Json
|
| 471 |
+
$presets = $registryData.presets
|
| 472 |
+
if ($presets) {
|
| 473 |
+
$sortedPresets = $presets.PSObject.Properties |
|
| 474 |
+
Where-Object { $null -eq $_.Value.enabled -or $_.Value.enabled -ne $false } |
|
| 475 |
+
Sort-Object { if ($null -ne $_.Value.priority) { $_.Value.priority } else { 10 } } |
|
| 476 |
+
ForEach-Object { $_.Name }
|
| 477 |
+
}
|
| 478 |
+
} catch {
|
| 479 |
+
$sortedPresets = @()
|
| 480 |
+
}
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
if ($sortedPresets.Count -gt 0) {
|
| 484 |
+
$pyCmd = Get-Python3Command
|
| 485 |
+
if (-not $pyCmd) {
|
| 486 |
+
# Check if any preset has strategy fields that would be ignored
|
| 487 |
+
foreach ($pid in $sortedPresets) {
|
| 488 |
+
$mf = Join-Path $presetsDir "$pid/preset.yml"
|
| 489 |
+
if ((Test-Path $mf) -and (Select-String -Path $mf -Pattern 'strategy:' -Quiet -ErrorAction SilentlyContinue)) {
|
| 490 |
+
Write-Warning "No Python 3 found; preset composition strategies will be ignored"
|
| 491 |
+
break
|
| 492 |
+
}
|
| 493 |
+
}
|
| 494 |
+
}
|
| 495 |
+
$yamlWarned = $false
|
| 496 |
+
foreach ($presetId in $sortedPresets) {
|
| 497 |
+
# Read strategy and file path from preset manifest
|
| 498 |
+
$strategy = 'replace'
|
| 499 |
+
$manifestFilePath = ''
|
| 500 |
+
$manifest = Join-Path $presetsDir "$presetId/preset.yml"
|
| 501 |
+
if ((Test-Path $manifest) -and $pyCmd) {
|
| 502 |
+
try {
|
| 503 |
+
# Use Python to parse YAML manifest for strategy and file path
|
| 504 |
+
$pyArgs = if ($pyCmd.Count -gt 1) { $pyCmd[1..($pyCmd.Count-1)] } else { @() }
|
| 505 |
+
$pyStderrFile = [System.IO.Path]::GetTempFileName()
|
| 506 |
+
$stratResult = & $pyCmd[0] @pyArgs -c @"
|
| 507 |
+
import sys
|
| 508 |
+
try:
|
| 509 |
+
import yaml
|
| 510 |
+
except ImportError:
|
| 511 |
+
print('yaml_missing', file=sys.stderr)
|
| 512 |
+
print('replace\t')
|
| 513 |
+
sys.exit(0)
|
| 514 |
+
try:
|
| 515 |
+
with open(sys.argv[1]) as f:
|
| 516 |
+
data = yaml.safe_load(f)
|
| 517 |
+
for t in data.get('provides', {}).get('templates', []):
|
| 518 |
+
if t.get('name') == sys.argv[2] and t.get('type', 'template') == 'template':
|
| 519 |
+
print(t.get('strategy', 'replace') + '\t' + t.get('file', ''))
|
| 520 |
+
sys.exit(0)
|
| 521 |
+
print('replace\t')
|
| 522 |
+
except Exception:
|
| 523 |
+
print('replace\t')
|
| 524 |
+
"@ $manifest $TemplateName 2>$pyStderrFile
|
| 525 |
+
if ($stratResult) {
|
| 526 |
+
$parts = $stratResult.Trim() -split "`t", 2
|
| 527 |
+
$strategy = $parts[0].ToLowerInvariant()
|
| 528 |
+
if ($parts.Count -gt 1 -and $parts[1]) { $manifestFilePath = $parts[1] }
|
| 529 |
+
}
|
| 530 |
+
if (-not $yamlWarned -and (Test-Path $pyStderrFile) -and (Get-Content $pyStderrFile -Raw -ErrorAction SilentlyContinue) -match 'yaml_missing') {
|
| 531 |
+
Write-Warning "PyYAML not available; composition strategies may be ignored"
|
| 532 |
+
$yamlWarned = $true
|
| 533 |
+
}
|
| 534 |
+
Remove-Item $pyStderrFile -Force -ErrorAction SilentlyContinue
|
| 535 |
+
} catch {
|
| 536 |
+
$strategy = 'replace'
|
| 537 |
+
if ($pyStderrFile) { Remove-Item $pyStderrFile -Force -ErrorAction SilentlyContinue }
|
| 538 |
+
}
|
| 539 |
+
}
|
| 540 |
+
# Try manifest file path first, then convention path
|
| 541 |
+
$candidate = $null
|
| 542 |
+
if ($manifestFilePath) {
|
| 543 |
+
# Reject absolute paths and parent traversal
|
| 544 |
+
if ([System.IO.Path]::IsPathRooted($manifestFilePath) -or $manifestFilePath -match '\.\.[\\/]') {
|
| 545 |
+
$manifestFilePath = ''
|
| 546 |
+
}
|
| 547 |
+
}
|
| 548 |
+
if ($manifestFilePath) {
|
| 549 |
+
$mf = Join-Path $presetsDir "$presetId/$manifestFilePath"
|
| 550 |
+
if (Test-Path $mf) { $candidate = $mf }
|
| 551 |
+
}
|
| 552 |
+
if (-not $candidate) {
|
| 553 |
+
$cf = Join-Path $presetsDir "$presetId/templates/$TemplateName.md"
|
| 554 |
+
if (Test-Path $cf) { $candidate = $cf }
|
| 555 |
+
}
|
| 556 |
+
if ($candidate) {
|
| 557 |
+
$layerPaths += $candidate
|
| 558 |
+
$layerStrategies += $strategy
|
| 559 |
+
}
|
| 560 |
+
}
|
| 561 |
+
} else {
|
| 562 |
+
# Fallback: alphabetical directory order (no registry or parse failure)
|
| 563 |
+
foreach ($preset in Get-ChildItem -Path $presetsDir -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike '.*' }) {
|
| 564 |
+
$candidate = Join-Path $preset.FullName "templates/$TemplateName.md"
|
| 565 |
+
if (Test-Path $candidate) {
|
| 566 |
+
$layerPaths += $candidate
|
| 567 |
+
$layerStrategies += 'replace'
|
| 568 |
+
}
|
| 569 |
+
}
|
| 570 |
+
}
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
# Priority 3: Extension-provided templates (always "replace")
|
| 574 |
+
$extDir = Join-Path $RepoRoot '.specify/extensions'
|
| 575 |
+
if (Test-Path $extDir) {
|
| 576 |
+
foreach ($ext in Get-ChildItem -Path $extDir -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike '.*' } | Sort-Object Name) {
|
| 577 |
+
$candidate = Join-Path $ext.FullName "templates/$TemplateName.md"
|
| 578 |
+
if (Test-Path $candidate) {
|
| 579 |
+
$layerPaths += $candidate
|
| 580 |
+
$layerStrategies += 'replace'
|
| 581 |
+
}
|
| 582 |
+
}
|
| 583 |
+
}
|
| 584 |
+
|
| 585 |
+
# Priority 4: Core templates (always "replace")
|
| 586 |
+
$core = Join-Path $base "$TemplateName.md"
|
| 587 |
+
if (Test-Path $core) {
|
| 588 |
+
$layerPaths += $core
|
| 589 |
+
$layerStrategies += 'replace'
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
if ($layerPaths.Count -eq 0) { return $null }
|
| 593 |
+
|
| 594 |
+
# If the top (highest-priority) layer is replace, it wins entirely β
|
| 595 |
+
# lower layers are irrelevant regardless of their strategies.
|
| 596 |
+
if ($layerStrategies[0] -eq 'replace') {
|
| 597 |
+
return (Get-Content $layerPaths[0] -Raw)
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
# Check if any layer uses a non-replace strategy
|
| 601 |
+
$hasComposition = $false
|
| 602 |
+
foreach ($s in $layerStrategies) {
|
| 603 |
+
if ($s -ne 'replace') { $hasComposition = $true; break }
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
if (-not $hasComposition) {
|
| 607 |
+
return (Get-Content $layerPaths[0] -Raw)
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
# Find the effective base: scan from highest priority (index 0) downward
|
| 611 |
+
# to find the nearest replace layer. Only compose layers above that base.
|
| 612 |
+
$baseIdx = -1
|
| 613 |
+
for ($i = 0; $i -lt $layerPaths.Count; $i++) {
|
| 614 |
+
if ($layerStrategies[$i] -eq 'replace') {
|
| 615 |
+
$baseIdx = $i
|
| 616 |
+
break
|
| 617 |
+
}
|
| 618 |
+
}
|
| 619 |
+
if ($baseIdx -lt 0) { return $null }
|
| 620 |
+
|
| 621 |
+
$content = Get-Content $layerPaths[$baseIdx] -Raw
|
| 622 |
+
|
| 623 |
+
for ($i = $baseIdx - 1; $i -ge 0; $i--) {
|
| 624 |
+
$path = $layerPaths[$i]
|
| 625 |
+
$strat = $layerStrategies[$i]
|
| 626 |
+
$layerContent = Get-Content $path -Raw
|
| 627 |
+
|
| 628 |
+
switch ($strat) {
|
| 629 |
+
'replace' { $content = $layerContent }
|
| 630 |
+
'prepend' { $content = "$layerContent`n`n$content" }
|
| 631 |
+
'append' { $content = "$content`n`n$layerContent" }
|
| 632 |
+
'wrap' {
|
| 633 |
+
if (-not $layerContent.Contains('{CORE_TEMPLATE}')) {
|
| 634 |
+
throw "Wrap strategy missing {CORE_TEMPLATE} placeholder"
|
| 635 |
+
}
|
| 636 |
+
$content = $layerContent.Replace('{CORE_TEMPLATE}', $content)
|
| 637 |
+
}
|
| 638 |
+
default { throw "Unknown strategy: $strat" }
|
| 639 |
+
}
|
| 640 |
+
}
|
| 641 |
+
|
| 642 |
+
return $content
|
| 643 |
+
}
|
.specify/scripts/powershell/create-new-feature.ps1
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 branch name and paths without creating branches, directories, or files"
|
| 25 |
+
Write-Host " -AllowExistingBranch Switch to branch if it already exists instead of failing"
|
| 26 |
+
Write-Host " -ShortName <name> Provide a custom short name (2-4 words) for the branch"
|
| 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 |
+
# Extract the highest sequential feature number from a list of branch/ref names.
|
| 71 |
+
# Shared by Get-HighestNumberFromBranches and Get-HighestNumberFromRemoteRefs.
|
| 72 |
+
function Get-HighestNumberFromNames {
|
| 73 |
+
param([string[]]$Names)
|
| 74 |
+
|
| 75 |
+
[long]$highest = 0
|
| 76 |
+
foreach ($name in $Names) {
|
| 77 |
+
if ($name -match '^(\d{3,})-' -and $name -notmatch '^\d{8}-\d{6}-') {
|
| 78 |
+
[long]$num = 0
|
| 79 |
+
if ([long]::TryParse($matches[1], [ref]$num) -and $num -gt $highest) {
|
| 80 |
+
$highest = $num
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
return $highest
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
function Get-HighestNumberFromBranches {
|
| 88 |
+
param()
|
| 89 |
+
|
| 90 |
+
try {
|
| 91 |
+
$branches = git branch -a 2>$null
|
| 92 |
+
if ($LASTEXITCODE -eq 0 -and $branches) {
|
| 93 |
+
$cleanNames = $branches | ForEach-Object {
|
| 94 |
+
$_.Trim() -replace '^\*?\s+', '' -replace '^remotes/[^/]+/', ''
|
| 95 |
+
}
|
| 96 |
+
return Get-HighestNumberFromNames -Names $cleanNames
|
| 97 |
+
}
|
| 98 |
+
} catch {
|
| 99 |
+
Write-Verbose "Could not check Git branches: $_"
|
| 100 |
+
}
|
| 101 |
+
return 0
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
function Get-HighestNumberFromRemoteRefs {
|
| 105 |
+
[long]$highest = 0
|
| 106 |
+
try {
|
| 107 |
+
$remotes = git remote 2>$null
|
| 108 |
+
if ($remotes) {
|
| 109 |
+
foreach ($remote in $remotes) {
|
| 110 |
+
$env:GIT_TERMINAL_PROMPT = '0'
|
| 111 |
+
$refs = git ls-remote --heads $remote 2>$null
|
| 112 |
+
$env:GIT_TERMINAL_PROMPT = $null
|
| 113 |
+
if ($LASTEXITCODE -eq 0 -and $refs) {
|
| 114 |
+
$refNames = $refs | ForEach-Object {
|
| 115 |
+
if ($_ -match 'refs/heads/(.+)$') { $matches[1] }
|
| 116 |
+
} | Where-Object { $_ }
|
| 117 |
+
$remoteHighest = Get-HighestNumberFromNames -Names $refNames
|
| 118 |
+
if ($remoteHighest -gt $highest) { $highest = $remoteHighest }
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
} catch {
|
| 123 |
+
Write-Verbose "Could not query remote refs: $_"
|
| 124 |
+
}
|
| 125 |
+
return $highest
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
# Return next available branch number. When SkipFetch is true, queries remotes
|
| 129 |
+
# via ls-remote (read-only) instead of fetching.
|
| 130 |
+
function Get-NextBranchNumber {
|
| 131 |
+
param(
|
| 132 |
+
[string]$SpecsDir,
|
| 133 |
+
[switch]$SkipFetch
|
| 134 |
+
)
|
| 135 |
+
|
| 136 |
+
if ($SkipFetch) {
|
| 137 |
+
# Side-effect-free: query remotes via ls-remote
|
| 138 |
+
$highestBranch = Get-HighestNumberFromBranches
|
| 139 |
+
$highestRemote = Get-HighestNumberFromRemoteRefs
|
| 140 |
+
$highestBranch = [Math]::Max($highestBranch, $highestRemote)
|
| 141 |
+
} else {
|
| 142 |
+
# Fetch all remotes to get latest branch info (suppress errors if no remotes)
|
| 143 |
+
try {
|
| 144 |
+
git fetch --all --prune 2>$null | Out-Null
|
| 145 |
+
} catch {
|
| 146 |
+
# Ignore fetch errors
|
| 147 |
+
}
|
| 148 |
+
$highestBranch = Get-HighestNumberFromBranches
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
# Get highest number from ALL specs (not just matching short name)
|
| 152 |
+
$highestSpec = Get-HighestNumberFromSpecs -SpecsDir $SpecsDir
|
| 153 |
+
|
| 154 |
+
# Take the maximum of both
|
| 155 |
+
$maxNum = [Math]::Max($highestBranch, $highestSpec)
|
| 156 |
+
|
| 157 |
+
# Return next number
|
| 158 |
+
return $maxNum + 1
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
function ConvertTo-CleanBranchName {
|
| 162 |
+
param([string]$Name)
|
| 163 |
+
|
| 164 |
+
return $Name.ToLower() -replace '[^a-z0-9]', '-' -replace '-{2,}', '-' -replace '^-', '' -replace '-$', ''
|
| 165 |
+
}
|
| 166 |
+
# Load common functions (includes Get-RepoRoot, Test-HasGit, Resolve-Template)
|
| 167 |
+
. "$PSScriptRoot/common.ps1"
|
| 168 |
+
|
| 169 |
+
# Use common.ps1 functions which prioritize .specify over git
|
| 170 |
+
$repoRoot = Get-RepoRoot
|
| 171 |
+
|
| 172 |
+
# Check if git is available at this repo root (not a parent)
|
| 173 |
+
$hasGit = Test-HasGit
|
| 174 |
+
|
| 175 |
+
Set-Location $repoRoot
|
| 176 |
+
|
| 177 |
+
$specsDir = Join-Path $repoRoot 'specs'
|
| 178 |
+
if (-not $DryRun) {
|
| 179 |
+
New-Item -ItemType Directory -Path $specsDir -Force | Out-Null
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
# Function to generate branch name with stop word filtering and length filtering
|
| 183 |
+
function Get-BranchName {
|
| 184 |
+
param([string]$Description)
|
| 185 |
+
|
| 186 |
+
# Common stop words to filter out
|
| 187 |
+
$stopWords = @(
|
| 188 |
+
'i', 'a', 'an', 'the', 'to', 'for', 'of', 'in', 'on', 'at', 'by', 'with', 'from',
|
| 189 |
+
'is', 'are', 'was', 'were', 'be', 'been', 'being', 'have', 'has', 'had',
|
| 190 |
+
'do', 'does', 'did', 'will', 'would', 'should', 'could', 'can', 'may', 'might', 'must', 'shall',
|
| 191 |
+
'this', 'that', 'these', 'those', 'my', 'your', 'our', 'their',
|
| 192 |
+
'want', 'need', 'add', 'get', 'set'
|
| 193 |
+
)
|
| 194 |
+
|
| 195 |
+
# Convert to lowercase and extract words (alphanumeric only)
|
| 196 |
+
$cleanName = $Description.ToLower() -replace '[^a-z0-9\s]', ' '
|
| 197 |
+
$words = $cleanName -split '\s+' | Where-Object { $_ }
|
| 198 |
+
|
| 199 |
+
# Filter words: remove stop words and words shorter than 3 chars (unless they're uppercase acronyms in original)
|
| 200 |
+
$meaningfulWords = @()
|
| 201 |
+
foreach ($word in $words) {
|
| 202 |
+
# Skip stop words
|
| 203 |
+
if ($stopWords -contains $word) { continue }
|
| 204 |
+
|
| 205 |
+
# Keep words that are length >= 3 OR appear as uppercase in original (likely acronyms)
|
| 206 |
+
if ($word.Length -ge 3) {
|
| 207 |
+
$meaningfulWords += $word
|
| 208 |
+
} elseif ($Description -match "\b$($word.ToUpper())\b") {
|
| 209 |
+
# Keep short words if they appear as uppercase in original (likely acronyms)
|
| 210 |
+
$meaningfulWords += $word
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
# If we have meaningful words, use first 3-4 of them
|
| 215 |
+
if ($meaningfulWords.Count -gt 0) {
|
| 216 |
+
$maxWords = if ($meaningfulWords.Count -eq 4) { 4 } else { 3 }
|
| 217 |
+
$result = ($meaningfulWords | Select-Object -First $maxWords) -join '-'
|
| 218 |
+
return $result
|
| 219 |
+
} else {
|
| 220 |
+
# Fallback to original logic if no meaningful words found
|
| 221 |
+
$result = ConvertTo-CleanBranchName -Name $Description
|
| 222 |
+
$fallbackWords = ($result -split '-') | Where-Object { $_ } | Select-Object -First 3
|
| 223 |
+
return [string]::Join('-', $fallbackWords)
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
# Generate branch name
|
| 228 |
+
if ($ShortName) {
|
| 229 |
+
# Use provided short name, just clean it up
|
| 230 |
+
$branchSuffix = ConvertTo-CleanBranchName -Name $ShortName
|
| 231 |
+
} else {
|
| 232 |
+
# Generate from description with smart filtering
|
| 233 |
+
$branchSuffix = Get-BranchName -Description $featureDesc
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
# Warn if -Number and -Timestamp are both specified
|
| 237 |
+
if ($Timestamp -and $Number -ne 0) {
|
| 238 |
+
Write-Warning "[specify] Warning: -Number is ignored when -Timestamp is used"
|
| 239 |
+
$Number = 0
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
# Determine branch prefix
|
| 243 |
+
if ($Timestamp) {
|
| 244 |
+
$featureNum = Get-Date -Format 'yyyyMMdd-HHmmss'
|
| 245 |
+
$branchName = "$featureNum-$branchSuffix"
|
| 246 |
+
} else {
|
| 247 |
+
# Determine branch number
|
| 248 |
+
if ($Number -eq 0) {
|
| 249 |
+
if ($DryRun -and $hasGit) {
|
| 250 |
+
# Dry-run: query remotes via ls-remote (side-effect-free, no fetch)
|
| 251 |
+
$Number = Get-NextBranchNumber -SpecsDir $specsDir -SkipFetch
|
| 252 |
+
} elseif ($DryRun) {
|
| 253 |
+
# Dry-run without git: local spec dirs only
|
| 254 |
+
$Number = (Get-HighestNumberFromSpecs -SpecsDir $specsDir) + 1
|
| 255 |
+
} elseif ($hasGit) {
|
| 256 |
+
# Check existing branches on remotes
|
| 257 |
+
$Number = Get-NextBranchNumber -SpecsDir $specsDir
|
| 258 |
+
} else {
|
| 259 |
+
# Fall back to local directory check
|
| 260 |
+
$Number = (Get-HighestNumberFromSpecs -SpecsDir $specsDir) + 1
|
| 261 |
+
}
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
$featureNum = ('{0:000}' -f $Number)
|
| 265 |
+
$branchName = "$featureNum-$branchSuffix"
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
# GitHub enforces a 244-byte limit on branch names
|
| 269 |
+
# Validate and truncate if necessary
|
| 270 |
+
$maxBranchLength = 244
|
| 271 |
+
if ($branchName.Length -gt $maxBranchLength) {
|
| 272 |
+
# Calculate how much we need to trim from suffix
|
| 273 |
+
# Account for prefix length: timestamp (15) + hyphen (1) = 16, or sequential (3) + hyphen (1) = 4
|
| 274 |
+
$prefixLength = $featureNum.Length + 1
|
| 275 |
+
$maxSuffixLength = $maxBranchLength - $prefixLength
|
| 276 |
+
|
| 277 |
+
# Truncate suffix
|
| 278 |
+
$truncatedSuffix = $branchSuffix.Substring(0, [Math]::Min($branchSuffix.Length, $maxSuffixLength))
|
| 279 |
+
# Remove trailing hyphen if truncation created one
|
| 280 |
+
$truncatedSuffix = $truncatedSuffix -replace '-$', ''
|
| 281 |
+
|
| 282 |
+
$originalBranchName = $branchName
|
| 283 |
+
$branchName = "$featureNum-$truncatedSuffix"
|
| 284 |
+
|
| 285 |
+
Write-Warning "[specify] Branch name exceeded GitHub's 244-byte limit"
|
| 286 |
+
Write-Warning "[specify] Original: $originalBranchName ($($originalBranchName.Length) bytes)"
|
| 287 |
+
Write-Warning "[specify] Truncated to: $branchName ($($branchName.Length) bytes)"
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
$featureDir = Join-Path $specsDir $branchName
|
| 291 |
+
$specFile = Join-Path $featureDir 'spec.md'
|
| 292 |
+
|
| 293 |
+
if (-not $DryRun) {
|
| 294 |
+
if ($hasGit) {
|
| 295 |
+
$branchCreated = $false
|
| 296 |
+
$branchCreateError = ''
|
| 297 |
+
try {
|
| 298 |
+
$branchCreateError = git checkout -q -b $branchName 2>&1 | Out-String
|
| 299 |
+
if ($LASTEXITCODE -eq 0) {
|
| 300 |
+
$branchCreated = $true
|
| 301 |
+
}
|
| 302 |
+
} catch {
|
| 303 |
+
$branchCreateError = $_.Exception.Message
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
if (-not $branchCreated) {
|
| 307 |
+
$currentBranch = ''
|
| 308 |
+
try { $currentBranch = (git rev-parse --abbrev-ref HEAD 2>$null).Trim() } catch {}
|
| 309 |
+
# Check if branch already exists
|
| 310 |
+
$existingBranch = git branch --list $branchName 2>$null
|
| 311 |
+
if ($existingBranch) {
|
| 312 |
+
if ($AllowExistingBranch) {
|
| 313 |
+
# If we're already on the branch, continue without another checkout.
|
| 314 |
+
if ($currentBranch -eq $branchName) {
|
| 315 |
+
# Already on the target branch β nothing to do
|
| 316 |
+
} else {
|
| 317 |
+
# Otherwise switch to the existing branch instead of failing.
|
| 318 |
+
$switchBranchError = git checkout -q $branchName 2>&1 | Out-String
|
| 319 |
+
if ($LASTEXITCODE -ne 0) {
|
| 320 |
+
if ($switchBranchError) {
|
| 321 |
+
Write-Error "Error: Branch '$branchName' exists but could not be checked out.`n$($switchBranchError.Trim())"
|
| 322 |
+
} else {
|
| 323 |
+
Write-Error "Error: Branch '$branchName' exists but could not be checked out. Resolve any uncommitted changes or conflicts and try again."
|
| 324 |
+
}
|
| 325 |
+
exit 1
|
| 326 |
+
}
|
| 327 |
+
}
|
| 328 |
+
} elseif ($Timestamp) {
|
| 329 |
+
Write-Error "Error: Branch '$branchName' already exists. Rerun to get a new timestamp or use a different -ShortName."
|
| 330 |
+
exit 1
|
| 331 |
+
} else {
|
| 332 |
+
Write-Error "Error: Branch '$branchName' already exists. Please use a different feature name or specify a different number with -Number."
|
| 333 |
+
exit 1
|
| 334 |
+
}
|
| 335 |
+
} else {
|
| 336 |
+
if ($branchCreateError) {
|
| 337 |
+
Write-Error "Error: Failed to create git branch '$branchName'.`n$($branchCreateError.Trim())"
|
| 338 |
+
} else {
|
| 339 |
+
Write-Error "Error: Failed to create git branch '$branchName'. Please check your git configuration and try again."
|
| 340 |
+
}
|
| 341 |
+
exit 1
|
| 342 |
+
}
|
| 343 |
+
}
|
| 344 |
+
} else {
|
| 345 |
+
Write-Warning "[specify] Warning: Git repository not detected; skipped branch creation for $branchName"
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
New-Item -ItemType Directory -Path $featureDir -Force | Out-Null
|
| 349 |
+
|
| 350 |
+
if (-not (Test-Path -PathType Leaf $specFile)) {
|
| 351 |
+
$template = Resolve-Template -TemplateName 'spec-template' -RepoRoot $repoRoot
|
| 352 |
+
if ($template -and (Test-Path $template)) {
|
| 353 |
+
# Read the template content and write it to the spec file with UTF-8 encoding without BOM
|
| 354 |
+
$content = [System.IO.File]::ReadAllText($template)
|
| 355 |
+
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
| 356 |
+
[System.IO.File]::WriteAllText($specFile, $content, $utf8NoBom)
|
| 357 |
+
} else {
|
| 358 |
+
New-Item -ItemType File -Path $specFile -Force | Out-Null
|
| 359 |
+
}
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
# Set the SPECIFY_FEATURE environment variable for the current session
|
| 363 |
+
$env:SPECIFY_FEATURE = $branchName
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
if ($Json) {
|
| 367 |
+
$obj = [PSCustomObject]@{
|
| 368 |
+
BRANCH_NAME = $branchName
|
| 369 |
+
SPEC_FILE = $specFile
|
| 370 |
+
FEATURE_NUM = $featureNum
|
| 371 |
+
HAS_GIT = $hasGit
|
| 372 |
+
}
|
| 373 |
+
if ($DryRun) {
|
| 374 |
+
$obj | Add-Member -NotePropertyName 'DRY_RUN' -NotePropertyValue $true
|
| 375 |
+
}
|
| 376 |
+
$obj | ConvertTo-Json -Compress
|
| 377 |
+
} else {
|
| 378 |
+
Write-Output "BRANCH_NAME: $branchName"
|
| 379 |
+
Write-Output "SPEC_FILE: $specFile"
|
| 380 |
+
Write-Output "FEATURE_NUM: $featureNum"
|
| 381 |
+
Write-Output "HAS_GIT: $hasGit"
|
| 382 |
+
if (-not $DryRun) {
|
| 383 |
+
Write-Output "SPECIFY_FEATURE environment variable set to: $branchName"
|
| 384 |
+
}
|
| 385 |
+
}
|
.specify/scripts/powershell/setup-plan.ps1
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# If feature.json pins an existing feature directory, branch naming is not required.
|
| 27 |
+
if (-not (Test-FeatureJsonMatchesFeatureDir -RepoRoot $paths.REPO_ROOT -ActiveFeatureDir $paths.FEATURE_DIR)) {
|
| 28 |
+
if (-not (Test-FeatureBranch -Branch $paths.CURRENT_BRANCH -HasGit $paths.HAS_GIT)) {
|
| 29 |
+
exit 1
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
# Ensure the feature directory exists
|
| 34 |
+
New-Item -ItemType Directory -Path $paths.FEATURE_DIR -Force | Out-Null
|
| 35 |
+
|
| 36 |
+
# Copy plan template if it exists, otherwise note it or create empty file
|
| 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 |
+
# Output results
|
| 50 |
+
if ($Json) {
|
| 51 |
+
$result = [PSCustomObject]@{
|
| 52 |
+
FEATURE_SPEC = $paths.FEATURE_SPEC
|
| 53 |
+
IMPL_PLAN = $paths.IMPL_PLAN
|
| 54 |
+
SPECS_DIR = $paths.FEATURE_DIR
|
| 55 |
+
BRANCH = $paths.CURRENT_BRANCH
|
| 56 |
+
HAS_GIT = $paths.HAS_GIT
|
| 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 |
+
Write-Output "HAS_GIT: $($paths.HAS_GIT)"
|
| 65 |
+
}
|
.specify/scripts/powershell/setup-tasks.ps1
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 and validate branch
|
| 20 |
+
$paths = Get-FeaturePathsEnv
|
| 21 |
+
|
| 22 |
+
# If feature.json pins an existing feature directory, branch naming is not required.
|
| 23 |
+
if (-not (Test-FeatureJsonMatchesFeatureDir -RepoRoot $paths.REPO_ROOT -ActiveFeatureDir $paths.FEATURE_DIR)) {
|
| 24 |
+
if (-not (Test-FeatureBranch -Branch $paths.CURRENT_BRANCH -HasGit $paths.HAS_GIT)) {
|
| 25 |
+
exit 1
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
if (-not (Test-Path $paths.IMPL_PLAN -PathType Leaf)) {
|
| 30 |
+
[Console]::Error.WriteLine("ERROR: plan.md not found in $($paths.FEATURE_DIR)")
|
| 31 |
+
[Console]::Error.WriteLine("Run /speckit.plan first to create the implementation plan.")
|
| 32 |
+
exit 1
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
if (-not (Test-Path $paths.FEATURE_SPEC -PathType Leaf)) {
|
| 36 |
+
[Console]::Error.WriteLine("ERROR: spec.md not found in $($paths.FEATURE_DIR)")
|
| 37 |
+
[Console]::Error.WriteLine("Run /speckit.specify first to create the feature structure.")
|
| 38 |
+
exit 1
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
# Build available docs list
|
| 42 |
+
$docs = @()
|
| 43 |
+
if (Test-Path $paths.RESEARCH) { $docs += 'research.md' }
|
| 44 |
+
if (Test-Path $paths.DATA_MODEL) { $docs += 'data-model.md' }
|
| 45 |
+
if ((Test-Path $paths.CONTRACTS_DIR) -and (Get-ChildItem -Path $paths.CONTRACTS_DIR -ErrorAction SilentlyContinue | Select-Object -First 1)) {
|
| 46 |
+
$docs += 'contracts/'
|
| 47 |
+
}
|
| 48 |
+
if (Test-Path $paths.QUICKSTART) { $docs += 'quickstart.md' }
|
| 49 |
+
|
| 50 |
+
# Resolve tasks template through override stack
|
| 51 |
+
$tasksTemplate = Resolve-Template -TemplateName 'tasks-template' -RepoRoot $paths.REPO_ROOT
|
| 52 |
+
if (-not $tasksTemplate -or -not (Test-Path -LiteralPath $tasksTemplate -PathType Leaf)) {
|
| 53 |
+
$expectedCoreTemplate = Join-Path $paths.REPO_ROOT '.specify/templates/tasks-template.md'
|
| 54 |
+
[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.")
|
| 55 |
+
exit 1
|
| 56 |
+
}
|
| 57 |
+
$tasksTemplate = (Resolve-Path -LiteralPath $tasksTemplate).Path
|
| 58 |
+
|
| 59 |
+
# Output results
|
| 60 |
+
if ($Json) {
|
| 61 |
+
[PSCustomObject]@{
|
| 62 |
+
FEATURE_DIR = $paths.FEATURE_DIR
|
| 63 |
+
AVAILABLE_DOCS = $docs
|
| 64 |
+
TASKS_TEMPLATE = $tasksTemplate
|
| 65 |
+
} | ConvertTo-Json -Compress
|
| 66 |
+
} else {
|
| 67 |
+
Write-Output "FEATURE_DIR: $($paths.FEATURE_DIR)"
|
| 68 |
+
Write-Output "TASKS_TEMPLATE: $(if ($tasksTemplate) { $tasksTemplate } else { 'not found' })"
|
| 69 |
+
Write-Output "AVAILABLE_DOCS:"
|
| 70 |
+
Test-FileExists -Path $paths.RESEARCH -Description 'research.md' | Out-Null
|
| 71 |
+
Test-FileExists -Path $paths.DATA_MODEL -Description 'data-model.md' | Out-Null
|
| 72 |
+
Test-DirHasFiles -Path $paths.CONTRACTS_DIR -Description 'contracts/' | Out-Null
|
| 73 |
+
Test-FileExists -Path $paths.QUICKSTART -Description 'quickstart.md' | Out-Null
|
| 74 |
+
}
|
.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-05-22T14:36:15.828421+00:00",
|
| 10 |
+
"updated_at": "2026-05-22T14:36:15.828421+00:00"
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
}
|
AGENTS.md
CHANGED
|
@@ -3,3 +3,8 @@
|
|
| 3 |
|
| 4 |
This version has breaking changes β APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices.
|
| 5 |
<!-- END:nextjs-agent-rules -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
This version has breaking changes β APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices.
|
| 5 |
<!-- END:nextjs-agent-rules -->
|
| 6 |
+
|
| 7 |
+
<!-- SPECKIT START -->
|
| 8 |
+
For additional context about technologies to be used, project structure,
|
| 9 |
+
shell commands, and other important information, read the current plan
|
| 10 |
+
<!-- SPECKIT END -->
|
app/layout.tsx
CHANGED
|
@@ -36,7 +36,7 @@ const fastHand = localFont({
|
|
| 36 |
export const metadata: Metadata = {
|
| 37 |
metadataBase: new URL("https://darkslategrey-nightingale-132659.hostingersite.com"),
|
| 38 |
title: "HUBAPI β Pre-Launch Marketing Showcase & Waitlist",
|
| 39 |
-
description: "One
|
| 40 |
alternates: {
|
| 41 |
canonical: "https://darkslategrey-nightingale-132659.hostingersite.com",
|
| 42 |
languages: {
|
|
@@ -46,7 +46,7 @@ export const metadata: Metadata = {
|
|
| 46 |
},
|
| 47 |
openGraph: {
|
| 48 |
title: "HUBAPI β Pre-Launch Marketing Showcase",
|
| 49 |
-
description: "One
|
| 50 |
url: "https://darkslategrey-nightingale-132659.hostingersite.com",
|
| 51 |
siteName: "HUBAPI",
|
| 52 |
images: [
|
|
@@ -62,7 +62,7 @@ export const metadata: Metadata = {
|
|
| 62 |
twitter: {
|
| 63 |
card: "summary_large_image",
|
| 64 |
title: "HUBAPI β Pre-Launch Marketing Showcase",
|
| 65 |
-
description: "One
|
| 66 |
images: ["/og-image.png"],
|
| 67 |
},
|
| 68 |
};
|
|
|
|
| 36 |
export const metadata: Metadata = {
|
| 37 |
metadataBase: new URL("https://darkslategrey-nightingale-132659.hostingersite.com"),
|
| 38 |
title: "HUBAPI β Pre-Launch Marketing Showcase & Waitlist",
|
| 39 |
+
description: "One planned gateway for multiple LLM providers. Access leading AI models through a unified API layer.",
|
| 40 |
alternates: {
|
| 41 |
canonical: "https://darkslategrey-nightingale-132659.hostingersite.com",
|
| 42 |
languages: {
|
|
|
|
| 46 |
},
|
| 47 |
openGraph: {
|
| 48 |
title: "HUBAPI β Pre-Launch Marketing Showcase",
|
| 49 |
+
description: "One planned gateway for multiple LLM providers. Standard REST API, multi-model access, unified billing, and a developer-first dashboard.",
|
| 50 |
url: "https://darkslategrey-nightingale-132659.hostingersite.com",
|
| 51 |
siteName: "HUBAPI",
|
| 52 |
images: [
|
|
|
|
| 62 |
twitter: {
|
| 63 |
card: "summary_large_image",
|
| 64 |
title: "HUBAPI β Pre-Launch Marketing Showcase",
|
| 65 |
+
description: "One planned gateway for multiple LLM providers. Standard REST API, multi-model access, unified billing, and a developer-first dashboard.",
|
| 66 |
images: ["/og-image.png"],
|
| 67 |
},
|
| 68 |
};
|
components/DeveloperWorkflowsSection.tsx
CHANGED
|
@@ -78,7 +78,7 @@ export function DeveloperWorkflowsSection() {
|
|
| 78 |
<div className="relative z-10 space-y-3">
|
| 79 |
<div className="flex items-center justify-between gap-3">
|
| 80 |
<span className="font-mono text-[10px] text-primary/60 uppercase tracking-widest">
|
| 81 |
-
{card.num} /
|
| 82 |
</span>
|
| 83 |
<Icon
|
| 84 |
className="h-5 w-5 text-primary/70 group-hover:text-primary transition-colors shrink-0"
|
|
|
|
| 78 |
<div className="relative z-10 space-y-3">
|
| 79 |
<div className="flex items-center justify-between gap-3">
|
| 80 |
<span className="font-mono text-[10px] text-primary/60 uppercase tracking-widest">
|
| 81 |
+
{card.num} /
|
| 82 |
</span>
|
| 83 |
<Icon
|
| 84 |
className="h-5 w-5 text-primary/70 group-hover:text-primary transition-colors shrink-0"
|
components/LLMProviderIconCloud.tsx
CHANGED
|
@@ -74,7 +74,7 @@ function CatalogCategory({
|
|
| 74 |
return (
|
| 75 |
<div className="space-y-4">
|
| 76 |
<h3 className="font-mono text-xs font-bold uppercase tracking-widest text-muted-foreground">
|
| 77 |
-
<span className="text-primary/60">{num} /
|
| 78 |
</h3>
|
| 79 |
<div className="flex flex-wrap gap-2">
|
| 80 |
{entries.map((entry) => (
|
|
|
|
| 74 |
return (
|
| 75 |
<div className="space-y-4">
|
| 76 |
<h3 className="font-mono text-xs font-bold uppercase tracking-widest text-muted-foreground">
|
| 77 |
+
<span className="text-primary/60">{num} /</span> {title}
|
| 78 |
</h3>
|
| 79 |
<div className="flex flex-wrap gap-2">
|
| 80 |
{entries.map((entry) => (
|
components/TrustSection.tsx
CHANGED
|
@@ -143,7 +143,7 @@ export function TrustSection() {
|
|
| 143 |
<div className="relative z-10 space-y-3">
|
| 144 |
<div className="flex items-center justify-between gap-3">
|
| 145 |
<span className="font-mono text-[10px] text-primary/60 uppercase tracking-widest">
|
| 146 |
-
{card.num} /
|
| 147 |
</span>
|
| 148 |
<Icon
|
| 149 |
className="h-5 w-5 text-primary/70 group-hover:text-primary transition-colors shrink-0"
|
|
@@ -197,7 +197,7 @@ export function TrustSection() {
|
|
| 197 |
<div className="relative z-10 space-y-3">
|
| 198 |
<div className="flex items-center justify-between gap-3">
|
| 199 |
<span className="font-mono text-[10px] text-primary/60 uppercase tracking-widest">
|
| 200 |
-
{card.num} /
|
| 201 |
</span>
|
| 202 |
<Icon
|
| 203 |
className="h-5 w-5 text-primary/70 group-hover:text-primary transition-colors shrink-0"
|
|
|
|
| 143 |
<div className="relative z-10 space-y-3">
|
| 144 |
<div className="flex items-center justify-between gap-3">
|
| 145 |
<span className="font-mono text-[10px] text-primary/60 uppercase tracking-widest">
|
| 146 |
+
{card.num} /
|
| 147 |
</span>
|
| 148 |
<Icon
|
| 149 |
className="h-5 w-5 text-primary/70 group-hover:text-primary transition-colors shrink-0"
|
|
|
|
| 197 |
<div className="relative z-10 space-y-3">
|
| 198 |
<div className="flex items-center justify-between gap-3">
|
| 199 |
<span className="font-mono text-[10px] text-primary/60 uppercase tracking-widest">
|
| 200 |
+
{card.num} /
|
| 201 |
</span>
|
| 202 |
<Icon
|
| 203 |
className="h-5 w-5 text-primary/70 group-hover:text-primary transition-colors shrink-0"
|
components/faq-accordion.tsx
CHANGED
|
@@ -67,7 +67,7 @@ export function FAQAccordion() {
|
|
| 67 |
>
|
| 68 |
<span className="font-medium tracking-tight text-start">
|
| 69 |
<span className="text-primary/60 text-[10px] uppercase tracking-widest block mb-1.5">
|
| 70 |
-
{faqNum} /
|
| 71 |
</span>
|
| 72 |
{question}
|
| 73 |
</span>
|
|
|
|
| 67 |
>
|
| 68 |
<span className="font-medium tracking-tight text-start">
|
| 69 |
<span className="text-primary/60 text-[10px] uppercase tracking-widest block mb-1.5">
|
| 70 |
+
{faqNum} /
|
| 71 |
</span>
|
| 72 |
{question}
|
| 73 |
</span>
|
components/header.tsx
CHANGED
|
@@ -38,7 +38,7 @@ export function Header() {
|
|
| 38 |
<span className="hidden sm:inline-block text-muted-foreground tracking-widest uppercase">{t("preLaunch")}</span>
|
| 39 |
<div className="flex items-center justify-center h-5 px-2.5 rounded-full border border-primary/30 bg-primary/10">
|
| 40 |
<span className="w-1.5 h-1.5 bg-primary rounded-full animate-pulse mr-2 shadow-[0_0_8px_var(--primary-glow)]"></span>
|
| 41 |
-
<span className="text-primary text-[10px] tracking-wider uppercase font-bold">{t("
|
| 42 |
</div>
|
| 43 |
<LanguageToggle />
|
| 44 |
<ThemeToggle />
|
|
@@ -46,4 +46,4 @@ export function Header() {
|
|
| 46 |
</nav>
|
| 47 |
</motion.header>
|
| 48 |
);
|
| 49 |
-
}
|
|
|
|
| 38 |
<span className="hidden sm:inline-block text-muted-foreground tracking-widest uppercase">{t("preLaunch")}</span>
|
| 39 |
<div className="flex items-center justify-center h-5 px-2.5 rounded-full border border-primary/30 bg-primary/10">
|
| 40 |
<span className="w-1.5 h-1.5 bg-primary rounded-full animate-pulse mr-2 shadow-[0_0_8px_var(--primary-glow)]"></span>
|
| 41 |
+
<span className="text-primary text-[10px] tracking-wider uppercase font-bold">{t("preLaunchShort")}</span>
|
| 42 |
</div>
|
| 43 |
<LanguageToggle />
|
| 44 |
<ThemeToggle />
|
|
|
|
| 46 |
</nav>
|
| 47 |
</motion.header>
|
| 48 |
);
|
| 49 |
+
}
|
components/hero-section.tsx
CHANGED
|
@@ -21,6 +21,8 @@ export function HeroSection() {
|
|
| 21 |
const reducedMotion = useReducedMotion();
|
| 22 |
const { t } = useLanguage();
|
| 23 |
const [variant, setVariant] = useState<"classic" | "intelligence">("classic");
|
|
|
|
|
|
|
| 24 |
|
| 25 |
const scrollToWaitlist = () => {
|
| 26 |
const input = document.getElementById("email-input");
|
|
|
|
| 21 |
const reducedMotion = useReducedMotion();
|
| 22 |
const { t } = useLanguage();
|
| 23 |
const [variant, setVariant] = useState<"classic" | "intelligence">("classic");
|
| 24 |
+
// variant is used via setVariant; state read happens through useEffect re-renders
|
| 25 |
+
void variant;
|
| 26 |
|
| 27 |
const scrollToWaitlist = () => {
|
| 28 |
const input = document.getElementById("email-input");
|
components/waitlist-form.tsx
CHANGED
|
@@ -154,7 +154,7 @@ export function WaitlistForm() {
|
|
| 154 |
<div className="absolute top-0 left-0 w-2.5 h-2.5 border-t border-l border-primary/40" />
|
| 155 |
<div className="absolute top-0 right-0 w-2.5 h-2.5 border-t border-r border-primary/40" />
|
| 156 |
<span className="text-[8px] text-muted-foreground/80 tracking-wider uppercase font-mono">
|
| 157 |
-
{t("rank")} // SYSTEM_RANK
|
| 158 |
</span>
|
| 159 |
<span className="text-xl sm:text-2xl font-black text-amber-500 dark:text-amber-400 font-sans tracking-wide text-glow">
|
| 160 |
#{ticketNo}
|
|
@@ -167,7 +167,7 @@ export function WaitlistForm() {
|
|
| 167 |
<div className="absolute top-0 left-0 w-2.5 h-2.5 border-t border-l border-primary/40" />
|
| 168 |
<div className="absolute top-0 right-0 w-2.5 h-2.5 border-t border-r border-primary/40" />
|
| 169 |
<span className="text-[8px] text-muted-foreground/80 tracking-wider uppercase font-mono">
|
| 170 |
-
{t("referralsCount")} // NETWORK_NODE
|
| 171 |
</span>
|
| 172 |
<span className="text-xl sm:text-2xl font-black text-indigo-500 dark:text-indigo-400 font-sans tracking-wide text-glow-accent">
|
| 173 |
0
|
|
|
|
| 154 |
<div className="absolute top-0 left-0 w-2.5 h-2.5 border-t border-l border-primary/40" />
|
| 155 |
<div className="absolute top-0 right-0 w-2.5 h-2.5 border-t border-r border-primary/40" />
|
| 156 |
<span className="text-[8px] text-muted-foreground/80 tracking-wider uppercase font-mono">
|
| 157 |
+
{t("rank")}{" // SYSTEM_RANK"}
|
| 158 |
</span>
|
| 159 |
<span className="text-xl sm:text-2xl font-black text-amber-500 dark:text-amber-400 font-sans tracking-wide text-glow">
|
| 160 |
#{ticketNo}
|
|
|
|
| 167 |
<div className="absolute top-0 left-0 w-2.5 h-2.5 border-t border-l border-primary/40" />
|
| 168 |
<div className="absolute top-0 right-0 w-2.5 h-2.5 border-t border-r border-primary/40" />
|
| 169 |
<span className="text-[8px] text-muted-foreground/80 tracking-wider uppercase font-mono">
|
| 170 |
+
{t("referralsCount")}{" // NETWORK_NODE"}
|
| 171 |
</span>
|
| 172 |
<span className="text-xl sm:text-2xl font-black text-indigo-500 dark:text-indigo-400 font-sans tracking-wide text-glow-accent">
|
| 173 |
0
|
data/ecosystem-catalog.ts
CHANGED
|
@@ -29,8 +29,8 @@ export const inferencePlatformCatalog: CatalogEntry[] = [
|
|
| 29 |
];
|
| 30 |
|
| 31 |
export const developerEcosystemCatalog: CatalogEntry[] = [
|
| 32 |
-
{ label: "
|
| 33 |
-
{ label: "
|
| 34 |
{ label: "Node.js" },
|
| 35 |
{ label: "Python" },
|
| 36 |
{ label: "Webhooks" },
|
|
|
|
| 29 |
];
|
| 30 |
|
| 31 |
export const developerEcosystemCatalog: CatalogEntry[] = [
|
| 32 |
+
{ label: "Standard REST API" },
|
| 33 |
+
{ label: "SDK Support" },
|
| 34 |
{ label: "Node.js" },
|
| 35 |
{ label: "Python" },
|
| 36 |
{ label: "Webhooks" },
|
specs/status-page-i18n/analysis.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Status Page i18n Refactor β Analysis Report
|
| 2 |
+
|
| 3 |
+
> **Analyzed:** 2026-05-22
|
| 4 |
+
> **Spec:** `spec.md` (clarified)
|
| 5 |
+
> **Plan:** `plan.md`
|
| 6 |
+
> **Tasks:** `tasks.md`
|
| 7 |
+
|
| 8 |
+
## Summary
|
| 9 |
+
|
| 10 |
+
| Metric | Value |
|
| 11 |
+
|--------|-------|
|
| 12 |
+
| Requirements | 5/5 covered (100%) |
|
| 13 |
+
| User stories | 2/2 with acceptance scenarios |
|
| 14 |
+
| Tasks | 5 total (1 critical, 3 high, 1 critical-verify) |
|
| 15 |
+
| Issues | 0 critical, 0 important, 0 minor |
|
| 16 |
+
|
| 17 |
+
## Coverage Matrix
|
| 18 |
+
|
| 19 |
+
| Requirement | Task Coverage | Status |
|
| 20 |
+
|-------------|---------------|--------|
|
| 21 |
+
| REQ-1: Add 18+ keys to languages.ts | T1 | β
|
|
| 22 |
+
| REQ-2: Replace ternaries with t() | T2, T3, T4 | β
|
|
| 23 |
+
| REQ-3: Build passes | T5 | β
|
|
| 24 |
+
| REQ-4: No visual changes | T5 (screenshot comparison) | β
|
|
| 25 |
+
| REQ-5: No other components affected | T4 (cleanup verified) | β
|
|
| 26 |
+
|
| 27 |
+
## User Story Coverage
|
| 28 |
+
|
| 29 |
+
| Story | Acceptance Scenarios Covered | Status |
|
| 30 |
+
|-------|------------------------------|--------|
|
| 31 |
+
| US-1: Status labels use t() | 4/4 (no ternaries, keys exist, en works, ar works) | β
|
|
| 32 |
+
| US-2: Visual parity maintained | 1/1 (visual diff) | β
|
|
| 33 |
+
|
| 34 |
+
## Dependency Graph
|
| 35 |
+
|
| 36 |
+
```mermaid
|
| 37 |
+
graph TD
|
| 38 |
+
T1 --> T2
|
| 39 |
+
T1 --> T3
|
| 40 |
+
T1 --> T4
|
| 41 |
+
T2 --> T5
|
| 42 |
+
T3 --> T5
|
| 43 |
+
T4 --> T5
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
- No circular dependencies
|
| 47 |
+
- Critical path: T1 β T2/3/4 β T5
|
| 48 |
+
|
| 49 |
+
## Constitution Compliance
|
| 50 |
+
|
| 51 |
+
| Rule | Verified In | Status |
|
| 52 |
+
|------|-------------|--------|
|
| 53 |
+
| I. Pre-Launch Honesty | N/A (no content change) | β
|
|
| 54 |
+
| II. Bilingual Symmetry | Spec clarifications (flagged for follow-up) | β οΈ Tracked |
|
| 55 |
+
| III. Data-Driven Content | T1 (all strings β languages.ts), T2/3/4 (ternaries removed) | β
FIXED |
|
| 56 |
+
| IV. Kebab-Case Components | N/A (no new files) | β
|
|
| 57 |
+
| V. Build-Before-Commit | T5 (npm run build gate) | β
ENFORCED |
|
| 58 |
+
|
| 59 |
+
## Recommendation
|
| 60 |
+
|
| 61 |
+
**Ready for implementation.** All artifacts are consistent. No blockers.
|
specs/status-page-i18n/checklists/code-quality.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Code Quality Checklist β Status Page i18n Refactor
|
| 2 |
+
|
| 3 |
+
## TypeScript
|
| 4 |
+
- [ ] All t() calls use valid keys from languages.ts
|
| 5 |
+
- [ ] No `language === "ar"` UI label ternaries remain
|
| 6 |
+
- [ ] All imports are used (no unused `language` destructure)
|
| 7 |
+
- [ ] npx tsc --noEmit passes
|
| 8 |
+
|
| 9 |
+
## i18n
|
| 10 |
+
- [ ] Every key in `en` block has matching key in `ar` block
|
| 11 |
+
- [ ] Arabic strings are exact copies of the current inline values
|
| 12 |
+
- [ ] New keys follow `status*` prefix convention
|
| 13 |
+
|
| 14 |
+
## File Modification
|
| 15 |
+
- [ ] Only lib/languages.ts and app/status/page.tsx changed
|
| 16 |
+
- [ ] No accidental whitespace/formatting changes
|
| 17 |
+
- [ ] No other pages or components affected
|
| 18 |
+
|
| 19 |
+
## Build
|
| 20 |
+
- [ ] npm run build passes with zero errors and zero warnings
|
specs/status-page-i18n/checklists/data.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Data Checklist β Status Page i18n Refactor
|
| 2 |
+
|
| 3 |
+
## Data Integrity
|
| 4 |
+
- [ ] Gateway node names (gw.name/gw.nameAr) remain as component state
|
| 5 |
+
- [ ] Node region data (gw.region/gw.regionAr) unchanged
|
| 6 |
+
- [ ] No data moved to languages.ts that isn't a UI label
|
| 7 |
+
|
| 8 |
+
## No Migration
|
| 9 |
+
- [ ] No database changes
|
| 10 |
+
- [ ] No schema changes
|
specs/status-page-i18n/checklists/security.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Security Checklist β Status Page i18n Refactor
|
| 2 |
+
|
| 3 |
+
## No Secrets
|
| 4 |
+
- [ ] No API keys or tokens added to languages.ts
|
| 5 |
+
- [ ] No credentials appear anywhere in the diff
|
| 6 |
+
- [ ] No `dangerouslySetInnerHTML` added
|
| 7 |
+
|
| 8 |
+
## No XSS
|
| 9 |
+
- [ ] All t() values rendered as text content (not innerHTML)
|
| 10 |
+
- [ ] No injected HTML from languages.ts values
|