@a5c-ai/babysitter-opencode 5.0.1-staging.f6432257 → 5.0.1-staging.f888f721bccb

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.
Files changed (55) hide show
  1. package/README.md +19 -21
  2. package/bin/cli.cjs +1 -191
  3. package/bin/cli.js +90 -49
  4. package/bin/install-shared.cjs +1 -478
  5. package/bin/install-shared.js +615 -0
  6. package/bin/install.cjs +1 -143
  7. package/bin/install.js +18 -98
  8. package/bin/uninstall.cjs +1 -87
  9. package/bin/uninstall.js +12 -34
  10. package/commands/call.md +5 -1
  11. package/commands/cleanup.md +30 -8
  12. package/commands/doctor.md +7 -8
  13. package/commands/help.md +246 -244
  14. package/commands/observe.md +17 -12
  15. package/commands/yolo.md +11 -7
  16. package/hooks/babysitter-proxied-session-created.js +18 -212
  17. package/hooks/babysitter-proxied-session-created.sh +11 -0
  18. package/hooks/babysitter-proxied-shell-env.js +21 -145
  19. package/hooks/babysitter-proxied-shell-env.sh +3 -0
  20. package/hooks/babysitter-proxied-stop-hook.sh +3 -0
  21. package/hooks/babysitter-proxied-tool-execute-after.js +20 -160
  22. package/hooks/babysitter-proxied-tool-execute-after.sh +3 -0
  23. package/hooks/babysitter-proxied-tool-execute-before.js +20 -162
  24. package/hooks/babysitter-proxied-tool-execute-before.sh +3 -0
  25. package/hooks/hooks.json +14 -22
  26. package/package.json +21 -19
  27. package/plugin.json +6 -4
  28. package/scripts/create-release-tag.mjs +18 -0
  29. package/scripts/publish-from-tag.mjs +41 -0
  30. package/scripts/team-install.js +23 -0
  31. package/skills/accomplish-status/SKILL.md +1 -1
  32. package/skills/babysit/SKILL.md +4 -3
  33. package/skills/call/SKILL.md +5 -1
  34. package/skills/cleanup/SKILL.md +30 -8
  35. package/skills/contrib/SKILL.md +25 -25
  36. package/skills/doctor/SKILL.md +7 -8
  37. package/skills/help/SKILL.md +4 -2
  38. package/skills/observe/SKILL.md +7 -2
  39. package/skills/plugins/SKILL.md +243 -243
  40. package/skills/project-install/SKILL.md +3 -3
  41. package/skills/resume/SKILL.md +1 -1
  42. package/skills/retrospect/SKILL.md +48 -48
  43. package/skills/user-install/SKILL.md +3 -3
  44. package/skills/yolo/SKILL.md +5 -1
  45. package/versions.json +2 -2
  46. package/hooks/babysitter-proxied-session-idle.js +0 -173
  47. package/hooks/hooks.json.legacy +0 -46
  48. package/hooks/proxied-hooks.json +0 -47
  49. package/hooks/session-created.js +0 -182
  50. package/hooks/session-idle.js +0 -124
  51. package/hooks/shell-env.js +0 -88
  52. package/hooks/tool-execute-after.js +0 -107
  53. package/hooks/tool-execute-before.js +0 -109
  54. package/scripts/sync-command-docs.cjs +0 -107
  55. package/scripts/sync-command-surfaces.js +0 -52
package/README.md CHANGED
@@ -9,7 +9,7 @@ complex multi-step workflows -- powered by the Babysitter SDK.
9
9
  ## Plugin Structure
10
10
 
11
11
  ```
12
- plugins/babysitter-opencode/
12
+ artifacts/generated-plugins/opencode/
13
13
  bin/
14
14
  cli.cjs CLI entry point (babysitter-opencode command)
15
15
  install.cjs Installation script
@@ -36,31 +36,29 @@ plugins/babysitter-opencode/
36
36
 
37
37
  ### Prerequisites
38
38
 
39
- Install the Babysitter SDK CLI:
39
+ Install the Babysitter CLI once:
40
40
 
41
41
  ```bash
42
- npm install -g @a5c-ai/babysitter-sdk
42
+ npm install -g @a5c-ai/babysitter
43
43
  ```
44
44
 
45
- ### Method 1: npm global install (recommended)
45
+ ### Method 1: Babysitter harness install (recommended)
46
46
 
47
- ```bash
48
- npm install -g @a5c-ai/babysitter-opencode
49
- ```
50
-
51
- The `postinstall` script automatically copies the plugin into your current
52
- workspace's `.opencode/plugins/babysitter/` directory.
53
-
54
- To install into a specific workspace:
47
+ Use the SDK helper for scriptable global or workspace installs. This is the canonical path used by the installer tests and resolves to `npx --yes @a5c-ai/babysitter-opencode install ...` under the hood:
55
48
 
56
49
  ```bash
57
- babysitter-opencode install --workspace /path/to/project
50
+ # Global install
51
+ babysitter harness:install-plugin opencode
52
+
53
+ # Workspace install
54
+ babysitter harness:install-plugin opencode --workspace /path/to/project
58
55
  ```
59
56
 
60
- ### Method 2: Babysitter harness install
57
+ ### Method 2: Published package installer
61
58
 
62
59
  ```bash
63
- babysitter harness:install-plugin opencode
60
+ npx --yes @a5c-ai/babysitter-opencode install --global
61
+ npx --yes @a5c-ai/babysitter-opencode install --workspace /path/to/project
64
62
  ```
65
63
 
66
64
  ### Method 3: Manual copy
@@ -94,13 +92,13 @@ OpenCode config directory (`<userDataPath>/opencode/plugins/babysitter/`).
94
92
 
95
93
  ```bash
96
94
  # Auto-detects Accomplish during standard install
97
- npm install -g @a5c-ai/babysitter-opencode
95
+ npx --yes @a5c-ai/babysitter-opencode install --global
98
96
 
99
97
  # Or target Accomplish explicitly
100
- babysitter-opencode install --accomplish
98
+ npx --yes @a5c-ai/babysitter-opencode install --accomplish
101
99
 
102
100
  # Install to both standalone OpenCode and Accomplish
103
- babysitter-opencode install --global --accomplish
101
+ npx --yes @a5c-ai/babysitter-opencode install --global --accomplish
104
102
  ```
105
103
 
106
104
  Accomplish stores OpenCode config at platform-specific locations:
@@ -131,7 +129,7 @@ plugin registers hooks for the following OpenCode events:
131
129
  |----------------|-----------------|---------|
132
130
  | `session.created` | `session-start` | Initialize session state |
133
131
  | `session.idle` | `stop` | Check for pending effects |
134
- | `shell.env` | -- | Inject env vars (BABYSITTER_SESSION_ID) |
132
+ | `shell.env` | -- | Inject env vars (AGENT_SESSION_ID) |
135
133
  | `tool.execute.before` | `pre-tool-use` | Pre-tool-use awareness |
136
134
  | `tool.execute.after` | `post-tool-use` | Post-tool-use awareness |
137
135
 
@@ -147,7 +145,7 @@ the agent runs the full orchestration loop within a single turn by calling
147
145
  The `shell.env` hook self-injects these variables since OpenCode does not
148
146
  natively provide them:
149
147
 
150
- - `BABYSITTER_SESSION_ID` -- Unique session identifier
148
+ - `AGENT_SESSION_ID` -- Unique session identifier
151
149
  - `OPENCODE_SESSION_ID` -- Alias for session ID
152
150
  - `BABYSITTER_STATE_DIR` -- State directory path
153
151
  - `BABYSITTER_RUNS_DIR` -- Runs directory path
@@ -206,7 +204,7 @@ babysitter process-library:active --json
206
204
  ## Running Tests
207
205
 
208
206
  ```bash
209
- cd plugins/babysitter-opencode
207
+ cd artifacts/generated-plugins/opencode
210
208
  npm test
211
209
  ```
212
210
 
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
- * Babysitter OpenCode CLI shim.
4
- *
5
- * Provides `babysitter-opencode` command for plugin management tasks
6
- * (install, uninstall, sync). Delegates heavy lifting to the SDK CLI.
7
- */
8
-
9
- "use strict";
10
-
11
- const { execSync } = require("child_process");
12
- const path = require("path");
13
-
14
- const PLUGIN_ROOT = path.resolve(__dirname, "..");
15
- const args = process.argv.slice(2);
16
- const command = args[0] || "help";
17
-
18
- function run(cmd) {
19
- try {
20
- execSync(cmd, { stdio: "inherit", cwd: PLUGIN_ROOT });
21
- } catch (err) {
22
- process.exit(err.status || 1);
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
- switch (command) {
27
- case "install":
28
- run(`node ${path.join(PLUGIN_ROOT, "bin", "install.js")}`);
29
- break;
30
- case "uninstall":
31
- run(`node ${path.join(PLUGIN_ROOT, "bin", "uninstall.js")}`);
32
- break;
33
- case "sync":
34
- run(`node ${path.join(PLUGIN_ROOT, "scripts", "sync-command-surfaces.js")}`);
35
- break;
36
- case "version":
37
- try {
38
- const pkg = require(path.join(PLUGIN_ROOT, "package.json"));
39
- console.log(pkg.version);
40
- } catch {
41
- console.log("unknown");
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
- break;
44
- case "help":
45
- default:
46
- console.log(`babysitter-opencode - Babysitter plugin for OpenCode
47
-
48
- Usage:
49
- babysitter-opencode install Install plugin into OpenCode
50
- babysitter-opencode uninstall Remove plugin from OpenCode
51
- babysitter-opencode sync Sync command surfaces
52
- babysitter-opencode version Show version
53
- babysitter-opencode help Show this help`);
54
- break;
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();