Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions .claude/commands/ship.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Ship — Full Delivery Loop

Commit staged work, push, open a PR, then run the full CI + review loop until the PR is green and all findings are addressed or dismissed.

## Phase 1 — Commit & PR

### 1.1 Check state

```bash
git status --porcelain | grep -v '^??'
git branch --show-current
```

If no tracked changes and no unpushed commits, check for an already-open PR and skip to Phase 2.

### 1.2 Stage and commit

```bash
git add -u
```

Write a conventional commit message (`feat:`, `fix:`, `chore:`, etc.) that describes the why, not the what.

```bash
git commit -m "<type>: <message>"
```

### 1.3 Push

```bash
git push -u origin HEAD
```

### 1.4 Create PR (or detect existing)

```bash
PR_NUM=$(gh pr list --head "$(git branch --show-current)" --state open --json number --jq '.[0].number' 2>/dev/null)
```

If `PR_NUM` is empty, create one:

```bash
gh pr create --title "<title>" --body "<summary + test plan>"
PR_NUM=$(gh pr list --head "$(git branch --show-current)" --state open --json number --jq '.[0].number')
```

Capture `PR_NUM` — it is used in every subsequent step.

---

## Phase 2 — CI Loop

Repeat until all checks pass.

### 2.1 Wait for checks

```bash
gh pr checks "$PR_NUM" --watch --interval 15
```

### 2.2 Handle failures

For each failed check:

1. Find the run ID: `gh pr checks "$PR_NUM" --json name,link`
2. Fetch failure logs: `gh run view <run-id> --log-failed`
3. Diagnose root cause
4. Fix the code
5. `make test` — must pass locally before pushing
6. Commit and push:

```bash
git add -u
git commit -m "fix: <what was wrong>"
git push
```

7. Go back to 2.1

---

## Phase 3 — Review Loop

Run once CI is fully green.

### 3.1 Fetch inline comments (Copilot, reviewers)

```bash
REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
gh api "repos/$REPO/pulls/$PR_NUM/comments" --jq '.[] | {path: .path, line: .line, body: .body}'
```

### 3.2 Fetch review summaries

```bash
gh pr view "$PR_NUM" --json reviews --jq '.reviews[] | {author: .author.login, state: .state, body: .body}'
```

### 3.3 Evaluate each finding

For each comment:

- **Warranted**: apply fix, run `make test`
- **Not warranted**: note the reasoning explicitly — do not apply blindly

### 3.4 If fixes were made

```bash
git add -u
git commit -m "fix: address review findings"
git push
```

Then go back to Phase 2 to confirm CI still passes with the fixes.

---

## Done

Report the PR as ready to merge when:

- All CI checks are green
- All review findings are addressed or explicitly dismissed with reasoning

```bash
gh pr view "$PR_NUM" --json url,title,state
```
58 changes: 58 additions & 0 deletions .claude/commands/watch-pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Watch PR — CI and Review Loop

After opening a PR, wait for CI and Copilot/reviewer feedback, fix warranted issues,
and push until the PR is green and all review findings are addressed.

## Step 1 — Identify the PR

```bash
BRANCH=$(git branch --show-current)
gh pr list --head "$BRANCH" --state open --json number,url
```

If no open PR is found, stop and tell the user.

## Step 2 — Wait for CI

```bash
gh pr checks <number> --watch --interval 15
```

## Step 3 — Handle CI failures

For each failed check:

1. Fetch the failure output from the check run logs via `gh run view`
2. Diagnose the root cause
3. Fix the code
4. Run `make test` to verify locally
5. Push — then go back to Step 2

## Step 4 — Fetch review feedback

```bash
gh pr view <number> --json reviews,comments
```

For each finding:

- Evaluate whether it is correct and warranted
- If yes: apply the fix, run `make test`
- If no: note the reasoning — do not blindly apply every suggestion

## Step 5 — Push and re-check

If any fixes were made:

```bash
git add -u
git commit -m "fix: address CI failures / review findings"
git push
```

Then go back to Step 2 to confirm CI still passes.

## Done

Report the PR as ready to merge when CI is green and all review findings are addressed or
explicitly dismissed with reasoning.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ TestResults.json
*.test
*.out
go.work
.commit_msg_tmp
2 changes: 0 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Commands

```bash
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.DEFAULT_GOAL := build

.PHONY: all build test vet clean
.PHONY: all build test vet clean install.tools lint deps.vulncheck

install.tools: install.tools.local

install.tools.local:
Comment thread
koenighotze marked this conversation as resolved.
go install golang.org/x/vuln/cmd/govulncheck@latest
Expand All @@ -16,6 +18,8 @@ fmt:
vet: fmt
go vet ./cmd/... ./internal/... ./pkg/...

lint: lint.local

lint.local:
golangci-lint run ./...

Expand All @@ -26,6 +30,8 @@ deps.upgrade:
deps.vendor:
go mod vendor

deps.vulncheck: deps.vulncheck.local

deps.vulncheck.local:
govulncheck ./...

Expand Down
95 changes: 0 additions & 95 deletions design/TODO_01_Fix_secret_error_message.md

This file was deleted.

Loading
Loading