@kbediako/codex-orchestrator 0.1.37 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +20 -0
- package/README.md +73 -291
- package/bin/codex-orchestrator.js +161 -0
- package/codex.orchestrator.json +149 -13
- package/dist/bin/codex-orchestrator.js +795 -1154
- package/dist/orchestrator/src/cli/adapters/CommandPlanner.js +22 -4
- package/dist/orchestrator/src/cli/adapters/CommandReviewer.js +3 -3
- package/dist/orchestrator/src/cli/adapters/CommandTester.js +2 -2
- package/dist/orchestrator/src/cli/adapters/cloudFailureDiagnostics.js +183 -11
- package/dist/orchestrator/src/cli/coStatusAttachCliShell.js +402 -0
- package/dist/orchestrator/src/cli/coStatusCliShell.js +429 -0
- package/dist/orchestrator/src/cli/coStatusOperatorAutopilotCliShell.js +120 -0
- package/dist/orchestrator/src/cli/codexCliShell.js +72 -0
- package/dist/orchestrator/src/cli/codexDefaultsSetup.js +49 -11
- package/dist/orchestrator/src/cli/config/delegationConfig.js +317 -5
- package/dist/orchestrator/src/cli/config/repoConfigPolicy.js +2 -3
- package/dist/orchestrator/src/cli/config/userConfig.js +28 -13
- package/dist/orchestrator/src/cli/control/authenticatedControlRouteGate.js +69 -0
- package/dist/orchestrator/src/cli/control/authenticatedRouteComposition.js +267 -0
- package/dist/orchestrator/src/cli/control/authenticatedRouteController.js +5 -0
- package/dist/orchestrator/src/cli/control/authenticatedRouteDispatcher.js +41 -0
- package/dist/orchestrator/src/cli/control/compatibilityIssuePresenter.js +1035 -0
- package/dist/orchestrator/src/cli/control/confirmationApproveController.js +62 -0
- package/dist/orchestrator/src/cli/control/confirmationCreateController.js +69 -0
- package/dist/orchestrator/src/cli/control/confirmationIssueConsumeController.js +43 -0
- package/dist/orchestrator/src/cli/control/confirmationListController.js +22 -0
- package/dist/orchestrator/src/cli/control/confirmationValidateController.js +58 -0
- package/dist/orchestrator/src/cli/control/confirmations.js +25 -3
- package/dist/orchestrator/src/cli/control/controlActionCancelConfirmation.js +65 -0
- package/dist/orchestrator/src/cli/control/controlActionController.js +77 -0
- package/dist/orchestrator/src/cli/control/controlActionControllerSequencing.js +161 -0
- package/dist/orchestrator/src/cli/control/controlActionExecution.js +142 -0
- package/dist/orchestrator/src/cli/control/controlActionFinalization.js +43 -0
- package/dist/orchestrator/src/cli/control/controlActionOutcome.js +60 -0
- package/dist/orchestrator/src/cli/control/controlActionPreflight.js +476 -0
- package/dist/orchestrator/src/cli/control/controlAuthenticatedRouteHandoff.js +57 -0
- package/dist/orchestrator/src/cli/control/controlBootstrapAssembly.js +39 -0
- package/dist/orchestrator/src/cli/control/controlBootstrapMetadataPersistence.js +16 -0
- package/dist/orchestrator/src/cli/control/controlEventTransport.js +49 -0
- package/dist/orchestrator/src/cli/control/controlExpiryLifecycle.js +102 -0
- package/dist/orchestrator/src/cli/control/controlHostOwnership.js +480 -0
- package/dist/orchestrator/src/cli/control/controlHostSupervision.js +608 -0
- package/dist/orchestrator/src/cli/control/controlOversightFacade.js +8 -0
- package/dist/orchestrator/src/cli/control/controlOversightReadContract.js +1 -0
- package/dist/orchestrator/src/cli/control/controlOversightReadService.js +16 -0
- package/dist/orchestrator/src/cli/control/controlOversightUpdateContract.js +1 -0
- package/dist/orchestrator/src/cli/control/controlPersistenceFiles.js +6 -0
- package/dist/orchestrator/src/cli/control/controlQuestionChildResolution.js +18 -0
- package/dist/orchestrator/src/cli/control/controlRequestContext.js +42 -0
- package/dist/orchestrator/src/cli/control/controlRequestController.js +9 -0
- package/dist/orchestrator/src/cli/control/controlRequestPredispatch.js +17 -0
- package/dist/orchestrator/src/cli/control/controlRequestRouteDispatch.js +44 -0
- package/dist/orchestrator/src/cli/control/controlRuntime.js +992 -0
- package/dist/orchestrator/src/cli/control/controlServer.js +23 -1456
- package/dist/orchestrator/src/cli/control/controlServerAuditAndErrorHelpers.js +115 -0
- package/dist/orchestrator/src/cli/control/controlServerAuthenticatedRouteBranch.js +29 -0
- package/dist/orchestrator/src/cli/control/controlServerBootstrapLifecycle.js +30 -0
- package/dist/orchestrator/src/cli/control/controlServerBootstrapStartSequence.js +21 -0
- package/dist/orchestrator/src/cli/control/controlServerOwnedRuntimeLifecycle.js +67 -0
- package/dist/orchestrator/src/cli/control/controlServerPublicLifecycle.js +756 -0
- package/dist/orchestrator/src/cli/control/controlServerPublicRouteHelpers.js +86 -0
- package/dist/orchestrator/src/cli/control/controlServerReadyInstanceLifecycle.js +25 -0
- package/dist/orchestrator/src/cli/control/controlServerReadyInstanceStartup.js +18 -0
- package/dist/orchestrator/src/cli/control/controlServerRequestBodyHelpers.js +37 -0
- package/dist/orchestrator/src/cli/control/controlServerRequestShell.js +40 -0
- package/dist/orchestrator/src/cli/control/controlServerRequestShellBinding.js +17 -0
- package/dist/orchestrator/src/cli/control/controlServerSeedLoading.js +27 -0
- package/dist/orchestrator/src/cli/control/controlServerSeededRuntimeAssembly.js +186 -0
- package/dist/orchestrator/src/cli/control/controlServerStartupInputPreparation.js +31 -0
- package/dist/orchestrator/src/cli/control/controlServerStartupSequence.js +49 -0
- package/dist/orchestrator/src/cli/control/controlState.js +233 -2
- package/dist/orchestrator/src/cli/control/controlStatusDashboard.js +1899 -0
- package/dist/orchestrator/src/cli/control/controlTelegramBridgeBootstrapLifecycle.js +22 -0
- package/dist/orchestrator/src/cli/control/controlTelegramBridgeLifecycle.js +67 -0
- package/dist/orchestrator/src/cli/control/controlTelegramBridgeOversightFacadeFactory.js +8 -0
- package/dist/orchestrator/src/cli/control/controlTelegramCommandController.js +49 -0
- package/dist/orchestrator/src/cli/control/controlTelegramDispatchRead.js +40 -0
- package/dist/orchestrator/src/cli/control/controlTelegramPollingController.js +89 -0
- package/dist/orchestrator/src/cli/control/controlTelegramProjectionNotificationController.js +29 -0
- package/dist/orchestrator/src/cli/control/controlTelegramPushState.js +63 -0
- package/dist/orchestrator/src/cli/control/controlTelegramQuestionRead.js +13 -0
- package/dist/orchestrator/src/cli/control/controlTelegramReadController.js +216 -0
- package/dist/orchestrator/src/cli/control/controlTelegramUpdateHandler.js +63 -0
- package/dist/orchestrator/src/cli/control/controlWatcher.js +73 -5
- package/dist/orchestrator/src/cli/control/delegationRegisterController.js +35 -0
- package/dist/orchestrator/src/cli/control/dynamicToolBridgePolicy.js +139 -0
- package/dist/orchestrator/src/cli/control/eventsSseController.js +12 -0
- package/dist/orchestrator/src/cli/control/linearBudgetState.js +1789 -0
- package/dist/orchestrator/src/cli/control/linearDispatchSource.js +1137 -0
- package/dist/orchestrator/src/cli/control/linearGraphqlClient.js +150 -0
- package/dist/orchestrator/src/cli/control/linearRateLimit.js +102 -0
- package/dist/orchestrator/src/cli/control/linearWebhookController.js +499 -0
- package/dist/orchestrator/src/cli/control/liveLinearAdvisoryRuntime.js +70 -0
- package/dist/orchestrator/src/cli/control/observabilityApiController.js +173 -0
- package/dist/orchestrator/src/cli/control/observabilityReadModel.js +500 -0
- package/dist/orchestrator/src/cli/control/observabilitySurface.js +284 -0
- package/dist/orchestrator/src/cli/control/observabilityUpdateNotifier.js +22 -0
- package/dist/orchestrator/src/cli/control/operatorDashboardPresenter.js +252 -0
- package/dist/orchestrator/src/cli/control/providerAgentCapacity.js +70 -0
- package/dist/orchestrator/src/cli/control/providerControlHostFreshnessGauge.js +1068 -0
- package/dist/orchestrator/src/cli/control/providerIntakeState.js +473 -0
- package/dist/orchestrator/src/cli/control/providerIssueHandoff.js +6811 -0
- package/dist/orchestrator/src/cli/control/providerIssueObservability.js +1348 -0
- package/dist/orchestrator/src/cli/control/providerIssueRetryQueue.js +84 -0
- package/dist/orchestrator/src/cli/control/providerLinearRuntimeProof.js +588 -0
- package/dist/orchestrator/src/cli/control/providerLinearScreenshotProof.js +473 -0
- package/dist/orchestrator/src/cli/control/providerLinearWorkerTruth.js +383 -0
- package/dist/orchestrator/src/cli/control/providerLinearWorkflowAudit.js +254 -0
- package/dist/orchestrator/src/cli/control/providerLinearWorkflowFacade.js +5573 -0
- package/dist/orchestrator/src/cli/control/providerLinearWorkflowStates.js +115 -0
- package/dist/orchestrator/src/cli/control/providerMergeCloseout.js +1868 -0
- package/dist/orchestrator/src/cli/control/providerOperatorAutopilot.js +1580 -0
- package/dist/orchestrator/src/cli/control/providerOperatorAutopilotLifecycle.js +154 -0
- package/dist/orchestrator/src/cli/control/providerOperatorAutopilotLocalRolloutExecution.js +1006 -0
- package/dist/orchestrator/src/cli/control/providerPollingHealth.js +435 -0
- package/dist/orchestrator/src/cli/control/providerTerminalCleanup.js +516 -0
- package/dist/orchestrator/src/cli/control/providerWorkerHosts.js +191 -0
- package/dist/orchestrator/src/cli/control/providerWorkflowConfigStore.js +515 -0
- package/dist/orchestrator/src/cli/control/questionChildResolutionAdapter.js +361 -0
- package/dist/orchestrator/src/cli/control/questionQueueController.js +181 -0
- package/dist/orchestrator/src/cli/control/questionReadRetryDeduplication.js +9 -0
- package/dist/orchestrator/src/cli/control/questionReadSequence.js +10 -0
- package/dist/orchestrator/src/cli/control/securityViolationController.js +27 -0
- package/dist/orchestrator/src/cli/control/selectedRunProjection.js +1838 -0
- package/dist/orchestrator/src/cli/control/telegramOversightApiClient.js +48 -0
- package/dist/orchestrator/src/cli/control/telegramOversightBridge.js +180 -0
- package/dist/orchestrator/src/cli/control/telegramOversightBridgeProjectionDeliveryQueue.js +25 -0
- package/dist/orchestrator/src/cli/control/telegramOversightBridgeRuntimeLifecycle.js +45 -0
- package/dist/orchestrator/src/cli/control/telegramOversightBridgeStateStore.js +77 -0
- package/dist/orchestrator/src/cli/control/telegramOversightControlActionApiClient.js +45 -0
- package/dist/orchestrator/src/cli/control/trackerDispatchPilot.js +439 -0
- package/dist/orchestrator/src/cli/control/uiDataController.js +34 -0
- package/dist/orchestrator/src/cli/control/uiSessionController.js +100 -0
- package/dist/orchestrator/src/cli/controlHostCliShell.js +860 -0
- package/dist/orchestrator/src/cli/controlHostFreshnessGaugeCliShell.js +129 -0
- package/dist/orchestrator/src/cli/controlHostSupervisionCliShell.js +2127 -0
- package/dist/orchestrator/src/cli/delegationCliShell.js +62 -0
- package/dist/orchestrator/src/cli/delegationServer.js +567 -678
- package/dist/orchestrator/src/cli/delegationServerCliShell.js +52 -0
- package/dist/orchestrator/src/cli/delegationServerQuestionFlowShell.js +228 -0
- package/dist/orchestrator/src/cli/delegationServerToolDispatchShell.js +411 -0
- package/dist/orchestrator/src/cli/delegationServerTransport.js +274 -0
- package/dist/orchestrator/src/cli/delegationSetup.js +51 -171
- package/dist/orchestrator/src/cli/devtoolsCliShell.js +34 -0
- package/dist/orchestrator/src/cli/doctor.js +542 -122
- package/dist/orchestrator/src/cli/doctorCliRequestShell.js +72 -0
- package/dist/orchestrator/src/cli/doctorCliShell.js +138 -0
- package/dist/orchestrator/src/cli/doctorUsage.js +136 -16
- package/dist/orchestrator/src/cli/exec/experience.js +16 -2
- package/dist/orchestrator/src/cli/exec/summary.js +3 -0
- package/dist/orchestrator/src/cli/execCliShell.js +51 -0
- package/dist/orchestrator/src/cli/flowCliRequestShell.js +44 -0
- package/dist/orchestrator/src/cli/flowCliShell.js +239 -0
- package/dist/orchestrator/src/cli/frontendTestCliRequestShell.js +80 -0
- package/dist/orchestrator/src/cli/frontendTestCliShell.js +41 -0
- package/dist/orchestrator/src/cli/init.js +1 -0
- package/dist/orchestrator/src/cli/initCliShell.js +50 -0
- package/dist/orchestrator/src/cli/linearCliShell.js +1200 -0
- package/dist/orchestrator/src/cli/mcpEnableCliShell.js +132 -0
- package/dist/orchestrator/src/cli/metrics/metricsAggregator.js +3 -2
- package/dist/orchestrator/src/cli/metrics/metricsRecorder.js +56 -0
- package/dist/orchestrator/src/cli/orchestrator.js +66 -1376
- package/dist/orchestrator/src/cli/planCliShell.js +19 -0
- package/dist/orchestrator/src/cli/prCliShell.js +41 -0
- package/dist/orchestrator/src/cli/providerLinearChildLanePhaseContract.js +204 -0
- package/dist/orchestrator/src/cli/providerLinearChildLaneRunner.js +1772 -0
- package/dist/orchestrator/src/cli/providerLinearChildLaneShell.js +2420 -0
- package/dist/orchestrator/src/cli/providerLinearChildStreamShell.js +385 -0
- package/dist/orchestrator/src/cli/providerLinearWorkerRunner.js +5738 -0
- package/dist/orchestrator/src/cli/resumeCliShell.js +14 -0
- package/dist/orchestrator/src/cli/reviewCliLaunchShell.js +72 -0
- package/dist/orchestrator/src/cli/rlm/alignment.js +3 -3
- package/dist/orchestrator/src/cli/rlm/context.js +94 -7
- package/dist/orchestrator/src/cli/rlm/rlmCodexRuntimeShell.js +546 -0
- package/dist/orchestrator/src/cli/rlm/symbolic.js +4 -2
- package/dist/orchestrator/src/cli/rlmCliRequestShell.js +42 -0
- package/dist/orchestrator/src/cli/rlmCompletionCliShell.js +46 -0
- package/dist/orchestrator/src/cli/rlmLaunchCliShell.js +51 -0
- package/dist/orchestrator/src/cli/rlmRunner.js +83 -523
- package/dist/orchestrator/src/cli/run/blockMemory.js +500 -0
- package/dist/orchestrator/src/cli/run/manifest.js +410 -73
- package/dist/orchestrator/src/cli/run/manifestPersister.js +45 -14
- package/dist/orchestrator/src/cli/run/runMemoryController.js +216 -0
- package/dist/orchestrator/src/cli/run/source0.js +690 -0
- package/dist/orchestrator/src/cli/run/workspacePath.js +101 -0
- package/dist/orchestrator/src/cli/runtime/mode.js +2 -1
- package/dist/orchestrator/src/cli/runtime/provider.js +39 -2
- package/dist/orchestrator/src/cli/selfCheckCliShell.js +12 -0
- package/dist/orchestrator/src/cli/services/commandRunner.js +668 -18
- package/dist/orchestrator/src/cli/services/execRuntime.js +66 -1
- package/dist/orchestrator/src/cli/services/orchestratorAutoScoutEvidenceRecorder.js +71 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudBranchResolution.js +8 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudEnvironmentResolution.js +22 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudExecutionLifecycleShell.js +39 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudPromptBuilder.js +37 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudRouteFallbackContract.js +45 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudRouteShell.js +36 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudTargetExecutor.js +277 -0
- package/dist/orchestrator/src/cli/services/orchestratorControlPlaneLifecycle.js +98 -0
- package/dist/orchestrator/src/cli/services/orchestratorControlPlaneLifecycleShell.js +54 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionLifecycle.js +112 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionModePolicy.js +27 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteAdapterShell.js +59 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteDecisionShell.js +57 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteState.js +21 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionRouter.js +2 -0
- package/dist/orchestrator/src/cli/services/orchestratorLocalPipelineExecutor.js +149 -0
- package/dist/orchestrator/src/cli/services/orchestratorLocalRouteShell.js +63 -0
- package/dist/orchestrator/src/cli/services/orchestratorPlanShell.js +54 -0
- package/dist/orchestrator/src/cli/services/orchestratorPlanTargetTracker.js +16 -0
- package/dist/orchestrator/src/cli/services/orchestratorResumePreparationShell.js +84 -0
- package/dist/orchestrator/src/cli/services/orchestratorResumeTokenValidation.js +15 -0
- package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleCompletion.js +31 -0
- package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleExecutionRegistration.js +37 -0
- package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleOrchestrationShell.js +83 -0
- package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleTaskManagerShell.js +37 -0
- package/dist/orchestrator/src/cli/services/orchestratorRuntimeManifestMutation.js +20 -0
- package/dist/orchestrator/src/cli/services/orchestratorStartPreparationShell.js +56 -0
- package/dist/orchestrator/src/cli/services/orchestratorStatusShell.js +70 -0
- package/dist/orchestrator/src/cli/services/pipelineResolver.js +7 -3
- package/dist/orchestrator/src/cli/services/plannerMemory.js +119 -0
- package/dist/orchestrator/src/cli/services/runPreparation.js +7 -3
- package/dist/orchestrator/src/cli/services/runSummaryWriter.js +9 -0
- package/dist/orchestrator/src/cli/setupBootstrapShell.js +114 -0
- package/dist/orchestrator/src/cli/setupCliShell.js +51 -0
- package/dist/orchestrator/src/cli/skillsCliShell.js +56 -0
- package/dist/orchestrator/src/cli/startCliRequestShell.js +53 -0
- package/dist/orchestrator/src/cli/startCliShell.js +68 -0
- package/dist/orchestrator/src/cli/statusCliShell.js +22 -0
- package/dist/orchestrator/src/cli/utils/authProvenanceFingerprint.js +27 -0
- package/dist/orchestrator/src/cli/utils/cloudPreflight.js +83 -1
- package/dist/orchestrator/src/cli/utils/delegationConfigParser.js +250 -0
- package/dist/orchestrator/src/cli/utils/delegationMcpHealth.js +1382 -0
- package/dist/orchestrator/src/cli/utils/devtools.js +2 -54
- package/dist/orchestrator/src/cli/utils/mcpServerEntry.js +53 -0
- package/dist/orchestrator/src/cli/utils/packageProgramResolver.js +151 -0
- package/dist/orchestrator/src/cli/utils/providerOverrideEnv.js +71 -0
- package/dist/orchestrator/src/cli/utils/trailingJsonObject.js +59 -0
- package/dist/orchestrator/src/learning/crystalizer.js +2 -2
- package/dist/orchestrator/src/persistence/ExperienceStore.js +233 -49
- package/dist/orchestrator/src/persistence/TaskStateStore.js +6 -6
- package/dist/orchestrator/src/persistence/lockFile.js +70 -4
- package/dist/orchestrator/src/persistence/sanitizeIdentifier.js +39 -0
- package/dist/orchestrator/src/sync/createCloudSyncWorker.js +3 -2
- package/dist/orchestrator/src/utils/atomicWrite.js +17 -2
- package/dist/packages/orchestrator/src/exec/unified-exec.js +99 -6
- package/dist/packages/orchestrator/src/instructions/promptPacks.js +150 -19
- package/dist/packages/sdk-node/src/orchestrator.js +137 -13
- package/dist/packages/shared/config/designConfig.js +8 -1
- package/dist/packages/shared/streams/stdio.js +1 -1
- package/dist/scripts/design/pipeline/permit.js +15 -0
- package/dist/scripts/lib/docs-catalog.js +365 -0
- package/dist/scripts/lib/docs-helpers.js +87 -5
- package/dist/scripts/lib/pr-watch-merge.js +1088 -80
- package/dist/scripts/lib/provider-run-contract.js +26 -0
- package/dist/scripts/lib/review-command-intent-classification.js +532 -0
- package/dist/scripts/lib/review-command-probe-classification.js +385 -0
- package/dist/scripts/lib/review-execution-boundary-preflight.js +279 -0
- package/dist/scripts/lib/review-execution-runtime.js +753 -0
- package/dist/scripts/lib/review-execution-state.js +1144 -0
- package/dist/scripts/lib/review-execution-telemetry.js +215 -0
- package/dist/scripts/lib/review-inspection-target-parsing.js +78 -0
- package/dist/scripts/lib/review-launch-attempt.js +601 -0
- package/dist/scripts/lib/review-meta-surface-boundary-analysis.js +300 -0
- package/dist/scripts/lib/review-meta-surface-normalization.js +746 -0
- package/dist/scripts/lib/review-non-interactive-handoff.js +61 -0
- package/dist/scripts/lib/review-prompt-context.js +376 -0
- package/dist/scripts/lib/review-scope-advisory.js +286 -0
- package/dist/scripts/lib/review-scope-paths.js +123 -0
- package/dist/scripts/lib/review-shell-command-parser.js +389 -0
- package/dist/scripts/lib/review-shell-env-interpreter.js +340 -0
- package/dist/scripts/lib/run-manifests.js +192 -36
- package/dist/scripts/lib/spark-policy-classifier.js +593 -0
- package/dist/scripts/run-review.js +507 -1777
- package/docs/public/downstream-setup.md +106 -0
- package/docs/public/provider-onboarding.md +173 -0
- package/package.json +30 -11
- package/plugins/codex-orchestrator/.codex-plugin/plugin.json +30 -0
- package/plugins/codex-orchestrator/.mcp.json +13 -0
- package/plugins/codex-orchestrator/launcher.mjs +359 -0
- package/schemas/manifest.json +395 -0
- package/skills/chrome-devtools/SKILL.md +1 -1
- package/skills/codex-orchestrator/SKILL.md +83 -0
- package/skills/collab-subagents-first/SKILL.md +2 -1
- package/skills/delegation-usage/DELEGATION_GUIDE.md +24 -11
- package/skills/delegation-usage/SKILL.md +20 -13
- package/skills/land/SKILL.md +77 -0
- package/skills/linear/SKILL.md +255 -0
- package/skills/release/SKILL.md +47 -3
- package/skills/standalone-review/SKILL.md +6 -1
- package/templates/README.md +4 -2
- package/templates/codex/.codex/agents/awaiter-high.toml +2 -2
- package/templates/codex/.codex/agents/explorer-fast.toml +1 -0
- package/templates/codex/.codex/agents/worker-complex.toml +1 -1
- package/templates/codex/.codex/config.toml +3 -4
- package/templates/codex/.codex/providers/README.md +13 -0
- package/templates/codex/.codex/providers/control.example.json +18 -0
- package/templates/codex/.codex/providers/provider.env.example +15 -0
- package/templates/codex/AGENTS.md +12 -7
- package/templates/codex/mcp-client.json +5 -1
- package/docs/README.md +0 -307
- package/docs/assets/setup.gif +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const PROVIDER_LAUNCH_SOURCE_ENV = 'CODEX_ORCHESTRATOR_PROVIDER_LAUNCH_SOURCE';
|
|
2
|
+
export const PROVIDER_LAUNCH_TOKEN_ENV = 'CODEX_ORCHESTRATOR_PROVIDER_LAUNCH_TOKEN';
|
|
3
|
+
export const PROVIDER_CONTROL_HOST_TASK_ID_ENV = 'CODEX_ORCHESTRATOR_PROVIDER_CONTROL_HOST_TASK_ID';
|
|
4
|
+
export const PROVIDER_CONTROL_HOST_RUN_ID_ENV = 'CODEX_ORCHESTRATOR_PROVIDER_CONTROL_HOST_RUN_ID';
|
|
5
|
+
export const PROVIDER_LAUNCH_SOURCE_CONTROL_HOST = 'control-host';
|
|
6
|
+
function readNonEmptyString(record, key) {
|
|
7
|
+
const value = record?.[key];
|
|
8
|
+
if (typeof value !== 'string') {
|
|
9
|
+
return '';
|
|
10
|
+
}
|
|
11
|
+
const trimmed = value.trim();
|
|
12
|
+
return trimmed.length > 0 ? trimmed : '';
|
|
13
|
+
}
|
|
14
|
+
export function readProviderControlHostLocatorFromEnv(env) {
|
|
15
|
+
const launchSource = readNonEmptyString(env, PROVIDER_LAUNCH_SOURCE_ENV);
|
|
16
|
+
const taskId = readNonEmptyString(env, PROVIDER_CONTROL_HOST_TASK_ID_ENV);
|
|
17
|
+
const runId = readNonEmptyString(env, PROVIDER_CONTROL_HOST_RUN_ID_ENV);
|
|
18
|
+
return launchSource === PROVIDER_LAUNCH_SOURCE_CONTROL_HOST && taskId && runId
|
|
19
|
+
? { taskId, runId }
|
|
20
|
+
: null;
|
|
21
|
+
}
|
|
22
|
+
export function readProviderControlHostLocatorFromManifest(record) {
|
|
23
|
+
const taskId = readNonEmptyString(record, 'provider_control_host_task_id');
|
|
24
|
+
const runId = readNonEmptyString(record, 'provider_control_host_run_id');
|
|
25
|
+
return taskId && runId ? { taskId, runId } : null;
|
|
26
|
+
}
|
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
import { extractShellCommandPayload, normalizeCommandToken, normalizeShellCommandPathSeparators, splitShellControlSegments, stripLeadingEnvAssignments, tokenizeShellSegment, unwrapEnvCommandTokens } from './review-shell-command-parser.js';
|
|
2
|
+
import { REVIEW_HEAVY_SCRIPT_TARGETS, resolvePackageScriptTarget } from './review-command-probe-classification.js';
|
|
3
|
+
const REVIEW_NON_BOUNDARY_HEAVY_SCRIPT_TARGETS = new Set(['typecheck', 'check']);
|
|
4
|
+
const REVIEW_VALIDATION_SUITE_SCRIPT_TARGETS = new Set([...REVIEW_HEAVY_SCRIPT_TARGETS].filter((target) => !REVIEW_NON_BOUNDARY_HEAVY_SCRIPT_TARGETS.has(target)));
|
|
5
|
+
const REVIEW_COMMAND_INTENT_DELEGATION_TOOL_LINE_RE = /^tool\s+delegation\.delegate\.(?:spawn|pause|cancel)\(/iu;
|
|
6
|
+
const REVIEW_DIRECT_VALIDATION_RUNNERS = new Set(['vitest', 'jest', 'pytest']);
|
|
7
|
+
const NODE_OPTION_VALUE_FLAGS = new Set([
|
|
8
|
+
'-C',
|
|
9
|
+
'-r',
|
|
10
|
+
'--conditions',
|
|
11
|
+
'--debug-port',
|
|
12
|
+
'--inspect-port',
|
|
13
|
+
'--require',
|
|
14
|
+
'--import',
|
|
15
|
+
'--loader',
|
|
16
|
+
'--experimental-loader',
|
|
17
|
+
'--input-type',
|
|
18
|
+
'--env-file',
|
|
19
|
+
'--env-file-if-exists',
|
|
20
|
+
'--title',
|
|
21
|
+
'--watch-kill-signal',
|
|
22
|
+
'--watch-path'
|
|
23
|
+
]);
|
|
24
|
+
const NODE_NON_SCRIPT_EXECUTION_FLAGS = new Set(['-e', '--eval', '-p', '--print', '-c', '--check']);
|
|
25
|
+
const NODE_RUNTIME_SCRIPT_FLAGS = new Set(['--run']);
|
|
26
|
+
const PYTHON_OPTION_VALUE_FLAGS = new Set(['-W', '-X', '--check-hash-based-pycs']);
|
|
27
|
+
const REVIEW_HELP_REQUEST_OPTION_VALUE_FLAGS = new Set([
|
|
28
|
+
'-c',
|
|
29
|
+
'-C',
|
|
30
|
+
'--ask-for-approval',
|
|
31
|
+
'--base',
|
|
32
|
+
'--cd',
|
|
33
|
+
'--commit',
|
|
34
|
+
'--config',
|
|
35
|
+
'--config-file',
|
|
36
|
+
'--cwd',
|
|
37
|
+
'--manifest',
|
|
38
|
+
'--model',
|
|
39
|
+
'--profile',
|
|
40
|
+
'--reasoning-effort',
|
|
41
|
+
'--runtime-mode',
|
|
42
|
+
'--runs-dir',
|
|
43
|
+
'--surface',
|
|
44
|
+
'--task',
|
|
45
|
+
'--title'
|
|
46
|
+
]);
|
|
47
|
+
const REVIEW_PACKAGE_RUN_SUBCOMMAND_ALIASES = new Set(['run', 'run-script', 'rum', 'urn']);
|
|
48
|
+
const REVIEW_PACKAGE_OPTION_VALUE_FLAGS = new Set(['--prefix', '--workspace', '--filter', '--cwd', '-C', '-w']);
|
|
49
|
+
function normalizeReviewCommandLine(line) {
|
|
50
|
+
const trimmed = line.trim();
|
|
51
|
+
if (!trimmed) {
|
|
52
|
+
return '';
|
|
53
|
+
}
|
|
54
|
+
const succeededIndex = trimmed.indexOf(' succeeded in ');
|
|
55
|
+
if (succeededIndex >= 0) {
|
|
56
|
+
return trimmed.slice(0, succeededIndex).trimEnd();
|
|
57
|
+
}
|
|
58
|
+
const exitedIndex = trimmed.indexOf(' exited ');
|
|
59
|
+
if (exitedIndex >= 0) {
|
|
60
|
+
return trimmed.slice(0, exitedIndex).trimEnd();
|
|
61
|
+
}
|
|
62
|
+
return trimmed;
|
|
63
|
+
}
|
|
64
|
+
export function classifyCommandIntentToolLine(line) {
|
|
65
|
+
if (REVIEW_COMMAND_INTENT_DELEGATION_TOOL_LINE_RE.test(line)) {
|
|
66
|
+
return {
|
|
67
|
+
kind: 'delegation-control',
|
|
68
|
+
sample: line.trim()
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
export function classifyCommandIntentCommandLine(commandLine, options) {
|
|
74
|
+
const normalized = normalizeShellCommandPathSeparators(normalizeReviewCommandLine(commandLine));
|
|
75
|
+
const segments = splitShellControlSegments(normalized);
|
|
76
|
+
for (const segment of segments) {
|
|
77
|
+
const violation = classifyCommandIntentSegment(segment, options, 0);
|
|
78
|
+
if (violation) {
|
|
79
|
+
return violation;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
function classifyCommandIntentSegment(segment, options, depth) {
|
|
85
|
+
const strippedTokens = stripLeadingEnvAssignments(tokenizeShellSegment(segment));
|
|
86
|
+
if (strippedTokens.length === 0) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
const tokens = unwrapEnvCommandTokens(strippedTokens);
|
|
90
|
+
if (tokens.length === 0) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
if (depth < 3) {
|
|
94
|
+
const payload = extractShellCommandPayload(tokens);
|
|
95
|
+
if (payload) {
|
|
96
|
+
const nestedSegments = splitShellControlSegments(normalizeShellCommandPathSeparators(payload));
|
|
97
|
+
for (const nestedSegment of nestedSegments) {
|
|
98
|
+
const nestedViolation = classifyCommandIntentSegment(nestedSegment, options, depth + 1);
|
|
99
|
+
if (nestedViolation) {
|
|
100
|
+
return nestedViolation;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const command = normalizeCommandToken(tokens[0] ?? '');
|
|
106
|
+
const args = tokens.slice(1);
|
|
107
|
+
if (isReviewOrchestrationCommand(command, args)) {
|
|
108
|
+
return {
|
|
109
|
+
kind: 'review-orchestration',
|
|
110
|
+
sample: segment.trim()
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (!options.allowValidationCommandIntents &&
|
|
114
|
+
isPackageManagerValidationSuiteCommand(command, args)) {
|
|
115
|
+
return {
|
|
116
|
+
kind: 'validation-suite',
|
|
117
|
+
sample: segment.trim()
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (!options.allowValidationCommandIntents && isDirectValidationRunnerCommand(command, args)) {
|
|
121
|
+
return {
|
|
122
|
+
kind: 'validation-runner',
|
|
123
|
+
sample: segment.trim()
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
export function isReviewOrchestrationCommand(command, args) {
|
|
129
|
+
if (command === 'npm' || command === 'pnpm' || command === 'yarn' || command === 'bun') {
|
|
130
|
+
const reviewScriptArgs = resolvePackageReviewScriptArgs(args);
|
|
131
|
+
return reviewScriptArgs !== null && !hasCliHelpRequest(reviewScriptArgs);
|
|
132
|
+
}
|
|
133
|
+
const firstArg = normalizeCommandToken(args[0] ?? '');
|
|
134
|
+
const startPipelineIndex = firstArg === 'start' ? findStartReviewPipelineArgIndex(args) : null;
|
|
135
|
+
if (command === 'codex-orchestrator') {
|
|
136
|
+
if ((firstArg === 'review' && hasCliHelpRequest(args.slice(1))) ||
|
|
137
|
+
(startPipelineIndex !== null &&
|
|
138
|
+
(hasCliHelpRequest(args.slice(1, startPipelineIndex)) ||
|
|
139
|
+
hasCliHelpRequest(args.slice(startPipelineIndex + 1))))) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return firstArg === 'review' || startPipelineIndex !== null;
|
|
143
|
+
}
|
|
144
|
+
if (command === 'codex') {
|
|
145
|
+
return firstArg === 'review' && !hasCliHelpRequest(args.slice(1));
|
|
146
|
+
}
|
|
147
|
+
if (command === 'node') {
|
|
148
|
+
const runtimeScriptTarget = resolveNodeRuntimeScriptTarget(args);
|
|
149
|
+
if (runtimeScriptTarget === 'review') {
|
|
150
|
+
return !hasCliHelpRequest(args);
|
|
151
|
+
}
|
|
152
|
+
const entryScript = resolveNodeEntryScriptToken(args);
|
|
153
|
+
return (entryScript !== null &&
|
|
154
|
+
isReviewRunnerScriptToken(entryScript) &&
|
|
155
|
+
!hasCliHelpRequest(args));
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
function isReviewPipelineTarget(target) {
|
|
160
|
+
return target === 'docs-review' || target === 'implementation-gate' || target === 'diagnostics';
|
|
161
|
+
}
|
|
162
|
+
const CLI_BOOLEAN_FLAG_KEYS = new Set([
|
|
163
|
+
'apply',
|
|
164
|
+
'auto-issue-log',
|
|
165
|
+
'blocked-by-source',
|
|
166
|
+
'cloud',
|
|
167
|
+
'cloud-preflight',
|
|
168
|
+
'codex-cli',
|
|
169
|
+
'codex-force',
|
|
170
|
+
'collab',
|
|
171
|
+
'devtools',
|
|
172
|
+
'dry-run',
|
|
173
|
+
'force',
|
|
174
|
+
'help',
|
|
175
|
+
'interactive',
|
|
176
|
+
'issue-log',
|
|
177
|
+
'multi-agent',
|
|
178
|
+
'no-interactive',
|
|
179
|
+
'repo-config-required',
|
|
180
|
+
'refresh-skills',
|
|
181
|
+
'ui',
|
|
182
|
+
'usage',
|
|
183
|
+
'watch',
|
|
184
|
+
'yes'
|
|
185
|
+
]);
|
|
186
|
+
function findStartReviewPipelineArgIndex(args) {
|
|
187
|
+
for (let index = 1; index < args.length; index += 1) {
|
|
188
|
+
const token = args[index] ?? '';
|
|
189
|
+
if (token === '--') {
|
|
190
|
+
const next = args[index + 1] ?? '';
|
|
191
|
+
return isReviewPipelineTarget(normalizeCommandToken(next)) ? index + 1 : null;
|
|
192
|
+
}
|
|
193
|
+
if (!token.startsWith('--')) {
|
|
194
|
+
return isReviewPipelineTarget(normalizeCommandToken(token)) ? index : null;
|
|
195
|
+
}
|
|
196
|
+
const key = token.slice(2);
|
|
197
|
+
if (key.includes('=') || CLI_BOOLEAN_FLAG_KEYS.has(key)) {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const next = args[index + 1];
|
|
201
|
+
if (next && !next.startsWith('--')) {
|
|
202
|
+
index += 1;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
function hasCliHelpRequest(tokens, options = {}) {
|
|
208
|
+
const positionals = [];
|
|
209
|
+
let sawNonBareHelpToken = false;
|
|
210
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
211
|
+
const token = tokens[index] ?? '';
|
|
212
|
+
const optionName = normalizeCliOptionName(token);
|
|
213
|
+
if (optionName === '--') {
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
if (optionName === '--help' || optionName === '-h') {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
if (token.startsWith('-')) {
|
|
220
|
+
if (REVIEW_HELP_REQUEST_OPTION_VALUE_FLAGS.has(optionName) &&
|
|
221
|
+
!hasInlineOptionValue(token) &&
|
|
222
|
+
tokens[index + 1]) {
|
|
223
|
+
index += 1;
|
|
224
|
+
}
|
|
225
|
+
sawNonBareHelpToken = true;
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
const positional = normalizeCommandToken(token);
|
|
229
|
+
positionals.push(positional);
|
|
230
|
+
if (positional !== 'help') {
|
|
231
|
+
sawNonBareHelpToken = true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return Boolean(options.allowBareHelp && !sawNonBareHelpToken && positionals.length === 1 && positionals[0] === 'help');
|
|
235
|
+
}
|
|
236
|
+
function resolvePackageReviewScriptArgs(args) {
|
|
237
|
+
let index = 0;
|
|
238
|
+
while (index < args.length) {
|
|
239
|
+
const token = args[index] ?? '';
|
|
240
|
+
const normalized = normalizeCommandToken(token);
|
|
241
|
+
if (normalized === '--') {
|
|
242
|
+
const target = normalizeCommandToken(args[index + 1] ?? '');
|
|
243
|
+
return target === 'review' ? stripPackageRunSeparator(args.slice(index + 2)) : null;
|
|
244
|
+
}
|
|
245
|
+
if (REVIEW_PACKAGE_RUN_SUBCOMMAND_ALIASES.has(normalized)) {
|
|
246
|
+
index += 1;
|
|
247
|
+
while (index < args.length) {
|
|
248
|
+
const candidate = args[index] ?? '';
|
|
249
|
+
const candidateNormalized = normalizeCommandToken(candidate);
|
|
250
|
+
if (candidateNormalized === '--') {
|
|
251
|
+
index += 1;
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (candidate.startsWith('-')) {
|
|
255
|
+
index += packageReviewOptionConsumesValue(candidate) && !hasInlineOptionValue(candidate) ? 2 : 1;
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
return candidateNormalized === 'review'
|
|
259
|
+
? stripPackageRunSeparator(args.slice(index + 1))
|
|
260
|
+
: null;
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
if (token.startsWith('-')) {
|
|
265
|
+
index += packageReviewOptionConsumesValue(token) && !hasInlineOptionValue(token) ? 2 : 1;
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
return normalized === 'review' ? stripPackageRunSeparator(args.slice(index + 1)) : null;
|
|
269
|
+
}
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
function stripPackageRunSeparator(args) {
|
|
273
|
+
return normalizeCommandToken(args[0] ?? '') === '--' ? args.slice(1) : args;
|
|
274
|
+
}
|
|
275
|
+
function packageReviewOptionConsumesValue(token) {
|
|
276
|
+
return REVIEW_PACKAGE_OPTION_VALUE_FLAGS.has(normalizeCliOptionName(token));
|
|
277
|
+
}
|
|
278
|
+
function isReviewRunnerScriptToken(token) {
|
|
279
|
+
return /^(?:.*\/)?run-review\.(?:js|ts|mjs|cjs|mts|cts|\{js,ts\})$/iu.test(token);
|
|
280
|
+
}
|
|
281
|
+
function resolveNodeEntryScriptToken(args) {
|
|
282
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
283
|
+
const token = args[index] ?? '';
|
|
284
|
+
const optionName = normalizeCliOptionName(token);
|
|
285
|
+
if (optionName === '--') {
|
|
286
|
+
const explicitScript = args[index + 1] ?? '';
|
|
287
|
+
return explicitScript ? normalizeCommandToken(explicitScript) : null;
|
|
288
|
+
}
|
|
289
|
+
if (NODE_NON_SCRIPT_EXECUTION_FLAGS.has(optionName) ||
|
|
290
|
+
NODE_RUNTIME_SCRIPT_FLAGS.has(optionName)) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
if (token.startsWith('-')) {
|
|
294
|
+
index += advancePastNodeOption(args, index) - 1;
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
return normalizeCommandToken(token);
|
|
298
|
+
}
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
function resolveNodeRuntimeScriptTarget(args) {
|
|
302
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
303
|
+
const token = args[index] ?? '';
|
|
304
|
+
const optionName = normalizeCliOptionName(token);
|
|
305
|
+
if (optionName === '--') {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
if (NODE_NON_SCRIPT_EXECUTION_FLAGS.has(optionName)) {
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
if (NODE_RUNTIME_SCRIPT_FLAGS.has(optionName)) {
|
|
312
|
+
if (hasInlineOptionValue(token)) {
|
|
313
|
+
return normalizeCommandToken(extractInlineOptionValue(token));
|
|
314
|
+
}
|
|
315
|
+
const scriptTarget = args[index + 1] ?? '';
|
|
316
|
+
return scriptTarget ? normalizeCommandToken(scriptTarget) : null;
|
|
317
|
+
}
|
|
318
|
+
if (token.startsWith('-')) {
|
|
319
|
+
index += advancePastNodeOption(args, index) - 1;
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
function advancePastNodeOption(args, index) {
|
|
327
|
+
const token = args[index] ?? '';
|
|
328
|
+
if (hasInlineOptionValue(token)) {
|
|
329
|
+
return 1;
|
|
330
|
+
}
|
|
331
|
+
const optionName = normalizeCliOptionName(token);
|
|
332
|
+
if (NODE_OPTION_VALUE_FLAGS.has(optionName)) {
|
|
333
|
+
return args[index + 1] ? 2 : 1;
|
|
334
|
+
}
|
|
335
|
+
const nextToken = args[index + 1] ?? '';
|
|
336
|
+
if (nextToken &&
|
|
337
|
+
!nextToken.startsWith('-') &&
|
|
338
|
+
hasLaterNodeReviewRunnerCandidate(args, index + 2)) {
|
|
339
|
+
return 2;
|
|
340
|
+
}
|
|
341
|
+
return 1;
|
|
342
|
+
}
|
|
343
|
+
function hasLaterNodeReviewRunnerCandidate(args, startIndex) {
|
|
344
|
+
for (let index = startIndex; index < args.length; index += 1) {
|
|
345
|
+
const token = args[index] ?? '';
|
|
346
|
+
const optionName = normalizeCliOptionName(token);
|
|
347
|
+
if (optionName === '--') {
|
|
348
|
+
const explicitScript = args[index + 1] ?? '';
|
|
349
|
+
return explicitScript ? isReviewRunnerScriptToken(normalizeCommandToken(explicitScript)) : false;
|
|
350
|
+
}
|
|
351
|
+
if (token.startsWith('-')) {
|
|
352
|
+
if (hasInlineOptionValue(token)) {
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
if (NODE_OPTION_VALUE_FLAGS.has(optionName)) {
|
|
356
|
+
index += args[index + 1] ? 1 : 0;
|
|
357
|
+
}
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
return isReviewRunnerScriptToken(normalizeCommandToken(token));
|
|
361
|
+
}
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
364
|
+
function normalizeCliOptionName(token) {
|
|
365
|
+
const equalsIndex = token.indexOf('=');
|
|
366
|
+
const optionName = equalsIndex >= 0 ? token.slice(0, equalsIndex) : token;
|
|
367
|
+
return optionName.startsWith('--') ? optionName.toLowerCase() : optionName;
|
|
368
|
+
}
|
|
369
|
+
function hasInlineOptionValue(token) {
|
|
370
|
+
return token.includes('=');
|
|
371
|
+
}
|
|
372
|
+
function extractInlineOptionValue(token) {
|
|
373
|
+
const equalsIndex = token.indexOf('=');
|
|
374
|
+
return equalsIndex >= 0 ? token.slice(equalsIndex + 1) : '';
|
|
375
|
+
}
|
|
376
|
+
function isDirectValidationRunnerCommand(command, args) {
|
|
377
|
+
if (REVIEW_DIRECT_VALIDATION_RUNNERS.has(command)) {
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
if (command === 'python' || command === 'python3' || command === 'py') {
|
|
381
|
+
for (let index = 0; index < args.length - 1; index += 1) {
|
|
382
|
+
const token = args[index] ?? '';
|
|
383
|
+
const optionName = normalizeCliOptionName(token);
|
|
384
|
+
if (optionName === '--' || optionName === '-c' || token === '-') {
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
if (optionName === '-m') {
|
|
388
|
+
return normalizeCommandToken(args[index + 1] ?? '') === 'pytest';
|
|
389
|
+
}
|
|
390
|
+
if (!token.startsWith('-')) {
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
if (pythonOptionConsumesValue(token)) {
|
|
394
|
+
index += hasInlineOptionValue(token) ? 0 : 1;
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
const launcherTarget = resolveValidationLauncherTarget(command, args);
|
|
400
|
+
return launcherTarget !== null && REVIEW_DIRECT_VALIDATION_RUNNERS.has(launcherTarget);
|
|
401
|
+
}
|
|
402
|
+
function isPackageManagerValidationSuiteCommand(command, args) {
|
|
403
|
+
if (command !== 'npm' && command !== 'pnpm' && command !== 'yarn' && command !== 'bun') {
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
const scriptTarget = resolvePackageScriptTarget(args);
|
|
407
|
+
if (scriptTarget === null) {
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
410
|
+
// Keep package-manager `test` launches inside the validation-suite boundary even
|
|
411
|
+
// when they pass file selectors: repo-defined scripts can still expand them into
|
|
412
|
+
// broader suites or chained wrappers.
|
|
413
|
+
return REVIEW_VALIDATION_SUITE_SCRIPT_TARGETS.has(scriptTarget);
|
|
414
|
+
}
|
|
415
|
+
function pythonOptionConsumesValue(token) {
|
|
416
|
+
return hasInlineOptionValue(token) || PYTHON_OPTION_VALUE_FLAGS.has(normalizeCliOptionName(token));
|
|
417
|
+
}
|
|
418
|
+
function resolveValidationLauncherTarget(command, args) {
|
|
419
|
+
if (command === 'npx' || command === 'bunx') {
|
|
420
|
+
return resolveFirstBinaryLauncherTarget(args);
|
|
421
|
+
}
|
|
422
|
+
const firstArg = normalizeCommandToken(args[0] ?? '');
|
|
423
|
+
if (command === 'npm' && firstArg === 'exec') {
|
|
424
|
+
return resolveFirstBinaryLauncherTarget(args.slice(1), { skipDlx: false });
|
|
425
|
+
}
|
|
426
|
+
if (command === 'npm' && firstArg === 'run') {
|
|
427
|
+
return resolvePackageScriptInvocationTarget(args.slice(1));
|
|
428
|
+
}
|
|
429
|
+
if (command === 'pnpm' && (firstArg === 'dlx' || firstArg === 'exec')) {
|
|
430
|
+
return resolveFirstBinaryLauncherTarget(args.slice(1), { skipDlx: false });
|
|
431
|
+
}
|
|
432
|
+
if (command === 'pnpm' && firstArg === 'run') {
|
|
433
|
+
return resolvePackageScriptInvocationTarget(args.slice(1));
|
|
434
|
+
}
|
|
435
|
+
if (command === 'pnpm' && firstArg && !firstArg.startsWith('-')) {
|
|
436
|
+
return firstArg;
|
|
437
|
+
}
|
|
438
|
+
if (command === 'yarn' && (firstArg === 'dlx' || firstArg === 'exec')) {
|
|
439
|
+
return resolveFirstBinaryLauncherTarget(args.slice(1), { skipDlx: false });
|
|
440
|
+
}
|
|
441
|
+
if (command === 'yarn' && firstArg === 'run') {
|
|
442
|
+
return resolvePackageScriptInvocationTarget(args.slice(1));
|
|
443
|
+
}
|
|
444
|
+
if (command === 'yarn' && firstArg && !firstArg.startsWith('-')) {
|
|
445
|
+
return firstArg;
|
|
446
|
+
}
|
|
447
|
+
if (command === 'bun' && firstArg === 'x') {
|
|
448
|
+
return resolveFirstBinaryLauncherTarget(args.slice(1), { skipDlx: false });
|
|
449
|
+
}
|
|
450
|
+
if (command === 'bun' && firstArg === 'run') {
|
|
451
|
+
return resolvePackageScriptInvocationTarget(args.slice(1));
|
|
452
|
+
}
|
|
453
|
+
if (command === 'bun' && firstArg && !firstArg.startsWith('-')) {
|
|
454
|
+
return firstArg;
|
|
455
|
+
}
|
|
456
|
+
return null;
|
|
457
|
+
}
|
|
458
|
+
function resolvePackageScriptInvocationTarget(args) {
|
|
459
|
+
let index = 0;
|
|
460
|
+
while (index < args.length) {
|
|
461
|
+
const token = args[index] ?? '';
|
|
462
|
+
const normalized = token.toLowerCase();
|
|
463
|
+
if (normalized === '--') {
|
|
464
|
+
const target = args[index + 1];
|
|
465
|
+
return target ? normalizeCommandToken(target) : null;
|
|
466
|
+
}
|
|
467
|
+
if (token.startsWith('-')) {
|
|
468
|
+
index += packageScriptOptionConsumesValue(token) && !token.includes('=') ? 2 : 1;
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
return normalizeCommandToken(token);
|
|
472
|
+
}
|
|
473
|
+
return null;
|
|
474
|
+
}
|
|
475
|
+
function resolveFirstBinaryLauncherTarget(args, options = {}) {
|
|
476
|
+
let index = 0;
|
|
477
|
+
while (index < args.length) {
|
|
478
|
+
const token = args[index] ?? '';
|
|
479
|
+
const normalized = token.toLowerCase();
|
|
480
|
+
if (normalized === '--') {
|
|
481
|
+
const target = args[index + 1];
|
|
482
|
+
return target ? normalizeCommandToken(target) : null;
|
|
483
|
+
}
|
|
484
|
+
if (options.skipDlx !== false && (normalized === 'dlx' || normalized === 'exec')) {
|
|
485
|
+
index += 1;
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
if (token.startsWith('-')) {
|
|
489
|
+
index += binaryLauncherOptionConsumesValue(token) && !token.includes('=') ? 2 : 1;
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
return normalizeCommandToken(token);
|
|
493
|
+
}
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
function binaryLauncherOptionConsumesValue(option) {
|
|
497
|
+
const normalized = option.toLowerCase();
|
|
498
|
+
return (normalized === '-p' ||
|
|
499
|
+
normalized === '--package' ||
|
|
500
|
+
normalized.startsWith('--package=') ||
|
|
501
|
+
normalized === '-c' ||
|
|
502
|
+
normalized === '--call' ||
|
|
503
|
+
normalized.startsWith('--call=') ||
|
|
504
|
+
normalized === '--node-options' ||
|
|
505
|
+
normalized.startsWith('--node-options='));
|
|
506
|
+
}
|
|
507
|
+
function packageScriptOptionConsumesValue(option) {
|
|
508
|
+
const normalized = option.toLowerCase();
|
|
509
|
+
return (normalized === '-c' ||
|
|
510
|
+
normalized === '--cwd' ||
|
|
511
|
+
normalized.startsWith('--cwd=') ||
|
|
512
|
+
normalized === '--filter' ||
|
|
513
|
+
normalized.startsWith('--filter=') ||
|
|
514
|
+
normalized === '--workspace' ||
|
|
515
|
+
normalized.startsWith('--workspace=') ||
|
|
516
|
+
normalized === '--workspaces' ||
|
|
517
|
+
normalized === '--top-level' ||
|
|
518
|
+
normalized === '--since' ||
|
|
519
|
+
normalized.startsWith('--since='));
|
|
520
|
+
}
|
|
521
|
+
export function formatCommandIntentViolationLabel(kind) {
|
|
522
|
+
if (kind === 'validation-suite') {
|
|
523
|
+
return 'validation suite launch';
|
|
524
|
+
}
|
|
525
|
+
if (kind === 'validation-runner') {
|
|
526
|
+
return 'direct validation runner launch';
|
|
527
|
+
}
|
|
528
|
+
if (kind === 'review-orchestration') {
|
|
529
|
+
return 'nested review or pipeline launch';
|
|
530
|
+
}
|
|
531
|
+
return 'delegation control activity';
|
|
532
|
+
}
|