{"_id":"@camelburrito/ratchet-kit","name":"@camelburrito/ratchet-kit","dist-tags":{"latest":"0.7.4"},"versions":{"0.7.4":{"name":"@camelburrito/ratchet-kit","version":"0.7.4","description":"Configurable strict-zero ratchet templates for keel-derived projects.","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"vitest run","prepublishOnly":"npm run build && npm run test"},"publishConfig":{"registry":"https://npm.pkg.github.com","access":"restricted"},"repository":{"type":"git","url":"git+https://github.com/camelburrito/keel.git","directory":"packages/ratchet-kit"},"peerDependencies":{"vitest":"^2.0.0"},"devDependencies":{"@types/node":"^20.0.0","typescript":"^5.6.0","vitest":"^2.0.0","@vitest/coverage-v8":"^2.0.0"},"engines":{"node":">=20"},"keywords":["ratchet","strict-zero","design-system","ci","keel"],"license":"MIT","private":false,"gitHead":"e14ed8c7e4213305ab0d1604552b9b117a3e5c1f","_id":"@camelburrito/ratchet-kit@0.7.4","bugs":{"url":"https://github.com/camelburrito/keel/issues"},"homepage":"https://github.com/camelburrito/keel#readme","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-vgAL7GC0bQzPk4kTMvGFdtcyQCqGxho8sxaaA3L8oDuClJnZyvZedYprnxHAcF6BllLo9OqR6lpjrU8GcFM2xA==","shasum":"0c702cccf76c36bf74612a40c8ac70c738fda4ce","tarball":"https://registry.npmjs.org/@camelburrito/ratchet-kit/-/ratchet-kit-0.7.4.tgz","fileCount":103,"unpackedSize":233121,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDWKvCUBzd2m9GezsfOc9eZYXyH7k2bGXxyj4HODzmOxAIgB57hNW8w0EHVGFYszHGWxrP8RiRmtp0CQNSMpxEDXhk="}]},"_npmUser":{"name":"camelburrito","email":"sriramkrish85@gmail.com"},"directories":{},"maintainers":[{"name":"camelburrito","email":"sriramkrish85@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ratchet-kit_0.7.4_1782875916636_0.42981025778620663"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-01T03:18:36.540Z","0.7.4":"2026-07-01T03:18:36.803Z","modified":"2026-07-01T03:18:36.943Z"},"maintainers":[{"name":"camelburrito","email":"sriramkrish85@gmail.com"}],"description":"Configurable strict-zero ratchet templates for keel-derived projects.","homepage":"https://github.com/camelburrito/keel#readme","keywords":["ratchet","strict-zero","design-system","ci","keel"],"repository":{"type":"git","url":"git+https://github.com/camelburrito/keel.git","directory":"packages/ratchet-kit"},"bugs":{"url":"https://github.com/camelburrito/keel/issues"},"license":"MIT","readme":"# @camelburrito/ratchet-kit\n\nConfigurable strict-zero ratchet templates for keel-derived projects.\n\n**Status:** stable — 23 ratchet templates, generalized from production use. See [keel playbook 07-ratchet-framework.md](../../docs/playbook/07-ratchet-framework.md).\n\n## What this package provides\n\n**Helpers** (shared utilities for any ratchet):\n- `stripTsLineAndBlockComments(src: string)`\n- `stripSwiftCommentsAndDebugBlocks(src: string)`\n- `stripSwiftPreviewBlocks(src: string)`\n- `countMatchesIgnoringBrands(matches, brands)`\n- `DeferralEntry` shape + `checkDeferralCount(actual, deferred)`\n\n**Ratchet templates** — each exported as a configurable function that takes a `RatchetConfig` (`{ root, extensions, expectedCounts?, ignoredDirs?, ignoredPrefixes?, ignoredFiles? }`). Available as of **v0.2.0**:\n\n| Export | Since | Defends |\n|--------|-------|---------|\n| `noInlineStyle` | v0.1 | inline `style={{}}` in `.tsx` (incl. `createElement` variant) |\n| `noBareHexInTsx` | v0.1 | bare `#hex` (3/6/8-char) in `.tsx` / `.ts` |\n| `noBareHexInCss` | v0.1 | bare `#hex` in `.css` outside tokens |\n| `noBarePxInCss` | v0.1 | bare `Npx` in `.css` (skips `--token:` declarations) |\n| `noConsoleInSource` | v0.1 | `console.*` calls with `-- <rationale>` disable-directive support |\n| `noImportantCss` | v0.2 | `!important` declarations |\n| `no3CharHexInTsx` | v0.2 | 3-char hex shorthand in `.tsx` / `.ts` (companion to `noBareHexInTsx`) |\n| `noBareRgbaInCss` | v0.2 | `rgba(...)` call sites in `.css` (each counts independently) |\n| `noBareHexInSwift` | v0.2 | bare `#hex` + `0xNN / 255` in `.swift` (skips `//`, `#if DEBUG`, `#Preview {}`) |\n| `noBareSizeInSwift` | v0.3 | `.padding(N)` / `.cornerRadius(N)` / `.frame(width:height:)` / `.offset(x:y:)` / `Spacing.custom(N)` / `let X: CGFloat = N` (Design-intent escape supported) |\n| `noBareDurationInSwift` | v0.3 | `duration: N`, `.seconds/.milliseconds(N)`, `.delay(N)`, `asyncAfter`, `withTimeInterval:`, `.spring(response:)` |\n| `noBareFontSizeInSwift` | v0.3 | `.system(size: N)`, `.custom(..., size: N)`, `UIFont.systemFont(ofSize: N)`, `UIFont(name:size:)` |\n| `noBareColorConstructorInSwift` | v0.3 | bare `Color(red: <numeric>, ...)` constructor calls |\n| `noBareFontPropertyInCss` | v0.4 | bare `font:` shorthand / `font-family` literals in `.css` |\n| `noBareViewportEmInCss` | v0.4 | bare viewport (`vw`/`vh`) + `em` literals in `.css` |\n| `noStaleE2eSelectors` | v0.4 | testid literals in `e2e/**` specs that no longer exist in production source |\n| `noPathsFilterWithoutFetchDepthZero` | v0.4 | `dorny/paths-filter` usage without a preceding `fetch-depth: 0` checkout |\n| `noBareHexInCodegenOutput` | v0.5 | bare `#hex` in named codegen-output files (var()-reference regression gate) |\n| `lockfileSyncWithPackageJson` | v0.5 | per-codebase `package-lock.json` carries every `package.json` dependency |\n| `ratchetListPrecommitVsWorkflow` | v0.5 | the pre-commit hook + CI workflow run the same ratchet set (drift gate) |\n| `noUndefinedTokens` | v0.6 | `var(--xyz)` references in consumer CSS resolve to declared tokens |\n| `archDocIntegrity` | v0.7 | every `docs/architecture/*.md`: links/anchors resolve (GitHub-exact slug), fully-qualified cited paths exist (incl. `file:line`), mermaid has no GitHub-renderer traps (`\\n`→`<br/>`, `&&`, raw `<tag>`, `\\\"`→`#quot;`, a `.` in a `-. dotted .->` edge label, `;` in sequenceDiagram text), every filled mermaid `classDef`/`style` pins a text `color:` (dark-mode legibility), footer present. Config: `{ archDir, repoRoot, topLevelDirs, ephemeralPrefixes? }`. |\n| `noAdaptiveFgOnKeptLightIsland` | v0.7 | dark-mode polarity: fails a CSS rule / SwiftUI modifier-run that paints an adaptive foreground on a kept-light island background. Adaptive set self-derived from `tokens.json` `darkColor`. Config: `{ tokensJsonPath, cssRoot?, swiftRoots? }`. |\n\n**On the roadmap (graduate as patterns prove portable across projects):**\n\n`noBareFirebaseUidInLogger`, `cfUtilsTarballsCommitted`.\n\n## Usage\n\n```ts\n// my-project/src/__tests__/ratchets.test.ts\nimport {\n  noInlineStyle,\n  noConsoleInSource,\n  noBareHexInTsx,\n} from '@camelburrito/ratchet-kit';\n\nnoInlineStyle({\n  paths: ['src/**/*.tsx', '!src/__tests__/**'],\n  expectedCounts: {}, // strict-zero\n});\n\nnoConsoleInSource({\n  paths: ['src/**/*.{ts,tsx}', 'functions/**/*.ts'],\n  allowDisableDirectives: true, // require -- <rationale> segment\n});\n\nnoBareHexInTsx({\n  paths: ['src/**/*.tsx'],\n  expectedCounts: {\n    'src/legacy/OldComponent.tsx': { count: 3, rationale: 'pre-migration baseline' },\n  },\n});\n```\n\n## What this package does NOT provide\n\nProject-specific ratchets (e.g., one locking a renamed design token out of a codebase) — those are not portable. Use the exported helpers to author them; see [recipes/add-a-ratchet.md](../../recipes/add-a-ratchet.md).\n\n## Versioning\n\nSemver. Breaking changes require a major bump.\n\n## Publishing\n\nPublishes to GitHub Packages on tag push (`v*.*.*`) via `.github/workflows/publish.yml` in the keel repo.\n","readmeFilename":"README.md","_rev":"1-36b2969b840a4681e8e71b4ba2d17dc1"}