wrxn-reversa 1.8.2 → 1.9.0
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/README.md +4 -1
- package/bin/reversa.js +2 -0
- package/lib/commands/add-engine.js +2 -1
- package/lib/commands/install.js +10 -2
- package/lib/commands/status.js +1 -0
- package/lib/commands/update.js +8 -1
- package/lib/installer/entry-block.js +10 -6
- package/lib/installer/locale.js +53 -0
- package/lib/installer/policy.js +22 -1
- package/lib/installer/prompts.js +17 -4
- package/lib/installer/writer.js +53 -54
- package/locales/README.md +156 -0
- package/locales/en/agents/reversa/SKILL.md +161 -0
- package/locales/en/agents/reversa/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa/references/checkpoint-guide.md +106 -0
- package/locales/en/agents/reversa/references/state-schema.md +88 -0
- package/locales/en/agents/reversa/references/step-01-first-run.md +64 -0
- package/locales/en/agents/reversa/references/step-02-resume.md +91 -0
- package/locales/en/agents/reversa/references/step-03-specs-organization.md +145 -0
- package/locales/en/agents/reversa/references/step-04-regression-check.md +94 -0
- package/locales/en/agents/reversa-add/SKILL.md +151 -0
- package/locales/en/agents/reversa-add/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-agents-help/SKILL.md +212 -0
- package/locales/en/agents/reversa-agents-help/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-arbiter/SKILL.md +150 -0
- package/locales/en/agents/reversa-arbiter/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-archaeologist/SKILL.md +104 -0
- package/locales/en/agents/reversa-archaeologist/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-archaeologist/references/modules-schema.md +75 -0
- package/locales/en/agents/reversa-architect/SKILL.md +113 -0
- package/locales/en/agents/reversa-architect/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-architect/references/interaction-conventions-template.md +34 -0
- package/locales/en/agents/reversa-arquitetura-3d/SKILL.md +163 -0
- package/locales/en/agents/reversa-arquitetura-3d/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-arquitetura-3d/references/ARCH_TOUR.md +242 -0
- package/locales/en/agents/reversa-arquitetura-3d/references/CALL_GRAPH_3D.md +217 -0
- package/locales/en/agents/reversa-arquitetura-3d/references/CODE_CITY.md +228 -0
- package/locales/en/agents/reversa-arquitetura-3d/references/DEPENDENCY_GRAPH_3D.md +240 -0
- package/locales/en/agents/reversa-arquitetura-3d/references/ERRORS.md +282 -0
- package/locales/en/agents/reversa-arquitetura-3d/references/LAYER_STACK.md +230 -0
- package/locales/en/agents/reversa-arquitetura-3d/references/THREE_PATTERNS.md +249 -0
- package/locales/en/agents/reversa-audit/SKILL.md +110 -0
- package/locales/en/agents/reversa-audit/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-autonomous/SKILL.md +145 -0
- package/locales/en/agents/reversa-autonomous/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa-brainstorm/SKILL.md +142 -0
- package/locales/en/agents/reversa-brainstorm/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa-challenger/SKILL.md +132 -0
- package/locales/en/agents/reversa-challenger/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-clarify/SKILL.md +115 -0
- package/locales/en/agents/reversa-clarify/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-code-express/SKILL.md +275 -0
- package/locales/en/agents/reversa-code-express/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-coding/SKILL.md +210 -0
- package/locales/en/agents/reversa-coding/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-curator/SKILL.md +142 -0
- package/locales/en/agents/reversa-curator/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-curator/references/decision-rubric.md +52 -0
- package/locales/en/agents/reversa-curator/references/templates/discard_log.md +37 -0
- package/locales/en/agents/reversa-curator/references/templates/target_business_rules.md +59 -0
- package/locales/en/agents/reversa-data-master/SKILL.md +71 -0
- package/locales/en/agents/reversa-data-master/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-debugger/SKILL.md +189 -0
- package/locales/en/agents/reversa-debugger/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa-debugger/references/bug-schema.md +123 -0
- package/locales/en/agents/reversa-debugger/references/bugs-readme-template.md +76 -0
- package/locales/en/agents/reversa-debugger-debate/SKILL.md +85 -0
- package/locales/en/agents/reversa-debugger-debate/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-debugger-debate/references/debate-protocol.md +102 -0
- package/locales/en/agents/reversa-debugger-fix/SKILL.md +180 -0
- package/locales/en/agents/reversa-debugger-fix/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-debugger-graph/SKILL.md +104 -0
- package/locales/en/agents/reversa-debugger-graph/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-decouple/SKILL.md +90 -0
- package/locales/en/agents/reversa-decouple/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-depth-inspection/SKILL.md +111 -0
- package/locales/en/agents/reversa-depth-inspection/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-design-system/SKILL.md +81 -0
- package/locales/en/agents/reversa-design-system/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-designer/SKILL.md +224 -0
- package/locales/en/agents/reversa-designer/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-designer/references/paradigm-checklist.md +50 -0
- package/locales/en/agents/reversa-designer/references/templates/data_migration_plan.md +80 -0
- package/locales/en/agents/reversa-designer/references/templates/target_architecture.md +70 -0
- package/locales/en/agents/reversa-designer/references/templates/target_data_model.md +64 -0
- package/locales/en/agents/reversa-designer/references/templates/target_domain_model.md +62 -0
- package/locales/en/agents/reversa-designer/references/templates/topology_decision.md +82 -0
- package/locales/en/agents/reversa-detective/SKILL.md +86 -0
- package/locales/en/agents/reversa-detective/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-docs/SKILL.md +253 -0
- package/locales/en/agents/reversa-docs/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa-docs/references/config-schema.json +108 -0
- package/locales/en/agents/reversa-docs/references/expected_sources.yaml +59 -0
- package/locales/en/agents/reversa-docs-analyst/SKILL.md +180 -0
- package/locales/en/agents/reversa-docs-analyst/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-docs-mapper/SKILL.md +170 -0
- package/locales/en/agents/reversa-docs-mapper/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-docs-mapper/references/extraction-policy.md +53 -0
- package/locales/en/agents/reversa-docs-publisher/SKILL.md +337 -0
- package/locales/en/agents/reversa-docs-publisher/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-docs-publisher/references/auxiliary_sources.yaml +27 -0
- package/locales/en/agents/reversa-docs-storyteller/SKILL.md +205 -0
- package/locales/en/agents/reversa-docs-storyteller/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-drafter/SKILL.md +204 -0
- package/locales/en/agents/reversa-drafter/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-especialista-d3/SKILL.md +37 -0
- package/locales/en/agents/reversa-especialista-d3/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-especialista-d3/references/api-core.md +13 -0
- package/locales/en/agents/reversa-especialista-d3/references/interatividade.md +5 -0
- package/locales/en/agents/reversa-especialista-d3/references/layouts-complexos.md +8 -0
- package/locales/en/agents/reversa-explorer/SKILL.md +120 -0
- package/locales/en/agents/reversa-explorer/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-extract-soul/SKILL.md +231 -0
- package/locales/en/agents/reversa-extract-soul/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-forward/SKILL.md +249 -0
- package/locales/en/agents/reversa-forward/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa-forward-autonomous/SKILL.md +202 -0
- package/locales/en/agents/reversa-forward-autonomous/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa-framer/SKILL.md +134 -0
- package/locales/en/agents/reversa-framer/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-highcharts-visualizer/SKILL.md +118 -0
- package/locales/en/agents/reversa-highcharts-visualizer/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-highcharts-visualizer/references/CHART_CATALOG.md +459 -0
- package/locales/en/agents/reversa-highcharts-visualizer/references/ERRORS.md +102 -0
- package/locales/en/agents/reversa-highcharts-visualizer/references/HIGHCHARTS_PATTERNS.md +343 -0
- package/locales/en/agents/reversa-ideator/SKILL.md +149 -0
- package/locales/en/agents/reversa-ideator/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-image-prompt-json/SKILL.md +210 -0
- package/locales/en/agents/reversa-image-prompt-json/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-image-prompt-json/references/Examples.md +133 -0
- package/locales/en/agents/reversa-inspector/SKILL.md +156 -0
- package/locales/en/agents/reversa-inspector/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-inspector/references/parity-coverage-matrix.md +55 -0
- package/locales/en/agents/reversa-inspector/references/templates/parity_specs.md +78 -0
- package/locales/en/agents/reversa-inspector/references/templates/parity_test.feature +48 -0
- package/locales/en/agents/reversa-migrate/SKILL.md +306 -0
- package/locales/en/agents/reversa-migrate/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa-migrate/references/auto-defaults.md +55 -0
- package/locales/en/agents/reversa-migrate/references/expected_legacy_artifacts.yaml +69 -0
- package/locales/en/agents/reversa-migrate/references/handoff-checklist.md +34 -0
- package/locales/en/agents/reversa-migrate/references/templates/ambiguity_log.md +43 -0
- package/locales/en/agents/reversa-migrate/references/templates/handoff.md +92 -0
- package/locales/en/agents/reversa-migrate/references/templates/migration_brief.md +58 -0
- package/locales/en/agents/reversa-migrate/references/templates/pending_decisions.md +36 -0
- package/locales/en/agents/reversa-modularize/SKILL.md +89 -0
- package/locales/en/agents/reversa-modularize/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-n8n/SKILL.md +266 -0
- package/locales/en/agents/reversa-n8n/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-n8n/references/node-catalog.md +245 -0
- package/locales/en/agents/reversa-new/SKILL.md +357 -0
- package/locales/en/agents/reversa-new/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa-optimize/SKILL.md +92 -0
- package/locales/en/agents/reversa-optimize/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-paradigm-advisor/SKILL.md +172 -0
- package/locales/en/agents/reversa-paradigm-advisor/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-paradigm-advisor/references/paradigm-catalog.md +101 -0
- package/locales/en/agents/reversa-paradigm-advisor/references/templates/paradigm_decision.md +69 -0
- package/locales/en/agents/reversa-plan/SKILL.md +116 -0
- package/locales/en/agents/reversa-plan/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-pre-spec/SKILL.md +143 -0
- package/locales/en/agents/reversa-pre-spec/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-pricing/SKILL.md +185 -0
- package/locales/en/agents/reversa-pricing/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa-pricing-advisor/SKILL.md +332 -0
- package/locales/en/agents/reversa-pricing-advisor/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-pricing-advisor/references/advisor-schema.json +196 -0
- package/locales/en/agents/reversa-pricing-advisor/references/advisor-template.md +106 -0
- package/locales/en/agents/reversa-pricing-advisor/references/sale-models.md +237 -0
- package/locales/en/agents/reversa-pricing-estimate/SKILL.md +297 -0
- package/locales/en/agents/reversa-pricing-estimate/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-pricing-estimate/references/effort-formula.md +146 -0
- package/locales/en/agents/reversa-pricing-estimate/references/estimate-schema.json +141 -0
- package/locales/en/agents/reversa-pricing-estimate/references/estimate-template.md +153 -0
- package/locales/en/agents/reversa-pricing-estimate/references/example-estimate.json +74 -0
- package/locales/en/agents/reversa-pricing-estimate/references/example-estimate.md +88 -0
- package/locales/en/agents/reversa-pricing-estimate/references/market-benchmarks.md +102 -0
- package/locales/en/agents/reversa-pricing-estimate/references/value-formula.md +123 -0
- package/locales/en/agents/reversa-pricing-product/SKILL.md +315 -0
- package/locales/en/agents/reversa-pricing-product/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-pricing-product/references/breakeven-formula.md +237 -0
- package/locales/en/agents/reversa-pricing-product/references/product-schema.json +288 -0
- package/locales/en/agents/reversa-pricing-product/references/product-template.md +113 -0
- package/locales/en/agents/reversa-pricing-product/references/store-commissions.md +57 -0
- package/locales/en/agents/reversa-pricing-profile/SKILL.md +407 -0
- package/locales/en/agents/reversa-pricing-profile/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-pricing-profile/references/example-profile.json +32 -0
- package/locales/en/agents/reversa-pricing-profile/references/example-profile.md +51 -0
- package/locales/en/agents/reversa-pricing-profile/references/profile-schema.json +227 -0
- package/locales/en/agents/reversa-pricing-profile/references/tax-regimes.md +106 -0
- package/locales/en/agents/reversa-pricing-research/SKILL.md +368 -0
- package/locales/en/agents/reversa-pricing-research/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-pricing-research/references/research-policy.md +213 -0
- package/locales/en/agents/reversa-pricing-research/references/research-schema.json +330 -0
- package/locales/en/agents/reversa-pricing-size/SKILL.md +215 -0
- package/locales/en/agents/reversa-pricing-size/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-pricing-size/references/example-size.json +41 -0
- package/locales/en/agents/reversa-pricing-size/references/size-schema.json +120 -0
- package/locales/en/agents/reversa-pricing-size/references/sizing-formula.md +183 -0
- package/locales/en/agents/reversa-principles/SKILL.md +87 -0
- package/locales/en/agents/reversa-principles/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-prune/SKILL.md +97 -0
- package/locales/en/agents/reversa-prune/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-quality/SKILL.md +100 -0
- package/locales/en/agents/reversa-quality/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-reconstructor/SKILL.md +277 -0
- package/locales/en/agents/reversa-reconstructor/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-reconstructor/references/reconstruction-plan-migration-template.md +92 -0
- package/locales/en/agents/reversa-reconstructor/references/reconstruction-plan-template.md +84 -0
- package/locales/en/agents/reversa-refactor/SKILL.md +123 -0
- package/locales/en/agents/reversa-refactor/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa-refactor/references/opportunity-schema.md +68 -0
- package/locales/en/agents/reversa-refactor/references/refactor-readme-template.md +35 -0
- package/locales/en/agents/reversa-requirements/SKILL.md +238 -0
- package/locales/en/agents/reversa-requirements/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-researcher/SKILL.md +146 -0
- package/locales/en/agents/reversa-researcher/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-restructure/SKILL.md +90 -0
- package/locales/en/agents/reversa-restructure/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-resume/SKILL.md +151 -0
- package/locales/en/agents/reversa-resume/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-reviewer/SKILL.md +158 -0
- package/locales/en/agents/reversa-reviewer/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-reviewer/references/confidence-report-template.md +73 -0
- package/locales/en/agents/reversa-reviewer/references/confidence-rules.md +67 -0
- package/locales/en/agents/reversa-reviewer/references/questions-template.md +74 -0
- package/locales/en/agents/reversa-router/SKILL.md +144 -0
- package/locales/en/agents/reversa-router/agents/openai.yaml +3 -0
- package/locales/en/agents/reversa-scout/SKILL.md +94 -0
- package/locales/en/agents/reversa-scout/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-scout/references/surface-schema.md +102 -0
- package/locales/en/agents/reversa-screen-translator/SKILL.md +306 -0
- package/locales/en/agents/reversa-screen-translator/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-screen-translator/references/adapter-pairs.md +102 -0
- package/locales/en/agents/reversa-screen-translator/references/platform-detection.md +73 -0
- package/locales/en/agents/reversa-screen-translator/references/templates/golden_manifest.yaml +62 -0
- package/locales/en/agents/reversa-screen-translator/references/templates/inventory.schema.json +142 -0
- package/locales/en/agents/reversa-screen-translator/references/templates/screen_deviation_log.md +66 -0
- package/locales/en/agents/reversa-screen-translator/references/templates/screen_modernization_decision.md +108 -0
- package/locales/en/agents/reversa-screen-translator/references/templates/target_screens.md +249 -0
- package/locales/en/agents/reversa-selo-generativo/SKILL.md +176 -0
- package/locales/en/agents/reversa-selo-generativo/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-selo-generativo/references/ERRORS.md +206 -0
- package/locales/en/agents/reversa-selo-generativo/references/GENERATIVE_PATTERNS.md +365 -0
- package/locales/en/agents/reversa-selo-generativo/references/PALETTE_BY_STYLE.md +176 -0
- package/locales/en/agents/reversa-simplify/SKILL.md +91 -0
- package/locales/en/agents/reversa-simplify/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-spec-sdd/SKILL.md +288 -0
- package/locales/en/agents/reversa-spec-sdd/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-spec-sdd/assets/spec_examples.md +159 -0
- package/locales/en/agents/reversa-spec-sdd/references/evaluation_rubric.md +113 -0
- package/locales/en/agents/reversa-spec-sdd/references/sdd_guide.md +124 -0
- package/locales/en/agents/reversa-spec-sdd/references/spec_template.md +231 -0
- package/locales/en/agents/reversa-standardize/SKILL.md +88 -0
- package/locales/en/agents/reversa-standardize/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-strategist/SKILL.md +123 -0
- package/locales/en/agents/reversa-strategist/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-strategist/references/migration-strategies.md +41 -0
- package/locales/en/agents/reversa-strategist/references/templates/cutover_plan.md +60 -0
- package/locales/en/agents/reversa-strategist/references/templates/migration_strategy.md +55 -0
- package/locales/en/agents/reversa-strategist/references/templates/risk_register.md +44 -0
- package/locales/en/agents/reversa-sync/SKILL.md +110 -0
- package/locales/en/agents/reversa-sync/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-to-do/SKILL.md +99 -0
- package/locales/en/agents/reversa-to-do/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-visor/SKILL.md +100 -0
- package/locales/en/agents/reversa-visor/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-writer/SKILL.md +225 -0
- package/locales/en/agents/reversa-writer/agents/openai.yaml +5 -0
- package/locales/en/agents/reversa-writer/references/design-template.md +49 -0
- package/locales/en/agents/reversa-writer/references/requirements-template.md +67 -0
- package/locales/en/agents/reversa-writer/references/tasks-template.md +39 -0
- package/locales/en/templates/config.toml +46 -0
- package/locales/en/templates/config.user.toml +8 -0
- package/locales/en/templates/engines/card.md +43 -0
- package/locales/en/templates/forward/body/actions-template.md +83 -0
- package/locales/en/templates/forward/body/principles-template.md +75 -0
- package/locales/en/templates/forward/body/quality-template.md +103 -0
- package/locales/en/templates/forward/body/requirements-template.md +128 -0
- package/locales/en/templates/forward/body/roadmap-template.md +116 -0
- package/locales/en/templates/forward/hooks.yml +60 -0
- package/locales/en/templates/hooks/README.md +93 -0
- package/locales/en/templates/migration/catalogs/paradigm_catalog.md +101 -0
- package/locales/en/templates/plan.md +65 -0
- package/package.json +3 -2
- package/templates/state.json +1 -0
package/README.md
CHANGED
|
@@ -63,7 +63,10 @@ The installer will:
|
|
|
63
63
|
> [!IMPORTANT]
|
|
64
64
|
> ### 🔒 Guaranteed immutability of the legacy project
|
|
65
65
|
>
|
|
66
|
-
>
|
|
66
|
+
> Install and update place the full marked routing block at the start of `AGENTS.md`, regardless of file size.
|
|
67
|
+
> They preserve your text and keep edited Reversa blocks unchanged.
|
|
68
|
+
> For other existing instruction files, install asks before it adds a new block.
|
|
69
|
+
> During analysis, agents follow the project's Reversa write policy.
|
|
67
70
|
|
|
68
71
|
> [!CAUTION]
|
|
69
72
|
> ### 💾 Back up your project before starting
|
package/bin/reversa.js
CHANGED
|
@@ -28,7 +28,9 @@ if (!command || command === '--help' || command === '-h') {
|
|
|
28
28
|
|
|
29
29
|
Comandos:
|
|
30
30
|
install Instala o Reversa no projeto atual (todos os agentes)
|
|
31
|
+
Opções: --lang=pt|en idioma das skills e das regras (padrão: pt)
|
|
31
32
|
update Atualiza as skills usando este pacote, sem sobrescrever edições
|
|
33
|
+
Opções: --lang=pt|en converte a instalação para outro idioma
|
|
32
34
|
status Mostra o estado atual da análise
|
|
33
35
|
uninstall Remove o Reversa do projeto
|
|
34
36
|
add-engine Adiciona suporte a uma engine
|
|
@@ -7,6 +7,7 @@ import { loadManifest, saveManifest, indexManifest } from '../installer/manifest
|
|
|
7
7
|
import { applyOrangeTheme, ORANGE_PREFIX } from '../installer/orange-prompts.js';
|
|
8
8
|
import { getPackageInfo } from '../utils/package-info.js';
|
|
9
9
|
import { applyWhenIdle, idlePreview } from '../installer/checkout-guard.js';
|
|
10
|
+
import { resolveSkillsLanguage } from '../installer/locale.js';
|
|
10
11
|
import { applyMirrors, describeSkillLayout, planMirrors, previewMirrors, recordChanges, resolveSkillLayout, resolveSkillsMode, verifySkillLayout } from '../installer/skill-layout.js';
|
|
11
12
|
|
|
12
13
|
export default async function addEngine() {
|
|
@@ -72,7 +73,7 @@ export default async function addEngine() {
|
|
|
72
73
|
previewMirrors(mirrors);
|
|
73
74
|
await applyWhenIdle(projectRoot, preview, chalk, async () => {
|
|
74
75
|
verifySkillLayout(projectRoot, selectedEngines, layout);
|
|
75
|
-
const writer = new Writer(projectRoot);
|
|
76
|
+
const writer = new Writer(projectRoot, { lang: resolveSkillsLanguage([], state) });
|
|
76
77
|
writer.installSkills(installedAgents, layout.canonical);
|
|
77
78
|
writer.applyPlan(native, index);
|
|
78
79
|
|
package/lib/commands/install.js
CHANGED
|
@@ -12,6 +12,7 @@ import { clearTerminalForLogo, renderReversaLogo } from '../utils/banner.js';
|
|
|
12
12
|
|
|
13
13
|
import { getPackageInfo } from '../utils/package-info.js';
|
|
14
14
|
import { applyWhenIdle, idlePreview } from '../installer/checkout-guard.js';
|
|
15
|
+
import { languageName, requestedSkillsLanguage, resolveSkillsLanguage } from '../installer/locale.js';
|
|
15
16
|
import { applyMirrors, describeSkillLayout, planMirrors, previewMirrors, recordChanges, resolveSkillLayout, resolveSkillsMode, verifySkillLayout } from '../installer/skill-layout.js';
|
|
16
17
|
|
|
17
18
|
export default async function install(args) {
|
|
@@ -32,6 +33,7 @@ export default async function install(args) {
|
|
|
32
33
|
const preview = idlePreview(projectRoot, chalk);
|
|
33
34
|
if (!preview) return;
|
|
34
35
|
const mode = resolveSkillsMode(args, preview.state);
|
|
36
|
+
const requestedLanguage = requestedSkillsLanguage(args);
|
|
35
37
|
// Check existing installation
|
|
36
38
|
const existing = checkExistingInstallation(projectRoot);
|
|
37
39
|
if (existing.installed) {
|
|
@@ -61,7 +63,12 @@ export default async function install(args) {
|
|
|
61
63
|
// Collect answers
|
|
62
64
|
let answers;
|
|
63
65
|
try {
|
|
64
|
-
|
|
66
|
+
// An existing installation keeps its language: only `update --lang` converts installed skills.
|
|
67
|
+
const kept = existing.installed ? resolveSkillsLanguage([], existing.state ?? {}) : undefined;
|
|
68
|
+
if (kept && requestedLanguage && requestedLanguage !== kept) {
|
|
69
|
+
console.log(chalk.yellow(` Skills stay in ${languageName(kept)}. Run npx ${getPackageInfo().name} update --lang ${requestedLanguage} to convert this installation.\n`));
|
|
70
|
+
}
|
|
71
|
+
answers = await runInstallPrompts(detectedEngines, { skillsLanguage: kept ?? requestedLanguage });
|
|
65
72
|
} catch (err) {
|
|
66
73
|
if (err.isTtyError || err.message?.includes('cancel')) {
|
|
67
74
|
console.log(chalk.gray('\n Installation cancelled.\n'));
|
|
@@ -80,7 +87,7 @@ export default async function install(args) {
|
|
|
80
87
|
let failed = false;
|
|
81
88
|
if (!await applyWhenIdle(projectRoot, preview, chalk, async () => {
|
|
82
89
|
verifySkillLayout(projectRoot, selectedEngines, layout);
|
|
83
|
-
const writer = new Writer(projectRoot);
|
|
90
|
+
const writer = new Writer(projectRoot, { lang: answers.skills_language });
|
|
84
91
|
|
|
85
92
|
const spinner = ora({ text: 'Installing agents...', color: 'cyan' }).start();
|
|
86
93
|
|
|
@@ -176,6 +183,7 @@ export default async function install(args) {
|
|
|
176
183
|
console.log(` ${chalk.cyan('Project:')} ${answers.project_name}`);
|
|
177
184
|
console.log(` ${chalk.cyan('Engines:')} ${engineNames}`);
|
|
178
185
|
console.log(` ${chalk.cyan('Version:')} ${version}`);
|
|
186
|
+
console.log(` ${chalk.cyan('Skills:')} ${languageName(answers.skills_language)}`);
|
|
179
187
|
console.log('');
|
|
180
188
|
console.log(chalk.bold(' Agents installed:'));
|
|
181
189
|
console.log(` ${chalk.cyan('Discovery Team:')} ${discoveryInstalled.length} agent(s)`);
|
package/lib/commands/status.js
CHANGED
|
@@ -23,6 +23,7 @@ export default async function status(args) {
|
|
|
23
23
|
console.log(` Current phase: ${chalk.cyan(state.phase || 'Not started')}`);
|
|
24
24
|
console.log(` Chat language: ${chalk.cyan(state.chat_language || 'pt-br')}`);
|
|
25
25
|
console.log(` Docs language: ${chalk.cyan(state.doc_language || 'pt-br')}`);
|
|
26
|
+
console.log(` Skills language: ${chalk.cyan(state.skills_language || 'pt')}`);
|
|
26
27
|
|
|
27
28
|
if (state.completed?.length > 0) {
|
|
28
29
|
console.log(`\n Completed: ${state.completed.map(f => chalk.hex('#ffa203')('✓ ' + f)).join(', ')}`);
|
package/lib/commands/update.js
CHANGED
|
@@ -11,6 +11,7 @@ import { planImpeccableAgents } from '../installer/impeccable-agents.js';
|
|
|
11
11
|
import { applyOrangeTheme, ORANGE_PREFIX } from '../installer/orange-prompts.js';
|
|
12
12
|
import { getPackageInfo } from '../utils/package-info.js';
|
|
13
13
|
import { applyWhenIdle, idlePreview } from '../installer/checkout-guard.js';
|
|
14
|
+
import { languageName, resolveSkillsLanguage } from '../installer/locale.js';
|
|
14
15
|
import { applyMirrors, describeSkillLayout, planMirrors, previewMirrors, recordChanges, resolveSkillLayout, resolveSkillsMode, verifySkillLayout } from '../installer/skill-layout.js';
|
|
15
16
|
|
|
16
17
|
async function fetchLatestVersion(packageName) {
|
|
@@ -53,6 +54,8 @@ export default async function update(args) {
|
|
|
53
54
|
}
|
|
54
55
|
const { state, version: installedVersion } = existing;
|
|
55
56
|
const mode = resolveSkillsMode(args, state);
|
|
57
|
+
const lang = resolveSkillsLanguage(args, state);
|
|
58
|
+
const previousLang = resolveSkillsLanguage([], state);
|
|
56
59
|
if (!semver.valid(installedVersion) || semver.gt(installedVersion, version)) {
|
|
57
60
|
console.log(chalk.yellow(` Cannot update v${installedVersion} using ${name}@${version}.`));
|
|
58
61
|
return;
|
|
@@ -65,6 +68,9 @@ export default async function update(args) {
|
|
|
65
68
|
spinner.stop();
|
|
66
69
|
console.log(` Installed: ${state.package_name ?? upstreamName}@${installedVersion}`);
|
|
67
70
|
console.log(` Update source: ${name}@${version} (running package)`);
|
|
71
|
+
console.log(lang === previousLang
|
|
72
|
+
? ` Skills language: ${languageName(lang)}`
|
|
73
|
+
: ` Skills language: ${languageName(previousLang)} → ${languageName(lang)} (edited files stay as they are)`);
|
|
68
74
|
if (semver.valid(latest) && semver.gt(latest, version)) {
|
|
69
75
|
console.log(` A newer bundle is available: npx ${name}@${latest} update`);
|
|
70
76
|
}
|
|
@@ -72,7 +78,7 @@ export default async function update(args) {
|
|
|
72
78
|
const manifest = loadManifest(projectRoot);
|
|
73
79
|
const index = indexManifest(manifest);
|
|
74
80
|
const allAgents = listAllAgents();
|
|
75
|
-
const writer = new Writer(projectRoot);
|
|
81
|
+
const writer = new Writer(projectRoot, { lang });
|
|
76
82
|
const plan = { writes: [], kept: [], removals: [] };
|
|
77
83
|
const add = part => {
|
|
78
84
|
for (const key of Object.keys(plan)) plan[key].push(...part[key]);
|
|
@@ -135,6 +141,7 @@ export default async function update(args) {
|
|
|
135
141
|
failed = counts.failed > 0 || allAgents.some(id => pathState(projectRoot, `${root}/${id}/SKILL.md`) !== 'file');
|
|
136
142
|
state.skill_links = links;
|
|
137
143
|
if (!failed) state.skills_mode = mode;
|
|
144
|
+
state.skills_language = lang;
|
|
138
145
|
saveManifest(projectRoot, manifest);
|
|
139
146
|
state.agents = allAgents;
|
|
140
147
|
state.package_name = name;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { readFileSync } from 'fs';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
2
|
import { hashContent } from './manifest.js';
|
|
4
3
|
import { renderPolicyBlock } from './policy.js';
|
|
5
4
|
import { getPackageInfo } from '../utils/package-info.js';
|
|
5
|
+
import { SOURCE_LANGUAGE, localizedPath } from './locale.js';
|
|
6
6
|
|
|
7
|
-
const CARD = fileURLToPath(new URL('../../templates/engines/card.md', import.meta.url));
|
|
8
7
|
const BEGIN = '<!-- reversa:begin';
|
|
9
8
|
const END_MARKER = '<!-- reversa:end -->';
|
|
10
9
|
// Última frase da política: fecha todo bloco gravado antes das marcas (até 1.3.7).
|
|
@@ -18,12 +17,17 @@ const skipNewline = (text, at) => text.startsWith('\r\n', at) ? at + 2 : text[at
|
|
|
18
17
|
export const cardHash = card => hashContent(normalize(card));
|
|
19
18
|
|
|
20
19
|
// Cartão de roteamento renderizado para um destino (ver ENGINES.entry).
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const COMPACT = {
|
|
21
|
+
pt: 'Ao compactar, preserve: skill Reversa ativo, etapa atual, último checkpoint gravado e o próximo passo combinado com o usuário.',
|
|
22
|
+
en: 'When compacting, preserve: the active Reversa skill, the current step, the last recorded checkpoint, and the next step agreed with the user.',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function renderCard(target, { outputFolder, forwardFolder, lang = SOURCE_LANGUAGE } = {}) {
|
|
26
|
+
let card = readFileSync(localizedPath('templates', 'engines/card.md', lang), 'utf8')
|
|
27
|
+
.replace('{{REVERSA_POLICY}}', renderPolicyBlock({ outputFolder, forwardFolder, lang }));
|
|
24
28
|
if (!card.endsWith('\n')) card += '\n';
|
|
25
29
|
if (target.compact) {
|
|
26
|
-
card +=
|
|
30
|
+
card += `\n## Compact Instructions\n\n${COMPACT[lang] ?? COMPACT[SOURCE_LANGUAGE]}\n`;
|
|
27
31
|
}
|
|
28
32
|
if (target.frontmatter === 'alwaysApply') card = `---\nalwaysApply: true\n---\n\n${card}`;
|
|
29
33
|
return card;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Language of the installed skills, routing card, and templates.
|
|
2
|
+
// Portuguese is the source tree (agents/, templates/). Every other language is
|
|
3
|
+
// an overlay under locales/<lang>/ with the same relative paths: a file in the
|
|
4
|
+
// overlay replaces the source file; a file with no overlay is installed as is.
|
|
5
|
+
import { existsSync } from 'fs';
|
|
6
|
+
import { join, resolve, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
|
|
9
|
+
const REPO_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
10
|
+
|
|
11
|
+
export const SOURCE_LANGUAGE = 'pt';
|
|
12
|
+
export const SKILL_LANGUAGES = [
|
|
13
|
+
{ id: 'pt', name: 'Português' },
|
|
14
|
+
{ id: 'en', name: 'English' },
|
|
15
|
+
];
|
|
16
|
+
const IDS = new Set(SKILL_LANGUAGES.map(language => language.id));
|
|
17
|
+
|
|
18
|
+
export const languageName = id => SKILL_LANGUAGES.find(language => language.id === id)?.name ?? id;
|
|
19
|
+
|
|
20
|
+
// Language given with --lang or --lang=<id>, or undefined.
|
|
21
|
+
export function requestedSkillsLanguage(args = []) {
|
|
22
|
+
const at = args.findIndex(arg => arg === '--lang' || arg.startsWith('--lang='));
|
|
23
|
+
if (at < 0) return undefined;
|
|
24
|
+
const value = args[at] === '--lang' ? args[at + 1] : args[at].slice('--lang='.length);
|
|
25
|
+
if (!IDS.has(value)) throw new Error(`Invalid --lang value. Expected one of: ${[...IDS].join(', ')}.`);
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// --lang wins; otherwise the language recorded at install time; otherwise the source language.
|
|
30
|
+
export function resolveSkillsLanguage(args = [], state = {}) {
|
|
31
|
+
const flag = requestedSkillsLanguage(args);
|
|
32
|
+
if (Object.hasOwn(state, 'skills_language') && !IDS.has(state.skills_language)) {
|
|
33
|
+
throw new Error(`Invalid skills_language in .reversa/state.json. Expected one of: ${[...IDS].join(', ')}.`);
|
|
34
|
+
}
|
|
35
|
+
return flag ?? state.skills_language ?? SOURCE_LANGUAGE;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Overlay directory of a skill in the given language, or null when there is none.
|
|
39
|
+
export function overlayDir(tree, rel, lang = SOURCE_LANGUAGE, root = REPO_ROOT) {
|
|
40
|
+
if (lang === SOURCE_LANGUAGE) return null;
|
|
41
|
+
const dir = join(root, 'locales', lang, tree, rel);
|
|
42
|
+
return existsSync(dir) ? dir : null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Absolute path of a bundled file in the given language.
|
|
46
|
+
// tree: 'agents' | 'templates'. rel: path inside that tree, with forward slashes.
|
|
47
|
+
export function localizedPath(tree, rel, lang = SOURCE_LANGUAGE, root = REPO_ROOT) {
|
|
48
|
+
if (lang !== SOURCE_LANGUAGE) {
|
|
49
|
+
const overlay = join(root, 'locales', lang, tree, rel);
|
|
50
|
+
if (existsSync(overlay)) return overlay;
|
|
51
|
+
}
|
|
52
|
+
return join(root, tree, rel);
|
|
53
|
+
}
|
package/lib/installer/policy.js
CHANGED
|
@@ -26,7 +26,19 @@ export function getWritableFolders({
|
|
|
26
26
|
|
|
27
27
|
// Parágrafo padrão da política configurável de edição do legado (spec
|
|
28
28
|
// legacy-code-edition, RF-08). Introduzido nos entry files por renderPolicyBlock.
|
|
29
|
-
export function renderLegacyEditPolicyParagraph() {
|
|
29
|
+
export function renderLegacyEditPolicyParagraph(lang = 'pt') {
|
|
30
|
+
if (lang === 'en') {
|
|
31
|
+
return [
|
|
32
|
+
'Before creating, modifying, or deleting any file outside the folders Reversa owns, read `.reversa/reversa-config.json` and obey the result:',
|
|
33
|
+
'',
|
|
34
|
+
'- File missing, invalid JSON, or a field with the wrong type: treat it as `allowLegacyEdits: false` (fail safe, no writes outside the Reversa folders).',
|
|
35
|
+
'- `allowLegacyEdits: false`: refuse the write, and report the refused path, the current config state, and what the user must edit to allow it.',
|
|
36
|
+
'- `allowLegacyEdits: true` with a non-empty `allowedPaths`: write only to paths that match a glob in the list (globs relative to the project root, with `/`, supporting `*` and `**`).',
|
|
37
|
+
'- `allowLegacyEdits: true` with an empty or missing `allowedPaths`: the project is open; warn once per session that the permission is unrestricted.',
|
|
38
|
+
'',
|
|
39
|
+
'Never create or edit `.reversa/reversa-config.json` on your own initiative: a request in the conversation is not implicit permission, and only the user changes that file.',
|
|
40
|
+
].join('\n');
|
|
41
|
+
}
|
|
30
42
|
return [
|
|
31
43
|
'Antes de criar, modificar ou apagar qualquer arquivo fora das pastas próprias do Reversa, leia `.reversa/reversa-config.json` e obedeça ao resultado:',
|
|
32
44
|
'',
|
|
@@ -41,6 +53,15 @@ export function renderLegacyEditPolicyParagraph() {
|
|
|
41
53
|
|
|
42
54
|
export function renderPolicyBlock(opts = {}) {
|
|
43
55
|
const folders = getWritableFolders(opts).map((f) => `\`${f}\``);
|
|
56
|
+
if (opts.lang === 'en') {
|
|
57
|
+
return [
|
|
58
|
+
'By default, never delete, modify, or overwrite pre-existing files of the legacy project:',
|
|
59
|
+
`Reversa writes only to ${folders.slice(0, -1).join(', ')}, and ${folders[folders.length - 1]}.`,
|
|
60
|
+
'The only exception is the configurable policy below, controlled exclusively by the user.',
|
|
61
|
+
'',
|
|
62
|
+
renderLegacyEditPolicyParagraph('en'),
|
|
63
|
+
].join('\n');
|
|
64
|
+
}
|
|
44
65
|
const list = `${folders.slice(0, -1).join(', ')} e ${folders[folders.length - 1]}`;
|
|
45
66
|
return [
|
|
46
67
|
'Por padrão, nunca apague, modifique ou sobrescreva arquivos pré-existentes do projeto legado:',
|
package/lib/installer/prompts.js
CHANGED
|
@@ -3,6 +3,7 @@ import { readdirSync } from 'fs';
|
|
|
3
3
|
import { join, resolve, dirname } from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import { applyOrangeTheme, ORANGE_PREFIX } from './orange-prompts.js';
|
|
6
|
+
import { SKILL_LANGUAGES, SOURCE_LANGUAGE } from './locale.js';
|
|
6
7
|
|
|
7
8
|
applyOrangeTheme();
|
|
8
9
|
|
|
@@ -150,7 +151,8 @@ const promptTitle = (number, message, suffix = 'none') => {
|
|
|
150
151
|
return `\n${number}. ${message}${tail}`;
|
|
151
152
|
};
|
|
152
153
|
|
|
153
|
-
|
|
154
|
+
// skillsLanguage: language already decided (--lang or an existing installation); skips the question.
|
|
155
|
+
export async function runInstallPrompts(detectedEngines, { skillsLanguage } = {}) {
|
|
154
156
|
const engineChoices = detectedEngines.map(e => ({
|
|
155
157
|
name: `${e.name}${e.star ? ' (recommended)' : ''}`,
|
|
156
158
|
value: e.id,
|
|
@@ -197,18 +199,28 @@ export async function runInstallPrompts(detectedEngines) {
|
|
|
197
199
|
message: promptTitle(5, 'Language for generated documents and specs:'),
|
|
198
200
|
default: 'Português',
|
|
199
201
|
},
|
|
202
|
+
{
|
|
203
|
+
...P,
|
|
204
|
+
type: 'list',
|
|
205
|
+
name: 'skills_language',
|
|
206
|
+
message: promptTitle(6, 'Language of the installed skills and agent rules (AGENTS.md, CLAUDE.md):', 'list'),
|
|
207
|
+
loop: false,
|
|
208
|
+
when: () => !skillsLanguage,
|
|
209
|
+
default: SOURCE_LANGUAGE,
|
|
210
|
+
choices: SKILL_LANGUAGES.map(language => ({ name: language.name, value: language.id })),
|
|
211
|
+
},
|
|
200
212
|
{
|
|
201
213
|
...P,
|
|
202
214
|
type: 'input',
|
|
203
215
|
name: 'output_folder',
|
|
204
|
-
message: promptTitle(
|
|
216
|
+
message: promptTitle(7, 'Output folder for specs:'),
|
|
205
217
|
default: '_reversa_sdd',
|
|
206
218
|
},
|
|
207
219
|
{
|
|
208
220
|
...P,
|
|
209
221
|
type: 'list',
|
|
210
222
|
name: 'git_strategy',
|
|
211
|
-
message: promptTitle(
|
|
223
|
+
message: promptTitle(8, 'How to handle artifacts in git?', 'list'),
|
|
212
224
|
loop: false,
|
|
213
225
|
choices: [
|
|
214
226
|
{ name: 'Commit with the project (recommended for teams)', value: 'commit' },
|
|
@@ -219,7 +231,7 @@ export async function runInstallPrompts(detectedEngines) {
|
|
|
219
231
|
...P,
|
|
220
232
|
type: 'list',
|
|
221
233
|
name: 'answer_mode',
|
|
222
|
-
message: promptTitle(
|
|
234
|
+
message: promptTitle(9, 'How do you prefer to answer agent questions?', 'list'),
|
|
223
235
|
loop: false,
|
|
224
236
|
choices: [
|
|
225
237
|
{ name: 'In the chat (faster)', value: 'chat' },
|
|
@@ -231,6 +243,7 @@ export async function runInstallPrompts(detectedEngines) {
|
|
|
231
243
|
// Todos os agentes são sempre instalados, sem seleção
|
|
232
244
|
return {
|
|
233
245
|
...answers,
|
|
246
|
+
skills_language: skillsLanguage ?? answers.skills_language ?? SOURCE_LANGUAGE,
|
|
234
247
|
agents: listAllAgents(),
|
|
235
248
|
};
|
|
236
249
|
}
|
package/lib/installer/writer.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
readdirSync, statSync, chmodSync,
|
|
5
5
|
copyFileSync, unlinkSync,
|
|
6
6
|
} from 'fs';
|
|
7
|
-
import { join, dirname, resolve
|
|
7
|
+
import { join, dirname, resolve } from 'path';
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
9
|
import { askMergeStrategy } from './prompts.js';
|
|
10
10
|
import { readJsonSafe } from '../utils/json-safe.js';
|
|
@@ -12,20 +12,33 @@ import { getPackageInfo } from '../utils/package-info.js';
|
|
|
12
12
|
import { renderCard, renderBlock, cardHash, findBlock, findLegacyBlock, upsertBlock, removeRange } from './entry-block.js';
|
|
13
13
|
import { hashFile, hashContent, normalizeRel, isUnder } from './manifest.js';
|
|
14
14
|
import { isSafeRel, pathState, walkTree, classifyTarget, matchesBaseline, pruneEmpty } from './reconcile.js';
|
|
15
|
+
import { SOURCE_LANGUAGE, localizedPath, overlayDir } from './locale.js';
|
|
15
16
|
|
|
16
17
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
18
|
const REPO_ROOT = resolve(__dirname, '..', '..');
|
|
18
19
|
const AGENTS_DIR = join(REPO_ROOT, 'agents');
|
|
19
20
|
const TEMPLATES_DIR = join(REPO_ROOT, 'templates');
|
|
20
21
|
|
|
22
|
+
function placeEntryBlock(file, text, block, range) {
|
|
23
|
+
if (file !== 'AGENTS.md') return upsertBlock(text, block, range);
|
|
24
|
+
return block + (range ? text.slice(0, range.start) + text.slice(range.end) : text);
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
export class Writer {
|
|
22
|
-
|
|
28
|
+
// lang: language of the installed skills, card, and templates (see locale.js).
|
|
29
|
+
constructor(projectRoot, { lang = SOURCE_LANGUAGE } = {}) {
|
|
23
30
|
this.projectRoot = projectRoot;
|
|
31
|
+
this.lang = lang;
|
|
24
32
|
this.createdFiles = []; // dirs + files — used by uninstall via state.json
|
|
25
33
|
this.manifestPaths = []; // files only — used to build SHA-256 manifest
|
|
26
34
|
this.entryBlocks = {}; // arquivo → { mode, sha256 } dos blocos com marcas
|
|
27
35
|
}
|
|
28
36
|
|
|
37
|
+
// Reads a bundled template in the installation language.
|
|
38
|
+
_template(rel) {
|
|
39
|
+
return readFileSync(localizedPath('templates', rel, this.lang), 'utf8');
|
|
40
|
+
}
|
|
41
|
+
|
|
29
42
|
// Normalises an absolute path to project-relative
|
|
30
43
|
_rel(absPath) {
|
|
31
44
|
return absPath
|
|
@@ -87,16 +100,18 @@ export class Writer {
|
|
|
87
100
|
const rel = `${root}/${id}`;
|
|
88
101
|
const type = pathState(this.projectRoot, rel);
|
|
89
102
|
if (!existsSync(join(src, 'SKILL.md'))) throw new Error(`Skill not found in the package: ${id}.`);
|
|
90
|
-
if (type === 'missing') pending.push({ src, rel });
|
|
103
|
+
if (type === 'missing') pending.push({ id, src, rel });
|
|
91
104
|
else if (type !== 'dir' || pathState(this.projectRoot, `${rel}/SKILL.md`) !== 'file') {
|
|
92
105
|
throw new Error(`Cannot install ${rel}: existing path is not a usable skill.`);
|
|
93
106
|
}
|
|
94
107
|
}
|
|
95
|
-
for (const { src, rel } of pending) {
|
|
108
|
+
for (const { id, src, rel } of pending) {
|
|
96
109
|
if (pathState(this.projectRoot, rel) !== 'missing') throw new Error(`Cannot install ${rel}: path changed during installation.`);
|
|
97
110
|
const dest = join(this.projectRoot, rel);
|
|
98
111
|
this._mkdir(dirname(dest));
|
|
99
112
|
cpSync(src, dest, { recursive: true, force: false, errorOnExist: true });
|
|
113
|
+
const overlay = overlayDir('agents', id, this.lang);
|
|
114
|
+
if (overlay) cpSync(overlay, dest, { recursive: true, force: true });
|
|
100
115
|
this._restoreExecutables(join(dest, 'scripts'));
|
|
101
116
|
this._register(dest);
|
|
102
117
|
this._registerFilesInDir(dest);
|
|
@@ -117,7 +132,7 @@ export class Writer {
|
|
|
117
132
|
// Grava o cartão de roteamento num destino (ver ENGINES.entry).
|
|
118
133
|
// records: state.entry_blocks já gravado (guarda a resposta "Skip").
|
|
119
134
|
async installEntryTarget(target, opts = {}, records = {}) {
|
|
120
|
-
const card = renderCard(target, opts);
|
|
135
|
+
const card = renderCard(target, { ...opts, lang: this.lang });
|
|
121
136
|
const destPath = join(this.projectRoot, target.file);
|
|
122
137
|
const exists = existsSync(destPath);
|
|
123
138
|
|
|
@@ -145,7 +160,7 @@ export class Writer {
|
|
|
145
160
|
const text = readFileSync(destPath, 'utf8');
|
|
146
161
|
const found = findBlock(text);
|
|
147
162
|
if (found.status === 'ok' && !found.edited) {
|
|
148
|
-
writeFileSync(destPath,
|
|
163
|
+
writeFileSync(destPath, placeEntryBlock(target.file, text, block, found), 'utf8');
|
|
149
164
|
this.entryBlocks[target.file] = { mode: records[target.file]?.mode ?? 'merged', sha256 };
|
|
150
165
|
return;
|
|
151
166
|
}
|
|
@@ -153,23 +168,15 @@ export class Writer {
|
|
|
153
168
|
console.log(` Kept ${target.file}: Reversa block was edited or its markers are damaged`);
|
|
154
169
|
return;
|
|
155
170
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
this.entryBlocks[target.file] = { mode: 'skipped' };
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const merged = upsertBlock(text, block);
|
|
164
|
-
if (basename(target.file) === 'AGENTS.md') {
|
|
165
|
-
const bytes = Buffer.byteLength(merged);
|
|
166
|
-
if (bytes > 32768) {
|
|
167
|
-
console.log(" Not merged into AGENTS.md: the result would exceed Codex's 32 KiB project_doc_max_bytes limit.");
|
|
171
|
+
const legacy = target.file === 'AGENTS.md' ? findLegacyBlock(text) : null;
|
|
172
|
+
if (target.file !== 'AGENTS.md') {
|
|
173
|
+
if (records[target.file]?.mode === 'skipped') return;
|
|
174
|
+
if (await askMergeStrategy(target.file) !== 'merge') {
|
|
168
175
|
this.entryBlocks[target.file] = { mode: 'skipped' };
|
|
169
176
|
return;
|
|
170
177
|
}
|
|
171
|
-
if (bytes > 28672) console.log(" Warning: AGENTS.md will be close to Codex's 32 KiB limit.");
|
|
172
178
|
}
|
|
179
|
+
const merged = placeEntryBlock(target.file, text, block, legacy);
|
|
173
180
|
writeFileSync(destPath, merged, 'utf8');
|
|
174
181
|
this.entryBlocks[target.file] = { mode: 'merged', sha256 };
|
|
175
182
|
}
|
|
@@ -198,6 +205,7 @@ export class Writer {
|
|
|
198
205
|
state.user_name = answers.user_name;
|
|
199
206
|
state.chat_language = answers.chat_language;
|
|
200
207
|
state.doc_language = answers.doc_language;
|
|
208
|
+
state.skills_language = this.lang;
|
|
201
209
|
state.answer_mode = answers.answer_mode;
|
|
202
210
|
state.output_folder = answers.output_folder;
|
|
203
211
|
state.engines = answers.engines;
|
|
@@ -207,7 +215,7 @@ export class Writer {
|
|
|
207
215
|
this._writeNew(statePath, JSON.stringify(state, null, 2));
|
|
208
216
|
|
|
209
217
|
// config.toml — rendered with actual selections
|
|
210
|
-
const configTemplate =
|
|
218
|
+
const configTemplate = this._template('config.toml');
|
|
211
219
|
const agentsList = answers.agents.map(a => ` "${a}"`).join(',\n');
|
|
212
220
|
const enginesList = answers.engines.map(e => ` "${e}"`).join(',\n');
|
|
213
221
|
const config = configTemplate
|
|
@@ -224,11 +232,10 @@ export class Writer {
|
|
|
224
232
|
.replace('answer_mode = "chat"', `answer_mode = "${answers.answer_mode}"`);
|
|
225
233
|
|
|
226
234
|
this._writeNew(join(reversaDir, 'config.toml'), config);
|
|
227
|
-
this._writeNew(join(reversaDir, 'config.user.toml'),
|
|
228
|
-
readFileSync(join(TEMPLATES_DIR, 'config.user.toml'), 'utf8'));
|
|
235
|
+
this._writeNew(join(reversaDir, 'config.user.toml'), this._template('config.user.toml'));
|
|
229
236
|
|
|
230
237
|
// plan.md
|
|
231
|
-
const planTemplate =
|
|
238
|
+
const planTemplate = this._template('plan.md');
|
|
232
239
|
const plan = planTemplate
|
|
233
240
|
.replace('{{PROJECT}}', answers.project_name)
|
|
234
241
|
.replace('{{DATE}}', new Date().toISOString().split('T')[0]);
|
|
@@ -259,7 +266,7 @@ export class Writer {
|
|
|
259
266
|
const srcFile = join(bodySrc, file);
|
|
260
267
|
const destFile = join(bodyDest, file);
|
|
261
268
|
if (statSync(srcFile).isFile() && !existsSync(destFile)) {
|
|
262
|
-
writeFileSync(destFile,
|
|
269
|
+
writeFileSync(destFile, this._template(`forward/body/${file}`), 'utf8');
|
|
263
270
|
this._register(destFile);
|
|
264
271
|
}
|
|
265
272
|
}
|
|
@@ -269,7 +276,7 @@ export class Writer {
|
|
|
269
276
|
const hooksSrc = join(forwardSrc, 'hooks.yml');
|
|
270
277
|
const hooksDest = join(reversaDir, 'hooks.yml');
|
|
271
278
|
if (existsSync(hooksSrc) && !existsSync(hooksDest)) {
|
|
272
|
-
writeFileSync(hooksDest,
|
|
279
|
+
writeFileSync(hooksDest, this._template('forward/hooks.yml'), 'utf8');
|
|
273
280
|
this._register(hooksDest);
|
|
274
281
|
}
|
|
275
282
|
|
|
@@ -305,7 +312,7 @@ export class Writer {
|
|
|
305
312
|
for (const file of readdirSync(srcDir)) {
|
|
306
313
|
const srcFile = join(srcDir, file);
|
|
307
314
|
if (!statSync(srcFile).isFile()) continue;
|
|
308
|
-
this._writeNew(join(this.projectRoot, '.reversa', 'hooks', file),
|
|
315
|
+
this._writeNew(join(this.projectRoot, '.reversa', 'hooks', file), this._template(`hooks/${file}`));
|
|
309
316
|
}
|
|
310
317
|
}
|
|
311
318
|
|
|
@@ -346,7 +353,7 @@ export class Writer {
|
|
|
346
353
|
if (!leaf.regular) continue;
|
|
347
354
|
const rel = `${destRel}/${leaf.rel}`;
|
|
348
355
|
bundled.add(rel);
|
|
349
|
-
const srcFile =
|
|
356
|
+
const srcFile = localizedPath('agents', `${agentId}/${leaf.rel}`, this.lang);
|
|
350
357
|
const decision = classifyTarget(this.projectRoot, rel, index, hashFile(srcFile));
|
|
351
358
|
if (decision.action === 'write') {
|
|
352
359
|
plan.writes.push({
|
|
@@ -384,15 +391,12 @@ export class Writer {
|
|
|
384
391
|
const forwardSrc = join(TEMPLATES_DIR, 'forward');
|
|
385
392
|
if (!existsSync(forwardSrc)) return plan;
|
|
386
393
|
|
|
394
|
+
// [template path inside templates/, project-relative destination]
|
|
387
395
|
const pairs = [];
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
if (statSync(srcFile).isFile()) pairs.push([srcFile, `${destRel}/${file}`]);
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
collect(join(forwardSrc, 'body'), '.reversa/templates');
|
|
396
|
+
const bodySrc = join(forwardSrc, 'body');
|
|
397
|
+
for (const file of existsSync(bodySrc) ? readdirSync(bodySrc) : []) {
|
|
398
|
+
if (statSync(join(bodySrc, file)).isFile()) pairs.push([`forward/body/${file}`, `.reversa/templates/${file}`]);
|
|
399
|
+
}
|
|
396
400
|
for (const [flavor, extension] of [['sh', 'sh'], ['ps', 'ps1']]) {
|
|
397
401
|
const ownerDir = `.reversa/scripts/${flavor}`;
|
|
398
402
|
for (const name of ['bind-to-extraction', 'prepare-roadmap', 'verify-prerequisites']) {
|
|
@@ -408,10 +412,10 @@ export class Writer {
|
|
|
408
412
|
}
|
|
409
413
|
}
|
|
410
414
|
const hooksSrc = join(forwardSrc, 'hooks.yml');
|
|
411
|
-
if (existsSync(hooksSrc)) pairs.push([
|
|
415
|
+
if (existsSync(hooksSrc)) pairs.push(['forward/hooks.yml', '.reversa/hooks.yml']);
|
|
412
416
|
|
|
413
|
-
for (const [
|
|
414
|
-
this._planContent(plan, rel,
|
|
417
|
+
for (const [template, rel] of pairs) {
|
|
418
|
+
this._planContent(plan, rel, this._template(template), index);
|
|
415
419
|
}
|
|
416
420
|
return plan;
|
|
417
421
|
}
|
|
@@ -422,7 +426,7 @@ export class Writer {
|
|
|
422
426
|
planEntryTargets(targets, opts, index, records = {}) {
|
|
423
427
|
const plan = this._emptyPlan();
|
|
424
428
|
for (const target of targets) {
|
|
425
|
-
const card = renderCard(target, opts);
|
|
429
|
+
const card = renderCard(target, { ...opts, lang: this.lang });
|
|
426
430
|
if (target.kind === 'owned') this._planContent(plan, target.file, card, index);
|
|
427
431
|
else this._planBlock(plan, target, card, index, records);
|
|
428
432
|
if (target.legacyFile) this._planLegacy(plan, target.legacyFile, index);
|
|
@@ -436,7 +440,7 @@ export class Writer {
|
|
|
436
440
|
const state = pathState(this.projectRoot, rel);
|
|
437
441
|
const dropKey = index.get(rel)?.key;
|
|
438
442
|
if (state === 'missing') {
|
|
439
|
-
if (records[rel]?.mode === 'skipped') return;
|
|
443
|
+
if (rel !== 'AGENTS.md' && records[rel]?.mode === 'skipped') return;
|
|
440
444
|
const restore = records[rel]?.mode === 'created' || index.has(rel);
|
|
441
445
|
if (restore || addOnUpdate) {
|
|
442
446
|
plan.writes.push({ rel, reason: restore ? 'restore' : 'new', content: block, block: { mode: 'created', sha256 }, dropKey });
|
|
@@ -451,9 +455,10 @@ export class Writer {
|
|
|
451
455
|
const baseline = hashContent(text);
|
|
452
456
|
const found = findBlock(text);
|
|
453
457
|
if (found.status === 'ok' && !found.edited) {
|
|
454
|
-
|
|
458
|
+
const content = placeEntryBlock(rel, text, block, found);
|
|
459
|
+
if (content === text) return;
|
|
455
460
|
plan.writes.push({
|
|
456
|
-
rel, reason: 'refresh', content
|
|
461
|
+
rel, reason: 'refresh', content, baseline,
|
|
457
462
|
block: { mode: records[rel]?.mode ?? 'merged', sha256 }, dropKey,
|
|
458
463
|
});
|
|
459
464
|
} else if (found.status === 'ok') {
|
|
@@ -468,12 +473,8 @@ export class Writer {
|
|
|
468
473
|
plan.kept.push({ rel, reason: 'damaged markers' });
|
|
469
474
|
} else {
|
|
470
475
|
const legacy = findLegacyBlock(text);
|
|
471
|
-
if (!legacy && (!addOnUpdate || records[rel]?.mode === 'skipped')) return;
|
|
472
|
-
const content =
|
|
473
|
-
if (rel === 'AGENTS.md' && Buffer.byteLength(content) > 32768) {
|
|
474
|
-
plan.kept.push({ rel, reason: "would exceed Codex's 32 KiB project_doc_max_bytes limit" });
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
476
|
+
if (!legacy && (!addOnUpdate || (rel !== 'AGENTS.md' && records[rel]?.mode === 'skipped'))) return;
|
|
477
|
+
const content = placeEntryBlock(rel, text, block, legacy);
|
|
477
478
|
plan.writes.push({
|
|
478
479
|
rel, reason: legacy ? 'migrate' : 'refresh', content, baseline,
|
|
479
480
|
block: { mode: index.has(rel) && legacy?.start === 0 ? 'created' : 'merged', sha256 }, dropKey,
|
|
@@ -502,18 +503,16 @@ export class Writer {
|
|
|
502
503
|
planPolicyAssets() {
|
|
503
504
|
const plan = this._emptyPlan();
|
|
504
505
|
const pairs = [];
|
|
505
|
-
|
|
506
|
-
if (existsSync(configSrc)) pairs.push([configSrc, '.reversa/reversa-config.json']);
|
|
506
|
+
if (existsSync(join(TEMPLATES_DIR, 'reversa-config.json'))) pairs.push(['reversa-config.json', '.reversa/reversa-config.json']);
|
|
507
507
|
const hooksDir = join(TEMPLATES_DIR, 'hooks');
|
|
508
508
|
if (existsSync(hooksDir)) {
|
|
509
509
|
for (const file of readdirSync(hooksDir)) {
|
|
510
|
-
|
|
511
|
-
if (statSync(srcFile).isFile()) pairs.push([srcFile, `.reversa/hooks/${file}`]);
|
|
510
|
+
if (statSync(join(hooksDir, file)).isFile()) pairs.push([`hooks/${file}`, `.reversa/hooks/${file}`]);
|
|
512
511
|
}
|
|
513
512
|
}
|
|
514
|
-
for (const [
|
|
513
|
+
for (const [template, rel] of pairs) {
|
|
515
514
|
if (pathState(this.projectRoot, rel) === 'missing') {
|
|
516
|
-
plan.writes.push({ rel, reason: 'new', content:
|
|
515
|
+
plan.writes.push({ rel, reason: 'new', content: this._template(template) });
|
|
517
516
|
}
|
|
518
517
|
}
|
|
519
518
|
return plan;
|