@daniellins/power-claude 0.16.3
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.
Potentially problematic release.
This version of @daniellins/power-claude might be problematic. Click here for more details.
- package/LICENSE +21 -0
- package/README.md +121 -0
- package/bin/cli.js +124 -0
- package/installer/__tests__/doctor-ready-oracles.test.cjs +140 -0
- package/installer/__tests__/merge-settings.test.cjs +330 -0
- package/installer/adopt.js +161 -0
- package/installer/copy.js +203 -0
- package/installer/doctor.js +266 -0
- package/installer/install.js +155 -0
- package/installer/manifest.js +102 -0
- package/installer/motor-scripts.js +50 -0
- package/installer/motor-scripts.json +39 -0
- package/installer/uninstall.js +99 -0
- package/installer/update.js +376 -0
- package/installer/util.js +113 -0
- package/installer/wizard.js +64 -0
- package/package.json +26 -0
- package/scripts/__fixtures__/anti-path-demo/agents/ap-writer.md +13 -0
- package/scripts/__fixtures__/anti-path-demo/templates/write-tmpl.md +7 -0
- package/scripts/__fixtures__/anti-path-demo/workflows/wf-ap.smoke.json +10 -0
- package/scripts/__fixtures__/anti-path-demo/workflows/wf-ap.yaml +25 -0
- package/scripts/__fixtures__/assess-tier/retrofit-leve/pod/agents/content-chief.md +1 -0
- package/scripts/__fixtures__/assess-tier/retrofit-leve/pod/workflows/wf-criacao-redteam.yaml +3 -0
- package/scripts/__fixtures__/assess-tier/retrofit-leve/pod-spec.json +13 -0
- package/scripts/__fixtures__/fidelity/fake-green-average-in-band.yaml +21 -0
- package/scripts/__fixtures__/fidelity/fake-green-average.yaml +18 -0
- package/scripts/__fixtures__/fidelity/fake-green-denominator.yaml +19 -0
- package/scripts/__fixtures__/fidelity/fake-green-missing-evidence.yaml +18 -0
- package/scripts/__fixtures__/fidelity/fake-green-threshold.yaml +18 -0
- package/scripts/__fixtures__/fidelity/fake-green-weight.yaml +18 -0
- package/scripts/__fixtures__/fidelity/golden.yaml +31 -0
- package/scripts/__fixtures__/fidelity/trindade-incoherent.yaml +15 -0
- package/scripts/__fixtures__/forge-canonical/pod-spec-example.json +37 -0
- package/scripts/__fixtures__/migrate-squad/authored/agents/offer-engineer.md +17 -0
- package/scripts/__fixtures__/migrate-squad/authored/knowledge/no-source.md +7 -0
- package/scripts/__fixtures__/migrate-squad/authored/knowledge/value-stack-method.md +8 -0
- package/scripts/__fixtures__/migrate-squad/authored/specs/wf-sample.smoke.json +24 -0
- package/scripts/__fixtures__/migrate-squad/authored/specs/wf-sample.spec.json +45 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/HEADLINE.md +3 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/README.md +4 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/agents/hormozi-offer.md +14 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/checklists/dead-redundant.md +4 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/checklists/method-guide.md +6 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/checklists/veto-screen.md +4 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/config/config.yaml +2 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/data/case-library.md +3 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/scripts/validate-mvn.py +16 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/sops/sop-sample.md +3 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/squad-io.yaml +14 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/tasks/gather-context.md +7 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/templates/output-tmpl.md +5 -0
- package/scripts/__fixtures__/migrate-squad/legacy-squad/workflows/wf-sample.yaml +24 -0
- package/scripts/__fixtures__/pipeline/pipelines/pipeline-checkpoint.yaml +21 -0
- package/scripts/__fixtures__/pipeline/pipelines/pipeline-demo.yaml +22 -0
- package/scripts/__fixtures__/pipeline/pods/pipe-a/agents/maker.md +13 -0
- package/scripts/__fixtures__/pipeline/pods/pipe-a/memory/learnings.consolidated.md +8 -0
- package/scripts/__fixtures__/pipeline/pods/pipe-a/memory/learnings.jsonl +83 -0
- package/scripts/__fixtures__/pipeline/pods/pipe-a/templates/make-tmpl.md +8 -0
- package/scripts/__fixtures__/pipeline/pods/pipe-a/workflows/wf-a.yaml +16 -0
- package/scripts/__fixtures__/pipeline/pods/pipe-b/agents/user.md +13 -0
- package/scripts/__fixtures__/pipeline/pods/pipe-b/memory/learnings.consolidated.md +8 -0
- package/scripts/__fixtures__/pipeline/pods/pipe-b/memory/learnings.jsonl +14 -0
- package/scripts/__fixtures__/pipeline/pods/pipe-b/templates/use-tmpl.md +6 -0
- package/scripts/__fixtures__/pipeline/pods/pipe-b/workflows/wf-b.yaml +16 -0
- package/scripts/__fixtures__/pod-run/agents/forge-chief.md +13 -0
- package/scripts/__fixtures__/pod-run/agents/pod-critic.md +13 -0
- package/scripts/__fixtures__/pod-run/templates/build-tmpl.md +8 -0
- package/scripts/__fixtures__/pod-run/templates/gate-tmpl.md +6 -0
- package/scripts/__fixtures__/pod-run/workflows/wf-min.yaml +43 -0
- package/scripts/__fixtures__/pod-run/workflows/wf-skip-modes.yaml +50 -0
- package/scripts/__fixtures__/pod-workflow/invalid-checkpoint-all-skippable.yaml +30 -0
- package/scripts/__fixtures__/pod-workflow/invalid-checkpoint-criteria-escalar-de-bloco.yaml +40 -0
- package/scripts/__fixtures__/pod-workflow/invalid-checkpoint-skip-mode-desconhecido.yaml +30 -0
- package/scripts/__fixtures__/pod-workflow/invalid-checkpoint-unknown-key.yaml +29 -0
- package/scripts/__fixtures__/pod-workflow/invalid-cycle.yaml +26 -0
- package/scripts/__fixtures__/pod-workflow/invalid-fix-loop-backedge.yaml +29 -0
- package/scripts/__fixtures__/pod-workflow/invalid-fix-loop-forward.yaml +29 -0
- package/scripts/__fixtures__/pod-workflow/invalid-handoff-open.yaml +27 -0
- package/scripts/__fixtures__/pod-workflow/invalid-knowledge-shape.yaml +18 -0
- package/scripts/__fixtures__/pod-workflow/invalid-missing-agent.yaml +15 -0
- package/scripts/__fixtures__/pod-workflow/invalid-missing-outputs.yaml +15 -0
- package/scripts/__fixtures__/pod-workflow/invalid-missing-template.yaml +15 -0
- package/scripts/__fixtures__/pod-workflow/invalid-missing-veto.yaml +13 -0
- package/scripts/__fixtures__/pod-workflow/invalid-template-not-on-disk.yaml +16 -0
- package/scripts/__fixtures__/pod-workflow/invalid-veto-prose.yaml +17 -0
- package/scripts/__fixtures__/pod-workflow/knowledge/a.md +4 -0
- package/scripts/__fixtures__/pod-workflow/knowledge/b.md +4 -0
- package/scripts/__fixtures__/pod-workflow/knowledge/c.md +4 -0
- package/scripts/__fixtures__/pod-workflow/templates/step-tmpl.md +7 -0
- package/scripts/__fixtures__/pod-workflow/valid-checkpoint-skip-modes.yaml +29 -0
- package/scripts/__fixtures__/pod-workflow/valid-fix-loop.yaml +30 -0
- package/scripts/__fixtures__/pod-workflow/valid-knowledge.yaml +30 -0
- package/scripts/__fixtures__/pod-workflow/valid-veto-always-true.yaml +20 -0
- package/scripts/__fixtures__/pod-workflow/valid.yaml +27 -0
- package/scripts/__fixtures__/smoke-canary/agents/canary-reporter.md +13 -0
- package/scripts/__fixtures__/smoke-canary/agents/canary-researcher.md +13 -0
- package/scripts/__fixtures__/smoke-canary/agents/canary-synth.md +13 -0
- package/scripts/__fixtures__/smoke-canary/memory/learnings.consolidated.md +10 -0
- package/scripts/__fixtures__/smoke-canary/memory/learnings.jsonl +448 -0
- package/scripts/__fixtures__/smoke-canary/templates/report-tmpl.md +9 -0
- package/scripts/__fixtures__/smoke-canary/templates/research-tmpl.md +7 -0
- package/scripts/__fixtures__/smoke-canary/templates/synth-tmpl.md +9 -0
- package/scripts/__fixtures__/smoke-canary/workflows/wf-canary.smoke.json +11 -0
- package/scripts/__fixtures__/smoke-canary/workflows/wf-canary.yaml +53 -0
- package/scripts/__fixtures__/source-audit/fake-green-bronze-unsignaled.yaml +10 -0
- package/scripts/__fixtures__/source-audit/fake-green-counts.yaml +9 -0
- package/scripts/__fixtures__/source-audit/fake-green-missing-evidence.yaml +9 -0
- package/scripts/__fixtures__/source-audit/fake-green-unclassified.yaml +10 -0
- package/scripts/__fixtures__/source-audit/fake-green-verdict.yaml +10 -0
- package/scripts/__fixtures__/source-audit/golden-blocked.yaml +10 -0
- package/scripts/__fixtures__/source-audit/golden.yaml +11 -0
- package/scripts/__fixtures__/sweep-forms/agents/forms-count.md +13 -0
- package/scripts/__fixtures__/sweep-forms/agents/forms-field.md +13 -0
- package/scripts/__fixtures__/sweep-forms/agents/forms-fileref.md +13 -0
- package/scripts/__fixtures__/sweep-forms/agents/forms-json.md +13 -0
- package/scripts/__fixtures__/sweep-forms/agents/forms-section.md +13 -0
- package/scripts/__fixtures__/sweep-forms/specs/wf-forms.spec.json +5 -0
- package/scripts/__fixtures__/sweep-forms/templates/t_count.md +5 -0
- package/scripts/__fixtures__/sweep-forms/templates/t_field.md +3 -0
- package/scripts/__fixtures__/sweep-forms/templates/t_fileref.md +3 -0
- package/scripts/__fixtures__/sweep-forms/templates/t_json.md +0 -0
- package/scripts/__fixtures__/sweep-forms/templates/t_section.md +3 -0
- package/scripts/__fixtures__/sweep-forms/workflows/wf-forms.smoke.json +13 -0
- package/scripts/__fixtures__/sweep-forms/workflows/wf-forms.yaml +67 -0
- package/scripts/__fixtures__/validate-story-acs-corpus/corpus-1-noop-state-json.fixture.md +18 -0
- package/scripts/__fixtures__/validate-story-acs-corpus/corpus-2-crash-buildworkflowyaml.fixture.md +26 -0
- package/scripts/__fixtures__/validate-story-acs-corpus/corpus-3-nasce-verde-skip-modes.fixture.md +29 -0
- package/scripts/__fixtures__/validate-story-acs-corpus/corpus-4-guarda-sem-irmao.fixture.md +17 -0
- package/scripts/__fixtures__/validate-story-acs-corpus/corpus-5a-diff-stat-sem-guarda.fixture.md +17 -0
- package/scripts/__fixtures__/validate-story-acs-corpus/corpus-5b-test-f-sobre-diretorio.fixture.md +20 -0
- package/scripts/__fixtures__/veto-checks/copy-clean.md +4 -0
- package/scripts/__fixtures__/veto-checks/copy-dashes.md +4 -0
- package/scripts/__fixtures__/veto-checks/n8n-bad.md +18 -0
- package/scripts/__fixtures__/veto-checks/n8n-ok.md +22 -0
- package/scripts/__fixtures__/veto-checks/page-bad.html +7 -0
- package/scripts/__fixtures__/veto-checks/phash/copy.png +0 -0
- package/scripts/__fixtures__/veto-checks/phash/distinct.png +0 -0
- package/scripts/__fixtures__/veto-checks/phash/distinct2.png +0 -0
- package/scripts/__fixtures__/veto-checks/phash/make-fixtures.cjs +203 -0
- package/scripts/__fixtures__/veto-checks/phash/ref.png +0 -0
- package/scripts/__fixtures__/veto-checks/slide-ok.html +15 -0
- package/scripts/__fixtures__/veto-checks/slide-overflow.html +14 -0
- package/scripts/__fixtures__/veto-checks/sweep-pod/agents/vc-checker.md +13 -0
- package/scripts/__fixtures__/veto-checks/sweep-pod/templates/check-tmpl.md +6 -0
- package/scripts/__fixtures__/veto-checks/sweep-pod/workflows/wf-vc.smoke.json +10 -0
- package/scripts/__fixtures__/veto-checks/sweep-pod/workflows/wf-vc.yaml +19 -0
- package/scripts/__fixtures__/voz-do-dono/README.md +23 -0
- package/scripts/__fixtures__/voz-do-dono/dono-escalar.yaml +9 -0
- package/scripts/__fixtures__/voz-do-dono/dono-guia.yaml +10 -0
- package/scripts/__fixtures__/voz-do-dono/peca-3a-pessoa.md +6 -0
- package/scripts/__fixtures__/voz-do-dono/peca-com-lexico-proibido.md +6 -0
- package/scripts/__fixtures__/voz-do-dono/peca-limpa-1a-pessoa.md +6 -0
- package/scripts/__tests__/derive-ready-transitions.test.cjs +269 -0
- package/scripts/__tests__/enforce-cycle-authority.test.cjs +869 -0
- package/scripts/__tests__/enforce-git-push-authority.test.cjs +701 -0
- package/scripts/__tests__/enforce-ready-oracles.test.cjs +745 -0
- package/scripts/__tests__/motor-scripts.test.cjs +339 -0
- package/scripts/__tests__/pc-run-pod-counter.test.cjs +58 -0
- package/scripts/__tests__/pc-run-pod.test.cjs +578 -0
- package/scripts/__tests__/validate-pod-workflow.test.cjs +90 -0
- package/scripts/__tests__/validate-story-acs.test.cjs +607 -0
- package/scripts/anti-path.test.cjs +163 -0
- package/scripts/arena.cjs +514 -0
- package/scripts/arena.test.cjs +213 -0
- package/scripts/brief-leitura-obrigatoria.test.cjs +364 -0
- package/scripts/consolidate-knowledge-runner.test.cjs +249 -0
- package/scripts/default-funcional.test.cjs +153 -0
- package/scripts/derive-ready-transitions.cjs +325 -0
- package/scripts/forge-additive.test.cjs +158 -0
- package/scripts/forge-assess-tier.cjs +205 -0
- package/scripts/forge-assess-tier.test.cjs +114 -0
- package/scripts/forge-canonical.test.cjs +624 -0
- package/scripts/forge-generate.cjs +1303 -0
- package/scripts/forge-harden-learning.cjs +921 -0
- package/scripts/forge-harden-learning.test.cjs +242 -0
- package/scripts/forge-ingest-memory.cjs +136 -0
- package/scripts/forge-upgrade-pod.cjs +368 -0
- package/scripts/forge.test.cjs +609 -0
- package/scripts/harden-knowledge.test.cjs +612 -0
- package/scripts/harness-g5-lite.cjs +243 -0
- package/scripts/harness-g5-lite.test.cjs +134 -0
- package/scripts/hn-carousel-contrato-entrada.test.cjs +96 -0
- package/scripts/migrate-squad-orchestration.test.cjs +146 -0
- package/scripts/migration-manifest-sf3.2.test.cjs +382 -0
- package/scripts/migration-manifest-sf3.3.test.cjs +170 -0
- package/scripts/migration-manifest-sf5.5.test.cjs +189 -0
- package/scripts/migration-manifest.cjs +1146 -0
- package/scripts/migration-manifest.test.cjs +186 -0
- package/scripts/npm-scope-invocation.test.cjs +194 -0
- package/scripts/owner-layer.cjs +442 -0
- package/scripts/owner-layer.test.cjs +358 -0
- package/scripts/pc-run-pipeline.cjs +289 -0
- package/scripts/pc-run-pipeline.test.cjs +256 -0
- package/scripts/pc-run-pod-countgte.test.cjs +66 -0
- package/scripts/pc-run-pod.cjs +1355 -0
- package/scripts/phash-gate.test.cjs +433 -0
- package/scripts/pod-export-compile.cjs +487 -0
- package/scripts/pod-export-compile.test.cjs +312 -0
- package/scripts/pod-export-executor.cjs +678 -0
- package/scripts/pod-export-executor.test.cjs +1341 -0
- package/scripts/pod-export-hardening.test.cjs +531 -0
- package/scripts/pod-export-postprocess.cjs +427 -0
- package/scripts/pod-export-postprocess.test.cjs +558 -0
- package/scripts/pod-export-queue-race.test.cjs +865 -0
- package/scripts/pod-export-release.cjs +473 -0
- package/scripts/pod-export-release.test.cjs +267 -0
- package/scripts/pod-export-service.cjs +1297 -0
- package/scripts/pod-export-service.test.cjs +489 -0
- package/scripts/pod-export-tools.cjs +470 -0
- package/scripts/pod-export-ui.cjs +805 -0
- package/scripts/pod-export-ui.test.cjs +301 -0
- package/scripts/pod-memory-budget.test.cjs +309 -0
- package/scripts/pod-memory-note.cjs +357 -0
- package/scripts/pod-memory-note.test.cjs +452 -0
- package/scripts/pod-memory.cjs +1252 -0
- package/scripts/pod-memory.test.cjs +951 -0
- package/scripts/render-png.test.cjs +307 -0
- package/scripts/smoke-isolation.test.cjs +100 -0
- package/scripts/smoke-pod-workflow.cjs +755 -0
- package/scripts/smoke-sweep.test.cjs +170 -0
- package/scripts/validate-adopt.js +235 -0
- package/scripts/validate-branding.js +84 -0
- package/scripts/validate-budgets.js +140 -0
- package/scripts/validate-fidelity-output.cjs +267 -0
- package/scripts/validate-fidelity-output.test.cjs +101 -0
- package/scripts/validate-install.js +230 -0
- package/scripts/validate-no-clone.cjs +220 -0
- package/scripts/validate-no-clone.test.cjs +77 -0
- package/scripts/validate-pipeline.cjs +145 -0
- package/scripts/validate-pod-workflow.cjs +878 -0
- package/scripts/validate-source-audit.cjs +170 -0
- package/scripts/validate-source-audit.test.cjs +90 -0
- package/scripts/validate-story-acs.cjs +862 -0
- package/scripts/validate-update-scope-motor.js +421 -0
- package/scripts/veto-checks/html-valid.cjs +92 -0
- package/scripts/veto-checks/lexical-check.cjs +62 -0
- package/scripts/veto-checks/phash-gate.cjs +589 -0
- package/scripts/veto-checks/render-gate.cjs +165 -0
- package/scripts/veto-checks/render-png.cjs +358 -0
- package/scripts/veto-checks.test.cjs +219 -0
- package/scripts/watcher-audit.cjs +178 -0
- package/template/.claude/CLAUDE.md +103 -0
- package/template/.claude/agents/pc-analyst.md +100 -0
- package/template/.claude/agents/pc-architect.md +32 -0
- package/template/.claude/agents/pc-dev.md +27 -0
- package/template/.claude/agents/pc-devops.md +45 -0
- package/template/.claude/agents/pc-planner.md +32 -0
- package/template/.claude/agents/pc-po.md +25 -0
- package/template/.claude/agents/pc-qa.md +25 -0
- package/template/.claude/commands/power/academy.md +9 -0
- package/template/.claude/commands/power/automation.md +9 -0
- package/template/.claude/commands/power/content-carousel.md +267 -0
- package/template/.claude/commands/power/content.md +9 -0
- package/template/.claude/commands/power/dev.md +9 -0
- package/template/.claude/commands/power/forge.md +224 -0
- package/template/.claude/commands/power/hormozi.md +221 -0
- package/template/.claude/commands/power/modo.md +57 -0
- package/template/.claude/hooks/README.md +114 -0
- package/template/.claude/hooks/context-budget.cjs +64 -0
- package/template/.claude/hooks/enforce-cycle-authority.cjs +457 -0
- package/template/.claude/hooks/enforce-git-push-authority.cjs +925 -0
- package/template/.claude/hooks/enforce-ready-oracles.cjs +502 -0
- package/template/.claude/rules/authority.md +76 -0
- package/template/.claude/rules/curadoria-de-conhecimento.md +30 -0
- package/template/.claude/rules/model-matrix.md +34 -0
- package/template/.claude/rules/orchestration.md +133 -0
- package/template/.claude/settings.json +50 -0
- package/template/.claude/skills/pc-apply-qa-fixes/SKILL.md +108 -0
- package/template/.claude/skills/pc-apply-qa-fixes/references/fix-loop.md +40 -0
- package/template/.claude/skills/pc-apply-qa-fixes/references/fix-request-template.md +70 -0
- package/template/.claude/skills/pc-arena/SKILL.md +96 -0
- package/template/.claude/skills/pc-close-story/SKILL.md +105 -0
- package/template/.claude/skills/pc-commit/SKILL.md +108 -0
- package/template/.claude/skills/pc-develop-story/SKILL.md +116 -0
- package/template/.claude/skills/pc-full-cycle/SKILL.md +150 -0
- package/template/.claude/skills/pc-pipeline/SKILL.md +63 -0
- package/template/.claude/skills/pc-pipeline/references/gate-templates.md +46 -0
- package/template/.claude/skills/pc-review-story/SKILL.md +129 -0
- package/template/.claude/skills/pc-review-story/references/false-positive-detection.md +50 -0
- package/template/.claude/skills/pc-review-story/references/nfr-assess.md +47 -0
- package/template/.claude/skills/pc-review-story/references/risk-profile.md +75 -0
- package/template/.claude/skills/pc-review-story/references/security-checklist.md +69 -0
- package/template/.claude/skills/pc-review-story/references/test-design.md +37 -0
- package/template/.claude/skills/pc-review-story/references/trace-requirements.md +46 -0
- package/template/.claude/skills/pc-run-pod/SKILL.md +123 -0
- package/template/.claude/skills/pc-validate-story/SKILL.md +114 -0
- package/template/.claude/skills/pc-wave/SKILL.md +133 -0
- package/template/.env.example +10 -0
- package/template/knowledge/analyst/brainstorming.md +40 -0
- package/template/knowledge/analyst/brief-skeleton.md +32 -0
- package/template/knowledge/analyst/competitor-skeleton.md +39 -0
- package/template/knowledge/analyst/elicitation-menu.md +49 -0
- package/template/knowledge/analyst/market-research-skeleton.md +36 -0
- package/template/knowledge/analyst/research-prompt-structure.md +48 -0
- package/template/knowledge/analyst/roi-skeleton.md +51 -0
- package/template/knowledge/voice-dna/README.md +99 -0
- package/template/knowledge/voice-dna/voice-dna.example.yaml +157 -0
- package/template/pods/README.md +64 -0
- package/template/pods/academy/README.md +37 -0
- package/template/pods/academy/agents/academy-chief.md +27 -0
- package/template/pods/academy/examples/palestra.example.md +142 -0
- package/template/pods/academy/pod-spec.json +44 -0
- package/template/pods/academy/templates/materiais-tmpl.md +17 -0
- package/template/pods/academy/templates/revisao-didatica-tmpl.md +20 -0
- package/template/pods/academy/workflows/wf-materiais-revisao.yaml +30 -0
- package/template/pods/authority-content/README.md +43 -0
- package/template/pods/authority-content/agents/content-chief.md +28 -0
- package/template/pods/authority-content/pod-spec.json +45 -0
- package/template/pods/authority-content/templates/criacao-na-voz-tmpl.md +17 -0
- package/template/pods/authority-content/templates/red-team-factual-tmpl.md +23 -0
- package/template/pods/authority-content/workflows/wf-criacao-redteam.yaml +30 -0
- package/template/pods/automation/README.md +37 -0
- package/template/pods/automation/agents/langgraph-architect.md +30 -0
- package/template/pods/automation/agents/n8n-architect.md +30 -0
- package/template/pods/automation/examples/README.md +46 -0
- package/template/pods/automation/examples/n8n-content-radar.example.json +380 -0
- package/template/pods/automation/knowledge/langgraph-patterns.md +126 -0
- package/template/pods/automation/knowledge/n8n-patterns.md +131 -0
- package/template/pods/automation/memory/README.md +16 -0
- package/template/pods/automation/memory/learnings.consolidated.md +8 -0
- package/template/pods/automation/memory/learnings.jsonl +0 -0
- package/template/pods/automation/pod-spec.json +109 -0
- package/template/pods/automation/specs/wf-langgraph-build.spec.json +107 -0
- package/template/pods/automation/squad-io.yaml +28 -0
- package/template/pods/automation/templates/lg-build-tmpl.md +17 -0
- package/template/pods/automation/templates/lg-design-tmpl.md +23 -0
- package/template/pods/automation/templates/lg-discover-tmpl.md +20 -0
- package/template/pods/automation/templates/lg-handoff-tmpl.md +20 -0
- package/template/pods/automation/templates/lg-test-tmpl.md +20 -0
- package/template/pods/automation/templates/n8n-build-tmpl.md +14 -0
- package/template/pods/automation/templates/n8n-design-tmpl.md +23 -0
- package/template/pods/automation/templates/n8n-discover-tmpl.md +20 -0
- package/template/pods/automation/templates/n8n-handoff-tmpl.md +20 -0
- package/template/pods/automation/templates/n8n-test-tmpl.md +20 -0
- package/template/pods/automation/workflows/wf-langgraph-build.smoke.json +11 -0
- package/template/pods/automation/workflows/wf-langgraph-build.yaml +64 -0
- package/template/pods/automation/workflows/wf-n8n-build.smoke.json +11 -0
- package/template/pods/automation/workflows/wf-n8n-build.yaml +65 -0
- package/template/pods/content-carousel/README.md +91 -0
- package/template/pods/content-carousel/agents/carousel-builder.md +28 -0
- package/template/pods/content-carousel/agents/carousel-visual.md +24 -0
- package/template/pods/content-carousel/agents/hn-curator.md +74 -0
- package/template/pods/content-carousel/config/heuristic-watcher-rubric.yaml +59 -0
- package/template/pods/content-carousel/knowledge/aquisicao-ancora.md +443 -0
- package/template/pods/content-carousel/knowledge/cta-brief.md +25 -0
- package/template/pods/content-carousel/knowledge/dono.example.yaml +45 -0
- package/template/pods/content-carousel/knowledge/identidade-visual-mascote.md +62 -0
- package/template/pods/content-carousel/knowledge/image-generation.md +62 -0
- package/template/pods/content-carousel/knowledge/selecao-de-ancora.md +60 -0
- package/template/pods/content-carousel/knowledge/slides-html.md +56 -0
- package/template/pods/content-carousel/memory/README.md +18 -0
- package/template/pods/content-carousel/memory/learnings.consolidated.md +6 -0
- package/template/pods/content-carousel/memory/learnings.jsonl +0 -0
- package/template/pods/content-carousel/pod-spec.json +100 -0
- package/template/pods/content-carousel/squad-io.yaml +10 -0
- package/template/pods/content-carousel/templates/assembly-tmpl.md +23 -0
- package/template/pods/content-carousel/templates/digest-tmpl.md +29 -0
- package/template/pods/content-carousel/templates/visuals-tmpl.md +20 -0
- package/template/pods/content-carousel/workflows/wf-content-carousel.smoke.json +23 -0
- package/template/pods/content-carousel/workflows/wf-content-carousel.yaml +80 -0
- package/template/pods/dev-ia/README.md +45 -0
- package/template/pods/dev-ia/agents/db-architect.md +33 -0
- package/template/pods/dev-ia/agents/ux-architect.md +29 -0
- package/template/pods/dev-ia/knowledge/db/migration-protocol.md +95 -0
- package/template/pods/dev-ia/knowledge/db/rls-patterns.md +101 -0
- package/template/pods/dev-ia/knowledge/db/schema-review-checklist.md +76 -0
- package/template/pods/dev-ia/memory/README.md +16 -0
- package/template/pods/dev-ia/memory/learnings.consolidated.md +8 -0
- package/template/pods/dev-ia/memory/learnings.jsonl +0 -0
- package/template/pods/dev-ia/pod-spec.json +34 -0
- package/template/pods/dev-ia/templates/schema-review-tmpl.md +23 -0
- package/template/pods/dev-ia/templates/ux-flow-review-tmpl.md +23 -0
- package/template/pods/dev-ia/tools/db-ops/backup-manager.sh +321 -0
- package/template/pods/dev-ia/tools/db-ops/best-practices-auditor.sh +534 -0
- package/template/pods/dev-ia/tools/db-ops/bootstrap-runner.sh +255 -0
- package/template/pods/dev-ia/tools/db-ops/data-loader.sh +616 -0
- package/template/pods/dev-ia/tools/db-ops/detect-database.sh +113 -0
- package/template/pods/dev-ia/tools/db-ops/explain-analyzer.sh +285 -0
- package/template/pods/dev-ia/tools/db-ops/health-checker.sh +323 -0
- package/template/pods/dev-ia/tools/db-ops/migration-runner.sh +308 -0
- package/template/pods/dev-ia/tools/db-ops/postgresql-schema-loader.sh +334 -0
- package/template/pods/dev-ia/tools/db-ops/query-runner.sh +171 -0
- package/template/pods/dev-ia/tools/db-ops/rls-policy-installer.sh +480 -0
- package/template/pods/dev-ia/tools/db-ops/rls-test-suite.sh +172 -0
- package/template/pods/dev-ia/tools/db-ops/schema-context-loader.sh +176 -0
- package/template/pods/hormozi-method/README.md +52 -0
- package/template/pods/hormozi-method/agents/acquisition-strategist.md +33 -0
- package/template/pods/hormozi-method/agents/conversion-copywriter.md +34 -0
- package/template/pods/hormozi-method/agents/monetization-architect.md +35 -0
- package/template/pods/hormozi-method/agents/offer-engineer.md +37 -0
- package/template/pods/hormozi-method/knowledge/core-four-leads.md +51 -0
- package/template/pods/hormozi-method/knowledge/grand-slam-offer.md +66 -0
- package/template/pods/hormozi-method/knowledge/growth-decision.md +38 -0
- package/template/pods/hormozi-method/knowledge/hooks-and-ads.md +56 -0
- package/template/pods/hormozi-method/knowledge/launch-email.md +31 -0
- package/template/pods/hormozi-method/knowledge/money-model.md +46 -0
- package/template/pods/hormozi-method/knowledge/opportunity-screening.md +44 -0
- package/template/pods/hormozi-method/knowledge/pages.md +25 -0
- package/template/pods/hormozi-method/knowledge/pos-lancamento-leads.md +56 -0
- package/template/pods/hormozi-method/knowledge/pricing.md +36 -0
- package/template/pods/hormozi-method/knowledge/retention-ltv.md +37 -0
- package/template/pods/hormozi-method/knowledge/scale-roadmap.md +35 -0
- package/template/pods/hormozi-method/knowledge/swipefiles-curados.md +44 -0
- package/template/pods/hormozi-method/knowledge/value-equation-diagnostic.md +77 -0
- package/template/pods/hormozi-method/memory/README.md +16 -0
- package/template/pods/hormozi-method/memory/learnings.consolidated.md +6 -0
- package/template/pods/hormozi-method/memory/learnings.jsonl +0 -0
- package/template/pods/hormozi-method/pod-spec.json +50 -0
- package/template/pods/hormozi-method/specs/wf-full-launch-sequence.spec.json +149 -0
- package/template/pods/hormozi-method/specs/wf-lead-magnet-pipeline.spec.json +125 -0
- package/template/pods/hormozi-method/specs/wf-money-model-design.spec.json +117 -0
- package/template/pods/hormozi-method/specs/wf-paid-ads-campaign.spec.json +132 -0
- package/template/pods/hormozi-method/specs/wf-scaling-diagnostic.spec.json +121 -0
- package/template/pods/hormozi-method/squad-io.yaml +43 -0
- package/template/pods/hormozi-method/templates/conversion-copywriter-tmpl.md +20 -0
- package/template/pods/hormozi-method/templates/launch-execucao-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/launch-fechamento-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/launch-pos-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/launch-preparacao-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/lm-copy-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/lm-distribuicao-tmpl.md +18 -0
- package/template/pods/hormozi-method/templates/lm-estrategia-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/mm-arquitetura-tmpl.md +18 -0
- package/template/pods/hormozi-method/templates/mm-copy-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/mm-diagnostico-tmpl.md +14 -0
- package/template/pods/hormozi-method/templates/monetization-architect-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/offer-engineer-tmpl.md +20 -0
- package/template/pods/hormozi-method/templates/paid-criativos-tmpl.md +19 -0
- package/template/pods/hormozi-method/templates/paid-fundacao-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/paid-teste-escala-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/scaling-diagnostico-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/scaling-priorizacao-tmpl.md +17 -0
- package/template/pods/hormozi-method/templates/scaling-roadmap-tmpl.md +17 -0
- package/template/pods/hormozi-method/workflows/wf-full-launch-sequence.smoke.json +12 -0
- package/template/pods/hormozi-method/workflows/wf-full-launch-sequence.yaml +56 -0
- package/template/pods/hormozi-method/workflows/wf-grand-slam-offer.smoke.json +11 -0
- package/template/pods/hormozi-method/workflows/wf-grand-slam-offer.yaml +45 -0
- package/template/pods/hormozi-method/workflows/wf-lead-magnet-pipeline.smoke.json +9 -0
- package/template/pods/hormozi-method/workflows/wf-lead-magnet-pipeline.yaml +45 -0
- package/template/pods/hormozi-method/workflows/wf-money-model-design.smoke.json +11 -0
- package/template/pods/hormozi-method/workflows/wf-money-model-design.yaml +45 -0
- package/template/pods/hormozi-method/workflows/wf-paid-ads-campaign.smoke.json +9 -0
- package/template/pods/hormozi-method/workflows/wf-paid-ads-campaign.yaml +46 -0
- package/template/pods/hormozi-method/workflows/wf-scaling-diagnostic.smoke.json +11 -0
- package/template/pods/hormozi-method/workflows/wf-scaling-diagnostic.yaml +44 -0
- package/template/pods/squad-forge/README.md +53 -0
- package/template/pods/squad-forge/agents/forge-chief.md +31 -0
- package/template/pods/squad-forge/agents/mind-extractor.md +29 -0
- package/template/pods/squad-forge/agents/pod-critic.md +26 -0
- package/template/pods/squad-forge/config/heuristic-watcher-rubric.yaml +74 -0
- package/template/pods/squad-forge/knowledge/fidelity-rubric.yaml +176 -0
- package/template/pods/squad-forge/knowledge/g6-memory-check.md +17 -0
- package/template/pods/squad-forge/knowledge/memory-ingest.md +16 -0
- package/template/pods/squad-forge/knowledge/source-audit-rubric.yaml +60 -0
- package/template/pods/squad-forge/memory/README.md +16 -0
- package/template/pods/squad-forge/memory/learnings.consolidated.md +8 -0
- package/template/pods/squad-forge/memory/learnings.jsonl +0 -0
- package/template/pods/squad-forge/pod-spec.json +166 -0
- package/template/pods/squad-forge/squad-io.yaml +13 -0
- package/template/pods/squad-forge/tasks/pipeline.md +158 -0
- package/template/pods/squad-forge/templates/discovery-tmpl.md +40 -0
- package/template/pods/squad-forge/templates/generation-tmpl.md +18 -0
- package/template/pods/squad-forge/templates/red-team-tmpl.md +17 -0
- package/template/pods/squad-forge/templates/register-tmpl.md +17 -0
- package/template/pods/squad-forge/templates/workflow-tmpl.yaml +101 -0
- package/template/pods/squad-forge/workflows/wf-forge.smoke.json +12 -0
- package/template/pods/squad-forge/workflows/wf-forge.yaml +60 -0
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/**
|
|
4
|
+
* pod-export-compile.cjs — compilador de motor: transforma um pod maduro (contrato
|
|
5
|
+
* v0.3) num BUNDLE server-side versionado + um `export.lock.json` auditável.
|
|
6
|
+
*
|
|
7
|
+
* Comando (padrão da casa, ADR-007):
|
|
8
|
+
* node scripts/pod-export-compile.cjs compile <pod-dir> [opções]
|
|
9
|
+
*
|
|
10
|
+
* Opções:
|
|
11
|
+
* --out <dir> override do diretório do bundle (default: .power-claude/pod-export/<pod>/bundle)
|
|
12
|
+
* --pins <file> override do arquivo de pins (default: exports/<pod>/pins.json)
|
|
13
|
+
* --lock-out <file> override do path do lock (default: exports/<pod>/export.lock.json)
|
|
14
|
+
* --no-endpoint-check pula a checagem de endpoint do modelo de imagem (uso: debug local; NUNCA em release)
|
|
15
|
+
*
|
|
16
|
+
* Fronteiras (ADR-018 F1; Story SF10.1):
|
|
17
|
+
* - REUSA `validate-pod-workflow.cjs` para o preflight de contrato (não reimplementa schema/DAG).
|
|
18
|
+
* - O "grafo" é o `wf-*.yaml` ORIGINAL empacotado VERBATIM (D3 — sem IR, sem tradução).
|
|
19
|
+
* - Knowledge citado vem do campo estruturado `knowledge:` POR STEP no wf (D2), com 3 checks
|
|
20
|
+
* fail-loud (existência, superconjunto, órfãos) — derivação PROGRAMÁTICA, nunca mapa hardcoded.
|
|
21
|
+
* - Não roda o bundle (executor/runtime é F2), não faz release/selo (F4), não faz push.
|
|
22
|
+
*
|
|
23
|
+
* Node >= 18, zero dependências externas. Determinístico: mesmo pod@sha (digest de conteúdo)
|
|
24
|
+
* + mesmo COMPILER_VERSION → bundle byte-idêntico (nenhum timestamp/aleatório no conteúdo).
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const fs = require('node:fs');
|
|
28
|
+
const path = require('node:path');
|
|
29
|
+
const crypto = require('node:crypto');
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
parseYaml,
|
|
33
|
+
validateWorkflow,
|
|
34
|
+
topoOrder,
|
|
35
|
+
Fail,
|
|
36
|
+
} = require('./validate-pod-workflow.cjs');
|
|
37
|
+
|
|
38
|
+
// Versão da SAÍDA do compilador (semver). Bumpar quando a forma do bundle/lock mudar
|
|
39
|
+
// (D4: chave de determinismo é `pod@sha + COMPILER_VERSION`; NÃO usar framework_version aqui).
|
|
40
|
+
const COMPILER_VERSION = '1.0.0';
|
|
41
|
+
|
|
42
|
+
const REPO_ROOT = path.resolve(__dirname, '..');
|
|
43
|
+
const VETO_CHECKS_DIR = path.join(REPO_ROOT, 'scripts', 'veto-checks');
|
|
44
|
+
|
|
45
|
+
class CompileError extends Error {}
|
|
46
|
+
function fail(msg) { throw new CompileError(msg); }
|
|
47
|
+
|
|
48
|
+
function sha256(buf) { return crypto.createHash('sha256').update(buf).digest('hex'); }
|
|
49
|
+
function read(p) { return fs.readFileSync(p, 'utf8'); }
|
|
50
|
+
function readBuf(p) { return fs.readFileSync(p); }
|
|
51
|
+
|
|
52
|
+
/** Ordena as chaves de um objeto plano → serialização determinística. */
|
|
53
|
+
function sortedObject(obj) {
|
|
54
|
+
const out = {};
|
|
55
|
+
for (const k of Object.keys(obj).sort()) out[k] = obj[k];
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// Parsing de agente (frontmatter, corpo, golden rules, citações de comando).
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
function splitFrontmatter(md) {
|
|
64
|
+
const m = md.match(/^---\n([\s\S]*?)\n---\n?/);
|
|
65
|
+
if (!m) return { frontmatter: {}, body: md.trim() };
|
|
66
|
+
const fmText = m[1];
|
|
67
|
+
const body = md.slice(m[0].length).trim();
|
|
68
|
+
const fm = {};
|
|
69
|
+
for (const line of fmText.split(/\r?\n/)) {
|
|
70
|
+
const mm = line.match(/^([A-Za-z0-9_]+):\s*(.*)$/);
|
|
71
|
+
if (mm) fm[mm[1]] = mm[2].trim();
|
|
72
|
+
}
|
|
73
|
+
return { frontmatter: fm, body };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Extrai a seção `## Regras de ouro` (golden rules) do corpo do agente; '' se ausente. */
|
|
77
|
+
function extractGoldenRules(body) {
|
|
78
|
+
const lines = body.split(/\r?\n/);
|
|
79
|
+
const start = lines.findIndex((l) => /^##\s+Regras de ouro\b/i.test(l.trim()));
|
|
80
|
+
if (start === -1) return '';
|
|
81
|
+
const out = [lines[start]];
|
|
82
|
+
for (let i = start + 1; i < lines.length; i++) {
|
|
83
|
+
if (/^##\s+\S/.test(lines[i].trim())) break;
|
|
84
|
+
out.push(lines[i]);
|
|
85
|
+
}
|
|
86
|
+
return out.join('\n').trim();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* D2 check 2 (superconjunto): citações `knowledge/<x>.md` parseáveis nas LINHAS DE COMANDO
|
|
91
|
+
* do agente (bullets iniciando por `- \`*comando`). Retorna Set de basenames (ex.: "slides-html.md").
|
|
92
|
+
*/
|
|
93
|
+
function parseCommandKnowledge(body) {
|
|
94
|
+
const cited = new Set();
|
|
95
|
+
for (const line of body.split(/\r?\n/)) {
|
|
96
|
+
if (!/^\s*-\s*`\*/.test(line)) continue; // só linhas de comando
|
|
97
|
+
const re = /knowledge\/([A-Za-z0-9._-]+\.md)/g;
|
|
98
|
+
let m;
|
|
99
|
+
while ((m = re.exec(line)) !== null) cited.add(m[1]);
|
|
100
|
+
}
|
|
101
|
+
return cited;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
// Pins de modelo (D4): INPUT explícito committado; FALHA se algum alias sem pin.
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
function loadPins(pinsPath) {
|
|
109
|
+
if (!fs.existsSync(pinsPath)) {
|
|
110
|
+
fail(`pins.json ausente: ${path.relative(REPO_ROOT, pinsPath)} — o lock exige id CONCRETO de modelo por alias (D4). Crie o arquivo.`);
|
|
111
|
+
}
|
|
112
|
+
let pins;
|
|
113
|
+
try { pins = JSON.parse(read(pinsPath)); } catch (e) { fail(`pins.json inválido (${path.relative(REPO_ROOT, pinsPath)}): ${e.message}`); }
|
|
114
|
+
if (!pins.models || typeof pins.models !== 'object') fail('pins.json: campo "models" (alias→id Anthropic) ausente');
|
|
115
|
+
if (!pins.image_model || typeof pins.image_model !== 'object' || !pins.image_model.id) {
|
|
116
|
+
fail('pins.json: campo "image_model" {id, endpoints_url} ausente');
|
|
117
|
+
}
|
|
118
|
+
return pins;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
// Checagem de endpoint do modelo de imagem (AC5 / Achado 1 do spike).
|
|
123
|
+
// Rede injetável (fetchImpl) para CI hermética; default usa fetch global (Node 18+).
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
|
|
126
|
+
async function validateImageEndpoint(imageModel, { fetchImpl, apiKey } = {}) {
|
|
127
|
+
const doFetch = fetchImpl || globalThis.fetch;
|
|
128
|
+
const url = imageModel.endpoints_url;
|
|
129
|
+
if (!url) fail('pins.json image_model.endpoints_url ausente — não há como validar disponibilidade (AC5)');
|
|
130
|
+
let res;
|
|
131
|
+
try {
|
|
132
|
+
res = await doFetch(url, { headers: apiKey ? { Authorization: `Bearer ${apiKey}` } : {} });
|
|
133
|
+
} catch (e) {
|
|
134
|
+
fail(`modelo de imagem "${imageModel.id}": falha ao consultar endpoint (${url}): ${e.message}`);
|
|
135
|
+
}
|
|
136
|
+
if (!res.ok) {
|
|
137
|
+
fail(`modelo de imagem "${imageModel.id}": endpoint indisponível — HTTP ${res.status} em ${url} (Achado 1 do spike: modelo descontinuado FALHA o compile)`);
|
|
138
|
+
}
|
|
139
|
+
let body;
|
|
140
|
+
try { body = await res.json(); } catch (e) { fail(`modelo de imagem "${imageModel.id}": resposta do endpoint não é JSON: ${e.message}`); }
|
|
141
|
+
const endpoints = body && body.data && body.data.endpoints;
|
|
142
|
+
if (!Array.isArray(endpoints) || endpoints.length === 0) {
|
|
143
|
+
fail(`modelo de imagem "${imageModel.id}": SEM endpoints ativos ("No endpoints" — Achado 1 do spike). Pino de imagem morto: compile ABORTADO.`);
|
|
144
|
+
}
|
|
145
|
+
return { id: imageModel.id, endpoints_count: endpoints.length };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// ---------------------------------------------------------------------------
|
|
149
|
+
// Compilação.
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Compila o pod em bundle + lock (não escreve o lock; devolve o objeto). Async por causa
|
|
154
|
+
* da checagem de endpoint (AC5). `opts.fetchImpl`/`opts.apiKey` injetáveis (CI mocka a rede).
|
|
155
|
+
*/
|
|
156
|
+
async function compile(podDir, opts = {}) {
|
|
157
|
+
const podRoot = path.resolve(podDir);
|
|
158
|
+
if (!fs.existsSync(podRoot) || !fs.statSync(podRoot).isDirectory()) {
|
|
159
|
+
fail(`pod-dir inexistente ou não é diretório: ${podDir}`);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// pod-spec.json → nome do pod + workflowId (D6: nome vem do spec, não do path).
|
|
163
|
+
const specPath = path.join(podRoot, 'pod-spec.json');
|
|
164
|
+
if (!fs.existsSync(specPath)) fail(`pod-spec.json ausente em ${podDir} — não é um pod v0.3`);
|
|
165
|
+
const spec = JSON.parse(read(specPath));
|
|
166
|
+
const podName = spec.pod;
|
|
167
|
+
const wfId = spec.workflowId || podName;
|
|
168
|
+
if (!podName) fail('pod-spec.json sem campo "pod"');
|
|
169
|
+
|
|
170
|
+
const wfPath = path.join(podRoot, 'workflows', `wf-${wfId}.yaml`);
|
|
171
|
+
if (!fs.existsSync(wfPath)) fail(`workflow ausente: workflows/wf-${wfId}.yaml`);
|
|
172
|
+
|
|
173
|
+
// Preflight de contrato — REUSO do validador (não reimplementa; D3). Fail-loud.
|
|
174
|
+
try {
|
|
175
|
+
validateWorkflow(wfPath, podRoot);
|
|
176
|
+
} catch (e) {
|
|
177
|
+
if (e instanceof Fail) fail(`pod-fonte reprovado por validate-pod-workflow: ${e.message}`);
|
|
178
|
+
throw e;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const doc = parseYaml(read(wfPath));
|
|
182
|
+
const order = topoOrder(doc);
|
|
183
|
+
const stepById = (id) => doc.steps.find((s) => s.id === id);
|
|
184
|
+
|
|
185
|
+
// Pins.
|
|
186
|
+
const pinsPath = opts.pinsPath || path.join(REPO_ROOT, 'exports', podName, 'pins.json');
|
|
187
|
+
const pins = loadPins(pinsPath);
|
|
188
|
+
|
|
189
|
+
// Inventário de knowledge .md do pod (para o check de órfãos, D2 check 3).
|
|
190
|
+
const knowledgeDir = path.join(podRoot, 'knowledge');
|
|
191
|
+
const podKnowledgeMd = fs.existsSync(knowledgeDir)
|
|
192
|
+
? fs.readdirSync(knowledgeDir).filter((f) => f.endsWith('.md')).sort()
|
|
193
|
+
: [];
|
|
194
|
+
const knowledgeExclude = Array.isArray(doc.knowledge_exclude) ? doc.knowledge_exclude : [];
|
|
195
|
+
|
|
196
|
+
const perFileSha = {}; // relpath (posix, pod-relativo ou framework-relativo p/ veto) → sha
|
|
197
|
+
const bundleFiles = []; // { rel, content(Buffer|string) }
|
|
198
|
+
const claimedKnowledge = new Set();
|
|
199
|
+
const phasesMeta = {};
|
|
200
|
+
const modelosAgentes = {};
|
|
201
|
+
const vetoScriptsToBundle = new Set();
|
|
202
|
+
|
|
203
|
+
function trackSource(absPath, relKey) {
|
|
204
|
+
const buf = readBuf(absPath);
|
|
205
|
+
perFileSha[relKey] = sha256(buf);
|
|
206
|
+
return buf;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// ---- Tabela de compilação (ADR-018 Decisão 2), por fase, na ordem topológica ----
|
|
210
|
+
for (const stepId of order) {
|
|
211
|
+
const step = stepById(stepId);
|
|
212
|
+
const agentName = step.agent;
|
|
213
|
+
const agentAbs = path.join(podRoot, 'agents', `${agentName}.md`);
|
|
214
|
+
if (!fs.existsSync(agentAbs)) fail(`etapa "${stepId}": agente inexistente agents/${agentName}.md`);
|
|
215
|
+
const agentBuf = trackSource(agentAbs, `agents/${agentName}.md`);
|
|
216
|
+
const { frontmatter, body } = splitFrontmatter(agentBuf.toString('utf8'));
|
|
217
|
+
|
|
218
|
+
// Modelo PINADO (D4): frontmatter traz ALIAS; lock exige id concreto.
|
|
219
|
+
const alias = frontmatter.model;
|
|
220
|
+
if (!alias) fail(`etapa "${stepId}": agente sem "model" no frontmatter`);
|
|
221
|
+
const modelId = pins.models[alias];
|
|
222
|
+
if (!modelId) fail(`etapa "${stepId}": alias de modelo "${alias}" sem pin em ${path.relative(REPO_ROOT, pinsPath)} (D4: FALHA se algum alias sem pin)`);
|
|
223
|
+
modelosAgentes[stepId] = modelId;
|
|
224
|
+
const budgetTokens = frontmatter.budget_tokens != null ? Number(frontmatter.budget_tokens) : null;
|
|
225
|
+
|
|
226
|
+
// Knowledge declarado (D2): OBRIGATÓRIO para o compile.
|
|
227
|
+
const declared = Array.isArray(step.knowledge) ? step.knowledge : null;
|
|
228
|
+
if (!declared || declared.length === 0) {
|
|
229
|
+
fail(`etapa "${stepId}": campo "knowledge:" ausente ou vazio no wf — OBRIGATÓRIO para exportar (D2). ` +
|
|
230
|
+
`Declare a lista ordenada de knowledge/*.md que a fase realmente cita.`);
|
|
231
|
+
}
|
|
232
|
+
// Check 1 — existência.
|
|
233
|
+
for (const k of declared) {
|
|
234
|
+
const kAbs = path.join(knowledgeDir, k);
|
|
235
|
+
if (!fs.existsSync(kAbs)) {
|
|
236
|
+
fail(`etapa "${stepId}": knowledge declarado inexistente no pod — knowledge/${k} (D2 check 1: mata o fantasma tipo "hn-fetch.md" declarado num pod que não o tem)`);
|
|
237
|
+
}
|
|
238
|
+
claimedKnowledge.add(k);
|
|
239
|
+
}
|
|
240
|
+
// Check 2 — superconjunto (citações parseáveis ⊆ declarado).
|
|
241
|
+
const parsed = parseCommandKnowledge(body);
|
|
242
|
+
for (const c of parsed) {
|
|
243
|
+
if (!declared.includes(c)) {
|
|
244
|
+
fail(`etapa "${stepId}": knowledge/${c} é CITADO na linha de comando do agente mas NÃO está declarado em knowledge: [${declared.join(', ')}] ` +
|
|
245
|
+
`(D2 check 2: declaração deve ser superconjunto das citações, nunca subconjunto)`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Corpo do agente + golden rules + knowledge (ORDEM DECLARADA) + memória (SÓ-LEITURA).
|
|
250
|
+
const golden = extractGoldenRules(body);
|
|
251
|
+
const sysParts = [];
|
|
252
|
+
sysParts.push(`# AGENTE DA FASE (${agentName})\n\n${body}`);
|
|
253
|
+
if (golden) sysParts.push(`\n\n# REGRAS DE OURO (golden rules — ${agentName})\n\n${golden}`);
|
|
254
|
+
for (const k of declared) { // ordem declarada = ordem de anexação (D2)
|
|
255
|
+
const kBuf = trackSource(path.join(knowledgeDir, k), `knowledge/${k}`);
|
|
256
|
+
sysParts.push(`\n\n# KNOWLEDGE: ${k}\n\n${kBuf.toString('utf8').trim()}`);
|
|
257
|
+
bundleFiles.push({ rel: `knowledge/${k}`, content: kBuf });
|
|
258
|
+
}
|
|
259
|
+
// Memória consolidada (SÓ-LEITURA — recordLearning DESLIGADO no export).
|
|
260
|
+
const consolidatedAbs = path.join(podRoot, 'memory', 'learnings.consolidated.md');
|
|
261
|
+
let consolidatedBlock = '';
|
|
262
|
+
if (fs.existsSync(consolidatedAbs)) {
|
|
263
|
+
const cBuf = trackSource(consolidatedAbs, 'memory/learnings.consolidated.md');
|
|
264
|
+
// Ramificação POR TRANSPORTE (DF-SF11.2-2, agora também DF-SF11.4-6): o prompt
|
|
265
|
+
// compilado nunca cita arquivo que não viaja no bundle. `learnings.jsonl` (log cru)
|
|
266
|
+
// sai de vez — o agente nunca o lê. A trilha auditável das endurecidas
|
|
267
|
+
// (`memory/learnings.hardened.md`) existe no repositório do pod, não no bundle:
|
|
268
|
+
// a linha é REESCRITA (não some) para não deixar referência pendurada no export,
|
|
269
|
+
// preservando a referência agregada que a precede.
|
|
270
|
+
const cBody = cBuf.toString('utf8')
|
|
271
|
+
.split(/\r?\n/)
|
|
272
|
+
.filter((l) => !/learnings\.jsonl/.test(l))
|
|
273
|
+
.map((l) => (/learnings\.hardened\.md/.test(l)
|
|
274
|
+
? '_Detalhe auditável das endurecidas (asserção, aprovador, momento) vive no repositório do pod — NÃO viaja no bundle do export; aqui valem os arquivos de knowledge compilados acima._'
|
|
275
|
+
: l))
|
|
276
|
+
.join('\n').trim();
|
|
277
|
+
consolidatedBlock = `\n\n# MEMÓRIA CONSOLIDADA DO POD (SÓ-LEITURA — não evolui no export; recordLearning DESLIGADO)\n\n${cBody}`;
|
|
278
|
+
sysParts.push(consolidatedBlock);
|
|
279
|
+
}
|
|
280
|
+
sysParts.push('\n\n# EXECUÇÃO SERVER-SIDE (export)\n' +
|
|
281
|
+
'Você roda como executor autônomo via API, SEM operador humano na etapa. A memória acima é SÓ-LEITURA ' +
|
|
282
|
+
'(não registre aprendizados). Use SOMENTE as tools fornecidas ao executor. Ao terminar, escreva o artefato ' +
|
|
283
|
+
'final da etapa no path exato indicado e pare. Não invente fato fora da fonte.');
|
|
284
|
+
const systemPrompt = sysParts.join('');
|
|
285
|
+
|
|
286
|
+
// Template → contrato de saída no user prompt.
|
|
287
|
+
const tmplRel = step.template;
|
|
288
|
+
const tmplAbs = path.join(podRoot, tmplRel);
|
|
289
|
+
const tmplBuf = trackSource(tmplAbs, tmplRel);
|
|
290
|
+
const userPrompt = [
|
|
291
|
+
`# CONTRATO DE SAÍDA — fase ${stepId}`,
|
|
292
|
+
`Escreva o artefato "${(step.outputs || []).join(', ')}" EXATAMENTE no formato do template abaixo, com todos os headings "##" e campos de máquina.`,
|
|
293
|
+
'',
|
|
294
|
+
'```',
|
|
295
|
+
tmplBuf.toString('utf8').trim(),
|
|
296
|
+
'```',
|
|
297
|
+
].join('\n');
|
|
298
|
+
bundleFiles.push({ rel: `templates/${path.basename(tmplRel)}`, content: tmplBuf });
|
|
299
|
+
|
|
300
|
+
// Vetos: command_check blessed → empacotar o script blessed no bundle (D2 tabela linha 6).
|
|
301
|
+
const assertions = (step.veto && Array.isArray(step.veto.assertions)) ? step.veto.assertions : [];
|
|
302
|
+
for (const a of assertions) {
|
|
303
|
+
if (a && a.type === 'command_check' && typeof a.command === 'string') {
|
|
304
|
+
vetoScriptsToBundle.add(a.command);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Escreve os prompts compilados da fase no bundle.
|
|
309
|
+
bundleFiles.push({ rel: `phases/${stepId}/system.md`, content: systemPrompt });
|
|
310
|
+
bundleFiles.push({ rel: `phases/${stepId}/user.md`, content: userPrompt });
|
|
311
|
+
phasesMeta[stepId] = {
|
|
312
|
+
agent: agentName,
|
|
313
|
+
model_id: modelId,
|
|
314
|
+
budget_tokens: budgetTokens,
|
|
315
|
+
knowledge: declared, // ordem preservada
|
|
316
|
+
template: `templates/${path.basename(tmplRel)}`,
|
|
317
|
+
outputs: step.outputs || [],
|
|
318
|
+
veto_scripts: assertions.filter((a) => a && a.type === 'command_check').map((a) => a.command),
|
|
319
|
+
};
|
|
320
|
+
bundleFiles.push({ rel: `phases/${stepId}/meta.json`, content: JSON.stringify(phasesMeta[stepId], null, 2) + '\n' });
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Check 3 — órfãos (D2): todo knowledge/*.md do pod é reivindicado OU excluído.
|
|
324
|
+
const orphans = podKnowledgeMd.filter((k) => !claimedKnowledge.has(k) && !knowledgeExclude.includes(k));
|
|
325
|
+
if (orphans.length > 0) {
|
|
326
|
+
fail(`knowledge órfão(s) — presente(s) no pod mas não reivindicado(s) por nenhuma fase nem em knowledge_exclude: ${orphans.join(', ')} ` +
|
|
327
|
+
`(D2 check 3: teria pego "identidade-visual-mascote.md" esquecido). Declare-o(s) na fase que usa ou em knowledge_exclude: no topo do wf.`);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Empacota os scripts de veto blessed citados (verbatim).
|
|
331
|
+
for (const cmd of [...vetoScriptsToBundle].sort()) {
|
|
332
|
+
const vAbs = path.join(VETO_CHECKS_DIR, cmd);
|
|
333
|
+
if (!fs.existsSync(vAbs)) fail(`veto blessed citado inexistente: scripts/veto-checks/${cmd}`);
|
|
334
|
+
const vBuf = trackSource(vAbs, `veto-checks/${cmd}`);
|
|
335
|
+
bundleFiles.push({ rel: `veto-checks/${cmd}`, content: vBuf });
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Grafo VERBATIM (D3) + pod-spec.
|
|
339
|
+
const wfBuf = trackSource(wfPath, `workflows/wf-${wfId}.yaml`);
|
|
340
|
+
bundleFiles.push({ rel: 'workflow.yaml', content: wfBuf });
|
|
341
|
+
const specBuf = trackSource(specPath, 'pod-spec.json');
|
|
342
|
+
bundleFiles.push({ rel: 'pod-spec.json', content: specBuf });
|
|
343
|
+
const consolidatedAbs = path.join(podRoot, 'memory', 'learnings.consolidated.md');
|
|
344
|
+
if (fs.existsSync(consolidatedAbs)) {
|
|
345
|
+
bundleFiles.push({ rel: 'memory/learnings.consolidated.md', content: readBuf(consolidatedAbs) });
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Validação de endpoint do modelo de imagem (AC5) — sempre, salvo debug local.
|
|
349
|
+
let imageEndpoint = null;
|
|
350
|
+
if (opts.checkEndpoint !== false) {
|
|
351
|
+
imageEndpoint = await validateImageEndpoint(pins.image_model, {
|
|
352
|
+
fetchImpl: opts.fetchImpl,
|
|
353
|
+
apiKey: opts.apiKey || process.env.OPENROUTER_API_KEY,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// Índice do bundle (determinístico).
|
|
358
|
+
const bundleIndex = {
|
|
359
|
+
pod: podName,
|
|
360
|
+
compiler_version: COMPILER_VERSION,
|
|
361
|
+
graph: 'workflow.yaml',
|
|
362
|
+
order,
|
|
363
|
+
phases: phasesMeta,
|
|
364
|
+
modelo_pinado: { agents: sortedObject(modelosAgentes), image: pins.image_model.id },
|
|
365
|
+
};
|
|
366
|
+
bundleFiles.push({ rel: 'bundle.json', content: JSON.stringify(bundleIndex, null, 2) + '\n' });
|
|
367
|
+
|
|
368
|
+
// pod_sha = digest de conteúdo determinístico das FONTES que alimentam o bundle
|
|
369
|
+
// (git-independente; "same pod@sha → byte-identical bundle"). D4/AC4.
|
|
370
|
+
const podShaInput = Object.keys(perFileSha).sort().map((k) => `${k}:${perFileSha[k]}`).join('\n');
|
|
371
|
+
const podSha = sha256(Buffer.from(podShaInput, 'utf8'));
|
|
372
|
+
|
|
373
|
+
// bundle_hashes = sha de cada arquivo escrito no bundle.
|
|
374
|
+
const bundleHashes = {};
|
|
375
|
+
for (const f of bundleFiles) {
|
|
376
|
+
const buf = Buffer.isBuffer(f.content) ? f.content : Buffer.from(f.content, 'utf8');
|
|
377
|
+
bundleHashes[f.rel] = sha256(buf);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const framework_version = JSON.parse(read(path.join(REPO_ROOT, 'package.json'))).version;
|
|
381
|
+
|
|
382
|
+
// Schema do lock (AC6) — chaves na ordem do schema; hashes com chaves ordenadas.
|
|
383
|
+
const lock = {
|
|
384
|
+
pod: podName,
|
|
385
|
+
pod_sha: podSha,
|
|
386
|
+
per_file_sha: sortedObject(perFileSha),
|
|
387
|
+
modelo_pinado: {
|
|
388
|
+
agents: sortedObject(modelosAgentes),
|
|
389
|
+
image: sortedObject({ id: pins.image_model.id, endpoints_url: pins.image_model.endpoints_url || null }),
|
|
390
|
+
},
|
|
391
|
+
framework_version,
|
|
392
|
+
compiler_version: COMPILER_VERSION,
|
|
393
|
+
bundle_hashes: sortedObject(bundleHashes),
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
return { podName, bundleFiles, lock, imageEndpoint };
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/** Escreve o bundle em disco (limpa o dir antes → determinismo/sem stale). */
|
|
400
|
+
function writeBundle(bundleDir, bundleFiles) {
|
|
401
|
+
fs.rmSync(bundleDir, { recursive: true, force: true });
|
|
402
|
+
for (const f of bundleFiles) {
|
|
403
|
+
const abs = path.join(bundleDir, f.rel);
|
|
404
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
405
|
+
fs.writeFileSync(abs, Buffer.isBuffer(f.content) ? f.content : Buffer.from(f.content, 'utf8'));
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function serializeLock(lock) {
|
|
410
|
+
return JSON.stringify(lock, null, 2) + '\n';
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// ---------------------------------------------------------------------------
|
|
414
|
+
// CLI.
|
|
415
|
+
// ---------------------------------------------------------------------------
|
|
416
|
+
|
|
417
|
+
async function main() {
|
|
418
|
+
const argv = process.argv.slice(2);
|
|
419
|
+
const sub = argv[0];
|
|
420
|
+
if (sub !== 'compile') {
|
|
421
|
+
console.error('Uso: node scripts/pod-export-compile.cjs compile <pod-dir> [--out <dir>] [--pins <file>] [--lock-out <file>] [--no-endpoint-check]');
|
|
422
|
+
process.exit(2);
|
|
423
|
+
}
|
|
424
|
+
const rest = argv.slice(1);
|
|
425
|
+
const flags = {};
|
|
426
|
+
const positionals = [];
|
|
427
|
+
for (let i = 0; i < rest.length; i++) {
|
|
428
|
+
if (rest[i] === '--out') flags.out = rest[++i];
|
|
429
|
+
else if (rest[i] === '--pins') flags.pins = rest[++i];
|
|
430
|
+
else if (rest[i] === '--lock-out') flags.lockOut = rest[++i];
|
|
431
|
+
else if (rest[i] === '--no-endpoint-check') flags.noEndpoint = true;
|
|
432
|
+
else positionals.push(rest[i]);
|
|
433
|
+
}
|
|
434
|
+
const podDir = positionals[0];
|
|
435
|
+
if (!podDir) {
|
|
436
|
+
console.error('Erro: informe o <pod-dir>.');
|
|
437
|
+
process.exit(2);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
try {
|
|
441
|
+
const { podName, bundleFiles, lock, imageEndpoint } = await compile(podDir, {
|
|
442
|
+
pinsPath: flags.pins ? path.resolve(flags.pins) : undefined,
|
|
443
|
+
checkEndpoint: !flags.noEndpoint,
|
|
444
|
+
});
|
|
445
|
+
const bundleDir = flags.out
|
|
446
|
+
? path.resolve(flags.out)
|
|
447
|
+
: path.join(REPO_ROOT, '.power-claude', 'pod-export', podName, 'bundle');
|
|
448
|
+
const lockPath = flags.lockOut
|
|
449
|
+
? path.resolve(flags.lockOut)
|
|
450
|
+
: path.join(REPO_ROOT, 'exports', podName, 'export.lock.json');
|
|
451
|
+
|
|
452
|
+
writeBundle(bundleDir, bundleFiles);
|
|
453
|
+
fs.mkdirSync(path.dirname(lockPath), { recursive: true });
|
|
454
|
+
fs.writeFileSync(lockPath, serializeLock(lock));
|
|
455
|
+
|
|
456
|
+
console.log(`[OK] pod "${podName}" compilado.`);
|
|
457
|
+
console.log(` bundle : ${path.relative(process.cwd(), bundleDir)} (${bundleFiles.length} arquivos, NÃO commitado)`);
|
|
458
|
+
console.log(` lock : ${path.relative(process.cwd(), lockPath)} (commitado)`);
|
|
459
|
+
console.log(` pod_sha: ${lock.pod_sha}`);
|
|
460
|
+
if (imageEndpoint) console.log(` imagem : ${imageEndpoint.id} — ${imageEndpoint.endpoints_count} endpoint(s) ativo(s)`);
|
|
461
|
+
else console.log(' imagem : checagem de endpoint PULADA (--no-endpoint-check)');
|
|
462
|
+
process.exit(0);
|
|
463
|
+
} catch (e) {
|
|
464
|
+
if (e instanceof CompileError || e instanceof Fail) {
|
|
465
|
+
console.error(`[FALHA] ${e.message}`);
|
|
466
|
+
process.exit(1);
|
|
467
|
+
}
|
|
468
|
+
throw e;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if (require.main === module) {
|
|
473
|
+
main();
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
module.exports = {
|
|
477
|
+
COMPILER_VERSION,
|
|
478
|
+
compile,
|
|
479
|
+
writeBundle,
|
|
480
|
+
serializeLock,
|
|
481
|
+
validateImageEndpoint,
|
|
482
|
+
splitFrontmatter,
|
|
483
|
+
extractGoldenRules,
|
|
484
|
+
parseCommandKnowledge,
|
|
485
|
+
loadPins,
|
|
486
|
+
CompileError,
|
|
487
|
+
};
|