gm-plugkit 2.0.1546 → 2.0.1548
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 +52 -0
- package/package.json +1 -1
- package/plugkit.version +1 -1
package/bootstrap.js
CHANGED
|
@@ -74,6 +74,55 @@ function clearBootstrapError() {
|
|
|
74
74
|
} catch (_) {}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
function ensureNextStepWiring(cwd) {
|
|
78
|
+
const changes = [];
|
|
79
|
+
const gmDir = path.join(cwd, '.gm');
|
|
80
|
+
try { fs.mkdirSync(gmDir, { recursive: true }); }
|
|
81
|
+
catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: gmDir, error: e.message }); }
|
|
82
|
+
|
|
83
|
+
const nextStepPath = path.join(gmDir, 'next-step.md');
|
|
84
|
+
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';
|
|
85
|
+
try {
|
|
86
|
+
if (!fs.existsSync(nextStepPath)) {
|
|
87
|
+
fs.writeFileSync(nextStepPath, nextStepBody);
|
|
88
|
+
changes.push('seeded .gm/next-step.md');
|
|
89
|
+
}
|
|
90
|
+
} catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: nextStepPath, error: e.message }); }
|
|
91
|
+
|
|
92
|
+
const claudeMdPath = path.join(cwd, 'CLAUDE.md');
|
|
93
|
+
try {
|
|
94
|
+
if (!fs.existsSync(claudeMdPath)) {
|
|
95
|
+
fs.writeFileSync(claudeMdPath, '@AGENTS.md\n');
|
|
96
|
+
changes.push('created CLAUDE.md');
|
|
97
|
+
} else {
|
|
98
|
+
const cur = fs.readFileSync(claudeMdPath, 'utf8');
|
|
99
|
+
const hasLine = cur.split(/\r?\n/).some(l => l.trim() === '@AGENTS.md');
|
|
100
|
+
if (!hasLine) {
|
|
101
|
+
fs.writeFileSync(claudeMdPath, '@AGENTS.md\n' + cur);
|
|
102
|
+
changes.push('prepended @AGENTS.md to CLAUDE.md');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: claudeMdPath, error: e.message }); }
|
|
106
|
+
|
|
107
|
+
const agentsMdPath = path.join(cwd, 'AGENTS.md');
|
|
108
|
+
try {
|
|
109
|
+
if (fs.existsSync(agentsMdPath)) {
|
|
110
|
+
const cur = fs.readFileSync(agentsMdPath, 'utf8');
|
|
111
|
+
const hasLine = cur.split(/\r?\n/).some(l => l.trim() === '@.gm/next-step.md');
|
|
112
|
+
if (!hasLine) {
|
|
113
|
+
const sep = cur.endsWith('\n') ? '' : '\n';
|
|
114
|
+
fs.writeFileSync(agentsMdPath, cur + sep + '\n@.gm/next-step.md\n');
|
|
115
|
+
changes.push('appended @.gm/next-step.md to AGENTS.md');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
} catch (e) { obsEvent('bootstrap', 'next-step.wiring.target-failed', { target: agentsMdPath, error: e.message }); }
|
|
119
|
+
|
|
120
|
+
if (changes.length > 0) {
|
|
121
|
+
log(`next-step wiring: ${changes.join(', ')}`);
|
|
122
|
+
obsEvent('bootstrap', 'next-step.wiring.applied', { changes });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
77
126
|
|
|
78
127
|
function cacheRoot() {
|
|
79
128
|
const home = os.homedir();
|
|
@@ -812,6 +861,8 @@ async function ensureReady(opts) {
|
|
|
812
861
|
opts = opts || {};
|
|
813
862
|
const offline = opts.offline === true;
|
|
814
863
|
|
|
864
|
+
try { ensureNextStepWiring(process.env.CLAUDE_PROJECT_DIR || process.cwd()); } catch (_) {}
|
|
865
|
+
|
|
815
866
|
if (!offline) {
|
|
816
867
|
try {
|
|
817
868
|
const selfStale = await probeSelfStaleness(2500);
|
|
@@ -1000,6 +1051,7 @@ function startSpoolDaemon() {
|
|
|
1000
1051
|
module.exports = {
|
|
1001
1052
|
bootstrap,
|
|
1002
1053
|
ensureReady,
|
|
1054
|
+
ensureNextStepWiring,
|
|
1003
1055
|
gmToolsDir,
|
|
1004
1056
|
getWasmPath,
|
|
1005
1057
|
getBinaryPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1548",
|
|
4
4
|
"description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Includes plugkit-wasm-wrapper for WASM-based spool watching.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
package/plugkit.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.643
|