-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
39 lines (33 loc) · 1.47 KB
/
Copy pathinstall.ps1
File metadata and controls
39 lines (33 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env pwsh
# Installs ai-codekeep into a project's .claude/ directory (or globally with -Global).
# Usage: ./install.ps1 [-Global] [-Hook]
param(
[switch]$Global,
[switch]$Hook
)
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
if ($Global) {
$Target = Join-Path $HOME ".claude"
} else {
$Target = Join-Path (Get-Location) ".claude"
}
New-Item -ItemType Directory -Force -Path "$Target\skills" | Out-Null
New-Item -ItemType Directory -Force -Path "$Target\commands" | Out-Null
New-Item -ItemType Directory -Force -Path "$Target\ai-codekeep\bin" | Out-Null
Copy-Item -Recurse -Force "$ScriptDir\skills\ai-codekeep" "$Target\skills\ai-codekeep"
Copy-Item -Force "$ScriptDir\commands\*.md" "$Target\commands\"
Copy-Item -Force "$ScriptDir\bin\ledger.mjs" "$Target\ai-codekeep\bin\ledger.mjs"
Write-Host "ai-codekeep installed into $Target"
Write-Host "run: node `"$Target\ai-codekeep\bin\ledger.mjs`" mode standard (from inside your project's git repo)"
if ($Hook) {
if (-not (Test-Path ".git")) {
Write-Warning "no .git directory here - skipping hook install (run -Hook from the repo you want tracked)"
exit 0
}
$HookPath = ".git\hooks\post-commit"
$LedgerPath = "$Target\ai-codekeep\bin\ledger.mjs"
$Content = "#!/usr/bin/env bash`nnode `"$LedgerPath`" update --commit HEAD >/dev/null 2>&1 || true`n"
Add-Content -Path $HookPath -Value $Content -NoNewline
Write-Host "post-commit hook installed at $HookPath"
}