gm-plugkit 2.0.2073 → 2.0.2075

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/bootstrap.js CHANGED
@@ -28,13 +28,15 @@ const {
28
28
  killPid,
29
29
  killSpoolWatcherInCwd,
30
30
  proactiveKillForNewInstall,
31
+ ensureNextStepWiring: ensureNextStepWiringShared,
31
32
  } = shared;
32
33
 
33
- // ensureNextStepWiring here is intentionally NOT imported from
34
- // bootstrap-shared -- this file's version does strictly more (CLAUDE.md
35
- // prepend, AGENTS.md append, managed .npmignore block) than bin/bootstrap.js's
36
- // leaner one, so it is genuinely-different logic, not accidental drift, and
37
- // stays local to this file.
34
+ // This file's own ensureNextStepWiring below delegates the shared prefix
35
+ // (seed next-step.md, prepend CLAUDE.md, append AGENTS.md) to
36
+ // bootstrap-shared's ensureNextStepWiringShared, then adds strictly more
37
+ // (a managed .npmignore block) that bootstrap-shared's leaner version does
38
+ // not need -- genuinely-different logic on top of a shared base, not two
39
+ // independent copies of the same first 40 lines.
38
40
 
39
41
  function resolveWindowsExe(cmd) {
40
42
  if (process.platform !== 'win32') return cmd;
@@ -177,48 +179,7 @@ function ensureInstructionsBundle(cwd) {
177
179
  }
178
180
 
179
181
  function ensureNextStepWiring(cwd) {
180
- const changes = [];
181
- const gmDir = path.join(cwd, '.gm');
182
- try { fs.mkdirSync(gmDir, { recursive: true }); }
183
- catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: gmDir, error: e.message }); }
184
-
185
- const nextStepPath = path.join(gmDir, 'next-step.md');
186
- const nextStepBody = '# Next step\n\nDispatch the `instruction` verb to plugkit by writing `.gm/exec-spool/in/instruction/<N>.txt` (any unique N) with body `{}` (or `{"prompt":"<user request>"}` on the first dispatch of the turn). Read the response from `.gm/exec-spool/out/<N>.json` and follow the imperative in the `instruction` field.\n\nThis file is auto-rewritten by plugkit on every instruction dispatch.\n';
187
- try {
188
- if (!fs.existsSync(nextStepPath)) {
189
- fs.writeFileSync(nextStepPath, nextStepBody);
190
- changes.push('seeded .gm/next-step.md');
191
- }
192
- } catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: nextStepPath, error: e.message }); }
193
-
194
-
195
- const claudeMdPath = path.join(cwd, 'CLAUDE.md');
196
- try {
197
- if (!fs.existsSync(claudeMdPath)) {
198
- fs.writeFileSync(claudeMdPath, '@AGENTS.md\n');
199
- changes.push('created CLAUDE.md');
200
- } else {
201
- const cur = fs.readFileSync(claudeMdPath, 'utf8');
202
- const hasLine = cur.split(/\r?\n/).some(l => l.trim() === '@AGENTS.md');
203
- if (!hasLine) {
204
- fs.writeFileSync(claudeMdPath, '@AGENTS.md\n' + cur);
205
- changes.push('prepended @AGENTS.md to CLAUDE.md');
206
- }
207
- }
208
- } catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: claudeMdPath, error: e.message }); }
209
-
210
- const agentsMdPath = path.join(cwd, 'AGENTS.md');
211
- try {
212
- if (fs.existsSync(agentsMdPath)) {
213
- const cur = fs.readFileSync(agentsMdPath, 'utf8');
214
- const hasLine = cur.split(/\r?\n/).some(l => l.trim() === '@.gm/next-step.md');
215
- if (!hasLine) {
216
- const sep = cur.endsWith('\n') ? '' : '\n';
217
- fs.writeFileSync(agentsMdPath, cur + sep + '\n@.gm/next-step.md\n');
218
- changes.push('appended @.gm/next-step.md to AGENTS.md');
219
- }
220
- }
221
- } catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: agentsMdPath, error: e.message }); }
182
+ const changes = ensureNextStepWiringShared(cwd);
222
183
 
223
184
  // gm writes its own runtime data into .gm/ in every project it drives; if that
224
185
  // project is an npm package, that data must never be published. Maintain a
package/gm-process.js CHANGED
@@ -42,7 +42,7 @@ function sha256OfFileSync(filePath) {
42
42
  function pidCommandLineForKillGuard(pid) {
43
43
  try {
44
44
  if (process.platform === 'win32') {
45
- const r = spawnSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', `(Get-WmiObject Win32_Process -Filter "ProcessId=${Number(pid)}").CommandLine`], { encoding: 'utf8', windowsHide: true, timeout: 5000 });
45
+ const r = spawnSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', `(Get-CimInstance Win32_Process -Filter "ProcessId=${Number(pid)}").CommandLine`], { encoding: 'utf8', windowsHide: true, timeout: 5000 });
46
46
  return String((r && r.stdout) || '');
47
47
  }
48
48
  const r = spawnSync('ps', ['-p', String(pid), '-o', 'args='], { encoding: 'utf8', timeout: 5000 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.2073",
3
+ "version": "2.0.2075",
4
4
  "description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform wasm, verifies SHA256, and launches agentplug-runner (the native wasm host) as the spool watcher daemon.",
5
5
  "main": "index.js",
6
6
  "bin": {