lean-spec 0.2.5 → 0.2.6-dev.20251125010539

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 (85) hide show
  1. package/dist/{chunk-7WXYOHZU.js → chunk-RTEGSMVL.js} +1253 -678
  2. package/dist/chunk-RTEGSMVL.js.map +1 -0
  3. package/dist/cli.js +7 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/mcp-server.js +1 -1
  6. package/package.json +2 -3
  7. package/templates/detailed/AGENTS.md +113 -0
  8. package/templates/detailed/README.md +28 -0
  9. package/templates/detailed/files/DESIGN.md +43 -0
  10. package/templates/detailed/files/PLAN.md +59 -0
  11. package/templates/detailed/files/README.md +30 -0
  12. package/templates/detailed/files/TEST.md +71 -0
  13. package/templates/examples/api-refactor/README.md +81 -0
  14. package/templates/examples/api-refactor/package.json +16 -0
  15. package/templates/examples/api-refactor/src/app.js +40 -0
  16. package/templates/examples/api-refactor/src/services/currencyService.js +43 -0
  17. package/templates/examples/api-refactor/src/services/timezoneService.js +41 -0
  18. package/templates/examples/api-refactor/src/services/weatherService.js +42 -0
  19. package/templates/examples/dark-theme/README.md +66 -0
  20. package/templates/examples/dark-theme/package.json +16 -0
  21. package/templates/examples/dark-theme/src/public/app.js +277 -0
  22. package/templates/examples/dark-theme/src/public/index.html +225 -0
  23. package/templates/examples/dark-theme/src/public/style.css +625 -0
  24. package/templates/examples/dark-theme/src/server.js +18 -0
  25. package/templates/examples/dashboard-widgets/README.md +70 -0
  26. package/templates/examples/dashboard-widgets/index.html +12 -0
  27. package/templates/examples/dashboard-widgets/package.json +22 -0
  28. package/templates/examples/dashboard-widgets/src/App.css +20 -0
  29. package/templates/examples/dashboard-widgets/src/App.jsx +16 -0
  30. package/templates/examples/dashboard-widgets/src/components/Dashboard.css +17 -0
  31. package/templates/examples/dashboard-widgets/src/components/Dashboard.jsx +15 -0
  32. package/templates/examples/dashboard-widgets/src/components/WidgetWrapper.css +23 -0
  33. package/templates/examples/dashboard-widgets/src/components/WidgetWrapper.jsx +16 -0
  34. package/templates/examples/dashboard-widgets/src/components/widgets/ChartWidget.css +33 -0
  35. package/templates/examples/dashboard-widgets/src/components/widgets/ChartWidget.jsx +28 -0
  36. package/templates/examples/dashboard-widgets/src/components/widgets/StatsWidget.css +24 -0
  37. package/templates/examples/dashboard-widgets/src/components/widgets/StatsWidget.jsx +22 -0
  38. package/templates/examples/dashboard-widgets/src/index.css +13 -0
  39. package/templates/examples/dashboard-widgets/src/main.jsx +10 -0
  40. package/templates/examples/dashboard-widgets/src/utils/mockData.js +30 -0
  41. package/templates/examples/dashboard-widgets/vite.config.js +6 -0
  42. package/templates/standard/AGENTS.md +113 -0
  43. package/templates/standard/README.md +4 -2
  44. package/dist/chunk-7WXYOHZU.js.map +0 -1
  45. package/templates/_shared/agents-components/core-rules-base-additions.md +0 -4
  46. package/templates/_shared/agents-components/core-rules-enterprise-additions.md +0 -4
  47. package/templates/_shared/agents-components/core-rules-shared.md +0 -1
  48. package/templates/_shared/agents-components/discovery-commands-enterprise-additions.md +0 -6
  49. package/templates/_shared/agents-components/discovery-commands-minimal-additions.md +0 -0
  50. package/templates/_shared/agents-components/discovery-commands-shared.md +0 -8
  51. package/templates/_shared/agents-components/discovery-commands-standard-additions.md +0 -3
  52. package/templates/_shared/agents-components/enterprise-approval.md +0 -10
  53. package/templates/_shared/agents-components/enterprise-compliance.md +0 -12
  54. package/templates/_shared/agents-components/enterprise-when-required.md +0 -13
  55. package/templates/_shared/agents-components/essential-commands-enterprise-additions.md +0 -29
  56. package/templates/_shared/agents-components/essential-commands-minimal-additions.md +0 -1
  57. package/templates/_shared/agents-components/essential-commands-shared.md +0 -15
  58. package/templates/_shared/agents-components/essential-commands-standard-additions.md +0 -18
  59. package/templates/_shared/agents-components/frontmatter-enterprise.md +0 -33
  60. package/templates/_shared/agents-components/frontmatter-minimal.md +0 -18
  61. package/templates/_shared/agents-components/frontmatter-standard.md +0 -23
  62. package/templates/_shared/agents-components/quality-standards-enterprise-additions.md +0 -4
  63. package/templates/_shared/agents-components/quality-standards-minimal-additions.md +0 -3
  64. package/templates/_shared/agents-components/quality-standards-shared.md +0 -6
  65. package/templates/_shared/agents-components/status-update-triggers.md +0 -14
  66. package/templates/_shared/agents-components/when-to-use-enterprise.md +0 -11
  67. package/templates/_shared/agents-components/when-to-use-minimal.md +0 -9
  68. package/templates/_shared/agents-components/when-to-use-standard.md +0 -9
  69. package/templates/_shared/agents-components/workflow-enterprise.md +0 -11
  70. package/templates/_shared/agents-components/workflow-standard-detailed.md +0 -10
  71. package/templates/_shared/agents-components/workflow-standard.md +0 -8
  72. package/templates/_shared/agents-template.hbs +0 -43
  73. package/templates/enterprise/README.md +0 -25
  74. package/templates/enterprise/agents-config.json +0 -16
  75. package/templates/enterprise/files/AGENTS.md +0 -194
  76. package/templates/enterprise/spec-template.md +0 -80
  77. package/templates/minimal/README.md +0 -18
  78. package/templates/minimal/agents-config.json +0 -13
  79. package/templates/minimal/config.json +0 -15
  80. package/templates/minimal/files/AGENTS.md +0 -116
  81. package/templates/minimal/spec-template.md +0 -25
  82. package/templates/standard/agents-config.json +0 -13
  83. package/templates/standard/files/AGENTS.md +0 -142
  84. /package/templates/{enterprise → detailed}/config.json +0 -0
  85. /package/templates/standard/{spec-template.md → files/README.md} +0 -0
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "dashboard-widgets-demo",
3
+ "version": "1.0.0",
4
+ "description": "React Dashboard for LeanSpec Tutorial 2",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "keywords": ["leanspec", "tutorial", "demo"],
12
+ "author": "",
13
+ "license": "MIT",
14
+ "dependencies": {
15
+ "react": "^18.2.0",
16
+ "react-dom": "^18.2.0"
17
+ },
18
+ "devDependencies": {
19
+ "@vitejs/plugin-react": "^4.2.1",
20
+ "vite": "^5.0.0"
21
+ }
22
+ }
@@ -0,0 +1,20 @@
1
+ .app {
2
+ padding: 20px;
3
+ max-width: 1400px;
4
+ margin: 0 auto;
5
+ }
6
+
7
+ header {
8
+ margin-bottom: 30px;
9
+ }
10
+
11
+ header h1 {
12
+ margin: 0 0 5px 0;
13
+ color: #333;
14
+ }
15
+
16
+ header p {
17
+ margin: 0;
18
+ color: #666;
19
+ font-size: 14px;
20
+ }
@@ -0,0 +1,16 @@
1
+ import Dashboard from './components/Dashboard';
2
+ import './App.css';
3
+
4
+ function App() {
5
+ return (
6
+ <div className="app">
7
+ <header>
8
+ <h1>Analytics Dashboard</h1>
9
+ <p>Demo for LeanSpec Tutorial 2</p>
10
+ </header>
11
+ <Dashboard />
12
+ </div>
13
+ );
14
+ }
15
+
16
+ export default App;
@@ -0,0 +1,17 @@
1
+ .dashboard-grid {
2
+ display: grid;
3
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
4
+ gap: 20px;
5
+ }
6
+
7
+ @media (min-width: 768px) {
8
+ .dashboard-grid {
9
+ grid-template-columns: repeat(2, 1fr);
10
+ }
11
+ }
12
+
13
+ @media (min-width: 1200px) {
14
+ .dashboard-grid {
15
+ grid-template-columns: repeat(3, 1fr);
16
+ }
17
+ }
@@ -0,0 +1,15 @@
1
+ import StatsWidget from './widgets/StatsWidget';
2
+ import ChartWidget from './widgets/ChartWidget';
3
+ import './Dashboard.css';
4
+
5
+ function Dashboard() {
6
+ return (
7
+ <div className="dashboard-grid">
8
+ <StatsWidget />
9
+ <ChartWidget />
10
+ {/* TODO: Add new widgets here */}
11
+ </div>
12
+ );
13
+ }
14
+
15
+ export default Dashboard;
@@ -0,0 +1,23 @@
1
+ .widget {
2
+ background: white;
3
+ border-radius: 8px;
4
+ box-shadow: 0 1px 3px rgba(0,0,0,0.1);
5
+ overflow: hidden;
6
+ }
7
+
8
+ .widget-header {
9
+ padding: 15px 20px;
10
+ border-bottom: 1px solid #eee;
11
+ background: #fafafa;
12
+ }
13
+
14
+ .widget-header h3 {
15
+ margin: 0;
16
+ font-size: 16px;
17
+ font-weight: 600;
18
+ color: #333;
19
+ }
20
+
21
+ .widget-body {
22
+ padding: 20px;
23
+ }
@@ -0,0 +1,16 @@
1
+ import './WidgetWrapper.css';
2
+
3
+ function WidgetWrapper({ title, children }) {
4
+ return (
5
+ <div className="widget">
6
+ <div className="widget-header">
7
+ <h3>{title}</h3>
8
+ </div>
9
+ <div className="widget-body">
10
+ {children}
11
+ </div>
12
+ </div>
13
+ );
14
+ }
15
+
16
+ export default WidgetWrapper;
@@ -0,0 +1,33 @@
1
+ .chart {
2
+ height: 200px;
3
+ }
4
+
5
+ .chart-bars {
6
+ display: flex;
7
+ align-items: flex-end;
8
+ justify-content: space-around;
9
+ height: 100%;
10
+ gap: 8px;
11
+ }
12
+
13
+ .chart-bar-container {
14
+ flex: 1;
15
+ display: flex;
16
+ flex-direction: column;
17
+ align-items: center;
18
+ height: 100%;
19
+ }
20
+
21
+ .chart-bar {
22
+ width: 100%;
23
+ background: linear-gradient(to top, #2563eb, #60a5fa);
24
+ border-radius: 4px 4px 0 0;
25
+ transition: height 0.3s ease;
26
+ min-height: 4px;
27
+ }
28
+
29
+ .chart-label {
30
+ margin-top: 8px;
31
+ font-size: 11px;
32
+ color: #666;
33
+ }
@@ -0,0 +1,28 @@
1
+ import WidgetWrapper from '../WidgetWrapper';
2
+ import { getChartData } from '../../utils/mockData';
3
+ import './ChartWidget.css';
4
+
5
+ function ChartWidget() {
6
+ const data = getChartData();
7
+ const maxValue = Math.max(...data.map(d => d.value));
8
+
9
+ return (
10
+ <WidgetWrapper title="Activity Trend">
11
+ <div className="chart">
12
+ <div className="chart-bars">
13
+ {data.map((item, index) => (
14
+ <div key={index} className="chart-bar-container">
15
+ <div
16
+ className="chart-bar"
17
+ style={{ height: `${(item.value / maxValue) * 100}%` }}
18
+ />
19
+ <div className="chart-label">{item.label}</div>
20
+ </div>
21
+ ))}
22
+ </div>
23
+ </div>
24
+ </WidgetWrapper>
25
+ );
26
+ }
27
+
28
+ export default ChartWidget;
@@ -0,0 +1,24 @@
1
+ .stats-grid {
2
+ display: grid;
3
+ grid-template-columns: repeat(2, 1fr);
4
+ gap: 15px;
5
+ }
6
+
7
+ .stat-item {
8
+ text-align: center;
9
+ padding: 10px;
10
+ }
11
+
12
+ .stat-value {
13
+ font-size: 28px;
14
+ font-weight: bold;
15
+ color: #2563eb;
16
+ margin-bottom: 5px;
17
+ }
18
+
19
+ .stat-label {
20
+ font-size: 12px;
21
+ color: #666;
22
+ text-transform: uppercase;
23
+ letter-spacing: 0.5px;
24
+ }
@@ -0,0 +1,22 @@
1
+ import WidgetWrapper from '../WidgetWrapper';
2
+ import { getStats } from '../../utils/mockData';
3
+ import './StatsWidget.css';
4
+
5
+ function StatsWidget() {
6
+ const stats = getStats();
7
+
8
+ return (
9
+ <WidgetWrapper title="Quick Stats">
10
+ <div className="stats-grid">
11
+ {stats.map((stat, index) => (
12
+ <div key={index} className="stat-item">
13
+ <div className="stat-value">{stat.value}</div>
14
+ <div className="stat-label">{stat.label}</div>
15
+ </div>
16
+ ))}
17
+ </div>
18
+ </WidgetWrapper>
19
+ );
20
+ }
21
+
22
+ export default StatsWidget;
@@ -0,0 +1,13 @@
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
+ sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ -moz-osx-font-smoothing: grayscale;
8
+ background: #f5f5f5;
9
+ }
10
+
11
+ * {
12
+ box-sizing: border-box;
13
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import App from './App';
4
+ import './index.css';
5
+
6
+ ReactDOM.createRoot(document.getElementById('root')).render(
7
+ <React.StrictMode>
8
+ <App />
9
+ </React.StrictMode>
10
+ );
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Mock data generators for dashboard widgets
3
+ */
4
+
5
+ export function getStats() {
6
+ return [
7
+ { label: 'Users', value: '2,453' },
8
+ { label: 'Revenue', value: '$12.5K' },
9
+ { label: 'Orders', value: '186' },
10
+ { label: 'Growth', value: '+23%' },
11
+ ];
12
+ }
13
+
14
+ export function getChartData() {
15
+ return [
16
+ { label: 'Mon', value: 45 },
17
+ { label: 'Tue', value: 62 },
18
+ { label: 'Wed', value: 38 },
19
+ { label: 'Thu', value: 71 },
20
+ { label: 'Fri', value: 55 },
21
+ { label: 'Sat', value: 28 },
22
+ { label: 'Sun', value: 34 },
23
+ ];
24
+ }
25
+
26
+ // TODO: Add more mock data generators for new widgets
27
+ // Example:
28
+ // export function getActivityFeed() { ... }
29
+ // export function getPerformanceMetrics() { ... }
30
+ // export function getQuickActions() { ... }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ });
@@ -0,0 +1,113 @@
1
+ # AI Agent Instructions
2
+
3
+ ## Project: {project_name}
4
+
5
+ Lightweight spec methodology for AI-powered development.
6
+
7
+ ## Core Rules
8
+
9
+ 1. **Read README.md first** - Understand project context
10
+ 2. **Check specs/** - Review existing specs before starting
11
+ 3. **Use `lean-spec --help`** - When unsure about commands, check the built-in help
12
+ 4. **Follow LeanSpec principles** - Clarity over documentation
13
+ 5. **Keep it minimal** - If it doesn't add clarity, cut it
14
+ 6. **NEVER manually edit system-managed frontmatter** - Fields like `status`, `priority`, `tags`, `assignee`, `transitions`, `created_at`, `updated_at`, `completed_at`, `depends_on`, `related` are system-managed. Always use `lean-spec update`, `lean-spec link`, `lean-spec unlink`, or `lean-spec create` commands. Manual edits will cause metadata corruption and tracking issues.
15
+ 7. **Never use nested code blocks** - Markdown doesn't support code blocks within code blocks. If you need to show code examples in documentation, use indentation or describe the structure instead of nesting backticks.
16
+
17
+ ## When to Use Specs
18
+
19
+ Write a spec for:
20
+ - Features affecting multiple parts of the system
21
+ - Breaking changes or significant refactors
22
+ - Design decisions needing team alignment
23
+
24
+ Skip specs for:
25
+ - Bug fixes
26
+ - Trivial changes
27
+ - Self-explanatory refactors
28
+
29
+ ## Essential Commands
30
+
31
+ **Quick Reference** (for full details, see `lean-spec --help`):
32
+
33
+ **Discovery:**
34
+ - `lean-spec list` - See all specs
35
+ - `lean-spec search "<query>"` - Find relevant specs
36
+
37
+ **Working with specs:**
38
+ - `lean-spec create <name>` - Create new spec
39
+ - `lean-spec update <spec> --status <status>` - Update status (REQUIRED - never edit frontmatter manually)
40
+ - `lean-spec update <spec> --priority <priority>` - Update priority
41
+ - `lean-spec deps <spec>` - Show dependency graph
42
+ - `lean-spec tokens <spec>` - Count tokens for context management
43
+
44
+ **Project overview:**
45
+ - `lean-spec board` - Kanban view with project health
46
+ - `lean-spec stats` - Quick project metrics
47
+
48
+ **When in doubt:** Run `lean-spec --help` or `lean-spec <command> --help` to discover commands.
49
+
50
+ ## Spec Relationships
51
+
52
+ LeanSpec has two types of relationships:
53
+
54
+ ### `related` - Bidirectional Soft Reference
55
+ Informational relationship between specs. Automatically shown from both sides.
56
+
57
+ **Use when:** Specs cover related topics, work is coordinated but not blocking.
58
+
59
+ ### `depends_on` - Directional Blocking Dependency
60
+ Hard dependency - spec cannot start until dependencies complete.
61
+
62
+ **Use when:** Spec truly cannot start until another completes, work order matters.
63
+
64
+ **Best Practice:** Use `related` by default. Reserve `depends_on` for true blocking dependencies.
65
+
66
+ ## SDD Workflow
67
+
68
+ 1. **Discover** - Check existing specs with `lean-spec list`
69
+ 2. **Plan** - Create spec with `lean-spec create <name>` (status: `planned`)
70
+ 3. **Start Work** - Run `lean-spec update <spec> --status in-progress` before implementing
71
+ 4. **Implement** - Write code/docs, keep spec in sync as you learn
72
+ 5. **Complete** - Run `lean-spec update <spec> --status complete` after implementation done
73
+ 6. **Document** - Report progress and document changes into the spec
74
+
75
+ **CRITICAL - What "Work" Means:**
76
+ - ❌ **NOT**: Creating/writing the spec document itself
77
+ - ✅ **YES**: Implementing what the spec describes (code, docs, features, etc.)
78
+
79
+ **Frontmatter Editing Rules:**
80
+ - **NEVER manually edit**: `status`, `priority`, `tags`, `assignee`, `transitions`, timestamps, `depends_on`, `related`
81
+ - **Use CLI commands**: `lean-spec update`, `lean-spec link`, `lean-spec unlink`
82
+
83
+ **Note on Archiving**: Archive specs when they're no longer actively referenced (weeks/months after completion), not immediately. Use `lean-spec archive <spec>` to move old/stale specs to `archived/` directory.
84
+
85
+ ## Quality Standards
86
+
87
+ - Code is clear and maintainable
88
+ - Tests cover critical paths
89
+ - Specs stay in sync with implementation
90
+ - **Status tracking is mandatory:**
91
+ - Specs start as `planned` after creation
92
+ - Mark `in-progress` BEFORE starting implementation work
93
+ - Mark `complete` AFTER implementation is finished
94
+ - **Remember**: Status tracks implementation, not spec document completion
95
+ - Never leave specs with stale status
96
+
97
+ ## Spec Complexity Guidelines
98
+
99
+ **Token Thresholds:**
100
+ - **<2,000 tokens**: ✅ Optimal
101
+ - **2,000-3,500 tokens**: ✅ Good
102
+ - **3,500-5,000 tokens**: ⚠️ Warning - Consider splitting
103
+ - **>5,000 tokens**: 🔴 Should split
104
+
105
+ **Check with:** `lean-spec tokens <spec>`
106
+
107
+ **When to split:** >3,500 tokens, multiple concerns, takes >10 min to read
108
+
109
+ **How to split:** Use sub-specs or split into related specs with `lean-spec link --related`
110
+
111
+ ---
112
+
113
+ **Remember**: LeanSpec is a mindset, not a rulebook. When in doubt, keep it simple and use `lean-spec --help` to discover features as needed.
@@ -1,16 +1,17 @@
1
1
  # Standard Template
2
2
 
3
- Recommended for most projects. Includes AI agent instructions and sensible defaults.
3
+ Recommended for most projects. Single-file specs with AI agent instructions.
4
4
 
5
5
  ## What's Included
6
6
 
7
7
  - **AGENTS.md** - Instructions for AI coding assistants
8
- - Spec folder structure
8
+ - **Single-file spec template** - All sections in one README.md
9
9
  - Opinionated defaults for fast iteration
10
10
 
11
11
  ## When to Use
12
12
 
13
13
  - Solo developers or small teams
14
+ - Simple to moderate complexity specs
14
15
  - Want AI agent integration
15
16
  - Need clear but not heavy-weight process
16
17
 
@@ -22,3 +23,4 @@ Keep it lean. Write specs for features that need clarity. Skip them for obvious
22
23
 
23
24
  1. Customize AGENTS.md for your project
24
25
  2. Create your first spec: `lean-spec create my-feature`
26
+