@a5c-ai/babysitter-github 5.0.1-staging.f6432257 → 5.0.1-staging.ff2c19f9

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 +14 -26
  2. package/bin/install-shared.js +382 -210
  3. package/bin/install.js +41 -90
  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.json +10 -10
  15. package/package.json +18 -20
  16. package/plugin.json +7 -6
  17. package/scripts/team-install.js +14 -84
  18. package/skills/cleanup/SKILL.md +21 -0
  19. package/skills/contrib/SKILL.md +34 -0
  20. package/skills/doctor/SKILL.md +5 -5
  21. package/skills/forever/SKILL.md +8 -0
  22. package/skills/help/SKILL.md +3 -2
  23. package/skills/observe/SKILL.md +1 -1
  24. package/skills/plugins/SKILL.md +257 -0
  25. package/skills/project-install/SKILL.md +18 -0
  26. package/skills/resume/SKILL.md +1 -1
  27. package/skills/retrospect/SKILL.md +48 -48
  28. package/skills/user-install/SKILL.md +3 -3
  29. package/skills/yolo/SKILL.md +8 -0
  30. package/versions.json +1 -1
  31. package/.github/plugin.json +0 -25
  32. package/hooks/proxied-hooks.json +0 -29
  33. package/hooks/session-end.ps1 +0 -69
  34. package/hooks/session-end.sh +0 -54
  35. package/hooks/session-start.ps1 +0 -111
  36. package/hooks/session-start.sh +0 -101
  37. package/hooks/user-prompt-submitted.ps1 +0 -52
  38. package/hooks/user-prompt-submitted.sh +0 -31
@@ -1,111 +0,0 @@
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
- }
74
- } else {
75
- Write-Blog "SDK CLI not found, will install"
76
- $NeedsInstall = $true
77
- }
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 +0,0 @@
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
- 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
39
- 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
- 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
85
- 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
@@ -1,52 +0,0 @@
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
- $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 +0,0 @@
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