Skip to content

Commit 741bf49

Browse files
rosieyohannanhanabel1claude
authored
chunk CLI + sidecars improvements (#10343)
* use numbered steps to get set up with chunk cli * some updates to chunk cli docs for clarity for reader * fix style issue * allow code references in xref link text * document chunk task command in chunk CLI guide Adds a "Trigger Chunk tasks" section covering `chunk task config` and `chunk task run`, plus an intro bullet and Next steps link on the install page so the command is discoverable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * style and formatting * formatting of chunk * fix order of steps --------- Co-authored-by: Hanabel M. <hanabel.mengistu@circleci.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4c37c85 commit 741bf49

5 files changed

Lines changed: 210 additions & 57 deletions

File tree

docs/guides/modules/ROOT/nav.adoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,17 @@
321321
*** xref:guides:toolkit:chunk-setup-and-overview.adoc[Chunk Setup and Overview]
322322
*** xref:toolkit:using-the-circleci-mcp-server.adoc[Using the CircleCI MCP server]
323323
*** xref:toolkit:intelligent-summaries.adoc[Intelligent summaries]
324-
** CLI
325-
*** xref:toolkit:environment-cli-usage-guide.adoc[CircleCI environment CLI usage guide]
324+
** Local CLI
326325
*** xref:toolkit:local-cli.adoc[Install and configure the CircleCI local CLI]
327326
*** xref:toolkit:how-to-use-the-circleci-local-cli.adoc[How to use the CircleCI local CLI]
328-
*** xref:toolkit:install-and-configure-the-chunk-cli.adoc[Install and configure the chunk CLI]
329-
*** xref:toolkit:how-to-use-chunk-cli.adoc[How to use the chunk CLI]
327+
328+
** Chunk CLI
329+
*** xref:toolkit:install-and-configure-the-chunk-cli.adoc[Install and configure the Chunk CLI]
330+
*** xref:toolkit:how-to-use-chunk-cli.adoc[How to use the Chunk CLI]
331+
332+
** Environment CLI
333+
*** xref:toolkit:environment-cli-usage-guide.adoc[CircleCI environment CLI usage guide]
334+
330335
** APIs
331336
*** xref:toolkit:api-intro.adoc[API v2 intro]
332337
*** xref:toolkit:api-developers-guide.adoc[API v2 developers guide]

docs/guides/modules/toolkit/pages/how-to-use-chunk-cli.adoc

Lines changed: 133 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
= How to use the chunk CLI
1+
= How to use the Chunk CLI
22
:page-platform: Cloud
3-
:page-description: How to use the chunk CLI to generate AI review prompts, run validations, manage Chunk sidecars, and install AI agent skills.
3+
:page-description: How to use the `chunk` CLI to generate AI review prompts, run validations, manage Chunk sidecars, and install AI agent skills.
44
:experimental:
55

66
This page describes how to use the main features of the `chunk` CLI.
@@ -62,7 +62,7 @@ You can customize this behavior with the following flags:
6262
--
6363

6464
[#run-validation]
65-
== Validate your changes
65+
== Validate your changes locally
6666

6767
The `chunk validate` command runs the commands configured in your project's `.chunk/config.json`. Use it to verify your changes pass all quality checks before pushing.
6868

@@ -105,20 +105,85 @@ The following flags are available:
105105
--
106106

107107
[#run-validation-in-a-sidecar]
108-
=== Validate in a Chunk sidecar
108+
[badge="Preview"]
109+
== Validate in a Chunk sidecar
109110

110111
CAUTION: Chunk sidecars are available in preview if you are on a paid plan. The product is in its early stages and you may encounter bugs, unexpected behavior, or incomplete features. If you have feedback, you can share it on our link:https://discord.com/invite/circleci[Discord]. When the feature is made generally available, there will be a cost associated with access and usage.
111112

112-
To validate in a CircleCI Cloud environment instead of locally, pass a Chunk sidecar ID:
113+
Chunk sidecars let you validate your changes in a CircleCI Cloud environment instead of locally. This ensures your code runs against the same environment your CI pipeline uses.
114+
115+
Follow these steps to validate in a Chunk sidecar:
116+
117+
=== 1. Authenticate with CircleCI
118+
119+
Before creating a Chunk sidecar, authenticate with CircleCI:
120+
121+
[source,console]
122+
----
123+
$ chunk auth set circleci
124+
----
125+
126+
Enter your CircleCI personal API token when prompted. Generate a token from your link:https://app.circleci.com/settings/user/tokens[User Settings, window=_blank] in the CircleCI web app.
127+
128+
=== 2. Create a Chunk sidecar
129+
130+
Create a new Chunk sidecar environment:
131+
132+
[source,console]
133+
----
134+
$ chunk sidecar create --name <name>
135+
----
136+
137+
Replace `<name>` with a descriptive name for your sidecar. The command auto-detects your tech stack, generates a Dockerfile, and provisions a cloud environment. When ready, it prints the Chunk sidecar ID. Copy this ID for use in the validation step.
138+
139+
=== 3. Sync your local files to the sidecar
140+
141+
Sync your local project files to the Chunk sidecar:
142+
143+
[source,console]
144+
----
145+
$ chunk sidecar sync
146+
----
147+
148+
This copies your current working directory to the remote environment.
149+
150+
=== 4. Run validation in the sidecar
151+
152+
Run your validation commands in the Chunk sidecar:
113153

114154
[source,console]
115155
----
116156
$ chunk validate --sidecar-id <sidecar-id>
117157
----
118158

119-
To get a Chunk sidecar ID, run `chunk sidecar create` and copy the ID printed when the environment is ready, or run `chunk sidecar list` to retrieve the ID of an existing Chunk sidecar. See the <<manage-sidecars>> section for details.
159+
Replace `<sidecar-id>` with the ID from step 2. The command executes all configured validation commands from your `.chunk/config.json` in the remote environment.
160+
161+
=== 5. (Optional) SSH into the sidecar for debugging
162+
163+
If validation fails and you need to investigate, SSH into the Chunk sidecar:
164+
165+
[source,console]
166+
----
167+
$ chunk sidecar ssh
168+
----
169+
170+
This opens an interactive shell in the remote environment.
171+
172+
=== 6. (Optional) Snapshot the sidecar for reuse
173+
174+
After configuring a Chunk sidecar successfully, capture its state as a snapshot for faster future sessions:
175+
176+
[source,console]
177+
----
178+
$ chunk sidecar snapshot create --name <snapshot-name>
179+
----
180+
181+
The command prints a snapshot ID. Use this ID to create new sidecars with `chunk sidecar create --name <name> --image <snapshot-id>`.
182+
183+
For more details on managing Chunk sidecars, see the <<manage-sidecars>> section.
120184

121185
[#manage-sidecars]
186+
[badge="Preview"]
122187
== Manage Chunk sidecars
123188

124189
CAUTION: Chunk sidecars are available in preview if you are on a paid plan. The product is in its early stages and you may encounter bugs, unexpected behavior, or incomplete features. If you have feedback, you can share it on our link:https://discord.com/invite/circleci[Discord]. When the feature is made generally available, there will be a cost associated with access and usage.
@@ -194,6 +259,67 @@ $ chunk sidecar sync
194259
$ chunk sidecar exec <command>
195260
----
196261

262+
[#trigger-chunk-tasks]
263+
== Trigger Chunk tasks
264+
265+
The `chunk task` command triggers a xref:guides:toolkit:chunk-setup-and-overview.adoc[Chunk Task] in CircleCI Cloud from your terminal, instead of opening the Chunk task drawer in the CircleCI web app.
266+
267+
[#configure-task-runs]
268+
=== Configure task runs
269+
270+
Before you can trigger a task run, set up `.chunk/run.json` for the repository. This file records the CircleCI project to run the task against.
271+
272+
From your project directory:
273+
274+
[source,console]
275+
----
276+
$ chunk task config
277+
----
278+
279+
The command fetches your CircleCI projects and prompts you to select the project to use. It then saves the selection to `.chunk/run.json`. Pass `--force` (or `-f`) to overwrite an existing configuration without confirmation.
280+
281+
[#trigger-a-task-run]
282+
=== Trigger a task run
283+
284+
After you have configured the repository, trigger a task run with `chunk task run`:
285+
286+
[source,console]
287+
----
288+
$ chunk task run --definition <name-or-uuid> --prompt "<prompt text>"
289+
----
290+
291+
Replace `<name-or-uuid>` with the name or UUID of the Chunk task definition you want to run, and `<prompt text>` with the instructions to send to the task. Both flags are required.
292+
293+
The command prints the run ID and pipeline ID when the task is triggered.
294+
295+
The following flags are available:
296+
297+
[.table-scroll]
298+
--
299+
[cols=2*, options="header"]
300+
|===
301+
|Flag |Description
302+
303+
|`--definition <name-or-uuid>`
304+
|Required. Name or UUID of the Chunk task definition to run.
305+
306+
|`--prompt <text>`
307+
|Required. Prompt text to send to the task.
308+
309+
|`--branch <branch>`
310+
|Override the branch the task checks out.
311+
312+
|`--new-branch`
313+
|Create a new branch for the task run.
314+
315+
|`--no-pipeline-as-tool`
316+
|Disable running the pipeline as a tool.
317+
318+
|`--json`
319+
|Print the response as JSON.
320+
|===
321+
--
322+
197323
[#install-skills]
198324
== Install AI agent skills
199325

@@ -287,3 +413,4 @@ Supported keys:
287413
== Next steps
288414

289415
* xref:guides:toolkit:chunk-setup-and-overview.adoc[Set up Chunk in the CircleCI Web App]
416+
* link:https://github.com/CircleCI-Public/chunk-cli/blob/main/docs/CLI.md[View the full command list in the Chunk CLI repository, window=_blank]

0 commit comments

Comments
 (0)