diff --git a/.claude/settings.json b/.claude/settings.json index 44bb7e48..4f7901c8 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -1,15 +1,4 @@ { - "extraKnownMarketplaces": { - "unicli": { - "source": { - "source": "github", - "repo": "yucchiy/UniCli" - } - } - }, - "enabledPlugins": { - "unicli@unicli": true - }, "hooks": { "PostToolUse": [ { diff --git a/Aspid.FastTools/Assets/DevTests/CliCommands.meta b/Aspid.FastTools/Assets/DevTests/CliCommands.meta new file mode 100644 index 00000000..ddf5922c --- /dev/null +++ b/Aspid.FastTools/Assets/DevTests/CliCommands.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce9aa844052a54282b9acd83bdc3ae75 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Aspid.FastTools/Assets/DevTests/CliCommands/Editor.meta b/Aspid.FastTools/Assets/DevTests/CliCommands/Editor.meta new file mode 100644 index 00000000..1a841f9a --- /dev/null +++ b/Aspid.FastTools/Assets/DevTests/CliCommands/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 101ca99d4e0f54189ab70cf8029bc101 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/Aspid.FastTools.DevTests.CliCommands.Editor.asmdef b/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/Aspid.FastTools.DevTests.CliCommands.Editor.asmdef new file mode 100644 index 00000000..854f2e48 --- /dev/null +++ b/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/Aspid.FastTools.DevTests.CliCommands.Editor.asmdef @@ -0,0 +1,19 @@ +{ + "name": "Aspid.FastTools.DevTests.CliCommands.Editor", + "references": [ + "Aspid.FastTools.Unity.Editor", + "Aspid.FastTools.Unity.Editor.SerializeReferences.Yaml", + "Unity.Pipeline" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": false, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} diff --git a/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/Aspid.FastTools.DevTests.CliCommands.Editor.asmdef.meta b/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/Aspid.FastTools.DevTests.CliCommands.Editor.asmdef.meta new file mode 100644 index 00000000..1d36d643 --- /dev/null +++ b/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/Aspid.FastTools.DevTests.CliCommands.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c012c3cc320d547c19d595e9f832cb5f +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/SerializeReferenceGateCommands.cs b/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/SerializeReferenceGateCommands.cs new file mode 100644 index 00000000..8b6d5cac --- /dev/null +++ b/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/SerializeReferenceGateCommands.cs @@ -0,0 +1,53 @@ +using System.Linq; +using Unity.Pipeline.Commands; +using Aspid.FastTools.SerializeReferences.Editors; + +// ReSharper disable once CheckNamespace +namespace Aspid.FastTools.DevTests.Editors +{ + /// + /// Dev-only Unity CLI wrapper over the SerializeReference gate scanner: unity command sr_gate returns the + /// violations as structured JSON without a batchmode Editor relaunch, unlike . + /// + internal static class SerializeReferenceGateCommands + { + [CliCommand("sr_gate", "Scan the project for SerializeReference gate violations (missing types / unset Required fields)")] + internal static object Run( + [CliArg("scope", "What to scan: missing | required | full")] string scope = "missing", + [CliArg("warn_only", "Force Warn severity: report but exit code 0")] bool warnOnly = false, + [CliArg("fail", "Force Fail severity: exit code 1 on violations")] bool fail = false) + { + var options = scope?.ToLowerInvariant() switch + { + "missing" => GateOptions.MissingOnly, + "required" => GateOptions.RequiredOnly, + "full" => GateOptions.Full, + _ => default, + }; + + if (options.Equals(default(GateOptions))) + return new { success = false, error = $"Unknown scope '{scope}'. Use: missing | required | full." }; + + var severity = SerializeReferenceCiGate.ResolveSeverity(SerializeReferenceSettings.BuildSeverity, warnOnly, fail); + var violations = SerializeReferenceGateScanner.Scan(options); + + return new + { + success = true, + scope, + severity = severity.ToString(), + violationCount = violations.Count, + exitCode = SerializeReferenceCiGate.ComputeExitCode(violations.Count, severity), + violations = violations.Select(violation => new + { + kind = violation.Kind.ToString(), + assetPath = violation.AssetPath, + fieldPath = violation.FieldPath, + storedType = violation.StoredType.Class, + fileId = violation.FileId, + rid = violation.Rid, + }).ToArray(), + }; + } + } +} diff --git a/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/SerializeReferenceGateCommands.cs.meta b/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/SerializeReferenceGateCommands.cs.meta new file mode 100644 index 00000000..c26de9af --- /dev/null +++ b/Aspid.FastTools/Assets/DevTests/CliCommands/Editor/SerializeReferenceGateCommands.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 22168adc7920444d0a81ca384ff585d9 \ No newline at end of file diff --git a/Aspid.FastTools/Packages/manifest.json b/Aspid.FastTools/Packages/manifest.json index 80f6a977..e9acbe2b 100755 --- a/Aspid.FastTools/Packages/manifest.json +++ b/Aspid.FastTools/Packages/manifest.json @@ -13,7 +13,6 @@ "com.unity.timeline": "1.8.11", "com.unity.ugui": "2.0.0", "com.unity.visualscripting": "1.9.10", - "com.yucchiy.unicli-server": "https://github.com/yucchiy/UniCli.git?path=src/UniCli.Unity/Packages/com.yucchiy.unicli-server", "com.unity.modules.accessibility": "1.0.0", "com.unity.modules.adaptiveperformance": "1.0.0", "com.unity.modules.ai": "1.0.0", @@ -47,7 +46,8 @@ "com.unity.modules.video": "1.0.0", "com.unity.modules.vr": "1.0.0", "com.unity.modules.wind": "1.0.0", - "com.unity.modules.xr": "1.0.0" + "com.unity.modules.xr": "1.0.0", + "com.unity.pipeline": "0.3.1-exp.1" }, "testables": [ "tech.aspid.fasttools" diff --git a/Aspid.FastTools/Packages/packages-lock.json b/Aspid.FastTools/Packages/packages-lock.json index bfa835bb..e33f9372 100755 --- a/Aspid.FastTools/Packages/packages-lock.json +++ b/Aspid.FastTools/Packages/packages-lock.json @@ -127,6 +127,20 @@ }, "url": "https://packages.unity.com" }, + "com.unity.pipeline": { + "version": "0.3.1-exp.1", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.test-framework": "1.1.33", + "com.unity.nuget.mono-cecil": "1.11.6", + "com.unity.modules.uielements": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.screencapture": "1.0.0", + "com.unity.nuget.newtonsoft-json": "3.0.2" + }, + "url": "https://packages.unity.com" + }, "com.unity.render-pipelines.core": { "version": "17.4.0", "depth": 1, @@ -225,13 +239,6 @@ }, "url": "https://packages.unity.com" }, - "com.yucchiy.unicli-server": { - "version": "https://github.com/yucchiy/UniCli.git?path=src/UniCli.Unity/Packages/com.yucchiy.unicli-server", - "depth": 0, - "source": "git", - "dependencies": {}, - "hash": "be0abbd15c319e1fd6c1843f4d57acbe90eedfce" - }, "tech.aspid.fasttools": { "version": "file:tech.aspid.fasttools", "depth": 0, diff --git a/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/AssemblyInfo.cs b/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/AssemblyInfo.cs index 83ea98cf..47d6cf1d 100644 --- a/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/AssemblyInfo.cs +++ b/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/AssemblyInfo.cs @@ -4,3 +4,4 @@ [assembly: InternalsVisibleTo(assemblyName: "Aspid.MVVM.StarterKit.Unity.Editor")] [assembly: InternalsVisibleTo(assemblyName: "Aspid.FastTools.Unity.Editor.Tests")] [assembly: InternalsVisibleTo(assemblyName: "Aspid.FastTools.Unity.Editor.SerializeReferences.Tests")] +[assembly: InternalsVisibleTo(assemblyName: "Aspid.FastTools.DevTests.CliCommands.Editor")] diff --git a/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/SerializeReferences/Yaml/AssemblyInfo.cs b/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/SerializeReferences/Yaml/AssemblyInfo.cs index d6ad2190..54708477 100644 --- a/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/SerializeReferences/Yaml/AssemblyInfo.cs +++ b/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/SerializeReferences/Yaml/AssemblyInfo.cs @@ -6,3 +6,4 @@ [assembly: InternalsVisibleTo("Aspid.FastTools.Unity.Editor")] [assembly: InternalsVisibleTo("Aspid.FastTools.Unity.Editor.SerializeReferences.Tests")] [assembly: InternalsVisibleTo("Aspid.FastTools.Unity.Editor.Tests")] +[assembly: InternalsVisibleTo("Aspid.FastTools.DevTests.CliCommands.Editor")]