lightspec 0.2.1 → 0.3.0
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/README.md +32 -57
- package/dist/core/configurators/skills/base.d.ts +27 -0
- package/dist/core/configurators/{slash → skills}/base.js +19 -81
- package/dist/core/configurators/skills/registry.d.ts +9 -0
- package/dist/core/configurators/skills/registry.js +24 -0
- package/dist/core/init.d.ts +1 -1
- package/dist/core/init.js +16 -16
- package/dist/core/templates/agent-skill-templates.d.ts +6 -0
- package/dist/core/templates/{slash-command-templates.js → agent-skill-templates.js} +7 -7
- package/dist/core/templates/agents-root-stub.d.ts +1 -1
- package/dist/core/templates/agents-root-stub.js +2 -9
- package/dist/core/templates/agents-template.d.ts +1 -1
- package/dist/core/templates/agents-template.js +1 -1
- package/dist/core/templates/archive-template.js +1 -1
- package/dist/core/templates/index.d.ts +4 -4
- package/dist/core/templates/index.js +5 -5
- package/dist/core/update.js +11 -11
- package/package.json +2 -1
- package/dist/core/configurators/slash/amazon-q.d.ts +0 -9
- package/dist/core/configurators/slash/amazon-q.js +0 -50
- package/dist/core/configurators/slash/antigravity.d.ts +0 -9
- package/dist/core/configurators/slash/antigravity.js +0 -25
- package/dist/core/configurators/slash/auggie.d.ts +0 -9
- package/dist/core/configurators/slash/auggie.js +0 -38
- package/dist/core/configurators/slash/base.d.ts +0 -30
- package/dist/core/configurators/slash/claude.d.ts +0 -9
- package/dist/core/configurators/slash/claude.js +0 -44
- package/dist/core/configurators/slash/cline.d.ts +0 -9
- package/dist/core/configurators/slash/cline.js +0 -25
- package/dist/core/configurators/slash/codebuddy.d.ts +0 -9
- package/dist/core/configurators/slash/codebuddy.js +0 -41
- package/dist/core/configurators/slash/codex.d.ts +0 -6
- package/dist/core/configurators/slash/codex.js +0 -6
- package/dist/core/configurators/slash/continue.d.ts +0 -9
- package/dist/core/configurators/slash/continue.js +0 -53
- package/dist/core/configurators/slash/costrict.d.ts +0 -9
- package/dist/core/configurators/slash/costrict.js +0 -35
- package/dist/core/configurators/slash/crush.d.ts +0 -9
- package/dist/core/configurators/slash/crush.js +0 -44
- package/dist/core/configurators/slash/cursor.d.ts +0 -9
- package/dist/core/configurators/slash/cursor.js +0 -44
- package/dist/core/configurators/slash/factory.d.ts +0 -10
- package/dist/core/configurators/slash/factory.js +0 -42
- package/dist/core/configurators/slash/gemini.d.ts +0 -9
- package/dist/core/configurators/slash/gemini.js +0 -24
- package/dist/core/configurators/slash/github-copilot.d.ts +0 -9
- package/dist/core/configurators/slash/github-copilot.js +0 -38
- package/dist/core/configurators/slash/iflow.d.ts +0 -9
- package/dist/core/configurators/slash/iflow.js +0 -44
- package/dist/core/configurators/slash/kilocode.d.ts +0 -9
- package/dist/core/configurators/slash/kilocode.js +0 -18
- package/dist/core/configurators/slash/mistral-vibe.d.ts +0 -6
- package/dist/core/configurators/slash/mistral-vibe.js +0 -6
- package/dist/core/configurators/slash/opencode.d.ts +0 -12
- package/dist/core/configurators/slash/opencode.js +0 -76
- package/dist/core/configurators/slash/qoder.d.ts +0 -35
- package/dist/core/configurators/slash/qoder.js +0 -83
- package/dist/core/configurators/slash/qwen.d.ts +0 -32
- package/dist/core/configurators/slash/qwen.js +0 -51
- package/dist/core/configurators/slash/registry.d.ts +0 -9
- package/dist/core/configurators/slash/registry.js +0 -86
- package/dist/core/configurators/slash/roocode.d.ts +0 -9
- package/dist/core/configurators/slash/roocode.js +0 -25
- package/dist/core/configurators/slash/toml-base.d.ts +0 -4
- package/dist/core/configurators/slash/toml-base.js +0 -4
- package/dist/core/configurators/slash/windsurf.d.ts +0 -9
- package/dist/core/configurators/slash/windsurf.js +0 -25
- package/dist/core/templates/slash-command-templates.d.ts +0 -6
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://github.com/augmenter-dev/lightspec">
|
|
3
3
|
<picture>
|
|
4
|
-
<img src="assets/augmenter-lightspec.svg" alt="LightSpec logo" height="
|
|
4
|
+
<img src="assets/augmenter-lightspec.svg" alt="LightSpec logo" height="156">
|
|
5
5
|
</picture>
|
|
6
6
|
</a>
|
|
7
7
|
|
|
@@ -20,13 +20,9 @@
|
|
|
20
20
|
<img src="assets/openspec_dashboard.png" alt="LightSpec dashboard preview" width="90%">
|
|
21
21
|
</p>
|
|
22
22
|
|
|
23
|
-
<p align="center">
|
|
24
|
-
Follow <a href="https://x.com/0xTab">@0xTab on X</a> for updates · Join the <a href="https://discord.gg/YctCnvvshC">LightSpec Discord</a> for help and questions.
|
|
25
|
-
</p>
|
|
26
|
-
|
|
27
23
|
# LightSpec
|
|
28
24
|
|
|
29
|
-
A fork of [
|
|
25
|
+
A fork of [OpenSpec](https://github.com/Fission-AI/OpenSpec), focused on simplicity and skill-based agents.
|
|
30
26
|
|
|
31
27
|
LightSpec aligns humans and AI coding assistants with spec-driven development so you agree on what to build before any code is written. **No API keys required.**
|
|
32
28
|
|
|
@@ -38,13 +34,14 @@ Key outcomes:
|
|
|
38
34
|
- Human and AI stakeholders agree on specs before work begins.
|
|
39
35
|
- Structured change folders (proposals, tasks, and spec updates) keep scope explicit and auditable.
|
|
40
36
|
- Shared visibility into what's proposed, active, or archived.
|
|
41
|
-
- Works with the AI tools you already use
|
|
37
|
+
- Works with the AI tools you already use via [agent skills](https://agentskills.io/).
|
|
42
38
|
|
|
43
39
|
## How LightSpec compares (at a glance)
|
|
44
40
|
|
|
45
41
|
- **Lightweight**: simple workflow, no API keys, minimal setup.
|
|
46
42
|
- **Brownfield-first**: works great beyond 0→1. LightSpec separates the source of truth from proposals: `lightspec/specs/` (current truth) and `lightspec/changes/` (proposed updates). This keeps diffs explicit and manageable across features.
|
|
47
43
|
- **Change tracking**: proposals, tasks, and spec deltas live together; archiving merges the approved updates back into specs.
|
|
44
|
+
- **Compared to OpenSpec**: LightSpec is a streamlined alternative to OpenSpec, focused on simplicity and ease of adoption. It has fewer commands and a more opinionated workflow, which can reduce cognitive overhead for teams new to spec-driven development.
|
|
48
45
|
- **Compared to spec-kit & Kiro**: those shine for brand-new features (0→1). LightSpec also excels when modifying existing behavior (1→n), especially when updates span multiple specs.
|
|
49
46
|
|
|
50
47
|
See the full comparison in [How LightSpec Compares](#how-lightspec-compares).
|
|
@@ -85,49 +82,29 @@ See the full comparison in [How LightSpec Compares](#how-lightspec-compares).
|
|
|
85
82
|
|
|
86
83
|
### Supported AI Tools
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
| **OpenCode** | `/lightspec-proposal`, `/lightspec-apply`, `/lightspec-archive` |
|
|
112
|
-
| **Qoder (CLI)** | `/lightspec:proposal`, `/lightspec:apply`, `/lightspec:archive` (`.qoder/commands/lightspec/`) — see [docs](https://qoder.com/cli) |
|
|
113
|
-
| **Qwen Code** | `/lightspec-proposal`, `/lightspec-apply`, `/lightspec-archive` (`.qwen/commands/`) |
|
|
114
|
-
| **RooCode** | `/lightspec-proposal`, `/lightspec-apply`, `/lightspec-archive` (`.roo/commands/`) |
|
|
115
|
-
| **Windsurf** | `/lightspec-proposal`, `/lightspec-apply`, `/lightspec-archive` (`.windsurf/workflows/`) |
|
|
116
|
-
|
|
117
|
-
Kilo Code discovers team workflows automatically. Save the generated files under `.kilocode/workflows/` and trigger them from the command palette with `/lightspec-proposal.md`, `/lightspec-apply.md`, or `/lightspec-archive.md`.
|
|
118
|
-
|
|
119
|
-
</details>
|
|
120
|
-
|
|
121
|
-
<details>
|
|
122
|
-
<summary><strong>AGENTS.md Compatible</strong> (click to expand)</summary>
|
|
123
|
-
|
|
124
|
-
These tools automatically read workflow instructions from `lightspec/AGENTS.md`. Ask them to follow the LightSpec workflow if they need a reminder. Learn more about the [AGENTS.md convention](https://agents.md/).
|
|
125
|
-
|
|
126
|
-
| Tools |
|
|
127
|
-
|-------|
|
|
128
|
-
| Amp • Jules • Others |
|
|
129
|
-
|
|
130
|
-
</details>
|
|
85
|
+
- Amazon Q Developer
|
|
86
|
+
- Antigravity
|
|
87
|
+
- Auggie (Augment CLI)
|
|
88
|
+
- Claude Code
|
|
89
|
+
- Cline
|
|
90
|
+
- Codex
|
|
91
|
+
- CodeBuddy Code (CLI)
|
|
92
|
+
- Continue (VS Code / JetBrains / CLI)
|
|
93
|
+
- CoStrict
|
|
94
|
+
- Crush
|
|
95
|
+
- Cursor
|
|
96
|
+
- Factory Droid
|
|
97
|
+
- Gemini CLI
|
|
98
|
+
- GitHub Copilot
|
|
99
|
+
- iFlow
|
|
100
|
+
- Kilo Code
|
|
101
|
+
- Mistral Vibe
|
|
102
|
+
- OpenCode
|
|
103
|
+
- Qoder (CLI)
|
|
104
|
+
- Qwen Code
|
|
105
|
+
- RooCode
|
|
106
|
+
- Windsurf
|
|
107
|
+
- Any AGENTS.md-compatible assistant (via Universal `AGENTS.md`)
|
|
131
108
|
|
|
132
109
|
### Install & Initialize
|
|
133
110
|
|
|
@@ -194,14 +171,14 @@ lightspec init
|
|
|
194
171
|
|
|
195
172
|
**What happens during initialization:**
|
|
196
173
|
- You'll be prompted to pick any natively supported AI tools (Claude Code, CodeBuddy, Cursor, OpenCode, Qoder,etc.); other assistants always rely on the shared `AGENTS.md` stub
|
|
197
|
-
- LightSpec automatically configures
|
|
174
|
+
- LightSpec automatically configures skills for the tools you choose and always writes a managed `AGENTS.md` hand-off at the project root
|
|
198
175
|
- A new `lightspec/` directory structure is created in your project
|
|
199
176
|
|
|
200
177
|
**After setup:**
|
|
201
178
|
- Primary AI tools can trigger `/lightspec` workflows without additional configuration
|
|
202
179
|
- Run `lightspec list` to verify the setup and view any active changes
|
|
203
|
-
- If your coding assistant doesn't surface the new
|
|
204
|
-
|
|
180
|
+
- If your coding assistant doesn't surface the new skills right away, restart it. Skills are loaded at startup, so a fresh launch ensures they appear
|
|
181
|
+
- Depending on your AI tool, you'll need to invoke the lightspec skills with either slash commands (e.g. `/lightspec:proposal`) or dollar commands (e.g. `$lightspec-proposal`) to create change proposals, apply changes, or archive completed work
|
|
205
182
|
|
|
206
183
|
### Optional: Populate Project Context
|
|
207
184
|
|
|
@@ -216,7 +193,7 @@ Use the `/lightspec:context-check` skill to validate that your agent instruction
|
|
|
216
193
|
|
|
217
194
|
### Create Your First Change
|
|
218
195
|
|
|
219
|
-
Here's a real example showing the complete LightSpec workflow. This works with any AI tool.
|
|
196
|
+
Here's a real example showing the complete LightSpec workflow. This works with any AI tool.
|
|
220
197
|
|
|
221
198
|
#### 1. Draft the Proposal
|
|
222
199
|
Start by asking your AI to create a change proposal:
|
|
@@ -279,8 +256,6 @@ Or run the command yourself in terminal:
|
|
|
279
256
|
$ lightspec archive add-profile-filters --yes # Archive the completed change without prompts
|
|
280
257
|
```
|
|
281
258
|
|
|
282
|
-
**Note:** Tools with native slash commands (Claude Code, CodeBuddy, Cursor, Codex, Qoder, RooCode) can use the shortcuts shown. All other tools work with natural language requests to "create an LightSpec proposal", "apply the LightSpec change", or "archive the change".
|
|
283
|
-
|
|
284
259
|
## Command Reference
|
|
285
260
|
|
|
286
261
|
```bash
|
|
@@ -405,7 +380,7 @@ Run `lightspec update` whenever someone switches tools so your agents pick up th
|
|
|
405
380
|
npm install -g lightspec@latest
|
|
406
381
|
```
|
|
407
382
|
2. **Refresh agent instructions**
|
|
408
|
-
- Run `lightspec update` inside each project to regenerate AI guidance and ensure the latest
|
|
383
|
+
- Run `lightspec update` inside each project to regenerate AI guidance and ensure the latest skills are active.
|
|
409
384
|
|
|
410
385
|
## Contributing
|
|
411
386
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AgentSkillId } from '../../templates/index.js';
|
|
2
|
+
export interface AgentSkillTarget {
|
|
3
|
+
id: AgentSkillId;
|
|
4
|
+
path: string;
|
|
5
|
+
kind: 'skill';
|
|
6
|
+
}
|
|
7
|
+
export type SkillInstallLocation = 'project' | 'home';
|
|
8
|
+
export declare const AGENT_SKILL_TOOL_IDS: readonly string[];
|
|
9
|
+
export declare class AgentSkillConfigurator {
|
|
10
|
+
readonly toolId: string;
|
|
11
|
+
readonly isAvailable: boolean;
|
|
12
|
+
private installLocation;
|
|
13
|
+
constructor(toolId: string, isAvailable?: boolean);
|
|
14
|
+
setInstallLocation(location: SkillInstallLocation): void;
|
|
15
|
+
getTargets(): AgentSkillTarget[];
|
|
16
|
+
generateAll(projectPath: string, _lightspecDir: string): Promise<string[]>;
|
|
17
|
+
updateExisting(projectPath: string, _lightspecDir: string): Promise<string[]>;
|
|
18
|
+
protected getBody(id: AgentSkillId): string;
|
|
19
|
+
resolveAbsolutePath(projectPath: string, id: AgentSkillId): string;
|
|
20
|
+
private getRelativeSkillPath;
|
|
21
|
+
private getToolRoot;
|
|
22
|
+
private getHomeRootPath;
|
|
23
|
+
private getSkillName;
|
|
24
|
+
private buildSkillFile;
|
|
25
|
+
protected updateBody(filePath: string, body: string): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { promises as fs } from 'fs';
|
|
4
3
|
import { FileSystemUtils } from '../../../utils/file-system.js';
|
|
5
4
|
import { TemplateManager } from '../../templates/index.js';
|
|
6
5
|
import { LIGHTSPEC_MARKERS } from '../../config.js';
|
|
7
|
-
const
|
|
6
|
+
const ALL_SKILL_IDS = ['proposal', 'apply', 'archive', 'context-check'];
|
|
8
7
|
const TOOL_SKILL_ROOTS = {
|
|
9
8
|
'amazon-q': '.amazonq',
|
|
10
9
|
antigravity: '.antigravity',
|
|
@@ -29,37 +28,26 @@ const TOOL_SKILL_ROOTS = {
|
|
|
29
28
|
roocode: '.roocode',
|
|
30
29
|
windsurf: '.windsurf',
|
|
31
30
|
};
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
auggie: ['.augment/commands', '.auggie/commands'],
|
|
36
|
-
claude: ['.claude/commands'],
|
|
37
|
-
cline: ['.cline/commands', '.clinerules/workflows'],
|
|
38
|
-
codex: ['.codex/prompts'],
|
|
39
|
-
codebuddy: ['.codebuddy/commands'],
|
|
40
|
-
continue: ['.continue/prompts', '.continue/commands'],
|
|
41
|
-
costrict: ['.cospec/lightspec/commands'],
|
|
42
|
-
crush: ['.crush/commands'],
|
|
43
|
-
cursor: ['.cursor/commands'],
|
|
44
|
-
factory: ['.factory/commands'],
|
|
45
|
-
gemini: ['.gemini/commands'],
|
|
46
|
-
'github-copilot': ['.github/prompts', '.github/copilot/prompts'],
|
|
47
|
-
iflow: ['.iflow/commands'],
|
|
48
|
-
kilocode: ['.kilocode/commands', '.kilocode/workflows'],
|
|
49
|
-
'mistral-vibe': ['.vibe/commands', '.vibe/workflows', '.vibe/prompts'],
|
|
50
|
-
opencode: ['.opencode/command', '.opencode/commands'],
|
|
51
|
-
qoder: ['.qoder/commands', '.qoder/prompts'],
|
|
52
|
-
qwen: ['.qwen/commands', '.qwen/prompts'],
|
|
53
|
-
roocode: ['.roo/commands', '.roocode/commands'],
|
|
54
|
-
windsurf: ['.windsurf/workflows', '.windsurf/commands'],
|
|
31
|
+
export const AGENT_SKILL_TOOL_IDS = Object.freeze(Object.keys(TOOL_SKILL_ROOTS));
|
|
32
|
+
const TOOL_BODY_SUFFIX = {
|
|
33
|
+
factory: '\n\n$ARGUMENTS',
|
|
55
34
|
};
|
|
56
|
-
export class
|
|
35
|
+
export class AgentSkillConfigurator {
|
|
36
|
+
toolId;
|
|
37
|
+
isAvailable;
|
|
57
38
|
installLocation = 'project';
|
|
39
|
+
constructor(toolId, isAvailable = true) {
|
|
40
|
+
this.toolId = toolId;
|
|
41
|
+
this.isAvailable = isAvailable;
|
|
42
|
+
if (!TOOL_SKILL_ROOTS[this.toolId]) {
|
|
43
|
+
throw new Error(`No skill root directory configured for tool '${this.toolId}'`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
58
46
|
setInstallLocation(location) {
|
|
59
47
|
this.installLocation = location;
|
|
60
48
|
}
|
|
61
49
|
getTargets() {
|
|
62
|
-
return
|
|
50
|
+
return ALL_SKILL_IDS.map((id) => ({
|
|
63
51
|
id,
|
|
64
52
|
path: this.getRelativeSkillPath(id),
|
|
65
53
|
kind: 'skill',
|
|
@@ -74,13 +62,12 @@ export class SlashCommandConfigurator {
|
|
|
74
62
|
await this.updateBody(filePath, body);
|
|
75
63
|
}
|
|
76
64
|
else {
|
|
77
|
-
const frontmatter = TemplateManager.
|
|
65
|
+
const frontmatter = TemplateManager.getAgentSkillFrontmatter(target.id).trim();
|
|
78
66
|
const content = this.buildSkillFile(frontmatter, body);
|
|
79
67
|
await FileSystemUtils.writeFile(filePath, content);
|
|
80
68
|
}
|
|
81
69
|
createdOrUpdated.push(target.path);
|
|
82
70
|
}
|
|
83
|
-
await this.cleanupLegacyArtifacts(projectPath);
|
|
84
71
|
return createdOrUpdated;
|
|
85
72
|
}
|
|
86
73
|
async updateExisting(projectPath, _lightspecDir) {
|
|
@@ -93,11 +80,12 @@ export class SlashCommandConfigurator {
|
|
|
93
80
|
updated.push(target.path);
|
|
94
81
|
}
|
|
95
82
|
}
|
|
96
|
-
await this.cleanupLegacyArtifacts(projectPath);
|
|
97
83
|
return updated;
|
|
98
84
|
}
|
|
99
85
|
getBody(id) {
|
|
100
|
-
|
|
86
|
+
const baseBody = TemplateManager.getAgentSkillBody(id).trim();
|
|
87
|
+
const suffix = TOOL_BODY_SUFFIX[this.toolId] ?? '';
|
|
88
|
+
return `${baseBody}${suffix}`;
|
|
101
89
|
}
|
|
102
90
|
resolveAbsolutePath(projectPath, id) {
|
|
103
91
|
const relativePath = this.getRelativeSkillPath(id);
|
|
@@ -159,55 +147,5 @@ export class SlashCommandConfigurator {
|
|
|
159
147
|
const updatedContent = `${before}\n${body}\n${after}`;
|
|
160
148
|
await FileSystemUtils.writeFile(filePath, updatedContent);
|
|
161
149
|
}
|
|
162
|
-
async cleanupLegacyArtifacts(projectPath) {
|
|
163
|
-
const legacyDirs = TOOL_LEGACY_DIRS[this.toolId] ?? [];
|
|
164
|
-
for (const legacyDir of legacyDirs) {
|
|
165
|
-
const absoluteDir = this.installLocation === 'project'
|
|
166
|
-
? FileSystemUtils.joinPath(projectPath, legacyDir)
|
|
167
|
-
: FileSystemUtils.joinPath(this.getHomeRootPath(), this.relativeToToolRoot(legacyDir));
|
|
168
|
-
await this.removeLegacyLightSpecFiles(absoluteDir);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
relativeToToolRoot(relativePath) {
|
|
172
|
-
const rootPrefix = this.getToolRoot();
|
|
173
|
-
const normalized = FileSystemUtils.toPosixPath(relativePath);
|
|
174
|
-
if (normalized.startsWith(`${rootPrefix}/`)) {
|
|
175
|
-
return normalized.slice(rootPrefix.length + 1);
|
|
176
|
-
}
|
|
177
|
-
if (normalized === rootPrefix) {
|
|
178
|
-
return '';
|
|
179
|
-
}
|
|
180
|
-
return normalized.startsWith('./') ? normalized.slice(2) : normalized;
|
|
181
|
-
}
|
|
182
|
-
async removeLegacyLightSpecFiles(dirPath) {
|
|
183
|
-
if (!(await FileSystemUtils.directoryExists(dirPath))) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
await this.walkAndRemove(dirPath);
|
|
187
|
-
}
|
|
188
|
-
async walkAndRemove(currentPath) {
|
|
189
|
-
const entries = await fs.readdir(currentPath, { withFileTypes: true });
|
|
190
|
-
for (const entry of entries) {
|
|
191
|
-
const entryPath = path.join(currentPath, entry.name);
|
|
192
|
-
if (entry.isDirectory()) {
|
|
193
|
-
await this.walkAndRemove(entryPath);
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
if (this.isLegacyLightSpecFile(entryPath)) {
|
|
197
|
-
await fs.unlink(entryPath);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
isLegacyLightSpecFile(filePath) {
|
|
202
|
-
const normalized = FileSystemUtils.toPosixPath(filePath).toLowerCase();
|
|
203
|
-
return (normalized.includes('/lightspec-proposal') ||
|
|
204
|
-
normalized.includes('/lightspec-apply') ||
|
|
205
|
-
normalized.includes('/lightspec-archive') ||
|
|
206
|
-
normalized.includes('/lightspec-context-check') ||
|
|
207
|
-
normalized.includes('/lightspec/proposal') ||
|
|
208
|
-
normalized.includes('/lightspec/apply') ||
|
|
209
|
-
normalized.includes('/lightspec/archive') ||
|
|
210
|
-
normalized.includes('/lightspec/context-check'));
|
|
211
|
-
}
|
|
212
150
|
}
|
|
213
151
|
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AgentSkillConfigurator, SkillInstallLocation } from './base.js';
|
|
2
|
+
export declare class AgentSkillRegistry {
|
|
3
|
+
private static configurators;
|
|
4
|
+
static register(configurator: AgentSkillConfigurator): void;
|
|
5
|
+
static get(toolId: string): AgentSkillConfigurator | undefined;
|
|
6
|
+
static getAll(): AgentSkillConfigurator[];
|
|
7
|
+
static setInstallLocation(location: SkillInstallLocation): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AGENT_SKILL_TOOL_IDS, AgentSkillConfigurator, } from './base.js';
|
|
2
|
+
export class AgentSkillRegistry {
|
|
3
|
+
static configurators = new Map();
|
|
4
|
+
static {
|
|
5
|
+
for (const toolId of AGENT_SKILL_TOOL_IDS) {
|
|
6
|
+
this.configurators.set(toolId, new AgentSkillConfigurator(toolId));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
static register(configurator) {
|
|
10
|
+
this.configurators.set(configurator.toolId, configurator);
|
|
11
|
+
}
|
|
12
|
+
static get(toolId) {
|
|
13
|
+
return this.configurators.get(toolId);
|
|
14
|
+
}
|
|
15
|
+
static getAll() {
|
|
16
|
+
return Array.from(this.configurators.values());
|
|
17
|
+
}
|
|
18
|
+
static setInstallLocation(location) {
|
|
19
|
+
for (const configurator of this.configurators.values()) {
|
|
20
|
+
configurator.setInstallLocation(location);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=registry.js.map
|
package/dist/core/init.d.ts
CHANGED
package/dist/core/init.js
CHANGED
|
@@ -6,7 +6,7 @@ import ora from 'ora';
|
|
|
6
6
|
import { FileSystemUtils } from '../utils/file-system.js';
|
|
7
7
|
import { TemplateManager } from './templates/index.js';
|
|
8
8
|
import { ToolRegistry } from './configurators/registry.js';
|
|
9
|
-
import {
|
|
9
|
+
import { AgentSkillRegistry } from './configurators/skills/registry.js';
|
|
10
10
|
import { AI_TOOLS, LIGHTSPEC_DIR_NAME, LIGHTSPEC_MARKERS, } from './config.js';
|
|
11
11
|
import { PALETTE } from './styles/palette.js';
|
|
12
12
|
const PROGRESS_SPINNER = {
|
|
@@ -282,7 +282,7 @@ export class InitCommand {
|
|
|
282
282
|
this.renderBanner(extendMode);
|
|
283
283
|
// Get configuration (after validation to avoid prompts if validation fails)
|
|
284
284
|
const config = await this.getConfiguration(existingToolStates, extendMode);
|
|
285
|
-
|
|
285
|
+
AgentSkillRegistry.setInstallLocation(config.skillLocation);
|
|
286
286
|
const availableTools = AI_TOOLS.filter((tool) => tool.available);
|
|
287
287
|
const selectedIds = new Set(config.aiTools);
|
|
288
288
|
const selectedTools = availableTools.filter((tool) => selectedIds.has(tool.value));
|
|
@@ -474,7 +474,7 @@ export class InitCommand {
|
|
|
474
474
|
}
|
|
475
475
|
};
|
|
476
476
|
let hasConfigFile = false;
|
|
477
|
-
let
|
|
477
|
+
let hasSkills = false;
|
|
478
478
|
// Check if the tool has a config file with LightSpec markers
|
|
479
479
|
const configFile = ToolRegistry.get(toolId)?.configFileName;
|
|
480
480
|
if (configFile) {
|
|
@@ -482,24 +482,24 @@ export class InitCommand {
|
|
|
482
482
|
hasConfigFile = (await FileSystemUtils.fileExists(configPath)) && (await fileHasMarkers(configPath));
|
|
483
483
|
}
|
|
484
484
|
// Check if any skill file exists with LightSpec markers
|
|
485
|
-
const
|
|
486
|
-
if (
|
|
487
|
-
for (const target of
|
|
488
|
-
const absolute =
|
|
485
|
+
const skillConfigurator = AgentSkillRegistry.get(toolId);
|
|
486
|
+
if (skillConfigurator) {
|
|
487
|
+
for (const target of skillConfigurator.getTargets()) {
|
|
488
|
+
const absolute = skillConfigurator.resolveAbsolutePath(projectPath, target.id);
|
|
489
489
|
if ((await FileSystemUtils.fileExists(absolute)) && (await fileHasMarkers(absolute))) {
|
|
490
|
-
|
|
490
|
+
hasSkills = true;
|
|
491
491
|
break; // At least one file with markers is sufficient
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
// Tool is only configured if BOTH exist with markers
|
|
496
|
-
// OR if the tool has no config file requirement (
|
|
497
|
-
// OR if the tool has no
|
|
496
|
+
// OR if the tool has no config file requirement (skills only)
|
|
497
|
+
// OR if the tool has no skill requirement (config file only)
|
|
498
498
|
const hasConfigFileRequirement = configFile !== undefined;
|
|
499
|
-
const hasSkillRequirement =
|
|
499
|
+
const hasSkillRequirement = skillConfigurator !== undefined;
|
|
500
500
|
if (hasConfigFileRequirement && hasSkillRequirement) {
|
|
501
501
|
// Both are required - both must be present with markers
|
|
502
|
-
return hasConfigFile &&
|
|
502
|
+
return hasConfigFile && hasSkills;
|
|
503
503
|
}
|
|
504
504
|
else if (hasConfigFileRequirement) {
|
|
505
505
|
// Only config file required
|
|
@@ -507,7 +507,7 @@ export class InitCommand {
|
|
|
507
507
|
}
|
|
508
508
|
else if (hasSkillRequirement) {
|
|
509
509
|
// Only skills required
|
|
510
|
-
return
|
|
510
|
+
return hasSkills;
|
|
511
511
|
}
|
|
512
512
|
return false;
|
|
513
513
|
}
|
|
@@ -552,9 +552,9 @@ export class InitCommand {
|
|
|
552
552
|
if (configurator && configurator.isAvailable) {
|
|
553
553
|
await configurator.configure(projectPath, lightspecDir);
|
|
554
554
|
}
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
557
|
-
await
|
|
555
|
+
const skillConfigurator = AgentSkillRegistry.get(toolId);
|
|
556
|
+
if (skillConfigurator && skillConfigurator.isAvailable) {
|
|
557
|
+
await skillConfigurator.generateAll(projectPath, lightspecDir);
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
return rootStubStatus;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type AgentSkillId = 'proposal' | 'apply' | 'archive' | 'context-check';
|
|
2
|
+
export declare const agentSkillBodies: Record<AgentSkillId, string>;
|
|
3
|
+
export declare const agentSkillFrontmatter: Record<AgentSkillId, string>;
|
|
4
|
+
export declare function getAgentSkillBody(id: AgentSkillId): string;
|
|
5
|
+
export declare function getAgentSkillFrontmatter(id: AgentSkillId): string;
|
|
6
|
+
//# sourceMappingURL=agent-skill-templates.d.ts.map
|
|
@@ -2,22 +2,22 @@ import { applyTemplate, applyFrontmatter } from './apply-template.js';
|
|
|
2
2
|
import { archiveTemplate, archiveFrontmatter } from './archive-template.js';
|
|
3
3
|
import { proposalTemplate, proposalFrontmatter } from './proposal-template.js';
|
|
4
4
|
import { contextCheckTemplate, contextCheckFrontmatter, } from './context-check-template.js';
|
|
5
|
-
export const
|
|
5
|
+
export const agentSkillBodies = {
|
|
6
6
|
proposal: proposalTemplate,
|
|
7
7
|
apply: applyTemplate,
|
|
8
8
|
archive: archiveTemplate,
|
|
9
9
|
'context-check': contextCheckTemplate,
|
|
10
10
|
};
|
|
11
|
-
export const
|
|
11
|
+
export const agentSkillFrontmatter = {
|
|
12
12
|
proposal: proposalFrontmatter,
|
|
13
13
|
apply: applyFrontmatter,
|
|
14
14
|
archive: archiveFrontmatter,
|
|
15
15
|
'context-check': contextCheckFrontmatter,
|
|
16
16
|
};
|
|
17
|
-
export function
|
|
18
|
-
return
|
|
17
|
+
export function getAgentSkillBody(id) {
|
|
18
|
+
return agentSkillBodies[id];
|
|
19
19
|
}
|
|
20
|
-
export function
|
|
21
|
-
return
|
|
20
|
+
export function getAgentSkillFrontmatter(id) {
|
|
21
|
+
return agentSkillFrontmatter[id];
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=agent-skill-templates.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const agentsRootStubTemplate = "# LightSpec Instructions\n\nThese instructions are for AI assistants working in this project.\n\
|
|
1
|
+
export declare const agentsRootStubTemplate = "# LightSpec Instructions\n\nThese instructions are for AI assistants working in this project.\n\n- For complex features (new capability, breaking change, architecture/performance/security work), suggest switching to `/plan` mode if it's not already the case, then run `lightspec-proposal` before coding.\n- If unsure which skill to run, list installed skills in your assistant's `skills/` folder.\n\nKeep this managed block so 'lightspec update' can refresh the instructions.\n";
|
|
2
2
|
//# sourceMappingURL=agents-root-stub.d.ts.map
|
|
@@ -2,15 +2,8 @@ export const agentsRootStubTemplate = `# LightSpec Instructions
|
|
|
2
2
|
|
|
3
3
|
These instructions are for AI assistants working in this project.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
-
|
|
7
|
-
- Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work
|
|
8
|
-
- Sounds ambiguous and you need the authoritative spec before coding
|
|
9
|
-
|
|
10
|
-
Use \`@/lightspec/AGENTS.md\` to learn:
|
|
11
|
-
- How to create and apply change proposals
|
|
12
|
-
- Spec format and conventions
|
|
13
|
-
- Project structure and guidelines
|
|
5
|
+
- For complex features (new capability, breaking change, architecture/performance/security work), suggest switching to \`/plan\` mode if it's not already the case, then run \`lightspec-proposal\` before coding.
|
|
6
|
+
- If unsure which skill to run, list installed skills in your assistant's \`skills/\` folder.
|
|
14
7
|
|
|
15
8
|
Keep this managed block so 'lightspec update' can refresh the instructions.
|
|
16
9
|
`;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const agentsTemplate = "# LightSpec Instructions\n\nInstructions for AI coding assistants using LightSpec for spec-driven development.\n\n## TL;DR Quick Checklist\n\n- Search existing work: `lightspec spec list --long`, `lightspec list` (use `rg` only for full-text search)\n- Decide scope: new capability vs modify existing capability\n- Pick a unique `change-id`: kebab-case, verb-led (`add-`, `update-`, `remove-`, `refactor-`)\n- Scaffold: `proposal.md`, `tasks.md`, `design.md` (only if needed), and delta specs per affected capability\n- Write deltas: use `## ADDED|MODIFIED|REMOVED|RENAMED Requirements`; include at least one `#### Scenario:` per requirement\n- Validate: `lightspec validate [change-id] --strict --no-interactive` and fix issues\n- Request approval: Do not start implementation until proposal is approved\n\n## Three-Stage Workflow\n\n### Stage 1: Creating Changes\nCreate proposal when you need to:\n- Add features or functionality\n- Make breaking changes (API, schema)\n- Change architecture or patterns \n- Optimize performance (changes behavior)\n- Update security patterns\n\nTriggers (examples):\n- \"Help me create a change proposal\"\n- \"Help me plan a change\"\n- \"Help me create a proposal\"\n- \"I want to create a spec proposal\"\n- \"I want to create a spec\"\n\nLoose matching guidance:\n- Contains one of: `proposal`, `change`, `spec`\n- With one of: `create`, `plan`, `make`, `start`, `help`\n\nSkip proposal for:\n- Bug fixes (restore intended behavior)\n- Typos, formatting, comments\n- Dependency updates (non-breaking)\n- Configuration changes\n- Tests for existing behavior\n\n**Workflow**\n1. Review `lightspec list` and `lightspec list --specs` to understand current context.\n2. Choose a unique verb-led `change-id` and scaffold `proposal.md`, `tasks.md`, optional `design.md`, and spec deltas under `lightspec/changes/<id>/`.\n3. Draft spec deltas using `## ADDED|MODIFIED|REMOVED Requirements` with at least one `#### Scenario:` per requirement.\n4. Run `lightspec validate <id> --strict --no-interactive` and resolve any issues before sharing the proposal.\n\n### Stage 2: Implementing Changes\nTrack these steps as TODOs and complete them one by one.\n1. **Read proposal.md** - Understand what's being built\n2. **Read design.md** (if exists) - Review technical decisions\n3. **Read tasks.md** - Get implementation checklist\n4. **Implement tasks sequentially** - Complete in order\n5. **Confirm completion** - Ensure every item in `tasks.md` is finished before updating statuses\n6. **Update checklist** - After all work is done, set every task to `- [x]` so the list reflects reality\n7. **Approval gate** - Do not start implementation until the proposal is reviewed and approved\n\n### Stage 3: Archiving Changes\nAfter deployment, create separate PR to:\n- Move `changes/[name]/` \u2192 `changes/archive/YYYY-MM-DD-[name]/`\n- Update `specs/` if capabilities changed\n- Use `lightspec archive <change-id> --skip-specs --yes` for tooling-only changes (always pass the change ID explicitly)\n- Run `lightspec validate --strict --no-interactive` to confirm the archived change passes checks\n\n## Before Any Task\n\n**Context Checklist:**\n- [ ] Read relevant specs in `specs/[capability]/spec.md`\n- [ ] Check pending changes in `changes/` for conflicts\n- [ ] Run `lightspec list` to see active changes\n- [ ] Run `lightspec list --specs` to see existing capabilities\n\n**Before Creating Specs:**\n- Always check if capability already exists\n- Prefer modifying existing specs over creating duplicates\n- Use `lightspec show [spec]` to review current state\n- If request is ambiguous, ask 1\u20132 clarifying questions before scaffolding\n\n### Search Guidance\n- Enumerate specs: `lightspec spec list --long` (or `--json` for scripts)\n- Enumerate changes: `lightspec list` (or `lightspec change list --json` - deprecated but available)\n- Show details:\n - Spec: `lightspec show <spec-id> --type spec` (use `--json` for filters)\n - Change: `lightspec show <change-id> --json --deltas-only`\n- Full-text search (use ripgrep): `rg -n \"Requirement:|Scenario:\" lightspec/specs`\n\n## Quick Start\n\n### CLI Commands\n\n```bash\n# Essential commands\nlightspec list # List active changes\nlightspec list --specs # List specifications\nlightspec show [item] # Display change or spec\nlightspec validate [item] # Validate changes or specs\nlightspec archive <change-id> [--yes|-y] # Archive after deployment (add --yes for non-interactive runs)\n\n# Project management\nlightspec init [path] # Initialize LightSpec\nlightspec update [path] # Update instruction files\n\n# Interactive mode\nlightspec show # Prompts for selection\nlightspec validate # Bulk validation mode\n\n# Debugging\nlightspec show [change] --json --deltas-only\nlightspec validate [change] --strict --no-interactive\n```\n\n### Command Flags\n\n- `--json` - Machine-readable output\n- `--type change|spec` - Disambiguate items\n- `--strict` - Comprehensive validation\n- `--no-interactive` - Disable prompts\n- `--skip-specs` - Archive without spec updates\n- `--yes`/`-y` - Skip confirmation prompts (non-interactive archive)\n\n## Directory Structure\n\n```\nlightspec/\n\u251C\u2500\u2500 specs/ # Current truth - what IS built\n\u2502 \u2514\u2500\u2500 [capability]/ # Single focused capability\n\u2502 \u251C\u2500\u2500 spec.md # Requirements and scenarios\n\u2502 \u2514\u2500\u2500 design.md # Technical patterns\n\u251C\u2500\u2500 changes/ # Proposals - what SHOULD change\n\u2502 \u251C\u2500\u2500 [change-name]/\n\u2502 \u2502 \u251C\u2500\u2500 proposal.md # Why, what, impact\n\u2502 \u2502 \u251C\u2500\u2500 tasks.md # Implementation checklist\n\u2502 \u2502 \u251C\u2500\u2500 design.md # Technical decisions (optional; see criteria)\n\u2502 \u2502 \u2514\u2500\u2500 specs/ # Delta changes\n\u2502 \u2502 \u2514\u2500\u2500 [capability]/\n\u2502 \u2502 \u2514\u2500\u2500 spec.md # ADDED/MODIFIED/REMOVED\n\u2502 \u2514\u2500\u2500 archive/ # Completed changes\n```\n\n## Creating Change Proposals\n\n### Decision Tree\n\n```\nNew request?\n\u251C\u2500 Bug fix restoring spec behavior? \u2192 Fix directly\n\u251C\u2500 Typo/format/comment? \u2192 Fix directly \n\u251C\u2500 New feature/capability? \u2192 Create proposal\n\u251C\u2500 Breaking change? \u2192 Create proposal\n\u251C\u2500 Architecture change? \u2192 Create proposal\n\u2514\u2500 Unclear? \u2192 Create proposal (safer)\n```\n\n### Proposal Structure\n\n1. **Create directory:** `changes/[change-id]/` (kebab-case, verb-led, unique)\n\n2. **Write proposal.md:**\n```markdown\n# Change: [Brief description of change]\n\n## Why\n[1-2 sentences on problem/opportunity]\n\n## What Changes\n- [Bullet list of changes]\n- [Mark breaking changes with **BREAKING**]\n\n## Impact\n- Affected specs: [list capabilities]\n- Affected code: [key files/systems]\n```\n\n3. **Create spec deltas:** `specs/[capability]/spec.md`\n```markdown\n## ADDED Requirements\n### Requirement: New Feature\nThe system SHALL provide...\n\n#### Scenario: Success case\n- **WHEN** user performs action\n- **THEN** expected result\n\n## MODIFIED Requirements\n### Requirement: Existing Feature\n[Complete modified requirement]\n\n## REMOVED Requirements\n### Requirement: Old Feature\n**Reason**: [Why removing]\n**Migration**: [How to handle]\n```\nIf multiple capabilities are affected, create multiple delta files under `changes/[change-id]/specs/<capability>/spec.md`\u2014one per capability.\n\n4. **Create tasks.md:**\n```markdown\n## 1. Implementation\n- [ ] 1.1 Create database schema\n- [ ] 1.2 Implement API endpoint\n- [ ] 1.3 Add frontend component\n- [ ] 1.4 Write tests\n```\n\n5. **Create design.md when needed:**\nCreate `design.md` if any of the following apply; otherwise omit it:\n- Cross-cutting change (multiple services/modules) or a new architectural pattern\n- New external dependency or significant data model changes\n- Security, performance, or migration complexity\n- Ambiguity that benefits from technical decisions before coding\n\nMinimal `design.md` skeleton:\n```markdown\n## Context\n[Background, constraints, stakeholders]\n\n## Goals / Non-Goals\n- Goals: [...]\n- Non-Goals: [...]\n\n## Decisions\n- Decision: [What and why]\n- Alternatives considered: [Options + rationale]\n\n## Risks / Trade-offs\n- [Risk] \u2192 Mitigation\n\n## Migration Plan\n[Steps, rollback]\n\n## Open Questions\n- [...]\n```\n\n## Spec File Format\n\n### Critical: Scenario Formatting\n\n**CORRECT** (use #### headers):\n```markdown\n#### Scenario: User login success\n- **WHEN** valid credentials provided\n- **THEN** return JWT token\n```\n\n**WRONG** (don't use bullets or bold):\n```markdown\n- **Scenario: User login** \u274C\n**Scenario**: User login \u274C\n### Scenario: User login \u274C\n```\n\nEvery requirement MUST have at least one scenario.\n\n### Requirement Wording\n- Use SHALL/MUST for normative requirements (avoid should/may unless intentionally non-normative)\n\n### Delta Operations\n\n- `## ADDED Requirements` - New capabilities\n- `## MODIFIED Requirements` - Changed behavior\n- `## REMOVED Requirements` - Deprecated features\n- `## RENAMED Requirements` - Name changes\n\nHeaders matched with `trim(header)` - whitespace ignored.\n\n#### When to use ADDED vs MODIFIED\n- 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.\n- 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.\n- RENAMED: Use when only the name changes. If you also change behavior, use RENAMED (name) plus MODIFIED (content) referencing the new name.\n\nCommon pitfall: Using MODIFIED to add a new concern without including the previous text. This causes loss of detail at archive time. If you aren\u2019t explicitly changing the existing requirement, add a new requirement under ADDED instead.\n\nAuthoring a MODIFIED requirement correctly:\n1) Locate the existing requirement in `lightspec/specs/<capability>/spec.md`.\n2) Copy the entire requirement block (from `### Requirement: ...` through its scenarios).\n3) Paste it under `## MODIFIED Requirements` and edit to reflect the new behavior.\n4) Ensure the header text matches exactly (whitespace-insensitive) and keep at least one `#### Scenario:`.\n\nExample for RENAMED:\n```markdown\n## RENAMED Requirements\n- FROM: `### Requirement: Login`\n- TO: `### Requirement: User Authentication`\n```\n\n## Troubleshooting\n\n### Common Errors\n\n**\"Change must have at least one delta\"**\n- Check `changes/[name]/specs/` exists with .md files\n- Verify files have operation prefixes (## ADDED Requirements)\n\n**\"Requirement must have at least one scenario\"**\n- Check scenarios use `#### Scenario:` format (4 hashtags)\n- Don't use bullet points or bold for scenario headers\n\n**Silent scenario parsing failures**\n- Exact format required: `#### Scenario: Name`\n- Debug with: `lightspec show [change] --json --deltas-only`\n\n### Validation Tips\n\n```bash\n# Always use strict mode for comprehensive checks\nlightspec validate [change] --strict --no-interactive\n\n# Debug delta parsing\nlightspec show [change] --json | jq '.deltas'\n\n# Check specific requirement\nlightspec show [spec] --json -r 1\n```\n\n## Happy Path Script\n\n```bash\n# 1) Explore current state\nlightspec spec list --long\nlightspec list\n# Optional full-text search:\n# rg -n \"Requirement:|Scenario:\" lightspec/specs\n# rg -n \"^#|Requirement:\" lightspec/changes\n\n# 2) Choose change id and scaffold\nCHANGE=add-two-factor-auth\nmkdir -p lightspec/changes/$CHANGE/{specs/auth}\nprintf \"## Why\\n...\\n\\n## What Changes\\n- ...\\n\\n## Impact\\n- ...\\n\" > lightspec/changes/$CHANGE/proposal.md\nprintf \"## 1. Implementation\\n- [ ] 1.1 ...\\n\" > lightspec/changes/$CHANGE/tasks.md\n\n# 3) Add deltas (example)\ncat > lightspec/changes/$CHANGE/specs/auth/spec.md << 'EOF'\n## ADDED Requirements\n### Requirement: Two-Factor Authentication\nUsers MUST provide a second factor during login.\n\n#### Scenario: OTP required\n- **WHEN** valid credentials are provided\n- **THEN** an OTP challenge is required\nEOF\n\n# 4) Validate\nlightspec validate $CHANGE --strict --no-interactive\n```\n\n## Multi-Capability Example\n\n```\nlightspec/changes/add-2fa-notify/\n\u251C\u2500\u2500 proposal.md\n\u251C\u2500\u2500 tasks.md\n\u2514\u2500\u2500 specs/\n \u251C\u2500\u2500 auth/\n \u2502 \u2514\u2500\u2500 spec.md # ADDED: Two-Factor Authentication\n \u2514\u2500\u2500 notifications/\n \u2514\u2500\u2500 spec.md # ADDED: OTP email notification\n```\n\nauth/spec.md\n```markdown\n## ADDED Requirements\n### Requirement: Two-Factor Authentication\n...\n```\n\nnotifications/spec.md\n```markdown\n## ADDED Requirements\n### Requirement: OTP Email Notification\n...\n```\n\n## Best Practices\n\n### Simplicity First\n- Default to <100 lines of new code\n- Single-file implementations until proven insufficient\n- Avoid frameworks without clear justification\n- Choose boring, proven patterns\n\n### Complexity Triggers\nOnly add complexity with:\n- Performance data showing current solution too slow\n- Concrete scale requirements (>1000 users, >100MB data)\n- Multiple proven use cases requiring abstraction\n\n### Clear References\n- Use `file.ts:42` format for code locations\n- Reference specs as `specs/auth/spec.md`\n- Link related changes and PRs\n\n### Capability Naming\n- Use verb-noun: `user-auth`, `payment-capture`\n- Single purpose per capability\n- 10-minute understandability rule\n- Split if description needs \"AND\"\n\n### Change ID Naming\n- Use kebab-case, short and descriptive: `add-two-factor-auth`\n- Prefer verb-led prefixes: `add-`, `update-`, `remove-`, `refactor-`\n- Ensure uniqueness; if taken, append `-2`, `-3`, etc.\n\n## Tool Selection Guide\n\n| Task | Tool | Why |\n|------|------|-----|\n| Find files by pattern | Glob | Fast pattern matching |\n| Search code content | Grep | Optimized regex search |\n| Read specific files | Read | Direct file access |\n| Explore unknown scope | Task | Multi-step investigation |\n\n## Error Recovery\n\n### Change Conflicts\n1. Run `lightspec list` to see active changes\n2. Check for overlapping specs\n3. Coordinate with change owners\n4. Consider combining proposals\n\n### Validation Failures\n1. Run with `--strict` flag\n2. Check JSON output for details\n3. Verify spec file format\n4. Ensure scenarios properly formatted\n\n### Missing Context\n1. Check related specs\n2. Review recent archives\n3. Ask for clarification\n\n## Quick Reference\n\n### Stage Indicators\n- `changes/` - Proposed, not yet built\n- `specs/` - Built and deployed\n- `archive/` - Completed changes\n\n### File Purposes\n- `proposal.md` - Why and what\n- `tasks.md` - Implementation steps\n- `design.md` - Technical decisions\n- `spec.md` - Requirements and behavior\n\n### CLI Essentials\n```bash\nlightspec list # What's in progress?\nlightspec show [item] # View details\nlightspec validate --strict --no-interactive # Is it correct?\nlightspec archive <change-id> [--yes|-y] # Mark complete (add --yes for automation)\n```\n\nRemember: Specs are truth. Changes are proposals. Keep them in sync.\n";
|
|
1
|
+
export declare const agentsTemplate = "# LightSpec Instructions\n\nInstructions for AI coding assistants using LightSpec for spec-driven development.\n\n## TL;DR Quick Checklist\n\n- Search existing work: `lightspec spec list --long`, `lightspec list` (use `rg` only for full-text search)\n- Decide scope: new capability vs modify existing capability\n- Pick a unique `change-id`: kebab-case, verb-led (`add-`, `update-`, `remove-`, `refactor-`)\n- Scaffold: `proposal.md`, `tasks.md`, `design.md` (only if needed), and delta specs per affected capability\n- Write deltas: use `## ADDED|MODIFIED|REMOVED|RENAMED Requirements`; include at least one `#### Scenario:` per requirement\n- Validate: `lightspec validate [change-id] --strict --no-interactive` and fix issues\n- Request approval: Do not start implementation until proposal is approved\n\n## Three-Stage Workflow\n\n### Stage 1: Creating Changes\nCreate proposal when you need to:\n- Add features or functionality\n- Make breaking changes (API, schema)\n- Change architecture or patterns \n- Optimize performance (changes behavior)\n- Update security patterns\n\nTriggers (examples):\n- \"Help me create a change proposal\"\n- \"Help me plan a change\"\n- \"Help me create a proposal\"\n- \"I want to create a spec proposal\"\n- \"I want to create a spec\"\n\nLoose matching guidance:\n- Contains one of: `proposal`, `change`, `spec`\n- With one of: `create`, `plan`, `make`, `start`, `help`\n\nSkip proposal for:\n- Bug fixes (restore intended behavior)\n- Typos, formatting, comments\n- Dependency updates (non-breaking)\n- Configuration changes\n- Tests for existing behavior\n\n**Workflow**\n1. Review `lightspec list` and `lightspec list --specs` to understand current context.\n2. Choose a unique verb-led `change-id` and scaffold `proposal.md`, `tasks.md`, optional `design.md`, and spec deltas under `lightspec/changes/<id>/`.\n3. Draft spec deltas using `## ADDED|MODIFIED|REMOVED Requirements` with at least one `#### Scenario:` per requirement.\n4. Run `lightspec validate <id> --strict --no-interactive` and resolve any issues before sharing the proposal.\n\n### Stage 2: Implementing Changes\nTrack these steps as TODOs and complete them one by one.\n1. **Read proposal.md** - Understand what's being built\n2. **Read design.md** (if exists) - Review technical decisions\n3. **Read tasks.md** - Get implementation checklist\n4. **Implement tasks sequentially** - Complete in order\n5. **Confirm completion** - Ensure every item in `tasks.md` is finished before updating statuses\n6. **Update checklist** - After all work is done, set every task to `- [x]` so the list reflects reality\n7. **Approval gate** - Do not start implementation until the proposal is reviewed and approved\n\n### Stage 3: Archiving Changes\nAfter deployment, create separate PR to:\n- Move `changes/[name]/` \u2192 `changes/archive/YYYY-MM-DD-[name]/`\n- Update `specs/` if capabilities changed\n- Use `lightspec archive <change-id> --skip-specs --yes` for tooling-only changes (always pass the change ID explicitly)\n- Run `lightspec validate --strict --no-interactive` to confirm the archived change passes checks\n\n## Before Any Task\n\n**Context Checklist:**\n- [ ] Read relevant specs in `specs/[capability]/spec.md`\n- [ ] Check pending changes in `changes/` for conflicts\n- [ ] Run `lightspec list` to see active changes\n- [ ] Run `lightspec list --specs` to see existing capabilities\n\n**Before Creating Specs:**\n- Always check if capability already exists\n- Prefer modifying existing specs over creating duplicates\n- Use `lightspec show [spec]` to review current state\n- If request is ambiguous, ask 1\u20132 clarifying questions before scaffolding\n\n### Search Guidance\n- Enumerate specs: `lightspec spec list --long` (or `--json` for scripts)\n- Enumerate changes: `lightspec list` (or `lightspec change list --json` - deprecated but available)\n- Show details:\n - Spec: `lightspec show <spec-id> --type spec` (use `--json` for filters)\n - Change: `lightspec show <change-id> --json --deltas-only`\n- Full-text search (use ripgrep): `rg -n \"Requirement:|Scenario:\" lightspec/specs`\n\n## Quick Start\n\n### CLI Commands\n\n```bash\n# Essential commands\nlightspec list # List active changes\nlightspec list --specs # List specifications\nlightspec show [item] # Display change or spec\nlightspec validate [item] # Validate changes or specs\nlightspec archive <change-id> [--yes|-y] # Archive after deployment (add --yes for non-interactive runs)\n\n# Project management\nlightspec init [path] # Initialize LightSpec\nlightspec update [path] # Update instruction files\n\n# Interactive mode\nlightspec show # Prompts for selection\nlightspec validate # Bulk validation mode\n\n# Debugging\nlightspec show [change] --json --deltas-only\nlightspec validate [change] --strict --no-interactive\n```\n\n### Command Flags\n\n- `--json` - Machine-readable output\n- `--type change|spec` - Disambiguate items\n- `--strict` - Comprehensive validation\n- `--no-interactive` - Disable prompts\n- `--skip-specs` - Archive without spec updates\n- `--yes`/`-y` - Skip confirmation prompts (non-interactive archive)\n\n## Directory Structure\n\n```\nlightspec/\n\u251C\u2500\u2500 specs/ # Current truth - what IS built\n\u2502 \u2514\u2500\u2500 [capability]/ # Single focused capability\n\u2502 \u251C\u2500\u2500 spec.md # Requirements and scenarios\n\u2502 \u2514\u2500\u2500 design.md # Technical patterns\n\u251C\u2500\u2500 changes/ # Proposals - what SHOULD change\n\u2502 \u251C\u2500\u2500 [change-name]/\n\u2502 \u2502 \u251C\u2500\u2500 proposal.md # Why, what, impact\n\u2502 \u2502 \u251C\u2500\u2500 tasks.md # Implementation checklist\n\u2502 \u2502 \u251C\u2500\u2500 design.md # Technical decisions (optional; see criteria)\n\u2502 \u2502 \u2514\u2500\u2500 specs/ # Delta changes\n\u2502 \u2502 \u2514\u2500\u2500 [capability]/\n\u2502 \u2502 \u2514\u2500\u2500 spec.md # ADDED/MODIFIED/REMOVED\n\u2502 \u2514\u2500\u2500 archive/ # Completed changes\n```\n\n## Creating Change Proposals\n\n### Decision Tree\n\n```\nNew request?\n\u251C\u2500 Bug fix restoring spec behavior? \u2192 Fix directly\n\u251C\u2500 Typo/format/comment? \u2192 Fix directly \n\u251C\u2500 New feature/capability? \u2192 Create proposal\n\u251C\u2500 Breaking change? \u2192 Create proposal\n\u251C\u2500 Architecture change? \u2192 Create proposal\n\u2514\u2500 Unclear? \u2192 Create proposal (safer)\n```\n\n### Proposal Structure\n\n1. **Create directory:** `changes/[change-id]/` (kebab-case, verb-led, unique)\n\n2. **Write proposal.md:**\n```markdown\n# Change: [Brief description of change]\n\n## Why\n[1-2 sentences on problem/opportunity]\n\n## What Changes\n- [Bullet list of changes]\n- [Mark breaking changes with **BREAKING**]\n\n## Impact\n- Affected specs: [list capabilities]\n- Affected code: [key files/systems]\n```\n\n3. **Create spec deltas:** `specs/[capability]/spec.md`\n```markdown\n## ADDED Requirements\n### Requirement: New Feature\nThe system SHALL provide...\n\n#### Scenario: Success case\n- **WHEN** user performs action\n- **THEN** expected result\n\n## MODIFIED Requirements\n### Requirement: Existing Feature\n[Complete modified requirement]\n\n## REMOVED Requirements\n### Requirement: Old Feature\n**Reason**: [Why removing]\n**Migration**: [How to handle]\n```\nIf multiple capabilities are affected, create multiple delta files under `changes/[change-id]/specs/<capability>/spec.md`\u2014one per capability.\n\n4. **Create tasks.md:**\n```markdown\n## 1. Implementation\n- [ ] 1.1 Create database schema\n- [ ] 1.2 Implement API endpoint\n- [ ] 1.3 Add frontend component\n- [ ] 1.4 Write tests\n```\n\n5. **Create design.md when needed:**\nCreate `design.md` if any of the following apply; otherwise omit it:\n- Cross-cutting change (multiple services/modules) or a new architectural pattern\n- New external dependency or significant data model changes\n- Security, performance, or migration complexity\n- Ambiguity that benefits from technical decisions before coding\n\nMinimal `design.md` skeleton:\n```markdown\n## Context\n[Background, constraints, stakeholders]\n\n## Goals / Non-Goals\n- Goals: [...]\n- Non-Goals: [...]\n\n## Decisions\n- Decision: [What and why]\n- Alternatives considered: [Options + rationale]\n\n## Risks / Trade-offs\n- [Risk] \u2192 Mitigation\n\n## Migration Plan\n[Steps, rollback]\n\n## Open Questions\n- [...]\n```\n\n## Spec File Format\n\n### Critical: Scenario Formatting\n\n**CORRECT** (use #### headers):\n```markdown\n#### Scenario: User login success\n- **WHEN** valid credentials provided\n- **THEN** return JWT token\n```\n\n**WRONG** (don't use bullets or bold):\n```markdown\n- **Scenario: User login** \u274C\n**Scenario**: User login \u274C\n### Scenario: User login \u274C\n```\n\nEvery requirement MUST have at least one scenario.\n\n### Requirement Wording\n- Use SHALL/MUST for normative requirements (avoid should/may unless intentionally non-normative)\n\n### Delta Operations\n\n- `## ADDED Requirements` - New capabilities\n- `## MODIFIED Requirements` - Changed behavior\n- `## REMOVED Requirements` - Deprecated features\n- `## RENAMED Requirements` - Name changes\n\nHeaders matched with `trim(header)` - whitespace ignored.\n\n#### When to use ADDED vs MODIFIED\n- 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 \"Agent Skill Configuration\") rather than altering the semantics of an existing requirement.\n- 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.\n- RENAMED: Use when only the name changes. If you also change behavior, use RENAMED (name) plus MODIFIED (content) referencing the new name.\n\nCommon pitfall: Using MODIFIED to add a new concern without including the previous text. This causes loss of detail at archive time. If you aren\u2019t explicitly changing the existing requirement, add a new requirement under ADDED instead.\n\nAuthoring a MODIFIED requirement correctly:\n1) Locate the existing requirement in `lightspec/specs/<capability>/spec.md`.\n2) Copy the entire requirement block (from `### Requirement: ...` through its scenarios).\n3) Paste it under `## MODIFIED Requirements` and edit to reflect the new behavior.\n4) Ensure the header text matches exactly (whitespace-insensitive) and keep at least one `#### Scenario:`.\n\nExample for RENAMED:\n```markdown\n## RENAMED Requirements\n- FROM: `### Requirement: Login`\n- TO: `### Requirement: User Authentication`\n```\n\n## Troubleshooting\n\n### Common Errors\n\n**\"Change must have at least one delta\"**\n- Check `changes/[name]/specs/` exists with .md files\n- Verify files have operation prefixes (## ADDED Requirements)\n\n**\"Requirement must have at least one scenario\"**\n- Check scenarios use `#### Scenario:` format (4 hashtags)\n- Don't use bullet points or bold for scenario headers\n\n**Silent scenario parsing failures**\n- Exact format required: `#### Scenario: Name`\n- Debug with: `lightspec show [change] --json --deltas-only`\n\n### Validation Tips\n\n```bash\n# Always use strict mode for comprehensive checks\nlightspec validate [change] --strict --no-interactive\n\n# Debug delta parsing\nlightspec show [change] --json | jq '.deltas'\n\n# Check specific requirement\nlightspec show [spec] --json -r 1\n```\n\n## Happy Path Script\n\n```bash\n# 1) Explore current state\nlightspec spec list --long\nlightspec list\n# Optional full-text search:\n# rg -n \"Requirement:|Scenario:\" lightspec/specs\n# rg -n \"^#|Requirement:\" lightspec/changes\n\n# 2) Choose change id and scaffold\nCHANGE=add-two-factor-auth\nmkdir -p lightspec/changes/$CHANGE/{specs/auth}\nprintf \"## Why\\n...\\n\\n## What Changes\\n- ...\\n\\n## Impact\\n- ...\\n\" > lightspec/changes/$CHANGE/proposal.md\nprintf \"## 1. Implementation\\n- [ ] 1.1 ...\\n\" > lightspec/changes/$CHANGE/tasks.md\n\n# 3) Add deltas (example)\ncat > lightspec/changes/$CHANGE/specs/auth/spec.md << 'EOF'\n## ADDED Requirements\n### Requirement: Two-Factor Authentication\nUsers MUST provide a second factor during login.\n\n#### Scenario: OTP required\n- **WHEN** valid credentials are provided\n- **THEN** an OTP challenge is required\nEOF\n\n# 4) Validate\nlightspec validate $CHANGE --strict --no-interactive\n```\n\n## Multi-Capability Example\n\n```\nlightspec/changes/add-2fa-notify/\n\u251C\u2500\u2500 proposal.md\n\u251C\u2500\u2500 tasks.md\n\u2514\u2500\u2500 specs/\n \u251C\u2500\u2500 auth/\n \u2502 \u2514\u2500\u2500 spec.md # ADDED: Two-Factor Authentication\n \u2514\u2500\u2500 notifications/\n \u2514\u2500\u2500 spec.md # ADDED: OTP email notification\n```\n\nauth/spec.md\n```markdown\n## ADDED Requirements\n### Requirement: Two-Factor Authentication\n...\n```\n\nnotifications/spec.md\n```markdown\n## ADDED Requirements\n### Requirement: OTP Email Notification\n...\n```\n\n## Best Practices\n\n### Simplicity First\n- Default to <100 lines of new code\n- Single-file implementations until proven insufficient\n- Avoid frameworks without clear justification\n- Choose boring, proven patterns\n\n### Complexity Triggers\nOnly add complexity with:\n- Performance data showing current solution too slow\n- Concrete scale requirements (>1000 users, >100MB data)\n- Multiple proven use cases requiring abstraction\n\n### Clear References\n- Use `file.ts:42` format for code locations\n- Reference specs as `specs/auth/spec.md`\n- Link related changes and PRs\n\n### Capability Naming\n- Use verb-noun: `user-auth`, `payment-capture`\n- Single purpose per capability\n- 10-minute understandability rule\n- Split if description needs \"AND\"\n\n### Change ID Naming\n- Use kebab-case, short and descriptive: `add-two-factor-auth`\n- Prefer verb-led prefixes: `add-`, `update-`, `remove-`, `refactor-`\n- Ensure uniqueness; if taken, append `-2`, `-3`, etc.\n\n## Tool Selection Guide\n\n| Task | Tool | Why |\n|------|------|-----|\n| Find files by pattern | Glob | Fast pattern matching |\n| Search code content | Grep | Optimized regex search |\n| Read specific files | Read | Direct file access |\n| Explore unknown scope | Task | Multi-step investigation |\n\n## Error Recovery\n\n### Change Conflicts\n1. Run `lightspec list` to see active changes\n2. Check for overlapping specs\n3. Coordinate with change owners\n4. Consider combining proposals\n\n### Validation Failures\n1. Run with `--strict` flag\n2. Check JSON output for details\n3. Verify spec file format\n4. Ensure scenarios properly formatted\n\n### Missing Context\n1. Check related specs\n2. Review recent archives\n3. Ask for clarification\n\n## Quick Reference\n\n### Stage Indicators\n- `changes/` - Proposed, not yet built\n- `specs/` - Built and deployed\n- `archive/` - Completed changes\n\n### File Purposes\n- `proposal.md` - Why and what\n- `tasks.md` - Implementation steps\n- `design.md` - Technical decisions\n- `spec.md` - Requirements and behavior\n\n### CLI Essentials\n```bash\nlightspec list # What's in progress?\nlightspec show [item] # View details\nlightspec validate --strict --no-interactive # Is it correct?\nlightspec archive <change-id> [--yes|-y] # Mark complete (add --yes for automation)\n```\n\nRemember: Specs are truth. Changes are proposals. Keep them in sync.\n";
|
|
2
2
|
//# sourceMappingURL=agents-template.d.ts.map
|
|
@@ -265,7 +265,7 @@ Every requirement MUST have at least one scenario.
|
|
|
265
265
|
Headers matched with \`trim(header)\` - whitespace ignored.
|
|
266
266
|
|
|
267
267
|
#### When to use ADDED vs MODIFIED
|
|
268
|
-
- 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 "
|
|
268
|
+
- 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 "Agent Skill Configuration") rather than altering the semantics of an existing requirement.
|
|
269
269
|
- 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.
|
|
270
270
|
- RENAMED: Use when only the name changes. If you also change behavior, use RENAMED (name) plus MODIFIED (content) referencing the new name.
|
|
271
271
|
|
|
@@ -10,7 +10,7 @@ metadata:
|
|
|
10
10
|
---`;
|
|
11
11
|
const archiveSteps = `**Steps**
|
|
12
12
|
1. Determine the change ID to archive:
|
|
13
|
-
- If this prompt already includes a specific change ID (for example inside a \`<ChangeId>\` block populated by
|
|
13
|
+
- If this prompt already includes a specific change ID (for example inside a \`<ChangeId>\` block populated by skill arguments), use that value after trimming whitespace.
|
|
14
14
|
- 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.
|
|
15
15
|
- Otherwise, review the conversation, run \`lightspec list\`, and ask the user which change to archive; wait for a confirmed change ID before proceeding.
|
|
16
16
|
- If you still cannot identify a single change ID, stop and tell the user you cannot archive anything yet.
|