Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ The installer places the global `uloop` dispatcher on PATH. Project-specific `ul

Keep the v3 dispatcher installed when working with both v2 and v3 projects. If Unity resolves a project to a v2 `io.github.hatayama.uloopmcp` package, the dispatcher automatically installs the matching v2 `uloop-cli` release into its versioned user cache and delegates the command to it. The resolved package version takes precedence over a stale v3 project-runner pin left after a downgrade. The initial npm installation and the v2-mode notice are written to stderr so stdout remains the delegated command's output. V3 projects continue to use the project runner selected by their pin.

The global `install`, `update`, `uninstall`, `completion`, and `launch` commands remain owned by the v3 dispatcher in every project. Other project commands, help, and the project-scoped version request are delegated for detected v2 projects.
The global `install`, `update`, `uninstall`, `completion` (now a no-op stub; shell completion has been removed), and `launch` commands remain owned by the v3 dispatcher in every project. Other project commands, help, and the project-scoped version request are delegated for detected v2 projects.

V2 delegation requires Node.js 22 or later, including npm for the first command that populates the cache. Do not press **Update CLI** or **Downgrade CLI** in a v2 project's Settings window. These buttons are normally hidden because the delegated CLI reports the matching v2 version, but using one can restore a global npm CLI that hides the v3 dispatcher depending on PATH order.

Expand Down Expand Up @@ -257,25 +257,6 @@ uloop execute-dynamic-code --code 'using UnityEngine; Debug.Log("Hello from CLI!

</details>

<details>
<summary>Shell Completion (Optional)</summary>

You can install Bash/Zsh/PowerShell completion:

```bash
# Add completion script to shell config (auto-detects shell)
uloop completion --install

# Explicitly specify shell (when auto-detection fails on Windows)
uloop completion --shell bash --install # Git Bash / MINGW64
uloop completion --shell powershell --install # PowerShell

# Check completion script
uloop completion
```

</details>

## Project Path Specification

If `--project-path` is omitted, the port is automatically selected from the Unity project detected in the current directory.
Expand Down
21 changes: 1 addition & 20 deletions README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ installerはグローバルな`uloop` dispatcherをPATH上に配置します。

v2とv3のプロジェクトを併用するときも、v3 dispatcherをインストールしたままにしてください。Unityがプロジェクトをv2系の`io.github.hatayama.uloopmcp` packageへ解決している場合、dispatcherは同じバージョンのv2 `uloop-cli` releaseをバージョン別user cacheへ自動的にインストールし、コマンドを委譲します。解決済みpackageのバージョンは、downgrade後に残った古いv3 project-runner pinより優先されます。初回のnpmインストールとv2モードの注記はstderrへ出力されるため、stdoutには委譲先コマンドの出力だけが残ります。v3プロジェクトはpinで選ばれたproject runnerを引き続き使用します。

グローバルな`install`、`update`、`uninstall`、`completion`、`launch`コマンドは、どのプロジェクトでもv3 dispatcherが処理します。検出されたv2プロジェクトでは、それ以外のプロジェクトコマンド、help、プロジェクトスコープのversion表示が委譲されます。
グローバルな`install`、`update`、`uninstall`、`completion`(シェル補完機能は削除済みで、現在は何もしないスタブ)、`launch`コマンドは、どのプロジェクトでもv3 dispatcherが処理します。検出されたv2プロジェクトでは、それ以外のプロジェクトコマンド、help、プロジェクトスコープのversion表示が委譲されます。

v2への委譲には、初回コマンドでcacheを作成するnpmを含むNode.js 22以降が必要です。v2プロジェクトのSettingsウィンドウでは、**Update CLI**または**Downgrade CLI**を押さないでください。委譲先CLIが同じv2バージョンを返すため通常はボタン自体が表示されませんが、使用するとグローバルnpm版CLIが復活し、PATHの順序によってv3 dispatcherが隠れる可能性があります。

Expand Down Expand Up @@ -255,25 +255,6 @@ uloop execute-dynamic-code --code 'using UnityEngine; Debug.Log("Hello from CLI!

</details>

<details>
<summary>シェル補完(オプション)</summary>

Bash/Zsh/PowerShell の補完機能をインストールできます:

```bash
# 補完スクリプトをシェル設定に追加(シェル自動検出)
uloop completion --install

# シェルを明示的に指定(Windows環境で自動検出が失敗する場合)
uloop completion --shell bash --install # Git Bash / MINGW64
uloop completion --shell powershell --install # PowerShell

# 補完スクリプトを確認
uloop completion
```

</details>

## プロジェクトパス指定

`--project-path` を省略した場合は、カレントディレクトリの Unity プロジェクトで設定されたポートが自動選択されます。
Expand Down
30 changes: 12 additions & 18 deletions cli/common/clicore/command_registry.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
package clicore

const (
LaunchCommandName = "launch"
InstallCommandName = "install"
UpdateCommandName = "update"
UninstallCommandName = "uninstall"
SkillsCommandName = "skills"
CompileCommandName = "compile"
ExecuteDynamicCodeCommandName = "execute-dynamic-code"
PausePointAwaitCommandName = "await-pause-point"
PausePointStatusUserCommandName = "pause-point-status"
RunTestsCommandName = "run-tests"
CompletionCommand = "completion"
ListCommandsFlag = "--list-commands"
ListOptionsFlag = "--list-options"
PausePointIDFlagName = "id"
PausePointTimeoutFlagName = "timeout-seconds"
PausePointLogsMaxCountFlagName = "matching-logs-max-count"
PausePointCapturedVariablesFlagName = "captured-variables"
LaunchCommandName = "launch"
InstallCommandName = "install"
UpdateCommandName = "update"
UninstallCommandName = "uninstall"
SkillsCommandName = "skills"
CompileCommandName = "compile"
ExecuteDynamicCodeCommandName = "execute-dynamic-code"
PausePointAwaitCommandName = "await-pause-point"
PausePointStatusUserCommandName = "pause-point-status"
RunTestsCommandName = "run-tests"
CompletionCommand = "completion"
)

type NativeCommandEntry struct {
Expand All @@ -41,7 +35,7 @@ var NativeCommands = []NativeCommandEntry{
{Name: PausePointAwaitCommandName, Description: "Wait until a named UloopPausePoint.Pause marker pauses Unity", Owner: RunnerOwned},
{Name: PausePointStatusUserCommandName, Description: "Show the state of a named UloopPausePoint.Pause marker", Owner: RunnerOwned},
{Name: SkillsCommandName, Description: "List, install, or uninstall agent skills", Owner: DispatcherOwned},
{Name: CompletionCommand, Description: "Print or install shell completion", Owner: DispatcherOwned},
{Name: CompletionCommand, Description: "Deprecated: shell completion has been removed; this command is now a no-op", Owner: DispatcherOwned},
{Name: InstallCommandName, Description: "Configure the global uloop launcher binary", Owner: DispatcherOwned},
{Name: UpdateCommandName, Description: "Update the global uloop launcher binary", Owner: DispatcherOwned},
{Name: UninstallCommandName, Description: "Remove the global uloop launcher binary", Owner: DispatcherOwned},
Expand Down
16 changes: 0 additions & 16 deletions cli/common/clicore/global_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,3 @@ func ContainsHelpRequest(args []string) bool {
}
return false
}

// ShouldHandleCompletionRequest reports whether args target the native completion
// command or its list-commands/list-options helper flags, so run.go can route them
// before falling back to the project-connected Unity tool dispatch path.
func ShouldHandleCompletionRequest(args []string) bool {
if len(args) == 0 {
return false
}

switch args[0] {
case ListCommandsFlag, ListOptionsFlag, CompletionCommand:
return true
default:
return false
}
}
8 changes: 6 additions & 2 deletions cli/dispatcher/internal/dispatcher/command_help.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import (
)

func tryHandleCommandHelp(command string, startPath string, projectPath string, stdout io.Writer, stderr io.Writer) (bool, int) {
if _, ok := clicore.NativeCommand(command); ok {
// Runner-owned commands are intentionally excluded here: their --help must
// go through the normal dispatch path to the pinned runner (see
// shouldRunInDispatcherProcess), which answers with its own up-to-date
// flag list instead of a dispatcher-side table that can drift.
if clicore.IsDispatcherOwnedCommandName(command) {
printNativeSingleCommandHelp(command, stdout)
return true, 0
}
Expand Down Expand Up @@ -114,7 +118,7 @@ func nativeCommandDescription(command string) (string, bool) {

func nativeCommandUsesProject(command string) bool {
switch command {
case clicore.LaunchCommandName, "list", "sync", "focus-window", clicore.SkillsCommandName, clicore.PausePointAwaitCommandName, clicore.PausePointStatusUserCommandName:
case clicore.LaunchCommandName, clicore.SkillsCommandName:
return true
default:
return false
Expand Down
Loading
Loading