Skip to content

Releases

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 20 Nov 14:01
v0.3.0
fbca23d

Bun and Deno: Ward now installs and runs hooks on Node, Bun and Deno, with the same config.

Warning

Ward is in early development (0.x). Until 1.0, any minor release may change the config and behavior.

Install

# npm
npm install -D @hexlabelposition/ward
npm pkg set scripts.prepare=ward
npm run prepare

# Bun: the same "prepare": "ward" script, run by bun install
bun add -d @hexlabelposition/ward

# Deno: add "prepare": "deno run -A npm:@hexlabelposition/ward" to deno.json tasks
deno add npm:@hexlabelposition/ward
deno task prepare

Published with npm provenance. Requires Git 2.20 or later and Node.js 24 or later, Bun or Deno 2. Two runtime dependencies (yaml, picomatch), ESM-only.

What's in v0.3

Bun

  • bun install runs prepare and installs the hooks, also from a workspace package.
  • Stubs start Ward on the runtime that ran the install: Node when it is installed, Bun when it is not.
  • ward.config.ts accepts full TypeScript syntax (enum, namespace, parameter properties), and syntax errors point at the line.

Deno

  • Install from a deno.json task: deno task prepare. Deno has no prepare lifecycle, so run it after cloning and after updating Ward.
  • Hooks run deno run -A npm:@hexlabelposition/ward, at the version from deno.json or package.json and the lockfile. No node_modules is needed.
  • ward.config.ts accepts full TypeScript syntax, and syntax errors point at the line.

All runtimes

  • WARD_RUNTIME=node, bun or deno overrides the runtime of the stubs for one command: WARD_RUNTIME=node git commit. An unknown value or a runtime that is not installed fails the hook with a hint.
  • Install hints show the command for the runtime in use (npx ward, bunx ward, deno run -A npm:@hexlabelposition/ward).
  • On Windows, the binary Bun writes for a workspace package (ward.exe) is found.

Tested on

Ubuntu, macOS and Windows, on Node.js 24 and the current release, the latest Bun and Deno 2.x. The full test suite runs on every runtime.

What's next

  • v0.4: the same config in CI (--from-ref, --all-files, --ci) and shared configs with extends.
  • v0.5: ward init, and hooks without tasks that exit without starting a runtime.

See BACKLOG.md.

Full Changelog: v0.2.0...v0.3.0

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 18 Nov 18:04
v0.2.0
2d948cb

Tasks on staged files: Ward now replaces lint-staged as well as husky, with one config for both.

Warning

Ward is in early development (0.x). Until 1.0, any minor release may change the config and behavior.

Install

npm install -D @hexlabelposition/ward
npm pkg set scripts.prepare=ward
npm run prepare

Published with npm provenance. Requires Node.js 24 or later. Two runtime dependencies (yaml, picomatch), ESM-only.

What's in v0.2

Tasks on files

  • Named tasks: { tasks: { name: { run } } }, run in the order they are listed.
  • {staged_files}, {push_files} and {all_files} placeholders. Long file lists are split into several runs, so they fit the command line limit on Windows.
  • glob and exclude per task pick the files a task runs on. A task with no matching files is skipped.
  • Files fixed by a task are staged again; stageFixed: false leaves them unstaged.
  • Symlinks are left out of file lists; symlinks: true passes them to the task.
  • Function tasks in ward.config.ts: a function that gets the file list.
  • parallel: true runs the tasks of a hook at the same time, with each line of output prefixed by the task name.

Safety

  • A backup with git stash create before every run; backup: false or --no-backup skips it.
  • Partial staging: unstaged changes of partially staged files are hidden while tasks run and put back afterwards.
  • When a task fails, the index and working tree are reverted to the backup; revert: false or --no-revert keeps the changes of the tasks.
  • Deletions, binary files, renames, symlinks and merge conflicts are handled in the backup and partial staging.
  • A pre-commit whose tasks undid every staged change fails instead of making an empty commit.

Install

  • ward --bin <path> sets the binary the hooks call instead of node_modules/.bin/ward.

Moving from lint-staged

Move each glob and its commands into a named task with glob and {staged_files}, then remove lint-staged. See Moving from lint-staged.

Tested on

Ubuntu, macOS and Windows, on Node.js 24 and the current release.

What's next

  • v0.3: Bun and Deno.
  • v0.4: the same config in CI (--from-ref, --all-files, --ci) and shared configs with extends.

See BACKLOG.md.

Full Changelog: v0.1.0...v0.2.0

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 11 Nov 17:55
v0.1.0
84637f9

First release of Ward: git hooks from one config file, with no hook folder in your repo. This version replaces husky.

Warning

Ward is in early development (0.x). Until 1.0, any minor release may change the config and behavior.

Install

npm install -D @hexlabelposition/ward
npm pkg set scripts.prepare=ward
npm run prepare

Published with npm provenance. Requires Node.js 24 or later. One runtime dependency (yaml), ESM-only.

What's in v0.1

Config

  • One config for all hooks: ward.config.ts, ward.yml / ward.yaml, or a "ward" section in package.json. Finding more than one is an error, not a silent pick.
  • defineConfig() gives types and autocomplete; the TS config is loaded by Node's built-in type stripping, with no loader dependency.
  • A hook is a command, a list of commands, or named tasks: "cmd", ["a", "b"], { tasks: { name: { run: "cmd" } } }.
  • The whole config is checked on every run. Every problem is listed with its place in the config, and typos get a suggestion: hooks.pre-comit: unknown hook. Did you mean "pre-commit"?
  • Options from later versions (glob, parallel, …) fail as "not supported yet" instead of being ignored.

Install

  • ward, run from prepare, writes a small stub for every git hook into .git/hooks. Only the config is committed.
  • The config is read at run time, so changes apply on the next git command, with no reinstall.
  • Existing hooks are never overwritten silently: Ward asks in a terminal and warns from prepare. --chain keeps them and runs them before Ward, --force replaces them.
  • core.hooksPath is detected and reported with the command that fixes it; --respect-hooks-path installs there instead.
  • Install does nothing in CI, outside a git repository and without git, so npm install does not fail.
  • ward uninstall removes only Ward's stubs and puts chained hooks back.

Run

  • Tasks run in order through the system shell from the repo root. The first failure stops the hook, and git gets its exit code.
  • {1}, {2}, … expand to the arguments git passed to the hook: commitlint --edit {1}.
  • A hook with no tasks exits right away.
  • WARD=0 skips Ward for one command; hooks are skipped automatically during a merge or rebase.

Moving from husky

Move the commands from .husky/* into the config, delete the folder and run git config --unset core.hooksPath. See Moving from husky.

Tested on

Ubuntu, macOS and Windows, on Node.js 24 and the current release.

What's next

  • v0.2: replace lint-staged: tasks on staged files with glob and {staged_files}, safe partial staging, parallel tasks.
  • v0.3: Bun and Deno.

See BACKLOG.md.

Full Changelog: https://github.com/hexlabelposition/ward/commits/v0.1.0