oxe-cc 1.21.1 → 1.22.2
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/.cursor/commands/oxe-alm.md +47 -0
- package/.cursor/commands/oxe-ask.md +1 -1
- package/.cursor/commands/oxe-capabilities.md +1 -1
- package/.cursor/commands/oxe-checkpoint.md +1 -1
- package/.cursor/commands/oxe-compact.md +1 -1
- package/.cursor/commands/oxe-dashboard.md +1 -1
- package/.cursor/commands/oxe-debug.md +1 -1
- package/.cursor/commands/oxe-discuss.md +1 -1
- package/.cursor/commands/oxe-execute.md +3 -1
- package/.cursor/commands/oxe-forensics.md +1 -1
- package/.cursor/commands/oxe-help.md +1 -1
- package/.cursor/commands/oxe-loop.md +1 -1
- package/.cursor/commands/oxe-milestone.md +1 -1
- package/.cursor/commands/oxe-next.md +1 -1
- package/.cursor/commands/oxe-obs.md +1 -1
- package/.cursor/commands/oxe-plan-agent.md +1 -1
- package/.cursor/commands/oxe-plan.md +3 -1
- package/.cursor/commands/oxe-project.md +1 -1
- package/.cursor/commands/oxe-quick.md +6 -4
- package/.cursor/commands/oxe-research.md +1 -1
- package/.cursor/commands/oxe-retro.md +1 -1
- package/.cursor/commands/oxe-review-pr.md +1 -1
- package/.cursor/commands/oxe-route.md +1 -1
- package/.cursor/commands/oxe-scan.md +1 -1
- package/.cursor/commands/oxe-security.md +1 -1
- package/.cursor/commands/oxe-session.md +1 -1
- package/.cursor/commands/oxe-ship.md +8 -8
- package/.cursor/commands/oxe-skill.md +1 -1
- package/.cursor/commands/oxe-spec.md +5 -3
- package/.cursor/commands/oxe-ui-review.md +1 -1
- package/.cursor/commands/oxe-ui-spec.md +1 -1
- package/.cursor/commands/oxe-update.md +1 -1
- package/.cursor/commands/oxe-validate-gaps.md +1 -1
- package/.cursor/commands/oxe-verify-audit.md +1 -1
- package/.cursor/commands/oxe-verify.md +1 -1
- package/.cursor/commands/oxe-workflow-authoring.md +1 -1
- package/.cursor/commands/oxe-workstream.md +1 -1
- package/.cursor/commands/oxe.md +4 -2
- package/.github/copilot-instructions.md +177 -177
- package/.github/dependabot.yml +31 -31
- package/.github/prompts/oxe-alm.prompt.md +47 -0
- package/.github/prompts/oxe-ask.prompt.md +1 -1
- package/.github/prompts/oxe-capabilities.prompt.md +1 -1
- package/.github/prompts/oxe-checkpoint.prompt.md +1 -1
- package/.github/prompts/oxe-compact.prompt.md +1 -1
- package/.github/prompts/oxe-dashboard.prompt.md +1 -1
- package/.github/prompts/oxe-debug.prompt.md +1 -1
- package/.github/prompts/oxe-discuss.prompt.md +1 -1
- package/.github/prompts/oxe-execute.prompt.md +3 -1
- package/.github/prompts/oxe-forensics.prompt.md +1 -1
- package/.github/prompts/oxe-help.prompt.md +1 -1
- package/.github/prompts/oxe-loop.prompt.md +1 -1
- package/.github/prompts/oxe-milestone.prompt.md +1 -1
- package/.github/prompts/oxe-next.prompt.md +1 -1
- package/.github/prompts/oxe-obs.prompt.md +1 -1
- package/.github/prompts/oxe-plan-agent.prompt.md +1 -1
- package/.github/prompts/oxe-plan.prompt.md +3 -1
- package/.github/prompts/oxe-project.prompt.md +1 -1
- package/.github/prompts/oxe-quick.prompt.md +6 -4
- package/.github/prompts/oxe-research.prompt.md +1 -1
- package/.github/prompts/oxe-retro.prompt.md +1 -1
- package/.github/prompts/oxe-review-pr.prompt.md +1 -1
- package/.github/prompts/oxe-route.prompt.md +1 -1
- package/.github/prompts/oxe-scan.prompt.md +1 -1
- package/.github/prompts/oxe-security.prompt.md +1 -1
- package/.github/prompts/oxe-session.prompt.md +1 -1
- package/.github/prompts/oxe-ship.prompt.md +7 -7
- package/.github/prompts/oxe-skill.prompt.md +1 -1
- package/.github/prompts/oxe-spec.prompt.md +4 -2
- package/.github/prompts/oxe-ui-review.prompt.md +1 -1
- package/.github/prompts/oxe-ui-spec.prompt.md +1 -1
- package/.github/prompts/oxe-update.prompt.md +1 -1
- package/.github/prompts/oxe-validate-gaps.prompt.md +1 -1
- package/.github/prompts/oxe-verify-audit.prompt.md +1 -1
- package/.github/prompts/oxe-verify.prompt.md +1 -1
- package/.github/prompts/oxe-workflow-authoring.prompt.md +1 -1
- package/.github/prompts/oxe-workstream.prompt.md +1 -1
- package/.github/prompts/oxe.prompt.md +4 -2
- package/.github/workflows/ci.yml +163 -163
- package/.github/workflows/release.yml +151 -120
- package/AGENTS.md +108 -102
- package/CHANGELOG.md +1971 -1042
- package/LICENSE +21 -21
- package/QUICKSTART.md +99 -99
- package/README.md +703 -673
- package/bin/banner.txt +18 -18
- package/bin/lib/commands/ops-commands.cjs +751 -0
- package/bin/lib/commands/spec-program-commands.cjs +337 -0
- package/bin/lib/operational/alm-refine-runtime.cjs +791 -0
- package/bin/lib/operational/child-env.cjs +52 -0
- package/bin/lib/operational/promote-runtime.cjs +1187 -0
- package/bin/lib/oxe-acceptance-audit.cjs +195 -0
- package/bin/lib/oxe-adr.cjs +145 -0
- package/bin/lib/oxe-agent-coord.cjs +246 -0
- package/bin/lib/oxe-agent-install.cjs +679 -677
- package/bin/lib/oxe-alm-admin.cjs +215 -0
- package/bin/lib/oxe-alm-metrics.cjs +143 -0
- package/bin/lib/oxe-alm-prs.cjs +274 -0
- package/bin/lib/oxe-alm-refine.cjs +1099 -0
- package/bin/lib/oxe-alm.cjs +1289 -0
- package/bin/lib/oxe-anchor-copy.cjs +218 -0
- package/bin/lib/oxe-api-surface.cjs +96 -0
- package/bin/lib/oxe-artifact-catalog.cjs +376 -376
- package/bin/lib/oxe-artifact-refs.cjs +72 -0
- package/bin/lib/oxe-attention.cjs +97 -0
- package/bin/lib/oxe-autoresume.cjs +448 -0
- package/bin/lib/oxe-budget.cjs +154 -117
- package/bin/lib/oxe-change-folder.cjs +130 -0
- package/bin/lib/oxe-change.cjs +389 -230
- package/bin/lib/oxe-channels.cjs +82 -0
- package/bin/lib/oxe-ci-adapter.cjs +304 -0
- package/bin/lib/oxe-cited-paths.cjs +180 -0
- package/bin/lib/oxe-cli-errors.cjs +76 -0
- package/bin/lib/oxe-cli-output.cjs +111 -0
- package/bin/lib/oxe-command-registry.cjs +31 -31
- package/bin/lib/oxe-commit-convention.cjs +104 -85
- package/bin/lib/oxe-complexity.cjs +106 -0
- package/bin/lib/oxe-console-decode.cjs +23 -0
- package/bin/lib/oxe-context-engine.cjs +874 -874
- package/bin/lib/oxe-coordinator-queue.cjs +67 -0
- package/bin/lib/oxe-core-command-handlers.cjs +84 -82
- package/bin/lib/oxe-criteria-ids.cjs +87 -0
- package/bin/lib/oxe-criterion-coverage.cjs +93 -58
- package/bin/lib/oxe-cross-card-conflicts.cjs +639 -0
- package/bin/lib/oxe-customize.cjs +146 -0
- package/bin/lib/oxe-dashboard.cjs +737 -737
- package/bin/lib/oxe-decisions.cjs +217 -0
- package/bin/lib/oxe-deferred.cjs +80 -0
- package/bin/lib/oxe-deps-audit.cjs +136 -0
- package/bin/lib/oxe-diff-reviewer.cjs +105 -0
- package/bin/lib/oxe-dir-info.cjs +157 -0
- package/bin/lib/oxe-docs-check.cjs +124 -0
- package/bin/lib/oxe-docs-publish.cjs +81 -0
- package/bin/lib/oxe-dom-hooks.cjs +902 -0
- package/bin/lib/oxe-dossier.cjs +355 -281
- package/bin/lib/oxe-e2e-ready.cjs +360 -0
- package/bin/lib/oxe-env-sanitize.cjs +160 -0
- package/bin/lib/oxe-event-bus.cjs +118 -118
- package/bin/lib/oxe-failure-cost.cjs +144 -0
- package/bin/lib/oxe-file-size-guard.cjs +849 -0
- package/bin/lib/oxe-findings.cjs +86 -0
- package/bin/lib/oxe-git-root.cjs +97 -0
- package/bin/lib/oxe-grill-cases.cjs +148 -0
- package/bin/lib/oxe-grill.cjs +533 -0
- package/bin/lib/oxe-grooming.cjs +115 -0
- package/bin/lib/oxe-guard.cjs +180 -0
- package/bin/lib/oxe-handoff.cjs +97 -0
- package/bin/lib/oxe-install-resolve.cjs +134 -134
- package/bin/lib/oxe-integration-checks.cjs +285 -0
- package/bin/lib/oxe-intent-context.cjs +101 -0
- package/bin/lib/oxe-journey.cjs +403 -0
- package/bin/lib/oxe-known-failures.cjs +138 -0
- package/bin/lib/oxe-local-config.cjs +77 -0
- package/bin/lib/oxe-manifest.cjs +124 -124
- package/bin/lib/oxe-memory-kernel.cjs +190 -188
- package/bin/lib/oxe-merge-train.cjs +277 -0
- package/bin/lib/oxe-model-resolve.cjs +74 -0
- package/bin/lib/oxe-model-tiers.cjs +65 -0
- package/bin/lib/oxe-nfr.cjs +125 -0
- package/bin/lib/oxe-npm-version.cjs +66 -66
- package/bin/lib/oxe-onboard.cjs +640 -0
- package/bin/lib/oxe-open-defects.cjs +121 -0
- package/bin/lib/oxe-operational.cjs +12112 -2115
- package/bin/lib/oxe-origin-guard.cjs +102 -0
- package/bin/lib/oxe-origin.cjs +380 -0
- package/bin/lib/oxe-pack-removed.cjs +208 -0
- package/bin/lib/oxe-parallel-run.cjs +81 -0
- package/bin/lib/oxe-parallel.cjs +234 -0
- package/bin/lib/oxe-phase-extras.cjs +185 -0
- package/bin/lib/oxe-phase-gates.cjs +688 -280
- package/bin/lib/oxe-plan-build.cjs +1580 -0
- package/bin/lib/oxe-plan-json.cjs +1107 -433
- package/bin/lib/oxe-plan-merge.cjs +253 -0
- package/bin/lib/oxe-plan-mutate.cjs +320 -0
- package/bin/lib/oxe-plan-repair.cjs +479 -0
- package/bin/lib/oxe-plan-review.cjs +256 -0
- package/bin/lib/oxe-plan-skeleton.cjs +494 -0
- package/bin/lib/oxe-plan-staleness.cjs +125 -0
- package/bin/lib/oxe-plugin-cli.cjs +97 -95
- package/bin/lib/oxe-plugins.cjs +432 -432
- package/bin/lib/oxe-policy-rules.cjs +144 -0
- package/bin/lib/oxe-prd.cjs +129 -0
- package/bin/lib/oxe-preflight.cjs +384 -0
- package/bin/lib/oxe-presets.cjs +216 -0
- package/bin/lib/oxe-process.cjs +67 -67
- package/bin/lib/oxe-program-members.cjs +97 -0
- package/bin/lib/oxe-program.cjs +245 -205
- package/bin/lib/oxe-progress-run.cjs +80 -0
- package/bin/lib/oxe-project-env.cjs +352 -178
- package/bin/lib/oxe-project-health.cjs +3426 -2962
- package/bin/lib/oxe-promote-helpers.cjs +1561 -0
- package/bin/lib/oxe-provider-antigravity.cjs +114 -0
- package/bin/lib/oxe-provider-grok.cjs +48 -0
- package/bin/lib/oxe-questions.cjs +115 -0
- package/bin/lib/oxe-quick.cjs +537 -0
- package/bin/lib/oxe-ratchets.cjs +132 -0
- package/bin/lib/oxe-rationality.cjs +587 -556
- package/bin/lib/oxe-real-regression.cjs +97 -0
- package/bin/lib/oxe-recovery.cjs +160 -0
- package/bin/lib/oxe-reevaluate.cjs +198 -0
- package/bin/lib/oxe-release-ops.cjs +361 -0
- package/bin/lib/oxe-release.cjs +622 -593
- package/bin/lib/oxe-repair.cjs +153 -0
- package/bin/lib/oxe-repo-map.cjs +136 -0
- package/bin/lib/oxe-repo-rules.cjs +121 -108
- package/bin/lib/oxe-research-provenance.cjs +96 -0
- package/bin/lib/oxe-resume.cjs +406 -0
- package/bin/lib/oxe-review.cjs +403 -0
- package/bin/lib/oxe-rfc.cjs +192 -0
- package/bin/lib/oxe-risk-decision.cjs +141 -0
- package/bin/lib/oxe-runtime-semantics.cjs +521 -514
- package/bin/lib/oxe-scorecard.cjs +627 -164
- package/bin/lib/oxe-scratch.cjs +81 -0
- package/bin/lib/oxe-seams.cjs +159 -0
- package/bin/lib/oxe-semver.cjs +83 -0
- package/bin/lib/oxe-ship-pr.cjs +272 -0
- package/bin/lib/oxe-signal.cjs +173 -0
- package/bin/lib/oxe-skill-loader.cjs +131 -131
- package/bin/lib/oxe-spec-check.cjs +249 -0
- package/bin/lib/oxe-spec-ears.cjs +98 -0
- package/bin/lib/oxe-spec-edit.cjs +411 -0
- package/bin/lib/oxe-spec-freeze.cjs +378 -0
- package/bin/lib/oxe-spec-probe.cjs +146 -0
- package/bin/lib/oxe-spec-stress.cjs +146 -0
- package/bin/lib/oxe-spike.cjs +98 -98
- package/bin/lib/oxe-state.cjs +87 -0
- package/bin/lib/oxe-stub-check.cjs +355 -0
- package/bin/lib/oxe-suite-impact.cjs +1160 -0
- package/bin/lib/oxe-sync.cjs +347 -0
- package/bin/lib/oxe-system-design.cjs +138 -0
- package/bin/lib/oxe-task-gates.cjs +139 -0
- package/bin/lib/oxe-telemetry.cjs +201 -0
- package/bin/lib/oxe-test-precheck.cjs +508 -0
- package/bin/lib/oxe-test-rigor.cjs +663 -0
- package/bin/lib/oxe-test-scope.cjs +883 -0
- package/bin/lib/oxe-trace.cjs +168 -0
- package/bin/lib/oxe-turns.cjs +64 -0
- package/bin/lib/oxe-ui-evidence.cjs +187 -0
- package/bin/lib/oxe-ui-verify.cjs +55 -0
- package/bin/lib/oxe-unsafe-commands.cjs +94 -0
- package/bin/lib/oxe-verdicts.cjs +131 -0
- package/bin/lib/oxe-verify-cache.cjs +132 -0
- package/bin/lib/oxe-verify-dryrun.cjs +541 -152
- package/bin/lib/oxe-verify-remote.cjs +208 -0
- package/bin/lib/oxe-vitest-batch.cjs +149 -0
- package/bin/lib/oxe-workflow-budget.cjs +99 -0
- package/bin/lib/oxe-workflow-eval.cjs +118 -0
- package/bin/lib/oxe-workflows.cjs +147 -145
- package/bin/lib/oxe-worktree-deps.cjs +241 -0
- package/bin/lib/oxe-worktree-gc.cjs +655 -0
- package/bin/oxe-cc.js +3861 -100
- package/commands/oxe/alm.md +54 -0
- package/commands/oxe/ask.md +1 -1
- package/commands/oxe/capabilities.md +1 -1
- package/commands/oxe/checkpoint.md +1 -1
- package/commands/oxe/compact.md +1 -1
- package/commands/oxe/dashboard.md +1 -1
- package/commands/oxe/debug.md +1 -1
- package/commands/oxe/discuss.md +1 -1
- package/commands/oxe/execute.md +3 -1
- package/commands/oxe/forensics.md +1 -1
- package/commands/oxe/help.md +1 -1
- package/commands/oxe/loop.md +1 -1
- package/commands/oxe/milestone.md +1 -1
- package/commands/oxe/next.md +1 -1
- package/commands/oxe/obs.md +1 -1
- package/commands/oxe/oxe.md +3 -1
- package/commands/oxe/plan-agent.md +1 -1
- package/commands/oxe/plan.md +3 -1
- package/commands/oxe/project.md +1 -1
- package/commands/oxe/quick.md +4 -4
- package/commands/oxe/research.md +1 -1
- package/commands/oxe/retro.md +1 -1
- package/commands/oxe/review-pr.md +1 -1
- package/commands/oxe/route.md +1 -1
- package/commands/oxe/scan.md +1 -1
- package/commands/oxe/security.md +1 -1
- package/commands/oxe/session.md +1 -1
- package/commands/oxe/ship.md +6 -6
- package/commands/oxe/skill.md +1 -1
- package/commands/oxe/spec.md +6 -3
- package/commands/oxe/ui-review.md +1 -1
- package/commands/oxe/ui-spec.md +1 -1
- package/commands/oxe/update.md +1 -1
- package/commands/oxe/validate-gaps.md +1 -1
- package/commands/oxe/verify-audit.md +1 -1
- package/commands/oxe/verify.md +1 -1
- package/commands/oxe/workflow-authoring.md +1 -1
- package/commands/oxe/workstream.md +1 -1
- package/docs/ADLC-COVERAGE.md +55 -0
- package/docs/CONTENT-MIGRATION-AUDIT.md +49 -49
- package/docs/HAPPY-PATH.md +106 -0
- package/docs/INCIDENT-PLAYBOOK.md +181 -181
- package/docs/INTEGRATION.md +182 -182
- package/docs/QUALITY-GATES.md +46 -46
- package/docs/RELEASE-READINESS.md +93 -87
- package/docs/ROLES.md +129 -129
- package/docs/RUNTIME-SMOKE-MATRIX.md +137 -137
- package/docs/TEAM-ADOPTION.md +153 -153
- package/docs/WALKTHROUGH.md +241 -241
- package/docs/adr/D-1-isolamento-read-only-e-sanitizacao-centralizada-de-env-vars.md +29 -0
- package/docs/adr/D-2-junction-segura-de-node-modules-condicionada-a-sha-256-de-pa.md +29 -0
- package/docs/adr/D-3-preflight-local-5s-impacto-estatico-e2e-e-leitura-explicita.md +29 -0
- package/docs/adr/D-4-governanca-de-release-unificada-retomada-idempotente-pos-rei.md +29 -0
- package/docs/adr/D-5-core-agnostico-vs-presets-declarativos-de-dominio.md +29 -0
- package/docs/adr/D-6-decomposicao-strangler-fig-de-oxe-cc-e-oxe-operational.md +29 -0
- package/docs/adr/D-7-paridade-pre-push-com-phase-gates-path-aware-json-compacto-e.md +28 -0
- package/docs/adr/D-F1F4-1-paridade-pre-push-compactacao-json-sync-version-pins-e-quali.md +44 -0
- package/docs/adr/README.md +19 -0
- package/docs/cli-errors.md +20 -0
- package/docs/oxespace-1.5/BACKLOG.md +2056 -273
- package/docs/oxespace-1.5/HANDOFF-1.21.2.md +140 -0
- package/docs/oxevoice/BACKLOG.md +244 -244
- package/lib/runtime/compiler/graph-compiler.d.ts +2 -0
- package/lib/runtime/compiler/graph-compiler.js +11 -2
- package/lib/runtime/delivery/promotion-pipeline.d.ts +1 -0
- package/lib/runtime/delivery/promotion-pipeline.js +53 -0
- package/lib/runtime/events/catalog.d.ts +1 -1
- package/lib/runtime/events/catalog.js +18 -0
- package/lib/runtime/executor/action-tool-map.d.ts +3 -1
- package/lib/runtime/executor/action-tool-map.js +4 -1
- package/lib/runtime/executor/adapters/antigravity-cli.d.ts +103 -0
- package/lib/runtime/executor/adapters/antigravity-cli.js +530 -0
- package/lib/runtime/executor/adapters/claude-cli.d.ts +29 -0
- package/lib/runtime/executor/adapters/claude-cli.js +92 -14
- package/lib/runtime/executor/adapters/grok-cli.d.ts +89 -0
- package/lib/runtime/executor/adapters/grok-cli.js +351 -0
- package/lib/runtime/executor/adapters/registry.d.ts +6 -1
- package/lib/runtime/executor/adapters/registry.js +22 -2
- package/lib/runtime/executor/adapters/types.d.ts +1 -1
- package/lib/runtime/executor/built-in-tools.d.ts +56 -0
- package/lib/runtime/executor/built-in-tools.js +219 -17
- package/lib/runtime/executor/index.d.ts +9 -2
- package/lib/runtime/executor/index.js +23 -1
- package/lib/runtime/executor/llm-task-executor.d.ts +76 -3
- package/lib/runtime/executor/llm-task-executor.js +514 -31
- package/lib/runtime/executor/node-context.d.ts +11 -0
- package/lib/runtime/executor/node-context.js +10 -0
- package/lib/runtime/executor/node-prompt-builder.js +2 -0
- package/lib/runtime/executor/quota-patterns.d.ts +7 -0
- package/lib/runtime/executor/quota-patterns.js +39 -0
- package/lib/runtime/executor/shell-argv.d.ts +11 -0
- package/lib/runtime/executor/shell-argv.js +89 -2
- package/lib/runtime/executor/stream-completion.d.ts +16 -0
- package/lib/runtime/executor/stream-completion.js +72 -4
- package/lib/runtime/index.d.ts +1 -1
- package/lib/runtime/index.js +3 -1
- package/lib/runtime/models/failure.d.ts +1 -1
- package/lib/runtime/models/run.d.ts +1 -1
- package/lib/runtime/program/program-model.d.ts +20 -2
- package/lib/runtime/program/program-model.js +73 -6
- package/lib/runtime/projection/projection-engine.d.ts +6 -0
- package/lib/runtime/projection/projection-engine.js +30 -2
- package/lib/runtime/reducers/run-state-reducer.js +43 -5
- package/lib/runtime/scheduler/run-journal.d.ts +8 -0
- package/lib/runtime/scheduler/scheduler.d.ts +211 -2
- package/lib/runtime/scheduler/scheduler.js +982 -98
- package/lib/runtime/verification/runner-timeout.d.ts +7 -0
- package/lib/runtime/verification/runner-timeout.js +17 -0
- package/lib/runtime/verification/test-report-parsers.d.ts +2 -1
- package/lib/runtime/verification/test-report-parsers.js +9 -1
- package/lib/runtime/verification/verification-compiler.d.ts +46 -2
- package/lib/runtime/verification/verification-compiler.js +335 -33
- package/lib/runtime/verification/verification-manifest.d.ts +2 -0
- package/lib/runtime/verification/verification-manifest.js +15 -1
- package/lib/runtime/workspace/index.d.ts +2 -1
- package/lib/runtime/workspace/index.js +3 -1
- package/lib/runtime/workspace/strategies/ephemeral-container.d.ts +9 -0
- package/lib/runtime/workspace/strategies/ephemeral-container.js +37 -10
- package/lib/runtime/workspace/strategies/git-worktree.d.ts +15 -1
- package/lib/runtime/workspace/strategies/git-worktree.js +53 -1
- package/lib/sdk/README.md +82 -82
- package/lib/sdk/index.cjs +828 -815
- package/lib/sdk/index.d.ts +982 -982
- package/lib/sdk/index.types.ts +933 -933
- package/oxe/agents/oxe-assumptions-analyzer.md +136 -136
- package/oxe/agents/oxe-codebase-mapper.md +142 -142
- package/oxe/agents/oxe-debugger.md +145 -145
- package/oxe/agents/oxe-executor.md +139 -139
- package/oxe/agents/oxe-integration-checker.md +142 -142
- package/oxe/agents/oxe-plan-checker.md +143 -143
- package/oxe/agents/oxe-planner.md +151 -151
- package/oxe/agents/oxe-research-synthesizer.md +146 -146
- package/oxe/agents/oxe-researcher.md +163 -163
- package/oxe/agents/oxe-ui-auditor.md +151 -151
- package/oxe/agents/oxe-ui-checker.md +157 -157
- package/oxe/agents/oxe-ui-researcher.md +179 -179
- package/oxe/agents/oxe-validation-auditor.md +154 -154
- package/oxe/agents/oxe-verifier.md +132 -132
- package/oxe/migrations/config-migrations.json +15 -0
- package/oxe/personas/README.md +91 -91
- package/oxe/personas/architect.md +149 -149
- package/oxe/personas/db-specialist.md +149 -149
- package/oxe/personas/debugger.md +155 -155
- package/oxe/personas/executor.md +164 -164
- package/oxe/personas/planner.md +165 -165
- package/oxe/personas/researcher.md +148 -148
- package/oxe/personas/ui-specialist.md +164 -164
- package/oxe/personas/verifier.md +174 -174
- package/oxe/schemas/plan.schema.json +101 -85
- package/oxe/schemas/role-plan.schema.json +50 -0
- package/oxe/schemas/swarm-run.schema.json +130 -130
- package/oxe/templates/CONFIG.md +290 -105
- package/oxe/templates/DISCUSS.template.md +45 -44
- package/oxe/templates/EXECUTION-RUNTIME.template.md +68 -68
- package/oxe/templates/FIXTURE-PACK.template.json +41 -41
- package/oxe/templates/FIXTURE-PACK.template.md +30 -30
- package/oxe/templates/GLOSSARY.template.md +9 -0
- package/oxe/templates/IMPLEMENTATION-PACK.template.json +68 -68
- package/oxe/templates/IMPLEMENTATION-PACK.template.md +48 -48
- package/oxe/templates/PLAN.template.md +151 -151
- package/oxe/templates/PLUGINS.md +108 -108
- package/oxe/templates/PRD.template.md +53 -0
- package/oxe/templates/REFERENCE-ANCHORS.template.md +39 -35
- package/oxe/templates/RESEARCH.template.md +65 -57
- package/oxe/templates/RFC.template.md +43 -0
- package/oxe/templates/SPEC.template.md +119 -119
- package/oxe/templates/STATE-REFERENCE.md +125 -125
- package/oxe/templates/STATE.md +30 -30
- package/oxe/templates/SUMMARY.template.md +50 -50
- package/oxe/templates/VISUAL-INPUTS.template.json +27 -27
- package/oxe/templates/VISUAL-INPUTS.template.md +36 -36
- package/oxe/templates/config.template.json +38 -38
- package/oxe/templates/finding-rules.json +22 -0
- package/oxe/templates/stress-methods.md +33 -0
- package/oxe/workflows/agent-mode.md +150 -150
- package/oxe/workflows/alm.md +50 -0
- package/oxe/workflows/compact/plan.md +149 -0
- package/oxe/workflows/compact/spec.md +114 -0
- package/oxe/workflows/compact.md +45 -44
- package/oxe/workflows/conduct.md +149 -149
- package/oxe/workflows/debug.md +43 -43
- package/oxe/workflows/discuss.md +98 -86
- package/oxe/workflows/distill.md +164 -164
- package/oxe/workflows/execute.md +273 -269
- package/oxe/workflows/forensics.md +53 -53
- package/oxe/workflows/help.md +364 -355
- package/oxe/workflows/lean/execute.md +43 -0
- package/oxe/workflows/lean/plan.md +60 -0
- package/oxe/workflows/lean/spec.md +61 -0
- package/oxe/workflows/memory.md +163 -163
- package/oxe/workflows/next.md +47 -45
- package/oxe/workflows/oxe.md +168 -150
- package/oxe/workflows/plan.md +563 -556
- package/oxe/workflows/quick.md +199 -185
- package/oxe/workflows/references/alm-refine.md +55 -0
- package/oxe/workflows/references/azure-in-plan.md +5 -0
- package/oxe/workflows/references/change-management.md +48 -0
- package/oxe/workflows/references/flow-robustness-contract.md +80 -80
- package/oxe/workflows/references/grill.md +74 -0
- package/oxe/workflows/references/next-step-footer.md +33 -0
- package/oxe/workflows/references/plan-json-acceptance-program.md +174 -143
- package/oxe/workflows/references/product-docs-alm.md +51 -0
- package/oxe/workflows/references/workflow-runtime-contracts.json +1167 -1151
- package/oxe/workflows/research.md +67 -66
- package/oxe/workflows/route.md +32 -32
- package/oxe/workflows/scan.md +356 -355
- package/oxe/workflows/ship.md +93 -142
- package/oxe/workflows/size-budget.json +62 -0
- package/oxe/workflows/spec.md +615 -619
- package/oxe/workflows/swarm/board.md +119 -119
- package/oxe/workflows/swarm/scout.md +170 -170
- package/oxe/workflows/swarm-mode.md +280 -280
- package/oxe/workflows/ui-review.md +37 -37
- package/oxe/workflows/ui-spec.md +32 -32
- package/oxe/workflows/verify.md +273 -255
- package/package.json +134 -132
- package/packages/runtime/package.json +18 -18
- package/packages/runtime/src/compiler/graph-compiler.ts +349 -336
- package/packages/runtime/src/context/context-pack-builder.ts +339 -339
- package/packages/runtime/src/delivery/promotion-pipeline.ts +397 -342
- package/packages/runtime/src/events/catalog.ts +63 -45
- package/packages/runtime/src/executor/action-tool-map.ts +52 -50
- package/packages/runtime/src/executor/adapters/antigravity-cli.ts +619 -0
- package/packages/runtime/src/executor/adapters/claude-cli.ts +367 -285
- package/packages/runtime/src/executor/adapters/grok-cli.ts +392 -0
- package/packages/runtime/src/executor/adapters/http-openai.ts +16 -16
- package/packages/runtime/src/executor/adapters/registry.ts +53 -33
- package/packages/runtime/src/executor/adapters/types.ts +24 -24
- package/packages/runtime/src/executor/built-in-tools.ts +525 -333
- package/packages/runtime/src/executor/index.ts +23 -16
- package/packages/runtime/src/executor/llm-task-executor.ts +854 -336
- package/packages/runtime/src/executor/node-context.ts +226 -210
- package/packages/runtime/src/executor/node-prompt-builder.ts +69 -67
- package/packages/runtime/src/executor/quota-patterns.ts +41 -0
- package/packages/runtime/src/executor/shell-argv.ts +144 -66
- package/packages/runtime/src/executor/stream-completion.ts +230 -160
- package/packages/runtime/src/index.ts +56 -54
- package/packages/runtime/src/models/failure.ts +22 -13
- package/packages/runtime/src/models/run.ts +25 -24
- package/packages/runtime/src/plugins/capability-adapter.ts +313 -313
- package/packages/runtime/src/plugins/plugin-abi.ts +106 -106
- package/packages/runtime/src/plugins/plugin-registry.ts +241 -241
- package/packages/runtime/src/program/index.ts +1 -1
- package/packages/runtime/src/program/program-model.ts +293 -233
- package/packages/runtime/src/projection/projection-engine.ts +386 -361
- package/packages/runtime/src/reducers/run-state-reducer.ts +365 -329
- package/packages/runtime/src/scheduler/multi-agent-coordinator.ts +1017 -1017
- package/packages/runtime/src/scheduler/run-journal.ts +107 -105
- package/packages/runtime/src/scheduler/scheduler.ts +2081 -1144
- package/packages/runtime/src/verification/contract-exports.ts +203 -203
- package/packages/runtime/src/verification/index.ts +3 -3
- package/packages/runtime/src/verification/runner-timeout.ts +17 -0
- package/packages/runtime/src/verification/test-report-parsers.ts +204 -198
- package/packages/runtime/src/verification/verification-compiler.ts +1074 -766
- package/packages/runtime/src/verification/verification-manifest.ts +296 -281
- package/packages/runtime/src/workspace/index.ts +6 -5
- package/packages/runtime/src/workspace/strategies/ephemeral-container.ts +159 -126
- package/packages/runtime/src/workspace/strategies/git-worktree.ts +190 -150
- package/packages/runtime/tsconfig.json +24 -23
- package/vscode-extension/.vscodeignore +9 -9
- package/vscode-extension/LICENSE +21 -21
- package/vscode-extension/package.json +193 -193
- package/vscode-extension/src/extension.js +320 -320
|
@@ -0,0 +1,1580 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* OXB-097: `oxe-cc plan build --from <role files…>` writes PLAN.json, PLAN.md and IMPLEMENTATION-PACK.json together.
|
|
5
|
+
* - covers `plan merge` (OXB-086) and then: waves also by file overlap (a hot file — written by two tasks of the same
|
|
6
|
+
* wave — serializes: the later task moves to the next wave), acceptance test files out of the task scopes;
|
|
7
|
+
* - pack symbols from the named imports of the frozen tests that resolve to a task's files, and from the role's
|
|
8
|
+
* `deleted` / `edited` / `created` paths; contracts from the symbols; the pack and PLAN.md carry the `phase`.
|
|
9
|
+
* OXB-098: `oxe-cc plan check-role <file> [--ref <git ref>]` — what the agents run BEFORE handing a plan to the TL:
|
|
10
|
+
* exact titles of `proves` in the frozen test files, prose × A ids, `deleted`/`edited` paths existing at the ref,
|
|
11
|
+
* `created` paths not existing there, the verify shape.
|
|
12
|
+
* OXB-106: declarative task kinds with their own pack rule — `add` (only created paths), `remove` (OXB-088:
|
|
13
|
+
* removed_paths, no symbols), `move` (`moves: [{from, to}]`), `test-only` (only test files, no product code),
|
|
14
|
+
* `config-only` (only config files, no symbols).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const fs = require('fs');
|
|
18
|
+
const path = require('path');
|
|
19
|
+
const { spawnSync } = require('child_process');
|
|
20
|
+
const merge = require('./oxe-plan-merge.cjs');
|
|
21
|
+
|
|
22
|
+
const TEST_FILE_RE = /(^|\/)(tests?|__tests__|spec|e2e)\/|\.(test|spec)\.[cm]?[jt]sx?$/i;
|
|
23
|
+
const NON_PROD_DIR_RE = /^(scripts|docs|roles|benchmarks|examples|fixtures|\.oxe|\.git|node_modules|dist|build|coverage)\//i;
|
|
24
|
+
const CONFIG_FILE_RE = /\.(json|ya?ml|toml|ini|env|cfg|conf|properties)$|(^|\/)\.[a-z]+rc(\.[a-z]+)?$|(^|\/)(Dockerfile|Makefile)$/i;
|
|
25
|
+
const CODE_RE = /\.(c|m)?[jt]sx?$|\.(py|go|rs|java|kt|kts|swift|rb|cs|cpp|c|h|php|scala|vue|svelte)$/i;
|
|
26
|
+
const RESOLVE_EXTS = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.mts', '.cts', '.vue', '.svelte'];
|
|
27
|
+
const KINDS = new Set(['add', 'remove', 'move', 'test-only', 'config-only']);
|
|
28
|
+
const norm = (p) => String(p).replace(/\\/g, '/').replace(/^\.\//, '');
|
|
29
|
+
const uniq = (xs) => [...new Set(xs.filter(Boolean))];
|
|
30
|
+
|
|
31
|
+
/** Product code: a code file that is not a test, a script, a doc or a generated folder. */
|
|
32
|
+
function isProductCode(file) {
|
|
33
|
+
const f = norm(file);
|
|
34
|
+
return CODE_RE.test(f) && !TEST_FILE_RE.test(f) && !NON_PROD_DIR_RE.test(f);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function inScope(file, scope) {
|
|
38
|
+
const f = norm(file);
|
|
39
|
+
for (const raw of scope || []) {
|
|
40
|
+
const s = norm(raw);
|
|
41
|
+
if (!s) continue;
|
|
42
|
+
if (/[*?[{]/.test(s)) {
|
|
43
|
+
const re = new RegExp(`^${s.replace(/[.+^$()|\\]/g, '\\$&').replace(/\*\*\/?/g, '\u0000').replace(/\*/g, '[^/]*').replace(/\?/g, '[^/]').replace(/\u0000/g, '.*')}$`);
|
|
44
|
+
if (re.test(f)) return true;
|
|
45
|
+
} else {
|
|
46
|
+
const clean = s.replace(/\/+$/, '');
|
|
47
|
+
if (f === clean || f.startsWith(`${clean}/`)) return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function isDirEntry(root, ref, entryPath) {
|
|
54
|
+
const raw = String(entryPath || '').trim();
|
|
55
|
+
if (raw.endsWith('/') || raw.endsWith('/**')) return true;
|
|
56
|
+
const cleaned = norm(raw).replace(/(\/\*\*|\/)+$/, '');
|
|
57
|
+
if (!cleaned) return false;
|
|
58
|
+
try {
|
|
59
|
+
const typeRes = spawnSync('git', ['cat-file', '-t', `${ref || 'HEAD'}:${cleaned}`], { cwd: root, encoding: 'utf8', windowsHide: true });
|
|
60
|
+
if (typeRes.status === 0 && typeRes.stdout.trim() === 'tree') return true;
|
|
61
|
+
} catch { /* check disk */ }
|
|
62
|
+
try {
|
|
63
|
+
const abs = path.resolve(root, cleaned);
|
|
64
|
+
return fs.existsSync(abs) && fs.statSync(abs).isDirectory();
|
|
65
|
+
} catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function expandDirEntry(root, ref, entryPath) {
|
|
71
|
+
const cleaned = norm(entryPath).replace(/(\/\*\*|\/)+$/, '');
|
|
72
|
+
const out = [];
|
|
73
|
+
try {
|
|
74
|
+
const gitRes = spawnSync('git', ['ls-tree', '-r', '--name-only', ref || 'HEAD', cleaned], { cwd: root, encoding: 'utf8', windowsHide: true });
|
|
75
|
+
if (gitRes.status === 0 && gitRes.stdout && gitRes.stdout.trim()) {
|
|
76
|
+
for (const line of gitRes.stdout.trim().split(/\r?\n/)) {
|
|
77
|
+
const p = norm(line);
|
|
78
|
+
if (p) out.push(p);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} catch { /* check disk */ }
|
|
82
|
+
if (!out.length) {
|
|
83
|
+
const abs = path.resolve(root, cleaned);
|
|
84
|
+
try {
|
|
85
|
+
if (fs.existsSync(abs) && fs.statSync(abs).isDirectory()) {
|
|
86
|
+
const walk = (d) => {
|
|
87
|
+
for (const ent of fs.readdirSync(d, { withFileTypes: true })) {
|
|
88
|
+
const full = path.join(d, ent.name);
|
|
89
|
+
if (ent.isDirectory()) walk(full);
|
|
90
|
+
else if (ent.isFile()) out.push(norm(path.relative(root, full)));
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
walk(abs);
|
|
94
|
+
}
|
|
95
|
+
} catch { /* ignore */ }
|
|
96
|
+
}
|
|
97
|
+
return uniq(out);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function filterDeletedFromVerifyCommand(cmd, deletedSet) {
|
|
101
|
+
if (!cmd || typeof cmd !== 'string') return null;
|
|
102
|
+
const segments = cmd.split(/\s+&&\s+/);
|
|
103
|
+
const keptSegments = [];
|
|
104
|
+
for (const seg of segments) {
|
|
105
|
+
const tokens = seg.split(/\s+/);
|
|
106
|
+
const matchingDeleted = tokens.filter((tok) => {
|
|
107
|
+
const cleanTok = norm(tok.replace(/^["']|["']$/g, ''));
|
|
108
|
+
return deletedSet.has(cleanTok);
|
|
109
|
+
});
|
|
110
|
+
if (!matchingDeleted.length) {
|
|
111
|
+
keptSegments.push(seg);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const remainingTokens = tokens.filter((tok) => {
|
|
115
|
+
const cleanTok = norm(tok.replace(/^["']|["']$/g, ''));
|
|
116
|
+
return !deletedSet.has(cleanTok);
|
|
117
|
+
});
|
|
118
|
+
const hasRemainingTestFile = remainingTokens.some((tok) => TEST_FILE_RE.test(norm(tok.replace(/^["']|["']$/g, ''))));
|
|
119
|
+
if (hasRemainingTestFile) {
|
|
120
|
+
keptSegments.push(remainingTokens.join(' '));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return keptSegments.length ? keptSegments.join(' && ') : null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function transitiveDeletedForTask(task, allTasksById, roleByKey) {
|
|
127
|
+
const deleted = new Set();
|
|
128
|
+
const visited = new Set();
|
|
129
|
+
const queue = [task.id];
|
|
130
|
+
while (queue.length) {
|
|
131
|
+
const curId = queue.shift();
|
|
132
|
+
if (visited.has(curId)) continue;
|
|
133
|
+
visited.add(curId);
|
|
134
|
+
const curTask = allTasksById.get(curId);
|
|
135
|
+
const r = roleByKey.get(String(curTask && curTask.rid ? curTask.rid : curId)) || {};
|
|
136
|
+
for (const p of r.deleted || []) deleted.add(norm(p));
|
|
137
|
+
if (curTask && Array.isArray(curTask.removed_paths)) {
|
|
138
|
+
for (const p of curTask.removed_paths) deleted.add(norm(p));
|
|
139
|
+
}
|
|
140
|
+
const deps = curTask ? (curTask.depends_on || curTask.dependsOn || []) : [];
|
|
141
|
+
for (const d of deps) queue.push(d);
|
|
142
|
+
}
|
|
143
|
+
return deleted;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const OFFER_AUDIT_FILE = 'e2e/offer-audit.spec.ts';
|
|
147
|
+
const OFFER_AUDIT_TRIGGERS = [
|
|
148
|
+
'src/components/Navigation/appMenus.ts',
|
|
149
|
+
'src/components/Settings/SettingsModal.tsx',
|
|
150
|
+
];
|
|
151
|
+
const DESIGN_LINT_TESTS = [
|
|
152
|
+
'tests/design-lint.test.ts',
|
|
153
|
+
'tests/design-lint-target-size.test.ts',
|
|
154
|
+
];
|
|
155
|
+
|
|
156
|
+
function hasRepoFile(root, ref, relPath) {
|
|
157
|
+
if (!root) return false;
|
|
158
|
+
const clean = norm(relPath);
|
|
159
|
+
try {
|
|
160
|
+
if (fs.existsSync(path.join(root, clean))) return true;
|
|
161
|
+
} catch { /* check git */ }
|
|
162
|
+
try {
|
|
163
|
+
return spawnSync('git', ['cat-file', '-e', `${ref || 'HEAD'}:${clean}`], { cwd: root, windowsHide: true }).status === 0;
|
|
164
|
+
} catch {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function loadCoupledScope(root, options = {}) {
|
|
170
|
+
let explicit = [];
|
|
171
|
+
let builtinDisabled = options.builtinCoupledScope === false;
|
|
172
|
+
if (Array.isArray(options.coupledScope)) {
|
|
173
|
+
explicit = options.coupledScope;
|
|
174
|
+
} else if (root) {
|
|
175
|
+
try {
|
|
176
|
+
const cfgPath = path.join(root, '.oxe', 'config.json');
|
|
177
|
+
if (fs.existsSync(cfgPath)) {
|
|
178
|
+
const cfg = JSON.parse(fs.readFileSync(cfgPath, 'utf8'));
|
|
179
|
+
if (Array.isArray(cfg.coupled_scope)) explicit = cfg.coupled_scope;
|
|
180
|
+
if (cfg.builtin_coupled_scope === false || cfg.coupled_scope === false) builtinDisabled = true;
|
|
181
|
+
}
|
|
182
|
+
} catch { /* ignore */ }
|
|
183
|
+
}
|
|
184
|
+
const rules = [...explicit];
|
|
185
|
+
if (!builtinDisabled && root && (options.includeOfferAudit === true || hasRepoFile(root, options.ref || 'HEAD', OFFER_AUDIT_FILE))) {
|
|
186
|
+
const alreadyCoversOfferAudit = rules.some((r) => {
|
|
187
|
+
const inc = Array.isArray(r && r.include) ? r.include : (r && r.include ? [r.include] : []);
|
|
188
|
+
return inc.map(norm).includes(OFFER_AUDIT_FILE);
|
|
189
|
+
});
|
|
190
|
+
if (!alreadyCoversOfferAudit) {
|
|
191
|
+
rules.push({
|
|
192
|
+
when: OFFER_AUDIT_TRIGGERS,
|
|
193
|
+
include: [OFFER_AUDIT_FILE],
|
|
194
|
+
note: 'confira MENU_EFFECTS em e2e/offer-audit.spec.ts ao editar appMenus.ts ou SettingsModal.tsx',
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return rules;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function matchedCoupledRules(coupledRules, changes) {
|
|
202
|
+
const toInclude = [];
|
|
203
|
+
const matchedRules = [];
|
|
204
|
+
const files = changes.files || [];
|
|
205
|
+
const created = changes.created || [];
|
|
206
|
+
const edited = changes.edited || [];
|
|
207
|
+
const deleted = changes.deleted || [];
|
|
208
|
+
const allChanges = [...files, ...created, ...edited, ...deleted];
|
|
209
|
+
for (const rule of coupledRules || []) {
|
|
210
|
+
if (!rule || typeof rule !== 'object') continue;
|
|
211
|
+
const when = rule.when ? (Array.isArray(rule.when) ? rule.when : [rule.when]) : [];
|
|
212
|
+
const whenDeleted = rule.when_deleted ? (Array.isArray(rule.when_deleted) ? rule.when_deleted : [rule.when_deleted]) : [];
|
|
213
|
+
const whenEdited = rule.when_edited ? (Array.isArray(rule.when_edited) ? rule.when_edited : [rule.when_edited]) : [];
|
|
214
|
+
const whenCreated = rule.when_created ? (Array.isArray(rule.when_created) ? rule.when_created : [rule.when_created]) : [];
|
|
215
|
+
|
|
216
|
+
const matchWhen = when.some((w) => allChanges.some((p) => inScope(p, [w])));
|
|
217
|
+
const matchDeleted = whenDeleted.some((w) => deleted.some((p) => inScope(p, [w])));
|
|
218
|
+
const matchEdited = whenEdited.some((w) => edited.some((p) => inScope(p, [w])));
|
|
219
|
+
const matchCreated = whenCreated.some((w) => created.some((p) => inScope(p, [w])));
|
|
220
|
+
|
|
221
|
+
if (matchWhen || matchDeleted || matchEdited || matchCreated) {
|
|
222
|
+
const inc = Array.isArray(rule.include) ? rule.include : (rule.include ? [rule.include] : []);
|
|
223
|
+
toInclude.push(...inc.map(norm));
|
|
224
|
+
matchedRules.push(rule);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return { included: uniq(toInclude), matchedRules };
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function applyCoupledScope(coupledRules, changes) {
|
|
231
|
+
return matchedCoupledRules(coupledRules, changes).included;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Named imports of a test file that resolve to one of `files`: [{ name, path }]. */
|
|
235
|
+
function importedSymbols(root, testFile, files) {
|
|
236
|
+
let text = '';
|
|
237
|
+
try { text = fs.readFileSync(path.join(root, testFile), 'utf8'); } catch { return []; }
|
|
238
|
+
const out = [];
|
|
239
|
+
const dir = path.posix.dirname(norm(testFile));
|
|
240
|
+
const resolve = (spec) => {
|
|
241
|
+
if (!spec.startsWith('.')) return null;
|
|
242
|
+
const base = path.posix.normalize(path.posix.join(dir, spec));
|
|
243
|
+
return files.find((f) => { const n = norm(f); return n === base || n.replace(/\.[^.]+$/, '') === base || n.replace(/\/index\.[^.]+$/, '') === base; }) || null;
|
|
244
|
+
};
|
|
245
|
+
for (const m of text.matchAll(/import\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/g)) {
|
|
246
|
+
const file = resolve(m[2]);
|
|
247
|
+
if (file) for (const n of m[1].split(',').map((x) => x.trim().split(/\s+as\s+/)[0].trim()).filter(Boolean)) out.push({ name: n, path: norm(file) });
|
|
248
|
+
}
|
|
249
|
+
for (const m of text.matchAll(/const\s*\{([^}]+)\}\s*=\s*require\(\s*['"]([^'"]+)['"]\s*\)/g)) {
|
|
250
|
+
const file = resolve(m[2]);
|
|
251
|
+
if (file) for (const n of m[1].split(',').map((x) => x.trim().split(':')[0].trim()).filter(Boolean)) out.push({ name: n, path: norm(file) });
|
|
252
|
+
}
|
|
253
|
+
// OXB-222-06 / OXB-222-11: infer CJS namespace require() member accesses (`const mod = require('./a.cjs'); mod.fn()`)
|
|
254
|
+
// Strip comments and string literals before scanning member accesses so e.g. `'.../oxe-alm-refine.cjs'` never matches `refine.cjs`.
|
|
255
|
+
const codeOnly = text
|
|
256
|
+
.replace(/\/\*[\s\S]*?\*\//g, ' ')
|
|
257
|
+
.replace(/\/\/[^\r\n]*/g, ' ')
|
|
258
|
+
.replace(/(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/g, ' ');
|
|
259
|
+
const BUILTIN_PROPS = new Set(['prototype', 'constructor', 'toString', 'valueOf', 'hasOwnProperty', 'keys', 'values', 'entries', 'length', 'cjs', 'mjs', 'js', 'ts', 'json', 'md']);
|
|
260
|
+
for (const m of text.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*require\(\s*['"]([^'"]+)['"]\s*\)/g)) {
|
|
261
|
+
const alias = m[1];
|
|
262
|
+
const file = resolve(m[2]);
|
|
263
|
+
if (!file) continue;
|
|
264
|
+
const accessRe = new RegExp(`(?<![A-Za-z0-9_$-])${alias.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\.([A-Za-z_$][\\w$]*)\\b`, 'g');
|
|
265
|
+
for (const am of codeOnly.matchAll(accessRe)) {
|
|
266
|
+
if (am[1] && !BUILTIN_PROPS.has(am[1])) out.push({ name: am[1], path: norm(file) });
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return out;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** Waves by dependency AND by file overlap: a task never shares a written file with another task of its wave. */
|
|
273
|
+
function assignWaves(tasks) {
|
|
274
|
+
const byId = new Map(tasks.map((t) => [t.id, t]));
|
|
275
|
+
const waveFiles = new Map();
|
|
276
|
+
const wave = new Map();
|
|
277
|
+
for (const t of tasks) {
|
|
278
|
+
let w = Math.max(1, ...(t.depends_on || []).map((d) => (wave.get(d) || 0) + 1));
|
|
279
|
+
const files = (t.files || []).map(norm);
|
|
280
|
+
while ((waveFiles.get(w) || new Set()) && files.some((f) => (waveFiles.get(w) || new Set()).has(f))) w += 1;
|
|
281
|
+
wave.set(t.id, w);
|
|
282
|
+
if (!waveFiles.has(w)) waveFiles.set(w, new Set());
|
|
283
|
+
for (const f of files) waveFiles.get(w).add(f);
|
|
284
|
+
}
|
|
285
|
+
for (const t of tasks) t.wave = wave.get(t.id);
|
|
286
|
+
// dependents of a task moved later must stay after it
|
|
287
|
+
let changed = true;
|
|
288
|
+
while (changed) {
|
|
289
|
+
changed = false;
|
|
290
|
+
for (const t of tasks) for (const d of t.depends_on || []) if (byId.has(d) && t.wave <= byId.get(d).wave) { t.wave = byId.get(d).wave + 1; changed = true; }
|
|
291
|
+
}
|
|
292
|
+
return tasks;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** Pack entry by kind (OXB-106). */
|
|
296
|
+
function packEntry(root, task, role, frozenFiles, frozenTests) {
|
|
297
|
+
const kind = task.kind && KINDS.has(task.kind) ? task.kind : null;
|
|
298
|
+
const deleted = uniq((role.deleted || []).map(norm));
|
|
299
|
+
const created = uniq((role.created || []).map(norm));
|
|
300
|
+
const edited = uniq((role.edited || []).map(norm));
|
|
301
|
+
const swept = uniq((role.swept || []).map(norm)).filter((f) => !frozenFiles.has(f));
|
|
302
|
+
const moves = Array.isArray(role.moves) ? role.moves.map((m) => ({ from: norm(m.from), to: norm(m.to) })) : [];
|
|
303
|
+
const exact = uniq([...(task.files || []).map(norm), ...deleted, ...created, ...edited, ...moves.flatMap((m) => [m.from, m.to])]).filter((f) => !frozenFiles.has(f));
|
|
304
|
+
const symbols = [];
|
|
305
|
+
const pushSymbol = (s) => {
|
|
306
|
+
if (!s || typeof s !== 'object' || !s.name || !s.path) return;
|
|
307
|
+
const entrySym = { ...(s.kind ? { kind: String(s.kind) } : {}), name: String(s.name), path: norm(s.path) };
|
|
308
|
+
if (!symbols.some((x) => x.name === entrySym.name && x.path === entrySym.path)) symbols.push(entrySym);
|
|
309
|
+
};
|
|
310
|
+
for (const t of frozenTests) for (const s of importedSymbols(root, t, exact)) pushSymbol(s);
|
|
311
|
+
// OXB-222-06: preserve explicit symbols declared on tasks in role.json
|
|
312
|
+
for (const s of Array.isArray(task.symbols) ? task.symbols : []) pushSymbol(s);
|
|
313
|
+
for (const rt of Array.isArray(role.rawTasks) ? role.rawTasks : []) {
|
|
314
|
+
for (const s of Array.isArray(rt && rt.symbols) ? rt.symbols : []) pushSymbol(s);
|
|
315
|
+
}
|
|
316
|
+
const editedClean = edited.filter((f) => !frozenFiles.has(f));
|
|
317
|
+
const symbolsRemoved = [];
|
|
318
|
+
for (const rt of Array.isArray(role.rawTasks) ? role.rawTasks : []) {
|
|
319
|
+
for (const sr of Array.isArray(rt.symbols_removed) ? rt.symbols_removed : []) {
|
|
320
|
+
if (sr && typeof sr === 'object' && sr.name && sr.path) {
|
|
321
|
+
const entrySr = { name: String(sr.name), path: norm(sr.path) };
|
|
322
|
+
if (!symbolsRemoved.some((x) => x.name === entrySr.name && x.path === entrySr.path)) symbolsRemoved.push(entrySr);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const entry = {
|
|
327
|
+
id: task.id,
|
|
328
|
+
mode: 'mutating',
|
|
329
|
+
write_set: 'closed',
|
|
330
|
+
exact_paths: exact,
|
|
331
|
+
...(editedClean.length ? { edited_paths: editedClean } : {}),
|
|
332
|
+
...(swept.length ? { swept_paths: swept } : {}),
|
|
333
|
+
...(symbolsRemoved.length ? { symbols_removed: symbolsRemoved } : {}),
|
|
334
|
+
symbols,
|
|
335
|
+
contracts: [],
|
|
336
|
+
expected_checks: (task.verify && task.verify.commands) || [],
|
|
337
|
+
...(task.phase ? { phase: task.phase } : {}),
|
|
338
|
+
};
|
|
339
|
+
for (const s of symbols) entry.contracts.push(`${s.name} exportado de ${s.path}`);
|
|
340
|
+
if (kind === 'remove' || deleted.length) { entry.removed_paths = uniq([...deleted, ...moves.map((m) => m.from)]); for (const p of entry.removed_paths) entry.contracts.push(`${p} não existe mais`); }
|
|
341
|
+
if (kind === 'move') for (const m of moves) { entry.removed_paths = uniq([...(entry.removed_paths || []), m.from]); entry.contracts.push(`${m.from} movido para ${m.to}`); }
|
|
342
|
+
if (kind === 'add') for (const p of created) entry.contracts.push(`${p} criado`);
|
|
343
|
+
if (kind === 'test-only') entry.contracts.push('só arquivos de teste: nenhum código de produto muda');
|
|
344
|
+
if (kind === 'config-only') entry.contracts.push('só configuração: nenhum código muda');
|
|
345
|
+
if (!entry.contracts.length && edited.length) for (const p of edited) entry.contracts.push(`${p} editado no escopo da tarefa`);
|
|
346
|
+
if (!entry.contracts.length) entry.contracts.push(`escopo fechado: ${exact.slice(0, 4).join(', ')}`);
|
|
347
|
+
return { entry, kind, created, deleted, moves, exact };
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/** OXB-106: the kind rule — errors when the scope does not fit the declared kind. */
|
|
351
|
+
function kindErrors(task, info) {
|
|
352
|
+
const errs = [];
|
|
353
|
+
const f = info.exact;
|
|
354
|
+
if (info.kind === 'test-only' && f.some((p) => !TEST_FILE_RE.test(p))) errs.push(`${task.id} (test-only): ${f.filter((p) => !TEST_FILE_RE.test(p)).join(', ')} não é arquivo de teste`);
|
|
355
|
+
if (info.kind === 'config-only' && f.some((p) => !CONFIG_FILE_RE.test(p))) errs.push(`${task.id} (config-only): ${f.filter((p) => !CONFIG_FILE_RE.test(p)).join(', ')} não é configuração`);
|
|
356
|
+
if (info.kind === 'add' && info.deleted.length) errs.push(`${task.id} (add): declara deleted (${info.deleted.join(', ')}) — use remove ou move`);
|
|
357
|
+
if (info.kind === 'move' && !info.moves.length) errs.push(`${task.id} (move): declare moves: [{ from, to }]`);
|
|
358
|
+
if (info.kind === 'remove' && !info.deleted.length && !(task.files || []).length) errs.push(`${task.id} (remove): declare deleted (os caminhos que deixam de existir)`);
|
|
359
|
+
return errs;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function renderPlanMd(plan, phase) {
|
|
363
|
+
const lines = [`# PLAN${phase ? ` — ${phase}` : ''}`, '', `> Gerado por \`oxe-cc plan build\` a partir de ${plan.merged_from.join(', ')}. A fonte é o PLAN.json; este arquivo é a leitura humana.`, ''];
|
|
364
|
+
const waves = [...new Set(plan.tasks.map((t) => t.wave))].sort((a, b) => a - b);
|
|
365
|
+
for (const w of waves) {
|
|
366
|
+
lines.push(`## Onda ${w}`, '');
|
|
367
|
+
for (const t of plan.tasks.filter((x) => x.wave === w)) {
|
|
368
|
+
lines.push(
|
|
369
|
+
`### ${t.id} — ${t.title}`,
|
|
370
|
+
'',
|
|
371
|
+
`- **Arquivos prováveis:** ${(t.files || []).map((f) => `\`${f}\``).join(', ') || '—'}`,
|
|
372
|
+
`- **Depende de:** ${(t.depends_on || []).join(', ') || '—'}`,
|
|
373
|
+
`- **Onda:** ${t.wave}`,
|
|
374
|
+
...(t.kind ? [`- **Tipo:** ${t.kind}`] : []),
|
|
375
|
+
...(t.notes && String(t.notes).trim() ? [`- **Notas:** ${String(t.notes).trim().replace(/\r?\n/g, ' · ')}`] : []),
|
|
376
|
+
'- **Verificar:**',
|
|
377
|
+
` - Comando: ${((t.verify && t.verify.commands) || []).map((c) => `\`${c}\``).join(' · ') || '—'}`,
|
|
378
|
+
`- **Aceite vinculado:** ${(t.acceptance || []).join(', ') || '—'}`,
|
|
379
|
+
'',
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return lines.join('\n');
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/** inputs: [{ file, doc }]; ctx: { root, phase, coupledScope, autoCloseImports }. */
|
|
387
|
+
function listProductionCodeFiles(root, ref = 'HEAD') {
|
|
388
|
+
const files = [];
|
|
389
|
+
try {
|
|
390
|
+
const gitRes = spawnSync('git', ['ls-tree', '-r', '--name-only', ref || 'HEAD'], { cwd: root, encoding: 'utf8', windowsHide: true });
|
|
391
|
+
if (gitRes.status === 0 && gitRes.stdout && gitRes.stdout.trim()) {
|
|
392
|
+
for (const line of gitRes.stdout.trim().split(/\r?\n/)) {
|
|
393
|
+
const p = norm(line);
|
|
394
|
+
if (p && CODE_RE.test(p) && !TEST_FILE_RE.test(p) && !NON_PROD_DIR_RE.test(p)) files.push(p);
|
|
395
|
+
}
|
|
396
|
+
return uniq(files);
|
|
397
|
+
}
|
|
398
|
+
} catch { /* fallback to disk */ }
|
|
399
|
+
const walk = (dir) => {
|
|
400
|
+
let entries = [];
|
|
401
|
+
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
402
|
+
for (const ent of entries) {
|
|
403
|
+
if (ent.name === 'node_modules' || ent.name === '.git' || ent.name === '.oxe') continue;
|
|
404
|
+
const full = path.join(dir, ent.name);
|
|
405
|
+
const rel = norm(path.relative(root, full));
|
|
406
|
+
if (ent.isDirectory()) {
|
|
407
|
+
if (!NON_PROD_DIR_RE.test(`${rel}/`)) walk(full);
|
|
408
|
+
} else if (ent.isFile() && CODE_RE.test(rel) && !TEST_FILE_RE.test(rel) && !NON_PROD_DIR_RE.test(rel)) {
|
|
409
|
+
files.push(rel);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
walk(root);
|
|
414
|
+
return uniq(files);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function readRepoText(root, ref, relPath) {
|
|
418
|
+
const clean = norm(relPath);
|
|
419
|
+
if (!ref || ref === 'HEAD') {
|
|
420
|
+
try {
|
|
421
|
+
const abs = path.join(root, clean);
|
|
422
|
+
if (fs.existsSync(abs) && fs.statSync(abs).isFile()) return fs.readFileSync(abs, 'utf8');
|
|
423
|
+
} catch { /* try git */ }
|
|
424
|
+
}
|
|
425
|
+
try {
|
|
426
|
+
const res = spawnSync('git', ['show', `${ref || 'HEAD'}:${clean}`], { cwd: root, encoding: 'utf8', windowsHide: true });
|
|
427
|
+
if (res.status === 0 && typeof res.stdout === 'string') return res.stdout;
|
|
428
|
+
} catch { /* ignore */ }
|
|
429
|
+
try {
|
|
430
|
+
return fs.readFileSync(path.join(root, clean), 'utf8');
|
|
431
|
+
} catch {
|
|
432
|
+
return '';
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function loadPathAliases(root) {
|
|
437
|
+
const aliases = [
|
|
438
|
+
{ prefix: '@shared/', target: 'shared/' },
|
|
439
|
+
{ prefix: '@electron/', target: 'electron/' },
|
|
440
|
+
{ prefix: '@renderer/', target: 'src/' },
|
|
441
|
+
{ prefix: '@/', target: 'src/' },
|
|
442
|
+
{ prefix: '~/', target: 'src/' },
|
|
443
|
+
];
|
|
444
|
+
try {
|
|
445
|
+
const tsPath = path.join(root, 'tsconfig.json');
|
|
446
|
+
if (fs.existsSync(tsPath)) {
|
|
447
|
+
const raw = fs.readFileSync(tsPath, 'utf8').replace(/^\s*\/\/.*$/gm, '');
|
|
448
|
+
const parsed = JSON.parse(raw);
|
|
449
|
+
const pathsObj = parsed && parsed.compilerOptions && parsed.compilerOptions.paths;
|
|
450
|
+
if (pathsObj && typeof pathsObj === 'object') {
|
|
451
|
+
const baseUrl = norm((parsed.compilerOptions && parsed.compilerOptions.baseUrl) || '');
|
|
452
|
+
for (const [k, vals] of Object.entries(pathsObj)) {
|
|
453
|
+
if (!Array.isArray(vals) || !vals.length) continue;
|
|
454
|
+
const pref = String(k).replace(/\*$/, '');
|
|
455
|
+
const tgtRaw = norm(String(vals[0]).replace(/\*$/, ''));
|
|
456
|
+
const tgt = baseUrl && baseUrl !== '.' ? norm(path.posix.join(baseUrl, tgtRaw)) : tgtRaw;
|
|
457
|
+
if (pref && !aliases.some((a) => a.prefix === pref)) {
|
|
458
|
+
aliases.unshift({ prefix: pref, target: tgt });
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
} catch { /* ignore non-strict jsonc tsconfig */ }
|
|
464
|
+
return aliases;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function resolveModuleSpecifier(importerFile, specifier, knownFilesSet, aliases = []) {
|
|
468
|
+
const spec = String(specifier || '').trim();
|
|
469
|
+
if (!spec) return null;
|
|
470
|
+
const bases = [];
|
|
471
|
+
if (spec.startsWith('.')) {
|
|
472
|
+
bases.push(norm(path.posix.normalize(path.posix.join(path.posix.dirname(norm(importerFile)), spec))));
|
|
473
|
+
} else {
|
|
474
|
+
for (const a of aliases) {
|
|
475
|
+
if (spec.startsWith(a.prefix)) {
|
|
476
|
+
bases.push(norm(path.posix.normalize(a.target + spec.slice(a.prefix.length))));
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
if (/^(src|electron|shared|resources)\//.test(spec)) {
|
|
480
|
+
bases.push(norm(spec));
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
for (const rawBase of bases) {
|
|
484
|
+
const strippedJs = rawBase.replace(/\.(?:[cm]?js|jsx)$/i, '');
|
|
485
|
+
const candidates = uniq([rawBase, strippedJs]);
|
|
486
|
+
for (const b of candidates) {
|
|
487
|
+
if (knownFilesSet.has(b)) return b;
|
|
488
|
+
for (const ext of RESOLVE_EXTS) {
|
|
489
|
+
if (knownFilesSet.has(`${b}${ext}`)) return `${b}${ext}`;
|
|
490
|
+
}
|
|
491
|
+
for (const ext of RESOLVE_EXTS) {
|
|
492
|
+
if (knownFilesSet.has(`${b}/index${ext}`)) return `${b}/index${ext}`;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return null;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function parseNamedClause(clause) {
|
|
500
|
+
const names = [];
|
|
501
|
+
let wildcard = /\*\s+as\s+[A-Za-z_$][\w$]*/.test(clause);
|
|
502
|
+
const braceMatch = clause.match(/\{([^}]+)\}/);
|
|
503
|
+
if (braceMatch) {
|
|
504
|
+
for (const part of braceMatch[1].split(',')) {
|
|
505
|
+
const cleaned = part.replace(/^\s*type\s+/, '').trim();
|
|
506
|
+
if (!cleaned) continue;
|
|
507
|
+
const orig = cleaned.split(/\s+as\s+/)[0].trim();
|
|
508
|
+
if (orig) names.push(orig);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
const beforeBrace = clause.replace(/\{[^}]*\}/g, '').replace(/^\s*type\s+/, '').replace(/,/g, ' ').trim();
|
|
512
|
+
if (beforeBrace && !beforeBrace.startsWith('*')) {
|
|
513
|
+
const defName = beforeBrace.split(/\s+/)[0].trim();
|
|
514
|
+
if (defName) names.push('default');
|
|
515
|
+
}
|
|
516
|
+
if (clause.trim() === '*') wildcard = true;
|
|
517
|
+
return { names: uniq(names), wildcard };
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
function extractModuleImports(text) {
|
|
521
|
+
const out = [];
|
|
522
|
+
const src = String(text || '');
|
|
523
|
+
// import ... from 'spec' and export ... from 'spec'
|
|
524
|
+
for (const m of src.matchAll(/\b(?:import|export)\s+([\s\S]*?)\s+from\s*['"]([^'"]+)['"]/g)) {
|
|
525
|
+
const parsed = parseNamedClause(m[1]);
|
|
526
|
+
out.push({ specifier: m[2], names: parsed.names, wildcard: parsed.wildcard, isReExport: m[0].startsWith('export') });
|
|
527
|
+
}
|
|
528
|
+
// side-effect import 'spec'
|
|
529
|
+
for (const m of src.matchAll(/\bimport\s*['"]([^'"]+)['"]/g)) {
|
|
530
|
+
out.push({ specifier: m[1], names: [], wildcard: false, isReExport: false });
|
|
531
|
+
}
|
|
532
|
+
// dynamic import('spec') and require('spec')
|
|
533
|
+
for (const m of src.matchAll(/\b(?:import|require)\s*\(\s*['"]([^'"]+)['"]\s*\)/g)) {
|
|
534
|
+
out.push({ specifier: m[1], names: [], wildcard: true, isReExport: false });
|
|
535
|
+
}
|
|
536
|
+
// vitest / jest module mocks: vi.mock('spec'), vi.importActual('spec'), jest.mock('spec')
|
|
537
|
+
for (const m of src.matchAll(/\b(?:vi|jest)\.(?:mock|doMock|importActual|requireActual)\s*\(\s*['"]([^'"]+)['"]/g)) {
|
|
538
|
+
out.push({ specifier: m[1], names: [], wildcard: true, isReExport: false });
|
|
539
|
+
}
|
|
540
|
+
return out;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function extractExportedUnions(text) {
|
|
544
|
+
const unions = [];
|
|
545
|
+
const src = String(text || '');
|
|
546
|
+
// export type Foo = 'a' | 'b' (single or multi-line up to `;` or next `export`/`type`/`interface`/`const`/`function`)
|
|
547
|
+
for (const m of src.matchAll(/\bexport\s+type\s+([A-Z][A-Za-z0-9_]*)\s*=\s*([^;]+?)(?:;|\n(?=\s*(?:export|type|interface|const|let|var|function|class|\/\*\*)\b)|$)/g)) {
|
|
548
|
+
if (m[2] && m[2].includes('|')) unions.push(m[1]);
|
|
549
|
+
}
|
|
550
|
+
for (const m of src.matchAll(/\bexport\s+(?:const\s+)?enum\s+([A-Z][A-Za-z0-9_]*)\b/g)) {
|
|
551
|
+
unions.push(m[1]);
|
|
552
|
+
}
|
|
553
|
+
return uniq(unions);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function extractExhaustiveRecordKeys(text) {
|
|
557
|
+
const keys = [];
|
|
558
|
+
const src = String(text || '');
|
|
559
|
+
for (const m of src.matchAll(/\b(Partial\s*<\s*)?Record\s*<\s*(?:Readonly\s*<\s*)?([A-Z][A-Za-z0-9_]*)\b/g)) {
|
|
560
|
+
if (!m[1]) keys.push(m[2]);
|
|
561
|
+
}
|
|
562
|
+
for (const m of src.matchAll(/\[\s*[A-Za-z_$][\w$]*\s+in\s+([A-Z][A-Za-z0-9_]*)\s*\](?!\s*\?)/g)) {
|
|
563
|
+
keys.push(m[1]);
|
|
564
|
+
}
|
|
565
|
+
return uniq(keys);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
function buildImportIndex(root, ref = 'HEAD') {
|
|
569
|
+
const files = listProductionCodeFiles(root, ref);
|
|
570
|
+
const known = new Set(files);
|
|
571
|
+
const aliases = loadPathAliases(root);
|
|
572
|
+
const byFile = new Map();
|
|
573
|
+
for (const f of files) {
|
|
574
|
+
const text = readRepoText(root, ref, f);
|
|
575
|
+
const rawImports = extractModuleImports(text);
|
|
576
|
+
const resolvedImports = [];
|
|
577
|
+
for (const imp of rawImports) {
|
|
578
|
+
const target = resolveModuleSpecifier(f, imp.specifier, known, aliases);
|
|
579
|
+
if (target) resolvedImports.push({ ...imp, target });
|
|
580
|
+
}
|
|
581
|
+
byFile.set(f, {
|
|
582
|
+
file: f,
|
|
583
|
+
text,
|
|
584
|
+
imports: resolvedImports,
|
|
585
|
+
exportedUnions: extractExportedUnions(text),
|
|
586
|
+
exhaustiveRecordKeys: extractExhaustiveRecordKeys(text),
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
return { files, known, byFile };
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/** OXB-199: 1-hop reverse importers in production code for newly deleted paths. */
|
|
593
|
+
function findOrphanImporters(index, newlyDeletedPaths, declaredScope = [], alreadyDeletedSet = new Set()) {
|
|
594
|
+
const targetSet = new Set((newlyDeletedPaths || []).map(norm).filter((p) => p && !alreadyDeletedSet.has(p)));
|
|
595
|
+
if (!targetSet.size) return [];
|
|
596
|
+
const orphans = [];
|
|
597
|
+
for (const [file, info] of index.byFile.entries()) {
|
|
598
|
+
if (alreadyDeletedSet.has(file) || targetSet.has(file)) continue;
|
|
599
|
+
if (inScope(file, declaredScope)) continue;
|
|
600
|
+
if (info.imports.some((imp) => targetSet.has(imp.target))) {
|
|
601
|
+
orphans.push(file);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
return orphans.sort();
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* OXB-198: When a removal task edits a file exporting a union type/enum (e.g. `AppView` in `keybindings.ts`),
|
|
609
|
+
* find production files that import that union type (directly or via 1-hop barrel re-export) and use it as an
|
|
610
|
+
* exhaustive `Record<UnionType, ...>` or `[K in UnionType]` key (e.g. `viewSwitch.ts`, `ShortcutGuide.tsx`).
|
|
611
|
+
*/
|
|
612
|
+
function findCoupledUnionConsumers(index, editedFiles, declaredScope = [], deletedSet = new Set()) {
|
|
613
|
+
const unionSources = new Map(); // TypeName -> Set<sourceFile | barrelFile>
|
|
614
|
+
for (const rawFile of editedFiles || []) {
|
|
615
|
+
const f = norm(rawFile);
|
|
616
|
+
if (deletedSet.has(f)) continue;
|
|
617
|
+
const info = index.byFile.get(f);
|
|
618
|
+
if (!info || !info.exportedUnions.length) continue;
|
|
619
|
+
for (const typeName of info.exportedUnions) {
|
|
620
|
+
if (!unionSources.has(typeName)) unionSources.set(typeName, new Set());
|
|
621
|
+
unionSources.get(typeName).add(f);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
if (!unionSources.size) return [];
|
|
625
|
+
// Include 1-hop barrel re-exporters (`export * from` or `export { AppView } from`)
|
|
626
|
+
for (const [file, info] of index.byFile.entries()) {
|
|
627
|
+
for (const imp of info.imports) {
|
|
628
|
+
if (!imp.isReExport) continue;
|
|
629
|
+
for (const [typeName, sources] of unionSources.entries()) {
|
|
630
|
+
if (sources.has(imp.target) && (imp.wildcard || imp.names.includes(typeName))) {
|
|
631
|
+
sources.add(file);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
const coupled = [];
|
|
637
|
+
for (const [file, info] of index.byFile.entries()) {
|
|
638
|
+
if (deletedSet.has(file) || inScope(file, declaredScope)) continue;
|
|
639
|
+
if (!info.exhaustiveRecordKeys.length) continue;
|
|
640
|
+
for (const typeName of info.exhaustiveRecordKeys) {
|
|
641
|
+
const sources = unionSources.get(typeName);
|
|
642
|
+
if (!sources) continue;
|
|
643
|
+
const importsType = info.imports.some((imp) => sources.has(imp.target) && (imp.wildcard || imp.names.includes(typeName)));
|
|
644
|
+
if (importsType) {
|
|
645
|
+
coupled.push(file);
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
return uniq(coupled).sort();
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/** OXB-201: role path lists accept `edited`/`edited_paths`, `deleted`/`deleted_paths`, `created`/`created_paths`. */
|
|
654
|
+
function rolePathList(t, field) {
|
|
655
|
+
if (!t) return [];
|
|
656
|
+
const a = Array.isArray(t[field]) ? t[field] : [];
|
|
657
|
+
const b = Array.isArray(t[`${field}_paths`]) ? t[`${field}_paths`] : [];
|
|
658
|
+
return uniq([...a, ...b].map(norm));
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/** OXB-201: renames in the recent history at `ref` (`git log --diff-filter=R`): [{ from, to }]. */
|
|
662
|
+
function recentRenames(root, ref = 'HEAD', max = 500) {
|
|
663
|
+
const out = [];
|
|
664
|
+
try {
|
|
665
|
+
const r = spawnSync('git', ['log', '--diff-filter=R', '-M', '--name-status', '--format=', `-n${max}`, ref || 'HEAD'], { cwd: root, encoding: 'utf8', windowsHide: true, maxBuffer: 64 * 1024 * 1024 });
|
|
666
|
+
if (r.status !== 0) return out;
|
|
667
|
+
for (const line of String(r.stdout || '').split(/\r?\n/)) {
|
|
668
|
+
const m = /^R\d*\t([^\t]+)\t([^\t]+)$/.exec(line.trim());
|
|
669
|
+
if (m) out.push({ from: norm(m[1]), to: norm(m[2]) });
|
|
670
|
+
}
|
|
671
|
+
} catch { /* no git */ }
|
|
672
|
+
return out;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* OXB-201: the real path of a stale `edited`/`deleted` entry — the target of a rename of that exact path, or the single
|
|
677
|
+
* renamed file with the same basename that exists at `ref`. null when there is no candidate or more than one.
|
|
678
|
+
*/
|
|
679
|
+
function staleSuggestion(root, ref, p, renames) {
|
|
680
|
+
const clean = norm(p);
|
|
681
|
+
const exists = (x) => gitHas(root, ref, x);
|
|
682
|
+
// follow a rename chain of the exact path (a → b → c)
|
|
683
|
+
let cur = clean;
|
|
684
|
+
const seen = new Set();
|
|
685
|
+
for (;;) {
|
|
686
|
+
const hit = renames.find((r) => r.from === cur);
|
|
687
|
+
if (!hit || seen.has(hit.to)) break;
|
|
688
|
+
seen.add(hit.to);
|
|
689
|
+
cur = hit.to;
|
|
690
|
+
}
|
|
691
|
+
if (cur !== clean && exists(cur)) return cur;
|
|
692
|
+
const base = path.posix.basename(clean);
|
|
693
|
+
const cands = uniq(renames.filter((r) => path.posix.basename(r.to) === base).map((r) => r.to)).filter(exists);
|
|
694
|
+
return cands.length === 1 ? cands[0] : null;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* OXB-201: `edited`/`deleted` entries (of every role task, in order) that do not exist at `ref`, skipping paths created
|
|
699
|
+
* by an earlier task of the phase. Returns [{ index, rid, field, path, suggestion }].
|
|
700
|
+
*/
|
|
701
|
+
function staleRolePaths(root, ref, tasks) {
|
|
702
|
+
const out = [];
|
|
703
|
+
const createdBefore = new Set();
|
|
704
|
+
let renames = null;
|
|
705
|
+
for (const [i, t] of (tasks || []).entries()) {
|
|
706
|
+
if (!t) continue;
|
|
707
|
+
for (const field of ['edited', 'deleted']) {
|
|
708
|
+
for (const p of rolePathList(t, field)) {
|
|
709
|
+
if (!p || /[*?[{]/.test(p)) continue;
|
|
710
|
+
if (createdBefore.has(p) || gitHas(root, ref, p)) continue;
|
|
711
|
+
if (!renames) renames = recentRenames(root, ref);
|
|
712
|
+
out.push({ index: i, rid: t.rid || t.id || null, field, path: p, suggestion: staleSuggestion(root, ref, p, renames) });
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
for (const p of rolePathList(t, 'created')) createdBefore.add(p);
|
|
716
|
+
}
|
|
717
|
+
return out;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/** OXB-201: replaces a stale path by its suggestion in the role task (edited/deleted/files and their *_paths). */
|
|
721
|
+
function applyStaleFix(t, stale) {
|
|
722
|
+
for (const key of [stale.field, `${stale.field}_paths`, 'files']) {
|
|
723
|
+
if (Array.isArray(t[key])) t[key] = uniq(t[key].map((x) => (norm(x) === stale.path ? stale.suggestion : norm(x))));
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
function staleMessage(at, s, ref) {
|
|
728
|
+
return `${at}: ${s.path} não existe em ${ref} (declarado como ${s.field})${s.suggestion ? ` — movido para ${s.suggestion}? (use --fix-stale-paths para corrigir)` : ''}`;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/** OXB-202: files whose change makes the third-party notices stale. */
|
|
732
|
+
const DEPENDENCY_MANIFEST_RE = /(^|\/)(package\.json|package-lock\.json)$/;
|
|
733
|
+
const NOTICES_FILE = 'THIRD_PARTY_NOTICES.md';
|
|
734
|
+
|
|
735
|
+
function readPackageScripts(root) {
|
|
736
|
+
try {
|
|
737
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
|
|
738
|
+
return pkg && pkg.scripts && typeof pkg.scripts === 'object' ? pkg.scripts : {};
|
|
739
|
+
} catch {
|
|
740
|
+
return {};
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* OXB-202: when a task of the phase edits package.json / package-lock.json, the plan gets the `notices` phase gate
|
|
746
|
+
* (`npm run notices:check`) and the task gets THIRD_PARTY_NOTICES.md in its scope (when the repo has it).
|
|
747
|
+
*/
|
|
748
|
+
function injectNoticesGate(root, ref, plan, warnings) {
|
|
749
|
+
const touching = plan.tasks.filter((t) => (t.files || []).some((f) => DEPENDENCY_MANIFEST_RE.test(norm(f)) && !/node_modules\//.test(f)));
|
|
750
|
+
if (!touching.length) return null;
|
|
751
|
+
const scripts = readPackageScripts(root);
|
|
752
|
+
const hasNotices = gitHas(root, ref, NOTICES_FILE) || fs.existsSync(path.join(root, NOTICES_FILE));
|
|
753
|
+
for (const t of touching) {
|
|
754
|
+
if (hasNotices && !(t.files || []).includes(NOTICES_FILE)) {
|
|
755
|
+
t.files = uniq([...(t.files || []), NOTICES_FILE]);
|
|
756
|
+
warnings.push(`${t.id}: muda ${t.files.filter((f) => DEPENDENCY_MANIFEST_RE.test(f)).join(', ')} — ${NOTICES_FILE} entrou no escopo (rode npm run notices:generate na tarefa)`);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
if (typeof scripts['notices:check'] !== 'string') {
|
|
760
|
+
warnings.push(`${touching.map((t) => t.id).join(', ')} muda(m) package.json/lockfile, mas o package.json não tem o script notices:check — confira as licenças de terceiros antes do PR`);
|
|
761
|
+
return null;
|
|
762
|
+
}
|
|
763
|
+
const gates = Array.isArray(plan.phase_gates) ? plan.phase_gates : [];
|
|
764
|
+
if (!gates.some((g) => g && (g.id === 'notices' || String(g.command || '').includes('notices:check')))) {
|
|
765
|
+
gates.push({ id: 'notices', command: 'npm run notices:check', description: `licenças de terceiros em dia (${touching.map((t) => t.id).join(', ')} muda(m) package.json/lockfile)` });
|
|
766
|
+
}
|
|
767
|
+
plan.phase_gates = gates;
|
|
768
|
+
return 'notices';
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/** OXB-203: the IPC contract files (shared channel types + the renderer's window typing) and the e2e IPC mock. */
|
|
772
|
+
const IPC_CONTRACT_FILES = ['src/types/window.d.ts', 'shared/types/ipc.ts'];
|
|
773
|
+
const IPC_CONSUMER_FILES = ['electron/main/e2e/mock-ipc.ts'];
|
|
774
|
+
const IPC_CONSUMER_RE = /\bwindow\.oxe\b|mock-ipc/;
|
|
775
|
+
|
|
776
|
+
function isFrontendTask(t) {
|
|
777
|
+
return (t.roles || []).some((r) => /front|^fe$|^ui$|renderer/i.test(String(r)))
|
|
778
|
+
|| /^FE-/i.test(String(t.rid || ''))
|
|
779
|
+
|| (Array.isArray(t.ids) && t.ids.some((id) => /(?:^|:)FE-/i.test(String(id))));
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* OXB-207: every `FE-*` / frontend task that creates or edits `.tsx` / `.css` under `src/` automatically includes
|
|
784
|
+
* `tests/design-lint.test.ts` and `tests/design-lint-target-size.test.ts` (when present in the repo) in `verify.commands`.
|
|
785
|
+
*/
|
|
786
|
+
function injectFrontendDesignLintVerify(root, ref, task, roleInfo = {}, taskDeleted = [], overrideTests = null) {
|
|
787
|
+
const isFe = isFrontendTask(task)
|
|
788
|
+
|| (Array.isArray(roleInfo.rawTasks) && roleInfo.rawTasks.some((rt) => rt && /^FE-/i.test(String(rt.id || rt.rid || ''))));
|
|
789
|
+
if (!isFe) return [];
|
|
790
|
+
const delSet = new Set((taskDeleted || []).map(norm));
|
|
791
|
+
const touchedUi = uniq([
|
|
792
|
+
...(roleInfo.created || []),
|
|
793
|
+
...(roleInfo.edited || []),
|
|
794
|
+
...(task.files || []),
|
|
795
|
+
...((roleInfo.moves || []).map((m) => m.to)),
|
|
796
|
+
].map(norm)).filter((p) => !delSet.has(p) && !TEST_FILE_RE.test(p) && /^src\/.+\.(?:tsx|css)$/i.test(p));
|
|
797
|
+
if (!touchedUi.length) return [];
|
|
798
|
+
|
|
799
|
+
const candidates = Array.isArray(overrideTests)
|
|
800
|
+
? overrideTests.map(norm)
|
|
801
|
+
: DESIGN_LINT_TESTS.filter((f) => hasRepoFile(root, ref, f) && !delSet.has(f));
|
|
802
|
+
if (!candidates.length) return [];
|
|
803
|
+
|
|
804
|
+
const existingCmds = (task.verify && Array.isArray(task.verify.commands))
|
|
805
|
+
? [...task.verify.commands]
|
|
806
|
+
: (typeof task.verify === 'string' ? [task.verify] : []);
|
|
807
|
+
const missingTests = candidates.filter((tf) => !existingCmds.some((c) => String(c).includes(tf)));
|
|
808
|
+
if (missingTests.length) {
|
|
809
|
+
existingCmds.push(`npx vitest run ${missingTests.join(' ')}`);
|
|
810
|
+
task.verify = {
|
|
811
|
+
...(task.verify && typeof task.verify === 'object' && !Array.isArray(task.verify) ? task.verify : {}),
|
|
812
|
+
commands: existingCmds,
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
return missingTests;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* OXB-203 (`--pair-as-deps`): a frontend task that consumes `window.oxe` / the e2e IPC mock depends on the tasks of the
|
|
820
|
+
* phase that edit the IPC contract (src/types/window.d.ts, shared/types/ipc.ts) — never the other way round, and never
|
|
821
|
+
* when it would close a cycle. Returns [{ task, added: [ids] }].
|
|
822
|
+
*/
|
|
823
|
+
function pairIpcDependencies(root, ref, tasks, options = {}) {
|
|
824
|
+
const contract = (options.contractFiles || IPC_CONTRACT_FILES).map(norm);
|
|
825
|
+
const consumerFiles = (options.consumerFiles || IPC_CONSUMER_FILES).map(norm);
|
|
826
|
+
const producers = tasks.filter((t) => (t.files || []).some((f) => contract.includes(norm(f))));
|
|
827
|
+
if (!producers.length) return [];
|
|
828
|
+
const byId = new Map(tasks.map((t) => [t.id, t]));
|
|
829
|
+
const dependsOn = (a, b, seen = new Set()) => { // does a depend (transitively) on b?
|
|
830
|
+
if (a === b) return true;
|
|
831
|
+
if (seen.has(a)) return false;
|
|
832
|
+
seen.add(a);
|
|
833
|
+
return ((byId.get(a) || {}).depends_on || []).some((d) => dependsOn(d, b, seen));
|
|
834
|
+
};
|
|
835
|
+
const out = [];
|
|
836
|
+
for (const t of tasks) {
|
|
837
|
+
if (!isFrontendTask(t) || producers.includes(t)) continue;
|
|
838
|
+
const files = (t.files || []).map(norm);
|
|
839
|
+
const consumes = files.some((f) => consumerFiles.includes(f)) || files.some((f) => CODE_RE.test(f) && IPC_CONSUMER_RE.test(readRepoText(root, ref, f)));
|
|
840
|
+
if (!consumes) continue;
|
|
841
|
+
const added = [];
|
|
842
|
+
for (const p of producers) {
|
|
843
|
+
if ((t.depends_on || []).includes(p.id) || dependsOn(p.id, t.id)) continue;
|
|
844
|
+
t.depends_on = uniq([...(t.depends_on || []), p.id]);
|
|
845
|
+
added.push(p.id);
|
|
846
|
+
}
|
|
847
|
+
if (added.length) out.push({ task: t.id, added });
|
|
848
|
+
}
|
|
849
|
+
return out;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
const GENERIC_EXPORT_NAMES = new Set([
|
|
853
|
+
'init', 'index', 'main', 'default', 'types', 'config', 'state', 'store', 'props',
|
|
854
|
+
'utils', 'helper', 'helpers', 'render', 'setup', 'start', 'close', 'reset', 'create',
|
|
855
|
+
'update', 'remove', 'delete', 'open', 'read', 'write', 'list', 'load', 'save',
|
|
856
|
+
]);
|
|
857
|
+
const GENERIC_FEATURE_DIRS = new Set([
|
|
858
|
+
'common', 'shared', 'layout', 'navigation', 'modal', 'modals', 'icons', 'keyboard',
|
|
859
|
+
'editor', 'utils', 'hooks', 'types', 'store', 'stores', 'services', 'components',
|
|
860
|
+
'main', 'renderer', 'preload', 'ipc', 'lib', 'core', 'app', 'ui', 'views', 'modes',
|
|
861
|
+
]);
|
|
862
|
+
const URL_SCHEMES = new Set([
|
|
863
|
+
'http', 'https', 'file', 'data', 'node', 'ws', 'wss', 'mailto', 'about', 'chrome',
|
|
864
|
+
'javascript', 'devtools', 'electron', 'app', 'oxe', 'backend', 'frontend', 'stress',
|
|
865
|
+
]);
|
|
866
|
+
|
|
867
|
+
function listAllRepoFiles(root, ref = 'HEAD') {
|
|
868
|
+
const files = [];
|
|
869
|
+
try {
|
|
870
|
+
const gitRes = spawnSync('git', ['ls-tree', '-r', '--name-only', ref || 'HEAD'], {
|
|
871
|
+
cwd: root,
|
|
872
|
+
encoding: 'utf8',
|
|
873
|
+
windowsHide: true,
|
|
874
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
875
|
+
});
|
|
876
|
+
if (gitRes.status === 0 && gitRes.stdout && gitRes.stdout.trim()) {
|
|
877
|
+
for (const line of gitRes.stdout.trim().split(/\r?\n/)) {
|
|
878
|
+
const p = norm(line);
|
|
879
|
+
if (p) files.push(p);
|
|
880
|
+
}
|
|
881
|
+
return uniq(files);
|
|
882
|
+
}
|
|
883
|
+
} catch { /* fallback to disk */ }
|
|
884
|
+
const walk = (dir) => {
|
|
885
|
+
let entries = [];
|
|
886
|
+
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
887
|
+
for (const ent of entries) {
|
|
888
|
+
if (['node_modules', '.git', '.oxe', 'dist', 'build', 'coverage'].includes(ent.name)) continue;
|
|
889
|
+
const full = path.join(dir, ent.name);
|
|
890
|
+
const rel = norm(path.relative(root, full));
|
|
891
|
+
if (ent.isDirectory()) walk(full);
|
|
892
|
+
else if (ent.isFile()) files.push(rel);
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
walk(root);
|
|
896
|
+
return uniq(files);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
function extractExportedSymbols(text) {
|
|
900
|
+
const out = [];
|
|
901
|
+
const src = String(text || '');
|
|
902
|
+
for (const m of src.matchAll(/\bexport\s+(?:default\s+)?(?:async\s+)?(?:function|const|let|var|class|type|interface|enum)\s+([A-Za-z_$][\w$]*)/g)) {
|
|
903
|
+
if (m[1]) out.push(m[1]);
|
|
904
|
+
}
|
|
905
|
+
for (const m of src.matchAll(/\bexport\s*\{([^}]+)\}(?!\s*from\b)/g)) {
|
|
906
|
+
for (const part of m[1].split(',')) {
|
|
907
|
+
const cleaned = part.replace(/^\s*type\s+/, '').trim();
|
|
908
|
+
if (!cleaned) continue;
|
|
909
|
+
const parts = cleaned.split(/\s+as\s+/);
|
|
910
|
+
const exported = (parts[1] || parts[0] || '').trim();
|
|
911
|
+
if (exported && exported !== 'default') out.push(exported);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
return uniq(out);
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
function escapeRegExp(s) {
|
|
918
|
+
return String(s).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
function hasStringLiteral(text, lit) {
|
|
922
|
+
if (!lit) return false;
|
|
923
|
+
return text.includes(`'${lit}'`) || text.includes(`"${lit}"`) || text.includes(`\`${lit}\``);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
function toKebabSlug(name) {
|
|
927
|
+
return String(name || '')
|
|
928
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
929
|
+
.replace(/[_\s]+/g, '-')
|
|
930
|
+
.toLowerCase();
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* OXB-206: On removal tasks (deleting files under src/ | electron/ | shared/, or removing IPC channels / modes / routes),
|
|
935
|
+
* sweep non-frozen legacy tests (tests/ excluding tests/acceptance/), e2e/, appMenus.ts, and
|
|
936
|
+
* docs/security/threat-model-*.md for removed imports, symbols, IPC channels, modes, and routes.
|
|
937
|
+
*/
|
|
938
|
+
function sweepRemovalImpacts(root, ref, task, roleInfo, sweepCtx = {}) {
|
|
939
|
+
const deletedBefore = sweepCtx.deletedBefore || new Set();
|
|
940
|
+
const frozenFiles = sweepCtx.frozenFiles || new Set();
|
|
941
|
+
const allRepoFiles = sweepCtx.allRepoFiles || listAllRepoFiles(root, ref);
|
|
942
|
+
const aliases = sweepCtx.aliases || loadPathAliases(root);
|
|
943
|
+
const textCache = sweepCtx.textCache || new Map();
|
|
944
|
+
const readText = (f) => {
|
|
945
|
+
if (!textCache.has(f)) textCache.set(f, readRepoText(root, ref, f));
|
|
946
|
+
return textCache.get(f);
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
const taskDeleted = uniq([
|
|
950
|
+
...((roleInfo && roleInfo.deleted) || []).map(norm),
|
|
951
|
+
...(((roleInfo && roleInfo.moves) || []).map((m) => norm(m.from))),
|
|
952
|
+
]);
|
|
953
|
+
const newlyDeleted = taskDeleted.filter((p) => !deletedBefore.has(p));
|
|
954
|
+
const deletedProd = newlyDeleted.filter((p) => /^(src|electron|shared)\//.test(p));
|
|
955
|
+
const rawTasks = Array.isArray(roleInfo && roleInfo.rawTasks) ? roleInfo.rawTasks : [];
|
|
956
|
+
|
|
957
|
+
const explicitSymbols = new Set();
|
|
958
|
+
const explicitChannels = new Set();
|
|
959
|
+
const explicitLiterals = new Set();
|
|
960
|
+
|
|
961
|
+
for (const rt of rawTasks) {
|
|
962
|
+
for (const s of [...(rt.removed_symbols || []), ...(rt.symbols_removed || [])]) {
|
|
963
|
+
const name = typeof s === 'string' ? s.trim() : (s && s.name ? String(s.name).trim() : '');
|
|
964
|
+
if (name) explicitSymbols.add(name);
|
|
965
|
+
}
|
|
966
|
+
for (const ch of [...(rt.removed_channels || []), ...(rt.ipc_channels_removed || [])]) {
|
|
967
|
+
if (typeof ch === 'string' && ch.trim()) explicitChannels.add(ch.trim());
|
|
968
|
+
}
|
|
969
|
+
for (const lit of [
|
|
970
|
+
...(rt.removed_modes || []),
|
|
971
|
+
...(rt.modes_removed || []),
|
|
972
|
+
...(rt.removed_routes || []),
|
|
973
|
+
...(rt.routes_removed || []),
|
|
974
|
+
...(rt.removed_views || []),
|
|
975
|
+
...(rt.views_removed || []),
|
|
976
|
+
]) {
|
|
977
|
+
if (typeof lit === 'string' && lit.trim()) explicitLiterals.add(lit.trim());
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
const hasExplicitRemovals = explicitSymbols.size > 0 || explicitChannels.size > 0 || explicitLiterals.size > 0;
|
|
982
|
+
const isRemovalTask =
|
|
983
|
+
task.kind === 'remove'
|
|
984
|
+
|| deletedProd.length > 0
|
|
985
|
+
|| hasExplicitRemovals
|
|
986
|
+
|| /\b(remov|drop|strip|retir|delet)/i.test(String(task.title || ''));
|
|
987
|
+
if (!isRemovalTask) return { swept: [], legacyTests: [], e2eSpecs: [], menuFiles: [], threatModelDocs: [] };
|
|
988
|
+
|
|
989
|
+
// Extract quoted/backticked IPC channels, routes, and mode/tool literals from removal task title & notes
|
|
990
|
+
const prose = `${task.title || ''}\n${task.notes || ''}`;
|
|
991
|
+
for (const m of prose.matchAll(/(?:^|[\s'"`(,])([a-z][a-z0-9-]*:[a-z0-9][\w:-]*)(?=$|[\s'"`),.;])/g)) {
|
|
992
|
+
const ch = m[1];
|
|
993
|
+
const scheme = ch.split(':')[0];
|
|
994
|
+
if (!URL_SCHEMES.has(scheme)) explicitChannels.add(ch);
|
|
995
|
+
}
|
|
996
|
+
for (const m of prose.matchAll(/['"`]([^'"`\s]{3,60})['"`]/g)) {
|
|
997
|
+
const tok = m[1].trim();
|
|
998
|
+
if (!tok || /^[AG]\d+(?:\.\d+)?$/.test(tok)) continue;
|
|
999
|
+
if (/\.[a-z0-9]{1,5}$/i.test(tok) || tok.includes('/src/') || tok.includes('/electron/')) continue;
|
|
1000
|
+
if (tok.includes(':')) {
|
|
1001
|
+
const scheme = tok.split(':')[0];
|
|
1002
|
+
if (!URL_SCHEMES.has(scheme)) explicitChannels.add(tok);
|
|
1003
|
+
continue;
|
|
1004
|
+
}
|
|
1005
|
+
if (tok.startsWith('/') || /^(?:tool|view|mode|tab|nav)-[a-z0-9-]+$/i.test(tok) || /^[a-z][a-z0-9-]{2,}$/.test(tok)) {
|
|
1006
|
+
explicitLiterals.add(tok);
|
|
1007
|
+
} else if (/^[A-Za-z_$][\w$]{3,}$/.test(tok)) {
|
|
1008
|
+
explicitSymbols.add(tok);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
const allDeletedSet = new Set([...deletedBefore, ...taskDeleted]);
|
|
1013
|
+
|
|
1014
|
+
// Surviving production exports and IPC handlers (to prevent false-positive symbol/channel collisions)
|
|
1015
|
+
const survivingExports = new Set();
|
|
1016
|
+
const survivingIpcHandlers = new Set();
|
|
1017
|
+
if (deletedProd.length) {
|
|
1018
|
+
for (const f of allRepoFiles) {
|
|
1019
|
+
if (allDeletedSet.has(f) || !/^(src|electron|shared)\//.test(f) || !CODE_RE.test(f) || TEST_FILE_RE.test(f)) continue;
|
|
1020
|
+
const txt = readText(f);
|
|
1021
|
+
for (const sym of extractExportedSymbols(txt)) survivingExports.add(sym);
|
|
1022
|
+
if (f.startsWith('electron/')) {
|
|
1023
|
+
for (const hm of txt.matchAll(/\b(?:ipcMain\.(?:handle|on)|handleIpc)\s*\(\s*['"`]([^'"`]+)['"`]/g)) {
|
|
1024
|
+
survivingIpcHandlers.add(hm[1]);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
const inferredSymbols = new Set();
|
|
1031
|
+
const inferredChannels = new Set();
|
|
1032
|
+
const featureSlugs = new Set();
|
|
1033
|
+
const deletedDirPrefixes = new Set();
|
|
1034
|
+
|
|
1035
|
+
for (const rawDel of (roleInfo && roleInfo.rawDeleted) || []) {
|
|
1036
|
+
const cleaned = norm(rawDel).replace(/(\/\*\*|\/)+$/, '');
|
|
1037
|
+
if (/^(src|electron|shared)\//.test(cleaned) && isDirEntry(root, ref, rawDel)) {
|
|
1038
|
+
deletedDirPrefixes.add(cleaned);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
for (const f of deletedProd) {
|
|
1043
|
+
const txt = readText(f);
|
|
1044
|
+
for (const sym of extractExportedSymbols(txt)) {
|
|
1045
|
+
if (sym.length >= 4 && !GENERIC_EXPORT_NAMES.has(sym.toLowerCase()) && !survivingExports.has(sym)) {
|
|
1046
|
+
inferredSymbols.add(sym);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
for (const cm of txt.matchAll(/['"`]([a-z][a-z0-9-]*:[a-z0-9][\w:-]*)['"`]/g)) {
|
|
1050
|
+
const ch = cm[1];
|
|
1051
|
+
const scheme = ch.split(':')[0];
|
|
1052
|
+
if (!URL_SCHEMES.has(scheme) && !survivingIpcHandlers.has(ch)) {
|
|
1053
|
+
inferredChannels.add(ch);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
const segMatch = /^(?:src\/(?:components|views|modes|features)|electron\/main\/services)\/([^/]+)(?:\/|$)/.exec(f);
|
|
1057
|
+
if (segMatch && segMatch[1]) {
|
|
1058
|
+
const segBase = segMatch[1].replace(/\.[^.]+$/, '');
|
|
1059
|
+
const slug = toKebabSlug(segBase);
|
|
1060
|
+
if (slug.length >= 4 && !GENERIC_FEATURE_DIRS.has(slug) && !GENERIC_FEATURE_DIRS.has(segBase.toLowerCase())) {
|
|
1061
|
+
featureSlugs.add(slug);
|
|
1062
|
+
featureSlugs.add(segBase.toLowerCase());
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
const deletedTargets = new Set(deletedProd);
|
|
1068
|
+
const removedSymbols = new Set([...explicitSymbols, ...inferredSymbols]);
|
|
1069
|
+
const removedChannels = new Set([...explicitChannels, ...inferredChannels]);
|
|
1070
|
+
const removedLiterals = new Set([...explicitLiterals]);
|
|
1071
|
+
|
|
1072
|
+
if (!deletedTargets.size && !removedSymbols.size && !removedChannels.size && !removedLiterals.size && !featureSlugs.size) {
|
|
1073
|
+
return { swept: [], legacyTests: [], e2eSpecs: [], menuFiles: [], threatModelDocs: [] };
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
const knownAllSet = new Set([...allRepoFiles, ...deletedTargets, ...taskDeleted]);
|
|
1077
|
+
const symbolRegexes = [...removedSymbols]
|
|
1078
|
+
.filter((sym) => explicitSymbols.has(sym) || sym.length >= 5)
|
|
1079
|
+
.map((sym) => new RegExp(`\\b${escapeRegExp(sym)}\\b`));
|
|
1080
|
+
|
|
1081
|
+
const matchesCodeCandidate = (candFile, kind) => {
|
|
1082
|
+
const txt = readText(candFile);
|
|
1083
|
+
if (!txt) return false;
|
|
1084
|
+
const rawImports = extractModuleImports(txt);
|
|
1085
|
+
for (const imp of rawImports) {
|
|
1086
|
+
if (deletedTargets.size) {
|
|
1087
|
+
const resolved = resolveModuleSpecifier(candFile, imp.specifier, knownAllSet, aliases);
|
|
1088
|
+
if (resolved && deletedTargets.has(resolved)) return true;
|
|
1089
|
+
for (const dirPref of deletedDirPrefixes) {
|
|
1090
|
+
if (resolved && (resolved === dirPref || resolved.startsWith(`${dirPref}/`))) return true;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
if (removedSymbols.size && imp.names.some((n) => removedSymbols.has(n))) return true;
|
|
1094
|
+
}
|
|
1095
|
+
for (const ch of removedChannels) {
|
|
1096
|
+
if (hasStringLiteral(txt, ch)) return true;
|
|
1097
|
+
}
|
|
1098
|
+
for (const lit of removedLiterals) {
|
|
1099
|
+
if (hasStringLiteral(txt, lit)) return true;
|
|
1100
|
+
}
|
|
1101
|
+
for (const re of symbolRegexes) {
|
|
1102
|
+
if (re.test(txt)) return true;
|
|
1103
|
+
}
|
|
1104
|
+
if (kind === 'menu' && featureSlugs.size) {
|
|
1105
|
+
for (const slug of featureSlugs) {
|
|
1106
|
+
if (
|
|
1107
|
+
hasStringLiteral(txt, `tool-${slug}`)
|
|
1108
|
+
|| hasStringLiteral(txt, `view-${slug}`)
|
|
1109
|
+
|| hasStringLiteral(txt, `mode-${slug}`)
|
|
1110
|
+
|| hasStringLiteral(txt, slug)
|
|
1111
|
+
) {
|
|
1112
|
+
return true;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
if (kind === 'e2e' && featureSlugs.size) {
|
|
1117
|
+
const base = path.posix.basename(candFile).toLowerCase();
|
|
1118
|
+
for (const slug of featureSlugs) {
|
|
1119
|
+
if (
|
|
1120
|
+
base.startsWith(slug)
|
|
1121
|
+
|| hasStringLiteral(txt, `/${slug}`)
|
|
1122
|
+
|| hasStringLiteral(txt, `tool-${slug}`)
|
|
1123
|
+
|| hasStringLiteral(txt, slug)
|
|
1124
|
+
) {
|
|
1125
|
+
return true;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
return false;
|
|
1130
|
+
};
|
|
1131
|
+
|
|
1132
|
+
const matchesDocCandidate = (docFile) => {
|
|
1133
|
+
const txt = readText(docFile);
|
|
1134
|
+
if (!txt) return false;
|
|
1135
|
+
for (const p of deletedProd) {
|
|
1136
|
+
if (txt.includes(p)) return true;
|
|
1137
|
+
}
|
|
1138
|
+
for (const dirPref of deletedDirPrefixes) {
|
|
1139
|
+
if (txt.includes(dirPref)) return true;
|
|
1140
|
+
}
|
|
1141
|
+
for (const ch of removedChannels) {
|
|
1142
|
+
if (txt.includes(ch)) return true;
|
|
1143
|
+
}
|
|
1144
|
+
for (const lit of removedLiterals) {
|
|
1145
|
+
if (txt.includes(lit)) return true;
|
|
1146
|
+
}
|
|
1147
|
+
for (const sym of explicitSymbols) {
|
|
1148
|
+
if (sym.length >= 4 && new RegExp(`\\b${escapeRegExp(sym)}\\b`).test(txt)) return true;
|
|
1149
|
+
}
|
|
1150
|
+
return false;
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
const legacyTests = [];
|
|
1154
|
+
const e2eSpecs = [];
|
|
1155
|
+
const menuFiles = [];
|
|
1156
|
+
const threatModelDocs = [];
|
|
1157
|
+
|
|
1158
|
+
for (const f of allRepoFiles) {
|
|
1159
|
+
if (allDeletedSet.has(f) || frozenFiles.has(f)) continue;
|
|
1160
|
+
if (f.startsWith('tests/') && !f.startsWith('tests/acceptance/') && (CODE_RE.test(f) || TEST_FILE_RE.test(f))) {
|
|
1161
|
+
if (matchesCodeCandidate(f, 'test')) legacyTests.push(f);
|
|
1162
|
+
} else if (f.startsWith('e2e/') && (CODE_RE.test(f) || TEST_FILE_RE.test(f))) {
|
|
1163
|
+
if (matchesCodeCandidate(f, 'e2e')) e2eSpecs.push(f);
|
|
1164
|
+
} else if (/(?:^|\/)appMenus\.[cm]?[jt]sx?$/.test(f)) {
|
|
1165
|
+
if (matchesCodeCandidate(f, 'menu')) menuFiles.push(f);
|
|
1166
|
+
} else if (/^docs\/security\/threat-model-[^/]*\.md$/.test(f)) {
|
|
1167
|
+
if (matchesDocCandidate(f)) threatModelDocs.push(f);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
legacyTests.sort();
|
|
1172
|
+
e2eSpecs.sort();
|
|
1173
|
+
menuFiles.sort();
|
|
1174
|
+
threatModelDocs.sort();
|
|
1175
|
+
const swept = uniq([...legacyTests, ...e2eSpecs, ...menuFiles, ...threatModelDocs]);
|
|
1176
|
+
return { swept, legacyTests, e2eSpecs, menuFiles, threatModelDocs };
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
function expandRolePaths(root, ref, list) {
|
|
1180
|
+
const expanded = [];
|
|
1181
|
+
for (const p of Array.isArray(list) ? list : []) {
|
|
1182
|
+
if (isDirEntry(root, ref || 'HEAD', p)) {
|
|
1183
|
+
expanded.push(norm(p), ...expandDirEntry(root, ref || 'HEAD', p));
|
|
1184
|
+
} else {
|
|
1185
|
+
expanded.push(norm(p));
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
return uniq(expanded);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
function build(first, second = {}, third = {}) {
|
|
1192
|
+
let rawInputs = first;
|
|
1193
|
+
let ctx = second || {};
|
|
1194
|
+
if (typeof first === 'string' && Array.isArray(second)) {
|
|
1195
|
+
rawInputs = second;
|
|
1196
|
+
ctx = { ...(third || {}), root: first };
|
|
1197
|
+
}
|
|
1198
|
+
const inputs = (Array.isArray(rawInputs) ? rawInputs : []).map((entry, idx) => {
|
|
1199
|
+
if (entry && typeof entry === 'object' && entry.doc && typeof entry.file === 'string') return entry;
|
|
1200
|
+
if (entry && typeof entry === 'object' && Array.isArray(entry.tasks)) {
|
|
1201
|
+
return { file: `${entry.role || `role-${idx + 1}`}.role.json`, doc: entry };
|
|
1202
|
+
}
|
|
1203
|
+
return entry;
|
|
1204
|
+
});
|
|
1205
|
+
const root = ctx.root || process.cwd();
|
|
1206
|
+
const ref = ctx.ref || 'HEAD';
|
|
1207
|
+
const coupledRules = loadCoupledScope(root, ctx);
|
|
1208
|
+
// OXB-201: stale edited/deleted paths (moved by an earlier phase) — fixed with --fix-stale-paths, an error otherwise.
|
|
1209
|
+
const staleErrors = [];
|
|
1210
|
+
const staleFixed = [];
|
|
1211
|
+
if (ctx.checkPaths !== false) {
|
|
1212
|
+
for (const { file, doc } of inputs) {
|
|
1213
|
+
for (const s of staleRolePaths(root, ref, (doc && doc.tasks) || [])) {
|
|
1214
|
+
const at = `${path.basename(file)}: tasks[${s.index}]${s.rid ? ` (${s.rid})` : ''}`;
|
|
1215
|
+
if (ctx.fixStalePaths && s.suggestion) {
|
|
1216
|
+
applyStaleFix(doc.tasks[s.index], s);
|
|
1217
|
+
staleFixed.push(`${at}: ${s.path} → ${s.suggestion} (corrigido pelo histórico de renames)`);
|
|
1218
|
+
} else staleErrors.push(staleMessage(at, s, ref));
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
const res = merge.mergeRolePlans(inputs, { key: ctx.key || 'rid' });
|
|
1223
|
+
const errors = [...res.errors, ...staleErrors];
|
|
1224
|
+
const warnings = [...res.warnings, ...staleFixed];
|
|
1225
|
+
const plan = res.plan;
|
|
1226
|
+
const frozenFiles = new Set((plan.acceptance_tests || []).flatMap((a) => (a.files || []).map(norm)));
|
|
1227
|
+
// role-level path declarations by key
|
|
1228
|
+
const roleByKey = new Map();
|
|
1229
|
+
for (const { doc } of inputs) for (const t of (doc && doc.tasks) || []) {
|
|
1230
|
+
const k = String(t.rid || t[ctx.key || 'rid'] || '');
|
|
1231
|
+
const cur = roleByKey.get(k) || { deleted: [], created: [], edited: [], moves: [], swept: [], rawDeleted: [], rawTasks: [] };
|
|
1232
|
+
cur.rawDeleted.push(...rolePathList(t, 'deleted'));
|
|
1233
|
+
cur.rawTasks.push(t);
|
|
1234
|
+
for (const f of ['deleted', 'created', 'edited']) {
|
|
1235
|
+
cur[f].push(...expandRolePaths(root, ref, rolePathList(t, f)));
|
|
1236
|
+
}
|
|
1237
|
+
// OXB-C24-3: `swept` (existing tests the task updates, no symbols needed) on ANY task, not only removals
|
|
1238
|
+
cur.swept.push(...expandRolePaths(root, ref, rolePathList(t, 'swept')));
|
|
1239
|
+
cur.moves.push(...(Array.isArray(t.moves) ? t.moves : []));
|
|
1240
|
+
roleByKey.set(k, cur);
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
let importIndex = null;
|
|
1244
|
+
const getImportIndex = () => {
|
|
1245
|
+
if (!importIndex) importIndex = buildImportIndex(root, ref);
|
|
1246
|
+
return importIndex;
|
|
1247
|
+
};
|
|
1248
|
+
let allRepoFiles = null;
|
|
1249
|
+
let pathAliases = null;
|
|
1250
|
+
const sweepTextCache = new Map();
|
|
1251
|
+
const getSweepBase = () => {
|
|
1252
|
+
if (!allRepoFiles) allRepoFiles = listAllRepoFiles(root, ref);
|
|
1253
|
+
if (!pathAliases) pathAliases = loadPathAliases(root);
|
|
1254
|
+
return { allRepoFiles, aliases: pathAliases, textCache: sweepTextCache };
|
|
1255
|
+
};
|
|
1256
|
+
|
|
1257
|
+
const deletedBefore = new Set();
|
|
1258
|
+
const phaseSweptLegacyTests = [];
|
|
1259
|
+
const phaseSweptE2eSpecs = [];
|
|
1260
|
+
const phaseSweepTasks = [];
|
|
1261
|
+
|
|
1262
|
+
for (const t of plan.tasks) {
|
|
1263
|
+
const before = t.files.length;
|
|
1264
|
+
const r = roleByKey.get(String(t.rid)) || {};
|
|
1265
|
+
const taskFilesExpanded = expandRolePaths(root, ref, t.files);
|
|
1266
|
+
const taskDeleted = uniq([...(r.deleted || []).map(norm), ...((r.moves || []).map((m) => norm(m.from)))]);
|
|
1267
|
+
const newlyDeleted = taskDeleted.filter((p) => !deletedBefore.has(p));
|
|
1268
|
+
|
|
1269
|
+
// OXB-199: 1-hop reverse import closure when `--auto-close-imports` (`ctx.autoCloseImports`) is enabled
|
|
1270
|
+
let autoClosedImporters = [];
|
|
1271
|
+
if (ctx.autoCloseImports && newlyDeleted.length) {
|
|
1272
|
+
const currentScope = uniq([...taskFilesExpanded, ...(r.edited || []).map(norm), ...(r.created || []).map(norm), ...taskDeleted]);
|
|
1273
|
+
autoClosedImporters = findOrphanImporters(getImportIndex(), newlyDeleted, currentScope, deletedBefore);
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
// OXB-198: exhaustive Record<UnionType, ...> shrink coupling on mode/feature removal tasks
|
|
1277
|
+
let unionCoupled = [];
|
|
1278
|
+
const isRemovalTask = t.kind === 'remove' || taskDeleted.length > 0 || /\b(remov|drop|strip|retir|delet)/i.test(String(t.title || ''));
|
|
1279
|
+
const candidateUnionEdited = uniq([...taskFilesExpanded, ...(r.edited || []).map(norm), ...autoClosedImporters]).filter((p) => CODE_RE.test(p) && !taskDeleted.includes(p));
|
|
1280
|
+
if (isRemovalTask && candidateUnionEdited.length) {
|
|
1281
|
+
const allDeletedSoFar = new Set([...deletedBefore, ...taskDeleted]);
|
|
1282
|
+
const currentScope = uniq([...taskFilesExpanded, ...(r.edited || []).map(norm), ...(r.created || []).map(norm), ...autoClosedImporters, ...taskDeleted]);
|
|
1283
|
+
unionCoupled = findCoupledUnionConsumers(getImportIndex(), candidateUnionEdited, currentScope, allDeletedSoFar);
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
// OXB-206: sweep legacy suites (`tests/**`, `e2e/**`), `appMenus.ts`, and `docs/security/threat-model-*.md`
|
|
1287
|
+
const sweepRes = ctx.legacySweep === false
|
|
1288
|
+
? { swept: [], legacyTests: [], e2eSpecs: [], menuFiles: [], threatModelDocs: [] }
|
|
1289
|
+
: sweepRemovalImpacts(root, ref, t, r, { deletedBefore, frozenFiles, ...getSweepBase() });
|
|
1290
|
+
|
|
1291
|
+
const effectiveEdited = uniq([...(r.edited || []).map(norm), ...autoClosedImporters, ...unionCoupled, ...sweepRes.swept]);
|
|
1292
|
+
if (autoClosedImporters.length || unionCoupled.length || sweepRes.swept.length) {
|
|
1293
|
+
r.edited = effectiveEdited;
|
|
1294
|
+
r.swept = uniq([...(r.swept || []), ...sweepRes.swept]);
|
|
1295
|
+
roleByKey.set(String(t.rid), r);
|
|
1296
|
+
}
|
|
1297
|
+
if (effectiveEdited.length) {
|
|
1298
|
+
t.edited_paths = effectiveEdited.filter((f) => !frozenFiles.has(f));
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
if (sweepRes.swept.length) {
|
|
1302
|
+
phaseSweepTasks.push(t.id);
|
|
1303
|
+
const taskGates = Array.isArray(t.gates) ? [...t.gates] : [];
|
|
1304
|
+
if (sweepRes.legacyTests.length) {
|
|
1305
|
+
phaseSweptLegacyTests.push(...sweepRes.legacyTests);
|
|
1306
|
+
const existingCmds = (t.verify && Array.isArray(t.verify.commands)) ? t.verify.commands : [];
|
|
1307
|
+
const uncoveredTests = sweepRes.legacyTests.filter((tf) => !existingCmds.some((c) => String(c).includes(tf)));
|
|
1308
|
+
if (uncoveredTests.length) {
|
|
1309
|
+
t.verify = { ...(t.verify || {}), commands: [...existingCmds, `npx vitest run ${uncoveredTests.join(' ')}`] };
|
|
1310
|
+
}
|
|
1311
|
+
taskGates.push(`npx vitest run ${sweepRes.legacyTests.join(' ')}`);
|
|
1312
|
+
}
|
|
1313
|
+
if (sweepRes.e2eSpecs.length) {
|
|
1314
|
+
phaseSweptE2eSpecs.push(...sweepRes.e2eSpecs);
|
|
1315
|
+
taskGates.push(`npx playwright test ${sweepRes.e2eSpecs.join(' ')}`);
|
|
1316
|
+
}
|
|
1317
|
+
if (taskGates.length) t.gates = uniq(taskGates);
|
|
1318
|
+
warnings.push(`${t.id}: varredura de remoção anexou a edited_paths (${sweepRes.swept.join(', ')})`);
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
const coupledMatch = matchedCoupledRules(coupledRules, {
|
|
1322
|
+
files: [...taskFilesExpanded, ...autoClosedImporters, ...unionCoupled, ...sweepRes.swept],
|
|
1323
|
+
created: r.created || [],
|
|
1324
|
+
edited: effectiveEdited,
|
|
1325
|
+
deleted: r.deleted || [],
|
|
1326
|
+
});
|
|
1327
|
+
const coupled = coupledMatch.included;
|
|
1328
|
+
for (const mr of coupledMatch.matchedRules) {
|
|
1329
|
+
if (mr.note) warnings.push(`${t.id}: ${mr.note}`);
|
|
1330
|
+
}
|
|
1331
|
+
t.files = uniq([
|
|
1332
|
+
...taskFilesExpanded,
|
|
1333
|
+
...autoClosedImporters,
|
|
1334
|
+
...unionCoupled,
|
|
1335
|
+
...sweepRes.swept,
|
|
1336
|
+
...coupled,
|
|
1337
|
+
...(r.created || []).map(norm),
|
|
1338
|
+
...effectiveEdited,
|
|
1339
|
+
...(r.deleted || []).map(norm),
|
|
1340
|
+
...(r.moves || []).flatMap((m) => [norm(m.from), norm(m.to)]),
|
|
1341
|
+
]).filter((f) => !frozenFiles.has(f));
|
|
1342
|
+
if (ctx.designLintVerify !== false) {
|
|
1343
|
+
injectFrontendDesignLintVerify(root, ref, t, r, taskDeleted, ctx.designLintTests);
|
|
1344
|
+
}
|
|
1345
|
+
if (before && t.files.length < before) warnings.push(`${t.id}: arquivos de aceite congelados tirados do escopo`);
|
|
1346
|
+
if (ctx.phase) t.phase = ctx.phase;
|
|
1347
|
+
for (const p of taskDeleted) deletedBefore.add(p);
|
|
1348
|
+
}
|
|
1349
|
+
// OXB-206: attach phase_gates for legacy vitest / playwright suites swept by removal tasks (excluding tests deleted later in the phase)
|
|
1350
|
+
const survivingSweptLegacy = uniq(phaseSweptLegacyTests).filter((f) => !deletedBefore.has(f));
|
|
1351
|
+
const survivingSweptE2e = uniq(phaseSweptE2eSpecs).filter((f) => !deletedBefore.has(f));
|
|
1352
|
+
if (survivingSweptLegacy.length || survivingSweptE2e.length) {
|
|
1353
|
+
const gates = Array.isArray(plan.phase_gates) ? [...plan.phase_gates] : [];
|
|
1354
|
+
const byTasks = uniq(phaseSweepTasks).join(', ');
|
|
1355
|
+
if (survivingSweptLegacy.length && !gates.some((g) => g && g.id === 'legacy-tests')) {
|
|
1356
|
+
gates.push({
|
|
1357
|
+
id: 'legacy-tests',
|
|
1358
|
+
command: `npx vitest run ${survivingSweptLegacy.join(' ')}`,
|
|
1359
|
+
description: `suítes legadas impactadas por remoção (${byTasks})`,
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
if (survivingSweptE2e.length && !gates.some((g) => g && g.id === 'legacy-e2e')) {
|
|
1363
|
+
gates.push({
|
|
1364
|
+
id: 'legacy-e2e',
|
|
1365
|
+
command: `npx playwright test ${survivingSweptE2e.join(' ')}`,
|
|
1366
|
+
description: `suítes e2e impactadas por remoção (${byTasks})`,
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
if (gates.length) plan.phase_gates = gates;
|
|
1370
|
+
}
|
|
1371
|
+
// OXB-202: package.json / lockfile changed → notices gate (+ THIRD_PARTY_NOTICES.md in scope).
|
|
1372
|
+
const noticesGate = ctx.noticesGate === false ? null : injectNoticesGate(root, ref, plan, warnings);
|
|
1373
|
+
// OXB-203: --pair-as-deps — frontend consumers of window.oxe / the IPC mock after the IPC contract tasks.
|
|
1374
|
+
const pairCfg = (() => { try { return (JSON.parse(fs.readFileSync(path.join(root, '.oxe', 'config.json'), 'utf8')).plan || {}); } catch { return {}; } })();
|
|
1375
|
+
const paired = ctx.pairAsDeps || pairCfg.pair_as_deps === true
|
|
1376
|
+
? pairIpcDependencies(root, ref, plan.tasks, { contractFiles: pairCfg.ipc_contract_files, consumerFiles: pairCfg.ipc_consumer_files })
|
|
1377
|
+
: [];
|
|
1378
|
+
for (const p of paired) warnings.push(`${p.task}: passa a depender de ${p.added.join(', ')} (contrato IPC: ${IPC_CONTRACT_FILES.join(', ')}) — --pair-as-deps`);
|
|
1379
|
+
assignWaves(plan.tasks);
|
|
1380
|
+
|
|
1381
|
+
// OXB-194: filter deleted test files out of verify commands (own and transitive dependencies)
|
|
1382
|
+
const allTasksById = new Map(plan.tasks.map((t) => [t.id, t]));
|
|
1383
|
+
for (const t of plan.tasks) {
|
|
1384
|
+
const transitiveDel = transitiveDeletedForTask(t, allTasksById, roleByKey);
|
|
1385
|
+
if (t.verify && Array.isArray(t.verify.commands)) {
|
|
1386
|
+
const filteredCmds = [];
|
|
1387
|
+
for (const cmd of t.verify.commands) {
|
|
1388
|
+
const clean = filterDeletedFromVerifyCommand(cmd, transitiveDel);
|
|
1389
|
+
if (clean) filteredCmds.push(clean);
|
|
1390
|
+
}
|
|
1391
|
+
t.verify.commands = filteredCmds;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
const pack = { schema_version: 1, generated_by: 'oxe-cc plan build', ...(ctx.phase ? { phase: ctx.phase } : {}), tasks: [] };
|
|
1396
|
+
for (const t of plan.tasks) {
|
|
1397
|
+
const tests = (plan.acceptance_tests || []).filter((a) => (t.acceptance || []).includes(a.criterion)).flatMap((a) => a.files || []);
|
|
1398
|
+
const info = packEntry(root, t, roleByKey.get(String(t.rid)) || {}, frozenFiles, tests);
|
|
1399
|
+
errors.push(...kindErrors(t, info));
|
|
1400
|
+
const removed = new Set(info.entry.removed_paths || []);
|
|
1401
|
+
const sweptSet = new Set(info.entry.swept_paths || []);
|
|
1402
|
+
const uncovered = info.exact.filter((p) => CODE_RE.test(p) && !removed.has(p) && !sweptSet.has(p));
|
|
1403
|
+
if (!info.entry.symbols.length && uncovered.length && !['test-only', 'config-only'].includes(info.kind)) warnings.push(`${t.id}: nenhum símbolo saiu dos testes congelados para ${uncovered.slice(0, 3).join(', ')} — declare symbols no pack antes do execute`);
|
|
1404
|
+
pack.tasks.push(info.entry);
|
|
1405
|
+
}
|
|
1406
|
+
if (ctx.phase) plan.phase = ctx.phase;
|
|
1407
|
+
try {
|
|
1408
|
+
const rigor = require('./oxe-test-rigor.cjs');
|
|
1409
|
+
errors.push(
|
|
1410
|
+
...rigor.suspiciousRegexMessages(rigor.suspiciousRegexFindings(root, plan)),
|
|
1411
|
+
...rigor.pausedSocketMessages(rigor.pausedSocketFindings(root, plan)),
|
|
1412
|
+
);
|
|
1413
|
+
} catch { /* */ }
|
|
1414
|
+
// OXB-C1 Adendo 2 (G47): warn and enrich task.notes when an in-scope file is within ~20 lines of its file-size cap.
|
|
1415
|
+
try {
|
|
1416
|
+
const fsg = require('./oxe-file-size-guard.cjs');
|
|
1417
|
+
const annotated = fsg.annotatePlanFileSizeNotes(root, plan, { pack });
|
|
1418
|
+
if (annotated.findings.length) {
|
|
1419
|
+
warnings.push(...fsg.fileSizeHeadroomMessages(annotated.findings).warnings);
|
|
1420
|
+
}
|
|
1421
|
+
} catch { /* */ }
|
|
1422
|
+
// OXB-222-21: annotate empirical/heuristic `suggested_model_hint` + `routing_reason` while preserving any explicit `model_hint`.
|
|
1423
|
+
try {
|
|
1424
|
+
const scorecardMod = require('./oxe-scorecard.cjs');
|
|
1425
|
+
const histEvents = [];
|
|
1426
|
+
const evCandidates = [
|
|
1427
|
+
path.join(root, '.oxe', 'events', 'events.ndjson'),
|
|
1428
|
+
path.join(root, '.oxe', 'OXE-EVENTS.ndjson'),
|
|
1429
|
+
];
|
|
1430
|
+
for (const evFile of evCandidates) {
|
|
1431
|
+
if (!fs.existsSync(evFile)) continue;
|
|
1432
|
+
for (const line of fs.readFileSync(evFile, 'utf8').split(/\r?\n/).filter(Boolean)) {
|
|
1433
|
+
try { histEvents.push(JSON.parse(line)); } catch { /* skip corrupt */ }
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
const routingStats = scorecardMod.computeModelRoutingStats(histEvents);
|
|
1437
|
+
for (const t of plan.tasks) {
|
|
1438
|
+
const suggestion = scorecardMod.suggestModelHint(t, routingStats);
|
|
1439
|
+
t.suggested_model_hint = suggestion.suggested_model_hint;
|
|
1440
|
+
t.routing_reason = suggestion.routing_reason;
|
|
1441
|
+
}
|
|
1442
|
+
} catch { /* sugestão de roteamento auxiliar */ }
|
|
1443
|
+
// OXB-C25: the preflight needs `ready: true`; without it, execute stopped on execution_rationality:not_ready with an
|
|
1444
|
+
// empty gap list while plan lint said ok. The build's own checks decide it.
|
|
1445
|
+
pack.ready = errors.length === 0;
|
|
1446
|
+
pack.critical_gaps = [];
|
|
1447
|
+
return { plan, pack, planMd: renderPlanMd(plan, ctx.phase), errors, warnings, map: res.map, paired, notices_gate: noticesGate };
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
function gitHas(root, ref, p) {
|
|
1451
|
+
const clean = norm(p).replace(/(\/\*\*|\/)+$/, '');
|
|
1452
|
+
return spawnSync('git', ['cat-file', '-e', `${ref}:${clean}`], { cwd: root, windowsHide: true }).status === 0;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
/** OXB-098 / OXB-199: problems of one role file (including 1-hop reverse import closure on deleted paths). */
|
|
1456
|
+
function checkRole(root, doc, options = {}) {
|
|
1457
|
+
const errors = [];
|
|
1458
|
+
const warnings = [];
|
|
1459
|
+
const ref = options.ref || 'HEAD';
|
|
1460
|
+
const ACCEPT_RE = require('./oxe-plan-json.cjs').ACCEPT_RE;
|
|
1461
|
+
const coupledRules = loadCoupledScope(root, options);
|
|
1462
|
+
let importIndex = null;
|
|
1463
|
+
const getImportIndex = () => {
|
|
1464
|
+
if (!importIndex) importIndex = buildImportIndex(root, ref);
|
|
1465
|
+
return importIndex;
|
|
1466
|
+
};
|
|
1467
|
+
const deletedBefore = new Set();
|
|
1468
|
+
// OXB-201: edited/deleted must exist at the ref unless an earlier task creates them; a moved file gets its real path.
|
|
1469
|
+
const staleByIndex = new Map();
|
|
1470
|
+
for (const s of staleRolePaths(root, ref, (doc && doc.tasks) || [])) {
|
|
1471
|
+
if (!staleByIndex.has(s.index)) staleByIndex.set(s.index, []);
|
|
1472
|
+
staleByIndex.get(s.index).push(s);
|
|
1473
|
+
}
|
|
1474
|
+
for (const [i, t] of ((doc && doc.tasks) || []).entries()) {
|
|
1475
|
+
const at = `tasks[${i}]${t && t.rid ? ` (${t.rid})` : ''}`;
|
|
1476
|
+
if (!t || !t.rid) errors.push(`${at}: sem rid`);
|
|
1477
|
+
for (const c of [...(Array.isArray(t.acceptance) ? t.acceptance : []), ...(Array.isArray(t.criteria) ? t.criteria : typeof t.criteria === 'string' ? [t.criteria] : [])]) if (!ACCEPT_RE.test(String(c).trim())) errors.push(`${at}: critério em prosa "${String(c).slice(0, 50)}" — use ids A<n>`);
|
|
1478
|
+
for (const s of staleByIndex.get(i) || []) {
|
|
1479
|
+
if (options.fixStalePaths && s.suggestion) { applyStaleFix(t, s); warnings.push(`${at}: ${s.path} → ${s.suggestion} (corrigido pelo histórico de renames)`); }
|
|
1480
|
+
else errors.push(staleMessage(at, s, ref));
|
|
1481
|
+
}
|
|
1482
|
+
for (const p of rolePathList(t, 'created')) if (gitHas(root, ref, p)) errors.push(`${at}: ${p} já existe em ${ref} (declarado como created — é edited)`);
|
|
1483
|
+
const v = t.verify;
|
|
1484
|
+
const cmds = Array.isArray(v) ? v : v && Array.isArray(v.commands) ? v.commands : typeof v === 'string' ? [v] : [];
|
|
1485
|
+
if (!cmds.length && !['external_delivery', 'verify_only', 'spike'].includes(t.kind)) errors.push(`${at}: sem verify (verify.commands: ["…"])`);
|
|
1486
|
+
for (const c of cmds) if (typeof c !== 'string' || !c.trim() || /\.\.\.|<[^>]+>/.test(c)) errors.push(`${at}: verify "${String(c).slice(0, 60)}" não é um comando executável (placeholder)`);
|
|
1487
|
+
if (t.kind && !KINDS.has(t.kind) && !['external_delivery', 'verify_only', 'spike'].includes(t.kind)) warnings.push(`${at}: kind "${t.kind}" desconhecido (add|remove|move|test-only|config-only)`);
|
|
1488
|
+
|
|
1489
|
+
// OXB-199: check 1-hop reverse importers of newly deleted paths
|
|
1490
|
+
const expandedDeleted = expandRolePaths(root, ref, t && t.deleted).filter((p) => gitHas(root, ref, p));
|
|
1491
|
+
const newlyDeleted = expandedDeleted.filter((p) => !deletedBefore.has(p));
|
|
1492
|
+
if (newlyDeleted.length) {
|
|
1493
|
+
const declaredScope = uniq([
|
|
1494
|
+
...expandRolePaths(root, ref, t.files),
|
|
1495
|
+
...expandRolePaths(root, ref, t.edited),
|
|
1496
|
+
...expandRolePaths(root, ref, t.created),
|
|
1497
|
+
...expandedDeleted,
|
|
1498
|
+
]);
|
|
1499
|
+
const orphans = findOrphanImporters(getImportIndex(), newlyDeleted, declaredScope, deletedBefore);
|
|
1500
|
+
if (orphans.length) {
|
|
1501
|
+
if (options.autoCloseImports) {
|
|
1502
|
+
t.files = uniq([...(t.files || []).map(norm), ...orphans]);
|
|
1503
|
+
} else {
|
|
1504
|
+
errors.push(`${at}: importadores órfãos de caminhos em deleted fora de files/deleted: ${orphans.join(', ')} (adicione a files ou use --auto-close-imports)`);
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
for (const p of expandedDeleted) deletedBefore.add(p);
|
|
1509
|
+
|
|
1510
|
+
if (coupledRules.length) {
|
|
1511
|
+
const coupledMatch = matchedCoupledRules(coupledRules, { files: t.files || [], created: t.created || [], edited: t.edited || [], deleted: t.deleted || [] });
|
|
1512
|
+
const coupled = coupledMatch.included;
|
|
1513
|
+
const declared = uniq([...(t.files || []), ...(t.edited || []), ...(t.created || [])].map(norm));
|
|
1514
|
+
const missing = coupled.filter((f) => !declared.includes(f));
|
|
1515
|
+
const notes = uniq(coupledMatch.matchedRules.map((mr) => mr.note).filter(Boolean));
|
|
1516
|
+
if (missing.length) {
|
|
1517
|
+
warnings.push(`${at}: escopo acoplado recomendado (${missing.join(', ')})${notes.length ? ` — ${notes.join('; ')}` : ''}`);
|
|
1518
|
+
} else {
|
|
1519
|
+
for (const note of notes) warnings.push(`${at}: ${note}`);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
if (t.proves && typeof t.proves === 'object' && !Array.isArray(t.proves)) {
|
|
1523
|
+
for (const [file, titles] of Object.entries(t.proves)) {
|
|
1524
|
+
let text = '';
|
|
1525
|
+
try { text = fs.readFileSync(path.join(root, file), 'utf8'); } catch { errors.push(`${at}: proves cita ${file}, que não existe`); continue; }
|
|
1526
|
+
for (const title of Array.isArray(titles) ? titles : [titles]) {
|
|
1527
|
+
const exact = text.includes(`'${title}'`) || text.includes(`"${title}"`) || text.includes(`\`${title}\``);
|
|
1528
|
+
if (!exact) errors.push(`${at}: o título "${title}" não está em ${file} (proves exige o título exato do it/test)`);
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
try {
|
|
1534
|
+
const rigor = require('./oxe-test-rigor.cjs');
|
|
1535
|
+
const roleTestFiles = [
|
|
1536
|
+
...((doc && Array.isArray(doc.acceptance_tests) ? doc.acceptance_tests : []).flatMap((a) => (a && a.files) || [])),
|
|
1537
|
+
...((doc && Array.isArray(doc.tasks) ? doc.tasks : []).flatMap((t) => (t && t.proves && typeof t.proves === 'object' && !Array.isArray(t.proves) ? Object.keys(t.proves) : []))),
|
|
1538
|
+
];
|
|
1539
|
+
if (roleTestFiles.length) {
|
|
1540
|
+
errors.push(
|
|
1541
|
+
...rigor.suspiciousRegexMessages(rigor.suspiciousRegexFindings(root, roleTestFiles)),
|
|
1542
|
+
...rigor.pausedSocketMessages(rigor.pausedSocketFindings(root, roleTestFiles)),
|
|
1543
|
+
);
|
|
1544
|
+
}
|
|
1545
|
+
} catch { /* */ }
|
|
1546
|
+
return { errors, warnings };
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
module.exports = {
|
|
1550
|
+
isProductCode,
|
|
1551
|
+
build,
|
|
1552
|
+
checkRole,
|
|
1553
|
+
importedSymbols,
|
|
1554
|
+
assignWaves,
|
|
1555
|
+
kindErrors,
|
|
1556
|
+
renderPlanMd,
|
|
1557
|
+
KINDS,
|
|
1558
|
+
inScope,
|
|
1559
|
+
isDirEntry,
|
|
1560
|
+
expandDirEntry,
|
|
1561
|
+
filterDeletedFromVerifyCommand,
|
|
1562
|
+
transitiveDeletedForTask,
|
|
1563
|
+
loadCoupledScope,
|
|
1564
|
+
matchedCoupledRules,
|
|
1565
|
+
applyCoupledScope,
|
|
1566
|
+
injectFrontendDesignLintVerify,
|
|
1567
|
+
buildImportIndex,
|
|
1568
|
+
extractModuleImports,
|
|
1569
|
+
loadPathAliases,
|
|
1570
|
+
resolveModuleSpecifier,
|
|
1571
|
+
findOrphanImporters,
|
|
1572
|
+
findCoupledUnionConsumers,
|
|
1573
|
+
rolePathList,
|
|
1574
|
+
recentRenames,
|
|
1575
|
+
staleRolePaths,
|
|
1576
|
+
injectNoticesGate,
|
|
1577
|
+
pairIpcDependencies,
|
|
1578
|
+
sweepRemovalImpacts,
|
|
1579
|
+
IPC_CONTRACT_FILES,
|
|
1580
|
+
};
|