chore(unity): 固定Unity CLI Loop本地包并移除UnitySkills依赖
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
|
||||
namespace io.github.hatayama.uLoopMCP
|
||||
{
|
||||
/// <summary>
|
||||
/// Individual log entry information
|
||||
/// </summary>
|
||||
public class LogEntry
|
||||
{
|
||||
public string Type { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string StackTrace { get; set; }
|
||||
|
||||
public LogEntry(string type, string message, string stackTrace)
|
||||
{
|
||||
Type = type;
|
||||
Message = message;
|
||||
StackTrace = stackTrace;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor for JSON deserialization
|
||||
/// </summary>
|
||||
public LogEntry()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Response schema for GetLogs command
|
||||
/// Provides type-safe response structure
|
||||
/// </summary>
|
||||
public class GetLogsResponse : BaseToolResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Total number of logs available
|
||||
/// </summary>
|
||||
public int TotalCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of logs displayed in this response
|
||||
/// </summary>
|
||||
public int DisplayedCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Log type filter used
|
||||
/// </summary>
|
||||
public string LogType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum count limit used
|
||||
/// </summary>
|
||||
public int MaxCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Search text filter used
|
||||
/// </summary>
|
||||
public string SearchText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether stack trace was included
|
||||
/// </summary>
|
||||
public bool IncludeStackTrace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Array of log entries
|
||||
/// </summary>
|
||||
public LogEntry[] Logs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new GetLogsResponse
|
||||
/// </summary>
|
||||
public GetLogsResponse(int totalCount, int displayedCount, string logType, int maxCount,
|
||||
string searchText, bool includeStackTrace, LogEntry[] logs)
|
||||
{
|
||||
TotalCount = totalCount;
|
||||
DisplayedCount = displayedCount;
|
||||
LogType = logType;
|
||||
MaxCount = maxCount;
|
||||
SearchText = searchText;
|
||||
IncludeStackTrace = includeStackTrace;
|
||||
Logs = logs ?? Array.Empty<LogEntry>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor for JSON deserialization
|
||||
/// </summary>
|
||||
public GetLogsResponse()
|
||||
{
|
||||
LogType = string.Empty;
|
||||
SearchText = string.Empty;
|
||||
Logs = Array.Empty<LogEntry>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a6a96f2b9c804d2e83868b021c695b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,58 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace io.github.hatayama.uLoopMCP
|
||||
{
|
||||
/// <summary>
|
||||
/// Supported log types for filtering: Log, Warning, Error, All
|
||||
/// </summary>
|
||||
public static class McpLogType
|
||||
{
|
||||
public const string Log = "Log";
|
||||
public const string Warning = "Warning";
|
||||
public const string Error = "Error";
|
||||
public const string All = "All";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Schema for GetLogs command parameters
|
||||
/// Provides type-safe parameter access with default values
|
||||
/// </summary>
|
||||
public class GetLogsSchema : BaseToolSchema
|
||||
{
|
||||
/// <summary>
|
||||
/// Log type to filter (Error, Warning, Log, All)
|
||||
/// </summary>
|
||||
[Description("Log type to filter (Error, Warning, Log, All)")]
|
||||
public string LogType { get; set; } = McpLogType.All;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of logs to retrieve
|
||||
/// </summary>
|
||||
[Description("Maximum number of logs to retrieve")]
|
||||
public int MaxCount { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Text to search within log messages (retrieve all if empty)
|
||||
/// </summary>
|
||||
[Description("Text to search within log messages (retrieve all if empty)")]
|
||||
public string SearchText { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Whether to use regular expression for search
|
||||
/// </summary>
|
||||
[Description("Whether to use regular expression for search")]
|
||||
public bool UseRegex { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to search within stack trace as well
|
||||
/// </summary>
|
||||
[Description("Whether to search within stack trace as well")]
|
||||
public bool SearchInStackTrace { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to display stack trace
|
||||
/// </summary>
|
||||
[Description("Whether to display stack trace")]
|
||||
public bool IncludeStackTrace { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9715eed6c884146a39ad9185a165a169
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace io.github.hatayama.uLoopMCP
|
||||
{
|
||||
/// <summary>
|
||||
/// GetLogs tool handler - Type-safe implementation using Schema and Response
|
||||
/// Retrieves Unity console logs with filtering options
|
||||
///
|
||||
///
|
||||
/// This Tool class delegates to GetLogsUseCase for business logic execution,
|
||||
/// following the UseCase + Tool pattern for separation of concerns.
|
||||
///
|
||||
/// Related classes:
|
||||
/// - GetLogsUseCase: Business logic and orchestration
|
||||
/// - GetLogsSchema: Type-safe parameter schema
|
||||
/// - GetLogsResponse: Type-safe response structure
|
||||
/// </summary>
|
||||
[McpTool(Description = "Retrieve logs from Unity Console")]
|
||||
public class GetLogsTool : AbstractUnityTool<GetLogsSchema, GetLogsResponse>
|
||||
{
|
||||
public override string ToolName => "get-logs";
|
||||
|
||||
|
||||
protected override async Task<GetLogsResponse> ExecuteAsync(GetLogsSchema parameters, CancellationToken cancellationToken)
|
||||
{
|
||||
// Create and execute GetLogsUseCase instance
|
||||
GetLogsUseCase useCase = new(new LogRetrievalService(), new LogFilteringService());
|
||||
return await useCase.ExecuteAsync(parameters, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25c606c7e488f444e891199483003a5f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fdb37ae06b6d24128a32e16d36d7bfd8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
name: uloop-get-logs
|
||||
description: "Read current Unity Console entries from a running Editor. Use during bug investigation after compile, tests, PlayMode, or dynamic code to inspect logs, warnings, errors, and stack traces."
|
||||
---
|
||||
|
||||
# uloop get-logs
|
||||
|
||||
Retrieve logs from Unity Console.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
uloop get-logs [options]
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `--log-type` | string | `All` | Log type filter: `Error`, `Warning`, `Log`, `All` |
|
||||
| `--max-count` | integer | `100` | Maximum number of logs to retrieve |
|
||||
| `--search-text` | string | - | Text to search within logs |
|
||||
| `--include-stack-trace` | boolean | `false` | Include stack trace in output |
|
||||
| `--use-regex` | boolean | `false` | Use regex for search |
|
||||
| `--search-in-stack-trace` | boolean | `false` | Search within stack trace |
|
||||
|
||||
## Global Options
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| `--project-path <path>` | Optional. Use only when the target Unity project is not the current directory. |
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
# Get all logs
|
||||
uloop get-logs
|
||||
|
||||
# Get only errors
|
||||
uloop get-logs --log-type Error
|
||||
|
||||
# Search for specific text
|
||||
uloop get-logs --search-text "NullReference"
|
||||
|
||||
# Regex search
|
||||
uloop get-logs --search-text "Missing.*Component" --use-regex
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
Returns JSON with:
|
||||
- `TotalCount` (number): Total logs available before max-count clipping
|
||||
- `DisplayedCount` (number): Logs returned in this response (≤ `--max-count`)
|
||||
- `LogType` (string): The `--log-type` filter that was applied
|
||||
- `MaxCount` (number): The `--max-count` cap that was applied
|
||||
- `SearchText` (string): The `--search-text` filter that was applied (empty when omitted)
|
||||
- `IncludeStackTrace` (boolean): Whether stack traces are included in `Logs[]`
|
||||
- `Logs` (array): Each entry has:
|
||||
- `Type` (string): `"Error"`, `"Warning"`, or `"Log"`
|
||||
- `Message` (string): Log message body
|
||||
- `StackTrace` (string): Stack trace text. Empty when `--include-stack-trace` is `false`.
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22f7be6e7017c44038c32b066ba294c8
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user