@pathbit/agentdevkit 0.0.0-stage → 0.0.6

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 (242) hide show
  1. package/.pbai4devs/COMPATIBILIDADE.md +109 -0
  2. package/.pbai4devs/INSTRUCTIONS.md +87 -0
  3. package/.pbai4devs/README.md +53 -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 +65 -0
  196. package/CONTRIBUTING.md +73 -0
  197. package/LICENSE +21 -0
  198. package/README.en.md +89 -0
  199. package/README.es.md +91 -0
  200. package/README.md +94 -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 +86 -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 +87 -0
  216. package/docs/product/README.md +12 -0
  217. package/docs/product/design.md +104 -0
  218. package/docs/product/prd.md +70 -0
  219. package/docs/product/roadmap.md +38 -0
  220. package/docs/product/ux-ui.md +42 -0
  221. package/docs/specs/README.md +21 -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/docs/specs/v0.0.6/README.md +10 -0
  234. package/docs/specs/v0.0.6/SPEC.md +77 -0
  235. package/package.json +67 -4
  236. package/src/README.md +16 -0
  237. package/src/adapters/index.mjs +1 -0
  238. package/src/cli.mjs +162 -0
  239. package/src/config.mjs +14 -0
  240. package/src/i18n.mjs +42 -0
  241. package/src/install.mjs +373 -0
  242. package/src/next.mjs +79 -0
@@ -0,0 +1,192 @@
1
+ #!/usr/bin/env node
2
+ // Exercita CLIs instaladas; resultados ficam em .agent-tests, sem instalar pacotes.
3
+ import assert from 'node:assert/strict';
4
+ import { spawnSync } from 'node:child_process';
5
+ import { createHash } from 'node:crypto';
6
+ import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
7
+ import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+ import { requireNode } from '../../lib/runtime.mjs';
10
+
11
+ requireNode();
12
+ const here = dirname(fileURLToPath(import.meta.url));
13
+ const project = resolve(here, '../../../..');
14
+ const manager = resolve(here, '../SCRIPT.mjs');
15
+ const artifacts = join(project, '.agent-tests/vercel-labs');
16
+ mkdirSync(artifacts, { recursive: true });
17
+ const runRoot = mkdtempSync(join(artifacts, 'smoke-'));
18
+ const reportFile = join(runRoot, 'REPORT.json');
19
+ const report = {
20
+ startedAt: new Date().toISOString(),
21
+ scope: 'CLIs locais com fixtures; sem browser, produto, proxy, TLS ou chamadas de modelo.',
22
+ limitations: [
23
+ 'Probes de versão/ajuda comprovam inicialização, não o fluxo de um produto.',
24
+ 'webreel valida e resolve roteiro; gravação de vídeo e Chrome não são exercitados.',
25
+ 'opensrc lista cache local; resolução de registries e download de fontes não são exercitados.',
26
+ ],
27
+ steps: [],
28
+ };
29
+ let sequence = 0;
30
+
31
+ function snapshot(folder) {
32
+ if (!existsSync(folder)) return null;
33
+ const entries = [];
34
+ function visit(base, path = '') {
35
+ for (const name of readdirSync(base).sort()) {
36
+ const file = join(base, name);
37
+ const item = path ? `${path}/${name}` : name;
38
+ const stat = lstatSync(file);
39
+ if (stat.isSymbolicLink()) entries.push({ path: item, type: 'symlink' });
40
+ else if (stat.isDirectory()) { entries.push({ path: item, type: 'directory' }); visit(file, item); }
41
+ else entries.push({ path: item, type: 'file', sha256: createHash('sha256').update(readFileSync(file)).digest('hex') });
42
+ }
43
+ }
44
+ visit(folder);
45
+ return entries;
46
+ }
47
+
48
+ function fixture(name) {
49
+ const folder = join(runRoot, name);
50
+ cpSync(join(here, 'fixtures-vercel', name), folder, { recursive: true });
51
+ return folder;
52
+ }
53
+
54
+ function stateDirectory(tool, variable) {
55
+ const config = JSON.parse(readFileSync(join(project, '.pbai4devs/tools', tool, 'TOOL.json'), 'utf8'));
56
+ assert.equal(typeof config.envPaths?.[variable], 'string', `TOOL.json deve isolar ${variable} via envPaths.`);
57
+ const local = join(project, '.pbai4devs/tools', tool, '.local');
58
+ const state = resolve(local, config.envPaths[variable]);
59
+ const traversal = relative(local, state);
60
+ assert.ok(traversal && !isAbsolute(traversal) && traversal !== '..' && !traversal.startsWith('../') && !traversal.startsWith('..\\'), `${variable} fora da instalação local.`);
61
+ return state;
62
+ }
63
+
64
+ function run(tool, args, cwd) {
65
+ const command = [manager, 'run', tool, ...args];
66
+ const result = spawnSync(process.execPath, command, {
67
+ cwd,
68
+ encoding: 'utf8',
69
+ timeout: 30000,
70
+ maxBuffer: 4 * 1024 * 1024,
71
+ windowsHide: true,
72
+ env: { ...process.env, CI: '1', NO_COLOR: '1', DISABLE_TELEMETRY: '1', DO_NOT_TRACK: '1', NO_UPDATE_NOTIFIER: '1' },
73
+ });
74
+ const log = join(runRoot, `${String(++sequence).padStart(2, '0')}-${tool}.json`);
75
+ writeFileSync(log, JSON.stringify({ executable: process.execPath, args: command, cwd, status: result.status, signal: result.signal, error: result.error?.message, stdout: result.stdout, stderr: result.stderr }, null, 2) + '\n');
76
+ report.steps.at(-1).logs.push(log);
77
+ assert.ifError(result.error);
78
+ assert.equal(result.signal, null, `${tool}: processo interrompido; veja ${log}`);
79
+ assert.equal(result.status, 0, `${tool}: saída ${result.status}; veja ${log}`);
80
+ return result.stdout;
81
+ }
82
+
83
+ function check(name, kind, action) {
84
+ const step = { name, kind, status: 'running', logs: [] };
85
+ report.steps.push(step);
86
+ try {
87
+ const detail = action();
88
+ if (detail) step.detail = detail;
89
+ step.status = 'passed';
90
+ } catch (error) {
91
+ step.status = 'failed';
92
+ step.error = error.message;
93
+ process.exitCode = 1;
94
+ }
95
+ }
96
+
97
+ const tools = ['skills', 'just-bash', 'opensrc', 'webreel', 'portless'];
98
+ check('Instalações locais disponíveis', 'precondition', () => {
99
+ for (const name of tools) {
100
+ const folder = join(project, '.pbai4devs/tools', name);
101
+ assert.ok(existsSync(join(folder, 'TOOL.json')), `Definição ausente: ${name}. Configure antes de executar este smoke.`);
102
+ assert.ok(existsSync(join(folder, '.local/CURRENT.json')), `Ferramenta ausente: ${name}. Execute install ${name} antes deste smoke; ele não instala pacotes.`);
103
+ }
104
+ });
105
+
106
+ if (report.steps[0].status === 'passed') {
107
+ check('skills descobre skill local sem instalar nem criar apontamentos', 'functional', () => {
108
+ const cwd = fixture('skills');
109
+ const before = snapshot(cwd);
110
+ const state = stateDirectory('skills', 'XDG_STATE_HOME');
111
+ const stateBefore = snapshot(state);
112
+ const stdout = run('skills', ['add', join(cwd, 'agentdevkit-smoke'), '--list'], cwd);
113
+ assert.match(stdout, /agentdevkit-smoke/);
114
+ assert.deepEqual(snapshot(cwd), before, 'A listagem criou ou alterou arquivos, links, locks ou pastas de clientes.');
115
+ assert.deepEqual(snapshot(state), stateBefore, 'A listagem criou ou alterou estado/locks de skills fora do cwd.');
116
+ assert.ok(before.every(item => item.type !== 'symlink'));
117
+ });
118
+
119
+ check('just-bash executa cat e grep com saída JSON', 'functional', () => {
120
+ const cwd = fixture('just-bash');
121
+ const before = snapshot(cwd);
122
+ const result = JSON.parse(run('just-bash', ['--root', cwd, '-c', 'cat input.txt | grep agentdevkit', '--json'], cwd));
123
+ assert.equal(result.exitCode, 0);
124
+ assert.equal(result.stdout, 'agentdevkit example\n');
125
+ assert.equal(result.stderr, '');
126
+ assert.deepEqual(snapshot(cwd), before);
127
+ });
128
+
129
+ check('just-bash escreve no overlay sem persistir no disco', 'functional', () => {
130
+ const cwd = fixture('just-bash-overlay');
131
+ const before = snapshot(cwd);
132
+ const result = JSON.parse(run('just-bash', ['--root', cwd, '--allow-write', '-c', 'printf overlay > output.txt; cat output.txt', '--json'], cwd));
133
+ assert.equal(result.exitCode, 0);
134
+ assert.equal(result.stdout, 'overlay');
135
+ assert.equal(result.stderr, '');
136
+ assert.equal(existsSync(join(cwd, 'output.txt')), false);
137
+ assert.deepEqual(snapshot(cwd), before);
138
+ });
139
+
140
+ check('opensrc lista somente o cache local configurado', 'functional', () => {
141
+ const cache = stateDirectory('opensrc', 'OPENSRC_HOME');
142
+ const before = snapshot(cache);
143
+ const cwd = join(runRoot, 'opensrc');
144
+ mkdirSync(cwd);
145
+ const stdout = run('opensrc', ['list', '--json'], cwd).trim();
146
+ let detail;
147
+ if (stdout.startsWith('{')) {
148
+ const index = JSON.parse(stdout);
149
+ assert.ok(index && typeof index === 'object' && !Array.isArray(index));
150
+ for (const key of ['packages', 'repos']) if (index[key] !== undefined) assert.ok(Array.isArray(index[key]));
151
+ detail = 'Índice JSON local lido sem downloads.';
152
+ } else {
153
+ assert.match(stdout, /^No sources cached yet\./);
154
+ const indexFile = join(cache, 'sources.json');
155
+ const index = existsSync(indexFile) ? JSON.parse(readFileSync(indexFile, 'utf8')) : {};
156
+ assert.equal((index.packages?.length || 0) + (index.repos?.length || 0), 0);
157
+ detail = 'Cache vazio. A CLI upstream retorna texto mesmo com --json nesse estado.';
158
+ }
159
+ assert.deepEqual(snapshot(cache), before, 'A listagem alterou o cache.');
160
+ assert.deepEqual(readdirSync(cwd), []);
161
+ return detail;
162
+ });
163
+
164
+ check('webreel valida roteiro local e resolve dry-run sem gravar', 'functional', () => {
165
+ const cwd = fixture('webreel');
166
+ const config = join(cwd, 'webreel.config.json');
167
+ const before = snapshot(cwd);
168
+ assert.match(run('webreel', ['validate', '--config', config], cwd), /webreel\.config\.json: valid/);
169
+ const stdout = run('webreel', ['record', '--dry-run', '--config', config], cwd);
170
+ assert.match(stdout, /Resolved configuration/);
171
+ assert.match(stdout, /agentdevkit-smoke/);
172
+ assert.match(stdout, /pause 10ms/);
173
+ assert.match(stdout, /index\.html/);
174
+ assert.deepEqual(snapshot(cwd), before, 'O dry-run criou artefatos ou alterou a fixture.');
175
+ });
176
+
177
+ check('portless inicia versão e ajuda sem iniciar proxy', 'probe', () => {
178
+ const cwd = join(runRoot, 'portless');
179
+ mkdirSync(cwd);
180
+ const state = stateDirectory('portless', 'PORTLESS_STATE_DIR');
181
+ const stateBefore = snapshot(state);
182
+ assert.match(run('portless', ['--version'], cwd), /\d+\.\d+\.\d+/);
183
+ assert.match(run('portless', ['--help'], cwd), /portless/i);
184
+ assert.deepEqual(readdirSync(cwd), []);
185
+ assert.deepEqual(snapshot(state), stateBefore, 'Versão/ajuda criaram ou alteraram estado do proxy.');
186
+ });
187
+ }
188
+
189
+ report.completedAt = new Date().toISOString();
190
+ report.status = report.steps.every(step => step.status === 'passed') ? 'passed' : 'failed';
191
+ writeFileSync(reportFile, JSON.stringify(report, null, 2) + '\n');
192
+ console.log(JSON.stringify({ status: report.status, passed: report.steps.filter(step => step.status === 'passed').length, failed: report.steps.filter(step => step.status === 'failed').length, report: reportFile }));