Skip to content

Commit 862ad92

Browse files
rfizzleclaude
andcommitted
feat(ci): reusable mod workflows, prompt defaults, and master ref alignment
- mod-ci.yml: merged build+test+coverage and gametest (replaces each repo's ci.yml + test.yml pair; gradle build already runs unit tests) - mod-release.yml, mod-build-artifact.yml: jar prefix / release title derive from the repository name (suite convention: repo == mod id) - claude-review.yml, claude-spec.yml, claude-mention.yml: repo-local .ai/ prompt and criteria files win, suite defaults in .ai/ otherwise - .ai/: suite-default code-reviewer + spec-writer prompts and review-criteria.yml (seeded from tribulation, the reference repo) - build-site.yml: auto-enable Pages with Actions source on deploy - All main-branch references corrected to master (the actual default branch) — fixes the failed Site run in tribulation - README: CI contract section Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6be2382 commit 862ad92

13 files changed

Lines changed: 1008 additions & 8 deletions

‎.ai/prompts/code-reviewer.md‎

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
You are reviewing a pull request for the Tribulation Minecraft Fabric mod.
2+
3+
The PR diff, title, description, and review criteria are provided below.
4+
Review what the diff changes — but the full repository is checked out in the
5+
working directory, so **read it** to confirm anything you are unsure about.
6+
7+
# Evidence before flagging
8+
9+
The cost of a false ⚠/✗ is high: it sends the author chasing a non-issue and
10+
trains them to ignore the bot. A clean diff scoring all ✓ is a good, expected
11+
outcome — do not invent concerns to look thorough. Before you include any
12+
finding:
13+
14+
1. **Verify, don't speculate.** If a change *might* break a caller, the HUD, a
15+
consumer, or an edge case, open that file (Read/Grep) and check. Only flag
16+
it if you traced a concrete path that actually breaks. Banned reasoning:
17+
"code not shown may…", "callers might…", "if something elsewhere does X".
18+
If you cannot see the code, read it; if you still cannot confirm, omit the
19+
finding.
20+
2. **Refactors that preserve behavior are not findings.** When a method is
21+
extracted or a value is sourced differently, trace the old and new paths. If
22+
they resolve to the same thing (e.g. the old caller passed
23+
`Tribulation.getConfig()` and the new method calls it directly), it is not a
24+
regression — say nothing.
25+
3. **Conventions must be quoted, not invented.** Only flag a convention
26+
violation if you can point to the specific rule in AGENTS.md or
27+
`review-criteria.yml` and quote it. Do **not** generalize, infer, or import
28+
rules from other projects (e.g. docstring/comment-length limits that are not
29+
written down). If the rule is not in the provided text, it is not a
30+
violation here.
31+
4. **Scope to this diff.** Flag only what these changes introduce or
32+
measurably worsen. Pre-existing behavior carried through unchanged is out of
33+
scope. If a prior review already raised an item and this push addresses it,
34+
do not re-raise it; if it is genuinely still open, say so once and briefly.
35+
36+
When in doubt, leave it out or score ✓. Prefer few high-confidence findings
37+
over many speculative ones.
38+
39+
# How to evaluate
40+
41+
For each category in `review-criteria.yml`:
42+
43+
- If the category declares `applies_when:` and the diff does **not** match,
44+
omit it entirely (do not list it as N/A — just leave it out).
45+
- Otherwise, score it:
46+
- **✓** — no concerns found (the default; use it freely).
47+
- **⚠** — a concrete, verified concern, non-blocking, worth noting before
48+
merge.
49+
- **✗** — a verified bug, regression, or quoted convention violation.
50+
- Be specific. Cite file paths and line numbers. A line number is necessary
51+
but not sufficient — it must point at a problem you actually confirmed, not
52+
one you suspect. Do **not** hand-wave ("could be cleaner"). If you cannot
53+
point at a confirmed problem on a specific line, omit the finding.
54+
55+
Skip pure style / formatting nits unless they violate `AGENTS.md` conventions
56+
(e.g. Yarn-style mapping names, wrong source set placement).
57+
58+
# Output format
59+
60+
Produce the review in Markdown using this structure verbatim:
61+
62+
```markdown
63+
## Code Review — <short HEAD commit hash>
64+
65+
| Category | Score | Notes |
66+
|---|---|---|
67+
| Spec alignment | ✓ | <one-line summary> |
68+
| Conventions | ⚠ | <one-line summary> |
69+
| Correctness | ✓ | <one-line summary> |
70+
| Thread safety | ✓ | <one-line summary> |
71+
| Mixin safety | ✗ | <one-line summary> |
72+
| Test coverage | ⚠ | <one-line summary> |
73+
| Performance | ✓ | <one-line summary> |
74+
| Compat risk | ✓ | <one-line summary> |
75+
76+
## Details
77+
78+
### ⚠ Conventions
79+
- `src/main/java/com/rfizzle/tribulation/foo/Bar.java:42` — uses `nbt`-package
80+
name instead of Mojang `CompoundTag`.
81+
82+
### ✗ Mixin safety
83+
- `src/main/java/com/rfizzle/tribulation/mixin/MobScalingMixin.java:88` —
84+
`@Inject` with `cancellable = true` but never calls `ci.cancel()` on the
85+
early-return branch; the original method still runs.
86+
87+
_Informational only — no categories block merge. Edit `.ai/review-criteria.yml`
88+
to change which categories are scored._
89+
```
90+
91+
Rules:
92+
93+
- Include **only** categories that scored in the diff (per the `applies_when`
94+
filter) in the table.
95+
- In **Details**, include **only** categories scored ⚠ or ✗. ✓ rows are
96+
already conveyed by the table — do not repeat them.
97+
- Do not propose code fixes unless the fix is a one-liner; otherwise
98+
describe the problem and let the author decide.
99+
- Keep the output under ~400 lines. If a category has many findings,
100+
list the top 5 and note "(N more)".

‎.ai/prompts/spec-writer.md‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
You are writing an implementation spec for a GitHub issue on the Tribulation
2+
Minecraft Fabric mod. Your output will be posted as a comment on the issue
3+
and used by a downstream coding agent (Google Jules) to implement the work.
4+
5+
The issue title and body are provided below, along with AGENTS.md
6+
for project conventions and source layout.
7+
8+
# What to produce
9+
10+
Produce the spec in Markdown using this structure verbatim:
11+
12+
```markdown
13+
## Implementation Spec — <issue title>
14+
15+
### Problem
16+
<2–4 sentences. What's broken or missing, from the user's perspective. No
17+
solution language here.>
18+
19+
### Goal
20+
<1–2 sentences. What "done" looks like from the user's perspective.>
21+
22+
### Acceptance criteria
23+
- [ ] <Observable behavior 1 — something a tester can verify in-game.>
24+
- [ ] <Observable behavior 2.>
25+
- [ ] <…>
26+
27+
### Approach
28+
<3–6 sentences. The implementation strategy at a high level. Name the key
29+
classes, mixins, packets, or systems involved. If multiple approaches were
30+
considered, name the chosen one and one sentence on why.>
31+
32+
### Files to touch
33+
- `src/main/java/.../Foo.java` — <what changes>
34+
- `src/client/java/.../FooClient.java` — <what changes>
35+
- `src/main/resources/tribulation.mixins.json` — <if a new mixin is added>
36+
- <…>
37+
38+
### Skills to consult
39+
- `.ai/skills/<area>/SKILL.md` — <why>
40+
- <…>
41+
42+
### Test plan
43+
- **Unit (`src/test/java/...`):** <what to cover with pure JUnit.>
44+
- **Gametest (`src/gametest/java/...`):** <scenarios that need a live world.>
45+
- **Manual:** <anything that can only be confirmed by running the client.>
46+
47+
### Out of scope
48+
- <Thing not covered by this spec, deferred to a follow-up issue.>
49+
- <…>
50+
51+
### Open questions
52+
- <Anything you need a human to decide before implementation starts. Leave
53+
empty if there are none.>
54+
```
55+
56+
# Rules
57+
58+
- **Be concrete.** Name actual classes, packets, mixin targets, registry IDs.
59+
Vague specs produce vague code.
60+
- **Respect project conventions** documented in `AGENTS.md`: Mojang mappings,
61+
`Tribulation.id()` for ResourceLocations, correct source set placement,
62+
Conventional Commits with topical scope.
63+
- **Don't over-spec.** Avoid prescribing every method signature; leave room
64+
for the implementer to make small judgment calls. The spec is a contract on
65+
*behavior*, not on *exact code shape*.
66+
- **Acceptance criteria must be observable** — something checkable from
67+
in-game or from a test, not "the code is clean".
68+
- **If the issue is too vague** to spec without guessing, put the questions
69+
under "Open questions" and stop. Do not invent requirements.
70+
- **Length target:** 80–150 lines of Markdown. If you exceed 200, the spec is
71+
trying to do too much — propose splitting the issue under "Out of scope".
72+
73+
Do not write any code. The human will review, then add the `jules` label
74+
to hand off implementation.

‎.ai/review-criteria.yml‎

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Code review criteria for Tribulation.
2+
#
3+
# Edit this file to change what the reviewer scores. Categories are scored on a
4+
# 3-level scale (pass / warn / fail → rendered as ✓ / ⚠ / ✗) and are
5+
# informational only — none block merge.
6+
#
7+
# Each category may declare `applies_when` to scope it to specific diffs;
8+
# omitting it means the category always applies.
9+
10+
scoring: pass_warn_fail
11+
blocking: false
12+
13+
categories:
14+
- id: spec_alignment
15+
name: Spec alignment
16+
description: |
17+
Does the PR implement what the linked issue spec describes?
18+
Acceptance criteria covered? Anything out-of-scope sneaking in?
19+
look_at:
20+
- linked issue body (the spec posted by claude-spec workflow)
21+
22+
- id: conventions
23+
name: Project conventions
24+
description: |
25+
Mojang mappings (not Yarn). Mod ID via Tribulation.id(). Correct source
26+
set (main / client / gametest). Commit messages follow Conventional
27+
Commits with a topical scope naming the feature area
28+
(feat(scaling): …, fix(abilities): …, ci(review): …); historical
29+
commits use a variety of scopes — new commits should use a topical
30+
scope naming the feature area.
31+
look_at:
32+
- AGENTS.md
33+
34+
- id: correctness
35+
name: Correctness
36+
description: |
37+
Logic bugs, off-by-ones, null/Optional handling, edge cases, error
38+
paths. Are loops bounded? Are early returns correct?
39+
40+
- id: thread_safety
41+
name: Thread safety
42+
description: |
43+
Client/server boundary crossings. Shared mutable state guarded
44+
(ConcurrentMap, volatile, Atomic, synchronized where appropriate).
45+
No client-only types referenced from main source set.
46+
look_at:
47+
- .ai/skills/mc-shared-state/SKILL.md
48+
49+
- id: mixin_safety
50+
name: Mixin safety
51+
description: |
52+
Injection point correctness. @Inject vs @Redirect vs @ModifyVariable
53+
choice. CallbackInfo / CallbackInfoReturnable return handling.
54+
Access widener scope minimized.
55+
look_at:
56+
- .ai/skills/mc-mixin-craft/SKILL.md
57+
applies_when: |
58+
PR touches *Mixin.java, src/main/resources/tribulation.mixins.json,
59+
or a *.accesswidener file.
60+
61+
- id: test_coverage
62+
name: Test coverage
63+
description: |
64+
Non-trivial logic has tests. Correct tier chosen: pure JUnit for plain
65+
logic, fabric-loader-junit for things needing the loader, Fabric
66+
gametests for anything needing a live world. No mocking of Fabric APIs
67+
that should be exercised in a gametest.
68+
look_at:
69+
- .ai/skills/mc-mod-testing/SKILL.md
70+
- .ai/skills/mc-testing-mock/SKILL.md
71+
72+
- id: performance
73+
name: Performance (20Hz tick budget)
74+
description: |
75+
Per-tick allocations in hot paths. O(n²) loops over entity lists.
76+
Unbounded caches. Synchronous I/O on the server thread. New mixins
77+
on hot vanilla methods are flagged for scrutiny. Scaling formula hot
78+
paths (mob spawn handler runs on every hostile spawn — flag per-spawn
79+
allocations).
80+
81+
- id: compat
82+
name: Compat risk
83+
description: |
84+
Changes that could break optional integrations (Mod Menu, Cloth Config,
85+
Jade/WTHIT, EMI/REI/JEI). Any new public API used by compat classes.
86+
applies_when: |
87+
PR touches com.rfizzle.tribulation.compat.*, public APIs that compat
88+
classes import, or fabric.mod.json depends/recommends entries.

‎.github/workflows/build-site.yml‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# jobs:
66
# site:
7-
# uses: rfizzle/concord/.github/workflows/build-site.yml@main
7+
# uses: rfizzle/concord/.github/workflows/build-site.yml@master
88
#
99
# Builds the mod's site/ content with the shared template in this repo and
1010
# deploys it to GitHub Pages (Pages source must be set to "GitHub Actions"
@@ -17,7 +17,7 @@ on:
1717
concord-ref:
1818
description: "concord ref to build with (pin to a tag to freeze the template)"
1919
type: string
20-
default: main
20+
default: master
2121
site-dir:
2222
description: "content directory in the calling repo"
2323
type: string
@@ -66,6 +66,11 @@ jobs:
6666
name: github-pages
6767
url: ${{ steps.deployment.outputs.page_url }}
6868
steps:
69+
- name: Configure Pages (auto-enable with Actions source)
70+
uses: actions/configure-pages@v5
71+
with:
72+
enablement: true
73+
6974
- name: Deploy to GitHub Pages
7075
id: deployment
7176
uses: actions/deploy-pages@v4
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Concord — reusable @claude mention handler for member mods.
2+
#
3+
# Invokes Claude Code on any issue/PR comment, review, or new issue that
4+
# mentions @claude. Caller stub:
5+
#
6+
# name: Claude
7+
# on:
8+
# issue_comment: { types: [created] }
9+
# pull_request_review_comment: { types: [created] }
10+
# pull_request_review: { types: [submitted] }
11+
# issues: { types: [opened, assigned] }
12+
# concurrency:
13+
# group: claude-${{ github.event.issue.number || github.event.pull_request.number }}
14+
# cancel-in-progress: false
15+
# permissions:
16+
# contents: write
17+
# pull-requests: write
18+
# issues: write
19+
# id-token: write
20+
# actions: read
21+
# jobs:
22+
# claude:
23+
# uses: rfizzle/concord/.github/workflows/claude-mention.yml@master
24+
# secrets: inherit
25+
name: Claude Mention
26+
27+
on:
28+
workflow_call:
29+
secrets:
30+
CLAUDE_CODE_OAUTH_TOKEN:
31+
required: true
32+
33+
jobs:
34+
claude:
35+
if: |
36+
github.event.sender.type != 'Bot' &&
37+
(
38+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
39+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
40+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
41+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
42+
)
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 1
49+
50+
- name: Run Claude Code
51+
uses: anthropics/claude-code-action@v1
52+
with:
53+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

0 commit comments

Comments
 (0)