install.ps1 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <#
  2. .SYNOPSIS
  3. Install claude-mods extensions to ~/.claude/
  4. .DESCRIPTION
  5. Copies commands, skills, agents, and rules to the global Claude Code config.
  6. Handles cleanup of deprecated items and command-to-skill migrations.
  7. .NOTES
  8. Run from the claude-mods directory:
  9. .\scripts\install.ps1
  10. #>
  11. $ErrorActionPreference = "Stop"
  12. Write-Host "================================================================" -ForegroundColor Cyan
  13. Write-Host " claude-mods Installer (Windows) " -ForegroundColor Cyan
  14. Write-Host "================================================================" -ForegroundColor Cyan
  15. Write-Host ""
  16. $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
  17. $projectRoot = Split-Path -Parent $scriptDir
  18. $claudeDir = "$env:USERPROFILE\.claude"
  19. # Ensure ~/.claude directories exist
  20. $dirs = @("commands", "skills", "agents", "rules", "output-styles")
  21. foreach ($dir in $dirs) {
  22. $path = Join-Path $claudeDir $dir
  23. if (-not (Test-Path $path)) {
  24. New-Item -ItemType Directory -Path $path -Force | Out-Null
  25. Write-Host " Created $path" -ForegroundColor Green
  26. }
  27. }
  28. # =============================================================================
  29. # DEPRECATED ITEMS - Remove these from user config
  30. # =============================================================================
  31. $deprecated = @(
  32. "$claudeDir\commands\review.md",
  33. "$claudeDir\commands\testgen.md",
  34. "$claudeDir\commands\conclave.md",
  35. "$claudeDir\commands\pulse.md",
  36. "$claudeDir\skills\conclave"
  37. )
  38. Write-Host "Cleaning up deprecated items..." -ForegroundColor Yellow
  39. foreach ($item in $deprecated) {
  40. if (Test-Path $item) {
  41. Remove-Item -Path $item -Recurse -Force
  42. Write-Host " Removed: $item" -ForegroundColor Red
  43. }
  44. }
  45. Write-Host ""
  46. # =============================================================================
  47. # COMMANDS - Only copy commands that have not been migrated to skills
  48. # =============================================================================
  49. Write-Host "Installing commands..." -ForegroundColor Cyan
  50. $skipCommands = @("review.md", "testgen.md")
  51. $commandsDir = Join-Path $projectRoot "commands"
  52. Get-ChildItem -Path $commandsDir -Filter "*.md" | ForEach-Object {
  53. if ($_.Name -notin $skipCommands -and $_.Name -notlike "archive*") {
  54. Copy-Item $_.FullName -Destination "$claudeDir\commands\" -Force
  55. Write-Host " $($_.Name)" -ForegroundColor Green
  56. }
  57. }
  58. Write-Host ""
  59. # =============================================================================
  60. # SKILLS - Copy all skill directories
  61. # =============================================================================
  62. Write-Host "Installing skills..." -ForegroundColor Cyan
  63. $skillsDir = Join-Path $projectRoot "skills"
  64. Get-ChildItem -Path $skillsDir -Directory | ForEach-Object {
  65. $dest = "$claudeDir\skills\$($_.Name)"
  66. if (Test-Path $dest) {
  67. Remove-Item -Path $dest -Recurse -Force
  68. }
  69. Copy-Item $_.FullName -Destination $dest -Recurse -Force
  70. Write-Host " $($_.Name)/" -ForegroundColor Green
  71. }
  72. Write-Host ""
  73. # =============================================================================
  74. # AGENTS - Copy all agent files
  75. # =============================================================================
  76. Write-Host "Installing agents..." -ForegroundColor Cyan
  77. $agentsDir = Join-Path $projectRoot "agents"
  78. Get-ChildItem -Path $agentsDir -Filter "*.md" | ForEach-Object {
  79. Copy-Item $_.FullName -Destination "$claudeDir\agents\" -Force
  80. Write-Host " $($_.Name)" -ForegroundColor Green
  81. }
  82. Write-Host ""
  83. # =============================================================================
  84. # RULES - Copy all rule files
  85. # =============================================================================
  86. Write-Host "Installing rules..." -ForegroundColor Cyan
  87. $rulesDir = Join-Path $projectRoot "rules"
  88. Get-ChildItem -Path $rulesDir -Filter "*.md" | ForEach-Object {
  89. Copy-Item $_.FullName -Destination "$claudeDir\rules\" -Force
  90. Write-Host " $($_.Name)" -ForegroundColor Green
  91. }
  92. Write-Host ""
  93. # =============================================================================
  94. # OUTPUT STYLES - Copy all output style files
  95. # =============================================================================
  96. Write-Host "Installing output styles..." -ForegroundColor Cyan
  97. $stylesDir = Join-Path $projectRoot "output-styles"
  98. if (Test-Path $stylesDir) {
  99. Get-ChildItem -Path $stylesDir -Filter "*.md" | ForEach-Object {
  100. Copy-Item $_.FullName -Destination "$claudeDir\output-styles\" -Force
  101. Write-Host " $($_.Name)" -ForegroundColor Green
  102. }
  103. }
  104. Write-Host ""
  105. # =============================================================================
  106. # SUMMARY
  107. # =============================================================================
  108. Write-Host "================================================================" -ForegroundColor Cyan
  109. Write-Host " Installation complete!" -ForegroundColor Green
  110. Write-Host "================================================================" -ForegroundColor Cyan
  111. Write-Host ""
  112. Write-Host "Restart Claude Code to load the new extensions." -ForegroundColor Yellow
  113. Write-Host ""