@agent-native/recap-cli 0.4.7 → 0.5.1
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/recap.d.ts +10 -1
- package/dist/recap.d.ts.map +1 -1
- package/dist/recap.js +91 -31
- package/dist/recap.js.map +1 -1
- package/dist/workflows/pr-visual-recap.yml +19 -3
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ name: PR Visual Recap
|
|
|
6
6
|
|
|
7
7
|
on:
|
|
8
8
|
pull_request:
|
|
9
|
-
types: [opened, synchronize, reopened, ready_for_review, closed]
|
|
9
|
+
types: [opened, synchronize, reopened, ready_for_review, labeled, closed]
|
|
10
10
|
|
|
11
11
|
permissions:
|
|
12
12
|
contents: read
|
|
@@ -18,12 +18,14 @@ concurrency:
|
|
|
18
18
|
env:
|
|
19
19
|
VISUAL_RECAP_AGENT: ${{ vars.VISUAL_RECAP_AGENT || 'claude' }}
|
|
20
20
|
VISUAL_RECAP_BASE_URL: ${{ vars.VISUAL_RECAP_BASE_URL || '' }}
|
|
21
|
+
VISUAL_RECAP_REQUIRED_LABELS: ${{ vars.VISUAL_RECAP_REQUIRED_LABELS || '' }}
|
|
21
22
|
VISUAL_RECAP_SKILL_SOURCE: ${{ vars.VISUAL_RECAP_SKILL_SOURCE || 'auto' }}
|
|
22
23
|
VISUAL_RECAP_SECRET_SCAN: ${{ vars.VISUAL_RECAP_SECRET_SCAN || 'high-confidence' }}
|
|
23
24
|
|
|
24
25
|
jobs:
|
|
25
26
|
gate:
|
|
26
27
|
name: Gate
|
|
28
|
+
if: github.event.action != 'labeled' || vars.VISUAL_RECAP_REQUIRED_LABELS != ''
|
|
27
29
|
# A custom plain-label runner is allowed only for trusted same-repo authors.
|
|
28
30
|
# Fork and untrusted PRs are forced onto GitHub-hosted ubuntu-latest before
|
|
29
31
|
# any step starts. The only fromJSON input is this static association list.
|
|
@@ -50,6 +52,7 @@ jobs:
|
|
|
50
52
|
VISUAL_RECAP_BASE_URL: ${{ env.VISUAL_RECAP_BASE_URL }}
|
|
51
53
|
VISUAL_RECAP_MODEL: ${{ vars.VISUAL_RECAP_MODEL }}
|
|
52
54
|
VISUAL_RECAP_RUNS_ON: ${{ vars.VISUAL_RECAP_RUNS_ON || '"ubuntu-latest"' }}
|
|
55
|
+
VISUAL_RECAP_REQUIRED_LABELS: ${{ env.VISUAL_RECAP_REQUIRED_LABELS }}
|
|
53
56
|
VISUAL_RECAP_SKILL_SOURCE: ${{ env.VISUAL_RECAP_SKILL_SOURCE }}
|
|
54
57
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
55
58
|
with:
|
|
@@ -62,6 +65,19 @@ jobs:
|
|
|
62
65
|
if (pr && context.payload.action === 'closed' && !pr.merged) {
|
|
63
66
|
reasons.push('closed without merge');
|
|
64
67
|
}
|
|
68
|
+
const requiredLabels = (process.env.VISUAL_RECAP_REQUIRED_LABELS || '')
|
|
69
|
+
.split(',')
|
|
70
|
+
.map((label) => label.trim().toLowerCase())
|
|
71
|
+
.filter(Boolean);
|
|
72
|
+
if (pr && requiredLabels.length > 0) {
|
|
73
|
+
const prLabels = new Set((Array.isArray(pr.labels) ? pr.labels : [])
|
|
74
|
+
.map((label) => typeof label === 'string' ? label : label && label.name)
|
|
75
|
+
.filter(Boolean)
|
|
76
|
+
.map((label) => String(label).toLowerCase()));
|
|
77
|
+
if (!requiredLabels.some((label) => prLabels.has(label))) {
|
|
78
|
+
reasons.push(`missing required recap label (${requiredLabels.join(', ')})`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
65
81
|
|
|
66
82
|
// Fork PRs only receive repo secrets when the org/repo opts into
|
|
67
83
|
// GitHub's "Send secrets to workflows from pull requests" setting
|
|
@@ -966,13 +982,13 @@ jobs:
|
|
|
966
982
|
SHOT_STATUS=$(LIGHT_SHOT_JSON="$LIGHT_SHOT_JSON" DARK_SHOT_JSON="$DARK_SHOT_JSON" node <<'NODE'
|
|
967
983
|
const parse = (raw) => { try { return JSON.parse(raw || "{}"); } catch { return { ok: false, reason: "invalid shot JSON" }; } };
|
|
968
984
|
const shots = [["light", parse(process.env.LIGHT_SHOT_JSON)], ["dark", parse(process.env.DARK_SHOT_JSON)]];
|
|
969
|
-
const
|
|
985
|
+
const hasAllImages = shots.every(([, shot]) => typeof shot.imageUrl === "string" && shot.imageUrl.trim());
|
|
970
986
|
const reasons = shots.flatMap(([label, shot]) => {
|
|
971
987
|
if (typeof shot.reason === "string" && shot.reason.trim()) return [`${label}: ${shot.reason.trim()}`];
|
|
972
988
|
if (!(typeof shot.imageUrl === "string" && shot.imageUrl.trim())) return [`${label}: no imageUrl returned`];
|
|
973
989
|
return [];
|
|
974
990
|
});
|
|
975
|
-
process.stdout.write(JSON.stringify({ ok:
|
|
991
|
+
process.stdout.write(JSON.stringify({ ok: hasAllImages, reason: hasAllImages ? "" : reasons.join("; ").slice(0, 1000) }));
|
|
976
992
|
NODE
|
|
977
993
|
)
|
|
978
994
|
SHOT_OK=$(node -e 'try{process.stdout.write(JSON.parse(process.argv[1]).ok===true?"true":"false")}catch{process.stdout.write("false")}' "$SHOT_STATUS")
|
package/package.json
CHANGED