@a5c-ai/babysitter-opencode 5.0.1-staging.542f8525 → 5.0.1-staging.55f6fe69
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/bin/cli.cjs +1 -191
- package/bin/cli.js +90 -49
- package/bin/install-shared.cjs +1 -478
- package/bin/install-shared.js +615 -0
- package/bin/install.cjs +1 -143
- package/bin/install.js +18 -98
- package/bin/uninstall.cjs +1 -87
- package/bin/uninstall.js +12 -34
- package/commands/help.md +245 -244
- package/commands/observe.md +12 -12
- package/hooks/babysitter-proxied-session-created.js +18 -212
- package/hooks/babysitter-proxied-session-created.sh +11 -0
- package/hooks/babysitter-proxied-session-idle.js +18 -167
- package/hooks/babysitter-proxied-session-idle.sh +3 -0
- package/hooks/babysitter-proxied-shell-env.js +21 -145
- package/hooks/babysitter-proxied-shell-env.sh +3 -0
- package/hooks/babysitter-proxied-tool-execute-after.js +20 -160
- package/hooks/babysitter-proxied-tool-execute-after.sh +3 -0
- package/hooks/babysitter-proxied-tool-execute-before.js +20 -162
- package/hooks/babysitter-proxied-tool-execute-before.sh +3 -0
- package/hooks/hooks.json +18 -18
- package/package.json +22 -18
- package/plugin.json +6 -4
- package/scripts/team-install.js +23 -0
- package/skills/contrib/SKILL.md +25 -25
- package/skills/help/SKILL.md +3 -2
- package/skills/observe/SKILL.md +1 -1
- package/skills/plugins/SKILL.md +243 -243
- package/skills/project-install/SKILL.md +3 -3
- package/skills/resume/SKILL.md +1 -1
- package/skills/retrospect/SKILL.md +48 -48
- package/skills/user-install/SKILL.md +3 -3
- package/versions.json +2 -2
- package/hooks/proxied-hooks.json +0 -47
package/bin/cli.cjs
CHANGED
|
@@ -1,194 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
* Babysitter OpenCode CLI shim.
|
|
6
|
-
*
|
|
7
|
-
* Provides `babysitter-opencode` command for plugin management tasks
|
|
8
|
-
* (install, uninstall, sync, doctor). Delegates heavy lifting to the
|
|
9
|
-
* SDK CLI with opencode-specific flags.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const path = require('path');
|
|
13
|
-
const { spawnSync } = require('child_process');
|
|
14
|
-
|
|
15
|
-
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
16
|
-
|
|
17
|
-
function printUsage() {
|
|
18
|
-
console.log([
|
|
19
|
-
'babysitter-opencode - Babysitter plugin for OpenCode',
|
|
20
|
-
'',
|
|
21
|
-
'Usage:',
|
|
22
|
-
' babysitter-opencode install [--global] Install plugin globally',
|
|
23
|
-
' babysitter-opencode install --workspace [path] Install into workspace',
|
|
24
|
-
' babysitter-opencode uninstall [--global] Uninstall plugin globally',
|
|
25
|
-
' babysitter-opencode uninstall --workspace [path] Uninstall from workspace',
|
|
26
|
-
' babysitter-opencode sync Sync command surfaces',
|
|
27
|
-
' babysitter-opencode doctor Check installation health',
|
|
28
|
-
' babysitter-opencode version Show version',
|
|
29
|
-
' babysitter-opencode help Show this help',
|
|
30
|
-
].join('\n'));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function parseArgs(argv) {
|
|
34
|
-
let workspace = null;
|
|
35
|
-
|
|
36
|
-
for (let i = 0; i < argv.length; i += 1) {
|
|
37
|
-
const arg = argv[i];
|
|
38
|
-
if (arg === '--workspace') {
|
|
39
|
-
const next = argv[i + 1];
|
|
40
|
-
workspace = next && !next.startsWith('-') ? path.resolve(next) : process.cwd();
|
|
41
|
-
if (next && !next.startsWith('-')) {
|
|
42
|
-
i += 1;
|
|
43
|
-
}
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
if (arg === '--global') {
|
|
47
|
-
workspace = null;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
throw new Error(`unknown argument: ${arg}`);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return { workspace };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function runNodeScript(scriptPath, args) {
|
|
57
|
-
const result = spawnSync(process.execPath, [scriptPath, ...args], {
|
|
58
|
-
cwd: process.cwd(),
|
|
59
|
-
stdio: 'inherit',
|
|
60
|
-
env: process.env,
|
|
61
|
-
});
|
|
62
|
-
process.exitCode = result.status ?? 1;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function runDoctor(workspace) {
|
|
66
|
-
const fs = require('fs');
|
|
67
|
-
const { getOpenCodeHome, getHomePluginRoot } = require('./install-shared.cjs');
|
|
68
|
-
|
|
69
|
-
const ws = workspace || process.cwd();
|
|
70
|
-
const openCodeHome = getOpenCodeHome(ws);
|
|
71
|
-
const pluginRoot = getHomePluginRoot(ws);
|
|
72
|
-
let ok = true;
|
|
73
|
-
|
|
74
|
-
console.log('[babysitter] OpenCode plugin health check');
|
|
75
|
-
console.log(` Workspace: ${ws}`);
|
|
76
|
-
console.log(` OpenCode: ${openCodeHome}`);
|
|
77
|
-
console.log(` Plugin root: ${pluginRoot}`);
|
|
78
|
-
console.log('');
|
|
79
|
-
|
|
80
|
-
// Check plugin directory
|
|
81
|
-
if (fs.existsSync(pluginRoot)) {
|
|
82
|
-
console.log(' [ok] Plugin directory exists');
|
|
83
|
-
} else {
|
|
84
|
-
console.log(' [FAIL] Plugin directory missing');
|
|
85
|
-
ok = false;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Check index.js
|
|
89
|
-
const indexPath = path.join(pluginRoot, 'index.js');
|
|
90
|
-
if (fs.existsSync(indexPath)) {
|
|
91
|
-
console.log(' [ok] index.js entry point exists');
|
|
92
|
-
} else {
|
|
93
|
-
console.log(' [FAIL] index.js entry point missing');
|
|
94
|
-
ok = false;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Check plugin.json
|
|
98
|
-
const pluginJsonPath = path.join(pluginRoot, 'plugin.json');
|
|
99
|
-
if (fs.existsSync(pluginJsonPath)) {
|
|
100
|
-
console.log(' [ok] plugin.json exists');
|
|
101
|
-
} else {
|
|
102
|
-
console.log(' [FAIL] plugin.json missing');
|
|
103
|
-
ok = false;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Check hooks
|
|
107
|
-
const hooksDir = path.join(pluginRoot, 'hooks');
|
|
108
|
-
if (fs.existsSync(hooksDir)) {
|
|
109
|
-
const hooks = fs.readdirSync(hooksDir).filter((f) => f.endsWith('.js'));
|
|
110
|
-
console.log(` [ok] hooks/ directory (${hooks.length} scripts)`);
|
|
111
|
-
} else {
|
|
112
|
-
console.log(' [FAIL] hooks/ directory missing');
|
|
113
|
-
ok = false;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Check skills
|
|
117
|
-
const skillPath = path.join(pluginRoot, 'skills', 'babysit', 'SKILL.md');
|
|
118
|
-
if (fs.existsSync(skillPath)) {
|
|
119
|
-
console.log(' [ok] skills/babysit/SKILL.md exists');
|
|
120
|
-
} else {
|
|
121
|
-
console.log(' [WARN] skills/babysit/SKILL.md missing');
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Check babysitter CLI availability
|
|
125
|
-
const { spawnSync: spawn } = require('child_process');
|
|
126
|
-
const cliCheck = spawn('babysitter', ['--version'], {
|
|
127
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
128
|
-
encoding: 'utf8',
|
|
129
|
-
});
|
|
130
|
-
if (cliCheck.status === 0) {
|
|
131
|
-
console.log(` [ok] babysitter CLI: ${(cliCheck.stdout || '').trim()}`);
|
|
132
|
-
} else {
|
|
133
|
-
console.log(' [WARN] babysitter CLI not found in PATH');
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
console.log('');
|
|
137
|
-
if (ok) {
|
|
138
|
-
console.log(' All checks passed.');
|
|
139
|
-
} else {
|
|
140
|
-
console.log(' Some checks failed. Run "babysitter-opencode install" to fix.');
|
|
141
|
-
process.exitCode = 1;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function main() {
|
|
146
|
-
const [command, ...rest] = process.argv.slice(2);
|
|
147
|
-
if (!command || command === '--help' || command === '-h' || command === 'help') {
|
|
148
|
-
printUsage();
|
|
149
|
-
process.exitCode = command ? 0 : 1;
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
switch (command) {
|
|
154
|
-
case 'install':
|
|
155
|
-
case 'uninstall': {
|
|
156
|
-
const parsed = parseArgs(rest);
|
|
157
|
-
const args = parsed.workspace ? ['--workspace', parsed.workspace] : ['--global'];
|
|
158
|
-
runNodeScript(path.join(PACKAGE_ROOT, 'bin', `${command}.cjs`), args);
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
case 'sync': {
|
|
162
|
-
const syncScript = path.join(PACKAGE_ROOT, 'scripts', 'sync-command-surfaces.js');
|
|
163
|
-
const fs = require('fs');
|
|
164
|
-
if (fs.existsSync(syncScript)) {
|
|
165
|
-
runNodeScript(syncScript, rest);
|
|
166
|
-
} else {
|
|
167
|
-
console.error('[babysitter] sync-command-surfaces.js not found');
|
|
168
|
-
process.exitCode = 1;
|
|
169
|
-
}
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
case 'doctor': {
|
|
173
|
-
const parsed = parseArgs(rest);
|
|
174
|
-
runDoctor(parsed.workspace);
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
case 'version': {
|
|
178
|
-
try {
|
|
179
|
-
const pkg = require(path.join(PACKAGE_ROOT, 'package.json'));
|
|
180
|
-
console.log(pkg.version);
|
|
181
|
-
} catch {
|
|
182
|
-
console.log('unknown');
|
|
183
|
-
}
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
default:
|
|
187
|
-
console.error(`Unknown command: ${command}`);
|
|
188
|
-
printUsage();
|
|
189
|
-
process.exitCode = 1;
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
main();
|
|
4
|
+
require('./cli.js');
|
package/bin/cli.js
CHANGED
|
@@ -1,55 +1,96 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { spawnSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
8
|
+
let shared;
|
|
9
|
+
try { shared = require('./install-shared'); } catch {}
|
|
10
|
+
|
|
11
|
+
function printUsage() {
|
|
12
|
+
console.error([
|
|
13
|
+
'Usage:',
|
|
14
|
+
' babysitter-opencode install [--global]',
|
|
15
|
+
' babysitter-opencode install --workspace [path]',
|
|
16
|
+
' babysitter-opencode uninstall',
|
|
17
|
+
].join('\n'));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function parseInstallArgs(argv) {
|
|
21
|
+
let scope = 'global';
|
|
22
|
+
let workspace = null;
|
|
23
|
+
const passthrough = [];
|
|
24
|
+
|
|
25
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
26
|
+
const arg = argv[i];
|
|
27
|
+
if (arg === '--global') {
|
|
28
|
+
scope = 'global';
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (arg === '--workspace') {
|
|
32
|
+
scope = 'workspace';
|
|
33
|
+
const next = argv[i + 1];
|
|
34
|
+
if (next && !next.startsWith('-')) {
|
|
35
|
+
workspace = path.resolve(next);
|
|
36
|
+
i += 1;
|
|
37
|
+
} else {
|
|
38
|
+
workspace = process.cwd();
|
|
39
|
+
}
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
passthrough.push(arg);
|
|
23
43
|
}
|
|
44
|
+
|
|
45
|
+
return { scope, workspace, passthrough };
|
|
24
46
|
}
|
|
25
47
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
function runNodeScript(scriptPath, args, extraEnv = {}) {
|
|
49
|
+
const result = spawnSync(process.execPath, [scriptPath, ...args], {
|
|
50
|
+
cwd: process.cwd(),
|
|
51
|
+
stdio: 'inherit',
|
|
52
|
+
env: { ...process.env, ...extraEnv },
|
|
53
|
+
});
|
|
54
|
+
process.exitCode = result.status ?? 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function main() {
|
|
58
|
+
const [command, ...rest] = process.argv.slice(2);
|
|
59
|
+
if (!command || command === '--help' || command === '-h' || command === 'help') {
|
|
60
|
+
printUsage();
|
|
61
|
+
process.exitCode = command ? 0 : 1;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (command === 'install') {
|
|
66
|
+
if (shared && typeof shared.harnessCliRoute === 'function' && shared.harnessCliRoute(rest, PACKAGE_ROOT, runNodeScript)) {
|
|
67
|
+
return;
|
|
42
68
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
69
|
+
const parsed = parseInstallArgs(rest);
|
|
70
|
+
if (parsed.scope === 'workspace') {
|
|
71
|
+
const args = [];
|
|
72
|
+
if (parsed.workspace) {
|
|
73
|
+
args.push('--workspace', parsed.workspace);
|
|
74
|
+
}
|
|
75
|
+
args.push(...parsed.passthrough);
|
|
76
|
+
runNodeScript(
|
|
77
|
+
path.join(PACKAGE_ROOT, 'scripts', 'team-install.js'),
|
|
78
|
+
args,
|
|
79
|
+
{ PLUGIN_PACKAGE_ROOT: PACKAGE_ROOT },
|
|
80
|
+
);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
runNodeScript(path.join(PACKAGE_ROOT, 'bin', 'install.js'), parsed.passthrough);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (command === 'uninstall') {
|
|
88
|
+
runNodeScript(path.join(PACKAGE_ROOT, 'bin', 'uninstall.js'), rest);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
printUsage();
|
|
93
|
+
process.exitCode = 1;
|
|
55
94
|
}
|
|
95
|
+
|
|
96
|
+
main();
|