The file is the registry's catch-all (~85 exports over unrelated domains), and index.ts re-exports all of it into every capability's namespace — which is why helpers get re-derived rather than reused, and why unrelated work keeps landing here. A comment alone would not stop the next addition, so the ceiling is enforced by test: helpers.freeze.test.ts fails when the file grows past its line or export count, and the failure message names where the logic should go instead. Both ceilings only ever drop — moving an export out to a focused module is the intended change, followed by lowering the constant. Verified by temporarily adding an export: both assertions fire. Records the policy in .agents/rules/typescript-style.md as well, since the ratchet explains what to do and the rule explains why.
1.6 KiB
1.6 KiB
description, globs, trigger
| description | globs | trigger |
|---|---|---|
| TypeScript and ESM coding conventions for seal-use codebase | src/**/*.ts | manual |
TypeScript & ESM Conventions
When modifying or adding TypeScript files in src/:
-
Module System & Import Extensions:
- Use ES modules exclusively.
- Local file imports MUST include explicit
.jsextensions (e.g.import { foo } from "./bar.js").
-
Validation & Typing:
- Validate external inputs, environment variables, and API responses with Zod or narrow TypeScript types.
- Avoid
any. Prefer precise domain types.
-
Code Style:
- 2-space indentation.
- Double quotes (
"). - Omitted trailing semicolons where possible.
camelCasefor functions/variables,PascalCasefor classes/types/interfaces.- Kebab-case filenames (e.g.
token-store.ts).
-
Architecture:
- Prefer small, cohesive domain functions over large generic utility files.
-
Frozen Utility Modules:
src/domains/seal/capabilities/helpers.tsis FROZEN: no new exports. It is the historical catch-all (~85 exports, re-exported into every capability's namespace viaexport *), andhelpers.freeze.test.tsfails CI when it grows past its line/export ceiling.- Put new logic in a focused module beside the domain that owns it. Moving an
existing export OUT of
helpers.tsis encouraged — then lower the ceiling constants in the ratchet test. - Apply the same instinct to any other module you are tempted to treat as a
scrap drawer: if the file's name is
helpers/utils/common, it is already a sign the logic belongs somewhere more specific.