@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.
- package/.pbai4devs/COMPATIBILIDADE.md +109 -0
- package/.pbai4devs/INSTRUCTIONS.md +87 -0
- package/.pbai4devs/README.md +53 -0
- package/.pbai4devs/agents/README.md +18 -0
- package/.pbai4devs/agents/revisor/AGENT.md +16 -0
- package/.pbai4devs/agents/revisor/antigravity.yaml +8 -0
- package/.pbai4devs/agents/revisor/claude.yaml +5 -0
- package/.pbai4devs/agents/revisor/cursor.yaml +5 -0
- package/.pbai4devs/agents/revisor/gemini.yaml +6 -0
- package/.pbai4devs/agents/revisor/github.yaml +5 -0
- package/.pbai4devs/agents/revisor/kimi-code.yaml +5 -0
- package/.pbai4devs/agents/revisor/mimocode.yaml +10 -0
- package/.pbai4devs/agents/revisor/opencode.yaml +7 -0
- package/.pbai4devs/agents/revisor/zcode.yaml +5 -0
- package/.pbai4devs/commands/README.md +30 -0
- package/.pbai4devs/commands/atualizar-ferramentas/COMMAND.md +17 -0
- package/.pbai4devs/commands/diagnosticar/COMMAND.md +18 -0
- package/.pbai4devs/commands/instalar-ferramentas/COMMAND.md +21 -0
- package/.pbai4devs/commands/preparar-dev/COMMAND.md +14 -0
- package/.pbai4devs/commands/proximos-passos/COMMAND.md +9 -0
- package/.pbai4devs/commands/revisar-entrega/COMMAND.md +29 -0
- package/.pbai4devs/commands/sincronizar/COMMAND.md +20 -0
- package/.pbai4devs/commands/status-roadmap/COMMAND.md +12 -0
- package/.pbai4devs/commands/testar-navegador/COMMAND.md +16 -0
- package/.pbai4devs/commands/verificar-agentes/COMMAND.md +19 -0
- package/.pbai4devs/estado/README.md +12 -0
- package/.pbai4devs/external-skills/CATALOG.json +121 -0
- package/.pbai4devs/external-skills/README.md +48 -0
- package/.pbai4devs/rules/README.md +18 -0
- package/.pbai4devs/rules/ambiente-local/RULE.md +33 -0
- package/.pbai4devs/rules/ambiente-local/cursor.yaml +4 -0
- package/.pbai4devs/rules/documentacao/RULE.md +11 -0
- package/.pbai4devs/rules/documentacao/cursor.yaml +4 -0
- package/.pbai4devs/rules/estrutura/RULE.md +33 -0
- package/.pbai4devs/rules/estrutura/cursor.yaml +4 -0
- package/.pbai4devs/rules/git/RULE.md +18 -0
- package/.pbai4devs/rules/git/cursor.yaml +4 -0
- package/.pbai4devs/rules/proximos-passos/RULE.md +14 -0
- package/.pbai4devs/rules/qualidade/RULE.md +32 -0
- package/.pbai4devs/rules/qualidade/cursor.yaml +4 -0
- package/.pbai4devs/scripts/README.md +69 -0
- package/.pbai4devs/scripts/diagnosticar-ambiente/SCRIPT.mjs +41 -0
- package/.pbai4devs/scripts/diagnosticar-ambiente/tests/TEST.mjs +30 -0
- package/.pbai4devs/scripts/executar-script/README.md +28 -0
- package/.pbai4devs/scripts/executar-script/SCRIPT.mjs +78 -0
- package/.pbai4devs/scripts/executar-script/tests/TEST.mjs +122 -0
- package/.pbai4devs/scripts/gerenciar-skills-externas/README.md +31 -0
- package/.pbai4devs/scripts/gerenciar-skills-externas/SCRIPT.mjs +182 -0
- package/.pbai4devs/scripts/gerenciar-skills-externas/tests/TEST.mjs +134 -0
- package/.pbai4devs/scripts/inspecionar-projeto/SCRIPT.mjs +190 -0
- package/.pbai4devs/scripts/inspecionar-projeto/tests/TEST.mjs +161 -0
- package/.pbai4devs/scripts/lib/README.md +9 -0
- package/.pbai4devs/scripts/lib/adapters.mjs +135 -0
- package/.pbai4devs/scripts/lib/catalog.mjs +170 -0
- package/.pbai4devs/scripts/lib/gitignore.mjs +348 -0
- package/.pbai4devs/scripts/lib/npm.mjs +17 -0
- package/.pbai4devs/scripts/lib/resource-path.mjs +20 -0
- package/.pbai4devs/scripts/lib/runtime.mjs +28 -0
- package/.pbai4devs/scripts/lib/script-config.mjs +8 -0
- package/.pbai4devs/scripts/preparar-ferramentas/BOOTSTRAP.md +34 -0
- package/.pbai4devs/scripts/preparar-ferramentas/BOOTSTRAP.mjs +189 -0
- package/.pbai4devs/scripts/preparar-ferramentas/README.md +71 -0
- package/.pbai4devs/scripts/preparar-ferramentas/SCRIPT.mjs +455 -0
- package/.pbai4devs/scripts/preparar-ferramentas/tests/FIXTURE.html +20 -0
- package/.pbai4devs/scripts/preparar-ferramentas/tests/SMOKE_BROWSER.mjs +55 -0
- package/.pbai4devs/scripts/preparar-ferramentas/tests/SMOKE_DESKTOP.mjs +61 -0
- package/.pbai4devs/scripts/preparar-ferramentas/tests/SMOKE_VERCEL.mjs +192 -0
- package/.pbai4devs/scripts/preparar-ferramentas/tests/TEST.mjs +552 -0
- package/.pbai4devs/scripts/preparar-ferramentas/tests/bootstrap.test.mjs +94 -0
- package/.pbai4devs/scripts/preparar-ferramentas/tests/fixtures-vercel/just-bash/input.txt +2 -0
- package/.pbai4devs/scripts/preparar-ferramentas/tests/fixtures-vercel/just-bash-overlay/input.txt +1 -0
- package/.pbai4devs/scripts/preparar-ferramentas/tests/fixtures-vercel/skills/agentdevkit-smoke/SKILL.md +8 -0
- package/.pbai4devs/scripts/preparar-ferramentas/tests/fixtures-vercel/webreel/index.html +6 -0
- package/.pbai4devs/scripts/preparar-ferramentas/tests/fixtures-vercel/webreel/webreel.config.json +10 -0
- package/.pbai4devs/scripts/revisar-entrega/README.md +36 -0
- package/.pbai4devs/scripts/revisar-entrega/SCRIPT.mjs +249 -0
- package/.pbai4devs/scripts/revisar-entrega/tests/TEST.mjs +249 -0
- package/.pbai4devs/scripts/sincronizar-agentes/README.md +41 -0
- package/.pbai4devs/scripts/sincronizar-agentes/SCRIPT.mjs +473 -0
- package/.pbai4devs/scripts/sincronizar-agentes/tests/LOCAL_IGNORE.mjs +290 -0
- package/.pbai4devs/scripts/sincronizar-agentes/tests/TEST.mjs +869 -0
- package/.pbai4devs/scripts/testar-infraestrutura/SCRIPT.mjs +39 -0
- package/.pbai4devs/scripts/testar-infraestrutura/tests/TEST.mjs +29 -0
- package/.pbai4devs/scripts/testar-maturidade/README.md +54 -0
- package/.pbai4devs/scripts/testar-maturidade/SCRIPT.mjs +477 -0
- package/.pbai4devs/scripts/testar-maturidade/assets/calculator.mjs +1 -0
- package/.pbai4devs/scripts/testar-maturidade/assets/calculator.test.mjs.template +8 -0
- package/.pbai4devs/scripts/testar-maturidade/assets/http-api.test.mjs.template +28 -0
- package/.pbai4devs/scripts/testar-maturidade/assets/server.mjs +34 -0
- package/.pbai4devs/scripts/testar-maturidade/tests/TEST.mjs +305 -0
- package/.pbai4devs/scripts/testar-navegador/REFERENCE.md +49 -0
- package/.pbai4devs/scripts/testar-navegador/SCRIPT.conf +1 -0
- package/.pbai4devs/scripts/testar-navegador/SCRIPT.js +64 -0
- package/.pbai4devs/scripts/testar-navegador/tests/FAIL.js +8 -0
- package/.pbai4devs/scripts/testar-navegador/tests/SUCCESS.js +13 -0
- package/.pbai4devs/scripts/verificar-recursos/README.md +25 -0
- package/.pbai4devs/scripts/verificar-recursos/SCRIPT.mjs +209 -0
- package/.pbai4devs/scripts/verificar-recursos/tests/TEST.mjs +310 -0
- package/.pbai4devs/scripts/verificar-recursos/tests/ambiente-local.mjs +80 -0
- package/.pbai4devs/skills/README.md +24 -0
- package/.pbai4devs/skills/git/git-branch/SKILL.md +11 -0
- package/.pbai4devs/skills/git/git-commit/SKILL.md +16 -0
- package/.pbai4devs/skills/git/git-diff/SKILL.md +9 -0
- package/.pbai4devs/skills/git/git-fetch/SKILL.md +10 -0
- package/.pbai4devs/skills/git/git-log/SKILL.md +9 -0
- package/.pbai4devs/skills/git/git-merge/SKILL.md +13 -0
- package/.pbai4devs/skills/git/git-pull/SKILL.md +12 -0
- package/.pbai4devs/skills/git/git-push/SKILL.md +12 -0
- package/.pbai4devs/skills/git/git-status/SKILL.md +9 -0
- package/.pbai4devs/skills/git/git-worktree/SKILL.md +10 -0
- package/.pbai4devs/skills/produto/criar-design-doc/SKILL.md +37 -0
- package/.pbai4devs/skills/produto/criar-prd/SKILL.md +35 -0
- package/.pbai4devs/skills/produto/criar-ux-ui/SKILL.md +34 -0
- package/.pbai4devs/skills/projeto/atualizar-documentacao/SKILL.md +26 -0
- package/.pbai4devs/skills/projeto/configurar-projeto/SKILL.md +62 -0
- package/.pbai4devs/skills/projeto/criar-agente/SKILL.md +20 -0
- package/.pbai4devs/skills/projeto/criar-comando/SKILL.md +25 -0
- package/.pbai4devs/skills/projeto/criar-recurso/SKILL.md +41 -0
- package/.pbai4devs/skills/projeto/criar-regra/SKILL.md +19 -0
- package/.pbai4devs/skills/projeto/criar-skill/SKILL.md +22 -0
- package/.pbai4devs/skills/projeto/executar-script/SKILL.md +29 -0
- package/.pbai4devs/skills/projeto/preparar-dev/SKILL.md +45 -0
- package/.pbai4devs/skills/projeto/preparar-ferramentas/SKILL.md +56 -0
- package/.pbai4devs/skills/projeto/proximos-passos/SKILL.md +23 -0
- package/.pbai4devs/skills/projeto/sincronizar-agentes/SKILL.md +42 -0
- package/.pbai4devs/skills/projeto/usar-skills-externas/SKILL.md +28 -0
- package/.pbai4devs/skills/projeto/verificar-trabalho/SKILL.md +45 -0
- package/.pbai4devs/skills/specs/criar-spec/SKILL.md +33 -0
- package/.pbai4devs/skills/specs/gerenciar-roadmap/SKILL.md +26 -0
- package/.pbai4devs/skills/specs/implementar-spec/SKILL.md +48 -0
- package/.pbai4devs/templates/README.md +65 -0
- package/.pbai4devs/templates/adr/TEMPLATE.md +21 -0
- package/.pbai4devs/templates/ambiente-local/Makefile.template +48 -0
- package/.pbai4devs/templates/ambiente-local/TEMPLATE.md +48 -0
- package/.pbai4devs/templates/ambiente-local/compose.local.yml.template +16 -0
- package/.pbai4devs/templates/ambiente-local/dockerignore.template +28 -0
- package/.pbai4devs/templates/changelog/TEMPLATE.md +17 -0
- package/.pbai4devs/templates/claude/TEMPLATE.md +8 -0
- package/.pbai4devs/templates/clients/ADAPTERS.json +306 -0
- package/.pbai4devs/templates/clients/TEMPLATE.md +12 -0
- package/.pbai4devs/templates/comando/TEMPLATE.md +15 -0
- package/.pbai4devs/templates/configuracao/TEMPLATE.md +46 -0
- package/.pbai4devs/templates/configuracao-raiz/TEMPLATE.md +22 -0
- package/.pbai4devs/templates/configuracao-raiz/editorconfig.template +21 -0
- package/.pbai4devs/templates/configuracao-raiz/env.example.template +3 -0
- package/.pbai4devs/templates/configuracao-raiz/gitattributes.template +6 -0
- package/.pbai4devs/templates/contribuicao/TEMPLATE.md +23 -0
- package/.pbai4devs/templates/design/TEMPLATE.md +30 -0
- package/.pbai4devs/templates/entrypoints/AGENTS.md +19 -0
- package/.pbai4devs/templates/entrypoints/CLAUDE.md +7 -0
- package/.pbai4devs/templates/entrypoints/GEMINI.md +7 -0
- package/.pbai4devs/templates/entrypoints/TEMPLATE.md +12 -0
- package/.pbai4devs/templates/gitignore/TEMPLATE.md +42 -0
- package/.pbai4devs/templates/gitignore/agents.ignore +45 -0
- package/.pbai4devs/templates/gitignore/clients.json +20 -0
- package/.pbai4devs/templates/gitignore/local.ignore +10 -0
- package/.pbai4devs/templates/gitignore/shared.ignore +60 -0
- package/.pbai4devs/templates/instrucoes-agentes/TEMPLATE.md +25 -0
- package/.pbai4devs/templates/plano-implementacao/TEMPLATE.md +27 -0
- package/.pbai4devs/templates/prd/TEMPLATE.md +30 -0
- package/.pbai4devs/templates/readme-pasta/TEMPLATE.md +16 -0
- package/.pbai4devs/templates/readme-projeto/TEMPLATE.md +34 -0
- package/.pbai4devs/templates/release/TEMPLATE.md +23 -0
- package/.pbai4devs/templates/revisao-entrega/TEMPLATE.md +41 -0
- package/.pbai4devs/templates/roadmap/TEMPLATE.md +18 -0
- package/.pbai4devs/templates/seguranca/TEMPLATE.md +22 -0
- package/.pbai4devs/templates/spec/TEMPLATE.md +61 -0
- package/.pbai4devs/templates/tasks/TEMPLATE.md +20 -0
- package/.pbai4devs/templates/ux-ui/TEMPLATE.md +26 -0
- package/.pbai4devs/tools/README.md +87 -0
- package/.pbai4devs/tools/agent-browser/README.md +26 -0
- package/.pbai4devs/tools/agent-browser/SCRIPT.mjs +5 -0
- package/.pbai4devs/tools/agent-browser/TOOL.json +33 -0
- package/.pbai4devs/tools/agent-desktop/README.md +26 -0
- package/.pbai4devs/tools/agent-desktop/SCRIPT.mjs +5 -0
- package/.pbai4devs/tools/agent-desktop/TOOL.json +30 -0
- package/.pbai4devs/tools/just-bash/README.md +23 -0
- package/.pbai4devs/tools/just-bash/SCRIPT.mjs +5 -0
- package/.pbai4devs/tools/just-bash/TOOL.json +27 -0
- package/.pbai4devs/tools/markdownlint-cli2/README.md +18 -0
- package/.pbai4devs/tools/markdownlint-cli2/SCRIPT.mjs +5 -0
- package/.pbai4devs/tools/markdownlint-cli2/TOOL.json +28 -0
- package/.pbai4devs/tools/opensrc/README.md +25 -0
- package/.pbai4devs/tools/opensrc/SCRIPT.mjs +5 -0
- package/.pbai4devs/tools/opensrc/TOOL.json +29 -0
- package/.pbai4devs/tools/portless/README.md +21 -0
- package/.pbai4devs/tools/portless/SCRIPT.mjs +5 -0
- package/.pbai4devs/tools/portless/TOOL.json +30 -0
- package/.pbai4devs/tools/skills/README.md +24 -0
- package/.pbai4devs/tools/skills/SCRIPT.mjs +5 -0
- package/.pbai4devs/tools/skills/TOOL.json +33 -0
- package/.pbai4devs/tools/webreel/README.md +23 -0
- package/.pbai4devs/tools/webreel/SCRIPT.mjs +5 -0
- package/.pbai4devs/tools/webreel/TOOL.json +25 -0
- package/CHANGELOG.md +65 -0
- package/CONTRIBUTING.md +73 -0
- package/LICENSE +21 -0
- package/README.en.md +89 -0
- package/README.es.md +91 -0
- package/README.md +94 -2
- package/bin/README.md +8 -0
- package/bin/agentdevkit.mjs +35 -0
- package/docs/README.md +81 -0
- package/docs/guides/README.md +14 -0
- package/docs/guides/cli.md +81 -0
- package/docs/guides/installation.md +86 -0
- package/docs/guides/resources.md +121 -0
- package/docs/guides/tools-and-testing.md +85 -0
- package/docs/guides/troubleshooting.md +151 -0
- package/docs/guides/workflow.md +130 -0
- package/docs/maintainers/README.md +12 -0
- package/docs/maintainers/community.md +49 -0
- package/docs/maintainers/development.md +54 -0
- package/docs/maintainers/maintenance.md +104 -0
- package/docs/maintainers/packages.md +87 -0
- package/docs/product/README.md +12 -0
- package/docs/product/design.md +104 -0
- package/docs/product/prd.md +70 -0
- package/docs/product/roadmap.md +38 -0
- package/docs/product/ux-ui.md +42 -0
- package/docs/specs/README.md +21 -0
- package/docs/specs/github-packages/SPEC.md +45 -0
- package/docs/specs/v0.0.1/README.md +10 -0
- package/docs/specs/v0.0.1/SPEC.md +57 -0
- package/docs/specs/v0.0.2/README.md +10 -0
- package/docs/specs/v0.0.2/SPEC.md +67 -0
- package/docs/specs/v0.0.3/README.md +10 -0
- package/docs/specs/v0.0.3/SPEC.md +64 -0
- package/docs/specs/v0.0.4/README.md +10 -0
- package/docs/specs/v0.0.4/SPEC.md +53 -0
- package/docs/specs/v0.0.5/README.md +9 -0
- package/docs/specs/v0.0.5/SPEC.md +42 -0
- package/docs/specs/v0.0.6/README.md +10 -0
- package/docs/specs/v0.0.6/SPEC.md +77 -0
- package/package.json +67 -4
- package/src/README.md +16 -0
- package/src/adapters/index.mjs +1 -0
- package/src/cli.mjs +162 -0
- package/src/config.mjs +14 -0
- package/src/i18n.mjs +42 -0
- package/src/install.mjs +373 -0
- package/src/next.mjs +79 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { spawnSync } from 'node:child_process';
|
|
6
|
+
import { checkReview, prepareReview, sealReview, specCriteria } from '../SCRIPT.mjs';
|
|
7
|
+
import { projectRoot } from '../../lib/runtime.mjs';
|
|
8
|
+
|
|
9
|
+
function fixture(t) {
|
|
10
|
+
mkdirSync(join(projectRoot, '.agent-tests'), { recursive: true });
|
|
11
|
+
const root = mkdtempSync(join(projectRoot, '.agent-tests/review-'));
|
|
12
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
13
|
+
const git = (...args) => {
|
|
14
|
+
const result = spawnSync('git', args, { cwd: root, encoding: 'utf8' });
|
|
15
|
+
assert.equal(result.status, 0, result.stderr); return result.stdout;
|
|
16
|
+
};
|
|
17
|
+
git('init', '-q');
|
|
18
|
+
const put = (file, body) => { mkdirSync(dirname(join(root, file)), { recursive: true }); writeFileSync(join(root, file), body); };
|
|
19
|
+
put('.gitignore', '/.agent-tests/\n'); put('README.md', '# Projeto\n'); put('src/main.mjs', 'export const value=1;\n');
|
|
20
|
+
put('spec.md', '# Spec\n\n## Critérios de aceite\n\n| ID | Resultado |\n| --- | --- |\n| AC-001 | Um |\n| AC-002 | Dois |\n\n## Dependências\n\nNenhuma.\n');
|
|
21
|
+
return { root, git, put };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function approved(t, options = {}, setup = () => {}, seal = true) {
|
|
25
|
+
const f = fixture(t);
|
|
26
|
+
setup(f);
|
|
27
|
+
const made = prepareReview({ root: f.root, id: 'mudanca', execution: 'exec-1', scope: ['src/main.mjs'], spec: 'spec.md', ...options });
|
|
28
|
+
const report = made.report;
|
|
29
|
+
for (const item of report.documentation) Object.assign(item, { decision: 'no-impact', reason: 'Comportamento externo preservado; revisado.' });
|
|
30
|
+
const proof = '.agent-tests/mudanca/exec-1/test.txt'; f.put(proof, 'teste real de fixture passou\n');
|
|
31
|
+
for (const item of report.validation) Object.assign(item, { method: 'node --test', prerequisite: 'Node 24', assertion: 'Resultado esperado presente', evidence: [proof], status: 'passed' });
|
|
32
|
+
report.review = { status: 'approved', reviewer: 'revisor-independente', findings: [] };
|
|
33
|
+
const save = () => f.put(made.file, JSON.stringify(report, null, 2)); save();
|
|
34
|
+
if (seal) sealReview(made.file, { root: f.root });
|
|
35
|
+
return { ...f, ...made, save, proof };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
test('aprova relatorio completo e liga spec, documentos e evidencias ignoradas', t => {
|
|
39
|
+
const f = approved(t);
|
|
40
|
+
assert.equal(checkReview(f.file, { root: f.root }).status, 'passed');
|
|
41
|
+
assert.equal(f.report.validation.length, 2);
|
|
42
|
+
assert.ok(f.report.snapshot.files.some(item => item.path === 'README.md'));
|
|
43
|
+
assert.ok(f.report.snapshot.files.some(item => item.path === 'spec.md'));
|
|
44
|
+
assert.equal(f.git('ls-files', '--', '.agent-tests').trim(), '');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('instrucoes existentes entram na revisao e mudancas posteriores invalidam o selo', async t => {
|
|
48
|
+
for (const file of ['AGENTS.md', 'CLAUDE.md', 'GEMINI.md']) await t.test(file, t => {
|
|
49
|
+
const f = approved(t, {}, f => f.put(file, '# Instrucoes\n'));
|
|
50
|
+
assert.ok(f.report.documentation.some(item => item.path === file));
|
|
51
|
+
assert.ok(f.report.snapshot.files.some(item => item.path === file));
|
|
52
|
+
f.put(file, '# Instrucoes alteradas\n');
|
|
53
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /mudaram/);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('instrucoes criadas apos o preparo exigem novo snapshot mesmo em escopo limitado', async t => {
|
|
58
|
+
for (const file of ['AGENTS.md', 'CLAUDE.md', 'GEMINI.md']) await t.test(file, t => {
|
|
59
|
+
const f = approved(t, {}, () => {}, false);
|
|
60
|
+
f.put(file, '# Novas instrucoes\n');
|
|
61
|
+
f.report.documentation.push({ path: file, decision: 'no-impact', reason: 'Revisado apos o preparo.' });
|
|
62
|
+
f.save();
|
|
63
|
+
assert.throws(() => sealReview(f.file, { root: f.root }), /Documentos obrigatorios mudaram/);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('relatorio inicial nao aprova entrega nem sobrescreve evidencias anteriores', t => {
|
|
68
|
+
const f = fixture(t);
|
|
69
|
+
const options = { root: f.root, id: 'mudanca', execution: 'exec-1', scope: ['src/main.mjs'] };
|
|
70
|
+
const result = prepareReview(options);
|
|
71
|
+
assert.throws(() => checkReview(result.file, { root: f.root }), /pendente|invalida/);
|
|
72
|
+
assert.throws(() => prepareReview(options), /ja existe/);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('mudanca de codigo, spec ou documento depois do snapshot exige nova revisao', async t => {
|
|
76
|
+
for (const file of ['src/main.mjs', 'spec.md', 'README.md']) await t.test(file, t => {
|
|
77
|
+
const f = approved(t); f.put(file, readFileSync(join(f.root, file), 'utf8') + '\nMudanca posterior.');
|
|
78
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /mudaram/);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('em modo git um novo arquivo elegivel invalida a revisao', t => {
|
|
83
|
+
const f = approved(t, { scope: [] });
|
|
84
|
+
f.put('novo.mjs', 'export {};');
|
|
85
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /mudaram/);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('todos os criterios precisam resultado e prova; nao executado nao e aprovado', async t => {
|
|
89
|
+
for (const status of ['pending', 'failed', 'not-run', 'not-applicable']) await t.test(status, t => {
|
|
90
|
+
const f = approved(t); f.report.validation[0].status = status; f.save();
|
|
91
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /sem prova/);
|
|
92
|
+
});
|
|
93
|
+
await t.test('criterio ausente', t => {
|
|
94
|
+
const f = approved(t); f.report.validation.pop(); f.save();
|
|
95
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /sem resultado/);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('provas vazias, fora do diretorio e forcadas no Git sao recusadas', async t => {
|
|
100
|
+
await t.test('vazia', t => { const f = approved(t); f.put(f.proof, ''); assert.throws(() => checkReview(f.file, { root: f.root }), /vazia/); });
|
|
101
|
+
await t.test('fora', t => { const f = approved(t); f.report.validation[0].evidence = ['README.md']; f.save(); assert.throws(() => checkReview(f.file, { root: f.root }), /Evidencia deve/); });
|
|
102
|
+
await t.test('versionada', t => { const f = approved(t); f.git('add', '-f', f.proof); assert.throws(() => checkReview(f.file, { root: f.root }), /indice Git/); });
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test('sem impacto exige motivo; omitir documento ou deixar achado aberto bloqueia', async t => {
|
|
106
|
+
await t.test('motivo', t => { const f = approved(t); f.report.documentation[0].reason = ''; f.save(); assert.throws(() => checkReview(f.file, { root: f.root }), /documentacao/); });
|
|
107
|
+
await t.test('documento', t => { const f = approved(t); f.report.documentation = []; f.save(); assert.throws(() => checkReview(f.file, { root: f.root }), /sem revisao/); });
|
|
108
|
+
await t.test('achado', t => { const f = approved(t); f.report.review.findings.push({ id: 'R1', description: 'Correcao necessaria', status: 'open' }); f.save(); assert.throws(() => checkReview(f.file, { root: f.root }), /abertos/); });
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test('caminhos perigosos e relatorios fora de local ignorado sao recusados', t => {
|
|
112
|
+
const f = fixture(t);
|
|
113
|
+
for (const scope of [['../fora'], ['.git/config']]) assert.throws(() => prepareReview({ root: f.root, id: 'mudanca', scope }), /fora do escopo/);
|
|
114
|
+
f.put('.gitignore', '');
|
|
115
|
+
assert.throws(() => prepareReview({ root: f.root, id: 'mudanca', scope: ['src/main.mjs'] }), /ignorado/);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('links simbolicos nao viram prova ou documento autorizado', t => {
|
|
119
|
+
const f = approved(t); const target = '.agent-tests/mudanca/exec-1/link.txt';
|
|
120
|
+
try { symlinkSync(join(f.root, f.proof), join(f.root, target)); }
|
|
121
|
+
catch (error) { if (['EPERM', 'EACCES'].includes(error.code)) return t.skip('Sem permissao de symlink.'); throw error; }
|
|
122
|
+
f.report.validation[0].evidence = [target]; f.save();
|
|
123
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /simbolico/);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test('spec sem IDs claros nao passa pelo preparo', () => {
|
|
127
|
+
assert.throws(() => specCriteria('## Critérios de aceite\n\nFunciona.\n'), /AC-001/);
|
|
128
|
+
assert.deepEqual(specCriteria('## Critérios de aceite\nAC-001\nAC-001\n\n## Referências\nAC-999'), ['AC-001']);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test('placeholders no plano nao contam como validacao definida', t => {
|
|
132
|
+
const f = approved(t); f.report.validation[0].assertion = 'A definir.'; f.save();
|
|
133
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /incompleto/);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test('documento extra nao Markdown permanece obrigatorio e protegido pelo snapshot', t => {
|
|
137
|
+
const f = fixture(t); f.put('api/openapi.yaml', 'openapi: 3.1.0\n');
|
|
138
|
+
const made = prepareReview({ root: f.root, id: 'mudanca', execution: 'extra', scope: ['src/main.mjs'], documents: ['api/openapi.yaml'] });
|
|
139
|
+
assert.ok(made.report.snapshot.documents.includes('api/openapi.yaml'));
|
|
140
|
+
assert.ok(made.report.snapshot.files.some(file => file.path === 'api/openapi.yaml'));
|
|
141
|
+
made.report.documentation = made.report.documentation.filter(item => item.path !== 'api/openapi.yaml');
|
|
142
|
+
for (const item of made.report.documentation) Object.assign(item, { decision: 'no-impact', reason: 'Revisado sem alteracao.' });
|
|
143
|
+
f.put(made.file, JSON.stringify(made.report));
|
|
144
|
+
assert.throws(() => checkReview(made.file, { root: f.root }), /Documento sem revisao/);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test('spec e documento de referencia nao podem ser artefatos ignorados', t => {
|
|
148
|
+
const f = fixture(t); f.put('.agent-tests/spec.md', readFileSync(join(f.root, 'spec.md')));
|
|
149
|
+
assert.throws(() => prepareReview({ root: f.root, id: 'mudanca', spec: '.agent-tests/spec.md' }), /versionavel/);
|
|
150
|
+
assert.throws(() => prepareReview({ root: f.root, id: 'mudanca', documents: ['.agent-tests/relatorio.txt'] }), /versionavel/);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test('remover referencia da spec do relatorio nao remove sua obrigatoriedade', t => {
|
|
154
|
+
const f = approved(t); f.report.spec = null; f.save();
|
|
155
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /Baseline|referencias alteradas/);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test('indice Git precisa corresponder ao codigo testado antes de commit', t => {
|
|
159
|
+
const f = approved(t, {}, f => {
|
|
160
|
+
f.git('add', 'src/main.mjs');
|
|
161
|
+
f.put('src/main.mjs', 'export const value=2;\n');
|
|
162
|
+
}, false);
|
|
163
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /Indice Git difere/);
|
|
164
|
+
f.git('add', 'src/main.mjs');
|
|
165
|
+
sealReview(f.file, { root: f.root });
|
|
166
|
+
assert.equal(checkReview(f.file, { root: f.root }).status, 'passed');
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
test('alterar evidencia apos a aprovacao invalida o selo', t => {
|
|
170
|
+
const f = approved(t); f.put(f.proof, 'TESTE FALHOU\n');
|
|
171
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /apos selar/);
|
|
172
|
+
assert.throws(() => sealReview(f.file, { root: f.root }), /apos selar/);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test('remover spec e criterios do JSON nao altera a baseline do preparo', t => {
|
|
176
|
+
const f = approved(t);
|
|
177
|
+
f.report.spec = null; f.report.snapshot.spec = null;
|
|
178
|
+
f.report.snapshot.files = f.report.snapshot.files.filter(item => item.path !== 'spec.md');
|
|
179
|
+
f.report.snapshot.documents = f.report.snapshot.documents.filter(path => path !== 'spec.md');
|
|
180
|
+
f.report.validation.pop(); f.save();
|
|
181
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /Baseline/);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
test('check exige selo sem permitir bypass pela API', t => {
|
|
185
|
+
const f = approved(t, {}, () => {}, false);
|
|
186
|
+
assert.throws(() => checkReview(f.file, { root: f.root, requireSeal: false }), /nao selada/);
|
|
187
|
+
sealReview(f.file, { root: f.root });
|
|
188
|
+
assert.equal(checkReview(f.file, { root: f.root }).status, 'passed');
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
function stageUntrack(f, file = 'generated.md', ignore = true) {
|
|
192
|
+
f.put(file, '# Saida local\n');
|
|
193
|
+
f.git('add', '-f', '--', file);
|
|
194
|
+
f.git('-c', 'user.name=Test User', '-c', 'user.email=test@example.invalid', '-c', 'commit.gpgsign=false', '-c', 'core.hooksPath=disabled-hooks', 'commit', '-q', '-m', 'test: fixture base');
|
|
195
|
+
f.git('rm', '--cached', '--', file);
|
|
196
|
+
if (ignore) f.put('.git/info/exclude', `/${file}\n`);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
test('desindexação real registra ação e hash físico sem exigir documento local', async t => {
|
|
200
|
+
for (const scope of [[], ['generated.md']]) await t.test(scope.length ? 'scope' : 'git', t => {
|
|
201
|
+
const f = approved(t, { scope }, f => stageUntrack(f));
|
|
202
|
+
const file = f.report.snapshot.files.find(file => file.path === 'generated.md');
|
|
203
|
+
assert.equal(file.indexAction, 'untrack'); assert.match(file.sha256, /^[a-f0-9]{64}$/);
|
|
204
|
+
assert.equal(f.report.documentation.some(item => item.path === 'generated.md'), false);
|
|
205
|
+
assert.ok(existsSync(join(f.root, 'generated.md')));
|
|
206
|
+
assert.equal(f.git('ls-files', 'generated.md'), '');
|
|
207
|
+
assert.equal(checkReview(f.file, { root: f.root }).status, 'passed');
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
test('desindexação sem ignore continua bloqueada em git e scope', async t => {
|
|
212
|
+
for (const scope of [[], ['generated.md']]) await t.test(scope.length ? 'scope' : 'git', t => {
|
|
213
|
+
assert.throws(() => approved(t, { scope }, f => stageUntrack(f, 'generated.md', false)), /Indice Git difere/);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
test('mudanças no arquivo, índice ou ignore invalidam a revisão de desindexação', async t => {
|
|
218
|
+
const cases = [
|
|
219
|
+
['conteudo', f => f.put('generated.md', '# Editado depois\n')],
|
|
220
|
+
['indice', f => f.git('add', '-f', 'generated.md')],
|
|
221
|
+
['ignore', f => f.put('.git/info/exclude', '')],
|
|
222
|
+
['arquivo removido', f => rmSync(join(f.root, 'generated.md'))],
|
|
223
|
+
];
|
|
224
|
+
for (const [name, change] of cases) await t.test(name, t => {
|
|
225
|
+
const f = approved(t, { scope: [] }, f => stageUntrack(f));
|
|
226
|
+
change(f);
|
|
227
|
+
assert.throws(() => checkReview(f.file, { root: f.root }), /mudaram|desindexacao/);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test('entradas ignoradas fora do índice não entram nos documentos obrigatórios', t => {
|
|
232
|
+
const f = approved(t, {}, f => {
|
|
233
|
+
f.put('AGENTS.md', '# Gerado\n'); f.put('CLAUDE.md', '# Gerado\n'); f.put('GEMINI.md', '# Gerado\n');
|
|
234
|
+
f.put('.git/info/exclude', '/AGENTS.md\n/CLAUDE.md\n/GEMINI.md\n');
|
|
235
|
+
});
|
|
236
|
+
for (const name of ['AGENTS.md', 'CLAUDE.md', 'GEMINI.md']) assert.equal(f.report.documentation.some(item => item.path === name), false);
|
|
237
|
+
assert.equal(checkReview(f.file, { root: f.root }).status, 'passed');
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
test('documentos rastreados permanecem obrigatórios mesmo com regra de ignore', t => {
|
|
241
|
+
const f = approved(t, {}, f => {
|
|
242
|
+
f.put('AGENTS.md', '# Instrução versionada\n');
|
|
243
|
+
f.git('add', 'AGENTS.md', 'spec.md');
|
|
244
|
+
f.put('.git/info/exclude', '/AGENTS.md\n/spec.md\n');
|
|
245
|
+
});
|
|
246
|
+
assert.ok(f.report.documentation.some(item => item.path === 'AGENTS.md'));
|
|
247
|
+
assert.ok(f.report.documentation.some(item => item.path === 'spec.md'));
|
|
248
|
+
assert.equal(checkReview(f.file, { root: f.root }).status, 'passed');
|
|
249
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Gera catálogos e apontamentos a partir da origem compartilhada.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Sincronizar agentes
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
node .pbai4devs/scripts/sincronizar-agentes/SCRIPT.mjs --check
|
|
9
|
+
node .pbai4devs/scripts/sincronizar-agentes/SCRIPT.mjs --force
|
|
10
|
+
node --test .pbai4devs/scripts/sincronizar-agentes/tests/TEST.mjs
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`--check` só confere; a execução normal atualiza os recursos. `--force` salva
|
|
14
|
+
conflitos em `.agent-tests/` antes de reparar os caminhos gerenciados.
|
|
15
|
+
|
|
16
|
+
Metadados vêm da fonte ou do YAML nativo declarado no manifesto. Regras exigem
|
|
17
|
+
`trigger` válido; `glob` exige `globs`. Origens nativas precisam pertencer ao
|
|
18
|
+
catálogo; resultados, caches e pastas temporárias não entram nos índices.
|
|
19
|
+
|
|
20
|
+
`espelhos.conf` define `agente|pasta|layout`, pode ajustar cada tipo com
|
|
21
|
+
`formato|pasta|tipo|formato` e registrar `descoberta|.agents|antigravity`.
|
|
22
|
+
`agrupado` preserva a árvore; `plano` retira categorias; `arquivo` preserva
|
|
23
|
+
categorias e usa `nome.md`. `mdc`, `instrucoes`, `prompt` e `agente` produzem as
|
|
24
|
+
extensões nativas. A descoberta gera os três manifestos JSON do Antigravity.
|
|
25
|
+
Veja os motivos e limites em [Compatibilidade](../../COMPATIBILIDADE.md).
|
|
26
|
+
|
|
27
|
+
Sem manifesto, o sincronizador gera a política de
|
|
28
|
+
`templates/clients/ADAPTERS.json`, usando a seleção salva ou `all`.
|
|
29
|
+
Após a instalação, depende somente de Node e do hub local, sem o pacote npm.
|
|
30
|
+
Ele respeita os clientes escolhidos, sem recriar os desmarcados. Para trocar
|
|
31
|
+
a seleção, use `agentdevkit agents <lista>`; não edite o manifesto gerado.
|
|
32
|
+
|
|
33
|
+
Os derivados ficam locais: catálogos, manifesto, estado e apontamentos são
|
|
34
|
+
excluídos pelo Git. O bloco em `.git/info/exclude` preserva regras próprias;
|
|
35
|
+
sem Git, usa um bloco na raiz que migra ao executar depois de `git init`.
|
|
36
|
+
Raízes dedicadas são locais por completo; `.github` e `.vscode` excluem somente
|
|
37
|
+
os arquivos gerados. Conteúdo próprio permanece no disco e não é desindexado
|
|
38
|
+
sem comprovação de propriedade do kit.
|
|
39
|
+
Entradas novas usam os templates; hashes em `estado/derived.json` permitem
|
|
40
|
+
atualizar apenas arquivos integralmente gerados, preservando alterações humanas.
|
|
41
|
+
`--check` também acusa derivados ainda rastreados; não altera o índice.
|