chore(unity): 固定Unity CLI Loop本地包并移除UnitySkills依赖

This commit is contained in:
Liubing\LB
2026-09-28 18:14:59 +08:00
parent 0eb43b2b40
commit c4ae02def9
952 changed files with 70137 additions and 11 deletions

View File

@@ -0,0 +1,22 @@
namespace io.github.hatayama.uLoopMCP
{
/// <summary>
/// Represents a compilation error during code compilation
///
/// Related Classes: RoslynCompiler, CompilationResult
/// </summary>
public class CompilationError
{
/// <summary>Line number where the compilation error occurred</summary>
public int Line { get; set; }
/// <summary>Column number where the compilation error occurred</summary>
public int Column { get; set; }
/// <summary>Detailed error message describing the compilation error</summary>
public string Message { get; set; }
/// <summary>Unique error code identifying the specific compilation error</summary>
public string ErrorCode { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c60a3998d37ae4373924387a9603af7b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,47 @@
using System.Collections.Generic;
namespace io.github.hatayama.uLoopMCP
{
/// <summary>
/// Compilation Request
///
/// Related Class: RoslynCompiler
/// </summary>
public class CompilationRequest
{
/// <summary>Source code to compile</summary>
public string Code { get; set; }
/// <summary>Name of the class</summary>
public string ClassName { get; set; }
/// <summary>Namespace of the class</summary>
public string Namespace { get; set; }
/// <summary>
/// Additional references (external DLL file paths)
/// Specify external libraries (such as NuGet package DLLs) that are not loaded in the AppDomain
/// by providing their file paths to be added as references during compilation
/// Example: ["C:/MyLibrary/CustomLibrary.dll", "D:/ThirdParty/SomePackage.dll"]
/// </summary>
public List<string> AdditionalReferences { get; set; } = new();
/// <summary>
/// Legacy assembly loading mode hint.
/// AssemblyBuilder always compiles against the full reference set, so this value is ignored.
/// </summary>
public AssemblyLoadingMode AssemblyMode { get; set; } = AssemblyLoadingMode.AllAssemblies;
}
/// <summary>
/// Defines the mode for loading assemblies during compilation
/// </summary>
public enum AssemblyLoadingMode
{
/// <summary>Reference only selected assemblies</summary>
SelectiveReference,
/// <summary>Add all assemblies</summary>
AllAssemblies
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0ae3bf8a209814a46845da1c0565747b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,83 @@
using System.Collections.Generic;
using System.Reflection;
namespace io.github.hatayama.uLoopMCP
{
/// <summary>
/// Compilation Result
///
/// Related Class: RoslynCompiler
/// </summary>
public class CompilationResult
{
/// <summary>Compilation Success</summary>
public bool Success { get; set; }
/// <summary>Compiled Assembly</summary>
public Assembly CompiledAssembly { get; set; }
/// <summary>Errors</summary>
public List<CompilationError> Errors { get; set; } = new();
/// <summary>Warnings</summary>
public List<string> Warnings { get; set; } = new();
/// <summary>
/// Code Formatted for Compilation
/// (After extracting and moving using statements, applying class/method wrapping)
/// </summary>
public string UpdatedCode { get; set; }
/// <summary>Flag for Security Violations</summary>
public bool HasSecurityViolations { get; set; }
/// <summary>Security Violation Details</summary>
public List<SecurityViolation> SecurityViolations { get; set; } = new();
/// <summary>Failure Reason Category</summary>
public CompilationFailureReason FailureReason { get; set; } = CompilationFailureReason.None;
/// <summary>
/// Types that could not be auto-resolved because multiple namespace candidates were found.
/// Key: type name, Value: list of candidate namespaces.
/// </summary>
public Dictionary<string, List<string>> AmbiguousTypeCandidates { get; set; } = new();
/// <summary>
/// Without this, callers cannot tell which namespaces were auto-resolved
/// and cannot advise users to include them for faster compilation.
/// </summary>
public List<string> AutoInjectedNamespaces { get; set; } = new();
/// <summary>
/// Keeps internal phase timings out of normal logs while allowing tests and
/// benchmarks to compare where time is spent inside the pipeline.
/// </summary>
public List<string> Timings { get; set; } = new();
public List<string> AdvisoryLogs { get; set; } = new();
public DynamicCompilationBackendKind CompilationBackendKind { get; set; } = DynamicCompilationBackendKind.Unknown;
}
/// <summary>
/// Compilation Failure Reason Categories
/// </summary>
public enum CompilationFailureReason
{
/// <summary>No Failure (Success)</summary>
None,
/// <summary>Compilation Error</summary>
CompilationError,
/// <summary>Security Violation</summary>
SecurityViolation,
/// <summary>Dynamic Assembly Addition Failed</summary>
DynamicAssemblyFailed,
/// <summary>Using Statement Addition Failed</summary>
UsingStatementFailed
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ae9eab1ed36274554be091d4c5e84c0b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
namespace io.github.hatayama.uLoopMCP
{
public enum DynamicCompilationBackendKind
{
Unknown = 0,
SharedRoslynWorker = 1,
OneShotRoslyn = 2,
AssemblyBuilderFallback = 3
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bfefff852f0cc4b7c95ca26d2ce85217
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,54 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace io.github.hatayama.uLoopMCP
{
/// <summary>
/// Security Validation Result
///
/// Related Class: SecurityValidator
/// </summary>
public class SecurityValidationResult
{
/// <summary>Validation status</summary>
public bool IsValid { get; set; }
/// <summary>List of security violations</summary>
public List<SecurityViolation> Violations { get; set; } = new();
/// <summary>Compilation errors (extended)</summary>
public List<string> CompilationErrors { get; set; } = new();
/// <summary>
/// Retrieve error summary
/// </summary>
public string GetErrorSummary()
{
if (IsValid) return "No security violations detected.";
StringBuilder sb = new();
sb.AppendLine($"Security validation failed with {Violations.Count} violation(s):");
foreach (SecurityViolation violation in Violations)
{
sb.AppendLine($" - [{violation.Type}] {violation.Message}");
if (!string.IsNullOrEmpty(violation.ApiName))
{
sb.AppendLine($" API: {violation.ApiName}");
}
}
if (CompilationErrors?.Any() == true)
{
sb.AppendLine($"Compilation errors: {CompilationErrors.Count}");
foreach (string error in CompilationErrors)
{
sb.AppendLine($" - {error}");
}
}
return sb.ToString();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c25f4cda916ef4d17afc470c799ca0c2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,51 @@
namespace io.github.hatayama.uLoopMCP
{
/// <summary>
/// Security Violation
/// Related Classes: SecurityValidator, SecuritySyntaxWalker
/// </summary>
public class SecurityViolation
{
/// <summary>Violation Type</summary>
public SecurityViolationType Type { get; set; }
/// <summary>Description of the Security Violation</summary>
public string Description { get; set; }
/// <summary>Line Number where the Violation Occurred</summary>
public int LineNumber { get; set; }
/// <summary>Code Snippet Containing the Violation</summary>
public string CodeSnippet { get; set; }
/// <summary>Violation Message</summary>
public string Message { get; set; }
/// <summary>API Name Involved in the Violation</summary>
public string ApiName { get; set; }
/// <summary>Location of the Violation</summary>
public string Location { get; set; }
}
/// <summary>
/// Security Violation Types
/// </summary>
public enum SecurityViolationType
{
/// <summary>Using Declaration of a Forbidden Namespace</summary>
ForbiddenNamespace,
/// <summary>Dangerous API Call (Method, Property, etc.)</summary>
DangerousApiCall,
/// <summary>Inheritance from a Dangerous Class</summary>
DangerousInheritance,
/// <summary>Instantiation of a Dangerous Type</summary>
DangerousTypeCreation,
/// <summary>Unauthorized Reflection Usage</summary>
UnauthorizedReflection
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3a9141487fe1641d881e98b773e5acc2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: