2.0 KiB
2.0 KiB
KriFrontCommon Repository Rules
Repository Role and Public Surface
- This repository publishes the ESM package
@kri/common; the repository name and package name intentionally differ. - Treat
package.jsonexports, exported TypeScript declarations, entry-point behavior, and documented environment requirements as public contracts. - Supported entry points are the package root and the explicitly declared subpaths in
package.json. Do not create or document imports fromsrc,dist, or another undeclared path. - Keep runtime-specific code separated. Browser-only APIs must not leak into server entry points, and server-only behavior must not enter browser bundles.
srcis the source of truth.distand declaration files are generated artifacts and must not be edited directly.
TypeScript and Dependency Rules
- Preserve ESM,
NodeNextmodule resolution, explicit.jsrelative import specifiers, declaration generation, and the current strict compiler options. - Keep exported types narrow and backward-compatible. Review any changed function signature, default, thrown error, serialization shape, or type export as a consumer-facing change.
- React, TanStack Query, and Jotai integrations are optional. Do not make an optional peer mandatory for consumers that use only core utilities.
- Do not add hidden global state for configuration, authentication, HTTP error handling, or query behavior.
- Never expose secrets or server-only environment values through browser-facing configuration helpers.
Verification and Release Boundary
- Install with the repository's selected package manager and lockfile.
- Run
npm run typecheckfor source changes andnpm run buildwhen declarations or package output may change. - Inspect the relevant
distentry points and generated declarations after changing exports. - Update
.agent/consumer.mdand human-facing documentation in the same approved change when a public contract changes. - Version changes, publication, registry changes, and consumer-repository edits require separate explicit approval.