chore: adopt AI agent harness

This commit is contained in:
2026-08-06 15:12:10 +09:00
parent 33c5924582
commit 998ae26c90
6 changed files with 342 additions and 0 deletions

23
.agent/consumer.md Normal file
View File

@@ -0,0 +1,23 @@
## KriFrontCommon Consumer Contract
### Package Usage
- Consume this contract through the published `@kri/common` package and only through entry points declared in its `package.json` `exports` map.
- Use the package root for runtime-neutral object, URL, date, string, and shared type utilities.
- Use a focused subpath such as `@kri/common/http`, `@kri/common/browser`, `@kri/common/server`, `@kri/common/security`, `@kri/common/hooks`, `@kri/common/query`, `@kri/common/config`, `@kri/common/jotai`, or `@kri/common/noti-hub` for the corresponding capability.
- Do not import from `@kri/common/src/*`, `@kri/common/dist/*`, or another undeclared deep path.
- Do not copy or fork a shared utility locally merely to avoid using an available public entry point. Propose a backward-compatible library addition when the shared contract is genuinely missing.
### Runtime and Optional Integrations
- Keep browser, server, and runtime-neutral imports on their intended side of the application boundary.
- A consumer that uses React hooks, TanStack Query, or Jotai integrations must provide the compatible optional peer dependency required by its selected entry point.
- Preserve the project's established HTTP client, authentication, error-policy, query-client, storage, and environment conventions when adopting a shared helper.
- Validate external data at runtime; a shared TypeScript type alone does not validate an API response or persisted value.
- Prefer named public exports and retain the consumer project's current module system and bundler conventions.
### Change Safety
- Pin or constrain the package version according to the consumer repository's dependency policy and commit its lockfile changes.
- Review release notes and the actual affected API before upgrading. Run the consumer's focused type-check, test, and build commands after an upgrade.
- Do not modify KriFrontCommon or another consumer repository unless it is explicitly included in the approved task scope.

16
.agent/profile.yml Normal file
View File

@@ -0,0 +1,16 @@
schema_version: 1
project:
id: kri-front-common
name: KriFrontCommon
type: library
layer: frontend
legacy: false
stack:
- typescript
- react
shared_contracts:
provides:
- kri-front-common

25
.agent/project.md Normal file
View File

@@ -0,0 +1,25 @@
## 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.