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,16 @@
1
+ #!/usr/bin/env bash
2
+ # JDI post-commit hook — no-op por padrao.
3
+ #
4
+ # STATE.md eh atualizado explicitamente pelos comandos (/jdi-do, /jdi-verify,
5
+ # /jdi-ship). Nao ha mais sed automatico.
6
+ #
7
+ # Este hook fica aqui pra compatibilidade e como ponto de extensao
8
+ # (ex: notificar Slack apos commit, atualizar dashboard externo, etc).
9
+
10
+ set -euo pipefail
11
+
12
+ # nada de .jdi? nao eh projeto JDI
13
+ [[ -d .jdi ]] || exit 0
14
+
15
+ # Hook sem acao por padrao.
16
+ exit 0
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+ # JDI pre-commit hook — no-op por padrao.
3
+ #
4
+ # O doer specialist eh responsavel por gerar/atualizar docs durante a
5
+ # execucao da phase. Este hook fica aqui pra compatibilidade e como
6
+ # ponto de extensao.
7
+ #
8
+ # Se voce quiser adicionar verificacoes pre-commit (lint rapido, secrets check
9
+ # basico, etc), edite este file ou desative com:
10
+ # git config --unset core.hooksPath
11
+
12
+ set -euo pipefail
13
+
14
+ # nada staged? sai
15
+ if git diff --cached --quiet; then
16
+ exit 0
17
+ fi
18
+
19
+ # Hook sem acao por padrao.
20
+ # Reviewer specialist (`/jdi-verify`) cobre validacao de qualidade.
21
+ exit 0
@@ -0,0 +1,381 @@
1
+ <#
2
+ .SYNOPSIS
3
+ jdi-build (Windows): gera runtimes/{claude,copilot,antigravity,opencode} a partir de core/.
4
+
5
+ .DESCRIPTION
6
+ Equivalente PowerShell de bin/jdi-build.sh. Funciona em Windows sem precisar de bash/awk/sed.
7
+ Usa regex nativo PowerShell pra parser do frontmatter YAML.
8
+
9
+ .PARAMETER Target
10
+ Runtime alvo: claude | copilot | antigravity | opencode | all (default).
11
+
12
+ .EXAMPLE
13
+ .\bin\jdi-build.ps1
14
+ .\bin\jdi-build.ps1 -Target opencode
15
+ #>
16
+ [CmdletBinding()]
17
+ param(
18
+ [ValidateSet('claude','copilot','antigravity','opencode','all')]
19
+ [string]$Target = 'all'
20
+ )
21
+
22
+ $ErrorActionPreference = 'Stop'
23
+
24
+ $Root = Split-Path -Parent $PSScriptRoot
25
+ $Core = Join-Path $Root 'core'
26
+ $Out = Join-Path $Root 'runtimes'
27
+
28
+ function Ensure-Dirs {
29
+ $dirs = @(
30
+ "$Out\claude\agents", "$Out\claude\commands", "$Out\claude\skills",
31
+ "$Out\copilot\agents", "$Out\copilot\prompts",
32
+ "$Out\antigravity\skills",
33
+ "$Out\opencode\agents", "$Out\opencode\commands", "$Out\opencode\skills"
34
+ )
35
+ foreach ($d in $dirs) {
36
+ New-Item -ItemType Directory -Force -Path $d | Out-Null
37
+ }
38
+ }
39
+
40
+ # Le arquivo e devolve hashtable com:
41
+ # Frontmatter = string (sem os ---)
42
+ # Body = string (corpo apos o frontmatter)
43
+ function Read-MdSource {
44
+ param([string]$Path)
45
+ $content = Get-Content -Path $Path -Raw -Encoding UTF8
46
+ if ($content -match '^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$') {
47
+ return @{
48
+ Frontmatter = $Matches[1]
49
+ Body = $Matches[2]
50
+ }
51
+ }
52
+ return @{ Frontmatter = ''; Body = $content }
53
+ }
54
+
55
+ # Extrai sub-bloco do frontmatter sob `runtime_overrides.<runtime>:`.
56
+ # Retorna hashtable { key = value } com parsing simples de "key: value" indented.
57
+ function Get-RuntimeOverride {
58
+ param(
59
+ [string]$Frontmatter,
60
+ [string]$Runtime
61
+ )
62
+ $result = [ordered]@{}
63
+ $lines = $Frontmatter -split "`r?`n"
64
+ $inOverrides = $false
65
+ $inRuntime = $false
66
+ $runtimeIndent = -1
67
+ $subBlocks = [ordered]@{}
68
+ $currentSub = $null
69
+ $currentSubLines = @()
70
+
71
+ foreach ($line in $lines) {
72
+ if ($line -match '^runtime_overrides:\s*$') { $inOverrides = $true; continue }
73
+ if (-not $inOverrides) { continue }
74
+
75
+ if ($line -match '^\S') { break } # saiu do bloco runtime_overrides
76
+
77
+ if ($line -match "^\s{2}${Runtime}:\s*$") {
78
+ $inRuntime = $true
79
+ $runtimeIndent = 2
80
+ continue
81
+ }
82
+
83
+ if ($inRuntime) {
84
+ if ($line -match '^\s{2}\S') { break } # outro runtime — fim do bloco
85
+
86
+ # linhas de 4 espacos: pares key: value, OU key: (sub-bloco)
87
+ if ($line -match '^\s{4}(\w[\w-]*):\s*(.*)$') {
88
+ $k = $Matches[1]
89
+ $v = $Matches[2]
90
+
91
+ # commit subbloco anterior
92
+ if ($currentSub) {
93
+ $subBlocks[$currentSub] = $currentSubLines
94
+ $currentSub = $null
95
+ $currentSubLines = @()
96
+ }
97
+
98
+ if ([string]::IsNullOrWhiteSpace($v)) {
99
+ # sub-bloco abre
100
+ $currentSub = $k
101
+ $currentSubLines = @()
102
+ } else {
103
+ $result[$k] = $v
104
+ }
105
+ }
106
+ elseif ($line -match '^\s{6}\S' -and $currentSub) {
107
+ # linha do sub-bloco (6 espacos)
108
+ $currentSubLines += ($line -replace '^\s{4}', '')
109
+ }
110
+ elseif ($line -match '^\s{4}- ' -and $currentSub) {
111
+ $currentSubLines += ($line -replace '^\s{4}', '')
112
+ }
113
+ }
114
+ }
115
+
116
+ # commit ultimo subbloco
117
+ if ($currentSub) {
118
+ $subBlocks[$currentSub] = $currentSubLines
119
+ }
120
+
121
+ return @{ Scalars = $result; SubBlocks = $subBlocks }
122
+ }
123
+
124
+ # Pega valor escalar do frontmatter base (ex: description, name, triggers).
125
+ function Get-BaseFrontmatterValue {
126
+ param(
127
+ [string]$Frontmatter,
128
+ [string]$Key
129
+ )
130
+ if ($Frontmatter -match "(?m)^${Key}:\s*(.+)$") {
131
+ return $Matches[1].Trim()
132
+ }
133
+ return $null
134
+ }
135
+
136
+ # Pega bloco multilinha do frontmatter base (ex: triggers: lista).
137
+ function Get-BaseFrontmatterBlock {
138
+ param(
139
+ [string]$Frontmatter,
140
+ [string]$Key
141
+ )
142
+ $lines = $Frontmatter -split "`r?`n"
143
+ $collecting = $false
144
+ $captured = @()
145
+ foreach ($line in $lines) {
146
+ if ($collecting) {
147
+ if ($line -match '^\S') { break } # proxima chave top-level
148
+ if ($line -match '^\s+\S') { $captured += $line; continue }
149
+ }
150
+ if ($line -match "^${Key}:\s*$") { $collecting = $true; $captured += $line; continue }
151
+ }
152
+ return ($captured -join "`n")
153
+ }
154
+
155
+ function Build-ClaudeAgent {
156
+ param([string]$SrcPath)
157
+ $name = [System.IO.Path]::GetFileNameWithoutExtension($SrcPath)
158
+ $dst = Join-Path "$Out\claude\agents" "$name.md"
159
+
160
+ $src = Read-MdSource -Path $SrcPath
161
+ $desc = Get-BaseFrontmatterValue -Frontmatter $src.Frontmatter -Key 'description'
162
+ $override = Get-RuntimeOverride -Frontmatter $src.Frontmatter -Runtime 'claude'
163
+
164
+ $fm = New-Object System.Text.StringBuilder
165
+ [void]$fm.AppendLine('---')
166
+ [void]$fm.AppendLine("name: $name")
167
+ if ($desc) { [void]$fm.AppendLine("description: $desc") }
168
+ if ($override.Scalars['model']) { [void]$fm.AppendLine("model: $($override.Scalars['model'])") }
169
+ if ($override.Scalars['tools']) { [void]$fm.AppendLine("tools: $($override.Scalars['tools'])") }
170
+ [void]$fm.AppendLine('---')
171
+
172
+ $content = $fm.ToString() + $src.Body
173
+ Set-Content -Path $dst -Value $content -Encoding UTF8 -NoNewline
174
+ Write-Host " claude/agents/$name.md"
175
+ }
176
+
177
+ function Build-CopilotAgent {
178
+ param([string]$SrcPath)
179
+ $name = [System.IO.Path]::GetFileNameWithoutExtension($SrcPath)
180
+ $dst = Join-Path "$Out\copilot\agents" "$name.agent.md"
181
+
182
+ $src = Read-MdSource -Path $SrcPath
183
+ $desc = Get-BaseFrontmatterValue -Frontmatter $src.Frontmatter -Key 'description'
184
+ $override = Get-RuntimeOverride -Frontmatter $src.Frontmatter -Runtime 'copilot'
185
+
186
+ $fm = New-Object System.Text.StringBuilder
187
+ [void]$fm.AppendLine('---')
188
+ [void]$fm.AppendLine("name: $name")
189
+ if ($desc) { [void]$fm.AppendLine("description: $desc") }
190
+ if ($override.Scalars['model']) { [void]$fm.AppendLine("model: $($override.Scalars['model'])") }
191
+ if ($override.Scalars['tools']) { [void]$fm.AppendLine("tools: $($override.Scalars['tools'])") }
192
+ [void]$fm.AppendLine('---')
193
+
194
+ $content = $fm.ToString() + $src.Body
195
+ Set-Content -Path $dst -Value $content -Encoding UTF8 -NoNewline
196
+ Write-Host " copilot/agents/$name.agent.md"
197
+ }
198
+
199
+ function Build-AntigravitySkill {
200
+ param([string]$SrcPath)
201
+ $name = [System.IO.Path]::GetFileNameWithoutExtension($SrcPath)
202
+ $skillDir = Join-Path "$Out\antigravity\skills" $name
203
+ $dst = Join-Path $skillDir 'SKILL.md'
204
+ New-Item -ItemType Directory -Force -Path "$skillDir\references" | Out-Null
205
+ New-Item -ItemType Directory -Force -Path "$skillDir\scripts" | Out-Null
206
+
207
+ $src = Read-MdSource -Path $SrcPath
208
+ $desc = Get-BaseFrontmatterValue -Frontmatter $src.Frontmatter -Key 'description'
209
+ $triggersBlock = Get-BaseFrontmatterBlock -Frontmatter $src.Frontmatter -Key 'triggers'
210
+ $override = Get-RuntimeOverride -Frontmatter $src.Frontmatter -Runtime 'antigravity'
211
+
212
+ $fm = New-Object System.Text.StringBuilder
213
+ [void]$fm.AppendLine('---')
214
+ [void]$fm.AppendLine("name: $name")
215
+ if ($desc) { [void]$fm.AppendLine("description: $desc") }
216
+ if ($triggersBlock) {
217
+ [void]$fm.AppendLine($triggersBlock)
218
+ if ($override.SubBlocks['triggers_extra']) {
219
+ foreach ($l in $override.SubBlocks['triggers_extra']) {
220
+ [void]$fm.AppendLine($l)
221
+ }
222
+ }
223
+ }
224
+ [void]$fm.AppendLine('---')
225
+
226
+ $content = $fm.ToString() + $src.Body
227
+ Set-Content -Path $dst -Value $content -Encoding UTF8 -NoNewline
228
+ Write-Host " antigravity/skills/$name/SKILL.md"
229
+ }
230
+
231
+ function Build-OpencodeAgent {
232
+ param([string]$SrcPath)
233
+ $name = [System.IO.Path]::GetFileNameWithoutExtension($SrcPath)
234
+ $dst = Join-Path "$Out\opencode\agents" "$name.md"
235
+
236
+ $src = Read-MdSource -Path $SrcPath
237
+ $desc = Get-BaseFrontmatterValue -Frontmatter $src.Frontmatter -Key 'description'
238
+ $override = Get-RuntimeOverride -Frontmatter $src.Frontmatter -Runtime 'opencode'
239
+
240
+ $fm = New-Object System.Text.StringBuilder
241
+ [void]$fm.AppendLine('---')
242
+ if ($desc) { [void]$fm.AppendLine("description: $desc") }
243
+ foreach ($k in @('mode','model','temperature')) {
244
+ if ($override.Scalars[$k]) {
245
+ [void]$fm.AppendLine("${k}: $($override.Scalars[$k])")
246
+ }
247
+ }
248
+ if ($override.SubBlocks['permission']) {
249
+ [void]$fm.AppendLine('permission:')
250
+ foreach ($l in $override.SubBlocks['permission']) {
251
+ [void]$fm.AppendLine($l)
252
+ }
253
+ }
254
+ [void]$fm.AppendLine('---')
255
+
256
+ $content = $fm.ToString() + $src.Body
257
+ Set-Content -Path $dst -Value $content -Encoding UTF8 -NoNewline
258
+ Write-Host " opencode/agents/$name.md"
259
+ }
260
+
261
+ function Build-Command {
262
+ param([string]$SrcPath)
263
+ $name = [System.IO.Path]::GetFileNameWithoutExtension($SrcPath)
264
+
265
+ Copy-Item -Path $SrcPath -Destination (Join-Path "$Out\claude\commands" "$name.md") -Force
266
+ Copy-Item -Path $SrcPath -Destination (Join-Path "$Out\copilot\prompts" "$name.prompt.md") -Force
267
+
268
+ $skillDir = Join-Path "$Out\antigravity\skills" $name
269
+ New-Item -ItemType Directory -Force -Path "$skillDir\scripts" | Out-Null
270
+ Copy-Item -Path $SrcPath -Destination (Join-Path $skillDir 'SKILL.md') -Force
271
+
272
+ Copy-Item -Path $SrcPath -Destination (Join-Path "$Out\opencode\commands" "$name.md") -Force
273
+
274
+ Write-Host " command: $name"
275
+ }
276
+
277
+ # Standalone skill em core/skills/<name>/SKILL.md (com optional references/ + scripts/).
278
+ # Diferente de Build-AntigravitySkill que converte agent em skill - aqui a skill ja eh skill.
279
+ function Build-StandaloneSkill {
280
+ param(
281
+ [string]$SrcDir, # core/skills/<name>/
282
+ [string]$Runtime, # claude | opencode | antigravity
283
+ [string]$DestRoot # runtimes/<runtime>/skills/<name>/
284
+ )
285
+
286
+ $name = Split-Path -Leaf $SrcDir
287
+ $srcSkill = Join-Path $SrcDir 'SKILL.md'
288
+ if (-not (Test-Path $srcSkill)) { return }
289
+
290
+ New-Item -ItemType Directory -Force -Path $DestRoot | Out-Null
291
+
292
+ $src = Read-MdSource -Path $srcSkill
293
+ $desc = Get-BaseFrontmatterValue -Frontmatter $src.Frontmatter -Key 'description'
294
+
295
+ $fm = New-Object System.Text.StringBuilder
296
+ [void]$fm.AppendLine('---')
297
+ [void]$fm.AppendLine("name: $name")
298
+ if ($desc) { [void]$fm.AppendLine("description: $desc") }
299
+
300
+ if ($Runtime -eq 'antigravity') {
301
+ # Antigravity descobre skills por triggers - merge de runtime_overrides.antigravity.triggers
302
+ $override = Get-RuntimeOverride -Frontmatter $src.Frontmatter -Runtime 'antigravity'
303
+ if ($override.SubBlocks['triggers']) {
304
+ [void]$fm.AppendLine('triggers:')
305
+ foreach ($l in $override.SubBlocks['triggers']) {
306
+ [void]$fm.AppendLine($l)
307
+ }
308
+ }
309
+ }
310
+
311
+ [void]$fm.AppendLine('---')
312
+
313
+ $content = $fm.ToString() + $src.Body
314
+ Set-Content -Path (Join-Path $DestRoot 'SKILL.md') -Value $content -Encoding UTF8 -NoNewline
315
+
316
+ # Copia subdirs opcionais (references/, scripts/)
317
+ foreach ($subdir in @('references', 'scripts')) {
318
+ $srcSub = Join-Path $SrcDir $subdir
319
+ if (Test-Path $srcSub) {
320
+ $dstSub = Join-Path $DestRoot $subdir
321
+ if (Test-Path $dstSub) { Remove-Item -Recurse -Force $dstSub }
322
+ Copy-Item -Path $srcSub -Destination $dstSub -Recurse -Force
323
+ }
324
+ }
325
+
326
+ Write-Host " $Runtime/skills/$name/SKILL.md"
327
+ }
328
+
329
+ function Main {
330
+ Ensure-Dirs
331
+ Write-Host "JDI build (PowerShell) - gerando runtimes a partir de core/"
332
+
333
+ $agentFiles = Get-ChildItem -Path "$Core\agents" -Filter '*.md' -File | Sort-Object Name
334
+
335
+ if ($Target -in 'claude','all') {
336
+ Write-Host "`nclaude:"
337
+ foreach ($f in $agentFiles) { Build-ClaudeAgent -SrcPath $f.FullName }
338
+ }
339
+ if ($Target -in 'copilot','all') {
340
+ Write-Host "`ncopilot:"
341
+ foreach ($f in $agentFiles) { Build-CopilotAgent -SrcPath $f.FullName }
342
+ }
343
+ if ($Target -in 'antigravity','all') {
344
+ Write-Host "`nantigravity:"
345
+ foreach ($f in $agentFiles) { Build-AntigravitySkill -SrcPath $f.FullName }
346
+ }
347
+ if ($Target -in 'opencode','all') {
348
+ Write-Host "`nopencode:"
349
+ foreach ($f in $agentFiles) { Build-OpencodeAgent -SrcPath $f.FullName }
350
+ }
351
+
352
+ Write-Host "`ncommands (todos os runtimes):"
353
+ $cmdFiles = Get-ChildItem -Path "$Core\commands" -Filter '*.md' -File | Sort-Object Name
354
+ foreach ($f in $cmdFiles) { Build-Command -SrcPath $f.FullName }
355
+
356
+ # Standalone skills em core/skills/<name>/SKILL.md
357
+ $skillDirs = @()
358
+ if (Test-Path "$Core\skills") {
359
+ $skillDirs = Get-ChildItem -Path "$Core\skills" -Directory -ErrorAction SilentlyContinue | Sort-Object Name
360
+ }
361
+
362
+ if ($skillDirs.Count -gt 0) {
363
+ Write-Host "`nskills (standalone):"
364
+ foreach ($d in $skillDirs) {
365
+ if ($Target -in 'claude','all') {
366
+ Build-StandaloneSkill -SrcDir $d.FullName -Runtime 'claude' -DestRoot (Join-Path "$Out\claude\skills" $d.Name)
367
+ }
368
+ if ($Target -in 'opencode','all') {
369
+ Build-StandaloneSkill -SrcDir $d.FullName -Runtime 'opencode' -DestRoot (Join-Path "$Out\opencode\skills" $d.Name)
370
+ }
371
+ if ($Target -in 'antigravity','all') {
372
+ Build-StandaloneSkill -SrcDir $d.FullName -Runtime 'antigravity' -DestRoot (Join-Path "$Out\antigravity\skills" $d.Name)
373
+ }
374
+ # Copilot: nao tem conceito nativo de skill - skip
375
+ }
376
+ }
377
+
378
+ Write-Host "`nBuild completo. Veja runtimes/$Target/"
379
+ }
380
+
381
+ Main