Skip to content

Commit e429f7e

Browse files
committed
Enhance README and Taskfile to include CodeBundle authoring skills installation
- Updated README to clarify the installation of authoring skills as Cursor rules during setup. - Added a new task in Taskfile for installing CodeBundle authoring skills, ensuring they are copied to the appropriate directory. - Modified the on-create script to install skills as part of the devcontainer setup process. These changes improve the developer experience by providing clear guidance and automating the installation of essential skills.
1 parent 674e871 commit e429f7e

12 files changed

+3230
-6
lines changed

.devcontainer/on-create.sh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,35 @@ if [ -f "${CODECOLLECTION_DIR}/requirements.txt" ]; then
7979
fi
8080

8181
# ------------------------------------------------------------------
82-
# 4. Ensure auth directory exists for credential mounts
82+
# 4. Install CodeBundle authoring skills as Cursor rules
83+
# ------------------------------------------------------------------
84+
DEVTOOLS_DIR="${RUNWHEN_HOME}/devtools"
85+
SKILLS_SRC="${DEVTOOLS_DIR}/skills"
86+
RULES_DIR="${CODECOLLECTION_DIR}/.cursor/rules"
87+
88+
if [ -d "${SKILLS_SRC}" ]; then
89+
mkdir -p "${RULES_DIR}"
90+
for skill in "${SKILLS_SRC}"/*.md; do
91+
[ -f "$skill" ] || continue
92+
base=$(basename "$skill" .md)
93+
cp "$skill" "${RULES_DIR}/${base}.mdc"
94+
echo " Installed skill: ${base}"
95+
done
96+
if [ ! -f "${RULES_DIR}/.gitignore" ]; then
97+
printf '# Injected by codecollection-devtools -- do not commit\n*.mdc\n' > "${RULES_DIR}/.gitignore"
98+
fi
99+
echo "Skills installed to ${RULES_DIR}"
100+
else
101+
echo "Skills directory not found at ${SKILLS_SRC}, skipping."
102+
fi
103+
104+
# ------------------------------------------------------------------
105+
# 5. Ensure auth directory exists for credential mounts
83106
# ------------------------------------------------------------------
84107
mkdir -p "${RUNWHEN_HOME}/auth"
85108

86109
# ------------------------------------------------------------------
87-
# 5. Verify key tools are available
110+
# 6. Verify key tools are available
88111
# ------------------------------------------------------------------
89112
echo ""
90113
echo "--- Environment ready ---"

README.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ task setup REPO=runwhen-contrib/rw-cli-codecollection PR=42
4848
task setup REPO=runwhen-contrib/azure-c7n-codecollection BRANCH=feat/foo
4949
```
5050

51-
That clones the repo, installs Python deps, and checks out the PR branch if specified.
51+
That clones the repo, installs Python deps, installs authoring skills as Cursor rules, and checks out the PR branch if specified.
5252

5353
### Option 2: VS Code devcontainer (local)
5454

@@ -94,7 +94,7 @@ docker run --rm -it \
9494
| `BRANCH` | `main` | Branch to check out after cloning. |
9595
| `PR` | *(none)* | If set, checks out the PR branch via `gh pr checkout`. |
9696

97-
Other tasks: `task verify` (check tools), `task clean` (remove cloned codecollection).
97+
Other tasks: `task verify` (check tools), `task install-skills` (re-install skills), `task clean` (remove cloned codecollection).
9898

9999
## Environment variables
100100

@@ -148,6 +148,38 @@ Mount or copy credentials into the `auth/` directory:
148148

149149
---
150150

151+
## CodeBundle authoring skills
152+
153+
The `skills/` directory contains platform-specific authoring guidance that is
154+
automatically installed as [Cursor rules](https://docs.cursor.com/context/rules)
155+
during `task setup`. These give AI assistants (and human authors) context about
156+
generation rules, SLI patterns, and test infrastructure conventions.
157+
158+
| Skill | Covers |
159+
|-------|--------|
160+
| `generation-rules-kubernetes.md` | K8s resource types, match rules, qualifiers, templates |
161+
| `generation-rules-aws.md` | AWS resource types, CloudQuery tables, account qualifiers |
162+
| `generation-rules-azure.md` | Azure + Azure DevOps platforms, resource groups, subscriptions |
163+
| `generation-rules-gcp.md` | GCP resource types, project qualifiers |
164+
| `sli-authoring.md` | In-repo SLIs, cron-scheduler SLIs, scoring patterns |
165+
| `test-infra-kubernetes.md` | Static manifests, Terraform patterns, Taskfile contract |
166+
| `test-infra-azure.md` | Azure Terraform test infra, tf.secret, workspaceInfo |
167+
| `test-infra-azure-devops.md` | DevOps projects, pipelines, agent pools via Terraform |
168+
| `test-infra-cloud.md` | Shared conventions across all cloud platforms |
169+
170+
Skills are copied to `{codecollection}/.cursor/rules/*.mdc` at setup time. A
171+
`.gitignore` is placed in that directory to prevent accidental commits. To
172+
re-install after an update, run:
173+
174+
```bash
175+
task install-skills
176+
```
177+
178+
These same skills are used by the [CodeBundle Farm](https://github.com/runwhen/codebundle-farm)
179+
Creator agent. Changes should be synced between both repos.
180+
181+
---
182+
151183
## What's in the image
152184

153185
| Category | Tools |
@@ -180,7 +212,11 @@ codecollection-devtools/
180212
│ └── workflows/
181213
│ ├── build-push.yaml # CI: multi-arch build → GHCR + GCP Artifact Registry
182214
│ └── pypi.yaml # publish rw-devtools to PyPI (deprecated)
183-
├── Taskfile.yml # task setup, task verify, task clean
215+
├── skills/ # CodeBundle authoring skills (installed as Cursor rules)
216+
│ ├── generation-rules-*.md # Platform-specific generation rule guides
217+
│ ├── sli-authoring.md # SLI design and implementation guide
218+
│ └── test-infra-*.md # Test infrastructure patterns per platform
219+
├── Taskfile.yml # task setup, task verify, task install-skills, task clean
184220
├── Dockerfile # image definition (built by CI, not locally)
185221
├── ro # Robot Framework test runner wrapper
186222
├── requirements.txt # base Python dependencies
@@ -215,7 +251,8 @@ devcontainer opens
215251
1. clones repo into /home/runwhen/codecollection/
216252
2. checks out PR branch (if PR set)
217253
3. pip installs codecollection's requirements.txt
218-
4. verifies tools (ro, robot, kubectl, gh, python)
254+
4. installs skills/ as .cursor/rules/*.mdc
255+
5. verifies tools (ro, robot, kubectl, gh, python)
219256
→ ready to develop
220257
```
221258

Taskfile.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ version: "3"
33
vars:
44
RUNWHEN_HOME: /home/runwhen
55
CODECOLLECTION_DIR: "{{.RUNWHEN_HOME}}/codecollection"
6+
DEVTOOLS_DIR: "{{.RUNWHEN_HOME}}/devtools"
7+
SKILLS_SRC: "{{.DEVTOOLS_DIR}}/skills"
68
DEFAULT_REPO: runwhen-contrib/rw-cli-codecollection
79
DEFAULT_BRANCH: main
810

@@ -32,6 +34,7 @@ tasks:
3234
- task: checkout-pr
3335
vars: { PR: "{{.PR}}" }
3436
- task: install-deps
37+
- task: install-skills
3538
- task: verify
3639

3740
clone:
@@ -78,6 +81,29 @@ tasks:
7881
fi
7982
- mkdir -p "{{.RUNWHEN_HOME}}/auth"
8083

84+
install-skills:
85+
desc: Install CodeBundle authoring skills as Cursor rules
86+
cmds:
87+
- |
88+
RULES_DIR="{{.CODECOLLECTION_DIR}}/.cursor/rules"
89+
if [ ! -d "{{.SKILLS_SRC}}" ]; then
90+
echo "Skills directory not found at {{.SKILLS_SRC}}, skipping."
91+
exit 0
92+
fi
93+
mkdir -p "$RULES_DIR"
94+
for skill in "{{.SKILLS_SRC}}"/*.md; do
95+
[ -f "$skill" ] || continue
96+
base=$(basename "$skill" .md)
97+
target="$RULES_DIR/${base}.mdc"
98+
cp "$skill" "$target"
99+
echo " Installed skill: ${base}"
100+
done
101+
if [ ! -f "$RULES_DIR/.gitignore" ]; then
102+
echo "# Injected by codecollection-devtools -- do not commit" > "$RULES_DIR/.gitignore"
103+
echo "*.mdc" >> "$RULES_DIR/.gitignore"
104+
fi
105+
echo "Skills installed to $RULES_DIR"
106+
81107
verify:
82108
desc: Check that key tools are available
83109
cmds:

0 commit comments

Comments
 (0)