@a5c-ai/babysitter-opencode 0.1.1-staging.0dc03363

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 (51) hide show
  1. package/README.md +169 -0
  2. package/bin/cli.cjs +194 -0
  3. package/bin/cli.js +55 -0
  4. package/bin/install-shared.cjs +406 -0
  5. package/bin/install.cjs +97 -0
  6. package/bin/install.js +110 -0
  7. package/bin/uninstall.cjs +90 -0
  8. package/bin/uninstall.js +46 -0
  9. package/commands/assimilate.md +37 -0
  10. package/commands/call.md +7 -0
  11. package/commands/cleanup.md +20 -0
  12. package/commands/contrib.md +33 -0
  13. package/commands/doctor.md +426 -0
  14. package/commands/forever.md +7 -0
  15. package/commands/help.md +244 -0
  16. package/commands/observe.md +12 -0
  17. package/commands/plan.md +7 -0
  18. package/commands/plugins.md +255 -0
  19. package/commands/project-install.md +17 -0
  20. package/commands/resume.md +8 -0
  21. package/commands/retrospect.md +55 -0
  22. package/commands/status.md +8 -0
  23. package/commands/user-install.md +17 -0
  24. package/commands/yolo.md +7 -0
  25. package/hooks/hooks.json +46 -0
  26. package/hooks/session-created.js +180 -0
  27. package/hooks/session-idle.js +122 -0
  28. package/hooks/shell-env.js +86 -0
  29. package/hooks/tool-execute-after.js +105 -0
  30. package/hooks/tool-execute-before.js +107 -0
  31. package/package.json +46 -0
  32. package/plugin.json +25 -0
  33. package/scripts/sync-command-docs.cjs +105 -0
  34. package/scripts/sync-command-surfaces.js +52 -0
  35. package/skills/assimilate/SKILL.md +38 -0
  36. package/skills/babysit/SKILL.md +35 -0
  37. package/skills/call/SKILL.md +8 -0
  38. package/skills/cleanup/SKILL.md +21 -0
  39. package/skills/contrib/SKILL.md +34 -0
  40. package/skills/doctor/SKILL.md +427 -0
  41. package/skills/forever/SKILL.md +8 -0
  42. package/skills/help/SKILL.md +245 -0
  43. package/skills/observe/SKILL.md +13 -0
  44. package/skills/plan/SKILL.md +8 -0
  45. package/skills/plugins/SKILL.md +257 -0
  46. package/skills/project-install/SKILL.md +18 -0
  47. package/skills/resume/SKILL.md +9 -0
  48. package/skills/retrospect/SKILL.md +56 -0
  49. package/skills/user-install/SKILL.md +18 -0
  50. package/skills/yolo/SKILL.md +8 -0
  51. package/versions.json +4 -0
package/plugin.json ADDED
@@ -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": "a5c.ai",
6
+ "license": "MIT",
7
+ "harness": "opencode",
8
+ "hooks": "hooks/",
9
+ "commands": "commands/",
10
+ "skills": "skills/",
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
+ "opencode",
22
+ "agent",
23
+ "LLM"
24
+ ]
25
+ }
@@ -0,0 +1,105 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const {
5
+ listMarkdownBasenames,
6
+ reportCheckResult,
7
+ syncCommandMirrors,
8
+ syncSkillsFromCommands,
9
+ writeFileIfChanged,
10
+ } = require('../../../scripts/plugin-command-sync-lib.cjs');
11
+
12
+ const PACKAGE_ROOT = path.resolve(__dirname, '..');
13
+ const REPO_ROOT = path.resolve(PACKAGE_ROOT, '..', '..');
14
+ const ROOT_COMMANDS = path.join(REPO_ROOT, 'plugins', 'babysitter', 'commands');
15
+ const COMMANDS_ROOT = path.join(PACKAGE_ROOT, 'commands');
16
+ const SKILLS_ROOT = path.join(PACKAGE_ROOT, 'skills');
17
+ const LABEL = 'babysitter-opencode sync';
18
+
19
+ const BABYSIT_SKILL = `---
20
+ name: babysit
21
+ description: Orchestrate via @babysitter. Use this skill when asked to babysit a run, orchestrate a process or whenever it is called explicitly. (babysit, babysitter, orchestrate, orchestrate a run, workflow, etc.)
22
+ ---
23
+
24
+ # babysit
25
+
26
+ Orchestrate \`.a5c/runs/<runId>/\` through iterative execution.
27
+
28
+ ## Dependencies
29
+
30
+ ### Babysitter SDK and CLI
31
+
32
+ Read the SDK version from \`versions.json\` to ensure version compatibility:
33
+
34
+ \`\`\`bash
35
+ SDK_VERSION=$(node -e "try{const fs=require('fs');const probes=['./plugins/babysitter-opencode/versions.json','./node_modules/@a5c-ai/babysitter-opencode/versions.json'];for(const probe of probes){if(fs.existsSync(probe)){console.log(JSON.parse(fs.readFileSync(probe,'utf8')).sdkVersion||'latest');process.exit(0)}}console.log('latest')}catch{console.log('latest')}")
36
+ CLI="npx -y @a5c-ai/babysitter-sdk@$SDK_VERSION"
37
+ \`\`\`
38
+
39
+ ## Instructions
40
+
41
+ Run the following command to get full orchestration instructions:
42
+
43
+ \`\`\`bash
44
+ babysitter instructions:babysit-skill --harness opencode --interactive
45
+ \`\`\`
46
+
47
+ For non-interactive mode:
48
+
49
+ \`\`\`bash
50
+ babysitter instructions:babysit-skill --harness opencode --no-interactive
51
+ \`\`\`
52
+
53
+ Follow the instructions returned by the command above to orchestrate the run.
54
+ `;
55
+
56
+ function getCommandNames() {
57
+ return listMarkdownBasenames(ROOT_COMMANDS);
58
+ }
59
+
60
+ function main() {
61
+ const check = process.argv.includes('--check');
62
+ const commandNames = getCommandNames();
63
+ const mirrorResult = syncCommandMirrors({
64
+ label: LABEL,
65
+ sourceRoot: ROOT_COMMANDS,
66
+ targetRoot: COMMANDS_ROOT,
67
+ names: commandNames,
68
+ check,
69
+ cwd: PACKAGE_ROOT,
70
+ });
71
+ const skillsResult = syncSkillsFromCommands({
72
+ label: LABEL,
73
+ sourceRoot: COMMANDS_ROOT,
74
+ skillsRoot: SKILLS_ROOT,
75
+ names: commandNames,
76
+ check,
77
+ cwd: PACKAGE_ROOT,
78
+ });
79
+
80
+ const babysitSkillPath = path.join(SKILLS_ROOT, 'babysit', 'SKILL.md');
81
+ if (check) {
82
+ const fs = require('fs');
83
+ const stale = [...mirrorResult.stale, ...skillsResult.stale];
84
+ const current = fs.existsSync(babysitSkillPath)
85
+ ? fs.readFileSync(babysitSkillPath, 'utf8')
86
+ : null;
87
+ if (current !== BABYSIT_SKILL) {
88
+ stale.push(path.relative(PACKAGE_ROOT, babysitSkillPath));
89
+ }
90
+ reportCheckResult(LABEL, stale);
91
+ return;
92
+ }
93
+
94
+ const babysitUpdated = writeFileIfChanged(babysitSkillPath, BABYSIT_SKILL) ? 1 : 0;
95
+ const updated = mirrorResult.updated + skillsResult.updated + babysitUpdated;
96
+
97
+ if (updated === 0) {
98
+ console.log(`[${LABEL}] no OpenCode command or skill changes were needed.`);
99
+ return;
100
+ }
101
+
102
+ console.log(`[${LABEL}] updated ${updated} OpenCode command/skill file(s).`);
103
+ }
104
+
105
+ main();
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Sync command surfaces from the canonical babysitter plugin.
4
+ *
5
+ * Copies command .md files from the cursor/codex plugins or generates
6
+ * them from the SDK CLI command definitions. Used during build/deploy
7
+ * to keep command surfaces in sync across harness plugins.
8
+ */
9
+
10
+ "use strict";
11
+
12
+ const fs = require("fs");
13
+ const path = require("path");
14
+
15
+ const PLUGIN_ROOT = path.resolve(__dirname, "..");
16
+ const COMMANDS_DIR = path.join(PLUGIN_ROOT, "commands");
17
+
18
+ // Check mode
19
+ const checkOnly = process.argv.includes("--check");
20
+
21
+ function main() {
22
+ // Verify commands directory exists and has files
23
+ if (!fs.existsSync(COMMANDS_DIR)) {
24
+ console.error("ERROR: commands/ directory not found");
25
+ process.exit(1);
26
+ }
27
+
28
+ const files = fs.readdirSync(COMMANDS_DIR).filter(f => f.endsWith(".md"));
29
+ if (files.length === 0) {
30
+ console.error("ERROR: No command .md files found in commands/");
31
+ process.exit(1);
32
+ }
33
+
34
+ console.log(`Found ${files.length} command files:`);
35
+ for (const file of files) {
36
+ const content = fs.readFileSync(path.join(COMMANDS_DIR, file), "utf8");
37
+ const hasHeader = content.startsWith("---");
38
+ const status = hasHeader ? "OK" : "MISSING FRONTMATTER";
39
+ console.log(` ${file} [${status}]`);
40
+ if (checkOnly && !hasHeader) {
41
+ process.exit(1);
42
+ }
43
+ }
44
+
45
+ if (checkOnly) {
46
+ console.log("\nAll command files are valid.");
47
+ } else {
48
+ console.log("\nCommand surfaces synced.");
49
+ }
50
+ }
51
+
52
+ main();
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: assimilate
3
+ description: Assimilate an external methodology, harness, or specification into babysitter process definitions with skills and agents.
4
+ ---
5
+
6
+ # assimilate
7
+
8
+ Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
9
+
10
+ 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.
11
+
12
+ If the workspace does not already have an active process-library binding, initialize it first through the shared global SDK binding:
13
+
14
+ ```bash
15
+ babysitter process-library:active --json
16
+ ```
17
+
18
+ Run the process after formalizing it.
19
+
20
+ Available assimilation workflows:
21
+ - **methodology-assimilation** (`specializations/meta/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.
22
+ - **harness integration** (`specializations/meta/assimilation/harness/*`) - Integrates babysitter SDK with a specific AI coding harness (generic, codex, opencode, gemini-cli, openclaw, antigravity).
23
+
24
+ During the interview phase, determine which assimilation workflow to use based on the user's target:
25
+ - If the target is a **repo URL or methodology name** then use the methodology-assimilation workflow.
26
+ - If the target is a **harness name** (e.g. codex, opencode, antigravity) then use the matching harness process.
27
+ - If the target is a **specification or other source** then adapt the methodology-assimilation workflow for the spec format.
28
+ - If unclear, ask the user to clarify the assimilation target and type.
29
+
30
+ ## After Assimilation: Contribute Back
31
+
32
+ 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:
33
+
34
+ - **Completed a methodology assimilation**: `/babysitter:contrib library contribution: assimilated [methodology-name] into babysitter process definitions`
35
+ - **Completed a harness integration**: `/babysitter:contrib library contribution: [harness-name] harness integration`
36
+ - **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]`
37
+
38
+ Even just reporting that an assimilation didn't work well helps improve babysitter for everyone.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: babysit
3
+ description: Orchestrate via @babysitter. Use this skill when asked to babysit a run, orchestrate a process or whenever it is called explicitly. (babysit, babysitter, orchestrate, orchestrate a run, workflow, etc.)
4
+ ---
5
+
6
+ # babysit
7
+
8
+ Orchestrate `.a5c/runs/<runId>/` through iterative execution.
9
+
10
+ ## Dependencies
11
+
12
+ ### Babysitter SDK and CLI
13
+
14
+ Read the SDK version from `versions.json` to ensure version compatibility:
15
+
16
+ ```bash
17
+ SDK_VERSION=$(node -e "try{const fs=require('fs');const probes=['./plugins/babysitter-opencode/versions.json','./node_modules/@a5c-ai/babysitter-opencode/versions.json'];for(const probe of probes){if(fs.existsSync(probe)){console.log(JSON.parse(fs.readFileSync(probe,'utf8')).sdkVersion||'latest');process.exit(0)}}console.log('latest')}catch{console.log('latest')}")
18
+ CLI="npx -y @a5c-ai/babysitter-sdk@$SDK_VERSION"
19
+ ```
20
+
21
+ ## Instructions
22
+
23
+ Run the following command to get full orchestration instructions:
24
+
25
+ ```bash
26
+ babysitter instructions:babysit-skill --harness opencode --interactive
27
+ ```
28
+
29
+ For non-interactive mode:
30
+
31
+ ```bash
32
+ babysitter instructions:babysit-skill --harness opencode --no-interactive
33
+ ```
34
+
35
+ Follow the instructions returned by the command above to orchestrate the run.
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: call
3
+ description: Orchestrate a babysitter run. use this command to start babysitting a complex workflow.
4
+ ---
5
+
6
+ # call
7
+
8
+ Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: cleanup
3
+ 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.
4
+ ---
5
+
6
+ # cleanup
7
+
8
+ Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
9
+
10
+ Create and run a cleanup process using the process at `skills\babysit\process\cradle\cleanup-runs.js/processes/cleanup-runs.js`.
11
+
12
+ Implementation notes (for the process):
13
+ - Parse arguments for `--dry-run` flag (if present, set dryRun: true in inputs) and `--keep-days N` (default: 7)
14
+ - The process scans .a5c/runs/ for completed/failed runs, aggregates insights, writes summaries, then removes old data
15
+ - Always show the user what will be removed before removing (in interactive mode via breakpoints)
16
+ - In non-interactive mode (yolo), proceed with cleanup using defaults
17
+ - The insights file goes to docs/run-history-insights.md
18
+ - Only remove terminal runs (completed/failed) older than the keep-days threshold
19
+ - Never remove active/in-progress runs
20
+ - Remove orphaned process files not referenced by remaining runs
21
+ - After cleanup, show remaining run count and disk usage
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: contrib
3
+ description: Submit feedback or contribute to babysitter project
4
+ ---
5
+
6
+ # contrib
7
+
8
+ Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
9
+
10
+ ## Process Routing
11
+
12
+ 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:
13
+
14
+ ### Issue-based (opens a GitHub issue in a5c-ai/babysitter)
15
+ * **Bug report** → `cradle/bug-report.js#process` — Report a bug in the SDK, CLI, process library, etc.
16
+ * **Feature request** → `cradle/feature-request.js#process` — Request a new feature or enhancement
17
+ * **Documentation question** → `cradle/documentation-question.js#process` — Ask about undocumented behavior or missing docs
18
+
19
+ ### PR-based (forks repo, creates branch, submits PR to a5c-ai/babysitter)
20
+ * **Bugfix** → `cradle/bugfix.js#process` — User already has the fix for a bug
21
+ * **Feature implementation** → `cradle/feature-implementation-contribute.js#process` — User already has a feature implementation
22
+ * **Harness integration** → `cradle/feature-harness-integration-contribute.js#process` — User has a harness (CI/CD, IDE, editor) integration
23
+ * **Library contribution** → `cradle/library-contribution.js#process` — New or improved process/skill/subagent for the library
24
+ * **Documentation answer** → `cradle/documentation-contribute-answer.js#process` — User has an answer for an unanswered docs question
25
+
26
+ ### Router (when arguments are empty or general)
27
+ * **Contribute** → `cradle/contribute.js#process` — Explains contribution types and routes to the specific process
28
+
29
+ ## Contribution Rules
30
+
31
+ * PR-based contributions: fork the babysitter repo (a5c-ai/babysitter) for the user, ask to star if not already starred, perform changes, submit PR
32
+ * Issue-based contributions: gather details, search for duplicates, review, then open an issue in a5c-ai/babysitter
33
+ * Add breakpoints (permissions) before ALL gh actions (fork, star, submit PR/issue) to allow user review and cancellation
34
+ * If arguments are empty: use the `contribute.js` router process to show options and route accordingly