@jsleekr/graft 6.0.2 → 6.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.
@@ -41,9 +41,9 @@ export function generate(program, report, sourceFile, index, backend) {
41
41
  }
42
42
  }
43
43
  }
44
- // Orchestration
44
+ // Orchestration (separate file — does not overwrite CLAUDE.md)
45
45
  files.push({
46
- path: '.claude/CLAUDE.md',
46
+ path: '.claude/orchestration.md',
47
47
  content: be.generateOrchestration(ctx),
48
48
  });
49
49
  // Settings
package/dist/index.js CHANGED
@@ -182,21 +182,19 @@ graph ${safeName}(input: Input, output: Output, budget: 10k) {
182
182
  }
183
183
  `);
184
184
  }
185
- // Generate or append .claude/CLAUDE.md with .gft spec
185
+ // Generate .claude/ config files
186
186
  const claudeDir = path.join(dir, '.claude');
187
187
  fs.mkdirSync(claudeDir, { recursive: true });
188
188
  const { buildSystemPrompt } = await import('./generator.js');
189
189
  const gftSpec = buildSystemPrompt();
190
+ // Write .gft spec directly into CLAUDE.md (Claude Code only auto-reads CLAUDE.md)
191
+ // graft compile outputs to orchestration.md, so it never overwrites this.
190
192
  const claudeMdPath = path.join(claudeDir, 'CLAUDE.md');
191
193
  const existingClaudeMd = fs.existsSync(claudeMdPath) ? fs.readFileSync(claudeMdPath, 'utf-8') : '';
192
- if (existingClaudeMd && existingClaudeMd.includes('graft compile')) {
193
- console.log(` .claude/CLAUDE.md already contains Graft config — skipped`);
194
- }
195
- else {
196
- const graftSection = `
197
- ## Graft — Multi-Agent Pipelines
194
+ const graftSection = `## Graft — Multi-Agent Pipelines
198
195
 
199
196
  This project uses **Graft** (.gft) for defining multi-agent pipelines.
197
+ **Do NOT manually edit \`.claude/orchestration.md\`, \`.claude/agents/\`, \`.claude/hooks/\`, or \`.claude/settings.json\`** — these are generated by \`graft compile\`.
200
198
 
201
199
  When the user asks to create, modify, or manage pipelines:
202
200
  1. Write or edit \`.gft\` files using the syntax below
@@ -221,17 +219,18 @@ graft watch <file.gft> # Watch and recompile on changes
221
219
  2. Validates output against the .gft schema (types, ranges, empty fields)
222
220
  3. Suggests .gft modifications if quality issues are found
223
221
 
224
- ${gftSpec}
225
- `;
226
- if (existingClaudeMd) {
227
- // Append Graft section to existing CLAUDE.md
228
- fs.writeFileSync(claudeMdPath, existingClaudeMd.trimEnd() + '\n\n' + graftSection.trim() + '\n');
229
- }
230
- else {
231
- // Create new CLAUDE.md with Graft header
232
- fs.writeFileSync(claudeMdPath, `# ${safeName}\n` + graftSection);
233
- }
234
- } // end else (not already configured)
222
+ ${gftSpec}`;
223
+ if (existingClaudeMd && existingClaudeMd.includes('graft compile')) {
224
+ console.log(` .claude/CLAUDE.md already contains Graft config — skipped`);
225
+ }
226
+ else if (existingClaudeMd) {
227
+ // Existing project: append Graft section to existing CLAUDE.md
228
+ fs.writeFileSync(claudeMdPath, existingClaudeMd.trimEnd() + '\n\n' + graftSection.trim() + '\n');
229
+ }
230
+ else {
231
+ // New project: create CLAUDE.md with Graft section
232
+ fs.writeFileSync(claudeMdPath, `# ${safeName}\n\n` + graftSection);
233
+ }
235
234
  if (isExisting) {
236
235
  console.log(`\nGraft added to current project.`);
237
236
  console.log(` .claude/CLAUDE.md — Graft spec injected`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsleekr/graft",
3
- "version": "6.0.2",
3
+ "version": "6.1.1",
4
4
  "description": "Graft compiler — compile .gft graph DSL to Claude Code harness structures",
5
5
  "type": "module",
6
6
  "license": "MIT",