docs/STYLE_GUIDE.md
.mdx for all filesCreate Pipeline..., Deploy App...Example code should be stored in a snippets/XXX subdirectory
By default, provide code snippets for all available SDK languages, with each code snippet in a separate tab. The order of tabs should always be Go, Python and TypeScript. Here is an example:
<Tabs groupId="language" queryString="sdk">
<TabItem value="go" label="Go">
...
</TabItem>
<TabItem value="python" label="Python">
...
</TabItem>
<TabItem value="typescript" label="TypeScript">
...
</TabItem>
</Tabs>
Always capitalize and use code font for Dagger core types such as Container, Secret, etc
Omit the () for readability since a lot of the time it's either not necessary, or implies no args are needed, and sometimes you just want to refer to a method call and ignore its required args e.g. Container.asService
Dagger Functions and arguments in code listings should be documented inline "wherever possible", except for Cookbook recipes where this is "mandatory" since these are intended to be best-practice examples. This inline documentation includes at minimum
ctx (Go) and self (Python)The minimal set of files to be included for a code listing are
dagger.json.gitignore.gitattributes (optional)main.go, go.mod and go.sumyou, we, our and other personal pronouns, except in the quickstart which is intended as a companion journey. Alternatives are (e.g. instead of this is where you will deploy the application):
this is where the application will be deployedthe application will be deployed heredeploy the application to...- for unordered lists and a number followed by a period 1. for ordered lists:) should be in bold text e.g. **State and duration**: Get visual cues for cached and pending states, and see exactly how long each step of your workflow takes.Lists section)Click the **Start** button.The Cookbook is organized into categories, each of which has two or more recipes. New categories may be added at will; however, ideally a category should contain at least two recipes.
Each recipe requires only:
dagger call, in an "Example" level-4 heading (required)./cookbook/snippets/RECIPE/LANGUAGE/FILE)Go, Python and TypeScriptSome screen recordings can be auto-generated with the docs/recorder module
Generate recordings for some feature pages:
dagger call generate-feature-recordings --base=../current_docs/features/snippets --github-token=<plaintext-token> export --path=/tmp/out
Generate recordings manually for other feature pages:
dagger logout
export PS1="$ " >> ~/.bashrc
# run each command once to warm the cache before recording
asciinema rec --overwrite --cols=80 --rows=24 ~/images/debug-breakpoints.asc
asciinema rec --overwrite --cols=80 --rows=24 ~/images/debug-interactive.asc
asciinema rec --overwrite --cols=80 --rows=24 ~/images/service-container.asc
asciinema rec --append --cols=80 --rows=24 ~/images/service-container.asc # in separate console
asciinema rec --overwrite --cols=80 --rows=24 ~/images/service-host.asc
# manually edit all .asc files to remove closing `$ exit`
# manually edit `service-container.asc` file to insert line break `\n` between terminal outputs
cd ~/images
docker run --rm -it -u $(id -u):$(id -g) -v $PWD:/data agg <file>.asc <file>.gif
Generate recordings for some quickstart pages:
dagger call generate-quickstart-recordings --base=../current_docs/ci/quickstart/snippets export --path=/tmp/out