Distribute hk tasks via gtb hk + mise.tasks.toml, add hk preset#160
Conversation
Ports the mise-tasks/hk/all and hk/base bash scripts into testable TS leaf commands under `gtb hk`. The pure planners (resolveBaseRef, hkMode, planHkAll, planHkBase) are unit-tested; the thin runner does the git I/O. Spawning hk from Node via cross-spawn removes the Git Bash PATH dance (lib.sh run_native) and the IFS/glob file-splitting — Node CreateProcess-es hk.exe with the already-Windows PATH and passes files as argv. HK_BATCH=1 is still forced on `hk all` since hk itself shells each step through cmd.exe (jdx/hk#971); `hk base` leaves it unset for small changesets. Adds a capture() process helper for the base-diff git queries. Not yet wired into mise or hk.pkl — follow-up commits replace the bash tasks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a generated, sync-owned mise.tasks.toml that wires the hk:all / hk:base mise tasks to `gtb hk`, replacing the mise-tasks/ bash scripts (and lib.sh) deleted here. The tasks resolve gtb explicitly since mise runs outside pnpm and node_modules/.bin is off PATH: consumers via `pnpm exec gtb`, self-hosted tooling via the `pnpm run gtb` shim. `gtb sync` now takes positional scope args (e.g. `gtb sync mise`) so the tasks file can be regenerated standalone, without a full workspace sync — useful for repos that adopt the hk preset but not the build pipeline. No args keeps the full sync. The `[task_config] includes` line that loads the file stays a manual, one-time edit (gtb verify asserts it via smol-toml) so sync never round-trips the comment-heavy mise.toml. An explicit includes replaces mise's default mise-tasks/ discovery, so consumers keeping their own script tasks list both: includes = ["mise-tasks", "mise.tasks.toml"]. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds the same positional scope args to `gtb verify` (e.g. `gtb verify mise`) so an hk-preset adopter can check just the mise include without the build-pipeline checks (turbo.json, tsconfigs, scripts) flagging artifacts they never manage. No args checks everything, as before. Extracts the scope tuple, type, and parser from sync.ts into a shared lib/sync-scopes.ts that both commands import, and neutralizes the parse error message (was "sync:"-prefixed). The codecov/mise checks keep their existing self-skip gates (no vitest tests / no mise.toml) — applicability is orthogonal to the requested scope. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Factors the reusable hk building blocks out of hk.pkl into a shared hk/Defaults.pkl: the lockfiles/batchFiles primitives, a fileHygiene mapping (the four builtins with exclude+batch pre-wired), forbidSubmodules, and renovateConfig. tooling imports it by relative path — self-host can't package://-import its own unpublished release, the same own-repo-vs-consumer split as the `./` workflow refs. Consumer package:// distribution is a follow-up. hk.pkl now spreads Defaults.fileHygiene, references forbidSubmodules, and derives both renovate steps from Defaults.renovateConfig (renovate-preset just retargets the glob to default.json), dropping the duplicated check command and the inline boilerplate. Broadens the Renovate customManager from hk.pkl to any .pkl file so the hk version embedded in Defaults.pkl's package URLs stays in lockstep too; the matchStrings only fire on the hk release URL, so other pkl files are inert. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Updates AGENTS.md (structure tree, hk pre-commit + mise-task sections), the gtb-build-pipeline skill (gtb hk command, scoped sync/verify, mise.tasks.toml generation + trigger keywords), and the README consumer setup blurb to match the task-distribution and hk-preset changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (27)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
💤 Files with no reviewable changes (3)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (3)default.json📄 CodeRabbit inference engine (AGENTS.md)
Files:
README.md📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.test.{js,ts}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (2)📓 Common learnings📚 Learning: 2026-06-04T02:26:02.824ZApplied to files:
🪛 LanguageToolAGENTS.md[grammar] ~107-~107: Ensure spelling is correct (QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1) 🔇 Additional comments (28)
📝 WalkthroughWalkthroughThis PR replaces bash-based ChangesHK command and scope-aware configuration generation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Codecov Report❌ Patch coverage is ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Extracts the hk runner orchestration into executeHkAll / executeHkBase with injected I/O (capture/run/env) so the shallow-fetch, diff, and skip-vs-spawn logic is unit-tested without spawning git/hk — the citty wrappers wire the real deps. Adds direct tests for process.capture(). Lifts patch coverage back over the 80% gate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- hk/Defaults.pkl: move gitlinkGuardPosix next to its only usage - pnpm-workspace.yaml: pin smol-toml to an exact version - default.json: drop the hard-coded .pkl file list from the customManager description (the pattern matches any .pkl) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Distributes the hk pre-commit setup as reusable, sync-owned config instead of bash scripts, and factors the shared hk steps into a Pkl preset.
gtb hk(all/base) — ports themise-tasks/hk/*bash into a testable TS leaf command (CIcheckvs localfix, shallow-clone base fetch,HK_BATCHbatching for the Windowscmd.exearg limit). Spawning hk from Node removes the Git Bashrun_native/cygpathPATH dance and theIFSfile-splitting entirely.mise.tasks.toml— generated bygtb sync, wiringhk:all/hk:basetogtb hk. Loaded via a one-time manual[task_config] includesline thatgtb verifyasserts (so sync never round-trips the comment-heavymise.toml). The task resolvesgtbper repo shape: self-hosted →pnpm run gtb; depends on@gtbuchanan/cli→pnpm exec gtb; hk-only adopter → baregtbfrom mise'snpm:backend (nonode_modulesneeded).gtb sync/gtb verify— positional scope args (codecov,mise,scripts,tsconfig,turbo), e.g.gtb sync mise/gtb verify mise, so the hk tasks can be (re)generated/checked standalone without a full workspace sync. No args = all. Shared parser inlib/sync-scopes.ts.hk/Defaults.pkl— shared hk preset (fileHygiene,forbidSubmodules,renovateConfig,lockfiles/batchFiles).hk.pklimports it by relative path (self-host can'tpackage://-import its own unpublished release — same trap as the./workflow refs). The RenovatecustomManagernow covers all.pklURLs.Validation
246 unit tests, typecheck, lint, full
@gtbuchanan/clibuild + e2e,pkl evalon both Pkl files, and the livemise run hk:base→gtb hk→hkchain (plus the refactored preset running in this PR's own pre-commit hooks).gtb verifyclean.Follow-up
Pkl publishing is deferred —
Defaults.pklis self-host-only; consumerpackage://distribution (PklProject +cd.ymlpublish + Renovate manager for the gtbuchanan URL) is a separate PR.🤖 Generated with Claude Code