@slamb2k/mad-skills 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +129 -0
- package/package.json +42 -0
- package/skills/brace/SKILL.md +51 -0
- package/skills/brace/assets/gitignore-template +28 -0
- package/skills/brace/assets/global-preferences-template.md +53 -0
- package/skills/brace/instructions.md +229 -0
- package/skills/brace/references/brace-workflow.md +109 -0
- package/skills/brace/references/claude-md-template.md +91 -0
- package/skills/brace/references/gotcha-principles.md +113 -0
- package/skills/brace/references/phase-prompts.md +228 -0
- package/skills/brace/references/report-template.md +38 -0
- package/skills/brace/references/scaffold-manifest.md +68 -0
- package/skills/brace/tests/evals.json +29 -0
- package/skills/build/SKILL.md +48 -0
- package/skills/build/instructions.md +293 -0
- package/skills/build/references/architecture-notes.md +34 -0
- package/skills/build/references/project-detection.md +45 -0
- package/skills/build/references/report-contracts.md +21 -0
- package/skills/build/references/stage-prompts.md +405 -0
- package/skills/build/tests/evals.json +28 -0
- package/skills/distil/SKILL.md +38 -0
- package/skills/distil/assets/DesignNav.tsx +54 -0
- package/skills/distil/instructions.md +255 -0
- package/skills/distil/references/design-guide.md +118 -0
- package/skills/distil/references/iteration-mode.md +186 -0
- package/skills/distil/references/project-setup.md +92 -0
- package/skills/distil/tests/evals.json +28 -0
- package/skills/manifest.json +76 -0
- package/skills/prime/SKILL.md +39 -0
- package/skills/prime/instructions.md +73 -0
- package/skills/prime/references/domains.md +38 -0
- package/skills/prime/tests/evals.json +28 -0
- package/skills/rig/SKILL.md +38 -0
- package/skills/rig/assets/azure-pipelines.yml +91 -0
- package/skills/rig/assets/ci.yml +104 -0
- package/skills/rig/assets/gitmessage +38 -0
- package/skills/rig/assets/lefthook.yml +29 -0
- package/skills/rig/assets/pull_request_template.md +24 -0
- package/skills/rig/instructions.md +162 -0
- package/skills/rig/references/configuration-steps.md +124 -0
- package/skills/rig/references/phase-prompts.md +180 -0
- package/skills/rig/references/report-template.md +28 -0
- package/skills/rig/tests/evals.json +29 -0
- package/skills/ship/SKILL.md +55 -0
- package/skills/ship/instructions.md +192 -0
- package/skills/ship/references/stage-prompts.md +322 -0
- package/skills/ship/tests/evals.json +30 -0
- package/skills/sync/SKILL.md +54 -0
- package/skills/sync/instructions.md +178 -0
- package/skills/sync/tests/evals.json +29 -0
- package/src/cli.js +419 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Ship Instructions
|
|
2
|
+
|
|
3
|
+
Ship changes through the complete PR lifecycle. Every stage runs in a subagent
|
|
4
|
+
to isolate context from the primary conversation. Prompts for each stage are
|
|
5
|
+
in `references/stage-prompts.md`.
|
|
6
|
+
|
|
7
|
+
## Flags
|
|
8
|
+
|
|
9
|
+
Parse optional flags from the request:
|
|
10
|
+
- `--pr-only`: Stop after creating the PR
|
|
11
|
+
- `--no-squash`: Use regular merge instead of squash
|
|
12
|
+
- `--keep-branch`: Don't delete the source branch after merge
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Pre-flight
|
|
17
|
+
|
|
18
|
+
Before starting, check all dependencies in this table:
|
|
19
|
+
|
|
20
|
+
| Dependency | Type | Check | Required | Resolution | Detail |
|
|
21
|
+
|-----------|------|-------|----------|------------|--------|
|
|
22
|
+
| git | cli | `git --version` | yes | stop | Install from https://git-scm.com |
|
|
23
|
+
| gh | cli | `gh --version` | yes | url | https://cli.github.com |
|
|
24
|
+
| ship-analyzer | agent | `~/.claude/agents/ship-analyzer.md` | no | fallback | Uses general-purpose agent |
|
|
25
|
+
|
|
26
|
+
For each row, in order:
|
|
27
|
+
1. Run the Check command (for cli/npm) or test file existence (for agent/skill)
|
|
28
|
+
2. If found: continue silently
|
|
29
|
+
3. If missing: apply Resolution strategy
|
|
30
|
+
- **stop**: notify user with Detail, halt execution
|
|
31
|
+
- **url**: notify user with Detail (install link), halt execution
|
|
32
|
+
- **install**: notify user, run the command in Detail, continue if successful
|
|
33
|
+
- **ask**: notify user, offer to run command in Detail, continue either way (or halt if required)
|
|
34
|
+
- **fallback**: notify user with Detail, continue with degraded behavior
|
|
35
|
+
4. After all checks: summarize what's available and what's degraded
|
|
36
|
+
|
|
37
|
+
Read `default_branch` and `remote` from Stage 1's SYNC_REPORT. These are
|
|
38
|
+
substituted into all stage prompts as `{REMOTE}` and `{DEFAULT_BRANCH}`.
|
|
39
|
+
|
|
40
|
+
### Platform Detection
|
|
41
|
+
|
|
42
|
+
After sync, detect the hosting platform from the remote URL:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
REMOTE_URL=$(git remote get-url {REMOTE} 2>/dev/null)
|
|
46
|
+
if echo "$REMOTE_URL" | grep -qiE 'dev\.azure\.com|visualstudio\.com'; then
|
|
47
|
+
PLATFORM="azdo"
|
|
48
|
+
elif echo "$REMOTE_URL" | grep -qi 'github\.com'; then
|
|
49
|
+
PLATFORM="github"
|
|
50
|
+
else
|
|
51
|
+
PLATFORM="github" # default fallback
|
|
52
|
+
fi
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Pass `{PLATFORM}` into all stage prompts. Each stage uses the appropriate
|
|
56
|
+
CLI tool: `gh` for GitHub, `az repos`/`az pipelines` for Azure DevOps.
|
|
57
|
+
|
|
58
|
+
> **Azure DevOps prerequisite:** The `az devops` extension must be installed
|
|
59
|
+
> and configured (`az devops configure --defaults organization=... project=...`).
|
|
60
|
+
> If `az repos` commands fail, report the setup requirement to the user.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Stage 1: Sync
|
|
65
|
+
|
|
66
|
+
Launch **Bash subagent** (haiku — simple git commands):
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Task(
|
|
70
|
+
subagent_type: "Bash",
|
|
71
|
+
model: "haiku",
|
|
72
|
+
description: "Sync with default branch",
|
|
73
|
+
prompt: "Follow ~/.claude/skills/sync/instructions.md subagent prompt. Return SYNC_REPORT."
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Parse SYNC_REPORT. Extract `remote` and `default_branch`. Abort if sync failed.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Stage 2: Commit, Push & Create PR
|
|
82
|
+
|
|
83
|
+
This stage needs to **read and understand code** to write good commit messages
|
|
84
|
+
and PR descriptions. Use a code-aware subagent.
|
|
85
|
+
|
|
86
|
+
Launch **ship-analyzer subagent** (reads diffs + source files):
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
Task(
|
|
90
|
+
subagent_type: "ship-analyzer",
|
|
91
|
+
description: "Analyze, commit, push, and create PR",
|
|
92
|
+
prompt: <read from references/stage-prompts.md#stage-2>
|
|
93
|
+
)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
> **Fallback:** If `ship-analyzer` is not available, use `subagent_type: "general-purpose"`.
|
|
97
|
+
|
|
98
|
+
Substitute `{USER_INTENT}`, `{FILES_TO_INCLUDE}`, `{FILES_TO_EXCLUDE}`,
|
|
99
|
+
`{REMOTE}`, `{DEFAULT_BRANCH}`, `{PLATFORM}` into the prompt.
|
|
100
|
+
|
|
101
|
+
Parse SHIP_REPORT. Abort if failed.
|
|
102
|
+
|
|
103
|
+
**Rollback:** If push succeeds but PR creation fails, report the error and
|
|
104
|
+
suggest the manual PR creation command. Do NOT revert the push.
|
|
105
|
+
- GitHub: `gh pr create --head {branch}`
|
|
106
|
+
- Azure DevOps: `az repos pr create --source-branch {branch} --target-branch {DEFAULT_BRANCH}`
|
|
107
|
+
|
|
108
|
+
**If `--pr-only` flag: Stop here and report PR URL to user.**
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Stage 3: Wait for CI
|
|
113
|
+
|
|
114
|
+
Launch **Bash subagent** in the **background** (haiku — just polling):
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Task(
|
|
118
|
+
subagent_type: "Bash",
|
|
119
|
+
model: "haiku",
|
|
120
|
+
run_in_background: true,
|
|
121
|
+
description: "Monitor CI checks",
|
|
122
|
+
prompt: <read from references/stage-prompts.md#stage-3>
|
|
123
|
+
)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Substitute `{PR_NUMBER}` into the prompt.
|
|
127
|
+
|
|
128
|
+
While CI runs in the background, briefly inform the user:
|
|
129
|
+
```
|
|
130
|
+
CI running for PR #{pr_number}... waiting for checks.
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
When the background task completes, read the output file and parse CHECKS_REPORT.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Stage 4: Fix Failing Checks (if needed)
|
|
138
|
+
|
|
139
|
+
If CHECKS_REPORT shows failures, launch **general-purpose subagent**:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
Task(
|
|
143
|
+
subagent_type: "general-purpose",
|
|
144
|
+
description: "Fix CI failures",
|
|
145
|
+
prompt: <read from references/stage-prompts.md#stage-4>
|
|
146
|
+
)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Substitute `{PR_NUMBER}`, `{BRANCH}`, `{FAILING_CHECKS}` into the prompt.
|
|
150
|
+
|
|
151
|
+
If fixed, return to Stage 3 (run CI watch again).
|
|
152
|
+
If unable to fix after 2 attempts, report to user and stop.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Stage 5: Merge & Final Sync
|
|
157
|
+
|
|
158
|
+
Launch **Bash subagent** (haiku — simple git + platform CLI commands):
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
Task(
|
|
162
|
+
subagent_type: "Bash",
|
|
163
|
+
model: "haiku",
|
|
164
|
+
description: "Merge PR and sync",
|
|
165
|
+
prompt: <read from references/stage-prompts.md#stage-5>
|
|
166
|
+
)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Substitute `{PR_NUMBER}`, `{REMOTE}`, `{DEFAULT_BRANCH}`, merge/branch flags.
|
|
170
|
+
|
|
171
|
+
Parse LAND_REPORT.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Final Report to User
|
|
176
|
+
|
|
177
|
+
Compile all stage reports into a summary:
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
Ship complete
|
|
181
|
+
|
|
182
|
+
Branch: {branch}
|
|
183
|
+
PR: {pr_url}
|
|
184
|
+
Merged: {merge_commit} ({merge_type})
|
|
185
|
+
|
|
186
|
+
Commits:
|
|
187
|
+
{list of commit messages, indented}
|
|
188
|
+
|
|
189
|
+
Files: {count} files changed ({diff_summary})
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
If any stage failed, report the failure point and suggested resolution.
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# Ship Stage Prompts
|
|
2
|
+
|
|
3
|
+
Subagent prompts for each ship stage. The orchestrator reads these and
|
|
4
|
+
substitutes template variables before launching each subagent.
|
|
5
|
+
|
|
6
|
+
`{PLATFORM}` is either `github` or `azdo` (detected from remote URL).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Stage 2: Commit, Push & Create PR
|
|
11
|
+
|
|
12
|
+
**Agent:** ship-analyzer (fallback: general-purpose)
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
Ship the following changes. Analyze the diffs, create semantic commits,
|
|
16
|
+
push to a feature branch, and create a pull request.
|
|
17
|
+
|
|
18
|
+
Limit SHIP_REPORT to 15 lines maximum.
|
|
19
|
+
|
|
20
|
+
PLATFORM: {PLATFORM}
|
|
21
|
+
USER INTENT: {USER_INTENT}
|
|
22
|
+
|
|
23
|
+
FILES TO INCLUDE: {FILES_TO_INCLUDE}
|
|
24
|
+
|
|
25
|
+
FILES TO EXCLUDE: {FILES_TO_EXCLUDE}
|
|
26
|
+
|
|
27
|
+
## Steps
|
|
28
|
+
|
|
29
|
+
1. **Analyze changes**
|
|
30
|
+
- Run: git status, git diff, git diff --cached
|
|
31
|
+
- Read source files where the diff alone doesn't explain intent
|
|
32
|
+
- Identify logical commit groupings
|
|
33
|
+
|
|
34
|
+
2. **Create branch** (if on {DEFAULT_BRANCH})
|
|
35
|
+
git checkout -b <type>/<descriptive-name>
|
|
36
|
+
|
|
37
|
+
3. **Commit in logical groups**
|
|
38
|
+
For each logical group:
|
|
39
|
+
git add <specific-files>
|
|
40
|
+
git commit -m "$(cat <<'EOF'
|
|
41
|
+
<type>(<scope>): <description>
|
|
42
|
+
|
|
43
|
+
<body if needed>
|
|
44
|
+
EOF
|
|
45
|
+
)"
|
|
46
|
+
|
|
47
|
+
Rules:
|
|
48
|
+
- Never add Co-Authored-By or attribution lines
|
|
49
|
+
- Use HEREDOC for commit messages (ensures proper formatting)
|
|
50
|
+
- Types: feat, fix, refactor, docs, chore, test, perf
|
|
51
|
+
|
|
52
|
+
4. **Push**
|
|
53
|
+
git push -u {REMOTE} $BRANCH
|
|
54
|
+
|
|
55
|
+
5. **Create PR**
|
|
56
|
+
- Read: git log {REMOTE}/{DEFAULT_BRANCH}..HEAD --format="%h %s%n%b"
|
|
57
|
+
- Read: git diff {REMOTE}/{DEFAULT_BRANCH} (skim for PR description context)
|
|
58
|
+
|
|
59
|
+
**If PLATFORM == github:**
|
|
60
|
+
gh pr create --title "<type>: <concise title>" --body "$(cat <<'EOF'
|
|
61
|
+
## Summary
|
|
62
|
+
<1-3 sentences: what and why>
|
|
63
|
+
|
|
64
|
+
## Changes
|
|
65
|
+
<bullet list of key changes>
|
|
66
|
+
|
|
67
|
+
## Testing
|
|
68
|
+
- [ ] <verification steps>
|
|
69
|
+
EOF
|
|
70
|
+
)"
|
|
71
|
+
|
|
72
|
+
**If PLATFORM == azdo:**
|
|
73
|
+
az repos pr create \
|
|
74
|
+
--title "<type>: <concise title>" \
|
|
75
|
+
--description "$(cat <<'EOF'
|
|
76
|
+
## Summary
|
|
77
|
+
<1-3 sentences: what and why>
|
|
78
|
+
|
|
79
|
+
## Changes
|
|
80
|
+
<bullet list of key changes>
|
|
81
|
+
|
|
82
|
+
## Testing
|
|
83
|
+
- [ ] <verification steps>
|
|
84
|
+
EOF
|
|
85
|
+
)" \
|
|
86
|
+
--source-branch "$BRANCH" \
|
|
87
|
+
--target-branch "{DEFAULT_BRANCH}" \
|
|
88
|
+
--output json
|
|
89
|
+
|
|
90
|
+
6. **Gather info**
|
|
91
|
+
|
|
92
|
+
**If PLATFORM == github:**
|
|
93
|
+
PR_URL=$(gh pr view --json url -q .url)
|
|
94
|
+
PR_NUMBER=$(gh pr view --json number -q .number)
|
|
95
|
+
|
|
96
|
+
**If PLATFORM == azdo:**
|
|
97
|
+
# If az repos pr create returned JSON, parse it directly:
|
|
98
|
+
PR_NUMBER=$(echo "$PR_JSON" | jq -r '.pullRequestId')
|
|
99
|
+
# Otherwise list to find it:
|
|
100
|
+
PR_NUMBER=$(az repos pr list --source-branch "$BRANCH" --status active --query '[0].pullRequestId' -o tsv)
|
|
101
|
+
PR_URL=$(az repos pr show --id $PR_NUMBER --query 'repository.webUrl' -o tsv)/pullrequest/$PR_NUMBER
|
|
102
|
+
|
|
103
|
+
COMMITS=$(git log {REMOTE}/{DEFAULT_BRANCH}..HEAD --oneline)
|
|
104
|
+
DIFF_STAT=$(git diff {REMOTE}/{DEFAULT_BRANCH} --shortstat)
|
|
105
|
+
FILES_CHANGED=$(git diff {REMOTE}/{DEFAULT_BRANCH} --name-only)
|
|
106
|
+
|
|
107
|
+
## Output Format
|
|
108
|
+
|
|
109
|
+
SHIP_REPORT:
|
|
110
|
+
- status: success|failed
|
|
111
|
+
- platform: {PLATFORM}
|
|
112
|
+
- branch: {branch name}
|
|
113
|
+
- pr_url: {url}
|
|
114
|
+
- pr_number: {number}
|
|
115
|
+
- pr_title: {title}
|
|
116
|
+
- commit_count: {number}
|
|
117
|
+
- commits: {list of commit messages}
|
|
118
|
+
- files_changed: {list}
|
|
119
|
+
- diff_summary: {insertions/deletions}
|
|
120
|
+
- errors: {any errors}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Stage 3: Wait for CI
|
|
126
|
+
|
|
127
|
+
**Agent:** Bash (haiku, background)
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
Monitor PR/pipeline status checks until complete.
|
|
131
|
+
|
|
132
|
+
Limit CHECKS_REPORT to 10 lines maximum.
|
|
133
|
+
|
|
134
|
+
PLATFORM: {PLATFORM}
|
|
135
|
+
PR_NUMBER: {PR_NUMBER}
|
|
136
|
+
BRANCH: {BRANCH}
|
|
137
|
+
|
|
138
|
+
## Steps
|
|
139
|
+
|
|
140
|
+
**If PLATFORM == github:**
|
|
141
|
+
|
|
142
|
+
1. **Wait for checks to complete**
|
|
143
|
+
gh pr checks {PR_NUMBER} --watch
|
|
144
|
+
|
|
145
|
+
2. **Report final status**
|
|
146
|
+
gh pr checks {PR_NUMBER}
|
|
147
|
+
|
|
148
|
+
**If PLATFORM == azdo:**
|
|
149
|
+
|
|
150
|
+
1. **Wait for CI to start** (pipelines may take time to trigger after PR creation)
|
|
151
|
+
Poll until at least one run appears (max 2 minutes, check every 15s):
|
|
152
|
+
```
|
|
153
|
+
RUNS_FOUND=false
|
|
154
|
+
for i in $(seq 1 8); do
|
|
155
|
+
RUN_COUNT=$(az pipelines runs list --branch "$BRANCH" --top 5 --query "length(@)" -o tsv 2>/dev/null)
|
|
156
|
+
if [ -n "$RUN_COUNT" ] && [ "$RUN_COUNT" != "0" ]; then
|
|
157
|
+
RUNS_FOUND=true
|
|
158
|
+
break
|
|
159
|
+
fi
|
|
160
|
+
sleep 15
|
|
161
|
+
done
|
|
162
|
+
```
|
|
163
|
+
If no runs appear after 2 minutes, also check PR policy evaluations:
|
|
164
|
+
```
|
|
165
|
+
az repos pr policy list --id {PR_NUMBER} --query "[].{name:configuration.type.displayName, status:status}" -o table
|
|
166
|
+
```
|
|
167
|
+
If no policies exist either, report `no_checks`.
|
|
168
|
+
|
|
169
|
+
2. **Wait for runs to complete** (max 30 minutes, check every 30s)
|
|
170
|
+
```
|
|
171
|
+
for i in $(seq 1 60); do
|
|
172
|
+
IN_PROGRESS=$(az pipelines runs list --branch "$BRANCH" --top 5 --query "[?status=='inProgress'] | length(@)" -o tsv)
|
|
173
|
+
if [ "$IN_PROGRESS" = "0" ] || [ -z "$IN_PROGRESS" ]; then break; fi
|
|
174
|
+
sleep 30
|
|
175
|
+
done
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
3. **Report final status**
|
|
179
|
+
Check both pipeline runs and PR policy evaluations:
|
|
180
|
+
```
|
|
181
|
+
az pipelines runs list --branch "$BRANCH" --top 5 --query "[].{name:definition.name, status:status, result:result}" -o table
|
|
182
|
+
az repos pr policy list --id {PR_NUMBER} --query "[].{name:configuration.type.displayName, status:status}" -o table
|
|
183
|
+
```
|
|
184
|
+
A policy status of `approved` or `queued` with no `rejected` means passed.
|
|
185
|
+
A pipeline result of `succeeded` means passed; `failed` means failed.
|
|
186
|
+
|
|
187
|
+
## Output Format
|
|
188
|
+
|
|
189
|
+
CHECKS_REPORT:
|
|
190
|
+
- status: all_passed|some_failed|pending|no_checks
|
|
191
|
+
- checks:
|
|
192
|
+
- name: {check name}
|
|
193
|
+
status: success|failure|pending
|
|
194
|
+
- failing_checks: {list of failed check names, or "none"}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Stage 4: Fix Failing Checks
|
|
200
|
+
|
|
201
|
+
**Agent:** general-purpose (default model)
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
Fix failing CI checks for PR #{PR_NUMBER} on branch {BRANCH}.
|
|
205
|
+
|
|
206
|
+
Limit FIX_REPORT to 10 lines maximum.
|
|
207
|
+
|
|
208
|
+
PLATFORM: {PLATFORM}
|
|
209
|
+
FAILING CHECKS: {FAILING_CHECKS}
|
|
210
|
+
|
|
211
|
+
## Steps
|
|
212
|
+
|
|
213
|
+
1. **Get failure details**
|
|
214
|
+
|
|
215
|
+
**If PLATFORM == github:**
|
|
216
|
+
gh run list --branch {BRANCH} --status failure --json databaseId --jq '.[0].databaseId'
|
|
217
|
+
gh run view <run-id> --log-failed
|
|
218
|
+
|
|
219
|
+
**If PLATFORM == azdo:**
|
|
220
|
+
RUN_ID=$(az pipelines runs list --branch {BRANCH} --top 1 --query "[?result=='failed'].id | [0]" -o tsv)
|
|
221
|
+
az pipelines runs show --id $RUN_ID --output json
|
|
222
|
+
# Get timeline for detailed step failures:
|
|
223
|
+
az devops invoke --area build --resource timeline \
|
|
224
|
+
--route-parameters project=$(az devops configure -l --query '[?name==`project`].value' -o tsv) buildId=$RUN_ID \
|
|
225
|
+
--api-version 7.0 --query "records[?result=='failed'].{name:name, log:log.url}" -o table
|
|
226
|
+
|
|
227
|
+
2. **Analyze and fix**
|
|
228
|
+
Read the relevant source files, understand the failures, fix the code.
|
|
229
|
+
|
|
230
|
+
3. **Commit and push**
|
|
231
|
+
git add <fixed-files>
|
|
232
|
+
git commit -m "$(cat <<'EOF'
|
|
233
|
+
fix: address CI feedback - {specific issue}
|
|
234
|
+
EOF
|
|
235
|
+
)"
|
|
236
|
+
git push
|
|
237
|
+
|
|
238
|
+
## Output Format
|
|
239
|
+
|
|
240
|
+
FIX_REPORT:
|
|
241
|
+
- status: fixed|unable_to_fix
|
|
242
|
+
- changes_made: {description}
|
|
243
|
+
- files_modified: {list}
|
|
244
|
+
- errors: {if unable to fix, why}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Stage 5: Merge & Final Sync
|
|
250
|
+
|
|
251
|
+
**Agent:** Bash (haiku)
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
Merge the pull request and sync local {DEFAULT_BRANCH}.
|
|
255
|
+
|
|
256
|
+
Limit LAND_REPORT to 10 lines maximum.
|
|
257
|
+
|
|
258
|
+
PLATFORM: {PLATFORM}
|
|
259
|
+
PR_NUMBER: {PR_NUMBER}
|
|
260
|
+
MERGE_FLAGS: {--squash (default) | --merge if --no-squash}
|
|
261
|
+
BRANCH_FLAGS: {--delete-branch (default) | omit if --keep-branch}
|
|
262
|
+
|
|
263
|
+
## Steps
|
|
264
|
+
|
|
265
|
+
1. **Merge**
|
|
266
|
+
|
|
267
|
+
**If PLATFORM == github:**
|
|
268
|
+
gh pr merge {PR_NUMBER} {MERGE_FLAGS} {BRANCH_FLAGS}
|
|
269
|
+
|
|
270
|
+
**If PLATFORM == azdo:**
|
|
271
|
+
# 1. Verify all policies pass before attempting merge
|
|
272
|
+
REJECTED=$(az repos pr policy list --id {PR_NUMBER} --query "[?status=='rejected'] | length(@)" -o tsv 2>/dev/null)
|
|
273
|
+
if [ -n "$REJECTED" ] && [ "$REJECTED" != "0" ]; then
|
|
274
|
+
echo "ERROR: $REJECTED PR policies are rejected — cannot merge"
|
|
275
|
+
az repos pr policy list --id {PR_NUMBER} --query "[?status=='rejected'].{name:configuration.type.displayName, status:status}" -o table
|
|
276
|
+
# Report failure
|
|
277
|
+
exit 1
|
|
278
|
+
fi
|
|
279
|
+
|
|
280
|
+
# 2. Complete the PR with merge strategy
|
|
281
|
+
MERGE_STRATEGY="squash" # default; use "noFastForward" if --no-squash
|
|
282
|
+
DELETE_BRANCH="true" # default; use "false" if --keep-branch
|
|
283
|
+
|
|
284
|
+
az repos pr update --id {PR_NUMBER} --status completed \
|
|
285
|
+
--squash $( [ "$MERGE_STRATEGY" = "squash" ] && echo "true" || echo "false" ) \
|
|
286
|
+
--delete-source-branch $DELETE_BRANCH
|
|
287
|
+
|
|
288
|
+
# 3. If merge fails (e.g. policies still evaluating), wait and retry once
|
|
289
|
+
if [ $? -ne 0 ]; then
|
|
290
|
+
echo "Merge failed, waiting 30s for policies to finalize..."
|
|
291
|
+
sleep 30
|
|
292
|
+
az repos pr update --id {PR_NUMBER} --status completed \
|
|
293
|
+
--squash $( [ "$MERGE_STRATEGY" = "squash" ] && echo "true" || echo "false" ) \
|
|
294
|
+
--delete-source-branch $DELETE_BRANCH
|
|
295
|
+
fi
|
|
296
|
+
|
|
297
|
+
2. **Sync local {DEFAULT_BRANCH}**
|
|
298
|
+
git checkout {DEFAULT_BRANCH}
|
|
299
|
+
git pull {REMOTE} {DEFAULT_BRANCH}
|
|
300
|
+
|
|
301
|
+
3. **Restore working state** (if there were stashed changes)
|
|
302
|
+
git stash pop (only if stash exists from Stage 1)
|
|
303
|
+
|
|
304
|
+
4. **Cleanup stale branches**
|
|
305
|
+
git fetch --prune
|
|
306
|
+
for branch in $(git branch -vv | grep ': gone]' | awk '{print $1}'); do
|
|
307
|
+
git branch -d "$branch" 2>/dev/null
|
|
308
|
+
done
|
|
309
|
+
|
|
310
|
+
5. **Report**
|
|
311
|
+
MERGE_COMMIT=$(git rev-parse --short HEAD)
|
|
312
|
+
|
|
313
|
+
## Output Format
|
|
314
|
+
|
|
315
|
+
LAND_REPORT:
|
|
316
|
+
- status: success|failed
|
|
317
|
+
- merge_commit: {hash}
|
|
318
|
+
- merge_type: squash|merge
|
|
319
|
+
- branch_deleted: true|false
|
|
320
|
+
- branches_cleaned: {list or "none"}
|
|
321
|
+
- errors: {any errors}
|
|
322
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "banner-and-tagline",
|
|
4
|
+
"prompt": "Ship my changes",
|
|
5
|
+
"assertions": [
|
|
6
|
+
{ "type": "contains", "value": "██" },
|
|
7
|
+
{ "type": "regex", "value": "(Special delivery|If it compiles|Anchors aweigh|push and pray|faster than Amazon|Yeet the code|merge queue|LGTM)" },
|
|
8
|
+
{ "type": "semantic", "value": "The response begins with an ASCII art banner displayed BEFORE any explanation or workflow steps" }
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "pr-lifecycle",
|
|
13
|
+
"prompt": "Ship the feature I've been working on",
|
|
14
|
+
"assertions": [
|
|
15
|
+
{ "type": "contains", "value": "██" },
|
|
16
|
+
{ "type": "regex", "value": "(commit|push|PR|pull request)", "flags": "i" },
|
|
17
|
+
{ "type": "regex", "value": "(CI|check|merge)", "flags": "i" },
|
|
18
|
+
{ "type": "semantic", "value": "Describes a multi-stage PR lifecycle that includes syncing, committing, pushing, creating a PR, monitoring CI, and merging" }
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "subagent-architecture",
|
|
23
|
+
"prompt": "Ship everything to production",
|
|
24
|
+
"assertions": [
|
|
25
|
+
{ "type": "contains", "value": "██" },
|
|
26
|
+
{ "type": "regex", "value": "ship.analyzer", "flags": "i" },
|
|
27
|
+
{ "type": "semantic", "value": "Mentions using specialized subagents for different stages, including a ship-analyzer agent for code analysis and commit/PR creation" }
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sync
|
|
3
|
+
description: >
|
|
4
|
+
Sync local repository with origin/main. Use before starting new work, after
|
|
5
|
+
completing a PR, or when needing latest upstream changes. Safely stashes
|
|
6
|
+
uncommitted changes, fetches and pulls origin/main, restores stash, and cleans
|
|
7
|
+
up stale local branches (merged or with deleted remotes). Invoke when switching
|
|
8
|
+
contexts or preparing for new feature work.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Sync - Repository Synchronization
|
|
12
|
+
|
|
13
|
+
When this skill is invoked, IMMEDIATELY output the banner below before doing anything else.
|
|
14
|
+
Pick ONE tagline at random — vary your choice each time:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
{tagline}
|
|
18
|
+
|
|
19
|
+
██╗███████╗██╗ ██╗███╗ ██╗ ██████╗
|
|
20
|
+
██╔╝██╔════╝╚██╗ ██╔╝████╗ ██║██╔════╝
|
|
21
|
+
██╔╝ ███████╗ ╚████╔╝ ██╔██╗ ██║██║
|
|
22
|
+
██╔╝ ╚════██║ ╚██╔╝ ██║╚██╗██║██║
|
|
23
|
+
██╔╝ ███████║ ██║ ██║ ╚████║╚██████╗
|
|
24
|
+
╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═══╝ ╚═════╝
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Taglines:
|
|
29
|
+
- 🎯 Pulling the latest moves...
|
|
30
|
+
- 🚂 All aboard the sync train!
|
|
31
|
+
- 🤝 Getting everyone on the same page!
|
|
32
|
+
- 📡 Fetching the latest plot twists!
|
|
33
|
+
- 🥷 Time to steal everyone else's code!
|
|
34
|
+
- ☕ Catching up on what you missed!
|
|
35
|
+
- 🔁 Rebase, merge, rinse, repeat!
|
|
36
|
+
- 🎬 Previously on main...
|
|
37
|
+
|
|
38
|
+
Follow instructions in: [instructions.md](instructions.md)
|
|
39
|
+
|
|
40
|
+
## Subagent Architecture
|
|
41
|
+
|
|
42
|
+
Single **Bash** subagent with **haiku** model. Pure git commands — no code
|
|
43
|
+
analysis needed, so the cheapest/fastest model is used. All git output stays
|
|
44
|
+
in the subagent context; the primary agent only sees the structured SYNC_REPORT.
|
|
45
|
+
|
|
46
|
+
## Flags
|
|
47
|
+
|
|
48
|
+
- `--no-stash` — Skip auto-stashing uncommitted changes
|
|
49
|
+
- `--no-cleanup` — Skip deleting stale local branches
|
|
50
|
+
- `--no-rebase` — Use merge instead of rebase on feature branches
|
|
51
|
+
|
|
52
|
+
## Safety
|
|
53
|
+
|
|
54
|
+
Safe by default: detached HEAD, rebase conflicts, and stash conflicts are detected and reported without destructive action.
|