dwe
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDWE — Dev Workspace Engine
DWE — Dev Workspace Engine
DWE is a CLI that orchestrates Docker-based local development environments on top of a project's compose file — configuration layering, lifecycle, validation, declarative commands. It does not replace compose; edit the compose file freely.
This skill is a navigator with an authoring layer, not a reference. It says which command to run, which file to edit and in what order. Every schema, field and deep behaviour lives in the built-in docs, versioned with the binary: . Look things up there instead of guessing.
dwe docs show <topic> --lang enDWE 是一个 CLI,在项目的 compose 文件之上编排基于 Docker 的本地开发环境——涵盖配置分层、生命周期、验证和声明式命令。它不会取代 compose;可以自由编辑 compose 文件。
该 skill 是一个带编写层的导航器,而不是参考资料。它会说明应运行哪个命令、应编辑哪个文件以及按什么顺序编辑。每个 schema、字段和深层行为都收录在内置文档中,并与二进制一同进行版本管理:。请在那里查询,而不是猜测。
dwe docs show <topic> --lang enDetecting a DWE project
检测 DWE 项目
Walk up from cwd until a directory contains — that is the root. Every command resolves the root itself; run it from the root or any descendant. A project with only plus commented scaffold files is a fresh — see .
workspace.ymldweworkspace.ymldwe initreferences/populate-init-repo.md从 cwd 向上遍历,直到找到包含 的目录——该目录即为根目录。每个 命令都会自行解析根目录;可以在根目录或其任意后代目录中运行。仅包含 和已注释脚手架文件的项目,是刚执行过 的全新项目——参见 。
workspace.ymldweworkspace.ymldwe initreferences/populate-init-repo.mdFirst step: orient yourself
第一步:了解项目上下文
Once per session, inside the project:
shell
dwe docs llms-txt --lang enIt emits a project-aware index (services, live command list, both builtin registries, template syntax by site, doc topics). Read it before anything else.
If a root exists, read it too. It is the project-specific layer (real services, real command IDs, project rules); this skill is the generic layer. On a project fact the wins; on a generic rule the skill wins.
AGENTS.mdAGENTS.mdTwo different files exist — do not confuse them:
AGENTS.md| File | Origin | Edit? |
|---|---|---|
root | written once by | yes, directly |
hub | generated by the | no — edit |
Neither has a beside it: Claude Code reads natively, and a in or above the cwd would make it skip every .
CLAUDE.mdAGENTS.mdCLAUDE.mdAGENTS.md每个会话在项目内执行一次:
shell
dwe docs llms-txt --lang en它会输出一份感知当前项目上下文的索引(服务、实时命令列表、两个内置注册表、按站点划分的模板语法、文档主题)。在执行其他操作前先阅读它。
如果根目录存在 ,也要阅读它。 它是项目专属层(真实服务、真实命令 ID、项目规则);本 skill 是通用层。对于项目事实, 优先;对于通用规则,本 skill 优先。
AGENTS.mdAGENTS.md存在两种不同的 文件——不要混淆:
AGENTS.md| 文件 | 来源 | 可编辑? |
|---|---|---|
根目录 | 由 | 是,直接编辑 |
hub | 由 | 否——编辑 |
两者旁边都没有 :Claude Code 原生读取 ,而位于 cwd 中或 cwd 上方的 会让它跳过所有 。
CLAUDE.mdAGENTS.mdCLAUDE.mdAGENTS.mdProject anatomy
项目结构
- 3-layer config, later wins, maps deep-merge: (identity:
workspace.yml,project,update,compose) →secrets(tracked:workspace/defaults.ymltoggles,services,runtime,vars,exports) →bridge(gitignored per-dev overrides; tool-written). The root is strict — free-form values live only underworkspace/local.yml; a bare custom root key is a hard load error. Avars:value may be anvars.*marker (committed secret, decrypted at load) →ENC[age:…].config/secrets - — compose project name, shared volumes, per-subcommand compose args, build prepull. Loaded separately, not in the 3-layer merge; per-key override, per-dev in
workspace/docker.yml→docker.local.yml.config/docker - Services = folders: ; the folder name is the key (no
workspace/services/<name>/service.ymlfield). The container itself lives in the compose base or an overlay. Optional per-servicename:/deploy.yml.reset.yml - User commands: ; path + filename + key = dot-ID; run with
workspace/commands/**.yml.dwe cmd <id> - Render packs: —
workspace/templates/{config,ide,ai,git,workspace}/writes runtime files into the service hub;config/ide/aiwrite hub dotfiles (devcontainer, hubgit, git hooks);AGENTS.mdwrites project-root artifacts selected by top-levelworkspace(explicit render only).render.workspace - Pipelines (optional, full-replacement): . Absent = built-in default (reported
workspace/{deploy,lifecycle,reset}.yml, not an error). Alsoⓘ(first-deploy wizard),setup.yml(project checks),validate.yml,snapshot.yml/info.yml(dashboard, branding),styles.yml.i18n/ - Integration tests: (name = basename; deploy step schema).
workspace/tests/<scenario>.yml - Generated, never hand-edited: ,
.env(deploy journal,.dwe/**, logs, test runs),generated.yml, rendered hub files.workspace/local.yml
Layout reference: .
dwe docs show concepts/project-layout --lang en- 3 层配置,后层优先,映射采用深度合并:(标识:
workspace.yml、project、update、compose)→secrets(纳入版本控制:workspace/defaults.yml开关、services、runtime、vars、exports)→bridge(被 Git 忽略的按开发者覆盖配置;由工具写入)。根目录是严格的——自由格式的值只能放在workspace/local.yml下;在根级直接添加自定义键会导致硬加载错误。vars:值可以是vars.*标记(提交的 secret,加载时解密)→ENC[age:…]。config/secrets - ——compose 项目名、共享卷、按子命令划分的 compose 参数、构建预拉取。它是单独加载的,不参与 3 层合并;可按键覆盖,按开发者使用
workspace/docker.yml→docker.local.yml。config/docker - 服务即文件夹:;文件夹名称就是键(没有
workspace/services/<name>/service.yml字段)。容器本身位于 compose base 或 overlay 中。可选的每服务name:/deploy.yml。reset.yml - 用户命令:;路径 + 文件名 + 键 = 点号 ID;使用
workspace/commands/**.yml运行。dwe cmd <id> - Render packs:——
workspace/templates/{config,ide,ai,git,workspace}/将运行时文件写入服务 hub;config/ide/ai写入 hub dotfiles(devcontainer、hubgit、Git hooks);AGENTS.md根据顶层workspace写入项目根目录产物(仅显式渲染)。render.workspace - 流水线(可选,完全替换默认行为):。缺失表示使用内置默认值(报告
workspace/{deploy,lifecycle,reset}.yml,不是错误)。此外还有ⓘ(首次部署向导)、setup.yml(项目检查)、validate.yml、snapshot.yml/info.yml(仪表板、品牌)、styles.yml。i18n/ - 集成测试:(名称 = basename;使用 deploy step schema)。
workspace/tests/<scenario>.yml - 生成文件,绝不可手动编辑:、
.env(deploy journal、.dwe/**、日志、测试运行)、generated.yml、已渲染的 hub 文件。workspace/local.yml
布局参考:。
dwe docs show concepts/project-layout --lang enRules no validator will catch
验证器无法发现的规则
dwe validate- Two disjoint registries share the word .
builtintakes the seven condition predicates (when: {type: builtin}·dir-empty·dir-not-empty·dir-exists·dir-missing·file-exists·file-missing). A step body andgenerated-missing <svc> <field>take the step builtins (check:,source_clone,service_configs_render,containers_running, …). Neither accepts the other's names. Need ahttp_checkthe predicates lack →when:; need its inverse as atype: shell→check:. Both registries with kinds and summaries:check: auto§ Builtins.dwe docs llms-txt --lang en - Mount the whole hub, not just .
src/+dir: ./services/<name>+dir_internal: /workspace, as a unit. Pointingwork_dir_internal: /workspace/srcat the checkout leaves rendered configs, caches and tooling state outside the container.dir: - One definition. A deploy step that runs something the project already declares as a command uses +
type: command, never a pastedcmd: <id>copy — the copies drift, and only the command carries service/workdir/user/env (a shell step runs on the host).type: shell - A entry in
ports:does not publish anything — compose binds only when anservice.ymlrule surfaces it (exports.env) and compose interpolates that var. DWE tooling still reads the declaration:{name: APP_PORT, from: services.<name>.ports.http}preflight checks it andports_freeremaps it, so removing it silently drops both.dwe test,PROJECT,UID,GIDare injected intoCOMPOSE_PROJECT_NAMEautomatically and may not be redeclared; the compose project name is set through.envdocker.yml, always lowercased.project_name
dwe validate- 两个彼此独立的注册表都使用 一词。
builtin接受七种条件谓词(when: {type: builtin}·dir-empty·dir-not-empty·dir-exists·dir-missing·file-exists·file-missing)。步骤主体和generated-missing <svc> <field>接受步骤 builtin(check:、source_clone、service_configs_render、containers_running等)。两者都不接受对方的名称。如果需要谓词中不存在的http_check条件,请使用when:;如果需要将其反向条件用作type: shell,请使用check:。两个注册表及其 kind 和摘要:check: auto§ Builtins。dwe docs llms-txt --lang en - 挂载整个 hub,而不只是 。 将
src/+dir: ./services/<name>+dir_internal: /workspace作为一个整体使用。如果把work_dir_internal: /workspace/src指向检出目录,就会把渲染后的配置、缓存和工具状态留在容器外。dir: - 只定义一次。 如果 deploy step 运行的是项目已声明为 command 的内容,应使用 +
type: command,绝不能粘贴一份cmd: <id>副本——副本会发生漂移,而且只有 command 会携带 service/workdir/user/env(shell step 在宿主机上运行)。type: shell - 中的
service.yml条目不会发布任何内容——只有当ports:规则公开该端口(exports.env)且 compose 对该变量进行插值时,compose 才会绑定端口。DWE 工具仍会读取该声明:{name: APP_PORT, from: services.<name>.ports.http}预检会检查它,ports_free会重新映射它,因此删除它会悄悄同时移除这两项。dwe test、PROJECT、UID、GID会自动注入COMPOSE_PROJECT_NAME,不得重新声明;compose 项目名通过.env的docker.yml设置,并始终转换为小写。project_name
Output conventions
输出约定
- Always for docs (
--lang en); translations may lag.llms-txt|search|show|list - (
--output json) for data you parse:-o json,status,validate,services list,vars get|list|inspect,snapshot list|inspect,info,logs,commands list,docs list|search,test list|run|clean,deploy plan.secrets status - Read the envelope keys before indexing — a wrong key returns empty with exit 0. is
status(no top-level{project, apps, tools, infra, daemons, deploy, topology, git});servicesisinfo;{title, sections[]}isvalidate;{summary, diagnostics[]}iscommands listwith{commands[]},id, optionaltype,group(localized — match ondescription) +id(its first line),summary,service;paramsisdeploy plan.{phases[{name, steps[{name, type, cmd, unresolved[], when, check, …}]}]} - Exceptions: and
docs showalways emit markdown and ignoredocs llms-txt(-o jsonwhen piping;docs show --rawwrites a file).llms-txt --out PATHis always YAML.deploy state showis always dotenv text.render env - Scope a doc instead of reading it whole: ,
dwe docs show <topic>#<anchor>,--anchors.--toc - Bare /
dwe commands/dwe docs/dwe statusopen a TUI on a terminal and fall back to plain output in a pipe. Always call the explicit read forms (dwe vars,commands list,docs list|show|search,status --output json).vars list
- 对文档始终使用 (
--lang en);翻译版本可能滞后。llms-txt|search|show|list - 对于要解析的数据,使用 (
--output json):-o json、status、validate、services list、vars get\|list\|inspect、snapshot list\|inspect、info、logs、commands list、docs list\|search、test list\|run\|clean、deploy plan。secrets status - 建立索引前先读取封装对象的键——键写错会返回空结果且退出码为 0。的结构为
status(没有顶层{project, apps, tools, infra, daemons, deploy, topology, git});services的结构为info;{title, sections[]}的结构为validate;{summary, diagnostics[]}的结构为commands list,其中包含{commands[]}、id、可选的type、已本地化的group(按description匹配)以及id(首行)、summary、service;params的结构为deploy plan。{phases[{name, steps[{name, type, cmd, unresolved[], when, check, …}]}]} - 例外:和
docs show始终输出 Markdown,并忽略docs llms-txt(管道传输时使用-o json;docs show --raw会写入文件)。llms-txt --out PATH始终为 YAML。deploy state show始终为 dotenv 文本。render env - 应限定文档范围,而不是通读全文:、
dwe docs show <topic>#<anchor>、--anchors。--toc - 裸执行 /
dwe commands/dwe docs/dwe status会在终端上打开 TUI,在管道中则回退为纯文本输出。始终调用显式读取形式(dwe vars、commands list、docs list\|show\|search、status --output json)。vars list
When to use what
何时使用什么
| Goal | Command / reference |
|---|---|
| Project overview (start here) | |
| Run a project task (tests, lint, migrate, …) | |
| One-off command in a service container | |
| Inspect state / logs / config | |
| Search docs / read a topic | |
| Read vars / set a var | |
| Encrypted-secret inventory | |
| Populate a fresh repo from git URL(s) | |
| Add a service / tool / infra | |
| Author a command or daemon | |
Render packs / vars / | |
| Author a pipeline (deploy / lifecycle / setup / validate / info / styles / docker.yml) | |
| Integration test / verify a clean deploy | |
| Snapshot / reset / troubleshoot | |
| Apply a change | Picking the apply command below — edit yml, then ASK the user to run it |
| 目标 | 命令 / 参考 |
|---|---|
| 项目概览(从这里开始) | |
| 运行项目任务(测试、lint、迁移等) | |
| 服务容器内的一次性命令 | |
| 检查状态 / 日志 / 配置 | |
| 搜索文档 / 阅读主题 | |
| 读取 vars / 设置 var | |
| 加密 Secret 清单 | |
| 从 Git URL 填充全新仓库 | |
| 添加服务 / 工具 / 基础设施 | |
| 编写 command 或 daemon | |
Render packs / vars / | |
| 编写 pipeline(deploy / lifecycle / setup / validate / info / styles / docker.yml) | |
| 集成测试 / 验证全新部署 | |
| Snapshot / reset / 排障 | |
| 应用改动 | 下面的应用命令选择指南——编辑 yml,然后让用户运行相应命令 |
Running things
运行任务
Most work in an existing project is running its own tasks. Two commands, not interchangeable:
dwe cmd <id>dwe commands list --output jsoniddescriptionserviceiddwe cmd -i <id> --output json--set key=value${args}--dwe cmd site.test -- --run x.test.tsconfirmation:${args}dwe shell <service> -c '<cmd>'- Check the registry before any task a declared command may cover — tests, linters, formatters, builds, codegen, migrations, seeds, cache/token management, package-manager scripts. Once per session, again after changes. Do not run the underlying npm/composer/make/docker command until that check is made.
workspace/commands/ - Scoped first, full before giving up. A hub may carry a
AGENTS.mdblock naming the service's groups (Declared commands). A scoped listing that finds nothing is not proof of absence: project-wide and workflow commands declare nodwe commands list <group> --output json— run one full listing before falling back toservice:. Block counts are declared; adwe shellcan shorten the live listing.hide: - Output streams. The run banner goes to stderr (and is not printed with
▶ <id>), so stdout of-o jsonis the command's own output.dwe cmd <id>also echoes the exact process it spawns (dwe -v cmd <id>, hostdocker compose … exec|run …) to stderr.sh -c … - Long-running command → (
dwe shell … --ttyhas no such flag). Without it the child's stdout is a pipe, block-buffers, and looks hung. Leave it off when parsing output (a PTY turnsdwe cmdinto\n).\r\n - Never /
docker execinstead.docker compose execresolves the container from the service name and applies itsdwe shellblock;cli:is the tell you wanteddocker ps | grepordwe status.dwe shell
现有项目中的大多数工作都是运行项目自身的任务。以下两个命令不可互换:
dwe cmd <id>dwe commands list --output jsoniddescriptionserviceiddwe cmd -i <id> --output json--set key=value--${args}dwe cmd site.test -- --run x.test.tsconfirmation:${args}dwe shell <service> -c '<cmd>'- 在执行声明命令可能涵盖的任何任务前,先检查注册表——测试、linters、formatters、构建、codegen、migrations、seeds、缓存/token 管理、package-manager scripts。每个会话检查一次,发生变化后再次检查。在完成检查前,不要直接运行底层 npm/composer/make/docker 命令。
workspace/commands/ - 先查限定范围,再查全量后放弃。 hub 可能包含一个
AGENTS.md区块,其中列出了服务的命令组(Declared commands)。限定范围查询无结果并不能证明命令不存在:项目级和工作流命令不声明dwe commands list <group> --output json——在回退到service:前,先运行一次完整列表。区块计数是已声明的数量;dwe shell可以缩短实时列表。hide: - 输出流。 运行横幅会写入 stderr(使用
▶ <id>时不会打印),因此-o json的 stdout 就是命令自身的输出。dwe cmd <id>还会将实际启动的进程(dwe -v cmd <id>、宿主机docker compose … exec|run …)回显到 stderr。sh -c … - 长时间运行的命令 → (
dwe shell … --tty没有此标志)。不加该标志时,子进程的 stdout 是一根管道并进行块缓冲,看起来像卡住。解析输出时不要加该标志(PTY 会把dwe cmd变成\n)。\r\n - 绝不要改用 /
docker exec。docker compose exec会根据服务名解析容器并应用其dwe shell区块;需要cli:时,应改用docker ps | grep或dwe status。dwe shell
Picking the apply command
选择应用命令
After editing yml, hand the user the command that matches what changed (never run it yourself):
- / a service's
service.yml/deploy.yml/configs/ servicedirs/ added a service /render→workspace/deploy.ymldwe deploy run - or the compose base/overlays →
workspace/lifecycle.ymldwe run - toggled a service →
dwe services enable|disable <name> --apply - template / top-level
workspace→render.workspace(explicit; not automatic on deploy)dwe render workspace [pack…] - only →
exports.env(ordwe run) — that block is in no config hash, so a plaindwe deploy run --forcejournal-skips thedwe deploy runrender (.env§ 6)references/render-and-vars.md - only icon / host / display strings → (then
dwe validate/runif runtime is affected)deploy run - authored a →
workspace/tests/<scenario>.yml, thendwe validate tests(gated — see below)dwe test run <scenario> - mixed / unsure → (ends in
dwe deploy run, so it covers a restart)docker up --wait
dwe deploy run --service <name>deploy.yml--forcewhen:dwe reset run && dwe deploy run编辑 yml 后,把与改动内容相匹配的命令交给用户(绝不要自行运行):
- / 服务的
service.yml/deploy.yml/configs/ 服务dirs/ 新增服务 /render→workspace/deploy.ymldwe deploy run - 或 compose base/overlays →
workspace/lifecycle.ymldwe run - 切换服务开关 →
dwe services enable\|disable <name> --apply - template / 顶层
workspace→render.workspace(显式执行,不会在 deploy 时自动运行)dwe render workspace [pack…] - 仅修改 →
exports.env(或dwe run)——该区块不包含在任何配置哈希中,因此普通dwe deploy run --force的 journal 会跳过dwe deploy run渲染(.env§ 6)references/render-and-vars.md - 仅修改 icon / host / display 字符串 → (如果影响运行时,再执行
dwe validate/run)deploy run - 编写了 →
workspace/tests/<scenario>.yml,然后dwe validate tests(受下列门槛约束)dwe test run <scenario> - 混合改动 / 不确定 → (最终会执行
dwe deploy run,因此也涵盖重启)docker up --wait
dwe deploy run --service <name>deploy.yml--forcewhen:dwe reset run && dwe deploy runPermission boundary — read freely, never mutate
权限边界——可自由读取,绝不执行变更
READ — run without asking (no state change, safe even when they report errors):
- ,
status,logs(+validate,validate config|checks|env|tests|…),--stageinfo - ,
deploy plan,reset plan,deploy state show/deploy ejectwithoutreset eject--out snapshot list|current|inspect- (bare, it errors),
compose argv <subcommand>,compose files,docker ps|logs|project-namebridge status|logs - ,
vars get|list|inspect/commands list [group],cmd -i <id>services list - ,
secrets status— no plaintext, no key material.secrets key listandsecrets getDO print secret material — handoff.secrets key export - bare only (no
render env): prints the resolved--out, writes nothing. Its unfiltered body is the whole exported secret set — always scope it:.env. Host-only.dwe render env | grep -E '^<NAME>=' docs show|search|list|llms-txt- (lock-free, no Docker;
test listcarries each scenario's-o json),cost_profiletest clean --dry-run
读取——无需询问即可运行(无状态变更,即使报告错误也安全):
- 、
status、logs(+validate、validate config\|checks\|env\|tests\|…)、--stageinfo - 、
deploy plan、reset plan、不带deploy state show的--out/deploy ejectreset eject snapshot list\|current\|inspect- (裸执行会报错)、
compose argv <subcommand>、compose files、docker ps\|logs\|project-namebridge status\|logs - 、
vars get\|list\|inspect/commands list [group]、cmd -i <id>services list - 、
secrets status——不输出明文或密钥材料。secrets key list和secrets get确实会输出 Secret 材料——应交给用户处理。secrets key export - 仅裸执行 (不带
render env):打印解析后的--out,不会写入任何内容。其未过滤的输出包含全部已导出的 Secret——始终限定范围:.env。仅限宿主机执行。dwe render env | grep -E '^<NAME>=' docs show\|search\|list\|llms-txt- (不获取锁,不使用 Docker;
test list会携带每个场景的-o json)、cost_profiletest clean --dry-run
Running project tasks — judge the task, not the verb
运行项目任务——根据任务判断,而不是根据动词
dwe cmd <id>dwe shell <service> -c '…'- Run without asking when the task only reads or verifies in place: linters, type-checks, formatters in check mode, in-container inspection, a test suite that talks to nothing stateful.
- Ask first when it changes project or data state: migrations, seeds, resets, dependency installs, anything writing outside a build cache — and anything you are unsure about.
- A test suite that reaches the project's database or another stateful service is in the second group. Integration suites routinely truncate and re-seed the schema they run against; pointed at the live stack they destroy the developer's working data (observed: one via
npx nx testsilently replaced every row of a dev database). Check what the suite connects to; when it needs the stack, the isolated way is adwe shellscenario viaworkspace/tests/, gated below.dwe test run - shows
dwe cmd -i <id>— a declared one means ask. Being asked to "run the tests" is permission to run the tests, not to run them against the live stack when they write to it.confirmation:
dwe cmd <id>dwe shell <service> -c '…'- 无需询问即可运行,前提是任务只在原位读取或验证:linters、type-checks、处于检查模式的 formatters、容器内检查,以及不访问任何有状态对象的测试套件。
- 必须先询问,前提是任务会更改项目或数据状态:migrations、seeds、resets、依赖安装、任何写入 build cache 之外位置的操作,以及任何你不确定的任务。
- 访问项目数据库或其他有状态服务的测试套件属于第二组。 集成测试套件经常截断并重新填充其运行所针对的 schema;如果指向实时运行的 stack,就会破坏开发者的本地数据(曾观察到:通过 运行一次
dwe shell,会悄无声息地替换开发数据库中的每一行)。应检查测试套件连接到什么;当测试需要 stack 时,隔离方式是使用npx nx test运行dwe test run场景,详见下方门槛。workspace/tests/ - 会显示
dwe cmd -i <id>——如果声明了该字段,就必须询问。用户要求“运行测试”,并不等于允许在会写入数据的实时 stack 上运行测试。confirmation:
The dwe test run
gate — cheap AND isolated, or ask
dwe test rundwe test run
门槛——既廉价又隔离,否则先询问
dwe test rundwe test rundwe test list --output jsoncost_profile- Hard stops — hand it over, no judgement call: non-empty after dropping entries with
isolation_findings(the fix for"shared": trueis routing the port throughinterpolated_host_portor anservices.<name>.portsruleexports.env);from: vars.<path>> 0;shared_volumes> 0 (project-authored code on the host —host_steps, thetype: shellbuiltin, host commands, shellshell/when:; dwe's own subcommands don't count, so the built-in pipeline reports 0).check: - Cost — judge it: ,
build_services,external_images. A build is not an automatic stop — read the Dockerfile; the profile reports whether there is a build, never what it costs (layer-cache warmth is not modelled).max_start_period_seconds
Run unattended only when all hard stops are clear and you can account for the cost; otherwise — and when unsure — hand over the exact command. Always (free) first, and propose a run only for substantial changes (new service, reworked pipeline, provisioning/secrets), never after a display-only edit. Details: .
dwe validate testsreferences/integration-tests.mdMUTATE — never invoke yourself. Prepare the change, then give the user the exact command:
- (safe to re-run: gap-fills;
dwe initoverwrites)--force - ,
dwe deploy run [--service|--force|--resume]/dwe run/stop,restart(destructive)dwe reset run dwe services enable|disable <name> --apply- ,
dwe vars set,dwe render config|ide|ai|git|workspace,dwe render env --out <path>dwe render config --harvest - /
dwe deploy eject --out,dwe reset eject --outdwe deploy state clear|repair - ,
dwe snapshot create|restore|rollback|remove|pack|unpack,dwe bridge start|stopdwe docs generate|export|cache clear - — each writes a layer / keyfile or prints secret material.
dwe secrets init|set|get|encrypt|decrypt|rekey|key import|export|removeis a human handoff: it opens a hidden prompt; never ask the user for the identity text so you can paste it (it would land in a transcript).key import - /
dwe cmd <id>when the task they carry mutatesdwe shell … -c - (without
dwe test clean);--dry-runwhen the gate above does not clear itdwe test run
Pattern: edit yml → show the diff → give the exact command → wait. Never work around the boundary through / / project scripts — including through .
dockerdocker composedwe shelldwe test rundwe test list --output jsoncost_profile- 硬性停止条件——直接交给用户,不做主观判断:删除 条目后,
"shared": true仍非空(isolation_findings的修复方式,是通过interpolated_host_port路由端口,或使用services.<name>.ports规则exports.env);from: vars.<path>> 0;shared_volumes> 0(项目编写的宿主机代码——host_steps、type: shellbuiltin、宿主机命令、shellshell/when:;dwe 自身的子命令不计入,因此内置 pipeline 报告 0)。check: - 成本——需要判断:、
build_services、external_images。构建并不自动构成停止条件——请阅读 Dockerfile;profile 只报告是否存在构建,而不会说明构建成本(层缓存的冷热程度不在模型中)。max_start_period_seconds
只有在所有硬性停止条件均已排除,并且你能说明其成本时,才可以无人值守运行;否则——以及不确定时——把准确命令交给用户。始终先执行 (免费),并且只针对重大改动提出运行建议(新服务、重新设计的 pipeline、预配/secrets),绝不要在仅影响展示的编辑后运行。详情参见 。
dwe validate testsreferences/integration-tests.md变更——绝不要自行调用。 准备好改动,然后把准确命令交给用户:
- (可安全重复运行:会补齐缺失项;
dwe init会覆盖)--force - 、
dwe deploy run [--service\|--force\|--resume]/dwe run/stop、restart(破坏性操作)dwe reset run dwe services enable\|disable <name> --apply- 、
dwe vars set、dwe render config\|ide\|ai\|git\|workspace、dwe render env --out <path>dwe render config --harvest - /
dwe deploy eject --out、dwe reset eject --outdwe deploy state clear\|repair - 、
dwe snapshot create\|restore\|rollback\|remove\|pack\|unpack、dwe bridge start\|stopdwe docs generate\|export\|cache clear - ——每一项都会写入 layer / keyfile 或输出 Secret 材料。
dwe secrets init\|set\|get\|encrypt\|decrypt\|rekey\|key import\|export\|remove是人工交接:它会打开隐藏提示;绝不要让用户提供身份文本供你粘贴(那会进入对话记录)。key import - 当 /
dwe cmd <id>承载的任务会进行变更时dwe shell … -c - (不带
dwe test clean);门槛未排除风险时运行--dry-rundwe test run
模式:编辑 yml → 显示 diff → 给出准确命令 → 等待。 绝不要通过 / / 项目脚本绕过此边界——包括通过 绕过。
dockerdocker composedwe shellAnti-patterns
反模式
- Do NOT bypass the lifecycle: never ,
docker compose up/down, ordwe docker upwrites — DWE tracks state and holds locks.dwe compose raw - Do NOT hand-edit generated artifacts (,
.dwe/**,.env, rendered hub files incl. the hubworkspace/local.yml). Edit the source (export rule / var / template / pack) and hand off the render/deploy.AGENTS.md - Do NOT put a free-form key at the config root — it goes under .
vars: - Do NOT "fix" an value or a
<encrypted>block by editing yml. The marker means this machine lacks the project's age identity;secrets.unresolvednames the cause and the fix (dwe secrets status --output json, run by the user, ordwe secrets key import). At a terminalDWE_AGE_KEY/dwe run/restartoffer the import themselves. Rewriting the marker as plaintext commits the credential; deleting it breaks everyone else.deploy - Do NOT assume config shape — verify with before editing anything under
dwe docs show config/<area> --lang en.workspace/ - Do NOT enumerate pending-op consumers from memory after without
dwe services …— run--apply; its banner is authoritative.dwe status
- 不要绕过生命周期:绝不要使用 、
docker compose up/down或dwe docker up进行写入——DWE 会跟踪状态并持有锁。dwe compose raw - 不要手动编辑生成产物(、
.dwe/**、.env、已渲染的 hub 文件,包括 hubworkspace/local.yml)。应编辑源文件(export rule / var / template / pack),然后交给 render/deploy 处理。AGENTS.md - 不要在配置根级放置自由格式的键——它应位于 下。
vars: - 不要通过编辑 yml 来“修复” 值或
<encrypted>区块。该标记表示当前机器缺少项目的 age identity;secrets.unresolved会指出原因和修复方式(由用户运行dwe secrets status --output json,或设置dwe secrets key import)。在终端执行DWE_AGE_KEY/dwe run/restart时,应由 DWE 自行提示导入。将标记重写为明文会提交凭据;删除它则会破坏其他所有人的环境。deploy - 不要假设配置结构——编辑 下的任何内容之前,先使用
workspace/进行确认。dwe docs show config/<area> --lang en - 执行 而未加
dwe services …后,不要凭记忆枚举待处理操作的消费者——运行--apply;它显示的横幅才是权威依据。dwe status
Reference files
参考文件
Load on demand when the task matches:
- — git URL(s) / "set up this project" / fresh
references/populate-init-repo.md'd repo: interview → init → services → deploy → commands → render/vars → validate → deploy handoff.init - — app/tool/infra service, toggles, compose overlays,
references/add-service-and-tools.md.extends - — user commands and daemons: type zoo, params, templating, bridge opt-in.
references/authoring-commands.md - — render packs, generated-secret harvest, the
references/render-and-vars.mdsandbox,vars.exports.env - — per-service & project
references/pipelines-and-orchestration.md,deploy.yml,lifecycle,setup,validate/info,styles.docker.yml - —
references/integration-tests.md, port isolation, the debugging loop.workspace/tests/<scenario>.yml - — triage trio, snapshot workflows, reset.
references/snapshots-reset-troubleshoot.md
任务匹配时按需加载:
- ——Git URL / “设置此项目” / 刚通过
references/populate-init-repo.md创建的仓库:访谈 → init → services → deploy → commands → render/vars → validate → deploy 交接。init - ——应用/工具/基础设施服务、开关、compose overlays、
references/add-service-and-tools.md。extends - ——用户 command 和 daemon:类型集合、参数、模板、bridge opt-in。
references/authoring-commands.md - ——render packs、生成 Secret 的 harvest、
references/render-and-vars.md沙箱、vars。exports.env - ——每服务及项目级
references/pipelines-and-orchestration.md、deploy.yml、lifecycle、setup、validate/info、styles。docker.yml - ——
references/integration-tests.md、端口隔离、调试循环。workspace/tests/<scenario>.yml - ——triage trio、snapshot 工作流、reset。
references/snapshots-reset-troubleshoot.md