From eef7f0c8b97f84e923fc7f47b1982fd0d691fc26 Mon Sep 17 00:00:00 2001 From: Roger Chappel Date: Fri, 22 May 2026 21:49:01 +1000 Subject: [PATCH] ci: restore GitHub Actions CI workflow - Add ci.yml with checkout, install, typecheck, build, test, smoke, and pack checks - The previous workflows were temporarily removed for initial push but never restored chore: add release:check scripts for release readiness - Add release:check, smoke, and package:smoke scripts to package.json - Fix smoke command to use positional directory argument instead of non-existent 'scan' subcommand - Fix CLI version import by creating src/version.ts (JSON import with type assertion is not portable across tsc setups) Fixes: - CI was completely missing, leaving no automated validation - release:check did not exist, making it difficult to verify release readiness - smoke script referenced a 'scan' subcommand that the CLI does not have (uses positional arg) - CLI failed at runtime due to import syntax that tsc compiles but Node cannot resolve --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ package.json | 5 ++++- src/cli.ts | 2 +- src/version.ts | 1 + 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 src/version.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4c1d652 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + - run: npm ci + - run: npm run check + - run: npm run build + - run: npm test + - run: npm run smoke + - run: npm run package:smoke diff --git a/package.json b/package.json index ac88bee..ef7a320 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,10 @@ "format": "prettier --write src", "test": "vitest run --coverage", "test:watch": "vitest", - "prepublishOnly": "npm run build" + "prepublishOnly": "npm run build", + "release:check": "npm run check && npm test && npm run smoke && npm run package:smoke", + "package:smoke": "npm pack --dry-run", + "smoke": "npm run build && node dist/cli.js --help && node dist/cli.js fixtures --format text" }, "keywords": [ "typescript", diff --git a/src/cli.ts b/src/cli.ts index e9d83e6..02fa329 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -9,7 +9,7 @@ import { resolve } from 'node:path'; import { existsSync } from 'node:fs'; import { analyzeDirectory } from './analyzer.js'; import { generateReport, saveBaseline, loadBaseline } from './reporter.js'; -import { version } from '../package.json' with { type: 'json' }; +import { version } from './version.js'; const program = new Command(); diff --git a/src/version.ts b/src/version.ts new file mode 100644 index 0000000..b41a6df --- /dev/null +++ b/src/version.ts @@ -0,0 +1 @@ +export const version = "0.1.0";