@leanspec/cli 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.
Files changed (68) hide show
  1. package/README.md +267 -0
  2. package/bin/lean-spec-rust.js +201 -0
  3. package/bin/lean-spec.js +9 -0
  4. package/bin/leanspec-rust.js +193 -0
  5. package/bin/leanspec.js +9 -0
  6. package/binaries/darwin-arm64/leanspec +0 -0
  7. package/binaries/darwin-arm64/leanspec-http +0 -0
  8. package/binaries/darwin-arm64/leanspec-mcp +0 -0
  9. package/binaries/darwin-arm64/package.json +24 -0
  10. package/binaries/darwin-arm64/postinstall.js +17 -0
  11. package/binaries/darwin-x64/leanspec +0 -0
  12. package/binaries/darwin-x64/leanspec-http +0 -0
  13. package/binaries/darwin-x64/leanspec-mcp +0 -0
  14. package/binaries/darwin-x64/package.json +24 -0
  15. package/binaries/darwin-x64/postinstall.js +17 -0
  16. package/binaries/linux-x64/leanspec +0 -0
  17. package/binaries/linux-x64/leanspec-http +0 -0
  18. package/binaries/linux-x64/leanspec-mcp +0 -0
  19. package/binaries/linux-x64/package.json +24 -0
  20. package/binaries/linux-x64/postinstall.js +17 -0
  21. package/binaries/windows-x64/leanspec-http.exe +0 -0
  22. package/binaries/windows-x64/leanspec-mcp.exe +0 -0
  23. package/binaries/windows-x64/leanspec.exe +0 -0
  24. package/binaries/windows-x64/package.json +24 -0
  25. package/binaries/windows-x64/postinstall.js +6 -0
  26. package/package.json +48 -0
  27. package/templates/detailed/AGENTS-minimal.md +9 -0
  28. package/templates/detailed/AGENTS.md +114 -0
  29. package/templates/detailed/README.md +28 -0
  30. package/templates/detailed/config.json +20 -0
  31. package/templates/detailed/files/DESIGN.md +43 -0
  32. package/templates/detailed/files/PLAN.md +59 -0
  33. package/templates/detailed/files/README.md +30 -0
  34. package/templates/detailed/files/TEST.md +71 -0
  35. package/templates/examples/api-refactor/README.md +81 -0
  36. package/templates/examples/api-refactor/package.json +16 -0
  37. package/templates/examples/api-refactor/src/app.js +40 -0
  38. package/templates/examples/api-refactor/src/services/currencyService.js +43 -0
  39. package/templates/examples/api-refactor/src/services/timezoneService.js +41 -0
  40. package/templates/examples/api-refactor/src/services/weatherService.js +42 -0
  41. package/templates/examples/dark-theme/README.md +66 -0
  42. package/templates/examples/dark-theme/package.json +16 -0
  43. package/templates/examples/dark-theme/src/public/app.js +277 -0
  44. package/templates/examples/dark-theme/src/public/index.html +225 -0
  45. package/templates/examples/dark-theme/src/public/style.css +625 -0
  46. package/templates/examples/dark-theme/src/server.js +18 -0
  47. package/templates/examples/dashboard-widgets/README.md +70 -0
  48. package/templates/examples/dashboard-widgets/index.html +12 -0
  49. package/templates/examples/dashboard-widgets/package.json +22 -0
  50. package/templates/examples/dashboard-widgets/src/App.css +20 -0
  51. package/templates/examples/dashboard-widgets/src/App.jsx +16 -0
  52. package/templates/examples/dashboard-widgets/src/components/Dashboard.css +17 -0
  53. package/templates/examples/dashboard-widgets/src/components/Dashboard.jsx +15 -0
  54. package/templates/examples/dashboard-widgets/src/components/WidgetWrapper.css +23 -0
  55. package/templates/examples/dashboard-widgets/src/components/WidgetWrapper.jsx +16 -0
  56. package/templates/examples/dashboard-widgets/src/components/widgets/ChartWidget.css +33 -0
  57. package/templates/examples/dashboard-widgets/src/components/widgets/ChartWidget.jsx +28 -0
  58. package/templates/examples/dashboard-widgets/src/components/widgets/StatsWidget.css +24 -0
  59. package/templates/examples/dashboard-widgets/src/components/widgets/StatsWidget.jsx +22 -0
  60. package/templates/examples/dashboard-widgets/src/index.css +13 -0
  61. package/templates/examples/dashboard-widgets/src/main.jsx +10 -0
  62. package/templates/examples/dashboard-widgets/src/utils/mockData.js +30 -0
  63. package/templates/examples/dashboard-widgets/vite.config.js +6 -0
  64. package/templates/standard/AGENTS-minimal.md +10 -0
  65. package/templates/standard/AGENTS.md +114 -0
  66. package/templates/standard/README.md +25 -0
  67. package/templates/standard/config.json +18 -0
  68. package/templates/standard/files/README.md +42 -0
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@leanspec/cli-darwin-arm64",
3
+ "version": "0.3.0",
4
+ "description": "LeanSpec CLI binary for macOS ARM64",
5
+ "os": [
6
+ "darwin"
7
+ ],
8
+ "cpu": [
9
+ "arm64"
10
+ ],
11
+ "main": "leanspec",
12
+ "files": [
13
+ "leanspec",
14
+ "postinstall.js"
15
+ ],
16
+ "scripts": {
17
+ "postinstall": "node postinstall.js"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/codervisor/leanspec.git"
22
+ },
23
+ "license": "MIT"
24
+ }
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Postinstall script to set execute permissions on the binary.
4
+ * npm doesn't preserve file permissions, so we need to set them after install.
5
+ */
6
+ const { chmodSync } = require('fs');
7
+ const { join } = require('path');
8
+
9
+ const binaryPath = join(__dirname, 'leanspec');
10
+
11
+ try {
12
+ chmodSync(binaryPath, 0o755);
13
+ console.log('✓ Set execute permissions on leanspec binary');
14
+ } catch (err) {
15
+ console.error('Warning: Could not set execute permissions:', err.message);
16
+ // Don't fail the install
17
+ }
Binary file
Binary file
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@leanspec/cli-darwin-x64",
3
+ "version": "0.3.0",
4
+ "description": "LeanSpec CLI binary for macOS x64",
5
+ "os": [
6
+ "darwin"
7
+ ],
8
+ "cpu": [
9
+ "x64"
10
+ ],
11
+ "main": "leanspec",
12
+ "files": [
13
+ "leanspec",
14
+ "postinstall.js"
15
+ ],
16
+ "scripts": {
17
+ "postinstall": "node postinstall.js"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/codervisor/leanspec.git"
22
+ },
23
+ "license": "MIT"
24
+ }
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Postinstall script to set execute permissions on the binary.
4
+ * npm doesn't preserve file permissions, so we need to set them after install.
5
+ */
6
+ const { chmodSync } = require('fs');
7
+ const { join } = require('path');
8
+
9
+ const binaryPath = join(__dirname, 'leanspec');
10
+
11
+ try {
12
+ chmodSync(binaryPath, 0o755);
13
+ console.log('✓ Set execute permissions on leanspec binary');
14
+ } catch (err) {
15
+ console.error('Warning: Could not set execute permissions:', err.message);
16
+ // Don't fail the install
17
+ }
Binary file
Binary file
Binary file
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@leanspec/cli-linux-x64",
3
+ "version": "0.3.0",
4
+ "description": "LeanSpec CLI binary for Linux x64",
5
+ "os": [
6
+ "linux"
7
+ ],
8
+ "cpu": [
9
+ "x64"
10
+ ],
11
+ "main": "leanspec",
12
+ "files": [
13
+ "leanspec",
14
+ "postinstall.js"
15
+ ],
16
+ "scripts": {
17
+ "postinstall": "node postinstall.js"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/codervisor/leanspec.git"
22
+ },
23
+ "license": "MIT"
24
+ }
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Postinstall script to set execute permissions on the binary.
4
+ * npm doesn't preserve file permissions, so we need to set them after install.
5
+ */
6
+ const { chmodSync } = require('fs');
7
+ const { join } = require('path');
8
+
9
+ const binaryPath = join(__dirname, 'leanspec');
10
+
11
+ try {
12
+ chmodSync(binaryPath, 0o755);
13
+ console.log('✓ Set execute permissions on leanspec binary');
14
+ } catch (err) {
15
+ console.error('Warning: Could not set execute permissions:', err.message);
16
+ // Don't fail the install
17
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@leanspec/cli-windows-x64",
3
+ "version": "0.3.0",
4
+ "description": "LeanSpec CLI binary for Windows x64",
5
+ "os": [
6
+ "win32"
7
+ ],
8
+ "cpu": [
9
+ "x64"
10
+ ],
11
+ "main": "leanspec.exe",
12
+ "files": [
13
+ "leanspec.exe",
14
+ "postinstall.js"
15
+ ],
16
+ "scripts": {
17
+ "postinstall": "node postinstall.js"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/codervisor/leanspec.git"
22
+ },
23
+ "license": "MIT"
24
+ }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Postinstall script - no-op on Windows (permissions not needed).
4
+ * This file exists for consistency across all platform packages.
5
+ */
6
+ console.log('✓ leanspec.exe ready');
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@leanspec/cli",
3
+ "version": "0.3.0",
4
+ "description": "Specification-driven development made simple",
5
+ "type": "module",
6
+ "bin": {
7
+ "leanspec": "./bin/leanspec.js",
8
+ "lean-spec": "./bin/lean-spec.js"
9
+ },
10
+ "scripts": {
11
+ "typecheck": "echo 'No TypeScript source to check'"
12
+ },
13
+ "keywords": [
14
+ "spec",
15
+ "specification",
16
+ "documentation",
17
+ "ai",
18
+ "agent",
19
+ "sdd"
20
+ ],
21
+ "author": "Marvin Zhang",
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/codervisor/leanspec.git"
26
+ },
27
+ "homepage": "https://lean-spec.dev",
28
+ "bugs": {
29
+ "url": "https://github.com/codervisor/leanspec/issues"
30
+ },
31
+ "files": [
32
+ "bin/",
33
+ "binaries/",
34
+ "templates/",
35
+ "README.md",
36
+ "LICENSE",
37
+ "CHANGELOG.md"
38
+ ],
39
+ "engines": {
40
+ "node": ">=20"
41
+ },
42
+ "optionalDependencies": {
43
+ "@leanspec/cli-darwin-x64": "0.3.0",
44
+ "@leanspec/cli-darwin-arm64": "0.3.0",
45
+ "@leanspec/cli-linux-x64": "0.3.0",
46
+ "@leanspec/cli-windows-x64": "0.3.0"
47
+ }
48
+ }
@@ -0,0 +1,9 @@
1
+ # {project_name}
2
+
3
+ ## Project-Specific Rules
4
+
5
+ Add your project-specific conventions here. For example:
6
+ - Code style preferences
7
+ - Naming conventions
8
+ - Team workflows
9
+ - Custom tooling
@@ -0,0 +1,114 @@
1
+ # AI Agent Instructions
2
+
3
+ ## Project: {project_name}
4
+
5
+ ## 🚨 CRITICAL: Before ANY Task
6
+
7
+ **STOP and check these first:**
8
+
9
+ 1. **Discover context** → Use `board` tool to see project state
10
+ 2. **Search for related work** → Use `search` tool before creating new specs
11
+ 3. **Never create files manually** → Always use `create` tool for new specs
12
+
13
+ > **Why?** Skipping discovery creates duplicate work. Manual file creation breaks LeanSpec tooling.
14
+
15
+ ## 🔧 Managing Specs
16
+
17
+ ### MCP Tools (Preferred) with CLI Fallback
18
+
19
+ | Action | MCP Tool | CLI Fallback |
20
+ |--------|----------|--------------|
21
+ | Project status | `board` | `leanspec board` |
22
+ | List specs | `list` | `leanspec list` |
23
+ | Search specs | `search` | `leanspec search "query"` |
24
+ | View spec | `view` | `leanspec view <spec>` |
25
+ | Create spec | `create` | `leanspec create <name>` |
26
+ | Update spec | `update` | `leanspec update <spec> --status <status>` |
27
+ | Link specs | `link` | `leanspec link <spec> --depends-on <other>` |
28
+ | Unlink specs | `unlink` | `leanspec unlink <spec> --depends-on <other>` |
29
+ | Dependencies | `deps` | `leanspec deps <spec>` |
30
+ | Token count | `tokens` | `leanspec tokens <spec>` |
31
+ | Validate specs | `validate` | `leanspec 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 → `leanspec 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
44
+
45
+ | ❌ Don't | ✅ Do Instead |
46
+ |----------|---------------|
47
+ | Create spec files manually | Use `create` tool |
48
+ | Skip discovery | Run `board` and `search` first |
49
+ | Leave status as "planned" | Update to `in-progress` before coding |
50
+ | Edit frontmatter manually | Use `update` tool |
51
+ | Complete spec without documentation | Document progress, prompts, learnings first |
52
+
53
+ ## 📋 SDD Workflow
54
+
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
+ ```
60
+
61
+ **Status tracks implementation, NOT spec writing.**
62
+
63
+ ## Spec Dependencies
64
+
65
+ Use `depends_on` to express blocking relationships between specs:
66
+ - **`depends_on`** = True blocker, work order matters, directional (A depends on B)
67
+
68
+ Link dependencies when one spec builds on another:
69
+ ```bash
70
+ leanspec link <spec> --depends-on <other-spec>
71
+ ```
72
+
73
+ ## When to Use Specs
74
+
75
+ | ✅ Write spec | ❌ Skip spec |
76
+ |---------------|--------------|
77
+ | Multi-part features | Bug fixes |
78
+ | Breaking changes | Trivial changes |
79
+ | Design decisions | Self-explanatory refactors |
80
+
81
+ ## Token Thresholds
82
+
83
+ | Tokens | Status |
84
+ |--------|--------|
85
+ | <2,000 | ✅ Optimal |
86
+ | 2,000-3,500 | ✅ Good |
87
+ | 3,500-5,000 | ⚠️ Consider splitting |
88
+ | >5,000 | 🔴 Must split |
89
+
90
+ ## Quality Validation
91
+
92
+ Before completing work, validate spec quality:
93
+ ```bash
94
+ leanspec validate # Check structure and quality
95
+ leanspec 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)
105
+
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
111
+
112
+ ---
113
+
114
+ **Remember:** LeanSpec tracks what you're building. Keep specs in sync with your work!
@@ -0,0 +1,28 @@
1
+ # Detailed Template
2
+
3
+ For complex specs that benefit from structured sub-specs. Demonstrates how to manage token limits.
4
+
5
+ ## What's Included
6
+
7
+ - **AGENTS.md** - Same AI agent instructions as standard template
8
+ - **Sub-spec structure** - README.md + DESIGN.md + PLAN.md + TEST.md
9
+ - Demonstrates splitting specs to stay under token limits
10
+ - Example of real-world sub-spec organization
11
+
12
+ ## When to Use
13
+
14
+ - Complex features with lots of detail
15
+ - Specs approaching 3,500+ tokens
16
+ - Need clear separation of concerns (design, plan, test)
17
+ - Large teams with multiple reviewers
18
+
19
+ ## Philosophy
20
+
21
+ Keep it lean, but organized. Use sub-specs to manage complexity without overwhelming context. Each file stays focused and under token limits.
22
+
23
+ ## Next Steps
24
+
25
+ You're ready to go! Ask your AI to create a spec for your next feature.
26
+
27
+ When a spec grows large, consider splitting sections into sub-spec files.
28
+
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "Enterprise",
3
+ "description": "Governance-ready with approvals, compliance, and security",
4
+ "config": {
5
+ "template": "enterprise",
6
+ "specsDir": "specs",
7
+ "structure": {
8
+ "pattern": "flat",
9
+ "prefix": "",
10
+ "dateFormat": "YYYYMMDD",
11
+ "sequenceDigits": 3,
12
+ "defaultFile": "README.md"
13
+ },
14
+ "features": {
15
+ "aiAgents": true,
16
+ "compliance": true,
17
+ "approvals": true
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,43 @@
1
+ # Design: {name}
2
+
3
+ > Part of [{name}](README.md)
4
+
5
+ ## Architecture
6
+
7
+ <!-- High-level system design, components, interactions -->
8
+
9
+ ## Technical Approach
10
+
11
+ <!-- Specific technologies, patterns, frameworks -->
12
+
13
+ ## Design Decisions
14
+
15
+ <!-- Key decisions and rationale -->
16
+
17
+ ### Decision 1
18
+
19
+ **Context**: <!-- What problem does this solve? -->
20
+
21
+ **Decision**: <!-- What did we choose? -->
22
+
23
+ **Rationale**: <!-- Why this approach? -->
24
+
25
+ **Trade-offs**: <!-- What are we giving up? -->
26
+
27
+ ## Dependencies
28
+
29
+ <!-- What does this depend on? What depends on this? -->
30
+
31
+ ### System Dependencies
32
+ -
33
+
34
+ ### Team Dependencies
35
+ -
36
+
37
+ ## Security & Compliance
38
+
39
+ <!-- Security implications, compliance requirements -->
40
+
41
+ - [ ] Handles sensitive data (PII, credentials, etc.)
42
+ - [ ] Security review completed
43
+ - [ ] Compliance requirements addressed
@@ -0,0 +1,59 @@
1
+ # Plan: {name}
2
+
3
+ > Part of [{name}](README.md)
4
+
5
+ ## Implementation Phases
6
+
7
+ ### Phase 1: [Name]
8
+
9
+ **Goal**: <!-- What does this phase achieve? -->
10
+
11
+ **Tasks**:
12
+ - [ ] Task 1
13
+ - [ ] Task 2
14
+ - [ ] Task 3
15
+
16
+ **Dependencies**: <!-- What must be done before this? -->
17
+
18
+ **Success criteria**: <!-- How do we know this is done? -->
19
+
20
+ ### Phase 2: [Name]
21
+
22
+ **Goal**: <!-- What does this phase achieve? -->
23
+
24
+ **Tasks**:
25
+ - [ ] Task 1
26
+ - [ ] Task 2
27
+ - [ ] Task 3
28
+
29
+ **Dependencies**: <!-- What must be done before this? -->
30
+
31
+ **Success criteria**: <!-- How do we know this is done? -->
32
+
33
+ ## Rollout Strategy
34
+
35
+ <!-- How will this be deployed to production? -->
36
+
37
+ **Staging**:
38
+ -
39
+
40
+ **Production**:
41
+ -
42
+
43
+ **Monitoring**:
44
+ -
45
+
46
+ **Rollback plan**:
47
+ -
48
+
49
+ ## Timeline
50
+
51
+ | Phase | Duration | Dependencies |
52
+ |-------|----------|--------------|
53
+ | | | |
54
+
55
+ ## Risks
56
+
57
+ | Risk | Impact | Mitigation |
58
+ |------|--------|------------|
59
+ | | | |
@@ -0,0 +1,30 @@
1
+ ---
2
+ status: planned
3
+ created: '{date}'
4
+ tags: []
5
+ priority: medium
6
+ ---
7
+
8
+ # {name}
9
+
10
+ > **Status**: {status} · **Priority**: {priority} · **Created**: {date}
11
+
12
+ ## Overview
13
+
14
+ <!-- What are we solving? Why now? Expected impact? -->
15
+
16
+ ## Sub-Specs
17
+
18
+ For detailed information, see:
19
+
20
+ - **[DESIGN.md](DESIGN.md)** - Technical architecture and design decisions
21
+ - **[PLAN.md](PLAN.md)** - Implementation plan and phases
22
+ - **[TEST.md](TEST.md)** - Testing strategy and verification
23
+
24
+ ## Quick Summary
25
+
26
+ <!-- Brief summary of the spec (2-3 paragraphs max) -->
27
+
28
+ ## Notes
29
+
30
+ <!-- Key decisions, constraints, open questions -->
@@ -0,0 +1,71 @@
1
+ # Test: {name}
2
+
3
+ > Part of [{name}](README.md)
4
+
5
+ ## Testing Strategy
6
+
7
+ <!-- Overall approach to verifying this works -->
8
+
9
+ ## Unit Tests
10
+
11
+ <!-- Component-level testing -->
12
+
13
+ **Scope**:
14
+ -
15
+
16
+ **Key test cases**:
17
+ - [ ] Test case 1
18
+ - [ ] Test case 2
19
+ - [ ] Test case 3
20
+
21
+ ## Integration Tests
22
+
23
+ <!-- System interaction testing -->
24
+
25
+ **Scope**:
26
+ -
27
+
28
+ **Key test cases**:
29
+ - [ ] Test case 1
30
+ - [ ] Test case 2
31
+ - [ ] Test case 3
32
+
33
+ ## Performance Tests
34
+
35
+ <!-- Load, stress, and performance testing -->
36
+
37
+ **Requirements**:
38
+ -
39
+
40
+ **Test scenarios**:
41
+ - [ ] Scenario 1
42
+ - [ ] Scenario 2
43
+
44
+ ## Security Tests
45
+
46
+ <!-- Security validation -->
47
+
48
+ **Security checks**:
49
+ - [ ] Authentication/authorization
50
+ - [ ] Input validation
51
+ - [ ] Data encryption
52
+ - [ ] Audit logging
53
+
54
+ ## Acceptance Criteria
55
+
56
+ <!-- What must be true for this to be considered complete? -->
57
+
58
+ - [ ] Criterion 1
59
+ - [ ] Criterion 2
60
+ - [ ] Criterion 3
61
+
62
+ ## Test Data
63
+
64
+ <!-- What test data is needed? -->
65
+
66
+ ## Manual Testing
67
+
68
+ <!-- What requires human verification? -->
69
+
70
+ - [ ] Manual test 1
71
+ - [ ] Manual test 2