@a5c-ai/babysitter-cursor 0.1.1-staging.400de59e

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 (42) hide show
  1. package/.cursor-plugin/plugin.json +22 -0
  2. package/.cursorrules +55 -0
  3. package/README.md +488 -0
  4. package/bin/cli.js +104 -0
  5. package/bin/install-shared.js +394 -0
  6. package/bin/install.js +46 -0
  7. package/bin/uninstall.js +40 -0
  8. package/commands/assimilate.md +37 -0
  9. package/commands/call.md +7 -0
  10. package/commands/cleanup.md +20 -0
  11. package/commands/contrib.md +33 -0
  12. package/commands/doctor.md +423 -0
  13. package/commands/forever.md +7 -0
  14. package/commands/help.md +244 -0
  15. package/commands/observe.md +12 -0
  16. package/commands/plan.md +7 -0
  17. package/commands/plugins.md +255 -0
  18. package/commands/project-install.md +17 -0
  19. package/commands/resume.md +8 -0
  20. package/commands/retrospect.md +55 -0
  21. package/commands/user-install.md +17 -0
  22. package/commands/yolo.md +7 -0
  23. package/hooks/hooks-cursor.json +21 -0
  24. package/hooks/session-start.ps1 +115 -0
  25. package/hooks/session-start.sh +105 -0
  26. package/hooks/stop-hook.ps1 +72 -0
  27. package/hooks/stop-hook.sh +64 -0
  28. package/hooks.json +21 -0
  29. package/package.json +48 -0
  30. package/plugin.json +24 -0
  31. package/scripts/team-install.js +81 -0
  32. package/skills/assimilate/SKILL.md +17 -0
  33. package/skills/babysit/SKILL.md +81 -0
  34. package/skills/call/SKILL.md +17 -0
  35. package/skills/doctor/SKILL.md +16 -0
  36. package/skills/help/SKILL.md +15 -0
  37. package/skills/observe/SKILL.md +15 -0
  38. package/skills/plan/SKILL.md +16 -0
  39. package/skills/resume/SKILL.md +15 -0
  40. package/skills/retrospect/SKILL.md +55 -0
  41. package/skills/user-install/SKILL.md +15 -0
  42. package/versions.json +3 -0
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "babysitter",
3
+ "version": "0.1.0",
4
+ "description": "Babysitter orchestration plugin for Cursor IDE/CLI with lifecycle hooks and SDK-managed process-library bootstrapping",
5
+ "author": {
6
+ "name": "a5c.ai",
7
+ "email": "support@a5c.ai"
8
+ },
9
+ "homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-cursor#readme",
10
+ "repository": "https://github.com/a5c-ai/babysitter",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "babysitter",
14
+ "cursor",
15
+ "orchestration",
16
+ "hooks",
17
+ "skills"
18
+ ],
19
+ "skills": "skills/",
20
+ "commands": "commands/",
21
+ "hooks": "hooks/hooks-cursor.json"
22
+ }
package/.cursorrules ADDED
@@ -0,0 +1,55 @@
1
+ # Babysitter Orchestration Agent
2
+
3
+ You are operating under Babysitter orchestration. Babysitter manages complex, multi-step
4
+ workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop
5
+ approval gates.
6
+
7
+ ## Key Behaviors
8
+
9
+ 1. **Follow the process definition exactly.** Each task in the workflow has been defined with
10
+ specific inputs, outputs, and quality criteria. Do not skip steps or improvise alternatives
11
+ unless explicitly told to by the orchestrator.
12
+
13
+ 2. **Report completion accurately.** When you finish a task, your output must match the expected
14
+ result schema. Do not fabricate results or claim success without evidence.
15
+
16
+ 3. **Respect breakpoints.** When you encounter a breakpoint (human approval gate), stop and wait.
17
+ Do not attempt to bypass or auto-approve breakpoints.
18
+
19
+ 4. **Use structured output.** When the orchestrator requests JSON output, respond with valid JSON
20
+ only. Do not wrap it in markdown code fences or add commentary outside the JSON.
21
+
22
+ 5. **Completion proof.** When you have completed all assigned work, output the completion proof
23
+ token provided by the orchestrator: `<promise>COMPLETION_PROOF</promise>`. This signals the
24
+ Stop hook to allow the session to end.
25
+
26
+ ## Environment
27
+
28
+ - **Harness**: Cursor IDE/CLI
29
+ - **SDK CLI**: `babysitter` (installed globally or via npx)
30
+ - **State directory**: `.a5c/` in the project root
31
+
32
+ ## Available Skills
33
+
34
+ Use the babysitter skills for orchestration workflows:
35
+
36
+ - `babysit` - Start and orchestrate a babysitter run
37
+ - `call` - Start a new orchestration run
38
+ - `resume` - Resume an existing run
39
+ - `plan` - Plan a workflow without executing
40
+ - `doctor` - Diagnose run health and issues
41
+ - `retrospect` - Analyze completed runs
42
+ - `observe` - Monitor and inspect runs
43
+ - `help` - Get usage help
44
+ - `assimilate` - Ingest external methodologies
45
+ - `user-install` - Set up user-level configuration
46
+
47
+ ## SDK CLI Commands
48
+
49
+ ```bash
50
+ babysitter run:create --process-id <id> --entry <path>#<export> --inputs <file> --prompt "$PROMPT" --harness cursor --json
51
+ babysitter run:iterate <runDir> --json --iteration <n> --plugin-root <root>
52
+ babysitter run:status <runId> --json
53
+ babysitter task:list <runId> --pending --json
54
+ babysitter task:post <runId> <effectId> --status <ok|error> --value <file> --json
55
+ ```
package/README.md ADDED
@@ -0,0 +1,488 @@
1
+ # @a5c-ai/babysitter-cursor
2
+
3
+ Babysitter orchestration plugin for [Cursor IDE](https://cursor.com) and
4
+ its headless CLI agent mode.
5
+
6
+ This package ships a complete Cursor plugin bundle -- skills, lifecycle
7
+ hooks, and SDK integration -- that lets you run Babysitter's event-sourced,
8
+ multi-step orchestration engine directly inside Cursor sessions. It uses the
9
+ Babysitter SDK CLI and the shared `~/.a5c` process-library state. The
10
+ installer registers the plugin bundle and materializes the active skills and
11
+ hooks so Cursor can execute Babysitter commands and hook scripts directly.
12
+
13
+ ## Prerequisites
14
+
15
+ - **Node.js 22+**
16
+ - **Cursor IDE** with CLI agent support (`cursor` command available on PATH)
17
+ - **CURSOR_API_KEY** environment variable -- required for headless CLI mode
18
+ - **Babysitter SDK CLI** (`@a5c-ai/babysitter-sdk`) -- installed globally
19
+
20
+ ## Installation
21
+
22
+ Install the SDK CLI first:
23
+
24
+ ```bash
25
+ npm install -g @a5c-ai/babysitter-sdk
26
+ ```
27
+
28
+ ### Via Cursor Marketplace (recommended)
29
+
30
+ Install through Cursor's marketplace UI using the repo-root
31
+ `/.cursor-plugin/marketplace.json` manifest:
32
+
33
+ 1. Add this repository as a Cursor marketplace source
34
+ 2. Open the marketplace entry named **a5c-ai**
35
+ 3. Install the plugin named **babysitter**
36
+
37
+ ### Via Babysitter plugin manager
38
+
39
+ This path installs the Babysitter plugin package named
40
+ `babysitter-cursor` from the SDK marketplace, not the Cursor UI plugin
41
+ entry:
42
+
43
+ ```bash
44
+ babysitter plugin:install babysitter-cursor --marketplace-name a5c-ai --global
45
+ ```
46
+
47
+ ### Workspace installation
48
+
49
+ ```bash
50
+ babysitter plugin:install babysitter-cursor --marketplace-name a5c-ai --project
51
+ ```
52
+
53
+ If the workspace does not already have an active process-library binding, the
54
+ installer bootstraps the shared global SDK process library automatically:
55
+
56
+ ```bash
57
+ babysitter process-library:active --json
58
+ ```
59
+
60
+ ### Alternative Installation (development)
61
+
62
+ For local development or environments without marketplace access:
63
+
64
+ #### Via npm
65
+
66
+ ```bash
67
+ npm install -g @a5c-ai/babysitter-cursor
68
+ babysitter-cursor install
69
+ ```
70
+
71
+ #### From source
72
+
73
+ ```bash
74
+ cd plugins/babysitter-cursor
75
+ node bin/install.js
76
+ ```
77
+
78
+ #### Manual installation
79
+
80
+ Copy the plugin directory to your local Cursor plugins path:
81
+
82
+ ```bash
83
+ cp -r plugins/babysitter-cursor ~/.cursor/plugins/local/babysitter-cursor
84
+ # Or symlink for faster iteration:
85
+ ln -s "$(pwd)/plugins/babysitter-cursor" ~/.cursor/plugins/local/babysitter-cursor
86
+ ```
87
+
88
+ ## Uninstallation
89
+
90
+ ```bash
91
+ babysitter-cursor uninstall
92
+ ```
93
+
94
+ Or via the plugin manager:
95
+
96
+ ```bash
97
+ babysitter plugin:uninstall babysitter-cursor --global
98
+ ```
99
+
100
+ ## Plugin Structure (Directory Layout)
101
+
102
+ ```
103
+ plugins/babysitter-cursor/
104
+ .cursor-plugin/
105
+ plugin.json # Cursor plugin manifest (skills, commands, hooks, metadata)
106
+ plugin.json # Babysitter plugin manifest (skills dir, hooks path, metadata)
107
+ hooks.json # Legacy/manual hook configuration
108
+ hooks/
109
+ hooks-cursor.json # Cursor plugin hook configuration
110
+ session-start.sh # SessionStart lifecycle hook (bash)
111
+ session-start.ps1 # SessionStart lifecycle hook (PowerShell)
112
+ stop-hook.sh # Stop hook -- orchestration loop driver (bash)
113
+ stop-hook.ps1 # Stop hook -- orchestration loop driver (PowerShell)
114
+ skills/
115
+ babysit/SKILL.md # Core orchestration skill
116
+ call/SKILL.md # Start a new run
117
+ plan/SKILL.md # Plan without executing
118
+ resume/SKILL.md # Resume an incomplete run
119
+ doctor/SKILL.md # Diagnose run health
120
+ retrospect/SKILL.md # Analyze completed runs
121
+ observe/SKILL.md # Observer dashboard
122
+ assimilate/SKILL.md # Assimilate external methodologies
123
+ help/SKILL.md # Help and documentation
124
+ user-install/SKILL.md # User setup
125
+ bin/
126
+ cli.js # CLI entry point (babysitter-cursor command)
127
+ install.js # Installation script
128
+ install-shared.js # Shared installation utilities
129
+ uninstall.js # Uninstallation script
130
+ scripts/
131
+ team-install.js # Team-level installation
132
+ versions.json # SDK version pinning
133
+ package.json # npm package metadata
134
+ .cursorrules # Custom instructions for Cursor agent
135
+ .gitignore
136
+ ```
137
+
138
+ ## Hook Configuration
139
+
140
+ The plugin declares lifecycle hooks in `hooks/hooks-cursor.json` using the version 1
141
+ format. Hook event names use camelCase (e.g., `sessionStart`, `stop`).
142
+
143
+ ```json
144
+ {
145
+ "version": 1,
146
+ "hooks": {
147
+ "sessionStart": [
148
+ {
149
+ "type": "command",
150
+ "bash": "bash \"./hooks/session-start.sh\"",
151
+ "powershell": "powershell -NoProfile -ExecutionPolicy Bypass -File \"./hooks/session-start.ps1\"",
152
+ "timeoutSec": 30
153
+ }
154
+ ],
155
+ "stop": [
156
+ {
157
+ "type": "command",
158
+ "bash": "bash \"./hooks/stop-hook.sh\"",
159
+ "powershell": "powershell -NoProfile -ExecutionPolicy Bypass -File \"./hooks/stop-hook.ps1\"",
160
+ "loop_limit": null
161
+ }
162
+ ]
163
+ }
164
+ }
165
+ ```
166
+
167
+ Each hook entry specifies a `bash` and/or `powershell` command, a `type`
168
+ (currently always `"command"`), and optional parameters like `timeoutSec`
169
+ or `loop_limit`.
170
+
171
+ ### Hook Format Details
172
+
173
+ - **version**: Must be `1`. Identifies the hooks schema version.
174
+ - **Event names**: Use camelCase (`sessionStart`, `stop`). Not snake_case,
175
+ not PascalCase.
176
+ - **loop_limit**: Controls how many times the stop hook can re-inject
177
+ continuation before the session is forced to end. Set to `null` for
178
+ unlimited orchestration iterations (the default for this plugin).
179
+ - **Input**: Hooks receive JSON via stdin containing session context
180
+ (including `conversation_id` for session identification).
181
+ - **Output**: Hooks emit JSON via stdout. The stop hook uses
182
+ `{followup_message: "..."}` to auto-continue the orchestration loop.
183
+
184
+ ## Available Skills
185
+
186
+ The plugin registers ten skills that surface as slash commands within
187
+ Cursor:
188
+
189
+ | Skill | Description |
190
+ |-------|-------------|
191
+ | `babysit` | Core entrypoint. Orchestrate `.a5c/runs/<runId>/` through iterative execution. Invoke when asked to babysit, orchestrate, or run a workflow. |
192
+ | `call` | Start a new orchestration run. Everything after `$call` becomes the initial Babysitter request. Always creates an interactive run. |
193
+ | `plan` | Design a process definition without executing it. Useful for reviewing or refining a workflow before committing to a run. |
194
+ | `resume` | Resume an incomplete or paused orchestration run from where it left off. |
195
+ | `doctor` | Diagnose run health -- journal integrity, state cache, effects, locks, sessions, logs, and disk usage. |
196
+ | `retrospect` | Analyze a completed run: results, process quality, and suggestions for process improvements and optimizations. |
197
+ | `observe` | Launch the real-time observer dashboard to watch active runs. |
198
+ | `assimilate` | Assimilate an external methodology, harness, or specification into Babysitter process definitions. |
199
+ | `help` | Show documentation for Babysitter command usage, processes, skills, agents, and methodologies. |
200
+ | `user-install` | Set up Babysitter for yourself -- installs dependencies, interviews you about preferences, and configures user-level defaults. |
201
+
202
+ ## Usage Examples
203
+
204
+ ### Interactive (Cursor IDE)
205
+
206
+ Open a Cursor session and invoke any skill as a slash command:
207
+
208
+ ```text
209
+ $babysit run my-workflow
210
+ $call build and test the authentication module
211
+ $plan design a data migration pipeline
212
+ $resume
213
+ $doctor
214
+ ```
215
+
216
+ ### Headless CLI
217
+
218
+ Run Cursor in headless agent mode for fully automated orchestration. The
219
+ `CURSOR_API_KEY` environment variable must be set.
220
+
221
+ ```bash
222
+ export CURSOR_API_KEY="your-api-key"
223
+
224
+ cursor agent -p -f --trust --approve-mcps \
225
+ 'Build and test the authentication module'
226
+ ```
227
+
228
+ With a workspace directory:
229
+
230
+ ```bash
231
+ cursor agent -p -f --trust --approve-mcps \
232
+ --workspace /path/to/repo \
233
+ 'Refactor the payment service to use the new API'
234
+ ```
235
+
236
+ **Headless CLI flags:**
237
+
238
+ | Flag | Description |
239
+ |------|-------------|
240
+ | `-p` | Print mode (output to stdout) |
241
+ | `-f` | Non-interactive / force mode |
242
+ | `--trust` | Trust the workspace (skip confirmation prompts) |
243
+ | `--approve-mcps` | Auto-approve MCP server connections |
244
+ | `--workspace <dir>` | Set the working directory |
245
+
246
+ **Note:** The `afterAgentResponse` and `afterAgentThought` hook events do
247
+ NOT fire in CLI headless mode. The plugin relies on `sessionStart` and
248
+ `stop` hooks, which are supported in both interactive and headless modes.
249
+
250
+ ## Orchestration Model
251
+
252
+ The plugin drives multi-step orchestration through a stop-hook loop
253
+ pattern. This is how Babysitter iterates autonomously within Cursor:
254
+
255
+ ### SessionStart
256
+
257
+ Fires when a new Cursor session begins. The hook:
258
+
259
+ 1. Checks and installs the required SDK version (pinned in `versions.json`)
260
+ 2. Initializes a Babysitter session for the active Cursor session
261
+ 3. The session ID is extracted from `conversation_id` in the hook's stdin
262
+ JSON (not from an environment variable)
263
+
264
+ ### Stop (Orchestration Loop Driver)
265
+
266
+ When Cursor attempts to end its turn, this hook intercepts the exit and:
267
+
268
+ 1. Checks whether the active run has completed or emitted a completion proof
269
+ 2. If the run is still in progress, emits `{followup_message: "..."}` to
270
+ auto-continue the orchestration loop with the next iteration step
271
+ 3. Only allows the session to exit when the run finishes or reaches a
272
+ breakpoint requiring human input
273
+
274
+ This is what keeps Babysitter iterating autonomously -- each turn performs
275
+ one orchestration phase, and the stop hook decides whether to loop or yield.
276
+ The `loop_limit: null` setting in `hooks/hooks-cursor.json` allows unlimited iterations.
277
+
278
+ **Important:** The stop hook uses `{followup_message: "..."}` to signal
279
+ continuation, NOT `{decision: "block"}`. This is a Cursor-specific
280
+ convention.
281
+
282
+ ## Configuration
283
+
284
+ ### .cursorrules
285
+
286
+ The plugin includes a `.cursorrules` file for custom agent instructions.
287
+ This file is discovered by Cursor by convention and configures agent
288
+ behavior within sessions.
289
+
290
+ ### Environment Variables
291
+
292
+ | Variable | Default | Description |
293
+ |----------|---------|-------------|
294
+ | `CURSOR_API_KEY` | -- | API key for headless CLI mode (required) |
295
+ | `CURSOR_PLUGIN_ROOT` | Plugin directory | Plugin root directory |
296
+ | `BABYSITTER_STATE_DIR` | `<cwd>/.a5c` | State directory for session data |
297
+ | `BABYSITTER_LOG_DIR` | `<plugin>/.a5c/logs` | Log output directory |
298
+
299
+ ### SDK Version Pinning
300
+
301
+ The plugin pins its required SDK version in `versions.json`. The
302
+ SessionStart hook reads this file and ensures the correct version of
303
+ `@a5c-ai/babysitter-sdk` is installed globally before proceeding.
304
+
305
+ ## Marketplace Distribution
306
+
307
+ Cursor Marketplace is Git-based. Plugins are distributed through Git
308
+ repositories that contain a manifest file.
309
+
310
+ ### Plugin Manifest
311
+
312
+ The Cursor marketplace manifest lives at `.cursor-plugin/plugin.json`:
313
+
314
+ ```json
315
+ {
316
+ "name": "babysitter",
317
+ "version": "0.1.0",
318
+ "description": "Babysitter orchestration plugin for Cursor IDE/CLI ...",
319
+ "author": {
320
+ "name": "a5c.ai",
321
+ "email": "support@a5c.ai",
322
+ "url": "https://github.com/a5c-ai/babysitter"
323
+ },
324
+ "homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-cursor#readme",
325
+ "repository": "https://github.com/a5c-ai/babysitter",
326
+ "license": "MIT",
327
+ "skills": "skills/",
328
+ "hooks": "hooks/hooks-cursor.json"
329
+ }
330
+ ```
331
+
332
+ The `skills` field points to the skills directory where Cursor
333
+ auto-discovers `SKILL.md` files in subdirectories. The `hooks` field
334
+ references the `hooks/hooks-cursor.json` configuration file.
335
+
336
+ ### Marketplace Manifest
337
+
338
+ The repo-root Cursor marketplace manifest lives at `/.cursor-plugin/marketplace.json`:
339
+
340
+ ```json
341
+ {
342
+ "name": "a5c-ai",
343
+ "owner": {
344
+ "name": "a5c-ai",
345
+ "email": "support@a5c.ai"
346
+ },
347
+ "metadata": {
348
+ "description": "Babysitter orchestration plugins",
349
+ "pluginRoot": "plugins"
350
+ },
351
+ "plugins": [
352
+ {
353
+ "name": "babysitter",
354
+ "description": "Multi-step workflow orchestration for Cursor IDE",
355
+ "version": "0.1.0",
356
+ "source": "babysitter-cursor"
357
+ }
358
+ ]
359
+ }
360
+ ```
361
+
362
+ ### User Commands
363
+
364
+ ```bash
365
+ babysitter plugin:add-marketplace --marketplace-url https://github.com/a5c-ai/babysitter --marketplace-path plugins/a5c/marketplace/marketplace.json --global
366
+ babysitter plugin:list-plugins --marketplace-name a5c-ai --global
367
+ babysitter plugin:install babysitter-cursor --marketplace-name a5c-ai --global
368
+ ```
369
+
370
+ ## Troubleshooting
371
+
372
+ ### Hook not firing
373
+
374
+ Run the doctor skill from within a Cursor session to diagnose hook and
375
+ session health:
376
+
377
+ ```text
378
+ $doctor
379
+ ```
380
+
381
+ Also check log output in `<plugin-root>/.a5c/logs/`:
382
+
383
+ - `babysitter-session-start-hook.log`
384
+ - `babysitter-stop-hook.log`
385
+ - `babysitter-stop-hook-stderr.log`
386
+ - `babysitter-session-start-hook-stderr.log`
387
+
388
+ ### Run stuck or not progressing
389
+
390
+ Check the run status and diagnose:
391
+
392
+ ```text
393
+ $doctor [run-id]
394
+ ```
395
+
396
+ Or inspect the run directory directly:
397
+
398
+ ```bash
399
+ babysitter run:status --run-id <runId> --json
400
+ babysitter run:events --run-id <runId> --json
401
+ ```
402
+
403
+ ### SDK version mismatch
404
+
405
+ If the plugin reports version incompatibility, ensure the pinned SDK
406
+ version is installed:
407
+
408
+ ```bash
409
+ SDK_VERSION=$(node -e "console.log(JSON.parse(require('fs').readFileSync('versions.json','utf8')).sdkVersion)")
410
+ npm install -g @a5c-ai/babysitter-sdk@$SDK_VERSION
411
+ ```
412
+
413
+ ### Headless mode not working
414
+
415
+ Verify that `CURSOR_API_KEY` is set:
416
+
417
+ ```bash
418
+ echo $CURSOR_API_KEY
419
+ ```
420
+
421
+ Ensure the `cursor` CLI is available on PATH:
422
+
423
+ ```bash
424
+ cursor --version
425
+ ```
426
+
427
+ ### afterAgentResponse / afterAgentThought hooks not firing
428
+
429
+ These hook events do not fire in CLI headless mode. This is expected
430
+ Cursor behavior. The plugin is designed to work with `sessionStart` and
431
+ `stop` hooks only, which are supported in both interactive and headless
432
+ modes.
433
+
434
+ ### Windows limitations
435
+
436
+ On native Windows, hook execution depends on shell configuration. The
437
+ plugin includes both `bash` (.sh) and `powershell` (.ps1) hook scripts
438
+ to maximize compatibility. If hooks do not fire, try running from Git Bash
439
+ or WSL. The Cursor hook manifest includes explicit `powershell` entries alongside
440
+ `bash` entries for Windows PowerShell execution support.
441
+
442
+ ## Development / Contributing
443
+
444
+ ### Local development
445
+
446
+ ```bash
447
+ git clone https://github.com/a5c-ai/babysitter.git
448
+ cd babysitter
449
+ npm install
450
+ cd plugins/babysitter-cursor
451
+ node bin/install.js
452
+ ```
453
+
454
+ ### Publishing
455
+
456
+ ```bash
457
+ cd plugins/babysitter-cursor
458
+ npm run deploy # Publish to npm (public)
459
+ npm run deploy:staging # Publish to npm with staging tag
460
+ ```
461
+
462
+ ### Team installation
463
+
464
+ ```bash
465
+ cd plugins/babysitter-cursor
466
+ npm run team:install
467
+ ```
468
+
469
+ This sets up the plugin for all team members in a shared workspace,
470
+ writing team-level configuration to `.a5c/team/`.
471
+
472
+ ### Verification
473
+
474
+ Verify the installed plugin bundle:
475
+
476
+ ```bash
477
+ npm ls -g @a5c-ai/babysitter-cursor --depth=0
478
+ ```
479
+
480
+ Verify the active shared process-library binding:
481
+
482
+ ```bash
483
+ babysitter process-library:active --json
484
+ ```
485
+
486
+ ## License
487
+
488
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const path = require('path');
5
+ const { spawnSync } = require('child_process');
6
+
7
+ const PACKAGE_ROOT = path.resolve(__dirname, '..');
8
+
9
+ function printUsage() {
10
+ console.error([
11
+ 'Usage:',
12
+ ' babysitter-cursor install [--global]',
13
+ ' babysitter-cursor install --workspace [path]',
14
+ ' babysitter-cursor uninstall',
15
+ ].join('\n'));
16
+ }
17
+
18
+ function parseInstallArgs(argv) {
19
+ let scope = 'global';
20
+ let workspace = null;
21
+ const passthrough = [];
22
+
23
+ for (let i = 0; i < argv.length; i += 1) {
24
+ const arg = argv[i];
25
+ if (arg === '--global') {
26
+ if (scope === 'workspace') {
27
+ throw new Error('install accepts either --global or --workspace, not both');
28
+ }
29
+ scope = 'global';
30
+ continue;
31
+ }
32
+ if (arg === '--workspace') {
33
+ if (scope === 'global' && workspace !== null) {
34
+ throw new Error('install accepts either --global or --workspace, not both');
35
+ }
36
+ scope = 'workspace';
37
+ const next = argv[i + 1];
38
+ if (next && !next.startsWith('-')) {
39
+ workspace = path.resolve(next);
40
+ i += 1;
41
+ } else {
42
+ workspace = process.cwd();
43
+ }
44
+ continue;
45
+ }
46
+ passthrough.push(arg);
47
+ }
48
+
49
+ return {
50
+ scope,
51
+ workspace,
52
+ passthrough,
53
+ };
54
+ }
55
+
56
+ function runNodeScript(scriptPath, args, extraEnv = {}) {
57
+ const result = spawnSync(process.execPath, [scriptPath, ...args], {
58
+ cwd: process.cwd(),
59
+ stdio: 'inherit',
60
+ env: {
61
+ ...process.env,
62
+ ...extraEnv,
63
+ },
64
+ });
65
+ process.exitCode = result.status ?? 1;
66
+ }
67
+
68
+ function main() {
69
+ const [command, ...rest] = process.argv.slice(2);
70
+ if (!command || command === '--help' || command === '-h' || command === 'help') {
71
+ printUsage();
72
+ process.exitCode = command ? 0 : 1;
73
+ return;
74
+ }
75
+
76
+ if (command === 'install') {
77
+ const parsed = parseInstallArgs(rest);
78
+ if (parsed.scope === 'workspace') {
79
+ const args = [];
80
+ if (parsed.workspace) {
81
+ args.push('--workspace', parsed.workspace);
82
+ }
83
+ args.push(...parsed.passthrough);
84
+ runNodeScript(
85
+ path.join(PACKAGE_ROOT, 'scripts', 'team-install.js'),
86
+ args,
87
+ { BABYSITTER_PACKAGE_ROOT: PACKAGE_ROOT },
88
+ );
89
+ return;
90
+ }
91
+ runNodeScript(path.join(PACKAGE_ROOT, 'bin', 'install.js'), parsed.passthrough);
92
+ return;
93
+ }
94
+
95
+ if (command === 'uninstall') {
96
+ runNodeScript(path.join(PACKAGE_ROOT, 'bin', 'uninstall.js'), rest);
97
+ return;
98
+ }
99
+
100
+ printUsage();
101
+ process.exitCode = 1;
102
+ }
103
+
104
+ main();