From 174b9c6976d448c535d29393d8ebead7b7a08b3a Mon Sep 17 00:00:00 2001 From: cneicy Date: Tue, 29 Sep 2026 10:14:38 +0800 Subject: [PATCH] feat(command): expose registration snapshots for inspection --- DotNet~/ShrinkSDK.Command.csproj | 4 ++-- README.md | 10 ++++++++++ Runtime/Core/ShrinkCommandService.cs | 3 +++ package.json | 4 ++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/DotNet~/ShrinkSDK.Command.csproj b/DotNet~/ShrinkSDK.Command.csproj index 03cfe0e..1297ca5 100644 --- a/DotNet~/ShrinkSDK.Command.csproj +++ b/DotNet~/ShrinkSDK.Command.csproj @@ -5,7 +5,7 @@ ShrinkCommand.Runtime ShrinkCommand ShrinkSDK.Command - 0.3.0 + 0.4.2 ShrinkSDK command parsing, permissions and execution runtime. false @@ -13,6 +13,6 @@ - + diff --git a/README.md b/README.md index edb3cc9..9bd1d31 100644 --- a/README.md +++ b/README.md @@ -85,3 +85,13 @@ service.RegisterCommands(myCommandInstance); - 运行时创建的对象 - 模组实例 - 需要带状态的命令宿主 + +## 可复用能力 + + +Capability: 路径式命令解析、参数转换、来源权限和帮助输出 +Aliases: 命令 控制台 控制 指令 权限 command +Limits: 不替代游戏行为实现;从网络调用仍需检查命令来源与权限;注册与执行归宿主协调 +Extension: ShrinkCommandRegistration;RegisterConverter;ShrinkCommandAttribute +Evidence: [ShrinkCommandService](Runtime/Core/ShrinkCommandService.cs); [ShrinkCommandRegistration](Runtime/Core/ShrinkCommandService.cs) + diff --git a/Runtime/Core/ShrinkCommandService.cs b/Runtime/Core/ShrinkCommandService.cs index 7710460..0949be4 100644 --- a/Runtime/Core/ShrinkCommandService.cs +++ b/Runtime/Core/ShrinkCommandService.cs @@ -56,6 +56,9 @@ namespace ShrinkCommand RegisterBuiltInCommands(); } + public IReadOnlyList<(string Path, MethodInfo Handler)> CaptureBindings() => _commands + .Select(command => (command.Descriptor.Path, command.Handler.Method)).ToArray(); + public IReadOnlyList Commands => _commands .Select(command => command.Descriptor) .OrderBy(command => command.Path, StringComparer.OrdinalIgnoreCase) diff --git a/package.json b/package.json index b8a3f79..fa967df 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "com.cneicy.shrink-command", - "version": "0.3.0", + "version": "0.4.2", "displayName": "ShrinkCommand", "description": "独立于网络层的 Unity 命令系统,提供路径式命令、权限、帮助输出与属性式注册。", "unity": "2022.3", "dependencies": { - "com.cneicy.shrink-shared-codegen": "0.1.1", + "com.cneicy.shrink-shared-codegen": "0.2.1", "com.cysharp.unitask": "2.5.10" }, "keywords": [