gm-skill 2.0.1148 → 2.0.1149

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
@@ -35,7 +35,7 @@ An earlier generation fanned out fifteen per-platform downstream repos (gm-cc, g
35
35
 
36
36
  ## Version
37
37
 
38
- `2.0.1148` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
38
+ `2.0.1149` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` (or any cascading sibling crate) republishes this package.
39
39
 
40
40
  ## Source of truth
41
41
 
@@ -1 +1 @@
1
- 0.1.413
1
+ 0.1.414
package/bin/plugkit.wasm CHANGED
Binary file
@@ -1 +1 @@
1
- 4032ac9258c6fb79106ef9e02a40c9cba7a509a6e0507d4d0c062645b25799a6 plugkit.wasm
1
+ 74a7d080de71336c5d7c56a0edd4936c853259a21323c0ab797ce9a3782f5dac plugkit.wasm
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1148",
3
+ "version": "2.0.1149",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -17,5 +17,5 @@
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
20
- "plugkitVersion": "0.1.413"
20
+ "plugkitVersion": "0.1.414"
21
21
  }
@@ -1,6 +1,33 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const os = require('os');
4
+ const { spawnSync } = require('child_process');
5
+
6
+ function isWorktreeDirty(cwd) {
7
+ try {
8
+ const r = spawnSync('git', ['status', '--porcelain'], {
9
+ cwd: cwd || process.cwd(), encoding: 'utf8', timeout: 1500, windowsHide: true
10
+ });
11
+ if (r.status !== 0) return { dirty: false, files: [], available: false };
12
+ const lines = r.stdout.split('\n').filter(l => l.length > 0);
13
+ return { dirty: lines.length > 0, files: lines, available: true };
14
+ } catch (_) {
15
+ return { dirty: false, files: [], available: false };
16
+ }
17
+ }
18
+
19
+ function hasUnpushedCommits(cwd) {
20
+ try {
21
+ const r = spawnSync('git', ['log', '@{u}..HEAD', '--oneline'], {
22
+ cwd: cwd || process.cwd(), encoding: 'utf8', timeout: 1500, windowsHide: true
23
+ });
24
+ if (r.status !== 0) return { unpushed: false, count: 0, available: false };
25
+ const lines = r.stdout.split('\n').filter(l => l.length > 0);
26
+ return { unpushed: lines.length > 0, count: lines.length, available: true };
27
+ } catch (_) {
28
+ return { unpushed: false, count: 0, available: false };
29
+ }
30
+ }
4
31
 
5
32
  async function dispatchSpool(cmd, lang, body, timeoutMs, sessionId) {
6
33
  const taskId = `${Date.now()}-${Math.random().toString(16).slice(2, 8)}`;
@@ -73,12 +100,45 @@ async function pollForCompletion(jsonFile, timeoutMs, taskId) {
73
100
  }
74
101
 
75
102
  function checkDispatchGates(sessionId, operation) {
76
- const gm = path.join(process.cwd(), '.gm');
103
+ const cwd = process.cwd();
104
+ const gm = path.join(cwd, '.gm');
77
105
  const prdPath = path.join(gm, 'prd.yml');
78
106
  const mutsPath = path.join(gm, 'mutables.yml');
79
107
  const needsGmPath = path.join(gm, 'needs-gm');
80
108
  const gmFiredPath = path.join(gm, `gm-fired-${sessionId}`);
81
109
 
110
+ if (['stop', 'complete'].includes(operation)) {
111
+ const residuals = [];
112
+ if (fs.existsSync(prdPath)) {
113
+ try {
114
+ const content = fs.readFileSync(prdPath, 'utf8');
115
+ if (content.includes('status: pending') || content.includes('status: in_progress')) {
116
+ residuals.push('PRD has open items — resolve or name-and-stop before declaring done');
117
+ }
118
+ } catch (_) {}
119
+ }
120
+ if (fs.existsSync(mutsPath)) {
121
+ try {
122
+ const content = fs.readFileSync(mutsPath, 'utf8');
123
+ if (content.includes('status: unknown')) {
124
+ residuals.push('unresolved mutables present — resolve with witness_evidence before declaring done');
125
+ }
126
+ } catch (_) {}
127
+ }
128
+ const dirty = isWorktreeDirty(cwd);
129
+ if (dirty.available && dirty.dirty) {
130
+ residuals.push(`worktree dirty (${dirty.files.length} file${dirty.files.length === 1 ? '' : 's'}) — commit and push before declaring done`);
131
+ }
132
+ const unpushed = hasUnpushedCommits(cwd);
133
+ if (unpushed.available && unpushed.unpushed) {
134
+ residuals.push(`${unpushed.count} unpushed commit${unpushed.count === 1 ? '' : 's'} — push to remote before declaring done`);
135
+ }
136
+ if (residuals.length > 0) {
137
+ return { allowed: false, reason: `stop-gate residuals: ${residuals.join('; ')}`, residuals };
138
+ }
139
+ return { allowed: true };
140
+ }
141
+
82
142
  if (!['write', 'edit', 'git'].includes(operation)) return { allowed: true };
83
143
 
84
144
  if (fs.existsSync(prdPath) && fs.existsSync(needsGmPath) && !fs.existsSync(gmFiredPath)) {
@@ -97,4 +157,4 @@ function checkDispatchGates(sessionId, operation) {
97
157
  return { allowed: true };
98
158
  }
99
159
 
100
- module.exports = { dispatchSpool, checkDispatchGates };
160
+ module.exports = { dispatchSpool, checkDispatchGates, isWorktreeDirty, hasUnpushedCommits };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1148",
3
+ "version": "2.0.1149",
4
4
  "description": "Canonical universal harness — AI-native software engineering via skill-driven orchestration; bootstraps plugkit for task execution and session isolation. Install in any AI coding agent host.",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "gm.json"
40
40
  ],
41
41
  "dependencies": {
42
- "gm-plugkit": "^2.0.1148"
42
+ "gm-plugkit": "^2.0.1149"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=16.0.0"
@@ -6,6 +6,14 @@ allowed-tools: Skill, Read, Write, Bash(node *), Bash(bun *)
6
6
 
7
7
  # gm — single entry point
8
8
 
9
+ Every turn begins with `instruction`. Write `.gm/exec-spool/in/instruction/<N>.txt` (empty body) and read the response — its `instruction` field is the active phase prose, its `prd_items` is the live work plan, its `mutables_pending` is what blocks the EMIT gate, its `recall_hits` is the prior memory already loaded for you. Follow that prose imperatively until the phase's exit condition is met, then `transition`. The user's request is the authorization; the PRD is the receipt; the chain runs PLAN → EXECUTE → EMIT → VERIFY → COMPLETE without re-asking between phases.
10
+
11
+ Direct Read/Edit/Bash before the first `instruction` dispatch is the failure mode this skill prevents. If you find yourself reaching for a tool to "just take a quick look", you have already dropped the loop — dispatch `instruction` first, then act on its prose.
12
+
13
+ Fix on Sight. Every unexpected output, broken neighbor, lockfile drift, suppressed error, or stale generated file surfaced during work becomes a PRD item the same turn and is executed before COMPLETE. Surprise is a new mutable, not noise to absorb. Stubs, mocks, placeholder returns, fixture-only paths, and "always succeeds" code paths are forbidden in shipped material; acceptance is real input through real code into real output, witnessed. Edits to code that runs in a browser require a live `browser` verb witness in the same turn — Browser Witness is non-negotiable.
14
+
15
+ Before any apparent stop, dispatch `residual-scan`. If it returns work that fits the spirit of the original ask and is reachable from this session, expand the PRD and execute; only residuals genuinely out-of-spirit or out-of-reach are name-and-stop. A turn that ends with uncommitted changes, an open PRD slice, or unresolved mutables has not actually stopped — it has stalled the chain.
16
+
9
17
  The wasm artifact lives at `~/.claude/gm-tools/plugkit.wasm`; the spool watcher runs it. The watcher's own stdout/stderr is appended to `.gm/exec-spool/.watcher.log` — Read it to see plugkit's internal trace, dispatch timings, sweep actions, errors.
10
18
 
11
19
  ## Boot the spool watcher (first turn only)
@@ -84,11 +92,11 @@ The log is rotated at 10MB (older content moves to `.watcher.log.1`).
84
92
 
85
93
  ## The loop
86
94
 
87
- Dispatch `instruction` with empty body to get current-phase guidance + full state snapshot. Follow the `instruction` prose imperatively. Add PRD items via `prd-add` (JSON body), resolve via `prd-resolve` (id as body). Add mutables via `mutable-add`, resolve via `mutable-resolve` once `witness_evidence` is filled. Every resolve auto-fires `memorize-fire` so the evidence becomes recall-able.
95
+ Add PRD items via `prd-add` (JSON body), resolve via `prd-resolve` (id as body). Add mutables via `mutable-add`, resolve via `mutable-resolve` once `witness_evidence` is filled — narrative resolution is rejected; only file:line, codesearch hit, or exec output snippet counts. Every `mutable-resolve` auto-fires memorize so the witness becomes recall-able next session.
88
96
 
89
97
  Resolve every entry in `mutables_pending` before transitioning. When the phase's exit condition is met, dispatch `transition` with the next phase name (or empty for auto-advance). Each transition response embeds `recall_hits` automatically — relevant prior memos surface without you asking.
90
98
 
91
- Stop when `next_phase_hint` is null or phase is `COMPLETE`.
99
+ Stop only when `phase` is `COMPLETE` AND `residual-scan` returns empty AND the worktree is clean AND CI is green. Any of those false means the chain has not finished.
92
100
 
93
101
  ## Orchestrator verbs
94
102
 
@@ -104,8 +112,8 @@ Stop when `next_phase_hint` is null or phase is `COMPLETE`.
104
112
 
105
113
  ### Browser
106
114
 
107
- Dispatch `.gm/exec-spool/in/browser/<N>.txt` with raw JavaScript as the body. The wrapper spawns Chrome (managed profile at `<cwd>/.gm/browser-profile/`) and runs the JS via playwriter. Globals available inside the body: `page` (playwright Page), `snapshot` (accessibility snapshot), `screenshotWithAccessibilityLabels` (screenshot helper), `state` (per-session state object).
115
+ The `browser` verb is the only sanctioned way to drive a live page. Do not reach for any other browser tool, library, or skill — the host owns the managed session and a parallel surface fragments witness state. Dispatch `.gm/exec-spool/in/browser/<N>.txt` with raw JavaScript as the body. The host runs Chrome under a project-scoped profile at `<cwd>/.gm/browser-profile/` (cookies/login persist per project) and exposes the body to four globals: `page` (the live page handle — `await page.goto(...)`, `await page.evaluate(...)`, etc.), `snapshot` (accessibility-tree snapshot), `screenshotWithAccessibilityLabels` (annotated screenshot helper), and `state` (a per-session object that persists across dispatches within the same session).
108
116
 
109
- Special commands (body starts with `session `): `session new`, `session list`, `session close <id>` pass through to playwriter directly.
117
+ Special commands (body starts with `session `): `session new`, `session list`, `session close <id>` manage session lifecycle.
110
118
 
111
- Chrome is detected from system install paths; profile dir is project-scoped so cookies/login persist per project. The wrapper writes the managed gitignore block (which includes `.gm/browser-profile/`) on first launch.
119
+ Required for any edit to code that runs in a browser — Browser Witness is non-negotiable. A `node test.js passes` does not substitute for a live `page.evaluate` asserting the invariant the edit was supposed to change.