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
2 changes: 1 addition & 1 deletion .agents/skills/recreate-terminal-demo/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ accurate, readable, compact, and safe to commit.
6. Run:

```bash
ZIG_GLOBAL_CACHE_DIR=/tmp/package-version-info-zig-cache yarn validate
ZIG_GLOBAL_CACHE_DIR=/tmp/package-version-info-zig-cache bun run validate
git diff --check
git diff --cached --check
```
Expand Down
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
*.png binary
*.gif binary

yarn.lock -diff
package-lock.json -diff
23 changes: 6 additions & 17 deletions .github/actions/cached-deps/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Get & Cache Dependencies
description: Get dependencies via yarn and cache them
description: Get dependencies via Bun and cache them
inputs:
caching:
description: Whether to cache dependencies or not
Expand All @@ -8,7 +8,7 @@ inputs:
outputs:
used-cache:
description: Whether the cache was used
value: ${{ steps.install.outputs.cache }}
value: ${{ steps.cache.outputs.cache-hit }}
runs:
using: composite
steps:
Expand All @@ -17,23 +17,12 @@ runs:
id: cache
uses: actions/cache@v6
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-${{ env.cache-name }}-
${{ runner.OS }}-yarn-
${{ runner.OS }}-
${{ runner.os }}-bun-

- name: Install
if: steps.cache.outputs.cache-hit != 'true' || inputs.caching != 'true'
id: install
run: |
yarn install --frozen-lockfile
echo "cache='${{ inputs.caching }}'" >> $GITHUB_OUTPUT
shell: bash

- name: Postinstall
if: steps.cache.outputs.cache-hit == 'true' && inputs.caching == 'true'
id: postinstall
run: yarn postinstall
run: bun ci
shell: bash
24 changes: 24 additions & 0 deletions .github/actions/generate-coverage/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Generate Coverage
description: Generate a kcov coverage report in Docker
inputs:
kcov-image:
description: Pinned kcov Docker image
required: false
default: kcov/kcov@sha256:481289ae32e55e5b733019515acd10948a4f76dfed381765577db909664fc603
runs:
using: composite
steps:
- name: Generate coverage
shell: bash
env:
KCOV_IMAGE: ${{ inputs.kcov-image }}
run: |
docker run --rm \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--volume "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" \
--workdir "$GITHUB_WORKSPACE" \
--user "$(id -u):$(id -g)" \
--entrypoint /bin/sh \
"$KCOV_IMAGE" \
"$GITHUB_WORKSPACE/scripts/coverage.sh"
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ _None_

- [ ] I have performed a self-review of my code.
- [ ] If it is a core feature, I have added thorough tests.
- [ ] I have checked that affected pages are responsive.
- [ ] I have checked that there are no z-index issues on affected pages.
- [ ] I have run `bun run validate` when required.
- [ ] If CLI behavior changed, I have smoke-tested the affected commands.
15 changes: 9 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ jobs:
- name: 🗜️ Setup node version
uses: actions/setup-node@v6
with:
node-version: 24
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"

- name: 🗜️ Setup Bun
uses: oven-sh/setup-bun@v2

- name: 🗜️ Setup Zig
uses: mlugg/setup-zig@v2
with:
Expand All @@ -34,13 +37,13 @@ jobs:
uses: ./.github/actions/cached-deps

- name: 🛠️ Clean temporary files
run: yarn clean
run: bun run clean

- name: ✅ Validate
run: yarn validate
run: bun run validate

- name: 🛠️ Build cross-platform package
run: yarn package
run: bun run package

- name: 🚀 Publish NPM
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == false
Expand All @@ -56,13 +59,13 @@ jobs:

- name: 🛠️ Set up package for GPR
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == false
run: yarn script:package-github
run: bun run script:package-github

- name: 🛠️ Use GPR
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == false
uses: actions/setup-node@v4
with:
node-version: 24
node-version-file: ".nvmrc"
registry-url: https://npm.pkg.github.com/
scope: "@celtian"

Expand Down
35 changes: 14 additions & 21 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ permissions:
contents: read
pull-requests: write

env:
# kcov/kcov:latest, pinned for reproducible builds
KCOV_IMAGE: kcov/kcov@sha256:481289ae32e55e5b733019515acd10948a4f76dfed381765577db909664fc603

jobs:
install-and-test:
name: 🛠️ Install & Test
Expand All @@ -21,9 +17,12 @@ jobs:
- name: 🗜️ Setup node version
uses: actions/setup-node@v6
with:
node-version: 24
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"

- name: 🗜️ Setup Bun
uses: oven-sh/setup-bun@v2

- name: 🗜️ Setup Zig
uses: mlugg/setup-zig@v2
with:
Expand All @@ -33,25 +32,16 @@ jobs:
uses: ./.github/actions/cached-deps

- name: 🛠️ Clean temporary files
run: yarn clean
run: bun run clean

- name: ✅ Validate
run: yarn validate
run: bun run validate

- name: 🛠️ Build coverage tests
run: yarn coverage:build
run: bun run coverage:build

- name: 🧪 Generate coverage
run: |
docker run --rm \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--volume "$PWD:$PWD" \
--workdir "$PWD" \
--user "$(id -u):$(id -g)" \
--entrypoint /bin/sh \
"$KCOV_IMAGE" \
"$PWD/scripts/coverage.sh"
uses: ./.github/actions/generate-coverage

- name: 📊 Report coverage
if: github.event.pull_request.head.repo.full_name == github.repository
Expand All @@ -60,7 +50,7 @@ jobs:
coverage-file: coverage/merged/kcov-merged/cobertura.xml

- name: 🛠️ Build cross-platform package
run: yarn package
run: bun run package

package-smoke-test:
name: 📦 Package Smoke Test (${{ matrix.os }})
Expand All @@ -77,7 +67,10 @@ jobs:
- name: 🗜️ Setup node version
uses: actions/setup-node@v6
with:
node-version: 24
node-version-file: ".nvmrc"

- name: 🗜️ Setup Bun
uses: oven-sh/setup-bun@v2

- name: 🗜️ Setup Zig
uses: mlugg/setup-zig@v2
Expand All @@ -90,7 +83,7 @@ jobs:
caching: "false"

- name: 🛠️ Build cross-platform package
run: yarn package
run: bun run package

- name: 🧪 Run packaged CLI
run: node dist/bin/package-version-info.js --version
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ zig-out/
# Node.js artifacts
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json

# Visual Studio Code
Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx --no-install commitlint --edit
bunx --no-install commitlint --edit "$1"
10 changes: 5 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
- This repository provides a Zig library and CLI that generate TypeScript version information from `package.json`.
- `src/root.zig` contains the public `version_info` library API.
- `src/main.zig` contains the CLI entry point and argument parsing.
- Node.js and Yarn are used for packaging and publishing; the runtime executable is Zig.
- Node.js and Bun are used for packaging, npm is used for publishing, and the runtime executable is Zig.

## Toolchain

- Use Zig 0.16.0. Prefer ZVM: `zvm install 0.16.0` followed by `zvm use 0.16.0`.
- Use Yarn 1.22.22 with Node.js 24.
- Use Bun 1.3.14 with Node.js 24.
- Keep the Zig version synchronized in `build.zig.zon`, `README.md`, and every workflow under `.github/workflows/`.
- When upgrading toolchains, search hidden files too: `rg --hidden '<old-version>' . --glob '!.git/**'`.
- Never change the `build.zig.zon` package fingerprint.
Expand All @@ -30,17 +30,17 @@
Before handing off any Zig source, build configuration, dependency, packaging script, CI, or toolchain change, MUST run:

```bash
yarn validate
bun run validate
```

- `yarn validate` is the canonical validation command. It runs formatting checks, `zig build`, and `zig build test`.
- `bun run validate` is the canonical validation command. It runs formatting checks, `zig build`, and `zig build test`.
- MUST run formatting checks on every changed Zig file. Keep `format:check` synchronized when Zig files are added or renamed.
- Run `zig build` separately because `zig build test` does not fully analyze the CLI `main` function.
- Behavior changes MUST include new or updated tests where practical.
- If the global Zig cache is not writable, set `ZIG_GLOBAL_CACHE_DIR` to a directory under `/tmp`.
- For CLI changes, also smoke-test `--version`, generation with a real `.git` directory, and generation with a missing Git directory.
- Write smoke-test output outside the repository so generated artifacts are not accidentally committed.
- Documentation-only changes do not require `yarn validate` unless they change commands, versions, build instructions, or other executable examples.
- Documentation-only changes do not require `bun run validate` unless they change commands, versions, build instructions, or other executable examples.
- MUST NOT weaken, remove, or skip tests merely to make validation pass.
- MUST NOT report a command as passing unless it was actually executed successfully.
- If a required command cannot run, report the exact command, failure, and remaining unverified behavior.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ npm install package-version-info --save-dev
```

```bash
yarn add package-version-info --dev
bun add --dev package-version-info
```

The npm package includes native executables for macOS arm64/x64, Linux arm64/x64, and Windows
Expand Down Expand Up @@ -202,7 +202,7 @@ Requirements:

- [Zig 0.16.0](https://ziglang.org/download/)
- Node.js 24
- Yarn 1.22.22
- Bun 1.3.14

```bash
# Build the executable
Expand All @@ -212,7 +212,7 @@ zig build
zig build run

# Run all formatting, build, and test checks
yarn validate
bun run validate
```

<details>
Expand Down
Loading
Loading