Fix format, add lefthook pre-push check #19

Closed
opened 2026-08-04 19:59:53 +00:00 by alex · 2 comments
Owner

Currently build fails because of formatting issues.

Fix the problem and add lefthook config so to prvent pushing changes (locally) that were not validated fully

Currently build fails because of formatting issues. Fix the problem and add lefthook config so to prvent pushing changes (locally) that were not validated fully
Author
Owner

/pi new pr

/pi new pr
Contributor

The CI runs deno fmt --check, deno lint, deno check, and deno test. The issue mentions formatting issues. Let me check the current formatting state and the issue/PR context.There are 2 files with formatting issues: src/mutex.ts (missing trailing newline) and README.md (prose reflow). Let me look at the context and the mutex.ts file (the most recent commit).Now I understand both issues. Let me see the full fmt diff to understand all changes needed:The formatting is now fixed. Let me verify all CI checks pass:All checks pass now: fmt OK, lint clean, check OK, 243 tests passing. Now let me look at existing config to build the lefthook config properly:Let me check the README for a contributing/development section where I should document the lefthook setup:I now have a complete picture. Let me create the lefthook config mirroring the CI validation steps, and document it in the README.Now let me add documentation in the README's Development section:Now let me add a "Git hooks" subsection after the deno tasks table:Let me verify everything still passes fmt (since I edited the README), and re-run all checks:Let me run fmt to auto-fix the README prose I added:Everything looks good. Let me do a final full validation and verify the lefthook config is valid YAML:The YAML is valid and all static checks pass. Let me run the test suite once more, and refine the lefthook config — I'll remove the tags field to keep it minimal and ensure every push runs the full validation (tags would allow bypassing checks, which slightly contradicts "validated fully"):All checks pass (fmt, lint, check, 243 tests). Let me do a final review of the complete changeset before creating the PR:I notice deno.lock got modified (from my YAML validation importing @std/yaml, which isn't a project dependency). Let me revert that to keep the PR clean:Now the changeset is clean: formatting fix (mutex.ts trailing newline + README.md reflow), the new lefthook.yml, and README docs. Let me create the PR:PR #20 created: #20

What was done:

  1. Fixed the failing build — CI's deno fmt --check was flagging two files:

    • src/mutex.ts had no trailing newline (the code file that broke the build).
    • README.md had a few prose lines over the 80-column wrap width, which deno fmt reflowed.
  2. Added Lefthook pre-push hook (lefthook.yml) running the same checks CI enforces — deno fmt --check, deno lint, deno check src/main.ts, and deno test. They run in parallel; if any fails the push is aborted, so broken changes can't be pushed locally. Documented it in the README (new "Git hooks" section, activate with lefthook install).

All CI steps pass locally (fmt: 43 files OK, lint clean, check OK, 243 tests passing). I left the Fallow dead-code analysis out of the hook since it's a heavy Node/npx tool; it remains the separate deno task fallow step.


View action run | Model: zai/glm-5.2 (thinking: max) | Time: 3m 49s | Tokens: 449.6K | Pi SDK v0.82.1 | Action v2.27.0

The CI runs `deno fmt --check`, `deno lint`, `deno check`, and `deno test`. The issue mentions formatting issues. Let me check the current formatting state and the issue/PR context.There are 2 files with formatting issues: `src/mutex.ts` (missing trailing newline) and `README.md` (prose reflow). Let me look at the context and the mutex.ts file (the most recent commit).Now I understand both issues. Let me see the full fmt diff to understand all changes needed:The formatting is now fixed. Let me verify all CI checks pass:All checks pass now: fmt OK, lint clean, check OK, 243 tests passing. Now let me look at existing config to build the lefthook config properly:Let me check the README for a contributing/development section where I should document the lefthook setup:I now have a complete picture. Let me create the lefthook config mirroring the CI validation steps, and document it in the README.Now let me add documentation in the README's Development section:Now let me add a "Git hooks" subsection after the deno tasks table:Let me verify everything still passes fmt (since I edited the README), and re-run all checks:Let me run fmt to auto-fix the README prose I added:Everything looks good. Let me do a final full validation and verify the lefthook config is valid YAML:The YAML is valid and all static checks pass. Let me run the test suite once more, and refine the lefthook config — I'll remove the `tags` field to keep it minimal and ensure every push runs the full validation (tags would allow bypassing checks, which slightly contradicts "validated fully"):All checks pass (fmt, lint, check, 243 tests). Let me do a final review of the complete changeset before creating the PR:I notice `deno.lock` got modified (from my YAML validation importing `@std/yaml`, which isn't a project dependency). Let me revert that to keep the PR clean:Now the changeset is clean: formatting fix (`mutex.ts` trailing newline + `README.md` reflow), the new `lefthook.yml`, and README docs. Let me create the PR:PR #20 created: https://forge.l3x.in/alex/irc-greeter-bot/pulls/20 **What was done:** 1. **Fixed the failing build** — CI's `deno fmt --check` was flagging two files: - `src/mutex.ts` had no trailing newline (the code file that broke the build). - `README.md` had a few prose lines over the 80-column wrap width, which `deno fmt` reflowed. 2. **Added Lefthook `pre-push` hook** (`lefthook.yml`) running the same checks CI enforces — `deno fmt --check`, `deno lint`, `deno check src/main.ts`, and `deno test`. They run in parallel; if any fails the push is aborted, so broken changes can't be pushed locally. Documented it in the README (new "Git hooks" section, activate with `lefthook install`). All CI steps pass locally (fmt: 43 files OK, lint clean, check OK, 243 tests passing). I left the Fallow dead-code analysis out of the hook since it's a heavy Node/npx tool; it remains the separate `deno task fallow` step. --- [View action run](https://forge.l3x.in/alex/irc-greeter-bot/actions/runs/86) | Model: zai/glm-5.2 (thinking: max) | Time: 3m 49s | Tokens: 449.6K | Pi SDK v0.82.1 | Action v2.27.0
alex closed this issue 2026-08-04 20:09:50 +00:00
Sign in to join this conversation.
No labels
dependencies
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
alex/irc-greeter-bot#19
No description provided.