cargo-project
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCargo project — a Cargo workspace, declared in a repo
Cargo project — 在仓库中声明的Cargo工作区
Use this skill to define a Cargo workspace in TypeScript ( builders from
) and reconcile it to live infrastructure with .
It is the declarative counterpart to the imperative capability skills: instead
of running one CLI command per resource, you write the whole graph once and deploy
it repeatably, with a deploy state — held in your workspace, pointed at by a
committed — linking your code to what Cargo created.
define*@cargo-ai/cdkcargo-ai project deploycargo.state.json"Project" and "workspace" are two different things — keep them apart. A workspace is the Cargo tenant you sign into: it holds the models, connectors, agents, mailboxes and credits, and it is whatselects and whatlogin --workspace-namereports. A project is the repo that declares resources and deploys them into a workspace: it is whatwhoamiscaffolds, whatproject initpoints from, and whatcargo.state.jsonlocates. One project deploys into one workspace at a time — the workspace guard refuses a deploy when the state's workspace isn't the selected one — and the same project reaches a dev and a prod workspace through a different deploy state each. Say "project" for the repo, and don't name a project directory--dir.my-workspace
使用此技能在TypeScript中定义Cargo工作区(使用 的 构建器),并通过 将其与实时基础设施对齐。它是命令式能力技能的声明式对应物:不是为每个资源运行一条CLI命令,而是编写一次整个资源图并重复部署,并带有一个部署状态——保存在你的工作区中,由一个提交的 指向——将你的代码与Cargo创建的内容关联起来。
@cargo-ai/cdkdefine*cargo-ai project deploycargo.state.json“Project”和“workspace”是两回事——请区分它们。 workspace 是你登录的Cargo租户:它包含模型、连接器、Agent、邮箱和积分,是选择的对象,也是login --workspace-name报告的内容。project 是仓库,它声明资源并将它们部署到workspace中:它是whoami脚手架生成的对象,是project init指向的源,也是cargo.state.json定位的对象。一个project一次部署到一个workspace中——当状态的workspace不是当前选中的workspace时,workspace guard会拒绝部署——同一个project通过不同的部署状态分别到达开发和生产workspace。说“project”指仓库,不要将项目目录命名为--dir。my-workspace
Bootstrap
引导(Bootstrap)
Already signed in ( returns a workspace)? Skip to the next section.
cargo-ai whoamibash
npm install -g @cargo-ai/cli # no global install? prefix every command with `npx @cargo-ai/cli`
cargo-ai login --email you@company.com # emailed code, no browser; creates the account on first use
# alternatives: --oauth (browser) · --token <api-token> (CI)
cargo-ai whoami # confirm the active workspace before any write
cargo-ai project --help # `unknown command` = CLI too old; reinstall @cargo-ai/cli@latestTwo CDK-specific extras: the project needs as a dependency for the builders you import ( scaffolds a with it — then ), and the domain ships with the CLI itself.
@cargo-ai/cdkdefine*cargo-ai project initpackage.jsonnpm installcargo-ai projectEvery command prints JSON to stdout; failures exit non-zero with . Anything that creates a run or a batch is async — pass or poll the matching . When the full skill bundle is installed, adds the CLI version pin, token scopes, and the admin-only surface.
{"errorMessage": "..."}--wait-until-finishedget../cargo/references/prerequisites.md已登录( 返回一个workspace)?跳到下一节。
cargo-ai whoamibash
npm install -g @cargo-ai/cli # 没有全局安装?在每个命令前加 `npx @cargo-ai/cli`
cargo-ai login --email you@company.com # 邮件发送验证码,无需浏览器;首次使用创建账户
# 备选:--oauth(浏览器)· --token <api-token>(CI)
cargo-ai whoami # 在任何写入前确认活动workspace
cargo-ai project --help # `unknown command` = CLI太旧;重新安装 @cargo-ai/cli@latest两个CDK专属附加项:project需要将 作为依赖,用于你导入的 构建器( 会生成包含它的 ——然后运行 ),并且 域随CLI本身一起提供。
@cargo-ai/cdkdefine*cargo-ai project initpackage.jsonnpm installcargo-ai project每个命令向stdout输出JSON;失败以非零退出码和 退出。任何创建运行或批处理的操作都是异步的——传递 或轮询对应的 。当完整技能包安装后, 会添加CLI版本固定、token作用域和管理员专用表面。
{"errorMessage": "..."}--wait-until-finishedget../cargo/references/prerequisites.md1) What this skill governs
1) 此技能管辖什么
- Authoring every Cargo resource with a builder that returns a handle; wiring resources by passing handles to each other (the dependency graph is your variable graph).
define* - Deploying the graph: (offline diff) →
plan(create/update, write state) →deploy(tear down). Plus drift (destroy), adoption (refresh), and recovery (import).rollback - Typing the config against your workspace's real integration schemas
().
cargo-ai project types
The CDK spans every resource kind — so it overlaps every imperative capability
skill (, , , ,
, , …). Which to reach for is the first decision:
cargo-connectioncargo-storagecargo-aicargo-orchestrationcargo-contentcargo-hosting- 编写每个Cargo资源,使用返回句柄的 构建器;通过将句柄传递给彼此来连接资源(依赖图就是你的变量图)。
define* - 部署资源图:(离线差异)→
plan(创建/更新,写入状态)→deploy(拆除)。还有漂移(destroy)、采纳(refresh)和恢复(import)。rollback - 类型化配置,针对你的工作区的真实集成模式()。
cargo-ai project types
CDK涵盖每一种资源类型——因此它与每个命令式能力技能(、、、、、等)重叠。选哪个是第一个决定:
cargo-connectioncargo-storagecargo-aicargo-orchestrationcargo-contentcargo-hosting2) CDK or the CLI? — the routing decision
2) CDK还是CLI?——路由决策
Declarative (this skill) vs imperative (a capability skill).
Use the CDK when the user is managing resources as an artifact:
- "Set up / stand up / bootstrap a whole workspace (as code / from a template)."
- "Make this reproducible / version-controlled / in git / repeatable across environments (dev → prod)."
- "Deploy these connectors + models + agents together" (a multi-resource graph wired by dependency).
- Anything that should be re-runnable and diffable, where losing the definition would be a problem.
Use the matching capability skill (imperative ) when the
user is doing a one-off operation or exploring:
cargo-ai <domain>- "Create one connector", "add a column to this model", "list connectors", "run this workflow", "query storage", "read this agent's memory."
- Any read, ad-hoc query, or single mutation that doesn't need to live in code.
When unsure, ask whether the result should be committed and re-deployable. If yes
→ CDK. If it's a quick action or a read → the capability skill (see the
router to pick the right domain).
cargo声明式(此技能) vs 命令式(能力技能)。
当用户是将资源作为工件管理时,使用CDK:
- “设置/搭建/引导整个workspace(作为代码/从模板)。”
- “使这个可复现/版本控制/在git中/跨环境(dev → prod)可重复。”
- “一起部署这些连接器+模型+Agent”(一个按依赖连接的多资源图)。
- 任何应该可重新运行和可差异化的东西,丢失定义将是一个问题。
当用户正在进行一次性操作或探索时,使用匹配的能力技能(命令式 ):
cargo-ai <domain>- “创建一个连接器”、“向此模型添加列”、“列出连接器”、“运行此工作流”、“查询存储”、“读取此Agent的记忆”。
- 任何读取、临时查询或不需要存在于代码中的单个变更。
不确定时,询问结果是否应该提交并重新部署。如果是→CDK。如果是一次快速操作或读取→能力技能(参见 router 以选择正确的域)。
cargo3) The lifecycle
3) 生命周期
cargo-ai project init <dir> scaffold from getcargohq/cargo-manifest; resources in infra/
│
cargo-ai project types generate per-workspace types for typed config (optional)
│
(author define* files) importing a .ts file IS registration — no manifest
│
cargo-ai project plan offline: compile the graph, diff against the deploy state
│
cargo-ai project deploy create/update resources in dependency order, write state
│
cargo-ai project destroy tear down resources recorded in statesays what resources change; it doesn't show what a play does. For aproject plan/definePlaygraph past three nodes, present a Mermaid flowchart of the node graph alongside the plan — routing, fallbacks, and which nodes bill on every scheduled run are what the reviewer is approving. Generate it from the deployed release after the first deploy, or from the node array while authoring:defineTool.../cargo-orchestration/references/node-diagram.md
Side branches: (validate the tree, no state, no API calls —
the CI/editor subset of ) · (what is here: every declared
resource, the file that declared it, whether it is deployed) ·
(read-only drift report) · (re-apply code over out-of-band edits) ·
(delete resources removed from code) ·
(bind an existing live resource into state) · (generate
source from a live workspace and adopt it) · (restore the
pre-deploy state snapshot) · (inspect and repoint the deploy state).
cargo-ai project checkplancargo-ai project infocargo-ai project refreshdeploy --refreshdeploy --prunecargo-ai project import <id> <uuid>cargo-ai project pulldefine*cargo-ai project rollbackcargo-ai project stateplaninfoplaninfocheckplancargo-ai projectinfoinitcargo-ai project init <dir> 从 getcargohq/cargo-manifest 脚手架;资源在 infra/ 中
│
cargo-ai project types 为类型化配置生成按workspace的类型(可选)
│
(编写 define* 文件) 导入 .ts 文件即注册——无需manifest
│
cargo-ai project plan 离线:编译资源图,与部署状态差异对比
│
cargo-ai project deploy 按依赖顺序创建/更新资源,写入状态
│
cargo-ai project destroy 拆除状态中记录的资源说明哪些资源会变化;它不显示剧本做什么。 对于超过三个节点的project plan/definePlay图,在计划旁边呈现节点图的 Mermaid 流程图——路由、回退以及哪些节点在每次计划运行中计费,是审查者要批准的。在首次部署后从已部署的发布生成,或在编写时从节点数组生成:defineTool。../cargo-orchestration/references/node-diagram.md
侧分支:(验证树,无状态,无API调用——CI/编辑器子集的 )· (这里有什么:每个声明的资源、声明它的文件、是否已部署)· (只读漂移报告)· (将代码重新应用到带外编辑上)· (删除从代码中移除的资源)· (将现有实时资源绑定到状态中)· (从实时workspace生成 源码并采纳它)· (恢复部署前状态快照)· (检查和重新指向部署状态)。
cargo-ai project checkplancargo-ai project infocargo-ai project refreshdeploy --refreshdeploy --prunecargo-ai project import <id> <uuid>cargo-ai project pulldefine*cargo-ai project rollbackcargo-ai project stateplaninfoplaninfocheckplancargo-ai projectinfoinit4) Documentation hierarchy
4) 文档层次结构
- Level 1 — (this file): the decision model, lifecycle, critical rules, and routing.
SKILL.md - Level 2 — Guides:
,
guides/authoring-resources.md,guides/deploy-and-state.md.guides/typed-config.md - Level 2.5 — Recipes: — step-by-step playbooks to follow as your execution plan.
recipes/*.md - References — (the full builder catalog),
references/resources.md(everyreferences/commands.mdsubcommand + flags),cargo-ai project, andreferences/troubleshooting.md.references/examples/full-workspace.md
- 第1级 — (本文件):决策模型、生命周期、关键规则和路由。
SKILL.md - 第2级 — 指南:
、
guides/authoring-resources.md、guides/deploy-and-state.md。guides/typed-config.md - 第2.5级 — 食谱: — 作为你的执行计划遵循的分步手册。
recipes/*.md - 参考资料 — (完整构建器目录)、
references/resources.md(每个references/commands.md子命令+标志)、cargo-ai project和references/troubleshooting.md。references/examples/full-workspace.md
5) Read behavior — match the task to a doc and READ IT
5) 读取行为——将任务匹配到文档并阅读它
| When the task involves… | Read this first | What it gives you |
|---|---|---|
Writing | | The builder catalog, the handle/ref model, secrets, and how workflow bodies compile. |
| | The deploy lifecycle, |
Typed config, | | What |
| A field/spec/output for a specific builder | | Every builder → spec fields → which ref each takes → outputs. |
| Exact command flags | | Every |
| A deploy error / footgun | | The known failure modes and fixes. |
| A known GTM outcome, before authoring one | | The cookbook menu: gtm-skills that carry a worked CDK example, and the adaptations each supports. |
| 当任务涉及… | 首先阅读这个 | 它给你什么 |
|---|---|---|
编写 | | 构建器目录、句柄/引用模型、机密,以及工作流主体如何编译。 |
| | 部署生命周期、 |
类型化配置、 | | |
| 特定构建器的字段/规范/输出 | | 每个构建器 → 规范字段 → 接受哪个引用 → 输出。 |
| 确切的命令标志 | | 每个 |
| 部署错误/陷阱 | | 已知失败模式和修复。 |
| 已知GTM结果,在编写一个之前 | | 食谱菜单:带有可用CDK示例的gtm-skills,以及每个支持的适配。 |
Cookbooks — check the menu before authoring a known outcome from scratch
Cookbooks——在从头编写已知结果前检查菜单
getcargohq/gtm-skillsThe menu is local: . Read it
before authoring a common GTM outcome from scratch. It is generated from gtm-skills'
, so it cannot drift.
references/cookbooks.mdcatalog.jsonA cookbook is a worked example, not a template to fill in. Each one declares in its what may be reshaped, what must hold or it stops
working, and what has to be answered either way, and it carries its own procedure.
is the copy step in that procedure:
SKILL.mdproject addsh
cargo-ai project add cookbook/tam-building # inside a CDK project
cargo-ai project init my-project --cookbook tam-building # no project yet: both at onceThat writes the resources to and the procedure to
, skipping any file it would overwrite. Then start the
skill at its Adapt section — its opening steps are written for someone who found the
folder on GitHub and still has to place it, so following them from the top scaffolds a
second project and copies the folder in again.
infra/tam-building/.claude/skills/tam-building/What is left after the copy is the part only you can do: reconcile it with what is
already declared, adapt the copied files in place to the project's real shape (do not
regenerate them from the skill's prose — the safety lives in the TypeScript), plan and
stop, deploy on a yes, walk its .
Done whenIf you are mid-task and the skill is not in this session, fetches the procedure alone and you can read
directly; no reload needed. To read one without
installing, prints it. Neither brings the
CDK resources — for those you still want .
npx skills add getcargohq/gtm-skills/<slug>.agents/skills/<slug>/SKILL.mdnpx skills use getcargohq/gtm-skills@<slug>project addRouting rule: one-off versus standing. A user who wants the list today wants
(or gtm-skills' one-off ); a user who wants a pipeline
that keeps producing it wants . The same words describe both ("build
our TAM"), so listen for whether the result is meant to keep arriving. A cookbook
matches → install it and follow it. No match → author from the recipes below.
cargo-gtmbuild-tam-listtam-buildingNever into a directory that is not empty. It replaces
the project's and reverts adapted code, while
survives, so the next diffs a live workspace against code nobody wrote. Copy the
skill folder in as a sibling instead.
cargo-ai project init --forcepackage.jsoncargo.state.jsonplanCaveat: the examples typecheck, but they are not yet deploy-verified against a live
workspace, and every one is . Treat each skill's as the
acceptance test, and always review before deploying.
to-be-approvedDone whencargo-ai project plangetcargohq/gtm-skills菜单是本地的:。 在从头编写常见GTM结果之前阅读它。它从gtm-skills的 生成,因此不会漂移。
references/cookbooks.mdcatalog.jsonCookbook是一个可用示例,而不是要填写的模板。 每个cookbook在其 中声明哪些可以重塑,哪些必须保持不变否则停止工作,以及哪些无论如何都要回答,并且它带有自己的程序。 是该程序中的复制步骤:
SKILL.mdproject addsh
cargo-ai project add cookbook/tam-building # 在CDK project内
cargo-ai project init my-project --cookbook tam-building # 还没有project:两者同时这将资源写入 ,将程序写入 ,跳过任何它会覆盖的文件。然后从其Adapt部分开始技能——其开头步骤是为在GitHub上找到文件夹并且仍需放置它的人编写的,因此从头遵循它们会脚手架第二个项目并再次复制文件夹。
infra/tam-building/.claude/skills/tam-building/复制后剩下的部分只有你能做:与已经声明的内容协调,就地将复制的文件适配到项目的真实形状(不要从技能的文字重新生成它们——安全存在于TypeScript中),计划并停止,在yes时部署,走过它的 。
Done when如果你正在任务中途而该技能不在本次会话中, 仅获取程序,你可以直接阅读 ;无需重新加载。要阅读而不安装, 会打印它。两者都不带来CDK资源——对于这些你仍然需要 。
npx skills add getcargohq/gtm-skills/<slug>.agents/skills/<slug>/SKILL.mdnpx skills use getcargohq/gtm-skills@<slug>project add路由规则:一次性与持续。 今天想要列表的用户想要 (或gtm-skills的一次性 );想要持续产生列表的流水线的用户想要 。相同的词语描述两者(“构建我们的TAM”),因此要听结果是否旨在持续到达。 cookbook匹配→安装并遵循它。不匹配→从下面的食谱编写。
cargo-gtmbuild-tam-listtam-building永远不要 进入非空目录。 它替换项目的 并恢复适配后的代码,而 幸存,因此下一个 会将实时workspace与无人编写的代码进行差异对比。而是将技能文件夹作为兄弟文件夹复制进来。
cargo-ai project init --forcepackage.jsoncargo.state.jsonplan警告:示例通过类型检查,但尚未针对实时workspace进行部署验证,并且每个都是 。将每个技能的 作为验收测试,并且始终在部署前审查 。
to-be-approvedDone whencargo-ai project planRecipes — follow step-by-step when one matches
Recipes——当匹配时逐步遵循
| Recipe | Use when… |
|---|---|
| Standing up a new project from scratch ( |
| Adding a data source + a model sourced from it, wired by handle. |
| Composing a model + tool + agent (with |
| Bringing an already-live workspace under a project via |
| Deploying non-interactively from CI (token auth + committed state). |
| Recipe | 在以下情况下使用… |
|---|---|
| 从零搭建新project( |
| 添加数据源+从它获取的模型,通过句柄连接。 |
| 组合模型+工具+Agent(使用 |
| 通过 |
| 从CI非交互式部署(token认证+提交状态)。 |
6) Critical rules
6) 关键规则
-
Commit— it is a pointer now, not the state. The deploy state lives in your workspace; the repo commits only
cargo.state.json.{"stateUuid": "8f2c…"}creates the state and writes that pointer, so it lands in the scaffold commit. Commit it: without the uuid a fresh checkout can't find its state, and a deploy will not quietly create a replacement (that would orphan everything the old one tracks). The state records only uuids, hashes and outputs — never secret values. It is still the only handle on a deployed play, agent, or alert (they have no slug); recover a lost link withproject init, or per-resource withproject state bind <uuid>. Git-ignore the working files (cargo-ai project importscaffolds this):project initgitignore.cargo-ai/ cargo.state.lock cargo.state.bak.json cargo.state.cache.json cargo.state.audit.jsonlOne state per repo, and at most 10 live states per workspace:bashcargo-ai project state list # every state here, and which one this project is on cargo-ai project state create # create one for this project, write the pointer cargo-ai project state bind <uuid> # repoint at an existing oneA project scaffolded before states moved to the workspace has the resource map inline in, and keeps deploying against that file for as long as you leave it there — nothing migrates behind your back.cargo.state.jsonis what moves it: the map goes onto a new state, the file becomes a pointer, and you commit it. Don't migrate without telling the team, since a teammate who deploys before pulling the new pointer is deploying from a state that no longer exists. (Deleting a state —state create— is in the CDK README but is not in CLI 1.0.96; it lands in the next release.)state remove -
Three ways to get a value in, and they are not interchangeable.
- — read from your environment at deploy time, excluded from the content hash and from state. Export the env var before deploying; a missing one fails the deploy with an unresolved
secret("ENV_VAR")placeholder.${ENV_VAR} - — read from your environment at load time, and its value enters the spec and therefore the content hash, so changing it shows as drift. Use it for non-secret config you want tracked.
env("ENV_VAR") - — a pointer at a workspace env-var catalog entry. Nothing is read locally and nothing can fail; the value stays server-side and is re-read on every use, so rotating it in the workspace reaches the resource with no redeploy. Manage the catalog with
workspaceEnv("NAME")(seecargo-ai workspaceManagement envVar).../cargo-workspace-management/SKILL.md
andsecret()are accepted at secret-typed schema positions only —workspaceEnv()prints the union at exactly those positions. A resource's owncargo-ai project typesblock takesenvorenv()and rejects a pointer, because a worker, app, agent or script already inherits the whole workspace catalog; a pointer there could only restate a variable it can read anyway.secret() -
A rotatedneeds more than a plain deploy to land. Keeping the value out of the content hash is what stops rotation reading as drift — and it is also why
secret()won't push the new value: nothing in the hash changed, so the resource isn't re-applied. Roll it withdeploy, or any other edit to that resource.deploy --refreshhas no such step; that is most of its appeal.workspaceEnv() -
Wire by handle, never by. Pass a
.uuidhandle directly (define*,dataset: hubspot), ortools: [enrich]for a resource you didn't define in code (xxRef("uuid"),connectorRef,modelRef,folderRef,toolRef, …). Where a reference needs per-call options, wrap it asagentRef(e.g.{ ref, …options }).models: [{ ref: contacts, readOnly: true }] -
Runafter workspace integrations change — it regenerates
cargo-ai project typesso.cargo-ai//defineConnectorconfig (anddefineModelin workflow bodies) type-check against the real schemas. Typing is a bonus, never a gate: deploy works without it.integrations.* -
Any subdirectory of the repo is fine (CLI ≥ 1.0.83). Commands walk up to the package root whereis declared, then back down to the resource directory (
@cargo-ai/cdkin a scaffolded repo), soinfra/and.cargo-ai/land in the right place from anywhere inside the project.cargo.state.jsonstill overrides it. This is why resources live in--dir <path>and not at the root: the loader imports everyinfra/under the directory it is given, and a repo root also holds.ts— whose files run on import. Pointing a command at the root would execute them.scripts/ -
in CI.
--yesanddeployprompt for confirmation; non-interactive runs must passdestroy.--yes -
A/
definePlaygraph with paid nodes gets a sample run before it goes wide. Deploying is not running, but the first thing that runs a deployed play is usually a batch over the whole segment — and a scheduled play re-bills every node on every run. Before enrolling everything (or enabling a schedule), run the deployed workflow on 10–20 records —defineTool, orcargo-ai orchestration batch create --data '{"kind":"filter","modelUuid":"…","filter":…,"limit":15}'to test-run the module without deploying — then ask the user to approve the full enrollment with the record count and credit estimate. Read the provider's playbook (batch create --file ./plays/x.ts, esp. its Recurring use section) and the gate in../cargo-gtm/provider-playbooks/<slug>.md.../cargo-gtm/references/cost-discipline.md -
Awhose actions call paid nodes re-bills on every breach. An alert's
defineAlertfire as real runs, so a badly-sizedactionson a tightthresholdcan breach — and bill — every tick. Size the threshold withschedulebefore deploying, prefer cheap notification actions (an agent that posts, a connector notification) over anything that fans out, and apply the same cost gate above when an action calls a credits-based provider. Scope/threshold and firing semantics:cargo-ai observability alert preview.../cargo-observability/SKILL.md -
bills monthly, and
defineMailboxrewrites a DNS zone. A mailbox is 100–160 credits per month for as long as it exists (defineDomainfor live figures), so acargo-ai mailboxManagement pricing getline in the plan is a recurring charge the user approves, not a one-off. Its+ create mailbox:…,domainandusernameare create-only — changing any of them is destroy + recreate, i.e. a brand-new inbox back at the bottom of a 45-day warm-up ramp. The deploy pollstypefor up to 5 minutes waiting forrefreshStatus. Onactive,defineDomainis the whole zone, not a patch: declaring it replaces every live record (including the ones the registrar wrote at purchase), and omitting it leaves the zone untouched.dnsRecords,redirectUrlanddmarcEmailare additive and are the supported way to configure a zone without replacing it, so reach fordmarcPolicyonly when you mean to own every record. UsednsRecordsfor a domain or mailbox bought in the UI. Ramp, suppression and sending:adopt: true.../cargo-mailbox-management/SKILL.md -
Route CDK-managed resources into a clearly-labelled folder. Seton each builder so everything CDK owns lands in a dedicated folder whose name signals "owned by code — don't hand-edit" to anyone in the UI (manual UI edits read back as drift on the next
folder:). Folders are per-kind, so give each kind its own but share one short, recognizable prefix — recommended:plan(e.g.🔒 CDK,🔒 CDK Models). Keep names short (long labels truncate in the folder tree); the lock emoji is the "don't touch" cue. See🔒 CDK Agents.guides/authoring-resources.md
-
提交—— 它现在是一个指针,不是状态。 部署状态存在于你的workspace中;仓库只提交
cargo.state.json。{"stateUuid": "8f2c…"}创建状态并写入该指针,因此它落在脚手架提交中。提交它:没有uuid,新的检出找不到其状态,并且部署将不会静默创建替代品(那将孤立旧状态跟踪的所有内容)。状态只记录uuid、哈希和输出——绝不记录机密值。它仍然是已部署的 play、agent 或 alert 的唯一句柄(它们没有slug);使用project init或按资源使用project state bind <uuid>恢复丢失的链接。Git忽略工作文件(cargo-ai project import脚手架会生成):project initgitignore.cargo-ai/ cargo.state.lock cargo.state.bak.json cargo.state.cache.json cargo.state.audit.jsonl每个仓库一个状态,并且每个workspace最多10个实时状态:bashcargo-ai project state list # 这里每个状态,以及此project处于哪个 cargo-ai project state create # 为此project创建一个,写入指针 cargo-ai project state bind <uuid> # 重新指向现有状态在状态移到workspace之前脚手架生成的project在中内联资源映射,并且只要你把它留在那里就会继续针对该文件部署——没有东西会在你背后迁移。cargo.state.json是移动它的操作:映射转到新状态,文件成为指针,然后你提交它。不要在没有告知团队的情况下迁移,因为先部署的队友在拉取新指针之前是从一个不再存在的状态部署的。(删除状态——state create——在CDK README中但在CLI 1.0.96中不可用;它将在下个版本中发布。)state remove -
获取值的三种方式,它们不可互换。
- — 在部署时从你的环境读取,排除在内容哈希和状态之外。在部署前导出环境变量;缺少会导致部署失败,并带有未解析的
secret("ENV_VAR")占位符。${ENV_VAR} - — 在加载时从你的环境读取,其值进入规范并因此进入内容哈希,因此更改它会显示为漂移。对你想跟踪的非机密配置使用它。
env("ENV_VAR") - — 一个指向workspace环境变量目录条目的指针。本地不读取任何内容,也不会失败;该值保留在服务端,并在每次使用时重新读取,因此在workspace中轮换它可以无需重新部署就到达资源。使用
workspaceEnv("NAME")管理目录(参见cargo-ai workspaceManagement envVar)。../cargo-workspace-management/SKILL.md
和secret()仅在secret类型的模式位置被接受——workspaceEnv()在这些位置打印联合类型。资源自身的cargo-ai project types块接受env或env()并拒绝指针,因为worker、app、agent或script已经继承整个workspace目录;那里的指针只能重述一个它本就可以读取的变量。secret() -
轮换的需要的不止一次普通部署。 将该值排除在内容哈希之外是阻止轮换读取为漂移的原因——也是
secret()不会推送新值的原因:哈希中没有变化,因此资源不会重新应用。使用deploy或对该资源的任何其他编辑来轮换它。deploy --refresh没有这样的步骤;这是它的大部分吸引力。workspaceEnv() -
通过句柄连接,绝不通过。 直接传递一个
.uuid句柄(define*、dataset: hubspot),或者为你在代码中未定义的资源使用tools: [enrich](xxRef("uuid")、connectorRef、modelRef、folderRef、toolRef等)。当引用需要每次调用的选项时,将其包装为agentRef(例如{ ref, …options })。models: [{ ref: contacts, readOnly: true }] -
在workspace集成更改后运行—— 它重新生成
cargo-ai project types,使.cargo-ai//defineConnector配置(以及工作流主体中的defineModel)针对真实模式进行类型检查。类型化是奖励,绝不是门禁:没有它部署也能工作。integrations.* -
仓库的任何子目录都可以(CLI ≥ 1.0.83)。 命令向上走到声明了的包根目录,然后向下回到资源目录(脚手架仓库中的
@cargo-ai/cdk),因此infra/和.cargo-ai/从项目内部任何位置落在正确位置。cargo.state.json仍然覆盖它。这就是资源位于--dir <path>而不是根目录的原因:加载器导入给定目录下的每个infra/文件,而仓库根目录还包含.ts——其文件在导入时运行。将命令指向根目录会执行它们。scripts/ -
CI中的。
--yes和deploy提示确认;非交互式运行必须传递destroy。--yes -
带有付费节点的/
definePlay图在广泛运行前要进行样本运行。 部署不是运行,但运行已部署play的第一件事通常是对整个分段的批处理——而计划内的play会在每次运行中重新计费每个节点。在注册所有内容(或启用计划)之前,在 10–20条记录 上运行已部署的工作流——defineTool,或cargo-ai orchestration batch create --data '{"kind":"filter","modelUuid":"…","filter":…,"limit":15}'来测试运行模块而不部署——然后要求用户批准完整注册,并附上记录数量和积分估算。阅读提供者的playbook(batch create --file ./plays/x.ts,尤其是其 Recurring use 部分)以及../cargo-gtm/provider-playbooks/<slug>.md中的门禁。../cargo-gtm/references/cost-discipline.md -
调用付费节点的的action会在每次违反时重新计费。 Alert的
defineAlert作为真实运行触发,因此在紧张的actions上大小不当的schedule可能会每个tick违反——并计费。在部署前使用threshold调整阈值大小,优先选择廉价的通知action(一个发布的agent、一个连接器通知)而不是任何扇出的东西,并且当action调用基于积分的提供者时应用相同的成本门禁。作用域/阈值和触发语义:cargo-ai observability alert preview。../cargo-observability/SKILL.md -
每月计费,
defineMailbox重写DNS区域。 邮箱只要存在就每月消耗100–160积分(实时数字见defineDomain),因此计划中的cargo-ai mailboxManagement pricing get行是用户批准的经常性费用,而不是一次性费用。其+ create mailbox:…、domain和username是仅创建——更改其中任何一个都是销毁+重建,即一个全新收件箱回到45天预热坡道的底部。部署会轮询type最多5分钟等待refreshStatus。在active上,defineDomain是整个区域,不是补丁:声明它会替换每条实时记录(包括注册商在购买时写入的),而省略它会使区域保持不变。dnsRecords、redirectUrl和dmarcEmail是附加的,是配置区域而不替换它的受支持方式,因此只有当你打算拥有每条记录时才使用dmarcPolicy。对于在UI中购买的域或邮箱使用dnsRecords。预热、抑制和发送:adopt: true。../cargo-mailbox-management/SKILL.md -
将CDK管理的资源路由到清晰标记的文件夹。 在每个构建器上设置,使CDK拥有的所有内容落在一个专用文件夹中,其名称向UI中的任何人发出信号“由代码拥有——不要手动编辑”(手动UI编辑会在下一个
folder:上读回为漂移)。文件夹是按类型的,因此给每个类型自己的文件夹,但共享一个简短、可识别的前缀——推荐:plan(例如🔒 CDK、🔒 CDK Models)。保持名称简短(长标签在文件夹树中截断);锁表情是“不要碰”的提示。参见🔒 CDK Agents。guides/authoring-resources.md
Help
帮助
- and
cargo-ai project --helpfor the live flag surface.cargo-ai project <subcommand> --help - When a documented command/flag/response doesn't match what you observe, file a
report: (see
cargo-ai workspaceManagement report create).../cargo-workspace-management/SKILL.md
- 和
cargo-ai project --help查看实时标志表面。cargo-ai project <subcommand> --help - 当文档化的命令/标志/响应与你观察到的不匹配时,提交报告:(参见
cargo-ai workspaceManagement report create)。../cargo-workspace-management/SKILL.md