@cursor/july 0.1.114 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/channels/slack/inbound.d.ts +7 -0
  2. package/dist/channels/slack/inbound.d.ts.map +1 -1
  3. package/dist/channels/slack/inbound.js +23 -0
  4. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  5. package/dist/channels/slack/slack-channel.js +83 -4
  6. package/dist/docs/404.html +2 -2
  7. package/dist/docs/assets/{app.BqkJwOZ-.js → app.9eAtsjAM.js} +4 -4
  8. package/dist/docs/assets/chunks/@localSearchIndexroot.DjNBgxTF.js +1 -0
  9. package/dist/docs/assets/chunks/{VPLocalSearchBox.BJAi2KiV.js → VPLocalSearchBox.C9s69nxj.js} +1 -1
  10. package/dist/docs/assets/chunks/{arc.BZpXTgvV.js → arc.DmWDRaF-.js} +1 -1
  11. package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.WYI-7F-Y.js → architectureDiagram-Q4EWVU46.BE1Wj4f3.js} +1 -1
  12. package/dist/docs/assets/chunks/{baseUniq.CZaUPpg0.js → baseUniq.pmEZGnWu.js} +1 -1
  13. package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.D6UES2pD.js → blockDiagram-DXYQGD6D.D6mM-5XN.js} +1 -1
  14. package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.cwebIe4i.js → c4Diagram-AHTNJAMY.ZQYTPC1b.js} +1 -1
  15. package/dist/docs/assets/chunks/channel.BNF8VK-B.js +1 -0
  16. package/dist/docs/assets/chunks/{chunk-4BX2VUAB.fVyFnjxg.js → chunk-4BX2VUAB.CKJ7gaK8.js} +1 -1
  17. package/dist/docs/assets/chunks/{chunk-4TB4RGXK.BanufG1c.js → chunk-4TB4RGXK.CL61HnvB.js} +1 -1
  18. package/dist/docs/assets/chunks/{chunk-55IACEB6.VaSMz5-2.js → chunk-55IACEB6.DsA4XA1m.js} +1 -1
  19. package/dist/docs/assets/chunks/{chunk-EDXVE4YY.CN2diZOM.js → chunk-EDXVE4YY.BODHCHFW.js} +1 -1
  20. package/dist/docs/assets/chunks/{chunk-FMBD7UC4.g4ivypu3.js → chunk-FMBD7UC4.D6NBaZTa.js} +1 -1
  21. package/dist/docs/assets/chunks/{chunk-OYMX7WX6.GZXKn9JJ.js → chunk-OYMX7WX6.BLPuqFXg.js} +1 -1
  22. package/dist/docs/assets/chunks/{chunk-QZHKN3VN.itXxJZCd.js → chunk-QZHKN3VN.BFs_ML8Z.js} +1 -1
  23. package/dist/docs/assets/chunks/{chunk-YZCP3GAM.-rw2GfvX.js → chunk-YZCP3GAM.BDjuFyZv.js} +1 -1
  24. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.iViHzfrK.js +1 -0
  25. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.iViHzfrK.js +1 -0
  26. package/dist/docs/assets/chunks/clone.CJoR2BBM.js +1 -0
  27. package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.CmaI5br0.js → cose-bilkent-S5V4N54A.D85HNEsi.js} +1 -1
  28. package/dist/docs/assets/chunks/{dagre-KV5264BT.4wY9S4Kt.js → dagre-KV5264BT.V463KlSF.js} +1 -1
  29. package/dist/docs/assets/chunks/{diagram-5BDNPKRD.Pc3c0u9W.js → diagram-5BDNPKRD.DhBDu1ab.js} +1 -1
  30. package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.CYrWz-nj.js → diagram-G4DWMVQ6.v6sC68zl.js} +1 -1
  31. package/dist/docs/assets/chunks/{diagram-MMDJMWI5.Bgj5hukb.js → diagram-MMDJMWI5.DhHsdXYv.js} +1 -1
  32. package/dist/docs/assets/chunks/{diagram-TYMM5635.DGMEXalS.js → diagram-TYMM5635.BPWNSFZc.js} +1 -1
  33. package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.GepTV9Im.js → erDiagram-SMLLAGMA.Cq0wTMPL.js} +1 -1
  34. package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.DVKywg3j.js → flowDiagram-DWJPFMVM.MveMtucC.js} +1 -1
  35. package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.C7qt9Mlo.js → ganttDiagram-T4ZO3ILL.BzKfGUSf.js} +1 -1
  36. package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.U30_r82P.js → gitGraphDiagram-UUTBAWPF.OToXTSW_.js} +1 -1
  37. package/dist/docs/assets/chunks/{graph.CyyMyAWv.js → graph.D82tam-l.js} +1 -1
  38. package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.Dn9ACW3y.js → infoDiagram-42DDH7IO.DzFlRmcE.js} +1 -1
  39. package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.DlIdIGOA.js → ishikawaDiagram-UXIWVN3A.CVPRJiKe.js} +1 -1
  40. package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.DZj4vy4E.js → journeyDiagram-VCZTEJTY.CQvNTfQC.js} +1 -1
  41. package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.Dl63eMUV.js → kanban-definition-6JOO6SKY.BwywywUl.js} +1 -1
  42. package/dist/docs/assets/chunks/{layout.BLHZLWPH.js → layout.C4BkPPba.js} +1 -1
  43. package/dist/docs/assets/chunks/{linear.aXKGKaNw.js → linear.FoSfGKD4.js} +1 -1
  44. package/dist/docs/assets/chunks/{min.zWnFcpcc.js → min.yLh8jqfl.js} +1 -1
  45. package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.Qs4MQBea.js → mindmap-definition-QFDTVHPH.C9Dq2_CN.js} +1 -1
  46. package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.BmPHgsk7.js → pieDiagram-DEJITSTG.CiGyBcES.js} +1 -1
  47. package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.D5MQ3gwA.js → quadrantDiagram-34T5L4WZ.1FWea9nj.js} +1 -1
  48. package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.CkdUFrO7.js → requirementDiagram-MS252O5E.B1q7ntiV.js} +1 -1
  49. package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.KZrljrAV.js → sankeyDiagram-XADWPNL6.Cpr4oU_k.js} +1 -1
  50. package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.XMoEW-Lx.js → sequenceDiagram-FGHM5R23.CUK68STn.js} +1 -1
  51. package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.BmTzePLj.js → stateDiagram-FHFEXIEX.zU0yL2m4.js} +1 -1
  52. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.nV8Nl-td.js +1 -0
  53. package/dist/docs/assets/chunks/{theme.BfQzpxsg.js → theme.DhnKd0CD.js} +2 -2
  54. package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.Dug0oamp.js → timeline-definition-GMOUNBTQ.CNYoXo3F.js} +1 -1
  55. package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.BOTHrEFu.js → vennDiagram-DHZGUBPP.DFWH3G9s.js} +1 -1
  56. package/dist/docs/assets/chunks/{wardley-RL74JXVD.DXy2i1LS.js → wardley-RL74JXVD.Do4PwzeN.js} +1 -1
  57. package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.CoXKdfi6.js → wardleyDiagram-NUSXRM2D.7WLkqM7s.js} +1 -1
  58. package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.DXoSCjAW.js → xychartDiagram-5P7HB3ND.-SyUNgWw.js} +1 -1
  59. package/dist/docs/assets/{guides_slack.md.Bo96y42E.js → guides_slack.md.DVjNyqq5.js} +3 -3
  60. package/dist/docs/assets/{guides_slack.md.Bo96y42E.lean.js → guides_slack.md.DVjNyqq5.lean.js} +1 -1
  61. package/dist/docs/assets/reference_cli.md.BvnQM8wd.js +97 -0
  62. package/dist/docs/assets/reference_cli.md.BvnQM8wd.lean.js +1 -0
  63. package/dist/docs/building-with-agents.html +35 -35
  64. package/dist/docs/deployment.html +35 -35
  65. package/dist/docs/evals.html +35 -35
  66. package/dist/docs/guides/agent-to-agent.html +35 -35
  67. package/dist/docs/guides/bitbucket.html +35 -35
  68. package/dist/docs/guides/cloud-agents.html +35 -35
  69. package/dist/docs/guides/convert-automation.html +35 -35
  70. package/dist/docs/guides/github.html +35 -35
  71. package/dist/docs/guides/gitlab.html +35 -35
  72. package/dist/docs/guides/grokbot-agents.html +35 -35
  73. package/dist/docs/guides/hooks.html +35 -35
  74. package/dist/docs/guides/improve.html +35 -35
  75. package/dist/docs/guides/jev.html +35 -35
  76. package/dist/docs/guides/mcp-oauth.html +35 -35
  77. package/dist/docs/guides/opentelemetry.html +35 -35
  78. package/dist/docs/guides/slack.html +37 -37
  79. package/dist/docs/guides/slack.md +7 -0
  80. package/dist/docs/guides/webhooks.html +35 -35
  81. package/dist/docs/hashmap.json +1 -1
  82. package/dist/docs/hillclimbing.html +35 -35
  83. package/dist/docs/index.html +35 -35
  84. package/dist/docs/llms-full.txt +690 -751
  85. package/dist/docs/llms.txt +1 -1
  86. package/dist/docs/quickstart.html +35 -35
  87. package/dist/docs/reference/agent-config.html +35 -35
  88. package/dist/docs/reference/artifacts.html +35 -35
  89. package/dist/docs/reference/channels.html +35 -35
  90. package/dist/docs/reference/cli.html +127 -125
  91. package/dist/docs/reference/cli.md +685 -753
  92. package/dist/docs/reference/connections.html +35 -35
  93. package/dist/docs/reference/evals.html +35 -35
  94. package/dist/docs/reference/extensions.html +35 -35
  95. package/dist/docs/reference/hooks.html +35 -35
  96. package/dist/docs/reference/http-api.html +35 -35
  97. package/dist/docs/reference/instructions.html +35 -35
  98. package/dist/docs/reference/playground.html +35 -35
  99. package/dist/docs/reference/project-layout.html +35 -35
  100. package/dist/docs/reference/prompt.html +35 -35
  101. package/dist/docs/reference/schedules.html +35 -35
  102. package/dist/docs/reference/sessions.html +35 -35
  103. package/dist/docs/reference/skills.html +35 -35
  104. package/dist/docs/reference/subagents.html +35 -35
  105. package/dist/docs/reference/tools.html +35 -35
  106. package/dist/docs/templates/agentic-owners.html +35 -35
  107. package/dist/docs/templates/pr-autofixer.html +35 -35
  108. package/dist/docs/templates/security-reviewer.html +35 -35
  109. package/dist/docs/templates/thermo-quality-review.html +35 -35
  110. package/dist/docs/templates/thermo-review.html +35 -35
  111. package/dist/docs/templates/triage.html +35 -35
  112. package/dist/docs/troubleshooting.html +35 -35
  113. package/dist/internal/cli-deploy.d.ts.map +1 -1
  114. package/dist/internal/cli-deploy.js +9 -1
  115. package/dist/internal/deploy-client.d.ts +6 -0
  116. package/dist/internal/deploy-client.d.ts.map +1 -1
  117. package/dist/internal/deploy-client.js +3 -0
  118. package/dist/internal/discovery/agent-config.d.ts +3 -1
  119. package/dist/internal/discovery/agent-config.d.ts.map +1 -1
  120. package/dist/internal/discovery/agent-config.js +7 -4
  121. package/dist/internal/framework-storage-selection.d.ts +1 -1
  122. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  123. package/dist/internal/platform-timers.d.ts.map +1 -1
  124. package/dist/internal/platform-timers.js +20 -2
  125. package/dist/internal/reminder-runner.d.ts +79 -1
  126. package/dist/internal/reminder-runner.d.ts.map +1 -1
  127. package/dist/internal/reminder-runner.js +276 -44
  128. package/dist/internal/server.d.ts.map +1 -1
  129. package/dist/internal/server.js +7 -0
  130. package/dist/memory.d.ts +4 -0
  131. package/dist/memory.d.ts.map +1 -1
  132. package/dist/memory.js +28 -4
  133. package/dist/playground/assets/index-DLwnR9ys.css +1 -0
  134. package/dist/playground/index.html +2 -2
  135. package/dist/types.d.ts +16 -9
  136. package/dist/types.d.ts.map +1 -1
  137. package/docs/guides/slack.md +7 -0
  138. package/docs/reference/cli.md +686 -754
  139. package/package.json +1 -1
  140. package/src/channels/slack/inbound.ts +24 -0
  141. package/src/channels/slack/slack-channel.ts +123 -1
  142. package/src/internal/cli-deploy.ts +12 -1
  143. package/src/internal/deploy-client.ts +9 -0
  144. package/src/internal/discovery/agent-config.ts +8 -6
  145. package/src/internal/framework-storage-selection.ts +1 -1
  146. package/src/internal/platform-timers.ts +24 -2
  147. package/src/internal/reminder-runner.ts +426 -63
  148. package/src/internal/server.ts +8 -0
  149. package/src/memory.ts +37 -3
  150. package/src/types.ts +16 -9
  151. package/dist/docs/assets/chunks/@localSearchIndexroot.BnSgidYE.js +0 -1
  152. package/dist/docs/assets/chunks/channel.DdM5EfNW.js +0 -1
  153. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CjfGHeg2.js +0 -1
  154. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CjfGHeg2.js +0 -1
  155. package/dist/docs/assets/chunks/clone.wSOICb_f.js +0 -1
  156. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.Cu5X28zZ.js +0 -1
  157. package/dist/docs/assets/reference_cli.md.DLWDz9ij.js +0 -95
  158. package/dist/docs/assets/reference_cli.md.DLWDz9ij.lean.js +0 -1
  159. package/dist/playground/assets/index-C61EWMBK.css +0 -1
  160. /package/dist/playground/assets/{index-CrMWlgUU.js → index-CX6oTKwz.js} +0 -0
@@ -1,546 +1,502 @@
1
- # CLI reference
2
-
3
- `@cursor/july` installs one command, `agent-sdk`; `npx @cursor/july <cmd>`
4
- runs it. Run the CLI with Node 22.13 or newer. Don't run it with Bun; Bun
5
- corrupts tool-result streams from the Cursor SDK.
6
-
7
- `agent-sdk help` prints the built-in summary. The Slack and GitHub packs
8
- also provide `agent-sdk slack help` and `agent-sdk github help`.
9
-
10
- | Command | Description |
11
- | ------------------------------------------------------- | -------------------------------------------------------------- |
12
- | [`serve`](#serve) | Serve agents over HTTP |
13
- | [`dev`](#dev) | Start local development with `serve --dev` |
14
- | [`chat`](#chat) | Talk to a running agent |
15
- | [`resume`](#resume) | Reattach chat to a previous session |
16
- | [`logs`](#logs) | Follow local or hosted logs |
17
- | [`sessions`](#sessions) | List sessions on a running agent |
18
- | [`session`](#session) | Inspect one session |
19
- | [`cost`](#cost) | Report per-session token usage and estimated cost |
20
- | [`playground`](#playground) | Open the local or hosted playground |
21
- | [`docs`](#docs) | Serve the shipped documentation site locally |
22
- | [`run`](#run) | Run one or more turns locally, remotely, or on a hosted agent |
23
- | [`call`](#call) | Call a server tool without a model turn |
24
- | [`eval`](#eval) | Run filesystem evals |
25
- | [`trajectory`](#trajectory) | Summarize a saved event stream |
26
- | [`init`](#init) | Scaffold a project, or print the setup guide |
27
- | [`convert-automation`](#convert-automation) | Export a Cursor Automation into an agent project |
28
- | [`install-skills`](#install-skills) | Refresh coding-agent skills (`npm install` already copies them) |
29
- | [`info`](#info) | Print the discovered agent surface |
30
- | [`validate`](#validate) | Check a project and fail on errors |
31
- | [`login` / `logout` / `whoami`](#login-logout-whoami) | Manage the host's Cursor credential |
32
- | `version` | Print the installed version and exit (also `--version` / `-V`) |
33
- | [`update`](#update) | Upgrade the installed CLI |
34
- | [`deploy`](#deploy) | Deploy one or more agents to Cursor managed hosting |
35
- | [`deployments`](#deployments) | List hosted deployments |
36
- | [`deployment`](#deployment) | Inspect one hosted deployment |
37
- | [`stop`](#stop) | Stop a hosted deployment |
38
- | [`delete`](#delete) | Delete a hosted deployment |
39
- | [`rotate-token`](#rotate-token) | Replace a deployment's alias token |
40
- | [`secrets`](#secrets) | Manage deployment secrets |
41
- | [`mcp`](#mcp) | Proxy the agent's MCP endpoint over stdio; `mcp install` writes `~/.cursor/mcp.json` |
42
- | [`mcp oauth`](#mcp-oauth) | Authorize host MCP OAuth; optional `--store` to deployment secrets |
43
- | [`slack ...`](#slack) | Provision, set up, and check Slack channels |
44
- | [`github ...`](#github) | Forward, replay, and inspect GitHub webhook channels |
45
-
46
- ## Choose a target
47
-
48
- Request-sending commands support three target types.
49
-
50
- | Target | How to select it | Commands |
1
+ # CLI
2
+
3
+ `@cursor/july` provides the `agent-sdk` command for developing, inspecting,
4
+ testing, and deploying Agent SDK projects. Run it with Node 22.13 or newer;
5
+ Bun isn't supported. Commands exit nonzero when validation or a synchronous
6
+ request fails; asynchronous commands can exit `0` once work is accepted.
7
+
8
+ Use `npx @cursor/july <command>` to run the CLI without a global install.
9
+ `agent-sdk help` prints top-level help; the Slack, GitHub, GitLab, and
10
+ Bitbucket command packs provide their own `help` subcommands.
11
+
12
+ ## Command catalog
13
+
14
+ ### Development commands
15
+
16
+ | Command | Contract |
17
+ | --- | --- |
18
+ | `help`, `--help`, `-h` | Print top-level help |
19
+ | [`serve`](#serve) | Serve one or more agents over HTTP |
20
+ | [`dev`](#dev) | Serve agents with local-development behavior |
21
+ | [`docs`](#docs) | Serve the documentation bundled with `@cursor/july` |
22
+ | [`init`](#init) | Scaffold an Agent SDK project |
23
+ | [`convert-automation`](#convert-automation) | Export a Cursor Automation into a project |
24
+ | [`install-skills`](#install-skills) | Refresh the bundled coding-agent skills |
25
+ | [`info`](#info) | Print the discovered project surface |
26
+ | [`validate`](#validate) | Check project diagnostics and set the exit status |
27
+ | [`manifest`](#manifest) | Print deployment metadata as JSON |
28
+ | [`version`](#version) | Print the installed package version |
29
+ | [`update`](#update) | Upgrade the installed CLI |
30
+ | [`login`](#login-logout-whoami) | Sign the host in to Cursor |
31
+ | [`logout`](#login-logout-whoami) | Remove the stored Cursor credential |
32
+ | [`whoami`](#login-logout-whoami) | Show the active Cursor credential |
33
+
34
+ ### Session and eval commands
35
+
36
+ | Command | Contract |
37
+ | --- | --- |
38
+ | [`chat`](#chat) | Talk to a running agent |
39
+ | [`resume`](#resume) | Reattach chat to a previous session |
40
+ | [`run`](#run) | Start or continue work on a local, running, or managed agent |
41
+ | [`call`](#call) | Call a server tool without a model turn |
42
+ | [`skill`](#skill) | Read an authored skill without a model turn |
43
+ | [`logs`](#logs) | Follow or dump agent logs |
44
+ | [`sessions`](#sessions) | List sessions |
45
+ | [`session`](#session) | Inspect a session or start a managed session turn |
46
+ | [`cost`](#cost) | Report token usage and estimated cost |
47
+ | [`playground`](#playground) | Open an agent's playground |
48
+ | [`trajectory`](#trajectory) | Summarize a saved event stream |
49
+ | [`eval`](#eval) | List, run, inspect, or cancel evals |
50
+
51
+ ### Managed hosting commands
52
+
53
+ | Command | Contract |
54
+ | --- | --- |
55
+ | [`deploy`](#deploy) | Deploy one or more agents |
56
+ | [`deployments`](#deployments) | List deployments |
57
+ | [`deployment`](#deployment) | Inspect one deployment |
58
+ | [`stop`](#stop) | Stop a deployment |
59
+ | [`cancel-runs`](#cancel-runs) | Cancel active runs and reminder wakes |
60
+ | [`event-repos`](#event-repos) | Replace a managed application's event repositories |
61
+ | [`upgrade`](#upgrade) | Move a managed application to a release |
62
+ | [`delete`](#delete) | Delete a deployment |
63
+ | [`rotate-token`](#rotate-token) | Replace a deployment's alias token |
64
+ | [`secrets`](#secrets) | Set, list, or remove deployment secrets |
65
+
66
+ ### Connection and channel commands
67
+
68
+ | Command | Contract |
69
+ | --- | --- |
70
+ | [`mcp`](#mcp) | Proxy an agent's MCP endpoint over stdio |
71
+ | [`mcp install`](#mcp) | Add the agent to an MCP client config |
72
+ | [`mcp oauth`](#mcp-oauth) | Authorize an MCP connection |
73
+ | [`slack`](#slack) | Provision and check Slack channel apps |
74
+ | [`github`](#github) | Forward, replay, and inspect GitHub webhooks |
75
+ | [`gitlab`](#gitlab) | Replay and inspect GitLab webhooks |
76
+ | [`bitbucket`](#bitbucket) | Replay and inspect Bitbucket webhooks |
77
+
78
+ ## Targets {#choose-a-target}
79
+
80
+ Commands that send requests support these targets:
81
+
82
+ | Target | Selection | Commands |
51
83
  | --- | --- | --- |
52
- | Ephemeral local server | Omit `--url` and `--prod` | `run`, `call`, `eval` |
53
- | Running server | Pass `--url <baseUrl>`, unless the command uses the localhost default described next | `chat`, `resume`, `logs`, `sessions`, `session`, `cost`, `playground`, `run`, `call`, `eval`, `mcp` |
54
- | Cursor managed hosting | Pass `--prod` | `chat`, `resume`, `logs`, `sessions`, `session`, `cost`, `playground`, `run`, `call`, `eval`, `mcp` |
55
-
56
- `chat`, `logs`, `sessions`, `session`, `cost`, and `playground` default to
57
- `http://127.0.0.1:3000`. A `--url` must include the agent slug for a
58
- multi-agent server, such as `http://127.0.0.1:3000/pr-approver`.
59
- `--slug` doesn't change an explicit URL. `mcp` has no default target;
60
- pass `--url` or `--prod`.
61
-
62
- With `--prod`, `--slug` selects the deployment and `--team` selects the
63
- Cursor team. The slug defaults to the `--dir` basename. The team
64
- defaults to the signed-in account's team. `--url` and `--prod` are
65
- mutually exclusive.
66
-
67
- Use `--bearer-token <token>` when a running server requires bearer
68
- authentication. Hosted commands use your Cursor credential to request
69
- short-lived engine access. `--api-key` overrides the Cursor credential
70
- for `login`, `serve`, hosted targets, and managed-hosting commands.
71
- `--state-root` applies to `serve` and ephemeral `run`, `call`, and
72
- `eval` servers. Running and hosted targets ignore it.
73
-
74
- For ephemeral `run`, `call`, and `eval` commands, omitting `--slug`
75
- selects an unslugged root mount when one exists. Otherwise, the Agent SDK
76
- selects the first discovered agent.
77
-
78
- ## serve
79
-
80
- `serve` hosts every agent under `--dir` in multi-agent mode by default.
81
-
82
- ```bash
83
- agent-sdk serve [--dir <path>] [--port 3000] [--host 127.0.0.1] [--dev]
84
- [--mode multi|single] [--api-key <key>]
85
- [--state-root <path>] [--bearer-token <secret> | --allow-anonymous]
86
- [--allow-anonymous-cursor-github]
87
- [--allow-anonymous-cursor-account-mcp]
88
- [--public-url <url>] [--cloud-tools-url <url>]
89
- [--no-schedules] [--no-playground]
90
- [--no-docs] [--cursor-events --repo owner/name]...
91
- ```
92
-
93
- If `--dir` is an agent project, it mounts under its directory name. If
94
- it contains agent projects, each child mounts separately. The index
95
- lives at `/`. Each agent is available at `/<slug>/v1/*` and
96
- `/<slug>/playground`. On a TTY, press Enter to restart.
97
- Unless `--state-root` is set, each mount uses a state directory under
98
- the agent project. Slugged mounts get a subdirectory named for the slug.
99
-
100
- | Flag | Meaning |
84
+ | Ephemeral local server | Omit `--url` and `--prod` | `run`, `call`, `skill`, `eval` |
85
+ | Running server | Pass `--url <baseUrl>` | `chat`, `resume`, `run`, `call`, `skill`, `eval`, `logs`, `sessions`, `session`, `cost`, `playground`, `mcp` |
86
+ | Default local server | Omit `--url` and `--prod`; uses `http://127.0.0.1:3000` | `chat`, `resume`, `logs`, `sessions`, `session`, `cost`, `playground` |
87
+ | Hosted deployment | Pass `--prod` | `chat`, `resume`, `run`, `call`, `skill`, `eval`, `logs`, `sessions`, `session`, `cost`, `playground`, `mcp` |
88
+ | Managed application | Pass `--prod` | `run`, `session` |
89
+
90
+ An explicit `--url` must include the slug for a multi-agent server, such as
91
+ `http://127.0.0.1:3000/pr-approver`. `--slug` never changes an explicit URL.
92
+ `--url` and `--prod` are mutually exclusive.
93
+
94
+ | Option | Contract |
95
+ | --- | --- |
96
+ | `--dir <path>` | Select the project root. The default is the current directory. |
97
+ | `--url <baseUrl>` | Use a running agent instead of local project discovery. |
98
+ | `--prod` | Use a hosted deployment or managed application. Command support depends on the target type as listed above. |
99
+ | `--slug <slug>` | Select an agent from a multi-agent project or a hosted resource. Under `--prod`, the default is the `--dir` basename. |
100
+ | `--team <id>` | Select a Cursor team. The signed-in account's team is the default. |
101
+ | `--api-key <key>` | Override the Cursor credential for commands that authenticate with Cursor. |
102
+ | `--bearer-token <token>` | Authenticate to a running server with a bearer token. |
103
+ | `--state-root <path>` | Select local state for `serve` and ephemeral `run`, `call`, `skill`, and `eval` targets. Running and `--prod` targets ignore it. |
104
+ | `--json` | Request machine-readable output when the command supports it. `run` already defaults to JSON. |
105
+
106
+ ## Local servers
107
+
108
+ ### Serve agents {#serve}
109
+
110
+ `serve` mounts every project discovered under `--dir`:
111
+
112
+ ```bash
113
+ agent-sdk serve [--dir <path>] [--port <n>] [--host <host>]
114
+ [--mode multi|single] [--dev] [--api-key <key>]
115
+ [--state-root <path>]
116
+ [--bearer-token <secret> | --allow-anonymous]
117
+ [--allow-anonymous-cursor-github]
118
+ [--allow-anonymous-cursor-account-mcp]
119
+ [--public-url <url>] [--cloud-tools-url <url>]
120
+ [--no-schedules] [--no-playground] [--no-docs]
121
+ [--cursor-events --repo <owner/name>]...
122
+ ```
123
+
124
+ | Option | Contract |
101
125
  | --- | --- |
102
- | `--port` | Listen on this port. `0` selects an available port. The default is `3000`. When the default is taken, serve tries the next free port and prints a notice; an explicit `--port` fails with a next-port hint instead. |
103
- | `--host` | Bind this host. The default is loopback-only `127.0.0.1`. |
104
- | `--dev` | Disable automatic schedule and reminder firing, admit unsigned loopback GitHub deliveries, and widen playground session access on loopback. |
105
- | `--mode` | Use `multi` for slugged routes and an index, or `single` for one agent at the unslugged `/v1/*`. The default is `multi`. |
106
- | `--api-key` | Use this Cursor API key. Otherwise the command uses `CURSOR_API_KEY`, then `CURSOR_API_KEY_FILE` (hosted default `/run/cursor/secrets/CURSOR_API_KEY` when unset), then `CURSOR_SERVICE_ACCOUNT_KEY`, then the stored login. |
107
- | `--state-root` | Store sessions, streams, workspaces, and channel state here. Keep durable production state outside the agent repository. |
108
- | `--bearer-token` | Require this bearer token on routes without authored auth. Mutually exclusive with `--allow-anonymous`. |
109
- | `--allow-anonymous` | Admit every caller as one `anonymous` principal. Use only behind a trusted network boundary. |
110
- | `--allow-anonymous-cursor-github` | Allow anonymous callers to drive sessions holding a Cursor account's repo-scoped GitHub credential. Use only behind an authenticating proxy. |
111
- | `--allow-anonymous-cursor-account-mcp` | Allow anonymous callers to drive Cursor account MCP connectors (`defineConnection({ cursorAccount: true })`). Use only behind an authenticating proxy (hosted alias token counts). |
112
- | `--public-url` | Set the externally reachable host URL. Cloud-runtime peer connections need it to call back into this server. |
113
- | `--cloud-tools-url` | Authenticated HTTP MCP URL for this deployment's direct server-tool endpoint. Hosted deployments configure it automatically. |
114
- | `--no-schedules` | Disable the cron runner outside dev mode. |
115
- | `--no-playground` | Skip the web playground. |
126
+ | `--port <n>` | Listen on this port. The default is `3000`; `0` selects an available port. When an omitted default is occupied, the CLI selects the next port. An occupied explicit port fails with a next-port hint. |
127
+ | `--host <host>` | Bind this host. The default is loopback-only `127.0.0.1`. |
128
+ | `--mode multi` | Mount projects at `/<slug>/v1/*` and `/<slug>/playground`, with an index at `/`. This is the default. |
129
+ | `--mode single` | Mount one project at `/v1/*` and `/playground`. |
130
+ | `--dev` | Disable automatic schedule and reminder firing, admit unsigned loopback GitHub deliveries, and enable local playground access. |
131
+ | `--state-root <path>` | Store local sessions, streams, workspaces, and channel state here. Keep durable state outside a repository whose rules shouldn't reach agent workspaces. |
132
+ | `--bearer-token <secret>` | Require this token on routes without authored authentication. Mutually exclusive with `--allow-anonymous`. |
133
+ | `--allow-anonymous` | Admit callers as one anonymous principal. Use it only behind a trusted network boundary. |
134
+ | `--allow-anonymous-cursor-github` | Let anonymous callers use sessions with a Cursor account's repository-scoped GitHub credential. Requires an authenticating proxy. |
135
+ | `--allow-anonymous-cursor-account-mcp` | Let anonymous callers use Cursor account MCP connections. Requires an authenticating proxy. |
136
+ | `--public-url <url>` | Publish the externally reachable host URL for peer-agent callbacks. |
137
+ | `--cloud-tools-url <url>` | Publish the authenticated server-tool MCP URL used by cloud turns. Managed hosting sets it automatically. |
138
+ | `--no-schedules` | Disable schedule firing outside dev mode. |
139
+ | `--no-playground` | Skip the playground. |
116
140
  | `--no-docs` | Skip the documentation site at `/docs`. |
117
- | `--cursor-events` | Pull SCM events from Cursor in addition to authored webhook routes. Requires a signed-in host. Pass repeatable `--repo owner/name` values; repos declared by `githubChannel({ cursorAccount })` also enable it. |
141
+ | `--cursor-events` | Receive SCM events through Cursor. Requires sign-in and one or more repeatable `--repo owner/name` values. |
118
142
 
119
- Multi-agent slugs must start with a letter or digit, then contain only
120
- letters, digits, `_`, or `-`. The reserved slugs are `v1`, `playground`,
121
- and `docs`.
143
+ Multi-agent slugs start with a letter or digit and contain only letters,
144
+ digits, `_`, or `-`. The reserved slugs are `v1`, `playground`, and `docs`.
122
145
 
123
- ## dev
146
+ ### Develop locally {#dev}
124
147
 
125
- `dev` is the local-development shortcut for `serve --dev`. Pass the
126
- agent folder as a positional path, or run it from inside the project:
148
+ `dev` is `serve --dev` with an optional positional project path:
127
149
 
128
150
  ```bash
129
151
  agent-sdk dev
130
- agent-sdk dev ./sdk-pr-reviewer
131
152
  agent-sdk dev ./sdk-pr-reviewer --port 3000
132
153
  ```
133
154
 
134
- `dev` accepts the same flags as [`serve`](#serve). You can use `--dir`
135
- instead of the positional path.
136
- Dev mode is always on: schedules and reminders wait for manual dispatch,
137
- and GitHub accepts unsigned loopback deliveries. Prefer this over
138
- `serve --dev` while iterating. Pass at most one positional path. Don't
139
- combine a positional path with a different `--dir`.
140
-
141
- ## chat
155
+ It accepts every `serve` option. Pass at most one positional path, and don't
156
+ combine it with a different `--dir`.
142
157
 
143
- `chat` talks to a running agent from the terminal. It never starts a
144
- server.
158
+ ### Serve the docs {#docs}
145
159
 
146
160
  ```bash
147
- agent-sdk chat --url http://127.0.0.1:3000/pr-approver
148
- agent-sdk chat --message "Is the PR ready to approve?"
149
- agent-sdk chat --message "Inspect PR 42" --json
150
- agent-sdk chat --prod --slug pr-approver --team 123
161
+ npx @cursor/july docs
162
+ agent-sdk docs [--port <n>] [--host 127.0.0.1] [--print]
151
163
  ```
152
164
 
153
- `chat` streams text, tool calls, and a per-turn usage footer.
154
- On a TTY, `--message` seeds the interactive REPL. With non-TTY input,
155
- `--message` runs one turn and exits; without it, `chat` reads
156
- newline-delimited messages until EOF. `--json` requires `--message`,
157
- runs one turn, and prints
158
- `{ ok, sessionId, continuationToken, trajectory }`. `--text` prints a
159
- compact trajectory when combined with `--json`. `--no-color` forces
160
- plain interactive output.
165
+ `docs` serves the bundled documentation without an agent project. It uses an
166
+ available loopback port by default and stays open until Ctrl-C. `--print`
167
+ prints the URL without opening a browser.
161
168
 
162
- Use `--session <id>` to reattach a stored session. The command looks up
163
- its continuation token when you omit `--continuation-token`. Use
164
- `--resume` to select the most recently updated session with a
165
- continuation token.
169
+ ## Sessions and turns
166
170
 
167
- ## resume
171
+ ### Chat with an agent {#chat}
168
172
 
169
- `resume` is the direct way to reattach the chat REPL.
173
+ `chat` connects to a running server and never starts an ephemeral one:
170
174
 
171
175
  ```bash
172
- agent-sdk resume ses_123 --url http://127.0.0.1:3000/pr-approver
173
- agent-sdk resume --url http://127.0.0.1:3000/pr-approver
174
- agent-sdk resume ses_123 --prod --team 123 --slug pr-approver
175
- agent-sdk resume ses_123 --message "Continue the review" --json
176
+ agent-sdk chat [--url <baseUrl> | --prod] [--message <text>]
177
+ [--session <id> | --resume] [--continuation-token <token>]
178
+ [--slug <slug>] [--team <id>] [--json] [--text] [--no-color]
176
179
  ```
177
180
 
178
- Pass a session ID to select it. Omit the ID to select the most recently
179
- updated followable session from `/v1/sessions`. The command looks up a
180
- missing continuation token, replays the transcript, and accepts
181
- follow-ups. `resume --json` requires `--message`. The same operation is
182
- available as `chat --session <id>` or `chat --resume`.
181
+ | Input mode | Behavior |
182
+ | --- | --- |
183
+ | TTY without `--message` | Open an interactive REPL. |
184
+ | TTY with `--message` | Send the message, then keep the REPL open. |
185
+ | Non-TTY with `--message` | Send one turn and exit. |
186
+ | Non-TTY without `--message` | Read newline-delimited messages until EOF. |
187
+ | `--json --message <text>` | Send one turn and print `{ ok, sessionId, continuationToken, trajectory }`. |
188
+ | `--json --text --message <text>` | Print a compact trajectory instead of JSON. |
189
+
190
+ Use `--session <id>` to reattach a stored session. If you omit
191
+ `--continuation-token`, the CLI looks it up from the target's session list.
192
+ `--resume` selects the most recently updated session with a continuation
193
+ token. An explicit session ID takes precedence.
183
194
 
184
- ## logs
195
+ ### Resume a session {#resume}
185
196
 
186
- `logs` follows the local or hosted log buffer.
197
+ `resume` provides the same reattachment contract as `chat --session`:
187
198
 
188
199
  ```bash
189
- agent-sdk logs [--url http://127.0.0.1:3000] [--once] [--json]
190
- agent-sdk logs --prod [--slug <slug>] [--team <id>] [--once] [--json]
200
+ agent-sdk resume [sessionId] [--url <baseUrl> | --prod]
201
+ [--message <text>] [--json] [--text]
202
+ [--continuation-token <token>] [--slug <slug>] [--team <id>]
191
203
  ```
192
204
 
193
- Local mode reads `/v1/logs` from the running server. Hosted mode reports
194
- deploy progress until the deployment is running or degraded, then
195
- follows reachable runtime logs.
196
- The command follows until Ctrl-C by default. `--once` prints the current
197
- buffer and exits. `--json` emits newline-delimited JSON events.
205
+ Omit the session ID to select the most recently updated followable session.
206
+ The command replays the transcript before accepting follow-ups.
207
+ `resume --json` requires `--message`.
198
208
 
199
- ## sessions
209
+ ### Run turns {#run}
200
210
 
201
- `sessions` lists sessions on a running or hosted agent.
211
+ `run` sends messages to an ephemeral, running, or `--prod` target:
202
212
 
203
213
  ```bash
204
- agent-sdk sessions [--url <baseUrl> | --prod] [--slug <slug>]
205
- [--team <id>] [--bearer-token <token>] [--json]
214
+ agent-sdk run [--dir <path>] [--message <text>]...
215
+ [--messages-file <path>] [--url <baseUrl> | --prod]
216
+ [--session <id>] [--continuation-token <token>]
217
+ [--events <file> | --no-events] [--text]
218
+ [--timeout-ms <n>] [--no-stream] [--slug <slug>] [--team <id>]
219
+ [--dry-run] [--as-of <instant>] [--component <key>]
206
220
  ```
207
221
 
208
- Text output shows session ID, channel, mode, turn count, running status,
209
- and update time. `--json` prints full session summaries in
210
- `{ sessions }`, including continuation tokens.
222
+ | Option | Contract |
223
+ | --- | --- |
224
+ | `--message <text>` | Send a user message. Repeat it for a multi-turn local or `--url` run. Managed starts accept one message. |
225
+ | `--messages-file <path>` | Read a JSON array of strings. File messages run before repeated `--message` values. |
226
+ | `--session <id>` | Continue a session. Managed session starts accept a hosted `ses_...` ID. |
227
+ | `--continuation-token <token>` | Continue the session selected by `--session` on a running server. Managed session starts use `--session` instead. |
228
+ | `--events <file>` | Write the raw NDJSON stream to this path. |
229
+ | `--no-events` | Skip the NDJSON trace. |
230
+ | `--text` | Print a compact trajectory instead of JSON. |
231
+ | `--timeout-ms <n>` | Stop waiting after a positive number of milliseconds. There is no default timeout. |
232
+ | `--no-stream` | Hide live tool and reply progress on stderr. |
233
+ | `--dry-run` | Mark a managed session turn as non-mutating. |
234
+ | `--as-of <instant>` | Freeze a managed session's clock at a timezone-bearing ISO-8601 instant. |
235
+ | `--component <key>` | Select a managed application's component instead of its default. |
236
+
237
+ For local and running-server targets, JSON output contains `ok`, `sessionId`,
238
+ `continuationToken`, `trace`, `playgroundUrl`, `playgroundHint`, `visualize`,
239
+ and `trajectory`. The `trace` value gives the saved path when event output is
240
+ enabled. A managed session start confirms acceptance; a continuation also
241
+ returns `sessionId`. Managed starts return before the turn finishes and ignore
242
+ `--events`, `--no-events`, `--text`, `--timeout-ms`, and `--no-stream`.
243
+ A successful managed start exits `0` on acceptance, before its turn outcome is
244
+ known. A fresh start doesn't return `sessionId` synchronously.
211
245
 
212
- ## session
246
+ ### Call a tool {#call}
213
247
 
214
- `session` inspects the event stream for one session.
248
+ `call` invokes a server tool without a model turn:
215
249
 
216
250
  ```bash
217
- agent-sdk session <sessionId> [--url <baseUrl> | --prod]
218
- [--slug <slug>] [--team <id>]
219
- [--json | --text | --events] [--out <file.ndjson>]
251
+ agent-sdk call <tool> [--input <json>]
252
+ [--dir <path> | --url <baseUrl> | --prod]
253
+ [--session <id>] [--slug <slug>] [--team <id>]
220
254
  ```
221
255
 
222
- By default, `session` prints a compact trajectory. `--text` selects the
223
- same format. `--json` prints the trajectory object. `--events` prints
224
- `{ sessionId, events }` with the raw event list. You can't combine
225
- `--events` and `--json`. `--out <file.ndjson>` writes the raw NDJSON
226
- trace to a file instead of printing. The file uses the same format as
227
- `run --events` and the playground download. Use
228
- [`resume`](#resume) to continue the conversation.
256
+ `--input` accepts JSON and defaults to `{}`. `--session` uses the session
257
+ workspace and records the call on its event stream. The command prints the
258
+ server's JSON response and succeeds only when the HTTP response succeeds with
259
+ `ok: true`.
260
+
261
+ See [Tools](/docs/reference/tools.md#call-a-tool-without-a-model-turn) for validation,
262
+ busy-session behavior, and error codes.
229
263
 
230
- ## cost
264
+ ### Read a skill {#skill}
231
265
 
232
- `cost` reports token usage and estimated cost.
266
+ `skill` reads an authored skill without a model turn:
233
267
 
234
268
  ```bash
235
- agent-sdk cost [sessionId] [--url <baseUrl> | --prod]
236
- [--slug <slug>] [--team <id>] [--json]
269
+ agent-sdk skill <name> [--dir <path> | --url <baseUrl> | --prod]
270
+ [--slug <slug>] [--team <id>] [--text]
237
271
  ```
238
272
 
239
- With a session ID, `cost` prints per-turn token usage and estimated
240
- cost for that session. Without one, it prints one row per session on
241
- the target plus a total. Costs are the engine's recorded estimates from
242
- `turn.completed` events; turns persisted before cost tracking count as
243
- unpriced. `--json` prints the underlying report, or `{ sessions }` when
244
- aggregating. Like `session`, the command supports `--dir`,
245
- `--bearer-token`, and the `--url`/`--prod` targets, and defaults to the
246
- local server.
247
-
248
- ## playground
273
+ The default output is the server's JSON response. `--text` prints the rendered
274
+ `SKILL.md` content.
249
275
 
250
- `playground` opens an agent's web playground.
276
+ ### List sessions {#sessions}
251
277
 
252
278
  ```bash
253
- agent-sdk playground [--url <baseUrl> | --prod] [--session <id>]
254
- [--slug <slug>] [--team <id>]
255
- [--bearer-token <token>] [--print]
279
+ agent-sdk sessions [--url <baseUrl> | --prod]
280
+ [--slug <slug>] [--team <id>] [--bearer-token <token>] [--json]
256
281
  ```
257
282
 
258
- `--session` opens a deep link to one session. `--print` prints the URL
259
- without opening a browser.
283
+ Text output shows the session ID, channel, mode, turn count, running status,
284
+ and update time. `--json` prints `{ sessions }`, including continuation
285
+ tokens.
260
286
 
261
- For an unauthenticated local URL, `playground` opens the browser and
262
- exits. `--prod` and `--bearer-token` start a loopback proxy to inject
263
- browser-inaccessible credentials. The proxy stays open until Ctrl-C,
264
- including when you pass `--print`.
287
+ ### Inspect a session {#session}
265
288
 
266
- ## docs
289
+ ```bash
290
+ agent-sdk session <sessionId> [--url <baseUrl> | --prod]
291
+ [--slug <slug>] [--team <id>]
292
+ [--json | --text | --events] [--out <file.ndjson>]
293
+
294
+ agent-sdk session --prod [<sessionId>] --slug <slug> --message <text>
295
+ [--dry-run] [--as-of <instant>] [--component <key>]
296
+ ```
297
+
298
+ | Option | Contract |
299
+ | --- | --- |
300
+ | No output option | Print a compact trajectory. |
301
+ | `--text` | Select the compact trajectory explicitly. |
302
+ | `--json` | Print the trajectory object. |
303
+ | `--events` | Print `{ sessionId, events }` with the raw event list. |
304
+ | `--out <file.ndjson>` | Write the raw NDJSON trace instead of printing it. |
305
+ | `--prod --message <text>` | Start a managed session or continue the supplied managed session ID. |
267
306
 
268
- `docs` serves the documentation shipped inside `@cursor/july` and opens
269
- it in a browser. You don't need an agent project.
307
+ `--events` and `--json` are mutually exclusive. Managed sessions without an
308
+ event trajectory return hosted execution status and logs in text or JSON;
309
+ `--events` and `--out` require an event trajectory. Use [`resume`](#resume) to
310
+ continue a conversational session.
311
+
312
+ ### Follow logs {#logs}
270
313
 
271
314
  ```bash
272
- npx @cursor/july docs
273
- agent-sdk docs [--port <n>] [--host 127.0.0.1] [--print]
315
+ agent-sdk logs [--url <baseUrl> | --prod]
316
+ [--slug <slug>] [--team <id>] [--once] [--json]
274
317
  ```
275
318
 
276
- The site is the same documentation mounted at `/docs` on a running
277
- `serve` host. `docs` starts a loopback-only static server (default port
278
- is an ephemeral port) and keeps it open until Ctrl-C. `--print` prints
279
- the URL without opening a browser.
280
-
281
- ## run
319
+ The command follows logs until Ctrl-C. `--once` prints the current buffer and
320
+ exits; `--json` emits newline-delimited JSON events. A hosted deployment
321
+ reports deployment progress before runtime logs become available.
282
322
 
283
- `run` sends one or more turns and prints a JSON result.
323
+ ### Report costs {#cost}
284
324
 
285
325
  ```bash
286
- agent-sdk run --dir . --message "Is https://github.com/acme/checkout/pull/42 ready?"
287
- agent-sdk run --dir . --message "Inspect PR 42" --message "Summarize the risks"
288
- agent-sdk run --url http://127.0.0.1:3000/pr-approver --message "Inspect PR 42"
289
- agent-sdk run --prod --slug pr-approver --team 123 --message "Inspect PR 42"
290
- agent-sdk run --dir . --messages-file ./prompts.json
326
+ agent-sdk cost [sessionId] [--url <baseUrl> | --prod]
327
+ [--slug <slug>] [--team <id>] [--json]
291
328
  ```
292
329
 
293
- Without `--url` or `--prod`, the command starts an ephemeral server on
294
- an available port. Its state root is a temporary directory outside the
295
- project unless you pass `--state-root`. The command closes the server
296
- after the turns finish.
330
+ With a session ID, `cost` prints per-turn token usage and estimated cost.
331
+ Without one, it prints one row per session and a total. Turns saved before
332
+ cost tracking appear as unpriced. `--json` prints the underlying report or
333
+ `{ sessions }` for an aggregate.
297
334
 
298
- | Flag | Meaning |
299
- | --- | --- |
300
- | `--message <text>` | Send a user message. Repeat the flag for a multi-turn run. |
301
- | `--messages-file <path>` | Read a JSON array of strings. File messages run before repeated `--message` values. |
302
- | `--session <id>` | Follow up an existing session. Unlike `chat`, `run` doesn't look up a missing continuation token. |
303
- | `--continuation-token <token>` | Continue the existing session selected by `--session`. |
304
- | `--events <file>` | Write the raw NDJSON event stream to this path. |
305
- | `--no-events` | Don't write an event stream. |
306
- | `--text` | Print a compact trajectory instead of the JSON result. |
307
- | `--timeout-ms <n>` | Abort the turn after a positive number of milliseconds. There is no default timeout. |
308
- | `--no-stream` | Hide live tool and reply progress on stderr. Progress is on by default when stderr is a TTY. |
309
- | `--slug <slug>` | Pick one agent when local discovery mounts several agents. With `--prod`, select the hosted deployment. |
310
-
311
- The default trace path is
312
- `<state-root>/traces/<sessionId>.ndjson`. JSON output contains
313
- `ok`, `sessionId`, `continuationToken`, `trace`, `playgroundUrl`,
314
- `playgroundHint`, `visualize`, and `trajectory`. The command exits
315
- non-zero when the trajectory fails.
316
-
317
- ## call
318
-
319
- `call` invokes a server tool directly, with no model turn.
320
-
321
- ```bash
322
- agent-sdk call inspect_pr --dir . \
323
- --input '{"prUrl":"https://github.com/acme/checkout/pull/42"}'
324
- agent-sdk call inspect_pr --url http://127.0.0.1:3000/pr-approver \
325
- --input '{"prUrl":"https://github.com/acme/checkout/pull/42"}'
326
- agent-sdk call refresh_cache --url http://127.0.0.1:3000/pr-approver \
327
- --session ses_123
328
- agent-sdk call inspect_pr --prod --slug pr-approver --team 123 --input '{}'
329
- ```
330
-
331
- `call` sends `POST /v1/tools/:toolName` and runs the tool in the serving
332
- process without a model turn. `--input` accepts any valid JSON and
333
- defaults to `{}`. Tools with a Zod input schema validate and transform
334
- the value before execution. A local call needs no inference credential.
335
- A hosted call still needs Cursor credentials to reach the deployment.
336
-
337
- `--session` runs the tool inside an existing session and records it on
338
- the event stream. If a model turn is active or pending, a read-effect
339
- tool runs alongside it and a write-effect tool gets `session_busy`;
340
- retry after the turn finishes. The command
341
- prints the server's JSON response and exits non-zero unless the HTTP
342
- response succeeds with `ok: true`. See
343
- [Tools](/docs/reference/tools.md#call-a-tool-without-a-model-turn).
344
-
345
- ## eval
346
-
347
- `eval` runs the project's filesystem evals.
348
-
349
- ```bash
350
- agent-sdk eval --dir . --list # discovered datapoints
351
- agent-sdk eval --dir . # run all
352
- agent-sdk eval --dir . builds/checkout # one datapoint
353
- agent-sdk eval --dir . builds # every datapoint in the file
354
- agent-sdk eval --dir . --tag smoke # by tag (repeatable)
355
- agent-sdk eval --dir . --json # machine-readable results
356
- agent-sdk eval --dir . --verbose # stream t.log lines + reply snippets
357
- agent-sdk eval --prod --slug pr-approver --team 123
358
- # prints Eval ID immediately on --prod/--url; then:
359
- agent-sdk eval status <evalId> --prod --slug pr-approver
360
- agent-sdk eval cancel <evalId> --prod --slug pr-approver
361
- ```
362
-
363
- `eval` runs `evals/**/*.eval.{ts,js}` on an ephemeral server. With
364
- `--prod` or `--url`, the target server runs its own evals as a
365
- server-side batch. Select one or more exact case IDs, file ID prefixes,
366
- or tags.
367
- Omit selectors to run all cases. Repeated `--tag` flags use OR matching.
368
-
369
- An eval run requires `evals/evals.config.{ts,js}` with `maxConcurrency`
370
- between 1 and 200. Timeout priority is the case's `timeoutMs`, the CLI's
371
- `--timeout-ms`, the config's `timeoutMs`, then 180 seconds.
372
-
373
- | Flag | Meaning |
374
- | --- | --- |
375
- | `--list` | Print discovered cases without running. `--list --json` prints them as an array. |
376
- | `--tag <tag>` | Run cases with this tag. Repeated flags use OR matching. |
377
- | `--json` | Print `{ ok, passed, failed, scored, skipped, strict, results }`; see [Run evals in CI](/docs/evals.md#run-evals-in-ci) for the result shape. |
378
- | `--verbose` | Stream `t.log` lines and reply snippets. |
379
- | `--no-stream` | Hide live progress on stderr. |
380
- | `--strict` | Exit `1` when a scored case misses a soft threshold. |
381
- | `--max-concurrency <n>` | Override `maxConcurrency` from `evals.config.ts`. |
382
- | `--junit <path>` | Write JUnit XML for CI annotations. |
383
- | `--artifacts <dir>` | Write run artifacts here. The default is a timestamped directory under `evals/` in the project state directory (not affected by `--state-root`). |
384
- | `--no-artifacts` | Skip run artifacts. |
385
- | `--skip-report` | Ignore reporters from `evals.config.ts` and eval files. |
386
- | `--out <path>` | Also write the full results JSON to this path (also for `eval status <evalId>`). |
387
- | `--no-wait` | Return with the Eval ID as soon as a `--prod` or `--url` batch is accepted. |
388
- | `--timeout-ms <n>` | Per-case timeout override. |
335
+ ### Open the playground {#playground}
389
336
 
390
- Failed cases exit `1`. A scored case also exits `1` under `--strict`.
391
- No matching cases exit `2`. `eval status` exits `3` while the remote batch
392
- is still running.
337
+ ```bash
338
+ agent-sdk playground [--url <baseUrl> | --prod] [--session <id>]
339
+ [--slug <slug>] [--team <id>] [--bearer-token <token>] [--print]
340
+ ```
393
341
 
394
- ## trajectory
342
+ The command prints the playground URL and opens it unless `--print` is set.
343
+ `--session` opens a deep link. A running target with credentials that a
344
+ browser can't send starts a loopback proxy and stays open until Ctrl-C.
395
345
 
396
- `trajectory` summarizes a saved event stream.
346
+ ### Inspect a trajectory {#trajectory}
397
347
 
398
348
  ```bash
399
- agent-sdk trajectory --events /tmp/run.ndjson [--text]
349
+ agent-sdk trajectory --events <file.ndjson> [--text]
400
350
  ```
401
351
 
402
- `trajectory` converts a saved NDJSON stream into the trajectory JSON
403
- returned by `run`. `--text` prints the compact view. The command exits
404
- non-zero when the reconstructed trajectory failed.
352
+ The command converts an NDJSON stream into the trajectory JSON returned by
353
+ `run`. `--text` prints the compact view.
405
354
 
406
- ## init
355
+ ## Evals
407
356
 
408
- `init` scaffolds a new project.
357
+ ### Run evals {#eval}
358
+
359
+ `eval` discovers `evals/**/*.eval.{ts,js}` and runs selected cases:
409
360
 
410
361
  ```bash
411
- agent-sdk init ./my-agent # scaffold package.json, tsconfig.json, agent/ + a demo tool
412
- agent-sdk init ./my-demo --template demo # record a PR walkthrough
413
- agent-sdk init ./grokbot --template grokbot-agents # talk to Grok Bot agents
414
- agent-sdk init ./code-wiki --template code-wiki # keep wiki pages current after merge
415
- agent-sdk init ./agents-md --template agents-md # keep AGENTS.md current from last week's PRs and Slack
416
- agent-sdk init ./my-reviewer --template security-reviewer # review PRs for security bugs
417
- agent-sdk init ./thermo-review --template thermo-review # review PRs for bugs and breakage
418
- agent-sdk init ./thermo-quality --template thermo-quality-review # review PRs for code quality
419
- agent-sdk init ./security-help --template security-help # answer security questions in Slack
420
- agent-sdk init ./my-triage --template triage-linear # comment on Linear issues
421
- agent-sdk init ./my-triage --template triage-jira # comment on Jira issues
422
- agent-sdk init ./my-owners --template agentic-owners # review PRs via owners policies
423
- agent-sdk init ./pr-autofixer --template pr-autofixer # fix PRs on a cloud VM
424
- agent-sdk init ./pr-autofixer --template pr-autofixer \
425
- --var repos=acme/widgets,acme/api --json
426
- agent-sdk init ./my-agent --json # machine-readable summary for tooling
427
- agent-sdk init # no directory: print the setup guide
362
+ agent-sdk eval [--dir <path>] [evalId...]
363
+ [--list] [--tag <tag>]... [--json] [--verbose]
364
+ [--timeout-ms <n>] [--strict] [--max-concurrency <n>]
365
+ [--junit <path>] [--artifacts <dir> | --no-artifacts]
366
+ [--skip-report] [--out <file.json>] [--no-stream]
367
+ [--url <baseUrl> | --prod] [--no-wait]
368
+ [--slug <slug>] [--team <id>]
428
369
  ```
429
370
 
430
- `init` leaves existing files unchanged and labels each one `create` or
431
- `exist`. It prints the project path, then runs `npm install` so
432
- `@cursor/july` resolves for `dev` and `run`.
371
+ Select an exact case such as `weather/nyc`, a file prefix such as `weather`,
372
+ several IDs, or no IDs for every case. Repeat `--tag` for OR matching.
373
+ Projects must provide `evals/evals.config.{ts,js}` with `maxConcurrency`
374
+ between 1 and 200.
433
375
 
434
- Templates may ship `init.json`. On a TTY, `init` asks those questions
435
- before writing files. `code-wiki`, `pr-autofixer`, `security-help`, and
436
- `agents-md` ask for GitHub repos. `agents-md` also asks for Slack
437
- channels. `grokbot-agents` asks for Grok Bot names. Repeat
438
- `--var id=value` to answer without a prompt.
439
- `--json` and non-TTY hosts skip the interview unless `--var` is set.
376
+ | Option | Contract |
377
+ | --- | --- |
378
+ | `--list` | List matching cases without running them. `--list --json` prints an array. |
379
+ | `--tag <tag>` | Select a tag. Repeat the option for OR matching. |
380
+ | `--json` | Print `{ ok, passed, failed, scored, skipped, strict, results }`. |
381
+ | `--verbose` | Stream `t.log` lines and reply snippets. |
382
+ | `--no-stream` | Hide live progress on stderr. |
383
+ | `--strict` | Treat a scored case below its soft threshold as a failure. |
384
+ | `--max-concurrency <n>` | Override `maxConcurrency` from the eval config for an ephemeral local run. |
385
+ | `--timeout-ms <n>` | Override the per-case timeout. A case timeout takes precedence, followed by this option, the config timeout, and the 180-second default. |
386
+ | `--junit <path>` | Write JUnit XML for an ephemeral local run. |
387
+ | `--artifacts <dir>` | Select the artifact directory for an ephemeral local run. The default is a timestamped directory under the project's state directory. |
388
+ | `--no-artifacts` | Skip artifacts for an ephemeral local run. |
389
+ | `--skip-report` | Ignore reporters from eval files and the eval config during an ephemeral local run. |
390
+ | `--out <file.json>` | Also write the full result JSON. |
391
+ | `--no-wait` | Return after a running server or hosted deployment accepts the batch. |
440
392
 
441
- On a TTY, `init` also asks whether to refresh the coding-agent skills in
442
- `~/.cursor/skills/agentsdk/`. Installing `@cursor/july` already copies
443
- them via postinstall (with `alwaysApply: true` so Cursor injects the
444
- bodies), so this prompt is a chance to overwrite with the package
445
- version. The prompt is skipped for `--json` and non-interactive hosts.
393
+ A running server or hosted deployment prints its Eval ID when it accepts the
394
+ batch.
395
+ Use these commands to inspect or cancel it:
446
396
 
447
- If the host isn't signed in, `init` runs `agent-sdk login` and waits for
448
- the browser flow. It then prints the `cd`, `agent-sdk login`, and
449
- `agent-sdk dev` steps still needed.
397
+ ```bash
398
+ agent-sdk eval status [evalId] --prod [--slug <slug>] [--team <id>]
399
+ agent-sdk eval status [evalId] --url <baseUrl>
400
+ agent-sdk eval cancel <evalId> --prod [--slug <slug>] [--team <id>]
401
+ agent-sdk eval cancel <evalId> --url <baseUrl>
402
+ ```
450
403
 
451
- With `--json`, `init` still installs dependencies but never blocks on
452
- login or skill installation. It prints `{ ok, directory, template, created,
453
- skipped, installed, installError, cliOnPath, cliLinkError, next }`. The
454
- `next` list includes `login` when the host is unsigned.
404
+ `eval status` without an ID lists recent remote runs. `eval status --out`
405
+ requires an ID. The `status` and `cancel` subcommands require `--url` or
406
+ `--prod`.
455
407
 
456
- ## convert-automation
408
+ ## Projects
457
409
 
458
- `convert-automation` exports a Cursor Automation into an agent project.
410
+ ### Scaffold a project {#init}
459
411
 
460
412
  ```bash
461
- agent-sdk convert-automation <url> [--dir <path>] [--json]
413
+ agent-sdk init [directory] [--template <name>] [--var id=value]... [--json]
462
414
  ```
463
415
 
464
- `<url>` is the dashboard URL (`…/automations/<uuid>` or
465
- `…/custom-agents/<uuid>`) or a bare UUID. The command fetches the
466
- Automation with your Cursor credentials. It writes converted files to
467
- `--dir`, which defaults to `./<automation-name>`, adds missing `init`
468
- scaffold files, and runs `npm install`. File generation does not
469
- overwrite existing paths. The install may still update lockfiles or run
470
- lifecycle scripts from an existing `package.json`.
416
+ Without a directory, `init` prints the setup guide and changes no files. With
417
+ a directory, it preserves existing scaffold files, adds missing files,
418
+ installs dependencies, and tries to put `agent-sdk` on `PATH`.
419
+
420
+ | Option | Contract |
421
+ | --- | --- |
422
+ | `--template <name>` | Use a bundled template: `agentic-owners`, `agents-md`, `code-wiki`, `demo`, `grokbot-agents`, `pr-autofixer`, `security-help`, `security-reviewer`, `thermo-quality-review`, `thermo-review`, `triage-jira`, or `triage-linear`. |
423
+ | `--var id=value` | Answer a template question without a prompt. Repeat for multiple answers. |
424
+ | `--json` | Skip interactive login and skill prompts, then print `{ ok, directory, template, created, skipped, installed, installError, cliOnPath, cliLinkError, next }`. `ok` reflects dependency installation. |
471
425
 
472
- MCP servers convert to Cursor-account connections resolved at runtime.
473
- The project contains their names, not server URLs or credentials.
474
- Local runs use the signed-in account. Hosted deployments use a separate
475
- service account; authorize each generated connection with
476
- [`mcp oauth`](#mcp-oauth) after the first deploy. Review the generated
477
- project, then run `validate` and `dev`.
426
+ On a TTY, templates with questions run their interview before writing files.
427
+ `init` also offers to refresh the bundled coding-agent skills and starts login
428
+ when the host has no Cursor credential.
478
429
 
479
- Warnings do not change the exit status. Bad arguments, authentication
480
- failures, fetch failures, and file write failures return a nonzero exit
481
- code.
430
+ ### Convert an Automation {#convert-automation}
431
+
432
+ ```bash
433
+ agent-sdk convert-automation <url-or-uuid> [--dir <path>] [--json]
434
+ ```
435
+
436
+ The input can be a Cursor Automation dashboard URL or its UUID. The output
437
+ directory defaults to `./<automation-name>`. Generated files don't overwrite
438
+ existing paths, and missing scaffold files are added. The following
439
+ `npm install` can update lockfiles and run lifecycle scripts from an existing
440
+ `package.json`.
482
441
 
483
442
  `--json` prints
484
443
  `{ ok, directory, files, warnings, setupSteps, installed, installError, mcpConnections }`.
485
- On failure it prints `{ ok: false, error }` and still writes the prose
486
- error to stderr.
487
-
488
- The [Convert a Cursor Automation](/docs/guides/convert-automation.md) guide
489
- covers generated files and behavior the converter cannot reproduce.
444
+ Conversion warnings and dependency-install failures remain visible in this
445
+ output without failing a completed file conversion. Invalid input,
446
+ authentication, export, and file-write failures exit nonzero.
490
447
 
491
- ## install-skills
448
+ See [Convert a Cursor Automation](/docs/guides/convert-automation.md) for the
449
+ generated project and features that need manual review.
492
450
 
493
- `install-skills` copies the package's coding-agent skills into
494
- `~/.cursor/skills/agentsdk/` with `alwaysApply: true` so Cursor loads
495
- them as global rules. Installing `@cursor/july` already does this in
496
- postinstall (`npm install`, `npx`, a version bump). Use this command
497
- to refresh without reinstalling the package, or from a monorepo
498
- source checkout (postinstall skips that tree).
451
+ ### Install coding-agent skills {#install-skills}
499
452
 
500
453
  ```bash
501
454
  agent-sdk install-skills [--print] [--json]
502
455
  ```
503
456
 
504
- Running the command is the confirmation: it never prompts, and it
505
- overwrites the installed skills with the version bundled in the
506
- package. `init` offers the same refresh once, interactively. `--print`
507
- previews the skills, the removals, and the install path without writing
508
- anything. `--json` prints
457
+ The command replaces the installed Agent SDK skills under
458
+ `~/.cursor/skills/agentsdk/` with the package copy and removes stale bundled
459
+ skills. `--print` previews the change. `--json` prints
509
460
  `{ ok, dryRun, directory, firstInstall, skills, removed }`.
510
461
 
511
- Set `CURSOR_JULY_SKIP_SKILL_INSTALL=1` to skip the postinstall copy.
512
- `CURSOR_JULY_SKILLS_HOME` overrides the `~/.cursor/skills` directory.
462
+ Package installation already performs this copy. Set
463
+ `CURSOR_JULY_SKIP_SKILL_INSTALL=1` to skip that install hook, or set
464
+ `CURSOR_JULY_SKILLS_HOME` to choose another skills directory.
513
465
 
514
- ## info
515
-
516
- `info` prints the discovered agent surface.
466
+ ### Inspect a project {#info}
517
467
 
518
468
  ```bash
519
- agent-sdk info --dir . [--json]
469
+ agent-sdk info [--dir <path>] [--json]
520
470
  ```
521
471
 
522
- `info` reports the model, instruction size, tools, skills, MCP
523
- connections, subagents, channel routes, schedules, hooks, and
524
- diagnostics. Text output summarizes each mounted agent. `--json` prints
525
- `{ agents: [{ slug, ...projectInfo }] }`, with one entry per mounted
526
- slug. Use `validate`, not `info --json`, when a script needs an error
527
- exit status.
472
+ Text output lists the model, instructions, tools, skills, extensions,
473
+ connections, subagents, channels, schedules, hooks, hosting settings, and
474
+ diagnostics. For one unslugged project, `--json` prints its project info
475
+ object. For slugged or multi-agent discovery, it prints `{ agents }`.
476
+
477
+ ### Validate a project {#validate}
528
478
 
529
- ## validate
479
+ ```bash
480
+ agent-sdk validate [--dir <path>]
481
+ ```
530
482
 
531
- `validate` checks the project and sets the exit code.
483
+ `validate` prints every discovered project's diagnostics and exits nonzero
484
+ when any diagnostic has error severity. Use it instead of `info --json` when a
485
+ script needs validation status.
486
+
487
+ ### Print a deployment manifest {#manifest}
532
488
 
533
489
  ```bash
534
- agent-sdk validate --dir .
490
+ agent-sdk manifest [--dir <path>] [--json]
535
491
  ```
536
492
 
537
- `validate` prints diagnostics for each agent and exits non-zero when any
538
- diagnostic has error severity. `serve` also refuses to start when errors
539
- are present. Warnings don't change the exit status.
493
+ `manifest` validates one project and prints its deployment metadata without a
494
+ network request. Default output is indented JSON; `--json` prints one compact
495
+ line.
540
496
 
541
- ## login / logout / whoami
497
+ ## Credentials and versions
542
498
 
543
- Three commands manage the host's Cursor credential.
499
+ ### Manage credentials {#login-logout-whoami}
544
500
 
545
501
  ```bash
546
502
  agent-sdk login [--api-key <key>] [--key-name <name>]
@@ -548,418 +504,394 @@ agent-sdk whoami [--json]
548
504
  agent-sdk logout
549
505
  ```
550
506
 
551
- `login` signs the host in to Cursor: browser sign-in mints a named,
552
- dashboard-revocable API key, and only the key is stored (the default
553
- name is `<invoked command> (<hostname>)`). It powers inference, the cloud
554
- runtime, and Cursor account MCP connections. `--key-name` changes the
555
- name of a browser-minted key. `login --api-key` validates and stores a
556
- key you already created.
507
+ | Command | Contract |
508
+ | --- | --- |
509
+ | `login` | Use a supplied API key, or open browser sign-in and store the resulting dashboard-revocable key in the CLI config directory. `--key-name` labels a browser-created key. |
510
+ | `whoami` | Show the active credential and its source. `--json` returns the same identity as JSON. |
511
+ | `logout` | Remove the stored credential file. It doesn't revoke the API key; revoke the key in the Cursor dashboard. |
557
512
 
558
- `whoami` shows which credential is active and why. An explicit key
559
- wins, then `CURSOR_API_KEY`, then `CURSOR_API_KEY_FILE` (hosted default
560
- `/run/cursor/secrets/CURSOR_API_KEY` when unset), then
561
- `CURSOR_SERVICE_ACCOUNT_KEY`, then the stored login. A host that has
562
- both the service-account key and a bind file authenticates as the file
563
- principal. `logout` removes the local credential file but doesn't
564
- revoke the API key. Revoke it in the Cursor dashboard when it should
565
- stop working.
513
+ ### Print the version {#version}
566
514
 
567
- Login and account RPCs honor `CURSOR_API_BASE_URL`. The SDK harness
568
- honors `CURSOR_BACKEND_URL`. Set both to the same URL, or keys minted
569
- on one host are rejected by the other.
515
+ ```bash
516
+ agent-sdk version [--json]
517
+ agent-sdk --version
518
+ agent-sdk -V
519
+ ```
570
520
 
571
- ## update
521
+ Text output is the version number. `--json` prints
522
+ `{ name, version }`.
572
523
 
573
- `update` upgrades an installed copy to the latest published version.
524
+ ### Update the CLI {#update}
574
525
 
575
526
  ```bash
576
527
  agent-sdk update
577
528
  ```
578
529
 
579
- The command checks npm's `latest` tag, detects how the Agent SDK was installed,
580
- and runs the matching npm, pnpm, Yarn, or Bun upgrade command. It handles
581
- global installs and project dependencies. It doesn't prompt before
582
- running the package-manager command.
583
-
584
- Source checkouts, `npx` or `pnpm dlx` caches, and unknown install layouts
585
- aren't changed. The command prints a manual upgrade hint instead.
530
+ `update` checks npm's `latest` tag and upgrades a recognized global or project
531
+ install with its package manager. If it can't identify an installed copy, it
532
+ prints a manual upgrade command instead.
586
533
 
587
- Published installs also check for a newer version at most once every 24
588
- hours and print an update warning on stderr. Source checkouts, CI, and
589
- commands with an explicit `--json` flag skip this automatic check.
534
+ Published installs check for updates at most once every 24 hours. Set
535
+ `AGENT_SERVE_NO_UPDATE_CHECK`, `NO_UPDATE_NOTIFIER`, or `CI` to disable the
536
+ automatic warning.
590
537
 
591
- ## deploy
538
+ ## Managed hosting
592
539
 
593
- `deploy` sends one or more agents to Cursor managed hosting.
540
+ ### Deploy agents {#deploy}
594
541
 
595
542
  ```bash
596
543
  agent-sdk deploy [--dir <path>] [--slug <slug> | --all] [--team <id>]
597
- [--repo <https-url>] [--ref <git-ref>] [--path <agent-path>]
598
- [--cursor-events-repo owner/name]...
599
- [--allow-domain <domain>]...
600
- [--no-wait] [--json]
601
- ```
602
-
603
- Managed hosting requires team membership and the team's cloud-agent
604
- entitlement. A team service-account API key with agent access can
605
- deploy. `--team` defaults to the signed-in account's team.
606
-
607
- For a single project, the slug defaults to a normalized version of the
608
- directory name. Deployment slugs contain lowercase letters, digits, `_`,
609
- or `-`, with a maximum of 64 characters. For a directory with several
610
- agents, select one with `--slug`, deploy all with `--all`, or choose from
611
- the TTY prompt. Non-interactive callers must pass `--slug` or `--all`.
612
- If `--dir` contains no agent project or child agents, `deploy` requires
613
- `--slug` (or a slug derived from the directory name) and an https git
614
- repository URL (`--repo`, or inferred from `origin` when `--dir` is an
615
- agent project). `--all` fails when there is no agent project.
616
-
617
- The command infers `--repo`, `--ref`, and `--path` from the current Git
618
- checkout when possible. Explicit flags take precedence. `--repo` must
619
- use HTTPS. Repeat `--cursor-events-repo` to select SCM event sources.
620
- Repeat `--allow-domain` to add engine egress domains; these values are
621
- combined with `hosting.egressDomains` from the agent config. Egress
622
- domains apply only to repository-backed deployments. Each domain must
623
- be a lowercase hostname with at least two labels and an alphabetic
624
- top-level domain. One leading `*.` wildcard is allowed. A deployment
625
- can declare at most 20 domains.
626
-
627
- By default, the command polls every three seconds for up to ten minutes
628
- and succeeds only when the deployment reaches `running`. `--no-wait`
629
- returns after the deployment request is accepted. Multi-agent deploys
630
- run sequentially. When several agents are selected, `--path` is ignored
631
- and each project infers its own path. A single-target `--json` run
632
- prints one object; a multi-target run prints an array.
633
-
634
- The first deployment can return an alias token. It appears once in text
635
- or JSON output and can't be retrieved later. Store it as a secret. Send
636
- it as `X-Agent-Alias-Token` when calling the stable alias URL, or use it
637
- to sign in to the hosted playground.
638
-
639
- See [Deployment](/docs/deployment.md) for the hosting security model and
640
- state layout.
641
-
642
- ## deployments
643
-
644
- `deployments` lists the selected team's deployments.
544
+ [--repo <https-url>] [--ref <git-ref>] [--path <agent-path>]
545
+ [--cursor-events-repo <owner/name>]...
546
+ [--allow-domain <domain>]... [--no-wait] [--json]
547
+ ```
548
+
549
+ Managed hosting requires a team with agent hosting enabled. A team
550
+ service-account API key with agent access can deploy.
551
+
552
+ | Option | Contract |
553
+ | --- | --- |
554
+ | `--slug <slug>` | Select one project and set its deployment slug. |
555
+ | `--all` | Deploy every child project under a multi-agent `--dir`. Mutually exclusive with `--slug`. |
556
+ | `--team <id>` | Select the Cursor team. |
557
+ | `--repo <https-url>` | Set the source repository. The CLI infers it from the current checkout when possible. HTTPS is required. |
558
+ | `--ref <git-ref>` | Set the source Git ref. The CLI infers the current branch when possible. |
559
+ | `--path <agent-path>` | Set the project path relative to the repository root. |
560
+ | `--cursor-events-repo <owner/name>` | Add a repository whose SCM events reach the deployment. Repeat for multiple repositories. |
561
+ | `--allow-domain <domain>` | Add an egress hostname. Repeat for multiple domains; values are combined with `hosting.egressDomains`. |
562
+ | `--no-wait` | Return after the deployment request is accepted. |
563
+ | `--json` | Print one object for one target or an array for multiple targets. |
564
+
565
+ Deployment slugs contain lowercase letters, digits, `_`, or `-`, start with a
566
+ letter or digit, and have at most 64 characters. Egress entries are lowercase
567
+ hostnames with an alphabetic top-level domain; one leading `*.` wildcard is
568
+ allowed, with at most 20 entries.
569
+
570
+ By default, `deploy` waits until the deployment is running and exits nonzero
571
+ if it reaches a failed state. A first deployment can return an alias token
572
+ once. Store it as a secret and send it as `X-Agent-Alias-Token` when calling
573
+ the stable alias URL.
574
+
575
+ ### List deployments {#deployments}
645
576
 
646
577
  ```bash
647
578
  agent-sdk deployments [--team <id>] [--json]
648
579
  ```
649
580
 
650
- Text output shows each slug, status, deployment kind, and
651
- update time. `--json` prints `{ deployments }`.
581
+ Text output shows slug, status, generation, kind, and update time. `--json`
582
+ prints `{ deployments }` and may also include `applications`. An empty list
583
+ succeeds.
652
584
 
653
- ## deployment
654
-
655
- `deployment` prints the full status of one deployment.
585
+ ### Inspect a deployment {#deployment}
656
586
 
657
587
  ```bash
658
588
  agent-sdk deployment <slug> [--team <id>] [--json]
659
589
  ```
660
590
 
661
- Text output includes status, kind, alias, source, egress
662
- domains, secret names, engine state, and the last error when present.
663
- `--json` returns the full API response. It can include short-lived
664
- `engineAccess.headers`, so handle JSON output as a credential.
591
+ Text output includes status, source, routes, secret names, egress domains, and
592
+ the latest error. `--json` can include short-lived access headers, so handle
593
+ its output as a credential.
594
+
595
+ ### Stop a deployment {#stop}
596
+
597
+ ```bash
598
+ agent-sdk stop <slug> [--team <id>] [--no-wait] [--cancel-runs] [--json]
599
+ ```
665
600
 
666
- ## stop
601
+ The command waits for `stopped` by default. `--no-wait` returns after the
602
+ request is accepted. `--cancel-runs` also requests cancellation of active
603
+ runs and reminder wakes for a managed application. Other deployment types
604
+ reject this option.
667
605
 
668
- `stop` shuts down a deployment.
606
+ ### Cancel active runs {#cancel-runs}
669
607
 
670
608
  ```bash
671
- agent-sdk stop <slug> [--team <id>] [--no-wait] [--json]
609
+ agent-sdk cancel-runs <slug> [--team <id>] [--json]
672
610
  ```
673
611
 
674
- The command polls for up to ten minutes until the status reaches
675
- `stopped`. `--no-wait` returns after the stop request is accepted.
612
+ The command requests cancellation for a managed application's active runs and
613
+ reminder wakes. Other deployment types reject it. For a multi-tenant
614
+ application, this cancels every install; use `stop --cancel-runs` for
615
+ install-local cancellation. It exits nonzero if any cancellation request fails
616
+ to start.
617
+
618
+ ### Replace event repositories {#event-repos}
619
+
620
+ ```bash
621
+ agent-sdk event-repos <slug> [--repo <owner/name>]...
622
+ [--team <id>] [--json]
623
+ ```
676
624
 
677
- ## delete
625
+ The supplied repositories replace the managed application's complete event
626
+ repository list; they aren't merged with the previous list. Omit `--repo` to
627
+ clear the list.
678
628
 
679
- `delete` removes a hosted deployment. You can delete a deployment that
680
- still runs. The command frees the slug. A later deploy can use the same
681
- name. Spend stays on the archived service account.
629
+ ### Upgrade a managed application {#upgrade}
682
630
 
683
631
  ```bash
684
- agent-sdk delete <slug> [--team <id>] [--no-wait] [--json]
632
+ agent-sdk upgrade <slug> [--release <id-or-version>]
633
+ [--team <id>] [--json]
685
634
  ```
686
635
 
687
- The command waits until the deployment is gone. `--no-wait` returns after
688
- the delete request is accepted. Architecture v2 slugs use the Agent SDK
689
- control plane. Architecture v1 slugs use the Agent Serve control plane.
636
+ `--release` accepts a release ID or version. Omit it to select the newest
637
+ ready release. `--json` prints `{ releaseId }`.
638
+
639
+ ### Delete a deployment {#delete}
690
640
 
691
- ## rotate-token
641
+ ```bash
642
+ agent-sdk delete <slug> [--team <id>] [--no-wait] [--json]
643
+ ```
692
644
 
693
- `rotate-token` replaces the alias token used by callers and the hosted
694
- playground.
645
+ `delete` removes the deployment and frees its slug. It waits until the
646
+ deployment is gone unless `--no-wait` is set.
647
+
648
+ ### Rotate an alias token {#rotate-token}
695
649
 
696
650
  ```bash
697
651
  agent-sdk rotate-token <slug> [--team <id>] [--json]
698
652
  ```
699
653
 
700
- The old token stops working immediately. The replacement is shown once.
654
+ The old token stops working immediately. The replacement appears once;
701
655
  `--json` prints `{ aliasToken }`.
702
656
 
703
- ## mcp
704
-
705
- `mcp` proxies an agent's MCP endpoint over stdio for MCP clients that
706
- spawn local servers, such as Cursor.
657
+ ### Manage deployment secrets {#secrets}
707
658
 
708
659
  ```bash
709
- agent-sdk mcp --prod [--slug <slug>] [--team <id>]
710
- agent-sdk mcp --url <baseUrl> [--bearer-token <token>]
711
- agent-sdk mcp install [--prod | --url <baseUrl>] [--name <serverName>]
712
- [--print] [--json] [--remote]
660
+ agent-sdk secrets set <slug> NAME [NAME2 ...]
661
+ [--team <id>] [--from-argv] [--json]
662
+ agent-sdk secrets list <slug> [--team <id>] [--json]
663
+ agent-sdk secrets unset <slug> NAME [--team <id>] [--json]
713
664
  ```
714
665
 
715
- The bare command reads newline-delimited JSON-RPC on stdin and forwards
716
- one POST per message to `<target>/v1/mcp`. It requires `--prod` or
717
- `--url`. With `--prod`, it resolves the hosted deployment through the
718
- signed-in Cursor account and re-mints short-lived engine credentials as
719
- they expire, so no durable secret lands in a config file. stdout is
720
- reserved for the MCP wire; logging goes to stderr.
666
+ Pass secret names to `set`. On a TTY, the CLI prompts for hidden values; with
667
+ piped input, provide one line per name. It rejects `NAME=VALUE` arguments
668
+ unless `--from-argv` is set because command-line values can enter shell
669
+ history and captured terminals.
670
+
671
+ Names use `UPPER_SNAKE_CASE`, start with a letter, and contain at most 64
672
+ characters. Names beginning with `CURSOR_` are reserved. Values contain at
673
+ most 4096 bytes, and each deployment holds at most 32 secrets.
674
+
675
+ `list` returns names and creation times, never values. JSON output is
676
+ `{ secretNames }` for `set`, `{ secrets }` for `list`, and `{ removed }` for
677
+ `unset`. Changes are available to subsequent hosted work.
721
678
 
722
- `mcp install` writes the matching entry into `~/.cursor/mcp.json` so
723
- the agent shows up as an MCP server in Cursor. `--name` overrides the
724
- server name (the default is the slug, or a name derived from `--url`).
725
- `--print` prints the entry instead of writing the file, and `--json`
726
- prints a machine-readable result. `--remote` (with `--prod`) writes a
727
- remote HTTP entry pointing at the stable Cursor MCP gateway instead of
728
- the local stdio proxy, for MCP hosts that can't spawn stdio servers.
729
- The remote entry carries your API key in plain text, so treat the file
730
- as a credential.
679
+ ## MCP connections
731
680
 
732
- ## mcp oauth
681
+ ### Connect an MCP client {#mcp}
682
+
683
+ ```bash
684
+ agent-sdk mcp --prod [--slug <slug>] [--team <id>]
685
+ agent-sdk mcp --url <baseUrl> [--bearer-token <token>]
733
686
 
734
- `mcp oauth` authorizes a `defineConnection({ url, oauth: true })` or
735
- `defineConnection({ cursorAccount: true })` connection.
687
+ agent-sdk mcp install --prod [--slug <slug>] [--team <id>]
688
+ [--name <server-name>] [--print] [--json] [--remote]
689
+ agent-sdk mcp install --url <baseUrl> [--bearer-token <token>]
690
+ [--name <server-name>] [--print] [--json]
691
+ ```
736
692
 
737
- URL connections run a browser PKCE flow. Tokens are written to
738
- `mcp-auth.json` under the CLI config directory (override with
739
- `AGENT_SERVE_CONFIG_DIR`). Pass `--store` to upsert matching
740
- `MCP_OAUTH_<CONNECTION>_*` secrets on the hosted deployment.
741
- `--store` is the path for the next deploy. Hosted Connect lets the
742
- current process retry.
693
+ | Command | Contract |
694
+ | --- | --- |
695
+ | `mcp` | Read newline-delimited JSON-RPC from stdin and proxy it to the selected agent's MCP endpoint. stdout is reserved for MCP messages. A target is required. |
696
+ | `mcp install` | Add the selected agent to `~/.cursor/mcp.json`. `--name` sets the server name, `--print` previews the entry, and `--json` prints a machine-readable result. A `--url` entry with `--bearer-token` contains that token; handle printed and written copies as credentials. |
697
+ | `mcp install --remote --prod` | Write a remote HTTP entry for clients that can't spawn a stdio process. The entry contains the API key in plain text and must be handled as a credential. |
743
698
 
744
- Cursor-account connections authorize the hosted deployment's service
745
- account through the Cursor backend's connector consent flow. Those
746
- tokens live on the Cursor backend, so `--store` isn't needed; the
747
- command prints a note when you pass it anyway.
699
+ ### Authorize MCP OAuth {#mcp-oauth}
748
700
 
749
701
  ```bash
750
- agent-sdk mcp oauth <connection> [--dir .] [--store] [--slug <slug>] [--team <id>]
702
+ agent-sdk mcp oauth <connection> [--dir <path>] [--store]
703
+ [--slug <slug>] [--team <id>]
751
704
  ```
752
705
 
753
706
  `<connection>` is the basename under `agent/mcp-connections/` or
754
707
  `agent/host-connections/`.
755
- `--slug` defaults to the `--dir` basename. `--team` defaults to the
756
- signed-in account's team. You need `agent-sdk login` (or `--api-key`)
757
- before `--store`.
758
708
 
759
- Secret names are `MCP_OAUTH_<NAME>_ACCESS_TOKEN`,
760
- `_REFRESH_TOKEN`, and `_CLIENT_ID` (`<NAME>` is the connection id in
761
- upper snake case). Declare them in `hosting.secretNames` so deploy
762
- validation expects them. Secrets apply on the next deploy.
709
+ | Connection | Result |
710
+ | --- | --- |
711
+ | `defineConnection({ url, oauth: true })` | Open a browser PKCE flow and save tokens in `mcp-auth.json` under the CLI config directory. `--store` also sets the matching deployment secrets. |
712
+ | `defineConnection({ cursorAccount: true })` | Authorize the managed deployment's service account through Cursor. `--store` isn't needed. |
763
713
 
764
- Tokens are bound to the connection's resource URL. Changing the URL
765
- invalidates the local entry; run `mcp oauth` again.
714
+ Stored secret names are `MCP_OAUTH_<NAME>_ACCESS_TOKEN`,
715
+ `MCP_OAUTH_<NAME>_REFRESH_TOKEN`, and `MCP_OAUTH_<NAME>_CLIENT_ID`. Declare
716
+ them in `hosting.secretNames`. URL-connection tokens are bound to the resource
717
+ URL; authorize again after changing it.
766
718
 
767
- See the [Host MCP OAuth guide](/docs/guides/mcp-oauth.md).
719
+ See [Host MCP OAuth](/docs/guides/mcp-oauth.md) for the full setup flow.
768
720
 
769
- ## secrets
721
+ ## Channel helpers
770
722
 
771
- `secrets` manages environment secrets for a deployment.
723
+ ### Configure Slack {#slack}
772
724
 
773
725
  ```bash
774
- agent-sdk secrets set <slug> NAME [NAME2 ...] [--team <id>] [--json]
775
- agent-sdk secrets list <slug> [--team <id>] [--json]
776
- agent-sdk secrets unset <slug> NAME [--team <id>] [--json]
726
+ agent-sdk slack setup
727
+ agent-sdk slack create [--dir <path>] [--name <name>] [--prod]
728
+ [--slack-team <id>] [--team <id>] [--icon <url-or-file>]
729
+ [--prefix <prefix> | --no-prefix] [--channel-posts] [--json]
730
+ agent-sdk slack destroy [--dir <path>] [--prod]
731
+ [--slack-team <id>] [--team <id>] [--json]
732
+ agent-sdk slack icon <url-or-file> [--dir <path>] [--prod]
733
+ [--slack-team <id>] [--team <id>] [--json]
734
+ agent-sdk slack init --manual [--dir <path>] [--name <name>]
735
+ [--prefix <prefix> | --no-prefix] [--channel-posts]
736
+ [--install | --no-install] [--slack-team <id>] [--prod]
737
+ agent-sdk slack manifest [--dir <path>] [--name <name>]
738
+ [--env dev|prod|both] [--channel-posts] [--print]
739
+ agent-sdk slack doctor [--dir <path>]
740
+ [--prefix <prefix> | --no-prefix] [--channel <id>]... [--json]
777
741
  ```
778
742
 
779
- Pass names only. On a TTY, `secrets set` prompts for each value with
780
- hidden input (nothing echoes). When stdin is piped, provide one line per
781
- name. Values never print on stdout.
743
+ | Subcommand | Contract |
744
+ | --- | --- |
745
+ | `setup` | Print the setup choices without changing files. |
746
+ | `create` | Open the signed-in Cursor dashboard wizard, write the resulting token pair to `.env.local`, and run `doctor`. The development app is the default; `--prod` selects production. A second create overwrites the live app manifest. |
747
+ | `destroy` | Delete the provisioned app. Existing local token entries remain but stop working. |
748
+ | `icon` | Set an HTTPS or local PNG, JPG, or GIF icon of at most 512 KB. |
749
+ | `init --manual` | Write the channel, manifests, Slack CLI project, and setup files for a manually managed app. |
750
+ | `manifest` | Generate Slack manifests. `--env` defaults to `both`; with `--print`, select one environment when you need one JSON document. |
751
+ | `doctor` | Check both tokens, Socket Mode connectivity, Slack authentication, and any repeatable `--channel` values. |
752
+
753
+ The default token prefix is the project directory name normalized to upper
754
+ snake case. `--no-prefix` uses `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN`.
755
+ Channel-post subscriptions are off by default; `--channel-posts` adds message
756
+ events for public and private channels as required by
757
+ `engagement.channelPosts`.
758
+ Multi-agent servers need one token pair per agent.
759
+
760
+ See [Slack](/docs/guides/slack.md) for app consent and manual setup.
782
761
 
783
- Do not put values on the command line. `NAME=VALUE` in argv shows up in
784
- shell history and in agent-captured terminals. The CLI refuses that form
785
- unless you pass `--from-argv` (still warns). Prefer a file redirect when
786
- a human is not at the prompt:
762
+ ### Test GitHub webhooks {#github}
787
763
 
788
764
  ```bash
789
- agent-sdk secrets set weather-agent WEATHER_API_KEY < ./weather-api-key.txt
765
+ agent-sdk github forward [--dir <path>] [--slug <slug>] [--channel <id>]
766
+ [--repo owner/repo | --org <org>] [--events a,b,c]
767
+ [--url <url>] [--host <host>] [--port <n>]
768
+ [--secret <secret>] [--install]
769
+ agent-sdk github replay <pr-url-or-owner/repo#N>
770
+ [--events a,b,c | '*'] [--action <action>] [--conclusion <result>]
771
+ [--comment <body>] [--context <name>] [--dir <path>]
772
+ [--slug <slug>] [--channel <id>] [--url <url>]
773
+ [--secret <secret>] [--dry-run] [--out <dir>] [--json]
774
+ agent-sdk github events [--dir <path>] [--host <host>] [--port <n>] [--json]
775
+ agent-sdk github doctor [--install] [--json]
790
776
  ```
791
777
 
792
- Secret names use `UPPER_SNAKE_CASE`, start with a letter, and contain at
793
- most 64 characters. Names beginning with `CURSOR_` are reserved. Values
794
- can contain at most 4096 bytes, and one deployment can hold 32 secrets.
778
+ | Subcommand | Contract |
779
+ | --- | --- |
780
+ | `forward` | Forward live deliveries with `gh webhook forward`. The CLI derives URLs and events from discovered channels and can fan out to several matches. |
781
+ | `replay` | Read a pull request, synthesize selected webhook payloads, and post them to matching channels. The default event is `pull_request`; `'*'` selects the channel's supported declared events. |
782
+ | `events` | List discovered channel URLs and event sets. No channels is a successful empty result. |
783
+ | `doctor` | Check the GitHub CLI, its login, and the pinned webhook extension. `--install` installs or repairs the extension. |
795
784
 
796
- `secrets list` returns names and creation times, never values. Secret
797
- changes reach the engine on its next deploy. `secrets set` upserts the
798
- named secrets without deleting others.
785
+ Replay supports `pull_request`, `issue_comment`,
786
+ `pull_request_review_comment`, `check_run`, `check_suite`, `workflow_run`, and
787
+ `status`. `--dry-run` prints without posting. `--out` writes fixtures and
788
+ still posts unless combined with `--dry-run`.
799
789
 
800
- JSON output is `{ secretNames }` for `set`, `{ secrets }` for `list`,
801
- and `{ removed }` for `unset`.
790
+ Forwarding requires repository admin access, or organization owner access for
791
+ `--org`. It uses the GitHub CLI's stored login; unset `GITHUB_TOKEN` and
792
+ `GH_TOKEN` before forwarding. Replay needs only pull-request read access.
802
793
 
803
- ## slack
794
+ See [GitHub](/docs/guides/github.md) for channel setup and live delivery.
804
795
 
805
- The `slack` pack provisions, generates, and checks Socket Mode channel
806
- setup.
796
+ ### Test GitLab webhooks {#gitlab}
807
797
 
808
798
  ```bash
809
- agent-sdk slack setup
810
- agent-sdk slack create [--dir <path>] [--name <name>] [--prod]
811
- [--slack-team <T…>] [--team <id>]
812
- [--icon <https-url-or-file>]
813
- [--prefix <prefix> | --no-prefix]
814
- [--channel-posts] [--json]
815
- agent-sdk slack destroy [--dir <path>] [--prod] [--slack-team <T…>]
816
- [--team <id>] [--json]
817
- agent-sdk slack icon <https-url-or-file> [--dir <path>] [--prod]
818
- [--slack-team <T…>] [--team <id>] [--json]
819
- agent-sdk slack init --manual [--dir <path>] [--name <name>]
820
- [--prefix <prefix> | --no-prefix] [--channel-posts]
821
- [--install | --no-install] [--slack-team <T…>] [--prod]
822
- agent-sdk slack manifest [--dir <path>] [--name <name>]
823
- [--env dev|prod|both] [--channel-posts] [--print]
824
- agent-sdk slack doctor [--dir <path>] [--prefix <prefix> | --no-prefix] [--json]
825
- ```
826
-
827
- `slack setup` prints the two-product chooser plus the `--manual` setup
828
- checklist. It doesn't change files.
829
-
830
- `slack create` opens the signed-in Cursor dashboard wizard. Finish Slack
831
- consent and the bot name there. The CLI writes the token pair into
832
- `<dir>/.env.local` and runs `doctor`. It requires a signed-in host
833
- (`agent-sdk login` or `CURSOR_API_KEY`). A team service-account key
834
- cannot create Slack apps. `--prod` provisions the production app; the
835
- default is the development app. `--name` / `--icon`
836
- / `--channel-posts` prefill the wizard. A second create for the same
837
- slug and env overwrites the live Slack app. If Slack needs a workspace
838
- admin's approval, the wizard waits; keep the CLI running, open Slack's
839
- **Request approval** page (the CLI prints the link), and click **Retry**
840
- after the admin approves. Token values never print.
841
-
842
- `slack destroy` deletes the provisioned app for the selected
843
- environment. Tokens already written to `.env.local` stay in place and
844
- stop working.
845
-
846
- `slack icon` sets the provisioned app's icon from an https image URL or
847
- a local png, jpg, or gif file of at most 512KB.
848
-
849
- `slack init` without `--manual` exits non-zero and writes no files. Use
850
- `slack create` for the dashboard wizard. `slack init --manual` writes
851
- the channel file, development and production manifests, a Slack CLI
852
- `.slack/` project (hook + manifests, committed with the repo). When
853
- Slack CLI is logged in, it installs the app. Otherwise `next` asks
854
- you to install it. `--install` requires that install. `--no-install`
855
- skips it. `--prod` selects the deployed app.
856
- `--slack-team` picks the workspace. Slack CLI keeps install tokens in
857
- that process; copy `xoxb` and mint `xapp` (`connections:write`) into
858
- `.env.local`. Tokens that appear in `.env` during that install are
859
- copied onto the prefixed names. Paste `.slack/manifest.dev.json` at
860
- api.slack.com when the Slack CLI is missing. Do not run
861
- `slack deploy`. The command refuses to overwrite the channel file.
862
- It updates the Slack CLI hook and manifests when `.slack/` already
863
- exists. If a collision occurs, it exits non-zero; files created
864
- earlier in the run remain. The token prefix defaults to the directory
865
- basename normalized to uppercase snake case.
866
- Explicit `--prefix` values use the same normalization. For example,
867
- `pr-approver` becomes `PR_APPROVER_SLACK_BOT_TOKEN`. `--no-prefix`
868
- uses shared `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN`.
869
- `--channel-posts` subscribes the manifests to channel-post events.
870
- The command always prints a JSON summary.
871
-
872
- `slack manifest` regenerates selected manifest files. `--env` defaults
873
- to `both`, and `--name` defaults to the directory name. `--print` writes
874
- the manifest JSON to stdout instead of changing files. With the default
875
- `--env both`, it prints development JSON, a `--- prod ---` separator,
876
- then production JSON.
877
-
878
- `slack doctor` checks both tokens, Socket Mode connectivity, and
879
- Slack's `auth.test`. It exits non-zero when any check fails.
880
-
881
- See the [Slack guide](/docs/guides/slack.md).
882
-
883
- ## github
884
-
885
- The `github` pack discovers `githubChannel()` definitions and sends live
886
- or synthesized deliveries to them.
799
+ agent-sdk gitlab replay <mr-url-or-group/project!N>
800
+ [--events a,b,c | '*'] [--action <action>]
801
+ [--conclusion <status>] [--comment <body>]
802
+ [--dir <path>] [--slug <slug>] [--channel <id>]
803
+ [--url <url>] [--host <host>] [--port <n>]
804
+ [--secret <secret>] [--dry-run] [--out <dir>] [--json]
805
+ agent-sdk gitlab events [--dir <path>] [--host <host>] [--port <n>] [--json]
806
+ agent-sdk gitlab forward [--dir <path>] [--host <host>] [--port <n>]
807
+ ```
808
+
809
+ | Subcommand | Contract |
810
+ | --- | --- |
811
+ | `replay` | Read a merge request, synthesize selected webhook payloads, and post them to matching channels. The default event is `merge_request`; `'*'` selects the channel's declared events. |
812
+ | `events` | List discovered GitLab channel URLs and object kinds. |
813
+ | `forward` | Print the public-hook and tunnel recipe for live deliveries. |
814
+
815
+ Replay supports `merge_request`, `note`, `pipeline`, and `push`. It requires
816
+ `GITLAB_TOKEN` with project read access. `--secret` defaults to
817
+ `GITLAB_WEBHOOK_SECRET`; `--dry-run` and `--out` follow the GitHub replay
818
+ contract.
819
+
820
+ See [GitLab](/docs/guides/gitlab.md) for channel setup and self-managed hosts.
821
+
822
+ ### Test Bitbucket webhooks {#bitbucket}
887
823
 
888
824
  ```bash
889
- agent-sdk github doctor [--install] [--json]
890
- agent-sdk github events [--dir <path>] [--host <host>] [--port <n>] [--json]
891
- agent-sdk github forward [--dir <path>] [--slug <slug>] [--channel <id>]
892
- [--repo owner/repo | --org <org>] [--events a,b,c] [--url <url>]
893
- [--host <host>] [--port <n>] [--secret <secret>] [--install]
894
- agent-sdk github replay <pr-url|owner/repo#N> --dir .
895
- [--events a,b,c|'*'] [--action <action>] [--conclusion <result>]
896
- [--comment <body>] [--context <name>] [--slug <slug>] [--channel <id>]
897
- [--host <host>] [--port <n>] [--url <url>] [--secret <secret>]
898
- [--dry-run] [--out <dir>] [--json]
899
- ```
900
-
901
- `github events` prints each discovered channel's delivery URL and event
902
- set. When it finds no channels, it returns an empty result and exits
903
- successfully.
904
-
905
- `github forward` wraps `gh webhook forward`. It infers the repository
906
- from the Git remote when you omit `--repo` and `--org`. URLs and events
907
- come from the discovered channels; `--events` overrides the event set.
908
- Use `--slug` or `--channel` to narrow discovery when several channels
909
- match. Otherwise, one local proxy fans deliveries out to every match.
910
- `--url` targets one channel. For `forward`, pass `--events` when no
911
- matched channel can supply the event set.
912
-
913
- Repository forwarding needs repo-admin access. Organization forwarding
914
- needs org-owner access. The relay authenticates with the GitHub CLI's
915
- stored login. A `GITHUB_TOKEN` or `GH_TOKEN` environment override can
916
- make delivery requests return `401`, even when hook creation succeeds.
917
- Unset those variables before forwarding.
918
-
919
- Pass `--secret` or set `GITHUB_WEBHOOK_SECRET` to sign deliveries.
920
- `serve --dev` accepts unsigned loopback deliveries. A non-dev target
921
- requires the same secret on both sides.
922
-
923
- `github replay` needs read access, not admin access. It reads the pull
924
- request through `gh api`, builds GitHub webhook payloads, and posts them
925
- to the selected channels. Supported events are `pull_request`,
926
- `issue_comment`, `pull_request_review_comment`, `check_run`,
927
- `check_suite`, `workflow_run`, and `status`. The default is
928
- `pull_request` with action `synchronize`. Comment events need
929
- `--comment`.
930
-
931
- Use `--events '*'` to replay every supported event declared by the
932
- channel. `--dry-run` prints payloads without posting them. `--out`
933
- writes fixture files but still posts unless you also pass `--dry-run`.
934
-
935
- `github doctor` checks `gh`, its login, and the pinned
936
- `cli/gh-webhook` extension. `--install` installs or repairs the
937
- extension. An environment-token override is a warning and doesn't make
938
- `github doctor` fail.
939
-
940
- See the [GitHub guide](/docs/guides/github.md).
825
+ agent-sdk bitbucket replay <pr-url-or-workspace/repo#N>
826
+ [--events a,b,c | '*'] [--comment <body>]
827
+ [--dir <path>] [--slug <slug>] [--channel <id>]
828
+ [--url <url>] [--host <host>] [--port <n>]
829
+ [--secret <secret>] [--dry-run] [--out <dir>] [--json]
830
+ agent-sdk bitbucket events [--dir <path>] [--host <host>] [--port <n>] [--json]
831
+ agent-sdk bitbucket forward [--dir <path>] [--host <host>] [--port <n>]
832
+ ```
833
+
834
+ | Subcommand | Contract |
835
+ | --- | --- |
836
+ | `replay` | Read a pull request, synthesize webhook payloads in the host's Cloud or Data Center format, and post them to matching channels. |
837
+ | `events` | List discovered Bitbucket channel URLs and event keys. |
838
+ | `forward` | Print the repository-hook and tunnel recipe for live deliveries. |
839
+
840
+ Replay supports `pullrequest:created`, `pullrequest:updated`,
841
+ `pullrequest:comment_created`, and `repo:push`, along with their supported Data
842
+ Center forms. It requires `BITBUCKET_TOKEN` with pull-request read access.
843
+ `--secret` defaults to `BITBUCKET_WEBHOOK_SECRET`; `--dry-run` and `--out`
844
+ follow the GitHub replay contract.
845
+
846
+ See [Bitbucket](/docs/guides/bitbucket.md) for Cloud and Data Center setup.
941
847
 
942
848
  ## Environment variables
943
849
 
944
- These environment variables affect the CLI and its channel packs.
850
+ Credential resolution follows this order: `--api-key`, `CURSOR_API_KEY`,
851
+ `CURSOR_API_KEY_FILE`, `CURSOR_SERVICE_ACCOUNT_KEY`, then the stored login.
945
852
 
946
- | Variable | Meaning |
853
+ | Variable | Contract |
854
+ | --- | --- |
855
+ | `CURSOR_API_KEY` | Cursor credential. |
856
+ | `CURSOR_API_KEY_FILE` | Path to a Cursor credential file. |
857
+ | `CURSOR_SERVICE_ACCOUNT_KEY` | Team service-account credential used after the API key and key-file sources. |
858
+ | `CURSOR_API_BASE_URL` | Backend for login, account, deployment, and event commands. |
859
+ | `CURSOR_BACKEND_URL` | Backend for Agent SDK turns. Set it with `CURSOR_API_BASE_URL` when using a non-default backend. |
860
+ | `AGENT_SERVE_CONFIG_DIR` | Override the CLI config directory for stored credentials and update state. |
861
+ | `AGENT_SERVE_NO_UPDATE_CHECK`, `NO_UPDATE_NOTIFIER`, `CI` | Disable published-version checks when set to a non-empty value other than `0`. |
862
+ | `CURSOR_JULY_SKIP_SKILL_INSTALL` | Skip the package install hook that refreshes coding-agent skills. |
863
+ | `CURSOR_JULY_SKILLS_HOME` | Override the coding-agent skills directory. |
864
+ | `GITHUB_WEBHOOK_SECRET` | Default signature secret for GitHub forwarding and replay. |
865
+ | `GITHUB_APP_ID`, `GITHUB_APP_PRIVATE_KEY`, `GITHUB_APP_INSTALLATION_ID` | GitHub App credentials for outbound API calls. |
866
+ | `GITHUB_TOKEN`, `GH_TOKEN` | Token credentials for outbound GitHub calls. Unset both for `github forward`. |
867
+ | `GITLAB_TOKEN` | Token for GitLab API reads and direct channel calls. |
868
+ | `GITLAB_API_BASE_URL` | Override the GitLab REST base URL for self-managed hosts. |
869
+ | `GITLAB_WEBHOOK_SECRET` | Default GitLab webhook token for replay and channel verification. |
870
+ | `BITBUCKET_TOKEN` | Token for Bitbucket API reads and direct channel calls. |
871
+ | `BITBUCKET_API_BASE_URL` | Override the Bitbucket Data Center REST base URL. |
872
+ | `BITBUCKET_WEBHOOK_SECRET` | Default Bitbucket signing secret for replay and channel verification. |
873
+ | `SLACK_BOT_TOKEN`, `SLACK_APP_TOKEN` | Slack tokens for one agent. Multi-agent servers use `<PREFIX>_SLACK_BOT_TOKEN` and `<PREFIX>_SLACK_APP_TOKEN`. |
874
+
875
+ ## Exit status
876
+
877
+ | Command | Nonzero contract |
947
878
  | --- | --- |
948
- | `CURSOR_API_KEY` | Cursor credential. It takes precedence over `CURSOR_API_KEY_FILE`, `CURSOR_SERVICE_ACCOUNT_KEY`, and the stored login. |
949
- | `CURSOR_API_KEY_FILE` | Path to a Cursor credential file. Used when `CURSOR_API_KEY` is unset. When this variable is unset, the hosted default `/run/cursor/secrets/CURSOR_API_KEY` is tried. A present file takes precedence over `CURSOR_SERVICE_ACCOUNT_KEY` and the stored login. |
950
- | `CURSOR_SERVICE_ACCOUNT_KEY` | Team service-account credential. Used when `CURSOR_API_KEY` and `CURSOR_API_KEY_FILE` (including the hosted default path) are unset. It takes precedence over the stored login. |
951
- | `CURSOR_API_BASE_URL` | Backend used by login, account, deployment, and event-relay RPCs. |
952
- | `CURSOR_BACKEND_URL` | Backend used by the Cursor SDK harness. |
953
- | `AGENT_SERVE_CONFIG_DIR` | Directory for stored credentials and update-check state. Defaults to the CLI config directory under `~/.config`. |
954
- | `AGENT_SERVE_NO_UPDATE_CHECK` / `NO_UPDATE_NOTIFIER` | Disable the automatic published-version check when set to a non-empty value other than `0`. |
955
- | `CI` | Disable the automatic published-version check when set. |
956
- | `GITHUB_WEBHOOK_SECRET` | Default signing secret for GitHub forwarding and replay. |
957
- | `GITHUB_APP_ID` / `GITHUB_APP_PRIVATE_KEY` / `GITHUB_APP_INSTALLATION_ID` | GitHub App authentication for outbound API calls. |
958
- | `GITHUB_TOKEN` / `GH_TOKEN` | Token authentication for outbound API calls. Unset both for `github forward`. |
959
- | `SLACK_BOT_TOKEN` / `SLACK_APP_TOKEN` | Slack tokens for one agent. Use `<PREFIX>_SLACK_BOT_TOKEN` and `<PREFIX>_SLACK_APP_TOKEN` for each agent on a multi-agent host. |
960
-
961
- ## What's next
962
-
963
- - [Project layout](/docs/reference/project-layout.md): files the CLI discovers
964
- - [HTTP API](/docs/reference/http-api.md): routes used by `chat`, `call`, and other clients
965
- - [Deployment](/docs/deployment.md): production auth, state, and operations
879
+ | No command | Print help and exit `1`. Explicit `help`, `--help`, and `-h` exit `0`. |
880
+ | `run` | For local and running-server trajectories, exit `1` when the trajectory fails. |
881
+ | `call` | Exit `1` unless the response succeeds with `ok: true`. |
882
+ | `skill` | Exit `2` when the name is missing and `1` when the request fails. |
883
+ | `trajectory` | Exit `1` when the reconstructed trajectory failed. |
884
+ | `eval` | Exit `1` for failed cases, or scored cases below threshold with `--strict`; exit `2` for invalid eval options or an execution with no matching cases. An empty `--list` succeeds. |
885
+ | `eval status` | Exit `3` while the batch runs, `1` when it failed or was cancelled, and `2` for invalid usage. |
886
+ | `chat`, `session` | Exit `2` for documented option conflicts or missing required input. |
887
+ | `validate` | Exit `1` when any project diagnostic has error severity. |
888
+ | `convert-automation` | Exit `1` for invalid input, authentication, export, or file-write failure. Warnings and dependency-install failure don't change a successful conversion exit. |
889
+ | Other commands | Exit nonzero when validation, authentication, a request, or the requested operation fails. |
890
+
891
+ ## Related
892
+
893
+ - [Project layout](/docs/reference/project-layout.md)
894
+ - [Sessions, events, and streaming](/docs/reference/sessions.md)
895
+ - [Evals](/docs/reference/evals.md)
896
+ - [HTTP API](/docs/reference/http-api.md)
897
+ - [Deployment](/docs/deployment.md)