tdd-claude-code 0.2.0 → 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 CHANGED
@@ -27,7 +27,9 @@ npx tdd-claude-code --local # this project only
27
27
  You use `/tdd:*` commands for everything. Never touch `/gsd:*` directly.
28
28
 
29
29
  ```
30
- /tdd:new-project Describe your idea, get test infrastructure
30
+ /tdd:new-project New project from scratch
31
+ OR
32
+ /tdd:init Add TDD to existing codebase
31
33
 
32
34
  /tdd:discuss 1 Shape how phase 1 gets built
33
35
  /tdd:plan 1 Create task plans
@@ -55,6 +57,7 @@ You run one command. Tests get written before code. Automatically.
55
57
  | Command | What It Does |
56
58
  |---------|--------------|
57
59
  | `/tdd:new-project` | Start project with test infrastructure |
60
+ | `/tdd:init` | Add TDD to existing codebase |
58
61
  | `/tdd:discuss [N]` | Capture implementation preferences |
59
62
  | `/tdd:plan [N]` | Create task plans |
60
63
  | `/tdd:build <N>` | **Write tests → implement → verify** |
package/bin/install.js CHANGED
@@ -26,10 +26,11 @@ ${c.cyan} ████████╗██████╗ ██████
26
26
  ╚═╝ ╚═════╝ ╚═════╝${c.reset}
27
27
  `;
28
28
 
29
- const VERSION = '0.2.0';
29
+ const VERSION = '0.3.0';
30
30
 
31
31
  const COMMANDS = [
32
32
  'new-project.md',
33
+ 'init.md',
33
34
  'discuss.md',
34
35
  'plan.md',
35
36
  'build.md',
package/help.md CHANGED
@@ -4,11 +4,17 @@ TDD-first workflow powered by GSD. You use `/tdd:*` for everything — tests hap
4
4
 
5
5
  ## Commands
6
6
 
7
- ### Core Workflow
7
+ ### Getting Started
8
8
 
9
9
  | Command | What It Does |
10
10
  |---------|--------------|
11
11
  | `/tdd:new-project` | Start new project with test infrastructure |
12
+ | `/tdd:init` | Add TDD to existing codebase |
13
+
14
+ ### Core Workflow
15
+
16
+ | Command | What It Does |
17
+ |---------|--------------|
12
18
  | `/tdd:discuss [N]` | Capture implementation preferences for phase N |
13
19
  | `/tdd:plan [N]` | Research and create task plans for phase N |
14
20
  | `/tdd:build <N>` | **Write tests → implement → verify tests pass** |
@@ -38,7 +44,9 @@ TDD-first workflow powered by GSD. You use `/tdd:*` for everything — tests hap
38
44
  ## Workflow
39
45
 
40
46
  ```
41
- /tdd:new-project Describe your idea, set up project + tests
47
+ /tdd:new-project New project from scratch
48
+ OR
49
+ /tdd:init Existing codebase
42
50
 
43
51
  /tdd:discuss 1 Shape how phase 1 gets built
44
52
  /tdd:plan 1 Create task plans
@@ -81,6 +89,7 @@ TDD commands call GSD internally:
81
89
  | TDD Command | Calls |
82
90
  |-------------|-------|
83
91
  | `/tdd:new-project` | `/gsd:new-project` + test setup |
92
+ | `/tdd:init` | scan + test setup (no GSD call) |
84
93
  | `/tdd:discuss` | `/gsd:discuss-phase` |
85
94
  | `/tdd:plan` | `/gsd:plan-phase` |
86
95
  | `/tdd:build` | write tests + `/gsd:execute-phase` |
package/init.md ADDED
@@ -0,0 +1,147 @@
1
+ # /tdd:init - Initialize TDD in Existing Project
2
+
3
+ Add TDD workflow to an existing codebase.
4
+
5
+ ## When to Use
6
+
7
+ - You have existing code without tests
8
+ - You have existing code with some tests
9
+ - You're joining a project mid-development
10
+ - You want to adopt TDD on a "vibe coded" project
11
+
12
+ For brand new projects with no code, use `/tdd:new-project` instead.
13
+
14
+ ## Process
15
+
16
+ ### 1. Scan for Existing Code
17
+
18
+ Check for source files:
19
+ - `src/`, `lib/`, `app/`, `pkg/`, or root-level code files
20
+ - `package.json`, `pyproject.toml`, `go.mod`, `Gemfile`, `Cargo.toml`
21
+
22
+ If no code found, suggest running `/tdd:new-project` instead.
23
+
24
+ ### 2. Detect Stack
25
+
26
+ | Indicator | Stack |
27
+ |-----------|-------|
28
+ | `package.json` + React/Next deps | Next.js / React |
29
+ | `package.json` (no framework) | Node.js |
30
+ | `pyproject.toml` / `requirements.txt` | Python |
31
+ | `go.mod` | Go |
32
+ | `Gemfile` | Ruby |
33
+ | `Cargo.toml` | Rust |
34
+
35
+ ### 3. Scan for Existing Tests
36
+
37
+ Look for test indicators:
38
+
39
+ **Directories:**
40
+ - `tests/`, `test/`, `__tests__/`, `spec/`
41
+
42
+ **Files:**
43
+ - `*_test.py`, `test_*.py`
44
+ - `*.test.ts`, `*.test.js`, `*.spec.ts`, `*.spec.js`
45
+ - `*_test.go`
46
+ - `*_spec.rb`
47
+
48
+ **Config files:**
49
+ - `vitest.config.*`, `jest.config.*`, `pytest.ini`, `pyproject.toml` [tool.pytest]
50
+ - `.rspec`, `spec/spec_helper.rb`
51
+
52
+ ### 4. Set Up Test Framework (if missing)
53
+
54
+ If no tests found, set up based on detected stack:
55
+
56
+ | Stack | Framework | Setup |
57
+ |-------|-----------|-------|
58
+ | Next.js / React | Vitest | `npm install -D vitest @testing-library/react` |
59
+ | Node.js | Vitest | `npm install -D vitest` |
60
+ | Python | pytest | `pip install pytest` or add to pyproject.toml |
61
+ | Go | go test | Built-in, no setup needed |
62
+ | Ruby | RSpec | `gem install rspec && rspec --init` |
63
+ | Rust | cargo test | Built-in, no setup needed |
64
+
65
+ Create config file and test directory structure.
66
+
67
+ Add test scripts to package.json / pyproject.toml / Makefile:
68
+ ```json
69
+ "scripts": {
70
+ "test": "vitest run",
71
+ "test:watch": "vitest"
72
+ }
73
+ ```
74
+
75
+ ### 5. If Tests Already Exist
76
+
77
+ - Skip framework setup
78
+ - Note existing test patterns for consistency
79
+ - Report: "Found existing test framework: [vitest/jest/pytest/etc]"
80
+ - Report: "Found X existing test files"
81
+
82
+ ### 6. Analyze Existing Code Structure
83
+
84
+ Scan the codebase and generate summary:
85
+ - Main directories and their purpose
86
+ - Key modules/components identified
87
+ - Entry points (main files, API routes, etc.)
88
+ - Dependencies and their roles
89
+
90
+ ### 7. Create or Update PROJECT.md
91
+
92
+ If PROJECT.md doesn't exist, create it with:
93
+
94
+ ```markdown
95
+ # [Project Name]
96
+
97
+ ## Overview
98
+ [Inferred from code structure and README if present]
99
+
100
+ ## Tech Stack
101
+ - [Detected stack]
102
+ - [Key dependencies]
103
+
104
+ ## Project Structure
105
+ [Generated from scan]
106
+
107
+ ## Development Methodology: Test-Led Development
108
+
109
+ This project uses TDD. All new implementation follows Red -> Green -> Refactor:
110
+
111
+ 1. **Red**: Write failing tests that define expected behavior
112
+ 2. **Green**: Write minimum code to make tests pass
113
+ 3. **Refactor**: Clean up while keeping tests green
114
+
115
+ Tests are written BEFORE implementation, not after.
116
+
117
+ ## Test Framework
118
+ - Framework: [detected or installed]
119
+ - Run tests: `[test command]`
120
+ - Test directory: `[path]`
121
+ ```
122
+
123
+ If PROJECT.md exists, append the TDD section only.
124
+
125
+ ### 8. Report Summary
126
+
127
+ ```
128
+ TDD initialized for [project name]
129
+
130
+ Stack: [detected]
131
+ Test framework: [framework] (existing/newly configured)
132
+ Test directory: [path]
133
+ Existing tests: [count] files
134
+
135
+ Next steps:
136
+ - Run /tdd:status to check current test coverage
137
+ - Run /tdd:discuss to plan new features with TDD
138
+ - Run /tdd:quick for ad-hoc tasks with tests
139
+ ```
140
+
141
+ ## Usage
142
+
143
+ ```
144
+ /tdd:init
145
+ ```
146
+
147
+ No arguments needed. Auto-detects everything.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tdd-claude-code",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "TDD workflow for Claude Code - wraps GSD",
5
5
  "bin": {
6
6
  "tdd-claude-code": "./bin/install.js"