package-walter-green
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseA remote development machine, with Walter
基于Walter的远程开发机器
Use this skill to initialize or operate a walter project in the user's current
directory. Walter provisions one machine, records it in so
reaches it, and powers it off and on.
~/.ssh/configssh <profile>使用本技能可在用户当前目录中初始化或操作walter项目。Walter会置备一台机器,将其记录到中,以便通过连接,并可对机器进行开关机操作。
~/.ssh/configssh <profile>Requirements
要求
Babashka runs the launcher. and also need OpenTofu and
Ansible. and need the CLI and a live session. With
set, a real also needs on the workstation — it
runs GitHub's device flow as its first action. Provider credentials use
variables, except OCI, which uses the profile named in
, and S3, which uses OpenTofu's ambient AWS credential chain.
createdeletestopstartocigithub-accountcreateghCOLORS_PAR_*~/.oci/configBabashka运行启动器。和操作还需要OpenTofu和Ansible。和操作需要 CLI以及有效会话。若设置了,实际执行时还需要工作站上安装——它会首先运行GitHub的设备流。提供商凭证使用变量,OCI除外,它使用中指定的配置文件,S3则使用OpenTofu的环境AWS凭证链。
createdeletestopstartocigithub-accountcreateghCOLORS_PAR_*~/.oci/configNon-negotiable safety rules
不可妥协的安全规则
- Never ask the user to paste a secret into chat.
- Never put API tokens, passwords, private keys or access keys in , in the
colors.ymllauncher, in shell history, or in generated examples. Every credential arrives through agreenenvironment variable named after the key it fills. Suggest a gitignoredCOLORS_PAR_*, never an inline export a shell history records..envrc.private - Public SSH keys are not secrets; private ones are. holds the path to a public-key file that OpenTofu reads at plan time — record the path, never inline the contents, and never read a private key. With
oci-ssh-authorized-keyswalter generates and managescompute-keygen: trueitself; never read or move that file either.~/.ssh/<profile> - With set, a real
github-accountstarts by printing a one-time code and waiting — up to about fifteen minutes — for the user to approve it at https://github.com/login/device. That is the design, not a hang: the workflow is interactive at the beginning only. Relay the code and URL to the user and wait; never try to acquire, read, or echo the token itself.create - Never set . Walter refuses to run when it is set, and suggesting it as a workaround defeats the guard. The profile identifies the project, and the project is the directory. If the user wants a different profile, edit
COLORS_PAR_PROFILE.colors.yml - Do not overwrite an existing launcher or
greenwithout explicit approval. If a project is already valid, operate it rather than regenerating it.colors.yml - Default to and
build. Run a realcreate --dry-runorcreateonly after the user confirms that exact operation.delete - and
buildare credential-free by design and check nocreate --dry-runat all. A clean dry-run says nothing about whether real provisioning would authenticate; never report it as credential validation.COLORS_PAR_* - Before , remind the user that a development machine holds uncommitted work and that the boot volume goes with it.
deletedefaults tocompute-prevent-destroy; authorize an intentional delete withtruerather than editing desired state.COLORS_PAR_COMPUTE_PREVENT_DESTROY=false - Never edit anything under — it is generated output.
.colors/
Read references/configuration.md before
generating or changing desired state, and before any real or .
createdelete- 切勿要求用户在聊天中粘贴机密信息。
- 切勿将API令牌、密码、私钥或访问密钥放入、
colors.yml启动器、shell历史记录或生成的示例中。所有凭证都通过与填充密钥对应的green环境变量传入。建议使用被git忽略的COLORS_PAR_*,切勿使用会被shell历史记录保存的内联export命令。.envrc.private - 公钥不是机密;私钥是。存储的是OpenTofu在计划阶段读取的公钥文件的路径——仅记录路径,切勿内联内容,也切勿读取私钥。若设置
oci-ssh-authorized-keys,Walter会自行生成并管理compute-keygen: true;同样切勿读取或移动该文件。~/.ssh/<profile> - 若设置了,实际执行
github-account时会先打印一次性代码,然后等待(最多约15分钟)用户在https://github.com/login/device上完成授权。这是设计流程,而非卡顿:仅在开始阶段需要交互。将代码和URL告知用户并等待;切勿尝试获取、读取或回显令牌本身。create - 切勿设置。当该变量被设置时,Walter会拒绝运行,建议将其作为解决方案会绕过防护机制。配置文件(profile)用于标识项目,而项目对应目录。若用户需要不同的配置文件,请编辑
COLORS_PAR_PROFILE。colors.yml - 未经明确许可,切勿覆盖现有的启动器或
green。若项目已有效,应直接操作而非重新生成。colors.yml - 默认使用和
build。仅在用户确认具体操作后,才执行实际的create --dry-run或create。delete - 和
build设计为无需凭证,完全不检查任何create --dry-run变量。成功的试运行并不代表实际置备会通过身份验证;切勿将其报告为凭证验证通过。COLORS_PAR_* - 执行前,提醒用户开发机器上可能包含未提交的工作,且启动卷会随机器一同销毁。
delete默认设为compute-prevent-destroy;若要执行有意的删除操作,需设置true,而非编辑预期状态。COLORS_PAR_COMPUTE_PREVENT_DESTROY=false - 切勿编辑下的任何内容——这是生成的输出文件。
.colors/
在生成或修改预期状态,以及执行任何实际的或操作前,请阅读references/configuration.md。
createdeleteCommands
命令
sh
./green build # render .colors/<profile>/ only; contacts nothing
./green create --dry-run # print the graph; touches nothing
./green create # provision, and write the ssh config block
./green stop # power off
./green start # power on, and refresh the ssh config block
./green delete # destroy, dropping the ssh block first-f/--filecolors.ymlsh
./green build # 仅渲染.colors/<profile>/;不连接任何外部服务
./green create --dry-run # 打印执行图;不修改任何内容
./green create # 置备机器,并写入ssh配置块
./green stop # 关机
./green start # 开机,并刷新ssh配置块
./green delete # 销毁机器,先移除ssh配置块-f/--filecolors.ymlInitialize in the current directory
在当前目录初始化
- Copy the payload beside this file into the project root and
greenit.chmod +x - Write . Ask for the provider first, then only the keys that provider needs —
colors.ymllists them.references/configuration.md - Choose a unique to this project, conventionally the directory name. It names the work directory, the OpenTofu state keys and the ssh alias. Two projects sharing a profile and a state bucket address the same state, which is how a development machine ends up managing a production server.
profile - Ask whether the machine should have the user's GitHub identity. If so, set
to their login and
github-accountto their commit email, and tell them a realgit-emailwill start with a one-time device-flow code to approve from a browser. This is required before offeringcreate,emacs-config-repoorclone-orgs— their clones authenticate through it.dotfiles-checkout - Ask whether walter should generate the machine-access ssh keypair
() or whether the user supplies a provider key as before.
compute-keygen: true - Ask whether the user wants their Emacs configuration on the machine. If so,
set to its https git URL (
emacs-config-repo/git@forms are refused) andssh://to where it must live — the default isemacs-config-dest, and a configuration expecting another path needs~/.config/emacsto reach it. Leave both out otherwise; the rendered playbook then does not mention Emacs.--init-directory - Run and show the user what was rendered.
./green build
- 将本文件旁的代码复制到项目根目录,并执行
green赋予执行权限。chmod +x - 编写。先询问提供商,再仅询问该提供商所需的密钥——
colors.yml中列出了这些密钥。references/configuration.md - 选择一个对该项目唯一的,通常使用目录名称。它会作为工作目录、OpenTofu状态密钥以及ssh别名的名称。两个项目若共享同一个profile和状态存储桶,会指向相同的状态,这可能导致开发机器意外管理生产服务器。
profile - 询问用户是否希望机器使用其GitHub身份。若是,将设为其登录名,
github-account设为其提交邮箱,并告知用户实际执行git-email时会先显示一次性设备流代码,需通过浏览器完成授权。这是提供create、emacs-config-repo或clone-orgs的前提——这些克隆操作会通过该身份验证。dotfiles-checkout - 询问用户是否希望Walter生成机器访问用的ssh密钥对(),还是由用户自行提供提供商密钥。
compute-keygen: true - 询问用户是否希望在机器上安装其Emacs配置。若是,将设为其https格式的git URL(拒绝
emacs-config-repo/git@格式),ssh://设为配置文件的目标路径——默认是emacs-config-dest,若配置文件期望其他路径,需使用~/.config/emacs指定。否则留空这两个配置项;此时渲染的playbook不会提及Emacs。--init-directory - 运行并向用户展示渲染结果。
./green build
What create puts on the machine
create操作会在机器上部署的内容
Every machine gets nix, a Ghostty terminfo entry, and kernel networking
settings for unprivileged , unconditionally. The sysctls allow the
login user's primary group to use ping sockets and raise QUIC's receive/send
buffer ceilings, so a tunnel should run without sudo or those warnings. Tell
the user about nix rather than proposing walter changes for other tooling: once
it is there, anything else is and needs nothing from
walter.
cloudflarednix profile installThe terminfo is why does not
happen. If a user reports that error — from , , or Emacs — on a
machine created before this existed, the fix is to re-run , not to
change . For a terminal walter does not cover, the one-liner is:
Terminal type xterm-ghostty is not definedvimtoplesscreateTERMsh
infocmp -x "$TERM" | ssh <alias> -- tic -x -With set, also logs the machine's own gh in with the
token the device flow minted, makes it git's https credential helper, and
configures the commit identity — every clone below authenticates through it,
and nothing of the workstation's (no key, no agent) is involved. A machine
already logged in skips the interactive step entirely, so re-creates stay
unattended.
github-accountcreateWith set, also installs Emacs (a full build from a
pinned nixpkgs) and clones the configuration over https with the machine's own
token — no private key is written to the machine, and the checkout can push
back. The clone happens once; a later leaves an existing one alone,
so work done on the machine is never discarded. Offer on the machine
rather than a re-run when the user wants the config refreshed.
emacs-config-repocreatecreategit pullEmacs packages are not pre-fetched. The first launch fetches from
ELPA/MELPA, native-compiles and clones tree-sitter grammars, which takes minutes
and is expected. Do not report it as a provisioning failure.
emacsnixemacsPATH/etc/profile.d/nix.shssh walter-ocissh walter-oci emacs …每台机器都会无条件安装nix、Ghostty terminfo条目,以及用于无特权运行的内核网络设置。这些sysctl配置允许登录用户的主组使用ping套接字,并提高QUIC的接收/发送缓冲区上限,因此隧道无需sudo即可运行,也不会出现相关警告。向用户介绍nix即可,无需为其他工具修改Walter:一旦安装了nix,其他工具都可通过安装,无需Walter参与。
cloudflarednix profile installterminfo条目可避免出现“Terminal type xterm-ghostty is not defined”错误。若用户报告在本功能推出前创建的机器上出现该错误(来自、、或Emacs),修复方法是重新运行,而非修改。对于Walter未覆盖的终端,可使用以下单行命令:
vimtoplesscreateTERMsh
infocmp -x "$TERM" | ssh <alias> -- tic -x -若设置了,还会使用设备流生成的令牌在机器上完成gh登录,将其设为git的https凭证助手,并配置提交身份——后续所有克隆操作都会通过该身份验证,与工作站的任何内容(无密钥、无代理)无关。已登录的机器会完全跳过交互步骤,因此重新执行时无需人工干预。
github-accountcreatecreate若设置了,还会安装Emacs(基于固定版本nixpkgs的完整构建),并通过机器自身的令牌以https方式克隆配置文件——不会向机器写入私钥,且克隆后的仓库可推送代码。克隆操作仅执行一次;后续执行时会保留已有的克隆内容,因此机器上的工作不会被丢弃。当用户希望刷新配置时,建议在机器上执行,而非重新运行。
emacs-config-repocreatecreategit pullcreateEmacs包不会预先获取。首次启动时会从ELPA/MELPA获取包、进行原生编译并克隆tree-sitter语法,这需要几分钟时间,属于正常情况。切勿将其报告为置备失败。
emacsnixemacs/etc/profile.d/nix.shPATHssh walter-ocissh walter-oci emacs …Stopping and starting
开关机操作
stopstartConsequences worth telling the user about:
- Only OCI can be power cycled today. Everywhere else reports that and exits 0. That is deliberate, not a bug. Do not present it as a failure.
stop - will not restart a stopped machine. With no power state in the configuration there is no diff, so an apply leaves it stopped.
createis the only way up.start - Stopping stops the compute meter, not the storage one. The boot volume bills whether the machine runs or not.
- and
stopneed thestartCLI to authenticate, which OpenTofu does not. Session tokens last 60 minutes. When walter reports an expired session it names the command that fixes it; run that, then retry.oci
stopstart需要告知用户的相关后果:
- 目前仅OCI支持电源循环。在其他环境下,会报告此情况并以0状态码退出。这是有意设计,而非bug。切勿将其视为失败。
stop - 不会重启已关机的机器。由于配置中无电源状态,因此执行apply时不会产生差异,机器会保持关机状态。只有
create操作可开机。start - 关机仅停止计算计费,存储计费仍会继续。无论机器是否运行,启动卷都会产生费用。
- 和
stop需要startCLI完成身份验证,这与OpenTofu的验证方式不同。会话令牌有效期为60分钟。当Walter报告会话过期时,会给出修复命令;执行该命令后重试即可。oci
When something fails
故障排查
- — the user has it exported, probably from another project's
COLORS_PAR_PROFILE is set. Unset it; do not work around it..envrc - — name the variable and let the user export it themselves.
required credential is not set: COLORS_PAR_X - — walter could not read the compute stage's
no instance idoutput and desired state carries none. Either the machine was never created, or the state backend is unreachable.instance_idinoci-instance-idis the documented escape hatch.colors.yml - —
gh auth login failedis missing on the workstation, or the one-time code expired unapproved. Install gh or re-runghand approve the code; there is no token to paste anywhere.create - A create failed after the code was approved — just re-run it. The minted
token survives under for exactly this, so the retry does not prompt again; it is removed once a create seeds the machine.
~/.local/state/walter/github-token-<profile> - the login approved the code as X but colors.yml names github-account Y —
the user approved from the wrong GitHub account. Re-run and approve from the account the machine is meant to act as, or fix
create.github-account - A contract mismatch — the pinned commit is older than this launcher.
Re-copy from an updated skill; nothing inside the project fixes it.
green
- ——用户已导出该变量,可能来自其他项目的
COLORS_PAR_PROFILE is set。取消设置该变量;切勿寻找变通方法。.envrc - ——告知用户对应的变量名称,让用户自行导出。
required credential is not set: COLORS_PAR_X - ——Walter无法读取计算阶段的
no instance id输出,且预期状态中也未包含该值。可能是机器从未被创建,或状态后端无法访问。instance_id中的colors.yml是文档中说明的解决方法。oci-instance-id - ——工作站上未安装
gh auth login failed,或一次性代码未被授权已过期。安装gh或重新运行gh并完成授权;无需粘贴任何令牌。create - 授权代码后create操作失败——只需重新运行即可。生成的令牌会保存在下,专为这种情况设计,因此重试时不会再次提示;当create操作完成机器置备后,该令牌会被删除。
~/.local/state/walter/github-token-<profile> - 登录时使用账户X授权,但colors.yml中github-account为Y——用户使用了错误的GitHub账户授权。重新运行并使用机器预期的账户授权,或修改
create配置。github-account - A contract mismatch——固定的提交版本早于当前启动器。从更新后的技能中重新复制;项目内部的任何修改都无法解决此问题。
green