@punks/cli 2.3.2 → 2.4.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/BASELINE_CHANGELOG.md +50 -0
- package/dist/CHANGELOG.md +50 -0
- package/dist/index.js +216 -221
- package/dist/skills/agnostic/cli/dp-cli/SKILL.md +1 -12
- package/dist/skills/agnostic/cli/dp-cli/references/commands.md +22 -18
- package/dist/skills/agnostic/cli/dp-cli/references/post-command-flow.md +15 -19
- package/dist/skills/agnostic/planning/wayfinder/SKILL.md +42 -0
- package/dist/skills/agnostic/quality/review/SKILL.md +89 -0
- package/dist/skills/agnostic/requirements/write-backlog/EXAMPLES.md +22 -0
- package/dist/skills/agnostic/requirements/write-backlog/REFERENCE.md +110 -23
- package/dist/skills/agnostic/requirements/write-backlog/SKILL.md +30 -14
- package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/backlog-model.md +74 -7
- package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/story-shape.md +108 -2
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/azure-devops-create-payload.md +29 -3
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/github-projects-create-payload.md +43 -7
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/linear-create-payload.md +25 -3
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/monday-create-payload.md +63 -14
- package/dist/skills/agnostic/research/parallel-research/SKILL.md +5 -2
- package/dist/skills/frameworks/expo/add-app-clip/SKILL.md +280 -0
- package/dist/skills/frameworks/expo/add-app-clip/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/add-app-clip/references/native-module.md +96 -0
- package/dist/skills/frameworks/expo/building-native-ui/SKILL.md +377 -0
- package/dist/skills/frameworks/expo/building-native-ui/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/animations.md +220 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/controls.md +270 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/form-sheet.md +253 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/gradients.md +106 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/icons.md +213 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/media.md +198 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/route-structure.md +229 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/search.md +248 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/storage.md +121 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/tabs.md +433 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/toolbar-and-headers.md +284 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/visual-effects.md +197 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/webgpu-three.md +605 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/zoom-transitions.md +158 -0
- package/dist/skills/frameworks/expo/eas-simulator/SKILL.md +154 -0
- package/dist/skills/frameworks/expo/eas-simulator/references/controllers.md +67 -0
- package/dist/skills/frameworks/expo/eas-simulator/references/run-your-app.md +185 -0
- package/dist/skills/frameworks/expo/eas-simulator/references/troubleshooting.md +38 -0
- package/dist/skills/frameworks/expo/eas-update-insights/SKILL.md +228 -0
- package/dist/skills/frameworks/expo/eas-update-insights/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/eas-update-insights/references/channel-insights-schema.md +47 -0
- package/dist/skills/frameworks/expo/eas-update-insights/references/update-insights-schema.md +69 -0
- package/dist/skills/frameworks/expo/expo-api-routes/SKILL.md +368 -0
- package/dist/skills/frameworks/expo/expo-api-routes/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-brownfield/SKILL.md +54 -0
- package/dist/skills/frameworks/expo/expo-brownfield/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-brownfield/references/brownfield-integrated.md +526 -0
- package/dist/skills/frameworks/expo/expo-brownfield/references/brownfield-isolated.md +402 -0
- package/dist/skills/frameworks/expo/expo-brownfield/references/comparison.md +63 -0
- package/dist/skills/frameworks/expo/expo-brownfield/references/troubleshooting.md +88 -0
- package/dist/skills/frameworks/expo/expo-cicd-workflows/SKILL.md +92 -0
- package/dist/skills/frameworks/expo/expo-cicd-workflows/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-cicd-workflows/scripts/fetch.js +109 -0
- package/dist/skills/frameworks/expo/expo-cicd-workflows/scripts/package.json +11 -0
- package/dist/skills/frameworks/expo/expo-cicd-workflows/scripts/validate.js +84 -0
- package/dist/skills/frameworks/expo/expo-deployment/SKILL.md +167 -0
- package/dist/skills/frameworks/expo/expo-deployment/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-deployment/references/app-store-metadata.md +497 -0
- package/dist/skills/frameworks/expo/expo-deployment/references/ios-app-store.md +371 -0
- package/dist/skills/frameworks/expo/expo-deployment/references/play-store.md +246 -0
- package/dist/skills/frameworks/expo/expo-deployment/references/testflight.md +58 -0
- package/dist/skills/frameworks/expo/expo-deployment/references/workflows.md +160 -0
- package/dist/skills/frameworks/expo/expo-dev-client/SKILL.md +172 -0
- package/dist/skills/frameworks/expo/expo-dev-client/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-examples/SKILL.md +97 -0
- package/dist/skills/frameworks/expo/expo-examples/references/catalog.md +105 -0
- package/dist/skills/frameworks/expo/expo-module/SKILL.md +141 -0
- package/dist/skills/frameworks/expo/expo-module/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-module/references/config-plugin.md +90 -0
- package/dist/skills/frameworks/expo/expo-module/references/create-expo-module.md +206 -0
- package/dist/skills/frameworks/expo/expo-module/references/lifecycle.md +127 -0
- package/dist/skills/frameworks/expo/expo-module/references/module-config.md +48 -0
- package/dist/skills/frameworks/expo/expo-module/references/native-module.md +286 -0
- package/dist/skills/frameworks/expo/expo-module/references/native-view.md +171 -0
- package/dist/skills/frameworks/expo/expo-observe/SKILL.md +29 -0
- package/dist/skills/frameworks/expo/expo-observe/references/metrics.md +47 -0
- package/dist/skills/frameworks/expo/expo-observe/references/queries.md +342 -0
- package/dist/skills/frameworks/expo/expo-observe/references/setup.md +255 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/SKILL.md +314 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/agents/visual-grader.md +52 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/references/design-rubric.md +45 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/references/runtime-matrix.md +33 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/check-static.sh +64 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/clean-fixture.sh +56 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/generate_viewer.py +450 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/latest-sdk.sh +46 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/make-fixture.sh +95 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/make-workspace.sh +31 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/snapshot-android.sh +284 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/snapshot-ios.sh +132 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/snapshot-web.sh +61 -0
- package/dist/skills/frameworks/expo/expo-tailwind-setup/SKILL.md +480 -0
- package/dist/skills/frameworks/expo/expo-tailwind-setup/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-ui/SKILL.md +47 -0
- package/dist/skills/frameworks/expo/expo-ui/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-ui/references/drop-in-replacements.md +27 -0
- package/dist/skills/frameworks/expo/expo-ui/references/jetpack-compose.md +73 -0
- package/dist/skills/frameworks/expo/expo-ui/references/swift-ui.md +73 -0
- package/dist/skills/frameworks/expo/expo-ui/references/universal.md +73 -0
- package/dist/skills/frameworks/expo/expo-ui/scripts/list-components.js +193 -0
- package/dist/skills/frameworks/expo/native-data-fetching/SKILL.md +505 -0
- package/dist/skills/frameworks/expo/native-data-fetching/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/native-data-fetching/references/expo-router-loaders.md +341 -0
- package/dist/skills/frameworks/expo/upgrading-expo/SKILL.md +134 -0
- package/dist/skills/frameworks/expo/upgrading-expo/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/expo-av-to-audio.md +132 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/expo-av-to-video.md +160 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/native-tabs.md +124 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/new-architecture.md +79 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/react-19.md +79 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/react-compiler.md +59 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/react-navigation-to-expo-router.md +61 -0
- package/dist/skills/frameworks/expo/use-dom/SKILL.md +417 -0
- package/dist/skills/frameworks/expo/use-dom/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/web-to-native/SKILL.md +83 -0
- package/dist/skills/frameworks/expo/web-to-native/references/false-friends.md +119 -0
- package/dist/skills/frameworks/expo/web-to-native/references/native-patterns.md +39 -0
- package/dist/skills/frameworks/expo/web-to-native/references/run-as-goal.md +48 -0
- package/dist/skills/frameworks/expo/web-to-native/references/verify-on-device.md +45 -0
- package/dist/skills/phases/finder-phase/SKILL.md +52 -0
- package/dist/skills/phases/finder-phase/references/frontier-lifecycle.md +70 -0
- package/dist/skills/phases/finder-phase/references/root-routing.md +29 -0
- package/dist/skills/phases/goalify/SKILL.md +10 -7
- package/dist/skills/phases/review-phase/REFERENCE.md +36 -3
- package/dist/skills/phases/review-phase/SKILL.md +18 -11
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Reclaim disk after a fixture's screenshots are captured. Essential for
|
|
3
|
+
# dev-build runs, where each `expo run:<platform>` leaves multi-GB native build
|
|
4
|
+
# output (iOS Pods + DerivedData, Android Gradle build). Removes the heavy,
|
|
5
|
+
# regenerable artifacts and keeps the app source + git history, so the grader's
|
|
6
|
+
# `git diff` still works.
|
|
7
|
+
#
|
|
8
|
+
# Usage: clean-fixture.sh <project-path>
|
|
9
|
+
#
|
|
10
|
+
# Env: EXPO_SKILL_EVAL_KEEP_DERIVEDDATA=1 skips the iOS DerivedData sweep (set it
|
|
11
|
+
# only if you keep a real Xcode project literally named "fixture").
|
|
12
|
+
set -uo pipefail
|
|
13
|
+
|
|
14
|
+
APP="${1:?usage: clean-fixture.sh <project-path>}"
|
|
15
|
+
|
|
16
|
+
# Safety guard: only ever clean inside an expo-skill-eval workspace.
|
|
17
|
+
case "$APP" in
|
|
18
|
+
*expo-skill-eval-*) : ;;
|
|
19
|
+
*) echo "clean-fixture: refusing to clean '$APP' (not an expo-skill-eval fixture)" >&2; exit 1 ;;
|
|
20
|
+
esac
|
|
21
|
+
[[ -d "$APP" ]] || { echo "clean-fixture: $APP not found, skipping"; exit 0; }
|
|
22
|
+
|
|
23
|
+
# Stop any Metro / Expo dev server that may still be running for this fixture.
|
|
24
|
+
# The snapshot scripts' EXIT trap normally handles this, but cleaning up here
|
|
25
|
+
# catches leftover processes from crashes or interrupted runs.
|
|
26
|
+
# Ports 8081 (iOS) and 8082 (Android) are the two ports the eval harness
|
|
27
|
+
# reserves — freeing them here is safe because clean-fixture.sh only runs after
|
|
28
|
+
# all screenshots for this fixture have been captured.
|
|
29
|
+
#
|
|
30
|
+
# `-sTCP:LISTEN` is REQUIRED, not a refinement: without it, `lsof -ti tcp:8082`
|
|
31
|
+
# also matches the *established* connection the adb daemon holds from the
|
|
32
|
+
# `adb reverse tcp:8082` tunnel, and SIGKILLing the adb daemon crashes the
|
|
33
|
+
# emulator with a gfxstream gRPC SIGABRT (std::bad_function_call). Keep the flag
|
|
34
|
+
# so only the Metro listener is killed.
|
|
35
|
+
lsof -ti tcp:8081 -sTCP:LISTEN 2>/dev/null | xargs kill -9 2>/dev/null || true
|
|
36
|
+
lsof -ti tcp:8082 -sTCP:LISTEN 2>/dev/null | xargs kill -9 2>/dev/null || true
|
|
37
|
+
|
|
38
|
+
# Per-fixture heavy dirs — all gitignored / regenerable (node_modules, the
|
|
39
|
+
# prebuilt native projects incl. iOS Pods and Android Gradle output, caches).
|
|
40
|
+
rm -rf \
|
|
41
|
+
"$APP/node_modules" \
|
|
42
|
+
"$APP/ios" \
|
|
43
|
+
"$APP/android" \
|
|
44
|
+
"$APP/.expo" \
|
|
45
|
+
"$APP/dist" \
|
|
46
|
+
"$APP/web-build" 2>/dev/null || true
|
|
47
|
+
|
|
48
|
+
# iOS DerivedData for fixture builds. create-expo-app names the project
|
|
49
|
+
# "fixture", so its build output lives under DerivedData/fixture-<hash>. This is
|
|
50
|
+
# a cache (worst case a rebuild), so it's safe to drop between fixtures.
|
|
51
|
+
if [[ "${EXPO_SKILL_EVAL_KEEP_DERIVEDDATA:-0}" != "1" ]]; then
|
|
52
|
+
DD="$HOME/Library/Developer/Xcode/DerivedData"
|
|
53
|
+
[[ -d "$DD" ]] && rm -rf "$DD"/fixture-* 2>/dev/null || true
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
echo "cleaned fixture: $APP"
|
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Generate the self-contained HTML viewer for an expo-skill-eval run.
|
|
3
|
+
|
|
4
|
+
Usage: generate_viewer.py <workspace-root> [--artifact]
|
|
5
|
+
<workspace-root> Run root, e.g. /private/tmp/expo-skill-eval-expo-ui.
|
|
6
|
+
Iteration dirs (iteration-*) and trigger-evals/ live under it;
|
|
7
|
+
viewer.html is written there and opened in the browser.
|
|
8
|
+
--artifact Emit viewer_artifact.html (page-content only, no
|
|
9
|
+
<!DOCTYPE>/<html>/<head>/<body>) for the Artifact tool, and
|
|
10
|
+
do NOT open a browser. The standalone viewer.html is still
|
|
11
|
+
written on a normal (non-artifact) run.
|
|
12
|
+
|
|
13
|
+
Reads, per iteration, <iter>/evals.json plus each eval's
|
|
14
|
+
eval-<id>/<config>/{grading.json,static.json,outputs/<platform>.png}. Screenshots
|
|
15
|
+
are embedded as base64 data: URIs so the file is fully self-contained (and
|
|
16
|
+
satisfies the Artifact CSP). Self-paced by argv so it can be a checked-in script
|
|
17
|
+
rather than regenerated each run.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
import base64
|
|
21
|
+
import json
|
|
22
|
+
import sys
|
|
23
|
+
import webbrowser
|
|
24
|
+
from pathlib import Path
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def b64_img(path):
|
|
28
|
+
if not path:
|
|
29
|
+
return None
|
|
30
|
+
p = Path(path)
|
|
31
|
+
if not p.exists() or not p.is_file():
|
|
32
|
+
return None
|
|
33
|
+
with open(p, "rb") as f:
|
|
34
|
+
data = base64.b64encode(f.read()).decode()
|
|
35
|
+
ext = p.suffix.lower().lstrip(".")
|
|
36
|
+
mime = {"png": "image/png", "jpg": "image/jpeg", "jpeg": "image/jpeg"}.get(ext, "image/png")
|
|
37
|
+
return f"data:{mime};base64,{data}"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def score_color(score, max_score):
|
|
41
|
+
if not max_score:
|
|
42
|
+
return "#888"
|
|
43
|
+
pct = score / max_score
|
|
44
|
+
if pct >= 0.85:
|
|
45
|
+
return "#4ade80"
|
|
46
|
+
elif pct >= 0.65:
|
|
47
|
+
return "#fbbf24"
|
|
48
|
+
else:
|
|
49
|
+
return "#f87171"
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def load_json(path, default=None):
|
|
53
|
+
p = Path(path)
|
|
54
|
+
if not p.exists():
|
|
55
|
+
return default
|
|
56
|
+
try:
|
|
57
|
+
with open(p) as f:
|
|
58
|
+
return json.load(f)
|
|
59
|
+
except Exception:
|
|
60
|
+
return default
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def render_expectations(expectations):
|
|
64
|
+
if not expectations:
|
|
65
|
+
return ""
|
|
66
|
+
html = '<ul class="exp-list">'
|
|
67
|
+
for exp in expectations:
|
|
68
|
+
if isinstance(exp, dict):
|
|
69
|
+
passed = exp.get("passed", None)
|
|
70
|
+
text = exp.get("text", str(exp))
|
|
71
|
+
evidence = exp.get("evidence", "")
|
|
72
|
+
if passed is True:
|
|
73
|
+
badge = '<span class="badge pass">PASS</span>'
|
|
74
|
+
elif passed is False:
|
|
75
|
+
badge = '<span class="badge fail">FAIL</span>'
|
|
76
|
+
else:
|
|
77
|
+
badge = '<span class="badge unknown">?</span>'
|
|
78
|
+
ev_html = f'<div class="evidence">{evidence}</div>' if evidence else ""
|
|
79
|
+
html += f'<li>{badge} {text}{ev_html}</li>'
|
|
80
|
+
else:
|
|
81
|
+
html += f'<li><span class="badge unknown">?</span> {exp}</li>'
|
|
82
|
+
html += "</ul>"
|
|
83
|
+
return html
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def render_quality(quality):
|
|
87
|
+
if not quality:
|
|
88
|
+
return ""
|
|
89
|
+
dims = quality.get("dimensions", [])
|
|
90
|
+
subtotal = quality.get("subtotal", 0)
|
|
91
|
+
max_total = quality.get("max", 0)
|
|
92
|
+
summary = quality.get("summary", "")
|
|
93
|
+
html = '<div class="quality-block">'
|
|
94
|
+
html += f'<div class="quality-header">Design Quality: <b>{subtotal}/{max_total}</b></div>'
|
|
95
|
+
for d in dims:
|
|
96
|
+
name = d.get("name", "")
|
|
97
|
+
score = d.get("score", 0)
|
|
98
|
+
mx = d.get("max", 3)
|
|
99
|
+
evidence = d.get("evidence", "")
|
|
100
|
+
pct = (score / mx * 100) if mx else 0
|
|
101
|
+
color = score_color(score, mx)
|
|
102
|
+
html += f'''<div class="quality-dim">
|
|
103
|
+
<div class="dim-label">{name} <span style="color:{color}">{score}/{mx}</span></div>
|
|
104
|
+
<div class="dim-bar-wrap"><div class="dim-bar" style="width:{pct:.0f}%;background:{color}"></div></div>
|
|
105
|
+
{f'<div class="dim-evidence">{evidence}</div>' if evidence else ""}
|
|
106
|
+
</div>'''
|
|
107
|
+
if summary:
|
|
108
|
+
html += f'<div class="quality-summary">{summary}</div>'
|
|
109
|
+
html += "</div>"
|
|
110
|
+
return html
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def render_config_card(iter_dir, eval_id, config, eval_case, grading, static_result):
|
|
114
|
+
screenshots = []
|
|
115
|
+
for plat in eval_case.get("runtime", {}).get("platforms", ["ios"]):
|
|
116
|
+
img_path = iter_dir / f"eval-{eval_id}" / config / "outputs" / f"{plat}.png"
|
|
117
|
+
screenshots.append((plat, b64_img(img_path)))
|
|
118
|
+
|
|
119
|
+
static_pass = static_result and static_result.get("exit_code") == 0
|
|
120
|
+
static_badge = '<span class="badge pass">BUILD OK</span>' if static_pass else '<span class="badge fail">BUILD FAIL</span>'
|
|
121
|
+
|
|
122
|
+
score = grading.get("score", 0) if grading else None
|
|
123
|
+
max_score = grading.get("max_score", 1) if grading else 1
|
|
124
|
+
score_html = ""
|
|
125
|
+
if score is not None:
|
|
126
|
+
color = score_color(score, max_score)
|
|
127
|
+
score_html = f'<div class="score" style="color:{color}">{score}/{max_score}</div>'
|
|
128
|
+
|
|
129
|
+
label = "With Skill" if config == "with_skill" else "Without Skill"
|
|
130
|
+
html = '<div class="config-card">'
|
|
131
|
+
html += f'<div class="config-header"><span class="config-label {"with" if config == "with_skill" else "without"}">{label}</span>{static_badge}{score_html}</div>'
|
|
132
|
+
|
|
133
|
+
for plat, img_b64 in screenshots:
|
|
134
|
+
if img_b64:
|
|
135
|
+
html += f'<div class="screenshot-wrap"><div class="plat-label">{plat}</div>'
|
|
136
|
+
html += f'<img src="{img_b64}" class="screenshot" onclick="this.classList.toggle(\'zoomed\')" />'
|
|
137
|
+
html += '</div>'
|
|
138
|
+
else:
|
|
139
|
+
html += f'<div class="screenshot-wrap"><div class="plat-label">{plat}</div><div class="no-screenshot">No screenshot</div></div>'
|
|
140
|
+
|
|
141
|
+
if grading:
|
|
142
|
+
html += render_expectations(grading.get("expectations", []))
|
|
143
|
+
|
|
144
|
+
ref_match = grading.get("reference_match")
|
|
145
|
+
if ref_match:
|
|
146
|
+
rm_score = ref_match.get("score", 0)
|
|
147
|
+
rm_max = ref_match.get("max", 10)
|
|
148
|
+
rm_color = score_color(rm_score, rm_max)
|
|
149
|
+
html += f'<div class="ref-match"><b>Reference Match:</b> <span style="color:{rm_color}">{rm_score}/{rm_max}</span>'
|
|
150
|
+
if ref_match.get("evidence"):
|
|
151
|
+
html += f'<div class="evidence">{ref_match["evidence"]}</div>'
|
|
152
|
+
html += '</div>'
|
|
153
|
+
|
|
154
|
+
html += render_quality(grading.get("quality"))
|
|
155
|
+
|
|
156
|
+
notes = grading.get("user_notes_summary", {})
|
|
157
|
+
if notes and notes.get("notes"):
|
|
158
|
+
html += f'<div class="reviewer-notes"><b>Notes:</b> {notes["notes"]}</div>'
|
|
159
|
+
|
|
160
|
+
html += '</div>'
|
|
161
|
+
return html
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def render_iteration(iter_dir):
|
|
165
|
+
evals = load_json(iter_dir / "evals.json")
|
|
166
|
+
if not evals:
|
|
167
|
+
return f"<p>No evals.json found in {iter_dir}</p>"
|
|
168
|
+
|
|
169
|
+
html = ""
|
|
170
|
+
total_with = total_without = 0
|
|
171
|
+
scored_with = scored_without = 0
|
|
172
|
+
qual_with = qual_without = 0
|
|
173
|
+
total_evals = 0
|
|
174
|
+
|
|
175
|
+
for ev in evals:
|
|
176
|
+
eid = ev["id"]
|
|
177
|
+
ref_img_b64 = b64_img(ev.get("reference_image", ""))
|
|
178
|
+
|
|
179
|
+
with_grading = load_json(iter_dir / f"eval-{eid}" / "with_skill" / "grading.json")
|
|
180
|
+
without_grading = load_json(iter_dir / f"eval-{eid}" / "without_skill" / "grading.json")
|
|
181
|
+
with_static = load_json(iter_dir / f"eval-{eid}" / "with_skill" / "static.json")
|
|
182
|
+
without_static = load_json(iter_dir / f"eval-{eid}" / "without_skill" / "static.json")
|
|
183
|
+
|
|
184
|
+
total_evals += 1
|
|
185
|
+
|
|
186
|
+
if with_grading and with_grading.get("max_score"):
|
|
187
|
+
scored_with += with_grading.get("score", 0)
|
|
188
|
+
total_with += with_grading.get("max_score", 0)
|
|
189
|
+
if without_grading and without_grading.get("max_score"):
|
|
190
|
+
scored_without += without_grading.get("score", 0)
|
|
191
|
+
total_without += without_grading.get("max_score", 0)
|
|
192
|
+
if with_grading and with_grading.get("quality"):
|
|
193
|
+
qual_with += with_grading["quality"].get("subtotal", 0)
|
|
194
|
+
if without_grading and without_grading.get("quality"):
|
|
195
|
+
qual_without += without_grading["quality"].get("subtotal", 0)
|
|
196
|
+
|
|
197
|
+
html += '<div class="eval-case">'
|
|
198
|
+
html += f'<div class="eval-header">Eval #{eid}</div>'
|
|
199
|
+
html += f'<div class="eval-prompt">{ev.get("prompt", "")[:200]}</div>'
|
|
200
|
+
|
|
201
|
+
if ref_img_b64:
|
|
202
|
+
html += '<div class="ref-image-wrap"><div class="ref-label">Target Reference</div>'
|
|
203
|
+
html += f'<img src="{ref_img_b64}" class="ref-image" onclick="this.classList.toggle(\'zoomed\')" />'
|
|
204
|
+
html += '</div>'
|
|
205
|
+
|
|
206
|
+
html += '<div class="configs-row">'
|
|
207
|
+
html += render_config_card(iter_dir, eid, "with_skill", ev, with_grading, with_static)
|
|
208
|
+
html += render_config_card(iter_dir, eid, "without_skill", ev, without_grading, without_static)
|
|
209
|
+
html += '</div>'
|
|
210
|
+
html += '</div>'
|
|
211
|
+
|
|
212
|
+
with_pct = (scored_with / total_with * 100) if total_with else 0
|
|
213
|
+
without_pct = (scored_without / total_without * 100) if total_without else 0
|
|
214
|
+
delta = with_pct - without_pct
|
|
215
|
+
delta_color = "#4ade80" if delta > 0 else "#f87171" if delta < 0 else "#888"
|
|
216
|
+
|
|
217
|
+
qual_html = ""
|
|
218
|
+
if qual_with or qual_without:
|
|
219
|
+
qdelta = qual_with - qual_without
|
|
220
|
+
qcolor = "#4ade80" if qdelta > 0 else "#f87171" if qdelta < 0 else "#888"
|
|
221
|
+
qual_html = f' <div class="summary-item">Quality Δ: <span style="color:{qcolor}">{qdelta:+d}</span></div>\n'
|
|
222
|
+
|
|
223
|
+
summary = f'''<div class="summary-bar">
|
|
224
|
+
<div class="summary-item">With Skill: <span style="color:{score_color(scored_with, total_with) if total_with else "#888"}">{with_pct:.0f}%</span></div>
|
|
225
|
+
<div class="summary-item">Without Skill: <span style="color:{score_color(scored_without, total_without) if total_without else "#888"}">{without_pct:.0f}%</span></div>
|
|
226
|
+
<div class="summary-item">Delta: <span style="color:{delta_color}">{delta:+.0f}pp</span></div>
|
|
227
|
+
{qual_html} <div class="summary-item">Evals: {total_evals}</div>
|
|
228
|
+
</div>'''
|
|
229
|
+
|
|
230
|
+
return summary + html
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def render_trigger_table(results_path):
|
|
234
|
+
data = load_json(results_path)
|
|
235
|
+
if not data:
|
|
236
|
+
return ""
|
|
237
|
+
|
|
238
|
+
html = '<div class="trigger-section"><h2>Trigger Accuracy</h2>'
|
|
239
|
+
recall = data.get("recall", 0)
|
|
240
|
+
color = score_color(recall, 1)
|
|
241
|
+
passed_count = data.get("passed", data.get("triggered", 0))
|
|
242
|
+
html += f'<div class="trigger-summary">Recall: <span style="color:{color}">{100*recall:.0f}%</span> ({passed_count}/{data.get("total")} passed)</div>'
|
|
243
|
+
html += '<table class="trigger-table"><tr><th>#</th><th>Prompt</th><th>Should Trigger</th><th>Triggered</th><th>Result</th><th>Time</th></tr>'
|
|
244
|
+
for i, r in enumerate(data.get("results", []), 1):
|
|
245
|
+
# Support both schema variants: {id, prompt, should_trigger, pass} and {query, triggered, duration}
|
|
246
|
+
rid = r.get("id", i)
|
|
247
|
+
prompt = r.get("prompt", r.get("query", ""))
|
|
248
|
+
should_trigger = r.get("should_trigger", True) # default True for recall-only runs
|
|
249
|
+
triggered = r.get("triggered", False)
|
|
250
|
+
passed = r.get("pass", triggered if should_trigger else not triggered)
|
|
251
|
+
result_badge = '<span class="badge pass">PASS</span>' if passed else '<span class="badge fail">FAIL</span>'
|
|
252
|
+
should = "Yes" if should_trigger else "No"
|
|
253
|
+
triggered_str = "Yes" if triggered else "No"
|
|
254
|
+
elapsed = r.get("elapsed_s", r.get("duration", "?"))
|
|
255
|
+
html += f'<tr><td>{rid}</td><td class="prompt-cell">{prompt[:80]}</td><td>{should}</td><td>{triggered_str}</td><td>{result_badge}</td><td>{elapsed}s</td></tr>'
|
|
256
|
+
html += '</table></div>'
|
|
257
|
+
return html
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
CSS = """\
|
|
261
|
+
:root {
|
|
262
|
+
--ground: #090C14;
|
|
263
|
+
--surface: #0E1320;
|
|
264
|
+
--surface-hi: #131929;
|
|
265
|
+
--border: #1A2238;
|
|
266
|
+
--text: #D9E2F5;
|
|
267
|
+
--text-muted: #6B7A9E;
|
|
268
|
+
--text-dim: #3A4560;
|
|
269
|
+
--accent: #7B6FD3;
|
|
270
|
+
--accent-glow: rgba(123,111,211,0.12);
|
|
271
|
+
--pass: #4DB87C;
|
|
272
|
+
--pass-bg: rgba(77,184,124,0.10);
|
|
273
|
+
--fail: #E05555;
|
|
274
|
+
--fail-bg: rgba(224,85,85,0.10);
|
|
275
|
+
--score-with: #9B8EE8;
|
|
276
|
+
--score-without: #5A6480;
|
|
277
|
+
}
|
|
278
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
279
|
+
body { background: var(--ground); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.5; padding: 20px 24px; }
|
|
280
|
+
h1 { font-size: 15px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 20px; }
|
|
281
|
+
h2 { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 24px 0 10px; }
|
|
282
|
+
|
|
283
|
+
/* Tabs */
|
|
284
|
+
.tabs { display: flex; gap: 6px; margin-bottom: 20px; }
|
|
285
|
+
.tab { background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); padding: 5px 14px; border-radius: 5px; cursor: pointer; font-size: 12px; font-weight: 500; transition: color .15s, border-color .15s; }
|
|
286
|
+
.tab:hover { color: var(--text); border-color: #2A3558; }
|
|
287
|
+
.tab.active { background: var(--surface-hi); border-color: var(--accent); color: var(--text); }
|
|
288
|
+
|
|
289
|
+
/* Summary strip */
|
|
290
|
+
.summary-bar { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 20px; }
|
|
291
|
+
.summary-item { flex: 1; padding: 12px 16px; border-right: 1px solid var(--border); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
|
|
292
|
+
.summary-item:last-child { border-right: none; }
|
|
293
|
+
.summary-item span { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--text); margin-top: 2px; }
|
|
294
|
+
|
|
295
|
+
/* Eval card */
|
|
296
|
+
.eval-case { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 24px; overflow: hidden; }
|
|
297
|
+
.eval-header { padding: 10px 16px; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
|
|
298
|
+
.eval-prompt { padding: 12px 16px; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border); line-height: 1.55; }
|
|
299
|
+
|
|
300
|
+
/* Reference image */
|
|
301
|
+
.ref-image-wrap { padding: 16px; background: #07090F; border-bottom: 1px solid var(--border); }
|
|
302
|
+
.ref-label { font-size: 10px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
|
|
303
|
+
.ref-image { max-height: 260px; width: auto; border-radius: 10px; border: 1px solid #1E2840; cursor: zoom-in; display: block; }
|
|
304
|
+
.ref-image.zoomed { max-height: none; cursor: zoom-out; }
|
|
305
|
+
|
|
306
|
+
/* Side-by-side config columns */
|
|
307
|
+
.configs-row { display: grid; grid-template-columns: 1fr 1fr; }
|
|
308
|
+
.config-card { padding: 16px; border-right: 1px solid var(--border); position: relative; }
|
|
309
|
+
.config-card:last-child { border-right: none; }
|
|
310
|
+
|
|
311
|
+
/* The aesthetic risk: the with_skill card gets a faint violet radial glow from its header edge */
|
|
312
|
+
.config-card:first-child::before {
|
|
313
|
+
content: "";
|
|
314
|
+
position: absolute;
|
|
315
|
+
top: 0; left: 0; right: 0; height: 180px;
|
|
316
|
+
background: radial-gradient(ellipse 80% 120px at 50% 0, var(--accent-glow), transparent 70%);
|
|
317
|
+
pointer-events: none;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.config-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
|
|
321
|
+
.config-label { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; }
|
|
322
|
+
.config-label.with { background: rgba(123,111,211,0.15); color: var(--accent); border: 1px solid rgba(123,111,211,0.25); }
|
|
323
|
+
.config-label.without { background: var(--surface-hi); color: var(--text-muted); border: 1px solid var(--border); }
|
|
324
|
+
.score { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-left: auto; }
|
|
325
|
+
.config-card:first-child .score { color: var(--score-with); }
|
|
326
|
+
.config-card:last-child .score { color: var(--score-without); }
|
|
327
|
+
|
|
328
|
+
/* Badges */
|
|
329
|
+
.badge { display: inline-flex; align-items: center; font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 3px; letter-spacing: 0.05em; text-transform: uppercase; }
|
|
330
|
+
.badge.pass { background: var(--pass-bg); color: var(--pass); border: 1px solid rgba(77,184,124,0.2); }
|
|
331
|
+
.badge.fail { background: var(--fail-bg); color: var(--fail); border: 1px solid rgba(224,85,85,0.2); }
|
|
332
|
+
.badge.unknown { background: var(--surface-hi); color: var(--text-dim); border: 1px solid var(--border); }
|
|
333
|
+
|
|
334
|
+
/* Screenshots */
|
|
335
|
+
.screenshot-wrap { margin-bottom: 14px; }
|
|
336
|
+
.plat-label { font-size: 9px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }
|
|
337
|
+
.screenshot { max-width: 100%; max-height: 380px; width: auto; border-radius: 14px; border: 1px solid #1A2540; cursor: zoom-in; display: block; box-shadow: 0 4px 24px rgba(0,0,0,0.5); }
|
|
338
|
+
.screenshot.zoomed { max-height: none; cursor: zoom-out; }
|
|
339
|
+
.no-screenshot { color: var(--text-dim); font-size: 11px; padding: 16px; background: var(--surface-hi); border-radius: 6px; text-align: center; border: 1px dashed var(--border); }
|
|
340
|
+
|
|
341
|
+
/* Expectations */
|
|
342
|
+
.exp-list { list-style: none; margin-top: 12px; }
|
|
343
|
+
.exp-list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
|
|
344
|
+
.exp-list li:last-child { border-bottom: none; }
|
|
345
|
+
.evidence { font-size: 10px; color: var(--text-dim); width: 100%; line-height: 1.5; margin-top: 2px; }
|
|
346
|
+
|
|
347
|
+
/* Reference match block */
|
|
348
|
+
.ref-match { margin-top: 12px; font-size: 12px; color: var(--text-muted); background: var(--surface-hi); padding: 10px 12px; border-radius: 6px; border-left: 2px solid var(--accent); }
|
|
349
|
+
.ref-match b { color: var(--text); }
|
|
350
|
+
|
|
351
|
+
/* Quality rubric */
|
|
352
|
+
.quality-block { margin-top: 12px; background: var(--surface-hi); border: 1px solid var(--border); border-radius: 6px; padding: 12px; }
|
|
353
|
+
.quality-header { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
|
|
354
|
+
.quality-dim { margin-bottom: 10px; }
|
|
355
|
+
.quality-dim:last-of-type { margin-bottom: 0; }
|
|
356
|
+
.dim-label { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
|
|
357
|
+
.dim-label span { font-variant-numeric: tabular-nums; }
|
|
358
|
+
.dim-bar-wrap { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
|
|
359
|
+
.dim-bar { height: 100%; border-radius: 2px; }
|
|
360
|
+
.dim-evidence { font-size: 10px; color: var(--text-dim); margin-top: 3px; line-height: 1.45; }
|
|
361
|
+
.quality-summary { font-size: 11px; color: var(--text-dim); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
|
|
362
|
+
.reviewer-notes { margin-top: 10px; font-size: 11px; color: var(--text-dim); background: var(--ground); padding: 8px 10px; border-radius: 4px; }
|
|
363
|
+
|
|
364
|
+
/* Trigger table */
|
|
365
|
+
.trigger-section { margin-top: 32px; }
|
|
366
|
+
.trigger-summary { font-size: 13px; margin-bottom: 12px; color: var(--text-muted); }
|
|
367
|
+
.trigger-table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
|
368
|
+
.trigger-table th { background: var(--surface); padding: 9px 10px; text-align: left; font-size: 10px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
|
|
369
|
+
.trigger-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-muted); vertical-align: top; }
|
|
370
|
+
.trigger-table tr:last-child td { border-bottom: none; }
|
|
371
|
+
.trigger-table tr:hover td { background: var(--surface-hi); }
|
|
372
|
+
.prompt-cell { max-width: 320px; word-break: break-word; color: var(--text); }
|
|
373
|
+
@media (prefers-reduced-motion: reduce) { .dim-bar { transition: none; } }
|
|
374
|
+
"""
|
|
375
|
+
|
|
376
|
+
JS = """\
|
|
377
|
+
function showTab(i) {
|
|
378
|
+
document.querySelectorAll('.panel').forEach((p, idx) => { p.style.display = idx === i ? 'block' : 'none'; });
|
|
379
|
+
document.querySelectorAll('.tab').forEach((t, idx) => { t.classList.toggle('active', idx === i); });
|
|
380
|
+
localStorage.setItem('expo-eval-tab', i);
|
|
381
|
+
}
|
|
382
|
+
(function() {
|
|
383
|
+
const saved = parseInt(localStorage.getItem('expo-eval-tab') || '0', 10);
|
|
384
|
+
if (saved > 0) showTab(saved);
|
|
385
|
+
})();
|
|
386
|
+
"""
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
def build_page(ws, title, artifact=False):
|
|
390
|
+
iterations = sorted(p for p in ws.glob("iteration-*") if p.is_dir())
|
|
391
|
+
if not iterations:
|
|
392
|
+
return f"<p>No iteration directories found under {ws}.</p>"
|
|
393
|
+
|
|
394
|
+
tabs_html = ""
|
|
395
|
+
panels_html = ""
|
|
396
|
+
for i, it in enumerate(iterations):
|
|
397
|
+
active = "active" if i == 0 else ""
|
|
398
|
+
tabs_html += f'<button class="tab {active}" onclick="showTab({i})" id="tab-{i}">{it.name}</button>'
|
|
399
|
+
content = render_iteration(it)
|
|
400
|
+
panels_html += f'<div class="panel" id="panel-{i}" style="display:{"block" if i == 0 else "none"}">{content}</div>'
|
|
401
|
+
|
|
402
|
+
trigger_html = render_trigger_table(ws / "trigger-evals" / "trigger_results.json")
|
|
403
|
+
body_content = f'<h1>{title}</h1>\n<div class="tabs">{tabs_html}</div>\n{panels_html}\n{trigger_html}'
|
|
404
|
+
|
|
405
|
+
if artifact:
|
|
406
|
+
return f'<title>{title}</title>\n<style>\n{CSS}</style>\n{body_content}\n<script>\n{JS}</script>'
|
|
407
|
+
return f'''<!DOCTYPE html>
|
|
408
|
+
<html lang="en">
|
|
409
|
+
<head>
|
|
410
|
+
<meta charset="UTF-8" />
|
|
411
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
412
|
+
<title>{title}</title>
|
|
413
|
+
<style>
|
|
414
|
+
{CSS}
|
|
415
|
+
</style>
|
|
416
|
+
</head>
|
|
417
|
+
<body>
|
|
418
|
+
{body_content}
|
|
419
|
+
<script>
|
|
420
|
+
{JS}
|
|
421
|
+
</script>
|
|
422
|
+
</body>
|
|
423
|
+
</html>'''
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def main():
|
|
427
|
+
args = [a for a in sys.argv[1:] if a != "--artifact"]
|
|
428
|
+
artifact = "--artifact" in sys.argv
|
|
429
|
+
if not args:
|
|
430
|
+
print("usage: generate_viewer.py <workspace-root> [--artifact]", file=sys.stderr)
|
|
431
|
+
sys.exit(1)
|
|
432
|
+
|
|
433
|
+
ws = Path(args[0]).resolve()
|
|
434
|
+
skill = ws.name.replace("expo-skill-eval-", "")
|
|
435
|
+
title = f"{skill} Skill Eval"
|
|
436
|
+
html = build_page(ws, title, artifact=artifact)
|
|
437
|
+
|
|
438
|
+
if artifact:
|
|
439
|
+
out = ws / "viewer_artifact.html"
|
|
440
|
+
out.write_text(html)
|
|
441
|
+
print(f"Artifact viewer written: {out}")
|
|
442
|
+
else:
|
|
443
|
+
out = ws / "viewer.html"
|
|
444
|
+
out.write_text(html)
|
|
445
|
+
print(f"Viewer written: {out}")
|
|
446
|
+
webbrowser.open("file://" + str(out))
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
if __name__ == "__main__":
|
|
450
|
+
main()
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Print the latest Expo SDK major version.
|
|
3
|
+
#
|
|
4
|
+
# Usage: latest-sdk.sh
|
|
5
|
+
#
|
|
6
|
+
# The `expo` package's major version IS the SDK version (expo@56.x -> SDK 56).
|
|
7
|
+
# Uses bun to run `npm view expo dist-tags --json` (so it honors the local npm
|
|
8
|
+
# registry / proxy / auth config rather than hardcoding registry.npmjs.org),
|
|
9
|
+
# JSON.parse the result, and take the major via the `semver` package (falling
|
|
10
|
+
# back to a numeric split if semver can't be resolved). Run via the skill's
|
|
11
|
+
# `bash *expo-skill-eval/scripts/*` rule so SDK detection stays prompt-free —
|
|
12
|
+
# the npm child runs under bun, not as its own Bash tool call.
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
|
|
15
|
+
exec bun -e '
|
|
16
|
+
let out;
|
|
17
|
+
try {
|
|
18
|
+
out = await Bun.$`npm view expo dist-tags --json`.text();
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.error("error: `npm view expo` failed: " + (e?.message ?? e));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
let latest;
|
|
24
|
+
try {
|
|
25
|
+
latest = JSON.parse(out)?.latest;
|
|
26
|
+
} catch {
|
|
27
|
+
console.error("error: could not JSON.parse `npm view` output");
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
if (!latest) {
|
|
31
|
+
console.error("error: no `latest` dist-tag for expo");
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
let major;
|
|
35
|
+
try {
|
|
36
|
+
const semver = await import("semver");
|
|
37
|
+
major = (semver.default ?? semver).major(latest);
|
|
38
|
+
} catch {
|
|
39
|
+
major = Number.parseInt(String(latest).split(".")[0], 10);
|
|
40
|
+
}
|
|
41
|
+
if (!Number.isInteger(major)) {
|
|
42
|
+
console.error(`error: could not parse SDK major from "${latest}"`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
console.log(major);
|
|
46
|
+
'
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Create an Expo app fixture for an eval run.
|
|
3
|
+
#
|
|
4
|
+
# Usage: make-fixture.sh <project-path> [sdk-version] [variant]
|
|
5
|
+
# project-path Where the app should end up (must not exist yet)
|
|
6
|
+
# sdk-version Expo SDK major version, e.g. "56". Omit for the latest template.
|
|
7
|
+
# variant "clean" (default) runs the template's reset-project script so
|
|
8
|
+
# executors start from a blank app instead of the example
|
|
9
|
+
# screens. "full" keeps the example tabs (Home/Explore) - use
|
|
10
|
+
# it for evals whose prompt assumes an existing app.
|
|
11
|
+
#
|
|
12
|
+
# One pristine app is created per SDK version + variant with
|
|
13
|
+
# `bunx create-expo-app -t default@sdk-<version>` and cached under
|
|
14
|
+
# $EXPO_SKILL_EVAL_CACHE (default ~/.cache/expo-skill-eval/fixtures).
|
|
15
|
+
# Each call clones the cache with APFS copy-on-write, so only the first
|
|
16
|
+
# call per SDK version pays the install cost.
|
|
17
|
+
set -euo pipefail
|
|
18
|
+
|
|
19
|
+
PROJECT_PATH="${1:?usage: make-fixture.sh <project-path> [sdk-version] [variant]}"
|
|
20
|
+
SDK_VERSION="${2:-}"
|
|
21
|
+
VARIANT="${3:-clean}"
|
|
22
|
+
if [[ "$VARIANT" != "clean" && "$VARIANT" != "full" ]]; then
|
|
23
|
+
echo "error: variant must be 'clean' or 'full', got '$VARIANT'" >&2
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
CACHE_ROOT="${EXPO_SKILL_EVAL_CACHE:-$HOME/.cache/expo-skill-eval/fixtures}"
|
|
27
|
+
|
|
28
|
+
if [[ -e "$PROJECT_PATH" ]]; then
|
|
29
|
+
echo "error: $PROJECT_PATH already exists" >&2
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
TEMPLATE="default"
|
|
34
|
+
CACHE_KEY="latest"
|
|
35
|
+
if [[ -n "$SDK_VERSION" ]]; then
|
|
36
|
+
TEMPLATE="default@sdk-${SDK_VERSION}"
|
|
37
|
+
CACHE_KEY="sdk-${SDK_VERSION}"
|
|
38
|
+
fi
|
|
39
|
+
if [[ "$VARIANT" == "clean" ]]; then
|
|
40
|
+
CACHE_KEY="${CACHE_KEY}-clean"
|
|
41
|
+
fi
|
|
42
|
+
CACHE_DIR="$CACHE_ROOT/$CACHE_KEY"
|
|
43
|
+
|
|
44
|
+
if [[ ! -d "$CACHE_DIR" ]]; then
|
|
45
|
+
echo "building fixture cache for template '$TEMPLATE'..." >&2
|
|
46
|
+
mkdir -p "$CACHE_ROOT"
|
|
47
|
+
TMP_DIR="$(mktemp -d)"
|
|
48
|
+
trap 'rm -rf "$TMP_DIR"' EXIT
|
|
49
|
+
(cd "$TMP_DIR" && bunx create-expo-app --yes --template "$TEMPLATE" fixture) >&2
|
|
50
|
+
if [[ "$VARIANT" == "clean" ]]; then
|
|
51
|
+
# Strip the example screens so executors start from a blank app.
|
|
52
|
+
# Answer "n" to the "move to /example?" prompt - delete them instead.
|
|
53
|
+
(cd "$TMP_DIR/fixture" && echo n | bun run reset-project) >&2
|
|
54
|
+
fi
|
|
55
|
+
# Pin a stable iOS bundle identifier and Android package. The default template
|
|
56
|
+
# leaves both unset, so a dev-build run (`expo run:ios`/`expo run:android`)
|
|
57
|
+
# would prompt for them - which fails in the snapshot scripts' non-interactive
|
|
58
|
+
# mode - and the snapshot scripts need a known id to relaunch the app by.
|
|
59
|
+
(cd "$TMP_DIR/fixture" && bun -e '
|
|
60
|
+
const f = "app.json";
|
|
61
|
+
const j = await Bun.file(f).json();
|
|
62
|
+
j.expo ??= {};
|
|
63
|
+
j.expo.ios ??= {};
|
|
64
|
+
j.expo.android ??= {};
|
|
65
|
+
j.expo.ios.bundleIdentifier ??= "com.exposkilleval.fixture";
|
|
66
|
+
j.expo.android.package ??= "com.exposkilleval.fixture";
|
|
67
|
+
await Bun.write(f, JSON.stringify(j, null, 2) + "\n");
|
|
68
|
+
') >&2
|
|
69
|
+
# The CLI normally generates expo-env.d.ts on first `expo start`; the static
|
|
70
|
+
# gate runs tsc before any start, so create it up front (it provides the
|
|
71
|
+
# CSS-module and Metro type declarations from expo/types).
|
|
72
|
+
printf '/// <reference types="expo/types" />\n' >"$TMP_DIR/fixture/expo-env.d.ts"
|
|
73
|
+
# expo-dev-client is required for dev-build snapshots: it registers the
|
|
74
|
+
# expo-development-client URL scheme and enables custom Metro port connections
|
|
75
|
+
# (expo run:ios/android --port N opens the app via a deep link that the dev
|
|
76
|
+
# client handles). Without it, a custom port deep link may not open the app.
|
|
77
|
+
(cd "$TMP_DIR/fixture" && bunx expo install expo-dev-client) >&2
|
|
78
|
+
# First `expo lint` self-installs eslint + eslint-config-expo and writes
|
|
79
|
+
# eslint.config.js if missing; it may exit non-zero on that bootstrap run.
|
|
80
|
+
(cd "$TMP_DIR/fixture" && CI=1 bunx expo lint) >&2 || true
|
|
81
|
+
printf '.eval-static/\n' >>"$TMP_DIR/fixture/.gitignore"
|
|
82
|
+
mv "$TMP_DIR/fixture" "$CACHE_DIR"
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
mkdir -p "$(dirname "$PROJECT_PATH")"
|
|
86
|
+
# -c uses APFS clonefile (instant, no extra disk); fall back to a plain copy.
|
|
87
|
+
cp -Rc "$CACHE_DIR" "$PROJECT_PATH" 2>/dev/null || cp -R "$CACHE_DIR" "$PROJECT_PATH"
|
|
88
|
+
|
|
89
|
+
# Fresh git history so `git diff` in the app shows exactly what the executor changed.
|
|
90
|
+
rm -rf "$PROJECT_PATH/.git"
|
|
91
|
+
git -C "$PROJECT_PATH" init -q
|
|
92
|
+
git -C "$PROJECT_PATH" add -A
|
|
93
|
+
git -C "$PROJECT_PATH" commit -qm "fixture: pristine $TEMPLATE template" --no-verify
|
|
94
|
+
|
|
95
|
+
echo "$PROJECT_PATH"
|