@a5c-ai/babysitter-github 0.1.1-staging.0825aadb

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 (44) hide show
  1. package/.github/plugin.json +25 -0
  2. package/AGENTS.md +41 -0
  3. package/README.md +545 -0
  4. package/bin/cli.js +104 -0
  5. package/bin/install-shared.js +450 -0
  6. package/bin/install.js +81 -0
  7. package/bin/uninstall.js +76 -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 +426 -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/session-end.ps1 +68 -0
  24. package/hooks/session-end.sh +65 -0
  25. package/hooks/session-start.ps1 +110 -0
  26. package/hooks/session-start.sh +100 -0
  27. package/hooks/user-prompt-submitted.ps1 +51 -0
  28. package/hooks/user-prompt-submitted.sh +41 -0
  29. package/hooks.json +29 -0
  30. package/package.json +50 -0
  31. package/plugin.json +25 -0
  32. package/scripts/sync-command-surfaces.js +62 -0
  33. package/scripts/team-install.js +86 -0
  34. package/skills/assimilate/SKILL.md +38 -0
  35. package/skills/babysit/SKILL.md +77 -0
  36. package/skills/call/SKILL.md +8 -0
  37. package/skills/doctor/SKILL.md +427 -0
  38. package/skills/help/SKILL.md +245 -0
  39. package/skills/observe/SKILL.md +13 -0
  40. package/skills/plan/SKILL.md +8 -0
  41. package/skills/resume/SKILL.md +9 -0
  42. package/skills/retrospect/SKILL.md +56 -0
  43. package/skills/user-install/SKILL.md +18 -0
  44. package/versions.json +3 -0
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "babysitter",
3
+ "version": "0.1.0",
4
+ "description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval -- powered by the Babysitter SDK",
5
+ "author": { "name": "a5c.ai", "email": "support@a5c.ai" },
6
+ "license": "MIT",
7
+ "skills": "skills/",
8
+ "hooks": "hooks.json",
9
+ "commands": "commands/",
10
+ "agents": "AGENTS.md",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/a5c-ai/babysitter"
14
+ },
15
+ "keywords": [
16
+ "orchestration",
17
+ "workflow",
18
+ "automation",
19
+ "event-sourced",
20
+ "hooks",
21
+ "github-copilot",
22
+ "agent",
23
+ "LLM"
24
+ ]
25
+ }
package/AGENTS.md ADDED
@@ -0,0 +1,41 @@
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**: GitHub Copilot CLI (`copilot`)
29
+ - **SDK CLI**: `babysitter` (installed globally or via npx)
30
+ - **State directory**: `.a5c/` in the project root
31
+ - **Run directory**: `.a5c/runs/<runId>/`
32
+
33
+ ## Commands
34
+
35
+ You can invoke babysitter CLI commands directly:
36
+
37
+ ```bash
38
+ babysitter run:status --run-id <id> --json # Check run status
39
+ babysitter task:list --run-id <id> --json # List pending tasks
40
+ babysitter task:post --run-id <id> --effect-id <eid> --json # Post task result
41
+ ```
package/README.md ADDED
@@ -0,0 +1,545 @@
1
+ # @a5c-ai/babysitter-github
2
+
3
+ Babysitter orchestration plugin for [GitHub Copilot CLI](https://docs.github.com/en/copilot/using-github-copilot/using-github-copilot-in-the-command-line).
4
+
5
+ This package ships a complete Copilot CLI plugin bundle -- skills, lifecycle
6
+ hooks, and SDK integration -- that lets you run Babysitter's event-sourced,
7
+ multi-step orchestration engine directly inside GitHub Copilot CLI sessions.
8
+ It uses the Babysitter SDK CLI and the shared `~/.a5c` process-library state.
9
+ The installer registers the plugin bundle and materializes the active skills
10
+ and hooks so Copilot CLI can execute Babysitter commands and hook scripts
11
+ directly.
12
+
13
+ ## Prerequisites
14
+
15
+ - **Node.js 22+**
16
+ - **GitHub Copilot CLI** (`copilot`) -- requires an active GitHub Copilot
17
+ subscription
18
+ - **Babysitter SDK CLI** (`@a5c-ai/babysitter-sdk`) -- installed globally
19
+
20
+ ## Installation
21
+
22
+ ### From marketplace (recommended)
23
+
24
+ Register the a5c.ai marketplace and install the plugin:
25
+
26
+ ```bash
27
+ # Register the marketplace
28
+ copilot plugin marketplace add a5c-ai/babysitter
29
+
30
+ # Install the plugin
31
+ copilot plugin install babysitter
32
+ ```
33
+
34
+ ### Direct GitHub install
35
+
36
+ Install directly from the Git repository using Copilot CLI. Copilot CLI
37
+ discovers the plugin via `.github/plugin/marketplace.json` at the repo root:
38
+
39
+ ```bash
40
+ copilot plugin install a5c-ai/babysitter
41
+ ```
42
+
43
+ ### Alternative Installation (npm / development)
44
+
45
+ For development or environments where the Copilot CLI plugin system is not
46
+ available, install via npm:
47
+
48
+ Install the SDK CLI first:
49
+
50
+ ```bash
51
+ npm install -g @a5c-ai/babysitter-sdk
52
+ ```
53
+
54
+ Then install the GitHub Copilot plugin globally:
55
+
56
+ ```bash
57
+ npm install -g @a5c-ai/babysitter-github
58
+ babysitter-github install
59
+ ```
60
+
61
+ Or install from source:
62
+
63
+ ```bash
64
+ cd plugins/babysitter-github
65
+ node bin/install.js
66
+ ```
67
+
68
+ Install into a specific workspace:
69
+
70
+ ```bash
71
+ babysitter-github install --workspace /path/to/repo
72
+ ```
73
+
74
+ If the workspace does not already have an active process-library binding, the
75
+ installer bootstraps the shared global SDK process library automatically:
76
+
77
+ ```bash
78
+ babysitter process-library:active --json
79
+ ```
80
+
81
+ ## Uninstallation
82
+
83
+ Via Copilot CLI:
84
+
85
+ ```bash
86
+ copilot plugin uninstall babysitter
87
+ ```
88
+
89
+ Via npm:
90
+
91
+ ```bash
92
+ babysitter-github uninstall
93
+ ```
94
+
95
+ ## Integration Model
96
+
97
+ The plugin provides:
98
+
99
+ - `skills/babysit/SKILL.md` as the core orchestration entrypoint
100
+ - Mode wrapper skills such as `$call`, `$plan`, and `$resume`
101
+ - Plugin-level lifecycle hooks for `sessionStart`, `sessionEnd`, and
102
+ `userPromptSubmitted`
103
+
104
+ The process library is fetched and bound through the SDK CLI in
105
+ `~/.a5c/active/process-library.json`.
106
+
107
+ ### Active Process-Library Model
108
+
109
+ Process discovery prefers active roots in this order:
110
+
111
+ 1. `.a5c/processes` in the current workspace
112
+ 2. The SDK-managed active process-library binding returned by
113
+ `babysitter process-library:active --json`
114
+ 3. The cloned process-library repo root from `defaultSpec.cloneDir` when
115
+ adjacent reference material is needed
116
+ 4. Installed extension content only as a compatibility fallback
117
+
118
+ ## Available Skills
119
+
120
+ The plugin registers ten skills that surface as slash commands within Copilot
121
+ CLI:
122
+
123
+ | Skill | Description |
124
+ |-------|-------------|
125
+ | `babysit` | Core entrypoint. Orchestrate `.a5c/runs/<runId>/` through iterative execution. Invoke when asked to babysit, orchestrate, or run a workflow. |
126
+ | `call` | Start a new orchestration run. Everything after `$call` becomes the initial Babysitter request. Always creates an interactive run. |
127
+ | `plan` | Design a process definition without executing it. Useful for reviewing or refining a workflow before committing to a run. |
128
+ | `resume` | Resume an incomplete or paused orchestration run from where it left off. |
129
+ | `doctor` | Diagnose run health -- journal integrity, state cache, effects, locks, sessions, logs, and disk usage. |
130
+ | `retrospect` | Analyze a completed run: results, process quality, and suggestions for process improvements and optimizations. |
131
+ | `observe` | Launch the real-time observer dashboard to watch active runs. |
132
+ | `assimilate` | Assimilate an external methodology, harness, or specification into Babysitter process definitions. |
133
+ | `help` | Show documentation for Babysitter command usage, processes, skills, agents, and methodologies. |
134
+ | `user-install` | Set up Babysitter for yourself -- installs dependencies, interviews you about preferences, and configures user-level defaults. |
135
+
136
+ ## How the Hook-Driven Orchestration Loop Works
137
+
138
+ GitHub Copilot CLI supports plugin lifecycle hooks. This plugin registers
139
+ three hooks that drive the orchestration loop:
140
+
141
+ ### SessionStart
142
+
143
+ Fires when a new Copilot CLI session begins. The hook:
144
+
145
+ 1. Initializes a Babysitter session for the active Copilot session
146
+ 2. Ensures the SDK CLI is installed at the correct version (pinned in
147
+ `versions.json`)
148
+ 3. Creates baseline session state in the `.a5c` state directory
149
+
150
+ ### SessionEnd
151
+
152
+ The orchestration loop driver. Registered as `sessionEnd` in `hooks.json`,
153
+ this hook fires when the Copilot CLI session ends and:
154
+
155
+ 1. Checks whether the active run has completed or emitted a completion proof
156
+ 2. If the run is still in progress, re-injects the next orchestration step
157
+ to continue iteration
158
+ 3. Only allows the session to exit when the run finishes or reaches a
159
+ breakpoint requiring human input
160
+
161
+ This is what keeps Babysitter iterating autonomously within the Copilot CLI
162
+ session -- each turn performs one orchestration phase, and the Stop hook
163
+ decides whether to loop or yield.
164
+
165
+ ### UserPromptSubmitted
166
+
167
+ Fires before a user prompt reaches the model. The hook applies
168
+ density-filter compression to long user prompts to reduce token usage while
169
+ preserving semantic content.
170
+
171
+ ## Configuration
172
+
173
+ ### AGENTS.md
174
+
175
+ The plugin uses `AGENTS.md` (the Copilot CLI equivalent of `CLAUDE.md`) for
176
+ custom agent instructions. This file is read by Copilot CLI to configure
177
+ agent behavior within sessions.
178
+
179
+ ### Environment Variables
180
+
181
+ | Variable | Default | Description |
182
+ |----------|---------|-------------|
183
+ | `CLAUDE_PROJECT_DIR` | CWD | Project root directory (set by Copilot CLI) |
184
+ | `BABYSITTER_LOG_DIR` | `<plugin>/.a5c/logs` | Log output directory |
185
+ | `BABYSITTER_STATE_DIR` | `<cwd>/.a5c` | State directory for session data |
186
+
187
+ ### SDK Version Pinning
188
+
189
+ The plugin pins its required SDK version in `versions.json`. The
190
+ SessionStart hook reads this file and ensures the correct version of
191
+ `@a5c-ai/babysitter-sdk` is installed globally before proceeding.
192
+
193
+ ## Copilot CLI Plugin Structure
194
+
195
+ This section documents the Copilot CLI plugin format that this package
196
+ conforms to. Understanding this structure is useful when extending the plugin
197
+ or building new ones.
198
+
199
+ ### Plugin Manifest Location
200
+
201
+ Copilot CLI looks for the plugin manifest in these paths, checked in order:
202
+
203
+ 1. `.plugin/plugin.json`
204
+ 2. `.github/plugin/plugin.json`
205
+ 3. `.claude-plugin/plugin.json`
206
+ 4. `plugin.json` (repository root)
207
+
208
+ The first match wins. This plugin uses `plugin.json` at the package root.
209
+
210
+ For marketplace discovery, Copilot CLI looks for `.github/plugin/marketplace.json`
211
+ at the repository root. This file lists all available plugins in the repo and is
212
+ used when installing via `copilot plugin install OWNER/REPO`.
213
+
214
+ ### plugin.json Schema
215
+
216
+ The manifest declares metadata, skills, hooks, and optional integrations:
217
+
218
+ | Field | Required | Type | Description |
219
+ |-------|----------|------|-------------|
220
+ | `name` | Yes | `string` | Plugin identifier (e.g., `"babysitter"`) |
221
+ | `description` | No | `string` | Human-readable summary |
222
+ | `version` | No | `string` | Semver version string |
223
+ | `author` | No | `object` | Author info: `{ "name": "...", "email": "..." }` |
224
+ | `license` | No | `string` | SPDX license identifier |
225
+ | `keywords` | No | `string[]` | Searchable tags for marketplace discovery |
226
+ | `agents` | No | `string` | Path to agents directory |
227
+ | `skills` | No | `string` | Path to skills directory (auto-discovers SKILL.md files in subdirectories) |
228
+ | `hooks` | No | `string` | Path to `hooks.json` |
229
+ | `mcpServers` | No | `string` | Path to `.mcp.json` for MCP server configuration |
230
+
231
+ Example from this plugin:
232
+
233
+ ```json
234
+ {
235
+ "name": "babysitter",
236
+ "version": "0.1.0",
237
+ "description": "Orchestrate complex, multi-step workflows ...",
238
+ "author": "a5c.ai",
239
+ "license": "MIT",
240
+ "skills": "skills/",
241
+ "hooks": "hooks.json",
242
+ "commands": [],
243
+ "keywords": ["orchestration", "workflow", "automation"]
244
+ }
245
+ ```
246
+
247
+ ### Skills Format
248
+
249
+ Each skill lives in its own directory under `skills/` and is defined by a
250
+ Markdown file with YAML frontmatter:
251
+
252
+ ```
253
+ skills/
254
+ babysit/
255
+ SKILL.md
256
+ call/
257
+ SKILL.md
258
+ plan/
259
+ SKILL.md
260
+ ```
261
+
262
+ The `SKILL.md` file uses frontmatter to declare metadata:
263
+
264
+ ```markdown
265
+ ---
266
+ name: babysit
267
+ description: Orchestrate a multi-step workflow using the Babysitter SDK
268
+ ---
269
+
270
+ Skill body with instructions for the agent...
271
+ ```
272
+
273
+ The `name` and `description` fields in the frontmatter are required. The
274
+ body of the Markdown file contains the instructions the agent follows when
275
+ the skill is invoked.
276
+
277
+ ### hooks.json Format
278
+
279
+ The `hooks.json` file declares lifecycle hook handlers as an array of
280
+ command descriptors per event type:
281
+
282
+ ```json
283
+ {
284
+ "version": 1,
285
+ "hooks": {
286
+ "sessionStart": [
287
+ {
288
+ "type": "command",
289
+ "bash": "./hooks/session-start.sh",
290
+ "powershell": "./hooks/session-start.ps1",
291
+ "timeoutSec": 30
292
+ }
293
+ ],
294
+ "sessionEnd": [
295
+ {
296
+ "type": "command",
297
+ "bash": "./hooks/session-end.sh",
298
+ "powershell": "./hooks/session-end.ps1",
299
+ "timeoutSec": 30
300
+ }
301
+ ],
302
+ "userPromptSubmitted": [
303
+ {
304
+ "type": "command",
305
+ "bash": "./hooks/user-prompt-submitted.sh",
306
+ "powershell": "./hooks/user-prompt-submitted.ps1",
307
+ "timeoutSec": 30
308
+ }
309
+ ],
310
+ "preToolUse": [...],
311
+ "postToolUse": [...],
312
+ "errorOccurred": [...]
313
+ }
314
+ }
315
+ ```
316
+
317
+ Each hook entry specifies a `bash` and/or `powershell` command, a `type`
318
+ (currently always `"command"`), and an optional `timeoutSec`.
319
+
320
+ **Supported hook event types:**
321
+
322
+ | Event | Description |
323
+ |-------|-------------|
324
+ | `sessionStart` | Fires when a new CLI session begins |
325
+ | `sessionEnd` | Fires when a CLI session ends |
326
+ | `userPromptSubmitted` | Fires before a user prompt reaches the model |
327
+ | `preToolUse` | Fires before a tool is executed |
328
+ | `postToolUse` | Fires after a tool has executed |
329
+ | `errorOccurred` | Fires when an error is encountered |
330
+
331
+ **Flow-control decisions:** Only `preToolUse` hooks can return flow-control
332
+ decisions via the `permissionDecision` field in stdout JSON. Valid values
333
+ are `"deny"`, `"allow"`, and `"ask"`. All other hook event outputs are
334
+ ignored by the runtime.
335
+
336
+ ## Marketplace Distribution
337
+
338
+ Copilot CLI plugins can be distributed through marketplaces -- Git
339
+ repositories that contain a manifest listing available plugins.
340
+
341
+ ### Creating a Marketplace
342
+
343
+ A marketplace is a Git repository with a `marketplace.json` file at the
344
+ repository root in `.github/plugin/marketplace.json`:
345
+
346
+ ```json
347
+ {
348
+ "name": "a5c.ai",
349
+ "owner": {
350
+ "name": "a5c.ai",
351
+ "email": "support@a5c.ai"
352
+ },
353
+ "metadata": {
354
+ "description": "Babysitter orchestration plugins",
355
+ "version": "1.0.0"
356
+ },
357
+ "plugins": [
358
+ {
359
+ "name": "babysitter",
360
+ "description": "Multi-step workflow orchestration with event-sourced state",
361
+ "version": "0.1.0",
362
+ "source": "./plugins/babysitter-github"
363
+ }
364
+ ]
365
+ }
366
+ ```
367
+
368
+ The `source` field points to the plugin directory relative to the
369
+ marketplace repository root.
370
+
371
+ ### User Commands
372
+
373
+ Copilot CLI provides built-in commands for plugin and marketplace
374
+ management:
375
+
376
+ **Marketplace commands:**
377
+
378
+ ```bash
379
+ copilot plugin marketplace add OWNER/REPO # Register a marketplace
380
+ copilot plugin marketplace list # List registered marketplaces
381
+ copilot plugin marketplace browse NAME # Browse plugins in a marketplace
382
+ ```
383
+
384
+ **Plugin installation:**
385
+
386
+ ```bash
387
+ copilot plugin install PLUGIN@MARKETPLACE # Install from a marketplace
388
+ copilot plugin install OWNER/REPO # Install directly from a GitHub repo
389
+ copilot plugin install ./PATH # Install from a local path
390
+ ```
391
+
392
+ **Plugin management:**
393
+
394
+ ```bash
395
+ copilot plugin list # List installed plugins
396
+ copilot plugin update PLUGIN # Update a plugin
397
+ copilot plugin uninstall PLUGIN # Remove a plugin
398
+ ```
399
+
400
+ ### Plugin Storage
401
+
402
+ Installed plugins are stored under `~/.copilot/installed-plugins/`:
403
+
404
+ - **Marketplace installs:** `~/.copilot/installed-plugins/MARKETPLACE/PLUGIN-NAME/`
405
+ - **Direct installs:** `~/.copilot/installed-plugins/_direct/SOURCE-ID/`
406
+
407
+ ### Default Registries
408
+
409
+ Copilot CLI ships with two built-in registries:
410
+
411
+ - `copilot-plugins` -- official first-party plugins
412
+ - `awesome-copilot` -- community-curated plugin collection
413
+
414
+ These registries are available without running `marketplace add`.
415
+
416
+ ## Plugin Structure (Directory Layout)
417
+
418
+ ```
419
+ plugins/babysitter-github/
420
+ plugin.json # Plugin manifest (skills, hooks, metadata)
421
+ .github/plugin.json # Plugin manifest (alternate discovery path)
422
+ hooks.json # Hook configuration (sessionStart, sessionEnd, userPromptSubmitted)
423
+ hooks/
424
+ session-start.sh # SessionStart lifecycle hook
425
+ session-end.sh # SessionEnd lifecycle hook
426
+ user-prompt-submitted.sh # UserPromptSubmitted hook (prompt compression)
427
+ skills/
428
+ babysit/SKILL.md # Core orchestration skill
429
+ call/SKILL.md # Start a new run
430
+ plan/SKILL.md # Plan without executing
431
+ resume/SKILL.md # Resume an incomplete run
432
+ doctor/SKILL.md # Diagnose run health
433
+ retrospect/SKILL.md # Analyze completed runs
434
+ observe/SKILL.md # Observer dashboard
435
+ assimilate/SKILL.md # Assimilate external methodologies
436
+ help/SKILL.md # Help and documentation
437
+ user-install/SKILL.md # User setup
438
+ bin/
439
+ cli.js # CLI entry point (babysitter-github command)
440
+ install.js # Installation script
441
+ uninstall.js # Uninstallation script
442
+ scripts/
443
+ team-install.js # Team-level installation
444
+ versions.json # SDK version pinning
445
+ package.json # npm package metadata
446
+ AGENTS.md # Custom instructions for Copilot CLI
447
+ ```
448
+
449
+ ## Verification
450
+
451
+ Verify marketplace registration:
452
+
453
+ ```bash
454
+ copilot plugin marketplace list
455
+ ```
456
+
457
+ Verify the installed plugin:
458
+
459
+ ```bash
460
+ npm ls -g @a5c-ai/babysitter-github --depth=0
461
+ ```
462
+
463
+ Verify the active shared process-library binding:
464
+
465
+ ```bash
466
+ babysitter process-library:active --json
467
+ ```
468
+
469
+ ## Troubleshooting
470
+
471
+ ### Hook not firing
472
+
473
+ Run the doctor skill from within a Copilot CLI session to diagnose hook and
474
+ session health:
475
+
476
+ ```text
477
+ $doctor
478
+ ```
479
+
480
+ ### Run stuck or not progressing
481
+
482
+ Check the run status and diagnose:
483
+
484
+ ```text
485
+ $doctor [run-id]
486
+ ```
487
+
488
+ You can also inspect the run directory directly:
489
+
490
+ ```bash
491
+ babysitter run:status --run-id <runId> --json
492
+ babysitter run:events --run-id <runId> --json
493
+ ```
494
+
495
+ ### SDK version mismatch
496
+
497
+ If the plugin reports version incompatibility, ensure the pinned SDK version
498
+ is installed:
499
+
500
+ ```bash
501
+ SDK_VERSION=$(node -e "console.log(JSON.parse(require('fs').readFileSync('versions.json','utf8')).sdkVersion)")
502
+ npm install -g @a5c-ai/babysitter-sdk@$SDK_VERSION
503
+ ```
504
+
505
+ ### Windows limitations
506
+
507
+ On native Windows, Copilot CLI may not execute hook scripts depending on
508
+ shell configuration. The plugin still installs correctly, but lifecycle hooks
509
+ may not fire. Using WSL or Git Bash is recommended. The `hooks.json` file
510
+ includes `powershell` entries alongside `bash` entries to improve Windows
511
+ compatibility where PowerShell execution is available.
512
+
513
+ ## Development / Contributing
514
+
515
+ ### Local development
516
+
517
+ ```bash
518
+ git clone https://github.com/a5c-ai/babysitter.git
519
+ cd babysitter
520
+ npm install
521
+ cd plugins/babysitter-github
522
+ node bin/install.js
523
+ ```
524
+
525
+ ### Publishing
526
+
527
+ ```bash
528
+ cd plugins/babysitter-github
529
+ npm run deploy # Publish to npm (public)
530
+ npm run deploy:staging # Publish to npm with staging tag
531
+ ```
532
+
533
+ ### Team installation
534
+
535
+ ```bash
536
+ cd plugins/babysitter-github
537
+ npm run team:install
538
+ ```
539
+
540
+ This sets up the plugin for all team members in a shared workspace,
541
+ writing team-level configuration to `.a5c/team/`.
542
+
543
+ ## License
544
+
545
+ 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-github install [--global]',
13
+ ' babysitter-github install --workspace [path]',
14
+ ' babysitter-github 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();