26 lines
2.0 KiB
Markdown
26 lines
2.0 KiB
Markdown
## 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.json` `exports`, 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 from `src`, `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.
|
|
- `src` is the source of truth. `dist` and declaration files are generated artifacts and must not be edited directly.
|
|
|
|
### TypeScript and Dependency Rules
|
|
|
|
- Preserve ESM, `NodeNext` module resolution, explicit `.js` relative 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 typecheck` for source changes and `npm run build` when declarations or package output may change.
|
|
- Inspect the relevant `dist` entry points and generated declarations after changing exports.
|
|
- Update `.agent/consumer.md` and 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.
|