@grainulation/wheat 1.0.9 → 1.0.11
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 +3 -1
- package/bin/wheat-mcp.cjs +18 -0
- package/compiler/wheat-compiler.js +2 -0
- package/lib/init.js +22 -3
- package/lib/serve-mcp.js +16 -3
- package/package.json +2 -2
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
|
|
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
|
+
});
|
|
@@ -836,7 +836,9 @@ function compile(inputPath, outputPath, dir, opts = {}) {
|
|
|
836
836
|
id: c.id,
|
|
837
837
|
type: c.type,
|
|
838
838
|
topic: c.topic,
|
|
839
|
+
content: c.content,
|
|
839
840
|
evidence: c.evidence,
|
|
841
|
+
confidence: c.confidence,
|
|
840
842
|
status: c.status,
|
|
841
843
|
phase_added: c.phase_added,
|
|
842
844
|
source: c.source,
|
package/lib/init.js
CHANGED
|
@@ -341,6 +341,11 @@ fi
|
|
|
341
341
|
// ─── .mcp.json & AGENTS.md ──────────────────────────────────────────────────
|
|
342
342
|
|
|
343
343
|
function writeMcpJson(dir) {
|
|
344
|
+
if (process.env.CLAUDE_PLUGIN_ROOT) {
|
|
345
|
+
console.log(" - .mcp.json (skipped — plugin provides MCP servers)");
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
|
|
344
349
|
const mcpPath = target(dir, ".mcp.json");
|
|
345
350
|
const wheatEntry = {
|
|
346
351
|
command: "npx",
|
|
@@ -577,10 +582,24 @@ export async function run(dir, args) {
|
|
|
577
582
|
fs.renameSync(tmpClaims, claimsPath);
|
|
578
583
|
console.log(" \x1b[32m+\x1b[0m claims.json");
|
|
579
584
|
|
|
580
|
-
// CLAUDE.md
|
|
585
|
+
// CLAUDE.md (preserve existing content unless --force)
|
|
581
586
|
const claudePath = target(dir, "CLAUDE.md");
|
|
582
|
-
fs.
|
|
583
|
-
|
|
587
|
+
const claudeExists = fs.existsSync(claudePath);
|
|
588
|
+
if (claudeExists && flags.force) {
|
|
589
|
+
// --force with existing file: back up before overwriting
|
|
590
|
+
fs.copyFileSync(claudePath, claudePath + ".bak");
|
|
591
|
+
fs.writeFileSync(claudePath, claudeMd);
|
|
592
|
+
console.log(" \x1b[32m+\x1b[0m CLAUDE.md (backed up existing to CLAUDE.md.bak)");
|
|
593
|
+
} else if (claudeExists) {
|
|
594
|
+
// Existing file, no --force: append wheat section with separator
|
|
595
|
+
const existing = fs.readFileSync(claudePath, "utf8");
|
|
596
|
+
fs.writeFileSync(claudePath, existing + "\n\n---\n\n" + claudeMd);
|
|
597
|
+
console.log(" \x1b[32m+\x1b[0m CLAUDE.md (appended wheat sprint section)");
|
|
598
|
+
} else {
|
|
599
|
+
// No existing file: write normally
|
|
600
|
+
fs.writeFileSync(claudePath, claudeMd);
|
|
601
|
+
console.log(" \x1b[32m+\x1b[0m CLAUDE.md");
|
|
602
|
+
}
|
|
584
603
|
|
|
585
604
|
// .claude/commands/wheat/
|
|
586
605
|
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.
|
|
@@ -218,6 +221,15 @@ function toolResolve(dir, args) {
|
|
|
218
221
|
if (!loserClaim)
|
|
219
222
|
return { status: "error", message: `Claim "${loser}" not found.` };
|
|
220
223
|
|
|
224
|
+
const winnerConflicts = winnerClaim.conflicts_with || [];
|
|
225
|
+
const loserConflicts = loserClaim.conflicts_with || [];
|
|
226
|
+
if (!winnerConflicts.includes(loser) && !loserConflicts.includes(winner)) {
|
|
227
|
+
return {
|
|
228
|
+
status: "error",
|
|
229
|
+
message: `Cannot resolve: "${winner}" and "${loser}" have no conflicts_with relationship.`,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
221
233
|
// Clear conflict references
|
|
222
234
|
winnerClaim.conflicts_with = (winnerClaim.conflicts_with || []).filter(
|
|
223
235
|
(cid) => cid !== loser
|
|
@@ -850,10 +862,11 @@ export async function run(dir, args) {
|
|
|
850
862
|
console.log(`wheat mcp -- Local MCP server for Claude Code
|
|
851
863
|
|
|
852
864
|
Usage:
|
|
853
|
-
wheat
|
|
865
|
+
wheat-mcp [--dir <path>] (recommended)
|
|
866
|
+
wheat mcp [--dir <path>] (legacy, still works)
|
|
854
867
|
|
|
855
868
|
Install in Claude Code:
|
|
856
|
-
claude mcp add wheat -- npx @grainulation/wheat
|
|
869
|
+
claude mcp add wheat -- npx @grainulation/wheat-mcp
|
|
857
870
|
|
|
858
871
|
Tools exposed:
|
|
859
872
|
wheat/compile Run the compiler
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grainulation/wheat",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
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"
|