Skip to content

Commit f2490e0

Browse files
authored
Move operation skills over (#269)
1 parent 00a032b commit f2490e0

11 files changed

Lines changed: 543 additions & 7 deletions

File tree

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
---
2+
name: implement-command-spec
3+
description: Orchestrate and verify command-spec Oz runs for Linear tickets. Starts an implementation run using the add-command-spec skill, verifies all edited/created generators have meaningful screenshots, and retries with follow-up runs until validation passes. Use this skill whenever you need to implement and fully validate a command-spec Linear ticket end-to-end, or when a user provides a Linear ticket that involves adding or modifying command completions in the command-signatures repo.
4+
---
5+
6+
# implement-command-spec
7+
8+
You are an orchestration agent managing the full lifecycle of a command-spec ticket: implementation, screenshot verification, and follow-up correction runs. You receive a Linear ticket URL or ID and drive it to completion autonomously.
9+
10+
## Prerequisites
11+
12+
- `gh` CLI (authenticated, with access to `warpdotdev/command-signatures`)
13+
- Linear MCP server connected
14+
15+
## Constants
16+
17+
- **Environment ID**: `Z0IIFcJio9DgsLd71HqTvY` (Command completions environment).
18+
- **Skill**: `warpdotdev/command-signatures:add-command-spec`
19+
- **Max verification cycles**: 4 (initial run + up to 3 follow-ups)
20+
- **Max failure retries per run**: 2 (so up to 3 attempts per run before giving up)
21+
- **Poll interval**: 30 seconds, exponential backoff to at most 480 seconds (8 minutes)
22+
23+
## Phase 1: Extract ticket info
24+
25+
Use the Linear MCP `get_issue` tool to fetch the ticket. Record:
26+
- The ticket identifier (e.g. `APP-3478`)
27+
- The ticket title and description — you will need these to construct follow-up prompts later.
28+
29+
## Phase 2: Start the implementation run
30+
31+
Spawn an agent with computer use enabled.
32+
- In remote environments, use <ENVIRONMENT_ID>.
33+
- Prompt the agent with the full "warpdotdev/command-signatures:add-command-spec" skill, along with the following instructions:
34+
"Use the add_command_spec skill to address this linear ticket: <LINEAR_TICKET>. Screenshots should be included as images in the PR description following the upload process, or posted to the Linear issue and linked to in the GitHub PR description if that's not possible."
35+
36+
Once the agent has started, note its run ID and session links, so that they can reported back to the user.
37+
38+
## Phase 3: Handle the spawned agent
39+
40+
When the agent reaches a terminal state:
41+
- If it **succeeded**: Proceed to Phase 4.
42+
- If it **failed**: Inspect the status message in the output.
43+
- If it contains **"Environment setup failed"**, this is a configuration error. **Stop immediately** and report the error — do not retry.
44+
- For any other failure, restart the run by repeating Phase 2. You may retry up to 2 additional times (3 total attempts per run). If all attempts fail, stop and report the failure with the last error message.
45+
46+
## Phase 4: Discover the PR and identify generators
47+
48+
### Find the PR
49+
50+
The run output includes an **Artifacts** section with the PR reference, branch name, and link:
51+
52+
```
53+
Artifacts:
54+
PR: command-signatures #233
55+
Branch: app-3478/command-spec-kubectl-kubeconfig
56+
Link: https://github.com/warpdotdev/command-signatures/pull/233
57+
```
58+
59+
If artifacts are missing, fall back to searching:
60+
61+
```sh
62+
gh pr list --repo warpdotdev/command-signatures --state open --json number,title,headRefName,url
63+
```
64+
65+
Match by ticket identifier in the branch name or PR title.
66+
67+
### Identify generators from the diff
68+
69+
Fetch the diff:
70+
71+
```sh
72+
gh pr diff <PR_NUMBER> --repo warpdotdev/command-signatures
73+
```
74+
75+
Look for changes in two locations:
76+
- **Generator source files**: `command-signatures/src/generators/<command>.rs` — each file may define multiple generator functions (e.g. `users_generator`, `services_generator`). A single file change can mean multiple generators need verification.
77+
- **JSON specs**: `json/<command>.json` — look for `generatorName` references to identify which generators are being wired up.
78+
79+
Build a list of every distinct generator that was added or modified. Include generator function names when identifiable from the diff, not just file paths — this precision matters for screenshot matching later.
80+
81+
Also check the PR description for an explicit summary of what was added; the add-command-spec skill often lists generators there.
82+
83+
## Phase 5: Validate screenshots
84+
85+
For each generator, determine whether a valid screenshot exists that proves it works.
86+
87+
### 5a: Collect screenshots from all sources
88+
89+
**GitHub PR description:**
90+
```sh
91+
gh pr view <PR_NUMBER> --repo warpdotdev/command-signatures --json body -q '.body'
92+
```
93+
94+
**GitHub PR comments:**
95+
```sh
96+
gh pr view <PR_NUMBER> --repo warpdotdev/command-signatures --json comments -q '.comments[].body'
97+
```
98+
99+
Extract image URLs from both (markdown `![...](URL)` or `<img src="URL">` tags).
100+
101+
**Linear issue**: Use the Linear MCP `get_issue` tool, then `extract_images` on the description markdown.
102+
103+
**Linear issue comments**: Use the Linear MCP `list_comments` tool, then `extract_images` on each comment body.
104+
105+
### 5b: Analyze each screenshot
106+
107+
For each image URL found:
108+
109+
1. Download it:
110+
```sh
111+
curl -sL "<IMAGE_URL>" -o /tmp/screenshot_N.png
112+
```
113+
2. View the downloaded image with `read_files` to trigger vision analysis.
114+
3. Determine:
115+
- **Which generator(s)** does this screenshot demonstrate? Look for: the command being typed, visible completions dropdown entries, flags or subcommands in the input, filenames or paths that indicate which generator was invoked.
116+
- **Is the screenshot meaningful?**
117+
- It must show the completions menu (a dropdown next to the cursor) with real, generator-produced entries.
118+
- A screenshot that shows the command typed but no completions appearing is **not valid**.
119+
- A screenshot showing an empty completions menu or only static (non-generator) completions is **not valid**.
120+
- Each generator needs at least one screenshot showing it producing non-trivial output.
121+
122+
### 5c: Build the verification map
123+
124+
Create a mapping: `generator → valid screenshot(s)`. Any generator with zero valid screenshots is **unverified**.
125+
126+
If all generators are verified, skip to Phase 7.
127+
128+
## Phase 6: Follow-up runs
129+
130+
When generators still lack valid screenshots:
131+
132+
### 6a: Update Linear status
133+
134+
If the ticket was moved to "In Review", move it back to "In Progress" using the Linear MCP `save_issue` tool:
135+
136+
```json
137+
{ "id": "<TICKET_ID>", "state": "In Progress" }
138+
```
139+
140+
### 6b: Construct the follow-up prompt
141+
142+
Read `references/follow-up-prompt-template.md` and fill in the placeholders with:
143+
- The ticket description from Phase 1
144+
- The branch name and PR URL from Phase 4
145+
- The specific list of unverified generators and what each should produce
146+
- Context about what was already verified vs. what's still missing
147+
148+
### 6c: Start the follow-up run
149+
150+
Spawn another agent with computer use enabled.
151+
- In remote environments, use <ENVIRONMENT_ID>.
152+
- Prompt the agent with the full "warpdotdev/command-signatures:add-command-spec and the <CONSTRUCTED_FOLLOW_UP_PROMPT>.
153+
154+
As before, once the agent has started, note its run ID and session links, so that they can be sent back to the user later.
155+
156+
### 6d: Monitor and re-validate
157+
158+
Repeat Phases 3–5 for the follow-up run. The same failure retry limits apply per run.
159+
160+
This verification loop may repeat up to 3 more times after the initial cycle (4 total verification cycles). If generators still lack valid screenshots after all cycles, proceed to Phase 7 and report which remain unverified.
161+
162+
## Phase 7: Completion
163+
164+
### All generators verified
165+
- Advance the Linear ticket's status to "In Review" via `save_issue`.
166+
- Report success in a Linear comment: the PR URL, the verified generators, and how many cycles it took. Include links and run IDs for each spawned agent for traceability.
167+
168+
### Some generators unverified after all attempts
169+
- Leave the Linear ticket in "In Progress".
170+
- Edit the Linear ticket description which generators still need screenshots, the PR URL, what succeeded, and any patterns you noticed (e.g. a generator that never produces output may have a more fundamental testing limitation).
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Follow-up Prompt Template
2+
3+
Use this template to construct follow-up prompts for Oz runs that need to verify generators with missing or invalid screenshots. Fill in the `[BRACKETED]` placeholders.
4+
5+
---
6+
7+
We've been working on [TICKET_DESCRIPTION] in the command-signatures repo, in the [BRANCH_NAME] branch. Now we need to validate all the generators edited in this branch by providing screenshots of them in use and putting them in a comment on the existing PR ([PR_URL]).
8+
9+
The following generators still need valid screenshots showing they produce meaningful completions output:
10+
[GENERATOR_LIST — one item per line, with a brief note about what each generator should produce. For example:
11+
- `kubeconfig_contexts_generator` — should show context names from kubeconfig
12+
- `namespaces_generator` — should show Kubernetes namespace completions]
13+
14+
[PRIOR_VERIFICATION_CONTEXT — describe what was already verified and what's missing. For example: "A prior attempt verified the --kubeconfig flag generator, but the KUBECONFIG environment variable and $KUBECONFIG shell variable methods still need verification." Or: "No valid screenshots were found for any of the generators listed above."]
15+
16+
First, read the add-command-spec skill in command-signatures/.agents/skills/add-command-spec/ to understand the full submission requirements including screenshot upload.
17+
18+
Set up a testing environment with the command installed and configured to produce meaningful results. Do that before attempting to run a local Warp build — the generators need real data to complete against (e.g. running services, existing configs, populated directories).
19+
20+
Use the test-local-warp skill in command-signatures/.agents/skills/test-local-warp/ to patch the command-signatures change into the local warp app build. Then, use a local Warp build to test each generator listed above. To trigger the completions menu, press the Tab key. We are NOT testing autocomplete (ghost text) — we are testing completions, which are dropdown menus that appear next to the cursor. Take a screenshot to show each generator invocation working and attach it as a comment on the PR; your work will not be accepted without it.
21+
22+
Each generator must have its own screenshot showing real, non-trivial output. Empty completions menus, zero results, or generic placeholders are not acceptable — the screenshot must show at least one generator-produced completion entry.

.agents/skills/test-local-warp/SKILL.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ description: Test command-signatures changes locally by running Warp terminal ag
77

88
## Overview
99

10-
`warp-command-signatures` is consumed by `warp-internal` as a git dependency. To test changes locally, temporarily point `warp-internal` at a local checkout of this repo, then build and run Warp.
10+
`warp-command-signatures` is consumed by the `warp` app as a git dependency. To test changes locally, temporarily point `warp` at a local checkout of this repo, then build and run Warp.
1111

1212
## Prerequisites
1313

14-
- A local checkout of both `warp-internal` and `command-signatures`.
14+
- A local checkout of both `warp` and `command-signatures`.
1515
- **Computer use must be enabled** — Warp is a GUI application, so verifying completions requires screen interaction.
1616

1717
## Steps
1818

19-
### 1. Patch the dependency in warp-internal
19+
### 1. Patch the dependency in warp
2020

21-
In the `warp-internal` repo's root `Cargo.toml`, find the `warp-command-signatures` line under `[workspace.dependencies]`:
21+
In the `warp` repo's root `Cargo.toml`, find the `warp-command-signatures` line under `[workspace.dependencies]`:
2222

2323
```toml
2424
warp-command-signatures = { git = "ssh://git@github.com/warpdotdev/command-signatures.git", rev = "...", default-features = false }
@@ -34,7 +34,7 @@ Note the nested `command-signatures/command-signatures` — the outer directory
3434

3535
### 2. Build and run Warp
3636

37-
From the `warp-internal` repo:
37+
From the `warp` repo:
3838

3939
```sh
4040
cargo run --features fast_dev
@@ -48,4 +48,4 @@ Open the locally-built Warp and test completions for the commands you modified.
4848
4949
### 4. Clean up
5050

51-
Revert the `Cargo.toml` change in `warp-internal` before committing. The local path override should never be checked in.
51+
Revert the `Cargo.toml` change in `warp` before committing. The local path override should never be checked in.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
name: update-command-spec-version
3+
description: >
4+
Update the warp-command-signatures dependency hash in warp to the latest commit from warpdotdev/command-signatures:main.
5+
---
6+
7+
# Update Command Spec Version
8+
9+
This skill automates updating the `warp-command-signatures` git dependency in `warpdotdev/warp` to the latest commit on `warpdotdev/command-signatures:main`, then opens a PR with a summary of what changed.
10+
11+
All scripts live in this skill's `scripts/` directory.
12+
13+
## Prerequisites
14+
15+
- `gh` CLI authenticated with access to `warpdotdev/warp` and `warpdotdev/command-signatures`
16+
- SSH access to both repos (they use `ssh://git@github.com/warpdotdev/...`)
17+
- Python 3 (for `list_merged_prs.py`)
18+
- Rust toolchain with `cargo` (for updating `Cargo.lock`)
19+
20+
## Step-by-step procedure
21+
22+
Run the scripts in order. The skill directory is wherever this SKILL.md lives; reference scripts relative to it.
23+
24+
### 1. Ensure repos are available
25+
26+
```bash
27+
bash <skill-dir>/scripts/ensure_repos.sh
28+
```
29+
30+
This clones or fetches both `~/warp` and `~/command-signatures`.
31+
32+
### 2. Get the current and latest hashes
33+
34+
```bash
35+
OLD_HASH=$(bash <skill-dir>/scripts/get_current_hash.sh)
36+
NEW_HASH=$(bash <skill-dir>/scripts/get_latest_hash.sh)
37+
```
38+
39+
If `OLD_HASH` equals `NEW_HASH`, tell the user that command-signatures is already up to date and stop.
40+
41+
### 3. List merged PRs
42+
43+
```bash
44+
python3 <skill-dir>/scripts/list_merged_prs.py "$OLD_HASH" "$NEW_HASH"
45+
```
46+
47+
This outputs JSON with four keys: `prs` (all PRs), `new_completions`, `bug_fixes`, and `other`. Each entry has `number` and `title`.
48+
49+
Review the categorization. The script uses simple heuristics (titles starting with "add" → new completion, titles containing "fix" or "bug" → bug fix). Move any miscategorized entries before composing the description.
50+
51+
### 4. Create the branch and update dependencies
52+
53+
```bash
54+
bash <skill-dir>/scripts/update_and_branch.sh "$NEW_HASH"
55+
```
56+
57+
This checks out a new branch `completions-bot/update-command-signatures-<first 8 chars of NEW_HASH>` from `origin/master` in `~/warp`, updates the `rev` in `Cargo.toml`, and syncs `Cargo.lock`.
58+
59+
### 5. Compose the PR description
60+
61+
Write a PR description following this structure (match the warp PR template). Save it to a temp file, e.g. `/tmp/completions_pr_body.md`.
62+
63+
```
64+
## Description
65+
66+
Updates `warp-command-signatures` to <NEW_HASH short>.
67+
68+
### Merged PRs
69+
- <PR title> (warpdotdev/command-signatures#<number>)
70+
- <PR title> (warpdotdev/command-signatures#<number>)
71+
- ...
72+
73+
## Changelog Entries for Stable
74+
75+
CHANGELOG-IMPROVEMENT: <single line covering all new completions, subcommands, generators, and updates>
76+
CHANGELOG-BUG-FIX: <single line covering all bug fixes>
77+
```
78+
79+
Guidelines for changelog entries:
80+
- Write **one** `CHANGELOG-IMPROVEMENT` line that summarizes all new completions and improvements. If there are many commands, use only their short names. For example: "Added completions for `aws ec2`, `scp`, `claude`, and `docker-compose` service names."
81+
- Write **one** `CHANGELOG-BUG-FIX` line that summarizes all bug fixes. For example: "Fixed npm install short-form command priority and HTML entity rendering in completion specs."
82+
- Omit a changelog line entirely if there are no PRs in that category.
83+
- If a PR doesn't fit either category, use your judgment — it may belong in the improvement line or may not warrant a changelog entry at all.
84+
85+
### 6. Submit the PR
86+
87+
```bash
88+
bash <skill-dir>/scripts/submit_pr.sh "$NEW_HASH" <absolute_path_to_temp_description_file>
89+
```
90+
91+
This commits the changes, pushes the branch, and opens a draft PR titled "[Completions] Bump command-signatures to <first 8 chars of NEW_HASH>" against `master`.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
WARP_DIR="${HOME}/warp"
5+
CMD_SIGS_DIR="${HOME}/command-signatures"
6+
7+
if [ -d "${WARP_DIR}" ]; then
8+
echo "Fetching warp..." >&2
9+
git -C "${WARP_DIR}" fetch origin
10+
else
11+
echo "Cloning warp..." >&2
12+
git clone ssh://git@github.com/warpdotdev/warp.git "${WARP_DIR}"
13+
fi
14+
15+
if [ -d "${CMD_SIGS_DIR}" ]; then
16+
echo "Fetching command-signatures..." >&2
17+
git -C "${CMD_SIGS_DIR}" fetch origin
18+
git -C "${CMD_SIGS_DIR}" checkout main --quiet
19+
git -C "${CMD_SIGS_DIR}" pull origin main --quiet
20+
else
21+
echo "Cloning command-signatures..." >&2
22+
git clone ssh://git@github.com/warpdotdev/command-signatures.git "${CMD_SIGS_DIR}"
23+
fi
24+
25+
echo "Both repositories are ready." >&2
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
WARP_DIR="${HOME}/warp"
5+
6+
# Read Cargo.toml from origin/master so we don't depend on local checkout state.
7+
HASH=$(git -C "${WARP_DIR}" show origin/master:Cargo.toml \
8+
| grep 'warp-command-signatures.*rev' \
9+
| grep -o 'rev = "[^"]*"' \
10+
| grep -o '"[^"]*"' \
11+
| tr -d '"')
12+
13+
if [ -z "${HASH}" ]; then
14+
echo "Error: could not find warp-command-signatures rev in Cargo.toml" >&2
15+
exit 1
16+
fi
17+
18+
echo "${HASH}"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
CMD_SIGS_DIR="${HOME}/command-signatures"
5+
6+
# After ensure_repos.sh has pulled, origin/main is up to date.
7+
HASH=$(git -C "${CMD_SIGS_DIR}" rev-parse origin/main)
8+
9+
if [ -z "${HASH}" ]; then
10+
echo "Error: could not determine HEAD of command-signatures main" >&2
11+
exit 1
12+
fi
13+
14+
echo "${HASH}"

0 commit comments

Comments
 (0)