Repository navigation
Conversation
### 可选正文(补充说明) 新增 `local:` 前缀的命令,可在桌面应用中直接在本机执行,而非项目主机。支持多语言国际化,新增全局命令功能,命令可在所有文件夹中显示,同时适配 Tauri 桌面端实现本地命令执行逻辑,新增相关测试和类型定义。
fengpanhe
force-pushed
the
feat_local_cmd
branch
from
October 16, 2026 20:01
63bbf98 to
a0b6dbc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Local commands (
local:) and global commandsSummary
local:command prefix so a folder command runs on the machine running the codeg desktop app instead of the folder's host. This lets a remote project launch local tools (e.g. open the remote dir in a local editor). No DB schema change and no server-side change — old remotecodeg-serverbuilds work as-is.run_local_command(src-tauri/src/commands/local_command.rs), registered inlib.rs, not exposed in the web router, so it can only ever run on the user's own machine. It spawns detached through the user's login shell ($SHELL -l -c 'eval "$CODEG_CMD"') with stdio nulled.CODEG_FOLDER_PATH(the folder's absolute path, remote path in remote mode) andCODEG_REMOTE_HOST(remote server host, empty for local projects).runLocalCommandinapi.tsalways uses the local shell transport;src/lib/local-command.tsparses the prefix and resolves the host; the command dropdown runslocal:commands directly (no terminal tab) and shows an error in pure-web mode.local: zed ssh://user@$CODEG_REMOTE_HOST$CODEG_FOLDER_PATH.local: code --new-window --remote ssh-remote+devbox $CODEG_FOLDER_PATHsrc/lib/global-commands.ts), use negative ids to stay distinct from DB primary keys, and show in every folder/worktree/remote connection with a 🌐 marker. This fixes commands disappearing when switching folders or worktrees (folder commands are keyed byfolder_id, and every worktree is a separate folder).storedCommandIdinterminal-context.tsxrejected ids < 0, so a running global command (negative id) read as "not running" after reload — now accepts any safe integer.localUnavailable,localRunFailed,globalCommand,localCommandHint,globalLabel,globalHint).Notes / risks
local:commands run on the user's machine only on an explicit click, never automatically.local:command selected as a work_task preflight still runs on the remote host as-is — don't use it that way.Test plan
pnpm vitest runfor affected suites — 36 files / 357 tests pass, including newlocal-command.test.ts,global-commands.test.ts, and extendedcommand-dropdown.test.tsx(local exec, web refusal, global command runs in a folder with none of its own).tsc --noEmit,eslint,prettier --check— clean.cargo check(desktop) andcargo check --no-default-features --features server-bin— pass;local_commandRust unit tests pass (incl. a real spawn verifying both env vars).local: <editor> "ssh://user@$CODEG_REMOTE_HOST$CODEG_FOLDER_PATH"and confirm it opens on the local machine.Files
22 files, +707 / −24: backend 3 (new
local_command.rs), frontend components 3, context 1,api.ts, 2 new libs (+2 tests), i18n 10.