freeharness 0.4.1
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/LICENSE +21 -0
- package/NOTICE +108 -0
- package/README.md +134 -0
- package/canonical/HARVEST.yaml +858 -0
- package/canonical/PROVENANCE.yaml +740 -0
- package/canonical/agents/README.md +95 -0
- package/canonical/agents/agentic-architect.md +18 -0
- package/canonical/agents/database-reviewer.md +41 -0
- package/canonical/agents/explorer-ai-engineer-analyst.md +65 -0
- package/canonical/agents/pr-reviewer.md +96 -0
- package/canonical/agents/python-reviewer.md +55 -0
- package/canonical/agents/report-formatter.md +19 -0
- package/canonical/agents/security-reviewer.md +53 -0
- package/canonical/agents/test-writer.md +34 -0
- package/canonical/commands/fh-context.md +37 -0
- package/canonical/evals/promptfoo.redteam.yaml +108 -0
- package/canonical/hooks/cost-prices.json +14 -0
- package/canonical/hooks/freeharness-auto-memory.mjs +158 -0
- package/canonical/hooks/freeharness-config-guard.mjs +162 -0
- package/canonical/hooks/freeharness-context-monitor.mjs +198 -0
- package/canonical/hooks/freeharness-converge.mjs +227 -0
- package/canonical/hooks/freeharness-cost-tracker.mjs +1027 -0
- package/canonical/hooks/freeharness-memory-guard.mjs +57 -0
- package/canonical/hooks/freeharness-output-pruner.mjs +333 -0
- package/canonical/hooks/freeharness-precompact.mjs +323 -0
- package/canonical/hooks/freeharness-repeat-tool.mjs +208 -0
- package/canonical/hooks/freeharness-security-guidance.mjs +164 -0
- package/canonical/hooks/freeharness-session-start +583 -0
- package/canonical/hooks/hooks.auto-memory.claude-code.json +16 -0
- package/canonical/hooks/hooks.claude-code.json +17 -0
- package/canonical/hooks/hooks.config-guard.claude-code.json +16 -0
- package/canonical/hooks/hooks.context-monitor.claude-code.json +15 -0
- package/canonical/hooks/hooks.converge.claude-code.json +15 -0
- package/canonical/hooks/hooks.cost-tracker.claude-code.json +37 -0
- package/canonical/hooks/hooks.memory-guard.claude-code.json +16 -0
- package/canonical/hooks/hooks.output-pruner.claude-code.json +16 -0
- package/canonical/hooks/hooks.precompact.claude-code.json +15 -0
- package/canonical/hooks/hooks.repeat-tool.claude-code.json +25 -0
- package/canonical/hooks/hooks.security-guidance.claude-code.json +16 -0
- package/canonical/mcp/servers.json +20 -0
- package/canonical/openspec/config.base.yaml +89 -0
- package/canonical/openspec/schema.spec-driven.yaml +277 -0
- package/canonical/openspec/templates/data-contract.md +36 -0
- package/canonical/openspec/templates/design.md +84 -0
- package/canonical/openspec/templates/eval-plan.md +33 -0
- package/canonical/openspec/templates/follow-ups.md +2 -0
- package/canonical/openspec/templates/proposal.md +45 -0
- package/canonical/openspec/templates/spec.md +42 -0
- package/canonical/openspec/templates/tasks.md +38 -0
- package/canonical/profiles/local-llamacpp.LOCAL-MODELS.md +47 -0
- package/canonical/profiles/local-llamacpp.json +27 -0
- package/canonical/profiles/local-ollama.json +20 -0
- package/canonical/profiles/mcp.json +91 -0
- package/canonical/rules/CLAUDE.md +78 -0
- package/canonical/rules/project-CLAUDE.template.md +62 -0
- package/canonical/rules/routing.md +20 -0
- package/canonical/rules/safety.md +41 -0
- package/canonical/settings/settings.cache-hygiene.claude-code.json +5 -0
- package/canonical/skills/agent-evaluation/SKILL.md +102 -0
- package/canonical/skills/agent-evaluation/assets/evaluation_report_template.md +206 -0
- package/canonical/skills/agent-evaluation/evals/cases.yaml +106 -0
- package/canonical/skills/agent-evaluation/references/dataset-preparation.md +351 -0
- package/canonical/skills/agent-evaluation/references/scorers-constraints.md +165 -0
- package/canonical/skills/agent-evaluation/references/scorers.md +431 -0
- package/canonical/skills/agent-evaluation/references/setup-guide.md +252 -0
- package/canonical/skills/agent-evaluation/references/tracing-integration.md +164 -0
- package/canonical/skills/agent-evaluation/references/troubleshooting.md +514 -0
- package/canonical/skills/agent-evaluation/scripts/analyze_results.py +462 -0
- package/canonical/skills/agent-evaluation/scripts/create_dataset_template.py +382 -0
- package/canonical/skills/agent-evaluation/scripts/list_datasets.py +273 -0
- package/canonical/skills/agent-evaluation/scripts/run_evaluation_template.py +309 -0
- package/canonical/skills/agent-evaluation/scripts/setup_mlflow.py +353 -0
- package/canonical/skills/agent-evaluation/scripts/utils/__init__.py +27 -0
- package/canonical/skills/agent-evaluation/scripts/utils/env_validation.py +123 -0
- package/canonical/skills/agent-evaluation/scripts/utils/tracing_utils.py +108 -0
- package/canonical/skills/agent-evaluation/scripts/validate_agent_tracing.py +148 -0
- package/canonical/skills/agent-evaluation/scripts/validate_auth.py +240 -0
- package/canonical/skills/agent-evaluation/scripts/validate_environment.py +185 -0
- package/canonical/skills/agent-evaluation/scripts/validate_tracing_runtime.py +318 -0
- package/canonical/skills/agentic-architecture/SKILL.md +41 -0
- package/canonical/skills/agentic-architecture/evals/cases.yaml +94 -0
- package/canonical/skills/agentic-architecture/reference/context-engineering.md +75 -0
- package/canonical/skills/agentic-architecture/reference/patterns.md +76 -0
- package/canonical/skills/agentic-architecture/reference/reliability-observability.md +94 -0
- package/canonical/skills/agentic-architecture/reference/review-framework.md +59 -0
- package/canonical/skills/code-review/SKILL.md +52 -0
- package/canonical/skills/code-review/evals/cases.yaml +197 -0
- package/canonical/skills/git-workflow/SKILL.md +41 -0
- package/canonical/skills/git-workflow/evals/cases.yaml +92 -0
- package/canonical/skills/local-code/SKILL.md +24 -0
- package/canonical/skills/local-code/evals/cases.yaml +85 -0
- package/canonical/skills/local-code/scripts/query_llama.py +68 -0
- package/canonical/skills/report-formatting/SKILL.md +62 -0
- package/canonical/skills/report-formatting/evals/cases.yaml +83 -0
- package/canonical/skills/report-formatting/reference/ARCHITECTURE.md +135 -0
- package/canonical/skills/report-formatting/reference/HELPERS.md +120 -0
- package/canonical/skills/report-formatting/reference/PPTX.md +136 -0
- package/canonical/skills/report-formatting/reference/RELEASE.md +99 -0
- package/canonical/skills/report-formatting/reference/TEMPLATES.md +48 -0
- package/canonical/skills/report-formatting/reference/authoring.md +66 -0
- package/canonical/skills/report-formatting/scripts/architecture-template.md +271 -0
- package/canonical/skills/report-formatting/scripts/assets/claro-logo.png +0 -0
- package/canonical/skills/report-formatting/scripts/assets/claro-wordmark.svg +1 -0
- package/canonical/skills/report-formatting/scripts/build-architecture.js +57 -0
- package/canonical/skills/report-formatting/scripts/build-md-claro.js +224 -0
- package/canonical/skills/report-formatting/scripts/build-release.js +51 -0
- package/canonical/skills/report-formatting/scripts/check-env.js +58 -0
- package/canonical/skills/report-formatting/scripts/docmodel.js +283 -0
- package/canonical/skills/report-formatting/scripts/example-build.js +119 -0
- package/canonical/skills/report-formatting/scripts/example_build_ArchitectureReview_docx.js +195 -0
- package/canonical/skills/report-formatting/scripts/example_build_ExecutiveReport_docx.js +114 -0
- package/canonical/skills/report-formatting/scripts/package.json +17 -0
- package/canonical/skills/report-formatting/scripts/pptx/example_build_StatusReport_pptx.py +223 -0
- package/canonical/skills/report-formatting/scripts/pptx/example_build_WeeklyStatus_pptx.py +245 -0
- package/canonical/skills/report-formatting/scripts/pptx/pptx_office.py +144 -0
- package/canonical/skills/report-formatting/scripts/pptx/requirements.txt +7 -0
- package/canonical/skills/report-formatting/scripts/pptx/status_report_blocks.py +193 -0
- package/canonical/skills/report-formatting/scripts/pptx/theme_claro_pptx.py +473 -0
- package/canonical/skills/report-formatting/scripts/release-template.md +80 -0
- package/canonical/skills/report-formatting/scripts/render-mermaid.js +105 -0
- package/canonical/skills/report-formatting/scripts/theme-claro.js +403 -0
- package/canonical/skills/subagent-driven-development/SKILL.md +60 -0
- package/canonical/skills/subagent-driven-development/evals/cases.yaml +208 -0
- package/canonical/skills/subagent-driven-development/reference/brief.md +91 -0
- package/canonical/skills/subagent-driven-development/reference/handoff.md +118 -0
- package/canonical/skills/subagent-driven-development/scripts/validate-handoff.mjs +850 -0
- package/canonical/skills/systematic-debugging/SKILL.md +44 -0
- package/canonical/skills/systematic-debugging/evals/cases.yaml +90 -0
- package/canonical/skills/test-driven-development/SKILL.md +42 -0
- package/canonical/skills/test-driven-development/evals/cases.yaml +86 -0
- package/canonical/skills/test-driven-development/reference/writing-good-tests.md +52 -0
- package/canonical/skills/verification-before-completion/SKILL.md +53 -0
- package/canonical/skills/verification-before-completion/evals/cases.yaml +107 -0
- package/dist/adapters/content/language-lint.d.ts +46 -0
- package/dist/adapters/content/language-lint.js +191 -0
- package/dist/adapters/harness/claude-code.d.ts +57 -0
- package/dist/adapters/harness/claude-code.js +385 -0
- package/dist/adapters/harness/index.d.ts +3 -0
- package/dist/adapters/harness/index.js +17 -0
- package/dist/adapters/harness/opencode.d.ts +7 -0
- package/dist/adapters/harness/opencode.js +166 -0
- package/dist/adapters/harness/plugin.d.ts +22 -0
- package/dist/adapters/harness/plugin.js +257 -0
- package/dist/adapters/memory/doctor.d.ts +480 -0
- package/dist/adapters/memory/doctor.js +1217 -0
- package/dist/adapters/memory/vendored.d.ts +150 -0
- package/dist/adapters/memory/vendored.js +487 -0
- package/dist/adapters/package/node.d.ts +9 -0
- package/dist/adapters/package/node.js +20 -0
- package/dist/adapters/prompt/readline.d.ts +19 -0
- package/dist/adapters/prompt/readline.js +53 -0
- package/dist/adapters/sync/diff.d.ts +43 -0
- package/dist/adapters/sync/diff.js +380 -0
- package/dist/cli/cleanup.d.ts +86 -0
- package/dist/cli/cleanup.js +382 -0
- package/dist/cli/cost.d.ts +304 -0
- package/dist/cli/cost.js +501 -0
- package/dist/cli/doctor.d.ts +205 -0
- package/dist/cli/doctor.js +654 -0
- package/dist/cli/executor.d.ts +5 -0
- package/dist/cli/executor.js +48 -0
- package/dist/cli/plugin-validate.d.ts +37 -0
- package/dist/cli/plugin-validate.js +256 -0
- package/dist/cli/prefix.d.ts +68 -0
- package/dist/cli/prefix.js +218 -0
- package/dist/cli/profile.d.ts +170 -0
- package/dist/cli/profile.js +285 -0
- package/dist/cli/runner.d.ts +10 -0
- package/dist/cli/runner.js +27 -0
- package/dist/cli/uninstall.d.ts +65 -0
- package/dist/cli/uninstall.js +147 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +989 -0
- package/dist/infra/dogfood.d.ts +31 -0
- package/dist/infra/dogfood.js +51 -0
- package/dist/infra/fsutil.d.ts +40 -0
- package/dist/infra/fsutil.js +143 -0
- package/dist/infra/manifest.d.ts +76 -0
- package/dist/infra/manifest.js +92 -0
- package/dist/infra/paths.d.ts +19 -0
- package/dist/infra/paths.js +74 -0
- package/dist/infra/routing.d.ts +4 -0
- package/dist/infra/routing.js +7 -0
- package/node_modules/@freeharness/core/dist/context.d.ts +30 -0
- package/node_modules/@freeharness/core/dist/context.js +1 -0
- package/node_modules/@freeharness/core/dist/index.d.ts +5 -0
- package/node_modules/@freeharness/core/dist/index.js +6 -0
- package/node_modules/@freeharness/core/dist/planner.d.ts +13 -0
- package/node_modules/@freeharness/core/dist/planner.js +18 -0
- package/node_modules/@freeharness/core/dist/ports.d.ts +90 -0
- package/node_modules/@freeharness/core/dist/ports.js +1 -0
- package/node_modules/@freeharness/core/dist/registry.d.ts +41 -0
- package/node_modules/@freeharness/core/dist/registry.js +124 -0
- package/node_modules/@freeharness/core/dist/tiers.d.ts +30 -0
- package/node_modules/@freeharness/core/dist/tiers.js +99 -0
- package/node_modules/@freeharness/core/package.json +34 -0
- package/node_modules/@freeharness/sdd/PROVENANCE.yaml +175 -0
- package/node_modules/@freeharness/sdd/dist/src/bin/openspec.d.ts +2 -0
- package/node_modules/@freeharness/sdd/dist/src/bin/openspec.js +166 -0
- package/node_modules/@freeharness/sdd/dist/src/index.d.ts +14 -0
- package/node_modules/@freeharness/sdd/dist/src/index.js +11 -0
- package/node_modules/@freeharness/sdd/dist/src/init.d.ts +39 -0
- package/node_modules/@freeharness/sdd/dist/src/init.js +190 -0
- package/node_modules/@freeharness/sdd/dist/src/root-resolver.d.ts +8 -0
- package/node_modules/@freeharness/sdd/dist/src/root-resolver.js +32 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/archive.d.ts +81 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/archive.js +483 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/context.d.ts +4 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/context.js +48 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.d.ts +57 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.js +279 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/instructions.d.ts +67 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/instructions.js +460 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/list.d.ts +5 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/list.js +95 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/new-change.d.ts +6 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/new-change.js +150 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/schemas.d.ts +4 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/schemas.js +23 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/shared.d.ts +56 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/shared.js +140 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/status.d.ts +8 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/status.js +85 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/validate.d.ts +6 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/validate.js +229 -0
- package/node_modules/@freeharness/sdd/dist/src/validate-change.d.ts +40 -0
- package/node_modules/@freeharness/sdd/dist/src/validate-change.js +114 -0
- package/node_modules/@freeharness/sdd/dist/src/validate.d.ts +24 -0
- package/node_modules/@freeharness/sdd/dist/src/validate.js +72 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/specs-apply.d.ts +130 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/specs-apply.js +981 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-metadata.d.ts +46 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-metadata.js +128 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.d.ts +26 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.js +32 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/file-system.d.ts +50 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/file-system.js +394 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/global-config.d.ts +15 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/global-config.js +49 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/graph.d.ts +71 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/graph.js +164 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.d.ts +11 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.js +21 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/instruction-loader.d.ts +102 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/instruction-loader.js +230 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.d.ts +18 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.js +138 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/resolver.d.ts +82 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/resolver.js +333 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/schema.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/schema.js +110 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/state.d.ts +11 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/state.js +32 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/task-progress.d.ts +33 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/task-progress.js +149 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/types.d.ts +39 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/types.js +49 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/claude.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/claude.js +31 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/index.d.ts +10 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/index.js +10 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/opencode.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/opencode.js +26 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/generator.d.ts +28 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/generator.js +41 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/index.d.ts +23 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/index.js +25 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/invocation.d.ts +72 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/invocation.js +76 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/registry.d.ts +39 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/registry.js +53 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/types.d.ts +62 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/types.js +7 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/yaml.d.ts +35 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/yaml.js +47 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-references.d.ts +33 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-references.js +55 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/allowed-tools.d.ts +11 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/allowed-tools.js +11 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/skill-generation.d.ts +48 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/skill-generation.js +99 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/skill-templates.d.ts +19 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/skill-templates.js +18 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/types.d.ts +18 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/types.js +4 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/apply-change.d.ts +19 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/apply-change.js +207 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/archive-change.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/archive-change.js +409 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/bulk-archive-change.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/bulk-archive-change.js +673 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/continue-change.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/continue-change.js +230 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/explore.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/explore.js +550 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/feedback.d.ts +8 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/feedback.js +107 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/ff-change.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/ff-change.js +228 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/new-change.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/new-change.js +147 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/onboard.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/onboard.js +571 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/propose.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/propose.js +322 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/store-selection.d.ts +7 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/store-selection.js +7 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/sync-specs.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/sync-specs.js +518 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/update-change.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/update-change.js +176 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/verify-change.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/verify-change.js +344 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.d.ts +39 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.js +54 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/delta-resolution.d.ts +35 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/delta-resolution.js +171 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.d.ts +27 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.js +210 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/code-fence.d.ts +14 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/code-fence.js +48 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/markdown-parser.d.ts +22 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/markdown-parser.js +186 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.d.ts +65 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.js +409 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.d.ts +55 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.js +98 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/spec-structure.d.ts +8 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/spec-structure.js +77 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/purpose-placeholder.d.ts +44 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/purpose-placeholder.js +116 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/base.schema.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/base.schema.js +17 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/change.schema.d.ts +72 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/change.schema.js +30 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/index.d.ts +3 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/index.js +3 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/spec.schema.d.ts +17 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/spec.schema.js +14 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.d.ts +39 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.js +114 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.d.ts +45 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.js +105 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-numbering.d.ts +15 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-numbering.js +56 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/types.d.ts +17 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/types.js +1 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.d.ts +94 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.js +756 -0
- package/node_modules/@freeharness/sdd/package.json +57 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/LICENSE.upstream +22 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/schema.upstream.yaml +232 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/README.md +19 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-apply-change/SKILL.md +187 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-archive-change/SKILL.md +181 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-bulk-archive-change/SKILL.md +338 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-continue-change/SKILL.md +117 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-explore/SKILL.md +342 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-ff-change/SKILL.md +116 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-new-change/SKILL.md +76 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-onboard/SKILL.md +560 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-propose/SKILL.md +162 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-sync-specs/SKILL.md +261 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-update-change/SKILL.md +90 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-verify-change/SKILL.md +174 -0
- package/package.json +70 -0
- package/provenance/canonical.PROVENANCE.yaml +740 -0
- package/provenance/claude-mem.LICENSE.upstream +202 -0
- package/provenance/memory.PROVENANCE.yaml +399 -0
- package/provenance/sdd.PROVENANCE.yaml +175 -0
- package/vendor-licenses/caveman.LICENSE +27 -0
- package/vendor-licenses/deepseek-harness.LICENSE +21 -0
- package/vendor-licenses/ecc.LICENSE +21 -0
- package/vendor-licenses/pi.LICENSE +21 -0
- package/vendor-licenses/superpowers.LICENSE +21 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
---
|
|
2
|
+
lang: pt-BR
|
|
3
|
+
app: <app>
|
|
4
|
+
title: <app> — <papel do sistema em uma linha>
|
|
5
|
+
doc_type: Documento de Arquitetura de Software e System Design
|
|
6
|
+
version: <1.0>
|
|
7
|
+
status: <Em revisão | Aprovado | Rascunho>
|
|
8
|
+
date: <DD/MM/AAAA>
|
|
9
|
+
audience: <Arquitetura de IA, CCoE, time de desenvolvimento>
|
|
10
|
+
system_version: <x.y.z-commit ou tag do código descrito>
|
|
11
|
+
project: <Projeto> — Claro
|
|
12
|
+
org: <Área> | DADOS & IA
|
|
13
|
+
author: André Negrelli
|
|
14
|
+
role: Tech Lead AI Data Engineer
|
|
15
|
+
area: DADOS & IA
|
|
16
|
+
---
|
|
17
|
+
<!--
|
|
18
|
+
Architecture & System Design model (reference/ARCHITECTURE.md). Fixed sections, in
|
|
19
|
+
this order; the build fails on an unknown or missing mandatory section. Numbered
|
|
20
|
+
sections are numbered automatically (0. Sumário executivo ...), "### " sub-headings
|
|
21
|
+
get "N.k" numbers, "#### " are unnumbered. Diagrams: ```mermaid blocks are rendered
|
|
22
|
+
and embedded (title + legend inside the diagram; one concern per diagram); a line
|
|
23
|
+
"Figura N – ..." right after becomes the caption. Callouts: "> **Nota:** ..." explains a
|
|
24
|
+
non-trivial concept in two or three lines. Pointers to code as `path/file.py:line`.
|
|
25
|
+
Every number comes from a measurement, a manifest, a test run or a commit. "<!-- width: 70 -->" before a diagram scales it to 70 % of the text width; "<!-- cols: 30 70 -->" before a table fixes column widths. Comments like this one are never rendered. Sections marked "agentic" are mandatory for
|
|
26
|
+
LLM/agent systems; for a plain service write "Não se aplica." and say why in one line.
|
|
27
|
+
-->
|
|
28
|
+
|
|
29
|
+
## Elaboração e revisão
|
|
30
|
+
<!-- mandatory · who wrote, designed and reviewed; then the cover table is printed from the front matter. -->
|
|
31
|
+
| Nome | Papel | Responsabilidade |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| <Nome> | <Tech Lead — AI Data Engineer> | <Elaboração, desenho e revisão técnica> |
|
|
34
|
+
| <Nome> | <Arquiteto de IA / revisor> | <Revisão> |
|
|
35
|
+
|
|
36
|
+
## Histórico de revisões
|
|
37
|
+
<!-- mandatory · one row per issued version of THIS document. -->
|
|
38
|
+
| Versão | Data | Responsável | Descrição |
|
|
39
|
+
|---|---|---|---|
|
|
40
|
+
| <1.0> | <DD/MM/AAAA> | <Nome> | <Emissão para revisão> |
|
|
41
|
+
|
|
42
|
+
## Convenções
|
|
43
|
+
<!-- optional · how to read the document and where the other documents are. -->
|
|
44
|
+
**Convenções deste documento.** Diagramas em Mermaid (C4 e sequência). Callouts explicam, em duas ou três linhas, conceitos não triviais. Ponteiros `arquivo:linha` apontam para o código descrito, na versão `<system_version>`.
|
|
45
|
+
|
|
46
|
+
**Outros documentos.** <guia de operação>, <guia de deploy>, <inventário de variáveis>, <caderno de testes>, <release notes>.
|
|
47
|
+
|
|
48
|
+
## Sumário executivo
|
|
49
|
+
<!-- mandatory · arc42 §1+§4 in one page: what the system is, for whom, the core solution strategy (workflow vs agent, orchestration pattern, framework, model tier, persistence), and the architecture principles that constrain every decision. -->
|
|
50
|
+
<O que o sistema é, para quem, o que entra e o que sai, volume-alvo e o que ele NÃO faz — em um parágrafo.>
|
|
51
|
+
|
|
52
|
+
<Estratégia da solução em um parágrafo: por que este nível de complexidade (chamada direta ao modelo → agente único com ferramentas → multiagente), padrão de orquestração escolhido, framework, modelo por tarefa, persistência.>
|
|
53
|
+
|
|
54
|
+
### Princípios de arquitetura
|
|
55
|
+
| # | Princípio | Consequência de desenho |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| P1 | <princípio em uma frase> | <o que ele obriga ou proíbe no código> |
|
|
58
|
+
| P2 | <...> | <...> |
|
|
59
|
+
|
|
60
|
+
## Visão e contexto
|
|
61
|
+
<!-- mandatory · arc42 §1-3 + ISO 42010: goals and non-goals, stakeholders and their concerns, constraints (technical, organisational, regulatory/LGPD, cost/latency ceilings), business and technical context with the C4 L1 diagram. For agents: which systems it may act upon vs only read. -->
|
|
62
|
+
### Objetivos e não objetivos
|
|
63
|
+
- **Objetivo:** <meta mensurável>.
|
|
64
|
+
- **Não objetivo:** <o que fica explicitamente fora>.
|
|
65
|
+
|
|
66
|
+
### Stakeholders e preocupações
|
|
67
|
+
| Stakeholder | Preocupação | Onde é respondida |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| <Operação / CCoE> | <disponibilidade, custo, rollback> | <§ Infraestrutura, § Observabilidade> |
|
|
70
|
+
| <Negócio> | <qualidade da resposta, prazo> | <§ Atributos de qualidade> |
|
|
71
|
+
|
|
72
|
+
### Restrições
|
|
73
|
+
- <Técnica: plataforma, linguagem, provedor de modelo, versão de runtime.>
|
|
74
|
+
- <Organizacional: times, janelas, aprovações.>
|
|
75
|
+
- <Regulatória: LGPD/PII, residência de dados, termos do provedor.>
|
|
76
|
+
- <Orçamento: teto de custo por execução, latência-alvo.>
|
|
77
|
+
|
|
78
|
+
### Contexto de negócio e técnico
|
|
79
|
+
<!-- width: 75 -->
|
|
80
|
+
```mermaid
|
|
81
|
+
C4Context
|
|
82
|
+
title Contexto do sistema (C4 L1)
|
|
83
|
+
Person(user, "Usuário/Operador", "quem aciona e quem opera")
|
|
84
|
+
System(sys, "<app>", "<papel em uma linha>")
|
|
85
|
+
System_Ext(llm, "Provedor de modelo", "API de inferência")
|
|
86
|
+
System_Ext(ext, "<sistema externo>", "<fila, CRM, bucket>")
|
|
87
|
+
Rel(user, sys, "aciona", "HTTPS")
|
|
88
|
+
Rel(sys, llm, "inferência", "HTTPS")
|
|
89
|
+
Rel(sys, ext, "lê/grava", "<protocolo>")
|
|
90
|
+
```
|
|
91
|
+
Figura 1 – Contexto do sistema (C4 L1): atores, sistemas externos e protocolos.
|
|
92
|
+
|
|
93
|
+
<Tabela ou lista: sobre quais sistemas o agente AGE e quais ele apenas LÊ.>
|
|
94
|
+
|
|
95
|
+
## Visão lógica
|
|
96
|
+
<!-- mandatory · C4 L2 containers (runtime, agent, stores, queues, MCP servers, observability) and L3 components of the agent container; layers / bounded contexts and the rule each layer obeys. -->
|
|
97
|
+
<!-- width: 75 -->
|
|
98
|
+
```mermaid
|
|
99
|
+
C4Container
|
|
100
|
+
title Containers (C4 L2)
|
|
101
|
+
Person(user, "Usuário")
|
|
102
|
+
Container(api, "<API / worker>", "<tecnologia>", "<responsabilidade>")
|
|
103
|
+
Container(agent, "<runtime do agente>", "<LangGraph / ...>", "<orquestra nós e ferramentas>")
|
|
104
|
+
ContainerDb(db, "<estado / checkpoints>", "<PostgreSQL>", "<o que persiste>")
|
|
105
|
+
System_Ext(llm, "Provedor de modelo", "")
|
|
106
|
+
Rel(user, api, "HTTPS")
|
|
107
|
+
Rel(api, agent, "invoca")
|
|
108
|
+
Rel(agent, db, "lê/grava estado")
|
|
109
|
+
Rel(agent, llm, "inferência")
|
|
110
|
+
```
|
|
111
|
+
Figura 2 – Containers (C4 L2) e fronteiras de confiança.
|
|
112
|
+
|
|
113
|
+
| Camada | Módulos | Regra |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| <Composição> | `<cli.py>` | <único lugar que constrói configuração e clientes> |
|
|
116
|
+
| <Domínio> | `<pacote>` | <não importa infraestrutura> |
|
|
117
|
+
|
|
118
|
+
## Estrutura de diretório
|
|
119
|
+
<!-- optional · the source tree with one comment per directory (code block). -->
|
|
120
|
+
```
|
|
121
|
+
<app>/
|
|
122
|
+
src/<pacote>/ # <o que vive aqui>
|
|
123
|
+
tests/ # <caderno de testes>
|
|
124
|
+
deploy/ # <manifests e perfis>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Agentes e orquestração
|
|
128
|
+
<!-- agentic (mandatory for LLM/agent systems; "Não se aplica." otherwise) · topology and pattern with the justification for the complexity level; loop exit conditions and iteration caps; state & memory model; tool contracts with side-effect class, risk and permission scope (MCP/A2A boundaries); model/prompt/config registry and promotion path; human-in-the-loop gates. -->
|
|
129
|
+
### Topologia e padrão de orquestração
|
|
130
|
+
```mermaid
|
|
131
|
+
flowchart LR
|
|
132
|
+
subgraph Orquestrador
|
|
133
|
+
S[supervisor] -->|tool call| A[agente A]
|
|
134
|
+
S -->|tool call| B[agente B]
|
|
135
|
+
end
|
|
136
|
+
A -->|handoff| B
|
|
137
|
+
```
|
|
138
|
+
Figura 3 – Topologia de agentes: arestas de tool call vs handoff; condições de saída do loop e limite de iterações.
|
|
139
|
+
|
|
140
|
+
| Agente / nó | Papel | Modelo | Ferramentas | Saída do loop |
|
|
141
|
+
|---|---|---|---|---|
|
|
142
|
+
| `<supervisor>` | <roteia e consolida> | `<modelo@versão>` | <lista> | <resposta final \| sem tool call \| N turnos \| erro \| HITL> |
|
|
143
|
+
|
|
144
|
+
### Estado e memória
|
|
145
|
+
| Camada | Onde vive | Escopo / chave | Papel |
|
|
146
|
+
|---|---|---|---|
|
|
147
|
+
| <Estado do grafo> | <checkpointer (PostgreSQL)> | <thread_id> | <retomada sem repetir trabalho> |
|
|
148
|
+
| <Memória de longo prazo> | <store> | <user_id> | <preferências / fatos> |
|
|
149
|
+
|
|
150
|
+
### Ferramentas e integrações
|
|
151
|
+
| Ferramenta | Contrato (schema) | Efeito colateral | Risco | Permissão / identidade | Via |
|
|
152
|
+
|---|---|---|---|---|---|
|
|
153
|
+
| `<tool>` | <entrada → saída> | <leitura \| escrita \| irreversível> | <baixo \| médio \| alto> | <least privilege, usuário propagado> | <MCP (stdio/HTTP) \| A2A \| SDK> |
|
|
154
|
+
|
|
155
|
+
### Modelos, prompts e configuração
|
|
156
|
+
| Item | Versão fixada | Promoção |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| Modelo `<papel>` | `<id/snapshot, quantização>` | <dev → hml → prd com eval> |
|
|
159
|
+
| Prompt `<nome>` | `<id@versão \| hash>` | <gate de regressão> |
|
|
160
|
+
|
|
161
|
+
### Human-in-the-loop
|
|
162
|
+
<Portões (obrigatórios vs opcionais), gatilhos (ação irreversível, alto risco, limiar de falha), o que é persistido no portão para retomar.>
|
|
163
|
+
|
|
164
|
+
## Visão de runtime
|
|
165
|
+
<!-- mandatory · 2-3 key scenarios as sequence diagrams (one failure path, one HITL/interrupt-resume when applicable); the agent loop as a state machine; concurrency model; lifecycle of a request/message; failures, retries, idempotency, degradation. -->
|
|
166
|
+
### Cenário principal
|
|
167
|
+
```mermaid
|
|
168
|
+
sequenceDiagram
|
|
169
|
+
participant U as Usuário
|
|
170
|
+
participant A as <app>
|
|
171
|
+
participant M as Modelo
|
|
172
|
+
U->>A: requisição
|
|
173
|
+
A->>M: prompt + contexto
|
|
174
|
+
M-->>A: resposta
|
|
175
|
+
A-->>U: resultado validado
|
|
176
|
+
```
|
|
177
|
+
Figura 4 – Cenário principal.
|
|
178
|
+
|
|
179
|
+
### Falhas, retentativas e idempotência
|
|
180
|
+
| Classificação | Significado | Destino |
|
|
181
|
+
|---|---|---|
|
|
182
|
+
| <permanente> | <repetir não muda> | <registro + DLQ> |
|
|
183
|
+
| <transitória> | <dependência indisponível> | <retry com backoff; circuit breaker> |
|
|
184
|
+
|
|
185
|
+
## Contratos
|
|
186
|
+
<!-- mandatory · input/output messages, APIs, stored objects — fields, schemas, versioning rule (additive keys only), examples. -->
|
|
187
|
+
### <Contrato de entrada>
|
|
188
|
+
<Campos, tipos, defaults, o que é ignorado, versão.>
|
|
189
|
+
|
|
190
|
+
### <Contrato de saída / objeto persistido>
|
|
191
|
+
<Campos, chaves congeladas vs aditivas, `contract_version`.>
|
|
192
|
+
|
|
193
|
+
## Dados, memória e persistência
|
|
194
|
+
<!-- optional (recommended for agentic) · stores, cache layers, queues, retention, PII handling, lineage of grounding data. -->
|
|
195
|
+
| Dado | Onde | Retenção | PII / tratamento |
|
|
196
|
+
|---|---|---|---|
|
|
197
|
+
| <trilha de decisão> | <PostgreSQL> | <90 dias> | <redigido em log/trace> |
|
|
198
|
+
|
|
199
|
+
## Configuração e ambiente
|
|
200
|
+
<!-- optional · reader of the environment, groups, sensitivity, defaults that changed, where the inventory lives. -->
|
|
201
|
+
<Quem lê o ambiente, grupos de variáveis, sensibilidade (secret | identifier | plain), defaults e inventário.>
|
|
202
|
+
|
|
203
|
+
## Infraestrutura e recursos
|
|
204
|
+
<!-- mandatory · C4 deployment: environments, topology, network boundaries, secrets, pod/instance resources, capacity and autoscaling, cost model. -->
|
|
205
|
+
### Topologia
|
|
206
|
+
<Ambientes, cluster/região, objetos criados, fronteiras de rede, segredos.>
|
|
207
|
+
|
|
208
|
+
### Capacidade, escala e custo
|
|
209
|
+
| Grandeza | Valor | Origem |
|
|
210
|
+
|---|---|---|
|
|
211
|
+
| <volume-alvo> | <1,6 M/dia> | <requisito> |
|
|
212
|
+
| <custo por execução> | <R$ / tokens> | <medido em DD/MM> |
|
|
213
|
+
|
|
214
|
+
## Observabilidade
|
|
215
|
+
<!-- mandatory · logs, metrics, traces (OTel GenAI spans: invoke_agent, chat, execute_tool, retrieval; token/latency per agent; content capture policy), correlation ids, dashboards/alerts, what is never logged. -->
|
|
216
|
+
| Sinal | Como |
|
|
217
|
+
|---|---|
|
|
218
|
+
| Logs | <JSON estruturado; correlação por id; nunca texto do cliente> |
|
|
219
|
+
| Métricas | <por agente: tokens, latência, erros> |
|
|
220
|
+
| Traces | <OTLP; spans GenAI; conteúdo/PII não capturado> |
|
|
221
|
+
|
|
222
|
+
## Segurança e AI Safety
|
|
223
|
+
<!-- mandatory · principles, threat model mapped to OWASP LLM Top 10 (2025) with a guardrail at each trust boundary (input, tool call, tool result, output), secrets, identities/least privilege, data governance. -->
|
|
224
|
+
### Princípios
|
|
225
|
+
- <Entrada não confiável é sanitizada e delimitada; decisão de negócio nunca depende de texto livre.>
|
|
226
|
+
- <Segredos fora do repositório; credencial nunca em log.>
|
|
227
|
+
|
|
228
|
+
### Modelo de ameaças
|
|
229
|
+
| Ameaça (OWASP LLM) | Vetor | Mitigação | Verificação |
|
|
230
|
+
|---|---|---|---|
|
|
231
|
+
| LLM01 Prompt injection | <texto livre, documento recuperado, resultado de ferramenta> | <sanitização, delimitação, saída tipada> | <suíte adversarial como regressão> |
|
|
232
|
+
| LLM06 Excessive agency | <ferramenta com escrita> | <least privilege, HITL> | <teste de permissão> |
|
|
233
|
+
|
|
234
|
+
## Atributos de qualidade, avaliação e testes
|
|
235
|
+
<!-- mandatory · quality-attribute scenarios (SEI: stimulus → response measure), the eval strategy and release gates (datasets@version, scorers / LLM-as-judge, thresholds), the test suite and structural gates. -->
|
|
236
|
+
| Atributo | Cenário / requisito | Como o desenho atende | Medida |
|
|
237
|
+
|---|---|---|---|
|
|
238
|
+
| <Latência> | <p95 < N s em carga X> | <assíncrono, filas> | <medido em DD/MM> |
|
|
239
|
+
| <Qualidade da resposta> | <eval suite@versão ≥ limiar> | <gate de release> | <resultado> |
|
|
240
|
+
|
|
241
|
+
<Suíte de testes: o que roda por padrão, gates estruturais, o que exige GPU/rede/amostras.>
|
|
242
|
+
|
|
243
|
+
## Decisões de arquitetura
|
|
244
|
+
<!-- mandatory · ADR log: one row per significant decision with rationale and consequence (alternatives considered inline or linked). -->
|
|
245
|
+
| ADR | Decisão | Motivo | Consequência / alternativas rejeitadas |
|
|
246
|
+
|---|---|---|---|
|
|
247
|
+
| 01 | <decisão> | <por quê> | <o que custa; o que foi descartado> |
|
|
248
|
+
|
|
249
|
+
## Riscos, premissas e pontos em aberto
|
|
250
|
+
<!-- mandatory · premises/constraints with origin; risks and open items with impact, owner and status. -->
|
|
251
|
+
| # | Item | Impacto | Dono | Status |
|
|
252
|
+
|---|---|---|---|---|
|
|
253
|
+
| 1 | <risco ou ponto em aberto> | <o que bloqueia> | <quem> | <Aberto \| Mitigado> |
|
|
254
|
+
|
|
255
|
+
## Roadmap e fases
|
|
256
|
+
<!-- optional · phases, what is out of scope now, migration steps, capacity/cost per phase. -->
|
|
257
|
+
- <Fase 1: ...> — <critério de saída>.
|
|
258
|
+
|
|
259
|
+
## Rastreabilidade e referências
|
|
260
|
+
<!-- mandatory · requirement/US/CCDA → component → test; related documents (guide, deploy, release notes, specs). -->
|
|
261
|
+
| Requisito | Componente | Verificação |
|
|
262
|
+
|---|---|---|
|
|
263
|
+
| <US/CCDA/spec> | <módulo> | <teste / eval> |
|
|
264
|
+
|
|
265
|
+
- <Documento relacionado e caminho.>
|
|
266
|
+
|
|
267
|
+
## Glossário
|
|
268
|
+
<!-- optional · domain and agent terms. -->
|
|
269
|
+
| Termo | Significado |
|
|
270
|
+
|---|---|
|
|
271
|
+
| <Handoff> | <transferência de controle entre agentes> |
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="425.3" height="159.7" viewBox="0 0 425.3 159.7" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" overflow="visible"><defs/><g id="g116-4_1_" transform="translate(654.66 -4.54285)"><path d="M-343.6 4.5C-337.7 4.6-331.8 4.5-325.8 4.5-325.8 22.7-325.8 40.8-325.8 59-331.7 59-337.7 59-343.6 59-343.6 40.9-343.6 22.7-343.6 4.5M-304.3 66C-288 49.2-271.9 32.2-255.7 15.4-251.5 19.8-247.2 24.1-243.1 28.6-259.2 45.6-275.4 62.3-291.5 79.3-295.9 74.9-300 70.4-304.3 66M-616 56C-611.5 54.9-606.9 54.3-602.3 54.5-587 54.1-572.2 62.2-562.7 74.5-558.2 80.3-554.9 87.2-553.1 94.4-560.1 94.4-567.1 94.4-574.1 94.4-577.2 88-581.9 82.3-588.1 79-591.5 77.1-595.2 75.8-599.1 75.3-602.7 75.2-606.3 74.9-609.9 75.9-615.8 77.2-621.3 80.5-625.5 85-631 90.3-634.6 97.9-634.9 105.7-635.6 113.2-634.2 121-630.1 127.3-626.2 133.3-620.6 138.4-614 140.9-603 145.2-589.6 142.6-581.2 133.9-578.4 130.9-575.9 127.4-574.1 123.7-567.1 123.7-560.2 123.7-553.2 123.7-554.9 131.4-558.7 138.5-563.4 144.6-566.7 148.1-569.9 151.9-573.9 154.5-591.9 167.4-618 166.7-634.9 152.1-640.2 147.4-645 142.1-648.3 135.7-654.4 124.4-655.9 110.9-653.8 98.3-652 87.6-646.6 77.7-639.2 70.2-632.8 63.3-624.8 58.2-616 56M-542.5 54.5C-535.9 54.5-529.2 54.5-522.6 54.5-522.6 91.1-522.6 127.6-522.6 164.2-529.2 164.2-535.9 164.2-542.5 164.2-542.5 127.6-542.5 91.1-542.5 54.5M-482.2 76.3C-478.4 75.5-474.6 76-470.7 75.9-466.3 76.3-461.8 77-457.6 78.5-453.4 80-449 81.9-446.1 85.6-442.6 89.9-441.4 95.7-441.1 101.2-441.1 122.2-441.1 143.2-441.1 164.2-447.8 164.2-454.6 164.3-461.3 164.1-461.4 161.2-461.2 158.4-461.3 155.5-467.2 160.8-474.9 163.2-482.5 163.8-487.3 164.7-492.3 163.9-496.9 162.3-502.8 160.3-507.7 155.1-509.4 148.9-511.3 142.2-510.9 135-508.7 128.4-506.3 121.8-500.5 117-494.2 114.9-486.1 111.9-477.4 111.4-469 109.7-466.1 109.7-463.2 107.8-462.1 105-461.3 101.9-462 98-464.6 96-467.5 94-471 93.6-474.4 93.5-477.4 93.6-480.6 93.6-483.2 95.3-486.7 97.3-488.2 101.4-488.9 105.3-495.6 105.2-502.3 105.3-508.9 105.2-508.1 98.3-506.7 91-502 85.8-497.3 79.8-489.6 76.9-482.2 76.3M-467.5 123.8C-471.4 124.8-475.3 126-479.3 126.6-482.5 127.3-485.8 128.3-488.1 130.9-491.3 134.8-491.5 140.8-489 145.1-487.9 147.1-485.8 148.1-483.9 148.8-477.6 150.1-470.6 148-466 143.3-461.3 137.1-462.1 128.8-462.1 121.3-464.1 121.9-465.6 123.4-467.5 123.8M-393.6 78.8C-389.5 77.7-385.4 76-381.1 76.4-381.1 83.5-380.7 90.6-380.8 97.7-384.5 97.2-388.3 96.7-391.9 97.9-399.7 100.1-406.2 107.3-407.1 115.8-407.2 117.7-407.6 119.5-407.7 121.4-407.7 135.7-407.7 149.9-407.7 164.2-414.3 164.2-421 164.2-427.6 164.2-427.7 136.1-427.6 108-427.6 80-421.2 79.9-414.8 80.2-408.3 80.4-408.3 83.9-408.4 87.3-408.3 90.8-404.6 85.5-399.6 81-393.6 78.8M-344 76.7C-341 76.4-338 76.1-335.1 76.4-317.2 76.6-300.9 91-296.6 109-292.9 123.7-296.5 140.6-307.1 151.2-313.3 158.1-321.7 162.8-330.7 164.3-335 164.3-339.3 164.3-343.7 164.3-356.6 162.4-367.8 153.2-374.2 141.6-380.8 128.8-380.8 112.6-374.4 99.8-368.1 87.9-356.9 78.6-344 76.7M-342.4 97.5C-348.4 98.9-353.4 103.3-356.5 108.7-361 116.6-360.3 127.5-354.7 134.6-348.9 143.2-337.1 146.2-328.1 141.7-322.8 139.2-318.8 134.4-316.6 128.9-314.1 122.6-314.6 115.2-317.5 109.2-320.6 103.1-326.4 98.3-333 97.2-336 97-339.2 96.9-342.4 97.5M-282.7 100.6C-264.9 100.6-247.2 100.6-229.4 100.6-229.4 106.8-229.4 112.9-229.4 119.1-247.2 119.1-264.9 119.1-282.7 119.1-282.7 113-282.6 106.8-282.7 100.6L-282.7 100.6Z" id="path114-5_1_" fill="#FFFFFF"/></g></svg>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* build-architecture.js — Software Architecture & System Design document (.docx,
|
|
5
|
+
* Claro theme) from a content file with fixed sections. Generic: system, version and
|
|
6
|
+
* authors come from the content file (architecture-template.md; guide
|
|
7
|
+
* reference/ARCHITECTURE.md). Engine: docmodel.js.
|
|
8
|
+
*
|
|
9
|
+
* node build-architecture.js <architecture.md> <output.docx>
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const { main } = require("./docmodel");
|
|
13
|
+
|
|
14
|
+
const model = {
|
|
15
|
+
name: "architecture",
|
|
16
|
+
layout: "compact",
|
|
17
|
+
cover: "page", // cover page + table of contents
|
|
18
|
+
tocTitle: "Sumário",
|
|
19
|
+
coverTitle: "Documento de Arquitetura de Software",
|
|
20
|
+
subtitle: (m) => m.title, // system name + one-line role
|
|
21
|
+
tagline: (m) => "System Design",
|
|
22
|
+
org: (m) => m.org || m.project,
|
|
23
|
+
title: (m) => m.title,
|
|
24
|
+
headerText: (m) => `Documento de Arquitetura de Software — ${m.app} | ${m.project || ""}`.replace(/\s+\|\s+$/, ""),
|
|
25
|
+
requiredMeta: ["app", "title", "version", "date", "status"],
|
|
26
|
+
meta: [
|
|
27
|
+
["app", "Aplicação"], ["doc_type", "Tipo de documento"], ["version", "Versão do documento"],
|
|
28
|
+
["status", "Status"], ["date", "Data de emissão"], ["audience", "Público"], ["system_version", "Versão do sistema"],
|
|
29
|
+
],
|
|
30
|
+
monoMeta: ["system_version"],
|
|
31
|
+
numberFrom: 0, // numbered sections start at "0. Sumário executivo"
|
|
32
|
+
sections: [
|
|
33
|
+
{ title: "Elaboração e revisão", key: "authors", mandatory: true },
|
|
34
|
+
{ title: "Histórico de revisões", key: "history", mandatory: true },
|
|
35
|
+
{ title: "Convenções", key: "conventions", mandatory: false },
|
|
36
|
+
{ title: "Sumário executivo", key: "summary", mandatory: true, numbered: true },
|
|
37
|
+
{ title: "Visão e contexto", key: "context", mandatory: true, numbered: true },
|
|
38
|
+
{ title: "Visão lógica", key: "logical", mandatory: true, numbered: true },
|
|
39
|
+
{ title: "Estrutura de diretório", key: "tree", mandatory: false, numbered: true },
|
|
40
|
+
{ title: "Agentes e orquestração", key: "agents", mandatory: true, numbered: true },
|
|
41
|
+
{ title: "Visão de runtime", key: "runtime", mandatory: true, numbered: true },
|
|
42
|
+
{ title: "Contratos", key: "contracts", mandatory: true, numbered: true },
|
|
43
|
+
{ title: "Dados, memória e persistência", key: "data", mandatory: false, numbered: true },
|
|
44
|
+
{ title: "Configuração e ambiente", key: "config", mandatory: false, numbered: true },
|
|
45
|
+
{ title: "Infraestrutura e recursos", key: "infra", mandatory: true, numbered: true },
|
|
46
|
+
{ title: "Observabilidade", key: "observability", mandatory: true, numbered: true },
|
|
47
|
+
{ title: "Segurança e AI Safety", key: "security", mandatory: true, numbered: true },
|
|
48
|
+
{ title: "Atributos de qualidade, avaliação e testes", key: "quality", mandatory: true, numbered: true },
|
|
49
|
+
{ title: "Decisões de arquitetura", key: "decisions", mandatory: true, numbered: true },
|
|
50
|
+
{ title: "Riscos, premissas e pontos em aberto", key: "risks", mandatory: true, numbered: true },
|
|
51
|
+
{ title: "Roadmap e fases", key: "roadmap", mandatory: false, numbered: true },
|
|
52
|
+
{ title: "Rastreabilidade e referências", key: "refs", mandatory: true, numbered: true },
|
|
53
|
+
{ title: "Glossário", key: "glossary", mandatory: false },
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
main(model);
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* build-md-claro.js — render a Markdown document into the Claro theme, faithfully.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* node build-md-claro.js <input.md> <output.docx> [--diagrams DIR] [--title T] [--subtitle S]
|
|
8
|
+
* [--header H] [--author NAME] [--role ROLE] [--project P] [--skip-h1]
|
|
9
|
+
* [--meta "Chave=Valor;Chave=Valor"] (metadata table under the cover)
|
|
10
|
+
*
|
|
11
|
+
* Every Markdown block maps to one theme helper: `##` -> h1, `###` -> h2, `####` -> h3,
|
|
12
|
+
* paragraphs (inline code, bold, italic), bullet and numbered lists (two levels),
|
|
13
|
+
* pipe tables, fenced code (```mermaid -> pre-rendered diagram_NN.png in --diagrams, in
|
|
14
|
+
* document order; other fences -> codeBlock), blockquotes -> info callout, `---` -> spacer.
|
|
15
|
+
* Nothing is added or dropped: what is not recognised is emitted as body text.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const fs = require("fs");
|
|
19
|
+
const path = require("path");
|
|
20
|
+
const { Packer, AlignmentType } = require("docx");
|
|
21
|
+
const T = require("./theme-claro");
|
|
22
|
+
|
|
23
|
+
// ---- args -----------------------------------------------------------------
|
|
24
|
+
const argv = process.argv.slice(2);
|
|
25
|
+
const positional = [];
|
|
26
|
+
const opt = { diagrams: null, title: null, subtitle: null, header: "", author: "", role: "", project: "", skipH1: false, meta: null };
|
|
27
|
+
for (let i = 0; i < argv.length; i++) {
|
|
28
|
+
const a = argv[i];
|
|
29
|
+
if (a === "--diagrams") opt.diagrams = argv[++i];
|
|
30
|
+
else if (a === "--title") opt.title = argv[++i];
|
|
31
|
+
else if (a === "--subtitle") opt.subtitle = argv[++i];
|
|
32
|
+
else if (a === "--header") opt.header = argv[++i];
|
|
33
|
+
else if (a === "--author") opt.author = argv[++i];
|
|
34
|
+
else if (a === "--role") opt.role = argv[++i];
|
|
35
|
+
else if (a === "--project") opt.project = argv[++i];
|
|
36
|
+
else if (a === "--skip-h1") opt.skipH1 = true;
|
|
37
|
+
else if (a === "--meta") opt.meta = argv[++i];
|
|
38
|
+
else positional.push(a);
|
|
39
|
+
}
|
|
40
|
+
const [inputPath, outputPath] = positional;
|
|
41
|
+
if (!inputPath || !outputPath) {
|
|
42
|
+
console.error("usage: build-md-claro.js <input.md> <output.docx> [options]");
|
|
43
|
+
process.exit(2);
|
|
44
|
+
}
|
|
45
|
+
const md = fs.readFileSync(inputPath, "utf8").split(/\r?\n/);
|
|
46
|
+
|
|
47
|
+
// ---- inline ---------------------------------------------------------------
|
|
48
|
+
const BODY = 22, MONO = 18, CELL = 20, CELL_MONO = 17;
|
|
49
|
+
function inline(text, size = BODY, monoSize = MONO, color = T.C.body) {
|
|
50
|
+
const runs = [];
|
|
51
|
+
const parts = text.split(/(`[^`]+`)/g);
|
|
52
|
+
for (const part of parts) {
|
|
53
|
+
if (!part) continue;
|
|
54
|
+
if (part.length >= 2 && part.startsWith("`") && part.endsWith("`")) {
|
|
55
|
+
runs.push(T.mono(part.slice(1, -1), monoSize));
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
// bold, then italic inside the remainder
|
|
59
|
+
const bolds = part.split(/(\*\*[^*]+\*\*)/g);
|
|
60
|
+
for (const b of bolds) {
|
|
61
|
+
if (!b) continue;
|
|
62
|
+
if (b.length >= 4 && b.startsWith("**") && b.endsWith("**")) {
|
|
63
|
+
runs.push(T.t(b.slice(2, -2), { size, bold: true, color }));
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const its = b.split(/(\*[^*\s][^*]*\*)/g);
|
|
67
|
+
for (const it of its) {
|
|
68
|
+
if (!it) continue;
|
|
69
|
+
if (it.length >= 3 && it.startsWith("*") && it.endsWith("*")) runs.push(T.t(it.slice(1, -1), { size, italics: true, color }));
|
|
70
|
+
else runs.push(T.t(it, { size, color }));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return runs;
|
|
75
|
+
}
|
|
76
|
+
const stripLinks = (s) => s.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1");
|
|
77
|
+
|
|
78
|
+
// ---- table ----------------------------------------------------------------
|
|
79
|
+
function splitRow(line) {
|
|
80
|
+
let s = line.trim();
|
|
81
|
+
if (s.startsWith("|")) s = s.slice(1);
|
|
82
|
+
if (s.endsWith("|")) s = s.slice(0, -1);
|
|
83
|
+
return s.split(/(?<!\\)\|/).map((c) => c.trim().replace(/\\\|/g, "|"));
|
|
84
|
+
}
|
|
85
|
+
function tableWidths(head, rows) {
|
|
86
|
+
const n = head.length;
|
|
87
|
+
const maxLen = head.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] || "").length)));
|
|
88
|
+
const total = maxLen.reduce((a, b) => a + b, 0) || 1;
|
|
89
|
+
// floor: the longest single word of the column must fit on one line (~95 DXA per char)
|
|
90
|
+
const longestWord = head.map((h, i) => Math.max(...[h, ...rows.map((r) => r[i] || "")].flatMap((c) => c.replace(/`/g, "").split(/\s+/)).map((w) => w.length)));
|
|
91
|
+
let widths = maxLen.map((l, i) => Math.max(1200, longestWord[i] * 95 + 220, Math.round((l / total) * T.CONTENT_W)));
|
|
92
|
+
const sum = widths.reduce((a, b) => a + b, 0);
|
|
93
|
+
widths = widths.map((w) => Math.round((w / sum) * T.CONTENT_W));
|
|
94
|
+
widths[n - 1] += T.CONTENT_W - widths.reduce((a, b) => a + b, 0);
|
|
95
|
+
return widths;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ---- walk -----------------------------------------------------------------
|
|
99
|
+
const children = [];
|
|
100
|
+
let diagramIndex = 0;
|
|
101
|
+
let firstH1 = true;
|
|
102
|
+
let i = 0;
|
|
103
|
+
let listInstance = 0;
|
|
104
|
+
const isTableLine = (l) => /^\s*\|.*\|\s*$/.test(l);
|
|
105
|
+
const isSep = (l) => /^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/.test(l);
|
|
106
|
+
|
|
107
|
+
while (i < md.length) {
|
|
108
|
+
const line = md[i];
|
|
109
|
+
|
|
110
|
+
if (/^\s*$/.test(line)) { i++; continue; }
|
|
111
|
+
if (/^---+\s*$/.test(line)) { children.push(T.spacer(120)); i++; continue; }
|
|
112
|
+
|
|
113
|
+
// fenced code
|
|
114
|
+
const fence = line.match(/^(\s*)```(\w+)?\s*$/);
|
|
115
|
+
if (fence) {
|
|
116
|
+
// Indented fences (inside list items) are fences too; their indent is stripped.
|
|
117
|
+
const indent = fence[1].length;
|
|
118
|
+
const lang = (fence[2] || "").toLowerCase();
|
|
119
|
+
const buf = [];
|
|
120
|
+
i++;
|
|
121
|
+
while (i < md.length && !/^\s*```\s*$/.test(md[i])) { buf.push(md[i].slice(Math.min(indent, md[i].match(/^\s*/)[0].length))); i++; }
|
|
122
|
+
i++;
|
|
123
|
+
if (lang === "mermaid") {
|
|
124
|
+
diagramIndex++;
|
|
125
|
+
const png = opt.diagrams ? path.join(opt.diagrams, `diagram_${String(diagramIndex).padStart(2, "0")}.png`) : null;
|
|
126
|
+
if (png && fs.existsSync(png)) {
|
|
127
|
+
children.push(T.image(png, 6050000));
|
|
128
|
+
children.push(T.caption(`Figura ${diagramIndex}`, { center: true }));
|
|
129
|
+
} else {
|
|
130
|
+
children.push(T.codeBlock(buf));
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
children.push(T.codeBlock(buf.length ? buf : [""]));
|
|
134
|
+
}
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// headings
|
|
139
|
+
const h = line.match(/^(#{1,4})\s+(.*)$/);
|
|
140
|
+
if (h) {
|
|
141
|
+
const level = h[1].length;
|
|
142
|
+
const text = stripLinks(h[2].trim());
|
|
143
|
+
if (level === 1) {
|
|
144
|
+
if (firstH1) { firstH1 = false; if (opt.skipH1) { i++; continue; } }
|
|
145
|
+
children.push(T.h1(text));
|
|
146
|
+
} else if (level === 2) children.push(T.h1(text));
|
|
147
|
+
else if (level === 3) children.push(T.h2(text));
|
|
148
|
+
else children.push(T.h3(text));
|
|
149
|
+
i++;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// table
|
|
154
|
+
if (isTableLine(line) && i + 1 < md.length && isSep(md[i + 1])) {
|
|
155
|
+
const head = splitRow(line);
|
|
156
|
+
i += 2;
|
|
157
|
+
const rows = [];
|
|
158
|
+
while (i < md.length && isTableLine(md[i])) { rows.push(splitRow(md[i])); i++; }
|
|
159
|
+
const widths = tableWidths(head, rows);
|
|
160
|
+
const body = rows.map((r) => head.map((_, c) => ({ runs: inline(stripLinks(r[c] || ""), CELL, CELL_MONO) })));
|
|
161
|
+
children.push(T.makeTable(widths, head.map((x) => stripLinks(x.replace(/\*\*/g, ""))), body));
|
|
162
|
+
children.push(T.spacer(100));
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// blockquote -> info callout
|
|
167
|
+
if (/^\s*>/.test(line)) {
|
|
168
|
+
const buf = [];
|
|
169
|
+
while (i < md.length && /^\s*>/.test(md[i])) { buf.push(md[i].replace(/^\s*>\s?/, "")); i++; }
|
|
170
|
+
const text = stripLinks(buf.join(" ").replace(/\s+/g, " ").trim());
|
|
171
|
+
const { Paragraph } = require("docx");
|
|
172
|
+
children.push(T.callout(new Paragraph({ children: inline(text, 20, 17) }), "info"));
|
|
173
|
+
children.push(T.spacer(80));
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// lists (bullets and numbered, two levels)
|
|
178
|
+
const li = line.match(/^(\s*)([-*]|\d+[.)])\s+(.*)$/);
|
|
179
|
+
if (li) {
|
|
180
|
+
listInstance += 1; // each list block restarts its numbering at 1
|
|
181
|
+
while (i < md.length) {
|
|
182
|
+
const m = md[i].match(/^(\s*)([-*]|\d+[.)])\s+(.*)$/);
|
|
183
|
+
if (!m) break;
|
|
184
|
+
const indent = m[1].replace(/\t/g, " ").length;
|
|
185
|
+
const lvl = indent >= 2 ? 1 : 0;
|
|
186
|
+
const numbered = /^\d/.test(m[2]);
|
|
187
|
+
let text = m[3];
|
|
188
|
+
// continuation lines (indented, not a new item, not blank)
|
|
189
|
+
let j = i + 1;
|
|
190
|
+
while (j < md.length && /^\s{2,}\S/.test(md[j]) && !/^\s*([-*]|\d+[.)])\s+/.test(md[j]) && !isTableLine(md[j]) && !/^\s*```/.test(md[j])) {
|
|
191
|
+
text += " " + md[j].trim(); j++;
|
|
192
|
+
}
|
|
193
|
+
const runs = inline(stripLinks(text));
|
|
194
|
+
if (numbered && lvl === 0) children.push(T.numItem(runs, listInstance));
|
|
195
|
+
else children.push(T.bullet(runs, lvl));
|
|
196
|
+
i = j;
|
|
197
|
+
}
|
|
198
|
+
children.push(T.spacer(60));
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// paragraph: gather until blank line or block start
|
|
203
|
+
const buf = [line];
|
|
204
|
+
i++;
|
|
205
|
+
while (i < md.length && !/^\s*$/.test(md[i]) && !/^(#{1,4})\s/.test(md[i]) && !isTableLine(md[i]) && !/^\s*```/.test(md[i]) && !/^\s*>/.test(md[i]) && !/^(\s*)([-*]|\d+[.)])\s+/.test(md[i]) && !/^---+\s*$/.test(md[i])) {
|
|
206
|
+
buf.push(md[i]); i++;
|
|
207
|
+
}
|
|
208
|
+
const text = stripLinks(buf.join(" ").replace(/\s+/g, " ").trim());
|
|
209
|
+
children.push(T.body(inline(text)));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// ---- assemble -------------------------------------------------------------
|
|
213
|
+
const front = T.coverBlock({ title: opt.title || path.basename(inputPath, ".md"), subtitle: opt.subtitle || undefined });
|
|
214
|
+
if (opt.meta) {
|
|
215
|
+
const rows = opt.meta.split(";").map((pair) => pair.split("=")).filter((r) => r.length === 2).map(([k, v]) => [k.trim(), v.trim()]);
|
|
216
|
+
if (rows.length) front.push(T.metaTable(rows), T.spacer(120));
|
|
217
|
+
}
|
|
218
|
+
const tail = opt.author ? T.authorBlock({ name: opt.author, role: opt.role, project: opt.project }) : [];
|
|
219
|
+
const doc = T.buildDocument({ children: [...front, T.spacer(160), ...children, ...tail], headerText: opt.header, footerAuthor: opt.author ? `${opt.author} — ${opt.role}` : "" });
|
|
220
|
+
Packer.toBuffer(doc).then((buf) => {
|
|
221
|
+
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
222
|
+
fs.writeFileSync(outputPath, buf);
|
|
223
|
+
console.log("Gerado:", outputPath, `(${buf.length} bytes)`, `diagramas: ${diagramIndex}`);
|
|
224
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* build-release.js — release document (.docx, Claro theme) from a content file with
|
|
5
|
+
* fixed sections. Generic: application and version come from the content file
|
|
6
|
+
* (release-template.md; guide reference/RELEASE.md). Engine: docmodel.js.
|
|
7
|
+
*
|
|
8
|
+
* node build-release.js <release.md> <output.docx>
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const T = require("./theme-claro");
|
|
12
|
+
const { main } = require("./docmodel");
|
|
13
|
+
|
|
14
|
+
const model = {
|
|
15
|
+
name: "release",
|
|
16
|
+
layout: "compact",
|
|
17
|
+
cover: "compact",
|
|
18
|
+
title: (m) => `${m.app} — Release ${m.version}`,
|
|
19
|
+
headerText: (m) => `${m.app} — Release`,
|
|
20
|
+
requiredMeta: ["app", "version", "artifact", "date"],
|
|
21
|
+
meta: [
|
|
22
|
+
["app", "Aplicação"], ["version", "Versão"], ["type", "Tipo"], ["artifact", "Artefato"],
|
|
23
|
+
["digest", "Digest"], ["date", "Data"], ["status", "Status"], ["previous", "Release anterior"],
|
|
24
|
+
["audience", "Público"], ["risk", "Risco / janela"],
|
|
25
|
+
],
|
|
26
|
+
monoMeta: ["artifact", "digest", "previous"],
|
|
27
|
+
subHeadings: "h3", // "### Corrigido" etc. stay small inside "Mudanças"
|
|
28
|
+
categories: ["Adicionado", "Alterado", "Corrigido", "Removido", "Obsoleto", "Segurança"],
|
|
29
|
+
sections: [
|
|
30
|
+
{ title: "Resumo", key: "summary", mandatory: true },
|
|
31
|
+
{ title: "Mudanças incompatíveis", key: "breaking", mandatory: true },
|
|
32
|
+
{ title: "Mudanças", key: "changes", mandatory: true },
|
|
33
|
+
{ title: "Modelos, prompts e avaliação", key: "models", mandatory: false },
|
|
34
|
+
{ title: "Configuração", key: "config", mandatory: false },
|
|
35
|
+
{ title: "Rollout e rollback", key: "rollout", mandatory: true },
|
|
36
|
+
{ title: "Verificação", key: "verify", mandatory: true },
|
|
37
|
+
{ title: "Problemas conhecidos e pendências", key: "known", mandatory: false },
|
|
38
|
+
{ title: "Referências", key: "refs", mandatory: false },
|
|
39
|
+
],
|
|
40
|
+
// "Nenhuma." -> green callout; anything else -> the whole section inside a danger callout
|
|
41
|
+
renderSection(key, body, ctx, children, content) {
|
|
42
|
+
if (key !== "breaking") return false;
|
|
43
|
+
if (/^nenhuma\.?$/i.test(content)) { children.push(T.callout("**Nenhuma.**", "success")); children.push(T.spacer(80)); return true; }
|
|
44
|
+
const { renderBlocks } = require("./docmodel");
|
|
45
|
+
const inner = renderBlocks(body, ctx).filter((b) => b.constructor && b.constructor.name === "Paragraph");
|
|
46
|
+
children.push(T.callout(inner, "danger")); children.push(T.spacer(80));
|
|
47
|
+
return true;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
main(model);
|