@alpsckr/unitycli 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/contracts/command-contract.json +109 -217
- package/contracts/package-files.json +374 -294
- package/contracts/stable-session/direct-call-semantics.json +8 -2
- package/contracts/tool-completion-contract.json +148 -672
- package/dist/bridge/admission.d.ts +17 -1
- package/dist/bridge/admission.js +2 -0
- package/dist/bridge/admission.js.map +1 -1
- package/dist/bridge/domains/asset.js +3 -1
- package/dist/bridge/domains/asset.js.map +1 -1
- package/dist/bridge/domains/camera.js +39 -7
- package/dist/bridge/domains/camera.js.map +1 -1
- package/dist/bridge/domains/console.js +2 -1
- package/dist/bridge/domains/console.js.map +1 -1
- package/dist/bridge/domains/doctor.d.ts +3 -0
- package/dist/bridge/domains/doctor.js +8 -0
- package/dist/bridge/domains/doctor.js.map +1 -0
- package/dist/bridge/domains/editor.js +0 -4
- package/dist/bridge/domains/editor.js.map +1 -1
- package/dist/bridge/domains/game-object.js +4 -12
- package/dist/bridge/domains/game-object.js.map +1 -1
- package/dist/bridge/domains/graphics.js +1 -16
- package/dist/bridge/domains/graphics.js.map +1 -1
- package/dist/bridge/domains/object.js +3 -0
- package/dist/bridge/domains/object.js.map +1 -1
- package/dist/bridge/domains/physics.js +1 -2
- package/dist/bridge/domains/physics.js.map +1 -1
- package/dist/bridge/domains/profiler.js +18 -7
- package/dist/bridge/domains/profiler.js.map +1 -1
- package/dist/bridge/domains/project-tool.js +4 -0
- package/dist/bridge/domains/project-tool.js.map +1 -1
- package/dist/bridge/domains/reflection.js +10 -2
- package/dist/bridge/domains/reflection.js.map +1 -1
- package/dist/bridge/domains/runtime-tool.js +3 -0
- package/dist/bridge/domains/runtime-tool.js.map +1 -1
- package/dist/bridge/domains/scene.js +3 -8
- package/dist/bridge/domains/scene.js.map +1 -1
- package/dist/bridge/domains/screenshot.js +30 -6
- package/dist/bridge/domains/screenshot.js.map +1 -1
- package/dist/bridge/domains/ui.js +3 -1
- package/dist/bridge/domains/ui.js.map +1 -1
- package/dist/bridge/index.d.ts +5 -5
- package/dist/bridge/index.js +6 -9
- package/dist/bridge/index.js.map +1 -1
- package/dist/bridge/registry.js +3 -5
- package/dist/bridge/registry.js.map +1 -1
- package/dist/bridge/session-supervisor.d.ts +6 -3
- package/dist/bridge/session-supervisor.js +122 -34
- package/dist/bridge/session-supervisor.js.map +1 -1
- package/dist/bridge/types.d.ts +6 -5
- package/dist/bridge/types.js +16 -2
- package/dist/bridge/types.js.map +1 -1
- package/dist/catalog-protocol.d.ts +64 -0
- package/dist/catalog-protocol.js +460 -0
- package/dist/catalog-protocol.js.map +1 -0
- package/dist/cli-commands/command.js +84 -61
- package/dist/cli-commands/command.js.map +1 -1
- package/dist/cli-commands/extensions.js +70 -50
- package/dist/cli-commands/extensions.js.map +1 -1
- package/dist/cli-commands/instances.js +1 -1
- package/dist/cli-commands/instances.js.map +1 -1
- package/dist/cli-process-owners.d.ts +6 -0
- package/dist/cli-process-owners.js +27 -0
- package/dist/cli-process-owners.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +20 -5
- package/dist/cli.js.map +1 -1
- package/dist/contracts/command-contract.js +14 -4
- package/dist/contracts/command-contract.js.map +1 -1
- package/dist/doctor.d.ts +4 -6
- package/dist/doctor.js +429 -398
- package/dist/doctor.js.map +1 -1
- package/dist/editor-blocker-observer.d.ts +2 -1
- package/dist/editor-blocker-observer.js +40 -13
- package/dist/editor-blocker-observer.js.map +1 -1
- package/dist/extension-availability.d.ts +27 -9
- package/dist/extension-availability.js +96 -56
- package/dist/extension-availability.js.map +1 -1
- package/dist/extensions/descriptor-loader.d.ts +2 -2
- package/dist/extensions/descriptor-loader.js +3 -4
- package/dist/extensions/descriptor-loader.js.map +1 -1
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/index.js +1 -1
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/installer.d.ts +24 -7
- package/dist/extensions/installer.js +142 -66
- package/dist/extensions/installer.js.map +1 -1
- package/dist/extensions/registry.js +3 -5
- package/dist/extensions/registry.js.map +1 -1
- package/dist/extensions/state-contract.d.ts +11 -0
- package/dist/extensions/state-contract.js +50 -0
- package/dist/extensions/state-contract.js.map +1 -0
- package/dist/instances.d.ts +13 -1
- package/dist/instances.js +26 -0
- package/dist/instances.js.map +1 -1
- package/dist/package-manager.d.ts +0 -24
- package/dist/package-manager.js +5 -58
- package/dist/package-manager.js.map +1 -1
- package/dist/project-tool-discovery.d.ts +5 -2
- package/dist/project-tool-discovery.js +22 -18
- package/dist/project-tool-discovery.js.map +1 -1
- package/dist/runtime-code.js +1 -1
- package/dist/runtime-code.js.map +1 -1
- package/dist/tool-name.d.ts +4 -0
- package/dist/tool-name.js +15 -0
- package/dist/tool-name.js.map +1 -0
- package/dist/tools/.generated-completion-registry.d.ts +2 -0
- package/dist/tools/.generated-completion-registry.js +763 -325
- package/dist/tools/.generated-completion-registry.js.map +1 -1
- package/dist/tools/.generated-registry.d.ts +6 -11
- package/dist/tools/.generated-registry.js +6 -11
- package/dist/tools/.generated-registry.js.map +1 -1
- package/dist/tools/.generated-schemas.js +11 -16
- package/dist/tools/.generated-schemas.js.map +1 -1
- package/dist/tools/asset/refresh-status.d.ts +3 -0
- package/dist/tools/asset/refresh-status.js +12 -0
- package/dist/tools/asset/refresh-status.js.map +1 -0
- package/dist/tools/asset/refresh.js +7 -3
- package/dist/tools/asset/refresh.js.map +1 -1
- package/dist/tools/build/player-status.d.ts +3 -0
- package/dist/tools/build/player-status.js +12 -0
- package/dist/tools/build/player-status.js.map +1 -0
- package/dist/tools/build/run.js +1 -1
- package/dist/tools/build/run.js.map +1 -1
- package/dist/tools/catalog-control.d.ts +22 -0
- package/dist/tools/catalog-control.js +335 -0
- package/dist/tools/catalog-control.js.map +1 -0
- package/dist/tools/catalog.d.ts +7 -9
- package/dist/tools/catalog.js +66 -45
- package/dist/tools/catalog.js.map +1 -1
- package/dist/tools/commands.d.ts +1 -1
- package/dist/tools/commands.js +44 -11
- package/dist/tools/commands.js.map +1 -1
- package/dist/tools/define.js +3 -2
- package/dist/tools/define.js.map +1 -1
- package/dist/tools/dispatcher.d.ts +53 -6
- package/dist/tools/dispatcher.js +277 -108
- package/dist/tools/dispatcher.js.map +1 -1
- package/dist/tools/editor/compile.js +1 -1
- package/dist/tools/editor/compile.js.map +1 -1
- package/dist/tools/editor/play-mode-status.d.ts +3 -0
- package/dist/tools/editor/play-mode-status.js +12 -0
- package/dist/tools/editor/play-mode-status.js.map +1 -0
- package/dist/tools/editor/readiness.d.ts +0 -1
- package/dist/tools/editor/readiness.js +0 -1
- package/dist/tools/editor/readiness.js.map +1 -1
- package/dist/tools/editor/refresh.d.ts +7 -3
- package/dist/tools/editor/refresh.js +20 -15
- package/dist/tools/editor/refresh.js.map +1 -1
- package/dist/tools/editor/state.d.ts +2 -2
- package/dist/tools/editor/state.js +13 -12
- package/dist/tools/editor/state.js.map +1 -1
- package/dist/tools/metadata/derived.js +1 -7
- package/dist/tools/metadata/derived.js.map +1 -1
- package/dist/tools/metadata/status.js +1 -12
- package/dist/tools/metadata/status.js.map +1 -1
- package/dist/tools/metadata/types.d.ts +0 -2
- package/dist/tools/navmesh/live.js +1 -1
- package/dist/tools/navmesh/live.js.map +1 -1
- package/dist/tools/occlusion/live.js +1 -1
- package/dist/tools/occlusion/live.js.map +1 -1
- package/dist/tools/package/deploy.js +2 -2
- package/dist/tools/package/deploy.js.map +1 -1
- package/dist/tools/package/embed.js +1 -1
- package/dist/tools/package/embed.js.map +1 -1
- package/dist/tools/package/install-status.d.ts +3 -0
- package/dist/tools/package/install-status.js +12 -0
- package/dist/tools/package/install-status.js.map +1 -0
- package/dist/tools/package/install.js +3 -3
- package/dist/tools/package/install.js.map +1 -1
- package/dist/tools/package/live-resolve.js +45 -12
- package/dist/tools/package/live-resolve.js.map +1 -1
- package/dist/tools/package/registry-clear.js.map +1 -1
- package/dist/tools/package/registry-set.js.map +1 -1
- package/dist/tools/package/remove-status.d.ts +3 -0
- package/dist/tools/package/remove-status.js +12 -0
- package/dist/tools/package/remove-status.js.map +1 -0
- package/dist/tools/package/remove.js +3 -3
- package/dist/tools/package/remove.js.map +1 -1
- package/dist/tools/package/resolve.js +3 -3
- package/dist/tools/package/resolve.js.map +1 -1
- package/dist/tools/package/restore.js +2 -2
- package/dist/tools/package/restore.js.map +1 -1
- package/dist/tools/package/scoped-registry-add.js.map +1 -1
- package/dist/tools/status/support.d.ts +13 -0
- package/dist/tools/status/support.js +28 -0
- package/dist/tools/status/support.js.map +1 -0
- package/dist/tools/test/cancel.js +2 -2
- package/dist/tools/test/cancel.js.map +1 -1
- package/dist/tools/test/run-status.d.ts +3 -0
- package/dist/tools/test/run-status.js +12 -0
- package/dist/tools/test/run-status.js.map +1 -0
- package/dist/tools/test/run.js +7 -4
- package/dist/tools/test/run.js.map +1 -1
- package/dist/tools/tools/group-summaries.js +10 -14
- package/dist/tools/tools/group-summaries.js.map +1 -1
- package/docs/architecture.md +4 -4
- package/docs/availability-differences.md +4 -4
- package/docs/command-execution.md +4 -3
- package/docs/error-codes.md +13 -5
- package/docs/extensions.md +1 -7
- package/docs/risk-and-side-effects.md +4 -3
- package/docs/safety-boundaries.md +3 -1
- package/docs/target-and-instance.md +1 -1
- package/docs/tool-discovery.md +17 -10
- package/docs/tool-execution.md +18 -7
- package/extensions/cinemachine/unitypkg/Editor/UnityCliExtensionAssembly.cs +3 -0
- package/extensions/hdrp/unitypkg/Editor/UnityCliExtensionAssembly.cs +3 -0
- package/extensions/probuilder/unitypkg/Editor/UnityCliExtensionAssembly.cs +3 -0
- package/extensions/urp/unitypkg/Editor/UnityCliExtensionAssembly.cs +3 -0
- package/extensions/vfx-graph/unitypkg/Editor/UnityCliExtensionAssembly.cs +3 -0
- package/package.json +2 -4
- package/skills/unitycli/SKILL.md +11 -2
- package/skills/unitycli/manifest.json +1 -1
- package/skills/unitycli/references/operation-protocol.md +3 -3
- package/unitypkg/Editor/AssemblyInfo.cs +5 -0
- package/unitypkg/Editor/Bridge/BridgeCommandRegistry.cs +49 -14
- package/unitypkg/Editor/Bridge/BridgeHttpServer.cs +9 -35
- package/unitypkg/Editor/Bridge/BridgeQueueState.cs +672 -0
- package/unitypkg/Editor/Bridge/BridgeWorkQueue.cs +970 -120
- package/unitypkg/Editor/BridgeStartupStateMachine.cs +59 -1
- package/unitypkg/Editor/Commands/ProjectToolCommands.cs +4 -0
- package/unitypkg/Editor/Commands/RuntimeToolCommands.cs +3 -0
- package/unitypkg/Editor/Generated/UnityCliToolCompletionRegistry.g.cs +379 -14
- package/unitypkg/Editor/Infrastructure/CodeExecSupport.cs +28 -13
- package/unitypkg/Editor/Infrastructure/RegistryOwnershipResolver.cs +132 -105
- package/unitypkg/Editor/Infrastructure/UnityCliActiveOperation.cs +138 -29
- package/unitypkg/Editor/Infrastructure/UnityCliAdmission.cs +1856 -237
- package/unitypkg/Editor/Infrastructure/UnityCliDoctorDiagnostics.cs +220 -0
- package/unitypkg/Editor/Infrastructure/UnityCliDurableStatusCoordinator.cs +118 -0
- package/unitypkg/Editor/Infrastructure/UnityCliEditorStateSnapshot.cs +2 -1
- package/unitypkg/Editor/Infrastructure/UnityCliHierarchyPager.cs +203 -0
- package/unitypkg/Editor/Infrastructure/UnityCliInstanceCleanup.cs +2 -1
- package/unitypkg/Editor/Infrastructure/UnityCliInstanceRegistry.cs +201 -63
- package/unitypkg/Editor/Infrastructure/UnityCliJson.cs +2 -3
- package/unitypkg/Editor/Infrastructure/UnityCliLiveBuildCoordinator.cs +289 -46
- package/unitypkg/Editor/Infrastructure/UnityCliLiveRefreshCoordinator.cs +87 -53
- package/unitypkg/Editor/Infrastructure/UnityCliNavMeshBakeCoordinator.cs +4 -4
- package/unitypkg/Editor/Infrastructure/UnityCliObjectRef.cs +128 -25
- package/unitypkg/Editor/Infrastructure/UnityCliObjectSerializer.cs +435 -327
- package/unitypkg/Editor/Infrastructure/UnityCliOcclusionBakeCoordinator.cs +4 -4
- package/unitypkg/Editor/Infrastructure/UnityCliOperationCoordinator.cs +351 -53
- package/unitypkg/Editor/Infrastructure/UnityCliPackageResolveCoordinator.cs +118 -18
- package/unitypkg/Editor/Infrastructure/UnityCliPackageResolveState.cs +20 -1
- package/unitypkg/Editor/Infrastructure/UnityCliReadGeneration.cs +97 -0
- package/unitypkg/Editor/Infrastructure/UnityCliReflection.cs +644 -133
- package/unitypkg/Editor/Infrastructure/UnityCliReloadOperation.cs +128 -41
- package/unitypkg/Editor/Infrastructure/UnityCliRuntimeExecutor.cs +14 -84
- package/unitypkg/Editor/Infrastructure/UnityCliSerializer.cs +220 -0
- package/unitypkg/Editor/Infrastructure/UnityCliSessionMutationLease.cs +69 -29
- package/unitypkg/Editor/Infrastructure/UnityCliTestRunCoordinator.cs +440 -54
- package/unitypkg/Editor/Infrastructure/UnityCliWaiter.cs +128 -35
- package/unitypkg/Editor/ProjectTools/IUnityCliTool.cs +9 -1
- package/unitypkg/Editor/ProjectTools/OfficialAttributeToolRegistry.cs +32 -31
- package/unitypkg/Editor/ProjectTools/ProjectToolRegistry.cs +607 -458
- package/unitypkg/Editor/ProjectTools/ProjectToolSchemaValidator.cs +35 -7
- package/unitypkg/Editor/ProjectTools/RegisteredTool.cs +501 -60
- package/unitypkg/Editor/ProjectTools/UnityCliProjectToolContext.cs +21 -0
- package/unitypkg/Editor/ProjectTools/UnityCliSchemaDeriver.cs +36 -7
- package/unitypkg/Editor/ProjectTools/UnityCliToolName.cs +30 -0
- package/unitypkg/Editor/Properties/AssemblyInfo.cs +3 -0
- package/unitypkg/Editor/Tools/asset/get-data.cs +16 -7
- package/unitypkg/Editor/Tools/build/BuildSceneStateTool.cs +23 -3
- package/unitypkg/Editor/Tools/build/BuildToolDtos.cs +2 -1
- package/unitypkg/Editor/Tools/build/scene/add.cs +6 -3
- package/unitypkg/Editor/Tools/build/scene/disable.cs +1 -1
- package/unitypkg/Editor/Tools/build/scene/enable.cs +1 -1
- package/unitypkg/Editor/Tools/build/scene/list.cs +1 -1
- package/unitypkg/Editor/Tools/build/scene/remove.cs +13 -3
- package/unitypkg/Editor/Tools/camera/CameraToolSupport.cs +38 -38
- package/unitypkg/Editor/Tools/camera/multiview.cs +13 -6
- package/unitypkg/Editor/Tools/camera/screenshot.cs +14 -7
- package/unitypkg/Editor/Tools/component/get.cs +16 -9
- package/unitypkg/Editor/Tools/component/modify.cs +6 -4
- package/unitypkg/Editor/Tools/console/clear.cs +7 -6
- package/unitypkg/Editor/Tools/console/get.cs +48 -16
- package/unitypkg/Editor/Tools/editor/EditorToolSupport.cs +143 -28
- package/unitypkg/Editor/Tools/editor/menu-items.cs +1 -1
- package/unitypkg/Editor/Tools/editor/play.cs +2 -11
- package/unitypkg/Editor/Tools/editor/selection.cs +1 -1
- package/unitypkg/Editor/Tools/editor/stop.cs +2 -11
- package/unitypkg/Editor/Tools/editor/windows.cs +1 -1
- package/unitypkg/Editor/Tools/go/GameObjectToolSupport.cs +54 -4
- package/unitypkg/Editor/Tools/go/delete.cs +1 -1
- package/unitypkg/Editor/Tools/go/find.cs +167 -70
- package/unitypkg/Editor/Tools/graphics/GraphicsToolSupport.cs +25 -0
- package/unitypkg/Editor/Tools/graphics/light-probe-group.cs +9 -3
- package/unitypkg/Editor/Tools/graphics/pipeline-info.cs +1 -1
- package/unitypkg/Editor/Tools/graphics/pipeline-settings.cs +1 -1
- package/unitypkg/Editor/Tools/graphics/quality.cs +2 -2
- package/unitypkg/Editor/Tools/graphics/reflection-probe.cs +3 -3
- package/unitypkg/Editor/Tools/graphics/stats.cs +1 -1
- package/unitypkg/Editor/Tools/object/ObjectToolSupport.cs +4 -4
- package/unitypkg/Editor/Tools/object/get-data.cs +9 -7
- package/unitypkg/Editor/Tools/object/modify.cs +7 -5
- package/unitypkg/Editor/Tools/physics/raycast.cs +24 -6
- package/unitypkg/Editor/Tools/prefab/stage.cs +1 -1
- package/unitypkg/Editor/Tools/profiler/ProfilerFrameDebuggerSupport.cs +94 -21
- package/unitypkg/Editor/Tools/profiler/ProfilerMemorySnapshotSupport.cs +397 -10
- package/unitypkg/Editor/Tools/profiler/ProfilerToolSupport.cs +18 -4
- package/unitypkg/Editor/Tools/profiler/frame-debugger/enable.cs +1 -1
- package/unitypkg/Editor/Tools/profiler/frame-debugger/events.cs +88 -87
- package/unitypkg/Editor/Tools/profiler/hierarchy.cs +278 -112
- package/unitypkg/Editor/Tools/profiler/memory-snapshot/compare.cs +9 -5
- package/unitypkg/Editor/Tools/profiler/memory-snapshot/list.cs +37 -35
- package/unitypkg/Editor/Tools/profiler/memory-snapshot/take.cs +99 -97
- package/unitypkg/Editor/Tools/project/info.cs +1 -1
- package/unitypkg/Editor/Tools/project/layers.cs +1 -1
- package/unitypkg/Editor/Tools/project/tags.cs +1 -1
- package/unitypkg/Editor/Tools/reflection/method/call.cs +9 -7
- package/unitypkg/Editor/Tools/reflection/method/find.cs +27 -37
- package/unitypkg/Editor/Tools/reflection/type/schema.cs +24 -28
- package/unitypkg/Editor/Tools/scene/gameobject/component.cs +8 -5
- package/unitypkg/Editor/Tools/scene/gameobject/components.cs +10 -7
- package/unitypkg/Editor/Tools/scene/gameobject-support.cs +104 -8
- package/unitypkg/Editor/Tools/scene/gameobject.cs +37 -16
- package/unitypkg/Editor/Tools/scene/hierarchy.cs +146 -142
- package/unitypkg/Editor/Tools/screenshot/EditorElementCaptureToolSupport.cs +77 -25
- package/unitypkg/Editor/Tools/screenshot/ScreenshotToolSupport.cs +315 -95
- package/unitypkg/Editor/Tools/screenshot/editor-element.cs +7 -5
- package/unitypkg/Editor/Tools/screenshot/game-view.cs +35 -21
- package/unitypkg/Editor/Tools/screenshot/isolated-object.cs +29 -23
- package/unitypkg/Editor/Tools/screenshot/orbit.cs +37 -25
- package/unitypkg/Editor/Tools/screenshot/scene-view.cs +25 -18
- package/unitypkg/Editor/Tools/screenshot/screen.cs +177 -17
- package/unitypkg/Editor/Tools/screenshot/surround.cs +83 -79
- package/unitypkg/Editor/Tools/ui/render-preview.cs +16 -11
- package/unitypkg/Editor/UnityCliBridge.cs +97 -34
- package/unitypkg/Runtime/Infrastructure/UnityCliRuntimeBridge.cs +753 -122
- package/unitypkg/Runtime/Properties/AssemblyInfo.cs +5 -0
- package/unitypkg/Runtime/UnityCli.Runtime.asmdef +1 -1
- package/unitypkg/Shared/AssemblyInfo.cs +4 -0
- package/unitypkg/Shared/UnityCliAdmissionPool.cs +265 -75
- package/unitypkg/Shared/UnityCliBridgeQueuePolicy.cs +410 -0
- package/unitypkg/Shared/UnityCliBridgeWorkItemState.cs +47 -0
- package/unitypkg/Shared/UnityCliExceptionProjection.cs +151 -0
- package/unitypkg/Shared/UnityCliQueuePublication.cs +30 -0
- package/unitypkg/Shared/UnityCliRequestBudget.cs +352 -0
- package/unitypkg/Shared/UnityCliRuntimeRequestPublication.cs +107 -0
- package/unitypkg/Tests/Editor/UnityCli.Editor.Tests.asmdef +2 -2
- package/unitypkg/Tests/Editor/UnityCliAdmissionCoordinatorIntegrationTests.cs +1329 -0
- package/unitypkg/Tests/Editor/UnityCliAdmissionPoolTests.cs +311 -114
- package/unitypkg/Tests/Editor/UnityCliAdmissionRepairStateTests.cs +94 -0
- package/unitypkg/Tests/Editor/UnityCliBridgeAdmissionIntegrationTests.cs +1229 -0
- package/unitypkg/Tests/Editor/UnityCliBridgeQueuePolicyTests.cs +412 -0
- package/unitypkg/Tests/Editor/UnityCliContinuationIntegrationTests.cs +292 -0
- package/unitypkg/Tests/Editor/UnityCliDiagnosticBoundaryTests.cs +120 -0
- package/unitypkg/Tests/Editor/UnityCliDurableStatusTests.cs +84 -0
- package/unitypkg/Tests/Editor/UnityCliExceptionProjectionTests.cs +72 -0
- package/unitypkg/Tests/Editor/UnityCliInstancePublicationRetryTests.cs +180 -97
- package/unitypkg/Tests/Editor/UnityCliMemoryReflectionIntegrationTests.cs +434 -0
- package/unitypkg/Tests/Editor/UnityCliRequestBudgetTests.cs +615 -0
- package/unitypkg/Tests/Editor/UnityCliRuntimeBridgeIntegrationTests.cs +520 -0
- package/unitypkg/Tests/Editor/UnityCliToolCatalogTests.cs +562 -0
- package/unitypkg/Tests/Runtime/UnityCli.Runtime.Tests.asmdef +23 -0
- package/unitypkg/Tests/Runtime/UnityCliRuntimeCatalogValidationTests.cs +29 -0
- package/unitypkg/package.json +1 -1
- package/contracts/static-capability-catalog.json +0 -48226
- package/dist/bridge/domains/diagnose.d.ts +0 -2
- package/dist/bridge/domains/diagnose.js +0 -11
- package/dist/bridge/domains/diagnose.js.map +0 -1
- package/dist/bridge/domains/extension.d.ts +0 -8
- package/dist/bridge/domains/extension.js +0 -20
- package/dist/bridge/domains/extension.js.map +0 -1
- package/dist/capabilities.d.ts +0 -5
- package/dist/capabilities.js +0 -84
- package/dist/capabilities.js.map +0 -1
- package/dist/static-capability-catalog.d.ts +0 -13
- package/dist/static-capability-catalog.js +0 -41
- package/dist/static-capability-catalog.js.map +0 -1
- package/dist/tools/diagnose/capabilities.d.ts +0 -13
- package/dist/tools/diagnose/capabilities.js +0 -34
- package/dist/tools/diagnose/capabilities.js.map +0 -1
- package/dist/tools/package/info.d.ts +0 -19
- package/dist/tools/package/info.js +0 -27
- package/dist/tools/package/info.js.map +0 -1
- package/dist/tools/package/list.d.ts +0 -27
- package/dist/tools/package/list.js +0 -21
- package/dist/tools/package/list.js.map +0 -1
- package/dist/tools/package/registry-get.d.ts +0 -10
- package/dist/tools/package/registry-get.js +0 -22
- package/dist/tools/package/registry-get.js.map +0 -1
- package/dist/tools/package/scoped-registry-list.d.ts +0 -14
- package/dist/tools/package/scoped-registry-list.js +0 -22
- package/dist/tools/package/scoped-registry-list.js.map +0 -1
- package/dist/tools/package/search.d.ts +0 -17
- package/dist/tools/package/search.js +0 -39
- package/dist/tools/package/search.js.map +0 -1
- package/dist/tools/package/status.d.ts +0 -21
- package/dist/tools/package/status.js +0 -37
- package/dist/tools/package/status.js.map +0 -1
- package/dist/tools/tools/describe.d.ts +0 -27
- package/dist/tools/tools/describe.js +0 -35
- package/dist/tools/tools/describe.js.map +0 -1
- package/dist/tools/tools/group-list.d.ts +0 -16
- package/dist/tools/tools/group-list.js +0 -38
- package/dist/tools/tools/group-list.js.map +0 -1
- package/dist/tools/tools/group.d.ts +0 -13
- package/dist/tools/tools/group.js +0 -34
- package/dist/tools/tools/group.js.map +0 -1
- package/dist/tools/tools/pagination.d.ts +0 -17
- package/dist/tools/tools/pagination.js +0 -28
- package/dist/tools/tools/pagination.js.map +0 -1
- package/dist/tools/tools/search.d.ts +0 -15
- package/dist/tools/tools/search.js +0 -42
- package/dist/tools/tools/search.js.map +0 -1
- package/unitypkg/Editor/Tools/diagnose/preflight.cs +0 -269
- package/unitypkg/Editor/Tools/editor/console.cs +0 -26
- package/unitypkg/Editor/Tools/extension/status.cs +0 -87
- package/unitypkg/Editor/Tools/go/inspect.cs +0 -49
- package/unitypkg/Editor/Tools/graphics/pipeline-quality.cs +0 -24
- package/unitypkg/Editor/Tools/graphics/probe-positions.cs +0 -58
- package/unitypkg/Editor/Tools/graphics/settings.cs +0 -104
- package/unitypkg/Editor/Tools/graphics/stats-counters.cs +0 -28
- package/unitypkg/Editor/Tools/graphics/stats-memory.cs +0 -21
- package/unitypkg/Editor/Tools/instances/list.cs +0 -71
- package/unitypkg/Editor/Tools/physics/raycast-all.cs +0 -67
- package/unitypkg/Editor/Tools/scene/build-settings.cs +0 -69
- package/unitypkg/Editor/Tools/scene/data.cs +0 -125
- package/unitypkg/Editor/Tools/tests/list.cs +0 -98
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { checkToolExtensionAvailability, extensionAvailabilityFlags } from "../../extension-availability.js";
|
|
2
|
-
import { publicToolDescriptor, resolveCatalogTool } from "../catalog.js";
|
|
3
|
-
import { defineTool } from "../define.js";
|
|
4
|
-
import { StructuredToolError } from "../errors.js";
|
|
5
|
-
export default defineTool({
|
|
6
|
-
name: "tools.describe",
|
|
7
|
-
summary: "Show one tool's input schema, examples, side effects, target, and availability.",
|
|
8
|
-
description: "Return one compact invocation descriptor from the connected Unity instance catalog: input schema, structured examples, effects, target, and current unavailability when applicable. Internal routing and result schemas stay private.",
|
|
9
|
-
group: "tools",
|
|
10
|
-
handler: "offline",
|
|
11
|
-
supportStatus: "cli-only",
|
|
12
|
-
destructiveHint: false,
|
|
13
|
-
sideEffects: [],
|
|
14
|
-
playModeSupport: "supported",
|
|
15
|
-
examples: [{ description: "Describe a tool's invocation contract", argv: ["tools", "run", "tools.describe", "--input", "{\"name\":\"asset.search\"}"] }],
|
|
16
|
-
async execute(request, context) {
|
|
17
|
-
if (!request.name)
|
|
18
|
-
throw new StructuredToolError("TOOLS_DESCRIBE_NAME_REQUIRED", "Pass a tool name: unitycli tools describe <tool>.", ["Run unitycli tools group to see tool groups."]);
|
|
19
|
-
const flags = context.flags ?? {};
|
|
20
|
-
const resolved = await resolveCatalogTool(request.name, flags, context, `${context.requestId}_describe_execution`);
|
|
21
|
-
if (resolved.ok === false)
|
|
22
|
-
throw StructuredToolError.from(resolved.error ?? { code: "TOOL_DISCOVERY_FAILED", message: "Tool discovery failed." });
|
|
23
|
-
if (!resolved.tool)
|
|
24
|
-
throw new StructuredToolError("E_TOOL_NOT_FOUND_FOR_TARGET", `Tool not found for target: ${request.name}.`, ["Run unitycli tools group to see tool groups.", "Run unitycli tools search <k1|k2|...> to find related tools."]);
|
|
25
|
-
const currentTool = resolved.tool;
|
|
26
|
-
const data = publicToolDescriptor(currentTool);
|
|
27
|
-
const availability = await checkToolExtensionAvailability(currentTool, await extensionAvailabilityFlags(flags, context));
|
|
28
|
-
if (!availability.available) {
|
|
29
|
-
data.available = false;
|
|
30
|
-
data.unavailableReason = `${availability.errorCode}: ${availability.message}`;
|
|
31
|
-
}
|
|
32
|
-
return data;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=describe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../src/tools/tools/describe.ts"],"names":[],"mapp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AI;YAAE,MAAM,IAAI,mBAAmB,CAAC,6BAA6B,EAAE,8BAA8B,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC,8CAA8C,EAAE,8DAA8D,CAAC,CAAC,CAAC;QAClP,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC;QAClC,MAAM,IAAI,GAAG,oBAAoB,CAAC,WAAW,CAAmC,CAAC;QACjF,MAAM,YAAY,GAAG,MAAM,8BAA8B,CAAC,WAAW,EAAE,MAAM,0BAA0B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;QACzH,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC;YAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACvB,IAAI,CAAC,iBAAiB,GAAG,GAAG,YAAY,CAAC,SAAS,KAAK,YAAY,CAAC,OAAO,EAAE,CAAC;QAChF,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type DiscoveryPageInfo, type DiscoveryPageRequest } from "./pagination.js";
|
|
2
|
-
export interface ToolsGroupListRequest extends DiscoveryPageRequest {
|
|
3
|
-
group: string;
|
|
4
|
-
}
|
|
5
|
-
export interface ToolsGroupListItem {
|
|
6
|
-
name: string;
|
|
7
|
-
summary: string;
|
|
8
|
-
available?: false;
|
|
9
|
-
}
|
|
10
|
-
export interface ToolsGroupListResult {
|
|
11
|
-
summary: string;
|
|
12
|
-
pageInfo: DiscoveryPageInfo;
|
|
13
|
-
tools: ToolsGroupListItem[];
|
|
14
|
-
}
|
|
15
|
-
declare const _default: import("../define.js").ToolDefinition<ToolsGroupListRequest, ToolsGroupListResult>;
|
|
16
|
-
export default _default;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { checkToolExtensionAvailability, extensionAvailabilityFlags } from "../../extension-availability.js";
|
|
2
|
-
import { loadToolCatalog } from "../catalog.js";
|
|
3
|
-
import { defineTool } from "../define.js";
|
|
4
|
-
import { StructuredToolError } from "../errors.js";
|
|
5
|
-
import { groupSummary } from "./group-summaries.js";
|
|
6
|
-
import { paginateDiscovery } from "./pagination.js";
|
|
7
|
-
export default defineTool({
|
|
8
|
-
name: "tools.group-list",
|
|
9
|
-
summary: "List one tool group's routing summaries and availability in bounded cursor pages.",
|
|
10
|
-
description: "List Tools in one group from the connected Unity instance catalog, sorted by exact Tool name. pageSize/cursor bound each page; use pageInfo.nextCursor unchanged to continue. Each tools[].name is the exact invocation name, group is only a filter and must never be prepended, and available appears only when false.",
|
|
11
|
-
group: "tools",
|
|
12
|
-
handler: "offline",
|
|
13
|
-
supportStatus: "cli-only",
|
|
14
|
-
destructiveHint: false,
|
|
15
|
-
sideEffects: [],
|
|
16
|
-
playModeSupport: "supported",
|
|
17
|
-
examples: [{ description: "List the first camera Tool page", argv: ["tools", "run", "tools.group-list", "--input", "{\"group\":\"camera\",\"pageSize\":20}"] }],
|
|
18
|
-
async execute(request, context) {
|
|
19
|
-
if (!request.group)
|
|
20
|
-
throw new StructuredToolError("TOOLS_GROUP_LIST_NAME_REQUIRED", "Pass a group name: unitycli tools group list <group>.", ["Run unitycli tools group to see all tool groups."]);
|
|
21
|
-
const flags = context.flags ?? {};
|
|
22
|
-
const catalog = await loadToolCatalog(flags, context, `${context.requestId}_group_list_execution`);
|
|
23
|
-
if (catalog.ok === false)
|
|
24
|
-
throw StructuredToolError.from(catalog.error ?? { code: "TOOL_DISCOVERY_FAILED", message: "Tool discovery failed." });
|
|
25
|
-
const matches = catalog.tools.filter((tool) => tool.group === request.group).sort((left, right) => left.name.localeCompare(right.name));
|
|
26
|
-
if (matches.length === 0)
|
|
27
|
-
throw new StructuredToolError("E_TOOL_GROUP_NOT_FOUND", `Tool group not found: ${request.group}.`, ["Run unitycli tools group to see all tool groups."]);
|
|
28
|
-
const page = paginateDiscovery(matches, request, "tools.group-list");
|
|
29
|
-
const availabilityFlags = await extensionAvailabilityFlags(flags, context);
|
|
30
|
-
const tools = await Promise.all(page.items.map(async (tool) => {
|
|
31
|
-
const availability = await checkToolExtensionAvailability(tool, availabilityFlags);
|
|
32
|
-
const available = availability.available && (tool.available ?? true);
|
|
33
|
-
return { name: tool.name, summary: tool.summary, ...(!available ? { available: false } : {}) };
|
|
34
|
-
}));
|
|
35
|
-
return { summary: groupSummary(request.group), pageInfo: page.pageInfo, tools };
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=group-list.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"group-list.js","sourceRoot":"","sources":["../../../src/tools/tools/group-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7G,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAqD,MAAM,iBAAiB,CAAC;AAMvG,eAAe,UAAU,CAA8C;IACrE,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,mFAAmF;IAC5F,WAAW,EAAE,0TAA0T;IACvU,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,UAAU;IACzB,eAAe,EAAE,KAAK;IACtB,WAAW,EAAE,EAAE;IACf,eAAe,EAAE,WAAW;IAC5B,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,iCAAiC,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,wCAAwC,CAAC,EAAE,CAAC;IAC/J,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO;QAC5B,IAAI,CAAC,OAAO,CAAC,KAAK;YAAE,MAA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M,SAAS,GAAG,YAAY,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;YACrE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAC1G,CAAC,CAAC,CAAC,CAAC;QACJ,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;IAClF,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface ToolsGroupRequest {
|
|
2
|
-
}
|
|
3
|
-
export interface ToolsGroupItem {
|
|
4
|
-
name: string;
|
|
5
|
-
summary: string;
|
|
6
|
-
toolCount: number;
|
|
7
|
-
}
|
|
8
|
-
export interface ToolsGroupResult {
|
|
9
|
-
count: number;
|
|
10
|
-
groups: ToolsGroupItem[];
|
|
11
|
-
}
|
|
12
|
-
declare const _default: import("../define.js").ToolDefinition<ToolsGroupRequest, ToolsGroupResult>;
|
|
13
|
-
export default _default;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { loadToolCatalog } from "../catalog.js";
|
|
2
|
-
import { defineTool } from "../define.js";
|
|
3
|
-
import { StructuredToolError } from "../errors.js";
|
|
4
|
-
import { groupSummary } from "./group-summaries.js";
|
|
5
|
-
function discoveryError(result) {
|
|
6
|
-
throw StructuredToolError.from(result.error ?? { code: "TOOL_DISCOVERY_FAILED", message: "Tool discovery failed." });
|
|
7
|
-
}
|
|
8
|
-
export default defineTool({
|
|
9
|
-
name: "tools.group",
|
|
10
|
-
summary: "List the available tool groups with counts.",
|
|
11
|
-
description: "List every Tool group owned by the connected Unity instance, including package-local CLI capabilities.",
|
|
12
|
-
group: "tools",
|
|
13
|
-
handler: "offline",
|
|
14
|
-
supportStatus: "cli-only",
|
|
15
|
-
destructiveHint: false,
|
|
16
|
-
sideEffects: [],
|
|
17
|
-
playModeSupport: "supported",
|
|
18
|
-
examples: [{ description: "List all tool groups", argv: ["tools", "run", "tools.group", "--input", "{}"] }],
|
|
19
|
-
async execute(request, context) {
|
|
20
|
-
const catalog = await loadToolCatalog(context.flags ?? {}, context, `${context.requestId}_group_execution`);
|
|
21
|
-
if (catalog.ok === false)
|
|
22
|
-
discoveryError(catalog);
|
|
23
|
-
const groups = new Map();
|
|
24
|
-
for (const tool of catalog.tools)
|
|
25
|
-
groups.set(tool.group, (groups.get(tool.group) ?? 0) + 1);
|
|
26
|
-
const items = [...groups].sort(([a], [b]) => a.localeCompare(b)).map(([name, toolCount]) => ({
|
|
27
|
-
name,
|
|
28
|
-
summary: groupSummary(name),
|
|
29
|
-
toolCount
|
|
30
|
-
}));
|
|
31
|
-
return { count: items.length, groups: items };
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=group.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/tools/tools/group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMpD,SAAS,cAAc,CAAC,MAA4I;IAClK,MAAM,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,wBAAwB,EAAE,CAAC,CAAC;AACvH,CAAC;AAED,eAAe,UAAU,CAAsC;IAC7D,IAAI,EAAE,aAAa;IACnB,OA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AC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAChD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_DISCOVERY_PAGE_SIZE = 20;
|
|
2
|
-
export declare const MAX_DISCOVERY_PAGE_SIZE = 100;
|
|
3
|
-
export interface DiscoveryPageRequest {
|
|
4
|
-
pageSize?: number;
|
|
5
|
-
cursor?: number;
|
|
6
|
-
}
|
|
7
|
-
export interface DiscoveryPageInfo {
|
|
8
|
-
cursor: number;
|
|
9
|
-
pageSize: number;
|
|
10
|
-
total: number;
|
|
11
|
-
nextCursor?: number;
|
|
12
|
-
}
|
|
13
|
-
/** 对稳定排序后的 discovery 结果应用统一数字 cursor 分页。 */
|
|
14
|
-
export declare function paginateDiscovery<T>(items: T[], request: DiscoveryPageRequest, operation: string): {
|
|
15
|
-
items: T[];
|
|
16
|
-
pageInfo: DiscoveryPageInfo;
|
|
17
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { StructuredToolError } from "../errors.js";
|
|
2
|
-
export const DEFAULT_DISCOVERY_PAGE_SIZE = 20;
|
|
3
|
-
export const MAX_DISCOVERY_PAGE_SIZE = 100;
|
|
4
|
-
/** 对稳定排序后的 discovery 结果应用统一数字 cursor 分页。 */
|
|
5
|
-
export function paginateDiscovery(items, request, operation) {
|
|
6
|
-
const pageSize = request.pageSize ?? DEFAULT_DISCOVERY_PAGE_SIZE;
|
|
7
|
-
const cursor = request.cursor ?? 0;
|
|
8
|
-
if (!Number.isSafeInteger(pageSize) || pageSize < 1 || pageSize > MAX_DISCOVERY_PAGE_SIZE) {
|
|
9
|
-
throw pageError(operation, "pageSize", `[1,${MAX_DISCOVERY_PAGE_SIZE}] integer`, request.pageSize);
|
|
10
|
-
}
|
|
11
|
-
if (!Number.isSafeInteger(cursor) || cursor < 0) {
|
|
12
|
-
throw pageError(operation, "cursor", "non-negative integer", request.cursor);
|
|
13
|
-
}
|
|
14
|
-
const end = Math.min(items.length, cursor + pageSize);
|
|
15
|
-
return {
|
|
16
|
-
items: cursor < items.length ? items.slice(cursor, end) : [],
|
|
17
|
-
pageInfo: {
|
|
18
|
-
cursor,
|
|
19
|
-
pageSize,
|
|
20
|
-
total: items.length,
|
|
21
|
-
...(end < items.length ? { nextCursor: end } : {}),
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function pageError(operation, field, expected, actual) {
|
|
26
|
-
return new StructuredToolError("E_SCHEMA_INVALID", `${operation} ${field} must be a ${expected}.`, [`Pass a valid ${field}; use the returned pageInfo.nextCursor unchanged to continue.`], { path: `$.${field}`, expected, actual: actual ?? null });
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=pagination.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../src/tools/tools/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAc3C,4CAA4C;AAC5C,MAAM,UAAU,iBAAiB,CAAI,KAAU,EAAE,OAA6B,EAAE,SAAiB;IAC/F,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,2BAA2B,CAAC;IACjE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,IAAI,QAAQ,GAAG,uBAAuB,EAAE,CAAC;QAC1F,MAAM,SAAS,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,uBAAuB,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrG,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAChD,MAAM,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,sBAAsB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/E,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;IACtD,OAAO;QACL,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;QAC5D,QAAQ,EAAE;YACR,MAAM;YACN,QAAQ;YACR,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnD;KACF,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,SAAiB,EAAE,KAAa,EAAE,QAAgB,EAAE,MAAe;IACpF,OAAO,IAAI,mBAAmB,CAC5B,kBAAkB,EAClB,GAAG,SAAS,IAAI,KAAK,cAAc,QAAQ,GAAG,EAC9C,CAAC,gBAAgB,KAAK,+DAA+D,CAAC,EACtF,EAAE,IAAI,EAAE,KAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,IAAI,IAAI,EAAE,CACzD,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type DiscoveryPageInfo, type DiscoveryPageRequest } from "./pagination.js";
|
|
2
|
-
export interface ToolsSearchRequest extends DiscoveryPageRequest {
|
|
3
|
-
keyword: string;
|
|
4
|
-
}
|
|
5
|
-
export interface ToolsSearchItem {
|
|
6
|
-
name: string;
|
|
7
|
-
summary: string;
|
|
8
|
-
group: string;
|
|
9
|
-
}
|
|
10
|
-
export interface ToolsSearchResult {
|
|
11
|
-
pageInfo: DiscoveryPageInfo;
|
|
12
|
-
tools: ToolsSearchItem[];
|
|
13
|
-
}
|
|
14
|
-
declare const _default: import("../define.js").ToolDefinition<ToolsSearchRequest, ToolsSearchResult>;
|
|
15
|
-
export default _default;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { loadToolCatalog } from "../catalog.js";
|
|
2
|
-
import { defineTool } from "../define.js";
|
|
3
|
-
import { StructuredToolError } from "../errors.js";
|
|
4
|
-
import { paginateDiscovery } from "./pagination.js";
|
|
5
|
-
export default defineTool({
|
|
6
|
-
name: "tools.search",
|
|
7
|
-
summary: "Search tool routing metadata with `|`-separated OR keywords and bounded cursor pages.",
|
|
8
|
-
description: "Search the complete Tool catalog owned by the connected Unity instance. keyword is split on `|`; a Tool matches when any token appears in its name, summary, description, or group (case-insensitive, OR semantics). Results are sorted by exact Tool name and paged with pageSize/cursor; use pageInfo.nextCursor unchanged to continue. Results contain routing summaries only - use tools describe for schema, availability, and full details.",
|
|
9
|
-
group: "tools",
|
|
10
|
-
handler: "offline",
|
|
11
|
-
supportStatus: "cli-only",
|
|
12
|
-
destructiveHint: false,
|
|
13
|
-
sideEffects: [],
|
|
14
|
-
playModeSupport: "supported",
|
|
15
|
-
examples: [
|
|
16
|
-
{ description: "Search for hierarchy tools", argv: ["tools", "run", "tools.search", "--input", "{\"keyword\":\"hierarchy\"}"] },
|
|
17
|
-
{ description: "Search several capability areas in one bounded page", argv: ["tools", "run", "tools.search", "--input", "{\"keyword\":\"editor|console|screenshot\",\"pageSize\":20}"] },
|
|
18
|
-
],
|
|
19
|
-
async execute(request, context) {
|
|
20
|
-
const tokens = (request.keyword ?? "")
|
|
21
|
-
.split("|")
|
|
22
|
-
.map((token) => token.trim().toLowerCase())
|
|
23
|
-
.filter((token) => token.length > 0);
|
|
24
|
-
if (tokens.length === 0) {
|
|
25
|
-
throw new StructuredToolError("TOOLS_SEARCH_KEYWORD_REQUIRED", "Pass one or more `|`-separated keywords: unitycli tools search <k1|k2|...>.", ["Run unitycli tools group to see tool groups."]);
|
|
26
|
-
}
|
|
27
|
-
const flags = context.flags ?? {};
|
|
28
|
-
const catalog = await loadToolCatalog(flags, context, `${context.requestId}_search_execution`);
|
|
29
|
-
if (catalog.ok === false) {
|
|
30
|
-
throw StructuredToolError.from(catalog.error ?? { code: "TOOL_DISCOVERY_FAILED", message: "Tool discovery failed." });
|
|
31
|
-
}
|
|
32
|
-
const matches = catalog.tools
|
|
33
|
-
.filter((tool) => tokens.some((token) => [tool.name, tool.summary, tool.description, tool.group].some((value) => value.toLowerCase().includes(token))))
|
|
34
|
-
.sort((left, right) => left.name.localeCompare(right.name));
|
|
35
|
-
const page = paginateDiscovery(matches, request, "tools.search");
|
|
36
|
-
return {
|
|
37
|
-
pageInfo: page.pageInfo,
|
|
38
|
-
tools: page.items.map((tool) => ({ name: tool.name, summary: tool.summary, group: tool.group })),
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=search.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/tools/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAqD,MAAM,iBAAiB,CAAC;AAMvG,eAAe,UAAU,CAAwC;IAC/D,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,uFAAuF;IAChG,WAAW,EAAE,mbAAmb;IAChc,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,UAAU;IACzB,eAAe,EAAE,KAAK;IACtB,WAAW,EAAE,EAAE;IACf,eAAe,EAAE,WAAW;IAC5B,QAAQ,EAA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CAAC,CAAC,KAAK,EAAE,EAAE,CACtC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aAC/G,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACjE,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;SACjG,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using System;
|
|
3
|
-
using System.Collections.Generic;
|
|
4
|
-
using System.Globalization;
|
|
5
|
-
using System.IO;
|
|
6
|
-
using System.Linq;
|
|
7
|
-
using System.Reflection;
|
|
8
|
-
using System.Text;
|
|
9
|
-
using UnityEditor;
|
|
10
|
-
using UnityEngine;
|
|
11
|
-
using UnityEngine.SceneManagement;
|
|
12
|
-
|
|
13
|
-
namespace UnityCli
|
|
14
|
-
{
|
|
15
|
-
public static partial class UnityCliBridge
|
|
16
|
-
{
|
|
17
|
-
/// <summary>
|
|
18
|
-
/// diagnose.preflight — 聚合 Unity Editor 健康诊断。
|
|
19
|
-
///
|
|
20
|
-
/// 作为 UnityCliBridge 的嵌套类实现,聚合 Editor 状态、公开 Tool 计数、项目 Tool
|
|
21
|
-
/// fingerprint 与编译诊断。所有动态字段直接构造为 Dictionary/List 值树。
|
|
22
|
-
/// </summary>
|
|
23
|
-
public sealed class DiagnosePreflightTool : IUnityCliTool<DiagnosePreflightTool.Request, DiagnosePreflightTool.Result>
|
|
24
|
-
{
|
|
25
|
-
public sealed class Request
|
|
26
|
-
{
|
|
27
|
-
public string Command { get; set; }
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public sealed class Result
|
|
31
|
-
{
|
|
32
|
-
public string TargetCommand { get; set; }
|
|
33
|
-
public ProjectInfo Project { get; set; }
|
|
34
|
-
[UnityCliAnyJson] public object Editor { get; set; }
|
|
35
|
-
public BridgeInfo Bridge { get; set; }
|
|
36
|
-
public CustomFingerprintInfo CustomTools { get; set; }
|
|
37
|
-
[UnityCliAnyJson] public List<object> Checks { get; set; }
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public sealed class ProjectInfo
|
|
41
|
-
{
|
|
42
|
-
public string Path { get; set; }
|
|
43
|
-
public string UnityVersion { get; set; }
|
|
44
|
-
public string ActiveScene { get; set; }
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public sealed class BridgeInfo
|
|
48
|
-
{
|
|
49
|
-
public bool Ready { get; set; }
|
|
50
|
-
public long ToolCount { get; set; }
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public sealed class CustomFingerprintInfo
|
|
54
|
-
{
|
|
55
|
-
[UnityCliAnyJson] public object Fingerprint { get; set; }
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public sealed class CompileStatusCheck
|
|
59
|
-
{
|
|
60
|
-
public string Name { get; set; }
|
|
61
|
-
public bool Ok { get; set; }
|
|
62
|
-
public bool Compiling { get; set; }
|
|
63
|
-
public bool ScanComplete { get; set; }
|
|
64
|
-
public bool HasCompileErrors { get; set; }
|
|
65
|
-
public long CompileErrorCount { get; set; }
|
|
66
|
-
public bool CompileErrorsTruncated { get; set; }
|
|
67
|
-
public List<string> CompileErrors { get; set; }
|
|
68
|
-
public List<string> NextActions { get; set; }
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public ToolDescriptor Describe() => new()
|
|
72
|
-
{
|
|
73
|
-
Name = "diagnose.preflight",
|
|
74
|
-
Summary = "Run a live Unity Editor health check for project state, capability counts, custom fingerprints, and compile diagnostics.",
|
|
75
|
-
Description = "Reads current project and Editor busy state, public Tool counts, custom Tool fingerprint health, and recent compile diagnostics without exposing Bridge routes, ports, or logs.",
|
|
76
|
-
Group = "diagnose",DestructiveHint = false, Target = "editor", PlayModeSupport = "supported",
|
|
77
|
-
DefaultTimeoutMs = 30000, MaxTimeoutMs = 600000,
|
|
78
|
-
Examples = new[]
|
|
79
|
-
{
|
|
80
|
-
new ToolExample { Description = "Run live preflight", Input = new Request { } },
|
|
81
|
-
new ToolExample { Description = "Preflight before component work", Input = new Request { Command = "component.add" } }
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request request, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
86
|
-
{
|
|
87
|
-
// preflight 只读取已经发布的 registry 快照,不能为了诊断触发 discovery 或写入缓存。
|
|
88
|
-
var scene = SceneManager.GetActiveScene();
|
|
89
|
-
var checks = new List<object>
|
|
90
|
-
{
|
|
91
|
-
MakeCheck("unityNotBusy", !(EditorApplication.isCompiling || EditorApplication.isUpdating || BuildPipeline.isBuildingPlayer)),
|
|
92
|
-
MakeCheck("sceneLoaded", scene.isLoaded),
|
|
93
|
-
MakeCheck("projectToolFingerprint", !ProjectTools.Values.Any(definition => definition.FingerprintStatus == "blocked")),
|
|
94
|
-
BuildCompileStatus(ct)
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result
|
|
98
|
-
{
|
|
99
|
-
TargetCommand = request.Command,
|
|
100
|
-
Project = new ProjectInfo
|
|
101
|
-
{
|
|
102
|
-
Path = ProjectRoot(),
|
|
103
|
-
UnityVersion = Application.unityVersion,
|
|
104
|
-
ActiveScene = scene.path
|
|
105
|
-
},
|
|
106
|
-
Editor = new Dictionary<string, object>
|
|
107
|
-
{
|
|
108
|
-
{ "busy", EditorApplication.isCompiling || EditorApplication.isUpdating || BuildPipeline.isBuildingPlayer },
|
|
109
|
-
{ "compiling", EditorApplication.isCompiling },
|
|
110
|
-
{ "updating", EditorApplication.isUpdating },
|
|
111
|
-
{ "building", BuildPipeline.isBuildingPlayer }
|
|
112
|
-
},
|
|
113
|
-
Bridge = new BridgeInfo
|
|
114
|
-
{
|
|
115
|
-
Ready = true,
|
|
116
|
-
ToolCount = ProjectTools.Count
|
|
117
|
-
},
|
|
118
|
-
CustomTools = new CustomFingerprintInfo { Fingerprint = ProjectToolFingerprintSummary() },
|
|
119
|
-
Checks = checks
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// 构造 {name, ok} 检查项(运行时 Dictionary,UnityCliSerializer 序列化为对象)
|
|
124
|
-
private static Dictionary<string, object> MakeCheck(string name, bool ok)
|
|
125
|
-
{
|
|
126
|
-
return new Dictionary<string, object> { { "name", name }, { "ok", ok } };
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// 编译状态检查:isCompiling + 近期编译错误(通过反射 LogEntries)。
|
|
130
|
-
// 扩展编译失败会让 Unity 持续无法完成编译、Bridge 报 E_UNITY_COMPILING,这里把状态和错误明示出来,
|
|
131
|
-
// 让 doctor 能定位是"扩展编译失败"而非"bridge 不可达"。
|
|
132
|
-
private static CompileStatusCheck BuildCompileStatus(System.Threading.CancellationToken ct)
|
|
133
|
-
{
|
|
134
|
-
const int maxScannedEntries = 5000;
|
|
135
|
-
const int maxScanMilliseconds = 50;
|
|
136
|
-
var scanTimer = System.Diagnostics.Stopwatch.StartNew();
|
|
137
|
-
var compiling = EditorApplication.isCompiling;
|
|
138
|
-
var hasCompileErrors = false;
|
|
139
|
-
var scanComplete = true;
|
|
140
|
-
long compileErrorCount = 0;
|
|
141
|
-
var compileErrorsTruncated = false;
|
|
142
|
-
var compileErrorChars = 0;
|
|
143
|
-
const int maxCompileErrorChars = 64 * 1024;
|
|
144
|
-
const int maxCompileErrorLineChars = 4096;
|
|
145
|
-
var errors = new List<string>();
|
|
146
|
-
try
|
|
147
|
-
{
|
|
148
|
-
var logEntriesType = FindType("UnityEditor.LogEntries") ?? FindType("UnityEditorInternal.LogEntries");
|
|
149
|
-
if (logEntriesType != null)
|
|
150
|
-
{
|
|
151
|
-
var flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
|
|
152
|
-
var start = logEntriesType.GetMethod("StartGettingEntries", flags);
|
|
153
|
-
var end = logEntriesType.GetMethod("EndGettingEntries", flags);
|
|
154
|
-
var count = logEntriesType.GetMethod("GetCount", flags);
|
|
155
|
-
var getEntry = logEntriesType.GetMethod("GetEntryInternal", flags);
|
|
156
|
-
var getLines = logEntriesType.GetMethod("GetLinesAndModeFromEntryInternal", flags)
|
|
157
|
-
?? logEntriesType.GetMethod("GetLinesAndModeInternal", flags);
|
|
158
|
-
if ((start == null && count == null) || (getEntry == null && getLines == null)) scanComplete = false;
|
|
159
|
-
var total = start != null
|
|
160
|
-
? Convert.ToInt32(start.Invoke(null, Type.EmptyTypes), CultureInfo.InvariantCulture)
|
|
161
|
-
: count == null ? 0 : Convert.ToInt32(count.Invoke(null, Type.EmptyTypes), CultureInfo.InvariantCulture);
|
|
162
|
-
try
|
|
163
|
-
{
|
|
164
|
-
var scannedEntries = 0;
|
|
165
|
-
for (var i = total - 1; i >= 0; i--)
|
|
166
|
-
{
|
|
167
|
-
ct.ThrowIfCancellationRequested();
|
|
168
|
-
if (scannedEntries >= maxScannedEntries || scanTimer.ElapsedMilliseconds >= maxScanMilliseconds)
|
|
169
|
-
{
|
|
170
|
-
scanComplete = false;
|
|
171
|
-
compileErrorsTruncated = true;
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
scannedEntries++;
|
|
175
|
-
string line = null;
|
|
176
|
-
var mode = 0;
|
|
177
|
-
try
|
|
178
|
-
{
|
|
179
|
-
if (getLines != null && getLines.GetParameters().Length == 4)
|
|
180
|
-
{
|
|
181
|
-
var args = new object[] { i, 1, 0, null };
|
|
182
|
-
getLines.Invoke(null, args);
|
|
183
|
-
mode = Convert.ToInt32(args[2], CultureInfo.InvariantCulture);
|
|
184
|
-
line = args[3] as string;
|
|
185
|
-
}
|
|
186
|
-
else if (getEntry != null && getEntry.GetParameters().Length == 4)
|
|
187
|
-
{
|
|
188
|
-
var args = new object[4] { i, null, null, null };
|
|
189
|
-
getEntry.Invoke(null, args);
|
|
190
|
-
line = args[1] as string;
|
|
191
|
-
mode = args[2] == null ? 0 : Convert.ToInt32(args[2], CultureInfo.InvariantCulture);
|
|
192
|
-
}
|
|
193
|
-
else if (getLines != null && getLines.GetParameters().Length == 2)
|
|
194
|
-
{
|
|
195
|
-
var args = new object[] { i, null };
|
|
196
|
-
getLines.Invoke(null, args);
|
|
197
|
-
line = args[1] as string;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
catch { scanComplete = false; }
|
|
201
|
-
if (string.IsNullOrEmpty(line)) { scanComplete = false; continue; }
|
|
202
|
-
// 仅关注编译错误(CS####)。mode 位掩码中 bit1 为 error。
|
|
203
|
-
var isCompileError = line.IndexOf("CS", StringComparison.OrdinalIgnoreCase) >= 0 && line.IndexOf("error", StringComparison.OrdinalIgnoreCase) >= 0;
|
|
204
|
-
if (isCompileError || ((mode & 1) != 0 && line.IndexOf("Compile", StringComparison.OrdinalIgnoreCase) >= 0))
|
|
205
|
-
{
|
|
206
|
-
hasCompileErrors = true;
|
|
207
|
-
compileErrorCount++;
|
|
208
|
-
var boundedLine = BoundedUtf8(line, maxCompileErrorLineChars);
|
|
209
|
-
var boundedBytes = Encoding.UTF8.GetByteCount(boundedLine);
|
|
210
|
-
if (errors.Count < 20 && compileErrorChars + boundedBytes <= maxCompileErrorChars)
|
|
211
|
-
{
|
|
212
|
-
errors.Add(boundedLine);
|
|
213
|
-
compileErrorChars += boundedBytes;
|
|
214
|
-
if (boundedLine.Length != line.Length) compileErrorsTruncated = true;
|
|
215
|
-
}
|
|
216
|
-
else compileErrorsTruncated = true;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
finally
|
|
221
|
-
{
|
|
222
|
-
if (start != null && end != null) end.Invoke(null, Type.EmptyTypes);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
else scanComplete = false;
|
|
226
|
-
}
|
|
227
|
-
catch (OperationCanceledException) { throw; }
|
|
228
|
-
catch (Exception exception)
|
|
229
|
-
{
|
|
230
|
-
scanComplete = false;
|
|
231
|
-
var readFailure = "Failed to read compile errors: " + exception.GetType().Name;
|
|
232
|
-
if (errors.Count < 20 && compileErrorChars + Encoding.UTF8.GetByteCount(readFailure) <= maxCompileErrorChars) errors.Insert(0, readFailure);
|
|
233
|
-
else compileErrorsTruncated = true;
|
|
234
|
-
}
|
|
235
|
-
if (!scanComplete) compileErrorsTruncated = true;
|
|
236
|
-
var nextActions = new List<string>();
|
|
237
|
-
if (!scanComplete) nextActions.Add("Compile diagnostics could not be scanned completely; inspect Unity Console before treating preflight as healthy.");
|
|
238
|
-
if (hasCompileErrors) nextActions.Add("Review the listed compile errors (often from a broken extension under Packages/com.alpsckr.unitycli/Extensions). Fix or remove the offending extension, then let Unity recompile.");
|
|
239
|
-
if (compiling) nextActions.Add("Wait for Unity to finish compiling, then re-run doctor.");
|
|
240
|
-
if (hasCompileErrors && File.Exists(Path.Combine(ProjectRoot(), "Packages", "com.alpsckr.unitycli", "Extensions", "extension.json")))
|
|
241
|
-
{
|
|
242
|
-
nextActions.Add("If an extension no longer compiles, remove it via unitycli extensions remove <id> --project <path>.");
|
|
243
|
-
}
|
|
244
|
-
return new CompileStatusCheck
|
|
245
|
-
{
|
|
246
|
-
Name = "compileStatus",
|
|
247
|
-
Ok = scanComplete && !compiling && !hasCompileErrors,
|
|
248
|
-
Compiling = compiling,
|
|
249
|
-
ScanComplete = scanComplete,
|
|
250
|
-
HasCompileErrors = hasCompileErrors,
|
|
251
|
-
CompileErrorCount = compileErrorCount,
|
|
252
|
-
CompileErrorsTruncated = compileErrorsTruncated,
|
|
253
|
-
CompileErrors = errors,
|
|
254
|
-
NextActions = nextActions
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
private static string BoundedUtf8(string value, int maxBytes)
|
|
259
|
-
{
|
|
260
|
-
if (string.IsNullOrEmpty(value) || Encoding.UTF8.GetByteCount(value) <= maxBytes) return value ?? string.Empty;
|
|
261
|
-
var length = Math.Min(value.Length, maxBytes);
|
|
262
|
-
while (length > 0 && Encoding.UTF8.GetByteCount(value.Substring(0, length)) > maxBytes) length--;
|
|
263
|
-
if (length > 0 && char.IsHighSurrogate(value[length - 1])) length--;
|
|
264
|
-
return value.Substring(0, length);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
#endif
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#if UNITY_EDITOR
|
|
2
|
-
using System;
|
|
3
|
-
using System.Collections.Generic;
|
|
4
|
-
using System.Linq;
|
|
5
|
-
using System.Reflection;
|
|
6
|
-
using UnityEditor;
|
|
7
|
-
using UnityEditor.Compilation;
|
|
8
|
-
using UnityEngine;
|
|
9
|
-
|
|
10
|
-
namespace UnityCli
|
|
11
|
-
{
|
|
12
|
-
/// <summary>editor.console — 读取 Console 日志(只读)。</summary>
|
|
13
|
-
public class EditorConsoleTool : IUnityCliTool<EditorConsoleTool.Request, EditorConsoleTool.Result>
|
|
14
|
-
{
|
|
15
|
-
public sealed class Request { public string Type { get; set; } public int? Count { get; set; } }
|
|
16
|
-
public sealed class Result { public bool Cleared { get; set; } public List<ConsoleEntry> Items { get; set; } public PageInfo PageInfo { get; set; } }
|
|
17
|
-
public ToolDescriptor Describe() => new() { Name = "editor.console", Summary = "Read recent Unity Console log entries.", Description = "Read-only: returns recent Console entries filtered by type. Use console.clear to clear.", Group = "editor",DestructiveHint = false, Target = "editor", PlayModeSupport = "supported", DefaultTimeoutMs = 30000, MaxTimeoutMs = 600000, Examples = new[] { new ToolExample { Description = "Read console", Input = new Request { Count = 20 } } } };
|
|
18
|
-
public System.Threading.Tasks.ValueTask<Result> ExecuteAsync(Request r, UnityCliProjectToolContext ctx, System.Threading.CancellationToken ct = default)
|
|
19
|
-
{
|
|
20
|
-
var count = Math.Max(1, Math.Min(r.Count ?? 50, 500));
|
|
21
|
-
var items = EditorToolSupport.ReadConsoleEntries(r.Type, null, count);
|
|
22
|
-
return new System.Threading.Tasks.ValueTask<Result>(new Result { Cleared = false, Items = items, PageInfo = new PageInfo { PageSize = count, Cursor = 0, Total = items.Count } });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
#endif
|