Skip to content

feat(harper): add harper-cli config to hk builtin config#714

Merged
jdx merged 1 commit intojdx:mainfrom
hituzi-no-sippo:feat/add-harper-to-builtin
Apr 16, 2026
Merged

feat(harper): add harper-cli config to hk builtin config#714
jdx merged 1 commit intojdx:mainfrom
hituzi-no-sippo:feat/add-harper-to-builtin

Conversation

@hituzi-no-sippo
Copy link
Copy Markdown
Contributor

Add harper-cli as a new builtin linter for grammar.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces harper-cli as a new grammar linter, expanding the project's built-in linting capabilities. The changes provide configurations for checking both general text content and commit messages, aiming to improve the overall quality and consistency of written materials across the repository.

Highlights

  • New Grammar Linter Integration: Integrated harper-cli as a new built-in linter for grammar checking, enhancing the project's ability to maintain high-quality prose and documentation.
  • Dedicated Configuration for Text and Commit Messages: Added separate Pkl configurations for harper-cli to specifically lint general text files and commit messages, ensuring targeted grammar checks.
  • Tool Stub for harper-cli: Included a tool stub for harper-cli to manage its version and execution within the project's testing environment.
Changelog
  • pkl/builtins/harper.pkl
    • Added a new Pkl configuration for harper-cli.
    • Configured harper-cli to check text file types.
    • Included test cases for both passing and failing grammar checks.
    • Added metadata describing it as a "Grammar checker for prose and documentation".
  • pkl/builtins/harper_commit_message.pkl
    • Created a dedicated Pkl configuration for harper-cli to lint commit messages.
    • Specified the check command to use commit_msg_file.
    • Added metadata describing it as a "Grammar checker for commit message".
  • test/builtin_tool_stubs/harper-cli
    • Created a new executable tool stub for harper-cli.
    • Set the version to "1.9.0" and tool to "harper-cli".
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds harper-cli as a new built-in linter for grammar checking. The changes introduce two new configurations, one for general text files and another for commit messages, along with a test stub for the tool. My review focuses on improving the maintainability and testability of the new configurations. I've pointed out a confusing comment that should be removed and suggested a way to make the commit message checker testable, along with adding tests for it.

Comment thread pkl/builtins/harper_commit_message.pkl Outdated
Comment on lines +9 to +11
harper = new Config.Step {
check = "harper-cli lint {{commit_msg_file}}"
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This step is not currently testable because it relies on the {{commit_msg_file}} variable, which is only available in the commit-msg hook context. You can make it testable by using Tera's default filter to fall back to the {{files}} variable during tests.

Also, for consistency with the other harper builtin and to ensure this step works correctly, please add tests for valid and invalid commit messages. The helpers.pkl module is already imported, so you can use TestMaker.

harper = new Config.Step {
  check = "harper-cli lint {{ commit_msg_file | default(value=files) }}"
  tests {
    local const testMaker = new helpers.TestMaker {
      filename = "COMMIT_EDITMSG"
    }
    ["check bad commit message"] = testMaker.checkFail("fix: this has a typo;s", 1)
    ["check good commit message"] = testMaker.checkPass("fix: this is a correct commit message", 0)
  }
}

Comment thread pkl/builtins/harper.pkl Outdated
Comment on lines +17 to +18
// It will work as expected once this issue (https://github.com/webpro-nl/knip/commit/c182c29e35748ff044048c578b6bf7dd99dae9a8)
// is fixed.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This comment appears to be a leftover from a copy-paste. The linked commit is in the knip repository and seems unrelated to harper-cli. This could be confusing for future maintainers. Please remove this comment.

Comment thread pkl/builtins/harper.pkl Outdated
Comment on lines +17 to +18
// It will work as expected once this issue (https://github.com/webpro-nl/knip/commit/c182c29e35748ff044048c578b6bf7dd99dae9a8)
// is fixed.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will keep it as a draft until the version with this issue fixed is released.
Automattic/harper#2832

@hituzi-no-sippo hituzi-no-sippo force-pushed the feat/add-harper-to-builtin branch from 3f10b1d to 056c8e0 Compare March 2, 2026 13:24
@hituzi-no-sippo hituzi-no-sippo force-pushed the feat/add-harper-to-builtin branch from 056c8e0 to 09e945a Compare April 14, 2026 09:55
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 14, 2026

Greptile Summary

This PR adds two new builtins — harper (for prose files) and harper_commit_message (for commit messages) — using harper-cli as the grammar checker, along with the corresponding mise tool stub (harper-cli resolves correctly to aqua:Automattic/harper/harper-cli in the registry). The harper.pkl step includes check tests; harper_commit_message.pkl omits a tests block, which is inconsistent with project convention.

Confidence Score: 4/5

  • The PR is close to mergeable but has open feedback from previous review rounds that should be resolved first.
  • Previous thread discussions flagged a P1 concern (file-type coverage) that remains unresolved in the current diff. My review adds only a P2 finding (missing tests in harper_commit_message.pkl). Score of 4 reflects the outstanding thread work rather than any new blocking issue.
  • pkl/builtins/harper.pkl — open P1 feedback from prior review rounds still applies to this file.

Important Files Changed

Filename Overview
pkl/builtins/harper.pkl Adds harper-cli grammar-check step for prose files; has both a passing and failing test but there are open thread concerns about the types restriction and test filename consistency that are still unresolved.
pkl/builtins/harper_commit_message.pkl Adds a commit-message grammar check step; correct use of {{commit_msg_file}}, but no tests block contrary to project conventions.
test/builtin_tool_stubs/harper-cli Tool stub is correctly formed; harper-cli is registered in the mise short-name registry (resolves to aqua:Automattic/harper/harper-cli) and version 2.0.0 is current.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Git Hook Triggered] --> B{Hook Type}
    B -- pre-commit --> C[harper step]
    B -- commit-msg --> D[harper_commit_message step]

    C --> E["types = List('text')\nFilter staged files"]
    E --> F["harper-cli lint {{ files }}"]
    F --> G{Exit code?}
    G -- 0 --> H[Commit proceeds]
    G -- non-zero --> I[Commit blocked\nGrammar issues reported]

    D --> J["harper-cli lint {{commit_msg_file}}"]
    J --> K{Exit code?}
    K -- 0 --> H
    K -- non-zero --> L[Commit blocked\nGrammar issues in message]
Loading

Reviews (3): Last reviewed commit: "feat(grammar): add harper config to hk b..." | Re-trigger Greptile

Comment thread pkl/builtins/harper.pkl
@hituzi-no-sippo hituzi-no-sippo force-pushed the feat/add-harper-to-builtin branch from 09e945a to e314958 Compare April 14, 2026 10:06
Comment thread pkl/builtins/harper.pkl Outdated
https://github.com/Automattic/harper

Harper is an offline, privacy-first grammar checker written in Rust.
It provides fast, millisecond-level checking for prose and documentation
with support for Markdown, HTML, and other text formats.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@hituzi-no-sippo hituzi-no-sippo force-pushed the feat/add-harper-to-builtin branch from e314958 to d7f041e Compare April 14, 2026 10:10
@hituzi-no-sippo hituzi-no-sippo changed the title feat(grammar): add harper-cli config to hk builtin config feat(harper): add harper-cli config to hk builtin config Apr 14, 2026
@hituzi-no-sippo hituzi-no-sippo marked this pull request as ready for review April 14, 2026 10:56
@jdx jdx merged commit 5d3998c into jdx:main Apr 16, 2026
19 checks passed
@jdx jdx mentioned this pull request Apr 16, 2026
jdx added a commit that referenced this pull request Apr 16, 2026
### 🚀 Features

- **(harper)** add harper-cli config to hk builtin config by
[@hituzi-no-sippo](https://github.com/hituzi-no-sippo) in
[#714](#714)

### 🐛 Bug Fixes

- **(release)** add linux musl targets by [@jdx](https://github.com/jdx)
in [#829](#829)

### 🔍 Other Changes

- drop sub-crate submodules and publish hk to crates.io by
[@jdx](https://github.com/jdx) in
[#830](#830)

### 📦️ Dependency Updates

- lock file maintenance by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#826](#826)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Primarily a version/release bookkeeping change (docs, generated CLI
metadata, and lockfiles) with no runtime logic modifications in this
diff.
> 
> **Overview**
> Cuts release `v1.43.0` by bumping the crate version in
`Cargo.toml`/`Cargo.lock` and updating `CHANGELOG.md` with the 1.43.0
notes.
> 
> Regenerates versioned references across docs and CLI artifacts (e.g.,
`docs/*`, `docs/cli/*`, example `.pkl` files, and `hk.usage.kdl`) to
point at `v1.43.0` Pkl package URLs. Updates `mise.lock` to include
provenance metadata for the `communique` linux x64 artifact.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f4e6c35. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: mise-en-dev <[email protected]>
@hituzi-no-sippo hituzi-no-sippo deleted the feat/add-harper-to-builtin branch April 16, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants