codebyplan 1.5.1 → 1.8.0
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/dist/cli.js +4462 -748
- package/package.json +5 -1
- package/templates/.gitkeep +0 -0
- package/templates/README.md +20 -0
- package/templates/agents/cbp-cc-executor.md +213 -0
- package/templates/agents/cbp-database-agent.md +229 -0
- package/templates/agents/cbp-improve-claude.md +245 -0
- package/templates/agents/cbp-improve-round.md +284 -0
- package/templates/agents/cbp-mechanical-edits.md +111 -0
- package/templates/agents/cbp-research.md +282 -0
- package/templates/agents/cbp-round-executor.md +604 -0
- package/templates/agents/cbp-security-agent.md +134 -0
- package/templates/agents/cbp-task-check.md +213 -0
- package/templates/agents/cbp-task-planner.md +582 -0
- package/templates/agents/cbp-test-e2e-agent.md +363 -0
- package/templates/agents/cbp-testing-qa-agent.md +400 -0
- package/templates/context/mcp-docs.md +139 -0
- package/templates/hooks/README.md +236 -0
- package/templates/hooks/cbp-auto-test-hooks.sh +44 -0
- package/templates/hooks/cbp-lint-format-on-edit.sh +159 -0
- package/templates/hooks/cbp-maestro-yaml-validate.sh +100 -0
- package/templates/hooks/cbp-mcp-migration-guard.sh +32 -0
- package/templates/hooks/cbp-mcp-round-sync.sh +79 -0
- package/templates/hooks/cbp-mcp-worktree-inject.sh +76 -0
- package/templates/hooks/cbp-notify.sh +68 -0
- package/templates/hooks/cbp-plugin-dispatch.sh +29 -0
- package/templates/hooks/cbp-pre-commit-quality-gate.sh +204 -0
- package/templates/hooks/cbp-statusline.sh +347 -0
- package/templates/hooks/cbp-subagent-statusline.sh +182 -0
- package/templates/hooks/cbp-test-coverage-gate.sh +144 -0
- package/templates/hooks/cbp-test-hooks.sh +320 -0
- package/templates/hooks/hooks.json +85 -0
- package/templates/hooks/validate-context-usage.sh +59 -0
- package/templates/hooks/validate-git-commit.sh +78 -0
- package/templates/hooks/validate-git-stash-deny.sh +32 -0
- package/templates/hooks/validate-structure-lengths.sh +57 -0
- package/templates/hooks/validate-structure-lib.sh +104 -0
- package/templates/hooks/validate-structure-patterns.sh +54 -0
- package/templates/hooks/validate-structure-scope.sh +33 -0
- package/templates/hooks/validate-structure-smoke.sh +95 -0
- package/templates/hooks/validate-structure-templates.sh +34 -0
- package/templates/hooks/validate-structure.sh +69 -0
- package/templates/rules/.gitkeep +0 -0
- package/templates/rules/README.md +47 -0
- package/templates/rules/context-file-loading.md +52 -0
- package/templates/rules/scope-vocabulary.md +64 -0
- package/templates/rules/todo-backend.md +109 -0
- package/templates/settings.project.base.json +55 -0
- package/templates/settings.user.base.json +25 -0
- package/templates/skills/cbp-build-cc-agent/SKILL.md +139 -0
- package/templates/skills/cbp-build-cc-agent/examples/read-only-reviewer.md +32 -0
- package/templates/skills/cbp-build-cc-agent/examples/with-hooks.md +41 -0
- package/templates/skills/cbp-build-cc-agent/examples/with-skills-preload.md +25 -0
- package/templates/skills/cbp-build-cc-agent/reference/cbp-quality.md +153 -0
- package/templates/skills/cbp-build-cc-agent/reference/frontmatter-fields.md +37 -0
- package/templates/skills/cbp-build-cc-agent/reference/permission-modes.md +18 -0
- package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +67 -0
- package/templates/skills/cbp-build-cc-agent/templates/agent.md +66 -0
- package/templates/skills/cbp-build-cc-claude-file/SKILL.md +178 -0
- package/templates/skills/cbp-build-cc-claude-file/examples/minimal-project.md +33 -0
- package/templates/skills/cbp-build-cc-claude-file/examples/monorepo-with-imports.md +39 -0
- package/templates/skills/cbp-build-cc-claude-file/reference/imports.md +72 -0
- package/templates/skills/cbp-build-cc-claude-file/reference/what-belongs.md +39 -0
- package/templates/skills/cbp-build-cc-claude-file/templates/project-claude-md.md +48 -0
- package/templates/skills/cbp-build-cc-claude-file/templates/user-claude-md.md +22 -0
- package/templates/skills/cbp-build-cc-memory/SKILL.md +201 -0
- package/templates/skills/cbp-build-cc-memory/examples/feedback-memory.md +11 -0
- package/templates/skills/cbp-build-cc-memory/examples/project-memory.md +11 -0
- package/templates/skills/cbp-build-cc-memory/examples/reference-memory.md +13 -0
- package/templates/skills/cbp-build-cc-memory/examples/user-memory.md +14 -0
- package/templates/skills/cbp-build-cc-memory/reference/memory-types.md +59 -0
- package/templates/skills/cbp-build-cc-memory/reference/when-to-save.md +62 -0
- package/templates/skills/cbp-build-cc-memory/templates/MEMORY-index.md +4 -0
- package/templates/skills/cbp-build-cc-memory/templates/memory-entry.md +15 -0
- package/templates/skills/cbp-build-cc-mode/SKILL.md +99 -0
- package/templates/skills/cbp-build-cc-rule/SKILL.md +176 -0
- package/templates/skills/cbp-build-cc-rule/examples/global-rule.md +19 -0
- package/templates/skills/cbp-build-cc-rule/examples/scoped-rule.md +41 -0
- package/templates/skills/cbp-build-cc-rule/reference/paths-patterns.md +48 -0
- package/templates/skills/cbp-build-cc-rule/templates/rule.md +32 -0
- package/templates/skills/cbp-build-cc-settings/SKILL.md +220 -0
- package/templates/skills/cbp-build-cc-settings/examples/hooks-config.json +64 -0
- package/templates/skills/cbp-build-cc-settings/examples/permissions-config.json +34 -0
- package/templates/skills/cbp-build-cc-settings/examples/sandbox-config.json +42 -0
- package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +104 -0
- package/templates/skills/cbp-build-cc-settings/reference/permission-rules.md +61 -0
- package/templates/skills/cbp-build-cc-settings/reference/scope-precedence.md +73 -0
- package/templates/skills/cbp-build-cc-settings/reference/settings-fields.md +166 -0
- package/templates/skills/cbp-build-cc-settings/templates/settings.json +23 -0
- package/templates/skills/cbp-build-cc-settings/templates/settings.local.json +10 -0
- package/templates/skills/cbp-build-cc-skill/SKILL.md +154 -0
- package/templates/skills/cbp-build-cc-skill/examples/dynamic-context.md +31 -0
- package/templates/skills/cbp-build-cc-skill/examples/fork-skill.md +22 -0
- package/templates/skills/cbp-build-cc-skill/examples/knowledge-skill.md +25 -0
- package/templates/skills/cbp-build-cc-skill/examples/task-skill.md +29 -0
- package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +157 -0
- package/templates/skills/cbp-build-cc-skill/reference/frontmatter-fields.md +35 -0
- package/templates/skills/cbp-build-cc-skill/reference/string-substitutions.md +60 -0
- package/templates/skills/cbp-build-cc-skill/scripts/validate-skill.sh +90 -0
- package/templates/skills/cbp-build-cc-skill/templates/skill.md +51 -0
- package/templates/skills/cbp-checkpoint-check/SKILL.md +156 -0
- package/templates/skills/cbp-checkpoint-complete/SKILL.md +109 -0
- package/templates/skills/cbp-checkpoint-create/SKILL.md +287 -0
- package/templates/skills/cbp-checkpoint-end/SKILL.md +241 -0
- package/templates/skills/cbp-checkpoint-update/SKILL.md +115 -0
- package/templates/skills/cbp-frontend-a11y/SKILL.md +109 -0
- package/templates/skills/cbp-frontend-a11y/reference/aria-roles-states.md +130 -0
- package/templates/skills/cbp-frontend-a11y/reference/contrast-visual.md +122 -0
- package/templates/skills/cbp-frontend-a11y/reference/keyboard-patterns.md +154 -0
- package/templates/skills/cbp-frontend-a11y/reference/semantic-html.md +111 -0
- package/templates/skills/cbp-frontend-design/SKILL.md +145 -0
- package/templates/skills/cbp-frontend-design/reference/nextjs-scss.md +118 -0
- package/templates/skills/cbp-frontend-design/reference/rn-expo.md +101 -0
- package/templates/skills/cbp-frontend-design/reference/tauri-react.md +82 -0
- package/templates/skills/cbp-frontend-ui/SKILL.md +262 -0
- package/templates/skills/cbp-frontend-ui/reference/ui-label-maps.md +42 -0
- package/templates/skills/cbp-frontend-ui/reference/ui-layout-patterns.md +105 -0
- package/templates/skills/cbp-frontend-ui/reference/variant-defaults.md +149 -0
- package/templates/skills/cbp-frontend-ux/SKILL.md +181 -0
- package/templates/skills/cbp-git-branch-feat-create/SKILL.md +115 -0
- package/templates/skills/cbp-git-commit/SKILL.md +278 -0
- package/templates/skills/cbp-git-worktree-create/SKILL.md +226 -0
- package/templates/skills/cbp-git-worktree-remove/SKILL.md +145 -0
- package/templates/skills/cbp-merge-main/SKILL.md +228 -0
- package/templates/skills/cbp-round-check/SKILL.md +104 -0
- package/templates/skills/cbp-round-end/SKILL.md +183 -0
- package/templates/skills/cbp-round-end/reference/findings-presentation.md +44 -0
- package/templates/skills/cbp-round-end/reference/inline-fallback.md +35 -0
- package/templates/skills/cbp-round-execute/SKILL.md +211 -0
- package/templates/skills/cbp-round-execute/reference/inline-fallback.md +59 -0
- package/templates/skills/cbp-round-input/SKILL.md +165 -0
- package/templates/skills/cbp-round-start/SKILL.md +222 -0
- package/templates/skills/cbp-round-update/SKILL.md +163 -0
- package/templates/skills/cbp-session-end/SKILL.md +187 -0
- package/templates/skills/cbp-session-start/SKILL.md +155 -0
- package/templates/skills/cbp-ship/SKILL.md +332 -0
- package/templates/skills/cbp-ship/reference/changesets-overview.md +120 -0
- package/templates/skills/cbp-ship/reference/eas-cli-overview.md +60 -0
- package/templates/skills/cbp-ship/reference/gh-cli-overview.md +135 -0
- package/templates/skills/cbp-ship/reference/gh-cli-shipment-commands.md +283 -0
- package/templates/skills/cbp-ship/reference/npm-publish-monorepo.md +252 -0
- package/templates/skills/cbp-ship/reference/npm-publish-oidc-trusted.md +157 -0
- package/templates/skills/cbp-ship/reference/npm-publish-overview.md +171 -0
- package/templates/skills/cbp-ship/reference/preflight-checklist.md +88 -0
- package/templates/skills/cbp-ship/reference/railway-nestjs-deployment.md +169 -0
- package/templates/skills/cbp-ship/reference/railway-overview.md +120 -0
- package/templates/skills/cbp-ship/reference/railway-troubleshooting.md +168 -0
- package/templates/skills/cbp-ship/reference/release-please-overview.md +99 -0
- package/templates/skills/cbp-ship/reference/surface-expo-eas.md +155 -0
- package/templates/skills/cbp-ship/reference/surface-npm.md +180 -0
- package/templates/skills/cbp-ship/reference/surface-railway.md +152 -0
- package/templates/skills/cbp-ship/reference/surface-supabase.md +178 -0
- package/templates/skills/cbp-ship/reference/surface-tauri.md +138 -0
- package/templates/skills/cbp-ship/reference/surface-vercel.md +124 -0
- package/templates/skills/cbp-ship/reference/surface-vscode-ext.md +144 -0
- package/templates/skills/cbp-ship/reference/surfaces.md +60 -0
- package/templates/skills/cbp-ship/reference/testflight-automation.md +215 -0
- package/templates/skills/cbp-ship/reference/testflight-internal-vs-external.md +69 -0
- package/templates/skills/cbp-ship/reference/testflight-overview.md +98 -0
- package/templates/skills/cbp-ship/reference/versioning.md +116 -0
- package/templates/skills/cbp-ship/scripts/detect-surfaces.sh +217 -0
- package/templates/skills/cbp-ship/scripts/verify-expo-eas.sh +35 -0
- package/templates/skills/cbp-ship/scripts/verify-npm.sh +21 -0
- package/templates/skills/cbp-ship/scripts/verify-railway.sh +41 -0
- package/templates/skills/cbp-ship/scripts/verify-supabase.sh +19 -0
- package/templates/skills/cbp-ship/scripts/verify-tauri.sh +24 -0
- package/templates/skills/cbp-ship/scripts/verify-vercel.sh +32 -0
- package/templates/skills/cbp-ship/scripts/verify-vscode-ext.sh +25 -0
- package/templates/skills/cbp-ship/templates/eas.json +66 -0
- package/templates/skills/cbp-ship/templates/railway.toml +15 -0
- package/templates/skills/cbp-ship/templates/release-please-config.json +17 -0
- package/templates/skills/cbp-ship/templates/vercel.json +19 -0
- package/templates/skills/cbp-ship/templates/vscodeignore +21 -0
- package/templates/skills/cbp-ship/templates/workflow-changesets.yml +41 -0
- package/templates/skills/cbp-ship/templates/workflow-eas-submit.yml +53 -0
- package/templates/skills/cbp-ship/templates/workflow-npm-publish.yml +36 -0
- package/templates/skills/cbp-ship/templates/workflow-release-please.yml +21 -0
- package/templates/skills/cbp-ship/templates/workflow-tauri-release.yml +69 -0
- package/templates/skills/cbp-ship/templates/workflow-vsce-publish.yml +31 -0
- package/templates/skills/cbp-ship-configure/SKILL.md +296 -0
- package/templates/skills/cbp-ship-configure/reference/expo-mobile.md +204 -0
- package/templates/skills/cbp-ship-configure/reference/npm-package.md +165 -0
- package/templates/skills/cbp-ship-configure/reference/railway-backend.md +199 -0
- package/templates/skills/cbp-ship-configure/reference/supabase.md +200 -0
- package/templates/skills/cbp-ship-configure/reference/tauri-desktop.md +181 -0
- package/templates/skills/cbp-ship-configure/reference/vercel.md +117 -0
- package/templates/skills/cbp-ship-configure/reference/vscode-ext.md +155 -0
- package/templates/skills/cbp-ship-main/SKILL.md +65 -0
- package/templates/skills/cbp-supabase-branch-check/SKILL.md +337 -0
- package/templates/skills/cbp-supabase-branch-check/reference/dag-steps.md +29 -0
- package/templates/skills/cbp-supabase-migrate/SKILL.md +314 -0
- package/templates/skills/cbp-supabase-migrate/reference/advisor-triage.md +70 -0
- package/templates/skills/cbp-supabase-migrate/reference/cli-fallback.md +87 -0
- package/templates/skills/cbp-supabase-migrate/reference/preflight-dry-run.md +58 -0
- package/templates/skills/cbp-supabase-setup/SKILL.md +239 -0
- package/templates/skills/cbp-supabase-setup/reference/branching-setup.md +121 -0
- package/templates/skills/cbp-supabase-setup/reference/cli-fallback.md +109 -0
- package/templates/skills/cbp-task-check/SKILL.md +166 -0
- package/templates/skills/cbp-task-complete/SKILL.md +206 -0
- package/templates/skills/cbp-task-complete/reference/checkpoint-done-branching.md +48 -0
- package/templates/skills/cbp-task-complete/reference/next-step-heuristic.md +56 -0
- package/templates/skills/cbp-task-create/SKILL.md +167 -0
- package/templates/skills/cbp-task-start/SKILL.md +239 -0
- package/templates/skills/cbp-task-testing/SKILL.md +277 -0
- package/templates/skills/cbp-todo/SKILL.md +97 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Changesets — Overview
|
|
2
|
+
|
|
3
|
+
`@changesets/cli` is a versioning + changelog tool optimized for monorepos with many published packages. Devs add a `.changeset/*.md` entry alongside their feature work describing which packages bump and how (major/minor/patch). An aggregator GH Action (`changesets/action`) opens a "Version Packages" PR that consolidates pending changesets into version bumps + CHANGELOG entries; merging that PR triggers `changeset publish` to npm.
|
|
4
|
+
|
|
5
|
+
Used by the `npm-package` surface in `/cbp-ship` as one of three versioning modes — recommended for monorepos with 3+ published packages.
|
|
6
|
+
|
|
7
|
+
Upstream: https://github.com/changesets/changesets
|
|
8
|
+
|
|
9
|
+
## How `/cbp-ship` uses it
|
|
10
|
+
|
|
11
|
+
The `npm-package` surface ([surface-npm.md](./surface-npm.md)) offers changesets as one of three versioning modes. When a repo opts in via `/cbp-ship-configure`:
|
|
12
|
+
|
|
13
|
+
1. Configure runs `pnpm add -Dw @changesets/cli` + `npx changeset init` + scaffolds the workflow from `templates/workflow-changesets.yml`
|
|
14
|
+
2. Devs run `pnpm changeset` after each feature, committing the resulting `.changeset/*.md` file
|
|
15
|
+
3. The `changesets/action` workflow opens a "Version Packages" PR (or updates the existing one)
|
|
16
|
+
4. Maintainer reviews + merges
|
|
17
|
+
5. The action runs `pnpm changeset publish` which calls `pnpm publish -r` for every bumped package, with OIDC `--provenance`
|
|
18
|
+
|
|
19
|
+
A pre-merge gate (`changeset status` in CI) prevents merges without an accompanying changeset for changes to published packages.
|
|
20
|
+
|
|
21
|
+
## Changeset file format
|
|
22
|
+
|
|
23
|
+
```markdown
|
|
24
|
+
---
|
|
25
|
+
"@codebyplan/cli": minor
|
|
26
|
+
"@codebyplan/auth": patch
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
Add new export `foo` and fix bug in `bar`.
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The frontmatter lists affected packages with bump types. The body becomes the changelog entry. Filenames are auto-generated (e.g. `funky-tigers-dance.md`) — random words to avoid merge conflicts when multiple devs add changesets in parallel.
|
|
33
|
+
|
|
34
|
+
## Config
|
|
35
|
+
|
|
36
|
+
`.changeset/config.json` essentials:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
|
|
41
|
+
"changelog": "@changesets/cli/changelog",
|
|
42
|
+
"commit": false,
|
|
43
|
+
"fixed": [],
|
|
44
|
+
"linked": [],
|
|
45
|
+
"access": "public",
|
|
46
|
+
"baseBranch": "main",
|
|
47
|
+
"updateInternalDependencies": "patch",
|
|
48
|
+
"ignore": ["@codebyplan/web", "@codebyplan/backend"]
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
| Field | Purpose |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `access` | npm publish access (`public` for scoped public packages) |
|
|
55
|
+
| `baseBranch` | Branch the aggregator PR is opened against |
|
|
56
|
+
| `commit` | If `true`, commits version bumps directly; CBP keeps `false` for PR-based review |
|
|
57
|
+
| `fixed` | Arrays of package names that always bump together as one unit (same version) |
|
|
58
|
+
| `linked` | Arrays of packages that bump together but keep independent versions |
|
|
59
|
+
| `updateInternalDependencies` | When pkg A depends on pkg B and B bumps, what version range update A gets |
|
|
60
|
+
| `ignore` | Packages excluded from version-PR consideration (apps, internal-only) |
|
|
61
|
+
|
|
62
|
+
## Workflow shape
|
|
63
|
+
|
|
64
|
+
`templates/workflow-changesets.yml`:
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
name: changesets
|
|
68
|
+
on:
|
|
69
|
+
push:
|
|
70
|
+
branches: [main]
|
|
71
|
+
|
|
72
|
+
permissions:
|
|
73
|
+
contents: write
|
|
74
|
+
pull-requests: write
|
|
75
|
+
id-token: write # for npm OIDC trusted publishing
|
|
76
|
+
|
|
77
|
+
jobs:
|
|
78
|
+
release:
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v4
|
|
82
|
+
with: { fetch-depth: 0 }
|
|
83
|
+
- uses: pnpm/action-setup@v4
|
|
84
|
+
- uses: actions/setup-node@v4
|
|
85
|
+
with:
|
|
86
|
+
node-version: '20'
|
|
87
|
+
registry-url: https://registry.npmjs.org
|
|
88
|
+
- run: pnpm install --frozen-lockfile
|
|
89
|
+
- uses: changesets/action@v1
|
|
90
|
+
with:
|
|
91
|
+
version: pnpm changeset version
|
|
92
|
+
publish: pnpm changeset publish
|
|
93
|
+
commit: 'chore(release): version packages'
|
|
94
|
+
title: 'chore(release): version packages'
|
|
95
|
+
env:
|
|
96
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
97
|
+
NPM_CONFIG_PROVENANCE: 'true'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Note `NPM_CONFIG_PROVENANCE: 'true'` — equivalent to `--provenance` on every publish. Combined with `id-token: write` and trusted publishing, no NPM_TOKEN is needed.
|
|
101
|
+
|
|
102
|
+
## Common gotchas
|
|
103
|
+
|
|
104
|
+
| Symptom | Cause | Fix |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| Forgotten changesets | Dev merged a PR without `pnpm changeset` | Add `changeset status` step in CI to fail PRs that touch published packages without a changeset |
|
|
107
|
+
| Version PR conflicts | Two parallel branches both have changesets that bump the same package | Last-merged wins; the `changeset version` command consumes existing changesets, so the next aggregator run is clean |
|
|
108
|
+
| Accidental publish of internal package | Forgot `"private": true` on an internal package | `npm unpublish` within 72h, OR `npm deprecate` after; add `"private": true` and ship |
|
|
109
|
+
| `workspace:*` strings in tarball | Used `npm publish` instead of `pnpm publish` | Always use pnpm publish for workspace packages — it rewrites the protocol at pack time |
|
|
110
|
+
|
|
111
|
+
## Comparison vs release-please
|
|
112
|
+
|
|
113
|
+
See [versioning.md](./versioning.md) and [npm-publish-monorepo.md](./npm-publish-monorepo.md) for the full decision. Short version: changesets is the default for monorepos with many independent packages and mixed-contributor PRs; release-please is simpler when Conventional Commits are already enforced and there's a single (or few) tightly-coupled packages.
|
|
114
|
+
|
|
115
|
+
## Pairs With
|
|
116
|
+
|
|
117
|
+
- [surface-npm.md](./surface-npm.md) — npm publish surface that consumes bumped versions
|
|
118
|
+
- [versioning.md](./versioning.md) — when changesets is the right pick
|
|
119
|
+
- [npm-publish-monorepo.md](./npm-publish-monorepo.md) — pnpm-monorepo-specific config and pre-publish gates
|
|
120
|
+
- `templates/workflow-changesets.yml` — workflow scaffold dropped by the configure skill
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# EAS CLI — Overview
|
|
2
|
+
|
|
3
|
+
`eas-cli` (latest stable: 16.21.0 family) is the command-line tool for Expo Application Services. It builds Expo / React Native apps in the cloud (`eas build`), submits them to TestFlight / Play Console (`eas submit`), pushes runtime updates over-the-air (`eas update`), and manages credentials (`eas credentials`). Required for any mobile shipment via the `expo-mobile` surface in `/cbp-ship`.
|
|
4
|
+
|
|
5
|
+
Upstream docs: https://docs.expo.dev/eas/
|
|
6
|
+
|
|
7
|
+
## Commands `/cbp-ship` actually calls
|
|
8
|
+
|
|
9
|
+
The `expo-mobile` surface ([surface-expo-eas.md](./surface-expo-eas.md)) calls these:
|
|
10
|
+
|
|
11
|
+
| Command | Purpose |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `eas build --profile <name> --platform <p> --non-interactive --no-wait` | Kick off a cloud build; returns build IDs immediately |
|
|
14
|
+
| `eas build:wait --build-id <id>` | Block until build reaches FINISHED state |
|
|
15
|
+
| `eas build:view <id> --json` | Inspect build status (used by `verify-expo-eas.sh`) |
|
|
16
|
+
| `eas submit --platform <p> --id <build-id> --non-interactive` | Upload finished build to TestFlight (iOS) / Play (Android) |
|
|
17
|
+
| `eas submit:list --status finished --json` | Verify submission completed |
|
|
18
|
+
| `eas credentials` | Interactive — Apple Distribution Certificate, Provisioning Profile, Push Notification Key, Android keystore |
|
|
19
|
+
| `eas init` | Initialise EAS project (one-time, configure setup only) |
|
|
20
|
+
| `eas whoami` | Probe — verify CLI auth |
|
|
21
|
+
|
|
22
|
+
## Build profiles used
|
|
23
|
+
|
|
24
|
+
Per `templates/eas.json` in this skill:
|
|
25
|
+
|
|
26
|
+
| Profile | Distribution | Auto-increment | Use |
|
|
27
|
+
|---|---|---|---|
|
|
28
|
+
| `development` | internal (dev client) | none | Local dev iteration |
|
|
29
|
+
| `preview` | internal | buildNumber | TestFlight internal group, fast feedback |
|
|
30
|
+
| `production` | store | buildNumber | TestFlight external review → App Store |
|
|
31
|
+
|
|
32
|
+
## Auth model
|
|
33
|
+
|
|
34
|
+
EAS auth is a CLI session bound to an Expo account:
|
|
35
|
+
|
|
36
|
+
- `eas login` — interactive browser auth, stores token at `~/.expo/state.json`
|
|
37
|
+
- `EXPO_TOKEN` env var — for CI; bypasses interactive login
|
|
38
|
+
- `eas whoami` — probe that auth is alive
|
|
39
|
+
|
|
40
|
+
Unlike many CLIs, there is no "key file" — the session token IS the credential. Apple/Google credentials are stored separately, encrypted, on Expo's servers (managed via `eas credentials`).
|
|
41
|
+
|
|
42
|
+
## Auto-increment behaviour
|
|
43
|
+
|
|
44
|
+
When `eas.json` build profile sets `autoIncrement: "buildNumber"` (iOS) or `"versionCode"` (Android), EAS bumps the value remotely on each build. The bumped value is the source of truth — local `app.json` may show stale values until `eas build:configure` syncs them down. This is why CBP's mobile shipment never has the user manually bump build numbers; semver `expo.version` stays manual.
|
|
45
|
+
|
|
46
|
+
## Common failure modes
|
|
47
|
+
|
|
48
|
+
| Error | Cause | Fix |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `Provisioning profile not found` | Apple credential drift | `eas credentials` → Apple → resync |
|
|
51
|
+
| `EAS Build worker not available` | Quota or platform incident | Check https://status.expo.dev; wait + retry |
|
|
52
|
+
| `Build failed: Native module link error` | Native module added to package.json without prebuild | `npx expo prebuild --clean`, commit, retry |
|
|
53
|
+
| `eas submit` errors with "Invalid bundle" | `app.json` `bundleIdentifier` doesn't match ASC record | Verify ASC app record; bundle IDs are immutable once published |
|
|
54
|
+
|
|
55
|
+
## Pairs With
|
|
56
|
+
|
|
57
|
+
- [surface-expo-eas.md](./surface-expo-eas.md) — operational deploy steps (variants: expo-go-only / eas-internal / eas-external)
|
|
58
|
+
- [testflight-overview.md](./testflight-overview.md) — what happens AFTER `eas submit` lands on App Store Connect
|
|
59
|
+
- [testflight-automation.md](./testflight-automation.md) — ASC API key setup that EAS Submit consumes
|
|
60
|
+
- `templates/eas.json` — canonical eas.json shape for CBP mobile apps
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# GitHub CLI (`gh`) — Overview
|
|
2
|
+
|
|
3
|
+
Reference for the `/cbp-ship` orchestrator and other shipment-surface skills. Authoritative manual: <https://cli.github.com/manual>.
|
|
4
|
+
|
|
5
|
+
## What `gh` Is
|
|
6
|
+
|
|
7
|
+
`gh` is GitHub's official command-line interface. It wraps the REST + GraphQL APIs in ergonomic subcommands (`gh pr`, `gh release`, `gh run`, `gh secret`, `gh api`) and authenticates against `github.com` or a GitHub Enterprise host.
|
|
8
|
+
|
|
9
|
+
For CodeByPlan we use it for: PR creation/merge, release creation, secret management, watching workflow runs, and (for non-Vercel platforms) hitting the Deployments API.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
| Platform | Command |
|
|
14
|
+
|----------|---------|
|
|
15
|
+
| macOS (Homebrew) | `brew install gh` |
|
|
16
|
+
| macOS (MacPorts) | `sudo port install gh` |
|
|
17
|
+
| Linux (apt) | `sudo apt install gh` (after adding the repo per <https://github.com/cli/cli/blob/trunk/docs/install_linux.md>) |
|
|
18
|
+
| Windows (winget) | `winget install --id GitHub.cli` |
|
|
19
|
+
| Direct | <https://github.com/cli/cli/releases> |
|
|
20
|
+
|
|
21
|
+
Verify: `gh --version` (this worktree's pipelines target the latest stable; v2.x is the supported major).
|
|
22
|
+
|
|
23
|
+
## Auth Flow
|
|
24
|
+
|
|
25
|
+
### Initial login
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
gh auth login
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Interactive prompts cover: hostname (`github.com` vs Enterprise), git protocol (HTTPS vs SSH), credential storage, browser-based vs token-based. The default path is web flow against `github.com` with HTTPS git protocol.
|
|
32
|
+
|
|
33
|
+
### Headless / CI
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
echo "$GITHUB_TOKEN" | gh auth login --with-token
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or rely on env vars — `gh` honours `GITHUB_TOKEN` / `GH_TOKEN` automatically and skips the credential store entirely. Useful inside GitHub Actions where `${{ secrets.GITHUB_TOKEN }}` is already in scope.
|
|
40
|
+
|
|
41
|
+
### Scopes
|
|
42
|
+
|
|
43
|
+
Minimum scopes for the `gh` default flow: `repo`, `read:org`, `gist`. Shipment work additionally needs:
|
|
44
|
+
|
|
45
|
+
| Scope | Why |
|
|
46
|
+
|-------|-----|
|
|
47
|
+
| `repo` | PR create/merge, release create, secret set (repo-level) |
|
|
48
|
+
| `workflow` | Trigger / re-run workflows via `gh workflow run` |
|
|
49
|
+
| `admin:org` | Org-level secrets via `gh secret set --org` |
|
|
50
|
+
| `admin:public_key` | SSH key upload during `gh auth login` (skipped with `--skip-ssh-key`) |
|
|
51
|
+
| `read:packages` / `write:packages` | Container/release asset interactions touching GHCR |
|
|
52
|
+
|
|
53
|
+
Bump scopes on an existing login with:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
gh auth refresh --scopes workflow,admin:org
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Status & switching
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
gh auth status # which host(s), which user, where token is stored
|
|
63
|
+
gh auth switch --user <login> # multi-account
|
|
64
|
+
gh auth logout --hostname github.com
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Config Locations
|
|
68
|
+
|
|
69
|
+
| Path | Purpose |
|
|
70
|
+
|------|---------|
|
|
71
|
+
| `~/.config/gh/config.yml` | Global preferences (editor, git_protocol, prompt) |
|
|
72
|
+
| `~/.config/gh/hosts.yml` | Per-host auth state (token if insecure storage; otherwise pointer into OS keychain) |
|
|
73
|
+
| `$XDG_CONFIG_HOME/gh/...` | Honoured if `XDG_CONFIG_HOME` is set |
|
|
74
|
+
| OS keychain (macOS Keychain / Windows Credential Manager / `secret-tool` on Linux) | Default secure token storage |
|
|
75
|
+
|
|
76
|
+
Inspect or override with `gh config get/set <key>`.
|
|
77
|
+
|
|
78
|
+
## SSH vs HTTPS
|
|
79
|
+
|
|
80
|
+
`gh auth login --git-protocol ssh|https` controls which URL form is written into git remotes. SSH requires either an existing key or `gh` generating one (it'll offer to upload it via the `admin:public_key` scope). HTTPS is simpler for headless contexts because git push reuses the `gh` token via the credential helper.
|
|
81
|
+
|
|
82
|
+
The token used for `gh api` calls is independent of the git protocol — flipping between SSH and HTTPS does not re-auth the API.
|
|
83
|
+
|
|
84
|
+
## GitHub Enterprise
|
|
85
|
+
|
|
86
|
+
`gh` supports Enterprise Server out of the box:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
gh auth login --hostname ghe.example.com
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
After login, every command honours an explicit `--hostname` flag or the `GH_HOST` env var. Repository references can be qualified inline:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
gh pr list --repo ghe.example.com/team/repo
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
CodeByPlan production targets `github.com`; the Enterprise path is documented for completeness in case downstream consumers fork the pipeline.
|
|
99
|
+
|
|
100
|
+
## Common Flags (Cross-Cutting)
|
|
101
|
+
|
|
102
|
+
| Flag | Behaviour |
|
|
103
|
+
|------|-----------|
|
|
104
|
+
| `--repo <[HOST/]OWNER/REPO>` (`-R`) | Override the inferred repo. Required when running outside a checkout, or against a different repo than `origin`. |
|
|
105
|
+
| `--json <fields>` | Switch a list/view command to JSON output. Field list is command-specific (`gh pr view --json` differs from `gh run view --json`). Pass `--json` with no value to discover available fields. |
|
|
106
|
+
| `--jq <expr>` | Apply a `jq` expression to the JSON output server-side (in-process, no `jq` binary needed). |
|
|
107
|
+
| `--template <go-tmpl>` | Apply a Go text/template instead of JSON output. |
|
|
108
|
+
| `--web` | Open the browser to the equivalent UI page rather than performing the API action. |
|
|
109
|
+
|
|
110
|
+
JSON + jq is the canonical pattern for scripting:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
gh pr view 123 --json state,mergeable --jq '.state'
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## The `gh api` Escape Hatch
|
|
117
|
+
|
|
118
|
+
Anything not covered by a dedicated subcommand falls back to `gh api`:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
gh api repos/{owner}/{repo}/deployments --method POST -f ref=main -f environment=production
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`gh api` reuses the authenticated token, handles pagination (`--paginate`), supports both REST and GraphQL (`graphql` as the path), and accepts typed (`-F`) or raw (`-f`) fields. See [gh-cli-shipment-commands.md](./gh-cli-shipment-commands.md) for the deployment-specific invocation.
|
|
125
|
+
|
|
126
|
+
## Where to Look Next
|
|
127
|
+
|
|
128
|
+
- [gh-cli-shipment-commands.md](./gh-cli-shipment-commands.md) — exact shipment commands `/cbp-ship` runs, with flags, JSON shapes, and error modes
|
|
129
|
+
- <https://cli.github.com/manual> — authoritative per-command reference (always reflects the latest release)
|
|
130
|
+
- `gh <command> --help` — the same content, offline, pinned to your installed version
|
|
131
|
+
|
|
132
|
+
## Pairs With
|
|
133
|
+
|
|
134
|
+
- `/cbp-ship` skill (orchestrator that wraps these commands)
|
|
135
|
+
- `.claude/rules/git-workflow.md` — branch / commit conventions that `gh pr create` must respect
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# GitHub CLI — Shipment Commands
|
|
2
|
+
|
|
3
|
+
Commands `/cbp-ship` actually runs, organised by surface. Authoritative reference: <https://cli.github.com/manual>. Each section: exact command, flags we use, JSON shape (where applicable), common errors.
|
|
4
|
+
|
|
5
|
+
## 1. Pull Requests
|
|
6
|
+
|
|
7
|
+
### `gh pr create` — open a PR
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gh pr create --base main --head "$BRANCH" \
|
|
11
|
+
--title "$TITLE" --body-file .claude/tmp/pr-body.md --draft
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Flag | Purpose |
|
|
15
|
+
|------|---------|
|
|
16
|
+
| `--base <branch>` | Target. CBP ships `feat/* -> main`; always set explicitly. |
|
|
17
|
+
| `--head <branch>` | Source. Defaults to current; pass explicitly with `--repo`. |
|
|
18
|
+
| `--title` | One-line title. Obey `rules/git-workflow.md` (no Claude attribution). |
|
|
19
|
+
| `--body-file <path>` | Multiline body. Preferred over `--body`. |
|
|
20
|
+
| `--draft` | Open in draft. CBP default for non-trivial PRs. |
|
|
21
|
+
| `--reviewer @me,user,team/slug` | Optional. |
|
|
22
|
+
| `--label`, `--assignee`, `--milestone`, `--project` | Optional metadata. |
|
|
23
|
+
| `--fill` | Use commit subject + body as title/body. |
|
|
24
|
+
| `--repo OWNER/REPO` | Required outside the checkout. |
|
|
25
|
+
|
|
26
|
+
Output: prints the URL on stdout (no JSON). Capture the PR number with `gh pr view --json number`.
|
|
27
|
+
|
|
28
|
+
Common errors:
|
|
29
|
+
|
|
30
|
+
- `A pull request already exists for ...` — branch has an open PR; use `gh pr view`.
|
|
31
|
+
- `must provide --title and --body (or --fill)` — non-TTY without flags.
|
|
32
|
+
- `Head sha can't be blank` — branch not pushed; `git push -u origin <branch>` first.
|
|
33
|
+
|
|
34
|
+
### `gh pr view` — read PR state
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
gh pr view "$PR_NUMBER" \
|
|
38
|
+
--json number,state,mergeable,mergeStateStatus,headRefOid,baseRefName,reviewDecision,statusCheckRollup,url \
|
|
39
|
+
--jq .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Field | Type | Use |
|
|
43
|
+
|-------|------|-----|
|
|
44
|
+
| `state` | `OPEN`/`CLOSED`/`MERGED` | Gate further actions |
|
|
45
|
+
| `mergeable` | `MERGEABLE`/`CONFLICTING`/`UNKNOWN` | Pre-merge gate |
|
|
46
|
+
| `mergeStateStatus` | `CLEAN`/`BLOCKED`/`BEHIND`/`DIRTY`/`UNSTABLE`/`HAS_HOOKS` | Why merge is blocked |
|
|
47
|
+
| `headRefOid` | sha | Pin a `--match-head-commit` merge |
|
|
48
|
+
| `reviewDecision` | `APPROVED`/`CHANGES_REQUESTED`/`REVIEW_REQUIRED` | Review gate |
|
|
49
|
+
| `statusCheckRollup` | array | Per-check status; filter with `--jq` |
|
|
50
|
+
|
|
51
|
+
Pass `--json` with no value to discover the full field list.
|
|
52
|
+
|
|
53
|
+
### `gh pr merge` — merge a PR
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
gh pr merge "$PR_NUMBER" --merge --delete-branch --match-head-commit "$HEAD_OID"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| Flag | Purpose |
|
|
60
|
+
|------|---------|
|
|
61
|
+
| `--merge`/`--squash`/`--rebase` | Strategy. CBP default is `--merge`. `--rebase` often blocked by branch protection. |
|
|
62
|
+
| `--auto` | Auto-merge once required checks pass. |
|
|
63
|
+
| `--delete-branch` (`-d`) | Delete head after merge. Always set for `feat/*`. |
|
|
64
|
+
| `--admin` | Bypass branch protection. Reserved for emergency hotfixes; never default. |
|
|
65
|
+
| `--match-head-commit <oid>` | Refuse merge if HEAD has moved. Use `headRefOid` from `gh pr view`. |
|
|
66
|
+
| `--subject`, `--body` | Override merge commit message. |
|
|
67
|
+
|
|
68
|
+
Common errors:
|
|
69
|
+
|
|
70
|
+
- `Pull request is not mergeable: <reason>` — inspect `mergeStateStatus`. `BLOCKED` = required checks/reviews missing.
|
|
71
|
+
- `auto-merge is not allowed for this repository` — repo disables it; remove `--auto`.
|
|
72
|
+
- HTTP 405 on protected branches without `--admin` — expected; do NOT auto-escalate.
|
|
73
|
+
|
|
74
|
+
## 2. Releases
|
|
75
|
+
|
|
76
|
+
### `gh release create`
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
gh release create "$TAG" --title "$TITLE" --notes-file CHANGELOG-fragment.md \
|
|
80
|
+
--target "$COMMIT_SHA" --latest ./dist/*.tar.gz ./dist/*.zip
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Argument order: `gh release create <tag> [<asset>...]`. Tag is positional + required.
|
|
84
|
+
|
|
85
|
+
| Flag | Purpose |
|
|
86
|
+
|------|---------|
|
|
87
|
+
| `--title` (`-t`) | Title. Defaults to tag. |
|
|
88
|
+
| `--notes-file` (`-F`) | Notes from file. `-` for stdin. |
|
|
89
|
+
| `--generate-notes` | Auto-generate via API; combinable with `--notes-file` (file content goes above generated). |
|
|
90
|
+
| `--target <branch-or-sha>` | Tag-target if tag does not exist. |
|
|
91
|
+
| `--draft` (`-d`) | Save as draft. CBP default for human review. |
|
|
92
|
+
| `--prerelease` (`-p`) | Prerelease flag. |
|
|
93
|
+
| `--latest` / `--latest=false` | Mark/unmark as Latest. |
|
|
94
|
+
| `--verify-tag` | Refuse if tag does not exist remotely. |
|
|
95
|
+
| `--discussion-category <name>` | Open a discussion. |
|
|
96
|
+
| `--fail-on-no-commits` | Abort if no new commits since last release. |
|
|
97
|
+
|
|
98
|
+
Asset upload: paths after the tag. Custom labels via `'/path/to/file.zip#Display Label'`.
|
|
99
|
+
|
|
100
|
+
Common errors:
|
|
101
|
+
|
|
102
|
+
- `tag already exists` (without `--target`) — local tag points to different sha; `git push --tags` or `git tag -d` + recreate.
|
|
103
|
+
- `validation failed: name has already been taken` — use `gh release edit` or `gh release delete` first.
|
|
104
|
+
- `could not find tag` with `--verify-tag` — push the tag first.
|
|
105
|
+
|
|
106
|
+
### `gh release view`
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
gh release view "$TAG" --json tagName,name,isDraft,isLatest,isPrerelease,publishedAt,url,assets --jq .
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
JSON fields: `tagName`, `name`, `body`, `isDraft`, `isLatest`, `isPrerelease`, `publishedAt`, `url`, `tarballUrl`, `zipballUrl`, `assets[].{name,size,downloadCount,url}`.
|
|
113
|
+
|
|
114
|
+
### `gh release delete`
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
gh release delete "$TAG" --yes --cleanup-tag
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`--yes` skips confirmation (required non-TTY). `--cleanup-tag` also deletes the underlying git tag. `release not found` is a soft failure — treat as already-clean.
|
|
121
|
+
|
|
122
|
+
## 3. Secrets
|
|
123
|
+
|
|
124
|
+
### `gh secret list`
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
gh secret list --repo "$OWNER/$REPO"
|
|
128
|
+
gh secret list --org "$ORG"
|
|
129
|
+
gh secret list --env "$ENV" --repo "$OWNER/$REPO"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Output is tab-separated `NAME UPDATED`. No `--json`. Secret values are never returned.
|
|
133
|
+
|
|
134
|
+
### `gh secret set`
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
echo -n "$VALUE" | gh secret set MY_SECRET # repo-level
|
|
138
|
+
gh secret set --env-file .env.production # bulk from dotenv
|
|
139
|
+
echo -n "$VALUE" | gh secret set MY_SECRET --env production # environment
|
|
140
|
+
echo -n "$VALUE" | gh secret set MY_SECRET --org myorg --visibility selected --repos repo1,repo2
|
|
141
|
+
echo -n "$VALUE" | gh secret set MY_SECRET --app dependabot # dependabot
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Scope matrix:
|
|
145
|
+
|
|
146
|
+
| Flag combo | Scope | Token scope |
|
|
147
|
+
|------------|-------|-------------|
|
|
148
|
+
| (none) | Repository | `repo` |
|
|
149
|
+
| `--env <name>` | Repository environment (env must exist) | `repo` |
|
|
150
|
+
| `--org <name> --visibility all`/`private` | Org-wide | `admin:org` |
|
|
151
|
+
| `--org <name> --visibility selected --repos a,b` | Org allow-list | `admin:org` |
|
|
152
|
+
| `--app actions` (default) / `dependabot` / `codespaces` | Per-application surface | as above |
|
|
153
|
+
|
|
154
|
+
Input precedence: `--body <value>` > stdin > interactive prompt. Prefer stdin to keep values out of process listings and shell history.
|
|
155
|
+
|
|
156
|
+
Common errors:
|
|
157
|
+
|
|
158
|
+
- `HTTP 404` with `--env` — environment must exist (`gh api repos/{o}/{r}/environments/{name} --method PUT`).
|
|
159
|
+
- `HTTP 422: visibility 'selected' requires --repos` — supply allow-list.
|
|
160
|
+
- `HTTP 403` against `--org` — `gh auth refresh --scopes admin:org`.
|
|
161
|
+
|
|
162
|
+
## 4. Workflow Runs
|
|
163
|
+
|
|
164
|
+
### `gh run list`
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
gh run list --workflow ci.yml --branch "$BRANCH" --limit 10 \
|
|
168
|
+
--json databaseId,status,conclusion,headSha,event,createdAt,workflowName,url \
|
|
169
|
+
--jq '.[] | select(.conclusion != "success")'
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Flags: `--workflow` (filename/ID/name), `--branch`, `--user`, `--status`, `--event`, `--limit` (default 20), `--created`, `--json`, `-R/--repo`.
|
|
173
|
+
|
|
174
|
+
JSON fields: `attempt`, `conclusion`, `createdAt`, `databaseId`, `displayTitle`, `event`, `headBranch`, `headSha`, `name`, `number`, `startedAt`, `status`, `updatedAt`, `url`, `workflowDatabaseId`, `workflowName`.
|
|
175
|
+
|
|
176
|
+
`status`: `queued`, `in_progress`, `completed`, `requested`, `waiting`. `conclusion` (when `status=completed`): `success`, `failure`, `cancelled`, `skipped`, `timed_out`, `action_required`, `neutral`, `stale`.
|
|
177
|
+
|
|
178
|
+
### `gh run watch`
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
gh run watch "$RUN_ID" --exit-status --interval 5 --compact
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
| Flag | Purpose |
|
|
185
|
+
|------|---------|
|
|
186
|
+
| `--exit-status` | Non-zero on failure. Required for `set -e`. |
|
|
187
|
+
| `--interval <sec>` (`-i`) | Poll interval (default 3). Bump to 5-10 for long runs. |
|
|
188
|
+
| `--compact` | Show only failed/relevant steps. |
|
|
189
|
+
| `-R/--repo` | Override repo. |
|
|
190
|
+
|
|
191
|
+
Never omit `RUN_ID` in `/cbp-ship` — without it the command prompts (no TTY).
|
|
192
|
+
|
|
193
|
+
### `gh run view`
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
gh run view "$RUN_ID" --json status,conclusion,jobs,workflowName,url --jq . # summary
|
|
197
|
+
gh run view "$RUN_ID" --log-failed # failed-step logs
|
|
198
|
+
gh run view --job "$JOB_ID" --log # one job
|
|
199
|
+
gh run view "$RUN_ID" --exit-status # script-friendly
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
JSON fields: same as `run list` plus `jobs`. `jobs[].{databaseId,name,status,conclusion,steps[].{name,conclusion,number}}` — canonical drill-down from a failed run to the responsible step.
|
|
203
|
+
|
|
204
|
+
Common errors:
|
|
205
|
+
|
|
206
|
+
- `could not find any workflow run with ID <x>` — wrong repo or expired; verify with `gh run list -R <repo>`.
|
|
207
|
+
- `--log-failed` empty while in progress — pair with `gh run watch` first.
|
|
208
|
+
- Logs older than 90 days unavailable (GitHub-side retention).
|
|
209
|
+
|
|
210
|
+
## 5. Deployments API (Non-Vercel)
|
|
211
|
+
|
|
212
|
+
For non-Vercel deploy targets, `/cbp-ship` records deploys via the GitHub Deployments API using `gh api`. There is no `gh deployment` subcommand.
|
|
213
|
+
|
|
214
|
+
### Create a deployment
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
gh api "repos/$OWNER/$REPO/deployments" --method POST \
|
|
218
|
+
-f ref="$COMMIT_SHA" -f environment=production -f description="ship: $TAG" \
|
|
219
|
+
-F auto_merge=false -f required_contexts='[]'
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
- `-f key=value` — string field.
|
|
223
|
+
- `-F key=value` — typed field (`true`/`false`/`null`/integer auto-converted).
|
|
224
|
+
- `required_contexts='[]'` — empty JSON array as a string to skip status-check gating.
|
|
225
|
+
- `--input <file>` — for complex payloads, pass JSON from file.
|
|
226
|
+
|
|
227
|
+
Response (excerpt):
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"id": 12345678,
|
|
232
|
+
"url": "https://api.github.com/repos/.../deployments/12345678",
|
|
233
|
+
"sha": "abc123...",
|
|
234
|
+
"ref": "main",
|
|
235
|
+
"environment": "production",
|
|
236
|
+
"statuses_url": "https://api.github.com/repos/.../deployments/12345678/statuses"
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Capture `id` for status follow-ups.
|
|
241
|
+
|
|
242
|
+
### Update deployment status
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
gh api "repos/$OWNER/$REPO/deployments/$DEPLOYMENT_ID/statuses" --method POST \
|
|
246
|
+
-f state=success -f environment_url="https://app.example.com" \
|
|
247
|
+
-f log_url="https://github.com/.../actions/runs/$RUN_ID" -f description="Live"
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
`state` values: `error`, `failure`, `inactive`, `in_progress`, `queued`, `pending`, `success`. Only `success` and `inactive` are terminal in the UI.
|
|
251
|
+
|
|
252
|
+
### List deployments
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
gh api "repos/$OWNER/$REPO/deployments?environment=production&per_page=10" \
|
|
256
|
+
--jq '.[] | {id, sha, created_at, ref}'
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Combine `--paginate` for full history, but bound it — Deployments grow unbounded.
|
|
260
|
+
|
|
261
|
+
Common errors:
|
|
262
|
+
|
|
263
|
+
- `HTTP 422: required_contexts is invalid` — pass `'[]'` literal with `-f`.
|
|
264
|
+
- `HTTP 422: Conflict merging <ref>` — `auto_merge` defaulted to true; pass `-F auto_merge=false`.
|
|
265
|
+
- `HTTP 404` — ref does not exist remotely, or token lacks `repo_deployment` (subset of `repo`).
|
|
266
|
+
|
|
267
|
+
## Quick-Reference: What `/cbp-ship` Calls
|
|
268
|
+
|
|
269
|
+
| Phase | Command |
|
|
270
|
+
|-------|---------|
|
|
271
|
+
| Open PR | `gh pr create --base ... --head ... --title ... --body-file ... --draft` |
|
|
272
|
+
| Wait for checks | `gh run watch $RUN_ID --exit-status --interval 5` |
|
|
273
|
+
| Inspect failure | `gh run view $RUN_ID --log-failed` |
|
|
274
|
+
| Pre-merge gate | `gh pr view $PR --json mergeable,mergeStateStatus,reviewDecision,headRefOid` |
|
|
275
|
+
| Merge | `gh pr merge $PR --merge --delete-branch --match-head-commit $OID` |
|
|
276
|
+
| Cut release | `gh release create $TAG --title ... --notes-file ... --target $SHA --latest` |
|
|
277
|
+
| Record deploy (non-Vercel) | `gh api repos/.../deployments --method POST -f ref=$SHA -f environment=production` |
|
|
278
|
+
|
|
279
|
+
## Pairs With
|
|
280
|
+
|
|
281
|
+
- [gh-cli-overview.md](./gh-cli-overview.md) — install, auth, config locations
|
|
282
|
+
- `/cbp-ship` skill — orchestrator that sequences these calls
|
|
283
|
+
- `.claude/rules/git-workflow.md` — branch/commit conventions enforced before any of these commands run
|