mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
feat: Add version tracking and upgrade check system
- Add /version command to check installed and latest versions - Create version.json metadata file during installation - Pass version and branch info from install-remote.ps1 to Install-Claude.ps1 - Support version comparison and upgrade recommendations - Track installation mode (Global/Path) and source branch 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,11 @@ param(
|
||||
|
||||
[switch]$BackupAll,
|
||||
|
||||
[switch]$NoBackup
|
||||
[switch]$NoBackup,
|
||||
|
||||
[string]$SourceVersion = "",
|
||||
|
||||
[string]$SourceBranch = ""
|
||||
)
|
||||
|
||||
# Set encoding for proper Unicode support
|
||||
@@ -622,6 +626,37 @@ function Merge-DirectoryContents {
|
||||
return $true
|
||||
}
|
||||
|
||||
function Create-VersionJson {
|
||||
param(
|
||||
[string]$TargetClaudeDir,
|
||||
[string]$InstallationMode
|
||||
)
|
||||
|
||||
# Determine version from source or default
|
||||
$versionNumber = if ($SourceVersion) { $SourceVersion } else { $Version }
|
||||
$sourceBranch = if ($SourceBranch) { $SourceBranch } else { "unknown" }
|
||||
|
||||
# Create version.json content
|
||||
$versionInfo = @{
|
||||
version = $versionNumber
|
||||
installation_mode = $InstallationMode
|
||||
installation_path = $TargetClaudeDir
|
||||
installation_date_utc = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
|
||||
source_branch = $sourceBranch
|
||||
}
|
||||
|
||||
$versionJsonPath = Join-Path $TargetClaudeDir "version.json"
|
||||
|
||||
try {
|
||||
$versionInfo | ConvertTo-Json | Out-File -FilePath $versionJsonPath -Encoding utf8 -Force
|
||||
Write-ColorOutput "Created version.json: $versionNumber ($InstallationMode)" $ColorSuccess
|
||||
return $true
|
||||
} catch {
|
||||
Write-ColorOutput "WARNING: Failed to create version.json: $($_.Exception.Message)" $ColorWarning
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
function Install-Global {
|
||||
Write-ColorOutput "Installing Claude Code Workflow System globally..." $ColorInfo
|
||||
|
||||
@@ -682,6 +717,10 @@ function Install-Global {
|
||||
Write-ColorOutput "Merging .gemini directory contents..." $ColorInfo
|
||||
$geminiMerged = Merge-DirectoryContents -Source $sourceGeminiDir -Destination $globalGeminiDir -Description ".gemini directory contents" -BackupFolder $backupFolder
|
||||
|
||||
# Create version.json in global .claude directory
|
||||
Write-ColorOutput "Creating version.json..." $ColorInfo
|
||||
Create-VersionJson -TargetClaudeDir $globalClaudeDir -InstallationMode "Global"
|
||||
|
||||
if ($backupFolder -and (Test-Path $backupFolder)) {
|
||||
$backupFiles = Get-ChildItem $backupFolder -Recurse -File -ErrorAction SilentlyContinue
|
||||
if (-not $backupFiles -or ($backupFiles | Measure-Object).Count -eq 0) {
|
||||
@@ -819,6 +858,14 @@ function Install-Path {
|
||||
Write-ColorOutput "Merging .gemini directory contents to local location..." $ColorInfo
|
||||
$geminiMerged = Merge-DirectoryContents -Source $sourceGeminiDir -Destination $localGeminiDir -Description ".gemini directory contents" -BackupFolder $backupFolder
|
||||
|
||||
# Create version.json in local .claude directory
|
||||
Write-ColorOutput "Creating version.json in local directory..." $ColorInfo
|
||||
Create-VersionJson -TargetClaudeDir $localClaudeDir -InstallationMode "Path"
|
||||
|
||||
# Also create version.json in global .claude directory
|
||||
Write-ColorOutput "Creating version.json in global directory..." $ColorInfo
|
||||
Create-VersionJson -TargetClaudeDir $globalClaudeDir -InstallationMode "Global"
|
||||
|
||||
if ($backupFolder -and (Test-Path $backupFolder)) {
|
||||
$backupFiles = Get-ChildItem $backupFolder -Recurse -File -ErrorAction SilentlyContinue
|
||||
if (-not $backupFiles -or ($backupFiles | Measure-Object).Count -eq 0) {
|
||||
|
||||
Reference in New Issue
Block a user