@grainulation/wheat 1.0.2 → 1.0.4

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 (42) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +32 -31
  3. package/bin/wheat.js +47 -36
  4. package/compiler/detect-sprints.js +126 -92
  5. package/compiler/generate-manifest.js +116 -69
  6. package/compiler/wheat-compiler.js +789 -468
  7. package/lib/compiler.js +11 -6
  8. package/lib/connect.js +273 -134
  9. package/lib/disconnect.js +61 -40
  10. package/lib/guard.js +20 -17
  11. package/lib/index.js +8 -8
  12. package/lib/init.js +217 -142
  13. package/lib/install-prompt.js +26 -26
  14. package/lib/load-claims.js +88 -0
  15. package/lib/quickstart.js +225 -111
  16. package/lib/serve-mcp.js +495 -180
  17. package/lib/server.js +198 -111
  18. package/lib/stats.js +65 -39
  19. package/lib/status.js +65 -34
  20. package/lib/update.js +13 -11
  21. package/package.json +8 -4
  22. package/templates/claude.md +31 -17
  23. package/templates/commands/blind-spot.md +9 -2
  24. package/templates/commands/brief.md +11 -1
  25. package/templates/commands/calibrate.md +3 -1
  26. package/templates/commands/challenge.md +4 -1
  27. package/templates/commands/connect.md +12 -1
  28. package/templates/commands/evaluate.md +4 -0
  29. package/templates/commands/feedback.md +3 -1
  30. package/templates/commands/handoff.md +11 -7
  31. package/templates/commands/init.md +4 -1
  32. package/templates/commands/merge.md +4 -1
  33. package/templates/commands/next.md +1 -0
  34. package/templates/commands/present.md +3 -0
  35. package/templates/commands/prototype.md +2 -0
  36. package/templates/commands/pull.md +103 -0
  37. package/templates/commands/replay.md +8 -0
  38. package/templates/commands/research.md +1 -0
  39. package/templates/commands/resolve.md +4 -1
  40. package/templates/commands/status.md +4 -0
  41. package/templates/commands/sync.md +94 -0
  42. package/templates/commands/witness.md +6 -2
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Aid Idrizovic
3
+ Copyright (c) 2026 grainulation contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -3,7 +3,8 @@
3
3
  </p>
4
4
 
5
5
  <p align="center">
6
- <a href="https://www.npmjs.com/package/@grainulation/wheat"><img src="https://img.shields.io/npm/v/@grainulation/wheat" alt="npm version"></a> <a href="https://www.npmjs.com/package/@grainulation/wheat"><img src="https://img.shields.io/npm/dm/@grainulation/wheat" alt="npm downloads"></a> <a href="https://github.com/grainulation/wheat/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@grainulation/wheat" alt="license"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/node/v/@grainulation/wheat" alt="node"></a> <a href="https://github.com/grainulation/wheat/actions"><img src="https://github.com/grainulation/wheat/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
6
+ <a href="https://www.npmjs.com/package/@grainulation/wheat"><img src="https://img.shields.io/npm/v/@grainulation/wheat" alt="npm version"></a> <a href="https://www.npmjs.com/package/@grainulation/wheat"><img src="https://img.shields.io/npm/dm/@grainulation/wheat" alt="npm downloads"></a> <a href="https://github.com/grainulation/wheat/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="license"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/node/v/@grainulation/wheat" alt="node"></a> <a href="https://github.com/grainulation/wheat/actions"><img src="https://github.com/grainulation/wheat/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
7
+ <a href="https://deepwiki.com/grainulation/wheat"><img src="https://deepwiki.com/badge.svg" alt="Explore on DeepWiki"></a>
7
8
  </p>
8
9
 
9
10
  <p align="center"><strong>CI/CD for technical decisions.</strong></p>
@@ -76,26 +77,26 @@ The compiler catches conflicts, warns about weak evidence, and blocks the build
76
77
 
77
78
  ## Commands
78
79
 
79
- | Command | What it does |
80
- |---------|-------------|
81
- | `/init` | Bootstrap a new research sprint |
82
- | `/research <topic>` | Deep dive on a topic, creates claims |
83
- | `/prototype` | Build something testable |
84
- | `/challenge <id>` | Adversarial stress-test of a claim |
85
- | `/witness <id> <url>` | External corroboration |
86
- | `/blind-spot` | Find gaps in your investigation |
87
- | `/status` | Sprint dashboard |
88
- | `/brief` | Compile the decision document |
89
- | `/present` | Generate a stakeholder presentation |
90
- | `/feedback` | Incorporate stakeholder input |
91
- | `/resolve` | Adjudicate conflicts between claims |
92
- | `/replay` | Time-travel through sprint history |
93
- | `/calibrate` | Score predictions against actual outcomes |
94
- | `/handoff` | Package sprint for knowledge transfer |
95
- | `/merge <path>` | Combine findings across sprints |
96
- | `/connect <type>` | Link external tools (Jira, docs, etc.) |
97
- | `/evaluate` | Test claims against reality, resolve conflicts |
98
- | `/next` | Route next steps through Farmer (mobile feedback) |
80
+ | Command | What it does |
81
+ | --------------------- | ------------------------------------------------- |
82
+ | `/init` | Bootstrap a new research sprint |
83
+ | `/research <topic>` | Deep dive on a topic, creates claims |
84
+ | `/prototype` | Build something testable |
85
+ | `/challenge <id>` | Adversarial stress-test of a claim |
86
+ | `/witness <id> <url>` | External corroboration |
87
+ | `/blind-spot` | Find gaps in your investigation |
88
+ | `/status` | Sprint dashboard |
89
+ | `/brief` | Compile the decision document |
90
+ | `/present` | Generate a stakeholder presentation |
91
+ | `/feedback` | Incorporate stakeholder input |
92
+ | `/resolve` | Adjudicate conflicts between claims |
93
+ | `/replay` | Time-travel through sprint history |
94
+ | `/calibrate` | Score predictions against actual outcomes |
95
+ | `/handoff` | Package sprint for knowledge transfer |
96
+ | `/merge <path>` | Combine findings across sprints |
97
+ | `/connect <type>` | Link external tools (Jira, docs, etc.) |
98
+ | `/evaluate` | Test claims against reality, resolve conflicts |
99
+ | `/next` | Route next steps through Farmer (mobile feedback) |
99
100
 
100
101
  ## Guard rails
101
102
 
@@ -116,16 +117,16 @@ Node built-in modules only. No npm install waterfall. No supply chain anxiety.
116
117
 
117
118
  ## Part of the grainulation ecosystem
118
119
 
119
- | Tool | Role |
120
- |------|------|
121
- | **wheat** | Research engine -- grow structured evidence |
122
- | [farmer](https://github.com/grainulation/farmer) | Permission dashboard -- approve AI actions in real time (admin + viewer roles) |
123
- | [barn](https://github.com/grainulation/barn) | Shared tools -- templates, validators, sprint detection |
124
- | [mill](https://github.com/grainulation/mill) | Format conversion -- export to PDF, CSV, slides, 24 formats |
125
- | [silo](https://github.com/grainulation/silo) | Knowledge storage -- reusable claim libraries and packs |
126
- | [harvest](https://github.com/grainulation/harvest) | Analytics -- cross-sprint patterns and prediction scoring |
127
- | [orchard](https://github.com/grainulation/orchard) | Orchestration -- multi-sprint coordination and dependencies |
128
- | [grainulation](https://github.com/grainulation/grainulation) | Unified CLI -- single entry point to the ecosystem |
120
+ | Tool | Role |
121
+ | ------------------------------------------------------------ | ------------------------------------------------------------------------------ |
122
+ | **wheat** | Research engine -- grow structured evidence |
123
+ | [farmer](https://github.com/grainulation/farmer) | Permission dashboard -- approve AI actions in real time (admin + viewer roles) |
124
+ | [barn](https://github.com/grainulation/barn) | Shared tools -- templates, validators, sprint detection |
125
+ | [mill](https://github.com/grainulation/mill) | Format conversion -- export to PDF, CSV, slides, 24 formats |
126
+ | [silo](https://github.com/grainulation/silo) | Knowledge storage -- reusable claim libraries and packs |
127
+ | [harvest](https://github.com/grainulation/harvest) | Analytics -- cross-sprint patterns and prediction scoring |
128
+ | [orchard](https://github.com/grainulation/orchard) | Orchestration -- multi-sprint coordination and dependencies |
129
+ | [grainulation](https://github.com/grainulation/grainulation) | Unified CLI -- single entry point to the ecosystem |
129
130
 
130
131
  ## License
131
132
 
package/bin/wheat.js CHANGED
@@ -19,34 +19,40 @@
19
19
  * Zero npm dependencies.
20
20
  */
21
21
 
22
- import path from 'path';
23
- import { readFileSync } from 'fs';
24
- import { fileURLToPath } from 'url';
25
- import { track as trackInstall, maybePrompt as installPrompt } from '../lib/install-prompt.js';
22
+ import path from "path";
23
+ import { readFileSync } from "fs";
24
+ import { fileURLToPath } from "url";
25
+ import {
26
+ track as trackInstall,
27
+ maybePrompt as installPrompt,
28
+ } from "../lib/install-prompt.js";
26
29
 
27
30
  const __filename = fileURLToPath(import.meta.url);
28
31
  const __dirname = path.dirname(__filename);
29
32
 
30
- const VERSION = JSON.parse(readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')).version;
33
+ const VERSION = JSON.parse(
34
+ readFileSync(path.join(__dirname, "..", "package.json"), "utf8")
35
+ ).version;
31
36
 
32
37
  // ─── Parse arguments ─────────────────────────────────────────────────────────
33
38
 
34
- const verbose = process.argv.includes('--verbose');
39
+ const verbose = process.argv.includes("--verbose");
35
40
  function vlog(...a) {
36
41
  if (!verbose) return;
37
42
  const ts = new Date().toISOString();
38
- process.stderr.write(`[${ts}] wheat: ${a.join(' ')}\n`);
43
+ process.stderr.write(`[${ts}] wheat: ${a.join(" ")}\n`);
39
44
  }
40
45
  export { vlog, verbose };
41
46
 
42
47
  const args = process.argv.slice(2);
43
48
  const subcommand = args[0];
44
49
 
45
- vlog('startup', `subcommand=${subcommand || '(none)'}`, `cwd=${process.cwd()}`);
50
+ vlog("startup", `subcommand=${subcommand || "(none)"}`, `cwd=${process.cwd()}`);
46
51
 
47
52
  // Extract --dir or --root flag (applies to all subcommands)
48
53
  let targetDir = process.cwd();
49
- const dirIdx = args.indexOf('--dir') !== -1 ? args.indexOf('--dir') : args.indexOf('--root');
54
+ const dirIdx =
55
+ args.indexOf("--dir") !== -1 ? args.indexOf("--dir") : args.indexOf("--root");
50
56
  if (dirIdx !== -1 && args[dirIdx + 1]) {
51
57
  targetDir = path.resolve(args[dirIdx + 1]);
52
58
  args.splice(dirIdx, 2);
@@ -57,7 +63,7 @@ const subArgs = args.slice(1);
57
63
 
58
64
  // ─── Help / Version ──────────────────────────────────────────────────────────
59
65
 
60
- if (!subcommand || subcommand === '--help' || subcommand === '-h') {
66
+ if (!subcommand || subcommand === "--help" || subcommand === "-h") {
61
67
  console.log(`wheat v${VERSION} — Research-driven development framework
62
68
 
63
69
  Usage:
@@ -94,7 +100,7 @@ Documentation: https://github.com/grainulation/wheat`);
94
100
  process.exit(0);
95
101
  }
96
102
 
97
- if (subcommand === '--version' || subcommand === '-v') {
103
+ if (subcommand === "--version" || subcommand === "-v") {
98
104
  console.log(`wheat v${VERSION}`);
99
105
  process.exit(0);
100
106
  }
@@ -109,28 +115,27 @@ installPrompt(subcommand);
109
115
  // ─── Dispatch ────────────────────────────────────────────────────────────────
110
116
 
111
117
  const commands = {
112
- init: '../lib/init.js',
113
- quickstart: '../lib/quickstart.js',
114
- compile: '../lib/compiler.js',
115
- guard: '../lib/guard.js',
116
- status: '../lib/status.js',
117
- stats: '../lib/stats.js',
118
- update: '../lib/update.js',
119
- serve: '../lib/server.js',
120
- mcp: '../lib/serve-mcp.js',
118
+ init: "../lib/init.js",
119
+ quickstart: "../lib/quickstart.js",
120
+ compile: "../lib/compiler.js",
121
+ guard: "../lib/guard.js",
122
+ status: "../lib/status.js",
123
+ stats: "../lib/stats.js",
124
+ update: "../lib/update.js",
125
+ serve: "../lib/server.js",
126
+ mcp: "../lib/serve-mcp.js",
121
127
  };
122
128
 
123
129
  // ─── wheat migrate (not yet implemented) ────────────────────────────────────
124
- if (subcommand === 'migrate') {
125
- console.error('wheat migrate is not yet available');
130
+ if (subcommand === "migrate") {
131
+ console.error("wheat migrate is not yet available");
126
132
  process.exit(1);
127
133
  }
128
134
 
129
-
130
135
  // Handle "wheat connect <target>" as a compound subcommand
131
- if (subcommand === 'connect') {
136
+ if (subcommand === "connect") {
132
137
  const target = subArgs[0];
133
- if (!target || target === '--help' || target === '-h') {
138
+ if (!target || target === "--help" || target === "-h") {
134
139
  console.log(`wheat connect — Link external tools
135
140
 
136
141
  Usage:
@@ -139,9 +144,11 @@ Usage:
139
144
  Run "wheat connect farmer --help" for options.`);
140
145
  process.exit(0);
141
146
  }
142
- if (target === 'farmer') {
143
- const connectModule = await import(new URL('../lib/connect.js', import.meta.url).href);
144
- await connectModule.run(targetDir, subArgs.slice(1)).catch(err => {
147
+ if (target === "farmer") {
148
+ const connectModule = await import(
149
+ new URL("../lib/connect.js", import.meta.url).href
150
+ );
151
+ await connectModule.run(targetDir, subArgs.slice(1)).catch((err) => {
145
152
  console.error(`\nwheat connect farmer failed:`, err.message);
146
153
  if (process.env.WHEAT_DEBUG) console.error(err.stack);
147
154
  process.exit(1);
@@ -153,9 +160,9 @@ Run "wheat connect farmer --help" for options.`);
153
160
  }
154
161
 
155
162
  // Handle "wheat disconnect <target>" as a compound subcommand
156
- if (subcommand === 'disconnect') {
163
+ if (subcommand === "disconnect") {
157
164
  const target = subArgs[0];
158
- if (!target || target === '--help' || target === '-h') {
165
+ if (!target || target === "--help" || target === "-h") {
159
166
  console.log(`wheat disconnect — Remove external tool hooks
160
167
 
161
168
  Usage:
@@ -164,16 +171,20 @@ Usage:
164
171
  Run "wheat disconnect farmer --help" for options.`);
165
172
  process.exit(0);
166
173
  }
167
- if (target === 'farmer') {
168
- const disconnectModule = await import(new URL('../lib/disconnect.js', import.meta.url).href);
169
- await disconnectModule.run(targetDir, subArgs.slice(1)).catch(err => {
174
+ if (target === "farmer") {
175
+ const disconnectModule = await import(
176
+ new URL("../lib/disconnect.js", import.meta.url).href
177
+ );
178
+ await disconnectModule.run(targetDir, subArgs.slice(1)).catch((err) => {
170
179
  console.error(`\nwheat disconnect farmer failed:`, err.message);
171
180
  if (process.env.WHEAT_DEBUG) console.error(err.stack);
172
181
  process.exit(1);
173
182
  });
174
183
  process.exit(0);
175
184
  }
176
- console.error(`wheat: unknown disconnect target: ${target}\nAvailable: farmer`);
185
+ console.error(
186
+ `wheat: unknown disconnect target: ${target}\nAvailable: farmer`
187
+ );
177
188
  process.exit(1);
178
189
  }
179
190
 
@@ -184,10 +195,10 @@ if (!commands[subcommand]) {
184
195
  }
185
196
 
186
197
  // Load and run the subcommand module
187
- vlog('dispatch', `loading module for "${subcommand}"`);
198
+ vlog("dispatch", `loading module for "${subcommand}"`);
188
199
  const modulePath = new URL(commands[subcommand], import.meta.url).href;
189
200
  const handler = await import(modulePath);
190
- handler.run(targetDir, subArgs).catch(err => {
201
+ handler.run(targetDir, subArgs).catch((err) => {
191
202
  console.error(`\nwheat ${subcommand} failed:`, err.message);
192
203
  if (process.env.WHEAT_DEBUG) console.error(err.stack);
193
204
  process.exit(1);