Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,8 @@ The release gate covers:
- `npm run build` - tsc && chmod +x dist/cli.js
- `npm test` - vitest run --coverage
- `npm run smoke` - npm run build && node dist/cli.js --help && node dist/cli.js fixtures --format text
- `npm run validate` - bash scripts/validate.sh
- `npm run validate` - build the CLI, assert the fully typed fixture reports 100% coverage and zero implicit types, and verify invalid output is rejected
- `npm run package:smoke` - npm run build && node scripts/package-smoke.mjs
- `npm run release:check` - full and production audits, typecheck, lint, tests, smoke checks, and package smoke check

## Release readiness

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"audit:all": "npm audit",
"audit:prod": "npm audit --omit=dev",
"prepublishOnly": "npm run build",
"release:check": "npm run audit:all && npm run audit:prod && npm run check && npm run lint && npm test && npm run smoke && npm run package:smoke",
"release:check": "npm run audit:all && npm run audit:prod && npm run check && npm run lint && npm test && npm run smoke && npm run validate && npm run package:smoke",
"package:smoke": "npm run build && node scripts/package-smoke.mjs",
"smoke": "npm run build && node dist/cli.js --help && node dist/cli.js fixtures --format text"
},
Expand Down
17 changes: 17 additions & 0 deletions scripts/assert-fully-typed.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { readFile } from 'node:fs/promises';

const [reportPath] = process.argv.slice(2);

if (!reportPath) {
console.error('Usage: node scripts/assert-fully-typed.mjs <report.json>');
process.exit(2);
}

const report = JSON.parse(await readFile(reportPath, 'utf8'));

if (report.coverage !== 100 || report.implicitCount !== 0) {
console.error(
`Expected 100% coverage and zero implicit types; received ${String(report.coverage)}% coverage and ${String(report.implicitCount)} implicit types.`,
);
process.exit(1);
}
22 changes: 16 additions & 6 deletions scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@ set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"

npm run check
npm run build
npm test
npm run smoke
npm run package:smoke

node dist/cli.js fixtures/fully-typed --format json --min-coverage 100 >/tmp/typegap-fully-typed.json
node -e "const fs=require('node:fs'); const r=JSON.parse(fs.readFileSync('/tmp/typegap-fully-typed.json','utf8')); if (r.coverage !== 100 || r.implicitCount !== 0) process.exit(1)"
output_dir="$(mktemp -d "${TMPDIR:-/tmp}/typegap-validation.XXXXXX")"
trap 'rm -rf "$output_dir"' EXIT

report_path="$output_dir/fully-typed.json"
invalid_report_path="$output_dir/invalid.json"

node dist/cli.js fixtures/fully-typed --format json --min-coverage 100 >"$report_path"
node scripts/assert-fully-typed.mjs "$report_path"

# Exercise the negative path so the gate cannot silently stop enforcing the
# fixture-specific coverage and implicit-type contract.
printf '%s\n' '{"coverage":99,"implicitCount":1}' >"$invalid_report_path"
if node scripts/assert-fully-typed.mjs "$invalid_report_path" >/dev/null 2>&1; then
printf 'Invalid fully-typed report unexpectedly passed validation.\n' >&2
exit 1
fi

printf 'TypeGap validation passed.\n'
Loading