Skip to content

feat(init): add auto-detection and interactive mode#656

Merged
jdx merged 4 commits intomainfrom
feat/interactive-init
Feb 1, 2026
Merged

feat(init): add auto-detection and interactive mode#656
jdx merged 4 commits intomainfrom
feat/interactive-init

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Jan 31, 2026

Summary

  • Auto-detect project files (package.json, Cargo.toml, pyproject.toml, go.mod, Gemfile, Dockerfile, .github/workflows, etc.) and suggest relevant builtins
  • Add -i/--interactive flag for manual selection with fuzzy picker
  • Extract builtin metadata (category, description, globs) at build time
  • Generate well-formatted hk.pkl based on detected/selected builtins

Usage

# Auto-detect and generate (default behavior)
$ hk init
Detected: prettier (package.json), eslint (package.json), biome (package.json)
Created hk.pkl

# Interactive mode - pick from all builtins
$ hk init -i

Test plan

  • hk init in empty directory generates default template
  • hk init with package.json detects JS/TS linters
  • hk init with Cargo.toml detects Rust linters
  • hk init with pyproject.toml detects Python linters
  • hk init with go.mod detects Go linters
  • hk init with .github/workflows detects actionlint/zizmor
  • hk init --force overwrites existing file
  • hk init --mise generates mise.toml
  • All unit tests pass
  • All integration tests pass

🤖 Generated with Claude Code


Note

Medium Risk
Medium risk because it adds new config-generation behavior (hk init), introduces a new interactive dependency (demand), and changes build-time codegen/CI steps that could affect releases if metadata generation is missing or mismatched.

Overview
hk init is revamped to auto-detect relevant builtins from the current project (via new per-builtin project_indicators) and generate a tailored hk.pkl, with a new -i/--interactive mode that lets users select linters and hooks via a fuzzy multi-select.

Build tooling now generates and consumes pkl/builtins_meta.json (category/description/indicators) to produce a compiled BUILTINS_META table; CI and mise tasks were updated to run pkl:gen (including on Windows), and pkl/builtins_meta.json is ignored. Tests were expanded to cover detection and init behaviors like --force and --mise.

Written by Cursor Bugbot for commit 965b1a2. This will update automatically on new commits. Configure here.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Comment thread src/cli/init/generator.rs
Comment thread src/cli/init/mod.rs Outdated
Comment thread src/cli/init/mod.rs Outdated
@jdx jdx force-pushed the feat/interactive-init branch 3 times, most recently from 830fdb3 to 249a374 Compare January 31, 2026 23:41
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Jan 31, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​demand@​1.8.29910093100100

View full report

Comment thread mise-tasks/pkl/gen Outdated
@jdx jdx force-pushed the feat/interactive-init branch 2 times, most recently from 61f3d7f to 397fb33 Compare January 31, 2026 23:57
Comment thread build/generate_builtins.rs Outdated
Comment thread src/cli/init/mod.rs
@jdx jdx force-pushed the feat/interactive-init branch from 397fb33 to 28ed0fa Compare February 1, 2026 00:01
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is ON, but a Cloud Agent failed to start.

Comment thread build/generate_builtins.rs Outdated
Comment thread src/cli/init/picker.rs
Comment thread src/cli/init/generator.rs
import "package://github.com/jdx/hk/releases/download/v{version}/hk@{version}#/Builtins.pkl"

"#
));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Duplicated package URL template in generator functions

Low Severity

The package URL pattern package://github.com/jdx/hk/releases/download/v{version}/hk@{version}#/... is duplicated in both generate_pkl() (lines 8-13) and generate_default_template() (lines 76-78). Extract a shared helper function to generate the header with amends and import statements.

Fix in Cursor Fix in Web

- Auto-detect project files (package.json, Cargo.toml, pyproject.toml,
  go.mod, Gemfile, Dockerfile, .github/workflows, etc.) and suggest
  relevant builtins
- Add -i/--interactive flag for manual selection with fuzzy picker
- Extract builtin metadata (category, description, globs) at build time
- Generate well-formatted hk.pkl based on detected/selected builtins

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jdx jdx force-pushed the feat/interactive-init branch from 28ed0fa to b4787a3 Compare February 1, 2026 00:10
- Fail build on malformed builtins_meta.json instead of silent fallback
- Reuse DEFAULT_HOOKS constant in picker.rs to avoid duplication

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@thejcannon
Copy link
Copy Markdown
Contributor

I was thinking of adding a config field to steps (with the semantics that if you've changed a config file, we'd run on all files)

That might be helpful as well

jdx and others added 2 commits February 1, 2026 10:13
Write to a temp file and mv into place to prevent cargo clippy's build
script from reading a half-written file when pkl:gen runs concurrently.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract gen logic into a cross-platform Python script and add a
PowerShell (.ps1) file task wrapper so mise discovers it on Windows.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jdx jdx merged commit dacb2b5 into main Feb 1, 2026
18 checks passed
@jdx jdx deleted the feat/interactive-init branch February 1, 2026 10:45
@jdx jdx mentioned this pull request Feb 1, 2026
jdx added a commit that referenced this pull request Feb 1, 2026
### 🚀 Features

- **(init)** add auto-detection and interactive mode by
[@jdx](https://github.com/jdx) in
[#656](#656)
- **(stash)** use haiku names for stash patch backups by
[@jdx](https://github.com/jdx) in
[#655](#655)
- add git worktree support by [@jdx](https://github.com/jdx) in
[#651](#651)
- add "did you mean?" suggestions for typos by
[@jdx](https://github.com/jdx) in
[#654](#654)

### 🚜 Refactor

- use xx utilities and drop unused dependencies by
[@jdx](https://github.com/jdx) in
[#653](#653)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk release bookkeeping: mainly version string/package URL
updates and regenerated CLI docs, with no substantive runtime logic
changes.
> 
> **Overview**
> Releases **v1.35.0** by updating crate versions
(`Cargo.toml`/`Cargo.lock`) and adding the `1.35.0` entry to
`CHANGELOG.md`.
> 
> Regenerates documentation and examples to reference `v1.35.0` package
URLs and CLI version metadata, and updates `hk init` docs/usage to
include the new `--interactive` flag.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
46c426e. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: mise-en-dev <123107610+mise-en-dev@users.noreply.github.com>
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