@hxp-tools/godplans 0.0.0-stage → 2.0.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/CHANGELOG.md +1202 -0
- package/LICENSE +21 -0
- package/PROMPT.md +4006 -0
- package/README.md +245 -2
- package/bin/godplans.js +93 -0
- package/docs/ARCHITECTURE.md +136 -0
- package/docs/RELEASING.md +107 -0
- package/docs/assets/badge-approved.svg +12 -0
- package/docs/assets/badge-done.svg +11 -0
- package/docs/assets/badge-graded.svg +12 -0
- package/docs/assets/badge-validated.svg +10 -0
- package/docs/assets/hero.svg +37 -0
- package/docs/assets/quest-map.svg +53 -0
- package/evals/README.md +295 -0
- package/evals/cases/brownfield-cli/EXPECTATIONS +15 -0
- package/evals/cases/brownfield-cli/INPUT/package.json +9 -0
- package/evals/cases/brownfield-cli/INPUT/src/cli.js +4 -0
- package/evals/cases/brownfield-cli/INPUT/src/format.js +3 -0
- package/evals/cases/brownfield-cli/INPUT/test/cli.test.js +7 -0
- package/evals/cases/brownfield-cli/REQUEST.baseline.md +10 -0
- package/evals/cases/brownfield-cli/REQUEST.md +10 -0
- package/evals/cases/compliance-refusal/EXPECTATIONS +4 -0
- package/evals/cases/compliance-refusal/REQUEST.baseline.md +9 -0
- package/evals/cases/compliance-refusal/REQUEST.md +8 -0
- package/evals/cases/greenfield-saas/EXPECTATIONS +21 -0
- package/evals/cases/greenfield-saas/REQUEST.baseline.md +11 -0
- package/evals/cases/greenfield-saas/REQUEST.md +11 -0
- package/evals/cases/nested-pillars/EXPECTATIONS +12 -0
- package/evals/cases/nested-pillars/REQUEST.baseline.md +10 -0
- package/evals/cases/nested-pillars/REQUEST.md +11 -0
- package/evals/cases/observability-evidence/EXPECTATIONS +10 -0
- package/evals/cases/observability-evidence/REQUEST.baseline.md +10 -0
- package/evals/cases/observability-evidence/REQUEST.md +11 -0
- package/evals/cases/product-business/EXPECTATIONS +18 -0
- package/evals/cases/product-business/REQUEST.baseline.md +13 -0
- package/evals/cases/product-business/REQUEST.md +14 -0
- package/evals/cases/product-form-routing/EXPECTATIONS +13 -0
- package/evals/cases/product-form-routing/REQUEST.baseline.md +11 -0
- package/evals/cases/product-form-routing/REQUEST.md +11 -0
- package/evals/cases/prose-integrity/EXPECTATIONS +19 -0
- package/evals/cases/prose-integrity/REQUEST.baseline.md +19 -0
- package/evals/cases/prose-integrity/REQUEST.md +20 -0
- package/evals/cases/replan-preserves-history/EXPECTATIONS +9 -0
- package/evals/cases/replan-preserves-history/INPUT/.godplans/PLAN.mdx +115 -0
- package/evals/cases/replan-preserves-history/INPUT/package.json +5 -0
- package/evals/cases/replan-preserves-history/REQUEST.baseline.md +10 -0
- package/evals/cases/replan-preserves-history/REQUEST.md +10 -0
- package/evals/cases/stale-prepublication/EXPECTATIONS +10 -0
- package/evals/cases/stale-prepublication/REQUEST.baseline.md +12 -0
- package/evals/cases/stale-prepublication/REQUEST.md +13 -0
- package/evals/cases/stale-source-evidence/EXPECTATIONS +10 -0
- package/evals/cases/stale-source-evidence/INPUT/package.json +8 -0
- package/evals/cases/stale-source-evidence/REQUEST.baseline.md +11 -0
- package/evals/cases/stale-source-evidence/REQUEST.md +12 -0
- package/evals/cases/weekend-library/EXPECTATIONS +19 -0
- package/evals/cases/weekend-library/REQUEST.baseline.md +10 -0
- package/evals/cases/weekend-library/REQUEST.md +11 -0
- package/evals/cases-roster.txt +19 -0
- package/evals/external/GRADE.schema.json +39 -0
- package/evals/external/README.md +42 -0
- package/evals/external/RUBRIC.md +32 -0
- package/evals/metrics/context-cost.json +154 -0
- package/evals/outcomes/README.md +65 -0
- package/evals/outcomes/cases/tenant-notes-api/REQUEST.baseline.md +14 -0
- package/evals/outcomes/cases/tenant-notes-api/REQUEST.md +13 -0
- package/evals/outcomes/cases/tenant-notes-api/VERIFY.sh +13 -0
- package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/README.md +93 -0
- package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/treatment/plan/PLAN.json +547 -0
- package/evals/runners/claude-baseline.sh +4 -0
- package/evals/runners/claude-grade.sh +3 -0
- package/evals/runners/claude.sh +4 -0
- package/evals/runners/codex-baseline.sh +181 -0
- package/evals/runners/codex-builder.sh +96 -0
- package/evals/runners/codex-godaudits.sh +84 -0
- package/evals/runners/codex.sh +147 -0
- package/evals/runners/gemini-baseline.sh +4 -0
- package/evals/runners/gemini-grade.sh +3 -0
- package/evals/runners/gemini.sh +4 -0
- package/evals/runners/vendor-cli.sh +257 -0
- package/evals/runners/vendor-grade.sh +82 -0
- package/install.sh +323 -0
- package/package.json +91 -4
- package/requirements/skills-ref.txt +2 -0
- package/scripts/build-catalog.js +114 -0
- package/scripts/build-prompt.sh +257 -0
- package/scripts/context-metrics.js +118 -0
- package/scripts/eval-external.js +226 -0
- package/scripts/eval-matrix.sh +172 -0
- package/scripts/eval-outcome.js +143 -0
- package/scripts/eval.sh +321 -0
- package/scripts/lint-parity.js +331 -0
- package/scripts/lint.sh +743 -0
- package/scripts/outcome-summary.js +126 -0
- package/scripts/release-check.sh +108 -0
- package/scripts/release-prepare.js +41 -0
- package/scripts/summarize-eval.js +91 -0
- package/scripts/summarize-matrix.js +101 -0
- package/scripts/version-sync.js +65 -0
- package/skills/godplans/SKILL.md +192 -0
- package/skills/godplans/references/agent-memory.md +168 -0
- package/skills/godplans/references/architecture.md +189 -0
- package/skills/godplans/references/build.md +130 -0
- package/skills/godplans/references/business.md +252 -0
- package/skills/godplans/references/code-quality.md +165 -0
- package/skills/godplans/references/compliance.md +59 -0
- package/skills/godplans/references/database.md +157 -0
- package/skills/godplans/references/deploy.md +146 -0
- package/skills/godplans/references/discovery.md +297 -0
- package/skills/godplans/references/doc-set.md +243 -0
- package/skills/godplans/references/exemplar.md +228 -0
- package/skills/godplans/references/launch.md +162 -0
- package/skills/godplans/references/llm.md +132 -0
- package/skills/godplans/references/observe.md +178 -0
- package/skills/godplans/references/plan-format.md +340 -0
- package/skills/godplans/references/product.md +130 -0
- package/skills/godplans/references/repo.md +184 -0
- package/skills/godplans/references/roadmap.md +158 -0
- package/skills/godplans/references/security.md +156 -0
- package/skills/godplans/references/seo.md +133 -0
- package/skills/godplans/references/stack.md +133 -0
- package/skills/godplans/references/style-genome.md +198 -0
- package/skills/godplans/references/ui.md +153 -0
- package/skills/godplans/references/ux.md +150 -0
- package/skills/godplans/schemas/PLAN.schema.json +275 -0
- package/skills/godplans/schemas/PLAN.v1.schema.json +258 -0
- package/skills/godplans/scripts/plan-halflife.sh +76 -0
- package/skills/godplans/scripts/style-stats.py +630 -0
- package/skills/godplans/scripts/validate-plan.sh +1709 -0
- package/skills/godplans/templates/PLAN.template.mdx +269 -0
- package/tests/agent-memory-guidance.sh +32 -0
- package/tests/build-catalog.sh +81 -0
- package/tests/codex-runner.sh +139 -0
- package/tests/eval-harness.sh +377 -0
- package/tests/evidence-harnesses.sh +243 -0
- package/tests/fixtures/plan-json-v1-1.13.0.json +472 -0
- package/tests/install-regression.sh +246 -0
- package/tests/lib/plan-schema-check.js +163 -0
- package/tests/lint-selftest.sh +582 -0
- package/tests/package-contents.sh +143 -0
- package/tests/portable-prompt.test.sh +261 -0
- package/tests/release-tooling.sh +204 -0
- package/tests/run.sh +14 -0
- package/tests/script-usage.sh +37 -0
- package/tests/style-stats.sh +170 -0
- package/tests/validate-plan.sh +1970 -0
- package/tests/vendor-runner.sh +291 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Package contents. By default (npm test) every packed path must be tracked or
|
|
3
|
+
# an untracked file git does not ignore, so a new case or reference that is
|
|
4
|
+
# still being written passes while ignored junk (bytecode, logs, editor
|
|
5
|
+
# backups) fails. With --tracked-only (release-check.sh) every packed path must
|
|
6
|
+
# be tracked, because a release ships exactly what is committed.
|
|
7
|
+
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
|
|
10
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
11
|
+
TMP="$(mktemp -d)"
|
|
12
|
+
trap 'rm -rf "$TMP"' EXIT HUP INT TERM
|
|
13
|
+
|
|
14
|
+
fail() {
|
|
15
|
+
echo "FAIL [package-contents] $*" >&2
|
|
16
|
+
exit 1
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
MODE=working-tree
|
|
20
|
+
case "${1:-}" in
|
|
21
|
+
'') ;;
|
|
22
|
+
--tracked-only) MODE=tracked ;;
|
|
23
|
+
*) fail "unknown option: $1 (expected --tracked-only)" ;;
|
|
24
|
+
esac
|
|
25
|
+
|
|
26
|
+
# packed_strays DIR MODE OUT: write the npm pack manifest for the package in
|
|
27
|
+
# DIR to OUT.json and the packed paths git does not allow under MODE to OUT,
|
|
28
|
+
# one per line. npm packs from the filesystem and ships ignored files under a
|
|
29
|
+
# "files" entry, so git is the reference for what the package may contain.
|
|
30
|
+
packed_strays() {
|
|
31
|
+
(cd "$1" && npm pack --dry-run --json --ignore-scripts) > "$3.json"
|
|
32
|
+
if [ "$2" = tracked ]; then
|
|
33
|
+
git -C "$1" ls-files -z > "$3.allowed"
|
|
34
|
+
else
|
|
35
|
+
git -C "$1" ls-files -z --cached --others --exclude-standard > "$3.allowed"
|
|
36
|
+
fi
|
|
37
|
+
node - "$3.json" "$3.allowed" > "$3" <<'NODE'
|
|
38
|
+
const fs = require('fs');
|
|
39
|
+
const [packFile, allowedFile] = process.argv.slice(2);
|
|
40
|
+
const allowed = new Set(fs.readFileSync(allowedFile, 'utf8').split('\0').filter(Boolean));
|
|
41
|
+
const packed = JSON.parse(fs.readFileSync(packFile, 'utf8'))[0].files.map((entry) => entry.path);
|
|
42
|
+
for (const file of packed.filter((path) => !allowed.has(path)).sort()) process.stdout.write(`${file}\n`);
|
|
43
|
+
NODE
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Prove both modes against a scratch repository that packs with the real
|
|
47
|
+
# "files" list before trusting a clean result from them: an untracked new file
|
|
48
|
+
# passes the working-tree mode and fails the tracked mode, an ignored file fails
|
|
49
|
+
# both, and Python bytecode is never packed at all.
|
|
50
|
+
FIXTURE="$TMP/fixture"
|
|
51
|
+
mkdir -p "$FIXTURE/skills/demo/scripts/__pycache__"
|
|
52
|
+
node -e '
|
|
53
|
+
const manifest = require(process.argv[1]);
|
|
54
|
+
process.stdout.write(JSON.stringify({ name: "fixture", version: "0.0.0", private: true, files: manifest.files }));
|
|
55
|
+
' "$ROOT/package.json" > "$FIXTURE/package.json"
|
|
56
|
+
printf '%s\n' '*.bak' > "$FIXTURE/.gitignore"
|
|
57
|
+
printf '%s\n' tracked > "$FIXTURE/skills/demo/SKILL.md"
|
|
58
|
+
git -C "$FIXTURE" init -q
|
|
59
|
+
git -C "$FIXTURE" config core.excludesFile /dev/null
|
|
60
|
+
git -C "$FIXTURE" add package.json .gitignore skills/demo/SKILL.md
|
|
61
|
+
printf '%s\n' new > "$FIXTURE/skills/demo/new-case.md"
|
|
62
|
+
packed_strays "$FIXTURE" working-tree "$TMP/fixture-new"
|
|
63
|
+
[ ! -s "$TMP/fixture-new" ] ||
|
|
64
|
+
fail "an untracked, unignored new file failed the working-tree check: $(cat "$TMP/fixture-new")"
|
|
65
|
+
packed_strays "$FIXTURE" tracked "$TMP/fixture-tracked"
|
|
66
|
+
grep -qx 'skills/demo/new-case.md' "$TMP/fixture-tracked" ||
|
|
67
|
+
fail "the tracked-only check missed an untracked file"
|
|
68
|
+
printf '%s\n' junk > "$FIXTURE/skills/demo/notes.bak"
|
|
69
|
+
packed_strays "$FIXTURE" working-tree "$TMP/fixture-ignored"
|
|
70
|
+
grep -qx 'skills/demo/notes.bak' "$TMP/fixture-ignored" ||
|
|
71
|
+
fail "the working-tree check missed an ignored file"
|
|
72
|
+
printf '%s\n' bytecode > "$FIXTURE/skills/demo/scripts/__pycache__/helper.cpython-314.pyc"
|
|
73
|
+
printf '%s\n' bytecode > "$FIXTURE/skills/demo/scripts/helper.pyc"
|
|
74
|
+
packed_strays "$FIXTURE" working-tree "$TMP/fixture-bytecode"
|
|
75
|
+
if grep -q '\.pyc"' "$TMP/fixture-bytecode.json"; then
|
|
76
|
+
fail "package.json \"files\" would pack Python bytecode"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
cd "$ROOT"
|
|
80
|
+
git rev-parse --is-inside-work-tree >/dev/null 2>&1 ||
|
|
81
|
+
fail "package contents are checked against git; run this from a git checkout"
|
|
82
|
+
packed_strays "$ROOT" "$MODE" "$TMP/stray"
|
|
83
|
+
|
|
84
|
+
node - "$TMP/stray.json" "$ROOT/package.json" <<'NODE' || exit 1
|
|
85
|
+
const fs = require('fs');
|
|
86
|
+
const [packFile, packageFile] = process.argv.slice(2);
|
|
87
|
+
|
|
88
|
+
const manifest = JSON.parse(fs.readFileSync(packageFile, 'utf8'));
|
|
89
|
+
if (manifest.name !== '@hxp-tools/godplans') {
|
|
90
|
+
process.stderr.write('FAIL [package-contents] package.json name must be @hxp-tools/godplans\n');
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
if (manifest.private === true) {
|
|
94
|
+
process.stderr.write('FAIL [package-contents] package.json must not be private; godplans publishes to npm\n');
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
if (!manifest.publishConfig || manifest.publishConfig.access !== 'public') {
|
|
98
|
+
process.stderr.write('FAIL [package-contents] package.json publishConfig.access must be public\n');
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
if (!manifest.bin || manifest.bin.godplans !== 'bin/godplans.js') {
|
|
102
|
+
process.stderr.write('FAIL [package-contents] package.json bin.godplans must point at bin/godplans.js\n');
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const payload = JSON.parse(fs.readFileSync(packFile, 'utf8'));
|
|
107
|
+
const paths = new Set(payload[0].files.map((entry) => entry.path));
|
|
108
|
+
for (const required of [
|
|
109
|
+
'bin/godplans.js',
|
|
110
|
+
'docs/assets/hero.svg',
|
|
111
|
+
'docs/assets/quest-map.svg',
|
|
112
|
+
'docs/assets/badge-graded.svg',
|
|
113
|
+
'docs/assets/badge-validated.svg',
|
|
114
|
+
'docs/assets/badge-approved.svg',
|
|
115
|
+
'docs/assets/badge-done.svg',
|
|
116
|
+
'scripts/release-check.sh',
|
|
117
|
+
'scripts/eval-matrix.sh',
|
|
118
|
+
'scripts/eval-external.js',
|
|
119
|
+
'scripts/eval-outcome.js',
|
|
120
|
+
'scripts/outcome-summary.js',
|
|
121
|
+
'evals/cases-roster.txt',
|
|
122
|
+
'evals/external/RUBRIC.md',
|
|
123
|
+
'evals/metrics/context-cost.json',
|
|
124
|
+
'evals/outcomes/README.md',
|
|
125
|
+
'requirements/skills-ref.txt'
|
|
126
|
+
]) {
|
|
127
|
+
if (!paths.has(required)) {
|
|
128
|
+
process.stderr.write(`FAIL [package-contents] missing ${required}\n`);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
NODE
|
|
133
|
+
|
|
134
|
+
if [ -s "$TMP/stray" ]; then
|
|
135
|
+
if [ "$MODE" = tracked ]; then
|
|
136
|
+
fail "the package would ship files git does not track:
|
|
137
|
+
$(sed 's/^/ /' "$TMP/stray")"
|
|
138
|
+
fi
|
|
139
|
+
fail "the package would ship files git ignores:
|
|
140
|
+
$(sed 's/^/ /' "$TMP/stray")"
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
echo "ok [package-contents]"
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
6
|
+
BUILD="$REPO_DIR/scripts/build-prompt.sh"
|
|
7
|
+
# Every build goes to a scratch path. The test asserts on a fresh build; lint
|
|
8
|
+
# prompt-fresh owns the comparison with the committed PROMPT.md, so a test run
|
|
9
|
+
# must never rewrite the tracked file or leave files in the repository.
|
|
10
|
+
TMP="$(mktemp -d)"
|
|
11
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
12
|
+
PROMPT="$TMP/PROMPT.md"
|
|
13
|
+
FULL_PROMPT="$TMP/PROMPT.full.md"
|
|
14
|
+
STAMP="$TMP/stamp"
|
|
15
|
+
|
|
16
|
+
fail() {
|
|
17
|
+
echo "FAIL [portable-prompt] $*" >&2
|
|
18
|
+
exit 1
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
marker_count() {
|
|
22
|
+
grep -Fxc "$1" "$PROMPT" || true
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
assert_marker_once() {
|
|
26
|
+
marker=$1
|
|
27
|
+
count=$(marker_count "$marker")
|
|
28
|
+
[ "$count" -eq 1 ] || fail "expected marker once, found $count: $marker"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
expected_refs="
|
|
32
|
+
compliance
|
|
33
|
+
discovery
|
|
34
|
+
product
|
|
35
|
+
architecture
|
|
36
|
+
stack
|
|
37
|
+
database
|
|
38
|
+
security
|
|
39
|
+
exemplar
|
|
40
|
+
plan-format
|
|
41
|
+
"
|
|
42
|
+
|
|
43
|
+
# doc-set is a lazy contract, not a domain; domain-parity leaves it out of
|
|
44
|
+
# its comparison, as it does the contract modules in expected_refs.
|
|
45
|
+
lazy_refs="
|
|
46
|
+
doc-set
|
|
47
|
+
business
|
|
48
|
+
llm
|
|
49
|
+
ux
|
|
50
|
+
ui
|
|
51
|
+
seo
|
|
52
|
+
code-quality
|
|
53
|
+
style-genome
|
|
54
|
+
agent-memory
|
|
55
|
+
repo
|
|
56
|
+
build
|
|
57
|
+
roadmap
|
|
58
|
+
deploy
|
|
59
|
+
observe
|
|
60
|
+
launch
|
|
61
|
+
"
|
|
62
|
+
|
|
63
|
+
touch "$STAMP"
|
|
64
|
+
# A one-second gap lets a filesystem with whole-second mtimes see a later write.
|
|
65
|
+
sleep 1
|
|
66
|
+
GODPLANS_PROMPT_OUT="$PROMPT" bash "$BUILD" >/dev/null
|
|
67
|
+
|
|
68
|
+
previous_line=0
|
|
69
|
+
for ref in $expected_refs; do
|
|
70
|
+
marker="# INLINED REFERENCE: references/$ref.md"
|
|
71
|
+
assert_marker_once "$marker"
|
|
72
|
+
title=$(sed -n '1p' "$REPO_DIR/skills/godplans/references/$ref.md")
|
|
73
|
+
title_count=$(marker_count "$title")
|
|
74
|
+
[ "$title_count" -eq 1 ] || fail "expected module title once, found $title_count: $title"
|
|
75
|
+
line=$(grep -Fnx "$marker" "$PROMPT" | cut -d: -f1)
|
|
76
|
+
[ "$line" -gt "$previous_line" ] || fail "reference order is not workflow order at $ref"
|
|
77
|
+
previous_line=$line
|
|
78
|
+
done
|
|
79
|
+
|
|
80
|
+
# Routing is prose a reader follows, so the inlined scripts (whose comments
|
|
81
|
+
# also name module paths) do not count.
|
|
82
|
+
sed '/^# INLINED VALIDATOR: /,$d' "$PROMPT" > "$TMP/routing.md"
|
|
83
|
+
for ref in $lazy_refs; do
|
|
84
|
+
marker="# INLINED REFERENCE: references/$ref.md"
|
|
85
|
+
count=$(marker_count "$marker")
|
|
86
|
+
[ "$count" -eq 0 ] || fail "lazy module was inlined into the core: $ref"
|
|
87
|
+
grep -Fq "references/$ref.md" "$TMP/routing.md" ||
|
|
88
|
+
fail "portable core does not route to lazy module: $ref"
|
|
89
|
+
done
|
|
90
|
+
|
|
91
|
+
template_marker="# INLINED TEMPLATE: templates/PLAN.template.mdx"
|
|
92
|
+
assert_marker_once "$template_marker"
|
|
93
|
+
template_title="# PROJECT-NAME master plan"
|
|
94
|
+
template_title_count=$(marker_count "$template_title")
|
|
95
|
+
[ "$template_title_count" -eq 1 ] || fail "expected template content once, found $template_title_count"
|
|
96
|
+
template_line=$(grep -Fnx "$template_marker" "$PROMPT" | cut -d: -f1)
|
|
97
|
+
[ "$template_line" -gt "$previous_line" ] || fail "template does not follow plan-format"
|
|
98
|
+
|
|
99
|
+
validator_marker="# INLINED VALIDATOR: scripts/validate-plan.sh"
|
|
100
|
+
assert_marker_once "$validator_marker"
|
|
101
|
+
validator_line=$(grep -Fnx "$validator_marker" "$PROMPT" | cut -d: -f1)
|
|
102
|
+
[ "$validator_line" -gt "$template_line" ] || fail "validator does not follow the template"
|
|
103
|
+
validator_shebangs=$(grep -Fxc '#!/usr/bin/env bash' "$PROMPT" || true)
|
|
104
|
+
[ "$validator_shebangs" -eq 2 ] || fail "expected validator and metric script shebangs, found $validator_shebangs"
|
|
105
|
+
|
|
106
|
+
halflife_marker="# INLINED SCRIPT: scripts/plan-halflife.sh"
|
|
107
|
+
assert_marker_once "$halflife_marker"
|
|
108
|
+
halflife_line=$(grep -Fnx "$halflife_marker" "$PROMPT" | cut -d: -f1)
|
|
109
|
+
[ "$halflife_line" -gt "$validator_line" ] || fail "plan half-life script does not follow the validator"
|
|
110
|
+
|
|
111
|
+
grep -Fq 'Weekend plans have at most 3 phases and 8 tasks.' "$PROMPT" ||
|
|
112
|
+
fail "portable prompt is missing the weekend scale ceiling"
|
|
113
|
+
grep -Fq 'Create the validator companion before drafting the plan.' "$PROMPT" ||
|
|
114
|
+
fail "portable prompt is missing the pre-draft companion gate"
|
|
115
|
+
tr '\n' ' ' < "$PROMPT" | grep -Fq 'write the inlined validator byte-for-byte to `.godplans/validate-plan.sh`' ||
|
|
116
|
+
fail "portable core does not say where to write the validator companion"
|
|
117
|
+
grep -Fq 'Pick product form before archetype and domain composition.' "$PROMPT" ||
|
|
118
|
+
fail "portable prompt is missing product-form routing"
|
|
119
|
+
grep -Fq "section_count('Plan provenance')" "$PROMPT" ||
|
|
120
|
+
fail "portable prompt is missing provenance validation"
|
|
121
|
+
|
|
122
|
+
# The budget exists to make growth visible, not to be raised whenever it fires.
|
|
123
|
+
# The invariant it encodes: headroom stays under one core module, so a
|
|
124
|
+
# module-sized addition trips the gate instead of sliding past it, while an
|
|
125
|
+
# ordinary edit does not. The number is derived from that rule, not chosen.
|
|
126
|
+
#
|
|
127
|
+
# Raised at 1.11.0: archetype scoring and overlays into discovery, the
|
|
128
|
+
# documentation-set and exclusion-tripwire grammar into plan-format, and roughly
|
|
129
|
+
# 25 KB of machine checks into the validator, which the core inlines whole
|
|
130
|
+
# because the portable surface has no skill files to read. That left 9 KB.
|
|
131
|
+
#
|
|
132
|
+
# Raised at 1.12.1, to 337000. 1.12.0 added the four capacity requirements to
|
|
133
|
+
# architecture and paid the gate's price first: the requirement prose was
|
|
134
|
+
# compressed and four task seeds consolidated into two, roughly 3 KB cut before
|
|
135
|
+
# the number moved. What remained was 53 bytes of headroom, at which point the
|
|
136
|
+
# gate could no longer tell a new module from a typo and failed CI on any edit
|
|
137
|
+
# at all. A gate that fires on everything measures nothing. 337000 restores
|
|
138
|
+
# 7053 bytes against a 7070-byte smallest core module (compliance), which is
|
|
139
|
+
# the invariant above, stated in bytes.
|
|
140
|
+
#
|
|
141
|
+
# Raised at 1.14.0, to 347923. That release closed roughly 25 validator gaps
|
|
142
|
+
# (about 3.6 KB of checks the core inlines whole) and wired the business domain
|
|
143
|
+
# into the orchestrator, discovery, the template, and the validator tables
|
|
144
|
+
# (about 1.5 KB; the business module itself stays lazy). It paid first: the
|
|
145
|
+
# Phase 5b failure-class list became a pointer to the exemplar gate it
|
|
146
|
+
# duplicated, and the plan-format machine-checks summary was regrouped, about
|
|
147
|
+
# 2.2 KB cut. At the raise, 347923 left 7053 bytes against compliance at 7070.
|
|
148
|
+
#
|
|
149
|
+
# Before moving it a fourth time: cut content or drop a module first, then set
|
|
150
|
+
# the number so headroom lands just under the smallest core module again. Print
|
|
151
|
+
# the module sizes with `npm run metrics:context` and read them out of
|
|
152
|
+
# evals/metrics/context-cost.json rather than guessing.
|
|
153
|
+
budget=347923
|
|
154
|
+
prompt_bytes=$(wc -c < "$PROMPT" | tr -d ' ')
|
|
155
|
+
[ "$prompt_bytes" -le "$budget" ] || fail "portable core exceeds $budget-byte budget: $prompt_bytes"
|
|
156
|
+
# The lower bound: a cut that leaves more headroom than the smallest core module
|
|
157
|
+
# lets a module-sized addition pass, so the number must come down with it.
|
|
158
|
+
smallest_core=$(for ref in $expected_refs; do
|
|
159
|
+
wc -c < "$REPO_DIR/skills/godplans/references/$ref.md"
|
|
160
|
+
done | sort -n | head -1 | tr -d ' ')
|
|
161
|
+
headroom=$((budget - prompt_bytes))
|
|
162
|
+
[ "$headroom" -lt "$smallest_core" ] ||
|
|
163
|
+
fail "budget headroom $headroom bytes is not under the smallest core module ($smallest_core bytes); lower the budget in this test to at most $((prompt_bytes + smallest_core - 1)) and record why in the comment above"
|
|
164
|
+
|
|
165
|
+
# unresolved_paths FILE [EXTRA]: lines naming an inlined file by a path the
|
|
166
|
+
# reader cannot open, in backticked or bare form. EXTRA is one more ERE: both
|
|
167
|
+
# prompts add style-stats.py, which neither inlines.
|
|
168
|
+
unresolved_paths() {
|
|
169
|
+
sed '/^# INLINED REFERENCE: /d; /^# INLINED TEMPLATE: /d; /^# INLINED VALIDATOR: /d; /^# INLINED SCRIPT: /d' "$1" |
|
|
170
|
+
grep -En "templates/PLAN\.template\.mdx|(^|[^[:alnum:]_.-])scripts/validate-plan\.sh|scripts/plan-halflife\.sh|(^|[^[:alnum:]-])plan-format\.md([^[:alnum:]-]|$)|references/(compliance|discovery|product|architecture|stack|database|security|exemplar)\.md${2:+|$2}" || true
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# A portable reader has no skill checkout, so it can run the half-life script
|
|
174
|
+
# only from where the prompt tells it to save the inlined copy: beside the
|
|
175
|
+
# validator companion that the script calls as its sibling.
|
|
176
|
+
assert_halflife_portable() {
|
|
177
|
+
label=$1
|
|
178
|
+
file=$2
|
|
179
|
+
tr '\n' ' ' < "$file" | grep -Fq 'save the inlined plan half-life script as `.godplans/plan-halflife.sh`' ||
|
|
180
|
+
fail "$label prompt does not say where to save the plan half-life script"
|
|
181
|
+
grep -Fq '`bash .godplans/plan-halflife.sh .godplans/PLAN.mdx .godplans/PLAN.metrics.json`' "$file" ||
|
|
182
|
+
fail "$label prompt does not run the saved plan half-life script"
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
unresolved=$(unresolved_paths "$PROMPT" 'scripts/style-stats\.py')
|
|
186
|
+
[ -z "$unresolved" ] || fail "unresolved required local reference remains:
|
|
187
|
+
$unresolved"
|
|
188
|
+
assert_halflife_portable core "$PROMPT"
|
|
189
|
+
|
|
190
|
+
# The header lists what the core inlines, and compliance comes first.
|
|
191
|
+
sed -n '1,/^---$/p' "$PROMPT" | tr '\n' ' ' | grep -Fq 'This slim core includes compliance,' ||
|
|
192
|
+
fail "core header does not list the inlined compliance module"
|
|
193
|
+
|
|
194
|
+
bash "$BUILD" --output "$TMP/PROMPT.second.md" >/dev/null
|
|
195
|
+
cmp -s "$PROMPT" "$TMP/PROMPT.second.md" || fail "regeneration is not deterministic"
|
|
196
|
+
|
|
197
|
+
bash "$BUILD" --full --output "$FULL_PROMPT" >/dev/null
|
|
198
|
+
# --output is honored in any flag order, and --core after --full builds a core.
|
|
199
|
+
bash "$BUILD" --output "$TMP/order-full.md" --full >/dev/null
|
|
200
|
+
cmp -s "$FULL_PROMPT" "$TMP/order-full.md" || fail "--output before --full was not honored"
|
|
201
|
+
bash "$BUILD" --full --core --output "$TMP/order-core.md" >/dev/null
|
|
202
|
+
cmp -s "$PROMPT" "$TMP/order-core.md" || fail "--full --core did not build the core prompt"
|
|
203
|
+
for ref in $expected_refs $lazy_refs; do
|
|
204
|
+
grep -Fqx "# INLINED REFERENCE: references/$ref.md" "$FULL_PROMPT" ||
|
|
205
|
+
fail "full prompt is missing module: $ref"
|
|
206
|
+
done
|
|
207
|
+
# The full prompt also inlines style-genome.md. Its vendoring note and R-DNA-21
|
|
208
|
+
# name the skill's own style-stats.py as where the measured norms come from,
|
|
209
|
+
# and R-DNA-21 sends the planned project to the .godplans copy instead. The
|
|
210
|
+
# path is masked on those two lines only, so a task seed, or a SKILL.md or
|
|
211
|
+
# discovery.md sentence that runs or copies the native script, still fails.
|
|
212
|
+
sed -e '/vendored by copy from codedna/s|scripts/style-stats\.py|style-stats.py|g' \
|
|
213
|
+
-e '/^- R-DNA-21 /s|scripts/style-stats\.py|style-stats.py|g' \
|
|
214
|
+
"$FULL_PROMPT" > "$TMP/full-checked.md"
|
|
215
|
+
unresolved=$(unresolved_paths "$TMP/full-checked.md" 'scripts/style-stats\.py')
|
|
216
|
+
[ -z "$unresolved" ] || fail "unresolved required local reference remains in the full prompt:
|
|
217
|
+
$unresolved"
|
|
218
|
+
assert_halflife_portable full "$FULL_PROMPT"
|
|
219
|
+
|
|
220
|
+
# A rewritten "the inlined X reference" must point at a module this prompt
|
|
221
|
+
# actually inlines; the generic full-mode rewrite would otherwise turn a path
|
|
222
|
+
# to a file outside the skill into a reference to nothing.
|
|
223
|
+
for file in "$PROMPT" "$FULL_PROMPT"; do
|
|
224
|
+
for name in $(grep -o 'the inlined [a-z-]* reference' "$file" | awk '{print $3}' | sort -u); do
|
|
225
|
+
grep -Fqx "# INLINED REFERENCE: references/$name.md" "$file" ||
|
|
226
|
+
fail "${file##*/} says 'the inlined $name reference' but inlines no references/$name.md"
|
|
227
|
+
done
|
|
228
|
+
done
|
|
229
|
+
|
|
230
|
+
for written in "$REPO_DIR/PROMPT.md" "$REPO_DIR/PROMPT.full.md"; do
|
|
231
|
+
if [ -e "$written" ] && [ -n "$(find "$written" -newer "$STAMP")" ]; then
|
|
232
|
+
fail "test run rewrote ${written#"$REPO_DIR"/}"
|
|
233
|
+
fi
|
|
234
|
+
done
|
|
235
|
+
[ ! -e "$REPO_DIR/PROMPT.full.test.md" ] || fail "test run left PROMPT.full.test.md in the repository"
|
|
236
|
+
|
|
237
|
+
# strip_council must fail the build, not pass quietly, when either boundary of
|
|
238
|
+
# the Phase 6d block is renamed. Build against a fixture that links everything
|
|
239
|
+
# in the skill except a modified SKILL.md.
|
|
240
|
+
council_fixture() {
|
|
241
|
+
sed_expr=$1
|
|
242
|
+
fix="$TMP/council-fixture"
|
|
243
|
+
rm -rf "$fix" || return 1
|
|
244
|
+
mkdir -p "$fix/scripts" "$fix/skills/godplans" || return 1
|
|
245
|
+
cp "$BUILD" "$fix/scripts/build-prompt.sh" || return 1
|
|
246
|
+
for entry in "$REPO_DIR"/skills/godplans/*; do
|
|
247
|
+
[ "${entry##*/}" = SKILL.md ] || ln -s "$entry" "$fix/skills/godplans/${entry##*/}" || return 1
|
|
248
|
+
done
|
|
249
|
+
sed "$sed_expr" "$REPO_DIR/skills/godplans/SKILL.md" > "$fix/skills/godplans/SKILL.md" || return 1
|
|
250
|
+
[ -s "$fix/skills/godplans/SKILL.md" ] || return 1
|
|
251
|
+
if bash "$fix/scripts/build-prompt.sh" --output "$TMP/council-fixture.out" >/dev/null 2>"$TMP/council-fixture.err"; then
|
|
252
|
+
return 1
|
|
253
|
+
fi
|
|
254
|
+
grep -Fq "strip_council boundaries" "$TMP/council-fixture.err"
|
|
255
|
+
}
|
|
256
|
+
council_fixture 's/^\*\*6d\. Council (opt-in)\.\*\*/**6d. Panel (opt-in).**/' ||
|
|
257
|
+
fail "build did not fail when the 6d council heading was renamed"
|
|
258
|
+
council_fixture 's/^Print the scorecard/Show the scorecard/' ||
|
|
259
|
+
fail "build did not fail when the Print the scorecard paragraph was renamed"
|
|
260
|
+
|
|
261
|
+
echo "ok [portable-prompt]"
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Release tooling regressions: release-check.sh validator resolution, changelog
|
|
3
|
+
# guard, gate wiring, and GitHub About parity, and the version sync that
|
|
4
|
+
# release:prepare runs.
|
|
5
|
+
# Everything runs in scratch copies, so no tracked file, venv, or tag is
|
|
6
|
+
# touched.
|
|
7
|
+
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
|
|
10
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
11
|
+
TMP="$(mktemp -d)"
|
|
12
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
13
|
+
|
|
14
|
+
fail() {
|
|
15
|
+
echo "FAIL [release-tooling] $*" >&2
|
|
16
|
+
exit 1
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
# CI and `npm run release:check` export SKILLS_REF_BIN. Each case below sets it
|
|
20
|
+
# explicitly when it wants one, so resolution cases start without it. GitHub
|
|
21
|
+
# Actions exports GITHUB_EVENT_NAME, which decides whether About drift fails or
|
|
22
|
+
# warns, so every case starts as a local run and the About cases set it.
|
|
23
|
+
unset SKILLS_REF_BIN GITHUB_EVENT_NAME
|
|
24
|
+
|
|
25
|
+
# Fake tools. The broken validator mimics a stale pipx shim whose interpreter
|
|
26
|
+
# was deleted. The fake gh fails authentication, so a release check that gets
|
|
27
|
+
# past its local guards stops there instead of reaching the network or npm.
|
|
28
|
+
BIN="$TMP/bin"
|
|
29
|
+
mkdir -p "$BIN/broken" "$BIN/fake-gh"
|
|
30
|
+
printf '%s\n' '#!/nonexistent/godplans-test-python' > "$BIN/broken/skills-ref"
|
|
31
|
+
printf '%s\n' '#!/usr/bin/env sh' 'case "$1" in --version) echo "skills-ref, version 0.0.0" ;; validate) echo "fixture rejection" >&2; exit 1 ;; esac' \
|
|
32
|
+
> "$BIN/rejecting"
|
|
33
|
+
printf '%s\n' '#!/usr/bin/env sh' 'case "$1" in --version) echo "skills-ref, version 0.0.0" ;; validate) echo "Valid skill: $2" ;; esac' \
|
|
34
|
+
> "$BIN/accepting"
|
|
35
|
+
printf '%s\n' '#!/usr/bin/env sh' 'exit 1' > "$BIN/fake-gh/gh"
|
|
36
|
+
chmod +x "$BIN/broken/skills-ref" "$BIN/rejecting" "$BIN/accepting" "$BIN/fake-gh/gh"
|
|
37
|
+
|
|
38
|
+
RC="$TMP/rc"
|
|
39
|
+
mkdir -p "$RC/scripts" "$RC/skills/godplans"
|
|
40
|
+
cp "$ROOT/scripts/release-check.sh" "$RC/scripts/release-check.sh"
|
|
41
|
+
# The top section names the word TODO in a real note; only the exact stub that
|
|
42
|
+
# release:prepare writes may block a release.
|
|
43
|
+
printf '%s\n' '# Changelog' '' '## [9.9.9] - 2026-01-01' '' '### Fixed' '' '- Real notes.' \
|
|
44
|
+
'- R-REPO-6 now also rejects TODO markers in shell scripts.' '' \
|
|
45
|
+
'## [9.9.8] - 2025-12-31' '' '- TODO markers in an older section are history.' > "$RC/CHANGELOG.md"
|
|
46
|
+
|
|
47
|
+
# Runs the scratch release check with PATH limited to the fake tools plus the
|
|
48
|
+
# system directories, so a skills-ref or gh installed on this machine is never
|
|
49
|
+
# picked up.
|
|
50
|
+
release_check() {
|
|
51
|
+
extra_path=$1
|
|
52
|
+
shift
|
|
53
|
+
env PATH="$extra_path:$BIN/fake-gh:/usr/bin:/bin" "$@" bash "$RC/scripts/release-check.sh"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if release_check "$BIN/broken" SKILLS_REF_BIN="$BIN/broken/skills-ref" >"$TMP/explicit.out" 2>&1; then
|
|
57
|
+
fail "release check passed with a validator that cannot execute"
|
|
58
|
+
fi
|
|
59
|
+
grep -q 'could not execute' "$TMP/explicit.out" ||
|
|
60
|
+
fail "an unrunnable SKILLS_REF_BIN was not reported as such: $(cat "$TMP/explicit.out")"
|
|
61
|
+
if grep -q 'rejected' "$TMP/explicit.out"; then
|
|
62
|
+
fail "an unrunnable validator was reported as rejecting the skill"
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
if release_check "$BIN/broken" SKILLS_REF_BIN="$BIN/rejecting" >"$TMP/rejected.out" 2>&1; then
|
|
66
|
+
fail "release check passed when the validator rejected the skill"
|
|
67
|
+
fi
|
|
68
|
+
grep -q 'rejected skills/godplans' "$TMP/rejected.out" ||
|
|
69
|
+
fail "a rejecting validator was not reported as a rejection: $(cat "$TMP/rejected.out")"
|
|
70
|
+
|
|
71
|
+
if release_check "$BIN/broken" >"$TMP/path.out" 2>&1; then
|
|
72
|
+
fail "release check skipped an unrunnable validator found on PATH"
|
|
73
|
+
fi
|
|
74
|
+
grep -q 'could not execute' "$TMP/path.out" ||
|
|
75
|
+
fail "an unrunnable PATH validator was not reported as such: $(cat "$TMP/path.out")"
|
|
76
|
+
|
|
77
|
+
# The documented repository venv wins over a broken shim on PATH.
|
|
78
|
+
mkdir -p "$RC/.venv-skills-ref/bin"
|
|
79
|
+
printf '%s\n' '#!/usr/bin/env sh' 'case "$1" in --version) exit 0 ;; validate) echo "venv validator ran" >&2; exit 1 ;; esac' \
|
|
80
|
+
> "$RC/.venv-skills-ref/bin/skills-ref"
|
|
81
|
+
chmod +x "$RC/.venv-skills-ref/bin/skills-ref"
|
|
82
|
+
if release_check "$BIN/broken" >"$TMP/venv.out" 2>&1; then
|
|
83
|
+
fail "release check passed with a rejecting venv validator"
|
|
84
|
+
fi
|
|
85
|
+
grep -q 'venv validator ran' "$TMP/venv.out" ||
|
|
86
|
+
fail "the repository venv validator was not preferred over PATH: $(cat "$TMP/venv.out")"
|
|
87
|
+
rm -rf "$RC/.venv-skills-ref"
|
|
88
|
+
|
|
89
|
+
# A clean top section passes the changelog guard and stops at the fake gh.
|
|
90
|
+
if release_check "$BIN/broken" SKILLS_REF_BIN="$BIN/accepting" >"$TMP/clean.out" 2>&1; then
|
|
91
|
+
fail "release check passed without an authenticated gh"
|
|
92
|
+
fi
|
|
93
|
+
grep -q 'authenticated gh CLI is required' "$TMP/clean.out" ||
|
|
94
|
+
fail "a clean changelog did not reach the gh check: $(cat "$TMP/clean.out")"
|
|
95
|
+
|
|
96
|
+
# Past its local guards the release check runs the repository gates. With
|
|
97
|
+
# stand-ins for gh, npm, and the gate scripts, it must finish and check the
|
|
98
|
+
# package against committed files only. There is no scripts/eval.sh stand-in:
|
|
99
|
+
# npm run check already covers the evaluation contracts, so the gate must not
|
|
100
|
+
# call it again. The gh stand-in answers `repo view` from about.json beside it,
|
|
101
|
+
# shaped like `gh repo view --json description,repositoryTopics` output.
|
|
102
|
+
mkdir -p "$BIN/ok-tools" "$RC/tests"
|
|
103
|
+
printf '%s\n' '#!/usr/bin/env sh' \
|
|
104
|
+
'if [ "$1 $2" = "repo view" ]; then cat "$(dirname "$0")/about.json"; fi' 'exit 0' > "$BIN/ok-tools/gh"
|
|
105
|
+
printf '%s\n' '#!/usr/bin/env sh' 'exit 0' > "$BIN/ok-tools/npm"
|
|
106
|
+
printf '%s\n' '#!/usr/bin/env bash' 'exit 0' > "$RC/scripts/lint.sh"
|
|
107
|
+
printf '%s\n' '#!/usr/bin/env bash' 'printf "%s\n" "$*" > "$(dirname "$0")/package-contents.args"' \
|
|
108
|
+
> "$RC/tests/package-contents.sh"
|
|
109
|
+
chmod +x "$BIN/ok-tools/gh" "$BIN/ok-tools/npm"
|
|
110
|
+
# The About comparison runs node; link the real one in rather than widening PATH.
|
|
111
|
+
NODE_BIN=$(command -v node) || fail "node is required to run this test"
|
|
112
|
+
ln -s "$NODE_BIN" "$BIN/ok-tools/node"
|
|
113
|
+
printf '%s\n' '{' ' "description": "Fixture description.",' ' "keywords": ["alpha", "beta"]' '}' > "$RC/package.json"
|
|
114
|
+
# Matching About text, with one extra topic, which is allowed.
|
|
115
|
+
printf '%s\n' '{"description":"Fixture description.","repositoryTopics":[{"name":"beta"},{"name":"alpha"},{"name":"gamma"}]}' \
|
|
116
|
+
> "$BIN/ok-tools/about.json"
|
|
117
|
+
env PATH="$BIN/ok-tools:/usr/bin:/bin" SKILLS_REF_BIN="$BIN/accepting" \
|
|
118
|
+
bash "$RC/scripts/release-check.sh" >"$TMP/full.out" 2>&1 ||
|
|
119
|
+
fail "release check failed with every gate stubbed to pass: $(cat "$TMP/full.out")"
|
|
120
|
+
grep -q 'ok \[release-check\]' "$TMP/full.out" || fail "release check did not finish"
|
|
121
|
+
[ "$(cat "$RC/tests/package-contents.args" 2>/dev/null)" = "--tracked-only" ] ||
|
|
122
|
+
fail "release check did not check the package against tracked files only"
|
|
123
|
+
|
|
124
|
+
# An About description that differs from package.json, or a keyword missing
|
|
125
|
+
# from the topics, fails a local release check and a push to main, and names
|
|
126
|
+
# the gh command that fixes it.
|
|
127
|
+
printf '%s\n' '{"description":"An older About text.","repositoryTopics":[{"name":"alpha"}]}' \
|
|
128
|
+
> "$BIN/ok-tools/about.json"
|
|
129
|
+
about_wants() {
|
|
130
|
+
for want in 'the repository description differs from package.json description' \
|
|
131
|
+
'the repository topics lack package.json keywords: beta' \
|
|
132
|
+
'fix: gh repo edit hannsxpeter/godplans --description "Fixture description." --add-topic beta'; do
|
|
133
|
+
grep -Fq "$want" "$1" || fail "About drift output lacks [$want]: $(cat "$1")"
|
|
134
|
+
done
|
|
135
|
+
}
|
|
136
|
+
for event in local push; do
|
|
137
|
+
rm -f "$RC/tests/package-contents.args"
|
|
138
|
+
event_env=
|
|
139
|
+
[ "$event" = "local" ] || event_env="GITHUB_EVENT_NAME=$event"
|
|
140
|
+
if env PATH="$BIN/ok-tools:/usr/bin:/bin" SKILLS_REF_BIN="$BIN/accepting" $event_env \
|
|
141
|
+
bash "$RC/scripts/release-check.sh" >"$TMP/about-$event.out" 2>&1; then
|
|
142
|
+
fail "release check ($event) passed with GitHub About drift"
|
|
143
|
+
fi
|
|
144
|
+
grep -q '^\[fail\] GitHub About drifted' "$TMP/about-$event.out" ||
|
|
145
|
+
fail "release check ($event) did not fail on About drift: $(cat "$TMP/about-$event.out")"
|
|
146
|
+
about_wants "$TMP/about-$event.out"
|
|
147
|
+
[ ! -e "$RC/tests/package-contents.args" ] || fail "release check ($event) went on past GitHub About drift"
|
|
148
|
+
done
|
|
149
|
+
# Pull request CI only warns: the About text is live state that no branch
|
|
150
|
+
# carries, so the drift is printed with its fix and the gate goes on.
|
|
151
|
+
rm -f "$RC/tests/package-contents.args"
|
|
152
|
+
env PATH="$BIN/ok-tools:/usr/bin:/bin" SKILLS_REF_BIN="$BIN/accepting" GITHUB_EVENT_NAME=pull_request \
|
|
153
|
+
bash "$RC/scripts/release-check.sh" >"$TMP/about-pr.out" 2>&1 ||
|
|
154
|
+
fail "release check failed on About drift in pull request CI: $(cat "$TMP/about-pr.out")"
|
|
155
|
+
grep -q '^\[warn\] GitHub About drifted' "$TMP/about-pr.out" ||
|
|
156
|
+
fail "About drift in pull request CI printed no warning: $(cat "$TMP/about-pr.out")"
|
|
157
|
+
about_wants "$TMP/about-pr.out"
|
|
158
|
+
grep -q 'ok \[release-check\]' "$TMP/about-pr.out" ||
|
|
159
|
+
fail "release check did not finish after an About warning"
|
|
160
|
+
[ "$(cat "$RC/tests/package-contents.args" 2>/dev/null)" = "--tracked-only" ] ||
|
|
161
|
+
fail "release check skipped the package check after an About warning"
|
|
162
|
+
# No topics at all reads as every keyword missing, not as a crash.
|
|
163
|
+
printf '%s\n' '{"description":"Fixture description.","repositoryTopics":null}' > "$BIN/ok-tools/about.json"
|
|
164
|
+
if env PATH="$BIN/ok-tools:/usr/bin:/bin" SKILLS_REF_BIN="$BIN/accepting" \
|
|
165
|
+
bash "$RC/scripts/release-check.sh" >"$TMP/notopics.out" 2>&1; then
|
|
166
|
+
fail "release check passed with no repository topics"
|
|
167
|
+
fi
|
|
168
|
+
grep -Fq 'fix: gh repo edit hannsxpeter/godplans --add-topic alpha,beta' "$TMP/notopics.out" ||
|
|
169
|
+
fail "missing topics were not named: $(cat "$TMP/notopics.out")"
|
|
170
|
+
|
|
171
|
+
# release:prepare from a scratch copy: version sync must leave every derived
|
|
172
|
+
# artifact current, and the TODO stub it writes must block the release check.
|
|
173
|
+
REPO="$TMP/repo"
|
|
174
|
+
mkdir -p "$REPO/scripts" "$REPO/evals/metrics" "$REPO/skills" "$REPO/.claude-plugin" "$REPO/plugins/godplans/.claude-plugin"
|
|
175
|
+
for file in package.json CHANGELOG.md README.md PROMPT.md; do
|
|
176
|
+
cp "$ROOT/$file" "$REPO/$file"
|
|
177
|
+
done
|
|
178
|
+
cp "$ROOT/.claude-plugin/marketplace.json" "$REPO/.claude-plugin/marketplace.json"
|
|
179
|
+
cp "$ROOT/plugins/godplans/.claude-plugin/plugin.json" "$REPO/plugins/godplans/.claude-plugin/plugin.json"
|
|
180
|
+
cp -R "$ROOT/skills/godplans" "$REPO/skills/godplans"
|
|
181
|
+
cp "$ROOT/evals/metrics/context-cost.json" "$REPO/evals/metrics/context-cost.json"
|
|
182
|
+
for script in version-sync.js release-prepare.js build-prompt.sh context-metrics.js release-check.sh; do
|
|
183
|
+
cp "$ROOT/scripts/$script" "$REPO/scripts/$script"
|
|
184
|
+
done
|
|
185
|
+
|
|
186
|
+
(cd "$REPO" && node scripts/release-prepare.js 99.0.0) >"$TMP/prepare.out" 2>&1 ||
|
|
187
|
+
fail "release:prepare failed in a scratch copy: $(cat "$TMP/prepare.out")"
|
|
188
|
+
(cd "$REPO" && node scripts/version-sync.js --check) >/dev/null 2>&1 ||
|
|
189
|
+
fail "release:prepare left a version surface stale"
|
|
190
|
+
(cd "$REPO" && node scripts/context-metrics.js --check) >/dev/null 2>&1 ||
|
|
191
|
+
fail "release:prepare left the context metrics stale"
|
|
192
|
+
grep -q '^## \[99\.0\.0\] - ' "$REPO/CHANGELOG.md" || fail "release:prepare did not stub the CHANGELOG"
|
|
193
|
+
|
|
194
|
+
if env PATH="$BIN/fake-gh:/usr/bin:/bin" SKILLS_REF_BIN="$BIN/accepting" \
|
|
195
|
+
bash "$REPO/scripts/release-check.sh" >"$TMP/todo.out" 2>&1; then
|
|
196
|
+
fail "release check passed with the TODO changelog stub"
|
|
197
|
+
fi
|
|
198
|
+
grep -q 'release:prepare stub' "$TMP/todo.out" ||
|
|
199
|
+
fail "the TODO changelog stub was not named: $(cat "$TMP/todo.out")"
|
|
200
|
+
if grep -q 'authenticated gh CLI is required' "$TMP/todo.out"; then
|
|
201
|
+
fail "the changelog guard ran after the gh check"
|
|
202
|
+
fi
|
|
203
|
+
|
|
204
|
+
echo "ok [release-tooling]"
|
package/tests/run.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Maintainer scripts answer --help with their usage and exit 0, and refuse an
|
|
3
|
+
# unknown argument with exit 2, before they read or write anything. Without
|
|
4
|
+
# this, --help reached npm version as a bump, rebuilt PROMPT.md, or created a
|
|
5
|
+
# directory named --help.
|
|
6
|
+
|
|
7
|
+
set -u
|
|
8
|
+
|
|
9
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
10
|
+
TMP="$(mktemp -d)"
|
|
11
|
+
trap 'rm -rf "$TMP"' EXIT HUP INT TERM
|
|
12
|
+
failures=0
|
|
13
|
+
|
|
14
|
+
fail() {
|
|
15
|
+
echo "FAIL [script-usage] $*" >&2
|
|
16
|
+
failures=$((failures + 1))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
for script in version-sync.js context-metrics.js build-catalog.js release-prepare.js summarize-eval.js summarize-matrix.js; do
|
|
20
|
+
out=$(cd "$TMP" && node "$ROOT/scripts/$script" --help 2>&1)
|
|
21
|
+
status=$?
|
|
22
|
+
[ "$status" -eq 0 ] || fail "$script --help exited $status"
|
|
23
|
+
case "$out" in
|
|
24
|
+
Usage:*) ;;
|
|
25
|
+
*) fail "$script --help printed no usage: $out" ;;
|
|
26
|
+
esac
|
|
27
|
+
|
|
28
|
+
(cd "$TMP" && node "$ROOT/scripts/$script" --bogus >/dev/null 2>&1)
|
|
29
|
+
status=$?
|
|
30
|
+
[ "$status" -eq 2 ] || fail "$script --bogus exited $status, expected 2"
|
|
31
|
+
done
|
|
32
|
+
|
|
33
|
+
[ -z "$(ls -A "$TMP")" ] || fail "a usage path wrote files: $(ls -A "$TMP" | tr '\n' ' ')"
|
|
34
|
+
[ ! -e "$ROOT/--help" ] || fail "a usage path created $ROOT/--help"
|
|
35
|
+
|
|
36
|
+
[ "$failures" -eq 0 ] || exit 1
|
|
37
|
+
echo "ok [script-usage]"
|