@a5c-ai/babysitter-gemini 4.0.153
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/GEMINI.md +392 -0
- package/README.md +295 -0
- package/bin/cli.js +337 -0
- package/bin/postinstall.js +79 -0
- package/bin/preuninstall.js +73 -0
- package/commands/assimilate.md +37 -0
- package/commands/call.md +7 -0
- package/commands/cleanup.md +20 -0
- package/commands/contrib.md +33 -0
- package/commands/doctor.md +426 -0
- package/commands/forever.md +7 -0
- package/commands/help.md +244 -0
- package/commands/observe.md +12 -0
- package/commands/plan.md +7 -0
- package/commands/plugins.md +255 -0
- package/commands/project-install.md +17 -0
- package/commands/resume.md +8 -0
- package/commands/retrospect.md +55 -0
- package/commands/user-install.md +17 -0
- package/commands/yolo.md +7 -0
- package/gemini-extension.json +18 -0
- package/hooks/after-agent.sh +101 -0
- package/hooks/hooks.json +32 -0
- package/hooks/session-start.sh +129 -0
- package/package.json +50 -0
- package/plugin.json +48 -0
- package/scripts/sync-command-surfaces.js +62 -0
- package/versions.json +4 -0
package/bin/cli.js
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
const { spawnSync } = require('child_process');
|
|
8
|
+
|
|
9
|
+
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
10
|
+
const PLUGIN_NAME = 'babysitter-gemini';
|
|
11
|
+
const EXTENSION_NAME = 'babysitter'; // matches gemini-extension.json "name"
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Helpers
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
function printUsage() {
|
|
18
|
+
console.log([
|
|
19
|
+
`${PLUGIN_NAME} - Babysitter plugin for Gemini CLI`,
|
|
20
|
+
'',
|
|
21
|
+
'Usage:',
|
|
22
|
+
` ${PLUGIN_NAME} install [--global] Install via: gemini extensions install <package-root>`,
|
|
23
|
+
` ${PLUGIN_NAME} install --link Link via: gemini extensions link <package-root> (dev mode)`,
|
|
24
|
+
` ${PLUGIN_NAME} uninstall Uninstall via: gemini extensions uninstall ${EXTENSION_NAME}`,
|
|
25
|
+
` ${PLUGIN_NAME} status Check installation status`,
|
|
26
|
+
` ${PLUGIN_NAME} version Show version info`,
|
|
27
|
+
` ${PLUGIN_NAME} help Show this message`,
|
|
28
|
+
'',
|
|
29
|
+
'Installation delegates to `gemini extensions install/link/uninstall`.',
|
|
30
|
+
'The Gemini CLI must be installed for install/uninstall to work.',
|
|
31
|
+
'',
|
|
32
|
+
'The plugin provides:',
|
|
33
|
+
' - GEMINI.md context file for orchestration instructions',
|
|
34
|
+
' - SessionStart hook for session initialization',
|
|
35
|
+
' - AfterAgent hook for continuation loop',
|
|
36
|
+
' - Command definitions for all babysitter workflows',
|
|
37
|
+
].join('\n'));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getVersions() {
|
|
41
|
+
try {
|
|
42
|
+
const versionsPath = path.join(PACKAGE_ROOT, 'versions.json');
|
|
43
|
+
return JSON.parse(fs.readFileSync(versionsPath, 'utf8'));
|
|
44
|
+
} catch {
|
|
45
|
+
return { sdkVersion: 'unknown', extensionVersion: 'unknown' };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function getExtensionDir() {
|
|
50
|
+
return path.join(os.homedir(), '.gemini', 'extensions', EXTENSION_NAME);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function isGeminiCliAvailable() {
|
|
54
|
+
const result = spawnSync('gemini', ['--version'], {
|
|
55
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
56
|
+
encoding: 'utf8',
|
|
57
|
+
shell: true,
|
|
58
|
+
timeout: 10000,
|
|
59
|
+
});
|
|
60
|
+
return result.status === 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function requireGeminiCli() {
|
|
64
|
+
if (!isGeminiCliAvailable()) {
|
|
65
|
+
console.error('[babysitter] Error: Gemini CLI is not installed or not in PATH.');
|
|
66
|
+
console.error('[babysitter] Install it first: https://github.com/google-gemini/gemini-cli');
|
|
67
|
+
process.exitCode = 1;
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function resolveBabysitterCommand() {
|
|
74
|
+
if (process.env.BABYSITTER_SDK_CLI) {
|
|
75
|
+
return {
|
|
76
|
+
command: process.execPath,
|
|
77
|
+
argsPrefix: [path.resolve(process.env.BABYSITTER_SDK_CLI)],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
return {
|
|
82
|
+
command: process.execPath,
|
|
83
|
+
argsPrefix: [
|
|
84
|
+
require.resolve('@a5c-ai/babysitter-sdk/dist/cli/main.js', {
|
|
85
|
+
paths: [PACKAGE_ROOT],
|
|
86
|
+
}),
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
} catch {
|
|
90
|
+
return { command: 'babysitter', argsPrefix: [] };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function runBabysitterCli(cliArgs) {
|
|
95
|
+
const resolved = resolveBabysitterCommand();
|
|
96
|
+
const result = spawnSync(resolved.command, [...resolved.argsPrefix, ...cliArgs], {
|
|
97
|
+
cwd: PACKAGE_ROOT,
|
|
98
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
99
|
+
encoding: 'utf8',
|
|
100
|
+
env: process.env,
|
|
101
|
+
});
|
|
102
|
+
if (result.status !== 0) {
|
|
103
|
+
const stderr = (result.stderr || '').trim();
|
|
104
|
+
const stdout = (result.stdout || '').trim();
|
|
105
|
+
throw new Error(
|
|
106
|
+
`babysitter ${cliArgs.join(' ')} failed` +
|
|
107
|
+
(stderr ? `: ${stderr}` : stdout ? `: ${stdout}` : ''),
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
return result.stdout;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function getGlobalStateDir() {
|
|
114
|
+
if (process.env.BABYSITTER_GLOBAL_STATE_DIR) {
|
|
115
|
+
return path.resolve(process.env.BABYSITTER_GLOBAL_STATE_DIR);
|
|
116
|
+
}
|
|
117
|
+
return path.join(os.homedir(), '.a5c');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
// Install
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
|
|
124
|
+
function install(useLink) {
|
|
125
|
+
if (!requireGeminiCli()) return;
|
|
126
|
+
|
|
127
|
+
const subcommand = useLink ? 'link' : 'install';
|
|
128
|
+
console.log(`[babysitter] Running: gemini extensions ${subcommand} ${PACKAGE_ROOT}`);
|
|
129
|
+
|
|
130
|
+
const result = spawnSync('gemini', ['extensions', subcommand, PACKAGE_ROOT], {
|
|
131
|
+
stdio: 'inherit',
|
|
132
|
+
shell: true,
|
|
133
|
+
timeout: 60000,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
if (result.status !== 0) {
|
|
137
|
+
console.error(`[babysitter] gemini extensions ${subcommand} failed (exit ${result.status}).`);
|
|
138
|
+
process.exitCode = 1;
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (useLink) {
|
|
143
|
+
console.log('[babysitter] Extension linked. Changes to the package are reflected immediately.');
|
|
144
|
+
} else {
|
|
145
|
+
console.log('[babysitter] Extension installed.');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
installSdk();
|
|
149
|
+
ensureProcessLibrary();
|
|
150
|
+
|
|
151
|
+
console.log('');
|
|
152
|
+
console.log('[babysitter] Installation complete! Restart Gemini CLI to activate.');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function installSdk() {
|
|
156
|
+
const versions = getVersions();
|
|
157
|
+
if (!versions.sdkVersion || versions.sdkVersion === 'unknown') return;
|
|
158
|
+
|
|
159
|
+
console.log(`[babysitter] Ensuring babysitter SDK (${versions.sdkVersion}) is available...`);
|
|
160
|
+
const result = spawnSync('npm', ['i', '-g', `@a5c-ai/babysitter-sdk@${versions.sdkVersion}`, '--loglevel=error'], {
|
|
161
|
+
stdio: 'inherit',
|
|
162
|
+
shell: true,
|
|
163
|
+
});
|
|
164
|
+
if (result.status === 0) {
|
|
165
|
+
console.log('[babysitter] SDK installed successfully.');
|
|
166
|
+
} else {
|
|
167
|
+
console.log('[babysitter] SDK global install failed — the SessionStart hook will attempt install on first use.');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function ensureProcessLibrary() {
|
|
172
|
+
try {
|
|
173
|
+
const raw = runBabysitterCli(['process-library:active', '--state-dir', getGlobalStateDir(), '--json']);
|
|
174
|
+
const active = JSON.parse(raw);
|
|
175
|
+
if (active.binding?.dir) {
|
|
176
|
+
console.log(`[babysitter] process library: ${active.binding.dir}`);
|
|
177
|
+
}
|
|
178
|
+
if (active.defaultSpec?.cloneDir) {
|
|
179
|
+
console.log(`[babysitter] process library clone: ${active.defaultSpec.cloneDir}`);
|
|
180
|
+
}
|
|
181
|
+
} catch {
|
|
182
|
+
// Process library bootstrap is best-effort
|
|
183
|
+
console.log('[babysitter] Process library bootstrap skipped (babysitter CLI not available yet).');
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// ---------------------------------------------------------------------------
|
|
188
|
+
// Uninstall
|
|
189
|
+
// ---------------------------------------------------------------------------
|
|
190
|
+
|
|
191
|
+
function uninstall() {
|
|
192
|
+
if (!requireGeminiCli()) return;
|
|
193
|
+
|
|
194
|
+
console.log(`[babysitter] Running: gemini extensions uninstall ${EXTENSION_NAME}`);
|
|
195
|
+
|
|
196
|
+
const result = spawnSync('gemini', ['extensions', 'uninstall', EXTENSION_NAME], {
|
|
197
|
+
stdio: 'inherit',
|
|
198
|
+
shell: true,
|
|
199
|
+
timeout: 30000,
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
if (result.status !== 0) {
|
|
203
|
+
console.error(`[babysitter] gemini extensions uninstall failed (exit ${result.status}).`);
|
|
204
|
+
process.exitCode = 1;
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
console.log('[babysitter] Extension removed. Restart Gemini CLI to complete uninstallation.');
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ---------------------------------------------------------------------------
|
|
212
|
+
// Status
|
|
213
|
+
// ---------------------------------------------------------------------------
|
|
214
|
+
|
|
215
|
+
function status() {
|
|
216
|
+
const extensionDir = getExtensionDir();
|
|
217
|
+
const exists = fs.existsSync(extensionDir);
|
|
218
|
+
let symlinked = false;
|
|
219
|
+
try {
|
|
220
|
+
symlinked = fs.lstatSync(extensionDir).isSymbolicLink();
|
|
221
|
+
} catch {
|
|
222
|
+
// Does not exist
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
console.log(`Extension directory: ${extensionDir}`);
|
|
226
|
+
console.log(`Installed: ${exists ? 'yes' : 'no'}`);
|
|
227
|
+
|
|
228
|
+
if (symlinked) {
|
|
229
|
+
const target = fs.readlinkSync(extensionDir);
|
|
230
|
+
console.log(`Mode: linked -> ${target}`);
|
|
231
|
+
} else if (exists) {
|
|
232
|
+
console.log('Mode: installed (copy)');
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (exists) {
|
|
236
|
+
const extManifest = path.join(extensionDir, 'gemini-extension.json');
|
|
237
|
+
const pluginManifest = path.join(extensionDir, 'plugin.json');
|
|
238
|
+
const versionsFile = path.join(extensionDir, 'versions.json');
|
|
239
|
+
const geminiMd = path.join(extensionDir, 'GEMINI.md');
|
|
240
|
+
const hooksDir = path.join(extensionDir, 'hooks');
|
|
241
|
+
|
|
242
|
+
console.log(`gemini-extension.json: ${fs.existsSync(extManifest) ? 'present' : 'MISSING'}`);
|
|
243
|
+
console.log(`plugin.json: ${fs.existsSync(pluginManifest) ? 'present' : 'MISSING'}`);
|
|
244
|
+
console.log(`versions.json: ${fs.existsSync(versionsFile) ? 'present' : 'MISSING'}`);
|
|
245
|
+
console.log(`GEMINI.md: ${fs.existsSync(geminiMd) ? 'present' : 'MISSING'}`);
|
|
246
|
+
console.log(`hooks/: ${fs.existsSync(hooksDir) ? 'present' : 'MISSING'}`);
|
|
247
|
+
|
|
248
|
+
if (fs.existsSync(versionsFile)) {
|
|
249
|
+
try {
|
|
250
|
+
const v = JSON.parse(fs.readFileSync(versionsFile, 'utf8'));
|
|
251
|
+
console.log(`SDK version: ${v.sdkVersion || 'unknown'}`);
|
|
252
|
+
console.log(`Extension version: ${v.extensionVersion || 'unknown'}`);
|
|
253
|
+
} catch {
|
|
254
|
+
console.log('versions.json: unreadable');
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Check CLIs
|
|
260
|
+
const geminiCheck = spawnSync('gemini', ['--version'], {
|
|
261
|
+
stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf8', shell: true,
|
|
262
|
+
});
|
|
263
|
+
console.log(`gemini CLI: ${geminiCheck.status === 0 ? geminiCheck.stdout.trim() : 'not found'}`);
|
|
264
|
+
|
|
265
|
+
const cliCheck = spawnSync('babysitter', ['--version'], {
|
|
266
|
+
stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf8', shell: true,
|
|
267
|
+
});
|
|
268
|
+
console.log(`babysitter CLI: ${cliCheck.status === 0 ? cliCheck.stdout.trim() : 'not found'}`);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// ---------------------------------------------------------------------------
|
|
272
|
+
// Argument parsing
|
|
273
|
+
// ---------------------------------------------------------------------------
|
|
274
|
+
|
|
275
|
+
function parseInstallArgs(argv) {
|
|
276
|
+
let useLink = false;
|
|
277
|
+
for (const arg of argv) {
|
|
278
|
+
if (arg === '--link' || arg === '--symlink') {
|
|
279
|
+
useLink = true;
|
|
280
|
+
} else if (arg === '--global') {
|
|
281
|
+
// Accepted for backwards compat, no-op (global is the only target now)
|
|
282
|
+
} else {
|
|
283
|
+
throw new Error(`unknown argument: ${arg}`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return { useLink };
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// ---------------------------------------------------------------------------
|
|
290
|
+
// Main
|
|
291
|
+
// ---------------------------------------------------------------------------
|
|
292
|
+
|
|
293
|
+
function main() {
|
|
294
|
+
const [command, ...rest] = process.argv.slice(2);
|
|
295
|
+
|
|
296
|
+
if (!command || command === '--help' || command === '-h' || command === 'help') {
|
|
297
|
+
printUsage();
|
|
298
|
+
process.exitCode = command ? 0 : 1;
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (command === 'version' || command === '--version' || command === '-v') {
|
|
303
|
+
const versions = getVersions();
|
|
304
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, 'package.json'), 'utf8'));
|
|
305
|
+
console.log(`${pkg.name}: ${pkg.version}`);
|
|
306
|
+
console.log(`extension: ${versions.extensionVersion || 'unknown'}`);
|
|
307
|
+
console.log(`sdk: ${versions.sdkVersion || 'unknown'}`);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (command === 'install') {
|
|
312
|
+
try {
|
|
313
|
+
const parsed = parseInstallArgs(rest);
|
|
314
|
+
install(parsed.useLink);
|
|
315
|
+
} catch (err) {
|
|
316
|
+
console.error(`[babysitter] Error: ${err.message}`);
|
|
317
|
+
process.exitCode = 1;
|
|
318
|
+
}
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (command === 'uninstall') {
|
|
323
|
+
uninstall();
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (command === 'status') {
|
|
328
|
+
status();
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
console.error(`Unknown command: ${command}`);
|
|
333
|
+
printUsage();
|
|
334
|
+
process.exitCode = 1;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
main();
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* postinstall hook — runs after `npm install [-g] @a5c-ai/babysitter-gemini`.
|
|
6
|
+
*
|
|
7
|
+
* When installed globally (the expected path), this delegates to
|
|
8
|
+
* `gemini extensions install <package-root>` so Gemini CLI handles the
|
|
9
|
+
* extension installation natively. Falls back to manual copy if the
|
|
10
|
+
* `gemini` CLI is not available.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
const os = require('os');
|
|
16
|
+
const { spawnSync } = require('child_process');
|
|
17
|
+
|
|
18
|
+
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
19
|
+
const EXTENSION_NAME = 'babysitter'; // matches gemini-extension.json "name"
|
|
20
|
+
|
|
21
|
+
function isGlobalInstall() {
|
|
22
|
+
if (process.env.npm_config_global === 'true') return true;
|
|
23
|
+
const globalPrefix = process.env.npm_config_prefix || '';
|
|
24
|
+
if (globalPrefix && PACKAGE_ROOT.startsWith(globalPrefix)) return true;
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function isGeminiCliAvailable() {
|
|
29
|
+
const result = spawnSync('gemini', ['--version'], {
|
|
30
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
31
|
+
encoding: 'utf8',
|
|
32
|
+
shell: true,
|
|
33
|
+
timeout: 10000,
|
|
34
|
+
});
|
|
35
|
+
return result.status === 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function isExtensionLinked() {
|
|
39
|
+
const extensionDir = path.join(os.homedir(), '.gemini', 'extensions', EXTENSION_NAME);
|
|
40
|
+
try {
|
|
41
|
+
return fs.lstatSync(extensionDir).isSymbolicLink();
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function main() {
|
|
48
|
+
if (!isGlobalInstall()) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Don't overwrite a linked extension (dev mode)
|
|
53
|
+
if (isExtensionLinked()) {
|
|
54
|
+
console.log(`[babysitter] Skipping postinstall: extension is linked (dev mode)`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!isGeminiCliAvailable()) {
|
|
59
|
+
console.warn('[babysitter] Gemini CLI not found. Run `babysitter-gemini install` after installing Gemini CLI.');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
console.log(`[babysitter] Installing extension via: gemini extensions install ${PACKAGE_ROOT}`);
|
|
64
|
+
|
|
65
|
+
const result = spawnSync('gemini', ['extensions', 'install', PACKAGE_ROOT], {
|
|
66
|
+
stdio: 'inherit',
|
|
67
|
+
shell: true,
|
|
68
|
+
timeout: 60000,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (result.status === 0) {
|
|
72
|
+
console.log('[babysitter] Extension installed via Gemini CLI. Restart Gemini CLI to activate.');
|
|
73
|
+
} else {
|
|
74
|
+
console.warn('[babysitter] Warning: gemini extensions install failed.');
|
|
75
|
+
console.warn('[babysitter] Run `babysitter-gemini install` manually to complete setup.');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
main();
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* preuninstall hook — runs before `npm uninstall [-g] @a5c-ai/babysitter-gemini`.
|
|
6
|
+
*
|
|
7
|
+
* Delegates to `gemini extensions uninstall babysitter` so Gemini CLI handles
|
|
8
|
+
* the removal natively. Falls back to manual removal if the CLI is not available.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const os = require('os');
|
|
14
|
+
const { spawnSync } = require('child_process');
|
|
15
|
+
|
|
16
|
+
const EXTENSION_NAME = 'babysitter'; // matches gemini-extension.json "name"
|
|
17
|
+
|
|
18
|
+
function getExtensionDir() {
|
|
19
|
+
return path.join(os.homedir(), '.gemini', 'extensions', EXTENSION_NAME);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function isGeminiCliAvailable() {
|
|
23
|
+
const result = spawnSync('gemini', ['--version'], {
|
|
24
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
25
|
+
encoding: 'utf8',
|
|
26
|
+
shell: true,
|
|
27
|
+
timeout: 10000,
|
|
28
|
+
});
|
|
29
|
+
return result.status === 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function main() {
|
|
33
|
+
const extensionDir = getExtensionDir();
|
|
34
|
+
|
|
35
|
+
if (!fs.existsSync(extensionDir)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Don't remove linked extensions automatically — they point to a dev checkout
|
|
40
|
+
try {
|
|
41
|
+
if (fs.lstatSync(extensionDir).isSymbolicLink()) {
|
|
42
|
+
console.log(`[babysitter] Skipping preuninstall: extension is linked (dev mode)`);
|
|
43
|
+
console.log(`[babysitter] Remove the link manually: gemini extensions uninstall ${EXTENSION_NAME}`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
} catch {
|
|
47
|
+
// Proceed
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (isGeminiCliAvailable()) {
|
|
51
|
+
console.log(`[babysitter] Uninstalling extension via: gemini extensions uninstall ${EXTENSION_NAME}`);
|
|
52
|
+
const result = spawnSync('gemini', ['extensions', 'uninstall', EXTENSION_NAME], {
|
|
53
|
+
stdio: 'inherit',
|
|
54
|
+
shell: true,
|
|
55
|
+
timeout: 30000,
|
|
56
|
+
});
|
|
57
|
+
if (result.status === 0) {
|
|
58
|
+
console.log('[babysitter] Extension removed via Gemini CLI.');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
console.warn('[babysitter] gemini extensions uninstall failed, falling back to manual removal.');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Fallback: manual removal
|
|
65
|
+
try {
|
|
66
|
+
fs.rmSync(extensionDir, { recursive: true, force: true });
|
|
67
|
+
console.log(`[babysitter] Removed extension from ${extensionDir}`);
|
|
68
|
+
} catch (err) {
|
|
69
|
+
console.warn(`[babysitter] Warning: could not remove ${extensionDir}: ${err.message}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
main();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Assimilate an external methodology, harness, or specification into babysitter process definitions with skills and agents.
|
|
3
|
+
argument-hint: Target to assimilate (e.g. repo URL, harness name, or spec path)
|
|
4
|
+
allowed-tools: Read, Grep, Write, Task, Bash, Edit, Grep, Glob, WebFetch, WebSearch, Search, AskUserQuestion, TodoWrite, TodoRead, Skill, BashOutput, KillShell, MultiEdit, LS
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
|
|
8
|
+
|
|
9
|
+
Use the assimilation domain processes from the active process library to convert external sources into well-defined babysitter process definitions with accompanying skills/ and agents/ directories.
|
|
10
|
+
|
|
11
|
+
If the workspace does not already have an active process-library binding, initialize it first through the shared global SDK binding:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
babysitter process-library:active --json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Run the process after formalizing it.
|
|
18
|
+
|
|
19
|
+
Available assimilation workflows:
|
|
20
|
+
- **methodology-assimilation** (`specializations/meta/assimilation/workflows/methodology-assimilation`) - Learns an external methodology from its repo and converts procedural instructions, commands, and manual flows into babysitter processes with refactored skills and agents. Supports output as methodology or specialization.
|
|
21
|
+
- **harness integration** (`specializations/meta/assimilation/harness/*`) - Integrates babysitter SDK with a specific AI coding harness (generic, codex, opencode, gemini-cli, openclaw, antigravity).
|
|
22
|
+
|
|
23
|
+
During the interview phase, determine which assimilation workflow to use based on the user's target:
|
|
24
|
+
- If the target is a **repo URL or methodology name** then use the methodology-assimilation workflow.
|
|
25
|
+
- If the target is a **harness name** (e.g. codex, opencode, antigravity) then use the matching harness process.
|
|
26
|
+
- If the target is a **specification or other source** then adapt the methodology-assimilation workflow for the spec format.
|
|
27
|
+
- If unclear, ask the user to clarify the assimilation target and type.
|
|
28
|
+
|
|
29
|
+
## After Assimilation: Contribute Back
|
|
30
|
+
|
|
31
|
+
After successfully assimilating a methodology or harness integration, prompt the user to share it with the community. The assimilated process definitions, skills, and agents could benefit other babysitter users:
|
|
32
|
+
|
|
33
|
+
- **Completed a methodology assimilation**: `/babysitter:contrib library contribution: assimilated [methodology-name] into babysitter process definitions`
|
|
34
|
+
- **Completed a harness integration**: `/babysitter:contrib library contribution: [harness-name] harness integration`
|
|
35
|
+
- **Hit issues during assimilation** (e.g. unsupported patterns, missing SDK features): `/babysitter:contrib bug report: assimilation of [target] failed because [description]` or `/babysitter:contrib feature request: [what the SDK needs to support]`
|
|
36
|
+
|
|
37
|
+
Even just reporting that an assimilation didn't work well helps improve babysitter for everyone.
|
package/commands/call.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Orchestrate a babysitter run. use this command to start babysitting a complex workflow.
|
|
3
|
+
argument-hint: Specific instructions for the run.
|
|
4
|
+
allowed-tools: Read, Grep, Write, Task, Bash, Edit, Grep, Glob, WebFetch, WebSearch, Search, AskUserQuestion, TodoWrite, TodoRead, Skill, BashOutput, KillShell, MultiEdit, LS
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Clean up .a5c/runs and .a5c/processes directories. Aggregates insights from completed/failed runs into docs/run-history-insights.md, then removes old run data and orphaned process files.
|
|
3
|
+
argument-hint: "[--dry-run] [--keep-days N] Optional flags. --dry-run shows what would be removed without deleting. --keep-days N keeps runs newer than N days (default 7)."
|
|
4
|
+
allowed-tools: Read, Grep, Write, Task, Bash, Edit, Grep, Glob, WebFetch, WebSearch, Search, AskUserQuestion, TodoWrite, TodoRead, Skill, BashOutput, KillShell, MultiEdit, LS
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
|
|
8
|
+
|
|
9
|
+
Create and run a cleanup process using the process at `skills\babysit\process\cradle\cleanup-runs.js/processes/cleanup-runs.js`.
|
|
10
|
+
|
|
11
|
+
Implementation notes (for the process):
|
|
12
|
+
- Parse arguments for `--dry-run` flag (if present, set dryRun: true in inputs) and `--keep-days N` (default: 7)
|
|
13
|
+
- The process scans .a5c/runs/ for completed/failed runs, aggregates insights, writes summaries, then removes old data
|
|
14
|
+
- Always show the user what will be removed before removing (in interactive mode via breakpoints)
|
|
15
|
+
- In non-interactive mode (yolo), proceed with cleanup using defaults
|
|
16
|
+
- The insights file goes to docs/run-history-insights.md
|
|
17
|
+
- Only remove terminal runs (completed/failed) older than the keep-days threshold
|
|
18
|
+
- Never remove active/in-progress runs
|
|
19
|
+
- Remove orphaned process files not referenced by remaining runs
|
|
20
|
+
- After cleanup, show remaining run count and disk usage
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Submit feedback or contribute to babysitter project
|
|
3
|
+
argument-hint: Specific instructions for the run.
|
|
4
|
+
allowed-tools: Read, Grep, Write, Task, Bash, Edit, Grep, Glob, WebFetch, WebSearch, Search, AskUserQuestion, TodoWrite, TodoRead, Skill, BashOutput, KillShell, MultiEdit, LS
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
|
|
8
|
+
|
|
9
|
+
## Process Routing
|
|
10
|
+
|
|
11
|
+
Contribution processes live under the active process library's `cradle/` directory. Resolve the active library root with `babysitter process-library:active --json` and route based on arguments:
|
|
12
|
+
|
|
13
|
+
### Issue-based (opens a GitHub issue in a5c-ai/babysitter)
|
|
14
|
+
* **Bug report** → `cradle/bug-report.js#process` — Report a bug in the SDK, CLI, process library, etc.
|
|
15
|
+
* **Feature request** → `cradle/feature-request.js#process` — Request a new feature or enhancement
|
|
16
|
+
* **Documentation question** → `cradle/documentation-question.js#process` — Ask about undocumented behavior or missing docs
|
|
17
|
+
|
|
18
|
+
### PR-based (forks repo, creates branch, submits PR to a5c-ai/babysitter)
|
|
19
|
+
* **Bugfix** → `cradle/bugfix.js#process` — User already has the fix for a bug
|
|
20
|
+
* **Feature implementation** → `cradle/feature-implementation-contribute.js#process` — User already has a feature implementation
|
|
21
|
+
* **Harness integration** → `cradle/feature-harness-integration-contribute.js#process` — User has a harness (CI/CD, IDE, editor) integration
|
|
22
|
+
* **Library contribution** → `cradle/library-contribution.js#process` — New or improved process/skill/subagent for the library
|
|
23
|
+
* **Documentation answer** → `cradle/documentation-contribute-answer.js#process` — User has an answer for an unanswered docs question
|
|
24
|
+
|
|
25
|
+
### Router (when arguments are empty or general)
|
|
26
|
+
* **Contribute** → `cradle/contribute.js#process` — Explains contribution types and routes to the specific process
|
|
27
|
+
|
|
28
|
+
## Contribution Rules
|
|
29
|
+
|
|
30
|
+
* PR-based contributions: fork the babysitter repo (a5c-ai/babysitter) for the user, ask to star if not already starred, perform changes, submit PR
|
|
31
|
+
* Issue-based contributions: gather details, search for duplicates, review, then open an issue in a5c-ai/babysitter
|
|
32
|
+
* Add breakpoints (permissions) before ALL gh actions (fork, star, submit PR/issue) to allow user review and cancellation
|
|
33
|
+
* If arguments are empty: use the `contribute.js` router process to show options and route accordingly
|