@a5c-ai/babysitter-github 0.1.1-staging.04cc300a
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/.github/plugin.json +25 -0
- package/AGENTS.md +41 -0
- package/README.md +606 -0
- package/bin/cli.js +116 -0
- package/bin/install-shared.js +701 -0
- package/bin/install.js +129 -0
- package/bin/uninstall.js +76 -0
- package/commands/assimilate.md +37 -0
- package/commands/call.md +7 -0
- package/commands/cleanup.md +20 -0
- package/commands/contrib.md +33 -0
- package/commands/doctor.md +426 -0
- package/commands/forever.md +7 -0
- package/commands/help.md +244 -0
- package/commands/observe.md +12 -0
- package/commands/plan.md +7 -0
- package/commands/plugins.md +255 -0
- package/commands/project-install.md +17 -0
- package/commands/resume.md +8 -0
- package/commands/retrospect.md +55 -0
- package/commands/user-install.md +17 -0
- package/commands/yolo.md +7 -0
- package/hooks/session-end.ps1 +68 -0
- package/hooks/session-end.sh +65 -0
- package/hooks/session-start.ps1 +110 -0
- package/hooks/session-start.sh +100 -0
- package/hooks/user-prompt-submitted.ps1 +51 -0
- package/hooks/user-prompt-submitted.sh +41 -0
- package/hooks.json +29 -0
- package/package.json +50 -0
- package/plugin.json +25 -0
- package/scripts/sync-command-surfaces.js +62 -0
- package/scripts/team-install.js +93 -0
- package/skills/assimilate/SKILL.md +38 -0
- package/skills/babysit/SKILL.md +77 -0
- package/skills/call/SKILL.md +8 -0
- package/skills/doctor/SKILL.md +427 -0
- package/skills/help/SKILL.md +245 -0
- package/skills/observe/SKILL.md +13 -0
- package/skills/plan/SKILL.md +8 -0
- package/skills/resume/SKILL.md +9 -0
- package/skills/retrospect/SKILL.md +56 -0
- package/skills/user-install/SKILL.md +18 -0
- package/versions.json +3 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Babysitter Session Start Hook for GitHub Copilot CLI
|
|
3
|
+
# Ensures the babysitter SDK CLI is installed (from versions.json sdkVersion),
|
|
4
|
+
# then delegates to the TypeScript handler.
|
|
5
|
+
#
|
|
6
|
+
# Protocol:
|
|
7
|
+
# Input: JSON via stdin (contains session_id, cwd, etc.)
|
|
8
|
+
# Output: JSON via stdout ({} on success)
|
|
9
|
+
# Stderr: debug/log output only
|
|
10
|
+
# Exit 0: success
|
|
11
|
+
# Exit 2: block (fatal error)
|
|
12
|
+
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
|
|
15
|
+
PLUGIN_ROOT="${COPILOT_PLUGIN_DIR:-$(cd "$(dirname "$0")/.." && pwd)}"
|
|
16
|
+
MARKER_FILE="${PLUGIN_ROOT}/.babysitter-install-attempted"
|
|
17
|
+
|
|
18
|
+
LOG_DIR="${BABYSITTER_LOG_DIR:-$PLUGIN_ROOT/.a5c/logs}"
|
|
19
|
+
LOG_FILE="$LOG_DIR/babysitter-session-start-hook.log"
|
|
20
|
+
mkdir -p "$LOG_DIR" 2>/dev/null
|
|
21
|
+
|
|
22
|
+
# Structured logging helper -- writes to both local and global log
|
|
23
|
+
blog() {
|
|
24
|
+
local msg="$1"
|
|
25
|
+
local ts
|
|
26
|
+
ts="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
27
|
+
echo "[INFO] $ts $msg" >> "$LOG_FILE" 2>/dev/null
|
|
28
|
+
# Use CLI structured logging when available; fall back to direct append
|
|
29
|
+
if command -v babysitter &>/dev/null; then
|
|
30
|
+
babysitter log --type hook --label "hook:session-start" --message "$msg" --source shell-hook 2>/dev/null || true
|
|
31
|
+
fi
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
blog "Hook script invoked"
|
|
35
|
+
blog "PLUGIN_ROOT=$PLUGIN_ROOT"
|
|
36
|
+
|
|
37
|
+
# Get required SDK version from versions.json
|
|
38
|
+
SDK_VERSION=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync('${PLUGIN_ROOT}/versions.json','utf8')).sdkVersion||'latest')}catch{console.log('latest')}" 2>/dev/null || echo "latest")
|
|
39
|
+
|
|
40
|
+
# Function to install/upgrade SDK
|
|
41
|
+
install_sdk() {
|
|
42
|
+
local target_version="$1"
|
|
43
|
+
# Try global install first, fall back to user-local if permissions fail
|
|
44
|
+
if npm i -g "@a5c-ai/babysitter-sdk@${target_version}" --loglevel=error 2>/dev/null; then
|
|
45
|
+
blog "Installed SDK globally (${target_version})"
|
|
46
|
+
return 0
|
|
47
|
+
else
|
|
48
|
+
# Global install failed (permissions) -- try user-local prefix
|
|
49
|
+
if npm i -g "@a5c-ai/babysitter-sdk@${target_version}" --prefix "$HOME/.local" --loglevel=error 2>/dev/null; then
|
|
50
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
51
|
+
blog "Installed SDK to user prefix (${target_version})"
|
|
52
|
+
return 0
|
|
53
|
+
fi
|
|
54
|
+
fi
|
|
55
|
+
return 1
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
# Check if babysitter CLI exists and if version matches
|
|
59
|
+
NEEDS_INSTALL=false
|
|
60
|
+
if command -v babysitter &>/dev/null; then
|
|
61
|
+
CURRENT_VERSION=$(babysitter --version 2>/dev/null || echo "unknown")
|
|
62
|
+
if [ "$CURRENT_VERSION" != "$SDK_VERSION" ]; then
|
|
63
|
+
blog "SDK version mismatch: installed=${CURRENT_VERSION}, required=${SDK_VERSION}"
|
|
64
|
+
NEEDS_INSTALL=true
|
|
65
|
+
else
|
|
66
|
+
blog "SDK version OK: ${CURRENT_VERSION}"
|
|
67
|
+
fi
|
|
68
|
+
else
|
|
69
|
+
blog "SDK CLI not found, will install"
|
|
70
|
+
NEEDS_INSTALL=true
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# Install/upgrade if needed (only attempt once per plugin version)
|
|
74
|
+
if [ "$NEEDS_INSTALL" = true ] && [ ! -f "$MARKER_FILE" ]; then
|
|
75
|
+
install_sdk "$SDK_VERSION"
|
|
76
|
+
echo "$SDK_VERSION" > "$MARKER_FILE" 2>/dev/null
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# If still not available after install attempt, try npx as last resort
|
|
80
|
+
if ! command -v babysitter &>/dev/null; then
|
|
81
|
+
blog "CLI not found after install, using npx fallback"
|
|
82
|
+
babysitter() { npx -y "@a5c-ai/babysitter-sdk@${SDK_VERSION}" "$@"; }
|
|
83
|
+
export -f babysitter
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
# Capture stdin to a temp file so the CLI receives a clean EOF
|
|
87
|
+
# (piping /dev/stdin directly can keep the Node.js event loop alive)
|
|
88
|
+
INPUT_FILE=$(mktemp 2>/dev/null || echo "/tmp/hook-session-start-$$.json")
|
|
89
|
+
cat > "$INPUT_FILE"
|
|
90
|
+
|
|
91
|
+
blog "Hook input received ($(wc -c < "$INPUT_FILE") bytes)"
|
|
92
|
+
|
|
93
|
+
RESULT=$(babysitter hook:run --hook-type session-start --harness github-copilot --plugin-root "$PLUGIN_ROOT" --json < "$INPUT_FILE" 2>"$LOG_DIR/babysitter-session-start-hook-stderr.log")
|
|
94
|
+
EXIT_CODE=$?
|
|
95
|
+
|
|
96
|
+
blog "CLI exit code=$EXIT_CODE"
|
|
97
|
+
|
|
98
|
+
rm -f "$INPUT_FILE" 2>/dev/null
|
|
99
|
+
printf '%s\n' "$RESULT"
|
|
100
|
+
exit $EXIT_CODE
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Babysitter userPromptSubmitted Hook for GitHub Copilot CLI (PowerShell)
|
|
2
|
+
# Applies density-filter compression to long user prompts.
|
|
3
|
+
#
|
|
4
|
+
# NOTE: Output from this hook is IGNORED by Copilot CLI.
|
|
5
|
+
# This hook is for logging and side-effects only.
|
|
6
|
+
|
|
7
|
+
$ErrorActionPreference = "Continue"
|
|
8
|
+
|
|
9
|
+
$PluginRoot = if ($env:COPILOT_PLUGIN_DIR) { $env:COPILOT_PLUGIN_DIR } else { Split-Path -Parent $PSScriptRoot }
|
|
10
|
+
|
|
11
|
+
# Resolve babysitter CLI
|
|
12
|
+
$hasBabysitter = [bool](Get-Command babysitter -ErrorAction SilentlyContinue)
|
|
13
|
+
$useFallback = $false
|
|
14
|
+
|
|
15
|
+
if (-not $hasBabysitter) {
|
|
16
|
+
$localBin = Join-Path $env:USERPROFILE ".local\bin\babysitter.cmd"
|
|
17
|
+
if (Test-Path $localBin) {
|
|
18
|
+
$env:PATH = "$(Split-Path $localBin);$env:PATH"
|
|
19
|
+
$hasBabysitter = $true
|
|
20
|
+
} else {
|
|
21
|
+
$versionsFile = Join-Path $PluginRoot "versions.json"
|
|
22
|
+
try {
|
|
23
|
+
$SdkVersion = (Get-Content $versionsFile -Raw | ConvertFrom-Json).sdkVersion
|
|
24
|
+
if (-not $SdkVersion) { $SdkVersion = "latest" }
|
|
25
|
+
} catch {
|
|
26
|
+
$SdkVersion = "latest"
|
|
27
|
+
}
|
|
28
|
+
$useFallback = $true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
$LogDir = if ($env:BABYSITTER_LOG_DIR) { $env:BABYSITTER_LOG_DIR } else { Join-Path $PluginRoot ".a5c\logs" }
|
|
33
|
+
New-Item -ItemType Directory -Path $LogDir -Force -ErrorAction SilentlyContinue | Out-Null
|
|
34
|
+
|
|
35
|
+
# Capture stdin
|
|
36
|
+
$InputFile = [System.IO.Path]::GetTempFileName()
|
|
37
|
+
$input | Out-File -FilePath $InputFile -Encoding utf8
|
|
38
|
+
|
|
39
|
+
$stderrLog = Join-Path $LogDir "babysitter-user-prompt-submitted-hook-stderr.log"
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
if ($useFallback) {
|
|
43
|
+
Get-Content $InputFile | & npx -y "@a5c-ai/babysitter-sdk@$SdkVersion" hook:run --hook-type user-prompt-submitted --harness github-copilot --json 2>$stderrLog | Out-Null
|
|
44
|
+
} elseif ($hasBabysitter) {
|
|
45
|
+
Get-Content $InputFile | & babysitter hook:run --hook-type user-prompt-submitted --harness github-copilot --json 2>$stderrLog | Out-Null
|
|
46
|
+
}
|
|
47
|
+
} catch {}
|
|
48
|
+
|
|
49
|
+
Remove-Item $InputFile -Force -ErrorAction SilentlyContinue
|
|
50
|
+
|
|
51
|
+
exit 0
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Babysitter userPromptSubmitted Hook for GitHub Copilot CLI
|
|
3
|
+
# Applies density-filter compression to long user prompts.
|
|
4
|
+
# Delegates to SDK CLI: babysitter hook:run --hook-type user-prompt-submitted
|
|
5
|
+
#
|
|
6
|
+
# NOTE: Output from this hook is IGNORED by Copilot CLI.
|
|
7
|
+
# This hook is for logging and side-effects only.
|
|
8
|
+
|
|
9
|
+
PLUGIN_ROOT="${COPILOT_PLUGIN_DIR:-$(cd "$(dirname "$0")/.." && pwd)}"
|
|
10
|
+
|
|
11
|
+
# Resolve babysitter CLI: installed binary, user-local prefix, or npx fallback
|
|
12
|
+
if ! command -v babysitter &>/dev/null; then
|
|
13
|
+
if [ -x "$HOME/.local/bin/babysitter" ]; then
|
|
14
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
15
|
+
else
|
|
16
|
+
SDK_VERSION=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync('${PLUGIN_ROOT}/versions.json','utf8')).sdkVersion||'latest')}catch{console.log('latest')}" 2>/dev/null || echo "latest")
|
|
17
|
+
if [ -n "$SDK_VERSION" ]; then
|
|
18
|
+
babysitter() { npx -y "@a5c-ai/babysitter-sdk@${SDK_VERSION}" "$@"; }
|
|
19
|
+
export -f babysitter
|
|
20
|
+
else
|
|
21
|
+
# No CLI available -- exit silently
|
|
22
|
+
exit 0
|
|
23
|
+
fi
|
|
24
|
+
fi
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
LOG_DIR="${BABYSITTER_LOG_DIR:-$PLUGIN_ROOT/.a5c/logs}"
|
|
28
|
+
mkdir -p "$LOG_DIR" 2>/dev/null
|
|
29
|
+
|
|
30
|
+
INPUT_FILE=$(mktemp 2>/dev/null || echo "/tmp/hook-user-prompt-submitted-$$.json")
|
|
31
|
+
cat > "$INPUT_FILE"
|
|
32
|
+
|
|
33
|
+
babysitter log --type hook --label "hook:user-prompt-submitted" --message "Hook invoked" --source shell-hook 2>/dev/null || true
|
|
34
|
+
|
|
35
|
+
babysitter hook:run --hook-type user-prompt-submitted --harness github-copilot --json < "$INPUT_FILE" 2>"$LOG_DIR/babysitter-user-prompt-submitted-hook-stderr.log" || true
|
|
36
|
+
|
|
37
|
+
babysitter log --type hook --label "hook:user-prompt-submitted" --message "Hook complete" --source shell-hook 2>/dev/null || true
|
|
38
|
+
|
|
39
|
+
rm -f "$INPUT_FILE" 2>/dev/null
|
|
40
|
+
|
|
41
|
+
exit 0
|
package/hooks.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"hooks": {
|
|
4
|
+
"sessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"type": "command",
|
|
7
|
+
"bash": "./hooks/session-start.sh",
|
|
8
|
+
"powershell": "./hooks/session-start.ps1",
|
|
9
|
+
"timeoutSec": 30
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"sessionEnd": [
|
|
13
|
+
{
|
|
14
|
+
"type": "command",
|
|
15
|
+
"bash": "./hooks/session-end.sh",
|
|
16
|
+
"powershell": "./hooks/session-end.ps1",
|
|
17
|
+
"timeoutSec": 30
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"userPromptSubmitted": [
|
|
21
|
+
{
|
|
22
|
+
"type": "command",
|
|
23
|
+
"bash": "./hooks/user-prompt-submitted.sh",
|
|
24
|
+
"powershell": "./hooks/user-prompt-submitted.ps1",
|
|
25
|
+
"timeoutSec": 30
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@a5c-ai/babysitter-github",
|
|
3
|
+
"version": "0.1.1-staging.04cc300a",
|
|
4
|
+
"description": "Babysitter orchestration plugin for GitHub Copilot CLI with lifecycle hooks and SDK-managed process-library bootstrapping",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "node scripts/sync-command-surfaces.js --check && node test/cloud-agent-install.test.js",
|
|
7
|
+
"sync:commands": "node scripts/sync-command-surfaces.js",
|
|
8
|
+
"postinstall": "node bin/install.js",
|
|
9
|
+
"preuninstall": "node bin/uninstall.js",
|
|
10
|
+
"team:install": "node scripts/team-install.js",
|
|
11
|
+
"deploy": "npm publish --access public",
|
|
12
|
+
"deploy:staging": "npm publish --access public --tag staging"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"babysitter-github": "bin/cli.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"plugin.json",
|
|
19
|
+
"hooks.json",
|
|
20
|
+
"hooks/",
|
|
21
|
+
"skills/",
|
|
22
|
+
"bin/",
|
|
23
|
+
"scripts/",
|
|
24
|
+
"versions.json",
|
|
25
|
+
"AGENTS.md",
|
|
26
|
+
"commands/",
|
|
27
|
+
".github/",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"keywords": [
|
|
31
|
+
"babysitter",
|
|
32
|
+
"github-copilot",
|
|
33
|
+
"orchestration",
|
|
34
|
+
"ai-agent",
|
|
35
|
+
"sdk-integration"
|
|
36
|
+
],
|
|
37
|
+
"author": "a5c.ai",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/a5c-ai/babysitter"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-github#readme",
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@a5c-ai/babysitter-sdk": "0.0.184-staging.04cc300a"
|
|
49
|
+
}
|
|
50
|
+
}
|
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": { "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
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const {
|
|
5
|
+
listDirectories,
|
|
6
|
+
listMarkdownBasenames,
|
|
7
|
+
reportCheckResult,
|
|
8
|
+
syncCommandMirrors,
|
|
9
|
+
syncSkillsFromCommands,
|
|
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 PLUGIN_COMMANDS = path.join(PACKAGE_ROOT, 'commands');
|
|
16
|
+
const PLUGIN_SKILLS = path.join(PACKAGE_ROOT, 'skills');
|
|
17
|
+
const LABEL = 'babysitter-github sync';
|
|
18
|
+
|
|
19
|
+
function getMirroredCommandNames() {
|
|
20
|
+
const local = new Set(listMarkdownBasenames(PLUGIN_COMMANDS));
|
|
21
|
+
return listMarkdownBasenames(ROOT_COMMANDS).filter((name) => local.has(name));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getDerivedSkillNames() {
|
|
25
|
+
const local = new Set(listDirectories(PLUGIN_SKILLS));
|
|
26
|
+
return listMarkdownBasenames(PLUGIN_COMMANDS).filter((name) => local.has(name));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function main() {
|
|
30
|
+
const check = process.argv.includes('--check');
|
|
31
|
+
const mirrorResult = syncCommandMirrors({
|
|
32
|
+
label: LABEL,
|
|
33
|
+
sourceRoot: ROOT_COMMANDS,
|
|
34
|
+
targetRoot: PLUGIN_COMMANDS,
|
|
35
|
+
names: getMirroredCommandNames(),
|
|
36
|
+
check,
|
|
37
|
+
cwd: PACKAGE_ROOT,
|
|
38
|
+
});
|
|
39
|
+
const skillsResult = syncSkillsFromCommands({
|
|
40
|
+
label: LABEL,
|
|
41
|
+
sourceRoot: PLUGIN_COMMANDS,
|
|
42
|
+
skillsRoot: PLUGIN_SKILLS,
|
|
43
|
+
names: getDerivedSkillNames(),
|
|
44
|
+
check,
|
|
45
|
+
cwd: PACKAGE_ROOT,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (check) {
|
|
49
|
+
reportCheckResult(LABEL, [...mirrorResult.stale, ...skillsResult.stale]);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const updated = mirrorResult.updated + skillsResult.updated;
|
|
54
|
+
if (updated === 0) {
|
|
55
|
+
console.log(`[${LABEL}] no GitHub plugin command changes were needed.`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
console.log(`[${LABEL}] updated ${updated} GitHub plugin file(s).`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
main();
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const {
|
|
7
|
+
copyPluginBundle,
|
|
8
|
+
ensureGlobalProcessLibrary,
|
|
9
|
+
ensureMarketplaceEntry,
|
|
10
|
+
installCopilotSurface,
|
|
11
|
+
registerCopilotPlugin,
|
|
12
|
+
warnWindowsHooks,
|
|
13
|
+
writeJson,
|
|
14
|
+
} = require('../bin/install-shared');
|
|
15
|
+
|
|
16
|
+
function parseArgs(argv) {
|
|
17
|
+
const args = {
|
|
18
|
+
workspace: process.cwd(),
|
|
19
|
+
cloudAgent: false,
|
|
20
|
+
dryRun: false,
|
|
21
|
+
};
|
|
22
|
+
for (let i = 2; i < argv.length; i += 1) {
|
|
23
|
+
if (argv[i] === '--workspace' && argv[i + 1]) {
|
|
24
|
+
args.workspace = path.resolve(argv[++i]);
|
|
25
|
+
} else if (argv[i] === '--cloud-agent') {
|
|
26
|
+
args.cloudAgent = true;
|
|
27
|
+
} else if (argv[i] === '--dry-run') {
|
|
28
|
+
args.dryRun = true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return args;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function main() {
|
|
35
|
+
const args = parseArgs(process.argv);
|
|
36
|
+
const packageRoot = path.resolve(process.env.BABYSITTER_PACKAGE_ROOT || path.join(__dirname, '..'));
|
|
37
|
+
const workspaceRoot = args.workspace;
|
|
38
|
+
const workspacePluginRoot = path.join(workspaceRoot, 'plugins', 'babysitter');
|
|
39
|
+
const workspaceMarketplacePath = path.join(workspaceRoot, '.agents', 'plugins', 'marketplace.json');
|
|
40
|
+
const workspaceCopilotDir = path.join(workspaceRoot, '.copilot');
|
|
41
|
+
|
|
42
|
+
const installInfo = {
|
|
43
|
+
installedAt: new Date().toISOString(),
|
|
44
|
+
packageRoot,
|
|
45
|
+
workspaceRoot,
|
|
46
|
+
pluginRoot: workspacePluginRoot,
|
|
47
|
+
marketplacePath: workspaceMarketplacePath,
|
|
48
|
+
copilotDir: workspaceCopilotDir,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (args.dryRun) {
|
|
52
|
+
console.log(JSON.stringify({
|
|
53
|
+
ok: true,
|
|
54
|
+
dryRun: true,
|
|
55
|
+
installInfo,
|
|
56
|
+
}, null, 2));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
copyPluginBundle(packageRoot, workspacePluginRoot);
|
|
61
|
+
ensureMarketplaceEntry(workspaceMarketplacePath, workspacePluginRoot);
|
|
62
|
+
registerCopilotPlugin(workspacePluginRoot);
|
|
63
|
+
installCopilotSurface(packageRoot, workspaceCopilotDir);
|
|
64
|
+
if (args.cloudAgent) {
|
|
65
|
+
const { installCloudAgentSurface } = require('../bin/install-shared');
|
|
66
|
+
installInfo.cloudAgent = installCloudAgentSurface(packageRoot, workspaceRoot);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const active = ensureGlobalProcessLibrary(packageRoot);
|
|
70
|
+
installInfo.processLibraryStateFile = active.stateFile;
|
|
71
|
+
installInfo.processLibraryRoot = active.binding?.dir || '';
|
|
72
|
+
installInfo.processLibraryCloneDir = active.defaultSpec?.cloneDir || '';
|
|
73
|
+
|
|
74
|
+
const outDir = path.join(workspaceRoot, '.a5c', 'team');
|
|
75
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
76
|
+
writeJson(path.join(outDir, 'install.json'), installInfo);
|
|
77
|
+
|
|
78
|
+
const profilePath = path.join(outDir, 'profile.json');
|
|
79
|
+
if (!fs.existsSync(profilePath)) {
|
|
80
|
+
writeJson(profilePath, {
|
|
81
|
+
teamName: 'default',
|
|
82
|
+
pluginRoot: workspacePluginRoot,
|
|
83
|
+
marketplacePath: workspaceMarketplacePath,
|
|
84
|
+
copilotDir: workspaceCopilotDir,
|
|
85
|
+
processLibraryLookupCommand: 'babysitter process-library:active --json',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
warnWindowsHooks();
|
|
90
|
+
console.log('[team-install] complete');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
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/domains/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/domains/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,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: babysit
|
|
3
|
+
description: >-
|
|
4
|
+
Orchestrate via @babysitter. Use this skill when asked to babysit a run,
|
|
5
|
+
orchestrate a process or whenever it is called explicitly. (babysit,
|
|
6
|
+
babysitter, orchestrate, orchestrate a run, workflow, etc.)
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# babysit
|
|
10
|
+
|
|
11
|
+
Orchestrate `.a5c/runs/<runId>/` through iterative execution.
|
|
12
|
+
|
|
13
|
+
## Dependencies
|
|
14
|
+
|
|
15
|
+
### Babysitter SDK and CLI
|
|
16
|
+
|
|
17
|
+
Read the SDK version from `versions.json` to ensure version compatibility:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
SDK_VERSION=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync('${PLUGIN_ROOT}/versions.json','utf8')).sdkVersion||'latest')}catch{console.log('latest')}")
|
|
21
|
+
sudo npm i -g @a5c-ai/babysitter-sdk@$SDK_VERSION
|
|
22
|
+
# sudo is depending on the env and system
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
then use the CLI alias: CLI="babysitter"
|
|
26
|
+
|
|
27
|
+
**Alternatively, use the CLI alias:** `CLI="npx -y @a5c-ai/babysitter-sdk@$SDK_VERSION"`
|
|
28
|
+
|
|
29
|
+
### jq
|
|
30
|
+
|
|
31
|
+
make sure you have jq installed and available in the path. if not, install it.
|
|
32
|
+
|
|
33
|
+
## Instructions
|
|
34
|
+
|
|
35
|
+
Run the following command to get full orchestration instructions:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
babysitter instructions:babysit-skill --harness github-copilot --json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Follow the instructions returned by the command above to orchestrate the run.
|
|
42
|
+
|
|
43
|
+
## GitHub Copilot CLI -- In-Turn Loop Model
|
|
44
|
+
|
|
45
|
+
**IMPORTANT**: Unlike Claude Code, GitHub Copilot CLI does NOT have a Stop hook
|
|
46
|
+
that can drive the orchestration loop between turns. The `sessionEnd` hook output
|
|
47
|
+
is ignored and cannot block or restart the session.
|
|
48
|
+
|
|
49
|
+
Therefore, you MUST use **in-turn iteration**: run the full orchestration loop
|
|
50
|
+
within a single session turn. The pattern is:
|
|
51
|
+
|
|
52
|
+
1. `babysitter run:iterate --json` -- get pending actions
|
|
53
|
+
2. For each pending action: execute it (run tasks, post results via `task:post`)
|
|
54
|
+
3. `babysitter run:iterate --json` -- check for more pending actions
|
|
55
|
+
4. Repeat steps 2-3 until run completes or reaches a breakpoint requiring user input
|
|
56
|
+
5. If a breakpoint requires user input, ask the user and post the response, then continue iterating
|
|
57
|
+
|
|
58
|
+
All iteration happens within the same turn -- do NOT rely on hooks to re-enter
|
|
59
|
+
the orchestration loop. The agent drives the loop directly by calling
|
|
60
|
+
`run:iterate` repeatedly until completion.
|
|
61
|
+
|
|
62
|
+
### Loop Example
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Initial iterate
|
|
66
|
+
RESULT=$(babysitter run:iterate --run-id "$RUN_ID" --json)
|
|
67
|
+
STATUS=$(echo "$RESULT" | jq -r '.status')
|
|
68
|
+
|
|
69
|
+
while [ "$STATUS" != "completed" ] && [ "$STATUS" != "failed" ]; do
|
|
70
|
+
# Process pending actions from RESULT
|
|
71
|
+
# ... execute tasks, post results ...
|
|
72
|
+
|
|
73
|
+
# Iterate again
|
|
74
|
+
RESULT=$(babysitter run:iterate --run-id "$RUN_ID" --json)
|
|
75
|
+
STATUS=$(echo "$RESULT" | jq -r '.status')
|
|
76
|
+
done
|
|
77
|
+
```
|