lean-spec 0.2.9 → 0.2.15-dev.21022397862

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.
Files changed (38) hide show
  1. package/README.md +101 -9
  2. package/bin/lean-spec-rust.js +116 -0
  3. package/bin/lean-spec.js +9 -1
  4. package/binaries/darwin-arm64/lean-spec +0 -0
  5. package/binaries/darwin-arm64/package.json +20 -0
  6. package/binaries/darwin-x64/lean-spec +0 -0
  7. package/binaries/darwin-x64/package.json +20 -0
  8. package/binaries/linux-arm64/lean-spec +0 -0
  9. package/binaries/linux-arm64/package.json +20 -0
  10. package/binaries/linux-x64/lean-spec +0 -0
  11. package/binaries/linux-x64/package.json +20 -0
  12. package/binaries/windows-x64/lean-spec.exe +0 -0
  13. package/binaries/windows-x64/package.json +20 -0
  14. package/package.json +9 -43
  15. package/templates/detailed/AGENTS.md +72 -101
  16. package/templates/standard/AGENTS.md +72 -101
  17. package/dist/backfill-WYW47B42.js +0 -5
  18. package/dist/backfill-WYW47B42.js.map +0 -1
  19. package/dist/chunk-ENX5NYTE.js +0 -297
  20. package/dist/chunk-ENX5NYTE.js.map +0 -1
  21. package/dist/chunk-FILG4YF3.js +0 -2990
  22. package/dist/chunk-FILG4YF3.js.map +0 -1
  23. package/dist/chunk-JX4PXHNC.js +0 -7945
  24. package/dist/chunk-JX4PXHNC.js.map +0 -1
  25. package/dist/chunk-K4VTB6BF.js +0 -298
  26. package/dist/chunk-K4VTB6BF.js.map +0 -1
  27. package/dist/chunk-SZNMHOHN.js +0 -444
  28. package/dist/chunk-SZNMHOHN.js.map +0 -1
  29. package/dist/cli.d.ts +0 -2
  30. package/dist/cli.js +0 -129
  31. package/dist/cli.js.map +0 -1
  32. package/dist/frontmatter-Q5UJOZLR.js +0 -3
  33. package/dist/frontmatter-Q5UJOZLR.js.map +0 -1
  34. package/dist/mcp-server.d.ts +0 -16
  35. package/dist/mcp-server.js +0 -8
  36. package/dist/mcp-server.js.map +0 -1
  37. package/dist/validate-LMCR5JTN.js +0 -5
  38. package/dist/validate-LMCR5JTN.js.map +0 -1
package/README.md CHANGED
@@ -84,14 +84,15 @@ Works with any AI coding assistant via MCP or CLI:
84
84
 
85
85
  ## Features
86
86
 
87
- | Feature | Description |
88
- |---------|-------------|
89
- | **📊 Kanban Board** | `lean-spec board` - visual project tracking |
90
- | **🔍 Smart Search** | `lean-spec search` - find specs by content or metadata |
91
- | **🔗 Dependencies** | Track spec relationships with `depends_on` and `related` |
92
- | **🎨 Web UI** | `lean-spec ui` - browser-based dashboard |
93
- | **📈 Project Stats** | `lean-spec stats` - health metrics and bottleneck detection |
94
- | **🤖 AI-Native** | MCP server + CLI for AI assistants |
87
+ | Feature | Description |
88
+ | ------------------- | ------------------------------------------------------------- |
89
+ | **📊 Kanban Board** | `lean-spec board` - visual project tracking |
90
+ | **🔍 Smart Search** | `lean-spec search` - find specs by content or metadata |
91
+ | **🔗 Dependencies** | Track spec relationships with `depends_on` and `related` |
92
+ | **🎨 Web UI** | `lean-spec ui` - browser-based dashboard |
93
+ | **📈 Project Stats** | `lean-spec stats` - health metrics and bottleneck detection |
94
+ | **🤖 AI-Native** | MCP server + CLI for AI assistants |
95
+ | **🖥️ Desktop App** | Native Tauri shell with tray + shortcuts (`pnpm dev:desktop`) |
95
96
 
96
97
  <p align="center">
97
98
  <img src="https://github.com/codervisor/lean-spec-docs/blob/main/static/img/ui/ui-board-view.png" alt="Kanban Board View" width="800">
@@ -99,13 +100,104 @@ Works with any AI coding assistant via MCP or CLI:
99
100
 
100
101
  ---
101
102
 
103
+ ## Requirements
104
+
105
+ ### Runtime
106
+ - **Node.js**: `>= 20.0.0`
107
+ - **pnpm**: `>= 10.0.0` (preferred package manager)
108
+
109
+ ### Development
110
+ - **Node.js**: `>= 20.0.0`
111
+ - **Rust**: `>= 1.70` (for building CLI/MCP/HTTP binaries)
112
+ - **pnpm**: `>= 10.0.0`
113
+
114
+ **Quick Check:**
115
+ ```bash
116
+ node --version # Should be v20.0.0 or higher
117
+ pnpm --version # Should be 10.0.0 or higher
118
+ rustc --version # Should be 1.70 or higher (dev only)
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Desktop App
124
+
125
+ The `@leanspec/desktop` package wraps the Vite UI (`@leanspec/ui`) in a lightweight Tauri shell for local, multi-project workflows backed by Rust commands:
126
+
127
+ ```bash
128
+ # Launch the desktop shell with hot reload
129
+ pnpm install
130
+ pnpm dev:desktop
131
+
132
+ # Produce signed installers + embedded UI bundle
133
+ pnpm build:desktop
134
+ ```
135
+
136
+ Key capabilities:
137
+ - Frameless window with custom title bar + native controls
138
+ - Global shortcuts (`Cmd/Ctrl+Shift+L` to toggle, `Cmd/Ctrl+Shift+K` to open the project switcher, `Cmd/Ctrl+Shift+N` to add a spec)
139
+ - Shared project registry + native folder picker backed by `~/.lean-spec/projects.json`
140
+ - System tray with recent projects, background notifications, and update checks
141
+ - Embedded Vite static build + Rust HTTP server for offline packaging (macOS `.dmg`, Windows `.msi/.exe`, Linux `.AppImage/.deb/.rpm`)
142
+
143
+ See [packages/desktop/README.md](packages/desktop/README.md) for configuration details.
144
+
145
+ ---
146
+
147
+ ## Developer Workflow
148
+
149
+ Common development tasks using `pnpm`:
150
+
151
+ ```bash
152
+ # Development
153
+ pnpm install # Install dependencies
154
+ pnpm build # Build all packages
155
+ pnpm dev # Start dev mode (UI + Core)
156
+ pnpm dev:web # UI only
157
+ pnpm dev:cli # CLI only
158
+ pnpm dev:desktop # Desktop app
159
+
160
+ # Testing
161
+ pnpm test # Run all tests
162
+ pnpm test:ui # Tests with UI
163
+ pnpm test:coverage # Coverage report
164
+ pnpm typecheck # Type check all packages
165
+
166
+ # Rust
167
+ pnpm rust:build # Build Rust packages (release)
168
+ pnpm rust:build:dev # Build Rust (dev, faster)
169
+ pnpm rust:test # Run Rust tests
170
+ pnpm rust:check # Quick Rust check
171
+ pnpm rust:clippy # Rust linting
172
+ pnpm rust:fmt # Format Rust code
173
+
174
+ # CLI (run locally)
175
+ pnpm cli board # Show spec board
176
+ pnpm cli list # List specs
177
+ pnpm cli create my-feat # Create new spec
178
+ pnpm cli validate # Validate specs
179
+
180
+ # Documentation
181
+ pnpm docs:dev # Start docs site
182
+ pnpm docs:build # Build docs
183
+
184
+ # Release
185
+ pnpm pre-release # Run all pre-release checks
186
+ pnpm prepare-publish # Prepare for npm publish
187
+ pnpm restore-packages # Restore after publish
188
+ ```
189
+
190
+ See [package.json](package.json) for all available scripts.
191
+
192
+ ---
193
+
102
194
  ## Documentation
103
195
 
104
196
  📖 [Full Documentation](https://www.lean-spec.dev) · [CLI Reference](https://www.lean-spec.dev/docs/reference/cli) · [First Principles](https://www.lean-spec.dev/docs/advanced/first-principles) · [FAQ](https://www.lean-spec.dev/docs/faq) · [中文文档](https://www.lean-spec.dev/zh-Hans/)
105
197
 
106
198
  ## Community
107
199
 
108
- 💬 [Discussions](https://github.com/codervisor/lean-spec/discussions) · 🐛 [Issues](https://github.com/codervisor/lean-spec/issues) · 🤝 [Contributing](CONTRIBUTING.md) · 📋 [Changelog](CHANGELOG) · 📄 [LICENSE](LICENSE)
200
+ 💬 [Discussions](https://github.com/codervisor/lean-spec/discussions) · 🐛 [Issues](https://github.com/codervisor/lean-spec/issues) · 🤝 [Contributing](CONTRIBUTING.md) · 📋 [Changelog](CHANGELOG.md) · 📄 [LICENSE](LICENSE)
109
201
 
110
202
  ---
111
203
 
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * LeanSpec CLI Binary Wrapper
4
+ *
5
+ * This script detects the current platform and architecture,
6
+ * then spawns the appropriate Rust binary with the provided arguments.
7
+ *
8
+ * The wrapper looks for binaries in the following locations:
9
+ * 1. Platform-specific npm package (lean-spec-darwin-x64, etc.)
10
+ * 2. Local binaries directory (for development)
11
+ */
12
+
13
+ import { spawn } from 'child_process';
14
+ import { createRequire } from 'module';
15
+ import { fileURLToPath } from 'url';
16
+ import { dirname, join } from 'path';
17
+ import { accessSync } from 'fs';
18
+
19
+ const require = createRequire(import.meta.url);
20
+ const __filename = fileURLToPath(import.meta.url);
21
+ const __dirname = dirname(__filename);
22
+
23
+ // Debug mode - enable with LEANSPEC_DEBUG=1
24
+ const DEBUG = process.env.LEANSPEC_DEBUG === '1';
25
+ const debug = (...args) => DEBUG && console.error('[lean-spec debug]', ...args);
26
+
27
+ // Platform detection mapping
28
+ const PLATFORM_MAP = {
29
+ darwin: { x64: 'darwin-x64', arm64: 'darwin-arm64' },
30
+ linux: { x64: 'linux-x64', arm64: 'linux-arm64' },
31
+ win32: { x64: 'windows-x64', arm64: 'windows-arm64' }
32
+ };
33
+
34
+ function getBinaryPath() {
35
+ const platform = process.platform;
36
+ const arch = process.arch;
37
+
38
+ debug('Platform detection:', { platform, arch });
39
+
40
+ const platformKey = PLATFORM_MAP[platform]?.[arch];
41
+ if (!platformKey) {
42
+ console.error(`Unsupported platform: ${platform}-${arch}`);
43
+ console.error('Supported: macOS (x64/arm64), Linux (x64/arm64), Windows (x64)');
44
+ process.exit(1);
45
+ }
46
+
47
+ const isWindows = platform === 'win32';
48
+ const binaryName = isWindows ? 'lean-spec.exe' : 'lean-spec';
49
+ const packageName = `@leanspec/cli-${platformKey}`;
50
+
51
+ debug('Binary info:', { platformKey, binaryName, packageName });
52
+
53
+ // Try to resolve platform package
54
+ try {
55
+ const resolvedPath = require.resolve(`${packageName}/${binaryName}`);
56
+ debug('Found platform package binary:', resolvedPath);
57
+ return resolvedPath;
58
+ } catch (e) {
59
+ debug('Platform package not found:', packageName, '-', e.message);
60
+ }
61
+
62
+ // Try local binaries directory (for development/testing)
63
+ try {
64
+ const localPath = join(__dirname, '..', 'binaries', platformKey, binaryName);
65
+ debug('Trying local binary:', localPath);
66
+ accessSync(localPath);
67
+ debug('Found local binary:', localPath);
68
+ return localPath;
69
+ } catch (e) {
70
+ debug('Local binary not found:', e.message);
71
+ }
72
+
73
+ // Try rust/target/release directory (for local development)
74
+ try {
75
+ const rustTargetPath = join(__dirname, '..', '..', '..', 'rust', 'target', 'release', binaryName);
76
+ debug('Trying rust target binary:', rustTargetPath);
77
+ accessSync(rustTargetPath);
78
+ debug('Found rust target binary:', rustTargetPath);
79
+ return rustTargetPath;
80
+ } catch (e) {
81
+ debug('Rust target binary not found:', e.message);
82
+ }
83
+
84
+ console.error(`Binary not found for ${platform}-${arch}`);
85
+ console.error(`Expected package: ${packageName}`);
86
+ console.error('');
87
+ console.error('To install:');
88
+ console.error(' npm install -g lean-spec');
89
+ console.error('');
90
+ console.error('If you installed globally, try:');
91
+ console.error(' npm uninstall -g lean-spec && npm install -g lean-spec');
92
+ process.exit(1);
93
+ }
94
+
95
+ // Execute binary
96
+ const binaryPath = getBinaryPath();
97
+ const args = process.argv.slice(2);
98
+
99
+ debug('Spawning binary:', binaryPath);
100
+ debug('Arguments:', args);
101
+
102
+ const child = spawn(binaryPath, args, {
103
+ stdio: 'inherit',
104
+ windowsHide: true,
105
+ });
106
+
107
+ child.on('exit', (code) => {
108
+ debug('Binary exited with code:', code);
109
+ process.exit(code ?? 1);
110
+ });
111
+
112
+ child.on('error', (err) => {
113
+ console.error('Failed to start lean-spec:', err.message);
114
+ debug('Spawn error:', err);
115
+ process.exit(1);
116
+ });
package/bin/lean-spec.js CHANGED
@@ -1,2 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import '../dist/cli.js';
2
+ /**
3
+ * LeanSpec CLI Entry Point
4
+ *
5
+ * Thin wrapper that delegates to the Rust binary.
6
+ * The TypeScript implementation has been deprecated in favor of Rust.
7
+ *
8
+ * @see spec 181-typescript-deprecation-rust-migration
9
+ */
10
+ import './lean-spec-rust.js';
Binary file
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@leanspec/cli-darwin-arm64",
3
+ "version": "0.2.15-dev.21022397862",
4
+ "description": "LeanSpec CLI binary for macOS ARM64",
5
+ "os": [
6
+ "darwin"
7
+ ],
8
+ "cpu": [
9
+ "arm64"
10
+ ],
11
+ "main": "lean-spec",
12
+ "files": [
13
+ "lean-spec"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/codervisor/lean-spec.git"
18
+ },
19
+ "license": "MIT"
20
+ }
Binary file
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@leanspec/cli-darwin-x64",
3
+ "version": "0.2.15-dev.21022397862",
4
+ "description": "LeanSpec CLI binary for macOS x64",
5
+ "os": [
6
+ "darwin"
7
+ ],
8
+ "cpu": [
9
+ "x64"
10
+ ],
11
+ "main": "lean-spec",
12
+ "files": [
13
+ "lean-spec"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/codervisor/lean-spec.git"
18
+ },
19
+ "license": "MIT"
20
+ }
Binary file
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@leanspec/cli-linux-arm64",
3
+ "version": "0.2.15-dev.21022397862",
4
+ "description": "LeanSpec CLI binary for Linux ARM64",
5
+ "os": [
6
+ "linux"
7
+ ],
8
+ "cpu": [
9
+ "arm64"
10
+ ],
11
+ "main": "lean-spec",
12
+ "files": [
13
+ "lean-spec"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/codervisor/lean-spec.git"
18
+ },
19
+ "license": "MIT"
20
+ }
Binary file
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@leanspec/cli-linux-x64",
3
+ "version": "0.2.15-dev.21022397862",
4
+ "description": "LeanSpec CLI binary for Linux x64",
5
+ "os": [
6
+ "linux"
7
+ ],
8
+ "cpu": [
9
+ "x64"
10
+ ],
11
+ "main": "lean-spec",
12
+ "files": [
13
+ "lean-spec"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/codervisor/lean-spec.git"
18
+ },
19
+ "license": "MIT"
20
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@leanspec/cli-windows-x64",
3
+ "version": "0.2.15-dev.21022397862",
4
+ "description": "LeanSpec CLI binary for Windows x64",
5
+ "os": [
6
+ "win32"
7
+ ],
8
+ "cpu": [
9
+ "x64"
10
+ ],
11
+ "main": "lean-spec.exe",
12
+ "files": [
13
+ "lean-spec.exe"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/codervisor/lean-spec.git"
18
+ },
19
+ "license": "MIT"
20
+ }
package/package.json CHANGED
@@ -1,17 +1,13 @@
1
1
  {
2
2
  "name": "lean-spec",
3
- "version": "0.2.9",
3
+ "version": "0.2.15-dev.21022397862",
4
4
  "description": "Specification-driven development made simple",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "lean-spec": "./bin/lean-spec.js"
8
8
  },
9
9
  "scripts": {
10
- "build": "tsup",
11
- "dev": "tsup --watch",
12
- "typecheck": "tsc --noEmit",
13
- "test": "vitest run",
14
- "test:watch": "vitest"
10
+ "typecheck": "echo 'No TypeScript source to check'"
15
11
  },
16
12
  "keywords": [
17
13
  "spec",
@@ -33,48 +29,18 @@
33
29
  },
34
30
  "files": [
35
31
  "bin/",
36
- "dist/",
32
+ "binaries/",
37
33
  "templates/",
38
34
  "README.md",
39
35
  "LICENSE",
40
36
  "CHANGELOG.md"
41
37
  ],
42
- "dependencies": {
43
- "@inquirer/prompts": "^7.9.0",
44
- "@modelcontextprotocol/sdk": "^1.21.0",
45
- "chalk": "^5.3.0",
46
- "cli-spinners": "^3.3.0",
47
- "cli-table3": "^0.6.5",
48
- "commander": "^14.0.2",
49
- "dayjs": "^1.11.19",
50
- "gray-matter": "^4.0.3",
51
- "ink": "^6.4.0",
52
- "ink-gradient": "^3.0.0",
53
- "ink-progress-bar": "^3.0.0",
54
- "ink-select-input": "^6.2.0",
55
- "ink-spinner": "^5.0.0",
56
- "ink-table": "^3.1.0",
57
- "ink-text-input": "^6.0.0",
58
- "js-yaml": "^4.1.0",
59
- "marked": "^15.0.12",
60
- "marked-terminal": "^7.3.0",
61
- "open": "^11.0.0",
62
- "ora": "^9.0.0",
63
- "react": "^19.2.0",
64
- "strip-ansi": "^7.1.2",
65
- "tiktoken": "^1.0.22",
66
- "tokenx": "^1.2.1",
67
- "zod": "^3.25.76"
68
- },
69
- "devDependencies": {
70
- "@leanspec/core": "^0.2.9",
71
- "@types/js-yaml": "^4.0.9",
72
- "@types/marked-terminal": "^6.1.1",
73
- "@types/node": "^20.10.0",
74
- "@types/react": "^19.2.2",
75
- "tsup": "^8.0.1",
76
- "typescript": "^5.3.3",
77
- "vitest": "^4.0.6"
38
+ "optionalDependencies": {
39
+ "@leanspec/cli-darwin-arm64": "workspace:*",
40
+ "@leanspec/cli-darwin-x64": "workspace:*",
41
+ "@leanspec/cli-linux-arm64": "workspace:*",
42
+ "@leanspec/cli-linux-x64": "workspace:*",
43
+ "@leanspec/cli-windows-x64": "workspace:*"
78
44
  },
79
45
  "engines": {
80
46
  "node": ">=20"
@@ -12,132 +12,103 @@
12
12
 
13
13
  > **Why?** Skipping discovery creates duplicate work. Manual file creation breaks LeanSpec tooling.
14
14
 
15
- ## 🔧 How to Manage Specs
16
-
17
- ### Primary Method: MCP Tools (Recommended)
18
-
19
- If you have LeanSpec MCP tools available, **ALWAYS use them**:
20
-
21
- | Action | MCP Tool | Description |
22
- |--------|----------|-------------|
23
- | See project status | `board` | Kanban view + project health metrics |
24
- | List all specs | `list` | Filterable list with metadata |
25
- | Search specs | `search` | Semantic search across all content |
26
- | View a spec | `view` | Full content with formatting |
27
- | Create new spec | `create` | Auto-sequences, proper structure |
28
- | Update spec | `update` | Validates transitions, timestamps |
29
- | Link specs | `link` | Add dependencies (depends_on) |
30
- | Unlink specs | `unlink` | Remove dependencies |
31
- | Check dependencies | `deps` | Visual dependency graph |
32
-
33
- **Why MCP over CLI?**
34
- - ✅ Direct tool integration (no shell execution needed)
35
- - Structured responses (better for AI reasoning)
36
- - ✅ Real-time validation (immediate feedback)
37
- - Context-aware (understands project state)
38
-
39
- ### Fallback: CLI Commands
40
-
41
- If MCP tools are not available, use CLI commands:
42
-
43
- ```bash
44
- lean-spec board # Project overview
45
- lean-spec list # See all specs
46
- lean-spec search "query" # Find relevant specs
47
- lean-spec create <name> # Create new spec
48
- lean-spec update <spec> --status <status> # Update status
49
- lean-spec link <spec> --depends-on <other> # Add dependencies
50
- lean-spec unlink <spec> --depends-on <other> # Remove dependencies
51
- lean-spec deps <spec> # Show dependencies
52
- ```
53
-
54
- **Tip:** Check if you have LeanSpec MCP tools available before using CLI.
55
-
56
- ## ⚠️ SDD Workflow Checkpoints
57
-
58
- ### Before Starting ANY Task
59
-
60
- 1. 📋 **Run `board`** - What's the current project state?
61
- 2. 🔍 **Run `search`** - Are there related specs already?
62
- 3. 📝 **Check existing specs** - Is there one for this work?
63
-
64
- ### During Implementation
65
-
66
- 4. 📊 **Update status to `in-progress`** BEFORE coding
67
- 5. 📝 **Document decisions** in the spec as you work
68
- 6. 🔗 **Link dependencies** if you discover blocking relationships
69
-
70
- ### After Completing Work
71
-
72
- 7. ✅ **Update status to `complete`** when done
73
- 8. 📄 **Document what you learned** in the spec
74
- 9. 🤔 **Create follow-up specs** if needed
75
-
76
- ### 🚫 Common Mistakes to Avoid
15
+ ## 🔧 Managing Specs
16
+
17
+ ### MCP Tools (Preferred) with CLI Fallback
18
+
19
+ | Action | MCP Tool | CLI Fallback |
20
+ |--------|----------|--------------|
21
+ | Project status | `board` | `lean-spec board` |
22
+ | List specs | `list` | `lean-spec list` |
23
+ | Search specs | `search` | `lean-spec search "query"` |
24
+ | View spec | `view` | `lean-spec view <spec>` |
25
+ | Create spec | `create` | `lean-spec create <name>` |
26
+ | Update spec | `update` | `lean-spec update <spec> --status <status>` |
27
+ | Link specs | `link` | `lean-spec link <spec> --depends-on <other>` |
28
+ | Unlink specs | `unlink` | `lean-spec unlink <spec> --depends-on <other>` |
29
+ | Dependencies | `deps` | `lean-spec deps <spec>` |
30
+ | Token count | `tokens` | `lean-spec tokens <spec>` |
31
+ | Validate specs | `validate` | `lean-spec validate` |
32
+
33
+ ## ⚠️ Core Rules
34
+
35
+ | Rule | Details |
36
+ |------|---------|
37
+ | **NEVER edit frontmatter manually** | Use `update`, `link`, `unlink` for: `status`, `priority`, `tags`, `assignee`, `transitions`, timestamps, `depends_on` |
38
+ | **ALWAYS link spec references** | Content mentions another spec → `lean-spec link <spec> --depends-on <other>` |
39
+ | **Track status transitions** | `planned` → `in-progress` (before coding) → `complete` (after done) |
40
+ | **Keep specs current** | Document progress, decisions, and learnings as work happens. Obsolete specs mislead both humans and AI |
41
+ | **No nested code blocks** | Use indentation instead |
42
+
43
+ ### 🚫 Common Mistakes
77
44
 
78
45
  | ❌ Don't | ✅ Do Instead |
79
46
  |----------|---------------|
80
47
  | Create spec files manually | Use `create` tool |
81
- | Skip discovery before new work | Run `board` and `search` first |
82
- | Leave status as "planned" after starting | Update to `in-progress` immediately |
83
- | Finish work without updating spec | Document decisions, update status |
48
+ | Skip discovery | Run `board` and `search` first |
49
+ | Leave status as "planned" | Update to `in-progress` before coding |
84
50
  | Edit frontmatter manually | Use `update` tool |
85
- | Forget about specs mid-conversation | Check spec status periodically |
86
-
87
- ## Core Rules
88
-
89
- 1. **Read README.md first** - Understand project context
90
- 2. **Check specs/** - Review existing specs before starting
91
- 3. **Use MCP tools** - Prefer MCP over CLI when available
92
- 4. **Follow LeanSpec principles** - Clarity over documentation
93
- 5. **Keep it minimal** - If it doesn't add clarity, cut it
94
- 6. **NEVER manually edit frontmatter** - Use `update`, `link`, `unlink` tools
95
- 7. **Track progress in specs** - Update status and document decisions
51
+ | Complete spec without documentation | Document progress, prompts, learnings first |
96
52
 
97
- ## When to Use Specs
53
+ ## 📋 SDD Workflow
98
54
 
99
- **Write a spec for:**
100
- - Features affecting multiple parts of the system
101
- - Breaking changes or significant refactors
102
- - Design decisions needing team alignment
55
+ ```
56
+ BEFORE: board search check existing specs
57
+ DURING: update status to in-progress code document decisions → link dependencies
58
+ AFTER: document completion update status to complete
59
+ ```
103
60
 
104
- **Skip specs for:**
105
- - Bug fixes
106
- - Trivial changes
107
- - Self-explanatory refactors
61
+ **Status tracks implementation, NOT spec writing.**
108
62
 
109
63
  ## Spec Dependencies
110
64
 
111
- ### `depends_on` - Blocking Dependency
112
- Directional dependency - this spec cannot start until dependencies are complete.
113
- **Use when:** True blocking dependency, work order matters, one spec builds on another.
65
+ Use `depends_on` to express blocking relationships between specs:
66
+ - **`depends_on`** = True blocker, work order matters, directional (A depends on B)
114
67
 
68
+ Link dependencies when one spec builds on another:
115
69
  ```bash
116
70
  lean-spec link <spec> --depends-on <other-spec>
117
71
  ```
118
72
 
119
- **Note:** Only use `depends_on` for actual blocking dependencies. Don't link specs just because they're "related" - link them when one truly blocks the other.
120
-
121
- ## Quality Standards
73
+ ## When to Use Specs
122
74
 
123
- - **Status tracking is mandatory:**
124
- - `planned` → after creation
125
- - `in-progress` BEFORE starting implementation
126
- - `complete` AFTER finishing implementation
127
- - Specs stay in sync with implementation
128
- - Never leave specs with stale status
75
+ | Write spec | ❌ Skip spec |
76
+ |---------------|--------------|
77
+ | Multi-part features | Bug fixes |
78
+ | Breaking changes | Trivial changes |
79
+ | Design decisions | Self-explanatory refactors |
129
80
 
130
- ## Spec Complexity Guidelines
81
+ ## Token Thresholds
131
82
 
132
83
  | Tokens | Status |
133
84
  |--------|--------|
134
85
  | <2,000 | ✅ Optimal |
135
86
  | 2,000-3,500 | ✅ Good |
136
87
  | 3,500-5,000 | ⚠️ Consider splitting |
137
- | >5,000 | 🔴 Should split |
88
+ | >5,000 | 🔴 Must split |
89
+
90
+ ## Quality Validation
91
+
92
+ Before completing work, validate spec quality:
93
+ ```bash
94
+ lean-spec validate # Check structure and quality
95
+ lean-spec validate --check-deps # Verify dependency alignment
96
+ ```
97
+
98
+ Validation checks:
99
+ - Missing required sections
100
+ - Excessive length (>400 lines)
101
+ - Content/frontmatter dependency misalignment
102
+ - Invalid frontmatter fields
103
+
104
+ ## First Principles (Priority Order)
138
105
 
139
- Use `tokens` tool to check spec size.
106
+ 1. **Context Economy** - <2,000 tokens optimal, >3,500 needs splitting
107
+ 2. **Signal-to-Noise** - Every word must inform a decision
108
+ 3. **Intent Over Implementation** - Capture why, let how emerge
109
+ 4. **Bridge the Gap** - Both human and AI must understand
110
+ 5. **Progressive Disclosure** - Add complexity only when pain is felt
140
111
 
141
112
  ---
142
113
 
143
- **Remember:** LeanSpec tracks what you're building. Keep specs in sync with your work!
114
+ **Remember:** LeanSpec tracks what you're building. Keep specs in sync with your work!