lean-spec 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,60 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2025-11-02
9
+
10
+ ### Added
11
+
12
+ **Core Features:**
13
+ - CLI tool with comprehensive command set (`init`, `create`, `list`, `search`, `update`, `archive`, `files`, `templates`)
14
+ - Project initialization with three built-in templates (minimal, standard, enterprise)
15
+ - Spec creation with automatic directory structure and frontmatter
16
+ - Frontmatter support with status tracking, tags, priority, and custom fields
17
+ - Full-text search across specs using fuzzy matching
18
+ - Dependency tracking between specs
19
+
20
+ **Visualization & Organization:**
21
+ - `lspec board` - Kanban-style board view with status columns
22
+ - `lspec stats` - Work distribution and completion analytics
23
+ - `lspec timeline` - Chronological view of spec creation
24
+ - `lspec gantt` - Gantt chart visualization (requires mermaid-cli)
25
+ - `lspec deps` - Dependency graph visualization
26
+
27
+ **Developer Experience:**
28
+ - Interactive prompts for all commands
29
+ - Colorized terminal output
30
+ - Spinner animations for long operations
31
+ - Table-based displays for list views
32
+ - React-based UI components (Ink)
33
+
34
+ **Template System:**
35
+ - Custom template support
36
+ - Template marketplace (`lspec templates marketplace`)
37
+ - Template variables for dynamic content
38
+ - Three built-in templates with different complexity levels
39
+
40
+ **Testing & Quality:**
41
+ - 62 passing tests with comprehensive coverage
42
+ - Integration tests for all commands
43
+ - TypeScript with strict mode
44
+ - ESLint and Prettier configuration
45
+
46
+ ### Documentation
47
+ - Complete README with examples and API reference
48
+ - AGENTS.md for AI agent integration
49
+ - CONTRIBUTING.md for contributors
50
+ - Individual spec READMEs for all 13 completed specs
51
+
52
+ ### Technical
53
+ - Built with TypeScript and tsup for fast builds
54
+ - Commander.js for CLI argument parsing
55
+ - Inquirer for interactive prompts
56
+ - Chalk and Ora for beautiful terminal UI
57
+ - Gray-matter for frontmatter parsing
58
+ - Dayjs for date handling
59
+
60
+ [0.1.0]: https://github.com/codervisor/lean-spec/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 codervisor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,321 @@
1
+ # LeanSpec
2
+
3
+ A lightweight, agile Spec-Driven Development (SDD) methodology and adaptive workflow designed to reduce spec "mind burden" and keep teams—both humans and AI coding agents—focused on what truly matters.
4
+
5
+ > **LeanSpec is not just a document—it's an adaptive workflow, SOP (Standard Operating Procedure), and living process for AI-powered development teams.**
6
+
7
+ ## The Problem
8
+
9
+ Traditional software specifications often suffer from:
10
+ - **Documentation Overload**: Lengthy documents that nobody (human or AI) reads or maintains
11
+ - **Frozen Contracts**: Specs that become outdated as soon as development begins
12
+ - **Exhaustive Overthinking**: Trying to document every possible edge case upfront
13
+ - **Mind Burden**: Cognitive load from managing verbose, complicated documentation
14
+ - **Lost Intent**: The "why" gets buried under mountains of "what" and "how"
15
+
16
+ Development teams—including AI coding agents—need clear direction without being buried in documentation debt.
17
+
18
+ ## The LeanSpec Solution
19
+
20
+ LeanSpec is a **mindset and methodology, not a rigid format or tool**. It's about capturing what truly matters with minimal overhead.
21
+
22
+ A simple example structure might include:
23
+ - **The Goal**: Why this work exists
24
+ - **Key Scenarios**: The critical user journeys that must succeed
25
+ - **Acceptance Criteria**: Clear, testable conditions for "done"
26
+ - **Technical Contracts**: Essential interfaces and constraints
27
+ - **Non-Goals**: What we're explicitly not doing (to maintain focus)
28
+
29
+ But the key is the mindset: focus on clarity, keep it lean, make it living documentation. The structure should serve your needs, not constrain them.
30
+
31
+ ## Agile Principles
32
+
33
+ LeanSpec is built on these core principles:
34
+
35
+ ### 🎯 Clarity over Documentation
36
+ Write just enough to communicate intent clearly. If it doesn't add clarity, don't write it.
37
+
38
+ ### 🚀 Essential Scenarios over Exhaustive Lists
39
+ Focus on the 20% of scenarios that deliver 80% of the value. Document what must work, not every possible edge case.
40
+
41
+ ### 📱 Living Guide over Frozen Contract
42
+ Specs should evolve with the project. Update them as you learn, don't treat them as immutable contracts.
43
+
44
+ ### 🧠 Reduced Mind Burden over Comprehensive Coverage
45
+ Keep specs short and scannable. The goal is to reduce cognitive load, not create reference manuals.
46
+
47
+ ### ⚡ Speed over Perfection
48
+ Ship a "good enough" spec quickly. You can always refine it based on feedback and learning.
49
+
50
+ ### 🤝 Collaboration over Specification
51
+ Use specs as conversation starters, not as replacements for human communication.
52
+
53
+ ## Getting Started
54
+
55
+ The LeanSpec mindset is simple:
56
+
57
+ 1. **Start with why**: What problem are you solving?
58
+ 2. **Capture the essentials**: What absolutely must be communicated?
59
+ 3. **Stay lean**: If it doesn't add clarity, cut it
60
+ 4. **Keep it living**: Update as you learn
61
+
62
+ For a practical example, see `templates/` for available project initialization templates. Each template contains:
63
+ - Full project structure (specs/ directory, examples)
64
+ - `AGENTS.md` - AI agent instructions and coding standards
65
+ - Supporting files - CONTRIBUTING.md, checklists, or other guides
66
+ - `config.json` - Template configuration
67
+
68
+ Initialize with `lspec init` to set up your project.
69
+
70
+ ## Quick Start
71
+
72
+ ```bash
73
+ # Install globally
74
+ pnpm install -g lean-spec
75
+
76
+ # Or use locally in your project
77
+ pnpm add -D lean-spec
78
+
79
+ # Initialize LeanSpec in your project (interactive)
80
+ lspec init
81
+
82
+ # Create your first spec (creates specs/YYYYMMDD/NNN-name/ folder)
83
+ lspec create my-feature
84
+
85
+ # List all specs
86
+ lspec list
87
+
88
+ # Filter specs by status, tags, or priority
89
+ lspec list --status=in-progress
90
+ lspec list --tag=api --priority=high
91
+
92
+ # Update spec metadata
93
+ lspec update specs/20251031/001-my-feature --status=complete
94
+ lspec update specs/20251031/001-my-feature --priority=high --tags=api,backend
95
+
96
+ # List available templates
97
+ lspec templates
98
+
99
+ # Archive old specs
100
+ lspec archive specs/20251031/001-my-feature
101
+ ```
102
+
103
+ ### Initialize Your Project
104
+
105
+ `lspec init` provides three paths:
106
+
107
+ 1. **Quick start** - Zero configuration, solo-dev defaults
108
+ 2. **Choose template** - Pick from solo-dev, team, enterprise, or api-first
109
+ 3. **Customize everything** - Full control (coming soon)
110
+
111
+ Each template is a complete working model with:
112
+ - Spec structure and examples
113
+ - AGENTS.md for AI agent integration
114
+ - Supporting files (CONTRIBUTING.md, checklists, etc.)
115
+ - Project-specific config
116
+
117
+ #### Spec Metadata with Frontmatter
118
+
119
+ LeanSpec uses YAML frontmatter for structured metadata. Each template includes different field sets:
120
+
121
+ **Minimal Template** (status, created only):
122
+ ```yaml
123
+ ---
124
+ status: planned
125
+ created: 2025-11-01
126
+ ---
127
+
128
+ # My Feature
129
+
130
+ > **Status**: 📅 Planned · **Created**: 2025-11-01
131
+ ```
132
+
133
+ **Standard Template** (recommended - adds tags and priority):
134
+ ```yaml
135
+ ---
136
+ status: in-progress
137
+ created: 2025-11-01
138
+ tags: [api, feature]
139
+ priority: high
140
+ ---
141
+
142
+ # My Feature
143
+
144
+ > **Status**: 🔨 In progress · **Priority**: High · **Created**: 2025-11-01 · **Tags**: api, feature
145
+ ```
146
+
147
+ **Enterprise Template** (adds team fields and tracking):
148
+ ```yaml
149
+ ---
150
+ status: in-progress
151
+ created: 2025-11-01
152
+ tags: [security, compliance]
153
+ priority: critical
154
+ assignee: alice
155
+ reviewer: bob
156
+ issue: JIRA-1234
157
+ epic: security-hardening
158
+ ---
159
+
160
+ # My Feature
161
+
162
+ > **Status**: 🔨 In progress · **Priority**: Critical · **Created**: 2025-11-01 · **Tags**: security, compliance
163
+ > **Assignee**: alice · **Reviewer**: bob
164
+ ```
165
+
166
+ **Key Features**:
167
+ - **Dual Format**: Machine-readable YAML frontmatter + human-readable visual badges
168
+ - **Auto-sync**: Visual badges automatically update when metadata changes
169
+ - **Status Emojis**: 📅 Planned, 🔨 In progress, ✅ Complete, 📦 Archived
170
+
171
+ **Philosophy**: Start minimal. Add fields only when you feel the pain of not having them.
172
+
173
+ **Valid Status Values**: `planned`, `in-progress`, `complete`, `archived`
174
+ **Valid Priority Values**: `low`, `medium`, `high`, `critical`
175
+
176
+ Use `lspec list` with filters to find specs:
177
+ - `lspec list --status=in-progress` - Show active work
178
+ - `lspec list --priority=high` - Focus on critical items
179
+ - `lspec list --tag=api` - Find related specs
180
+ - Combine filters: `lspec list --status=planned --priority=high --tag=api`
181
+
182
+ Update spec metadata without editing files:
183
+ - `lspec update <path> --status=complete` - Mark as done (auto-adds completion date)
184
+ - `lspec update <path> --priority=high --tags=api,backend` - Update multiple fields
185
+
186
+ #### Integrating with Existing Projects
187
+
188
+ If you already have `AGENTS.md`, `.cursorrules`, or other system prompts, `lspec init` will detect them and offer three options:
189
+
190
+ 1. **Merge** - Appends LeanSpec guidance to your existing `AGENTS.md` (preserves your content)
191
+ 2. **Backup** - Saves existing files as `.backup` and creates fresh ones
192
+ 3. **Skip** - Only adds `.lspec` config and `specs/` directory, keeps your files untouched
193
+
194
+ This makes it easy to adopt LeanSpec incrementally without disrupting your existing AI agent setup.
195
+
196
+ ### Available Templates
197
+
198
+ - **solo-dev** - Quick setup for solo developers (default)
199
+ - **team** - Small team collaboration with workflow guides
200
+ - **enterprise** - Enterprise-grade with governance & compliance
201
+ - **api-first** - API-driven development with endpoint specs
202
+
203
+ Run `lspec templates` to see all available templates.
204
+
205
+ See `AGENTS.md` for AI agent integration guidance.
206
+
207
+ ## Development
208
+
209
+ ### Testing
210
+
211
+ ```bash
212
+ pnpm test # Run tests in watch mode
213
+ pnpm test:run # Run tests once (CI mode)
214
+ ```
215
+
216
+ See [docs/testing.md](docs/testing.md) for comprehensive testing documentation.
217
+
218
+ ### Build
219
+
220
+ This project is built with TypeScript and pnpm:
221
+
222
+ ```bash
223
+ # Install dependencies
224
+ pnpm install
225
+
226
+ # Build CLI
227
+ pnpm build
228
+
229
+ # Watch mode
230
+ pnpm dev
231
+
232
+ # Type check
233
+ pnpm typecheck
234
+ ```
235
+
236
+ **Note**: LeanSpec methodology is language/framework-agnostic. This TS implementation is for the CLI tool only.
237
+
238
+ ## When to Use LeanSpec
239
+
240
+ **Perfect for:**
241
+ - New features or components
242
+ - API designs
243
+ - Architecture decisions that need shared understanding
244
+ - Quick alignment on work direction
245
+ - Providing context to AI coding agents for implementation tasks
246
+ - **Establishing an adaptive SOP for AI-powered development teams**
247
+ - **Integrating with system prompts and agent instructions**
248
+
249
+ **Not ideal for:**
250
+ - Detailed API reference documentation (use code comments + auto-generated docs)
251
+ - Step-by-step user manuals (use dedicated user documentation)
252
+ - Compliance requirements that mandate specific formats
253
+
254
+ ## LeanSpec for AI Coding Agents
255
+
256
+ In the era of AI-assisted development, LeanSpec serves as both a methodology and an adaptive workflow for AI-powered development teams. It's not just about writing specs—it's about establishing a living process that integrates with AI agent systems.
257
+
258
+ ### Core Benefits for AI Teams
259
+
260
+ - **Clear Context**: Starting with "why" gives AI agents the purpose behind the work
261
+ - **Concrete Scenarios**: Specific examples help AI understand expected behavior
262
+ - **Testable Criteria**: Clear targets guide AI implementation
263
+ - **Boundaries**: Explicit non-goals help AI avoid scope creep
264
+ - **Adaptable Structure**: Whatever format you choose, consistency helps AI parse effectively
265
+
266
+ AI coding agents work best with clear, concise specifications that balance context with brevity—exactly what the LeanSpec mindset promotes.
267
+
268
+ ### Implementing LeanSpec as an AI Workflow
269
+
270
+ LeanSpec becomes truly powerful when integrated as a **Standard Operating Procedure (SOP)** for your AI-powered development team:
271
+
272
+ #### System Prompts and Context Engineering
273
+
274
+ To effectively use LeanSpec with AI agents, consider implementing:
275
+
276
+ 1. **System-Level Instructions** (e.g., `AGENTS.md`)
277
+ - Define how AI agents should interpret and apply LeanSpec principles
278
+ - Establish coding standards and conventions
279
+ - Specify how to handle ambiguity or missing information
280
+ - Set expectations for testing, documentation, and code quality
281
+
282
+ 2. **Context Engineering**
283
+ - Structure your repository to make LeanSpec documents discoverable
284
+ - Use consistent naming conventions (e.g., `LEANSPEC_*.md`)
285
+ - Place specs near the code they describe
286
+ - Link related specs together for complex features
287
+
288
+ 3. **Adaptive Workflow Integration**
289
+ - Start each work item with a LeanSpec document
290
+ - Have AI agents reference the spec during implementation
291
+ - Update specs as understanding evolves (living documentation)
292
+ - Use specs as the source of truth for feature discussions
293
+
294
+ #### Example: AGENTS.md for LeanSpec Workflow
295
+
296
+ Create an `AGENTS.md` file in your repository to guide AI agents. See this repo's `AGENTS.md` for a working example.
297
+
298
+ ## Philosophy
299
+
300
+ > "The best spec is the one that gets read, understood, and acted upon—by humans and AI alike."
301
+
302
+ LeanSpec is a **mindset, methodology, and adaptive workflow**—not just a format. It embraces agile thinking: start small, iterate based on feedback, and focus on outcomes over outputs. A one-page spec that everyone (including AI coding agents) understands beats a fifty-page document that nobody reads.
303
+
304
+ The methodology is about principles over process—adapt it to your team, your tools, and your context. When working with AI-powered development teams, LeanSpec becomes an SOP that integrates with system prompts, context engineering, and agent instructions to create a cohesive, intelligent workflow.
305
+
306
+ ## Contributing
307
+
308
+ Have ideas for improving LeanSpec? Open an issue or submit a pull request. Keep it lean! 🚀
309
+
310
+ ## License
311
+
312
+ MIT License - See [LICENSE](LICENSE) for details.## Documentation
313
+
314
+ - **[Getting Started](README.md)** - You are here!
315
+ - **[AI Agent Integration](AGENTS.md)** - Setup for AI-powered development
316
+ - **[Contributing](CONTRIBUTING.md)** - How to contribute to LeanSpec
317
+ - **[Developer Guide](docs/)** - Testing and technical docs
318
+
319
+ ## Contributing
320
+
321
+ Have ideas for improving LeanSpec? See [CONTRIBUTING.md](CONTRIBUTING.md) for details. Keep it lean! 🚀
package/bin/lspec.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../dist/cli.js';