@pathbit/agentdevkit 0.0.0-stage → 0.0.5

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 (240) hide show
  1. package/.pbai4devs/COMPATIBILIDADE.md +109 -0
  2. package/.pbai4devs/INSTRUCTIONS.md +87 -0
  3. package/.pbai4devs/README.md +50 -0
  4. package/.pbai4devs/agents/README.md +18 -0
  5. package/.pbai4devs/agents/revisor/AGENT.md +16 -0
  6. package/.pbai4devs/agents/revisor/antigravity.yaml +8 -0
  7. package/.pbai4devs/agents/revisor/claude.yaml +5 -0
  8. package/.pbai4devs/agents/revisor/cursor.yaml +5 -0
  9. package/.pbai4devs/agents/revisor/gemini.yaml +6 -0
  10. package/.pbai4devs/agents/revisor/github.yaml +5 -0
  11. package/.pbai4devs/agents/revisor/kimi-code.yaml +5 -0
  12. package/.pbai4devs/agents/revisor/mimocode.yaml +10 -0
  13. package/.pbai4devs/agents/revisor/opencode.yaml +7 -0
  14. package/.pbai4devs/agents/revisor/zcode.yaml +5 -0
  15. package/.pbai4devs/commands/README.md +30 -0
  16. package/.pbai4devs/commands/atualizar-ferramentas/COMMAND.md +17 -0
  17. package/.pbai4devs/commands/diagnosticar/COMMAND.md +18 -0
  18. package/.pbai4devs/commands/instalar-ferramentas/COMMAND.md +21 -0
  19. package/.pbai4devs/commands/preparar-dev/COMMAND.md +14 -0
  20. package/.pbai4devs/commands/proximos-passos/COMMAND.md +9 -0
  21. package/.pbai4devs/commands/revisar-entrega/COMMAND.md +29 -0
  22. package/.pbai4devs/commands/sincronizar/COMMAND.md +20 -0
  23. package/.pbai4devs/commands/status-roadmap/COMMAND.md +12 -0
  24. package/.pbai4devs/commands/testar-navegador/COMMAND.md +16 -0
  25. package/.pbai4devs/commands/verificar-agentes/COMMAND.md +19 -0
  26. package/.pbai4devs/estado/README.md +12 -0
  27. package/.pbai4devs/external-skills/CATALOG.json +121 -0
  28. package/.pbai4devs/external-skills/README.md +48 -0
  29. package/.pbai4devs/rules/README.md +18 -0
  30. package/.pbai4devs/rules/ambiente-local/RULE.md +33 -0
  31. package/.pbai4devs/rules/ambiente-local/cursor.yaml +4 -0
  32. package/.pbai4devs/rules/documentacao/RULE.md +11 -0
  33. package/.pbai4devs/rules/documentacao/cursor.yaml +4 -0
  34. package/.pbai4devs/rules/estrutura/RULE.md +33 -0
  35. package/.pbai4devs/rules/estrutura/cursor.yaml +4 -0
  36. package/.pbai4devs/rules/git/RULE.md +18 -0
  37. package/.pbai4devs/rules/git/cursor.yaml +4 -0
  38. package/.pbai4devs/rules/proximos-passos/RULE.md +14 -0
  39. package/.pbai4devs/rules/qualidade/RULE.md +32 -0
  40. package/.pbai4devs/rules/qualidade/cursor.yaml +4 -0
  41. package/.pbai4devs/scripts/README.md +69 -0
  42. package/.pbai4devs/scripts/diagnosticar-ambiente/SCRIPT.mjs +41 -0
  43. package/.pbai4devs/scripts/diagnosticar-ambiente/tests/TEST.mjs +30 -0
  44. package/.pbai4devs/scripts/executar-script/README.md +28 -0
  45. package/.pbai4devs/scripts/executar-script/SCRIPT.mjs +78 -0
  46. package/.pbai4devs/scripts/executar-script/tests/TEST.mjs +122 -0
  47. package/.pbai4devs/scripts/gerenciar-skills-externas/README.md +31 -0
  48. package/.pbai4devs/scripts/gerenciar-skills-externas/SCRIPT.mjs +182 -0
  49. package/.pbai4devs/scripts/gerenciar-skills-externas/tests/TEST.mjs +134 -0
  50. package/.pbai4devs/scripts/inspecionar-projeto/SCRIPT.mjs +190 -0
  51. package/.pbai4devs/scripts/inspecionar-projeto/tests/TEST.mjs +161 -0
  52. package/.pbai4devs/scripts/lib/README.md +9 -0
  53. package/.pbai4devs/scripts/lib/adapters.mjs +135 -0
  54. package/.pbai4devs/scripts/lib/catalog.mjs +170 -0
  55. package/.pbai4devs/scripts/lib/gitignore.mjs +348 -0
  56. package/.pbai4devs/scripts/lib/npm.mjs +17 -0
  57. package/.pbai4devs/scripts/lib/resource-path.mjs +20 -0
  58. package/.pbai4devs/scripts/lib/runtime.mjs +28 -0
  59. package/.pbai4devs/scripts/lib/script-config.mjs +8 -0
  60. package/.pbai4devs/scripts/preparar-ferramentas/BOOTSTRAP.md +34 -0
  61. package/.pbai4devs/scripts/preparar-ferramentas/BOOTSTRAP.mjs +189 -0
  62. package/.pbai4devs/scripts/preparar-ferramentas/README.md +71 -0
  63. package/.pbai4devs/scripts/preparar-ferramentas/SCRIPT.mjs +455 -0
  64. package/.pbai4devs/scripts/preparar-ferramentas/tests/FIXTURE.html +20 -0
  65. package/.pbai4devs/scripts/preparar-ferramentas/tests/SMOKE_BROWSER.mjs +55 -0
  66. package/.pbai4devs/scripts/preparar-ferramentas/tests/SMOKE_DESKTOP.mjs +61 -0
  67. package/.pbai4devs/scripts/preparar-ferramentas/tests/SMOKE_VERCEL.mjs +192 -0
  68. package/.pbai4devs/scripts/preparar-ferramentas/tests/TEST.mjs +552 -0
  69. package/.pbai4devs/scripts/preparar-ferramentas/tests/bootstrap.test.mjs +94 -0
  70. package/.pbai4devs/scripts/preparar-ferramentas/tests/fixtures-vercel/just-bash/input.txt +2 -0
  71. package/.pbai4devs/scripts/preparar-ferramentas/tests/fixtures-vercel/just-bash-overlay/input.txt +1 -0
  72. package/.pbai4devs/scripts/preparar-ferramentas/tests/fixtures-vercel/skills/agentdevkit-smoke/SKILL.md +8 -0
  73. package/.pbai4devs/scripts/preparar-ferramentas/tests/fixtures-vercel/webreel/index.html +6 -0
  74. package/.pbai4devs/scripts/preparar-ferramentas/tests/fixtures-vercel/webreel/webreel.config.json +10 -0
  75. package/.pbai4devs/scripts/revisar-entrega/README.md +36 -0
  76. package/.pbai4devs/scripts/revisar-entrega/SCRIPT.mjs +249 -0
  77. package/.pbai4devs/scripts/revisar-entrega/tests/TEST.mjs +249 -0
  78. package/.pbai4devs/scripts/sincronizar-agentes/README.md +41 -0
  79. package/.pbai4devs/scripts/sincronizar-agentes/SCRIPT.mjs +473 -0
  80. package/.pbai4devs/scripts/sincronizar-agentes/tests/LOCAL_IGNORE.mjs +290 -0
  81. package/.pbai4devs/scripts/sincronizar-agentes/tests/TEST.mjs +869 -0
  82. package/.pbai4devs/scripts/testar-infraestrutura/SCRIPT.mjs +39 -0
  83. package/.pbai4devs/scripts/testar-infraestrutura/tests/TEST.mjs +29 -0
  84. package/.pbai4devs/scripts/testar-maturidade/README.md +54 -0
  85. package/.pbai4devs/scripts/testar-maturidade/SCRIPT.mjs +477 -0
  86. package/.pbai4devs/scripts/testar-maturidade/assets/calculator.mjs +1 -0
  87. package/.pbai4devs/scripts/testar-maturidade/assets/calculator.test.mjs.template +8 -0
  88. package/.pbai4devs/scripts/testar-maturidade/assets/http-api.test.mjs.template +28 -0
  89. package/.pbai4devs/scripts/testar-maturidade/assets/server.mjs +34 -0
  90. package/.pbai4devs/scripts/testar-maturidade/tests/TEST.mjs +305 -0
  91. package/.pbai4devs/scripts/testar-navegador/REFERENCE.md +49 -0
  92. package/.pbai4devs/scripts/testar-navegador/SCRIPT.conf +1 -0
  93. package/.pbai4devs/scripts/testar-navegador/SCRIPT.js +64 -0
  94. package/.pbai4devs/scripts/testar-navegador/tests/FAIL.js +8 -0
  95. package/.pbai4devs/scripts/testar-navegador/tests/SUCCESS.js +13 -0
  96. package/.pbai4devs/scripts/verificar-recursos/README.md +25 -0
  97. package/.pbai4devs/scripts/verificar-recursos/SCRIPT.mjs +209 -0
  98. package/.pbai4devs/scripts/verificar-recursos/tests/TEST.mjs +310 -0
  99. package/.pbai4devs/scripts/verificar-recursos/tests/ambiente-local.mjs +80 -0
  100. package/.pbai4devs/skills/README.md +24 -0
  101. package/.pbai4devs/skills/git/git-branch/SKILL.md +11 -0
  102. package/.pbai4devs/skills/git/git-commit/SKILL.md +16 -0
  103. package/.pbai4devs/skills/git/git-diff/SKILL.md +9 -0
  104. package/.pbai4devs/skills/git/git-fetch/SKILL.md +10 -0
  105. package/.pbai4devs/skills/git/git-log/SKILL.md +9 -0
  106. package/.pbai4devs/skills/git/git-merge/SKILL.md +13 -0
  107. package/.pbai4devs/skills/git/git-pull/SKILL.md +12 -0
  108. package/.pbai4devs/skills/git/git-push/SKILL.md +12 -0
  109. package/.pbai4devs/skills/git/git-status/SKILL.md +9 -0
  110. package/.pbai4devs/skills/git/git-worktree/SKILL.md +10 -0
  111. package/.pbai4devs/skills/produto/criar-design-doc/SKILL.md +37 -0
  112. package/.pbai4devs/skills/produto/criar-prd/SKILL.md +35 -0
  113. package/.pbai4devs/skills/produto/criar-ux-ui/SKILL.md +34 -0
  114. package/.pbai4devs/skills/projeto/atualizar-documentacao/SKILL.md +26 -0
  115. package/.pbai4devs/skills/projeto/configurar-projeto/SKILL.md +62 -0
  116. package/.pbai4devs/skills/projeto/criar-agente/SKILL.md +20 -0
  117. package/.pbai4devs/skills/projeto/criar-comando/SKILL.md +25 -0
  118. package/.pbai4devs/skills/projeto/criar-recurso/SKILL.md +41 -0
  119. package/.pbai4devs/skills/projeto/criar-regra/SKILL.md +19 -0
  120. package/.pbai4devs/skills/projeto/criar-skill/SKILL.md +22 -0
  121. package/.pbai4devs/skills/projeto/executar-script/SKILL.md +29 -0
  122. package/.pbai4devs/skills/projeto/preparar-dev/SKILL.md +45 -0
  123. package/.pbai4devs/skills/projeto/preparar-ferramentas/SKILL.md +56 -0
  124. package/.pbai4devs/skills/projeto/proximos-passos/SKILL.md +23 -0
  125. package/.pbai4devs/skills/projeto/sincronizar-agentes/SKILL.md +42 -0
  126. package/.pbai4devs/skills/projeto/usar-skills-externas/SKILL.md +28 -0
  127. package/.pbai4devs/skills/projeto/verificar-trabalho/SKILL.md +45 -0
  128. package/.pbai4devs/skills/specs/criar-spec/SKILL.md +33 -0
  129. package/.pbai4devs/skills/specs/gerenciar-roadmap/SKILL.md +26 -0
  130. package/.pbai4devs/skills/specs/implementar-spec/SKILL.md +48 -0
  131. package/.pbai4devs/templates/README.md +65 -0
  132. package/.pbai4devs/templates/adr/TEMPLATE.md +21 -0
  133. package/.pbai4devs/templates/ambiente-local/Makefile.template +48 -0
  134. package/.pbai4devs/templates/ambiente-local/TEMPLATE.md +48 -0
  135. package/.pbai4devs/templates/ambiente-local/compose.local.yml.template +16 -0
  136. package/.pbai4devs/templates/ambiente-local/dockerignore.template +28 -0
  137. package/.pbai4devs/templates/changelog/TEMPLATE.md +17 -0
  138. package/.pbai4devs/templates/claude/TEMPLATE.md +8 -0
  139. package/.pbai4devs/templates/clients/ADAPTERS.json +306 -0
  140. package/.pbai4devs/templates/clients/TEMPLATE.md +12 -0
  141. package/.pbai4devs/templates/comando/TEMPLATE.md +15 -0
  142. package/.pbai4devs/templates/configuracao/TEMPLATE.md +46 -0
  143. package/.pbai4devs/templates/configuracao-raiz/TEMPLATE.md +22 -0
  144. package/.pbai4devs/templates/configuracao-raiz/editorconfig.template +21 -0
  145. package/.pbai4devs/templates/configuracao-raiz/env.example.template +3 -0
  146. package/.pbai4devs/templates/configuracao-raiz/gitattributes.template +6 -0
  147. package/.pbai4devs/templates/contribuicao/TEMPLATE.md +23 -0
  148. package/.pbai4devs/templates/design/TEMPLATE.md +30 -0
  149. package/.pbai4devs/templates/entrypoints/AGENTS.md +19 -0
  150. package/.pbai4devs/templates/entrypoints/CLAUDE.md +7 -0
  151. package/.pbai4devs/templates/entrypoints/GEMINI.md +7 -0
  152. package/.pbai4devs/templates/entrypoints/TEMPLATE.md +12 -0
  153. package/.pbai4devs/templates/gitignore/TEMPLATE.md +42 -0
  154. package/.pbai4devs/templates/gitignore/agents.ignore +45 -0
  155. package/.pbai4devs/templates/gitignore/clients.json +20 -0
  156. package/.pbai4devs/templates/gitignore/local.ignore +10 -0
  157. package/.pbai4devs/templates/gitignore/shared.ignore +60 -0
  158. package/.pbai4devs/templates/instrucoes-agentes/TEMPLATE.md +25 -0
  159. package/.pbai4devs/templates/plano-implementacao/TEMPLATE.md +27 -0
  160. package/.pbai4devs/templates/prd/TEMPLATE.md +30 -0
  161. package/.pbai4devs/templates/readme-pasta/TEMPLATE.md +16 -0
  162. package/.pbai4devs/templates/readme-projeto/TEMPLATE.md +34 -0
  163. package/.pbai4devs/templates/release/TEMPLATE.md +23 -0
  164. package/.pbai4devs/templates/revisao-entrega/TEMPLATE.md +41 -0
  165. package/.pbai4devs/templates/roadmap/TEMPLATE.md +18 -0
  166. package/.pbai4devs/templates/seguranca/TEMPLATE.md +22 -0
  167. package/.pbai4devs/templates/spec/TEMPLATE.md +61 -0
  168. package/.pbai4devs/templates/tasks/TEMPLATE.md +20 -0
  169. package/.pbai4devs/templates/ux-ui/TEMPLATE.md +26 -0
  170. package/.pbai4devs/tools/README.md +87 -0
  171. package/.pbai4devs/tools/agent-browser/README.md +26 -0
  172. package/.pbai4devs/tools/agent-browser/SCRIPT.mjs +5 -0
  173. package/.pbai4devs/tools/agent-browser/TOOL.json +33 -0
  174. package/.pbai4devs/tools/agent-desktop/README.md +26 -0
  175. package/.pbai4devs/tools/agent-desktop/SCRIPT.mjs +5 -0
  176. package/.pbai4devs/tools/agent-desktop/TOOL.json +30 -0
  177. package/.pbai4devs/tools/just-bash/README.md +23 -0
  178. package/.pbai4devs/tools/just-bash/SCRIPT.mjs +5 -0
  179. package/.pbai4devs/tools/just-bash/TOOL.json +27 -0
  180. package/.pbai4devs/tools/markdownlint-cli2/README.md +18 -0
  181. package/.pbai4devs/tools/markdownlint-cli2/SCRIPT.mjs +5 -0
  182. package/.pbai4devs/tools/markdownlint-cli2/TOOL.json +28 -0
  183. package/.pbai4devs/tools/opensrc/README.md +25 -0
  184. package/.pbai4devs/tools/opensrc/SCRIPT.mjs +5 -0
  185. package/.pbai4devs/tools/opensrc/TOOL.json +29 -0
  186. package/.pbai4devs/tools/portless/README.md +21 -0
  187. package/.pbai4devs/tools/portless/SCRIPT.mjs +5 -0
  188. package/.pbai4devs/tools/portless/TOOL.json +30 -0
  189. package/.pbai4devs/tools/skills/README.md +24 -0
  190. package/.pbai4devs/tools/skills/SCRIPT.mjs +5 -0
  191. package/.pbai4devs/tools/skills/TOOL.json +33 -0
  192. package/.pbai4devs/tools/webreel/README.md +23 -0
  193. package/.pbai4devs/tools/webreel/SCRIPT.mjs +5 -0
  194. package/.pbai4devs/tools/webreel/TOOL.json +25 -0
  195. package/CHANGELOG.md +58 -0
  196. package/CONTRIBUTING.md +73 -0
  197. package/LICENSE +21 -0
  198. package/README.en.md +78 -0
  199. package/README.es.md +80 -0
  200. package/README.md +88 -2
  201. package/bin/README.md +8 -0
  202. package/bin/agentdevkit.mjs +35 -0
  203. package/docs/README.md +81 -0
  204. package/docs/guides/README.md +14 -0
  205. package/docs/guides/cli.md +81 -0
  206. package/docs/guides/installation.md +78 -0
  207. package/docs/guides/resources.md +121 -0
  208. package/docs/guides/tools-and-testing.md +85 -0
  209. package/docs/guides/troubleshooting.md +151 -0
  210. package/docs/guides/workflow.md +130 -0
  211. package/docs/maintainers/README.md +12 -0
  212. package/docs/maintainers/community.md +49 -0
  213. package/docs/maintainers/development.md +54 -0
  214. package/docs/maintainers/maintenance.md +104 -0
  215. package/docs/maintainers/packages.md +76 -0
  216. package/docs/product/README.md +12 -0
  217. package/docs/product/design.md +94 -0
  218. package/docs/product/prd.md +64 -0
  219. package/docs/product/roadmap.md +36 -0
  220. package/docs/product/ux-ui.md +42 -0
  221. package/docs/specs/README.md +20 -0
  222. package/docs/specs/github-packages/SPEC.md +45 -0
  223. package/docs/specs/v0.0.1/README.md +10 -0
  224. package/docs/specs/v0.0.1/SPEC.md +57 -0
  225. package/docs/specs/v0.0.2/README.md +10 -0
  226. package/docs/specs/v0.0.2/SPEC.md +67 -0
  227. package/docs/specs/v0.0.3/README.md +10 -0
  228. package/docs/specs/v0.0.3/SPEC.md +64 -0
  229. package/docs/specs/v0.0.4/README.md +10 -0
  230. package/docs/specs/v0.0.4/SPEC.md +53 -0
  231. package/docs/specs/v0.0.5/README.md +9 -0
  232. package/docs/specs/v0.0.5/SPEC.md +42 -0
  233. package/package.json +52 -4
  234. package/src/README.md +16 -0
  235. package/src/adapters/index.mjs +1 -0
  236. package/src/cli.mjs +162 -0
  237. package/src/config.mjs +14 -0
  238. package/src/i18n.mjs +42 -0
  239. package/src/install.mjs +367 -0
  240. package/src/next.mjs +79 -0
package/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "@pathbit/agentdevkit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.5",
4
+ "description": "PathBit AgentDevKit: specs, skills and workflows for coding agents.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "registry": "https://registry.npmjs.org",
9
+ "access": "public"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/pathbit/AgentDevKit.git"
14
+ },
15
+ "homepage": "https://github.com/pathbit/AgentDevKit#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/pathbit/AgentDevKit/issues"
18
+ },
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
22
+ "bin": {
23
+ "agentdevkit": "bin/agentdevkit.mjs"
24
+ },
25
+ "files": [
26
+ "bin/",
27
+ "src/",
28
+ ".pbai4devs/",
29
+ "docs/",
30
+ "README.md",
31
+ "README.en.md",
32
+ "README.es.md",
33
+ "CONTRIBUTING.md",
34
+ "CHANGELOG.md",
35
+ "LICENSE"
36
+ ],
37
+ "scripts": {
38
+ "cli": "node bin/agentdevkit.mjs",
39
+ "test": "node --test tests/*.test.mjs",
40
+ "test:distribution": "node --test tests/distribution.test.mjs",
41
+ "test:infra": "node .pbai4devs/scripts/testar-infraestrutura/SCRIPT.mjs",
42
+ "examples": "node .pbai4devs/scripts/testar-maturidade/SCRIPT.mjs prepare",
43
+ "test:examples": "node .pbai4devs/scripts/testar-maturidade/SCRIPT.mjs run",
44
+ "generate": "npm run examples",
45
+ "agents:sync": "node .pbai4devs/scripts/sincronizar-agentes/SCRIPT.mjs",
46
+ "check": "node scripts/release/pipeline.mjs check",
47
+ "verify": "node scripts/release/pipeline.mjs full",
48
+ "build": "node scripts/release/assets.mjs",
49
+ "pack:release": "node scripts/release/assets.mjs",
50
+ "ci:full": "node scripts/release/pipeline.mjs full",
51
+ "ci:portable": "node scripts/release/pipeline.mjs portable",
52
+ "ci:smoke": "node scripts/release/pipeline.mjs smoke"
53
+ }
54
+ }
package/src/README.md ADDED
@@ -0,0 +1,16 @@
1
+ ---
2
+ description: Código da CLI e do instalador do AgentDevKit.
3
+ ---
4
+
5
+ # Código do pacote
6
+
7
+ CLI, instalação, idioma e próximos passos usam os recursos compartilhados.
8
+ Este diretório não faz parte dos recursos instalados nos projetos.
9
+
10
+ | Módulo | Responsabilidade |
11
+ | --- | --- |
12
+ | `cli.mjs` | Comandos, opções e saída para pessoas ou automações. |
13
+ | `install.mjs` | Planejamento e aplicação segura da instalação. |
14
+ | `config.mjs` | Caminhos, versão e metadados do pacote. |
15
+ | `adapters/` | Acesso aos layouts compartilhados dos agentes. |
16
+ | `i18n.mjs` e `next.mjs` | Idiomas e orientação da próxima ação. |
@@ -0,0 +1 @@
1
+ export * from '../../.pbai4devs/scripts/lib/adapters.mjs';
package/src/cli.mjs ADDED
@@ -0,0 +1,162 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { resolve, join } from 'node:path';
3
+ import { createInterface } from 'node:readline/promises';
4
+ import { spawnSync } from 'node:child_process';
5
+ import { packageInfo } from './config.mjs';
6
+ import { text, normalizeLanguage, explainError } from './i18n.mjs';
7
+ import { resolveTarget, loadState, planInstallation, applyPlan, inspect } from './install.mjs';
8
+ import { getNextSteps } from './next.mjs';
9
+ import { availableClients, normalizeClients } from './adapters/index.mjs';
10
+
11
+ function usage(message) { throw Object.assign(new Error(message), { code: 'E_ARGS', exitCode: 2 }); }
12
+ function selectedClients(value) {
13
+ try { return normalizeClients(value); }
14
+ catch (error) { usage(error.message); }
15
+ }
16
+
17
+ export function parseArgs(argv) {
18
+ const options = { command: null, positionals: [], toolArgs: [], target: null, language: null, clients: undefined, yes: false, json: false, dryRun: false, force: false, check: false };
19
+ for (let index = 0; index < argv.length; index++) {
20
+ const arg = argv[index];
21
+ if (['--target', '--lang', '--agents', '--clients'].includes(arg)) {
22
+ const value = argv[++index]; if (!value || value.startsWith('-')) usage(`Missing value: ${arg}`);
23
+ if (arg === '--target') options.target = value;
24
+ else if (arg === '--lang') { options.language = normalizeLanguage(value); if (!options.language) usage('Use --lang pt, en or es.'); }
25
+ else { if (options.clients !== undefined) usage('Use --agents or --clients once.'); options.clients = selectedClients(value); }
26
+ } else if (arg === '--json') options.json = true;
27
+ else if (arg === '--yes' || arg === '-y') options.yes = true;
28
+ else if (arg === '--dry-run') options.dryRun = true;
29
+ else if (arg === '--force') options.force = true;
30
+ else if (arg === '--check' && options.command !== 'tools') options.check = true;
31
+ else if (options.command === 'tools') options.toolArgs.push(arg);
32
+ else if (arg === '--help' || arg === '-h') options.help = true;
33
+ else if (arg === '--version' || arg === '-v') options.version = true;
34
+ else if (arg.startsWith('-')) usage(`Unknown option: ${arg}`);
35
+ else if (!options.command) options.command = arg;
36
+ else options.positionals.push(arg);
37
+ }
38
+ if (!options.command) options.command = options.version ? 'version' : options.help ? 'help' : 'init';
39
+ if (options.command === 'language') options.command = 'lang';
40
+ if (options.command === 'clients') options.command = 'agents';
41
+ if (!['init', 'update', 'doctor', 'sync', 'lang', 'agents', 'next', 'tools', 'help', 'version'].includes(options.command)) usage(`Unknown command: ${options.command}`);
42
+ if (options.help) options.command = 'help';
43
+ if (options.version) options.command = 'version';
44
+ if (options.positionals.length > 1 || (options.positionals.length && !['init', 'lang', 'agents'].includes(options.command))) usage('Unexpected positional arguments.');
45
+ if (options.command === 'init' && options.target && options.positionals.length) usage('Use a directory or --target, not both.');
46
+ if (options.command === 'agents' && options.positionals.length) {
47
+ if (options.clients !== undefined) usage('Use a selection argument or --agents, not both.');
48
+ options.clients = selectedClients(options.positionals[0]);
49
+ }
50
+ if (options.clients !== undefined && !['init', 'update', 'sync', 'lang', 'agents', 'help', 'version'].includes(options.command)) usage('--agents requires an installation or configuration command.');
51
+ if (options.check && options.command !== 'sync') usage('--check requires sync.');
52
+ if (options.dryRun && (!['init', 'update', 'sync', 'lang', 'agents'].includes(options.command) || (options.command === 'agents' && options.clients === undefined))) usage('--dry-run requires an installation or configuration change.');
53
+ return options;
54
+ }
55
+
56
+ function print(result, options, output) {
57
+ if (options.json) { output.write(`${JSON.stringify(result)}\n`); return; }
58
+ output.write(`${result.message}\n`);
59
+ if (result.clients) output.write(`${text(result.language, 'clientsCurrent')}: ${result.clients.join(', ')}\n`);
60
+ if (result.availableClients) output.write(`${text(result.language, 'clientsAvailable')}: ${result.availableClients.map(client => client.id).join(', ')}\n`);
61
+ if (result.toolOutput) output.write(`${result.toolOutput.trimEnd()}\n`);
62
+ if (result.plan?.length) {
63
+ const names = { pt: { create: 'criar', update: 'atualizar', remove: 'remover' }, en: { create: 'create', update: 'update', remove: 'remove' }, es: { create: 'crear', update: 'actualizar', remove: 'eliminar' } };
64
+ const labels = {
65
+ pt: { files: 'Arquivos', conflicts: 'Conflitos', more: 'caminhos adicionais; use --json para o plano completo.' },
66
+ en: { files: 'Files', conflicts: 'Conflicts', more: 'additional paths; use --json for the complete plan.' },
67
+ es: { files: 'Archivos', conflicts: 'Conflictos', more: 'rutas adicionales; use --json para el plan completo.' },
68
+ }[result.language];
69
+ output.write(`${labels.files}: ${['create', 'update', 'remove'].map(action => `${result.plan.filter(item => item.action === action).length} ${names[result.language][action]}`).join(', ')}.\n`);
70
+ if (result.conflicts?.length) output.write(`${labels.conflicts}: ${result.conflicts.length}.\n`);
71
+ if (options.dryRun) {
72
+ const limit = 12;
73
+ for (const item of result.plan.slice(0, limit)) output.write(` ${names[result.language][item.action]} ${item.path}${item.conflict ? ' [!]' : ''}\n`);
74
+ if (result.plan.length > limit) output.write(` +${result.plan.length - limit} ${labels.more}\n`);
75
+ }
76
+ }
77
+ if (result.issues?.length) for (const item of result.issues) output.write(` ${item.code}: ${item.path}\n`);
78
+ output.write(`\n[ ${text(result.language, 'next')} ]\n`);
79
+ for (const step of result.next) {
80
+ output.write(` ${step.label}\n`);
81
+ if (step.skill) output.write(` ${step.skill}\n`);
82
+ if (step.instruction) output.write(` ${step.instruction}\n`);
83
+ if (step.command) output.write(` > ${step.command}\n`);
84
+ }
85
+ }
86
+
87
+ export async function main(argv = process.argv.slice(2), context = {}) {
88
+ const output = context.stdout || process.stdout, input = context.stdin || process.stdin, errorOutput = context.stderr || process.stderr;
89
+ let options = { json: argv.includes('--json') }, language = normalizeLanguage(argv[argv.indexOf('--lang') + 1]) || 'pt', target = resolve(context.cwd || process.cwd()), clients = ['all'];
90
+ try {
91
+ options = parseArgs(argv);
92
+ target = resolveTarget(options.target || (options.command === 'init' ? options.positionals[0] : '.'), context.cwd || process.cwd());
93
+ const previous = ['help', 'version'].includes(options.command) ? null : loadState(target);
94
+ language = options.language || previous?.language || 'pt';
95
+ clients = options.clients ?? previous?.clients ?? ['all'];
96
+ if (options.command === 'init' && !previous && !options.yes && !options.json && !options.dryRun && input.isTTY && output.isTTY && (!options.language || options.clients === undefined)) {
97
+ const prompt = context.ask ? null : createInterface({ input, output: errorOutput });
98
+ const ask = context.ask || (question => prompt.question(question));
99
+ try {
100
+ if (!options.language) language = normalizeLanguage((await ask(text(language, 'select'))).trim() || 'pt') || 'pt';
101
+ if (options.clients === undefined) {
102
+ const ids = availableClients.map(client => client.id).join(', ');
103
+ clients = selectedClients((await ask(`${text(language, 'clientsAvailable')}: ${ids}\n${text(language, 'clientsSelect')}`)).trim() || 'all');
104
+ options.clients = clients;
105
+ }
106
+ } finally { prompt?.close(); }
107
+ }
108
+ const result = { ok: true, command: options.command, version: packageInfo.version, language, ...(['help', 'version'].includes(options.command) ? {} : { clients }), target, message: '', next: getNextSteps({ command: options.command, language, target, installed: Boolean(previous) }) };
109
+ let exitCode = 0;
110
+ if (options.command === 'help') result.message = text(language, 'help');
111
+ else if (options.command === 'version') result.message = `AgentDevKit ${packageInfo.version}`;
112
+ else if (options.command === 'agents' && options.clients === undefined) {
113
+ result.message = text(language, 'clientsCurrent'); result.availableClients = availableClients;
114
+ }
115
+ else if (options.command === 'lang' && !options.positionals.length && !options.language && options.clients === undefined) result.message = `${text(language, 'language')}: ${language}`;
116
+ else if (options.command === 'doctor') {
117
+ const found = inspect(target);
118
+ if (found.installed && !found.issues.length) {
119
+ const plan = planInstallation({ target, language, mode: 'sync' });
120
+ found.issues.push(...plan.changes.map(change => ({ code: 'outdated', path: change.path })));
121
+ found.issues.push(...plan.localIgnoreCheck.missing.map(path => ({ code: 'unignored', path })));
122
+ if (plan.localIgnore.edits.length || plan.untrack?.paths.length) found.issues.push({ code: 'local-ignore', path: '.gitignore / Git info/exclude' });
123
+ }
124
+ result.issues = found.issues; result.ok = found.installed && found.issues.length === 0;
125
+ result.message = text(language, result.ok ? 'healthy' : found.installed ? 'unhealthy' : 'missing'); exitCode = result.ok ? 0 : 1;
126
+ } else if (options.command === 'next') {
127
+ result.message = previous ? text(language, 'workflow') : text(language, 'missing');
128
+ } else if (options.command === 'tools') {
129
+ if (!previous) throw Object.assign(new Error(text(language, 'missing')), { code: 'E_MISSING' });
130
+ const script = join(target, '.pbai4devs/scripts/preparar-ferramentas/SCRIPT.mjs');
131
+ const child = spawnSync(process.execPath, [script, ...options.toolArgs], { cwd: target, encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 });
132
+ result.ok = !child.error && child.status === 0; result.message = text(language, 'tools');
133
+ result.toolOutput = [child.stdout, child.stderr, child.error?.message].filter(Boolean).join('\n'); exitCode = result.ok ? 0 : child.status || 1;
134
+ } else {
135
+ if (options.command === 'lang') {
136
+ const selected = options.positionals[0] || options.language; language = normalizeLanguage(selected);
137
+ if (!language) usage('Use lang pt, en or es.'); result.language = language;
138
+ result.next = getNextSteps({ command: options.command, language, target, installed: Boolean(previous) });
139
+ }
140
+ const plan = planInstallation({ target, language, mode: options.command, force: options.force, clients: options.clients });
141
+ result.plan = plan.changes.map(({ path, action }) => ({ path, action, conflict: plan.conflicts.includes(path) }));
142
+ result.untrackedPaths = [...(plan.untrack?.paths || [])];
143
+ result.localIgnore = { status: plan.localIgnore.status, edits: plan.localIgnore.edits.map(({ path, before }) => ({ path, action: before === null ? 'create' : 'update' })), missing: plan.localIgnoreCheck.missing };
144
+ if (plan.localIgnore.edits.length) result.plan.push({ path: '.gitignore / Git info/exclude', action: 'update', conflict: false });
145
+ if (plan.untrack?.paths.length) result.plan.push({ path: 'Git index (generated files)', action: 'update', conflict: false });
146
+ result.conflicts = plan.conflicts;
147
+ const preview = options.dryRun || (options.command === 'sync' && options.check);
148
+ if (!plan.canApply || preview) {
149
+ result.ok = plan.canApply && (!options.check || result.plan.length === 0);
150
+ result.message = text(language, plan.canApply ? 'plan' : 'conflict'); exitCode = result.ok ? 0 : 1;
151
+ } else {
152
+ Object.assign(result, applyPlan(plan)); result.message = text(language, result.changed ? options.command : 'unchanged');
153
+ result.next = getNextSteps({ command: options.command, language, target, installed: true });
154
+ }
155
+ }
156
+ print(result, options, output); return exitCode;
157
+ } catch (error) {
158
+ const result = { ok: false, command: options.command || 'help', version: packageInfo.version, language, clients, target, message: explainError(language, error.code), error: { code: error.code || 'E_OPERATION', detail: error.message }, next: getNextSteps({ command: 'error', language, target, installed: existsSync(join(target, '.pbai4devs/estado/agentdevkit.json')) }) };
159
+ if (!options.json) result.message += ` (${error.code || 'E_OPERATION'})`;
160
+ print(result, options, output); return error.exitCode || 1;
161
+ }
162
+ }
package/src/config.mjs ADDED
@@ -0,0 +1,14 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { dirname, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ export const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
6
+ export const frameworkRoot = resolve(packageRoot, '.pbai4devs');
7
+ export const packageInfo = JSON.parse(readFileSync(resolve(packageRoot, 'package.json'), 'utf8'));
8
+ export const statePath = '.pbai4devs/estado/agentdevkit.json';
9
+ export const entryNames = ['AGENTS.md', 'CLAUDE.md', 'GEMINI.md'];
10
+ export const begin = '<!-- BEGIN AGENTDEVKIT -->';
11
+ export const end = '<!-- END AGENTDEVKIT -->';
12
+ const registry = packageInfo.publishConfig?.registry || 'https://registry.npmjs.org';
13
+ const registryOption = new URL(registry).hostname === 'registry.npmjs.org' ? '' : ` --registry=${registry}`;
14
+ export const releaseCommand = `npx --yes --ignore-scripts${registryOption} --package=${packageInfo.name}@${packageInfo.version} agentdevkit`;
package/src/i18n.mjs ADDED
@@ -0,0 +1,42 @@
1
+ export const languages = ['pt', 'en', 'es'];
2
+ export function normalizeLanguage(value) {
3
+ const locale = String(value || '').toLowerCase();
4
+ if (locale === 'pt-br') return 'pt';
5
+ return languages.includes(locale) ? locale : null;
6
+ }
7
+
8
+ const messages = {
9
+ pt: {
10
+ help: 'AgentDevKit: init [diretório], update, doctor, sync [--check], lang [pt|en|es], agents [lista], next, tools <ação>.\nOpções: --target <diretório>, --lang <idioma>, --agents <lista>, --yes, --dry-run, --force, --json.\nAliases: --clients e clients.',
11
+ clientsCurrent: 'Agentes selecionados', clientsAvailable: 'Agentes disponíveis', clientsSelect: 'Agentes (IDs separados por vírgula ou all) [all]: ', agents: 'Seleção de agentes atualizada.',
12
+ next: 'Próximo passo', init: 'Estrutura instalada.', update: 'Estrutura atualizada.', sync: 'Apontamentos sincronizados.', lang: 'Idioma configurado.', unchanged: 'Estrutura já atualizada.', plan: 'Plano calculado; nenhum arquivo alterado.', conflict: 'Há arquivos próprios ou alterados em conflito. Revise o plano; --force salva backup antes de substituir.',
13
+ healthy: 'Estrutura verificada.', unhealthy: 'A estrutura precisa de ajustes.', missing: 'AgentDevKit ainda não foi inicializado neste diretório.', error: 'Não foi possível concluir a operação.', invalid: 'Argumentos inválidos.', language: 'Idioma atual', version: 'Versão', select: 'Idioma / Language / Idioma [pt/en/es] (pt): ',
14
+ project: 'Projeto', readme: 'AgentDevKit instalado. Leia AGENTS.md e siga as etapas de produto, design e implementação.', state: 'Estado local do AgentDevKit e configuração compartilhada do projeto.',
15
+ agentLanguage: 'Responda em português, salvo quando o usuário solicitar outro idioma.', inspect: 'Verifique a instalação', workflow: 'Consulte a próxima etapa', install: 'Inicialize este projeto', repair: 'Confira a sincronização', review: 'Revise os arquivos em conflito', tools: 'Resultado da ferramenta',
16
+ },
17
+ en: {
18
+ help: 'AgentDevKit: init [directory], update, doctor, sync [--check], lang [pt|en|es], agents [list], next, tools <action>.\nOptions: --target <directory>, --lang <language>, --agents <list>, --yes, --dry-run, --force, --json.\nAliases: --clients and clients.',
19
+ clientsCurrent: 'Selected agents', clientsAvailable: 'Available agents', clientsSelect: 'Agents (comma-separated IDs or all) [all]: ', agents: 'Agent selection updated.',
20
+ next: 'Next step', init: 'Structure installed.', update: 'Structure updated.', sync: 'Pointers synchronized.', lang: 'Language configured.', unchanged: 'Structure is already current.', plan: 'Plan calculated; no files changed.', conflict: 'User files or edits conflict with this plan. Review it; --force backs them up before replacement.',
21
+ healthy: 'Structure verified.', unhealthy: 'The structure needs attention.', missing: 'AgentDevKit has not been initialized in this directory.', error: 'The operation could not be completed.', invalid: 'Invalid arguments.', language: 'Current language', version: 'Version', select: 'Idioma / Language / Idioma [pt/en/es] (pt): ',
22
+ project: 'Project', readme: 'AgentDevKit installed. Read AGENTS.md and follow the product, design and implementation stages.', state: 'AgentDevKit state and shared project configuration.',
23
+ agentLanguage: 'Respond in English unless the user requests another language.', inspect: 'Check the installation', workflow: 'Review the next stage', install: 'Initialize this project', repair: 'Check synchronization', review: 'Review conflicting files', tools: 'Tool result',
24
+ },
25
+ es: {
26
+ help: 'AgentDevKit: init [directorio], update, doctor, sync [--check], lang [pt|en|es], agents [lista], next, tools <acción>.\nOpciones: --target <directorio>, --lang <idioma>, --agents <lista>, --yes, --dry-run, --force, --json.\nAlias: --clients y clients.',
27
+ clientsCurrent: 'Agentes seleccionados', clientsAvailable: 'Agentes disponibles', clientsSelect: 'Agentes (IDs separados por coma o all) [all]: ', agents: 'Selección de agentes actualizada.',
28
+ next: 'Próximo paso', init: 'Estructura instalada.', update: 'Estructura actualizada.', sync: 'Referencias sincronizadas.', lang: 'Idioma configurado.', unchanged: 'La estructura ya está actualizada.', plan: 'Plan calculado; ningún archivo modificado.', conflict: 'Hay archivos propios o cambios en conflicto. Revise el plan; --force guarda una copia antes de reemplazarlos.',
29
+ healthy: 'Estructura verificada.', unhealthy: 'La estructura necesita ajustes.', missing: 'AgentDevKit no se ha inicializado en este directorio.', error: 'No se pudo completar la operación.', invalid: 'Argumentos inválidos.', language: 'Idioma actual', version: 'Versión', select: 'Idioma / Language / Idioma [pt/en/es] (pt): ',
30
+ project: 'Proyecto', readme: 'AgentDevKit instalado. Lea AGENTS.md y siga las etapas de producto, diseño e implementación.', state: 'Estado de AgentDevKit y configuración compartida del proyecto.',
31
+ agentLanguage: 'Responde en español salvo que el usuario solicite otro idioma.', inspect: 'Compruebe la instalación', workflow: 'Consulte la siguiente etapa', install: 'Inicialice este proyecto', repair: 'Compruebe la sincronización', review: 'Revise los archivos en conflicto', tools: 'Resultado de la herramienta',
32
+ },
33
+ };
34
+ export const text = (language, key) => messages[language || 'pt'][key] || key;
35
+ export function explainError(language, code) {
36
+ const value = {
37
+ pt: { E_ARGS: 'Argumentos inválidos; consulte --help.', E_STATE: 'O estado do AgentDevKit está inválido.', E_SYMLINK: 'Um link simbólico impede a operação segura.', E_TARGET: 'Escolha uma pasta real e segura como destino.', E_PATH: 'Um caminho gerenciado é inválido.', E_BLOCK: 'Os marcadores do bloco gerenciado estão inválidos.', E_CHANGED: 'Um arquivo mudou depois do planejamento; execute novamente.', E_TEMPLATE: 'Um template necessário está inválido.' },
38
+ en: { E_ARGS: 'Invalid arguments; see --help.', E_STATE: 'AgentDevKit state is invalid.', E_SYMLINK: 'A symbolic link prevents this operation.', E_TARGET: 'Choose a real, safe target directory.', E_PATH: 'A managed path is invalid.', E_BLOCK: 'Managed block markers are invalid.', E_CHANGED: 'A file changed after planning; try again.', E_TEMPLATE: 'A required template is invalid.' },
39
+ es: { E_ARGS: 'Argumentos inválidos; consulte --help.', E_STATE: 'El estado de AgentDevKit no es válido.', E_SYMLINK: 'Un enlace simbólico impide la operación segura.', E_TARGET: 'Elija un directorio real y seguro.', E_PATH: 'Una ruta administrada no es válida.', E_BLOCK: 'Los marcadores del bloque no son válidos.', E_CHANGED: 'Un archivo cambió después del plan; ejecute de nuevo.', E_TEMPLATE: 'Una plantilla necesaria no es válida.' },
40
+ };
41
+ return value[language || 'pt'][code] || text(language, code === 'E_MISSING' ? 'missing' : code === 'E_CONFLICT' ? 'conflict' : 'error');
42
+ }