Repository navigation
Expand file tree
/
Copy pathinstall.ps1
More file actions
128 lines (109 loc) · 4.45 KB
/
Copy pathinstall.ps1
File metadata and controls
128 lines (109 loc) · 4.45 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#Requires -Version 5.1
<#
.SYNOPSIS
Install Claude-Backup on Windows.
.PARAMETER VaultPath
Path to the backup vault. Defaults to $HOME\Documents\ClaudeVault
.PARAMETER Uninstall
Remove the installed files (does not delete your vault data).
.PARAMETER Check
Verify whether Claude-Backup is installed.
.EXAMPLE
.\install.ps1
.\install.ps1 -VaultPath "C:\Users\you\Dropbox\ClaudeVault"
.\install.ps1 -Check
.\install.ps1 -Uninstall
#>
param(
[string]$VaultPath = "",
[switch]$Uninstall,
[switch]$Check
)
$ClaudeDir = Join-Path $env:USERPROFILE ".claude"
$SkillDir = Join-Path $ClaudeDir "vault-resume"
$ScheduledDir = Join-Path $env:USERPROFILE "Documents\Claude\Scheduled\session-backup"
$DefaultVault = Join-Path $env:USERPROFILE "Documents\ClaudeVault"
if ($VaultPath -eq "") {
$VaultPath = $DefaultVault
}
# --Check: verify existing installation
if ($Check) {
Write-Host "Checking Claude-Backup installation..."
$skillFile = Join-Path $SkillDir "SKILL.md"
$scheduledFile = Join-Path $ScheduledDir "SKILL.md"
if (Test-Path $skillFile) {
Write-Host " Resume skill: installed ($skillFile)"
} else {
Write-Host " Resume skill: NOT FOUND ($skillFile)"
}
if (Test-Path $scheduledFile) {
Write-Host " Scheduled backup: installed ($scheduledFile)"
} else {
Write-Host " Scheduled backup: NOT FOUND ($scheduledFile)"
}
exit 0
}
# --Uninstall: remove installed files
if ($Uninstall) {
Write-Host "Uninstalling Claude-Backup..."
if (Test-Path $SkillDir) { Remove-Item -Recurse -Force $SkillDir; Write-Host " Removed: $SkillDir" }
if (Test-Path $ScheduledDir) { Remove-Item -Recurse -Force $ScheduledDir; Write-Host " Removed: $ScheduledDir" }
Write-Host "Done. Your vault data at the backup destination was NOT removed."
exit 0
}
Write-Host "Installing Claude-Backup..."
Write-Host " Vault location: $VaultPath"
Write-Host ""
# Warn if reinstalling
$existingSkill = Join-Path $SkillDir "SKILL.md"
if (Test-Path $existingSkill) {
Write-Host " Existing installation found — updating..."
}
# Helper: substitute vault path placeholder and write file
function Install-SkillFile {
param([string]$SourcePath, [string]$DestPath)
$destDir = Split-Path $DestPath -Parent
New-Item -ItemType Directory -Force -Path $destDir | Out-Null
$content = Get-Content $SourcePath -Raw -Encoding UTF8
# Normalise to forward slashes for cross-platform consistency inside the skill
$vaultFwd = $VaultPath -replace '\\', '/'
$content = $content -replace [regex]::Escape("~/Documents/ClaudeVault/"), "$vaultFwd/"
Set-Content -Path $DestPath -Value $content -Encoding UTF8 -NoNewline
}
# Install the resume skill
Install-SkillFile -SourcePath "skill\SKILL.md" -DestPath (Join-Path $SkillDir "SKILL.md")
Write-Host " Resume skill installed to: $SkillDir"
# Install the scheduled backup task
Install-SkillFile -SourcePath "scheduled-task\SKILL.md" -DestPath (Join-Path $ScheduledDir "SKILL.md")
Write-Host " Scheduled task installed to: $ScheduledDir"
# Install .gitignore template to vault directory (only on first install)
$vaultGitignore = Join-Path $VaultPath ".gitignore"
if (-not (Test-Path $vaultGitignore)) {
New-Item -ItemType Directory -Force -Path $VaultPath | Out-Null
Copy-Item "vault-gitignore.template" $vaultGitignore
Write-Host " Security: .gitignore installed to $VaultPath"
}
# Verify both files were written
$skillFile = Join-Path $SkillDir "SKILL.md"
$scheduledFile = Join-Path $ScheduledDir "SKILL.md"
if (-not (Test-Path $skillFile)) {
Write-Error "Resume skill install failed — $skillFile not found"
exit 1
}
if (-not (Test-Path $scheduledFile)) {
Write-Error "Scheduled task install failed — $scheduledFile not found"
exit 1
}
Write-Host ""
Write-Host "Done! Next steps:"
Write-Host " 1. Open Claude Desktop (Cowork mode)"
Write-Host " 2. Go to Scheduled tasks in the sidebar"
Write-Host " 3. Click 'Run now' on 'session-backup' to do your first backup"
Write-Host " 4. The backup will run automatically every 6 hours after that"
Write-Host ""
Write-Host "To resume any project, say 'pick up where I left off' in any new session."
Write-Host ""
Write-Host "Other commands:"
Write-Host " .\install.ps1 -Check Verify installation"
Write-Host " .\install.ps1 -Uninstall Remove installed files"
Write-Host " .\install.ps1 -VaultPath C:\path Install with custom vault location"