Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Remote BuildNew to Visual Studio Code? Get it now.
Remote Build

Remote Build

Aaronlu2026

|
2 installs
| (0) | Free
Drive a remote Linux build server over SSH from Windows via OpenSSH.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Remote Build

面向 AI agent 的远程编译插件:本机(Windows)通过 OpenSSH(ssh.exe)驱动远程 Linux 服务器执行构建命令,为 AI agent 提供可自动化触发、可判断成败的远程执行能力,不绑定特定平台或工具链。

能力一览

能力 入口 面向对象
服务器参数设置 侧边栏(Activity Bar) 人
远程交互式命令行 终端 Profile 人
自动化触发与分析 CLI AI agent

三个入口共用同一份配置 ~/.remote-build.json。

配置

配置文件:~/.remote-build.json(全局,家目录)。

{
  "host": "192.168.55.100[my build server]",
  "sshPath": "",
  "init": "source ~/.bashrc"
}
字段 说明
host SSH 别名(~/.ssh/config)或主机名,必填
sshPath ssh.exe 路径;留空自动探测(Windows 默认 C:\Windows\System32\OpenSSH\ssh.exe)
init 远程命令前 source 的片段,如 source ~/.bashrc 加载工具链环境

使用方式

1. 侧边栏:服务器参数设置

活动栏点 Remote Build 图标 → 表单里改 host / sshPath / init → Save → 写回 ~/.remote-build.json。

2. 终端:远程命令行

终端面板「+」下拉 → Remote Build → 基于配置的 host 开一个到服务器的交互式 SSH 命令行窗口。

该条目出现的前提:package.json 的 contributes.terminal 声明的 id 必须与 registerTerminalProfileProvider 的 id 一致,且 ~/.remote-build.json 已配置 host(否则 provider 返回空、profile 不显示)。

3. CLI:AI agent 自动化触发与分析

CLI 面向 AI agent 编程全流程:agent 调用它远程执行构建 / 测试命令,并以退出码、超时标记、stdout/stderr 分离判断成败。

# Windows(推荐):把 CLI 目录加入 PATH 后,任意目录直接调用
remote-build run --cmd "<command>" [--cwd "<dir>"] [--timeout <ms>]
remote-build config

# 不经 PATH —— PowerShell(~ 不展开,用 $HOME)
node "$HOME\.remote-build\cli.js" run --cmd "<command>"

# 不经 PATH —— Git Bash(~ 可展开)
node ~/.remote-build/cli.js run --cmd "<command>"

# 本地开发:构建后直接用 dist/ 下的 CLI
node dist/cli.js run --cmd "<command>" [--cwd "<dir>"] [--timeout <ms>]

将 CLI 目录加入用户 PATH(一次性,新开终端生效):

[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path","User") + ";$env:USERPROFILE\.remote-build", "User")

约定:

  • 退出码 = 远程命令退出码(agent 据此判断成败)
  • 超时返回 124
  • stdout / stderr 分离,便于 agent 解析

扩展每次激活会把编译好的 CLI(cli.js + core/)和一个 Windows 包装脚本 remote-build.cmd 复制到 ~/.remote-build/,因此 vsix 安装后无需源码即可从命令行调用。

Git Bash 提示:--cwd 以 / 开头的绝对路径会被 MSYS 转成 Windows 路径而失效,用双斜杠 //home/... 规避。

目录结构

src/core/config.ts     ~/.remote-build.json 读写
src/core/remote.ts     spawn ssh.exe 执行远程命令
src/configWebview.ts   侧边栏配置表单(Webview)
src/extension.ts       入口:侧边栏视图 + 终端 profile + CLI 落位
src/cli.ts             CLI(run / config)
media/remote-build.svg 活动栏图标
media/icon.png         扩展图标(Marketplace,128×128 PNG)

构建 & 打包

npm install
npm run build
npm run package   # 先 tsc 编译到 dist/,再打包产出 windows-remote-build-1.0.0.vsix

发布到 Marketplace

前置:package.json 已配置 publisher / repository / license / icon。

npx vsce login Aaronlu2026   # 输入 Azure DevOps PAT(scope: Marketplace > Manage)
npx vsce publish             # 重新校验 + 打包 + 上传

PAT 在 https://dev.azure.com/<组织>/_usersSettings/tokens 生成。扩展 name 在 Marketplace 全局唯一,被占用会报 already exists,需改名后重新打包。

前置要求

  • Windows 自带 OpenSSH 客户端(ssh.exe),或系统 PATH 上有 ssh。
  • 目标服务器已配好 SSH 别名(~/.ssh/config),免密登录(authorized_keys)已就绪。
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft