create-baton 1.1.0 → 1.1.2

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
@@ -38,7 +38,7 @@ $ npx create-baton
38
38
  Setting up Baton...
39
39
 
40
40
  ✓ Copied BATON_v3.1.md
41
- ✓ Copied skills/ (8 core + 2 stack + 1 pattern)
41
+ ✓ Copied skills/ (8 core + 6 stack + 7 pattern + 4 domain)
42
42
  ✓ Created .ai-rules/ (4 stub files)
43
43
  ✓ Created handoff/
44
44
  ✓ Created CLAUDE.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-baton",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Set up Baton AI orchestration protocol in any project",
5
5
  "bin": {
6
6
  "create-baton": "./bin/create-baton.js"
package/src/scaffold.js CHANGED
@@ -24,8 +24,8 @@ function scaffold(dest, { tool, stack, projectName }) {
24
24
  copyDir(path.join(skillsSrc, 'core'), path.join(skillsDest, 'core'));
25
25
  copyDir(path.join(skillsSrc, 'patterns'), path.join(skillsDest, 'patterns'));
26
26
 
27
- // Create domains/ (empty, for user to add)
28
- fs.mkdirSync(path.join(skillsDest, 'domains'), { recursive: true });
27
+ // Always copy domains/
28
+ copyDir(path.join(skillsSrc, 'domains'), path.join(skillsDest, 'domains'));
29
29
 
30
30
  // Copy stack-specific skills (each is a directory with SKILL.md)
31
31
  const stackSkills = STACK_MAP[stack] || [];
@@ -44,9 +44,12 @@ function scaffold(dest, { tool, stack, projectName }) {
44
44
  const patternCount = fs.readdirSync(path.join(skillsDest, 'patterns')).filter(
45
45
  f => fs.statSync(path.join(skillsDest, 'patterns', f)).isDirectory()
46
46
  ).length;
47
- results.push(`Copied skills/ (${coreCount} core + ${stackCount} stack + ${patternCount} pattern)`);
47
+ const domainCount = fs.readdirSync(path.join(skillsDest, 'domains')).filter(
48
+ f => fs.statSync(path.join(skillsDest, 'domains', f)).isDirectory()
49
+ ).length;
50
+ results.push(`Copied skills/ (${coreCount} core + ${stackCount} stack + ${patternCount} pattern + ${domainCount} domain)`);
48
51
 
49
- // 3. Create .ai-rules/ with stub files
52
+ // 3. Create .ai-rules/ with stub files (non-destructive)
50
53
  const aiRulesDir = path.join(dest, '.ai-rules');
51
54
  fs.mkdirSync(aiRulesDir, { recursive: true });
52
55
  const stubs = {
@@ -55,10 +58,21 @@ function scaffold(dest, { tool, stack, projectName }) {
55
58
  'patterns.md': `# Patterns & Quirks — ${projectName}\n\n> AI adds entries here as it discovers gotchas and solutions.\n`,
56
59
  'structure.md': `# Project Structure — ${projectName}\n\n> AI will fill this once the project scaffolding is set up.\n`,
57
60
  };
61
+ let createdStubCount = 0;
58
62
  for (const [file, content] of Object.entries(stubs)) {
59
- fs.writeFileSync(path.join(aiRulesDir, file), content);
63
+ const stubPath = path.join(aiRulesDir, file);
64
+ if (fs.existsSync(stubPath)) {
65
+ const altStubFile = getNextBatonFilename(aiRulesDir, file);
66
+ fs.writeFileSync(path.join(aiRulesDir, altStubFile), content);
67
+ results.push(`.ai-rules/${file} exists - created .ai-rules/${altStubFile} (review and merge manually if needed)`);
68
+ } else {
69
+ fs.writeFileSync(stubPath, content);
70
+ createdStubCount += 1;
71
+ }
72
+ }
73
+ if (createdStubCount > 0) {
74
+ results.push(`Created .ai-rules/ (${createdStubCount} stub files)`);
60
75
  }
61
- results.push('Created .ai-rules/ (4 stub files)');
62
76
 
63
77
  // 4. Create handoff/ with .gitkeep
64
78
  const handoffDir = path.join(dest, 'handoff');
@@ -85,8 +99,15 @@ function scaffold(dest, { tool, stack, projectName }) {
85
99
  .replace(/\{\{TYPECHECK_COMMAND\}\}/g, 'npx tsc --noEmit')
86
100
  .replace(/\{\{PROJECT_RULES\}\}/g, '<!-- AI will add project-specific rules here -->');
87
101
 
88
- fs.writeFileSync(path.join(dest, ide.file), templateContent);
89
- results.push(`Created ${ide.file}`);
102
+ const idePath = path.join(dest, ide.file);
103
+ if (fs.existsSync(idePath)) {
104
+ const altIdeFile = getNextBatonFilename(dest, ide.file);
105
+ fs.writeFileSync(path.join(dest, altIdeFile), templateContent);
106
+ results.push(`${ide.file} exists - created ${altIdeFile} (review and merge manually if needed)`);
107
+ } else {
108
+ fs.writeFileSync(idePath, templateContent);
109
+ results.push(`Created ${ide.file}`);
110
+ }
90
111
  } else {
91
112
  // Codex — uses AGENTS.md directly (already generated in step 6)
92
113
  results.push('Using AGENTS.md as IDE config (Codex)');
@@ -94,17 +115,34 @@ function scaffold(dest, { tool, stack, projectName }) {
94
115
 
95
116
  // 6. Generate AGENTS.md (universal standard for AI coding agents)
96
117
  const agentsMd = generateAgentsMd(projectName, stackLabel);
97
- fs.writeFileSync(path.join(dest, 'AGENTS.md'), agentsMd);
98
- results.push('Generated AGENTS.md');
99
-
100
- // 7. Create PROGRESS.md, BACKLOG.md, FEATURES.md
101
- fs.writeFileSync(path.join(dest, 'PROGRESS.md'),
102
- `# Progress — ${projectName}\n\n## Sessions\n\n_No sessions yet. AI will log progress here._\n`);
103
- fs.writeFileSync(path.join(dest, 'BACKLOG.md'),
104
- `# Backlog — ${projectName}\n\n_Deferred items go here. AI adds items during sessions._\n`);
105
- fs.writeFileSync(path.join(dest, 'FEATURES.md'),
106
- `# Features — ${projectName}\n\n_User-facing feature documentation. AI updates this as features ship._\n`);
107
- results.push('Created PROGRESS.md, BACKLOG.md, FEATURES.md');
118
+ const agentsPath = path.join(dest, 'AGENTS.md');
119
+ if (fs.existsSync(agentsPath)) {
120
+ const altAgentsFile = getNextAgentsFilename(dest);
121
+ fs.writeFileSync(path.join(dest, altAgentsFile), agentsMd);
122
+ results.push(`AGENTS.md exists - created ${altAgentsFile} (review and merge manually if needed)`);
123
+ } else {
124
+ fs.writeFileSync(agentsPath, agentsMd);
125
+ results.push('Generated AGENTS.md');
126
+ }
127
+
128
+ // 7. Create PROGRESS.md, BACKLOG.md, FEATURES.md (non-destructive)
129
+ const docsToCreate = {
130
+ 'PROGRESS.md': `# Progress — ${projectName}\n\n## Sessions\n\n_No sessions yet. AI will log progress here._\n`,
131
+ 'BACKLOG.md': `# Backlog — ${projectName}\n\n_Deferred items go here. AI adds items during sessions._\n`,
132
+ 'FEATURES.md': `# Features — ${projectName}\n\n_User-facing feature documentation. AI updates this as features ship._\n`,
133
+ };
134
+
135
+ for (const [file, content] of Object.entries(docsToCreate)) {
136
+ const filePath = path.join(dest, file);
137
+ if (fs.existsSync(filePath)) {
138
+ const altFile = getNextBatonFilename(dest, file);
139
+ fs.writeFileSync(path.join(dest, altFile), content);
140
+ results.push(`${file} exists - created ${altFile} (review and merge manually if needed)`);
141
+ } else {
142
+ fs.writeFileSync(filePath, content);
143
+ results.push(`Created ${file}`);
144
+ }
145
+ }
108
146
 
109
147
  return results;
110
148
  }
@@ -128,9 +166,9 @@ ${stackLine}
128
166
  This project uses the Baton protocol for AI-assisted development.
129
167
 
130
168
  1. Read \`BATON_v3.1.md\` — the orchestration protocol
131
- 2. Read \`.ai-rules/\` — project context files (AI-generated)
132
- 3. Read \`skills/\` — curated best practices for this stack
133
- 4. Check \`handoff/\` session handoff files for continuity
169
+ 2. Read \`.ai-rules/tech-stack.md\` and \`.ai-rules/patterns.md\` condensed project context
170
+ 3. Check \`handoff/\` — session handoff files for continuity
171
+ 4. Use \`skills/\` only for new problem areas not covered in \`.ai-rules/tech-stack.md\`
134
172
 
135
173
  ## Build & Development Commands
136
174
 
@@ -159,6 +197,7 @@ skills/ # Best practice skills
159
197
  core/ # Universal rules
160
198
  stacks/ # Stack-specific patterns
161
199
  patterns/ # Implementation patterns
200
+ domains/ # Domain-specific guidance
162
201
  handoff/ # Session handoff files
163
202
  PROGRESS.md # Session progress log
164
203
  BACKLOG.md # Deferred items
@@ -168,8 +207,9 @@ BACKLOG.md # Deferred items
168
207
 
169
208
  This project follows the Baton protocol. Key rules:
170
209
  - Read BATON_v3.1.md before starting work
171
- - Check skills/ before web searching
172
- - Document discoveries in .ai-rules/patterns.md
210
+ - Check .ai-rules/tech-stack.md first, then .ai-rules/patterns.md
211
+ - Use skills/ only when needed for new problem areas
212
+ - Document discoveries in .ai-rules/patterns.md and keep .ai-rules/tech-stack.md updated
173
213
  - Create handoff files at session end
174
214
  - Update PROGRESS.md after each session
175
215
  `;
@@ -190,4 +230,24 @@ function copyDir(src, dest) {
190
230
  }
191
231
  }
192
232
 
233
+ function getNextAgentsFilename(dest) {
234
+ let index = 2;
235
+ let name = `AGENTS${index}.md`;
236
+ while (fs.existsSync(path.join(dest, name))) {
237
+ index += 1;
238
+ name = `AGENTS${index}.md`;
239
+ }
240
+ return name;
241
+ }
242
+
243
+ function getNextBatonFilename(dest, baseFile) {
244
+ let index = 1;
245
+ let name = `${baseFile}.baton.new`;
246
+ while (fs.existsSync(path.join(dest, name))) {
247
+ index += 1;
248
+ name = `${baseFile}.baton${index}.new`;
249
+ }
250
+ return name;
251
+ }
252
+
193
253
  module.exports = { scaffold };
@@ -184,8 +184,8 @@ Create the appropriate config file for the user's AI tool:
184
184
  | Claude Code | CLAUDE.md |
185
185
  | Cursor | .cursorrules |
186
186
  | Windsurf | .windsurfrules |
187
- | Kiro | .kiro/context.md |
188
- | Warp | .warp/rules/project.md |
187
+ | Kiro | CLAUDE.md |
188
+ | Warp | CLAUDE.md |
189
189
  | Multiple/Other | Create CLAUDE.md as universal fallback |
190
190
 
191
191
  **IDE Config Must Include:**
@@ -458,11 +458,12 @@ You're a technical co-founder, not a contractor. This is OUR product.
458
458
  ## Knowledge Lookup Order
459
459
 
460
460
  When implementing with libraries/APIs:
461
- 1. **Check `patterns.md` FIRST** — it's the project's knowledge cache
462
- 2. **Check `skills/` folder** curated best practices
463
- 3. **If not found**, check installed version and docs
464
- 4. **If still unsure**, conduct web research
465
- 5. **After discovering quirks**, ADD to `patterns.md` at session end
461
+ 1. **Check `.ai-rules/tech-stack.md` FIRST** — condensed technical rules for this project
462
+ 2. **Check `.ai-rules/patterns.md`**project-specific knowledge cache
463
+ 3. **Check `skills/` ONLY if needed** for new problem areas not covered above
464
+ 4. **If not found**, check installed version and docs
465
+ 5. **If still unsure**, conduct web research
466
+ 6. **After discovering quirks**, ADD to `.ai-rules/patterns.md` and update `.ai-rules/tech-stack.md` if you loaded a new skill
466
467
 
467
468
  ---
468
469
 
@@ -566,13 +567,13 @@ This project uses **Baton Protocol** — an AI orchestration system where:
566
567
  2. Follow the session protocol
567
568
  3. End by creating the next handoff
568
569
 
569
- **Current Session:** `handoff/SESSION_[N].md`
570
+ **Current Session:** `handoff/SESSION_{{CURRENT_SESSION}}.md`
570
571
 
571
572
  ## Context Files (Read in Order)
572
573
 
573
574
  | Priority | File | Purpose |
574
575
  |----------|------|---------|
575
- | 1 | `handoff/SESSION_N.md` | Current session tasks |
576
+ | 1 | `handoff/SESSION_{{CURRENT_SESSION}}.md` | Current session tasks |
576
577
  | 2 | `.ai-rules/project.md` | Project decisions & rules |
577
578
  | 3 | `.ai-rules/tech-stack.md` | Stack patterns |
578
579
  | 4 | `.ai-rules/patterns.md` | Discovered quirks |
@@ -581,7 +582,8 @@ This project uses **Baton Protocol** — an AI orchestration system where:
581
582
 
582
583
  ## Skills Library
583
584
 
584
- Check these BEFORE web searching:
585
+ Use `.ai-rules/tech-stack.md` and `.ai-rules/patterns.md` first.
586
+ Check these skill folders only for new problem areas not covered there:
585
587
 
586
588
  - `skills/core/` — Security, testing, production rules
587
589
  - `skills/stacks/` — Tech stack patterns
@@ -592,16 +594,17 @@ Check these BEFORE web searching:
592
594
 
593
595
  1. **Flexible tasks** — Do 1-4 tasks based on size (tiny=4, large=1)
594
596
  2. **Verify before moving on** — Build must pass, feature must work
595
- 3. **Document as you go** — Update structure.md, patterns.md
596
- 4. **Create handoff at end** — Next session file is mandatory
597
- 5. **Ask when unsure** — Never guess on business logic
597
+ 3. **Knowledge order** — Check `.ai-rules/tech-stack.md`, then `.ai-rules/patterns.md`, then `skills/` only if needed
598
+ 4. **Document as you go** — Update structure.md, patterns.md
599
+ 5. **Create handoff at end** — Next session file is mandatory
600
+ 6. **Ask when unsure** — Never guess on business logic
598
601
 
599
602
  ## Session End Checklist
600
603
 
601
604
  - [ ] Build passes
602
605
  - [ ] New features work
603
606
  - [ ] PROGRESS.md updated
604
- - [ ] handoff/SESSION_{N+1}.md created
607
+ - [ ] `handoff/SESSION_{{NEXT_SESSION}}.md` created
605
608
  - [ ] Ask user: "next" or "done"?
606
609
  ```
607
610
 
@@ -613,7 +616,7 @@ Check these BEFORE web searching:
613
616
  This project uses Baton — an AI orchestration system.
614
617
 
615
618
  ## Start Each Session
616
- 1. Read handoff/SESSION_N.md (current session)
619
+ 1. Read handoff/SESSION_{{CURRENT_SESSION}}.md (current session)
617
620
  2. Read .ai-rules/ files for context
618
621
  3. Follow the tasks in the handoff
619
622
 
@@ -626,17 +629,20 @@ This project uses Baton — an AI orchestration system.
626
629
  ## End Each Session
627
630
  - Verify build passes
628
631
  - Update PROGRESS.md
629
- - Create handoff/SESSION_{N+1}.md
632
+ - Create handoff/SESSION_{{NEXT_SESSION}}.md
630
633
  - Ask: "next" or "done"?
631
634
 
632
635
  ## Skills (Check Before Web Search)
636
+ - .ai-rules/tech-stack.md — Condensed technical rules (read first)
637
+ - .ai-rules/patterns.md — Project-specific quirks
633
638
  - skills/core/ — Universal rules
634
- - skills/stacks/ — Tech patterns
635
- - skills/patterns/ — Implementation guides
639
+ - skills/stacks/ — Tech patterns (load only if needed)
640
+ - skills/patterns/ — Implementation guides (load only if needed)
636
641
 
637
642
  ## Key Files
638
- - handoff/SESSION_N.md — Current session
643
+ - handoff/SESSION_{{CURRENT_SESSION}}.md — Current session
639
644
  - .ai-rules/project.md — Decisions
645
+ - .ai-rules/tech-stack.md — Condensed stack + pattern rules
640
646
  - .ai-rules/patterns.md — Quirks discovered
641
647
  - PROGRESS.md — Session log
642
648
  - BACKLOG.md — Deferred work
@@ -645,8 +651,11 @@ This project uses Baton — an AI orchestration system.
645
651
  - Never commit secrets
646
652
  - Always use environment variables
647
653
  - RLS on all database tables
654
+ - Zod validation on all inputs
648
655
  - Verify before declaring done
649
656
  - Document quirks in patterns.md
657
+ - Update tech-stack.md when loading new skills
658
+ - Create handoff before ending session
650
659
  ```
651
660
 
652
661
  ### .windsurfrules (Windsurf)
@@ -694,7 +703,7 @@ Same content as .cursorrules — Windsurf uses similar format.
694
703
  - Update documentation as you go
695
704
  - If unsure about anything, ASK before building
696
705
  - If scope grows, pause and discuss
697
- - Check skills/ and patterns.md before web searching
706
+ - Check `.ai-rules/tech-stack.md` and `.ai-rules/patterns.md` before web searching; use `skills/` only if needed
698
707
 
699
708
  ### Ending a Session
700
709
 
@@ -24,7 +24,7 @@ This project uses **Baton Protocol** — an AI orchestration system where:
24
24
 
25
25
  | Priority | File | Purpose |
26
26
  |----------|------|---------|
27
- | 1 | `handoff/SESSION_N.md` | Current session tasks |
27
+ | 1 | `handoff/SESSION_{{CURRENT_SESSION}}.md` | Current session tasks |
28
28
  | 2 | `.ai-rules/project.md` | Project decisions & rules |
29
29
  | 3 | `.ai-rules/tech-stack.md` | Stack patterns |
30
30
  | 4 | `.ai-rules/patterns.md` | Discovered quirks (check first!) |
@@ -36,7 +36,8 @@ This project uses **Baton Protocol** — an AI orchestration system where:
36
36
 
37
37
  ## Skills Library
38
38
 
39
- **Check these BEFORE web searching:**
39
+ Use `.ai-rules/tech-stack.md` and `.ai-rules/patterns.md` first.
40
+ Check these skill folders only for new problem areas not covered there:
40
41
 
41
42
  | Folder | Contains |
42
43
  |--------|----------|
@@ -66,7 +67,7 @@ This project uses **Baton Protocol** — an AI orchestration system where:
66
67
  1. Build passes
67
68
  2. New features work
68
69
  3. PROGRESS.md updated
69
- 4. handoff/SESSION_{N+1}.md created
70
+ 4. `handoff/SESSION_{{NEXT_SESSION}}.md` created
70
71
  5. Ask: **"next"** or **"done"**?
71
72
 
72
73
  ---
@@ -75,7 +76,7 @@ This project uses **Baton Protocol** — an AI orchestration system where:
75
76
 
76
77
  1. **Verify before moving on** — Build must pass, feature must work
77
78
  2. **Document as you go** — Update structure.md, patterns.md
78
- 3. **Skills before search** — Check skills/ before web research
79
+ 3. **Knowledge order** — Check `.ai-rules/tech-stack.md`, then `.ai-rules/patterns.md`, then `skills/` only if needed
79
80
  4. **Ask when unsure** — Never guess on business logic
80
81
  5. **Handoff is mandatory** — Session isn't done without next handoff
81
82
 
@@ -5,7 +5,7 @@ This project uses Baton — an AI orchestration protocol.
5
5
 
6
6
  ## Start Each Session
7
7
 
8
- 1. Read `handoff/SESSION_N.md` (current session)
8
+ 1. Read `handoff/SESSION_{{CURRENT_SESSION}}.md` (current session)
9
9
  2. Read `.ai-rules/` files for context
10
10
  3. Run health check (build, verify previous work)
11
11
  4. Ask: Any feedback? Blockers?
@@ -23,20 +23,22 @@ This project uses Baton — an AI orchestration protocol.
23
23
 
24
24
  - Verify build passes
25
25
  - Update PROGRESS.md
26
- - Create `handoff/SESSION_{N+1}.md`
26
+ - Create `handoff/SESSION_{{NEXT_SESSION}}.md`
27
27
  - Ask user: **"next"** or **"done"**?
28
28
 
29
29
  ## Skills (Check Before Web Search)
30
30
 
31
- - `skills/core/`Security, testing, production rules
32
- - `skills/stacks/` — {{STACK}} patterns
33
- - `skills/patterns/` — Implementation guides
31
+ - `.ai-rules/tech-stack.md` — Condensed technical rules (read first)
34
32
  - `.ai-rules/patterns.md` — Project-specific quirks
33
+ - `skills/core/` — Security, testing, production rules
34
+ - `skills/stacks/` — {{STACK}} patterns (load only if needed)
35
+ - `skills/patterns/` — Implementation guides (load only if needed)
35
36
 
36
37
  ## Key Files
37
38
 
38
- - `handoff/SESSION_N.md` — Current session tasks
39
+ - `handoff/SESSION_{{CURRENT_SESSION}}.md` — Current session tasks
39
40
  - `.ai-rules/project.md` — Decisions and rules
41
+ - `.ai-rules/tech-stack.md` — Condensed stack + pattern rules
40
42
  - `.ai-rules/patterns.md` — Discovered quirks
41
43
  - `PROGRESS.md` — Session log
42
44
  - `BACKLOG.md` — Deferred work
@@ -49,6 +51,7 @@ This project uses Baton — an AI orchestration protocol.
49
51
  - Zod validation on all inputs
50
52
  - Verify before declaring done
51
53
  - Document quirks in patterns.md
54
+ - Update tech-stack.md when loading new skills
52
55
  - Create handoff before ending session
53
56
 
54
57
  ## Commands
@@ -75,7 +75,7 @@ EXPENSIVE:
75
75
  (Tokens for search + results + processing)
76
76
 
77
77
  CHEAP:
78
- "Read skills/stacks/nextjs.md"
78
+ "Read skills/stacks/nextjs/SKILL.md"
79
79
  (Just file read, minimal tokens)
80
80
  ```
81
81