Skip to content

Commit cc70869

Browse files
authored
Merge branch 'main' into auto/update-cagent-action
2 parents 8b1b707 + 070f968 commit cc70869

File tree

667 files changed

+43814
-9507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

667 files changed

+43814
-9507
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# PreToolUse hook for the Bash tool.
3+
# Blocks dangerous git patterns that cause CI failures.
4+
set -euo pipefail
5+
6+
input=$(cat)
7+
command=$(echo "$input" | jq -r '.tool_input.command // empty')
8+
9+
if [ -z "$command" ]; then
10+
exit 0
11+
fi
12+
13+
# Block 'git add .' / 'git add -A' / 'git add --all'
14+
# These stage package-lock.json and other generated files.
15+
if echo "$command" | grep -qE 'git\s+add\s+(\.|--all|-A)(\s|$|;)'; then
16+
echo "BLOCKED: do not use 'git add .' / 'git add -A' / 'git add --all'. Stage files explicitly by name." >&2
17+
exit 2
18+
fi
19+
20+
exit 0

.agents/hooks/enforce-vendored.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# PreToolUse hook for Edit and Write tools.
3+
# Blocks edits to vendored content that must be fixed upstream.
4+
set -euo pipefail
5+
6+
input=$(cat)
7+
file_path=$(echo "$input" | jq -r '.tool_input.file_path // empty')
8+
9+
if [ -z "$file_path" ]; then
10+
exit 0
11+
fi
12+
13+
# Block edits to vendored Hugo modules.
14+
if echo "$file_path" | grep -qE '/_vendor/'; then
15+
echo "BLOCKED: _vendor/ is vendored from upstream Hugo modules. Fix in the source repo instead." >&2
16+
exit 2
17+
fi
18+
19+
# Block edits to vendored CLI reference data.
20+
if echo "$file_path" | grep -qE '/data/cli/'; then
21+
echo "BLOCKED: data/cli/ is generated from upstream repos (docker/cli, docker/buildx, etc.). Fix in the source repo instead." >&2
22+
exit 2
23+
fi
24+
25+
exit 0

.agents/settings.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"hooks": {
3+
"PreToolUse": [
4+
{
5+
"matcher": "Edit|Write",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "bash .agents/hooks/enforce-vendored.sh"
10+
}
11+
],
12+
"description": "Block edits to vendored content (_vendor/, data/cli/)"
13+
},
14+
{
15+
"matcher": "Bash",
16+
"hooks": [
17+
{
18+
"type": "command",
19+
"command": "bash .agents/hooks/enforce-git-hygiene.sh"
20+
}
21+
],
22+
"description": "Block git add . and dangerous patterns"
23+
}
24+
]
25+
}
26+
}

.agents/skills/check-pr/SKILL.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
name: check-pr
3+
description: >
4+
Check a single PR's CI status, review comments, and requested changes.
5+
Fix actionable failures and address feedback. "check PR 1234", "what's
6+
the status of my PR", "address review comments on #500".
7+
argument-hint: "<pr-number>"
8+
context: fork
9+
---
10+
11+
# Check PR
12+
13+
Do one pass over PR **$ARGUMENTS**: check CI, read reviews, fix what's
14+
actionable, report status.
15+
16+
## 1. Gather PR state
17+
18+
```bash
19+
# Overall state
20+
gh pr view $ARGUMENTS --repo docker/docs --json state,title,url,headRefName
21+
22+
# CI checks
23+
gh pr checks $ARGUMENTS --repo docker/docs --json name,state,detailsUrl
24+
25+
# Top-level reviews
26+
gh pr view $ARGUMENTS --repo docker/docs --json reviews,reviewDecision
27+
28+
# Inline (line-level) comments — NOT included in the above
29+
gh api repos/docker/docs/pulls/$ARGUMENTS/comments \
30+
--jq '[.[] | {id: .id, author: .user.login, body: .body, path: .path, line: .line}]'
31+
```
32+
33+
Always check both the reviews endpoint and the inline comments endpoint.
34+
A review with an empty body may still have line-level comments requiring
35+
action.
36+
37+
## 2. If merged
38+
39+
Report the final state. Then check for any unanswered review comments (both
40+
top-level and inline) and reply to each one explaining what was done or that
41+
the issue was addressed in a follow-up. Skip to step 6 after.
42+
43+
## 3. If closed without merge
44+
45+
Read the closing context to understand why:
46+
47+
```bash
48+
gh pr view $ARGUMENTS --repo docker/docs --json closedAt,comments \
49+
--jq '{closedAt, lastComment: .comments[-1].body}'
50+
```
51+
52+
Report the reason. Common causes: rejected by maintainers, superseded by
53+
another PR, closed by automation.
54+
55+
## 4. If CI is failing
56+
57+
- Read the failure details (follow `detailsUrl` if needed)
58+
- Determine if the failure is in the PR's changed files or pre-existing
59+
- **Actionable:** check out the branch, fix, commit, push
60+
```bash
61+
git checkout <branch>
62+
# fix the issue
63+
git add <files>
64+
git commit -m "fix: <description>"
65+
git push
66+
```
67+
- **Pre-existing / upstream:** note it, do not block
68+
69+
## 5. If review comments or changes requested
70+
71+
- Read each unresolved comment
72+
- Address feedback in a follow-up commit
73+
- Push, then reply to each comment explaining what was done:
74+
```bash
75+
gh api repos/docker/docs/pulls/$ARGUMENTS/comments \
76+
--method POST \
77+
--field in_reply_to=<comment-id> \
78+
--field body="<response>"
79+
```
80+
- End every comment reply with a `Generated by [Claude Code](https://claude.com/claude-code)` footer
81+
- Resolve each thread via GraphQL after replying:
82+
```bash
83+
# Get thread IDs
84+
gh api graphql -f query='
85+
query($owner:String!, $repo:String!, $pr:Int!) {
86+
repository(owner:$owner, name:$repo) {
87+
pullRequest(number:$pr) {
88+
reviewThreads(first:50) {
89+
nodes { id isResolved comments(first:1) { nodes { path } } }
90+
}
91+
}
92+
}
93+
}' -f owner=docker -f repo=docs -F pr=$ARGUMENTS \
94+
--jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | {id, path: .comments.nodes[0].path}'
95+
96+
# Resolve a thread
97+
gh api graphql -f query='
98+
mutation($id:ID!) { resolveReviewThread(input:{threadId:$id}) { thread { isResolved } } }
99+
' -f id=<thread-id>
100+
```
101+
- Re-request review if changes were requested
102+
103+
## 6. Report
104+
105+
```
106+
## PR #$ARGUMENTS: <title>
107+
108+
**State:** <open|merged|closed>
109+
**CI:** <passing|failing|pending>
110+
**Review:** <approved|changes requested|pending>
111+
**Action taken:** <what was done, or "none needed">
112+
```
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
name: create-lab-guide
3+
description: >
4+
Create a guide page for a Labspace. This includes writing the markdown content for the guide,
5+
structuring it according to Docker docs conventions, and ensuring it provides clear instructions
6+
and information about the Labspace. Includes learning about the lab itself, extracting out its
7+
learning objectives, and combining all of that into a well-structured guide markdown file.
8+
---
9+
10+
# Create Lab Guide
11+
12+
You are creating a new guide page for a labspace. The guide should be structured according to Docker docs conventions,
13+
with clear sections, learning objectives, and instructions for users to get the most out of the lab.
14+
15+
## Inputs
16+
17+
The user provides one or more guides to migrate. Resolve these from the inventory below:
18+
19+
- **REPO_NAME**: GitHub repo in the `dockersamples` org (e.g. `labspace-ai-fundamentals`)
20+
21+
## Step 1: Clone the labspace repo
22+
23+
Clone the guide repo to a temporary directory. This gives you all source files locally — no HTTP calls needed.
24+
25+
```bash
26+
git clone --depth 1 https://github.com/dockersamples/{REPO_NAME}.git <tmpdir>/{REPO_NAME}
27+
```
28+
29+
Where `<tmpdir>` is a temporary directory on your system (e.g. the output of `mktemp -d`).
30+
31+
## Step 2: Learn and extract key information about the lab
32+
33+
The repo structure is:
34+
35+
- `<tmpdir>/{REPO_NAME}/README.md` — the main README for the lab
36+
- `<tmpdir>/{REPO_NAME}/labspace/labspace.yaml` — a YAML document outlining details of the lab, including the sections/modules and the path to their content
37+
- `<tmpdir>/{REPO_NAME}/labspace/*.md` — the content for each section/module (only reference the files specified in `labspace.yaml`)
38+
- `<tmpdir>/{REPO_NAME}/.github/workflows/` — the GHA workflow that publishes the labspace. It includes the repo URL for the published Compose file, which will be useful for the "launch" command
39+
- `<tmpdir>/{REPO_NAME}/compose.override.yaml` - lab-specific Compose customizations
40+
41+
1. Read `README.md` to understand the purpose of the lab.
42+
2. Read the `labspace/labspace.yaml` to understand the structure of the lab and its sections/modules.
43+
3. Read the `labspace/*.md` files to extract the learning objectives, instructions, and any code snippets.
44+
4. Extract a short description that can be used for the `description` and `summary` fields in the guide markdown.
45+
5. Determine if a model will be pulled when starting the lab by looking at the `compose.override.yaml` file and looking for the any top-level `model` specifications.
46+
47+
48+
## Step 2: Write the guide markdown
49+
50+
The markdown file must be located in the `guides/` directory and have a filename of `lab-{GUIDE_ID}.md`.
51+
52+
Sample markdown structure, including frontmatter and content:
53+
54+
```markdown
55+
---
56+
title: "Lab: { Short title }"
57+
linkTitle: "Lab: { Short title }"
58+
description: |
59+
A short description of the lab for SEO and social sharing.
60+
summary: |
61+
A short summary of the lab for the guides listing page. 2-3 lines.
62+
keywords: AI, Docker, Model Runner, agentic apps, lab, labspace
63+
aliases: # Include if the lab is an AI-related lab
64+
- /labs/docker-for-ai/{REPO_NAME_WITHOUT_LABSPACE_PREFIX}/
65+
params:
66+
tags: [ai, labs]
67+
time: 20 minutes
68+
resource_links:
69+
- title: A resource link pointing to relevant documentation or code
70+
url: /ai/model-runner/
71+
- title: Labspace repository
72+
url: https://github.com/dockersamples/{REPO_NAME}
73+
---
74+
75+
Short explanation of the lab and what it covers.
76+
77+
## Launch the lab
78+
79+
{{< labspace-launch image="dockersamples/{REPO_NAME}" >}}
80+
81+
## What you'll learn
82+
83+
By the end of this Labspace, you will have completed the following:
84+
85+
- Objective #1
86+
- Objective #2
87+
- Objective #3
88+
- Objective #4
89+
90+
## Modules
91+
92+
| # | Module | Description |
93+
|---|--------|-------------|
94+
| 1 | Module #1 | Description of module #1 |
95+
| 2 | Module #2 | Description of module #2 |
96+
| 3 | Module #3 | Description of module #3 |
97+
| 4 | Module #4 | Description of module #4 |
98+
| 5 | Module #5 | Description of module #5 |
99+
| 6 | Module #6 | Description of module #6 |
100+
```
101+
102+
Important notes:
103+
104+
- The learning objectives should be based on the content of the labspace as a whole.
105+
- The modules should be based on the sections/modules outlined in `labspace.yaml`.
106+
- All lab guides _must_ have a tag of `labs`
107+
- If the lab is AI-related, it should also have a tag of `ai` and aliases for `/labs/docker-for-ai/{REPO_NAME}/`
108+
- If the lab pulls a model, add a `model-download: true` parameter to the `labspace-launch` shortcode to show a warning about model downloads.
109+
110+
111+
## Step 3: Apply Docker docs style rules
112+
113+
These are mandatory (from STYLE.md and AGENTS.md):
114+
115+
- **No "we"**: "We are going to create" → "Create" or "Start by creating"
116+
- **No "let us" / "let's"**: → imperative voice or "You can..."
117+
- **No hedge words**: remove "simply", "easily", "just", "seamlessly"
118+
- **No meta-commentary**: remove "it's worth noting", "it's important to understand"
119+
- **No "allows you to" / "enables you to"**: → "lets you" or rephrase
120+
- **No "click"**: → "select"
121+
- **No bold for emphasis or product names**: only bold UI elements
122+
- **No time-relative language**: remove "currently", "new", "recently", "now"
123+
- **No exclamations**: remove "Voila!!!" etc.
124+
- Use `console` language hint for interactive shell blocks with `$` prompts
125+
- Use contractions: "it's", "you're", "don't"
126+

0 commit comments

Comments
 (0)