install.ps1 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. # Renamed skills: -patterns -> -ops (March 2026)
  39. $renamedSkills = @(
  40. "cli-patterns",
  41. "mcp-patterns",
  42. "python-async-patterns",
  43. "python-cli-patterns",
  44. "python-database-patterns",
  45. "python-fastapi-patterns",
  46. "python-observability-patterns",
  47. "python-pytest-patterns",
  48. "python-typing-patterns",
  49. "rest-patterns",
  50. "security-patterns",
  51. "sql-patterns",
  52. "tailwind-patterns",
  53. "testing-patterns"
  54. )
  55. foreach ($oldSkill in $renamedSkills) {
  56. $oldPath = "$claudeDir\skills\$oldSkill"
  57. if (Test-Path $oldPath) {
  58. Remove-Item -Path $oldPath -Recurse -Force
  59. $newName = $oldSkill -replace '-patterns$', '-ops'
  60. Write-Host " Removed renamed: $oldSkill (now $newName)" -ForegroundColor Red
  61. }
  62. }
  63. Write-Host "Cleaning up deprecated items..." -ForegroundColor Yellow
  64. foreach ($item in $deprecated) {
  65. if (Test-Path $item) {
  66. Remove-Item -Path $item -Recurse -Force
  67. Write-Host " Removed: $item" -ForegroundColor Red
  68. }
  69. }
  70. Write-Host ""
  71. # =============================================================================
  72. # COMMANDS - Only copy commands that have not been migrated to skills
  73. # =============================================================================
  74. Write-Host "Installing commands..." -ForegroundColor Cyan
  75. $skipCommands = @("review.md", "testgen.md")
  76. $commandsDir = Join-Path $projectRoot "commands"
  77. Get-ChildItem -Path $commandsDir -Filter "*.md" | ForEach-Object {
  78. if ($_.Name -notin $skipCommands -and $_.Name -notlike "archive*") {
  79. Copy-Item $_.FullName -Destination "$claudeDir\commands\" -Force
  80. Write-Host " $($_.Name)" -ForegroundColor Green
  81. }
  82. }
  83. Write-Host ""
  84. # =============================================================================
  85. # SKILLS - Copy all skill directories
  86. # =============================================================================
  87. Write-Host "Installing skills..." -ForegroundColor Cyan
  88. $skillsDir = Join-Path $projectRoot "skills"
  89. Get-ChildItem -Path $skillsDir -Directory | ForEach-Object {
  90. $dest = "$claudeDir\skills\$($_.Name)"
  91. if (Test-Path $dest) {
  92. Remove-Item -Path $dest -Recurse -Force
  93. }
  94. Copy-Item $_.FullName -Destination $dest -Recurse -Force
  95. Write-Host " $($_.Name)/" -ForegroundColor Green
  96. }
  97. Write-Host ""
  98. # =============================================================================
  99. # AGENTS - Copy all agent files
  100. # =============================================================================
  101. Write-Host "Installing agents..." -ForegroundColor Cyan
  102. $agentsDir = Join-Path $projectRoot "agents"
  103. Get-ChildItem -Path $agentsDir -Filter "*.md" | ForEach-Object {
  104. Copy-Item $_.FullName -Destination "$claudeDir\agents\" -Force
  105. Write-Host " $($_.Name)" -ForegroundColor Green
  106. }
  107. Write-Host ""
  108. # =============================================================================
  109. # RULES - Copy all rule files
  110. # =============================================================================
  111. Write-Host "Installing rules..." -ForegroundColor Cyan
  112. $rulesDir = Join-Path $projectRoot "rules"
  113. Get-ChildItem -Path $rulesDir -Filter "*.md" | ForEach-Object {
  114. Copy-Item $_.FullName -Destination "$claudeDir\rules\" -Force
  115. Write-Host " $($_.Name)" -ForegroundColor Green
  116. }
  117. Write-Host ""
  118. # =============================================================================
  119. # OUTPUT STYLES - Copy all output style files
  120. # =============================================================================
  121. Write-Host "Installing output styles..." -ForegroundColor Cyan
  122. $stylesDir = Join-Path $projectRoot "output-styles"
  123. if (Test-Path $stylesDir) {
  124. Get-ChildItem -Path $stylesDir -Filter "*.md" | ForEach-Object {
  125. Copy-Item $_.FullName -Destination "$claudeDir\output-styles\" -Force
  126. Write-Host " $($_.Name)" -ForegroundColor Green
  127. }
  128. }
  129. Write-Host ""
  130. # =============================================================================
  131. # SUMMARY
  132. # =============================================================================
  133. Write-Host "================================================================" -ForegroundColor Cyan
  134. Write-Host " Installation complete!" -ForegroundColor Green
  135. Write-Host "================================================================" -ForegroundColor Cyan
  136. Write-Host ""
  137. Write-Host "Restart Claude Code to load the new extensions." -ForegroundColor Yellow
  138. Write-Host ""