@kbediako/codex-orchestrator 0.1.38 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +20 -0
- package/README.md +46 -317
- package/bin/codex-orchestrator.js +161 -0
- package/codex.orchestrator.json +149 -13
- package/dist/bin/codex-orchestrator.js +797 -1154
- package/dist/orchestrator/src/cli/adapters/CommandBuilder.js +50 -0
- 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 +295 -11
- package/dist/orchestrator/src/cli/coStatusAttachCliShell.js +402 -0
- package/dist/orchestrator/src/cli/coStatusCliShell.js +451 -0
- package/dist/orchestrator/src/cli/coStatusOperatorAutopilotCliShell.js +120 -0
- package/dist/orchestrator/src/cli/codexCliShell.js +119 -0
- package/dist/orchestrator/src/cli/codexDefaultsSetup.js +265 -36
- 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 +630 -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 +1003 -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 +1904 -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 +1885 -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 +678 -164
- 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 +119 -15
- 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 +95 -1
- 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 +1835 -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 +6834 -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 +698 -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 +285 -7
- package/dist/orchestrator/src/cli/utils/codexFeatures.js +60 -0
- 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/manager.js +74 -4
- 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 +399 -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/README.md +43 -20
- package/docs/book/README.md +19 -0
- package/docs/book/codex-cli-0124-adoption.md +68 -0
- package/docs/book/local-hook-impact.md +73 -0
- package/docs/book/operations.md +60 -0
- package/docs/book/public-posture.md +34 -0
- package/docs/book/setup.md +91 -0
- package/docs/book/skills.md +11 -0
- package/docs/guides/codex-version-policy.md +104 -0
- package/docs/public/downstream-setup.md +113 -0
- package/docs/public/provider-onboarding.md +173 -0
- package/package.json +23 -10
- package/plugins/codex-orchestrator/.codex-plugin/plugin.json +30 -0
- package/plugins/codex-orchestrator/.mcp.json +13 -0
- package/plugins/codex-orchestrator/launcher.mjs +361 -0
- package/schemas/manifest.json +411 -0
- package/skills/README.md +26 -0
- package/skills/collab-subagents-first/SKILL.md +1 -1
- package/skills/delegation-usage/DELEGATION_GUIDE.md +30 -12
- package/skills/delegation-usage/SKILL.md +25 -14
- 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/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 +15 -8
- package/templates/codex/mcp-client.json +5 -1
- package/docs/assets/setup.gif +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { prepareReviewArtifacts } from './review-launch-attempt.js';
|
|
3
|
+
export function shouldForceNonInteractive(env, stdinIsTTY) {
|
|
4
|
+
return (!stdinIsTTY ||
|
|
5
|
+
envFlagEnabled(env.CI) ||
|
|
6
|
+
envFlagEnabled(env.CODEX_REVIEW_NON_INTERACTIVE) ||
|
|
7
|
+
envFlagEnabled(env.CODEX_NON_INTERACTIVE) ||
|
|
8
|
+
envFlagEnabled(env.CODEX_NO_INTERACTIVE) ||
|
|
9
|
+
envFlagEnabled(env.CODEX_NONINTERACTIVE));
|
|
10
|
+
}
|
|
11
|
+
export function shouldPrintNonInteractiveHandoff(params) {
|
|
12
|
+
return (params.nonInteractive &&
|
|
13
|
+
!envFlagEnabled(params.env.FORCE_CODEX_REVIEW) &&
|
|
14
|
+
(envFlagEnabled(params.env.CI) ||
|
|
15
|
+
!params.stdinIsTTY ||
|
|
16
|
+
envFlagEnabled(params.env.CODEX_REVIEW_NON_INTERACTIVE) ||
|
|
17
|
+
envFlagEnabled(params.env.CODEX_NON_INTERACTIVE) ||
|
|
18
|
+
envFlagEnabled(params.env.CODEX_NO_INTERACTIVE) ||
|
|
19
|
+
envFlagEnabled(params.env.CODEX_NONINTERACTIVE)));
|
|
20
|
+
}
|
|
21
|
+
export async function prepareReviewNonInteractiveHandoffShell(options) {
|
|
22
|
+
const artifactPaths = await prepareReviewArtifacts(options.manifestPath, options.prompt, options.repoRoot);
|
|
23
|
+
const nonInteractive = options.cliNonInteractive ?? shouldForceNonInteractive(options.env, options.stdinIsTTY);
|
|
24
|
+
const reviewEnv = { ...options.env };
|
|
25
|
+
reviewEnv.MANIFEST = options.manifestPath;
|
|
26
|
+
if (options.runnerLogExists) {
|
|
27
|
+
reviewEnv.RUNNER_LOG = options.runnerLogPath;
|
|
28
|
+
reviewEnv.RUN_LOG = options.runnerLogPath;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
delete reviewEnv.RUNNER_LOG;
|
|
32
|
+
delete reviewEnv.RUN_LOG;
|
|
33
|
+
}
|
|
34
|
+
if (nonInteractive) {
|
|
35
|
+
reviewEnv.CODEX_NON_INTERACTIVE = reviewEnv.CODEX_NON_INTERACTIVE ?? '1';
|
|
36
|
+
reviewEnv.CODEX_NO_INTERACTIVE = reviewEnv.CODEX_NO_INTERACTIVE ?? '1';
|
|
37
|
+
reviewEnv.CODEX_INTERACTIVE = reviewEnv.CODEX_INTERACTIVE ?? '0';
|
|
38
|
+
}
|
|
39
|
+
const handedOff = shouldPrintNonInteractiveHandoff({
|
|
40
|
+
env: options.env,
|
|
41
|
+
nonInteractive,
|
|
42
|
+
stdinIsTTY: options.stdinIsTTY
|
|
43
|
+
});
|
|
44
|
+
if (handedOff) {
|
|
45
|
+
const logger = options.logger ?? console;
|
|
46
|
+
logger.log('Codex review handoff (non-interactive):');
|
|
47
|
+
logger.log('---');
|
|
48
|
+
logger.log(options.prompt);
|
|
49
|
+
logger.log('---');
|
|
50
|
+
logger.log(`Review prompt saved to: ${path.relative(options.repoRoot, artifactPaths.promptPath)}`);
|
|
51
|
+
logger.log('Set FORCE_CODEX_REVIEW=1 to invoke `codex review` in this environment.');
|
|
52
|
+
}
|
|
53
|
+
return { artifactPaths, nonInteractive, reviewEnv, handedOff };
|
|
54
|
+
}
|
|
55
|
+
function envFlagEnabled(value) {
|
|
56
|
+
if (value === undefined) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const normalized = value.trim().toLowerCase();
|
|
60
|
+
return normalized === '1' || normalized === 'true' || normalized === 'yes';
|
|
61
|
+
}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { readFile, readdir, stat } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { buildRunMemoryPromptLines, selectRunMemoryForRole } from '../../orchestrator/src/cli/run/runMemoryController.js';
|
|
4
|
+
import { buildRunBlockMemoryPromptLines, readRunBlockMemoryDescriptor, readRunBlockMemoryIndex } from '../../orchestrator/src/cli/run/blockMemory.js';
|
|
5
|
+
import { normalizeTaskKey, pathExists } from './docs-helpers.js';
|
|
6
|
+
const DEFAULT_SCOPED_REVIEW_TITLE_MAX_LENGTH = 180;
|
|
7
|
+
const BOUNDED_SCOPED_REVIEW_TITLE_SEGMENT = 'Bounded: no validation; list follow-up commands only';
|
|
8
|
+
async function readTaskIndexEntries(repoRoot) {
|
|
9
|
+
const taskIndexPath = path.join(repoRoot, 'tasks', 'index.json');
|
|
10
|
+
if (!(await pathExists(taskIndexPath))) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const raw = await readFile(taskIndexPath, 'utf8');
|
|
15
|
+
const parsed = JSON.parse(raw);
|
|
16
|
+
return Array.isArray(parsed?.items) ? parsed.items : [];
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function extractTaskChecklistCandidate(item) {
|
|
23
|
+
const directTaskPath = typeof item.paths?.task === 'string'
|
|
24
|
+
? item.paths.task.trim()
|
|
25
|
+
: typeof item.relates_to === 'string'
|
|
26
|
+
? item.relates_to.trim()
|
|
27
|
+
: '';
|
|
28
|
+
if (directTaskPath.length > 0) {
|
|
29
|
+
return directTaskPath;
|
|
30
|
+
}
|
|
31
|
+
const legacyPath = typeof item.path === 'string' ? item.path.trim() : '';
|
|
32
|
+
const candidate = /(?:^|\/)tasks-[0-9]{4}-[A-Za-z0-9-]+\.md$/u.test(legacyPath) ? legacyPath : '';
|
|
33
|
+
return candidate.length > 0 ? candidate : null;
|
|
34
|
+
}
|
|
35
|
+
async function resolveRegisteredTaskChecklistPath(repoRoot, taskKey) {
|
|
36
|
+
const items = await readTaskIndexEntries(repoRoot);
|
|
37
|
+
if (items.length === 0) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const keyedItems = items
|
|
41
|
+
.map((item) => ({
|
|
42
|
+
key: normalizeTaskKey(item),
|
|
43
|
+
checklistPath: extractTaskChecklistCandidate(item)
|
|
44
|
+
}))
|
|
45
|
+
.filter((entry) => typeof entry.key === 'string' &&
|
|
46
|
+
entry.key.length > 0 &&
|
|
47
|
+
typeof entry.checklistPath === 'string' &&
|
|
48
|
+
entry.checklistPath.length > 0)
|
|
49
|
+
.sort((left, right) => right.key.length - left.key.length);
|
|
50
|
+
const exact = keyedItems.find((entry) => entry.key === taskKey);
|
|
51
|
+
const prefix = keyedItems.find((entry) => taskKey.startsWith(`${entry.key}-`));
|
|
52
|
+
const selected = exact ?? prefix;
|
|
53
|
+
if (!selected) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const absolute = path.resolve(repoRoot, selected.checklistPath);
|
|
57
|
+
return (await pathExists(absolute)) ? absolute : null;
|
|
58
|
+
}
|
|
59
|
+
async function resolveCanonicalTaskKey(repoRoot, taskKey) {
|
|
60
|
+
if (!taskKey) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const items = await readTaskIndexEntries(repoRoot);
|
|
64
|
+
if (items.length === 0) {
|
|
65
|
+
return taskKey;
|
|
66
|
+
}
|
|
67
|
+
const keyedItems = items
|
|
68
|
+
.map((item) => ({ key: normalizeTaskKey(item) }))
|
|
69
|
+
.filter((entry) => typeof entry.key === 'string' && entry.key.length > 0)
|
|
70
|
+
.sort((left, right) => right.key.length - left.key.length);
|
|
71
|
+
const exact = keyedItems.find((entry) => entry.key === taskKey);
|
|
72
|
+
const prefix = keyedItems.find((entry) => taskKey.startsWith(`${entry.key}-`));
|
|
73
|
+
return exact?.key ?? prefix?.key ?? taskKey;
|
|
74
|
+
}
|
|
75
|
+
async function resolveTaskChecklistPath(repoRoot, taskKey) {
|
|
76
|
+
const direct = path.join(repoRoot, 'tasks', `tasks-${taskKey}.md`);
|
|
77
|
+
if (await pathExists(direct)) {
|
|
78
|
+
return direct;
|
|
79
|
+
}
|
|
80
|
+
if (!/^\d{4}$/.test(taskKey)) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
const tasksDir = path.join(repoRoot, 'tasks');
|
|
84
|
+
let entries = [];
|
|
85
|
+
try {
|
|
86
|
+
entries = await readdir(tasksDir);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
const candidates = entries
|
|
92
|
+
.filter((name) => name.startsWith(`tasks-${taskKey}-`) && name.endsWith('.md'))
|
|
93
|
+
.map((name) => path.join(tasksDir, name))
|
|
94
|
+
.sort();
|
|
95
|
+
if (candidates.length === 1) {
|
|
96
|
+
return candidates[0] ?? null;
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
function extractTaskHeaderBulletLines(taskChecklist) {
|
|
101
|
+
const lines = taskChecklist.split('\n');
|
|
102
|
+
const checklistIndex = lines.findIndex((line) => line.trim() === '## Checklist');
|
|
103
|
+
const headerLines = checklistIndex === -1 ? lines : lines.slice(0, checklistIndex);
|
|
104
|
+
return headerLines
|
|
105
|
+
.map((line) => line.trimEnd())
|
|
106
|
+
.filter((line) => line.startsWith('- '));
|
|
107
|
+
}
|
|
108
|
+
function extractBacktickedPath(line) {
|
|
109
|
+
const match = line.match(/`([^`]+)`/);
|
|
110
|
+
return match?.[1] ?? null;
|
|
111
|
+
}
|
|
112
|
+
function extractTaskHeaderDocPath(headerBullets, patterns) {
|
|
113
|
+
const match = headerBullets.find((line) => {
|
|
114
|
+
const normalized = line.toLowerCase();
|
|
115
|
+
return patterns.some((pattern) => normalized.includes(pattern));
|
|
116
|
+
});
|
|
117
|
+
return match ? extractBacktickedPath(match) : null;
|
|
118
|
+
}
|
|
119
|
+
async function buildTaskContext(options) {
|
|
120
|
+
const checklistPath = (await resolveRegisteredTaskChecklistPath(options.repoRoot, options.taskKey)) ??
|
|
121
|
+
(await resolveTaskChecklistPath(options.repoRoot, options.taskKey));
|
|
122
|
+
if (!checklistPath) {
|
|
123
|
+
return { lines: [], architectureSurfacePaths: [] };
|
|
124
|
+
}
|
|
125
|
+
const relativeChecklist = path.relative(options.repoRoot, checklistPath);
|
|
126
|
+
const checklist = await readFile(checklistPath, 'utf8');
|
|
127
|
+
const headerBullets = extractTaskHeaderBulletLines(checklist);
|
|
128
|
+
const architectureSurfacePaths = options.surface === 'architecture' ? [checklistPath] : [];
|
|
129
|
+
const lines = ['Task context:', `- Task checklist: \`${relativeChecklist}\``];
|
|
130
|
+
const prdPath = extractTaskHeaderDocPath(headerBullets, ['primary prd:']);
|
|
131
|
+
if (prdPath) {
|
|
132
|
+
lines.push(`- Primary PRD: \`${prdPath}\``);
|
|
133
|
+
const absolutePrdPath = path.resolve(options.repoRoot, prdPath);
|
|
134
|
+
if (options.surface === 'architecture' && (await pathExists(absolutePrdPath))) {
|
|
135
|
+
architectureSurfacePaths.push(absolutePrdPath);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (options.surface === 'architecture') {
|
|
139
|
+
const techSpecPath = extractTaskHeaderDocPath(headerBullets, ['tech_spec:', 'tech spec:']);
|
|
140
|
+
if (techSpecPath) {
|
|
141
|
+
lines.push(`- TECH_SPEC: \`${techSpecPath}\``);
|
|
142
|
+
const absoluteTechSpecPath = path.resolve(options.repoRoot, techSpecPath);
|
|
143
|
+
if (await pathExists(absoluteTechSpecPath)) {
|
|
144
|
+
architectureSurfacePaths.push(absoluteTechSpecPath);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const actionPlanPath = extractTaskHeaderDocPath(headerBullets, ['action_plan:', 'action plan:']);
|
|
148
|
+
if (actionPlanPath) {
|
|
149
|
+
lines.push(`- ACTION_PLAN: \`${actionPlanPath}\``);
|
|
150
|
+
const absoluteActionPlanPath = path.resolve(options.repoRoot, actionPlanPath);
|
|
151
|
+
if (await pathExists(absoluteActionPlanPath)) {
|
|
152
|
+
architectureSurfacePaths.push(absoluteActionPlanPath);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const architecturePath = path.join(options.repoRoot, '.agent', 'system', 'architecture.md');
|
|
156
|
+
if (await pathExists(architecturePath)) {
|
|
157
|
+
lines.push(`- Repo architecture baseline: \`${path.relative(options.repoRoot, architecturePath)}\``);
|
|
158
|
+
architectureSurfacePaths.push(architecturePath);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return { lines, architectureSurfacePaths };
|
|
162
|
+
}
|
|
163
|
+
async function resolveActiveCloseoutBundleRoots(repoRoot, taskKey) {
|
|
164
|
+
const canonicalTaskKey = await resolveCanonicalTaskKey(repoRoot, taskKey);
|
|
165
|
+
if (!canonicalTaskKey) {
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
const manualDir = path.join(repoRoot, 'out', canonicalTaskKey, 'manual');
|
|
169
|
+
if (!(await pathExists(manualDir))) {
|
|
170
|
+
return [];
|
|
171
|
+
}
|
|
172
|
+
let entries = [];
|
|
173
|
+
try {
|
|
174
|
+
entries = await readdir(manualDir);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
return [];
|
|
178
|
+
}
|
|
179
|
+
const closeoutDirs = [];
|
|
180
|
+
for (const entry of entries) {
|
|
181
|
+
if (!(entry === 'TODO-closeout' || entry.endsWith('-closeout'))) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const absolute = path.join(manualDir, entry);
|
|
185
|
+
try {
|
|
186
|
+
if ((await stat(absolute)).isDirectory()) {
|
|
187
|
+
closeoutDirs.push(absolute);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
// ignore disappearing or unreadable entries
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
closeoutDirs.sort();
|
|
195
|
+
if (closeoutDirs.length === 0) {
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
const roots = new Set();
|
|
199
|
+
const todoCloseout = closeoutDirs.find((entry) => path.basename(entry) === 'TODO-closeout');
|
|
200
|
+
if (todoCloseout) {
|
|
201
|
+
roots.add(todoCloseout);
|
|
202
|
+
}
|
|
203
|
+
const completedCloseouts = closeoutDirs.filter((entry) => path.basename(entry) !== 'TODO-closeout');
|
|
204
|
+
const latestCompletedCloseout = completedCloseouts.at(-1);
|
|
205
|
+
if (latestCompletedCloseout) {
|
|
206
|
+
roots.add(latestCompletedCloseout);
|
|
207
|
+
}
|
|
208
|
+
return [...roots];
|
|
209
|
+
}
|
|
210
|
+
export function buildActiveCloseoutProvenanceLines(repoRoot, activeCloseoutBundleRoots) {
|
|
211
|
+
if (activeCloseoutBundleRoots.length === 0) {
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
214
|
+
return [
|
|
215
|
+
'Active closeout provenance:',
|
|
216
|
+
...activeCloseoutBundleRoots.map((root) => `- Resolved active closeout root: \`${path.relative(repoRoot, root)}\``),
|
|
217
|
+
'- These roots are already-resolved self-referential review surfaces for this task; do not re-derive or re-enumerate them unless directly necessary to assess code correctness.'
|
|
218
|
+
];
|
|
219
|
+
}
|
|
220
|
+
export function resolveReviewNotes(options) {
|
|
221
|
+
if (options.notes) {
|
|
222
|
+
return options.notes;
|
|
223
|
+
}
|
|
224
|
+
const fallback = `Goal: standalone review handoff | ` +
|
|
225
|
+
`Summary: auto-generated NOTES fallback (task=${options.taskLabel}, surface=${options.surface}) | ` +
|
|
226
|
+
'Risks: missing custom intent details may reduce review precision';
|
|
227
|
+
console.warn('[run-review] NOTES was not provided; using a generated fallback. ' +
|
|
228
|
+
'Set NOTES="Goal: ... | Summary: ... | Risks: ... | Questions (optional): ..." for higher-signal review context.');
|
|
229
|
+
return fallback;
|
|
230
|
+
}
|
|
231
|
+
function normalizeScopedReviewTitleSegment(value) {
|
|
232
|
+
return value.replace(/\s+/g, ' ').replace(/\s*\|\s*/g, ' | ').trim();
|
|
233
|
+
}
|
|
234
|
+
function compactScopedReviewTitleSegments(value) {
|
|
235
|
+
return value
|
|
236
|
+
.split('|')
|
|
237
|
+
.map((segment) => segment.replace(/\s+/g, ' ').trim())
|
|
238
|
+
.filter((segment) => segment.length > 0)
|
|
239
|
+
.join(' | ');
|
|
240
|
+
}
|
|
241
|
+
function removeBoundedScopedReviewTitleSegment(title) {
|
|
242
|
+
return compactScopedReviewTitleSegments(title.split(BOUNDED_SCOPED_REVIEW_TITLE_SEGMENT).join(' '));
|
|
243
|
+
}
|
|
244
|
+
function truncateScopedReviewTitle(title, maxLength) {
|
|
245
|
+
const normalizedMax = Number.isFinite(maxLength) ? Math.max(1, Math.trunc(maxLength)) : 1;
|
|
246
|
+
if (title.length <= normalizedMax) {
|
|
247
|
+
return title;
|
|
248
|
+
}
|
|
249
|
+
if (normalizedMax === 1) {
|
|
250
|
+
return '…';
|
|
251
|
+
}
|
|
252
|
+
return `${title.slice(0, normalizedMax - 1).trimEnd()}…`;
|
|
253
|
+
}
|
|
254
|
+
export function addBoundedReviewConstraintsToScopedTitle(options) {
|
|
255
|
+
const normalizedTitle = normalizeScopedReviewTitleSegment(options.title);
|
|
256
|
+
const maxLength = options.maxLength ?? DEFAULT_SCOPED_REVIEW_TITLE_MAX_LENGTH;
|
|
257
|
+
const untaggedTitle = removeBoundedScopedReviewTitleSegment(normalizedTitle);
|
|
258
|
+
if (untaggedTitle.length === 0) {
|
|
259
|
+
return truncateScopedReviewTitle(BOUNDED_SCOPED_REVIEW_TITLE_SEGMENT, maxLength);
|
|
260
|
+
}
|
|
261
|
+
const title = `${untaggedTitle} | ${BOUNDED_SCOPED_REVIEW_TITLE_SEGMENT}`;
|
|
262
|
+
if (title.length <= maxLength) {
|
|
263
|
+
return title;
|
|
264
|
+
}
|
|
265
|
+
const suffix = ` | ${BOUNDED_SCOPED_REVIEW_TITLE_SEGMENT}`;
|
|
266
|
+
const prefixBudget = maxLength - suffix.length;
|
|
267
|
+
if (prefixBudget <= 1) {
|
|
268
|
+
return truncateScopedReviewTitle(BOUNDED_SCOPED_REVIEW_TITLE_SEGMENT, maxLength);
|
|
269
|
+
}
|
|
270
|
+
return `${truncateScopedReviewTitle(untaggedTitle, prefixBudget)}${suffix}`;
|
|
271
|
+
}
|
|
272
|
+
export function buildScopedReviewTitle(options) {
|
|
273
|
+
const normalizedNotes = normalizeScopedReviewTitleSegment(options.notes);
|
|
274
|
+
const title = [
|
|
275
|
+
`Surface: ${options.reviewSurface}`,
|
|
276
|
+
options.includeBoundedReviewConstraints ? BOUNDED_SCOPED_REVIEW_TITLE_SEGMENT : '',
|
|
277
|
+
normalizedNotes
|
|
278
|
+
]
|
|
279
|
+
.filter((segment) => segment.length > 0)
|
|
280
|
+
.join(' | ');
|
|
281
|
+
return truncateScopedReviewTitle(title, options.maxLength ?? DEFAULT_SCOPED_REVIEW_TITLE_MAX_LENGTH);
|
|
282
|
+
}
|
|
283
|
+
export async function buildReviewPromptContext(options) {
|
|
284
|
+
const notes = resolveReviewNotes({
|
|
285
|
+
notes: options.notes?.trim(),
|
|
286
|
+
taskLabel: options.taskLabel,
|
|
287
|
+
surface: options.reviewSurface
|
|
288
|
+
});
|
|
289
|
+
const scopedReviewerVisibleTitle = buildScopedReviewTitle({
|
|
290
|
+
notes,
|
|
291
|
+
reviewSurface: options.reviewSurface,
|
|
292
|
+
includeBoundedReviewConstraints: options.includeBoundedReviewConstraints
|
|
293
|
+
});
|
|
294
|
+
const activeCloseoutBundleRoots = options.reviewSurface === 'diff'
|
|
295
|
+
? await resolveActiveCloseoutBundleRoots(options.repoRoot, options.taskKey)
|
|
296
|
+
: [];
|
|
297
|
+
const promptLines = [
|
|
298
|
+
`Review task: ${options.taskLabel}`,
|
|
299
|
+
`Review surface: ${options.reviewSurface}`
|
|
300
|
+
];
|
|
301
|
+
let reviewTaskContext = { lines: [], architectureSurfacePaths: [] };
|
|
302
|
+
if (options.reviewSurface === 'audit') {
|
|
303
|
+
promptLines.push(`Evidence manifest: ${options.relativeManifest}`);
|
|
304
|
+
if (options.runnerLogExists) {
|
|
305
|
+
promptLines.push(`Evidence runner log: ${options.relativeRunnerLog}`);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if ((options.reviewSurface === 'audit' || options.reviewSurface === 'architecture') && options.taskKey) {
|
|
309
|
+
reviewTaskContext = await buildTaskContext({
|
|
310
|
+
repoRoot: options.repoRoot,
|
|
311
|
+
taskKey: options.taskKey,
|
|
312
|
+
surface: options.reviewSurface
|
|
313
|
+
});
|
|
314
|
+
if (reviewTaskContext.lines.length > 0) {
|
|
315
|
+
promptLines.push('', ...reviewTaskContext.lines);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
const absoluteManifestPath = path.resolve(options.repoRoot, options.relativeManifest);
|
|
319
|
+
if (await pathExists(absoluteManifestPath)) {
|
|
320
|
+
try {
|
|
321
|
+
const rawManifest = JSON.parse(await readFile(absoluteManifestPath, 'utf8'));
|
|
322
|
+
const runMemoryPromptLines = buildRunMemoryPromptLines(selectRunMemoryForRole({
|
|
323
|
+
role: 'reviewer',
|
|
324
|
+
manifest: rawManifest
|
|
325
|
+
}));
|
|
326
|
+
if (runMemoryPromptLines.length > 0) {
|
|
327
|
+
promptLines.push('', ...runMemoryPromptLines);
|
|
328
|
+
}
|
|
329
|
+
const blockMemoryDescriptor = readRunBlockMemoryDescriptor(rawManifest);
|
|
330
|
+
if (blockMemoryDescriptor) {
|
|
331
|
+
const blockMemoryIndex = await readRunBlockMemoryIndex(options.repoRoot, blockMemoryDescriptor).catch(() => null);
|
|
332
|
+
const blockMemoryPromptLines = buildRunBlockMemoryPromptLines({
|
|
333
|
+
descriptor: blockMemoryDescriptor,
|
|
334
|
+
index: blockMemoryIndex
|
|
335
|
+
});
|
|
336
|
+
if (blockMemoryPromptLines.length > 0) {
|
|
337
|
+
promptLines.push('', ...blockMemoryPromptLines);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
// Ignore malformed manifests here and preserve the existing prompt scaffold.
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (notes) {
|
|
346
|
+
promptLines.push('', 'Agent notes:', notes);
|
|
347
|
+
}
|
|
348
|
+
promptLines.push('', 'Please review the current changes and confirm:', '- The solution is minimal and avoids unnecessary abstraction/scope');
|
|
349
|
+
if (options.reviewSurface === 'audit') {
|
|
350
|
+
promptLines.push('- README/SOP docs match the implemented behavior', '- Commands/scripts are non-interactive (no TTY prompts)', '- Evidence + checklist mirroring requirements are satisfied', '- Start with the manifest or runner log before consulting memory, skills, or review docs', '', 'Call out any remaining documentation/code mismatches or guardrail violations.');
|
|
351
|
+
}
|
|
352
|
+
else if (options.reviewSurface === 'architecture') {
|
|
353
|
+
promptLines.push('- Architecture, layering, and boundaries remain coherent for the requested change', '- Use the canonical architecture inputs above as the primary review context before widening further', '- Call out architectural drift, abstraction mismatch, or missing design rationale that is directly relevant to this task', '- Stay on the requested architecture/context surfaces and directly related implementation paths; do not switch into manifest/runner-log evidence audit unless it is explicitly required', '', 'Keep this pass architecture-focused. Do not treat it as a generic evidence or closeout audit.');
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
const startupFocusLine = options.scopeMode === 'uncommitted'
|
|
357
|
+
? '- Start with touched paths, scoped diff commands, or nearby changed code before consulting memory, skills, review docs, manifests, or review artifacts'
|
|
358
|
+
: '- Start with touched paths or nearby changed code before consulting memory, skills, review docs, manifests, or review artifacts';
|
|
359
|
+
promptLines.push('- Behavior remains correct for changed files and nearby dependencies', '- Call out concrete regressions, risky edge cases, or missing tests in the changed area', startupFocusLine, '- Concrete same-diff progress can be shown by citing touched paths with explicit locations such as `path:line`, `path:line:col`, `path#Lline`, or `path#LlineCcol`.', '- If you already have that diff-local citation evidence, do not search the wider repo for other examples of the rendering.', '', 'Keep this pass diff-focused. Do not audit checklist/docs/evidence surfaces unless they are directly required to assess code correctness.');
|
|
360
|
+
}
|
|
361
|
+
if (options.includeBoundedReviewConstraints) {
|
|
362
|
+
const boundedFocusLine = options.reviewSurface === 'audit'
|
|
363
|
+
? '- Keep this review focused on the requested audit surfaces, supporting evidence, and directly related code/docs paths.'
|
|
364
|
+
: options.reviewSurface === 'architecture'
|
|
365
|
+
? '- Keep this review focused on the requested architecture surfaces, canonical task docs, and directly relevant implementation paths.'
|
|
366
|
+
: '- Keep this review focused on changed files and nearby dependencies.';
|
|
367
|
+
promptLines.push('', 'Execution constraints (bounded review mode):', boundedFocusLine, '- Avoid full validation suites (for example `npm run test`, `npm run lint`, `npm run build`, `npm run docs:check`, `npm run docs:freshness`) during this pass.', '- Do not launch direct validation runners (for example `npx vitest`, `npm exec jest`) or nested review/pipeline/delegation flows during this pass.', '- If changed docs, task packets, or checklists mention validation commands, treat them as evidence or follow-up suggestions only; do not execute those commands during bounded review.', '- If broader validation would improve confidence, list follow-up commands instead of executing them.');
|
|
368
|
+
}
|
|
369
|
+
return {
|
|
370
|
+
promptLines,
|
|
371
|
+
reviewTaskContext,
|
|
372
|
+
activeCloseoutBundleRoots,
|
|
373
|
+
resolvedNotes: notes,
|
|
374
|
+
scopedReviewerVisibleTitle
|
|
375
|
+
};
|
|
376
|
+
}
|