chore: scaffold prek pre-commit hooks for local quality gates#47
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughAdds pre-commit hooks and a secrets baseline; tweaks CI/infra and workspace config formatting; reformats docs, tests, and TypeScript exports/imports; and implements Rust's Default for ByteStorage (delegates to new()). All behavior-preserving except for the ByteStorage Default impl. ChangesDeveloper tooling, code formatting, and configuration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.nvmrc:
- Line 1: Update .nvmrc to match CI by changing the single line from "20" to
"22" so local tooling uses the same Node major as CI and the majority of
packages, and if you intentionally need to stay on 20 instead, add a short note
in the repo (e.g., README or CONTRIBUTING) explaining the reason and any special
steps; also verify and, if needed, align the "engines" field in package.json
workspace and individual packages with the chosen major to avoid mismatches with
CI build-matrix expectations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1a4d9ee7-9190-46ee-b0ae-2dff6e0a5c56
📒 Files selected for processing (23)
.github/actionlint.yaml.github/workflows/ci.yml.gitignore.nvmrc.pre-commit-config.yaml.secrets.baselineREADME.mdSECURITY.mdpackages/cachekit-core-ts/CHANGELOG.mdpackages/cachekit-core-ts/src/lib.rspackages/cachekit/CHANGELOG.mdpackages/cachekit/README.mdpackages/cachekit/src/index.tspackages/cachekit/src/intents.test.tspackages/cachekit/src/intents.tspackages/cachekit/test/integration/encryption-real-crypto.integration.test.tspackages/cachekit/test/integration/redis-backend.integration.test.tspackages/cachekit/test/protocol/aad-format.protocol.test.tspackages/cachekit/test/protocol/cross-sdk-interop.protocol.test.tspnpm-workspace.yamlrelease-please-config.jsontsconfig.jsonvitest.workspace.ts
Adds .pre-commit-config.yaml driving prek (Rust reimplementation of pre-commit, drop-in compatible). Hooks run locally before each commit to catch issues that previously only surfaced in CI. Pre-commit stage: - ESLint --fix on staged .ts in packages/cachekit/src - Prettier --write on staged ts/js/json/md/yaml/yml - cargo fmt --check and cargo clippy -D warnings on Rust changes - actionlint on .github/workflows (with cachekit-lean/cachekit self-hosted labels whitelisted via .github/actionlint.yaml) - pre-commit-hooks: trailing-whitespace, end-of-file-fixer, check-yaml, check-json, check-toml, check-added-large-files (1MB cap), check-merge-conflict, check-case-conflict - detect-secrets against .secrets.baseline (16 known test fixtures baselined: ck_test_* keys, deterministic hex test vectors) Pre-push stage: - pnpm type-check (full repo, too slow for pre-commit) Side-effect fixes uncovered by the new hooks (these were latent issues the lack of pre-commit was hiding): - cargo fmt normalisations in packages/cachekit-core-ts/src/lib.rs - impl Default for ByteStorage (clippy::new_without_default) - trailing newline added to .nvmrc and .gitignore - prettier reflow across READMEs, CHANGELOGs, intents.ts, test files, tsconfig.json, vitest.workspace.ts, etc. Install (one-time per clone): prek install --install-hooks Existing local pre-commit hooks (e.g. personal caliber refresh) are preserved automatically — prek migrates them to .legacy and chains them.
bf94935 to
7fd6bda
Compare
Node 20 (Iron LTS) reached end-of-life on 2026-04-30. CI already runs Node 22 (and matrix [22, 24]); both publishable packages declare engines.node ">=22.0.0". The .nvmrc and root engines field were the last places lagging at 20 — fixed for consistency so fresh clones via nvm use land on a supported runtime that actually satisfies the per-package engines constraint. Addresses CodeRabbit review on PR #47.
…2 release (#52) ## Summary Two real documentation fixes that double as the trigger commit for the 0.1.2 recovery release. ### `packages/cachekit/README.md` - `Requirements: Node.js 18+` was stale. PR #47 bumped `engines.node` to `>=22.0.0` across all packages. README now matches: `Node.js 22+`. - Added a short version-history note explaining the `0.1.0 → 0.1.2` jump on npm so consumers don't think 0.1.1 is missing or yanked. ### `packages/cachekit-core-ts/README.md` (new) Every npm-published package should have a README. This one didn't. Added a minimal one covering: - What the package is and that consumers shouldn't install it directly - The 5 prebuilt platform packages and how `optionalDependencies` selects one - A summary of the public N-API surface - The same 0.1.0 → 0.1.2 version note ## Why this is the bootstrap commit for 0.1.2 The commit touches both `packages/cachekit/` and `packages/cachekit-core-ts/` paths so release-please picks both packages up for a coordinated release. The `Release-As: 0.1.2` trailer skips 0.1.1 (which exists as a git tag but never reached npm) and forces release-please to propose 0.1.2 directly. Type is `docs:` because that's what the changes honestly are — no code behavior changes. The `Release-As:` trailer is what triggers the release, not the type. ## What happens after this merges 1. release-please.yml fires on push to main 2. release-please scans commits since the last published manifest, sees the `Release-As: 0.1.2` trailer and the path touches → opens a release PR titled `chore: release main` proposing 0.1.2 for both packages 3. Merging that release PR cuts tags `cachekit-v0.1.2` and `cachekit-core-ts-v0.1.2` 4. `release-please.yml publish-cachekit` runs (auth fix from PR #45 is in place) → publishes `@cachekit-io/cachekit@0.1.2` 5. The core-ts tag triggers `build-native.yml` → publishes `@cachekit-io/cachekit-core-ts@0.1.2` + creates all 5 platform packages on npm (napi flag fix from PR #51 is in place) After step 5, all 7 packages exist on npm — at which point you can: 6. Configure trusted publishers on npmjs.com for each 7. Take PR #50 out of draft and merge it 8. Delete the `NPM_TOKEN` repo secret after the next OIDC-based release confirms the loop ## Fallback if release-please ignores `Release-As:` on a `docs:` commit If release-please's defaults don't pick up `Release-As:` from a non-releasing commit type, the fallback is to: - Bump both `package.json` files to 0.1.2 directly - Update `.release-please-manifest.json` to 0.1.2 for both packages - Manually create and push the tags I'd open that as a follow-up PR if needed — keeping the doc-fix and the release-trigger separate. ## Test plan - [x] Local validation via prek (no hooks affected by markdown-only changes) - [ ] CI green on this PR - [ ] After merge: confirm release-please opens a 0.1.2 PR within a few minutes - [ ] Merge the release PR and watch both publish workflows go green <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added comprehensive documentation for the native binding package, including installation guidance and platform support details * Updated minimum Node.js version requirement to 22+ * Clarified version and release information <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/cachekit-io/cachekit-ts/pull/52?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Adds a robust pre-commit toolchain to
cachekit-ts. Before this change, this repo had zero committed pre-commit tooling — quality gates only fired in CI, every contributor (fork or otherwise) found out about lint/format/type errors via GitHub. This PR closes that gap, matching the pattern already in place in sibling reposcachekit-pyandcachekit-rs.Uses prek (Rust reimplementation of pre-commit, drop-in compatible) — consistent with the workspace tooling preference. Python
pre-commitworks identically against the same config.What runs when
Pre-commit stage (every
git commit):*.ts/*.tsxinpackages/cachekit/src*.{ts,tsx,js,mjs,cjs,json,md,yaml,yml}packages/cachekit-core-ts/**/*.rsstagedpackages/cachekit-core-ts/**/*.rsstaged.github/workflows/*.ymlstaged.secrets.baselinePre-push stage (slow gates, run once per branch):
pnpm type-checkSide-effect fixes
The new hooks surfaced latent issues that were hidden by the absence of pre-commit. Bundled into this PR so the repo is green on first merge:
cargo fmtnormalisations inpackages/cachekit-core-ts/src/lib.rs(import ordering, multi-lineformat!()wrapping)impl Default for ByteStorage— fixesclippy::new_without_defaultviolation that was already a#![deny(clippy::all)]failure.nvmrcand.gitignoreintents.ts, test files,tsconfig.json,vitest.workspace.ts,pnpm-workspace.yaml,release-please-config.json.github/actionlint.yamladded to whitelist thecachekit-leanandcachekitself-hosted runner labels (otherwise actionlint flags 7 lines in CI workflows).secrets.baselinecommitted with 16 baselined test fixtures (allck_test_*API keys + deterministic cross-SDK hex test vectors — verified false positives)Install (one-time per clone)
(Or
pre-commit install --install-hooksif you don't have prek.)Existing local hooks (e.g. personal
caliber refresh) are migrated to.legacyand chained automatically — nothing breaks.Test plan
prek run --all-files→ all 14 hooks passpnpm build→ 2/2 packages succeedpnpm test→ 456/457 passes (1 skipped)cargo clippy --all-targets -- -D warnings→ cleanpnpm type-check(verified via push)Out of scope
main(admin action, separate)CONTRIBUTING.md/CODE_OF_CONDUCT.md(separate, follow-up)0.1.0 → 0.1.1drift inpackages/cachekit-core-ts/index.js(stale napi-generated artifact, unrelated)Summary by CodeRabbit