@a5c-ai/babysitter-cursor 0.1.1-staging.04cc300a
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/.cursor-plugin/plugin.json +22 -0
- package/.cursorrules +55 -0
- package/README.md +491 -0
- package/bin/cli.js +104 -0
- package/bin/install-shared.js +394 -0
- package/bin/install.js +46 -0
- package/bin/uninstall.js +40 -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/hooks/hooks-cursor.json +21 -0
- package/hooks/session-start.ps1 +115 -0
- package/hooks/session-start.sh +105 -0
- package/hooks/stop-hook.ps1 +72 -0
- package/hooks/stop-hook.sh +64 -0
- package/hooks.json +21 -0
- package/package.json +49 -0
- package/plugin.json +24 -0
- package/scripts/sync-command-surfaces.js +62 -0
- package/scripts/team-install.js +81 -0
- package/skills/assimilate/SKILL.md +38 -0
- package/skills/babysit/SKILL.md +81 -0
- package/skills/call/SKILL.md +8 -0
- package/skills/doctor/SKILL.md +427 -0
- package/skills/help/SKILL.md +245 -0
- package/skills/observe/SKILL.md +13 -0
- package/skills/plan/SKILL.md +8 -0
- package/skills/resume/SKILL.md +9 -0
- package/skills/retrospect/SKILL.md +56 -0
- package/skills/user-install/SKILL.md +18 -0
- package/versions.json +3 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { spawnSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
const PLUGIN_NAME = 'babysitter';
|
|
9
|
+
const PLUGIN_CATEGORY = 'Coding';
|
|
10
|
+
const HOOK_SCRIPT_NAMES = [
|
|
11
|
+
'session-start.sh',
|
|
12
|
+
'session-start.ps1',
|
|
13
|
+
'stop-hook.sh',
|
|
14
|
+
'stop-hook.ps1',
|
|
15
|
+
];
|
|
16
|
+
const DEFAULT_MARKETPLACE = {
|
|
17
|
+
name: 'local-plugins',
|
|
18
|
+
interface: {
|
|
19
|
+
displayName: 'Local Plugins',
|
|
20
|
+
},
|
|
21
|
+
plugins: [],
|
|
22
|
+
};
|
|
23
|
+
const MANAGED_HOOKS_CONFIG_PATHS = [
|
|
24
|
+
path.join('hooks', 'hooks-cursor.json'),
|
|
25
|
+
'hooks.json',
|
|
26
|
+
];
|
|
27
|
+
const PLUGIN_BUNDLE_ENTRIES = [
|
|
28
|
+
'.cursor-plugin',
|
|
29
|
+
'plugin.json',
|
|
30
|
+
'hooks.json',
|
|
31
|
+
'hooks',
|
|
32
|
+
'skills',
|
|
33
|
+
'commands',
|
|
34
|
+
'versions.json',
|
|
35
|
+
'.cursorrules',
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
function getCursorHome() {
|
|
39
|
+
if (process.env.CURSOR_HOME) return path.resolve(process.env.CURSOR_HOME);
|
|
40
|
+
return path.join(os.homedir(), '.cursor');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getUserHome() {
|
|
44
|
+
if (process.env.USERPROFILE) return path.resolve(process.env.USERPROFILE);
|
|
45
|
+
if (process.env.HOME) return path.resolve(process.env.HOME);
|
|
46
|
+
return os.homedir();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function getGlobalStateDir() {
|
|
50
|
+
if (process.env.BABYSITTER_GLOBAL_STATE_DIR) {
|
|
51
|
+
return path.resolve(process.env.BABYSITTER_GLOBAL_STATE_DIR);
|
|
52
|
+
}
|
|
53
|
+
return path.join(getUserHome(), '.a5c');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getHomePluginRoot() {
|
|
57
|
+
if (process.env.BABYSITTER_CURSOR_PLUGIN_DIR) {
|
|
58
|
+
return path.resolve(process.env.BABYSITTER_CURSOR_PLUGIN_DIR, PLUGIN_NAME);
|
|
59
|
+
}
|
|
60
|
+
return path.join(getCursorHome(), 'plugins', 'local', PLUGIN_NAME);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function getHomeMarketplacePath() {
|
|
64
|
+
if (process.env.BABYSITTER_CURSOR_MARKETPLACE_PATH) {
|
|
65
|
+
return path.resolve(process.env.BABYSITTER_CURSOR_MARKETPLACE_PATH);
|
|
66
|
+
}
|
|
67
|
+
return path.join(getUserHome(), '.agents', 'plugins', 'marketplace.json');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function writeFileIfChanged(filePath, contents) {
|
|
71
|
+
if (fs.existsSync(filePath)) {
|
|
72
|
+
const current = fs.readFileSync(filePath, 'utf8');
|
|
73
|
+
if (current === contents) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
78
|
+
fs.writeFileSync(filePath, contents, 'utf8');
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function copyRecursive(src, dest) {
|
|
83
|
+
const stat = fs.statSync(src);
|
|
84
|
+
if (stat.isDirectory()) {
|
|
85
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
86
|
+
for (const entry of fs.readdirSync(src)) {
|
|
87
|
+
if (['node_modules', '.git', 'test', '.a5c'].includes(entry)) continue;
|
|
88
|
+
copyRecursive(path.join(src, entry), path.join(dest, entry));
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (path.basename(src) === 'SKILL.md') {
|
|
94
|
+
const file = fs.readFileSync(src);
|
|
95
|
+
const hasBom = file.length >= 3 && file[0] === 0xef && file[1] === 0xbb && file[2] === 0xbf;
|
|
96
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
97
|
+
fs.writeFileSync(dest, hasBom ? file.subarray(3) : file);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
102
|
+
fs.copyFileSync(src, dest);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function copyPluginBundle(packageRoot, pluginRoot) {
|
|
106
|
+
if (path.resolve(packageRoot) === path.resolve(pluginRoot)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
fs.rmSync(pluginRoot, { recursive: true, force: true });
|
|
110
|
+
fs.mkdirSync(pluginRoot, { recursive: true });
|
|
111
|
+
for (const entry of PLUGIN_BUNDLE_ENTRIES) {
|
|
112
|
+
const src = path.join(packageRoot, entry);
|
|
113
|
+
if (fs.existsSync(src)) {
|
|
114
|
+
copyRecursive(src, path.join(pluginRoot, entry));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function ensureExecutable(filePath) {
|
|
120
|
+
try {
|
|
121
|
+
fs.chmodSync(filePath, 0o755);
|
|
122
|
+
} catch {
|
|
123
|
+
// Best-effort only. Windows and some filesystems may ignore mode changes.
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function normalizeMarketplaceSourcePath(marketplacePath, pluginSourcePath) {
|
|
128
|
+
let next = pluginSourcePath;
|
|
129
|
+
if (path.isAbsolute(next)) {
|
|
130
|
+
next = path.relative(path.dirname(marketplacePath), next);
|
|
131
|
+
}
|
|
132
|
+
next = String(next || '').replace(/\\/g, '/');
|
|
133
|
+
if (!next.startsWith('./') && !next.startsWith('../')) {
|
|
134
|
+
next = `./${next}`;
|
|
135
|
+
}
|
|
136
|
+
return next;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function readJson(filePath) {
|
|
140
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function getManagedHooksConfigPath(packageRoot) {
|
|
144
|
+
for (const relativePath of MANAGED_HOOKS_CONFIG_PATHS) {
|
|
145
|
+
const candidate = path.join(packageRoot, relativePath);
|
|
146
|
+
if (fs.existsSync(candidate)) {
|
|
147
|
+
return candidate;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function writeJson(filePath, value) {
|
|
154
|
+
writeFileIfChanged(filePath, `${JSON.stringify(value, null, 2)}\n`);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function normalizeMarketplaceName(name) {
|
|
158
|
+
const raw = String(name || '').trim();
|
|
159
|
+
const sanitized = raw
|
|
160
|
+
.replace(/[^A-Za-z0-9_-]+/g, '-')
|
|
161
|
+
.replace(/^-+|-+$/g, '');
|
|
162
|
+
return sanitized || DEFAULT_MARKETPLACE.name;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function ensureMarketplaceEntry(marketplacePath, pluginSourcePath) {
|
|
166
|
+
const marketplace = fs.existsSync(marketplacePath)
|
|
167
|
+
? readJson(marketplacePath)
|
|
168
|
+
: { ...DEFAULT_MARKETPLACE, plugins: [] };
|
|
169
|
+
marketplace.name = normalizeMarketplaceName(marketplace.name);
|
|
170
|
+
marketplace.interface = marketplace.interface || {};
|
|
171
|
+
marketplace.interface.displayName =
|
|
172
|
+
marketplace.interface.displayName || DEFAULT_MARKETPLACE.interface.displayName;
|
|
173
|
+
const nextEntry = {
|
|
174
|
+
name: PLUGIN_NAME,
|
|
175
|
+
source: {
|
|
176
|
+
source: 'local',
|
|
177
|
+
path: normalizeMarketplaceSourcePath(marketplacePath, pluginSourcePath),
|
|
178
|
+
},
|
|
179
|
+
policy: {
|
|
180
|
+
installation: 'AVAILABLE',
|
|
181
|
+
authentication: 'ON_INSTALL',
|
|
182
|
+
},
|
|
183
|
+
category: PLUGIN_CATEGORY,
|
|
184
|
+
};
|
|
185
|
+
const existingIndex = Array.isArray(marketplace.plugins)
|
|
186
|
+
? marketplace.plugins.findIndex((entry) => entry && entry.name === PLUGIN_NAME)
|
|
187
|
+
: -1;
|
|
188
|
+
if (!Array.isArray(marketplace.plugins)) {
|
|
189
|
+
marketplace.plugins = [nextEntry];
|
|
190
|
+
} else if (existingIndex >= 0) {
|
|
191
|
+
marketplace.plugins[existingIndex] = nextEntry;
|
|
192
|
+
} else {
|
|
193
|
+
marketplace.plugins.push(nextEntry);
|
|
194
|
+
}
|
|
195
|
+
writeJson(marketplacePath, marketplace);
|
|
196
|
+
return nextEntry;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function removeMarketplaceEntry(marketplacePath) {
|
|
200
|
+
if (!fs.existsSync(marketplacePath)) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const marketplace = readJson(marketplacePath);
|
|
204
|
+
if (!Array.isArray(marketplace.plugins)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
marketplace.plugins = marketplace.plugins.filter((entry) => entry && entry.name !== PLUGIN_NAME);
|
|
208
|
+
writeJson(marketplacePath, marketplace);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function mergeManagedHooksConfig(packageRoot, cursorHome) {
|
|
212
|
+
const hooksJsonPath = getManagedHooksConfigPath(packageRoot);
|
|
213
|
+
if (!hooksJsonPath) return;
|
|
214
|
+
const managedConfig = readJson(hooksJsonPath);
|
|
215
|
+
const managedHooks = managedConfig.hooks || {};
|
|
216
|
+
const hooksConfigPath = path.join(cursorHome, 'hooks.json');
|
|
217
|
+
const existing = fs.existsSync(hooksConfigPath)
|
|
218
|
+
? readJson(hooksConfigPath)
|
|
219
|
+
: { version: 1, hooks: {} };
|
|
220
|
+
existing.version = existing.version || 1;
|
|
221
|
+
if (!existing.hooks || typeof existing.hooks !== 'object') {
|
|
222
|
+
existing.hooks = {};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
for (const [eventName, entries] of Object.entries(managedHooks)) {
|
|
226
|
+
const existingEntries = Array.isArray(existing.hooks[eventName]) ? existing.hooks[eventName] : [];
|
|
227
|
+
const filteredEntries = existingEntries
|
|
228
|
+
.filter((entry) => {
|
|
229
|
+
const bash = String(entry.bash || entry.command || '');
|
|
230
|
+
const ps = String(entry.powershell || '');
|
|
231
|
+
return !HOOK_SCRIPT_NAMES.some((name) => bash.includes(name) || ps.includes(name));
|
|
232
|
+
});
|
|
233
|
+
existing.hooks[eventName] = [...filteredEntries, ...entries];
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
writeJson(hooksConfigPath, existing);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function removeManagedHooks(cursorHome) {
|
|
240
|
+
for (const hookName of HOOK_SCRIPT_NAMES) {
|
|
241
|
+
fs.rmSync(path.join(cursorHome, 'hooks', hookName), { force: true });
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const hooksConfigPath = path.join(cursorHome, 'hooks.json');
|
|
245
|
+
if (!fs.existsSync(hooksConfigPath)) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
let hooksConfig;
|
|
249
|
+
try {
|
|
250
|
+
hooksConfig = readJson(hooksConfigPath);
|
|
251
|
+
} catch {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (!hooksConfig.hooks || typeof hooksConfig.hooks !== 'object') {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
for (const eventName of Object.keys(hooksConfig.hooks)) {
|
|
258
|
+
const eventHooks = Array.isArray(hooksConfig.hooks[eventName]) ? hooksConfig.hooks[eventName] : [];
|
|
259
|
+
const filtered = eventHooks.filter((entry) => {
|
|
260
|
+
const bash = String(entry.bash || entry.command || '');
|
|
261
|
+
const ps = String(entry.powershell || '');
|
|
262
|
+
return !HOOK_SCRIPT_NAMES.some((name) => bash.includes(name) || ps.includes(name));
|
|
263
|
+
});
|
|
264
|
+
if (filtered.length > 0) {
|
|
265
|
+
hooksConfig.hooks[eventName] = filtered;
|
|
266
|
+
} else {
|
|
267
|
+
delete hooksConfig.hooks[eventName];
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (Object.keys(hooksConfig.hooks).length === 0) {
|
|
271
|
+
fs.rmSync(hooksConfigPath, { force: true });
|
|
272
|
+
} else {
|
|
273
|
+
writeJson(hooksConfigPath, hooksConfig);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function installCursorSurface(packageRoot, cursorHome) {
|
|
278
|
+
// Install skills
|
|
279
|
+
const sourceSkills = path.join(packageRoot, 'skills');
|
|
280
|
+
if (fs.existsSync(sourceSkills)) {
|
|
281
|
+
const targetSkills = path.join(cursorHome, 'skills');
|
|
282
|
+
fs.mkdirSync(targetSkills, { recursive: true });
|
|
283
|
+
for (const entry of fs.readdirSync(sourceSkills, { withFileTypes: true })) {
|
|
284
|
+
if (!entry.isDirectory()) continue;
|
|
285
|
+
copyRecursive(
|
|
286
|
+
path.join(sourceSkills, entry.name),
|
|
287
|
+
path.join(targetSkills, entry.name),
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Install hooks
|
|
293
|
+
const sourceHooks = path.join(packageRoot, 'hooks');
|
|
294
|
+
if (fs.existsSync(sourceHooks)) {
|
|
295
|
+
const targetHooks = path.join(cursorHome, 'hooks');
|
|
296
|
+
fs.mkdirSync(targetHooks, { recursive: true });
|
|
297
|
+
for (const scriptName of HOOK_SCRIPT_NAMES) {
|
|
298
|
+
const sourcePath = path.join(sourceHooks, scriptName);
|
|
299
|
+
if (!fs.existsSync(sourcePath)) continue;
|
|
300
|
+
const targetPath = path.join(targetHooks, scriptName);
|
|
301
|
+
copyRecursive(sourcePath, targetPath);
|
|
302
|
+
ensureExecutable(targetPath);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Merge hooks.json config
|
|
307
|
+
mergeManagedHooksConfig(packageRoot, cursorHome);
|
|
308
|
+
|
|
309
|
+
// Install .cursorrules
|
|
310
|
+
const sourceRules = path.join(packageRoot, '.cursorrules');
|
|
311
|
+
if (fs.existsSync(sourceRules)) {
|
|
312
|
+
copyRecursive(sourceRules, path.join(cursorHome, '.cursorrules'));
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function resolveBabysitterCommand(packageRoot) {
|
|
317
|
+
if (process.env.BABYSITTER_SDK_CLI) {
|
|
318
|
+
return {
|
|
319
|
+
command: process.execPath,
|
|
320
|
+
argsPrefix: [path.resolve(process.env.BABYSITTER_SDK_CLI)],
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
try {
|
|
324
|
+
return {
|
|
325
|
+
command: process.execPath,
|
|
326
|
+
argsPrefix: [
|
|
327
|
+
require.resolve('@a5c-ai/babysitter-sdk/dist/cli/main.js', {
|
|
328
|
+
paths: [packageRoot],
|
|
329
|
+
}),
|
|
330
|
+
],
|
|
331
|
+
};
|
|
332
|
+
} catch {
|
|
333
|
+
return {
|
|
334
|
+
command: 'babysitter',
|
|
335
|
+
argsPrefix: [],
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function runBabysitterCli(packageRoot, cliArgs, options = {}) {
|
|
341
|
+
const resolved = resolveBabysitterCommand(packageRoot);
|
|
342
|
+
const result = spawnSync(resolved.command, [...resolved.argsPrefix, ...cliArgs], {
|
|
343
|
+
cwd: options.cwd || process.cwd(),
|
|
344
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
345
|
+
encoding: 'utf8',
|
|
346
|
+
env: {
|
|
347
|
+
...process.env,
|
|
348
|
+
...(options.env || {}),
|
|
349
|
+
},
|
|
350
|
+
});
|
|
351
|
+
if (result.status !== 0) {
|
|
352
|
+
const stderr = (result.stderr || '').trim();
|
|
353
|
+
const stdout = (result.stdout || '').trim();
|
|
354
|
+
throw new Error(
|
|
355
|
+
`babysitter ${cliArgs.join(' ')} failed` +
|
|
356
|
+
(stderr ? `: ${stderr}` : stdout ? `: ${stdout}` : ''),
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
return result.stdout;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function ensureGlobalProcessLibrary(packageRoot) {
|
|
363
|
+
return JSON.parse(
|
|
364
|
+
runBabysitterCli(
|
|
365
|
+
packageRoot,
|
|
366
|
+
['process-library:active', '--state-dir', getGlobalStateDir(), '--json'],
|
|
367
|
+
{ cwd: packageRoot },
|
|
368
|
+
),
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function warnWindowsHooks() {
|
|
373
|
+
if (process.platform !== 'win32') {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
console.warn(`[${PLUGIN_NAME}] Note: On Windows, Cursor will use .ps1 PowerShell hooks.`);
|
|
377
|
+
console.warn(`[${PLUGIN_NAME}] Both bash (.sh) and PowerShell (.ps1) hook scripts are included.`);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
module.exports = {
|
|
381
|
+
copyPluginBundle,
|
|
382
|
+
ensureGlobalProcessLibrary,
|
|
383
|
+
ensureMarketplaceEntry,
|
|
384
|
+
getManagedHooksConfigPath,
|
|
385
|
+
getCursorHome,
|
|
386
|
+
getHomeMarketplacePath,
|
|
387
|
+
getHomePluginRoot,
|
|
388
|
+
installCursorSurface,
|
|
389
|
+
removeManagedHooks,
|
|
390
|
+
removeMarketplaceEntry,
|
|
391
|
+
warnWindowsHooks,
|
|
392
|
+
writeJson,
|
|
393
|
+
normalizeMarketplaceName,
|
|
394
|
+
};
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const {
|
|
6
|
+
copyPluginBundle,
|
|
7
|
+
ensureGlobalProcessLibrary,
|
|
8
|
+
ensureMarketplaceEntry,
|
|
9
|
+
getCursorHome,
|
|
10
|
+
getHomeMarketplacePath,
|
|
11
|
+
getHomePluginRoot,
|
|
12
|
+
installCursorSurface,
|
|
13
|
+
warnWindowsHooks,
|
|
14
|
+
} = require('./install-shared');
|
|
15
|
+
|
|
16
|
+
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
17
|
+
|
|
18
|
+
function main() {
|
|
19
|
+
const cursorHome = getCursorHome();
|
|
20
|
+
const pluginRoot = getHomePluginRoot();
|
|
21
|
+
const marketplacePath = getHomeMarketplacePath();
|
|
22
|
+
|
|
23
|
+
console.log(`[babysitter] Installing plugin to ${pluginRoot}`);
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
copyPluginBundle(PACKAGE_ROOT, pluginRoot);
|
|
27
|
+
ensureMarketplaceEntry(marketplacePath, pluginRoot);
|
|
28
|
+
installCursorSurface(PACKAGE_ROOT, cursorHome);
|
|
29
|
+
|
|
30
|
+
const active = ensureGlobalProcessLibrary(PACKAGE_ROOT);
|
|
31
|
+
console.log(`[babysitter] marketplace: ${marketplacePath}`);
|
|
32
|
+
console.log(`[babysitter] process library: ${active.binding?.dir}`);
|
|
33
|
+
if (active.defaultSpec?.cloneDir) {
|
|
34
|
+
console.log(`[babysitter] process library clone: ${active.defaultSpec.cloneDir}`);
|
|
35
|
+
}
|
|
36
|
+
console.log(`[babysitter] process library state: ${active.stateFile}`);
|
|
37
|
+
warnWindowsHooks();
|
|
38
|
+
console.log('[babysitter] Installation complete!');
|
|
39
|
+
console.log('[babysitter] Restart Cursor to pick up the installed plugin and config changes.');
|
|
40
|
+
} catch (err) {
|
|
41
|
+
console.error(`[babysitter] Failed to install plugin: ${err.message}`);
|
|
42
|
+
process.exitCode = 1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
main();
|
package/bin/uninstall.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const {
|
|
6
|
+
getCursorHome,
|
|
7
|
+
getHomeMarketplacePath,
|
|
8
|
+
getHomePluginRoot,
|
|
9
|
+
removeManagedHooks,
|
|
10
|
+
removeMarketplaceEntry,
|
|
11
|
+
} = require('./install-shared');
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
const cursorHome = getCursorHome();
|
|
15
|
+
const pluginRoot = getHomePluginRoot();
|
|
16
|
+
const marketplacePath = getHomeMarketplacePath();
|
|
17
|
+
let removedPlugin = false;
|
|
18
|
+
|
|
19
|
+
if (fs.existsSync(pluginRoot)) {
|
|
20
|
+
try {
|
|
21
|
+
fs.rmSync(pluginRoot, { recursive: true, force: true });
|
|
22
|
+
console.log(`[babysitter] Removed ${pluginRoot}`);
|
|
23
|
+
removedPlugin = true;
|
|
24
|
+
} catch (err) {
|
|
25
|
+
console.warn(`[babysitter] Warning: Could not remove plugin directory ${pluginRoot}: ${err.message}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
removeMarketplaceEntry(marketplacePath);
|
|
30
|
+
removeManagedHooks(cursorHome);
|
|
31
|
+
|
|
32
|
+
if (!removedPlugin) {
|
|
33
|
+
console.log('[babysitter] Plugin directory not found, config and hooks cleaned if present.');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.log('[babysitter] Restart Cursor to complete uninstallation.');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
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/domains/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/domains/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
|