Skip to content

Commit 0a3068c

Browse files
committed
update workflow
1 parent 0ac50ca commit 0a3068c

5 files changed

Lines changed: 249 additions & 26 deletions

File tree

.claude/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Rust library for NP-hard problem reductions. Implements computational problems w
1717
- [meta-power](skills/meta-power/SKILL.md) -- Batch-resolve all open `[Model]` and `[Rule]` issues autonomously: plan, implement, review, fix CI, merge — in dependency order (models first).
1818
- [project-pipeline](skills/project-pipeline/SKILL.md) -- Pick a Ready issue from the GitHub Project board, move it through In Progress -> issue-to-pr --execute -> review-agentic.
1919
- [review-pipeline](skills/review-pipeline/SKILL.md) -- Pick a PR from review-agentic column, fix Copilot review comments, fix CI, run agentic feature tests, move to In Review.
20+
- [dev-setup](skills/dev-setup/SKILL.md) -- Interactive wizard to install and configure all development tools for new maintainers.
2021

2122
## Commands
2223
```bash

.claude/skills/dev-setup/SKILL.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
name: dev-setup
3+
description: Interactive wizard to install and configure all development tools for new maintainers
4+
---
5+
6+
# Dev Setup
7+
8+
Interactive wizard that helps new maintainers install and configure all tools needed for the problemreductions project.
9+
10+
## Step 1: Dependencies Checklist
11+
12+
Check if `skills/dev-setup/dependencies.md` exists and has content.
13+
14+
- **If it exists**, ask the user:
15+
> "Found existing dependencies checklist. Use it as-is, or rescan project files for changes?"
16+
- **Use existing** → read `dependencies.md` and proceed to Step 2
17+
- **Rescan** → scan project files (see Scan Targets below), overwrite `dependencies.md`, then proceed
18+
19+
- **If it does not exist**, scan project files and generate `dependencies.md` with the format shown in the existing file. Then proceed.
20+
21+
### Scan Targets
22+
23+
When scanning, read these files for tool references:
24+
25+
- `Makefile` — tool invocations (cargo, mdbook, typst, uv, julia, python3, jq, gh, claude)
26+
- `.claude/skills/*/SKILL.md` — CLI references (gh, git, make, cargo, claude, pred)
27+
- `.github/workflows/*.yml` — installed tools, rustup components, and actions
28+
- `scripts/pyproject.toml` — Python tooling (uv)
29+
- `scripts/jl/Project.toml` — Julia dependency
30+
- `Cargo.toml` / `problemreductions-cli/Cargo.toml` — feature flags and build deps
31+
32+
Organize tools into three tiers in `dependencies.md`:
33+
- **Core** — needed to build, test, and generate docs
34+
- **Skill** — needed for the AI-assisted pipeline (gh, claude, pred, copilot-review)
35+
- **Optional** — nice to have but not required (julia)
36+
37+
Each tool needs: name, check command, install command (macOS), install command (Linux), purpose.
38+
39+
## Step 2: Detect Platform
40+
41+
```bash
42+
uname -s
43+
```
44+
45+
- `Darwin` → use macOS install commands
46+
- `Linux` → use Linux install commands
47+
48+
## Step 3: Install Core Tools
49+
50+
For each tool in the **Core Tools** table of `dependencies.md`:
51+
52+
1. Run the check command
53+
2. **If found** → print `[tool] installed` and continue
54+
3. **If missing** → print the install command for the detected platform, then execute it
55+
56+
After all core tools are done, ask:
57+
> "Core tools are installed. Do you also want to set up the AI pipeline tools (gh, claude, pred, copilot-review)?"
58+
59+
- **Yes** → proceed to Step 4
60+
- **No** → skip to Step 6
61+
62+
## Step 4: Install Skill Tools
63+
64+
For each tool in the **Skill Tools** table:
65+
66+
1. Run the check command
67+
2. **If found** → print `[tool] installed` and continue
68+
3. **If missing** → print the install command, then execute it
69+
70+
Note: `pred` is built from the local workspace. Use `cargo install --path problemreductions-cli`.
71+
72+
After skill tools, ask:
73+
> "Want to install optional tools (julia)?"
74+
75+
- **Yes** → install optional tools using the same check/install pattern
76+
- **No** → continue
77+
78+
## Step 5: Auth and Configuration
79+
80+
Skip this step if the user declined skill tools in Step 3.
81+
82+
### 5a: GitHub CLI auth
83+
84+
```bash
85+
gh auth status
86+
```
87+
88+
If not authenticated, run `gh auth login`.
89+
90+
### 5b: Repo access
91+
92+
```bash
93+
gh repo view --json name
94+
```
95+
96+
If this fails, the user needs repo access. Explain how to request it.
97+
98+
### 5c: Project board access
99+
100+
```bash
101+
gh project list --owner <org-or-user>
102+
```
103+
104+
If this fails with permission errors, run:
105+
```bash
106+
gh auth refresh -s read:project,project
107+
```
108+
109+
Explain that the `project-pipeline` and `review-pipeline` skills require these OAuth scopes.
110+
111+
## Step 6: Verification
112+
113+
Run the full check:
114+
115+
```bash
116+
make check
117+
```
118+
119+
This runs `fmt-check + clippy + test`. Print a pass/fail summary for each stage.
120+
121+
### Troubleshooting Common Failures
122+
123+
| Failure | Fix |
124+
|---------|-----|
125+
| `fmt-check` fails | Run `make fmt` to auto-fix |
126+
| Linker errors in clippy/test | Missing C/C++ toolchain for `ilp-highs` feature. Install Xcode CLT (`xcode-select --install` on macOS) or `build-essential` (`sudo apt install build-essential` on Linux) |
127+
| "HiGHS not found" or cmake errors | Install cmake: `brew install cmake` (macOS) or `sudo apt install cmake` (Linux) |
128+
| `cargo llvm-cov` fails with "missing llvm-profdata" | `rustup component add llvm-tools-preview` |
129+
130+
If `make check` passes, print:
131+
> "Setup complete! All tools installed and verified. You're ready to contribute."
132+
133+
If it fails, walk through the troubleshooting table and offer to run the fix commands.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Development Dependencies
2+
3+
Auto-generated tool checklist for problemreductions maintainers.
4+
Rescan by running `/dev-setup` and choosing "rescan".
5+
6+
## Core Tools (build, test, docs)
7+
8+
| Tool | Check Command | Install (macOS) | Install (Linux) | Purpose |
9+
|------|--------------|-----------------|-----------------|---------|
10+
| git | `git --version` | preinstalled | `sudo apt install git` | Version control |
11+
| rust | `rustc --version` | `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \| sh` | same | Compiler and toolchain |
12+
| clippy | `cargo clippy --version` | `rustup component add clippy` | same | Linting |
13+
| rustfmt | `rustfmt --version` | `rustup component add rustfmt` | same | Code formatting |
14+
| llvm-tools-preview | `rustup component list --installed \| grep llvm-tools` | `rustup component add llvm-tools-preview` | same | Required by cargo-llvm-cov |
15+
| make | `make --version` | preinstalled | `sudo apt install make` | Build orchestration |
16+
| python3 | `python3 --version` | `brew install python` | `sudo apt install python3` | Scripts and data generation |
17+
| uv | `uv --version` | `curl -LsSf https://astral.sh/uv/install.sh \| sh` | same | Python package manager |
18+
| jq | `jq --version` | `brew install jq` | `sudo apt install jq` | JSON processing (cli-demo, compare) |
19+
| mdbook | `mdbook --version` | `cargo install mdbook` | same | Documentation site |
20+
| typst | `typst --version` | `brew install typst` | `cargo install typst-cli` | Paper and diagrams |
21+
| cargo-llvm-cov | `cargo llvm-cov --version` | `cargo install cargo-llvm-cov` | same | Coverage reports |
22+
23+
## Skill Tools (AI-assisted pipeline)
24+
25+
| Tool | Check Command | Install (macOS) | Install (Linux) | Purpose |
26+
|------|--------------|-----------------|-----------------|---------|
27+
| gh | `gh --version` | `brew install gh` | `sudo apt install gh` | GitHub CLI |
28+
| gh-copilot-review | `gh copilot-review --help` | `gh extension install ChrisCarini/gh-copilot-review` | same | Copilot PR reviews |
29+
| claude | `claude --version` | `npm install -g @anthropic-ai/claude-code` | same | AI-assisted pipeline |
30+
| pred | `pred --version` | `cargo install --path problemreductions-cli` | same | Project CLI (check-issue, check-rule-redundancy) |
31+
32+
## Optional Tools
33+
34+
| Tool | Check Command | Install (macOS) | Install (Linux) | Purpose |
35+
|------|--------------|-----------------|-----------------|---------|
36+
| julia | `julia --version` | `brew install julia` | `sudo apt install julia` | Julia parity tests |

.claude/skills/project-pipeline/SKILL.md

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Pick a "Ready" issue from the [GitHub Project board](https://github.com/orgs/Cod
99

1010
## Invocation
1111

12-
- `/project-pipeline` -- pick the next Ready issue (first Model, then Rule, by issue number)
12+
- `/project-pipeline` -- pick the highest-ranked Ready issue (ranked by importance, relatedness, pending rules)
1313
- `/project-pipeline 97` -- process a specific issue number from the Ready column
14-
- `/project-pipeline --all` -- batch-process all Ready issues (Models first, then Rules)
14+
- `/project-pipeline --all` -- batch-process all Ready issues in ranked order
1515

1616
## Constants
1717

@@ -33,33 +33,70 @@ This skill runs **fully autonomously** — no confirmation prompts, no user ques
3333

3434
## Steps
3535

36-
### 0. Discover Ready Issues
36+
### 0. Discover and Rank Ready Issues
37+
38+
#### 0a. Fetch Ready Issues
3739

3840
```bash
3941
gh project item-list 8 --owner CodingThrust --format json
4042
```
4143

42-
Filter items where `status == "Ready"`. Partition into `[Model]` and `[Rule]` buckets, sort each by issue number ascending. Final order: **all Models first, then all Rules** (so dependencies are satisfied).
44+
Filter items where `status == "Ready"`. Partition into `[Model]` and `[Rule]` buckets.
45+
46+
#### 0b. Gather Context for Ranking
47+
48+
1. **Existing problems:** Call `list_problems` (MCP tool) to get all problems currently in the reduction graph.
49+
2. **Pending rules:** From the full project board JSON, collect all `[Rule]` issues that are in "Ready" or "In Progress" status. Parse their source/target problem names (e.g., `[Rule] BinPacking to ILP` → source=BinPacking, target=ILP).
50+
51+
#### 0c. Score Each Issue
52+
53+
Score each Ready issue on three criteria. For `[Model]` issues, extract the problem name. For `[Rule]` issues, extract both source and target problem names.
54+
55+
| Criterion | Weight | How to Assess |
56+
|-----------|--------|---------------|
57+
| **C1: Industrial/Theoretical Importance** | 3 | Read the issue body. Score 0-2: **2** = widely used in industry or foundational in complexity theory (e.g., ILP, SAT, MaxFlow, TSP, GraphColoring); **1** = moderately important or well-studied (e.g., SubsetSum, SetCover, Knapsack); **0** = niche or primarily academic |
58+
| **C2: Related to Existing Problems** | 2 | Check if the problem connects to problems already in the reduction graph (via `list_problems`). Score 0-2: **2** = directly related (shares input structure or has known reductions to/from ≥2 existing problems, but is NOT a trivial variant of an existing one); **1** = loosely related (same domain, connects to 1 existing problem); **0** = isolated or is essentially a variant/renaming of an existing problem |
59+
| **C3: Unblocks Pending Rules** | 2 | Check if this issue is a dependency for pending `[Rule]` issues. Score 0-2: **2** = unblocks ≥2 pending rules (a `[Model]` issue whose problem appears as source or target in ≥2 pending rules); **1** = unblocks 1 pending rule; **0** = does not unblock any pending rule |
60+
61+
**Final score** = C1 × 3 + C2 × 2 + C3 × 2 (max = 12)
4362

44-
Print the list for visibility (no confirmation needed):
63+
**Tie-breaking:** Models before Rules, then by lower issue number.
64+
65+
**Important for C2:** A problem that is merely a weighted/unweighted variant or a graph-subtype specialization of an existing problem scores **0** on C2, not 2. The goal is to add genuinely new problem types that expand the graph's reach.
66+
67+
#### 0d. Apply Hard Constraints
68+
69+
**Rule issues require both source and target models to exist.** For each `[Rule]` issue, check that both its source and target problem names appear in the `list_problems` output (existing models) OR in a `[Model]` issue in the current Ready/In Progress columns.
70+
71+
- If both models exist → eligible
72+
- If a missing model has a `[Model]` issue in Ready → eligible only in `--all` mode (the Model will be processed first); in single-issue mode, **skip this Rule** and mark it `[blocked]`
73+
- If a missing model has no `[Model]` issue at all → **ineligible**, mark it `[blocked]` with reason
74+
75+
#### 0e. Print Ranked List
76+
77+
Print all Ready issues with their scores for visibility (no confirmation needed). Blocked rules appear at the bottom with their reason:
4578

4679
```
47-
Ready issues:
48-
Models:
49-
#129 [Model] MultivariateQuadratic
50-
#117 [Model] GraphPartitioning
51-
Rules:
52-
#97 [Rule] BinPacking to ILP
53-
#110 [Rule] LCS to ILP
54-
#126 [Rule] KSatisfiability to SubsetSum
55-
#130 [Rule] MultivariateQuadratic to ILP
80+
Ready issues (ranked):
81+
Score Issue Title C1 C2 C3
82+
─────────────────────────────────────────────────────────────
83+
10 #117 [Model] GraphPartitioning 2 2 2
84+
8 #129 [Model] MultivariateQuadratic 2 1 1
85+
7 #97 [Rule] BinPacking to ILP 1 2 1
86+
6 #110 [Rule] LCS to ILP 1 1 1
87+
4 #126 [Rule] KSatisfiability to SubsetSum 0 2 0
88+
89+
Blocked:
90+
3 #130 [Rule] MultivariateQuadratic to ILP -- model "MultivariateQuadratic" not yet implemented
5691
```
5792

58-
**If a specific issue number was provided:** verify it is in the Ready column. If not, STOP with a message.
93+
#### 0f. Pick Issues
94+
95+
**If a specific issue number was provided:** verify it is in the Ready column. If it is blocked, STOP with a message explaining which model is missing.
5996

60-
**If `--all`:** proceed immediately with all Ready issues in order (no confirmation).
97+
**If `--all`:** proceed with all eligible issues in ranked order (highest score first). **Dependency ordering override:** if a `[Model]` issue and a `[Rule]` that depends on it are both eligible, the Model MUST be processed before that Rule regardless of score. Blocked rules are skipped.
6198

62-
**Otherwise (no args):** pick the first issue in the ordered list (Models before Rules, lowest number first) and proceed immediately (no confirmation).
99+
**Otherwise (no args):** pick the highest-scored eligible (non-blocked) issue and proceed immediately (no confirmation).
63100

64101
### 1. Create Worktree
65102

@@ -167,9 +204,11 @@ Completed: 2/4 | In Review: 3 | Returned to Ready: 1
167204
| Mistake | Fix |
168205
|---------|-----|
169206
| Issue not in Ready column | Verify status before processing; STOP if not Ready |
207+
| Picking a Rule whose model doesn't exist | Hard constraint: both source and target models must exist in codebase or be in a Ready Model issue (for `--all` mode) |
170208
| Missing project scopes | Run `gh auth refresh -s read:project,project` |
171209
| Forgetting to move back to Ready on total failure | Only move to In Review if a PR exists |
172-
| Processing Rules before Models | Always sort Models first — Rules may depend on them |
210+
| Processing Rules before their Model dependencies | In `--all` mode, ensure Models that unblock pending rules come before those rules regardless of score |
211+
| Scoring a variant as "related" | Weighted/unweighted variants or graph-subtype specializations of existing problems score 0 on C2 |
173212
| Not syncing main between batch issues | Each issue gets a fresh worktree from `origin/main` |
174213
| Worktree left behind on failure | Always clean up with `git worktree remove` in Step 5 |
175214
| Working in main checkout | All work happens in `.worktrees/` — never modify the main checkout |

.claude/skills/review-pipeline/SKILL.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,32 @@ gh project item-list 8 --owner CodingThrust --format json
3939

4040
Filter items where `status == "review-agentic"`. Each item should have an associated PR. Extract the PR number from the item title or linked issue.
4141

42-
Print the list for visibility:
42+
#### 0a. Check Copilot Review Status
43+
44+
For each candidate PR, check whether Copilot has already submitted a review:
45+
46+
```bash
47+
REPO=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
48+
gh api repos/$REPO/pulls/$PR/reviews --jq '[.[] | select(.user.login == "copilot-pull-request-reviewer[bot]")] | length'
49+
```
50+
51+
A PR is **eligible** only if the count is ≥ 1 (Copilot has submitted at least one review). PRs without a Copilot review yet are marked `[waiting for Copilot]` and skipped.
52+
53+
#### 0b. Print the List
54+
55+
Print all review-agentic items with their Copilot status:
4356

4457
```
4558
review-agentic PRs:
46-
#570 Fix #117: [Model] GraphPartitioning
47-
#571 Fix #97: [Rule] BinPacking to ILP
59+
#570 Fix #117: [Model] GraphPartitioning [copilot reviewed]
60+
#571 Fix #97: [Rule] BinPacking to ILP [waiting for Copilot]
4861
```
4962

50-
**If a specific PR number was provided:** verify it is in the review-agentic column. If not, STOP with a message.
63+
**If a specific PR number was provided:** verify it is in the review-agentic column. If it is waiting for Copilot, STOP with a message: `PR #N is waiting for Copilot review. Re-run after Copilot has reviewed.`
5164

52-
**If `--all`:** process all items in order (lowest PR number first).
65+
**If `--all`:** process only eligible (Copilot-reviewed) items in order (lowest PR number first). Skip waiting items.
5366

54-
**Otherwise:** pick the first item.
67+
**Otherwise:** pick the first eligible item. If no items are eligible, STOP with: `No review-agentic PRs have been reviewed by Copilot yet.`
5568

5669
### 1. Create Worktree and Checkout PR Branch
5770

@@ -71,7 +84,7 @@ All subsequent steps run inside the worktree.
7184

7285
### 2. Fix Copilot Review Comments
7386

74-
Check for existing Copilot review comments (no waiting — Copilot review was already requested by `issue-to-pr`):
87+
Copilot review is guaranteed to exist (verified in Step 0). Fetch the comments:
7588

7689
```bash
7790
COMMENTS=$(gh api repos/$REPO/pulls/$PR/comments --jq '[.[] | select(.user.login == "copilot-pull-request-reviewer[bot]")]')
@@ -83,7 +96,7 @@ If there are actionable comments: invoke `/fix-pr` to address them, then push:
8396
git push
8497
```
8598

86-
If no comments (or Copilot hasn't reviewed yet): skip to next step.
99+
If Copilot approved with no actionable comments: skip to next step.
87100

88101
### 3. Agentic Feature Test
89102

@@ -191,6 +204,7 @@ Completed: 2/2 | All moved to In Review
191204
| Mistake | Fix |
192205
|---------|-----|
193206
| PR not in review-agentic column | Verify status before processing; STOP if not review-agentic |
207+
| Picking a PR before Copilot has reviewed | Check `pulls/$PR/reviews` for copilot-pull-request-reviewer[bot]; skip if absent |
194208
| Missing project scopes | Run `gh auth refresh -s read:project,project` |
195209
| Skipping agentic tests | Always run test-feature even if CI is green |
196210
| Not checking out the right branch | Use `gh pr view` to get the exact branch name |

0 commit comments

Comments
 (0)