@grainulation/wheat 1.0.9 → 1.0.10

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
@@ -39,11 +39,13 @@ Works with [Claude Code](https://claude.com/claude-code), [Cursor](https://curso
39
39
  For native tool access in Claude Code:
40
40
 
41
41
  ```bash
42
- claude mcp add wheat -- npx -y @grainulation/wheat mcp
42
+ claude mcp add wheat -- npx -y @grainulation/wheat-mcp
43
43
  ```
44
44
 
45
45
  This gives Claude direct access to wheat's claims engine — add-claim, compile, search, status — without shelling out.
46
46
 
47
+ > **Note:** `wheat mcp` still works as a subcommand, but the dedicated `wheat-mcp` entry point is recommended for MCP integrations — it bypasses CLI dispatch and starts the server directly.
48
+
47
49
  ## See it in 30 seconds
48
50
 
49
51
  ```bash
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * wheat-mcp (CJS) — Dedicated MCP server entry point
4
+ *
5
+ * CJS wrapper that dynamically imports the ESM serve-mcp module.
6
+ * Claude Code's plugin transport reliably keeps CJS-spawned processes
7
+ * alive but drops ESM processes. This file bridges the gap.
8
+ */
9
+
10
+ const dirIdx = process.argv.indexOf("--dir");
11
+ const dir = dirIdx !== -1 && process.argv[dirIdx + 1]
12
+ ? process.argv[dirIdx + 1]
13
+ : process.cwd();
14
+
15
+ // Dynamic import of ESM module from CJS
16
+ import("../lib/serve-mcp.js").then((mod) => {
17
+ mod.startServer(dir);
18
+ });
package/lib/init.js CHANGED
@@ -577,10 +577,24 @@ export async function run(dir, args) {
577
577
  fs.renameSync(tmpClaims, claimsPath);
578
578
  console.log(" \x1b[32m+\x1b[0m claims.json");
579
579
 
580
- // CLAUDE.md
580
+ // CLAUDE.md (preserve existing content unless --force)
581
581
  const claudePath = target(dir, "CLAUDE.md");
582
- fs.writeFileSync(claudePath, claudeMd);
583
- console.log(" \x1b[32m+\x1b[0m CLAUDE.md");
582
+ const claudeExists = fs.existsSync(claudePath);
583
+ if (claudeExists && flags.force) {
584
+ // --force with existing file: back up before overwriting
585
+ fs.copyFileSync(claudePath, claudePath + ".bak");
586
+ fs.writeFileSync(claudePath, claudeMd);
587
+ console.log(" \x1b[32m+\x1b[0m CLAUDE.md (backed up existing to CLAUDE.md.bak)");
588
+ } else if (claudeExists) {
589
+ // Existing file, no --force: append wheat section with separator
590
+ const existing = fs.readFileSync(claudePath, "utf8");
591
+ fs.writeFileSync(claudePath, existing + "\n\n---\n\n" + claudeMd);
592
+ console.log(" \x1b[32m+\x1b[0m CLAUDE.md (appended wheat sprint section)");
593
+ } else {
594
+ // No existing file: write normally
595
+ fs.writeFileSync(claudePath, claudeMd);
596
+ console.log(" \x1b[32m+\x1b[0m CLAUDE.md");
597
+ }
584
598
 
585
599
  // .claude/commands/wheat/
586
600
  const copied = copyCommands(dir);
package/lib/serve-mcp.js CHANGED
@@ -22,7 +22,10 @@
22
22
  *
23
23
  * Protocol: MCP over stdio (JSON-RPC 2.0, newline-delimited)
24
24
  *
25
- * Install:
25
+ * Install (recommended):
26
+ * claude mcp add wheat -- npx @grainulation/wheat-mcp
27
+ *
28
+ * Legacy (still works, but routes through CLI dispatch):
26
29
  * claude mcp add wheat -- npx @grainulation/wheat mcp
27
30
  *
28
31
  * Zero npm dependencies.
@@ -850,10 +853,11 @@ export async function run(dir, args) {
850
853
  console.log(`wheat mcp -- Local MCP server for Claude Code
851
854
 
852
855
  Usage:
853
- wheat mcp [--dir <path>]
856
+ wheat-mcp [--dir <path>] (recommended)
857
+ wheat mcp [--dir <path>] (legacy, still works)
854
858
 
855
859
  Install in Claude Code:
856
- claude mcp add wheat -- npx @grainulation/wheat mcp
860
+ claude mcp add wheat -- npx @grainulation/wheat-mcp
857
861
 
858
862
  Tools exposed:
859
863
  wheat/compile Run the compiler
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grainulation/wheat",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Research-driven development framework — structured claims, compiled evidence, deterministic output",
5
5
  "license": "MIT",
6
6
  "author": "grainulation contributors",
@@ -47,7 +47,7 @@
47
47
  "templates/"
48
48
  ],
49
49
  "scripts": {
50
- "test": "node --test test/cli.test.js test/compiler.test.js test/guard.test.js test/init.test.js test/migration.test.js"
50
+ "test": "node --test test/cli.test.js test/compiler.test.js test/guard.test.js test/init.test.js test/migration.test.js test/mcp.test.js"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=20"