From 3a4d48b6717acc6db3aa15ae6ef481014a708765 Mon Sep 17 00:00:00 2001 From: Sauyon Lee Date: Mon, 18 May 2026 00:56:35 -0700 Subject: [PATCH 1/2] ci: run lint/fmt/typecheck through hk Adds an hk.pkl wiring up the prettier, biome, and tsc builtins so the same checks run locally (pre-commit, fix, check hooks) and in CI. Pins hk + pkl via mise.toml and collapses the separate fmt/lint/typecheck CI jobs into a single `check` job that invokes `hk check --all`. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 41 +++++++--------------------------------- hk.pkl | 23 ++++++++++++++++++++++ mise.toml | 3 +++ 3 files changed, 33 insertions(+), 34 deletions(-) create mode 100644 hk.pkl create mode 100644 mise.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fddec90..f63b5a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,8 @@ on: workflow_dispatch: jobs: - fmt: - name: fmt + check: + name: check runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -17,43 +17,16 @@ jobs: with: bun-version: latest - - name: Install dependencies - run: bun install - - - name: Check formatting - run: bun run fmt - - lint: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - - uses: oven-sh/setup-bun@v2 - with: - bun-version: latest + - uses: jdx/mise-action@v3 - name: Install dependencies run: bun install - - name: Run linter - run: bun run lint - - typecheck: - name: type check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - - uses: oven-sh/setup-bun@v2 - with: - bun-version: latest - - - name: Install dependencies - run: bun install + - name: Add node_modules/.bin to PATH + run: echo "$GITHUB_WORKSPACE/node_modules/.bin" >> "$GITHUB_PATH" - - name: Check types - run: bun run typecheck + - name: Run hk check + run: hk check --all test: name: test diff --git a/hk.pkl b/hk.pkl new file mode 100644 index 0000000..a31374a --- /dev/null +++ b/hk.pkl @@ -0,0 +1,23 @@ +amends "package://github.com/jdx/hk/releases/download/v1.45.0/hk@1.45.0#/Config.pkl" +import "package://github.com/jdx/hk/releases/download/v1.45.0/hk@1.45.0#/Builtins.pkl" + +local linters = new Mapping { + ["prettier"] = Builtins.prettier + ["biome"] = Builtins.biome + ["tsc"] = Builtins.tsc +} + +hooks { + ["pre-commit"] { + fix = true + stash = "git" + steps = linters + } + ["fix"] { + fix = true + steps = linters + } + ["check"] { + steps = linters + } +} diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..e9211e8 --- /dev/null +++ b/mise.toml @@ -0,0 +1,3 @@ +[tools] +"github:jdx/hk" = "1.45.0" +pkl = "0.31.1" From aa0ac86304f982678c5c9efd54121b2ed8efb57e Mon Sep 17 00:00:00 2001 From: Sauyon Lee Date: Mon, 18 May 2026 01:07:45 -0700 Subject: [PATCH 2/2] ci(hk): gate tsc on the slow profile tsc invokes the full project (tsc --noEmit -p tsconfig.json), so it's correct but slow to run on every commit. Move it onto the `slow` hk profile so pre-commit only runs prettier + biome, and pass `--slow` in CI so the type check still runs there. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 2 +- hk.pkl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f63b5a6..a331b6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: run: echo "$GITHUB_WORKSPACE/node_modules/.bin" >> "$GITHUB_PATH" - name: Run hk check - run: hk check --all + run: hk check --all --slow test: name: test diff --git a/hk.pkl b/hk.pkl index a31374a..209ff93 100644 --- a/hk.pkl +++ b/hk.pkl @@ -4,7 +4,7 @@ import "package://github.com/jdx/hk/releases/download/v1.45.0/hk@1.45.0#/Builtin local linters = new Mapping { ["prettier"] = Builtins.prettier ["biome"] = Builtins.biome - ["tsc"] = Builtins.tsc + ["tsc"] = (Builtins.tsc) { profiles = List("slow") } } hooks {