@a5c-ai/babysitter-github 5.0.1-staging.22bf451f → 5.0.1-staging.25e625f3

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 (38) hide show
  1. package/bin/cli.js +8 -19
  2. package/bin/install-shared.js +344 -204
  3. package/bin/install.js +35 -91
  4. package/bin/uninstall.js +12 -63
  5. package/commands/doctor.md +5 -5
  6. package/commands/help.md +245 -244
  7. package/commands/observe.md +12 -12
  8. package/hooks/babysitter-proxied-session-end.ps1 +10 -114
  9. package/hooks/babysitter-proxied-session-end.sh +2 -111
  10. package/hooks/babysitter-proxied-session-start.ps1 +10 -187
  11. package/hooks/babysitter-proxied-session-start.sh +6 -168
  12. package/hooks/babysitter-proxied-user-prompt-submitted.ps1 +10 -90
  13. package/hooks/babysitter-proxied-user-prompt-submitted.sh +2 -86
  14. package/hooks/session-end.ps1 +11 -68
  15. package/hooks/session-end.sh +2 -53
  16. package/hooks/session-start.ps1 +10 -109
  17. package/hooks/session-start.sh +6 -96
  18. package/hooks/user-prompt-submitted.ps1 +11 -51
  19. package/hooks/user-prompt-submitted.sh +2 -30
  20. package/hooks.json +10 -10
  21. package/package.json +18 -20
  22. package/plugin.json +7 -6
  23. package/scripts/team-install.js +12 -85
  24. package/skills/cleanup/SKILL.md +21 -0
  25. package/skills/contrib/SKILL.md +34 -0
  26. package/skills/doctor/SKILL.md +5 -5
  27. package/skills/forever/SKILL.md +8 -0
  28. package/skills/help/SKILL.md +3 -2
  29. package/skills/observe/SKILL.md +1 -1
  30. package/skills/plugins/SKILL.md +257 -0
  31. package/skills/project-install/SKILL.md +18 -0
  32. package/skills/resume/SKILL.md +1 -1
  33. package/skills/retrospect/SKILL.md +48 -48
  34. package/skills/user-install/SKILL.md +3 -3
  35. package/skills/yolo/SKILL.md +8 -0
  36. package/versions.json +1 -1
  37. package/.github/plugin.json +0 -25
  38. package/hooks/proxied-hooks.json +0 -29
@@ -1,87 +1,3 @@
1
1
  #!/bin/bash
2
- # Unified userPromptSubmitted Hook for GitHub Copilot CLI
3
- # Routes through hooks-proxy for all hook execution.
4
- #
5
- # Applies density-filter compression to long user prompts.
6
- # Delegates to SDK CLI: babysitter hook:run --hook-type user-prompt-submitted
7
- #
8
- # NOTE: Output from this hook is IGNORED by Copilot CLI.
9
- # This hook is for logging and side-effects only.
10
-
11
- PLUGIN_ROOT="${COPILOT_PLUGIN_DIR:-$(cd "$(dirname "$0")/.." && pwd)}"
12
- PROXY_MARKER_FILE="${PLUGIN_ROOT}/.hooks-proxy-install-attempted"
13
-
14
- GLOBAL_ROOT="${BABYSITTER_GLOBAL_STATE_DIR:-$HOME/.a5c}"
15
- LOG_DIR="${BABYSITTER_LOG_DIR:-${GLOBAL_ROOT}/logs}"
16
- mkdir -p "$LOG_DIR" 2>/dev/null
17
-
18
- # Get required version from versions.json (used for hooks-proxy)
19
- 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")
20
-
21
- # ---------------------------------------------------------------------------
22
- # Hooks-proxy install (same pattern as SDK install in session-start)
23
- # ---------------------------------------------------------------------------
24
-
25
- install_hooks_proxy() {
26
- local target_version="$1"
27
- if npm i -g "@a5c-ai/hooks-proxy-cli@${target_version}" --loglevel=error 2>/dev/null; then
28
- return 0
29
- else
30
- if npm i -g "@a5c-ai/hooks-proxy-cli@${target_version}" --prefix "$HOME/.local" --loglevel=error 2>/dev/null; then
31
- export PATH="$HOME/.local/bin:$PATH"
32
- return 0
33
- fi
34
- fi
35
- return 1
36
- }
37
-
38
- # Resolve hooks-proxy binary
39
- PROXY=""
40
- if command -v a5c-hooks-proxy &>/dev/null; then
41
- PROXY="a5c-hooks-proxy"
42
- elif [ -f "$HOME/.local/bin/a5c-hooks-proxy" ]; then
43
- PROXY="$HOME/.local/bin/a5c-hooks-proxy"
44
- fi
45
-
46
- # Install if not found (only attempt once per plugin version)
47
- if [ -z "$PROXY" ] && [ ! -f "$PROXY_MARKER_FILE" ]; then
48
- install_hooks_proxy "$SDK_VERSION"
49
- echo "$SDK_VERSION" > "$PROXY_MARKER_FILE" 2>/dev/null
50
- if command -v a5c-hooks-proxy &>/dev/null; then
51
- PROXY="a5c-hooks-proxy"
52
- elif [ -f "$HOME/.local/bin/a5c-hooks-proxy" ]; then
53
- PROXY="$HOME/.local/bin/a5c-hooks-proxy"
54
- fi
55
- fi
56
-
57
- # npx fallback if still not found
58
- if [ -z "$PROXY" ]; then
59
- PROXY="npx -y @a5c-ai/hooks-proxy-cli@${SDK_VERSION} "
60
- fi
61
-
62
- # ---------------------------------------------------------------------------
63
- # Capture stdin and delegate to hooks-proxy
64
- # ---------------------------------------------------------------------------
65
-
66
- INPUT_FILE=$(mktemp 2>/dev/null || echo "/tmp/hook-user-prompt-submitted-$$.json")
67
- cat > "$INPUT_FILE"
68
-
69
- if command -v babysitter &>/dev/null; then
70
- babysitter log --type hook --label "hook:user-prompt-submitted" --message "Unified hook invoked" --source shell-hook 2>/dev/null || true
71
- fi
72
-
73
- STDERR_LOG="$LOG_DIR/babysitter-user-prompt-submitted-hook-stderr.log"
74
-
75
- $PROXY invoke \
76
- --adapter copilot \
77
- --handler "babysitter hook:run --harness unified --hook-type user-prompt-submitted --json" \
78
- --json \
79
- < "$INPUT_FILE" 2>"$STDERR_LOG" || true
80
-
81
- if command -v babysitter &>/dev/null; then
82
- babysitter log --type hook --label "hook:user-prompt-submitted" --message "Hook complete" --source shell-hook 2>/dev/null || true
83
- fi
84
-
85
- rm -f "$INPUT_FILE" 2>/dev/null
86
-
87
- exit 0
2
+ set -euo pipefail
3
+ babysitter hook:run --harness unified --hook-type user-prompt-submit --json
@@ -1,69 +1,12 @@
1
- # Babysitter Session End Hook for GitHub Copilot CLI (PowerShell)
2
- # Cleanup and logging on session exit.
3
- #
4
- # NOTE: Unlike Claude Code's Stop hook, sessionEnd output is IGNORED by
5
- # Copilot CLI. This hook cannot block session exit or drive an orchestration
6
- # loop. It is purely for cleanup and logging.
7
-
8
- $ErrorActionPreference = "Continue"
9
-
10
- $PluginRoot = if ($env:COPILOT_PLUGIN_DIR) { $env:COPILOT_PLUGIN_DIR } else { Split-Path -Parent $PSScriptRoot }
11
-
12
- # Resolve babysitter CLI
13
- $hasBabysitter = [bool](Get-Command babysitter -ErrorAction SilentlyContinue)
14
- $useFallback = $false
15
-
16
- if (-not $hasBabysitter) {
17
- $localBin = Join-Path $env:USERPROFILE ".local\bin\babysitter.cmd"
18
- if (Test-Path $localBin) {
19
- $env:PATH = "$(Split-Path $localBin);$env:PATH"
20
- $hasBabysitter = $true
21
- } else {
22
- $versionsFile = Join-Path $PluginRoot "versions.json"
23
- try {
24
- $SdkVersion = (Get-Content $versionsFile -Raw | ConvertFrom-Json).sdkVersion
25
- if (-not $SdkVersion) { $SdkVersion = "latest" }
26
- } catch {
27
- $SdkVersion = "latest"
28
- }
29
- $useFallback = $true
30
- }
31
- }
32
-
33
- $GlobalRoot = if ($env:BABYSITTER_GLOBAL_STATE_DIR) { $env:BABYSITTER_GLOBAL_STATE_DIR } else { Join-Path $HOME ".a5c" }
34
- $LogDir = if ($env:BABYSITTER_LOG_DIR) { $env:BABYSITTER_LOG_DIR } else { Join-Path $GlobalRoot "logs" }
35
- $LogFile = Join-Path $LogDir "babysitter-session-end-hook.log"
36
- New-Item -ItemType Directory -Path $LogDir -Force -ErrorAction SilentlyContinue | Out-Null
37
-
38
- function Write-Blog {
39
- param([string]$Message)
40
- $ts = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
41
- Add-Content -Path $LogFile -Value "[INFO] $ts $Message" -ErrorAction SilentlyContinue
42
- }
43
-
44
- Write-Blog "Hook script invoked"
45
- Write-Blog "PLUGIN_ROOT=$PluginRoot"
46
-
47
- # Capture stdin
48
- $InputFile = [System.IO.Path]::GetTempFileName()
49
- $input | Out-File -FilePath $InputFile -Encoding utf8
50
-
51
- Write-Blog "Hook input received"
52
-
53
- $stderrLog = Join-Path $LogDir "babysitter-session-end-hook-stderr.log"
54
-
55
- try {
56
- if ($useFallback) {
57
- Get-Content $InputFile | & npx -y "@a5c-ai/babysitter-sdk@$SdkVersion" hook:run --hook-type session-end --harness github-copilot --plugin-root $PluginRoot --json 2>$stderrLog | Out-Null
58
- } elseif ($hasBabysitter) {
59
- Get-Content $InputFile | & babysitter hook:run --hook-type session-end --harness github-copilot --plugin-root $PluginRoot --json 2>$stderrLog | Out-Null
60
- }
61
- } catch {
62
- Write-Blog "Hook error: $_"
1
+ # PowerShell hook wrapper sets env vars and delegates to bash
2
+ $env:HOOK_TYPE = 'session-end'
3
+ $env:ADAPTER_NAME = 'copilot'
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 '{}'
63
12
  }
64
-
65
- Write-Blog "Session end hook complete"
66
-
67
- Remove-Item $InputFile -Force -ErrorAction SilentlyContinue
68
-
69
- exit 0
@@ -1,54 +1,3 @@
1
1
  #!/bin/bash
2
- # Babysitter Session End Hook for GitHub Copilot CLI
3
- # Cleanup and logging on session exit.
4
- #
5
- # NOTE: Unlike Claude Code's Stop hook, sessionEnd output is IGNORED by
6
- # Copilot CLI. This hook cannot block session exit or drive an orchestration
7
- # loop. It is purely for cleanup and logging.
8
- #
9
- # Protocol:
10
- # Input: JSON via stdin (session context)
11
- # Output: IGNORED by Copilot CLI
12
- # Exit 0: success (exit code also ignored)
13
-
14
- set -uo pipefail
15
-
16
- PLUGIN_ROOT="${COPILOT_PLUGIN_DIR:-$(cd "$(dirname "$0")/.." && pwd)}"
17
-
18
- if ! command -v babysitter &>/dev/null; then
19
- # No CLI available — exit 0 (no-op, proceed with original command)
20
- exit 0
21
- fi
22
-
23
- GLOBAL_ROOT="${BABYSITTER_GLOBAL_STATE_DIR:-$HOME/.a5c}"
24
- LOG_DIR="${BABYSITTER_LOG_DIR:-${GLOBAL_ROOT}/logs}"
25
- LOG_FILE="$LOG_DIR/babysitter-session-end-hook.log"
26
-
27
- mkdir -p "$LOG_DIR" 2>/dev/null
28
-
29
- # Structured logging helper
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
- babysitter log --type hook --label "hook:session-end" --message "$msg" --source shell-hook 2>/dev/null || true
36
- }
37
-
38
- blog "Hook script invoked"
39
- blog "PLUGIN_ROOT=$PLUGIN_ROOT"
40
-
41
- # Capture stdin so we can log size and pass to CLI
42
- INPUT_FILE=$(mktemp 2>/dev/null || echo "/tmp/hook-session-end-$$.json")
43
- cat > "$INPUT_FILE"
44
-
45
- blog "Hook input received ($(wc -c < "$INPUT_FILE") bytes)"
46
-
47
- # Run cleanup/logging via CLI; output is ignored by Copilot CLI
48
- babysitter hook:run --hook-type session-end --harness github-copilot --plugin-root "$PLUGIN_ROOT" --json < "$INPUT_FILE" 2>"$LOG_DIR/babysitter-session-end-hook-stderr.log" || true
49
-
50
- blog "Session end hook complete"
51
-
52
- rm -f "$INPUT_FILE" 2>/dev/null
53
-
54
- exit 0
2
+ set -euo pipefail
3
+ babysitter hook:run --harness unified --hook-type session-end --json
@@ -1,111 +1,12 @@
1
- # Babysitter Session Start Hook for GitHub Copilot CLI (PowerShell)
2
- # Ensures the babysitter SDK CLI is installed (from versions.json sdkVersion),
3
- # then delegates to the TypeScript handler.
4
- #
5
- # Protocol:
6
- # Input: JSON via stdin (contains session_id, cwd, etc.)
7
- # Output: JSON via stdout ({} on success)
8
- # Stderr: debug/log output only
9
- # Exit 0: success
10
- # Exit 2: block (fatal error)
11
-
12
- $ErrorActionPreference = "Stop"
13
-
14
- $PluginRoot = if ($env:COPILOT_PLUGIN_DIR) { $env:COPILOT_PLUGIN_DIR } else { Split-Path -Parent $PSScriptRoot }
15
- $MarkerFile = Join-Path $PluginRoot ".babysitter-install-attempted"
16
-
17
- $GlobalRoot = if ($env:BABYSITTER_GLOBAL_STATE_DIR) { $env:BABYSITTER_GLOBAL_STATE_DIR } else { Join-Path $HOME ".a5c" }
18
- $LogDir = if ($env:BABYSITTER_LOG_DIR) { $env:BABYSITTER_LOG_DIR } else { Join-Path $GlobalRoot "logs" }
19
- $LogFile = Join-Path $LogDir "babysitter-session-start-hook.log"
20
- New-Item -ItemType Directory -Path $LogDir -Force -ErrorAction SilentlyContinue | Out-Null
21
-
22
- function Write-Blog {
23
- param([string]$Message)
24
- $ts = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
25
- Add-Content -Path $LogFile -Value "[INFO] $ts $Message" -ErrorAction SilentlyContinue
26
- if (Get-Command babysitter -ErrorAction SilentlyContinue) {
27
- & babysitter log --type hook --label "hook:session-start" --message $Message --source shell-hook 2>$null
28
- }
29
- }
30
-
31
- Write-Blog "Hook script invoked"
32
- Write-Blog "PLUGIN_ROOT=$PluginRoot"
33
-
34
- # Get required SDK version from versions.json
35
- $versionsFile = Join-Path $PluginRoot "versions.json"
36
- try {
37
- $SdkVersion = (Get-Content $versionsFile -Raw | ConvertFrom-Json).sdkVersion
38
- if (-not $SdkVersion) { $SdkVersion = "latest" }
39
- } catch {
40
- $SdkVersion = "latest"
41
- }
42
-
43
- function Install-Sdk {
44
- param([string]$TargetVersion)
45
- try {
46
- & npm i -g "@a5c-ai/babysitter-sdk@$TargetVersion" --loglevel=error 2>$null
47
- if ($LASTEXITCODE -eq 0) {
48
- Write-Blog "Installed SDK globally ($TargetVersion)"
49
- return $true
50
- }
51
- } catch {}
52
- try {
53
- $prefix = Join-Path $env:USERPROFILE ".local"
54
- & npm i -g "@a5c-ai/babysitter-sdk@$TargetVersion" --prefix $prefix --loglevel=error 2>$null
55
- if ($LASTEXITCODE -eq 0) {
56
- $env:PATH = "$prefix\bin;$env:PATH"
57
- Write-Blog "Installed SDK to user prefix ($TargetVersion)"
58
- return $true
59
- }
60
- } catch {}
61
- return $false
62
- }
63
-
64
- # Check if babysitter CLI exists and if version matches
65
- $NeedsInstall = $false
66
- if (Get-Command babysitter -ErrorAction SilentlyContinue) {
67
- $CurrentVersion = & babysitter --version 2>$null
68
- if ($CurrentVersion -ne $SdkVersion) {
69
- Write-Blog "SDK version mismatch: installed=$CurrentVersion, required=$SdkVersion"
70
- $NeedsInstall = $true
71
- } else {
72
- Write-Blog "SDK version OK: $CurrentVersion"
73
- }
1
+ # PowerShell hook wrapper sets env vars and delegates to bash
2
+ $env:HOOK_TYPE = 'session-start'
3
+ $env:ADAPTER_NAME = 'copilot'
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
74
10
  } else {
75
- Write-Blog "SDK CLI not found, will install"
76
- $NeedsInstall = $true
11
+ Write-Output '{}'
77
12
  }
78
-
79
- # Install/upgrade if needed (only attempt once per plugin version)
80
- if ($NeedsInstall -and -not (Test-Path $MarkerFile)) {
81
- Install-Sdk $SdkVersion | Out-Null
82
- Set-Content -Path $MarkerFile -Value $SdkVersion -ErrorAction SilentlyContinue
83
- }
84
-
85
- # If still not available after install attempt, try npx as last resort
86
- $useFallback = $false
87
- if (-not (Get-Command babysitter -ErrorAction SilentlyContinue)) {
88
- Write-Blog "CLI not found after install, using npx fallback"
89
- $useFallback = $true
90
- }
91
-
92
- # Capture stdin
93
- $InputFile = [System.IO.Path]::GetTempFileName()
94
- $input | Out-File -FilePath $InputFile -Encoding utf8
95
-
96
- Write-Blog "Hook input received"
97
-
98
- $stderrLog = Join-Path $LogDir "babysitter-session-start-hook-stderr.log"
99
-
100
- if ($useFallback) {
101
- $Result = Get-Content $InputFile | & npx -y "@a5c-ai/babysitter-sdk@$SdkVersion" hook:run --hook-type session-start --harness github-copilot --plugin-root $PluginRoot --json 2>$stderrLog
102
- } else {
103
- $Result = Get-Content $InputFile | & babysitter hook:run --hook-type session-start --harness github-copilot --plugin-root $PluginRoot --json 2>$stderrLog
104
- }
105
- $ExitCode = $LASTEXITCODE
106
-
107
- Write-Blog "CLI exit code=$ExitCode"
108
-
109
- Remove-Item $InputFile -Force -ErrorAction SilentlyContinue
110
- Write-Output $Result
111
- exit $ExitCode
@@ -1,101 +1,11 @@
1
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
-
2
+ # Session Start installs SDK if needed, then runs hook handler.
13
3
  set -euo pipefail
14
-
15
- PLUGIN_ROOT="${COPILOT_PLUGIN_DIR:-$(cd "$(dirname "$0")/.." && pwd)}"
16
- MARKER_FILE="${PLUGIN_ROOT}/.babysitter-install-attempted"
17
-
18
- GLOBAL_ROOT="${BABYSITTER_GLOBAL_STATE_DIR:-$HOME/.a5c}"
19
- LOG_DIR="${BABYSITTER_LOG_DIR:-${GLOBAL_ROOT}/logs}"
20
- LOG_FILE="$LOG_DIR/babysitter-session-start-hook.log"
21
- mkdir -p "$LOG_DIR" 2>/dev/null
22
-
23
- # Structured logging helper -- writes to both local and global log
24
- blog() {
25
- local msg="$1"
26
- local ts
27
- ts="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
28
- echo "[INFO] $ts $msg" >> "$LOG_FILE" 2>/dev/null
29
- # Use CLI structured logging when available; fall back to direct append
30
- if command -v babysitter &>/dev/null; then
31
- babysitter log --type hook --label "hook:session-start" --message "$msg" --source shell-hook 2>/dev/null || true
32
- fi
33
- }
34
-
35
- blog "Hook script invoked"
36
- blog "PLUGIN_ROOT=$PLUGIN_ROOT"
37
-
38
- # Get required SDK version from versions.json
4
+ PLUGIN_ROOT="${PLUGIN_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}"
39
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")
40
-
41
- # Function to install/upgrade SDK
42
- install_sdk() {
43
- local target_version="$1"
44
- # Try global install first, fall back to user-local if permissions fail
45
- if npm i -g "@a5c-ai/babysitter-sdk@${target_version}" --loglevel=error 2>/dev/null; then
46
- blog "Installed SDK globally (${target_version})"
47
- return 0
48
- else
49
- # Global install failed (permissions) -- try user-local prefix
50
- if npm i -g "@a5c-ai/babysitter-sdk@${target_version}" --prefix "$HOME/.local" --loglevel=error 2>/dev/null; then
51
- export PATH="$HOME/.local/bin:$PATH"
52
- blog "Installed SDK to user prefix (${target_version})"
53
- return 0
54
- fi
55
- fi
56
- return 1
57
- }
58
-
59
- # Check if babysitter CLI exists and if version matches
60
- NEEDS_INSTALL=false
61
- if command -v babysitter &>/dev/null; then
62
- CURRENT_VERSION=$(babysitter --version 2>/dev/null || echo "unknown")
63
- if [ "$CURRENT_VERSION" != "$SDK_VERSION" ]; then
64
- blog "SDK version mismatch: installed=${CURRENT_VERSION}, required=${SDK_VERSION}"
65
- NEEDS_INSTALL=true
66
- else
67
- blog "SDK version OK: ${CURRENT_VERSION}"
68
- fi
69
- else
70
- blog "SDK CLI not found, will install"
71
- NEEDS_INSTALL=true
72
- fi
73
-
74
- # Install/upgrade if needed (only attempt once per plugin version)
75
- if [ "$NEEDS_INSTALL" = true ] && [ ! -f "$MARKER_FILE" ]; then
76
- install_sdk "$SDK_VERSION"
77
- echo "$SDK_VERSION" > "$MARKER_FILE" 2>/dev/null
78
- fi
79
-
80
- # If still not available after install attempt, try npx as last resort
81
6
  if ! command -v babysitter &>/dev/null; then
82
- blog "CLI not found after install, using npx fallback"
83
- babysitter() { npx -y "@a5c-ai/babysitter-sdk@${SDK_VERSION}" "$@"; }
84
- export -f babysitter
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"
85
10
  fi
86
-
87
- # Capture stdin to a temp file so the CLI receives a clean EOF
88
- # (piping /dev/stdin directly can keep the Node.js event loop alive)
89
- INPUT_FILE=$(mktemp 2>/dev/null || echo "/tmp/hook-session-start-$$.json")
90
- cat > "$INPUT_FILE"
91
-
92
- blog "Hook input received ($(wc -c < "$INPUT_FILE") bytes)"
93
-
94
- 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")
95
- EXIT_CODE=$?
96
-
97
- blog "CLI exit code=$EXIT_CODE"
98
-
99
- rm -f "$INPUT_FILE" 2>/dev/null
100
- printf '%s\n' "$RESULT"
101
- exit $EXIT_CODE
11
+ babysitter hook:run --harness unified --hook-type session-start --json
@@ -1,52 +1,12 @@
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
- }
1
+ # PowerShell hook wrapper sets env vars and delegates to bash
2
+ $env:HOOK_TYPE = 'user-prompt-submit'
3
+ $env:ADAPTER_NAME = 'copilot'
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 '{}'
30
12
  }
31
-
32
- $GlobalRoot = if ($env:BABYSITTER_GLOBAL_STATE_DIR) { $env:BABYSITTER_GLOBAL_STATE_DIR } else { Join-Path $HOME ".a5c" }
33
- $LogDir = if ($env:BABYSITTER_LOG_DIR) { $env:BABYSITTER_LOG_DIR } else { Join-Path $GlobalRoot "logs" }
34
- New-Item -ItemType Directory -Path $LogDir -Force -ErrorAction SilentlyContinue | Out-Null
35
-
36
- # Capture stdin
37
- $InputFile = [System.IO.Path]::GetTempFileName()
38
- $input | Out-File -FilePath $InputFile -Encoding utf8
39
-
40
- $stderrLog = Join-Path $LogDir "babysitter-user-prompt-submitted-hook-stderr.log"
41
-
42
- try {
43
- if ($useFallback) {
44
- 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
45
- } elseif ($hasBabysitter) {
46
- Get-Content $InputFile | & babysitter hook:run --hook-type user-prompt-submitted --harness github-copilot --json 2>$stderrLog | Out-Null
47
- }
48
- } catch {}
49
-
50
- Remove-Item $InputFile -Force -ErrorAction SilentlyContinue
51
-
52
- exit 0
@@ -1,31 +1,3 @@
1
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
- if ! command -v babysitter &>/dev/null; then
12
- # No CLI available — exit 0 (no-op, proceed with original command)
13
- exit 0
14
- fi
15
-
16
- GLOBAL_ROOT="${BABYSITTER_GLOBAL_STATE_DIR:-$HOME/.a5c}"
17
- LOG_DIR="${BABYSITTER_LOG_DIR:-${GLOBAL_ROOT}/logs}"
18
- mkdir -p "$LOG_DIR" 2>/dev/null
19
-
20
- INPUT_FILE=$(mktemp 2>/dev/null || echo "/tmp/hook-user-prompt-submitted-$$.json")
21
- cat > "$INPUT_FILE"
22
-
23
- babysitter log --type hook --label "hook:user-prompt-submitted" --message "Hook invoked" --source shell-hook 2>/dev/null || true
24
-
25
- 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
26
-
27
- babysitter log --type hook --label "hook:user-prompt-submitted" --message "Hook complete" --source shell-hook 2>/dev/null || true
28
-
29
- rm -f "$INPUT_FILE" 2>/dev/null
30
-
31
- exit 0
2
+ set -euo pipefail
3
+ babysitter hook:run --harness unified --hook-type user-prompt-submit --json
package/hooks.json CHANGED
@@ -4,25 +4,25 @@
4
4
  "sessionStart": [
5
5
  {
6
6
  "type": "command",
7
- "bash": "bash \"./hooks/babysitter-proxied-session-start.sh\"",
8
- "powershell": "powershell -NoProfile -ExecutionPolicy Bypass -File \"./hooks/babysitter-proxied-session-start.ps1\"",
7
+ "bash": "./hooks/session-start.sh",
8
+ "powershell": "./hooks/session-start.ps1",
9
9
  "timeoutSec": 30
10
10
  }
11
11
  ],
12
- "sessionEnd": [
12
+ "userPromptSubmitted": [
13
13
  {
14
14
  "type": "command",
15
- "bash": "bash \"./hooks/babysitter-proxied-session-end.sh\"",
16
- "powershell": "powershell -NoProfile -ExecutionPolicy Bypass -File \"./hooks/babysitter-proxied-session-end.ps1\"",
17
- "timeoutSec": 30
15
+ "bash": "./hooks/user-prompt-submitted.sh",
16
+ "powershell": "./hooks/user-prompt-submitted.ps1",
17
+ "timeoutSec": 15
18
18
  }
19
19
  ],
20
- "userPromptSubmitted": [
20
+ "sessionEnd": [
21
21
  {
22
22
  "type": "command",
23
- "bash": "bash \"./hooks/babysitter-proxied-user-prompt-submitted.sh\"",
24
- "powershell": "powershell -NoProfile -ExecutionPolicy Bypass -File \"./hooks/babysitter-proxied-user-prompt-submitted.ps1\"",
25
- "timeoutSec": 15
23
+ "bash": "./hooks/session-end.sh",
24
+ "powershell": "./hooks/session-end.ps1",
25
+ "timeoutSec": 30
26
26
  }
27
27
  ]
28
28
  }
package/package.json CHANGED
@@ -1,50 +1,48 @@
1
1
  {
2
2
  "name": "@a5c-ai/babysitter-github",
3
- "version": "5.0.1-staging.22bf451f",
4
- "description": "Babysitter orchestration plugin for GitHub Copilot CLI with lifecycle hooks and SDK-managed process-library bootstrapping",
3
+ "version": "5.0.1-staging.25e625f3",
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
- "test": "node scripts/sync-command-surfaces.js --check && node test/cloud-agent-install.test.js",
7
- "sync:commands": "node scripts/sync-command-surfaces.js",
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
10
  "team:install": "node scripts/team-install.js",
11
- "deploy": "npm publish --access public",
12
- "deploy:staging": "npm publish --access public --tag staging"
11
+ "test": "node scripts/sync-command-surfaces.js --check",
12
+ "sync:commands": "node scripts/sync-command-surfaces.js"
13
13
  },
14
14
  "bin": {
15
- "babysitter-github": "bin/cli.js"
15
+ "babysitter-github-copilot": "bin/cli.js"
16
16
  },
17
17
  "files": [
18
- "plugin.json",
18
+ "bin/",
19
19
  "hooks.json",
20
20
  "hooks/",
21
21
  "skills/",
22
- "bin/",
22
+ "commands/",
23
23
  "scripts/",
24
- "versions.json",
24
+ "plugin.json",
25
25
  "AGENTS.md",
26
- "commands/",
27
- ".github/",
28
- "README.md"
26
+ "README.md",
27
+ "versions.json",
28
+ "package.json"
29
29
  ],
30
30
  "keywords": [
31
31
  "babysitter",
32
32
  "github-copilot",
33
- "orchestration",
34
- "ai-agent",
35
- "sdk-integration"
33
+ "orchestration"
36
34
  ],
37
35
  "author": "a5c.ai",
38
36
  "license": "MIT",
39
37
  "publishConfig": {
40
38
  "access": "public"
41
39
  },
40
+ "dependencies": {
41
+ "@a5c-ai/babysitter-sdk": "5.0.1-staging.25e625f3"
42
+ },
42
43
  "repository": {
43
44
  "type": "git",
44
45
  "url": "https://github.com/a5c-ai/babysitter"
45
46
  },
46
- "homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-github#readme",
47
- "dependencies": {
48
- "@a5c-ai/babysitter-sdk": "5.0.1-staging.22bf451f"
49
- }
47
+ "homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-github#readme"
50
48
  }