@a5c-ai/babysitter-cursor 5.0.1-staging.71bb37a4 → 5.0.1-staging.75c8fb21
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/bin/cli.js +8 -16
- package/bin/install-shared.js +236 -120
- package/bin/install.js +12 -28
- package/bin/uninstall.js +11 -27
- package/commands/doctor.md +5 -5
- package/commands/help.md +245 -244
- package/commands/observe.md +12 -12
- package/hooks/babysitter-proxied-session-start.ps1 +10 -194
- package/hooks/babysitter-proxied-session-start.sh +7 -170
- package/hooks/babysitter-proxied-stop.ps1 +12 -0
- package/hooks/babysitter-proxied-stop.sh +3 -0
- package/hooks/hooks-cursor.json +2 -2
- package/hooks.json +2 -2
- package/package.json +20 -20
- package/plugin.json +7 -5
- package/scripts/team-install.js +14 -72
- package/skills/cleanup/SKILL.md +21 -0
- package/skills/contrib/SKILL.md +34 -0
- package/skills/doctor/SKILL.md +5 -5
- package/skills/forever/SKILL.md +8 -0
- package/skills/help/SKILL.md +3 -2
- package/skills/observe/SKILL.md +1 -1
- package/skills/plugins/SKILL.md +257 -0
- package/skills/project-install/SKILL.md +18 -0
- package/skills/resume/SKILL.md +1 -1
- package/skills/retrospect/SKILL.md +48 -48
- package/skills/user-install/SKILL.md +3 -3
- package/skills/yolo/SKILL.md +8 -0
- package/versions.json +2 -1
- package/.cursor-plugin/plugin.json +0 -22
- package/.cursorrules +0 -55
- package/hooks/babysitter-proxied-stop-hook.ps1 +0 -125
- package/hooks/babysitter-proxied-stop-hook.sh +0 -112
- package/hooks/hooks-cursor.json.legacy +0 -21
- package/hooks/proxied-hooks.json +0 -22
- package/hooks/session-start.ps1 +0 -116
- package/hooks/session-start.sh +0 -106
- package/hooks/stop-hook.ps1 +0 -73
- package/hooks/stop-hook.sh +0 -61
|
@@ -1,196 +1,12 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# Stderr: debug/log output only
|
|
11
|
-
# Exit 0: success
|
|
12
|
-
# Exit 2: block (fatal error)
|
|
13
|
-
|
|
14
|
-
$ErrorActionPreference = "Stop"
|
|
15
|
-
|
|
16
|
-
$PluginRoot = if ($env:CURSOR_PLUGIN_ROOT) { $env:CURSOR_PLUGIN_ROOT } else { Split-Path -Parent $PSScriptRoot }
|
|
17
|
-
$GlobalRoot = if ($env:BABYSITTER_GLOBAL_STATE_DIR) { $env:BABYSITTER_GLOBAL_STATE_DIR } else { Join-Path $HOME ".a5c" }
|
|
18
|
-
$StateDir = if ($env:BABYSITTER_STATE_DIR) { $env:BABYSITTER_STATE_DIR } else { Join-Path $GlobalRoot "state" }
|
|
19
|
-
$SdkMarkerFile = Join-Path $PluginRoot ".babysitter-install-attempted"
|
|
20
|
-
$ProxyMarkerFile = Join-Path $PluginRoot ".hooks-proxy-install-attempted"
|
|
21
|
-
|
|
22
|
-
$env:CURSOR_PLUGIN_ROOT = $PluginRoot
|
|
23
|
-
$env:BABYSITTER_STATE_DIR = $StateDir
|
|
24
|
-
|
|
25
|
-
$LogDir = if ($env:BABYSITTER_LOG_DIR) { $env:BABYSITTER_LOG_DIR } else { Join-Path $GlobalRoot "logs" }
|
|
26
|
-
$LogFile = Join-Path $LogDir "babysitter-session-start-hook.log"
|
|
27
|
-
New-Item -ItemType Directory -Path $LogDir -Force -ErrorAction SilentlyContinue | Out-Null
|
|
28
|
-
|
|
29
|
-
function Write-Blog {
|
|
30
|
-
param([string]$Message)
|
|
31
|
-
$ts = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
|
|
32
|
-
Add-Content -Path $LogFile -Value "[INFO] $ts $Message" -ErrorAction SilentlyContinue
|
|
33
|
-
if (Get-Command babysitter -ErrorAction SilentlyContinue) {
|
|
34
|
-
& babysitter log --type hook --label "hook:session-start" --message $Message --source shell-hook 2>$null
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
Write-Blog "Unified hook script invoked"
|
|
39
|
-
Write-Blog "PLUGIN_ROOT=$PluginRoot"
|
|
40
|
-
Write-Blog "STATE_DIR=$StateDir"
|
|
41
|
-
|
|
42
|
-
# Get required SDK version from versions.json (used for both SDK and hooks-proxy)
|
|
43
|
-
$versionsFile = Join-Path $PluginRoot "versions.json"
|
|
44
|
-
try {
|
|
45
|
-
$SdkVersion = (Get-Content $versionsFile -Raw | ConvertFrom-Json).sdkVersion
|
|
46
|
-
if (-not $SdkVersion) { $SdkVersion = "latest" }
|
|
47
|
-
} catch {
|
|
48
|
-
$SdkVersion = "latest"
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
# ---------------------------------------------------------------------------
|
|
52
|
-
# SDK install/upgrade
|
|
53
|
-
# ---------------------------------------------------------------------------
|
|
54
|
-
|
|
55
|
-
function Install-Sdk {
|
|
56
|
-
param([string]$TargetVersion)
|
|
57
|
-
try {
|
|
58
|
-
& npm i -g "@a5c-ai/babysitter-sdk@$TargetVersion" --loglevel=error 2>$null
|
|
59
|
-
if ($LASTEXITCODE -eq 0) {
|
|
60
|
-
Write-Blog "Installed SDK globally ($TargetVersion)"
|
|
61
|
-
return $true
|
|
62
|
-
}
|
|
63
|
-
} catch {}
|
|
64
|
-
try {
|
|
65
|
-
$prefix = Join-Path $env:USERPROFILE ".local"
|
|
66
|
-
& npm i -g "@a5c-ai/babysitter-sdk@$TargetVersion" --prefix $prefix --loglevel=error 2>$null
|
|
67
|
-
if ($LASTEXITCODE -eq 0) {
|
|
68
|
-
$env:PATH = "$prefix\bin;$env:PATH"
|
|
69
|
-
Write-Blog "Installed SDK to user prefix ($TargetVersion)"
|
|
70
|
-
return $true
|
|
71
|
-
}
|
|
72
|
-
} catch {}
|
|
73
|
-
return $false
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
$NeedsSdkInstall = $false
|
|
77
|
-
if (Get-Command babysitter -ErrorAction SilentlyContinue) {
|
|
78
|
-
$CurrentVersion = & babysitter --version 2>$null
|
|
79
|
-
if ($CurrentVersion -ne $SdkVersion) {
|
|
80
|
-
Write-Blog "SDK version mismatch: installed=$CurrentVersion, required=$SdkVersion"
|
|
81
|
-
$NeedsSdkInstall = $true
|
|
82
|
-
} else {
|
|
83
|
-
Write-Blog "SDK version OK: $CurrentVersion"
|
|
84
|
-
}
|
|
85
|
-
} else {
|
|
86
|
-
Write-Blog "SDK CLI not found, will install"
|
|
87
|
-
$NeedsSdkInstall = $true
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if ($NeedsSdkInstall -and -not (Test-Path $SdkMarkerFile)) {
|
|
91
|
-
Install-Sdk $SdkVersion | Out-Null
|
|
92
|
-
Set-Content -Path $SdkMarkerFile -Value $SdkVersion -ErrorAction SilentlyContinue
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
$useSdkFallback = $false
|
|
96
|
-
if (-not (Get-Command babysitter -ErrorAction SilentlyContinue)) {
|
|
97
|
-
Write-Blog "CLI not found after install, using npx fallback"
|
|
98
|
-
$useSdkFallback = $true
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
# ---------------------------------------------------------------------------
|
|
102
|
-
# Hooks-proxy install/upgrade (same pattern as SDK)
|
|
103
|
-
# ---------------------------------------------------------------------------
|
|
104
|
-
|
|
105
|
-
function Install-HooksProxy {
|
|
106
|
-
param([string]$TargetVersion)
|
|
107
|
-
try {
|
|
108
|
-
& npm i -g "@a5c-ai/hooks-proxy-cli@$TargetVersion" --loglevel=error 2>$null
|
|
109
|
-
if ($LASTEXITCODE -eq 0) {
|
|
110
|
-
Write-Blog "Installed hooks-proxy globally ($TargetVersion)"
|
|
111
|
-
return $true
|
|
112
|
-
}
|
|
113
|
-
} catch {}
|
|
114
|
-
try {
|
|
115
|
-
$prefix = Join-Path $env:USERPROFILE ".local"
|
|
116
|
-
& npm i -g "@a5c-ai/hooks-proxy-cli@$TargetVersion" --prefix $prefix --loglevel=error 2>$null
|
|
117
|
-
if ($LASTEXITCODE -eq 0) {
|
|
118
|
-
$env:PATH = "$prefix\bin;$env:PATH"
|
|
119
|
-
Write-Blog "Installed hooks-proxy to user prefix ($TargetVersion)"
|
|
120
|
-
return $true
|
|
121
|
-
}
|
|
122
|
-
} catch {}
|
|
123
|
-
return $false
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
$NeedsProxyInstall = $false
|
|
127
|
-
$Proxy = $null
|
|
128
|
-
if (Get-Command a5c-hooks-proxy -ErrorAction SilentlyContinue) {
|
|
129
|
-
$ProxyVersion = & a5c-hooks-proxy --version 2>$null
|
|
130
|
-
if ($ProxyVersion -ne $SdkVersion) {
|
|
131
|
-
Write-Blog "hooks-proxy version mismatch: installed=$ProxyVersion, required=$SdkVersion"
|
|
132
|
-
$NeedsProxyInstall = $true
|
|
133
|
-
} else {
|
|
134
|
-
Write-Blog "hooks-proxy version OK: $ProxyVersion"
|
|
135
|
-
$Proxy = "a5c-hooks-proxy"
|
|
136
|
-
}
|
|
137
|
-
} else {
|
|
138
|
-
$localProxy = Join-Path $env:USERPROFILE ".local\bin\a5c-hooks-proxy.exe"
|
|
139
|
-
if (Test-Path $localProxy) {
|
|
140
|
-
$ProxyVersion = & $localProxy --version 2>$null
|
|
141
|
-
if ($ProxyVersion -ne $SdkVersion) {
|
|
142
|
-
Write-Blog "hooks-proxy version mismatch: installed=$ProxyVersion, required=$SdkVersion"
|
|
143
|
-
$NeedsProxyInstall = $true
|
|
144
|
-
} else {
|
|
145
|
-
Write-Blog "hooks-proxy version OK: $ProxyVersion"
|
|
146
|
-
$Proxy = $localProxy
|
|
147
|
-
}
|
|
148
|
-
} else {
|
|
149
|
-
Write-Blog "hooks-proxy not found, will install"
|
|
150
|
-
$NeedsProxyInstall = $true
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if ($NeedsProxyInstall -and -not (Test-Path $ProxyMarkerFile)) {
|
|
155
|
-
Install-HooksProxy $SdkVersion | Out-Null
|
|
156
|
-
Set-Content -Path $ProxyMarkerFile -Value $SdkVersion -ErrorAction SilentlyContinue
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
# Re-resolve after potential install
|
|
160
|
-
if (-not $Proxy) {
|
|
161
|
-
if (Get-Command a5c-hooks-proxy -ErrorAction SilentlyContinue) {
|
|
162
|
-
$Proxy = "a5c-hooks-proxy"
|
|
163
|
-
} else {
|
|
164
|
-
$localProxy = Join-Path $env:USERPROFILE ".local\bin\a5c-hooks-proxy.exe"
|
|
165
|
-
if (Test-Path $localProxy) {
|
|
166
|
-
$Proxy = $localProxy
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
# ---------------------------------------------------------------------------
|
|
172
|
-
# Capture stdin and delegate to hooks-proxy
|
|
173
|
-
# ---------------------------------------------------------------------------
|
|
174
|
-
|
|
175
|
-
$InputFile = [System.IO.Path]::GetTempFileName()
|
|
176
|
-
$input | Out-File -FilePath $InputFile -Encoding utf8
|
|
177
|
-
|
|
178
|
-
Write-Blog "Hook input received"
|
|
179
|
-
|
|
180
|
-
$stderrLog = Join-Path $LogDir "babysitter-session-start-hook-stderr.log"
|
|
181
|
-
|
|
182
|
-
if ($Proxy) {
|
|
183
|
-
Write-Blog "Using hooks-proxy: $Proxy"
|
|
184
|
-
$Result = Get-Content $InputFile | & $Proxy invoke --adapter cursor --handler "babysitter hook:run --harness unified --hook-type session-start --plugin-root $PluginRoot --state-dir $StateDir --json" --json 2>$stderrLog
|
|
185
|
-
$ExitCode = $LASTEXITCODE
|
|
1
|
+
# PowerShell hook wrapper — sets env vars and delegates to bash
|
|
2
|
+
$env:HOOK_TYPE = 'session-start'
|
|
3
|
+
$env:ADAPTER_NAME = 'cursor'
|
|
4
|
+
$env:PLUGIN_ROOT = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
|
|
5
|
+
|
|
6
|
+
$input_data = [Console]::In.ReadToEnd()
|
|
7
|
+
$result = $input_data | & bash "$PSScriptRoot/../$($MyInvocation.MyCommand.Name -replace '\.ps1$','.sh')" 2>$null
|
|
8
|
+
if ($LASTEXITCODE -eq 0 -and $result) {
|
|
9
|
+
Write-Output $result
|
|
186
10
|
} else {
|
|
187
|
-
|
|
188
|
-
$Result = Get-Content $InputFile | & npx -y "@a5c-ai/hooks-proxy-cli@$SdkVersion" invoke --adapter cursor --handler "babysitter hook:run --harness unified --hook-type session-start --plugin-root $PluginRoot --state-dir $StateDir --json" --json 2>$stderrLog
|
|
189
|
-
$ExitCode = $LASTEXITCODE
|
|
11
|
+
Write-Output '{}'
|
|
190
12
|
}
|
|
191
|
-
|
|
192
|
-
Write-Blog "CLI exit code=$ExitCode"
|
|
193
|
-
|
|
194
|
-
Remove-Item $InputFile -Force -ErrorAction SilentlyContinue
|
|
195
|
-
Write-Output $Result
|
|
196
|
-
exit $ExitCode
|
|
@@ -1,174 +1,11 @@
|
|
|
1
|
-
#!/
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
# Ensures the babysitter SDK CLI and hooks-proxy are installed (from versions.json
|
|
5
|
-
# sdkVersion), then delegates to the SDK hook handler via hooks-proxy.
|
|
6
|
-
#
|
|
7
|
-
# Protocol:
|
|
8
|
-
# Input: JSON via stdin (contains session_id, cwd, etc.)
|
|
9
|
-
# Output: JSON via stdout ({} on success)
|
|
10
|
-
# Stderr: debug/log output only
|
|
11
|
-
# Exit 0: success
|
|
12
|
-
# Exit 2: block (fatal error)
|
|
13
|
-
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Session Start — installs SDK if needed, then runs hook handler.
|
|
14
3
|
set -euo pipefail
|
|
15
|
-
|
|
16
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
17
|
-
PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
18
|
-
GLOBAL_ROOT="${BABYSITTER_GLOBAL_STATE_DIR:-$HOME/.a5c}"
|
|
19
|
-
STATE_DIR="${BABYSITTER_STATE_DIR:-${GLOBAL_ROOT}/state}"
|
|
20
|
-
LOG_DIR="${BABYSITTER_LOG_DIR:-${GLOBAL_ROOT}/logs}"
|
|
21
|
-
LOG_FILE="$LOG_DIR/babysitter-session-start-hook.log"
|
|
22
|
-
SDK_MARKER_FILE="${PLUGIN_ROOT}/.babysitter-install-attempted"
|
|
23
|
-
PROXY_MARKER_FILE="${PLUGIN_ROOT}/.hooks-proxy-install-attempted"
|
|
24
|
-
|
|
25
|
-
export CURSOR_PLUGIN_ROOT="${CURSOR_PLUGIN_ROOT:-${PLUGIN_ROOT}}"
|
|
26
|
-
export BABYSITTER_STATE_DIR="${STATE_DIR}"
|
|
27
|
-
|
|
28
|
-
mkdir -p "$LOG_DIR" 2>/dev/null
|
|
29
|
-
|
|
30
|
-
blog() {
|
|
31
|
-
local msg="$1"
|
|
32
|
-
local ts
|
|
33
|
-
ts="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
34
|
-
echo "[INFO] $ts $msg" >> "$LOG_FILE" 2>/dev/null
|
|
35
|
-
if command -v babysitter &>/dev/null; then
|
|
36
|
-
babysitter log --type hook --label "hook:session-start" --message "$msg" --source shell-hook 2>/dev/null || true
|
|
37
|
-
fi
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
blog "Unified hook script invoked"
|
|
41
|
-
blog "PLUGIN_ROOT=$PLUGIN_ROOT"
|
|
42
|
-
blog "STATE_DIR=$STATE_DIR"
|
|
43
|
-
|
|
44
|
-
# Get required SDK version from versions.json (used for both SDK and hooks-proxy)
|
|
4
|
+
PLUGIN_ROOT="${PLUGIN_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}"
|
|
45
5
|
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")
|
|
46
|
-
|
|
47
|
-
# ---------------------------------------------------------------------------
|
|
48
|
-
# SDK install/upgrade
|
|
49
|
-
# ---------------------------------------------------------------------------
|
|
50
|
-
|
|
51
|
-
install_sdk() {
|
|
52
|
-
local target_version="$1"
|
|
53
|
-
if npm i -g "@a5c-ai/babysitter-sdk@${target_version}" --loglevel=error 2>/dev/null; then
|
|
54
|
-
blog "Installed SDK globally (${target_version})"
|
|
55
|
-
return 0
|
|
56
|
-
else
|
|
57
|
-
if npm i -g "@a5c-ai/babysitter-sdk@${target_version}" --prefix "$HOME/.local" --loglevel=error 2>/dev/null; then
|
|
58
|
-
export PATH="$HOME/.local/bin:$PATH"
|
|
59
|
-
blog "Installed SDK to user prefix (${target_version})"
|
|
60
|
-
return 0
|
|
61
|
-
fi
|
|
62
|
-
fi
|
|
63
|
-
return 1
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
NEEDS_SDK_INSTALL=false
|
|
67
|
-
if command -v babysitter &>/dev/null; then
|
|
68
|
-
CURRENT_VERSION=$(babysitter --version 2>/dev/null || echo "unknown")
|
|
69
|
-
if [ "$CURRENT_VERSION" != "$SDK_VERSION" ]; then
|
|
70
|
-
blog "SDK version mismatch: installed=${CURRENT_VERSION}, required=${SDK_VERSION}"
|
|
71
|
-
NEEDS_SDK_INSTALL=true
|
|
72
|
-
else
|
|
73
|
-
blog "SDK version OK: ${CURRENT_VERSION}"
|
|
74
|
-
fi
|
|
75
|
-
else
|
|
76
|
-
blog "SDK CLI not found, will install"
|
|
77
|
-
NEEDS_SDK_INSTALL=true
|
|
78
|
-
fi
|
|
79
|
-
|
|
80
|
-
if [ "$NEEDS_SDK_INSTALL" = true ] && [ ! -f "$SDK_MARKER_FILE" ]; then
|
|
81
|
-
install_sdk "$SDK_VERSION"
|
|
82
|
-
echo "$SDK_VERSION" > "$SDK_MARKER_FILE" 2>/dev/null
|
|
83
|
-
fi
|
|
84
|
-
|
|
85
6
|
if ! command -v babysitter &>/dev/null; then
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
fi
|
|
90
|
-
|
|
91
|
-
# ---------------------------------------------------------------------------
|
|
92
|
-
# Hooks-proxy install/upgrade (same pattern as SDK)
|
|
93
|
-
# ---------------------------------------------------------------------------
|
|
94
|
-
|
|
95
|
-
install_hooks_proxy() {
|
|
96
|
-
local target_version="$1"
|
|
97
|
-
if npm i -g "@a5c-ai/hooks-proxy-cli@${target_version}" --loglevel=error 2>/dev/null; then
|
|
98
|
-
blog "Installed hooks-proxy globally (${target_version})"
|
|
99
|
-
return 0
|
|
100
|
-
else
|
|
101
|
-
if npm i -g "@a5c-ai/hooks-proxy-cli@${target_version}" --prefix "$HOME/.local" --loglevel=error 2>/dev/null; then
|
|
102
|
-
export PATH="$HOME/.local/bin:$PATH"
|
|
103
|
-
blog "Installed hooks-proxy to user prefix (${target_version})"
|
|
104
|
-
return 0
|
|
105
|
-
fi
|
|
106
|
-
fi
|
|
107
|
-
return 1
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
NEEDS_PROXY_INSTALL=false
|
|
111
|
-
if command -v a5c-hooks-proxy &>/dev/null; then
|
|
112
|
-
PROXY_VERSION=$(a5c-hooks-proxy --version 2>/dev/null || echo "unknown")
|
|
113
|
-
if [ "$PROXY_VERSION" != "$SDK_VERSION" ]; then
|
|
114
|
-
blog "hooks-proxy version mismatch: installed=${PROXY_VERSION}, required=${SDK_VERSION}"
|
|
115
|
-
NEEDS_PROXY_INSTALL=true
|
|
116
|
-
else
|
|
117
|
-
blog "hooks-proxy version OK: ${PROXY_VERSION}"
|
|
118
|
-
fi
|
|
119
|
-
elif [ -f "$HOME/.local/bin/a5c-hooks-proxy" ]; then
|
|
120
|
-
export PATH="$HOME/.local/bin:$PATH"
|
|
121
|
-
PROXY_VERSION=$(a5c-hooks-proxy --version 2>/dev/null || echo "unknown")
|
|
122
|
-
if [ "$PROXY_VERSION" != "$SDK_VERSION" ]; then
|
|
123
|
-
blog "hooks-proxy version mismatch: installed=${PROXY_VERSION}, required=${SDK_VERSION}"
|
|
124
|
-
NEEDS_PROXY_INSTALL=true
|
|
125
|
-
else
|
|
126
|
-
blog "hooks-proxy version OK: ${PROXY_VERSION}"
|
|
127
|
-
fi
|
|
128
|
-
else
|
|
129
|
-
blog "hooks-proxy not found, will install"
|
|
130
|
-
NEEDS_PROXY_INSTALL=true
|
|
131
|
-
fi
|
|
132
|
-
|
|
133
|
-
if [ "$NEEDS_PROXY_INSTALL" = true ] && [ ! -f "$PROXY_MARKER_FILE" ]; then
|
|
134
|
-
install_hooks_proxy "$SDK_VERSION"
|
|
135
|
-
echo "$SDK_VERSION" > "$PROXY_MARKER_FILE" 2>/dev/null
|
|
136
|
-
fi
|
|
137
|
-
|
|
138
|
-
# Resolve hooks-proxy binary (npx fallback if still not found)
|
|
139
|
-
PROXY=""
|
|
140
|
-
if command -v a5c-hooks-proxy &>/dev/null; then
|
|
141
|
-
PROXY="a5c-hooks-proxy"
|
|
142
|
-
elif [ -f "$HOME/.local/bin/a5c-hooks-proxy" ]; then
|
|
143
|
-
PROXY="$HOME/.local/bin/a5c-hooks-proxy"
|
|
144
|
-
fi
|
|
145
|
-
|
|
146
|
-
if [ -z "$PROXY" ]; then
|
|
147
|
-
blog "hooks-proxy not found after install, using npx fallback"
|
|
148
|
-
PROXY="npx -y @a5c-ai/hooks-proxy-cli@${SDK_VERSION} "
|
|
7
|
+
npm i -g "@a5c-ai/babysitter-sdk@${SDK_VERSION}" --loglevel=error 2>/dev/null || \
|
|
8
|
+
npm i -g "@a5c-ai/babysitter-sdk@${SDK_VERSION}" --prefix "$HOME/.local" --loglevel=error 2>/dev/null || true
|
|
9
|
+
[ -d "$HOME/.local/bin" ] && export PATH="$HOME/.local/bin:$PATH"
|
|
149
10
|
fi
|
|
150
|
-
|
|
151
|
-
# ---------------------------------------------------------------------------
|
|
152
|
-
# Capture stdin and delegate to hooks-proxy
|
|
153
|
-
# ---------------------------------------------------------------------------
|
|
154
|
-
|
|
155
|
-
INPUT_FILE=$(mktemp 2>/dev/null || echo "/tmp/cursor-session-start-hook-$$.json")
|
|
156
|
-
cat > "$INPUT_FILE"
|
|
157
|
-
|
|
158
|
-
blog "Hook input received ($(wc -c < "$INPUT_FILE") bytes)"
|
|
159
|
-
|
|
160
|
-
STDERR_LOG="$LOG_DIR/babysitter-session-start-hook-stderr.log"
|
|
161
|
-
|
|
162
|
-
blog "Using hooks-proxy: $PROXY"
|
|
163
|
-
RESULT=$($PROXY invoke \
|
|
164
|
-
--adapter cursor \
|
|
165
|
-
--handler "babysitter hook:run --harness unified --hook-type session-start --plugin-root ${CURSOR_PLUGIN_ROOT} --state-dir ${BABYSITTER_STATE_DIR} --json" \
|
|
166
|
-
--json \
|
|
167
|
-
< "$INPUT_FILE" 2>"$STDERR_LOG")
|
|
168
|
-
EXIT_CODE=$?
|
|
169
|
-
|
|
170
|
-
blog "CLI exit code=$EXIT_CODE"
|
|
171
|
-
|
|
172
|
-
rm -f "$INPUT_FILE" 2>/dev/null
|
|
173
|
-
printf '%s\n' "$RESULT"
|
|
174
|
-
exit $EXIT_CODE
|
|
11
|
+
babysitter hook:run --harness unified --hook-type session-start --json
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# PowerShell hook wrapper — sets env vars and delegates to bash
|
|
2
|
+
$env:HOOK_TYPE = 'stop'
|
|
3
|
+
$env:ADAPTER_NAME = 'cursor'
|
|
4
|
+
$env:PLUGIN_ROOT = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
|
|
5
|
+
|
|
6
|
+
$input_data = [Console]::In.ReadToEnd()
|
|
7
|
+
$result = $input_data | & bash "$PSScriptRoot/../$($MyInvocation.MyCommand.Name -replace '\.ps1$','.sh')" 2>$null
|
|
8
|
+
if ($LASTEXITCODE -eq 0 -and $result) {
|
|
9
|
+
Write-Output $result
|
|
10
|
+
} else {
|
|
11
|
+
Write-Output '{}'
|
|
12
|
+
}
|
package/hooks/hooks-cursor.json
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"stop": [
|
|
13
13
|
{
|
|
14
14
|
"type": "command",
|
|
15
|
-
"bash": "bash \"./hooks/babysitter-proxied-stop
|
|
16
|
-
"powershell": "powershell -NoProfile -ExecutionPolicy Bypass -File \"./hooks/babysitter-proxied-stop
|
|
15
|
+
"bash": "bash \"./hooks/babysitter-proxied-stop.sh\"",
|
|
16
|
+
"powershell": "powershell -NoProfile -ExecutionPolicy Bypass -File \"./hooks/babysitter-proxied-stop.ps1\"",
|
|
17
17
|
"loop_limit": null
|
|
18
18
|
}
|
|
19
19
|
]
|
package/hooks.json
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"stop": [
|
|
13
13
|
{
|
|
14
14
|
"type": "command",
|
|
15
|
-
"bash": "bash \"./hooks/babysitter-proxied-stop
|
|
16
|
-
"powershell": "powershell -NoProfile -ExecutionPolicy Bypass -File \"./hooks/babysitter-proxied-stop
|
|
15
|
+
"bash": "bash \"./hooks/babysitter-proxied-stop.sh\"",
|
|
16
|
+
"powershell": "powershell -NoProfile -ExecutionPolicy Bypass -File \"./hooks/babysitter-proxied-stop.ps1\"",
|
|
17
17
|
"loop_limit": null
|
|
18
18
|
}
|
|
19
19
|
]
|
package/package.json
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a5c-ai/babysitter-cursor",
|
|
3
|
-
"version": "5.0.1-staging.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "5.0.1-staging.75c8fb21",
|
|
4
|
+
"description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"deploy": "npm publish --access public",
|
|
7
|
+
"deploy:staging": "npm publish --access public --tag staging",
|
|
8
8
|
"postinstall": "node bin/install.js",
|
|
9
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"
|
|
10
|
+
"team:install": "node scripts/team-install.js"
|
|
13
11
|
},
|
|
14
12
|
"bin": {
|
|
15
13
|
"babysitter-cursor": "bin/cli.js"
|
|
16
14
|
},
|
|
17
15
|
"files": [
|
|
18
|
-
".cursor-plugin/",
|
|
19
|
-
".cursorrules",
|
|
20
16
|
"bin/",
|
|
21
|
-
"commands/",
|
|
22
|
-
"hooks/",
|
|
23
17
|
"hooks.json",
|
|
24
|
-
"
|
|
25
|
-
"scripts/",
|
|
18
|
+
"hooks/",
|
|
26
19
|
"skills/",
|
|
27
|
-
"
|
|
20
|
+
"commands/",
|
|
21
|
+
"scripts/",
|
|
22
|
+
"plugin.json",
|
|
23
|
+
"README.md",
|
|
24
|
+
"versions.json",
|
|
25
|
+
"package.json"
|
|
28
26
|
],
|
|
29
27
|
"keywords": [
|
|
30
28
|
"babysitter",
|
|
31
29
|
"cursor",
|
|
32
|
-
"orchestration"
|
|
33
|
-
"ai-agent",
|
|
34
|
-
"sdk-integration"
|
|
30
|
+
"orchestration"
|
|
35
31
|
],
|
|
36
32
|
"author": "a5c.ai",
|
|
37
33
|
"license": "MIT",
|
|
38
34
|
"publishConfig": {
|
|
39
35
|
"access": "public"
|
|
40
36
|
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@a5c-ai/babysitter-sdk": "5.0.1-staging.75c8fb21"
|
|
39
|
+
},
|
|
41
40
|
"repository": {
|
|
42
41
|
"type": "git",
|
|
43
|
-
"url": "https://github.com/a5c-ai/babysitter"
|
|
42
|
+
"url": "git+https://github.com/a5c-ai/babysitter.git",
|
|
43
|
+
"directory": "plugins/babysitter-cursor"
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-cursor#readme",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/a5c-ai/babysitter/issues"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/plugin.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babysitter",
|
|
3
|
-
"version": "5.0.1-staging.
|
|
4
|
-
"description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval
|
|
3
|
+
"version": "5.0.1-staging.75c8fb21",
|
|
4
|
+
"description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval",
|
|
5
5
|
"author": "a5c.ai",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"hooks": "hooks
|
|
7
|
+
"hooks": "hooks.json",
|
|
8
8
|
"commands": "commands/",
|
|
9
9
|
"skills": "skills/",
|
|
10
10
|
"repository": {
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
"automation",
|
|
18
18
|
"event-sourced",
|
|
19
19
|
"hooks",
|
|
20
|
-
"
|
|
20
|
+
"TDD",
|
|
21
|
+
"quality-convergence",
|
|
21
22
|
"agent",
|
|
22
|
-
"LLM"
|
|
23
|
+
"LLM",
|
|
24
|
+
"cursor"
|
|
23
25
|
]
|
|
24
26
|
}
|
package/scripts/team-install.js
CHANGED
|
@@ -1,81 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
copyPluginBundle,
|
|
8
|
-
ensureGlobalProcessLibrary,
|
|
9
|
-
ensureMarketplaceEntry,
|
|
10
|
-
installCursorSurface,
|
|
11
|
-
warnWindowsHooks,
|
|
12
|
-
writeJson,
|
|
13
|
-
} = require('../bin/install-shared');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
var shared = require('../bin/install-shared');
|
|
14
6
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
for (let i = 2; i < argv.length; i += 1) {
|
|
21
|
-
if (argv[i] === '--workspace' && argv[i + 1]) {
|
|
22
|
-
args.workspace = path.resolve(argv[++i]);
|
|
23
|
-
} else if (argv[i] === '--dry-run') {
|
|
24
|
-
args.dryRun = true;
|
|
25
|
-
}
|
|
7
|
+
var workspace = process.cwd();
|
|
8
|
+
for (var i = 0; i < process.argv.length; i++) {
|
|
9
|
+
if (process.argv[i] === '--workspace' && process.argv[i + 1]) {
|
|
10
|
+
workspace = path.resolve(process.argv[i + 1]);
|
|
26
11
|
}
|
|
27
|
-
return args;
|
|
28
12
|
}
|
|
29
13
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const workspaceRoot = args.workspace;
|
|
34
|
-
const workspacePluginRoot = path.join(workspaceRoot, 'plugins', 'babysitter');
|
|
35
|
-
const workspaceMarketplacePath = path.join(workspaceRoot, '.agents', 'plugins', 'marketplace.json');
|
|
14
|
+
var src = process.env.PLUGIN_PACKAGE_ROOT || path.resolve(__dirname, '..');
|
|
15
|
+
var dest = shared.getHomePluginRoot('workspace');
|
|
16
|
+
console.log('[babysitter] Team install to ' + dest);
|
|
36
17
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
workspaceRoot,
|
|
41
|
-
pluginRoot: workspacePluginRoot,
|
|
42
|
-
marketplacePath: workspaceMarketplacePath,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
if (args.dryRun) {
|
|
46
|
-
console.log(JSON.stringify({
|
|
47
|
-
ok: true,
|
|
48
|
-
dryRun: true,
|
|
49
|
-
installInfo,
|
|
50
|
-
}, null, 2));
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
copyPluginBundle(packageRoot, workspacePluginRoot);
|
|
55
|
-
ensureMarketplaceEntry(workspaceMarketplacePath, workspacePluginRoot);
|
|
56
|
-
installCursorSurface(packageRoot, path.join(workspaceRoot, '.cursor'));
|
|
57
|
-
|
|
58
|
-
const active = ensureGlobalProcessLibrary(packageRoot);
|
|
59
|
-
installInfo.processLibraryStateFile = active.stateFile;
|
|
60
|
-
installInfo.processLibraryRoot = active.binding?.dir || '';
|
|
61
|
-
installInfo.processLibraryCloneDir = active.defaultSpec?.cloneDir || '';
|
|
62
|
-
|
|
63
|
-
const outDir = path.join(workspaceRoot, '.a5c', 'team');
|
|
64
|
-
fs.mkdirSync(outDir, { recursive: true });
|
|
65
|
-
writeJson(path.join(outDir, 'install.json'), installInfo);
|
|
66
|
-
|
|
67
|
-
const profilePath = path.join(outDir, 'profile.json');
|
|
68
|
-
if (!fs.existsSync(profilePath)) {
|
|
69
|
-
writeJson(profilePath, {
|
|
70
|
-
teamName: 'default',
|
|
71
|
-
pluginRoot: workspacePluginRoot,
|
|
72
|
-
marketplacePath: workspaceMarketplacePath,
|
|
73
|
-
processLibraryLookupCommand: 'babysitter process-library:active --json',
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
warnWindowsHooks();
|
|
78
|
-
console.log('[team-install] complete');
|
|
18
|
+
shared.copyPluginBundle(src, dest);
|
|
19
|
+
if (typeof shared.harnessTeamInstall === 'function') {
|
|
20
|
+
shared.harnessTeamInstall(src, dest, workspace);
|
|
79
21
|
}
|
|
80
|
-
|
|
81
|
-
|
|
22
|
+
shared.runPostInstall(dest);
|
|
23
|
+
console.log('[babysitter] Team install complete.');
|
|
@@ -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
|