jdi-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/AGENTS.md +209 -0
  2. package/ARCHITECTURE.md +210 -0
  3. package/COMMANDS.md +241 -0
  4. package/CREATE-EXAMPLE.md +385 -0
  5. package/CREATE.md +315 -0
  6. package/EXTENSION.md +141 -0
  7. package/LICENSE +21 -0
  8. package/MEMORY.md +471 -0
  9. package/PORTABILITY.md +438 -0
  10. package/README.md +789 -0
  11. package/bin/git-hooks/post-commit +16 -0
  12. package/bin/git-hooks/pre-commit +21 -0
  13. package/bin/jdi-build.ps1 +381 -0
  14. package/bin/jdi-build.sh +332 -0
  15. package/bin/jdi-doctor.ps1 +403 -0
  16. package/bin/jdi-doctor.sh +400 -0
  17. package/bin/jdi-install-caveman.ps1 +97 -0
  18. package/bin/jdi-install-caveman.sh +99 -0
  19. package/bin/jdi-install-playwright.ps1 +319 -0
  20. package/bin/jdi-install-playwright.sh +284 -0
  21. package/bin/jdi-install.ps1 +154 -0
  22. package/bin/jdi-install.sh +132 -0
  23. package/bin/jdi-uninstall.ps1 +309 -0
  24. package/bin/jdi-uninstall.sh +264 -0
  25. package/bin/jdi-update.ps1 +215 -0
  26. package/bin/jdi-update.sh +209 -0
  27. package/bin/jdi.js +460 -0
  28. package/bin/lib/jdi-monitor.ps1 +66 -0
  29. package/bin/lib/jdi-monitor.sh +74 -0
  30. package/bin/lib/jdi-truncate.ps1 +96 -0
  31. package/bin/lib/jdi-truncate.sh +99 -0
  32. package/bin/lib/ui.js +197 -0
  33. package/core/agents/jdi-adopter.md +465 -0
  34. package/core/agents/jdi-architect.md +894 -0
  35. package/core/agents/jdi-asker.md +153 -0
  36. package/core/agents/jdi-bootstrap.md +247 -0
  37. package/core/agents/jdi-planner.md +254 -0
  38. package/core/agents/jdi-researcher.md +303 -0
  39. package/core/commands/jdi-adopt.md +155 -0
  40. package/core/commands/jdi-bootstrap.md +81 -0
  41. package/core/commands/jdi-create.md +80 -0
  42. package/core/commands/jdi-discuss.md +80 -0
  43. package/core/commands/jdi-do.md +200 -0
  44. package/core/commands/jdi-loop.md +315 -0
  45. package/core/commands/jdi-new.md +131 -0
  46. package/core/commands/jdi-plan.md +73 -0
  47. package/core/commands/jdi-ship.md +146 -0
  48. package/core/commands/jdi-verify.md +159 -0
  49. package/core/skills/clean-code/SKILL.md +261 -0
  50. package/core/skills/dry/SKILL.md +150 -0
  51. package/core/skills/frontend-rules/SKILL.md +386 -0
  52. package/core/skills/frontend-validator/SKILL.md +567 -0
  53. package/core/skills/kiss/SKILL.md +178 -0
  54. package/core/skills/solid/SKILL.md +281 -0
  55. package/core/skills/yagni/SKILL.md +207 -0
  56. package/core/templates/agent.md +72 -0
  57. package/core/templates/doer-specialist.md +216 -0
  58. package/core/templates/reviewer-specialist.md +405 -0
  59. package/core/templates/skill.md +66 -0
  60. package/package.json +70 -0
  61. package/runtimes/antigravity/agents.md +74 -0
  62. package/runtimes/antigravity/skills/clean-code/SKILL.md +252 -0
  63. package/runtimes/antigravity/skills/dry/SKILL.md +141 -0
  64. package/runtimes/antigravity/skills/frontend-rules/SKILL.md +376 -0
  65. package/runtimes/antigravity/skills/frontend-validator/SKILL.md +559 -0
  66. package/runtimes/antigravity/skills/jdi-adopt/SKILL.md +155 -0
  67. package/runtimes/antigravity/skills/jdi-adopter/SKILL.md +436 -0
  68. package/runtimes/antigravity/skills/jdi-architect/SKILL.md +872 -0
  69. package/runtimes/antigravity/skills/jdi-asker/SKILL.md +125 -0
  70. package/runtimes/antigravity/skills/jdi-asker/references/context-template.md +34 -0
  71. package/runtimes/antigravity/skills/jdi-asker/references/decision-format.md +19 -0
  72. package/runtimes/antigravity/skills/jdi-asker/scripts/find_phase_dir.sh +25 -0
  73. package/runtimes/antigravity/skills/jdi-bootstrap/SKILL.md +81 -0
  74. package/runtimes/antigravity/skills/jdi-create/SKILL.md +80 -0
  75. package/runtimes/antigravity/skills/jdi-discuss/SKILL.md +80 -0
  76. package/runtimes/antigravity/skills/jdi-discuss/scripts/run_command.sh +62 -0
  77. package/runtimes/antigravity/skills/jdi-do/SKILL.md +200 -0
  78. package/runtimes/antigravity/skills/jdi-loop/SKILL.md +315 -0
  79. package/runtimes/antigravity/skills/jdi-new/SKILL.md +131 -0
  80. package/runtimes/antigravity/skills/jdi-plan/SKILL.md +73 -0
  81. package/runtimes/antigravity/skills/jdi-planner/SKILL.md +225 -0
  82. package/runtimes/antigravity/skills/jdi-researcher/SKILL.md +274 -0
  83. package/runtimes/antigravity/skills/jdi-ship/SKILL.md +146 -0
  84. package/runtimes/antigravity/skills/jdi-verify/SKILL.md +159 -0
  85. package/runtimes/antigravity/skills/kiss/SKILL.md +169 -0
  86. package/runtimes/antigravity/skills/solid/SKILL.md +272 -0
  87. package/runtimes/antigravity/skills/yagni/SKILL.md +198 -0
  88. package/runtimes/claude/CLAUDE.md +91 -0
  89. package/runtimes/claude/agents/jdi-adopter.md +430 -0
  90. package/runtimes/claude/agents/jdi-architect.md +864 -0
  91. package/runtimes/claude/agents/jdi-asker.md +119 -0
  92. package/runtimes/claude/agents/jdi-bootstrap.md +213 -0
  93. package/runtimes/claude/agents/jdi-planner.md +221 -0
  94. package/runtimes/claude/agents/jdi-researcher.md +269 -0
  95. package/runtimes/claude/commands/jdi-adopt.md +155 -0
  96. package/runtimes/claude/commands/jdi-bootstrap.md +81 -0
  97. package/runtimes/claude/commands/jdi-create.md +80 -0
  98. package/runtimes/claude/commands/jdi-discuss.md +80 -0
  99. package/runtimes/claude/commands/jdi-do.md +200 -0
  100. package/runtimes/claude/commands/jdi-loop.md +315 -0
  101. package/runtimes/claude/commands/jdi-new.md +131 -0
  102. package/runtimes/claude/commands/jdi-plan.md +73 -0
  103. package/runtimes/claude/commands/jdi-ship.md +146 -0
  104. package/runtimes/claude/commands/jdi-verify.md +159 -0
  105. package/runtimes/claude/settings.example.json +132 -0
  106. package/runtimes/claude/skills/clean-code/SKILL.md +247 -0
  107. package/runtimes/claude/skills/dry/SKILL.md +136 -0
  108. package/runtimes/claude/skills/frontend-rules/SKILL.md +369 -0
  109. package/runtimes/claude/skills/frontend-validator/SKILL.md +553 -0
  110. package/runtimes/claude/skills/kiss/SKILL.md +164 -0
  111. package/runtimes/claude/skills/solid/SKILL.md +267 -0
  112. package/runtimes/claude/skills/yagni/SKILL.md +193 -0
  113. package/runtimes/copilot/agents/jdi-adopter.agent.md +430 -0
  114. package/runtimes/copilot/agents/jdi-architect.agent.md +864 -0
  115. package/runtimes/copilot/agents/jdi-asker.agent.md +119 -0
  116. package/runtimes/copilot/agents/jdi-bootstrap.agent.md +213 -0
  117. package/runtimes/copilot/agents/jdi-planner.agent.md +221 -0
  118. package/runtimes/copilot/agents/jdi-researcher.agent.md +269 -0
  119. package/runtimes/copilot/copilot-instructions.md +80 -0
  120. package/runtimes/copilot/prompts/jdi-adopt.prompt.md +155 -0
  121. package/runtimes/copilot/prompts/jdi-bootstrap.prompt.md +81 -0
  122. package/runtimes/copilot/prompts/jdi-create.prompt.md +80 -0
  123. package/runtimes/copilot/prompts/jdi-discuss.prompt.md +80 -0
  124. package/runtimes/copilot/prompts/jdi-do.prompt.md +200 -0
  125. package/runtimes/copilot/prompts/jdi-loop.prompt.md +315 -0
  126. package/runtimes/copilot/prompts/jdi-new.prompt.md +131 -0
  127. package/runtimes/copilot/prompts/jdi-plan.prompt.md +73 -0
  128. package/runtimes/copilot/prompts/jdi-ship.prompt.md +146 -0
  129. package/runtimes/copilot/prompts/jdi-verify.prompt.md +159 -0
  130. package/runtimes/opencode/AGENTS.md +87 -0
  131. package/runtimes/opencode/agents/jdi-adopter.md +434 -0
  132. package/runtimes/opencode/agents/jdi-architect.md +861 -0
  133. package/runtimes/opencode/agents/jdi-asker.md +123 -0
  134. package/runtimes/opencode/agents/jdi-bootstrap.md +217 -0
  135. package/runtimes/opencode/agents/jdi-planner.md +225 -0
  136. package/runtimes/opencode/agents/jdi-researcher.md +273 -0
  137. package/runtimes/opencode/commands/jdi-adopt.md +155 -0
  138. package/runtimes/opencode/commands/jdi-bootstrap.md +81 -0
  139. package/runtimes/opencode/commands/jdi-create.md +80 -0
  140. package/runtimes/opencode/commands/jdi-discuss.md +80 -0
  141. package/runtimes/opencode/commands/jdi-do.md +200 -0
  142. package/runtimes/opencode/commands/jdi-loop.md +315 -0
  143. package/runtimes/opencode/commands/jdi-new.md +131 -0
  144. package/runtimes/opencode/commands/jdi-plan.md +73 -0
  145. package/runtimes/opencode/commands/jdi-ship.md +146 -0
  146. package/runtimes/opencode/commands/jdi-verify.md +159 -0
  147. package/runtimes/opencode/opencode.example.jsonc +169 -0
  148. package/runtimes/opencode/skills/clean-code/SKILL.md +247 -0
  149. package/runtimes/opencode/skills/dry/SKILL.md +136 -0
  150. package/runtimes/opencode/skills/frontend-rules/SKILL.md +369 -0
  151. package/runtimes/opencode/skills/frontend-validator/SKILL.md +553 -0
  152. package/runtimes/opencode/skills/kiss/SKILL.md +164 -0
  153. package/runtimes/opencode/skills/solid/SKILL.md +267 -0
  154. package/runtimes/opencode/skills/yagni/SKILL.md +193 -0
  155. package/templates-jdi-folder/config.json +18 -0
  156. package/templates-jdi-folder/registry.md +31 -0
  157. package/templates-jdi-folder/reviewers.md +33 -0
  158. package/templates-jdi-folder/skills-registry.md +32 -0
  159. package/templates-jdi-folder/specialists.md +39 -0
@@ -0,0 +1,154 @@
1
+ <#
2
+ .SYNOPSIS
3
+ jdi-install (Windows): copia runtimes/<runtime>/ pra destino do runtime.
4
+
5
+ .DESCRIPTION
6
+ Equivalente PowerShell de bin/jdi-install.sh. Funciona em Windows nativo.
7
+
8
+ .PARAMETER Runtime
9
+ claude | copilot | antigravity | opencode | all
10
+
11
+ .PARAMETER Scope
12
+ user | project (default: project)
13
+
14
+ .EXAMPLE
15
+ .\bin\jdi-install.ps1 -Runtime claude -Scope project
16
+ .\bin\jdi-install.ps1 -Runtime opencode -Scope user
17
+ .\bin\jdi-install.ps1 -Runtime all
18
+ #>
19
+ [CmdletBinding()]
20
+ param(
21
+ [Parameter(Mandatory=$true, Position=0)]
22
+ [ValidateSet('claude','copilot','antigravity','opencode','all')]
23
+ [string]$Runtime,
24
+
25
+ [ValidateSet('user','project')]
26
+ [string]$Scope = 'project'
27
+ )
28
+
29
+ $ErrorActionPreference = 'Stop'
30
+
31
+ $Root = Split-Path -Parent $PSScriptRoot
32
+ $ProjectDir = (Get-Location).Path
33
+ $UserHome = if ($env:HOME) { $env:HOME } else { $env:USERPROFILE }
34
+
35
+ function Copy-Tree {
36
+ param([string]$From, [string]$To)
37
+ if (-not (Test-Path $From)) { return }
38
+ New-Item -ItemType Directory -Force -Path $To | Out-Null
39
+ Copy-Item -Path (Join-Path $From '*') -Destination $To -Recurse -Force
40
+ }
41
+
42
+ function Install-Claude {
43
+ $dest = if ($Scope -eq 'user') { Join-Path $UserHome '.claude' } else { Join-Path $ProjectDir '.claude' }
44
+ New-Item -ItemType Directory -Force -Path "$dest\agents" | Out-Null
45
+ New-Item -ItemType Directory -Force -Path "$dest\commands" | Out-Null
46
+
47
+ Copy-Tree -From "$Root\runtimes\claude\agents" -To "$dest\agents"
48
+ Copy-Tree -From "$Root\runtimes\claude\commands" -To "$dest\commands"
49
+
50
+ if ($Scope -eq 'project') {
51
+ if (Test-Path "$Root\runtimes\claude\CLAUDE.md") {
52
+ Copy-Item -Path "$Root\runtimes\claude\CLAUDE.md" -Destination "$ProjectDir\CLAUDE.md" -Force
53
+ }
54
+ if (Test-Path "$Root\runtimes\claude\settings.example.json") {
55
+ $target = Join-Path $dest 'settings.example.json'
56
+ if (-not (Test-Path $target)) {
57
+ Copy-Item -Path "$Root\runtimes\claude\settings.example.json" -Destination $target
58
+ Write-Host " -> revise $target e renomeie para settings.json (ou .local.json)"
59
+ }
60
+ }
61
+ }
62
+ Write-Host "Claude Code instalado em: $dest (scope=$Scope)"
63
+ }
64
+
65
+ function Install-Copilot {
66
+ $dest = Join-Path $ProjectDir '.github'
67
+ New-Item -ItemType Directory -Force -Path "$dest\agents" | Out-Null
68
+ New-Item -ItemType Directory -Force -Path "$dest\prompts" | Out-Null
69
+
70
+ Copy-Tree -From "$Root\runtimes\copilot\agents" -To "$dest\agents"
71
+ Copy-Tree -From "$Root\runtimes\copilot\prompts" -To "$dest\prompts"
72
+
73
+ if (Test-Path "$Root\runtimes\copilot\copilot-instructions.md") {
74
+ Copy-Item -Path "$Root\runtimes\copilot\copilot-instructions.md" -Destination "$dest\copilot-instructions.md" -Force
75
+ }
76
+ Write-Host "Copilot instalado em: $dest"
77
+ Write-Host " -> Copilot e sempre project-scoped via .github/"
78
+ }
79
+
80
+ function Install-Antigravity {
81
+ $dest = if ($Scope -eq 'user') { Join-Path $UserHome '.gemini\antigravity' } else { Join-Path $ProjectDir '.gemini\antigravity' }
82
+ New-Item -ItemType Directory -Force -Path "$dest\skills" | Out-Null
83
+ Copy-Tree -From "$Root\runtimes\antigravity\skills" -To "$dest\skills"
84
+
85
+ if ($Scope -eq 'project' -and (Test-Path "$Root\runtimes\antigravity\agents.md")) {
86
+ Copy-Item -Path "$Root\runtimes\antigravity\agents.md" -Destination "$ProjectDir\agents.md" -Force
87
+ }
88
+ Write-Host "Antigravity instalado em: $dest (scope=$Scope)"
89
+ }
90
+
91
+ function Install-Opencode {
92
+ $dest = if ($Scope -eq 'user') { Join-Path $UserHome '.config\opencode' } else { Join-Path $ProjectDir '.opencode' }
93
+ New-Item -ItemType Directory -Force -Path "$dest\agents" | Out-Null
94
+ New-Item -ItemType Directory -Force -Path "$dest\commands" | Out-Null
95
+ New-Item -ItemType Directory -Force -Path "$dest\skills" | Out-Null
96
+
97
+ Copy-Tree -From "$Root\runtimes\opencode\agents" -To "$dest\agents"
98
+ Copy-Tree -From "$Root\runtimes\opencode\commands" -To "$dest\commands"
99
+ Copy-Tree -From "$Root\runtimes\opencode\skills" -To "$dest\skills"
100
+
101
+ if ($Scope -eq 'project') {
102
+ if (Test-Path "$Root\runtimes\opencode\AGENTS.md") {
103
+ Copy-Item -Path "$Root\runtimes\opencode\AGENTS.md" -Destination "$ProjectDir\AGENTS.md" -Force
104
+ }
105
+ $jsoncTarget = Join-Path $dest 'opencode.jsonc'
106
+ if (-not (Test-Path $jsoncTarget) -and (Test-Path "$Root\runtimes\opencode\opencode.example.jsonc")) {
107
+ Copy-Item -Path "$Root\runtimes\opencode\opencode.example.jsonc" -Destination $jsoncTarget
108
+ Write-Host " -> revise $jsoncTarget (gerado a partir do exemplo)"
109
+ }
110
+ }
111
+ Write-Host "OpenCode instalado em: $dest (scope=$Scope)"
112
+ }
113
+
114
+ function Install-GitHooks {
115
+ $hooksDir = Join-Path $ProjectDir '.githooks'
116
+ New-Item -ItemType Directory -Force -Path $hooksDir | Out-Null
117
+
118
+ foreach ($hook in @('pre-commit','post-commit')) {
119
+ $src = Join-Path "$Root\bin\git-hooks" $hook
120
+ if (Test-Path $src) {
121
+ Copy-Item -Path $src -Destination (Join-Path $hooksDir $hook) -Force
122
+ }
123
+ }
124
+
125
+ Write-Host ""
126
+ Write-Host "Git hooks copiados pra .githooks/. Para ativar:"
127
+ Write-Host " git config core.hooksPath .githooks"
128
+ Write-Host ""
129
+ Write-Host " Windows: hooks rodam via git-bash (vem com Git for Windows)."
130
+ Write-Host " Sem Git for Windows, hooks sao silenciosamente ignorados."
131
+ }
132
+
133
+ switch ($Runtime) {
134
+ 'claude' { Install-Claude }
135
+ 'copilot' { Install-Copilot }
136
+ 'antigravity' { Install-Antigravity }
137
+ 'opencode' { Install-Opencode }
138
+ 'all' {
139
+ Install-Claude
140
+ Install-Copilot
141
+ Install-Antigravity
142
+ Install-Opencode
143
+ }
144
+ }
145
+
146
+ Install-GitHooks
147
+
148
+ # Escreve .jdi/VERSION pra rastreio em updates futuros
149
+ if ($Scope -eq 'project' -or $Scope -eq 'user') {
150
+ if (Test-Path (Join-Path $ProjectDir '.jdi')) {
151
+ $pkgJson = Get-Content (Join-Path $Root 'package.json') -Raw | ConvertFrom-Json
152
+ Set-Content -Path (Join-Path $ProjectDir '.jdi/VERSION') -Value $pkgJson.version -Encoding UTF8 -NoNewline
153
+ }
154
+ }
@@ -0,0 +1,132 @@
1
+ #!/usr/bin/env bash
2
+ # jdi-install: copia runtimes/<runtime>/ pra destino do runtime.
3
+ # Uso: ./bin/jdi-install.sh <runtime> [--scope user|project]
4
+ # runtime: claude | copilot | antigravity | all
5
+ # scope: user (global) | project (default)
6
+
7
+ set -euo pipefail
8
+
9
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
10
+ RUNTIME="${1:?runtime obrigatorio: claude | copilot | antigravity | opencode | all}"
11
+ SCOPE_ARG="${2:---scope project}"
12
+
13
+ case "$SCOPE_ARG" in
14
+ --scope=user|--scope\ user) SCOPE=user ;;
15
+ --scope=project|--scope\ project) SCOPE=project ;;
16
+ *) SCOPE=project ;;
17
+ esac
18
+
19
+ [[ "$2" == "--scope" ]] && SCOPE="${3:-project}"
20
+
21
+ install_claude() {
22
+ local dest
23
+ if [[ "$SCOPE" == "user" ]]; then
24
+ dest="$HOME/.claude"
25
+ else
26
+ dest="$PWD/.claude"
27
+ fi
28
+ mkdir -p "$dest/agents" "$dest/commands"
29
+
30
+ cp -R "$ROOT/runtimes/claude/agents/." "$dest/agents/"
31
+ cp -R "$ROOT/runtimes/claude/commands/." "$dest/commands/"
32
+
33
+ if [[ "$SCOPE" == "project" ]]; then
34
+ cp "$ROOT/runtimes/claude/CLAUDE.md" "$PWD/CLAUDE.md"
35
+ if [[ -f "$ROOT/runtimes/claude/settings.example.json" ]]; then
36
+ mkdir -p "$dest"
37
+ cp -n "$ROOT/runtimes/claude/settings.example.json" "$dest/settings.example.json"
38
+ echo " -> revise $dest/settings.example.json e renomeie para settings.json (ou .local.json)"
39
+ fi
40
+ fi
41
+
42
+ echo "Claude Code instalado em: $dest (scope=$SCOPE)"
43
+ }
44
+
45
+ install_copilot() {
46
+ local dest="$PWD/.github"
47
+ mkdir -p "$dest/agents" "$dest/prompts"
48
+ cp -R "$ROOT/runtimes/copilot/agents/." "$dest/agents/"
49
+ cp -R "$ROOT/runtimes/copilot/prompts/." "$dest/prompts/"
50
+ cp "$ROOT/runtimes/copilot/copilot-instructions.md" "$dest/copilot-instructions.md"
51
+ echo "Copilot instalado em: $dest"
52
+ echo " -> Copilot e sempre project-scoped via .github/"
53
+ }
54
+
55
+ install_antigravity() {
56
+ local dest
57
+ if [[ "$SCOPE" == "user" ]]; then
58
+ dest="$HOME/.gemini/antigravity"
59
+ else
60
+ dest="$PWD/.gemini/antigravity"
61
+ fi
62
+ mkdir -p "$dest/skills"
63
+ cp -R "$ROOT/runtimes/antigravity/skills/." "$dest/skills/"
64
+
65
+ if [[ "$SCOPE" == "project" ]]; then
66
+ cp "$ROOT/runtimes/antigravity/agents.md" "$PWD/agents.md"
67
+ fi
68
+
69
+ echo "Antigravity instalado em: $dest (scope=$SCOPE)"
70
+ }
71
+
72
+ install_opencode() {
73
+ local dest
74
+ if [[ "$SCOPE" == "user" ]]; then
75
+ dest="$HOME/.config/opencode"
76
+ else
77
+ dest="$PWD/.opencode"
78
+ fi
79
+ mkdir -p "$dest/agents" "$dest/commands" "$dest/skills"
80
+
81
+ cp -R "$ROOT/runtimes/opencode/agents/." "$dest/agents/"
82
+ cp -R "$ROOT/runtimes/opencode/commands/." "$dest/commands/"
83
+
84
+ # Skills: OpenCode tambem le .claude/skills/. Se ja instalou Claude, reutiliza.
85
+ if [[ -d "$ROOT/runtimes/opencode/skills" ]]; then
86
+ cp -R "$ROOT/runtimes/opencode/skills/." "$dest/skills/" 2>/dev/null || true
87
+ fi
88
+
89
+ if [[ "$SCOPE" == "project" ]]; then
90
+ cp "$ROOT/runtimes/opencode/AGENTS.md" "$PWD/AGENTS.md"
91
+ if [[ ! -f "$dest/opencode.jsonc" ]]; then
92
+ cp "$ROOT/runtimes/opencode/opencode.example.jsonc" "$dest/opencode.jsonc"
93
+ echo " -> revise $dest/opencode.jsonc (gerado a partir do exemplo)"
94
+ fi
95
+ fi
96
+
97
+ echo "OpenCode instalado em: $dest (scope=$SCOPE)"
98
+ }
99
+
100
+ install_githooks() {
101
+ local hooks_dir="$PWD/.githooks"
102
+ mkdir -p "$hooks_dir"
103
+ if [[ -f "$ROOT/bin/git-hooks/pre-commit" ]]; then
104
+ cp "$ROOT/bin/git-hooks/pre-commit" "$hooks_dir/pre-commit"
105
+ chmod +x "$hooks_dir/pre-commit"
106
+ fi
107
+ if [[ -f "$ROOT/bin/git-hooks/post-commit" ]]; then
108
+ cp "$ROOT/bin/git-hooks/post-commit" "$hooks_dir/post-commit"
109
+ chmod +x "$hooks_dir/post-commit"
110
+ fi
111
+
112
+ echo
113
+ echo "Git hooks copiados pra .githooks/. Para ativar:"
114
+ echo " git config core.hooksPath .githooks"
115
+ }
116
+
117
+ case "$RUNTIME" in
118
+ claude) install_claude ;;
119
+ copilot) install_copilot ;;
120
+ antigravity) install_antigravity ;;
121
+ opencode) install_opencode ;;
122
+ all) install_claude && install_copilot && install_antigravity && install_opencode ;;
123
+ *) echo "runtime invalido: $RUNTIME"; exit 1 ;;
124
+ esac
125
+
126
+ install_githooks
127
+
128
+ # Escreve .jdi/VERSION pra rastreio em updates futuros
129
+ if [[ -d "$PWD/.jdi" ]]; then
130
+ pkg_version=$(grep -oE '"version":\s*"[^"]+"' "$ROOT/package.json" | head -1 | sed 's/.*"\([^"]*\)"/\1/')
131
+ printf '%s' "$pkg_version" > "$PWD/.jdi/VERSION"
132
+ fi
@@ -0,0 +1,309 @@
1
+ <#
2
+ .SYNOPSIS
3
+ jdi-uninstall (Windows): remove JDI do projeto.
4
+
5
+ .DESCRIPTION
6
+ Remove arquivos JDI dos runtimes detectados. Por seguranca:
7
+ - Default: NAO remove .jdi/ (state files com decisoes locked, roadmap, etc)
8
+ - Default: NAO remove .githooks/ (user pode ter customizado)
9
+ - --purge: remove TUDO incluindo .jdi/
10
+ - --runtime <name>: so desinstala 1 runtime especifico
11
+
12
+ SEMPRE pede confirmacao antes de remover. Use --yes pra skip prompts.
13
+
14
+ .PARAMETER Runtime
15
+ Especifico: claude | copilot | antigravity | opencode | all (default: all detectados)
16
+
17
+ .PARAMETER Scope
18
+ user | project (default: detect)
19
+
20
+ .PARAMETER Purge
21
+ Remove tambem .jdi/ (state files - DESTRUTIVO).
22
+
23
+ .PARAMETER Yes
24
+ Pula confirmacoes interativas.
25
+
26
+ .PARAMETER DryRun
27
+ Mostra o que seria removido, sem aplicar.
28
+
29
+ .EXAMPLE
30
+ .\bin\jdi-uninstall.ps1
31
+ .\bin\jdi-uninstall.ps1 -Runtime claude
32
+ .\bin\jdi-uninstall.ps1 -Purge -Yes
33
+ .\bin\jdi-uninstall.ps1 -DryRun
34
+ #>
35
+ [CmdletBinding()]
36
+ param(
37
+ [ValidateSet('claude','copilot','antigravity','opencode','all')]
38
+ [string]$Runtime = 'all',
39
+
40
+ [ValidateSet('user','project','both')]
41
+ [string]$Scope = 'both',
42
+
43
+ [switch]$Purge,
44
+ [switch]$Yes,
45
+ [switch]$DryRun
46
+ )
47
+
48
+ $ErrorActionPreference = 'Stop'
49
+
50
+ $ProjectDir = (Get-Location).Path
51
+ $UserHome = if ($env:HOME) { $env:HOME } else { $env:USERPROFILE }
52
+
53
+ function Confirm-Action {
54
+ param([string]$Message)
55
+ if ($Yes) { return $true }
56
+ if ($DryRun) { return $true }
57
+ $resp = Read-Host "$Message (y/N)"
58
+ return ($resp -match '^[YySs]')
59
+ }
60
+
61
+ function Remove-Item-Safe {
62
+ param([string]$Path, [string]$Label)
63
+ if (-not (Test-Path $Path)) { return }
64
+
65
+ if ($DryRun) {
66
+ Write-Host " [dry-run] removeria: $Path" -ForegroundColor DarkGray
67
+ return
68
+ }
69
+
70
+ Remove-Item -Path $Path -Recurse -Force -ErrorAction SilentlyContinue
71
+ Write-Host " removido: $Label" -ForegroundColor Green
72
+ }
73
+
74
+ function Uninstall-Claude {
75
+ param([string]$ScopeChoice)
76
+ $targets = @()
77
+ if ($ScopeChoice -in @('project','both')) {
78
+ $targets += @{ Dir = (Join-Path $ProjectDir '.claude'); Scope = 'project' }
79
+ }
80
+ if ($ScopeChoice -in @('user','both')) {
81
+ $targets += @{ Dir = (Join-Path $UserHome '.claude'); Scope = 'user' }
82
+ }
83
+
84
+ foreach ($t in $targets) {
85
+ if (-not (Test-Path $t.Dir)) { continue }
86
+ Write-Host ""
87
+ Write-Host "Claude ($($t.Scope) scope) em: $($t.Dir)" -ForegroundColor Cyan
88
+
89
+ # Remove agents jdi-*
90
+ $agentsDir = Join-Path $t.Dir 'agents'
91
+ if (Test-Path $agentsDir) {
92
+ Get-ChildItem $agentsDir -Filter 'jdi-*.md' -ErrorAction SilentlyContinue | ForEach-Object {
93
+ Remove-Item-Safe $_.FullName "agents/$($_.Name)"
94
+ }
95
+ }
96
+
97
+ # Remove commands jdi-*
98
+ $cmdDir = Join-Path $t.Dir 'commands'
99
+ if (Test-Path $cmdDir) {
100
+ Get-ChildItem $cmdDir -Filter 'jdi-*.md' -ErrorAction SilentlyContinue | ForEach-Object {
101
+ Remove-Item-Safe $_.FullName "commands/$($_.Name)"
102
+ }
103
+ }
104
+
105
+ # Remove skills shipped
106
+ $skillsDir = Join-Path $t.Dir 'skills'
107
+ if (Test-Path $skillsDir) {
108
+ foreach ($skillName in @('frontend-rules','frontend-validator','dry','kiss','yagni','solid','clean-code')) {
109
+ $sd = Join-Path $skillsDir $skillName
110
+ Remove-Item-Safe $sd "skills/$skillName/"
111
+ }
112
+ }
113
+
114
+ # CLAUDE.md (project scope only) - so se identico ao shipped
115
+ if ($t.Scope -eq 'project') {
116
+ $cmd = Join-Path $ProjectDir 'CLAUDE.md'
117
+ if (Test-Path $cmd) {
118
+ if (Confirm-Action "Remover CLAUDE.md? (pode ter sido editado)") {
119
+ Remove-Item-Safe $cmd "CLAUDE.md"
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+
126
+ function Uninstall-Copilot {
127
+ $dest = Join-Path $ProjectDir '.github'
128
+ if (-not (Test-Path $dest)) { return }
129
+
130
+ Write-Host ""
131
+ Write-Host "Copilot (project scope) em: $dest" -ForegroundColor Cyan
132
+
133
+ $agentsDir = Join-Path $dest 'agents'
134
+ if (Test-Path $agentsDir) {
135
+ Get-ChildItem $agentsDir -Filter 'jdi-*.agent.md' -ErrorAction SilentlyContinue | ForEach-Object {
136
+ Remove-Item-Safe $_.FullName "agents/$($_.Name)"
137
+ }
138
+ }
139
+
140
+ $promptsDir = Join-Path $dest 'prompts'
141
+ if (Test-Path $promptsDir) {
142
+ Get-ChildItem $promptsDir -Filter 'jdi-*.prompt.md' -ErrorAction SilentlyContinue | ForEach-Object {
143
+ Remove-Item-Safe $_.FullName "prompts/$($_.Name)"
144
+ }
145
+ }
146
+
147
+ $instr = Join-Path $dest 'copilot-instructions.md'
148
+ if (Test-Path $instr) {
149
+ if (Confirm-Action "Remover .github/copilot-instructions.md? (pode ter sido editado)") {
150
+ Remove-Item-Safe $instr ".github/copilot-instructions.md"
151
+ }
152
+ }
153
+ }
154
+
155
+ function Uninstall-Antigravity {
156
+ param([string]$ScopeChoice)
157
+ $targets = @()
158
+ if ($ScopeChoice -in @('project','both')) {
159
+ $targets += @{ Dir = (Join-Path $ProjectDir '.gemini/antigravity'); Scope = 'project' }
160
+ }
161
+ if ($ScopeChoice -in @('user','both')) {
162
+ $targets += @{ Dir = (Join-Path $UserHome '.gemini/antigravity'); Scope = 'user' }
163
+ }
164
+
165
+ foreach ($t in $targets) {
166
+ if (-not (Test-Path $t.Dir)) { continue }
167
+ Write-Host ""
168
+ Write-Host "Antigravity ($($t.Scope) scope) em: $($t.Dir)" -ForegroundColor Cyan
169
+
170
+ $skillsDir = Join-Path $t.Dir 'skills'
171
+ if (Test-Path $skillsDir) {
172
+ # Remove skills jdi-* (1 dir cada)
173
+ Get-ChildItem $skillsDir -Directory -Filter 'jdi-*' -ErrorAction SilentlyContinue | ForEach-Object {
174
+ Remove-Item-Safe $_.FullName "skills/$($_.Name)/"
175
+ }
176
+ # Remove skills universais
177
+ foreach ($skillName in @('frontend-rules','frontend-validator','dry','kiss','yagni','solid','clean-code')) {
178
+ $sd = Join-Path $skillsDir $skillName
179
+ Remove-Item-Safe $sd "skills/$skillName/"
180
+ }
181
+ }
182
+
183
+ if ($t.Scope -eq 'project') {
184
+ $agm = Join-Path $ProjectDir 'agents.md'
185
+ if (Test-Path $agm) {
186
+ if (Confirm-Action "Remover agents.md (Antigravity)? (pode ter sido editado)") {
187
+ Remove-Item-Safe $agm "agents.md"
188
+ }
189
+ }
190
+ }
191
+ }
192
+ }
193
+
194
+ function Uninstall-Opencode {
195
+ param([string]$ScopeChoice)
196
+ $targets = @()
197
+ if ($ScopeChoice -in @('project','both')) {
198
+ $targets += @{ Dir = (Join-Path $ProjectDir '.opencode'); Scope = 'project' }
199
+ }
200
+ if ($ScopeChoice -in @('user','both')) {
201
+ $targets += @{ Dir = (Join-Path $UserHome '.config/opencode'); Scope = 'user' }
202
+ }
203
+
204
+ foreach ($t in $targets) {
205
+ if (-not (Test-Path $t.Dir)) { continue }
206
+ Write-Host ""
207
+ Write-Host "OpenCode ($($t.Scope) scope) em: $($t.Dir)" -ForegroundColor Cyan
208
+
209
+ $agentsDir = Join-Path $t.Dir 'agents'
210
+ if (Test-Path $agentsDir) {
211
+ Get-ChildItem $agentsDir -Filter 'jdi-*.md' -ErrorAction SilentlyContinue | ForEach-Object {
212
+ Remove-Item-Safe $_.FullName "agents/$($_.Name)"
213
+ }
214
+ }
215
+
216
+ $cmdDir = Join-Path $t.Dir 'commands'
217
+ if (Test-Path $cmdDir) {
218
+ Get-ChildItem $cmdDir -Filter 'jdi-*.md' -ErrorAction SilentlyContinue | ForEach-Object {
219
+ Remove-Item-Safe $_.FullName "commands/$($_.Name)"
220
+ }
221
+ }
222
+
223
+ $skillsDir = Join-Path $t.Dir 'skills'
224
+ if (Test-Path $skillsDir) {
225
+ foreach ($skillName in @('frontend-rules','frontend-validator','dry','kiss','yagni','solid','clean-code')) {
226
+ $sd = Join-Path $skillsDir $skillName
227
+ Remove-Item-Safe $sd "skills/$skillName/"
228
+ }
229
+ }
230
+
231
+ if ($t.Scope -eq 'project') {
232
+ $agm = Join-Path $ProjectDir 'AGENTS.md'
233
+ if (Test-Path $agm) {
234
+ if (Confirm-Action "Remover AGENTS.md (OpenCode)? (pode ter sido editado)") {
235
+ Remove-Item-Safe $agm "AGENTS.md"
236
+ }
237
+ }
238
+ $jsonc = Join-Path $t.Dir 'opencode.jsonc'
239
+ if (Test-Path $jsonc) {
240
+ if (Confirm-Action "Remover .opencode/opencode.jsonc? (pode ter config customizada)") {
241
+ Remove-Item-Safe $jsonc ".opencode/opencode.jsonc"
242
+ }
243
+ }
244
+ }
245
+ }
246
+ }
247
+
248
+ # =========================================================
249
+ # Main
250
+ # =========================================================
251
+
252
+ Write-Host ""
253
+ Write-Host "JDI Uninstall" -ForegroundColor Cyan
254
+ Write-Host " Dir: $ProjectDir"
255
+ Write-Host " Runtime: $Runtime"
256
+ Write-Host " Scope: $Scope"
257
+ if ($Purge) { Write-Host " Purge: YES (vai remover .jdi/ tambem)" -ForegroundColor Yellow }
258
+ if ($DryRun) { Write-Host " Mode: DRY-RUN (sem mudancas)" -ForegroundColor Yellow }
259
+ Write-Host ""
260
+
261
+ if (-not $Yes -and -not $DryRun) {
262
+ if (-not (Confirm-Action "Continuar com uninstall? (acao destrutiva)")) {
263
+ Write-Host "Cancelado."
264
+ exit 0
265
+ }
266
+ }
267
+
268
+ $runtimes = if ($Runtime -eq 'all') { @('claude','copilot','antigravity','opencode') } else { @($Runtime) }
269
+
270
+ foreach ($r in $runtimes) {
271
+ switch ($r) {
272
+ 'claude' { Uninstall-Claude -ScopeChoice $Scope }
273
+ 'copilot' { Uninstall-Copilot }
274
+ 'antigravity' { Uninstall-Antigravity -ScopeChoice $Scope }
275
+ 'opencode' { Uninstall-Opencode -ScopeChoice $Scope }
276
+ }
277
+ }
278
+
279
+ # Purge .jdi/ (state) - so com flag explicito
280
+ if ($Purge) {
281
+ Write-Host ""
282
+ $jdiDir = Join-Path $ProjectDir '.jdi'
283
+ if (Test-Path $jdiDir) {
284
+ Write-Host "PURGE: removendo .jdi/ (state files - DECISIONS, ROADMAP, phases, etc)" -ForegroundColor Red
285
+ if (Confirm-Action "TEM CERTEZA? Isso apaga decisoes locked permanentemente") {
286
+ Remove-Item-Safe $jdiDir ".jdi/"
287
+ } else {
288
+ Write-Host " .jdi/ preservado." -ForegroundColor DarkGray
289
+ }
290
+ }
291
+
292
+ # Hooks tambem (default ship)
293
+ $hooksDir = Join-Path $ProjectDir '.githooks'
294
+ if (Test-Path $hooksDir) {
295
+ if (Confirm-Action "Remover .githooks/?") {
296
+ Remove-Item-Safe $hooksDir ".githooks/"
297
+ }
298
+ }
299
+ }
300
+
301
+ Write-Host ""
302
+ Write-Host "Uninstall completo." -ForegroundColor Green
303
+ if ($DryRun) {
304
+ Write-Host "(dry-run - nada foi mudado)" -ForegroundColor Yellow
305
+ }
306
+ if (-not $Purge) {
307
+ Write-Host ""
308
+ Write-Host "Nota: .jdi/ preservado (state files). Use --purge pra remover tambem." -ForegroundColor DarkGray
309
+ }