@grainulation/wheat 1.0.3 → 1.0.5

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 (43) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +32 -31
  3. package/bin/wheat.js +63 -40
  4. package/compiler/detect-sprints.js +108 -66
  5. package/compiler/generate-manifest.js +116 -69
  6. package/compiler/wheat-compiler.js +763 -471
  7. package/lib/compiler.js +11 -6
  8. package/lib/connect.js +273 -134
  9. package/lib/defaults.js +32 -0
  10. package/lib/disconnect.js +61 -40
  11. package/lib/guard.js +20 -17
  12. package/lib/index.js +8 -8
  13. package/lib/init.js +260 -142
  14. package/lib/install-prompt.js +26 -26
  15. package/lib/load-claims.js +88 -0
  16. package/lib/quickstart.js +225 -111
  17. package/lib/serve-mcp.js +495 -180
  18. package/lib/server.js +198 -111
  19. package/lib/stats.js +65 -39
  20. package/lib/status.js +65 -34
  21. package/lib/update.js +13 -11
  22. package/package.json +8 -4
  23. package/templates/claude.md +31 -17
  24. package/templates/commands/blind-spot.md +9 -2
  25. package/templates/commands/brief.md +11 -1
  26. package/templates/commands/calibrate.md +3 -1
  27. package/templates/commands/challenge.md +4 -1
  28. package/templates/commands/connect.md +12 -1
  29. package/templates/commands/evaluate.md +4 -0
  30. package/templates/commands/feedback.md +3 -1
  31. package/templates/commands/handoff.md +11 -7
  32. package/templates/commands/init.md +4 -1
  33. package/templates/commands/merge.md +4 -1
  34. package/templates/commands/next.md +1 -0
  35. package/templates/commands/present.md +3 -0
  36. package/templates/commands/prototype.md +2 -0
  37. package/templates/commands/pull.md +103 -0
  38. package/templates/commands/replay.md +8 -0
  39. package/templates/commands/research.md +1 -0
  40. package/templates/commands/resolve.md +4 -1
  41. package/templates/commands/status.md +4 -0
  42. package/templates/commands/sync.md +94 -0
  43. package/templates/commands/witness.md +6 -2
@@ -0,0 +1,94 @@
1
+ # /sync — Publish sprint artifacts to external platforms
2
+
3
+ You are publishing the current Wheat sprint's artifacts to external platforms. Read CLAUDE.md for sprint context and claims.json for the current state.
4
+
5
+ ## Process
6
+
7
+ 1. **Compile first**: Run `wheat compile --summary` to ensure compilation is fresh. If compilation is blocked, stop and tell the user to fix issues first.
8
+
9
+ 2. **Detect available targets**: Check which MCP servers are available:
10
+
11
+ - **Confluence** (via Atlassian MCP): Push the compiled brief as a Confluence page. Use `mcp__atlassian__confluence_create_page` or `mcp__atlassian__confluence_update_page`.
12
+ - **Slack** (via Slack MCP): Post a sprint summary to a channel. Use `mcp__slack__send_message`.
13
+ - **Notion** (via Notion MCP): Create a page with the brief content.
14
+ - **Local file export**: Always available — write to `output/` directory.
15
+
16
+ 3. **Confluence publish** (primary target):
17
+
18
+ - Read `compilation.json` for the certified output
19
+ - Read `output/brief.html` if it exists, otherwise generate the brief first via `/brief`
20
+ - Convert the brief to Confluence Storage Format (XHTML subset):
21
+ - Strip `<script>` and `<style>` tags
22
+ - Convert inline styles to Confluence macros where possible
23
+ - Wrap code blocks in `<ac:structured-macro ac:name="code">`
24
+ - Preserve tables, headings, lists as-is (Confluence supports standard HTML)
25
+ - Create or update the page:
26
+ - Page title: `[Sprint] <question summary>` (truncated to 255 chars)
27
+ - Space key: from user argument or CLAUDE.md connector config
28
+ - Add labels: `wheat-sprint`, `<phase>`, claim type tags
29
+ - Add a comment with sync metadata: timestamp, claims hash from compilation certificate, claim count
30
+
31
+ 4. **Build sync manifest**: After publishing, append a sync record to `output/sync-log.json`:
32
+
33
+ ```json
34
+ {
35
+ "timestamp": "<ISO>",
36
+ "target": "confluence|slack|notion|file",
37
+ "url": "<published URL or file path>",
38
+ "claims_hash": "<from compilation.json>",
39
+ "claims_count": <number>,
40
+ "phase": "<current phase>"
41
+ }
42
+ ```
43
+
44
+ 5. **Add a sync claim**: Append a claim recording the sync event:
45
+
46
+ ```json
47
+ {
48
+ "id": "r<next>",
49
+ "type": "factual",
50
+ "topic": "sync",
51
+ "content": "Sprint artifacts published to <target> at <url>. Claims hash: <hash>. <count> active claims at time of sync.",
52
+ "source": {
53
+ "origin": "mcp",
54
+ "artifact": "<url>",
55
+ "connector": "<target>"
56
+ },
57
+ "evidence": "documented",
58
+ "status": "active",
59
+ "phase_added": "<phase>",
60
+ "timestamp": "<ISO>",
61
+ "conflicts_with": [],
62
+ "resolved_by": null,
63
+ "tags": ["sync", "<target>"]
64
+ }
65
+ ```
66
+
67
+ 6. **Compile again** after adding the sync claim.
68
+
69
+ ## Arguments
70
+
71
+ - No argument: auto-detect available targets, prefer Confluence
72
+ - `confluence <space-key>`: publish to specific Confluence space
73
+ - `slack <channel>`: post summary to Slack channel
74
+ - `notion <page-id>`: publish to Notion page
75
+ - `file`: export to `output/` only (always works, no MCP needed)
76
+ - `--dry-run`: show what would be published without actually pushing
77
+
78
+ ## Error handling
79
+
80
+ - If no MCP servers are configured, fall back to local file export and tell the user how to configure Atlassian MCP: `claude mcp add atlassian -- npx @anthropic-ai/atlassian-mcp`
81
+ - If Confluence API returns 403, suggest checking OAuth scopes
82
+ - If the page already exists, update it (don't create duplicates) — search by title first
83
+
84
+ ## Next steps suggestions
85
+
86
+ After sync completes, suggest:
87
+
88
+ ```
89
+ Next steps:
90
+ /status -- verify sync claim was recorded
91
+ /sync slack <channel> -- cross-post to Slack
92
+ /pull confluence -- backfill claims from Confluence comments
93
+ /brief -- regenerate brief if claims changed
94
+ ```
@@ -5,6 +5,7 @@ You are corroborating (or contradicting) a specific claim using an external sour
5
5
  ## Process
6
6
 
7
7
  1. **Parse arguments**: The user provides a claim ID and an external URL.
8
+
8
9
  - Example: `/witness p001 https://nodejs.org/api/http.html`
9
10
  - If only a claim ID is given, ask for the URL
10
11
  - If only a URL is given, ask which claim to witness
@@ -14,13 +15,15 @@ You are corroborating (or contradicting) a specific claim using an external sour
14
15
  3. **Fetch the external source**: Use web fetch to read the URL. If it's documentation, source code, or an article, extract the relevant content.
15
16
 
16
17
  4. **Classify the relationship** between the external evidence and the claim:
18
+
17
19
  - **Full support** -> external source confirms the claim completely
18
20
  - **Partial support** -> confirms some assertions but adds caveats
19
21
  - **Partial contradiction** -> external source challenges some assertions
20
22
  - **Full contradiction** -> external source directly contradicts the claim
21
23
 
22
24
  5. **Determine evidence tier** based on source type:
23
- - Official docs (*.nodejs.org, docs.*, RFC) -> `documented`
25
+
26
+ - Official docs (_.nodejs.org, docs._, RFC) -> `documented`
24
27
  - Blog posts, Stack Overflow, tutorials -> `web`
25
28
  - GitHub source code, changelogs -> `documented`
26
29
  - Production metrics, dashboards -> `production`
@@ -52,6 +55,7 @@ You are corroborating (or contradicting) a specific claim using an external sour
52
55
  ```
53
56
 
54
57
  **Important relationship -> action mapping:**
58
+
55
59
  - Full/partial support: No `conflicts_with`. The witness corroborates.
56
60
  - Partial contradiction: Set `conflicts_with: ["<target claim ID>"]`. Explain the contradiction clearly in content.
57
61
  - Full contradiction: Set `conflicts_with: ["<target claim ID>"]`. This becomes a challenge claim effectively.
@@ -76,4 +80,4 @@ Commit: `wheat: /witness <target claim ID> — added <witness claim IDs> (<relat
76
80
  - The corroboration count for the witnessed claim
77
81
  - Suggest: `/witness` for other uncorroborated claims, `/challenge` if partial contradiction warrants deeper investigation
78
82
 
79
- $ARGUMENTS
83
+ $ARGUMENTS