@openora/create 0.4.1-canary.45 → 0.4.1-canary.451
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/README.md +5 -5
- package/dist/.tsbuildinfo +1 -1
- package/dist/generated/versions.d.ts +11 -0
- package/dist/generated/versions.d.ts.map +1 -0
- package/dist/generated/versions.js +11 -0
- package/dist/generated/versions.js.map +1 -0
- package/dist/index.js +50 -96
- package/dist/index.js.map +1 -1
- package/dist/render.d.ts +12 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +125 -0
- package/dist/render.js.map +1 -0
- package/package.json +8 -6
- package/template/Caddyfile +13 -0
- package/template/Dockerfile +11 -0
- package/template/README.md.tpl +45 -10
- package/template/__dot__claude/settings.json.tpl +39 -12
- package/template/__dot__dockerignore +8 -0
- package/template/__dot__env.example +51 -2
- package/template/__dot__gitignore +5 -5
- package/template/__dot__rulesync/commands/check.md +11 -10
- package/template/__dot__rulesync/commands/doctor.md.tpl +17 -0
- package/template/__dot__rulesync/commands/scaffold-module.md +3 -2
- package/template/__dot__rulesync/commands/scaffold-plugin.md +23 -4
- package/template/__dot__rulesync/commands/scaffold-route.md +1 -0
- package/template/__dot__rulesync/commands/start.md +3 -3
- package/template/__dot__rulesync/hooks/_shared.mjs +25 -34
- package/template/__dot__rulesync/hooks/guard-comments.mjs +82 -0
- package/template/__dot__rulesync/hooks/guard-core.mjs.tpl +98 -28
- package/template/__dot__rulesync/hooks/guard-generated.mjs +15 -16
- package/template/__dot__rulesync/hooks/guard-mr.mjs +205 -0
- package/template/__dot__rulesync/hooks/guard-review.mjs +294 -0
- package/template/__dot__rulesync/hooks/guard-stack.mjs +35 -0
- package/template/__dot__rulesync/hooks/guard-subagent.mjs +22 -6
- package/template/__dot__rulesync/hooks/post-edit.mjs.tpl +116 -0
- package/template/__dot__rulesync/hooks.json +42 -4
- package/template/__dot__rulesync/rules/conventions.md +100 -119
- package/template/__dot__rulesync/rules/db-conventions.md +6 -72
- package/template/__dot__rulesync/rules/e2e-conventions.md +41 -7
- package/template/__dot__rulesync/rules/frontend-conventions.md.tpl +35 -0
- package/template/__dot__rulesync/rules/oss-boundaries.md.tpl +78 -0
- package/template/__dot__rulesync/rules/overview.md +20 -82
- package/template/__dot__rulesync/skills/agent-retro/SKILL.md.tpl +81 -0
- package/template/__dot__rulesync/skills/agent-retro/scan.mjs +420 -0
- package/template/__dot__rulesync/skills/babysit/SKILL.md.tpl +48 -0
- package/template/__dot__rulesync/skills/babysit/babysit.mjs +290 -0
- package/template/__dot__rulesync/skills/create-plugin/{SKILL.md → SKILL.md.tpl} +12 -23
- package/template/__dot__rulesync/skills/create-pr/SKILL.md.tpl +39 -0
- package/template/__dot__rulesync/skills/create-task/SKILL.md.tpl +96 -0
- package/template/__dot__rulesync/skills/create-ui-module/{SKILL.md → SKILL.md.tpl} +12 -10
- package/template/__dot__rulesync/skills/enhance-prompt/{SKILL.md → SKILL.md.tpl} +4 -4
- package/template/__dot__rulesync/skills/handoff/SKILL.md +4 -3
- package/template/__dot__rulesync/skills/review/SKILL.md.tpl +276 -0
- package/template/__dot__rulesync/skills/ship/SKILL.md.tpl +157 -0
- package/template/__dot__rulesync/skills/ship/handoff.md.tpl +48 -0
- package/template/__dot__rulesync/skills/ui-verify/SKILL.md.tpl +123 -0
- package/template/__dot__rulesync/skills/ui-verify/layout-check.check.sh +58 -0
- package/template/__dot__rulesync/skills/ui-verify/layout-check.js +163 -0
- package/template/__dot__rulesync/subagents/builder.md.tpl +116 -0
- package/template/__dot__rulesync/subagents/compliance-reviewer.md +78 -0
- package/template/__dot__rulesync/subagents/debugger.md.tpl +89 -0
- package/template/__dot__rulesync/subagents/deployer.md.tpl +54 -0
- package/template/__dot__rulesync/subagents/expert.md +29 -34
- package/template/__dot__rulesync/subagents/planner.md.tpl +47 -0
- package/template/__dot__rulesync/subagents/quality-reviewer.md.tpl +113 -0
- package/template/__dot__rulesync/subagents/security-reviewer.md.tpl +85 -0
- package/template/__dot__rulesync/subagents/tester.md.tpl +103 -0
- package/template/__dot__rulesync/sync.json.tpl +26 -0
- package/template/apps/api/package.json.tpl +2 -2
- package/template/apps/api/src/extensions.config.ts.tpl +17 -2
- package/template/apps/api/src/main.ts.tpl +5 -4
- package/template/apps/api/src/seed.ts.tpl +24 -18
- package/template/compose.prod.yml +109 -0
- package/template/docker-compose.yml +15 -3
- package/template/docs/agents/cross-repo.md.tpl +36 -0
- package/template/docs/agents/forge.md.tpl +56 -0
- package/template/docs/agents/issue-tracker.md.tpl +42 -0
- package/template/docs/standards/comments.md +16 -0
- package/template/docs/standards/database.md +77 -0
- package/template/docs/standards/enforcement.md +12 -0
- package/template/docs/standards/errors.md +30 -0
- package/template/docs/standards/frontend.md +60 -0
- package/template/docs/standards/functions.md +38 -0
- package/template/docs/standards/git-delivery.md +31 -0
- package/template/docs/standards/module-structure.md +37 -0
- package/template/docs/standards/testing.md +93 -0
- package/template/docs/standards/types.md +31 -0
- package/template/package.json.tpl +17 -10
- package/template/pnpm-workspace.yaml.tpl +6 -0
- package/template/rulesync.jsonc +4 -5
- package/template/tools/bootstrap.mjs +73 -0
- package/template/tools/oss-worktree.mjs.tpl +105 -0
- package/template/tools/review-precheck.mjs +622 -0
- package/template/tools/sync-agents.mjs +279 -0
- package/dist/generated/core-version.d.ts +0 -2
- package/dist/generated/core-version.d.ts.map +0 -1
- package/dist/generated/core-version.js +0 -2
- package/dist/generated/core-version.js.map +0 -1
- package/template/__dot__rulesync/commands/doctor.md +0 -16
- package/template/__dot__rulesync/hooks/post-edit.mjs +0 -57
- package/template/__dot__rulesync/rules/oss-boundaries.md +0 -31
- package/template/__dot__rulesync/skills/add-feature/SKILL.md +0 -113
- package/template/__dot__rulesync/skills/add-feature/handoff.md +0 -58
- package/template/__dot__rulesync/skills/create-pr/SKILL.md +0 -55
- package/template/__dot__rulesync/skills/create-task/SKILL.md +0 -77
- package/template/__dot__rulesync/skills/review/SKILL.md +0 -110
- package/template/__dot__rulesync/subagents/builder.md +0 -93
- package/template/__dot__rulesync/subagents/debugger.md +0 -82
- package/template/__dot__rulesync/subagents/deployer.md +0 -66
- package/template/__dot__rulesync/subagents/qa.md +0 -88
- package/template/__dot__rulesync/subagents/quality-reviewer.md +0 -67
- package/template/__dot__rulesync/subagents/security-reviewer.md +0 -54
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-verify
|
|
3
|
+
targets: ['*']
|
|
4
|
+
description: >
|
|
5
|
+
Verify a UI change in a real browser with the global `playwright-cli`: cheap checks first,
|
|
6
|
+
then four screenshots per changed screen read for spacing, overlap, cut text and contrast,
|
|
7
|
+
then one clip per acceptance criterion for the PR. Use after any change to a page, component, style or
|
|
8
|
+
player/operator flow, on "check it looks right", "verify the UI", "does it render", "take a
|
|
9
|
+
screenshot", "record a video", and to reproduce a UI bug before fixing it.
|
|
10
|
+
claudecode:
|
|
11
|
+
context: fork
|
|
12
|
+
model: sonnet
|
|
13
|
+
effort: medium
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# ui-verify ({{name}})
|
|
17
|
+
|
|
18
|
+
Global `playwright-cli` (`npm i -g @playwright/cli` if missing), never a browser MCP: it costs a
|
|
19
|
+
fraction of the tokens. Do not spawn subagents. Return text only. A subagent (`tester`, `builder`) does not
|
|
20
|
+
invoke this skill, which forks one of its own: it reads this file and follows it itself.
|
|
21
|
+
|
|
22
|
+
## Stack
|
|
23
|
+
|
|
24
|
+
- Player app :3000, backoffice :3002, API :3001, unless the repo's rules name other ports (a
|
|
25
|
+
worktree slot, say). Ports held by another checkout: never kill it, ask.
|
|
26
|
+
- Accounts: the seed's (`admin@oss.dev` / `password1234` after `pnpm bootstrap`). Save a login once
|
|
27
|
+
with `state-save /tmp/ui-verify/<app>.json`, `state-load` it after.
|
|
28
|
+
- Theme: switch with the app's own toggle in a video; for a still, set what the toggle sets
|
|
29
|
+
(a cookie or `localStorage`) with `eval`, then reload.
|
|
30
|
+
|
|
31
|
+
## Cost ladder
|
|
32
|
+
|
|
33
|
+
Deterministic checks first, reading pixels last. Write each check as an assertion with an
|
|
34
|
+
expected value (`[data-testid=balance]` text matches `/\d+(\.\d+)? USDT/`) and stop at the
|
|
35
|
+
first rung that answers it.
|
|
36
|
+
|
|
37
|
+
1. **Shell.** The route serves: `curl -s -o /dev/null -w '%{http_code}' <url>`.
|
|
38
|
+
2. **Browser, one value.** `eval` for existence, text, count, computed style; `console error`
|
|
39
|
+
and `requests` grepped for `4\d\d|5\d\d`; `find "<text>"` for one node.
|
|
40
|
+
3. **Structure.** `snapshot <target>` scoped to the changed component; a full-page `snapshot`
|
|
41
|
+
only with `--depth` or `--filename` + `grep`.
|
|
42
|
+
4. **Pixels.** The screenshot review below.
|
|
43
|
+
|
|
44
|
+
Batch commands in one bash call. Output over ~50 lines goes to `/tmp/ui-verify/` and gets
|
|
45
|
+
`grep`, not read whole. One named session per run (`-s=<name>`), `close` at the end.
|
|
46
|
+
|
|
47
|
+
## Screenshot review
|
|
48
|
+
|
|
49
|
+
Screenshots are for you, videos for the reviewer: nobody reads a video back, so layout defects
|
|
50
|
+
are caught here. Every changed screen, after the checks pass and before the videos. Four shots:
|
|
51
|
+
mobile and desktop, light and dark (backoffice: desktop only).
|
|
52
|
+
|
|
53
|
+
- Sizes: never shrink a shot, halving it halves every padding you judge. Mobile 390x844 at 2x
|
|
54
|
+
device pixels (780x1688), desktop 1440x900 at 1x: both under the 2000 px per-image cap a
|
|
55
|
+
session with over 20 images gets, about 1.7k tokens each.
|
|
56
|
+
- Tall screens: one shot per viewport height (`eval "() => scrollTo(0, <y>)"`, then shoot),
|
|
57
|
+
never `--full-page`, which downscales a long page until its text is unreadable.
|
|
58
|
+
- Before reading, run `layout-check.js` in each of the four. It lists overlapping, clipped,
|
|
59
|
+
truncated and off-screen text and a page that scrolls sideways; every line it returns is a
|
|
60
|
+
check to settle on the shot. `sh .claude/skills/ui-verify/layout-check.check.sh` is its self-test.
|
|
61
|
+
- Read each shot for: spacing consistent with its neighbours, alignment, overlapping or cut text,
|
|
62
|
+
anything off-screen or out of its container, contrast in dark, and the ticket's designs. Every
|
|
63
|
+
shot gets a report line, a clean one too. A defect is a FAIL with the png path; it gets fixed
|
|
64
|
+
and shot again.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
mkdir -p /tmp/ui-verify
|
|
68
|
+
echo '{"browser":{"contextOptions":{"deviceScaleFactor":2}}}' > /tmp/ui-verify/2x.json
|
|
69
|
+
playwright-cli -s=m open <url> --config=/tmp/ui-verify/2x.json && playwright-cli -s=m resize 390 844
|
|
70
|
+
playwright-cli -s=m eval "$(cat .claude/skills/ui-verify/layout-check.js)"
|
|
71
|
+
playwright-cli -s=m screenshot --hires --filename=/tmp/ui-verify/<screen>-mobile-dark.png
|
|
72
|
+
# switch theme, reload, repeat as -light; desktop in its own session:
|
|
73
|
+
# no --config, resize 1440 900, no --hires
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Keep the four as your own layout check: they are not uploaded, unless the change is look-only,
|
|
77
|
+
where the before and after shots go side by side in the description.
|
|
78
|
+
|
|
79
|
+
## Video evidence
|
|
80
|
+
|
|
81
|
+
One clip per acceptance criterion, each the whole flow of that AC in one take, from the screen the
|
|
82
|
+
user starts on to the outcome the AC names, never a few seconds of the end state. Last, once, on the
|
|
83
|
+
final commit after the tests are green and review is clean (`ship` step 4b): a clip taken earlier is
|
|
84
|
+
thrown away by the next fix round. Record on the local stack in the AC's main viewport (mobile for a
|
|
85
|
+
player screen, desktop for an operator one), no theme switch: themes and sizes come from the four
|
|
86
|
+
shots above. A fix also gets a Before clip of the same flow, recorded on the base branch. Never read
|
|
87
|
+
a video back.
|
|
88
|
+
|
|
89
|
+
ACs a spec drives come first: every spec that drives one, new or existing, in one run with video
|
|
90
|
+
on (the repo's record switch, or `test.use({ video: 'on' })`); each lands in
|
|
91
|
+
`test-results/<test>/video.webm`; copy it to `/tmp/ui-verify/<ac>-<slug>.webm`, since the next run
|
|
92
|
+
wipes `test-results/`. Only an AC no spec drives gets `playwright-cli`. Use test accounts only,
|
|
93
|
+
never real user data. A login is never on camera: `state-load` a saved login, or type any secret,
|
|
94
|
+
before `video-start`; an AC that is the login itself is recorded with a test account and the
|
|
95
|
+
password field masked. `video-show-actions` prints every typed value on screen, so nothing secret is
|
|
96
|
+
typed after it:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
playwright-cli -s=v resize 390 844 # 1440 900 for an operator screen
|
|
100
|
+
playwright-cli -s=v state-load <saved-login>.json
|
|
101
|
+
playwright-cli -s=v video-start /tmp/ui-verify/ac1-<slug>.webm
|
|
102
|
+
playwright-cli -s=v video-show-actions
|
|
103
|
+
# drive the AC ... until its outcome is on screen
|
|
104
|
+
playwright-cli -s=v video-stop
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Upload each clip as `docs/agents/forge.md` says and embed it in its cell of the Evidence table
|
|
108
|
+
(`Flow | Before | Now | AC`, one row per AC). An AC with no visible flow still gets its row, with
|
|
109
|
+
sample request/response output in the Now cell, headers and tokens removed. A still with real user data is blurred before
|
|
110
|
+
upload; a clip cannot be blurred. After a fix to an open PR, record again only the ACs it touched
|
|
111
|
+
and replace those cells.
|
|
112
|
+
|
|
113
|
+
## Report
|
|
114
|
+
|
|
115
|
+
One line per check: `PASS|FAIL - <check> - rung <n> - expected <x>, got <y> - <artifact path>`,
|
|
116
|
+
plus the failure detail for each FAIL. A pixel claim neither a measurement nor the shot can
|
|
117
|
+
settle is `UNSURE - <check> - <what is ambiguous> - <png path>`, never a guess. Return every shot path, and one clip
|
|
118
|
+
path per AC and per Before cell.
|
|
119
|
+
|
|
120
|
+
## Bugs
|
|
121
|
+
|
|
122
|
+
Reproduce here first, as close to real use as possible, then fix, then rerun the same checks.
|
|
123
|
+
A fix without a before and after run is unverified.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Self-check for layout-check.js: the page below plants 5 defects next to 5 look-alikes that are fine.
|
|
3
|
+
set -e
|
|
4
|
+
dir=$(dirname "$0")
|
|
5
|
+
fixture=$(cat <<'HTML'
|
|
6
|
+
<!doctype html>
|
|
7
|
+
<html>
|
|
8
|
+
<body style="margin: 0; font: 16px sans-serif; width: 390px">
|
|
9
|
+
<p>
|
|
10
|
+
Clean wrapped paragraph that wraps across lines with a <a href="#">link inside</a> and more
|
|
11
|
+
text after it.
|
|
12
|
+
</p>
|
|
13
|
+
<div data-testid="overlap-card" style="position: relative; height: 40px">
|
|
14
|
+
<span>Balance</span><span style="position: absolute; left: 20px; top: 0">USDT 12.50</span>
|
|
15
|
+
</div>
|
|
16
|
+
<div data-testid="clip-box" style="height: 18px; overflow: hidden">
|
|
17
|
+
<p style="margin: 0">Line one<br />Line two cut off</p>
|
|
18
|
+
</div>
|
|
19
|
+
<div
|
|
20
|
+
data-testid="ellipsis"
|
|
21
|
+
style="width: 80px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis"
|
|
22
|
+
>
|
|
23
|
+
A very long game title
|
|
24
|
+
</div>
|
|
25
|
+
<span style="position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0)"
|
|
26
|
+
>Screen reader only</span
|
|
27
|
+
>
|
|
28
|
+
<div style="overflow: hidden; width: 200px; white-space: nowrap">
|
|
29
|
+
<div style="display: inline-block; width: 200px">Slide one</div>
|
|
30
|
+
<div style="display: inline-block; width: 200px">Slide two parked</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div data-testid="wide" style="white-space: nowrap">
|
|
33
|
+
This label is far too wide for a mobile viewport and runs out
|
|
34
|
+
</div>
|
|
35
|
+
<div style="overflow-x: auto; white-space: nowrap; width: 200px">
|
|
36
|
+
Scrollable chips row that is wider than its box on purpose
|
|
37
|
+
</div>
|
|
38
|
+
<p style="position: relative">Under the modal text</p>
|
|
39
|
+
<div style="position: fixed; top: 0; left: 0; width: 390px; height: 60px; background: #fff">
|
|
40
|
+
<p style="margin: 4px">Modal title over page text</p>
|
|
41
|
+
</div>
|
|
42
|
+
</body>
|
|
43
|
+
</html>
|
|
44
|
+
HTML
|
|
45
|
+
)
|
|
46
|
+
url="data:text/html;base64,$(printf '%s' "$fixture" | base64 | tr -d '\n')"
|
|
47
|
+
playwright-cli -s=layout-check open "$url" >/dev/null 2>&1
|
|
48
|
+
playwright-cli -s=layout-check resize 390 844 >/dev/null
|
|
49
|
+
out=$(playwright-cli -s=layout-check eval "$(cat "$dir/layout-check.js")")
|
|
50
|
+
playwright-cli -s=layout-check close >/dev/null
|
|
51
|
+
for expected in PAGE-SCROLLS-X 'CLIPPED.*clip-box' 'TRUNCATED.*ellipsis' 'OFFSCREEN.*wide' 'OVERLAP.*overlap-card.*with.*overlap-card'; do
|
|
52
|
+
echo "$out" | grep -q "$expected" || { echo "FAIL: missing $expected"; echo "$out"; exit 1; }
|
|
53
|
+
done
|
|
54
|
+
# Findings never carry page text: a real screen can show player data.
|
|
55
|
+
! echo "$out" | grep -qE 'Balance|USDT|Line two|game title|too wide' || { echo "FAIL: page text in findings"; echo "$out"; exit 1; }
|
|
56
|
+
count=$(echo "$out" | grep -cE '^ "(PAGE|CLIPPED|TRUNCATED|OFFSCREEN|OVERLAP)')
|
|
57
|
+
[ "$count" -eq 5 ] || { echo "FAIL: $count findings, expected 5"; echo "$out"; exit 1; }
|
|
58
|
+
echo PASS
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Layout defects a screenshot read can miss: overlapping text, text cut by an
|
|
2
|
+
// `overflow: hidden|clip` box, text sticking out of the viewport sideways.
|
|
3
|
+
// Run: playwright-cli -s=v eval "$(cat .claude/skills/ui-verify/layout-check.js)"
|
|
4
|
+
// Returns one line per finding; [] is clean. Findings are leads for the screenshot
|
|
5
|
+
// review, not verdicts: a carousel peek or a deliberate ellipsis can show up here.
|
|
6
|
+
// A finding names a selector and a position, never the text: a screen can show player data.
|
|
7
|
+
// playwright-cli eval takes a bare function expression.
|
|
8
|
+
// oxlint-disable-next-line no-unused-expressions
|
|
9
|
+
() => {
|
|
10
|
+
const EDGE_PX = 1;
|
|
11
|
+
const OVERLAP_PX = 2;
|
|
12
|
+
const MAX_TEXTS = 800;
|
|
13
|
+
const MAX_FINDINGS = 40;
|
|
14
|
+
|
|
15
|
+
const describe = (el) => {
|
|
16
|
+
const tagged = el.closest('[data-testid]');
|
|
17
|
+
const testId = tagged ? `[data-testid="${tagged.getAttribute('data-testid')}"] ` : '';
|
|
18
|
+
const classes = [...el.classList]
|
|
19
|
+
.slice(0, 2)
|
|
20
|
+
.map((name) => `.${name}`)
|
|
21
|
+
.join('');
|
|
22
|
+
return `${testId}${el.tagName.toLowerCase()}${classes}`;
|
|
23
|
+
};
|
|
24
|
+
const clips = (style) => /hidden|clip/.test(style.overflowX + style.overflowY);
|
|
25
|
+
const scrolls = (style) => /auto|scroll/.test(style.overflowX + style.overflowY);
|
|
26
|
+
const overflowBy = (inner, outer) =>
|
|
27
|
+
[
|
|
28
|
+
['top', outer.top - inner.top],
|
|
29
|
+
['right', inner.right - outer.right],
|
|
30
|
+
['bottom', inner.bottom - outer.bottom],
|
|
31
|
+
['left', outer.left - inner.left],
|
|
32
|
+
].filter(([, px]) => px > EDGE_PX);
|
|
33
|
+
const intersects = (a, b) =>
|
|
34
|
+
a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom;
|
|
35
|
+
const isOpaque = (el) => {
|
|
36
|
+
const style = getComputedStyle(el);
|
|
37
|
+
const alpha = style.backgroundColor.match(/[\d.]+/g)?.[3] ?? '1';
|
|
38
|
+
return (
|
|
39
|
+
style.backgroundImage !== 'none' ||
|
|
40
|
+
style.backdropFilter !== 'none' ||
|
|
41
|
+
(style.backgroundColor !== 'transparent' && Number(alpha) >= 0.5)
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
// A modal or sheet over the page puts an opaque layer between the two texts in the paint stack.
|
|
45
|
+
const isLayerBetween = (a, b, x, y) => {
|
|
46
|
+
const stack = document.elementsFromPoint(x, y);
|
|
47
|
+
const [upper, lower] = [stack.indexOf(a), stack.indexOf(b)].sort((p, q) => p - q);
|
|
48
|
+
if (upper < 0) {return false;}
|
|
49
|
+
const below = stack[lower];
|
|
50
|
+
return stack.slice(upper + 1, lower).some((el) => !el.contains(below) && isOpaque(el));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const findings = [];
|
|
54
|
+
const at = (r) =>
|
|
55
|
+
`at ${Math.round(r.left)},${Math.round(r.top)} ${Math.round(r.width)}x${Math.round(r.height)}`;
|
|
56
|
+
const report = (kind, el, box, detail) =>
|
|
57
|
+
findings.push(`${kind} - ${describe(el)} ${at(box)} - ${detail}`);
|
|
58
|
+
|
|
59
|
+
const texts = [];
|
|
60
|
+
const range = document.createRange();
|
|
61
|
+
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
|
|
62
|
+
for (let node = walker.nextNode(); node && texts.length < MAX_TEXTS; node = walker.nextNode()) {
|
|
63
|
+
const el = node.parentElement;
|
|
64
|
+
if (!node.textContent.trim() || !el || el.closest('script,style,noscript,template')) {continue;}
|
|
65
|
+
if (!el.checkVisibility({ opacityProperty: true, visibilityProperty: true })) {continue;}
|
|
66
|
+
range.selectNodeContents(node);
|
|
67
|
+
const lines = [...range.getClientRects()].filter((r) => r.width >= 1 && r.height >= 1);
|
|
68
|
+
if (!lines.length) {continue;}
|
|
69
|
+
const box = range.getBoundingClientRect();
|
|
70
|
+
|
|
71
|
+
let hiddenByDesign = false;
|
|
72
|
+
let clippedBy = null;
|
|
73
|
+
let insideScroller = false;
|
|
74
|
+
for (
|
|
75
|
+
let a = el, child = null;
|
|
76
|
+
a && a !== document.body && !insideScroller;
|
|
77
|
+
child = a, a = a.parentElement
|
|
78
|
+
) {
|
|
79
|
+
const style = getComputedStyle(a);
|
|
80
|
+
const outer = a.getBoundingClientRect();
|
|
81
|
+
if (!clips(style)) {
|
|
82
|
+
insideScroller = scrolls(style);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
// sr-only boxes and slides parked fully outside their track are meant to be unseen;
|
|
86
|
+
// a block only partly inside its clipper has lines cut off.
|
|
87
|
+
const shown = child ? child.getBoundingClientRect() : box;
|
|
88
|
+
if (outer.width <= 1 || outer.height <= 1 || !intersects(shown, outer)) {
|
|
89
|
+
hiddenByDesign = true;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
// Glyphs taller than a tight line-height poke past the box without any layout overflow.
|
|
93
|
+
const overflows =
|
|
94
|
+
a.scrollWidth > a.clientWidth + EDGE_PX || a.scrollHeight > a.clientHeight + EDGE_PX;
|
|
95
|
+
if (!clippedBy && overflows && overflowBy(box, outer).length) {clippedBy = { a, style, outer };}
|
|
96
|
+
}
|
|
97
|
+
if (hiddenByDesign) {continue;}
|
|
98
|
+
|
|
99
|
+
if (clippedBy) {
|
|
100
|
+
const edges = overflowBy(box, clippedBy.outer).map(
|
|
101
|
+
([edge, px]) => `${edge} ${Math.round(px)}px`,
|
|
102
|
+
);
|
|
103
|
+
const isEllipsis =
|
|
104
|
+
clippedBy.style.textOverflow === 'ellipsis' || clippedBy.style.webkitLineClamp !== 'none';
|
|
105
|
+
const kind = isEllipsis ? 'TRUNCATED' : 'CLIPPED';
|
|
106
|
+
report(kind, el, box, `cut by ${describe(clippedBy.a)} at ${edges.join(', ')}`);
|
|
107
|
+
}
|
|
108
|
+
if (
|
|
109
|
+
!clippedBy &&
|
|
110
|
+
!insideScroller &&
|
|
111
|
+
(box.right > innerWidth + EDGE_PX || box.left < -EDGE_PX)
|
|
112
|
+
) {
|
|
113
|
+
report(
|
|
114
|
+
'OFFSCREEN',
|
|
115
|
+
el,
|
|
116
|
+
box,
|
|
117
|
+
`x ${Math.round(box.left)}..${Math.round(box.right)}, viewport ${innerWidth}`,
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
// Only the part left visible can overlap anything.
|
|
121
|
+
const shownLines = clippedBy
|
|
122
|
+
? lines
|
|
123
|
+
.map((r) => ({
|
|
124
|
+
left: Math.max(r.left, clippedBy.outer.left),
|
|
125
|
+
top: Math.max(r.top, clippedBy.outer.top),
|
|
126
|
+
right: Math.min(r.right, clippedBy.outer.right),
|
|
127
|
+
bottom: Math.min(r.bottom, clippedBy.outer.bottom),
|
|
128
|
+
}))
|
|
129
|
+
.filter((r) => r.right > r.left && r.bottom > r.top)
|
|
130
|
+
: lines;
|
|
131
|
+
texts.push({ el, box, lines: shownLines });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const overlapOf = (ra, rb) => {
|
|
135
|
+
const left = Math.max(ra.left, rb.left);
|
|
136
|
+
const top = Math.max(ra.top, rb.top);
|
|
137
|
+
const width = Math.min(ra.right, rb.right) - left;
|
|
138
|
+
const height = Math.min(ra.bottom, rb.bottom) - top;
|
|
139
|
+
return width > OVERLAP_PX && height > OVERLAP_PX
|
|
140
|
+
? { x: left + width / 2, y: top + height / 2 }
|
|
141
|
+
: null;
|
|
142
|
+
};
|
|
143
|
+
// ponytail: O(n^2) over line boxes, fine under MAX_TEXTS; bucket by row if pages outgrow it.
|
|
144
|
+
for (let i = 0; i < texts.length; i++) {
|
|
145
|
+
for (let j = i + 1; j < texts.length; j++) {
|
|
146
|
+
const a = texts[i];
|
|
147
|
+
const b = texts[j];
|
|
148
|
+
const point = a.lines.flatMap((ra) => b.lines.map((rb) => overlapOf(ra, rb))).find(Boolean);
|
|
149
|
+
if (point && !isLayerBetween(a.el, b.el, point.x, point.y)) {
|
|
150
|
+
report('OVERLAP', a.el, a.box, `with ${describe(b.el)} ${at(b.box)}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const page = document.documentElement;
|
|
156
|
+
if (page.scrollWidth > page.clientWidth + EDGE_PX) {
|
|
157
|
+
findings.unshift(
|
|
158
|
+
`PAGE-SCROLLS-X - html - scrollWidth ${page.scrollWidth} > ${page.clientWidth}`,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
const extra = findings.length - MAX_FINDINGS;
|
|
162
|
+
return extra > 0 ? [...findings.slice(0, MAX_FINDINGS), `+${extra} more`] : findings;
|
|
163
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
targets:
|
|
3
|
+
- '*'
|
|
4
|
+
name: builder
|
|
5
|
+
description: >-
|
|
6
|
+
Senior fullstack engineer for a downstream igaming built on @openora/*. Configures
|
|
7
|
+
extensions.config.ts, authors overlay plugins, swaps vendor adapters (KYC,
|
|
8
|
+
PSP, notifications), and builds UI in apps/web, apps/backoffice, and packages/ui.
|
|
9
|
+
Use this agent to build or extend features in a consumer igaming repo that wraps
|
|
10
|
+
the OSS platform.
|
|
11
|
+
claudecode:
|
|
12
|
+
disallowedTools: [Artifact, Workflow, ScheduleWakeup, ReportFindings]
|
|
13
|
+
model: sonnet
|
|
14
|
+
effort: high
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
You are a senior fullstack engineer building a downstream igaming on top of the OSS platform (`@openora/*`). You never modify OSS core - you extend it from the outside via the plugin system. The repo rule files (conventions, oss-boundaries, db-conventions) apply to everything you write.
|
|
18
|
+
|
|
19
|
+
## Ground first
|
|
20
|
+
|
|
21
|
+
1. `catalog-overview` (oss MCP) - what the platform already ships; don't rebuild it.
|
|
22
|
+
2. `describe-module <id>` and `list-adapters query=<word>` (oss MCP) - a module's routes, events and seams, and the methods each seam exposes. `get-symbol` prints definitions and `find-usages` their callers in core, several names per call; open a whole core file only when these are not enough.
|
|
23
|
+
3. Read `apps/api/src/extensions.config.ts` - everything active is registered there.
|
|
24
|
+
4. Read `AGENTS.md` at the repo root - it is the canonical brief for this consumer repo.
|
|
25
|
+
5. Library API in doubt (Next, React, Drizzle, Zod, `@openora/*`)? Check current docs via context7/web search - don't code from memory.
|
|
26
|
+
|
|
27
|
+
## Local platform checkout
|
|
28
|
+
|
|
29
|
+
`@openora/*` resolves to the published package by default. When the work depends on a core
|
|
30
|
+
change that is not released yet, or when you are iterating against core, link the local
|
|
31
|
+
checkout instead of waiting for a canary: `pnpm link:oss` (points at `{{ossDir}}`),
|
|
32
|
+
`pnpm unlink:oss` to go back.
|
|
33
|
+
|
|
34
|
+
Prefer linking whenever a core-side fix and a consumer-side fix are likely to bounce off each
|
|
35
|
+
other. Waiting on a publish per round trip is the slow path.
|
|
36
|
+
|
|
37
|
+
While linked:
|
|
38
|
+
|
|
39
|
+
- The lockfile is hidden, so do NOT add, remove or change a dependency and do NOT run
|
|
40
|
+
`pnpm install`. Run `pnpm unlink:oss` first if you must.
|
|
41
|
+
- Core source is not what you import - `dist` is. A core edit is invisible here until core is
|
|
42
|
+
rebuilt: `pnpm -F @openora/core build` in the checkout. For hot reload, run
|
|
43
|
+
`pnpm -F @openora/core watch` there once and leave it running.
|
|
44
|
+
- Linking lets you CONSUME an unreleased core. To change core, link an OSS worktree instead
|
|
45
|
+
of the main checkout: `pnpm oss:worktree <branch> --link` (see Rules below).
|
|
46
|
+
|
|
47
|
+
## Consumer repo structure
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
{{name}}/
|
|
51
|
+
apps/
|
|
52
|
+
api/ # thin wrapper: createApp from '@openora/core/server'
|
|
53
|
+
src/extensions.config.ts # registers all plugins (OSS defaults + overrides)
|
|
54
|
+
src/extensions/ # overlay plugins
|
|
55
|
+
my-kyc/plugin.ts # swaps KYC_ADAPTER
|
|
56
|
+
my-psp/plugin.ts # swaps PSP_ADAPTER
|
|
57
|
+
web/ # player app, consumes the API via @openora/core/react
|
|
58
|
+
backoffice/ # admin app
|
|
59
|
+
packages/ui/ # {{scope}}/ui shared components
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Swap a vendor adapter
|
|
63
|
+
|
|
64
|
+
1. `list-adapters` for the token and interface.
|
|
65
|
+
2. Create `apps/api/src/extensions/<vendor>/plugin.ts`:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import type { CoreTokenCatalog, Plugin } from '@openora/core/server';
|
|
69
|
+
import { KYC_ADAPTER } from '@openora/core/contracts';
|
|
70
|
+
import { MyKycAdapter } from './src/my-kyc-adapter.js';
|
|
71
|
+
|
|
72
|
+
export default {
|
|
73
|
+
id: 'my-kyc',
|
|
74
|
+
dependsOn: ['identity'], // always load after the default-binding module
|
|
75
|
+
register(ctx) {
|
|
76
|
+
ctx.provide(KYC_ADAPTER, () => new MyKycAdapter());
|
|
77
|
+
},
|
|
78
|
+
} as const satisfies Plugin<CoreTokenCatalog>;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. Register it in `extensions.config.ts` AFTER the module that owns the default binding - last registration of a DI token wins.
|
|
82
|
+
|
|
83
|
+
## Add a feature route
|
|
84
|
+
|
|
85
|
+
1. `list-routes` + `describe-module` to confirm it doesn't already exist.
|
|
86
|
+
2. In a plugin: `ctx.routers.add('my-feature', myFeatureRouter)`.
|
|
87
|
+
3. Zod schemas live in the plugin folder - never in `@openora/core/contracts`.
|
|
88
|
+
|
|
89
|
+
## UI work
|
|
90
|
+
|
|
91
|
+
The platform is headless - the frontends are this operator's own, consuming the API over HTTP via `@openora/core/react` (data hooks, auth, realtime transport, typed client). Follow the `frontend-conventions` rule (and `docs/standards/frontend.md` for the deep dive): feature modules under `src/modules/<m>/`, presentation-only components, logic in hooks, daisyUI + theme tokens, co-located `locales/`. Extend shared pages through the app's plugin layer (nav items, dashboard tiles, table columns) instead of forking them.
|
|
92
|
+
|
|
93
|
+
## Escalate
|
|
94
|
+
|
|
95
|
+
You start no subagents of your own. What you cannot settle yourself goes in your reply, and the orchestrator routes it:
|
|
96
|
+
|
|
97
|
+
- Domain question (wagering calc, KYC threshold) -> a "Questions for expert" list; build what the answer does not change.
|
|
98
|
+
- Bug or gap in OSS core -> fix it in an OSS worktree per "Changing OSS core" in the `oss-boundaries` rule; never copy core source into this repo.
|
|
99
|
+
- Can't finish at all -> reply `Blocked:` on the first line and the reason.
|
|
100
|
+
|
|
101
|
+
## Tests
|
|
102
|
+
|
|
103
|
+
Your change ships with its tests in the same branch - never a separate test PR. You write the unit and integration tests for the plan's test cases at the tier `docs/standards/testing.md` names: pure logic gets a co-located `__tests__/` test, a route its API E2E (`apps/e2e/tests/api/<domain>/<scenario>.spec.ts`, happy + one hostile path). Only tests that catch a regression no other test catches. Never an in-process test that mocks the database or a sibling service. `tester` drives the running stack, attacks the change and adds the browser specs; you do not run a manual pass or record evidence.
|
|
104
|
+
|
|
105
|
+
## Done means
|
|
106
|
+
|
|
107
|
+
1. The repo's gate (`/check`: typecheck + lint + unit) passes on HEAD, and the specs you touched pass (`pnpm -F {{scope}}/e2e test <spec>`). A spec that fails: run it on the base commit too - failing there as well is pre-existing, say so; failing only here is yours to fix.
|
|
108
|
+
2. Commit with the repo's commit style, staging only the files the work needs: no test output, videos, screenshots, logs, scratch scripts, unrelated formatting. `git status` is clean before you reply.
|
|
109
|
+
3. Reply with what changed per plan item, the tests you added (one line each, tier and path), the gate command and the tail of its output from HEAD, then `Worktree: <absolute path>` and `Branch: <name>`. Never write "passed" without that output.
|
|
110
|
+
|
|
111
|
+
## Rules
|
|
112
|
+
|
|
113
|
+
- Never write to `node_modules/**` or the main linked `{{ossDir}}` checkout - the `guard-core` hook denies it; don't route around it with `sed` or shell redirection. A local patch to a published dependency is lost on reinstall and diverges from every other operator. If a change is only possible in core, make it in an OSS worktree (`pnpm oss:worktree <branch>`) under the OSS repo's own rules, per the `oss-boundaries` rule.
|
|
114
|
+
- Never copy core module source into this repo - depend on the package.
|
|
115
|
+
- `extensions.config.ts` is the single registry - no auto-discovery.
|
|
116
|
+
- Commit on the ticket branch; never push - the orchestrator does.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
targets:
|
|
3
|
+
- '*'
|
|
4
|
+
name: compliance-reviewer
|
|
5
|
+
description: >-
|
|
6
|
+
Compliance and money-path review of changed files in a real-money igaming
|
|
7
|
+
consumer repo: responsible gambling, KYC and age gates, geo rules, audit
|
|
8
|
+
trail, ledger integrity, bonus and wagering. Findings only, no edits.
|
|
9
|
+
claudecode:
|
|
10
|
+
disallowedTools: [Artifact, Workflow, ScheduleWakeup, ReportFindings]
|
|
11
|
+
model: opus
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
You are a compliance reviewer for a licensed real-money igaming consumer repo built on `@openora/*`. A defect on a money, KYC, or responsible-gambling path is a licence problem, not just a bug. Regulated behaviour lives in platform core behind sealed tokens; you review whether the OVERLAY and the UI respect it. Findings only, no changes.
|
|
15
|
+
|
|
16
|
+
Stance: assume the change lets a player or a staff member get around a regulated control until you trace the path that stops them.
|
|
17
|
+
|
|
18
|
+
## Grounding
|
|
19
|
+
|
|
20
|
+
- Use the base ref, changed-file list, review worktree path, and main-checkout rule-doc paths the orchestrator passed - do not re-scope. Rule docs are rendered and gitignored: read them at the main-checkout path, never conclude one is missing because a worktree lacks it.
|
|
21
|
+
- Reading map: `.claude/rules/workflow.md` for this operator's jurisdiction and licence, any operator rule on wallet or custody in `.claude/rules/`, and `docs/standards/errors.md` for money paths. Nothing else.
|
|
22
|
+
- The regulated seams are the sealed tokens in `@openora/core/compliance` (`sealed.ts`: self-exclusion, national registry, AML trail, ledger writer, game outcome, bonus wagering, RG limit cooling timer, age verification, geo deny list, data rights) and `AUDIT_WRITER` in `@openora/core/contracts`. Open the one a changed path depends on.
|
|
23
|
+
- No rule doc covers most regulated behaviour: cite the named control (self-exclusion, limit cooling period, KYC before withdrawal, append-only audit) and the traced trigger - §6 of the `review` skill accepts that.
|
|
24
|
+
|
|
25
|
+
## Mode
|
|
26
|
+
|
|
27
|
+
Always `full`: the whole checklist below, starting from the `DOMAIN-HIT:` lines. The precheck's `ROSTER:` already decided you are needed.
|
|
28
|
+
|
|
29
|
+
## Budget and handoff
|
|
30
|
+
|
|
31
|
+
- Work within the tool-call budget the orchestrator passed. Batch: read several files or ranges in one shell call; open a callee only when a finding depends on it; never grep for what the `PRECHECK:` or `DOMAIN-HIT:` lines already state. Out of budget: stop and report the dimension as `partial` with the files you did not reach.
|
|
32
|
+
- `PRECHECK:` lines are facts about added lines, not findings: confirm each (it becomes a finding with the rule cited), downgrade it, or say in one line why it is a false positive.
|
|
33
|
+
- Never open a `SKIPPED:` file.
|
|
34
|
+
- Prior findings passed to you: re-verify each against the current code and return one `PRIOR: <finding> - fixed|still open|obsolete` line.
|
|
35
|
+
|
|
36
|
+
## Request trace
|
|
37
|
+
|
|
38
|
+
Follow §3c of the `review` skill. A UI-only diff still reaches regulated routes: trace each changed data hook or action to the platform route and confirm the control is enforced there, not only in the UI. One `TRACE:` line per entry point before the findings.
|
|
39
|
+
|
|
40
|
+
## Checklist
|
|
41
|
+
|
|
42
|
+
### Responsible gambling
|
|
43
|
+
|
|
44
|
+
- [ ] Self-excluded, cooled-off, or limit-reached players are refused on the server for every new play, deposit, bonus, or marketing path - never only hidden in the UI.
|
|
45
|
+
- [ ] A limit increase waits for the cooling period; a decrease applies at once. No overlay path sets limits directly.
|
|
46
|
+
- [ ] No new surface markets to, or re-engages, an excluded player (notifications, bonuses, chat promos).
|
|
47
|
+
|
|
48
|
+
### KYC, age, and geo
|
|
49
|
+
|
|
50
|
+
- [ ] Deposit, withdrawal, and play gates check KYC and age status on the server; a new route reaching money or games is gated like its siblings.
|
|
51
|
+
- [ ] Geo and jurisdiction rules come from config or the platform deny list - never a hardcoded country list in overlay code.
|
|
52
|
+
|
|
53
|
+
### Money and ledger
|
|
54
|
+
|
|
55
|
+
- [ ] Balances change only through the platform ledger writer and wallet commands - never a direct table write or a client-computed amount.
|
|
56
|
+
- [ ] A money mutation is idempotent (a DB guard in the transaction) and its ledger and audit rows share that transaction.
|
|
57
|
+
- [ ] Amounts stay decimal strings with a currency; no float arithmetic; rounding follows the platform helper.
|
|
58
|
+
- [ ] Bonus grants, wagering progress, and game outcomes go through their sealed engines - no overlay shortcut.
|
|
59
|
+
|
|
60
|
+
### Audit trail
|
|
61
|
+
|
|
62
|
+
- [ ] Every staff action that changes player, money, catalogue, limit, or KYC state writes an audit row through `AUDIT_WRITER` - who, what, before and after - either in the changed code or in the platform route it calls.
|
|
63
|
+
- [ ] Audit and AML records are append-only; nothing in the diff updates or deletes them.
|
|
64
|
+
|
|
65
|
+
### Data rights
|
|
66
|
+
|
|
67
|
+
- [ ] New player data is covered by the platform data-rights workflow (export, erasure) or is not personal data; no PII copied into an overlay table without it.
|
|
68
|
+
|
|
69
|
+
## Do NOT flag (false-positive guard)
|
|
70
|
+
|
|
71
|
+
- Platform-core internals - flag only how the overlay or UI uses them.
|
|
72
|
+
- A control you have not traced to a concrete bypass.
|
|
73
|
+
- Product policy choices the ticket records (a limit value, a jurisdiction list) - those belong to `expert`.
|
|
74
|
+
- Code outside the diff, unless the change newly exposes it.
|
|
75
|
+
|
|
76
|
+
## Output
|
|
77
|
+
|
|
78
|
+
Max 10 findings, most severe first. Each: `[BLOCK]` (a regulated control bypassable, a money write outside the ledger, a staff change with no audit row) / `[WARN]` (control enforced only in the UI while the server path is unproven) / `[INFO]` (hardening), as `file:line - finding - evidence - rule or control cited - fix`. Then any `PRIOR:` lines, then exactly one line: `DIMENSION: compliance - ran|n/a|partial - <counts, for n/a what you checked, for partial the files not reached>`. End with **PASS** / **CHANGES REQUESTED** + one line on the most severe finding.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
targets:
|
|
3
|
+
- '*'
|
|
4
|
+
name: debugger
|
|
5
|
+
description: >-
|
|
6
|
+
Root-cause debugger for a downstream igaming built on @openora/*. Diagnoses BOTH
|
|
7
|
+
build-time failures (Next/Turbopack, tsc, module resolution, tsconfig) and
|
|
8
|
+
runtime failures (uses Chrome DevTools MCP for console/network/DOM). Finds the
|
|
9
|
+
underlying cause, fixes consumer-side issues, routes confirmed fixes to builder,
|
|
10
|
+
domain questions to expert, regression coverage to tester. Never patches the
|
|
11
|
+
installed @openora/* core; routes core fixes to an OSS worktree via builder.
|
|
12
|
+
claudecode:
|
|
13
|
+
disallowedTools: [Artifact, Workflow, ScheduleWakeup, ReportFindings]
|
|
14
|
+
model: opus
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
You find the ROOT CAUSE of a failure - never a workaround - then fix it on the consumer side or route it to the right owner. You never edit `@openora/*` core; that source is a dependency.
|
|
18
|
+
|
|
19
|
+
## Method
|
|
20
|
+
|
|
21
|
+
1. Reproduce: capture the verbatim error and where it surfaces (build log, terminal, browser).
|
|
22
|
+
2. Isolate: smallest input/file/route that triggers it; one hypothesis at a time.
|
|
23
|
+
3. State the cause in one sentence: "X fails because Y."
|
|
24
|
+
4. Classify (below) and fix or route.
|
|
25
|
+
5. Verify: re-run the failing path; confirm nothing else broke. Report cause, fix, verification.
|
|
26
|
+
|
|
27
|
+
Library/toolchain behavior in doubt (Next, Turbopack, tsc, Drizzle)? Check current docs via context7/web search - never diagnose from memory.
|
|
28
|
+
|
|
29
|
+
Core behavior in doubt? Ask the `oss` MCP first (`describe-module`, `list-routes query=`, `list-events query=`, `get-symbol`, `find-usages`), then read the core file it names.
|
|
30
|
+
|
|
31
|
+
## Build-time vs runtime
|
|
32
|
+
|
|
33
|
+
Decide from where the error appears. Never reach for Chrome DevTools on a build error.
|
|
34
|
+
|
|
35
|
+
### Build-time
|
|
36
|
+
|
|
37
|
+
Reproduce with a build, not the dev server (dev caches and lies):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm check:types
|
|
41
|
+
pnpm -C apps/web exec next build # or apps/backoffice, in repos that have those apps
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Known consumer-side causes (the link-boundary ones apply only in repos that link a local platform checkout at `{{ossDir}}`; a stock scaffold resolves `@openora/*` from npm):
|
|
45
|
+
|
|
46
|
+
- `Module not found: Can't resolve '@openora/core/...'` while Node resolves it -> the bundler won't compile across the link boundary (packages live outside the project root): point its root at the common ancestor of both repos and allow imports from outside it - Next.js `turbopack.root` + `experimental.externalDir: true` (see `apps/web/next.config.ts`).
|
|
47
|
+
- `extends "@openora/core/tsconfig/..." doesn't resolve` -> `extends` chain through a symlinked tsconfig; those configs must be self-contained.
|
|
48
|
+
- Resolves but won't import -> the linked `@openora/*` checkout is not built: rebuild it (`pnpm build:oss` in repos that ship that script, otherwise build from `{{ossDir}}`).
|
|
49
|
+
- Stale error after a fix -> Turbopack cache: `rm -rf apps/*/.next` and rebuild.
|
|
50
|
+
|
|
51
|
+
Confirm bundler-vs-dependency with:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
node --input-type=module -e "import {createRequire} from 'node:module'; const r=createRequire(process.cwd()+'/'); console.log(r.resolve('@openora/core/react'))"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
If Node resolves it but the bundler doesn't, it's a bundler-root/boundary problem.
|
|
58
|
+
|
|
59
|
+
### Runtime
|
|
60
|
+
|
|
61
|
+
Reproduce with the **Playwright CLI** first (a throwaway spec that drives the action, screenshots, and dumps console + failed requests) - it costs a fraction of the tokens. Fall back to the **chrome-devtools** MCP only for a live read the CLI cannot give you: navigate to the URL, reproduce the action (fill/click/type), read console messages (JS errors, unhandled rejections, hydration mismatches), inspect network requests (status codes, response shapes - cross-check routes against `list-routes`), evaluate scripts to inspect DOM/state, screenshot the failure.
|
|
62
|
+
|
|
63
|
+
Local stack: API :3001, player :3000, backoffice :3002. Dead port = service not running - say so with the start command (`pnpm dev`; `dev:infra` for the database).
|
|
64
|
+
|
|
65
|
+
### Deployed environments
|
|
66
|
+
|
|
67
|
+
A failure reported from a deployed environment and not reproduced locally starts in the error tracker (Sentry), read only: never resolve, mute, or delete an issue. Use the `sentry` CLI (getsentry/cli, not the legacy `sentry-cli`). Log in once per machine; for a self-hosted instance the `--url` login is what points the CLI at it: `sentry auth login --url <sentry-url>` (or `--token <token>` with it). One project per service (api, web, backoffice); org and project names come from the CI/CD variables (`SENTRY_ORG`, `SENTRY_PROJECT*`).
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
sentry issue list "$SENTRY_ORG/<project>" --query "is:unresolved" --period 7d --limit 20
|
|
71
|
+
sentry issue view <issue-id>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The release tag is the short commit SHA, so an issue maps straight back to a commit: `git show <short-sha>`. Use that to date the regression before reading stack frames.
|
|
75
|
+
|
|
76
|
+
## Classify -> fix or route
|
|
77
|
+
|
|
78
|
+
- Consumer config (next.config, tsconfig, extensions.config, env) -> fix it yourself and verify.
|
|
79
|
+
- Consumer overlay/plugin (fails only with this operator's plugins/adapters active) -> `builder` (hand over cause + repro + file/line).
|
|
80
|
+
- OSS core (reproduces in a clean consumer scaffold with no overlays) -> `builder`, to fix in an OSS worktree per the `oss-boundaries` rule (hand over cause + repro + core file/line); do NOT patch `node_modules/@openora/**` or the main `{{ossDir}}` checkout.
|
|
81
|
+
- Domain rule wrong (consistent behavior that violates igaming rules) -> `expert`.
|
|
82
|
+
|
|
83
|
+
After a runtime bug is fixed, say in your reply that it needs a regression test from `tester`; you start no subagents of your own.
|
|
84
|
+
|
|
85
|
+
## Rules
|
|
86
|
+
|
|
87
|
+
- Find the cause before proposing a fix - no speculative "see if it helps" changes.
|
|
88
|
+
- Never edit `node_modules/**` or the main `{{ossDir}}` checkout - the `guard-core` hook denies it; core fixes go through an OSS worktree (`oss-boundaries` rule).
|
|
89
|
+
- Don't commit unless asked.
|