@agimon-ai/po 0.0.0-alpha.21 → 0.0.0-alpha.211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +97 -8
- package/README.md +37 -722
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +2 -2
- package/dist/bin/cli.cjs +12 -7
- package/dist/bin/cli.cjs.map +1 -1
- package/dist/bin/cli.mjs +12 -7
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/poRunner.cjs +24 -7
- package/dist/bin/poRunner.cjs.map +1 -1
- package/dist/bin/poRunner.d.mts +8 -0
- package/dist/bin/poRunner.d.mts.map +1 -1
- package/dist/bin/poRunner.mjs +24 -7
- package/dist/bin/poRunner.mjs.map +1 -1
- package/dist/bin/serve.cjs +28 -17
- package/dist/bin/serve.cjs.map +1 -1
- package/dist/bin/serve.mjs +28 -17
- package/dist/bin/serve.mjs.map +1 -1
- package/dist/builders/cli/extensionAssembler/index.cjs +53 -40
- package/dist/builders/cli/extensionAssembler/index.cjs.map +1 -1
- package/dist/builders/cli/extensionAssembler/index.d.mts +11 -6
- package/dist/builders/cli/extensionAssembler/index.d.mts.map +1 -1
- package/dist/builders/cli/extensionAssembler/index.mjs +53 -41
- package/dist/builders/cli/extensionAssembler/index.mjs.map +1 -1
- package/dist/catalog/index.json +662 -105
- package/dist/cli.cjs +9 -14
- package/dist/cli.d.mts +1 -3
- package/dist/cli.mjs +1 -3
- package/dist/commands.cjs +13 -15
- package/dist/commands.d.mts +1 -2
- package/dist/commands.mjs +1 -2
- package/dist/config.cjs +9 -14
- package/dist/config.d.mts +3 -2
- package/dist/config.mjs +3 -2
- package/dist/extensions/server.cjs +30 -23
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +31 -24
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/harnessContext.cjs +0 -1
- package/dist/harnessContext.d.mts +2 -2
- package/dist/harnessContext.mjs +1 -1
- package/dist/harnessState.cjs +2 -1
- package/dist/help.cjs +9 -11
- package/dist/help.d.mts +1 -2
- package/dist/help.mjs +1 -2
- package/dist/index.cjs +40 -67
- package/dist/index.d.mts +7 -16
- package/dist/index.mjs +7 -14
- package/dist/locales/vi.cjs +218 -0
- package/dist/locales/vi.cjs.map +1 -0
- package/dist/locales/vi.mjs +213 -0
- package/dist/locales/vi.mjs.map +1 -0
- package/dist/locales/zh-CN.cjs +218 -0
- package/dist/locales/zh-CN.cjs.map +1 -0
- package/dist/locales/zh-CN.mjs +213 -0
- package/dist/locales/zh-CN.mjs.map +1 -0
- package/dist/matrixOptions.cjs +10 -5
- package/dist/matrixOptions.d.mts +2 -2
- package/dist/matrixOptions.mjs +1 -1
- package/dist/package.cjs +11 -0
- package/dist/package.cjs.map +1 -0
- package/dist/package.mjs +6 -0
- package/dist/package.mjs.map +1 -0
- package/dist/projectTrust.cjs +3 -0
- package/dist/projectTrust.d.mts +2 -2
- package/dist/projectTrust.mjs +1 -1
- package/dist/repository.cjs +1 -0
- package/dist/repository.d.mts +2 -2
- package/dist/repository.mjs +1 -1
- package/dist/services.cjs +5 -20
- package/dist/services.d.mts +3 -8
- package/dist/services.mjs +3 -8
- package/dist/shared.cjs +4 -17
- package/dist/shared.d.mts +2 -2
- package/dist/shared.mjs +1 -1
- package/dist/src/bin/agentDirectory.cjs +19 -15
- package/dist/src/bin/agentDirectory.cjs.map +1 -1
- package/dist/src/bin/agentDirectory.mjs +16 -13
- package/dist/src/bin/agentDirectory.mjs.map +1 -1
- package/dist/src/builders/apiContractExport/index.cjs +23 -22
- package/dist/src/builders/apiContractExport/index.cjs.map +1 -1
- package/dist/src/builders/apiContractExport/index.mjs +22 -21
- package/dist/src/builders/apiContractExport/index.mjs.map +1 -1
- package/dist/src/builders/cli/entryResolution.cjs +2 -2
- package/dist/src/builders/cli/entryResolution.cjs.map +1 -1
- package/dist/src/builders/cli/entryResolution.mjs +1 -1
- package/dist/src/builders/cli/entryResolution.mjs.map +1 -1
- package/dist/src/builders/cli/harnessContext.cjs +38 -43
- package/dist/src/builders/cli/harnessContext.cjs.map +1 -1
- package/dist/src/builders/cli/harnessContext.d.mts +11 -10
- package/dist/src/builders/cli/harnessContext.d.mts.map +1 -1
- package/dist/src/builders/cli/harnessContext.mjs +37 -41
- package/dist/src/builders/cli/harnessContext.mjs.map +1 -1
- package/dist/src/builders/cli/sessionComposition.cjs +23 -12
- package/dist/src/builders/cli/sessionComposition.cjs.map +1 -1
- package/dist/src/builders/cli/sessionComposition.mjs +23 -12
- package/dist/src/builders/cli/sessionComposition.mjs.map +1 -1
- package/dist/src/builders/isolate/compile.cjs +226 -0
- package/dist/src/builders/isolate/compile.cjs.map +1 -0
- package/dist/src/builders/isolate/compile.mjs +222 -0
- package/dist/src/builders/isolate/compile.mjs.map +1 -0
- package/dist/src/builders/isolate/index.cjs +195 -0
- package/dist/src/builders/isolate/index.cjs.map +1 -0
- package/dist/src/builders/isolate/index.mjs +192 -0
- package/dist/src/builders/isolate/index.mjs.map +1 -0
- package/dist/src/builders/isolate/membrane.cjs +198 -0
- package/dist/src/builders/isolate/membrane.cjs.map +1 -0
- package/dist/src/builders/isolate/membrane.mjs +198 -0
- package/dist/src/builders/isolate/membrane.mjs.map +1 -0
- package/dist/src/builders/isolate/names.cjs +10 -0
- package/dist/src/builders/isolate/names.cjs.map +1 -0
- package/dist/src/builders/isolate/names.mjs +9 -0
- package/dist/src/builders/isolate/names.mjs.map +1 -0
- package/dist/src/builders/native/index.cjs +229 -67
- package/dist/src/builders/native/index.cjs.map +1 -1
- package/dist/src/builders/native/index.d.mts +4 -2
- package/dist/src/builders/native/index.d.mts.map +1 -1
- package/dist/src/builders/native/index.mjs +229 -68
- package/dist/src/builders/native/index.mjs.map +1 -1
- package/dist/src/builders/npm/index.cjs +76 -0
- package/dist/src/builders/npm/index.cjs.map +1 -0
- package/dist/src/builders/npm/index.mjs +73 -0
- package/dist/src/builders/npm/index.mjs.map +1 -0
- package/dist/src/builders/server/backgroundSync.cjs +62 -39
- package/dist/src/builders/server/backgroundSync.cjs.map +1 -1
- package/dist/src/builders/server/backgroundSync.mjs +62 -38
- package/dist/src/builders/server/backgroundSync.mjs.map +1 -1
- package/dist/src/builders/server/bundlerService.cjs +165 -35
- package/dist/src/builders/server/bundlerService.cjs.map +1 -1
- package/dist/src/builders/server/bundlerService.mjs +164 -36
- package/dist/src/builders/server/bundlerService.mjs.map +1 -1
- package/dist/src/builders/server/capabilities.cjs +103 -0
- package/dist/src/builders/server/capabilities.cjs.map +1 -0
- package/dist/src/builders/server/capabilities.mjs +101 -0
- package/dist/src/builders/server/capabilities.mjs.map +1 -0
- package/dist/src/builders/server/computerUseBinding.cjs +62 -10
- package/dist/src/builders/server/computerUseBinding.cjs.map +1 -1
- package/dist/src/builders/server/computerUseBinding.mjs +60 -8
- package/dist/src/builders/server/computerUseBinding.mjs.map +1 -1
- package/dist/src/builders/server/computerUseRecordings.cjs +152 -51
- package/dist/src/builders/server/computerUseRecordings.cjs.map +1 -1
- package/dist/src/builders/server/computerUseRecordings.mjs +158 -59
- package/dist/src/builders/server/computerUseRecordings.mjs.map +1 -1
- package/dist/src/builders/server/containedSessions.cjs +152 -0
- package/dist/src/builders/server/containedSessions.cjs.map +1 -0
- package/dist/src/builders/server/containedSessions.mjs +146 -0
- package/dist/src/builders/server/containedSessions.mjs.map +1 -0
- package/dist/src/builders/server/defaultWorkspace.cjs +46 -11
- package/dist/src/builders/server/defaultWorkspace.cjs.map +1 -1
- package/dist/src/builders/server/defaultWorkspace.mjs +42 -10
- package/dist/src/builders/server/defaultWorkspace.mjs.map +1 -1
- package/dist/src/builders/server/electronBinding.cjs +82 -0
- package/dist/src/builders/server/electronBinding.cjs.map +1 -0
- package/dist/src/builders/server/electronBinding.mjs +82 -0
- package/dist/src/builders/server/electronBinding.mjs.map +1 -0
- package/dist/src/builders/server/federation.cjs +364 -0
- package/dist/src/builders/server/federation.cjs.map +1 -0
- package/dist/src/builders/server/federation.mjs +363 -0
- package/dist/src/builders/server/federation.mjs.map +1 -0
- package/dist/src/builders/server/hostDisplayName.cjs +14 -0
- package/dist/src/builders/server/hostDisplayName.cjs.map +1 -0
- package/dist/src/builders/server/hostDisplayName.mjs +14 -0
- package/dist/src/builders/server/hostDisplayName.mjs.map +1 -0
- package/dist/src/builders/server/hostModelGateway.cjs +41 -0
- package/dist/src/builders/server/hostModelGateway.cjs.map +1 -0
- package/dist/src/builders/server/hostModelGateway.mjs +39 -0
- package/dist/src/builders/server/hostModelGateway.mjs.map +1 -0
- package/dist/src/builders/server/hostTeam.cjs +188 -0
- package/dist/src/builders/server/hostTeam.cjs.map +1 -0
- package/dist/src/builders/server/hostTeam.mjs +180 -0
- package/dist/src/builders/server/hostTeam.mjs.map +1 -0
- package/dist/src/builders/server/idleRestart.cjs +185 -40
- package/dist/src/builders/server/idleRestart.cjs.map +1 -1
- package/dist/src/builders/server/idleRestart.mjs +176 -39
- package/dist/src/builders/server/idleRestart.mjs.map +1 -1
- package/dist/src/builders/server/index.cjs +58 -19
- package/dist/src/builders/server/index.cjs.map +1 -1
- package/dist/src/builders/server/index.mjs +57 -19
- package/dist/src/builders/server/index.mjs.map +1 -1
- package/dist/src/builders/server/liveActivityPush.cjs +202 -0
- package/dist/src/builders/server/liveActivityPush.cjs.map +1 -0
- package/dist/src/builders/server/liveActivityPush.mjs +202 -0
- package/dist/src/builders/server/liveActivityPush.mjs.map +1 -0
- package/dist/src/builders/server/logSink.cjs +12 -10
- package/dist/src/builders/server/logSink.cjs.map +1 -1
- package/dist/src/builders/server/logSink.mjs +12 -10
- package/dist/src/builders/server/logSink.mjs.map +1 -1
- package/dist/src/builders/server/mcpApp.cjs +27 -20
- package/dist/src/builders/server/mcpApp.cjs.map +1 -1
- package/dist/src/builders/server/mcpApp.mjs +25 -18
- package/dist/src/builders/server/mcpApp.mjs.map +1 -1
- package/dist/src/builders/server/mcpAppBuild.cjs +61 -41
- package/dist/src/builders/server/mcpAppBuild.cjs.map +1 -1
- package/dist/src/builders/server/mcpAppBuild.d.mts +3 -6
- package/dist/src/builders/server/mcpAppBuild.d.mts.map +1 -1
- package/dist/src/builders/server/mcpAppBuild.mjs +61 -40
- package/dist/src/builders/server/mcpAppBuild.mjs.map +1 -1
- package/dist/src/builders/server/mcpBundle.cjs +20 -16
- package/dist/src/builders/server/mcpBundle.cjs.map +1 -1
- package/dist/src/builders/server/mcpBundle.d.mts +2 -1
- package/dist/src/builders/server/mcpBundle.d.mts.map +1 -1
- package/dist/src/builders/server/mcpBundle.mjs +20 -15
- package/dist/src/builders/server/mcpBundle.mjs.map +1 -1
- package/dist/src/builders/server/nativePush.cjs +229 -0
- package/dist/src/builders/server/nativePush.cjs.map +1 -0
- package/dist/src/builders/server/nativePush.mjs +228 -0
- package/dist/src/builders/server/nativePush.mjs.map +1 -0
- package/dist/src/builders/server/network.cjs +887 -0
- package/dist/src/builders/server/network.cjs.map +1 -0
- package/dist/src/builders/server/network.mjs +886 -0
- package/dist/src/builders/server/network.mjs.map +1 -0
- package/dist/src/builders/server/networkGateway.cjs +123 -0
- package/dist/src/builders/server/networkGateway.cjs.map +1 -0
- package/dist/src/builders/server/networkGateway.mjs +123 -0
- package/dist/src/builders/server/networkGateway.mjs.map +1 -0
- package/dist/src/builders/server/networkRelay.cjs +83 -0
- package/dist/src/builders/server/networkRelay.cjs.map +1 -0
- package/dist/src/builders/server/networkRelay.mjs +81 -0
- package/dist/src/builders/server/networkRelay.mjs.map +1 -0
- package/dist/src/builders/server/orgPluginLibraryBinding.cjs +72 -0
- package/dist/src/builders/server/orgPluginLibraryBinding.cjs.map +1 -0
- package/dist/src/builders/server/orgPluginLibraryBinding.mjs +72 -0
- package/dist/src/builders/server/orgPluginLibraryBinding.mjs.map +1 -0
- package/dist/src/builders/server/packageReloadCheck.cjs +46 -2
- package/dist/src/builders/server/packageReloadCheck.cjs.map +1 -1
- package/dist/src/builders/server/packageReloadCheck.mjs +46 -3
- package/dist/src/builders/server/packageReloadCheck.mjs.map +1 -1
- package/dist/src/builders/server/packageUrl.cjs +161 -58
- package/dist/src/builders/server/packageUrl.cjs.map +1 -1
- package/dist/src/builders/server/packageUrl.mjs +162 -58
- package/dist/src/builders/server/packageUrl.mjs.map +1 -1
- package/dist/src/builders/server/privateRelay.cjs +309 -0
- package/dist/src/builders/server/privateRelay.cjs.map +1 -0
- package/dist/src/builders/server/privateRelay.mjs +305 -0
- package/dist/src/builders/server/privateRelay.mjs.map +1 -0
- package/dist/src/builders/server/privateRelayCarrier.cjs +316 -0
- package/dist/src/builders/server/privateRelayCarrier.cjs.map +1 -0
- package/dist/src/builders/server/privateRelayCarrier.mjs +309 -0
- package/dist/src/builders/server/privateRelayCarrier.mjs.map +1 -0
- package/dist/src/builders/server/runtime.cjs +2750 -486
- package/dist/src/builders/server/runtime.cjs.map +1 -1
- package/dist/src/builders/server/runtime.mjs +2760 -500
- package/dist/src/builders/server/runtime.mjs.map +1 -1
- package/dist/src/builders/server/runtimeResources.cjs +37 -0
- package/dist/src/builders/server/runtimeResources.cjs.map +1 -1
- package/dist/src/builders/server/runtimeResources.mjs +38 -2
- package/dist/src/builders/server/runtimeResources.mjs.map +1 -1
- package/dist/src/builders/server/sandboxRouter.cjs +815 -0
- package/dist/src/builders/server/sandboxRouter.cjs.map +1 -0
- package/dist/src/builders/server/sandboxRouter.mjs +811 -0
- package/dist/src/builders/server/sandboxRouter.mjs.map +1 -0
- package/dist/src/builders/server/sandboxSessionHandoff.cjs +298 -0
- package/dist/src/builders/server/sandboxSessionHandoff.cjs.map +1 -0
- package/dist/src/builders/server/sandboxSessionHandoff.mjs +287 -0
- package/dist/src/builders/server/sandboxSessionHandoff.mjs.map +1 -0
- package/dist/src/builders/server/scopeReloadController.cjs +80 -0
- package/dist/src/builders/server/scopeReloadController.cjs.map +1 -0
- package/dist/src/builders/server/scopeReloadController.mjs +80 -0
- package/dist/src/builders/server/scopeReloadController.mjs.map +1 -0
- package/dist/src/builders/server/selectionStatus.cjs +2 -2
- package/dist/src/builders/server/selectionStatus.cjs.map +1 -1
- package/dist/src/builders/server/selectionStatus.mjs +2 -2
- package/dist/src/builders/server/selectionStatus.mjs.map +1 -1
- package/dist/src/builders/server/sessionArguments.cjs +65 -7
- package/dist/src/builders/server/sessionArguments.cjs.map +1 -1
- package/dist/src/builders/server/sessionArguments.mjs +64 -8
- package/dist/src/builders/server/sessionArguments.mjs.map +1 -1
- package/dist/src/builders/server/sessionRemoval.cjs +233 -0
- package/dist/src/builders/server/sessionRemoval.cjs.map +1 -0
- package/dist/src/builders/server/sessionRemoval.mjs +224 -0
- package/dist/src/builders/server/sessionRemoval.mjs.map +1 -0
- package/dist/src/builders/server/sessionSummaries.cjs +32 -0
- package/dist/src/builders/server/sessionSummaries.cjs.map +1 -0
- package/dist/src/builders/server/sessionSummaries.mjs +31 -0
- package/dist/src/builders/server/sessionSummaries.mjs.map +1 -0
- package/dist/src/builders/server/shutdown.cjs +23 -0
- package/dist/src/builders/server/shutdown.cjs.map +1 -1
- package/dist/src/builders/server/shutdown.mjs +21 -1
- package/dist/src/builders/server/shutdown.mjs.map +1 -1
- package/dist/src/builders/server/shutdownStack.cjs +44 -0
- package/dist/src/builders/server/shutdownStack.cjs.map +1 -0
- package/dist/src/builders/server/shutdownStack.mjs +43 -0
- package/dist/src/builders/server/shutdownStack.mjs.map +1 -0
- package/dist/src/builders/server/toolBoundaryHold.cjs +55 -0
- package/dist/src/builders/server/toolBoundaryHold.cjs.map +1 -0
- package/dist/src/builders/server/toolBoundaryHold.mjs +55 -0
- package/dist/src/builders/server/toolBoundaryHold.mjs.map +1 -0
- package/dist/src/builders/server/watcherService.cjs +55 -28
- package/dist/src/builders/server/watcherService.cjs.map +1 -1
- package/dist/src/builders/server/watcherService.mjs +55 -27
- package/dist/src/builders/server/watcherService.mjs.map +1 -1
- package/dist/src/builders/server/webTemplateDecision.cjs +7 -3
- package/dist/src/builders/server/webTemplateDecision.cjs.map +1 -1
- package/dist/src/builders/server/webTemplateDecision.mjs +7 -3
- package/dist/src/builders/server/webTemplateDecision.mjs.map +1 -1
- package/dist/src/builders/server/workspaceAdmission.cjs +96 -0
- package/dist/src/builders/server/workspaceAdmission.cjs.map +1 -0
- package/dist/src/builders/server/workspaceAdmission.mjs +90 -0
- package/dist/src/builders/server/workspaceAdmission.mjs.map +1 -0
- package/dist/src/builders/server/workspaceCheckout.cjs +16 -7
- package/dist/src/builders/server/workspaceCheckout.cjs.map +1 -1
- package/dist/src/builders/server/workspaceCheckout.mjs +16 -7
- package/dist/src/builders/server/workspaceCheckout.mjs.map +1 -1
- package/dist/src/builders/web/bundle.cjs +16 -14
- package/dist/src/builders/web/bundle.cjs.map +1 -1
- package/dist/src/builders/web/bundle.d.mts +3 -0
- package/dist/src/builders/web/bundle.d.mts.map +1 -1
- package/dist/src/builders/web/bundle.mjs +15 -13
- package/dist/src/builders/web/bundle.mjs.map +1 -1
- package/dist/src/builders/web/index.cjs +92 -59
- package/dist/src/builders/web/index.cjs.map +1 -1
- package/dist/src/builders/web/index.d.mts +21 -14
- package/dist/src/builders/web/index.d.mts.map +1 -1
- package/dist/src/builders/web/index.mjs +91 -59
- package/dist/src/builders/web/index.mjs.map +1 -1
- package/dist/src/builders/web/webPluginGenerate.cjs +84 -45
- package/dist/src/builders/web/webPluginGenerate.cjs.map +1 -1
- package/dist/src/builders/web/webPluginGenerate.d.mts +13 -4
- package/dist/src/builders/web/webPluginGenerate.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginGenerate.mjs +82 -44
- package/dist/src/builders/web/webPluginGenerate.mjs.map +1 -1
- package/dist/src/builders/web/webPluginManifest.cjs +24 -17
- package/dist/src/builders/web/webPluginManifest.cjs.map +1 -1
- package/dist/src/builders/web/webPluginManifest.d.mts +11 -23
- package/dist/src/builders/web/webPluginManifest.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginManifest.mjs +23 -16
- package/dist/src/builders/web/webPluginManifest.mjs.map +1 -1
- package/dist/src/builders/web/webPluginScan.cjs +11 -8
- package/dist/src/builders/web/webPluginScan.cjs.map +1 -1
- package/dist/src/builders/web/webPluginScan.d.mts +1 -1
- package/dist/src/builders/web/webPluginScan.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginScan.mjs +10 -7
- package/dist/src/builders/web/webPluginScan.mjs.map +1 -1
- package/dist/src/builders/web/webPluginVite.cjs +5 -5
- package/dist/src/builders/web/webPluginVite.cjs.map +1 -1
- package/dist/src/builders/web/webPluginVite.d.mts +1 -1
- package/dist/src/builders/web/webPluginVite.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginVite.mjs +3 -3
- package/dist/src/builders/web/webPluginVite.mjs.map +1 -1
- package/dist/src/cli/cliApp.cjs +18 -19
- package/dist/src/cli/cliApp.cjs.map +1 -1
- package/dist/src/cli/cliApp.d.mts +1 -1
- package/dist/src/cli/cliApp.d.mts.map +1 -1
- package/dist/src/cli/cliApp.mjs +18 -19
- package/dist/src/cli/cliApp.mjs.map +1 -1
- package/dist/src/cli/commands/api-export/index.cjs +14 -13
- package/dist/src/cli/commands/api-export/index.cjs.map +1 -1
- package/dist/src/cli/commands/api-export/index.mjs +13 -12
- package/dist/src/cli/commands/api-export/index.mjs.map +1 -1
- package/dist/src/cli/commands/doctor/help.cjs +4 -3
- package/dist/src/cli/commands/doctor/help.cjs.map +1 -1
- package/dist/src/cli/commands/doctor/help.d.mts.map +1 -1
- package/dist/src/cli/commands/doctor/help.mjs +4 -3
- package/dist/src/cli/commands/doctor/help.mjs.map +1 -1
- package/dist/src/cli/commands/doctor/index.cjs +30 -17
- package/dist/src/cli/commands/doctor/index.cjs.map +1 -1
- package/dist/src/cli/commands/doctor/index.d.mts +4 -4
- package/dist/src/cli/commands/doctor/index.d.mts.map +1 -1
- package/dist/src/cli/commands/doctor/index.mjs +28 -15
- package/dist/src/cli/commands/doctor/index.mjs.map +1 -1
- package/dist/src/cli/commands/emit-mcp/index.cjs +3 -2
- package/dist/src/cli/commands/emit-mcp/index.cjs.map +1 -1
- package/dist/src/cli/commands/emit-mcp/index.d.mts.map +1 -1
- package/dist/src/cli/commands/emit-mcp/index.mjs +3 -2
- package/dist/src/cli/commands/emit-mcp/index.mjs.map +1 -1
- package/dist/src/cli/commands/explain/index.cjs +53 -38
- package/dist/src/cli/commands/explain/index.cjs.map +1 -1
- package/dist/src/cli/commands/explain/index.d.mts +3 -4
- package/dist/src/cli/commands/explain/index.d.mts.map +1 -1
- package/dist/src/cli/commands/explain/index.mjs +52 -37
- package/dist/src/cli/commands/explain/index.mjs.map +1 -1
- package/dist/src/cli/commands/init/help.cjs +3 -2
- package/dist/src/cli/commands/init/help.cjs.map +1 -1
- package/dist/src/cli/commands/init/help.d.mts.map +1 -1
- package/dist/src/cli/commands/init/help.mjs +3 -2
- package/dist/src/cli/commands/init/help.mjs.map +1 -1
- package/dist/src/cli/commands/init/index.cjs +17 -12
- package/dist/src/cli/commands/init/index.cjs.map +1 -1
- package/dist/src/cli/commands/init/index.d.mts.map +1 -1
- package/dist/src/cli/commands/init/index.mjs +16 -11
- package/dist/src/cli/commands/init/index.mjs.map +1 -1
- package/dist/src/cli/commands/init/presenter.cjs +29 -21
- package/dist/src/cli/commands/init/presenter.cjs.map +1 -1
- package/dist/src/cli/commands/init/presenter.mjs +29 -21
- package/dist/src/cli/commands/init/presenter.mjs.map +1 -1
- package/dist/src/cli/commands/sync/help.cjs +7 -3
- package/dist/src/cli/commands/sync/help.cjs.map +1 -1
- package/dist/src/cli/commands/sync/help.d.mts.map +1 -1
- package/dist/src/cli/commands/sync/help.mjs +7 -3
- package/dist/src/cli/commands/sync/help.mjs.map +1 -1
- package/dist/src/cli/commands/sync/index.cjs +72 -40
- package/dist/src/cli/commands/sync/index.cjs.map +1 -1
- package/dist/src/cli/commands/sync/index.d.mts.map +1 -1
- package/dist/src/cli/commands/sync/index.mjs +69 -37
- package/dist/src/cli/commands/sync/index.mjs.map +1 -1
- package/dist/src/cli/commands/sync/presenter.cjs +10 -1
- package/dist/src/cli/commands/sync/presenter.cjs.map +1 -1
- package/dist/src/cli/commands/sync/presenter.d.mts +0 -9
- package/dist/src/cli/commands/sync/presenter.d.mts.map +1 -1
- package/dist/src/cli/commands/sync/presenter.mjs +10 -1
- package/dist/src/cli/commands/sync/presenter.mjs.map +1 -1
- package/dist/src/cli/commands/web/index.cjs +7 -6
- package/dist/src/cli/commands/web/index.cjs.map +1 -1
- package/dist/src/cli/commands/web/index.mjs +6 -5
- package/dist/src/cli/commands/web/index.mjs.map +1 -1
- package/dist/src/cli/harnessOptions.cjs +15 -24
- package/dist/src/cli/harnessOptions.cjs.map +1 -1
- package/dist/src/cli/harnessOptions.d.mts +2 -2
- package/dist/src/cli/harnessOptions.d.mts.map +1 -1
- package/dist/src/cli/harnessOptions.mjs +14 -22
- package/dist/src/cli/harnessOptions.mjs.map +1 -1
- package/dist/src/cli/help.cjs +20 -26
- package/dist/src/cli/help.cjs.map +1 -1
- package/dist/src/cli/help.d.mts +1 -2
- package/dist/src/cli/help.d.mts.map +1 -1
- package/dist/src/cli/help.mjs +15 -20
- package/dist/src/cli/help.mjs.map +1 -1
- package/dist/src/cli/locale.cjs +30 -0
- package/dist/src/cli/locale.cjs.map +1 -0
- package/dist/src/cli/locale.mjs +27 -0
- package/dist/src/cli/locale.mjs.map +1 -0
- package/dist/src/cli/matrixOptions.cjs +85 -37
- package/dist/src/cli/matrixOptions.cjs.map +1 -1
- package/dist/src/cli/matrixOptions.d.mts +22 -16
- package/dist/src/cli/matrixOptions.d.mts.map +1 -1
- package/dist/src/cli/matrixOptions.mjs +76 -33
- package/dist/src/cli/matrixOptions.mjs.map +1 -1
- package/dist/src/cli/options.cjs +51 -128
- package/dist/src/cli/options.cjs.map +1 -1
- package/dist/src/cli/options.d.mts +1 -1
- package/dist/src/cli/options.d.mts.map +1 -1
- package/dist/src/cli/options.mjs +53 -130
- package/dist/src/cli/options.mjs.map +1 -1
- package/dist/src/cli/router.cjs +0 -1
- package/dist/src/cli/router.cjs.map +1 -1
- package/dist/src/cli/router.d.mts +1 -1
- package/dist/src/cli/router.mjs +0 -1
- package/dist/src/cli/router.mjs.map +1 -1
- package/dist/src/cli/server/options.cjs +37 -7
- package/dist/src/cli/server/options.cjs.map +1 -1
- package/dist/src/cli/server/options.mjs +37 -7
- package/dist/src/cli/server/options.mjs.map +1 -1
- package/dist/src/cli/server/processGuards.cjs +22 -15
- package/dist/src/cli/server/processGuards.cjs.map +1 -1
- package/dist/src/cli/server/processGuards.mjs +21 -14
- package/dist/src/cli/server/processGuards.mjs.map +1 -1
- package/dist/src/cli/server/restartPolicy.cjs +38 -0
- package/dist/src/cli/server/restartPolicy.cjs.map +1 -0
- package/dist/src/cli/server/restartPolicy.d.mts +21 -0
- package/dist/src/cli/server/restartPolicy.d.mts.map +1 -0
- package/dist/src/cli/server/restartPolicy.mjs +36 -0
- package/dist/src/cli/server/restartPolicy.mjs.map +1 -0
- package/dist/src/cli/server/run.cjs +12 -11
- package/dist/src/cli/server/run.cjs.map +1 -1
- package/dist/src/cli/server/run.mjs +11 -10
- package/dist/src/cli/server/run.mjs.map +1 -1
- package/dist/src/cli/server/supervise.cjs +89 -0
- package/dist/src/cli/server/supervise.cjs.map +1 -0
- package/dist/src/cli/server/supervise.mjs +89 -0
- package/dist/src/cli/server/supervise.mjs.map +1 -0
- package/dist/src/composition/harnessState/index.cjs +2 -1
- package/dist/src/composition/harnessState/index.cjs.map +1 -1
- package/dist/src/composition/harnessState/index.d.mts +2 -1
- package/dist/src/composition/harnessState/index.d.mts.map +1 -1
- package/dist/src/composition/harnessState/index.mjs +2 -1
- package/dist/src/composition/harnessState/index.mjs.map +1 -1
- package/dist/src/composition/layerPackageInstaller/index.cjs +293 -86
- package/dist/src/composition/layerPackageInstaller/index.cjs.map +1 -1
- package/dist/src/composition/layerPackageInstaller/index.d.mts +25 -2
- package/dist/src/composition/layerPackageInstaller/index.d.mts.map +1 -1
- package/dist/src/composition/layerPackageInstaller/index.mjs +295 -94
- package/dist/src/composition/layerPackageInstaller/index.mjs.map +1 -1
- package/dist/src/composition/marketplaceCatalog/index.cjs +136 -0
- package/dist/src/composition/marketplaceCatalog/index.cjs.map +1 -0
- package/dist/src/composition/marketplaceCatalog/index.mjs +132 -0
- package/dist/src/composition/marketplaceCatalog/index.mjs.map +1 -0
- package/dist/src/composition/orgPluginActivation/index.cjs +179 -0
- package/dist/src/composition/orgPluginActivation/index.cjs.map +1 -0
- package/dist/src/composition/orgPluginActivation/index.mjs +177 -0
- package/dist/src/composition/orgPluginActivation/index.mjs.map +1 -0
- package/dist/src/composition/orgPluginLibrary/index.cjs +205 -0
- package/dist/src/composition/orgPluginLibrary/index.cjs.map +1 -0
- package/dist/src/composition/orgPluginLibrary/index.mjs +200 -0
- package/dist/src/composition/orgPluginLibrary/index.mjs.map +1 -0
- package/dist/src/composition/pluginMarketplace/index.cjs +304 -0
- package/dist/src/composition/pluginMarketplace/index.cjs.map +1 -0
- package/dist/src/composition/pluginMarketplace/index.mjs +302 -0
- package/dist/src/composition/pluginMarketplace/index.mjs.map +1 -0
- package/dist/src/composition/poHomeMigration/index.cjs +46 -26
- package/dist/src/composition/poHomeMigration/index.cjs.map +1 -1
- package/dist/src/composition/poHomeMigration/index.d.mts.map +1 -1
- package/dist/src/composition/poHomeMigration/index.mjs +45 -25
- package/dist/src/composition/poHomeMigration/index.mjs.map +1 -1
- package/dist/src/composition/projectTrust/index.cjs +40 -3
- package/dist/src/composition/projectTrust/index.cjs.map +1 -1
- package/dist/src/composition/projectTrust/index.d.mts +8 -0
- package/dist/src/composition/projectTrust/index.d.mts.map +1 -1
- package/dist/src/composition/projectTrust/index.mjs +33 -2
- package/dist/src/composition/projectTrust/index.mjs.map +1 -1
- package/dist/src/composition/repository/index.cjs +29 -12
- package/dist/src/composition/repository/index.cjs.map +1 -1
- package/dist/src/composition/repository/index.d.mts +10 -3
- package/dist/src/composition/repository/index.d.mts.map +1 -1
- package/dist/src/composition/repository/index.mjs +29 -13
- package/dist/src/composition/repository/index.mjs.map +1 -1
- package/dist/src/composition/syncPrune/index.cjs +23 -16
- package/dist/src/composition/syncPrune/index.cjs.map +1 -1
- package/dist/src/composition/syncPrune/index.d.mts.map +1 -1
- package/dist/src/composition/syncPrune/index.mjs +22 -15
- package/dist/src/composition/syncPrune/index.mjs.map +1 -1
- package/dist/src/composition/syncService/index.cjs +441 -194
- package/dist/src/composition/syncService/index.cjs.map +1 -1
- package/dist/src/composition/syncService/index.d.mts +4 -1
- package/dist/src/composition/syncService/index.d.mts.map +1 -1
- package/dist/src/composition/syncService/index.mjs +440 -196
- package/dist/src/composition/syncService/index.mjs.map +1 -1
- package/dist/src/composition/syncService/localBuilds.cjs +41 -37
- package/dist/src/composition/syncService/localBuilds.cjs.map +1 -1
- package/dist/src/composition/syncService/localBuilds.mjs +40 -37
- package/dist/src/composition/syncService/localBuilds.mjs.map +1 -1
- package/dist/src/composition/transitionLayers.cjs.map +1 -1
- package/dist/src/composition/transitionLayers.d.mts +3 -3
- package/dist/src/composition/transitionLayers.d.mts.map +1 -1
- package/dist/src/composition/transitionLayers.mjs.map +1 -1
- package/dist/src/composition/types/harness.d.mts +4 -9
- package/dist/src/composition/types/harness.d.mts.map +1 -1
- package/dist/src/extensions/setupDiagnostics.cjs +8 -8
- package/dist/src/extensions/setupDiagnostics.cjs.map +1 -1
- package/dist/src/extensions/setupDiagnostics.mjs +8 -8
- package/dist/src/extensions/setupDiagnostics.mjs.map +1 -1
- package/dist/webBuilder.cjs +2 -0
- package/dist/webBuilder.d.mts +3 -3
- package/dist/webBuilder.mjs +3 -3
- package/docs/server/api-export.md +9 -9
- package/docs/server/api.md +22 -125
- package/docs/server/getting-started.md +21 -85
- package/docs/server/index.md +13 -58
- package/docs/server/ipc.md +26 -72
- package/docs/server/lifecycle.md +18 -91
- package/docs/server/security.md +20 -80
- package/locales/vi.json +208 -0
- package/locales/zh-CN.json +208 -0
- package/package.json +52 -69
- package/src/prompts/po-author-extension/SKILL.md +2 -2
- package/src/prompts/po-author-extension/references/extension-contract.md +4 -6
- package/dist/antigravity.cjs +0 -5
- package/dist/antigravity.d.mts +0 -2
- package/dist/antigravity.mjs +0 -1
- package/dist/codex.cjs +0 -8
- package/dist/codex.d.mts +0 -2
- package/dist/codex.mjs +0 -1
- package/dist/compatibility.cjs +0 -27
- package/dist/compatibility.d.mts +0 -6
- package/dist/compatibility.mjs +0 -6
- package/dist/compatibilityCommand.cjs +0 -4
- package/dist/compatibilityCommand.d.mts +0 -2
- package/dist/compatibilityCommand.mjs +0 -1
- package/dist/compatibilityContext.cjs +0 -3
- package/dist/compatibilityContext.d.mts +0 -2
- package/dist/compatibilityContext.mjs +0 -1
- package/dist/compatibilityOptions.cjs +0 -5
- package/dist/compatibilityOptions.d.mts +0 -2
- package/dist/compatibilityOptions.mjs +0 -1
- package/dist/process.cjs +0 -12
- package/dist/process.d.mts +0 -2
- package/dist/process.mjs +0 -1
- package/dist/src/builders/hooks/index.cjs +0 -238
- package/dist/src/builders/hooks/index.cjs.map +0 -1
- package/dist/src/builders/hooks/index.mjs +0 -231
- package/dist/src/builders/hooks/index.mjs.map +0 -1
- package/dist/src/cli/commands/compat/context.cjs +0 -115
- package/dist/src/cli/commands/compat/context.cjs.map +0 -1
- package/dist/src/cli/commands/compat/context.d.mts +0 -22
- package/dist/src/cli/commands/compat/context.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/context.mjs +0 -110
- package/dist/src/cli/commands/compat/context.mjs.map +0 -1
- package/dist/src/cli/commands/compat/help.cjs +0 -26
- package/dist/src/cli/commands/compat/help.cjs.map +0 -1
- package/dist/src/cli/commands/compat/help.d.mts +0 -4
- package/dist/src/cli/commands/compat/help.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/help.mjs +0 -25
- package/dist/src/cli/commands/compat/help.mjs.map +0 -1
- package/dist/src/cli/commands/compat/index.cjs +0 -73
- package/dist/src/cli/commands/compat/index.cjs.map +0 -1
- package/dist/src/cli/commands/compat/index.d.mts +0 -14
- package/dist/src/cli/commands/compat/index.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/index.mjs +0 -70
- package/dist/src/cli/commands/compat/index.mjs.map +0 -1
- package/dist/src/cli/commands/compat/options.cjs +0 -88
- package/dist/src/cli/commands/compat/options.cjs.map +0 -1
- package/dist/src/cli/commands/compat/options.d.mts +0 -15
- package/dist/src/cli/commands/compat/options.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/options.mjs +0 -86
- package/dist/src/cli/commands/compat/options.mjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/antigravity.cjs +0 -294
- package/dist/src/cli/commands/compat/providers/antigravity.cjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/antigravity.d.mts +0 -9
- package/dist/src/cli/commands/compat/providers/antigravity.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/providers/antigravity.mjs +0 -289
- package/dist/src/cli/commands/compat/providers/antigravity.mjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/codex.cjs +0 -178
- package/dist/src/cli/commands/compat/providers/codex.cjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/codex.d.mts +0 -17
- package/dist/src/cli/commands/compat/providers/codex.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/providers/codex.mjs +0 -170
- package/dist/src/cli/commands/compat/providers/codex.mjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/index.cjs +0 -65
- package/dist/src/cli/commands/compat/providers/index.cjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/index.d.mts +0 -15
- package/dist/src/cli/commands/compat/providers/index.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/providers/index.mjs +0 -45
- package/dist/src/cli/commands/compat/providers/index.mjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/process.cjs +0 -172
- package/dist/src/cli/commands/compat/providers/process.cjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/process.d.mts +0 -33
- package/dist/src/cli/commands/compat/providers/process.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/providers/process.mjs +0 -159
- package/dist/src/cli/commands/compat/providers/process.mjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/shared.cjs +0 -76
- package/dist/src/cli/commands/compat/providers/shared.cjs.map +0 -1
- package/dist/src/cli/commands/compat/providers/shared.d.mts +0 -40
- package/dist/src/cli/commands/compat/providers/shared.d.mts.map +0 -1
- package/dist/src/cli/commands/compat/providers/shared.mjs +0 -61
- package/dist/src/cli/commands/compat/providers/shared.mjs.map +0 -1
- package/dist/src/cli/commands/compat/types.d.mts +0 -31
- package/dist/src/cli/commands/compat/types.d.mts.map +0 -1
- package/dist/src/cli/commands/init/constants.cjs +0 -11
- package/dist/src/cli/commands/init/constants.cjs.map +0 -1
- package/dist/src/cli/commands/init/constants.mjs +0 -11
- package/dist/src/cli/commands/init/constants.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cliApp.mjs","names":[],"sources":["../../../src/cli/cliApp.ts"],"sourcesContent":["import type { HarnessTelemetry } from '@agimon-ai/po-core/runtimeLogSinkTelemetry';\n\nimport type { HarnessOptions } from '../composition/types/harness';\nimport type { BaseCommand } from './commands/baseCommand';\nimport { HARNESS_VERSION, printHelp } from './help';\nimport { parseHarnessArgs } from './options';\n\nconst NO_HARNESS_COMMAND = 'No harness command selected: pass --explain or --emit-mcp, or run po to start po-web.';\n\n/**\n * Main CLI Application\n *\n * Owns command registration and dispatch. Preparation is shared: the context\n * is built once and handed to whichever command claims the run.\n */\nasync function selectHarnessCommand(\n options: HarnessOptions,\n): Promise<\n (context: import('../builders/cli/harnessContext').HarnessContext, telemetry: HarnessTelemetry) => Promise<number>\n> {\n if (options.emitMcp) return (await import('./commands/emit-mcp')).runEmitMcp;\n if (options.explain) return (await import('./commands/explain')).runExplain;\n throw new Error(NO_HARNESS_COMMAND);\n}\nasync function selectLegacyCommand(options: HarnessOptions): Promise<BaseCommand> {\n if (options.emitMcp) {\n const { EmitMcpCommand } = await import('./commands/emit-mcp');\n return new EmitMcpCommand();\n }\n if (options.explain) {\n const { ExplainCommand } = await import('./commands/explain');\n return new ExplainCommand();\n }\n throw new Error(NO_HARNESS_COMMAND);\n}\n/**\n * The terminal app reads only what sync prepared. Packages the selected layers name that do not\n * resolve yet start a detached background sync from the repository, which registers it as a\n * workspace so sync covers its packages, and they arrive on the next launch.\n */\nexport async function requestUnsyncedPackages(\n repoRoot: string,\n context: Pick<\n import('../builders/cli/harnessContext').HarnessContext,\n 'majorModesConfig' | 'selectedLayers' | 'environment'\n >,\n): Promise<void> {\n const [{ missingLayerPackageSpecifiers }, { createLayerResolvers }, { createBackgroundSync }] = await Promise.all([\n import('../composition/layerPackageInstaller'),\n import('../builders/cli/extensionAssembler'),\n import('../builders/server/backgroundSync'),\n ]);\n const missing = missingLayerPackageSpecifiers(\n context.majorModesConfig,\n context.selectedLayers,\n createLayerResolvers(repoRoot, context.environment),\n );\n if (missing.length === 0) return;\n const notice = (message: string): void => {\n process.stderr.write(`${message}\\n`);\n };\n const started = createBackgroundSync({\n environment: context.environment,\n onNotice: notice,\n detached: true,\n repoRoot,\n }).request('the terminal app found unsynced packages');\n notice(\n started\n ? `Po is syncing ${missing.join(', ')} in the background; they arrive on the next launch.`\n : `${missing.join(', ')} ${missing.length === 1 ? 'is' : 'are'} not synced; run po sync to prepare them.`,\n );\n}\n/** Only the diagnostic commands consume a harness context; bare `po` runs po-web. */\nfunction wantsHarnessCommand(options: Pick<HarnessOptions, 'emitMcp' | 'explain'>): boolean {\n return Boolean(options.emitMcp) || options.explain;\n}\nfunction createCliApplication(initialTelemetry?: HarnessTelemetry) {\n let telemetry = initialTelemetry;\n let ownsTelemetry = false;\n async function getTelemetry(): Promise<HarnessTelemetry> {\n if (telemetry) return telemetry;\n const { createHarnessTelemetry } = await import('@agimon-ai/po-core/runtimeLogSinkTelemetry');\n // Telemetry's transport graph costs roughly one launcher budget slice by\n // itself. Startup callbacks and lifecycle events buffer until shutdown, so\n // transport initialization cannot compete with the Pi child for input.\n telemetry = createHarnessTelemetry({ deferSpans: true });\n ownsTelemetry = true;\n return telemetry;\n }\n\n async function runHarness(options: HarnessOptions): Promise<number> {\n const telemetry = await getTelemetry();\n const [{ buildHarnessContext }, { HARNESS_EVENT }] = await Promise.all([\n import('../builders/cli/harnessContext'),\n import('@agimon-ai/po-core/runtimeLogSinkTelemetry'),\n ]);\n return telemetry.runInSpan(\n 'po_pi.run',\n {\n 'harness.major_mode': options.majorMode,\n 'harness.domain_count': options.domains.length,\n 'harness.agents': options.agents,\n 'harness.mcp': options.mcp,\n 'harness.hooks': options.hooks,\n ...(options.profile ? { 'harness.profile': options.profile } : {}),\n ...(options.preset ? { 'harness.preset': options.preset } : {}),\n },\n async () => {\n const context = await buildHarnessContext(options, telemetry);\n try {\n await requestUnsyncedPackages(options.repoRoot, context);\n const command = await selectHarnessCommand(context.options);\n // Selection uses the same resolved options used to build the context.\n return await command(context, telemetry);\n } catch (error) {\n await telemetry.recordError(HARNESS_EVENT.cliFailed, error);\n throw error;\n } finally {\n await context.cleanup();\n }\n },\n );\n }\n\n async function run(args: string[]): Promise<number> {\n if (args[0] === 'init') {\n const { runInit } = await import('./commands/init');\n return runInit(args);\n }\n if (args[0] === 'sync') {\n const { runSync } = await import('./commands/sync/workflow');\n return runSync(args);\n }\n if (args[0] === 'api-export') {\n const { runApiExport } = await import('./commands/api-export');\n return runApiExport(args);\n }\n if (args[0] === 'doctor') {\n const { runDoctor } = await import('./commands/doctor');\n return runDoctor(args);\n }\n if (args[0] === 'compat') {\n const [{ runCompatibility }, telemetry] = await Promise.all([import('./commands/compat'), getTelemetry()]);\n return runCompatibility(args, undefined, undefined, telemetry);\n }\n\n // The first pass resolves --cwd without touching repository configuration,\n // which keeps help and version available even when modes.yaml is malformed.\n const initial = parseHarnessArgs(args);\n if (initial.help) {\n printHelp();\n return 0;\n }\n if (initial.version) {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n }\n // Bare `po` serves the web console. po-web owns its own arguments, so they\n // pass through untouched and never reach repository configuration here.\n if (!wantsHarnessCommand(initial.options)) {\n const { runPoWeb } = await import('./commands/web');\n return runPoWeb(args);\n }\n const telemetry = await getTelemetry();\n const [{ resolveHarnessOptions }, { toFailureReporter }] = await Promise.all([\n import('./harnessOptions'),\n import('@agimon-ai/po-core/runtimeLogSinkTelemetry'),\n ]);\n return runHarness(resolveHarnessOptions({ args, report: toFailureReporter(telemetry) }));\n }\n\n async function shutdown(): Promise<void> {\n if (ownsTelemetry) await telemetry?.shutdown();\n }\n return { run, runHarness, shutdown };\n}\n/** Public compatibility API; execution is implemented by the application functions. */\nexport class CliApp {\n private readonly app: ReturnType<typeof createCliApplication>;\n constructor(telemetry?: HarnessTelemetry) {\n this.app = createCliApplication(telemetry);\n }\n selectCommand(options: HarnessOptions): Promise<BaseCommand> {\n return selectLegacyCommand(options);\n }\n runHarness(options: HarnessOptions): Promise<number> {\n return this.app.runHarness(options);\n }\n run(args: string[]): Promise<number> {\n return this.app.run(args);\n }\n shutdown(): Promise<void> {\n return this.app.shutdown();\n }\n}\n\n/**\n * Convenience wrapper kept so the binary and tests need no CliApp knowledge.\n *\n * Telemetry is shut down here rather than inside runHarness, because this is\n * the only scope that owns the process: flushing earlier would drop the records\n * a later command still emits.\n */\nexport async function runCli(args: string[]): Promise<number> {\n const app = createCliApplication();\n try {\n return await app.run(args);\n } finally {\n await app.shutdown();\n }\n}\n\n/** Runs an already-resolved option set, skipping argument parsing. */\nexport async function runHarness(options: HarnessOptions): Promise<number> {\n const app = createCliApplication();\n try {\n return await app.runHarness(options);\n } finally {\n await app.shutdown();\n }\n}\n"],"mappings":";;;AAOA,MAAM,qBAAqB;;;;;;;AAQ3B,eAAe,qBACb,SAGA;CACA,IAAI,QAAQ,SAAS,QAAQ,MAAM,OAAO,iCAAA,CAAwB;CAClE,IAAI,QAAQ,SAAS,QAAQ,MAAM,OAAO,gCAAA,CAAuB;CACjE,MAAM,IAAI,MAAM,kBAAkB;AACpC;AACA,eAAe,oBAAoB,SAA+C;CAChF,IAAI,QAAQ,SAAS;EACnB,MAAM,EAAE,mBAAm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cliApp.ts"],"sourcesContent":["import type { HarnessTelemetry } from '@agimon-ai/po-core/runtimeLogSinkTelemetry';\n\nimport type { HarnessOptions } from '../composition/types/harness';\nimport type { BaseCommand } from './commands/baseCommand';\nimport { HARNESS_VERSION, printHelp } from './help';\nimport { cliText } from './locale';\nimport { parseHarnessArgs } from './options';\n\n/**\n * Main CLI Application\n *\n * Owns command registration and dispatch. Preparation is shared: the context\n * is built once and handed to whichever command claims the run.\n */\nasync function selectHarnessCommand(\n options: HarnessOptions,\n): Promise<\n (context: import('../builders/cli/harnessContext').HarnessContext, telemetry: HarnessTelemetry) => Promise<number>\n> {\n if (options.emitMcp) return (await import('./commands/emit-mcp')).runEmitMcp;\n if (options.explain) return (await import('./commands/explain')).runExplain;\n throw new Error(\n cliText(\n 'cli.error.noHarnessCommand',\n 'No harness command selected: pass --explain or --emit-mcp, or run po to start po-web.',\n ),\n );\n}\nasync function selectLegacyCommand(options: HarnessOptions): Promise<BaseCommand> {\n if (options.emitMcp) {\n const { EmitMcpCommand } = await import('./commands/emit-mcp');\n return new EmitMcpCommand();\n }\n if (options.explain) {\n const { ExplainCommand } = await import('./commands/explain');\n return new ExplainCommand();\n }\n throw new Error(\n cliText(\n 'cli.error.noHarnessCommand',\n 'No harness command selected: pass --explain or --emit-mcp, or run po to start po-web.',\n ),\n );\n}\n/**\n * The terminal app reads only what sync prepared. Packages the selected layers name that do not\n * resolve yet start a detached background sync from the repository, which registers it as a\n * workspace so sync covers its packages, and they arrive on the next launch.\n */\nexport async function requestUnsyncedPackages(\n repoRoot: string,\n context: Pick<\n import('../builders/cli/harnessContext').HarnessContext,\n 'presetsConfig' | 'selectedLayers' | 'environment'\n >,\n): Promise<void> {\n const [{ missingLayerPackageSpecifiers }, { createLayerResolvers }, { createBackgroundSync }] = await Promise.all([\n import('../composition/layerPackageInstaller'),\n import('../builders/cli/extensionAssembler'),\n import('../builders/server/backgroundSync'),\n ]);\n const missing = missingLayerPackageSpecifiers(\n context.presetsConfig,\n context.selectedLayers,\n createLayerResolvers(repoRoot, context.environment),\n );\n if (missing.length === 0) return;\n const notice = (message: string): void => {\n process.stderr.write(`${message}\\n`);\n };\n const started = await createBackgroundSync({\n environment: context.environment,\n onNotice: notice,\n detached: true,\n repoRoot,\n }).request('the terminal app found unsynced packages');\n notice(\n started\n ? cliText(\n 'cli.packages.backgroundSync',\n 'Po is syncing {packages} in the background; they arrive on the next launch.',\n { packages: missing.join(', ') },\n )\n : missing.length === 1\n ? cliText('cli.packages.unsyncedOne', '{packages} is not synced; run po sync to prepare them.', {\n packages: missing.join(', '),\n })\n : cliText('cli.packages.unsyncedMany', '{packages} are not synced; run po sync to prepare them.', {\n packages: missing.join(', '),\n }),\n );\n}\n/** Only the diagnostic commands consume a harness context; bare `po` runs po-web. */\nfunction wantsHarnessCommand(options: Pick<HarnessOptions, 'emitMcp' | 'explain'>): boolean {\n return Boolean(options.emitMcp) || options.explain;\n}\nfunction createCliApplication(initialTelemetry?: HarnessTelemetry) {\n let telemetry = initialTelemetry;\n let ownsTelemetry = false;\n async function getTelemetry(environment: NodeJS.ProcessEnv, cwd: string): Promise<HarnessTelemetry> {\n if (telemetry) return telemetry;\n const { createHarnessTelemetry } = await import('@agimon-ai/po-core/runtimeLogSinkTelemetry');\n // Telemetry's transport graph costs roughly one launcher budget slice by\n // itself. Startup callbacks and lifecycle events buffer until shutdown, so\n // transport initialization cannot compete with the Pi child for input.\n telemetry = createHarnessTelemetry({ env: environment, cwd, deferSpans: true });\n ownsTelemetry = true;\n return telemetry;\n }\n\n async function runHarness(options: HarnessOptions): Promise<number> {\n const telemetry = await getTelemetry(options.environment ?? process.env, options.cwd);\n const [{ buildHarnessContext }, { HARNESS_EVENT }] = await Promise.all([\n import('../builders/cli/harnessContext'),\n import('@agimon-ai/po-core/runtimeLogSinkTelemetry'),\n ]);\n return telemetry.runInSpan(\n 'po_pi.run',\n {\n 'harness.preset': options.preset,\n 'harness.domain_count': options.domains.length,\n 'harness.agents': options.agents,\n 'harness.mcp': options.mcp,\n ...(options.profile ? { 'harness.profile': options.profile } : {}),\n },\n async () => {\n const context = await buildHarnessContext(options, telemetry);\n try {\n await requestUnsyncedPackages(options.repoRoot, context);\n const command = await selectHarnessCommand(context.options);\n // Selection uses the same resolved options used to build the context.\n return await command(context, telemetry);\n } catch (error) {\n await telemetry.recordError(HARNESS_EVENT.cliFailed, error);\n throw error;\n } finally {\n await context.cleanup();\n }\n },\n );\n }\n\n async function run(args: string[]): Promise<number> {\n if (args[0] === 'compat')\n throw new Error(cliText('cli.error.retiredCompat', 'po compat has been retired. Use native Po sessions.'));\n if (args[0] === 'init') {\n const { runInit } = await import('./commands/init');\n return runInit(args);\n }\n if (args[0] === 'sync') {\n const { runSync } = await import('./commands/sync/workflow');\n return runSync(args);\n }\n if (args[0] === 'api-export') {\n const { runApiExport } = await import('./commands/api-export');\n return runApiExport(args);\n }\n if (args[0] === 'doctor') {\n const { runDoctor } = await import('./commands/doctor');\n return runDoctor(args);\n }\n\n // The first pass resolves --cwd without touching repository configuration,\n // which keeps help and version available even when presets.yaml is malformed.\n const initial = parseHarnessArgs(args);\n if (initial.help) {\n printHelp();\n return 0;\n }\n if (initial.version) {\n process.stdout.write(`${HARNESS_VERSION}\\n`);\n return 0;\n }\n // Bare `po` serves the web console. po-web owns its own arguments, so they\n // pass through untouched and never reach repository configuration here.\n if (!wantsHarnessCommand(initial.options)) {\n const { runPoWeb } = await import('./commands/web');\n return runPoWeb(args);\n }\n const telemetry = await getTelemetry(process.env, process.cwd());\n const [{ resolveHarnessOptions }, { toFailureReporter }] = await Promise.all([\n import('./harnessOptions'),\n import('@agimon-ai/po-core/runtimeLogSinkTelemetry'),\n ]);\n const options = await resolveHarnessOptions({ args, report: toFailureReporter(telemetry) });\n return runHarness(options);\n }\n\n async function shutdown(): Promise<void> {\n if (ownsTelemetry) await telemetry?.shutdown();\n }\n return { run, runHarness, shutdown };\n}\n/** Public compatibility API; execution is implemented by the application functions. */\nexport class CliApp {\n private readonly app: ReturnType<typeof createCliApplication>;\n constructor(telemetry?: HarnessTelemetry) {\n this.app = createCliApplication(telemetry);\n }\n selectCommand(options: HarnessOptions): Promise<BaseCommand> {\n return selectLegacyCommand(options);\n }\n runHarness(options: HarnessOptions): Promise<number> {\n return this.app.runHarness(options);\n }\n run(args: string[]): Promise<number> {\n return this.app.run(args);\n }\n shutdown(): Promise<void> {\n return this.app.shutdown();\n }\n}\n\n/**\n * Convenience wrapper kept so the binary and tests need no CliApp knowledge.\n *\n * Telemetry is shut down here rather than inside runHarness, because this is\n * the only scope that owns the process: flushing earlier would drop the records\n * a later command still emits.\n */\nexport async function runCli(args: string[]): Promise<number> {\n const app = createCliApplication();\n try {\n return await app.run(args);\n } finally {\n await app.shutdown();\n }\n}\n\n/** Runs an already-resolved option set, skipping argument parsing. */\nexport async function runHarness(options: HarnessOptions): Promise<number> {\n const app = createCliApplication();\n try {\n return await app.runHarness(options);\n } finally {\n await app.shutdown();\n }\n}\n"],"mappings":";;;;;;;;;;AAcA,eAAe,qBACb,SAGA;CACA,IAAI,QAAQ,SAAS,QAAQ,MAAM,OAAO,iCAAA,CAAwB;CAClE,IAAI,QAAQ,SAAS,QAAQ,MAAM,OAAO,gCAAA,CAAuB;CACjE,MAAM,IAAI,MACR,QACE,8BACA,uFACF,CACF;AACF;AACA,eAAe,oBAAoB,SAA+C;CAChF,IAAI,QAAQ,SAAS;EACnB,MAAM,EAAE,mBAAmB,MAAM,OAAO;EACxC,OAAO,IAAI,eAAe;CAC5B;CACA,IAAI,QAAQ,SAAS;EACnB,MAAM,EAAE,mBAAmB,MAAM,OAAO;EACxC,OAAO,IAAI,eAAe;CAC5B;CACA,MAAM,IAAI,MACR,QACE,8BACA,uFACF,CACF;AACF;;;;;;AAMA,eAAsB,wBACpB,UACA,SAIe;CACf,MAAM,CAAC,EAAE,iCAAiC,EAAE,wBAAwB,EAAE,0BAA0B,MAAM,QAAQ,IAAI;EAChH,OAAO;EACP,OAAO;EACP,OAAO;CACT,CAAC;CACD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B,MAAM,QAAQ,IAAI,CAC3E,OAAO,yBACP,OAAO,6CACT,CAAC;EAED,OAAO,WAAW,MADI,sBAAsB;GAAE;GAAM,QAAQ,kBAAkB,SAAS;EAAE,CAAC,CACjE;CAC3B;CAEA,eAAe,WAA0B;EACvC,IAAI,eAAe,MAAM,WAAW,SAAS;CAC/C;CACA,OAAO;EAAE;EAAK;EAAY;CAAS;AACrC;;AAEA,IAAa,SAAb,MAAoB;CAClB;CACA,YAAY,WAA8B;EACxC,KAAK,MAAM,qBAAqB,SAAS;CAC3C;CACA,cAAc,SAA+C;EAC3D,OAAO,oBAAoB,OAAO;CACpC;CACA,WAAW,SAA0C;EACnD,OAAO,KAAK,IAAI,WAAW,OAAO;CACpC;CACA,IAAI,MAAiC;EACnC,OAAO,KAAK,IAAI,IAAI,IAAI;CAC1B;CACA,WAA0B;EACxB,OAAO,KAAK,IAAI,SAAS;CAC3B;AACF;;;;;;;;AASA,eAAsB,OAAO,MAAiC;CAC5D,MAAM,MAAM,qBAAqB;CACjC,IAAI;EACF,OAAO,MAAM,IAAI,IAAI,IAAI;CAC3B,UAAU;EACR,MAAM,IAAI,SAAS;CACrB;AACF;;AAGA,eAAsB,WAAW,SAA0C;CACzE,MAAM,MAAM,qBAAqB;CACjC,IAAI;EACF,OAAO,MAAM,IAAI,WAAW,OAAO;CACrC,UAAU;EACR,MAAM,IAAI,SAAS;CACrB;AACF"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
const require_runtime = require("../../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_locale = require("../../locale.cjs");
|
|
2
3
|
const require_router = require("../../router.cjs");
|
|
3
4
|
const require_index = require("../../../builders/apiContractExport/index.cjs");
|
|
4
|
-
let node_path = require("node:path");
|
|
5
|
-
node_path = require_runtime.__toESM(node_path, 1);
|
|
6
5
|
let node_os = require("node:os");
|
|
7
6
|
node_os = require_runtime.__toESM(node_os, 1);
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
8
9
|
//#region src/cli/commands/api-export/index.ts
|
|
9
10
|
function apiExportHelp() {
|
|
10
|
-
return `Usage: po api-export --out <directory> [--
|
|
11
|
+
return require_locale.cliText("cli.help.apiExport", `Usage: po api-export --out <directory> [--preset <name>] [--strict]
|
|
11
12
|
|
|
12
13
|
Export OpenAPI, AsyncAPI, and a coverage manifest from synced global and workspace
|
|
13
14
|
API generations. No packages are installed and no services are started.
|
|
14
15
|
|
|
15
16
|
--out <directory> Destination for openapi.json, asyncapi.json, manifest.json
|
|
16
|
-
--
|
|
17
|
+
--preset <name> Session preset (defaults to the workspace default)
|
|
17
18
|
--strict Exit nonzero when selected contract coverage is incomplete
|
|
18
19
|
-h, --help Show this help
|
|
19
|
-
|
|
20
|
+
`);
|
|
20
21
|
}
|
|
21
22
|
async function runApiExport(args, environment = process.env, cwd = process.cwd(), output = process.stdout) {
|
|
22
23
|
if (require_router.wantsHelp(args.slice(1))) {
|
|
@@ -24,7 +25,7 @@ async function runApiExport(args, environment = process.env, cwd = process.cwd()
|
|
|
24
25
|
return 0;
|
|
25
26
|
}
|
|
26
27
|
let destination;
|
|
27
|
-
let
|
|
28
|
+
let preset;
|
|
28
29
|
let strict = false;
|
|
29
30
|
for (let index = 1; index < args.length; index += 1) {
|
|
30
31
|
const option = args[index];
|
|
@@ -32,25 +33,25 @@ async function runApiExport(args, environment = process.env, cwd = process.cwd()
|
|
|
32
33
|
strict = true;
|
|
33
34
|
continue;
|
|
34
35
|
}
|
|
35
|
-
if (option !== "--out" && option !== "--
|
|
36
|
+
if (option !== "--out" && option !== "--preset") throw new Error(require_locale.cliText("cli.apiExport.unknownArgument", "Unknown api-export argument: {option}", { option }));
|
|
36
37
|
const value = args[++index];
|
|
37
|
-
if (!value || value.startsWith("--")) throw new Error(
|
|
38
|
+
if (!value || value.startsWith("--")) throw new Error(require_locale.cliText("cli.apiExport.missingValue", "{option} requires a value", { option }));
|
|
38
39
|
if (option === "--out") {
|
|
39
|
-
if (destination !== void 0) throw new Error("--out was specified more than once");
|
|
40
|
+
if (destination !== void 0) throw new Error(require_locale.cliText("cli.apiExport.duplicateOut", "--out was specified more than once"));
|
|
40
41
|
destination = value;
|
|
41
42
|
} else {
|
|
42
|
-
if (
|
|
43
|
-
|
|
43
|
+
if (preset !== void 0) throw new Error(require_locale.cliText("cli.apiExport.duplicatePreset", "--preset was specified more than once"));
|
|
44
|
+
preset = value;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
if (!destination) throw new Error("api-export requires --out <directory>");
|
|
47
|
+
if (!destination) throw new Error(require_locale.cliText("cli.apiExport.missingOut", "api-export requires --out <directory>"));
|
|
47
48
|
const outputDirectory = node_path.default.resolve(cwd, destination);
|
|
48
49
|
const manifest = await require_index.exportApiContracts({
|
|
49
50
|
cwd,
|
|
50
51
|
environment,
|
|
51
52
|
homeDirectory: environment.HOME ?? node_os.default.homedir(),
|
|
52
53
|
outputDirectory,
|
|
53
|
-
|
|
54
|
+
preset
|
|
54
55
|
});
|
|
55
56
|
output.write(`${JSON.stringify({
|
|
56
57
|
directory: outputDirectory,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["wantsHelp","path","exportApiContracts","os"],"sources":["../../../../../src/cli/commands/api-export/index.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\n\nimport { exportApiContracts } from '../../../builders/apiContractExport';\nimport { wantsHelp } from '../../router';\n\nexport function apiExportHelp(): string {\n return `Usage: po api-export --out <directory> [--
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["cliText","wantsHelp","path","exportApiContracts","os"],"sources":["../../../../../src/cli/commands/api-export/index.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\n\nimport { exportApiContracts } from '../../../builders/apiContractExport';\nimport { cliText } from '../../locale';\nimport { wantsHelp } from '../../router';\n\nexport function apiExportHelp(): string {\n return cliText(\n 'cli.help.apiExport',\n `Usage: po api-export --out <directory> [--preset <name>] [--strict]\n\nExport OpenAPI, AsyncAPI, and a coverage manifest from synced global and workspace\nAPI generations. No packages are installed and no services are started.\n\n --out <directory> Destination for openapi.json, asyncapi.json, manifest.json\n --preset <name> Session preset (defaults to the workspace default)\n --strict Exit nonzero when selected contract coverage is incomplete\n -h, --help Show this help\n`,\n );\n}\n\nexport async function runApiExport(\n args: readonly string[],\n environment: NodeJS.ProcessEnv = process.env,\n cwd = process.cwd(),\n output: { write(chunk: string): void } = process.stdout,\n): Promise<number> {\n if (wantsHelp(args.slice(1))) {\n output.write(apiExportHelp());\n return 0;\n }\n let destination: string | undefined;\n let preset: string | undefined;\n let strict = false;\n for (let index = 1; index < args.length; index += 1) {\n const option = args[index];\n if (option === '--strict') {\n strict = true;\n continue;\n }\n if (option !== '--out' && option !== '--preset') {\n throw new Error(cliText('cli.apiExport.unknownArgument', 'Unknown api-export argument: {option}', { option }));\n }\n const value = args[++index];\n if (!value || value.startsWith('--')) {\n throw new Error(cliText('cli.apiExport.missingValue', '{option} requires a value', { option }));\n }\n if (option === '--out') {\n if (destination !== undefined) {\n throw new Error(cliText('cli.apiExport.duplicateOut', '--out was specified more than once'));\n }\n destination = value;\n } else {\n if (preset !== undefined) {\n throw new Error(cliText('cli.apiExport.duplicatePreset', '--preset was specified more than once'));\n }\n preset = value;\n }\n }\n if (!destination) throw new Error(cliText('cli.apiExport.missingOut', 'api-export requires --out <directory>'));\n const outputDirectory = path.resolve(cwd, destination);\n const manifest = await exportApiContracts({\n cwd,\n environment,\n homeDirectory: environment.HOME ?? os.homedir(),\n outputDirectory,\n preset,\n });\n output.write(`${JSON.stringify({ directory: outputDirectory, complete: manifest.complete, gaps: manifest.gaps })}\\n`);\n return strict && !manifest.complete ? 1 : 0;\n}\n"],"mappings":";;;;;;;;;AAOA,SAAgB,gBAAwB;CACtC,OAAOA,eAAAA,QACL,sBACA;;;;;;;;;CAUF;AACF;AAEA,eAAsB,aACpB,MACA,cAAiC,QAAQ,KACzC,MAAM,Q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;AAC5C"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { cliText } from "../../locale.mjs";
|
|
1
2
|
import { wantsHelp } from "../../router.mjs";
|
|
2
3
|
import { exportApiContracts } from "../../../builders/apiContractExport/index.mjs";
|
|
3
|
-
import path from "node:path";
|
|
4
4
|
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
5
6
|
//#region src/cli/commands/api-export/index.ts
|
|
6
7
|
function apiExportHelp() {
|
|
7
|
-
return `Usage: po api-export --out <directory> [--
|
|
8
|
+
return cliText("cli.help.apiExport", `Usage: po api-export --out <directory> [--preset <name>] [--strict]
|
|
8
9
|
|
|
9
10
|
Export OpenAPI, AsyncAPI, and a coverage manifest from synced global and workspace
|
|
10
11
|
API generations. No packages are installed and no services are started.
|
|
11
12
|
|
|
12
13
|
--out <directory> Destination for openapi.json, asyncapi.json, manifest.json
|
|
13
|
-
--
|
|
14
|
+
--preset <name> Session preset (defaults to the workspace default)
|
|
14
15
|
--strict Exit nonzero when selected contract coverage is incomplete
|
|
15
16
|
-h, --help Show this help
|
|
16
|
-
|
|
17
|
+
`);
|
|
17
18
|
}
|
|
18
19
|
async function runApiExport(args, environment = process.env, cwd = process.cwd(), output = process.stdout) {
|
|
19
20
|
if (wantsHelp(args.slice(1))) {
|
|
@@ -21,7 +22,7 @@ async function runApiExport(args, environment = process.env, cwd = process.cwd()
|
|
|
21
22
|
return 0;
|
|
22
23
|
}
|
|
23
24
|
let destination;
|
|
24
|
-
let
|
|
25
|
+
let preset;
|
|
25
26
|
let strict = false;
|
|
26
27
|
for (let index = 1; index < args.length; index += 1) {
|
|
27
28
|
const option = args[index];
|
|
@@ -29,25 +30,25 @@ async function runApiExport(args, environment = process.env, cwd = process.cwd()
|
|
|
29
30
|
strict = true;
|
|
30
31
|
continue;
|
|
31
32
|
}
|
|
32
|
-
if (option !== "--out" && option !== "--
|
|
33
|
+
if (option !== "--out" && option !== "--preset") throw new Error(cliText("cli.apiExport.unknownArgument", "Unknown api-export argument: {option}", { option }));
|
|
33
34
|
const value = args[++index];
|
|
34
|
-
if (!value || value.startsWith("--")) throw new Error(
|
|
35
|
+
if (!value || value.startsWith("--")) throw new Error(cliText("cli.apiExport.missingValue", "{option} requires a value", { option }));
|
|
35
36
|
if (option === "--out") {
|
|
36
|
-
if (destination !== void 0) throw new Error("--out was specified more than once");
|
|
37
|
+
if (destination !== void 0) throw new Error(cliText("cli.apiExport.duplicateOut", "--out was specified more than once"));
|
|
37
38
|
destination = value;
|
|
38
39
|
} else {
|
|
39
|
-
if (
|
|
40
|
-
|
|
40
|
+
if (preset !== void 0) throw new Error(cliText("cli.apiExport.duplicatePreset", "--preset was specified more than once"));
|
|
41
|
+
preset = value;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
if (!destination) throw new Error("api-export requires --out <directory>");
|
|
44
|
+
if (!destination) throw new Error(cliText("cli.apiExport.missingOut", "api-export requires --out <directory>"));
|
|
44
45
|
const outputDirectory = path.resolve(cwd, destination);
|
|
45
46
|
const manifest = await exportApiContracts({
|
|
46
47
|
cwd,
|
|
47
48
|
environment,
|
|
48
49
|
homeDirectory: environment.HOME ?? os.homedir(),
|
|
49
50
|
outputDirectory,
|
|
50
|
-
|
|
51
|
+
preset
|
|
51
52
|
});
|
|
52
53
|
output.write(`${JSON.stringify({
|
|
53
54
|
directory: outputDirectory,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/cli/commands/api-export/index.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\n\nimport { exportApiContracts } from '../../../builders/apiContractExport';\nimport { wantsHelp } from '../../router';\n\nexport function apiExportHelp(): string {\n return `Usage: po api-export --out <directory> [--
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/cli/commands/api-export/index.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\n\nimport { exportApiContracts } from '../../../builders/apiContractExport';\nimport { cliText } from '../../locale';\nimport { wantsHelp } from '../../router';\n\nexport function apiExportHelp(): string {\n return cliText(\n 'cli.help.apiExport',\n `Usage: po api-export --out <directory> [--preset <name>] [--strict]\n\nExport OpenAPI, AsyncAPI, and a coverage manifest from synced global and workspace\nAPI generations. No packages are installed and no services are started.\n\n --out <directory> Destination for openapi.json, asyncapi.json, manifest.json\n --preset <name> Session preset (defaults to the workspace default)\n --strict Exit nonzero when selected contract coverage is incomplete\n -h, --help Show this help\n`,\n );\n}\n\nexport async function runApiExport(\n args: readonly string[],\n environment: NodeJS.ProcessEnv = process.env,\n cwd = process.cwd(),\n output: { write(chunk: string): void } = process.stdout,\n): Promise<number> {\n if (wantsHelp(args.slice(1))) {\n output.write(apiExportHelp());\n return 0;\n }\n let destination: string | undefined;\n let preset: string | undefined;\n let strict = false;\n for (let index = 1; index < args.length; index += 1) {\n const option = args[index];\n if (option === '--strict') {\n strict = true;\n continue;\n }\n if (option !== '--out' && option !== '--preset') {\n throw new Error(cliText('cli.apiExport.unknownArgument', 'Unknown api-export argument: {option}', { option }));\n }\n const value = args[++index];\n if (!value || value.startsWith('--')) {\n throw new Error(cliText('cli.apiExport.missingValue', '{option} requires a value', { option }));\n }\n if (option === '--out') {\n if (destination !== undefined) {\n throw new Error(cliText('cli.apiExport.duplicateOut', '--out was specified more than once'));\n }\n destination = value;\n } else {\n if (preset !== undefined) {\n throw new Error(cliText('cli.apiExport.duplicatePreset', '--preset was specified more than once'));\n }\n preset = value;\n }\n }\n if (!destination) throw new Error(cliText('cli.apiExport.missingOut', 'api-export requires --out <directory>'));\n const outputDirectory = path.resolve(cwd, destination);\n const manifest = await exportApiContracts({\n cwd,\n environment,\n homeDirectory: environment.HOME ?? os.homedir(),\n outputDirectory,\n preset,\n });\n output.write(`${JSON.stringify({ directory: outputDirectory, complete: manifest.complete, gaps: manifest.gaps })}\\n`);\n return strict && !manifest.complete ? 1 : 0;\n}\n"],"mappings":";;;;;;AAOA,SAAgB,gBAAwB;CACtC,OAAO,QAC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,IAAI;AAC5C"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const require_locale = require("../../locale.cjs");
|
|
1
2
|
//#region src/cli/commands/doctor/help.ts
|
|
2
3
|
function doctorHelp() {
|
|
3
|
-
return `Usage: po doctor
|
|
4
|
+
return require_locale.cliText("cli.help.doctor", `Usage: po doctor
|
|
4
5
|
|
|
5
6
|
Checks the Po installation and reports what is wrong without changing
|
|
6
|
-
anything. Validates .po/config.yaml and .po/
|
|
7
|
+
anything. Validates .po/config.yaml and .po/presets.yaml strictly, including
|
|
7
8
|
the unsupported keys po sync ignores, then reports everything
|
|
8
9
|
po sync --check reports.
|
|
9
10
|
|
|
@@ -11,7 +12,7 @@ Exits non-zero when any check fails.
|
|
|
11
12
|
|
|
12
13
|
Options:
|
|
13
14
|
-h, --help Show this help
|
|
14
|
-
|
|
15
|
+
`);
|
|
15
16
|
}
|
|
16
17
|
//#endregion
|
|
17
18
|
exports.doctorHelp = doctorHelp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.cjs","names":[],"sources":["../../../../../src/cli/commands/doctor/help.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"help.cjs","names":["cliText"],"sources":["../../../../../src/cli/commands/doctor/help.ts"],"sourcesContent":["import { cliText } from '../../locale';\n\nexport function doctorHelp(): string {\n return cliText(\n 'cli.help.doctor',\n `Usage: po doctor\n\nChecks the Po installation and reports what is wrong without changing\nanything. Validates .po/config.yaml and .po/presets.yaml strictly, including\nthe unsupported keys po sync ignores, then reports everything\npo sync --check reports.\n\nExits non-zero when any check fails.\n\nOptions:\n -h, --help Show this help\n`,\n );\n}\n"],"mappings":";;AAEA,SAAgB,aAAqB;CACnC,OAAOA,eAAAA,QACL,mBACA;;;;;;;;;;;CAYF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.mts","names":[],"sources":["../../../../../src/cli/commands/doctor/help.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"help.d.mts","names":[],"sources":["../../../../../src/cli/commands/doctor/help.ts"],"mappings":";wBAEgB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { cliText } from "../../locale.mjs";
|
|
1
2
|
//#region src/cli/commands/doctor/help.ts
|
|
2
3
|
function doctorHelp() {
|
|
3
|
-
return `Usage: po doctor
|
|
4
|
+
return cliText("cli.help.doctor", `Usage: po doctor
|
|
4
5
|
|
|
5
6
|
Checks the Po installation and reports what is wrong without changing
|
|
6
|
-
anything. Validates .po/config.yaml and .po/
|
|
7
|
+
anything. Validates .po/config.yaml and .po/presets.yaml strictly, including
|
|
7
8
|
the unsupported keys po sync ignores, then reports everything
|
|
8
9
|
po sync --check reports.
|
|
9
10
|
|
|
@@ -11,7 +12,7 @@ Exits non-zero when any check fails.
|
|
|
11
12
|
|
|
12
13
|
Options:
|
|
13
14
|
-h, --help Show this help
|
|
14
|
-
|
|
15
|
+
`);
|
|
15
16
|
}
|
|
16
17
|
//#endregion
|
|
17
18
|
export { doctorHelp };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.mjs","names":[],"sources":["../../../../../src/cli/commands/doctor/help.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"help.mjs","names":[],"sources":["../../../../../src/cli/commands/doctor/help.ts"],"sourcesContent":["import { cliText } from '../../locale';\n\nexport function doctorHelp(): string {\n return cliText(\n 'cli.help.doctor',\n `Usage: po doctor\n\nChecks the Po installation and reports what is wrong without changing\nanything. Validates .po/config.yaml and .po/presets.yaml strictly, including\nthe unsupported keys po sync ignores, then reports everything\npo sync --check reports.\n\nExits non-zero when any check fails.\n\nOptions:\n -h, --help Show this help\n`,\n );\n}\n"],"mappings":";;AAEA,SAAgB,aAAqB;CACnC,OAAO,QACL,mBACA;;;;;;;;;;;CAYF;AACF"}
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
const require_runtime = require("../../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_locale = require("../../locale.cjs");
|
|
2
3
|
const require_help = require("./help.cjs");
|
|
4
|
+
const require_matrixOptions = require("../../matrixOptions.cjs");
|
|
3
5
|
const require_index = require("../../../composition/repository/index.cjs");
|
|
4
6
|
const require_router = require("../../router.cjs");
|
|
5
7
|
const require_index$1 = require("../sync/index.cjs");
|
|
6
|
-
let node_path = require("node:path");
|
|
7
|
-
node_path = require_runtime.__toESM(node_path, 1);
|
|
8
8
|
let node_os = require("node:os");
|
|
9
9
|
node_os = require_runtime.__toESM(node_os, 1);
|
|
10
|
+
let node_path = require("node:path");
|
|
11
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
10
12
|
let _agimon_ai_po_config_domains = require("@agimon-ai/po-config/domains");
|
|
11
|
-
let _agimon_ai_po_config_config = require("@agimon-ai/po-config/config");
|
|
12
|
-
let _agimon_ai_po_config_majorModes = require("@agimon-ai/po-config/majorModes");
|
|
13
13
|
let _agimon_ai_po_config_profiles = require("@agimon-ai/po-config/profiles");
|
|
14
|
+
let _agimon_ai_po_config_sync = require("@agimon-ai/po-config/sync");
|
|
14
15
|
//#region src/cli/commands/doctor/index.ts
|
|
15
16
|
const DOCTOR_COMMAND = "doctor";
|
|
16
17
|
const HARNESS_ROOT_ENV = "PO_ROOT";
|
|
17
18
|
const LABEL_WIDTH = 14;
|
|
18
19
|
function formatSection(section) {
|
|
19
|
-
const label =
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const label = ({
|
|
21
|
+
environment: require_locale.cliText("cli.doctor.environment", "environment"),
|
|
22
|
+
packages: require_locale.cliText("cli.doctor.packages", "packages"),
|
|
23
|
+
"web build": require_locale.cliText("cli.doctor.webBuild", "web build"),
|
|
24
|
+
installation: require_locale.cliText("cli.doctor.installation", "installation")
|
|
25
|
+
}[section.label] ?? section.label).padEnd(LABEL_WIDTH);
|
|
26
|
+
if (section.problems.length === 0) return `${label}${require_locale.cliText("cli.doctor.ok", "ok")}\n`;
|
|
27
|
+
return `${label}${section.problems.length === 1 ? require_locale.cliText("cli.doctor.failed", "FAILED") : require_locale.cliText("cli.doctor.problemCount", "{value1} problem(s)", { value1: String(section.problems.length) })}\n${section.problems.map((problem) => ` ${problem}\n`).join("")}`;
|
|
22
28
|
}
|
|
23
29
|
function messageOf(error) {
|
|
24
30
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -39,33 +45,33 @@ function check(run) {
|
|
|
39
45
|
* so a build cannot break over one. Everything `sync --check` reports is
|
|
40
46
|
* reported here too, so this is the one command to run when something is off.
|
|
41
47
|
*/
|
|
42
|
-
function runDoctor(args, environment = process.env, currentDirectory = process.cwd(), output = process.stdout) {
|
|
48
|
+
async function runDoctor(args, environment = process.env, currentDirectory = process.cwd(), output = process.stdout) {
|
|
43
49
|
if (require_router.wantsHelp(args.slice(1))) {
|
|
44
50
|
output.write(require_help.doctorHelp());
|
|
45
51
|
return 0;
|
|
46
52
|
}
|
|
47
|
-
const { sections, problems } = collectDoctorReport(environment, currentDirectory);
|
|
53
|
+
const { sections, problems } = await collectDoctorReport(environment, currentDirectory);
|
|
48
54
|
for (const section of sections) output.write(formatSection(section));
|
|
49
55
|
if (problems === 0) {
|
|
50
|
-
output.write("\nno problems found\n");
|
|
56
|
+
output.write(require_locale.cliText("cli.doctor.noProblems", "\nno problems found\n"));
|
|
51
57
|
return 0;
|
|
52
58
|
}
|
|
53
|
-
output.write(
|
|
59
|
+
output.write(require_locale.cliText("cli.doctor.foundProblems", "\n{value1} problem(s) found\n", { value1: String(problems) }));
|
|
54
60
|
return 1;
|
|
55
61
|
}
|
|
56
62
|
/** The CLI and session diagnostic tool run the same read-only checks. */
|
|
57
|
-
function collectDoctorReport(environment, currentDirectory) {
|
|
63
|
+
async function collectDoctorReport(environment, currentDirectory) {
|
|
58
64
|
const homeDirectory = environment.HOME ?? node_os.default.homedir();
|
|
59
65
|
const inheritedRoot = environment[HARNESS_ROOT_ENV];
|
|
60
|
-
const repoRoot = inheritedRoot ? node_path.default.resolve(inheritedRoot) : require_index.resolvePoConfigurationRoot(currentDirectory, homeDirectory);
|
|
66
|
+
const repoRoot = inheritedRoot ? node_path.default.resolve(inheritedRoot) : await require_index.resolvePoConfigurationRoot(currentDirectory, homeDirectory);
|
|
61
67
|
const sections = [
|
|
62
68
|
{
|
|
63
69
|
label: "config.yaml",
|
|
64
|
-
problems: check(() => (0,
|
|
70
|
+
problems: check(() => (0, _agimon_ai_po_config_sync.loadPoConfig)(repoRoot, homeDirectory))
|
|
65
71
|
},
|
|
66
72
|
{
|
|
67
|
-
label: "
|
|
68
|
-
problems: check(() => (0,
|
|
73
|
+
label: "presets.yaml",
|
|
74
|
+
problems: check(() => (0, _agimon_ai_po_config_sync.loadPresetsConfig)(repoRoot, homeDirectory))
|
|
69
75
|
},
|
|
70
76
|
{
|
|
71
77
|
label: "domains.yaml",
|
|
@@ -74,11 +80,18 @@ function collectDoctorReport(environment, currentDirectory) {
|
|
|
74
80
|
{
|
|
75
81
|
label: "profiles.yaml",
|
|
76
82
|
problems: check(() => (0, _agimon_ai_po_config_profiles.loadProfiles)(repoRoot, homeDirectory))
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: "environment",
|
|
86
|
+
problems: check(() => {
|
|
87
|
+
require_matrixOptions.resolveInheritedPreset(environment);
|
|
88
|
+
require_matrixOptions.resolveInheritedModes(environment);
|
|
89
|
+
})
|
|
77
90
|
}
|
|
78
91
|
];
|
|
79
92
|
const skipped = sections.some((section) => section.problems.length > 0) ? ["packages", "web build"] : [];
|
|
80
93
|
if (skipped.length === 0) try {
|
|
81
|
-
const readiness = require_index$1.syncReadiness(repoRoot, homeDirectory, environment);
|
|
94
|
+
const readiness = await require_index$1.syncReadiness(repoRoot, homeDirectory, environment, require_locale.cliText);
|
|
82
95
|
sections.push({
|
|
83
96
|
label: "packages",
|
|
84
97
|
problems: readiness.packages
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["wantsHelp","doctorHelp","os","path","resolvePoConfigurationRoot","loadPoConfig","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["cliText","wantsHelp","doctorHelp","os","path","resolvePoConfigurationRoot","loadPoConfig","loadPresetsConfig","loadDomains","loadProfiles","syncReadiness"],"sources":["../../../../../src/cli/commands/doctor/index.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\n\nimport { loadDomains } from '@agimon-ai/po-config/domains';\nimport { loadProfiles } from '@agimon-ai/po-config/profiles';\nimport { loadPoConfig, loadPresetsConfig } from '@agimon-ai/po-config/sync';\n\nimport { resolvePoConfigurationRoot } from '../../../composition/repository';\nimport { cliText } from '../../locale';\nimport { resolveInheritedModes, resolveInheritedPreset } from '../../matrixOptions';\nimport { wantsHelp } from '../../router';\nimport { syncReadiness } from '../sync';\nimport { doctorHelp } from './help';\n\nconst DOCTOR_COMMAND = 'doctor';\nconst HARNESS_ROOT_ENV = 'PO_ROOT';\nconst LABEL_WIDTH = 14;\n\nexport interface DoctorOutput {\n write(chunk: string): void;\n}\n\n/** One checked area and what it found. Empty problems means the section passed. */\ninterface Section {\n label: string;\n problems: string[];\n}\n\nfunction formatSection(section: Section): string {\n const labels: Record<string, string> = {\n environment: cliText('cli.doctor.environment', 'environment'),\n packages: cliText('cli.doctor.packages', 'packages'),\n 'web build': cliText('cli.doctor.webBuild', 'web build'),\n installation: cliText('cli.doctor.installation', 'installation'),\n };\n const label = (labels[section.label] ?? section.label).padEnd(LABEL_WIDTH);\n if (section.problems.length === 0) return `${label}${cliText('cli.doctor.ok', 'ok')}\\n`;\n return `${label}${section.problems.length === 1 ? cliText('cli.doctor.failed', 'FAILED') : cliText('cli.doctor.problemCount', '{value1} problem(s)', { value1: String(section.problems.length) })}\\n${section.problems\n .map((problem) => ` ${problem}\\n`)\n .join('')}`;\n}\n\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/** Runs one check, turning the throw a strict parser uses into a reported problem. */\nfunction check(run: () => void): string[] {\n try {\n run();\n return [];\n } catch (error) {\n return [messageOf(error)];\n }\n}\n\n/**\n * Reports what is wrong with a Po installation without changing anything.\n *\n * The strict counterpart to `po sync`, which tolerates unknown config keys\n * so a build cannot break over one. Everything `sync --check` reports is\n * reported here too, so this is the one command to run when something is off.\n */\nexport async function runDoctor(\n args: string[],\n environment: NodeJS.ProcessEnv = process.env,\n currentDirectory = process.cwd(),\n output: DoctorOutput = process.stdout,\n): Promise<number> {\n if (wantsHelp(args.slice(1))) {\n output.write(doctorHelp());\n return 0;\n }\n const { sections, problems } = await collectDoctorReport(environment, currentDirectory);\n for (const section of sections) output.write(formatSection(section));\n if (problems === 0) {\n output.write(cliText('cli.doctor.noProblems', '\\nno problems found\\n'));\n return 0;\n }\n output.write(cliText('cli.doctor.foundProblems', '\\n{value1} problem(s) found\\n', { value1: String(problems) }));\n return 1;\n}\n\n/** The CLI and session diagnostic tool run the same read-only checks. */\nexport async function collectDoctorReport(environment: NodeJS.ProcessEnv, currentDirectory: string) {\n const homeDirectory = environment.HOME ?? os.homedir();\n const inheritedRoot = environment[HARNESS_ROOT_ENV];\n const repoRoot = inheritedRoot\n ? path.resolve(inheritedRoot)\n : await resolvePoConfigurationRoot(currentDirectory, homeDirectory);\n const sections: Section[] = [\n { label: 'config.yaml', problems: check(() => loadPoConfig(repoRoot, homeDirectory)) },\n { label: 'presets.yaml', problems: check(() => loadPresetsConfig(repoRoot, homeDirectory)) },\n { label: 'domains.yaml', problems: check(() => loadDomains(repoRoot, homeDirectory)) },\n { label: 'profiles.yaml', problems: check(() => loadProfiles(repoRoot, homeDirectory)) },\n {\n label: 'environment',\n problems: check(() => {\n resolveInheritedPreset(environment);\n resolveInheritedModes(environment);\n }),\n },\n ];\n const skipped = sections.some((section) => section.problems.length > 0) ? ['packages', 'web build'] : [];\n if (skipped.length === 0) {\n try {\n const readiness = await syncReadiness(repoRoot, homeDirectory, environment, cliText);\n sections.push(\n { label: 'packages', problems: readiness.packages },\n { label: 'web build', problems: readiness.web },\n );\n } catch (error) {\n sections.push({ label: 'installation', problems: [messageOf(error)] });\n }\n }\n return {\n repoRoot,\n homeDirectory,\n sections,\n skipped,\n problems: sections.reduce((total, section) => total + section.problems.length, 0),\n };\n}\n/** Compatibility API. Executables call the command function directly. */\nexport class DoctorCommand {\n readonly name = DOCTOR_COMMAND;\n\n matches(args: string[]): boolean {\n return args[0] === this.name;\n }\n\n execute(\n args: string[],\n environment: NodeJS.ProcessEnv = process.env,\n currentDirectory = process.cwd(),\n output: DoctorOutput = process.stdout,\n ): Promise<number> {\n return runDoctor(args, environment, currentDirectory, output);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,iBAAiB;AACvB,MAAM,mBAAmB;AACzB,MAAM,cAAc;AAYpB,SAAS,cAAc,SAA0B;CAO/C,MAAM,SAAS;EALb,aAAaA,eAAAA,QAAQ,0BAA0B,aAAa;EAC5D,UAAUA,eAAAA,QAAQ,uBAAuB,UAAU;EACnD,aAAaA,eAAAA,QAAQ,uBAAuB,WAAW;EACvD,cAAcA,eAAAA,QAAQ,2BAA2B,cAAc;CAE7C,EAAE,QAAQ,UAAU,QAAQ,MAAA,CAAO,OAAO,WAAW;CACzE,IAAI,QAAQ,SAAS,WAAW,GAAG,OAAO,GAAG,QAAQA,eAAAA,QAAQ,iBAAiB,IAAI,EAAE;CACpF,OAAO,GAAG,QAAQ,QAAQ,SAAS,WAAW,IAAIA,eAAAA,QAAQ,qBAAqB,QAAQ,IAAIA,eAAAA,QAAQ,2BAA2B,uBAAuB,EAAE,QAAQ,OAAO,QAAQ,SAAS,MAAM,EAAE,CAAC,EAAE,IAAI,QAAQ,SAC3M,KAAK,YAAY,KAAK,QAAQ,GAAG,CAAC,CAClC,KAAK,EAAE;AACZ;AAEA,SAAS,UAAU,OAAwB;CACzC,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;;AAGA,SAAS,MAAM,KAA2B;CACxC,IAAI;EACF,IAAI;EACJ,OAAO,CAAC;CACV,SAAS,OAAO;EACd,OA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B,WAAW;IAClC,sBAAA,sBAAsB,WAAW;GACnC,CAAC;EACH;CACF;CACA,MAAM,UAAU,SAAS,MAAM,YAAY,QAAQ,SAAS,SAAS,CAAC,IAAI,CAAC,YAAY,WAAW,IAAI,CAAC;CACvG,IAAI,QAAQ,WAAW,GACrB,IAAI;EACF,MAAM,YAAY,MAAMC,gBAAAA,cAAc,UAAU,eAAe,aAAaV,eAAAA,OAAO;EACnF,SAAS,KACP;GAAE,OAAO;GAAY,UAAU,UAAU;EAAS,GAClD;GAAE,OAAO;GAAa,UAAU,UAAU;EAAI,CAChD;CACF,SAAS,OAAO;EACd,SAAS,KAAK;GAAE,OAAO;GAAgB,UAAU,CAAC,UAAU,KAAK,CAAC;EAAE,CAAC;CACvE;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA,UAAU,SAAS,QAAQ,OAAO,YAAY,QAAQ,QAAQ,SAAS,QAAQ,CAAC;CAClF;AACF;;AAEA,IAAa,gBAAb,MAA2B;CACzB,OAAgB;CAEhB,QAAQ,MAAyB;EAC/B,OAAO,KAAK,OAAO,KAAK;CAC1B;CAEA,QACE,MACA,cAAiC,QAAQ,KACzC,mBAAmB,QAAQ,IAAI,GAC/B,SAAuB,QAAQ,QACd;EACjB,OAAO,UAAU,MAAM,aAAa,kBAAkB,MAAM;CAC9D;AACF"}
|
|
@@ -14,20 +14,20 @@ interface Section {
|
|
|
14
14
|
* so a build cannot break over one. Everything `sync --check` reports is
|
|
15
15
|
* reported here too, so this is the one command to run when something is off.
|
|
16
16
|
*/
|
|
17
|
-
export declare function runDoctor(args: string[], environment?: NodeJS.ProcessEnv, currentDirectory?: string, output?: DoctorOutput): number
|
|
17
|
+
export declare function runDoctor(args: string[], environment?: NodeJS.ProcessEnv, currentDirectory?: string, output?: DoctorOutput): Promise<number>;
|
|
18
18
|
/** The CLI and session diagnostic tool run the same read-only checks. */
|
|
19
|
-
export declare function collectDoctorReport(environment: NodeJS.ProcessEnv, currentDirectory: string): {
|
|
19
|
+
export declare function collectDoctorReport(environment: NodeJS.ProcessEnv, currentDirectory: string): Promise<{
|
|
20
20
|
repoRoot: string;
|
|
21
21
|
homeDirectory: string;
|
|
22
22
|
sections: Section[];
|
|
23
23
|
skipped: string[];
|
|
24
24
|
problems: number;
|
|
25
|
-
}
|
|
25
|
+
}>;
|
|
26
26
|
/** Compatibility API. Executables call the command function directly. */
|
|
27
27
|
export declare class DoctorCommand {
|
|
28
28
|
readonly name = "doctor";
|
|
29
29
|
matches(args: string[]): boolean;
|
|
30
|
-
execute(args: string[], environment?: NodeJS.ProcessEnv, currentDirectory?: string, output?: DoctorOutput): number
|
|
30
|
+
execute(args: string[], environment?: NodeJS.ProcessEnv, currentDirectory?: string, output?: DoctorOutput): Promise<number>;
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
33
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../../src/cli/commands/doctor/index.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../../src/cli/commands/doctor/index.ts"],"mappings":";iBAkBiB;EACf,MAAM;;;UAIE;EACR;EACA;;;;;;;;;wBAsCoB,UACpB,gBACA,cAAa,OAAO,YACpB,2BACA,SAAQ,eACP;;wBAgBmB,oBAAoB,aAAa,OAAO,YAAY,2BAAwB;;;;;;;;qBAwCrF;WACF;EAET,QAAQ;EAIR,QACE,gBACA,cAAa,OAAO,YACpB,2BACA,SAAQ,eACP"}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
+
import { cliText } from "../../locale.mjs";
|
|
1
2
|
import { doctorHelp } from "./help.mjs";
|
|
3
|
+
import { resolveInheritedModes, resolveInheritedPreset } from "../../matrixOptions.mjs";
|
|
2
4
|
import { resolvePoConfigurationRoot } from "../../../composition/repository/index.mjs";
|
|
3
5
|
import { wantsHelp } from "../../router.mjs";
|
|
4
6
|
import { syncReadiness } from "../sync/index.mjs";
|
|
5
|
-
import path from "node:path";
|
|
6
7
|
import os from "node:os";
|
|
8
|
+
import path from "node:path";
|
|
7
9
|
import { loadDomains } from "@agimon-ai/po-config/domains";
|
|
8
|
-
import { loadPoConfig } from "@agimon-ai/po-config/config";
|
|
9
|
-
import { loadMajorModesConfig } from "@agimon-ai/po-config/majorModes";
|
|
10
10
|
import { loadProfiles } from "@agimon-ai/po-config/profiles";
|
|
11
|
+
import { loadPoConfig, loadPresetsConfig } from "@agimon-ai/po-config/sync";
|
|
11
12
|
//#region src/cli/commands/doctor/index.ts
|
|
12
13
|
const DOCTOR_COMMAND = "doctor";
|
|
13
14
|
const HARNESS_ROOT_ENV = "PO_ROOT";
|
|
14
15
|
const LABEL_WIDTH = 14;
|
|
15
16
|
function formatSection(section) {
|
|
16
|
-
const label =
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const label = ({
|
|
18
|
+
environment: cliText("cli.doctor.environment", "environment"),
|
|
19
|
+
packages: cliText("cli.doctor.packages", "packages"),
|
|
20
|
+
"web build": cliText("cli.doctor.webBuild", "web build"),
|
|
21
|
+
installation: cliText("cli.doctor.installation", "installation")
|
|
22
|
+
}[section.label] ?? section.label).padEnd(LABEL_WIDTH);
|
|
23
|
+
if (section.problems.length === 0) return `${label}${cliText("cli.doctor.ok", "ok")}\n`;
|
|
24
|
+
return `${label}${section.problems.length === 1 ? cliText("cli.doctor.failed", "FAILED") : cliText("cli.doctor.problemCount", "{value1} problem(s)", { value1: String(section.problems.length) })}\n${section.problems.map((problem) => ` ${problem}\n`).join("")}`;
|
|
19
25
|
}
|
|
20
26
|
function messageOf(error) {
|
|
21
27
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -36,33 +42,33 @@ function check(run) {
|
|
|
36
42
|
* so a build cannot break over one. Everything `sync --check` reports is
|
|
37
43
|
* reported here too, so this is the one command to run when something is off.
|
|
38
44
|
*/
|
|
39
|
-
function runDoctor(args, environment = process.env, currentDirectory = process.cwd(), output = process.stdout) {
|
|
45
|
+
async function runDoctor(args, environment = process.env, currentDirectory = process.cwd(), output = process.stdout) {
|
|
40
46
|
if (wantsHelp(args.slice(1))) {
|
|
41
47
|
output.write(doctorHelp());
|
|
42
48
|
return 0;
|
|
43
49
|
}
|
|
44
|
-
const { sections, problems } = collectDoctorReport(environment, currentDirectory);
|
|
50
|
+
const { sections, problems } = await collectDoctorReport(environment, currentDirectory);
|
|
45
51
|
for (const section of sections) output.write(formatSection(section));
|
|
46
52
|
if (problems === 0) {
|
|
47
|
-
output.write("\nno problems found\n");
|
|
53
|
+
output.write(cliText("cli.doctor.noProblems", "\nno problems found\n"));
|
|
48
54
|
return 0;
|
|
49
55
|
}
|
|
50
|
-
output.write(
|
|
56
|
+
output.write(cliText("cli.doctor.foundProblems", "\n{value1} problem(s) found\n", { value1: String(problems) }));
|
|
51
57
|
return 1;
|
|
52
58
|
}
|
|
53
59
|
/** The CLI and session diagnostic tool run the same read-only checks. */
|
|
54
|
-
function collectDoctorReport(environment, currentDirectory) {
|
|
60
|
+
async function collectDoctorReport(environment, currentDirectory) {
|
|
55
61
|
const homeDirectory = environment.HOME ?? os.homedir();
|
|
56
62
|
const inheritedRoot = environment[HARNESS_ROOT_ENV];
|
|
57
|
-
const repoRoot = inheritedRoot ? path.resolve(inheritedRoot) : resolvePoConfigurationRoot(currentDirectory, homeDirectory);
|
|
63
|
+
const repoRoot = inheritedRoot ? path.resolve(inheritedRoot) : await resolvePoConfigurationRoot(currentDirectory, homeDirectory);
|
|
58
64
|
const sections = [
|
|
59
65
|
{
|
|
60
66
|
label: "config.yaml",
|
|
61
67
|
problems: check(() => loadPoConfig(repoRoot, homeDirectory))
|
|
62
68
|
},
|
|
63
69
|
{
|
|
64
|
-
label: "
|
|
65
|
-
problems: check(() =>
|
|
70
|
+
label: "presets.yaml",
|
|
71
|
+
problems: check(() => loadPresetsConfig(repoRoot, homeDirectory))
|
|
66
72
|
},
|
|
67
73
|
{
|
|
68
74
|
label: "domains.yaml",
|
|
@@ -71,11 +77,18 @@ function collectDoctorReport(environment, currentDirectory) {
|
|
|
71
77
|
{
|
|
72
78
|
label: "profiles.yaml",
|
|
73
79
|
problems: check(() => loadProfiles(repoRoot, homeDirectory))
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
label: "environment",
|
|
83
|
+
problems: check(() => {
|
|
84
|
+
resolveInheritedPreset(environment);
|
|
85
|
+
resolveInheritedModes(environment);
|
|
86
|
+
})
|
|
74
87
|
}
|
|
75
88
|
];
|
|
76
89
|
const skipped = sections.some((section) => section.problems.length > 0) ? ["packages", "web build"] : [];
|
|
77
90
|
if (skipped.length === 0) try {
|
|
78
|
-
const readiness = syncReadiness(repoRoot, homeDirectory, environment);
|
|
91
|
+
const readiness = await syncReadiness(repoRoot, homeDirectory, environment, cliText);
|
|
79
92
|
sections.push({
|
|
80
93
|
label: "packages",
|
|
81
94
|
problems: readiness.packages
|