lightspec 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +435 -0
- package/bin/lightspec.js +3 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +361 -0
- package/dist/commands/change.d.ts +35 -0
- package/dist/commands/change.js +277 -0
- package/dist/commands/completion.d.ts +72 -0
- package/dist/commands/completion.js +257 -0
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.js +198 -0
- package/dist/commands/feedback.d.ts +9 -0
- package/dist/commands/feedback.js +183 -0
- package/dist/commands/show.d.ts +14 -0
- package/dist/commands/show.js +132 -0
- package/dist/commands/spec.d.ts +15 -0
- package/dist/commands/spec.js +225 -0
- package/dist/commands/validate.d.ts +24 -0
- package/dist/commands/validate.js +294 -0
- package/dist/core/archive.d.ts +11 -0
- package/dist/core/archive.js +280 -0
- package/dist/core/completions/command-registry.d.ts +7 -0
- package/dist/core/completions/command-registry.js +456 -0
- package/dist/core/completions/completion-provider.d.ts +60 -0
- package/dist/core/completions/completion-provider.js +102 -0
- package/dist/core/completions/factory.d.ts +64 -0
- package/dist/core/completions/factory.js +75 -0
- package/dist/core/completions/generators/bash-generator.d.ts +32 -0
- package/dist/core/completions/generators/bash-generator.js +174 -0
- package/dist/core/completions/generators/fish-generator.d.ts +32 -0
- package/dist/core/completions/generators/fish-generator.js +157 -0
- package/dist/core/completions/generators/powershell-generator.d.ts +33 -0
- package/dist/core/completions/generators/powershell-generator.js +207 -0
- package/dist/core/completions/generators/zsh-generator.d.ts +44 -0
- package/dist/core/completions/generators/zsh-generator.js +250 -0
- package/dist/core/completions/installers/bash-installer.d.ts +87 -0
- package/dist/core/completions/installers/bash-installer.js +318 -0
- package/dist/core/completions/installers/fish-installer.d.ts +43 -0
- package/dist/core/completions/installers/fish-installer.js +143 -0
- package/dist/core/completions/installers/powershell-installer.d.ts +88 -0
- package/dist/core/completions/installers/powershell-installer.js +327 -0
- package/dist/core/completions/installers/zsh-installer.d.ts +125 -0
- package/dist/core/completions/installers/zsh-installer.js +449 -0
- package/dist/core/completions/templates/bash-templates.d.ts +6 -0
- package/dist/core/completions/templates/bash-templates.js +24 -0
- package/dist/core/completions/templates/fish-templates.d.ts +7 -0
- package/dist/core/completions/templates/fish-templates.js +39 -0
- package/dist/core/completions/templates/powershell-templates.d.ts +6 -0
- package/dist/core/completions/templates/powershell-templates.js +25 -0
- package/dist/core/completions/templates/zsh-templates.d.ts +6 -0
- package/dist/core/completions/templates/zsh-templates.js +36 -0
- package/dist/core/completions/types.d.ts +79 -0
- package/dist/core/completions/types.js +2 -0
- package/dist/core/config-prompts.d.ts +9 -0
- package/dist/core/config-prompts.js +34 -0
- package/dist/core/config-schema.d.ts +76 -0
- package/dist/core/config-schema.js +200 -0
- package/dist/core/config.d.ts +16 -0
- package/dist/core/config.js +30 -0
- package/dist/core/configurators/agents.d.ts +8 -0
- package/dist/core/configurators/agents.js +15 -0
- package/dist/core/configurators/base.d.ts +7 -0
- package/dist/core/configurators/base.js +2 -0
- package/dist/core/configurators/claude.d.ts +8 -0
- package/dist/core/configurators/claude.js +15 -0
- package/dist/core/configurators/cline.d.ts +8 -0
- package/dist/core/configurators/cline.js +15 -0
- package/dist/core/configurators/codebuddy.d.ts +8 -0
- package/dist/core/configurators/codebuddy.js +15 -0
- package/dist/core/configurators/costrict.d.ts +8 -0
- package/dist/core/configurators/costrict.js +15 -0
- package/dist/core/configurators/iflow.d.ts +8 -0
- package/dist/core/configurators/iflow.js +15 -0
- package/dist/core/configurators/qoder.d.ts +30 -0
- package/dist/core/configurators/qoder.js +42 -0
- package/dist/core/configurators/qwen.d.ts +24 -0
- package/dist/core/configurators/qwen.js +37 -0
- package/dist/core/configurators/registry.d.ts +9 -0
- package/dist/core/configurators/registry.js +43 -0
- package/dist/core/configurators/slash/amazon-q.d.ts +9 -0
- package/dist/core/configurators/slash/amazon-q.js +46 -0
- package/dist/core/configurators/slash/antigravity.d.ts +9 -0
- package/dist/core/configurators/slash/antigravity.js +23 -0
- package/dist/core/configurators/slash/auggie.d.ts +9 -0
- package/dist/core/configurators/slash/auggie.js +31 -0
- package/dist/core/configurators/slash/base.d.ts +19 -0
- package/dist/core/configurators/slash/base.js +69 -0
- package/dist/core/configurators/slash/claude.d.ts +9 -0
- package/dist/core/configurators/slash/claude.js +37 -0
- package/dist/core/configurators/slash/cline.d.ts +9 -0
- package/dist/core/configurators/slash/cline.js +23 -0
- package/dist/core/configurators/slash/codebuddy.d.ts +9 -0
- package/dist/core/configurators/slash/codebuddy.js +34 -0
- package/dist/core/configurators/slash/codex.d.ts +14 -0
- package/dist/core/configurators/slash/codex.js +109 -0
- package/dist/core/configurators/slash/continue.d.ts +9 -0
- package/dist/core/configurators/slash/continue.js +46 -0
- package/dist/core/configurators/slash/costrict.d.ts +9 -0
- package/dist/core/configurators/slash/costrict.js +31 -0
- package/dist/core/configurators/slash/crush.d.ts +9 -0
- package/dist/core/configurators/slash/crush.js +37 -0
- package/dist/core/configurators/slash/cursor.d.ts +9 -0
- package/dist/core/configurators/slash/cursor.js +37 -0
- package/dist/core/configurators/slash/factory.d.ts +10 -0
- package/dist/core/configurators/slash/factory.js +35 -0
- package/dist/core/configurators/slash/gemini.d.ts +9 -0
- package/dist/core/configurators/slash/gemini.js +22 -0
- package/dist/core/configurators/slash/github-copilot.d.ts +9 -0
- package/dist/core/configurators/slash/github-copilot.js +34 -0
- package/dist/core/configurators/slash/iflow.d.ts +9 -0
- package/dist/core/configurators/slash/iflow.js +37 -0
- package/dist/core/configurators/slash/kilocode.d.ts +9 -0
- package/dist/core/configurators/slash/kilocode.js +17 -0
- package/dist/core/configurators/slash/opencode.d.ts +12 -0
- package/dist/core/configurators/slash/opencode.js +72 -0
- package/dist/core/configurators/slash/qoder.d.ts +35 -0
- package/dist/core/configurators/slash/qoder.js +76 -0
- package/dist/core/configurators/slash/qwen.d.ts +32 -0
- package/dist/core/configurators/slash/qwen.js +49 -0
- package/dist/core/configurators/slash/registry.d.ts +8 -0
- package/dist/core/configurators/slash/registry.js +78 -0
- package/dist/core/configurators/slash/roocode.d.ts +9 -0
- package/dist/core/configurators/slash/roocode.js +23 -0
- package/dist/core/configurators/slash/toml-base.d.ts +10 -0
- package/dist/core/configurators/slash/toml-base.js +53 -0
- package/dist/core/configurators/slash/windsurf.d.ts +9 -0
- package/dist/core/configurators/slash/windsurf.js +23 -0
- package/dist/core/converters/json-converter.d.ts +6 -0
- package/dist/core/converters/json-converter.js +51 -0
- package/dist/core/global-config.d.ts +39 -0
- package/dist/core/global-config.js +115 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +3 -0
- package/dist/core/init.d.ts +52 -0
- package/dist/core/init.js +644 -0
- package/dist/core/list.d.ts +9 -0
- package/dist/core/list.js +171 -0
- package/dist/core/parsers/change-parser.d.ts +13 -0
- package/dist/core/parsers/change-parser.js +193 -0
- package/dist/core/parsers/markdown-parser.d.ts +22 -0
- package/dist/core/parsers/markdown-parser.js +187 -0
- package/dist/core/parsers/requirement-blocks.d.ts +37 -0
- package/dist/core/parsers/requirement-blocks.js +201 -0
- package/dist/core/project-config.d.ts +64 -0
- package/dist/core/project-config.js +223 -0
- package/dist/core/schemas/base.schema.d.ts +13 -0
- package/dist/core/schemas/base.schema.js +13 -0
- package/dist/core/schemas/change.schema.d.ts +73 -0
- package/dist/core/schemas/change.schema.js +31 -0
- package/dist/core/schemas/index.d.ts +4 -0
- package/dist/core/schemas/index.js +4 -0
- package/dist/core/schemas/spec.schema.d.ts +18 -0
- package/dist/core/schemas/spec.schema.js +15 -0
- package/dist/core/specs-apply.d.ts +73 -0
- package/dist/core/specs-apply.js +384 -0
- package/dist/core/styles/palette.d.ts +7 -0
- package/dist/core/styles/palette.js +8 -0
- package/dist/core/templates/agents-root-stub.d.ts +2 -0
- package/dist/core/templates/agents-root-stub.js +17 -0
- package/dist/core/templates/agents-template.d.ts +2 -0
- package/dist/core/templates/agents-template.js +458 -0
- package/dist/core/templates/claude-template.d.ts +2 -0
- package/dist/core/templates/claude-template.js +2 -0
- package/dist/core/templates/cline-template.d.ts +2 -0
- package/dist/core/templates/cline-template.js +2 -0
- package/dist/core/templates/costrict-template.d.ts +2 -0
- package/dist/core/templates/costrict-template.js +2 -0
- package/dist/core/templates/index.d.ts +17 -0
- package/dist/core/templates/index.js +37 -0
- package/dist/core/templates/project-template.d.ts +8 -0
- package/dist/core/templates/project-template.js +32 -0
- package/dist/core/templates/slash-command-templates.d.ts +4 -0
- package/dist/core/templates/slash-command-templates.js +49 -0
- package/dist/core/update.d.ts +4 -0
- package/dist/core/update.js +88 -0
- package/dist/core/validation/constants.d.ts +34 -0
- package/dist/core/validation/constants.js +40 -0
- package/dist/core/validation/types.d.ts +18 -0
- package/dist/core/validation/types.js +2 -0
- package/dist/core/validation/validator.d.ts +33 -0
- package/dist/core/validation/validator.js +409 -0
- package/dist/core/view.d.ts +8 -0
- package/dist/core/view.js +168 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/telemetry/config.d.ts +32 -0
- package/dist/telemetry/config.js +68 -0
- package/dist/telemetry/index.d.ts +31 -0
- package/dist/telemetry/index.js +103 -0
- package/dist/utils/file-system.d.ts +25 -0
- package/dist/utils/file-system.js +218 -0
- package/dist/utils/interactive.d.ts +18 -0
- package/dist/utils/interactive.js +21 -0
- package/dist/utils/item-discovery.d.ts +4 -0
- package/dist/utils/item-discovery.js +72 -0
- package/dist/utils/match.d.ts +3 -0
- package/dist/utils/match.js +22 -0
- package/dist/utils/shell-detection.d.ts +20 -0
- package/dist/utils/shell-detection.js +41 -0
- package/dist/utils/task-progress.d.ts +8 -0
- package/dist/utils/task-progress.js +36 -0
- package/package.json +82 -0
- package/scripts/postinstall.js +147 -0
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
export const agentsTemplate = `# LightSpec Instructions
|
|
2
|
+
|
|
3
|
+
Instructions for AI coding assistants using LightSpec for spec-driven development.
|
|
4
|
+
|
|
5
|
+
## TL;DR Quick Checklist
|
|
6
|
+
|
|
7
|
+
- Search existing work: \`lightspec spec list --long\`, \`lightspec list\` (use \`rg\` only for full-text search)
|
|
8
|
+
- Decide scope: new capability vs modify existing capability
|
|
9
|
+
- Pick a unique \`change-id\`: kebab-case, verb-led (\`add-\`, \`update-\`, \`remove-\`, \`refactor-\`)
|
|
10
|
+
- Scaffold: \`proposal.md\`, \`tasks.md\`, \`design.md\` (only if needed), and delta specs per affected capability
|
|
11
|
+
- Write deltas: use \`## ADDED|MODIFIED|REMOVED|RENAMED Requirements\`; include at least one \`#### Scenario:\` per requirement
|
|
12
|
+
- Validate: \`lightspec validate [change-id] --strict --no-interactive\` and fix issues
|
|
13
|
+
- Request approval: Do not start implementation until proposal is approved
|
|
14
|
+
|
|
15
|
+
## Three-Stage Workflow
|
|
16
|
+
|
|
17
|
+
### Stage 1: Creating Changes
|
|
18
|
+
Create proposal when you need to:
|
|
19
|
+
- Add features or functionality
|
|
20
|
+
- Make breaking changes (API, schema)
|
|
21
|
+
- Change architecture or patterns
|
|
22
|
+
- Optimize performance (changes behavior)
|
|
23
|
+
- Update security patterns
|
|
24
|
+
|
|
25
|
+
Triggers (examples):
|
|
26
|
+
- "Help me create a change proposal"
|
|
27
|
+
- "Help me plan a change"
|
|
28
|
+
- "Help me create a proposal"
|
|
29
|
+
- "I want to create a spec proposal"
|
|
30
|
+
- "I want to create a spec"
|
|
31
|
+
|
|
32
|
+
Loose matching guidance:
|
|
33
|
+
- Contains one of: \`proposal\`, \`change\`, \`spec\`
|
|
34
|
+
- With one of: \`create\`, \`plan\`, \`make\`, \`start\`, \`help\`
|
|
35
|
+
|
|
36
|
+
Skip proposal for:
|
|
37
|
+
- Bug fixes (restore intended behavior)
|
|
38
|
+
- Typos, formatting, comments
|
|
39
|
+
- Dependency updates (non-breaking)
|
|
40
|
+
- Configuration changes
|
|
41
|
+
- Tests for existing behavior
|
|
42
|
+
|
|
43
|
+
**Workflow**
|
|
44
|
+
1. Review \`lightspec/project.md\`, \`lightspec list\`, and \`lightspec list --specs\` to understand current context.
|
|
45
|
+
2. Choose a unique verb-led \`change-id\` and scaffold \`proposal.md\`, \`tasks.md\`, optional \`design.md\`, and spec deltas under \`lightspec/changes/<id>/\`.
|
|
46
|
+
3. Draft spec deltas using \`## ADDED|MODIFIED|REMOVED Requirements\` with at least one \`#### Scenario:\` per requirement.
|
|
47
|
+
4. Run \`lightspec validate <id> --strict --no-interactive\` and resolve any issues before sharing the proposal.
|
|
48
|
+
|
|
49
|
+
### Stage 2: Implementing Changes
|
|
50
|
+
Track these steps as TODOs and complete them one by one.
|
|
51
|
+
1. **Read proposal.md** - Understand what's being built
|
|
52
|
+
2. **Read design.md** (if exists) - Review technical decisions
|
|
53
|
+
3. **Read tasks.md** - Get implementation checklist
|
|
54
|
+
4. **Implement tasks sequentially** - Complete in order
|
|
55
|
+
5. **Confirm completion** - Ensure every item in \`tasks.md\` is finished before updating statuses
|
|
56
|
+
6. **Update checklist** - After all work is done, set every task to \`- [x]\` so the list reflects reality
|
|
57
|
+
7. **Approval gate** - Do not start implementation until the proposal is reviewed and approved
|
|
58
|
+
|
|
59
|
+
### Stage 3: Archiving Changes
|
|
60
|
+
After deployment, create separate PR to:
|
|
61
|
+
- Move \`changes/[name]/\` → \`changes/archive/YYYY-MM-DD-[name]/\`
|
|
62
|
+
- Update \`specs/\` if capabilities changed
|
|
63
|
+
- Use \`lightspec archive <change-id> --skip-specs --yes\` for tooling-only changes (always pass the change ID explicitly)
|
|
64
|
+
- Run \`lightspec validate --strict --no-interactive\` to confirm the archived change passes checks
|
|
65
|
+
|
|
66
|
+
## Before Any Task
|
|
67
|
+
|
|
68
|
+
**Context Checklist:**
|
|
69
|
+
- [ ] Read relevant specs in \`specs/[capability]/spec.md\`
|
|
70
|
+
- [ ] Check pending changes in \`changes/\` for conflicts
|
|
71
|
+
- [ ] Read \`lightspec/project.md\` for conventions
|
|
72
|
+
- [ ] Run \`lightspec list\` to see active changes
|
|
73
|
+
- [ ] Run \`lightspec list --specs\` to see existing capabilities
|
|
74
|
+
|
|
75
|
+
**Before Creating Specs:**
|
|
76
|
+
- Always check if capability already exists
|
|
77
|
+
- Prefer modifying existing specs over creating duplicates
|
|
78
|
+
- Use \`lightspec show [spec]\` to review current state
|
|
79
|
+
- If request is ambiguous, ask 1–2 clarifying questions before scaffolding
|
|
80
|
+
|
|
81
|
+
### Search Guidance
|
|
82
|
+
- Enumerate specs: \`lightspec spec list --long\` (or \`--json\` for scripts)
|
|
83
|
+
- Enumerate changes: \`lightspec list\` (or \`lightspec change list --json\` - deprecated but available)
|
|
84
|
+
- Show details:
|
|
85
|
+
- Spec: \`lightspec show <spec-id> --type spec\` (use \`--json\` for filters)
|
|
86
|
+
- Change: \`lightspec show <change-id> --json --deltas-only\`
|
|
87
|
+
- Full-text search (use ripgrep): \`rg -n "Requirement:|Scenario:" lightspec/specs\`
|
|
88
|
+
|
|
89
|
+
## Quick Start
|
|
90
|
+
|
|
91
|
+
### CLI Commands
|
|
92
|
+
|
|
93
|
+
\`\`\`bash
|
|
94
|
+
# Essential commands
|
|
95
|
+
lightspec list # List active changes
|
|
96
|
+
lightspec list --specs # List specifications
|
|
97
|
+
lightspec show [item] # Display change or spec
|
|
98
|
+
lightspec validate [item] # Validate changes or specs
|
|
99
|
+
lightspec archive <change-id> [--yes|-y] # Archive after deployment (add --yes for non-interactive runs)
|
|
100
|
+
|
|
101
|
+
# Project management
|
|
102
|
+
lightspec init [path] # Initialize LightSpec
|
|
103
|
+
lightspec update [path] # Update instruction files
|
|
104
|
+
|
|
105
|
+
# Interactive mode
|
|
106
|
+
lightspec show # Prompts for selection
|
|
107
|
+
lightspec validate # Bulk validation mode
|
|
108
|
+
|
|
109
|
+
# Debugging
|
|
110
|
+
lightspec show [change] --json --deltas-only
|
|
111
|
+
lightspec validate [change] --strict --no-interactive
|
|
112
|
+
\`\`\`
|
|
113
|
+
|
|
114
|
+
### Command Flags
|
|
115
|
+
|
|
116
|
+
- \`--json\` - Machine-readable output
|
|
117
|
+
- \`--type change|spec\` - Disambiguate items
|
|
118
|
+
- \`--strict\` - Comprehensive validation
|
|
119
|
+
- \`--no-interactive\` - Disable prompts
|
|
120
|
+
- \`--skip-specs\` - Archive without spec updates
|
|
121
|
+
- \`--yes\`/\`-y\` - Skip confirmation prompts (non-interactive archive)
|
|
122
|
+
|
|
123
|
+
## Directory Structure
|
|
124
|
+
|
|
125
|
+
\`\`\`
|
|
126
|
+
lightspec/
|
|
127
|
+
├── project.md # Project conventions
|
|
128
|
+
├── specs/ # Current truth - what IS built
|
|
129
|
+
│ └── [capability]/ # Single focused capability
|
|
130
|
+
│ ├── spec.md # Requirements and scenarios
|
|
131
|
+
│ └── design.md # Technical patterns
|
|
132
|
+
├── changes/ # Proposals - what SHOULD change
|
|
133
|
+
│ ├── [change-name]/
|
|
134
|
+
│ │ ├── proposal.md # Why, what, impact
|
|
135
|
+
│ │ ├── tasks.md # Implementation checklist
|
|
136
|
+
│ │ ├── design.md # Technical decisions (optional; see criteria)
|
|
137
|
+
│ │ └── specs/ # Delta changes
|
|
138
|
+
│ │ └── [capability]/
|
|
139
|
+
│ │ └── spec.md # ADDED/MODIFIED/REMOVED
|
|
140
|
+
│ └── archive/ # Completed changes
|
|
141
|
+
\`\`\`
|
|
142
|
+
|
|
143
|
+
## Creating Change Proposals
|
|
144
|
+
|
|
145
|
+
### Decision Tree
|
|
146
|
+
|
|
147
|
+
\`\`\`
|
|
148
|
+
New request?
|
|
149
|
+
├─ Bug fix restoring spec behavior? → Fix directly
|
|
150
|
+
├─ Typo/format/comment? → Fix directly
|
|
151
|
+
├─ New feature/capability? → Create proposal
|
|
152
|
+
├─ Breaking change? → Create proposal
|
|
153
|
+
├─ Architecture change? → Create proposal
|
|
154
|
+
└─ Unclear? → Create proposal (safer)
|
|
155
|
+
\`\`\`
|
|
156
|
+
|
|
157
|
+
### Proposal Structure
|
|
158
|
+
|
|
159
|
+
1. **Create directory:** \`changes/[change-id]/\` (kebab-case, verb-led, unique)
|
|
160
|
+
|
|
161
|
+
2. **Write proposal.md:**
|
|
162
|
+
\`\`\`markdown
|
|
163
|
+
# Change: [Brief description of change]
|
|
164
|
+
|
|
165
|
+
## Why
|
|
166
|
+
[1-2 sentences on problem/opportunity]
|
|
167
|
+
|
|
168
|
+
## What Changes
|
|
169
|
+
- [Bullet list of changes]
|
|
170
|
+
- [Mark breaking changes with **BREAKING**]
|
|
171
|
+
|
|
172
|
+
## Impact
|
|
173
|
+
- Affected specs: [list capabilities]
|
|
174
|
+
- Affected code: [key files/systems]
|
|
175
|
+
\`\`\`
|
|
176
|
+
|
|
177
|
+
3. **Create spec deltas:** \`specs/[capability]/spec.md\`
|
|
178
|
+
\`\`\`markdown
|
|
179
|
+
## ADDED Requirements
|
|
180
|
+
### Requirement: New Feature
|
|
181
|
+
The system SHALL provide...
|
|
182
|
+
|
|
183
|
+
#### Scenario: Success case
|
|
184
|
+
- **WHEN** user performs action
|
|
185
|
+
- **THEN** expected result
|
|
186
|
+
|
|
187
|
+
## MODIFIED Requirements
|
|
188
|
+
### Requirement: Existing Feature
|
|
189
|
+
[Complete modified requirement]
|
|
190
|
+
|
|
191
|
+
## REMOVED Requirements
|
|
192
|
+
### Requirement: Old Feature
|
|
193
|
+
**Reason**: [Why removing]
|
|
194
|
+
**Migration**: [How to handle]
|
|
195
|
+
\`\`\`
|
|
196
|
+
If multiple capabilities are affected, create multiple delta files under \`changes/[change-id]/specs/<capability>/spec.md\`—one per capability.
|
|
197
|
+
|
|
198
|
+
4. **Create tasks.md:**
|
|
199
|
+
\`\`\`markdown
|
|
200
|
+
## 1. Implementation
|
|
201
|
+
- [ ] 1.1 Create database schema
|
|
202
|
+
- [ ] 1.2 Implement API endpoint
|
|
203
|
+
- [ ] 1.3 Add frontend component
|
|
204
|
+
- [ ] 1.4 Write tests
|
|
205
|
+
\`\`\`
|
|
206
|
+
|
|
207
|
+
5. **Create design.md when needed:**
|
|
208
|
+
Create \`design.md\` if any of the following apply; otherwise omit it:
|
|
209
|
+
- Cross-cutting change (multiple services/modules) or a new architectural pattern
|
|
210
|
+
- New external dependency or significant data model changes
|
|
211
|
+
- Security, performance, or migration complexity
|
|
212
|
+
- Ambiguity that benefits from technical decisions before coding
|
|
213
|
+
|
|
214
|
+
Minimal \`design.md\` skeleton:
|
|
215
|
+
\`\`\`markdown
|
|
216
|
+
## Context
|
|
217
|
+
[Background, constraints, stakeholders]
|
|
218
|
+
|
|
219
|
+
## Goals / Non-Goals
|
|
220
|
+
- Goals: [...]
|
|
221
|
+
- Non-Goals: [...]
|
|
222
|
+
|
|
223
|
+
## Decisions
|
|
224
|
+
- Decision: [What and why]
|
|
225
|
+
- Alternatives considered: [Options + rationale]
|
|
226
|
+
|
|
227
|
+
## Risks / Trade-offs
|
|
228
|
+
- [Risk] → Mitigation
|
|
229
|
+
|
|
230
|
+
## Migration Plan
|
|
231
|
+
[Steps, rollback]
|
|
232
|
+
|
|
233
|
+
## Open Questions
|
|
234
|
+
- [...]
|
|
235
|
+
\`\`\`
|
|
236
|
+
|
|
237
|
+
## Spec File Format
|
|
238
|
+
|
|
239
|
+
### Critical: Scenario Formatting
|
|
240
|
+
|
|
241
|
+
**CORRECT** (use #### headers):
|
|
242
|
+
\`\`\`markdown
|
|
243
|
+
#### Scenario: User login success
|
|
244
|
+
- **WHEN** valid credentials provided
|
|
245
|
+
- **THEN** return JWT token
|
|
246
|
+
\`\`\`
|
|
247
|
+
|
|
248
|
+
**WRONG** (don't use bullets or bold):
|
|
249
|
+
\`\`\`markdown
|
|
250
|
+
- **Scenario: User login** ❌
|
|
251
|
+
**Scenario**: User login ❌
|
|
252
|
+
### Scenario: User login ❌
|
|
253
|
+
\`\`\`
|
|
254
|
+
|
|
255
|
+
Every requirement MUST have at least one scenario.
|
|
256
|
+
|
|
257
|
+
### Requirement Wording
|
|
258
|
+
- Use SHALL/MUST for normative requirements (avoid should/may unless intentionally non-normative)
|
|
259
|
+
|
|
260
|
+
### Delta Operations
|
|
261
|
+
|
|
262
|
+
- \`## ADDED Requirements\` - New capabilities
|
|
263
|
+
- \`## MODIFIED Requirements\` - Changed behavior
|
|
264
|
+
- \`## REMOVED Requirements\` - Deprecated features
|
|
265
|
+
- \`## RENAMED Requirements\` - Name changes
|
|
266
|
+
|
|
267
|
+
Headers matched with \`trim(header)\` - whitespace ignored.
|
|
268
|
+
|
|
269
|
+
#### When to use ADDED vs MODIFIED
|
|
270
|
+
- ADDED: Introduces a new capability or sub-capability that can stand alone as a requirement. Prefer ADDED when the change is orthogonal (e.g., adding "Slash Command Configuration") rather than altering the semantics of an existing requirement.
|
|
271
|
+
- MODIFIED: Changes the behavior, scope, or acceptance criteria of an existing requirement. Always paste the full, updated requirement content (header + all scenarios). The archiver will replace the entire requirement with what you provide here; partial deltas will drop previous details.
|
|
272
|
+
- RENAMED: Use when only the name changes. If you also change behavior, use RENAMED (name) plus MODIFIED (content) referencing the new name.
|
|
273
|
+
|
|
274
|
+
Common pitfall: Using MODIFIED to add a new concern without including the previous text. This causes loss of detail at archive time. If you aren’t explicitly changing the existing requirement, add a new requirement under ADDED instead.
|
|
275
|
+
|
|
276
|
+
Authoring a MODIFIED requirement correctly:
|
|
277
|
+
1) Locate the existing requirement in \`lightspec/specs/<capability>/spec.md\`.
|
|
278
|
+
2) Copy the entire requirement block (from \`### Requirement: ...\` through its scenarios).
|
|
279
|
+
3) Paste it under \`## MODIFIED Requirements\` and edit to reflect the new behavior.
|
|
280
|
+
4) Ensure the header text matches exactly (whitespace-insensitive) and keep at least one \`#### Scenario:\`.
|
|
281
|
+
|
|
282
|
+
Example for RENAMED:
|
|
283
|
+
\`\`\`markdown
|
|
284
|
+
## RENAMED Requirements
|
|
285
|
+
- FROM: \`### Requirement: Login\`
|
|
286
|
+
- TO: \`### Requirement: User Authentication\`
|
|
287
|
+
\`\`\`
|
|
288
|
+
|
|
289
|
+
## Troubleshooting
|
|
290
|
+
|
|
291
|
+
### Common Errors
|
|
292
|
+
|
|
293
|
+
**"Change must have at least one delta"**
|
|
294
|
+
- Check \`changes/[name]/specs/\` exists with .md files
|
|
295
|
+
- Verify files have operation prefixes (## ADDED Requirements)
|
|
296
|
+
|
|
297
|
+
**"Requirement must have at least one scenario"**
|
|
298
|
+
- Check scenarios use \`#### Scenario:\` format (4 hashtags)
|
|
299
|
+
- Don't use bullet points or bold for scenario headers
|
|
300
|
+
|
|
301
|
+
**Silent scenario parsing failures**
|
|
302
|
+
- Exact format required: \`#### Scenario: Name\`
|
|
303
|
+
- Debug with: \`lightspec show [change] --json --deltas-only\`
|
|
304
|
+
|
|
305
|
+
### Validation Tips
|
|
306
|
+
|
|
307
|
+
\`\`\`bash
|
|
308
|
+
# Always use strict mode for comprehensive checks
|
|
309
|
+
lightspec validate [change] --strict --no-interactive
|
|
310
|
+
|
|
311
|
+
# Debug delta parsing
|
|
312
|
+
lightspec show [change] --json | jq '.deltas'
|
|
313
|
+
|
|
314
|
+
# Check specific requirement
|
|
315
|
+
lightspec show [spec] --json -r 1
|
|
316
|
+
\`\`\`
|
|
317
|
+
|
|
318
|
+
## Happy Path Script
|
|
319
|
+
|
|
320
|
+
\`\`\`bash
|
|
321
|
+
# 1) Explore current state
|
|
322
|
+
lightspec spec list --long
|
|
323
|
+
lightspec list
|
|
324
|
+
# Optional full-text search:
|
|
325
|
+
# rg -n "Requirement:|Scenario:" lightspec/specs
|
|
326
|
+
# rg -n "^#|Requirement:" lightspec/changes
|
|
327
|
+
|
|
328
|
+
# 2) Choose change id and scaffold
|
|
329
|
+
CHANGE=add-two-factor-auth
|
|
330
|
+
mkdir -p lightspec/changes/$CHANGE/{specs/auth}
|
|
331
|
+
printf "## Why\\n...\\n\\n## What Changes\\n- ...\\n\\n## Impact\\n- ...\\n" > lightspec/changes/$CHANGE/proposal.md
|
|
332
|
+
printf "## 1. Implementation\\n- [ ] 1.1 ...\\n" > lightspec/changes/$CHANGE/tasks.md
|
|
333
|
+
|
|
334
|
+
# 3) Add deltas (example)
|
|
335
|
+
cat > lightspec/changes/$CHANGE/specs/auth/spec.md << 'EOF'
|
|
336
|
+
## ADDED Requirements
|
|
337
|
+
### Requirement: Two-Factor Authentication
|
|
338
|
+
Users MUST provide a second factor during login.
|
|
339
|
+
|
|
340
|
+
#### Scenario: OTP required
|
|
341
|
+
- **WHEN** valid credentials are provided
|
|
342
|
+
- **THEN** an OTP challenge is required
|
|
343
|
+
EOF
|
|
344
|
+
|
|
345
|
+
# 4) Validate
|
|
346
|
+
lightspec validate $CHANGE --strict --no-interactive
|
|
347
|
+
\`\`\`
|
|
348
|
+
|
|
349
|
+
## Multi-Capability Example
|
|
350
|
+
|
|
351
|
+
\`\`\`
|
|
352
|
+
lightspec/changes/add-2fa-notify/
|
|
353
|
+
├── proposal.md
|
|
354
|
+
├── tasks.md
|
|
355
|
+
└── specs/
|
|
356
|
+
├── auth/
|
|
357
|
+
│ └── spec.md # ADDED: Two-Factor Authentication
|
|
358
|
+
└── notifications/
|
|
359
|
+
└── spec.md # ADDED: OTP email notification
|
|
360
|
+
\`\`\`
|
|
361
|
+
|
|
362
|
+
auth/spec.md
|
|
363
|
+
\`\`\`markdown
|
|
364
|
+
## ADDED Requirements
|
|
365
|
+
### Requirement: Two-Factor Authentication
|
|
366
|
+
...
|
|
367
|
+
\`\`\`
|
|
368
|
+
|
|
369
|
+
notifications/spec.md
|
|
370
|
+
\`\`\`markdown
|
|
371
|
+
## ADDED Requirements
|
|
372
|
+
### Requirement: OTP Email Notification
|
|
373
|
+
...
|
|
374
|
+
\`\`\`
|
|
375
|
+
|
|
376
|
+
## Best Practices
|
|
377
|
+
|
|
378
|
+
### Simplicity First
|
|
379
|
+
- Default to <100 lines of new code
|
|
380
|
+
- Single-file implementations until proven insufficient
|
|
381
|
+
- Avoid frameworks without clear justification
|
|
382
|
+
- Choose boring, proven patterns
|
|
383
|
+
|
|
384
|
+
### Complexity Triggers
|
|
385
|
+
Only add complexity with:
|
|
386
|
+
- Performance data showing current solution too slow
|
|
387
|
+
- Concrete scale requirements (>1000 users, >100MB data)
|
|
388
|
+
- Multiple proven use cases requiring abstraction
|
|
389
|
+
|
|
390
|
+
### Clear References
|
|
391
|
+
- Use \`file.ts:42\` format for code locations
|
|
392
|
+
- Reference specs as \`specs/auth/spec.md\`
|
|
393
|
+
- Link related changes and PRs
|
|
394
|
+
|
|
395
|
+
### Capability Naming
|
|
396
|
+
- Use verb-noun: \`user-auth\`, \`payment-capture\`
|
|
397
|
+
- Single purpose per capability
|
|
398
|
+
- 10-minute understandability rule
|
|
399
|
+
- Split if description needs "AND"
|
|
400
|
+
|
|
401
|
+
### Change ID Naming
|
|
402
|
+
- Use kebab-case, short and descriptive: \`add-two-factor-auth\`
|
|
403
|
+
- Prefer verb-led prefixes: \`add-\`, \`update-\`, \`remove-\`, \`refactor-\`
|
|
404
|
+
- Ensure uniqueness; if taken, append \`-2\`, \`-3\`, etc.
|
|
405
|
+
|
|
406
|
+
## Tool Selection Guide
|
|
407
|
+
|
|
408
|
+
| Task | Tool | Why |
|
|
409
|
+
|------|------|-----|
|
|
410
|
+
| Find files by pattern | Glob | Fast pattern matching |
|
|
411
|
+
| Search code content | Grep | Optimized regex search |
|
|
412
|
+
| Read specific files | Read | Direct file access |
|
|
413
|
+
| Explore unknown scope | Task | Multi-step investigation |
|
|
414
|
+
|
|
415
|
+
## Error Recovery
|
|
416
|
+
|
|
417
|
+
### Change Conflicts
|
|
418
|
+
1. Run \`lightspec list\` to see active changes
|
|
419
|
+
2. Check for overlapping specs
|
|
420
|
+
3. Coordinate with change owners
|
|
421
|
+
4. Consider combining proposals
|
|
422
|
+
|
|
423
|
+
### Validation Failures
|
|
424
|
+
1. Run with \`--strict\` flag
|
|
425
|
+
2. Check JSON output for details
|
|
426
|
+
3. Verify spec file format
|
|
427
|
+
4. Ensure scenarios properly formatted
|
|
428
|
+
|
|
429
|
+
### Missing Context
|
|
430
|
+
1. Read project.md first
|
|
431
|
+
2. Check related specs
|
|
432
|
+
3. Review recent archives
|
|
433
|
+
4. Ask for clarification
|
|
434
|
+
|
|
435
|
+
## Quick Reference
|
|
436
|
+
|
|
437
|
+
### Stage Indicators
|
|
438
|
+
- \`changes/\` - Proposed, not yet built
|
|
439
|
+
- \`specs/\` - Built and deployed
|
|
440
|
+
- \`archive/\` - Completed changes
|
|
441
|
+
|
|
442
|
+
### File Purposes
|
|
443
|
+
- \`proposal.md\` - Why and what
|
|
444
|
+
- \`tasks.md\` - Implementation steps
|
|
445
|
+
- \`design.md\` - Technical decisions
|
|
446
|
+
- \`spec.md\` - Requirements and behavior
|
|
447
|
+
|
|
448
|
+
### CLI Essentials
|
|
449
|
+
\`\`\`bash
|
|
450
|
+
lightspec list # What's in progress?
|
|
451
|
+
lightspec show [item] # View details
|
|
452
|
+
lightspec validate --strict --no-interactive # Is it correct?
|
|
453
|
+
lightspec archive <change-id> [--yes|-y] # Mark complete (add --yes for automation)
|
|
454
|
+
\`\`\`
|
|
455
|
+
|
|
456
|
+
Remember: Specs are truth. Changes are proposals. Keep them in sync.
|
|
457
|
+
`;
|
|
458
|
+
//# sourceMappingURL=agents-template.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ProjectContext } from './project-template.js';
|
|
2
|
+
import { SlashCommandId } from './slash-command-templates.js';
|
|
3
|
+
export interface Template {
|
|
4
|
+
path: string;
|
|
5
|
+
content: string | ((context: ProjectContext) => string);
|
|
6
|
+
}
|
|
7
|
+
export declare class TemplateManager {
|
|
8
|
+
static getTemplates(context?: ProjectContext): Template[];
|
|
9
|
+
static getClaudeTemplate(): string;
|
|
10
|
+
static getClineTemplate(): string;
|
|
11
|
+
static getCostrictTemplate(): string;
|
|
12
|
+
static getAgentsStandardTemplate(): string;
|
|
13
|
+
static getSlashCommandBody(id: SlashCommandId): string;
|
|
14
|
+
}
|
|
15
|
+
export { ProjectContext } from './project-template.js';
|
|
16
|
+
export type { SlashCommandId } from './slash-command-templates.js';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { agentsTemplate } from './agents-template.js';
|
|
2
|
+
import { projectTemplate } from './project-template.js';
|
|
3
|
+
import { claudeTemplate } from './claude-template.js';
|
|
4
|
+
import { clineTemplate } from './cline-template.js';
|
|
5
|
+
import { costrictTemplate } from './costrict-template.js';
|
|
6
|
+
import { agentsRootStubTemplate } from './agents-root-stub.js';
|
|
7
|
+
import { getSlashCommandBody } from './slash-command-templates.js';
|
|
8
|
+
export class TemplateManager {
|
|
9
|
+
static getTemplates(context = {}) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
path: 'AGENTS.md',
|
|
13
|
+
content: agentsTemplate
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
path: 'project.md',
|
|
17
|
+
content: projectTemplate(context)
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
static getClaudeTemplate() {
|
|
22
|
+
return claudeTemplate;
|
|
23
|
+
}
|
|
24
|
+
static getClineTemplate() {
|
|
25
|
+
return clineTemplate;
|
|
26
|
+
}
|
|
27
|
+
static getCostrictTemplate() {
|
|
28
|
+
return costrictTemplate;
|
|
29
|
+
}
|
|
30
|
+
static getAgentsStandardTemplate() {
|
|
31
|
+
return agentsRootStubTemplate;
|
|
32
|
+
}
|
|
33
|
+
static getSlashCommandBody(id) {
|
|
34
|
+
return getSlashCommandBody(id);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const projectTemplate = (context = {}) => `# ${context.projectName || 'Project'} Context
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
${context.description || '[Describe your project\'s purpose and goals]'}
|
|
5
|
+
|
|
6
|
+
## Tech Stack
|
|
7
|
+
${context.techStack?.length ? context.techStack.map(tech => `- ${tech}`).join('\n') : '- [List your primary technologies]\n- [e.g., TypeScript, React, Node.js]'}
|
|
8
|
+
|
|
9
|
+
## Project Conventions
|
|
10
|
+
|
|
11
|
+
### Code Style
|
|
12
|
+
[Describe your code style preferences, formatting rules, and naming conventions]
|
|
13
|
+
|
|
14
|
+
### Architecture Patterns
|
|
15
|
+
[Document your architectural decisions and patterns]
|
|
16
|
+
|
|
17
|
+
### Testing Strategy
|
|
18
|
+
[Explain your testing approach and requirements]
|
|
19
|
+
|
|
20
|
+
### Git Workflow
|
|
21
|
+
[Describe your branching strategy and commit conventions]
|
|
22
|
+
|
|
23
|
+
## Domain Context
|
|
24
|
+
[Add domain-specific knowledge that AI assistants need to understand]
|
|
25
|
+
|
|
26
|
+
## Important Constraints
|
|
27
|
+
[List any technical, business, or regulatory constraints]
|
|
28
|
+
|
|
29
|
+
## External Dependencies
|
|
30
|
+
[Document key external services, APIs, or systems]
|
|
31
|
+
`;
|
|
32
|
+
//# sourceMappingURL=project-template.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const baseGuardrails = `**Guardrails**
|
|
2
|
+
- Favor straightforward, minimal implementations first and add complexity only when it is requested or clearly required.
|
|
3
|
+
- Keep changes tightly scoped to the requested outcome.
|
|
4
|
+
- Refer to \`lightspec/AGENTS.md\` (located inside the \`lightspec/\` directory—run \`ls lightspec\` or \`lightspec update\` if you don't see it) if you need additional LightSpec conventions or clarifications.`;
|
|
5
|
+
const proposalGuardrails = `${baseGuardrails}\n- Identify any vague or ambiguous details and ask the necessary follow-up questions before editing files.
|
|
6
|
+
- Do not write any code during the proposal stage. Only create design documents (proposal.md, tasks.md, design.md, and spec deltas). Implementation happens in the apply stage after approval.`;
|
|
7
|
+
const proposalSteps = `**Steps**
|
|
8
|
+
1. Review \`lightspec/project.md\`, run \`lightspec list\` and \`lightspec list --specs\`, and inspect related code or docs (e.g., via \`rg\`/\`ls\`) to ground the proposal in current behaviour; note any gaps that require clarification.
|
|
9
|
+
2. Choose a unique verb-led \`change-id\` and scaffold \`proposal.md\`, \`tasks.md\`, and \`design.md\` (when needed) under \`lightspec/changes/<id>/\`.
|
|
10
|
+
3. Map the change into concrete capabilities or requirements, breaking multi-scope efforts into distinct spec deltas with clear relationships and sequencing.
|
|
11
|
+
4. Capture architectural reasoning in \`design.md\` when the solution spans multiple systems, introduces new patterns, or demands trade-off discussion before committing to specs.
|
|
12
|
+
5. Draft spec deltas in \`changes/<id>/specs/<capability>/spec.md\` (one folder per capability) using \`## ADDED|MODIFIED|REMOVED Requirements\` with at least one \`#### Scenario:\` per requirement and cross-reference related capabilities when relevant.
|
|
13
|
+
6. Draft \`tasks.md\` as an ordered list of small, verifiable work items that deliver user-visible progress, include validation (tests, tooling), and highlight dependencies or parallelizable work.
|
|
14
|
+
7. Validate with \`lightspec validate <id> --strict --no-interactive\` and resolve every issue before sharing the proposal.`;
|
|
15
|
+
const proposalReferences = `**Reference**
|
|
16
|
+
- Use \`lightspec show <id> --json --deltas-only\` or \`lightspec show <spec> --type spec\` to inspect details when validation fails.
|
|
17
|
+
- Search existing requirements with \`rg -n "Requirement:|Scenario:" lightspec/specs\` before writing new ones.
|
|
18
|
+
- Explore the codebase with \`rg <keyword>\`, \`ls\`, or direct file reads so proposals align with current implementation realities.`;
|
|
19
|
+
const applySteps = `**Steps**
|
|
20
|
+
Track these steps as TODOs and complete them one by one.
|
|
21
|
+
1. Read \`changes/<id>/proposal.md\`, \`design.md\` (if present), and \`tasks.md\` to confirm scope and acceptance criteria.
|
|
22
|
+
2. Work through tasks sequentially, keeping edits minimal and focused on the requested change.
|
|
23
|
+
3. Confirm completion before updating statuses—make sure every item in \`tasks.md\` is finished.
|
|
24
|
+
4. Update the checklist after all work is done so each task is marked \`- [x]\` and reflects reality.
|
|
25
|
+
5. Reference \`lightspec list\` or \`lightspec show <item>\` when additional context is required.`;
|
|
26
|
+
const applyReferences = `**Reference**
|
|
27
|
+
- Use \`lightspec show <id> --json --deltas-only\` if you need additional context from the proposal while implementing.`;
|
|
28
|
+
const archiveSteps = `**Steps**
|
|
29
|
+
1. Determine the change ID to archive:
|
|
30
|
+
- If this prompt already includes a specific change ID (for example inside a \`<ChangeId>\` block populated by slash-command arguments), use that value after trimming whitespace.
|
|
31
|
+
- If the conversation references a change loosely (for example by title or summary), run \`lightspec list\` to surface likely IDs, share the relevant candidates, and confirm which one the user intends.
|
|
32
|
+
- Otherwise, review the conversation, run \`lightspec list\`, and ask the user which change to archive; wait for a confirmed change ID before proceeding.
|
|
33
|
+
- If you still cannot identify a single change ID, stop and tell the user you cannot archive anything yet.
|
|
34
|
+
2. Validate the change ID by running \`lightspec list\` (or \`lightspec show <id>\`) and stop if the change is missing, already archived, or otherwise not ready to archive.
|
|
35
|
+
3. Run \`lightspec archive <id> --yes\` so the CLI moves the change and applies spec updates without prompts (use \`--skip-specs\` only for tooling-only work).
|
|
36
|
+
4. Review the command output to confirm the target specs were updated and the change landed in \`changes/archive/\`.
|
|
37
|
+
5. Validate with \`lightspec validate --strict --no-interactive\` and inspect with \`lightspec show <id>\` if anything looks off.`;
|
|
38
|
+
const archiveReferences = `**Reference**
|
|
39
|
+
- Use \`lightspec list\` to confirm change IDs before archiving.
|
|
40
|
+
- Inspect refreshed specs with \`lightspec list --specs\` and address any validation issues before handing off.`;
|
|
41
|
+
export const slashCommandBodies = {
|
|
42
|
+
proposal: [proposalGuardrails, proposalSteps, proposalReferences].join('\n\n'),
|
|
43
|
+
apply: [baseGuardrails, applySteps, applyReferences].join('\n\n'),
|
|
44
|
+
archive: [baseGuardrails, archiveSteps, archiveReferences].join('\n\n')
|
|
45
|
+
};
|
|
46
|
+
export function getSlashCommandBody(id) {
|
|
47
|
+
return slashCommandBodies[id];
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=slash-command-templates.js.map
|