@jsleekr/graft 6.1.0 → 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.
Files changed (2) hide show
  1. package/dist/index.js +13 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -187,17 +187,14 @@ graph ${safeName}(input: Input, output: Output, budget: 10k) {
187
187
  fs.mkdirSync(claudeDir, { recursive: true });
188
188
  const { buildSystemPrompt } = await import('./generator.js');
189
189
  const gftSpec = buildSystemPrompt();
190
- // 1. Write .gft spec to a separate file (never overwritten by compile)
191
- const specPath = path.join(claudeDir, 'graft-spec.md');
192
- const specContent = `# Graft — .gft Language Reference
193
-
194
- > Auto-generated by \`graft init\`. This file is the .gft syntax reference
195
- > that Claude Code reads to understand the Graft language.
196
- > Do NOT delete this file — \`graft compile\` does not touch it.
197
-
198
- ## Graft — Multi-Agent Pipelines
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.
192
+ const claudeMdPath = path.join(claudeDir, 'CLAUDE.md');
193
+ const existingClaudeMd = fs.existsSync(claudeMdPath) ? fs.readFileSync(claudeMdPath, 'utf-8') : '';
194
+ const graftSection = `## Graft Multi-Agent Pipelines
199
195
 
200
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\`.
201
198
 
202
199
  When the user asks to create, modify, or manage pipelines:
203
200
  1. Write or edit \`.gft\` files using the syntax below
@@ -222,23 +219,17 @@ graft watch <file.gft> # Watch and recompile on changes
222
219
  2. Validates output against the .gft schema (types, ranges, empty fields)
223
220
  3. Suggests .gft modifications if quality issues are found
224
221
 
225
- ${gftSpec}
226
- `;
227
- fs.writeFileSync(specPath, specContent);
228
- // 2. Add Graft reference to CLAUDE.md (short pointer, not the full spec)
229
- const claudeMdPath = path.join(claudeDir, 'CLAUDE.md');
230
- const existingClaudeMd = fs.existsSync(claudeMdPath) ? fs.readFileSync(claudeMdPath, 'utf-8') : '';
231
- const graftReference = `## Graft
232
-
233
- This project uses Graft for multi-agent pipelines. Read \`.claude/graft-spec.md\` for the full .gft syntax reference. Run \`graft compile <file.gft>\` to generate harness files.`;
234
- if (existingClaudeMd && existingClaudeMd.includes('graft-spec.md')) {
235
- console.log(` .claude/CLAUDE.md already references Graft — skipped`);
222
+ ${gftSpec}`;
223
+ if (existingClaudeMd && existingClaudeMd.includes('graft compile')) {
224
+ console.log(` .claude/CLAUDE.md already contains Graft config — skipped`);
236
225
  }
237
226
  else if (existingClaudeMd) {
238
- fs.writeFileSync(claudeMdPath, existingClaudeMd.trimEnd() + '\n\n' + graftReference + '\n');
227
+ // Existing project: append Graft section to existing CLAUDE.md
228
+ fs.writeFileSync(claudeMdPath, existingClaudeMd.trimEnd() + '\n\n' + graftSection.trim() + '\n');
239
229
  }
240
230
  else {
241
- fs.writeFileSync(claudeMdPath, `# ${safeName}\n\n` + graftReference + '\n');
231
+ // New project: create CLAUDE.md with Graft section
232
+ fs.writeFileSync(claudeMdPath, `# ${safeName}\n\n` + graftSection);
242
233
  }
243
234
  if (isExisting) {
244
235
  console.log(`\nGraft added to current project.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsleekr/graft",
3
- "version": "6.1.0",
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",