create-baton 1.1.0 → 1.1.1

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.1",
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,7 +44,10 @@ 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
52
  // 3. Create .ai-rules/ with stub files
50
53
  const aiRulesDir = path.join(dest, '.ai-rules');
@@ -85,8 +88,15 @@ function scaffold(dest, { tool, stack, projectName }) {
85
88
  .replace(/\{\{TYPECHECK_COMMAND\}\}/g, 'npx tsc --noEmit')
86
89
  .replace(/\{\{PROJECT_RULES\}\}/g, '<!-- AI will add project-specific rules here -->');
87
90
 
88
- fs.writeFileSync(path.join(dest, ide.file), templateContent);
89
- results.push(`Created ${ide.file}`);
91
+ const idePath = path.join(dest, ide.file);
92
+ if (fs.existsSync(idePath)) {
93
+ const altIdeFile = getNextBatonFilename(dest, ide.file);
94
+ fs.writeFileSync(path.join(dest, altIdeFile), templateContent);
95
+ results.push(`${ide.file} exists - created ${altIdeFile} (review and merge manually if needed)`);
96
+ } else {
97
+ fs.writeFileSync(idePath, templateContent);
98
+ results.push(`Created ${ide.file}`);
99
+ }
90
100
  } else {
91
101
  // Codex — uses AGENTS.md directly (already generated in step 6)
92
102
  results.push('Using AGENTS.md as IDE config (Codex)');
@@ -94,17 +104,34 @@ function scaffold(dest, { tool, stack, projectName }) {
94
104
 
95
105
  // 6. Generate AGENTS.md (universal standard for AI coding agents)
96
106
  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');
107
+ const agentsPath = path.join(dest, 'AGENTS.md');
108
+ if (fs.existsSync(agentsPath)) {
109
+ const altAgentsFile = getNextAgentsFilename(dest);
110
+ fs.writeFileSync(path.join(dest, altAgentsFile), agentsMd);
111
+ results.push(`AGENTS.md exists - created ${altAgentsFile} (review and merge manually if needed)`);
112
+ } else {
113
+ fs.writeFileSync(agentsPath, agentsMd);
114
+ results.push('Generated AGENTS.md');
115
+ }
116
+
117
+ // 7. Create PROGRESS.md, BACKLOG.md, FEATURES.md (non-destructive)
118
+ const docsToCreate = {
119
+ 'PROGRESS.md': `# Progress — ${projectName}\n\n## Sessions\n\n_No sessions yet. AI will log progress here._\n`,
120
+ 'BACKLOG.md': `# Backlog — ${projectName}\n\n_Deferred items go here. AI adds items during sessions._\n`,
121
+ 'FEATURES.md': `# Features — ${projectName}\n\n_User-facing feature documentation. AI updates this as features ship._\n`,
122
+ };
123
+
124
+ for (const [file, content] of Object.entries(docsToCreate)) {
125
+ const filePath = path.join(dest, file);
126
+ if (fs.existsSync(filePath)) {
127
+ const altFile = getNextBatonFilename(dest, file);
128
+ fs.writeFileSync(path.join(dest, altFile), content);
129
+ results.push(`${file} exists - created ${altFile} (review and merge manually if needed)`);
130
+ } else {
131
+ fs.writeFileSync(filePath, content);
132
+ results.push(`Created ${file}`);
133
+ }
134
+ }
108
135
 
109
136
  return results;
110
137
  }
@@ -190,4 +217,24 @@ function copyDir(src, dest) {
190
217
  }
191
218
  }
192
219
 
220
+ function getNextAgentsFilename(dest) {
221
+ let index = 2;
222
+ let name = `AGENTS${index}.md`;
223
+ while (fs.existsSync(path.join(dest, name))) {
224
+ index += 1;
225
+ name = `AGENTS${index}.md`;
226
+ }
227
+ return name;
228
+ }
229
+
230
+ function getNextBatonFilename(dest, baseFile) {
231
+ let index = 1;
232
+ let name = `${baseFile}.baton.new`;
233
+ while (fs.existsSync(path.join(dest, name))) {
234
+ index += 1;
235
+ name = `${baseFile}.baton${index}.new`;
236
+ }
237
+ return name;
238
+ }
239
+
193
240
  module.exports = { scaffold };
@@ -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
 
@@ -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!) |
@@ -66,7 +66,7 @@ This project uses **Baton Protocol** — an AI orchestration system where:
66
66
  1. Build passes
67
67
  2. New features work
68
68
  3. PROGRESS.md updated
69
- 4. handoff/SESSION_{N+1}.md created
69
+ 4. `handoff/SESSION_{{NEXT_SESSION}}.md` created
70
70
  5. Ask: **"next"** or **"done"**?
71
71
 
72
72
  ---
@@ -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,7 +23,7 @@ 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)
@@ -35,7 +35,7 @@ This project uses Baton — an AI orchestration protocol.
35
35
 
36
36
  ## Key Files
37
37
 
38
- - `handoff/SESSION_N.md` — Current session tasks
38
+ - `handoff/SESSION_{{CURRENT_SESSION}}.md` — Current session tasks
39
39
  - `.ai-rules/project.md` — Decisions and rules
40
40
  - `.ai-rules/patterns.md` — Discovered quirks
41
41
  - `PROGRESS.md` — Session log
@@ -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