GenPM モジュール共通の型:コンテンツ、サイトマップ、検索、管理リソース、決済、イベント
コード10 ファイルコンテキスト約 532 トークンスキャン合格
インストール
$
genpm add @core/contracts含まれるもの
- src/lib/contracts/ にソースコード(10 ファイル)。 (13.3 KB)
- src/lib/contracts/AGENTS.md に AI ルール、加えて IDE 用のルールファイル。
README
このパッケージには README がありません。
約 532 トークン→ src/lib/contracts/AGENTS.md→ .cursor/rules/genpm-core-contracts.mdc
これは AI が src/lib/contracts で作業するときに読む内容そのものです。それ以外はコンテキストに追加されません。
@core/contracts — rules for AI agents
Purpose
Types and small zod schemas shared by GenPM catalog modules, so a module can consume "anything that provides content /
sitemap URLs / search documents / admin resources / payments" without importing the concrete module. No logic, no
tables, no runtime dependency besides zod.
Map
index.ts— public API. Import from here only.content.ts—ContentSource,ContentEntry(implemented by @core/content and CMS adapters).sitemap.ts—SitemapSource(consumed by @core/seo).search.ts—SearchSource,SearchDocument(consumed by @core/search).admin.ts—AdminResource,AdminField(consumed by @core/admin).payment.ts—PaymentProvider(implemented by @core/checkout, used by @core/orders).events.ts—CommerceEvent,LeadEventand their zod schemas (consumed by @core/pixels).money.ts—Money(integer minor units + ISO 4217 code).
Integration
- Usually installed as a dependency of another module; nothing to wire.
- To expose your own data to the admin, sitemap or search, implement the type and register it in the project file
the consuming module documents (
src/genpm/admin.ts,src/genpm/seo.ts,src/genpm/search.ts):import { defineSitemapSource } from './lib/contracts/index.ts'; export const projects = defineSitemapSource({ name: 'projects', async *urls() { yield { loc: '/projects' }; } }); - Validate untrusted tracking payloads with
TrackedEventSchema.parse(body)before forwarding them.
Conventions
- Money is always
{ amount: integer minor units, currency: 'EUR' }; never floats. - Sources are async iterables: stream rows in pages, don't load whole tables into memory.
AdminResource.inputvalidates create/update input; permissions are<resource>:<action>(posts:update).
Don't
- Don't add implementations or helpers with behaviour here; put them in the module that owns the concept.
- Don't change an existing type incompatibly: every catalog module depends on it (major version of the whole train).
- Don't import other modules from this folder.
# @core/contracts — rules for AI agents
## Purpose
Types and small zod schemas shared by GenPM catalog modules, so a module can consume "anything that provides content /
sitemap URLs / search documents / admin resources / payments" without importing the concrete module. No logic, no
tables, no runtime dependency besides `zod`.
## Map
- `index.ts` — public API. Import from here only.
- `content.ts` — `ContentSource`, `ContentEntry` (implemented by @core/content and CMS adapters).
- `sitemap.ts` — `SitemapSource` (consumed by @core/seo).
- `search.ts` — `SearchSource`, `SearchDocument` (consumed by @core/search).
- `admin.ts` — `AdminResource`, `AdminField` (consumed by @core/admin).
- `payment.ts` — `PaymentProvider` (implemented by @core/checkout, used by @core/orders).
- `events.ts` — `CommerceEvent`, `LeadEvent` and their zod schemas (consumed by @core/pixels).
- `money.ts` — `Money` (integer minor units + ISO 4217 code).
## Integration
1. Usually installed as a dependency of another module; nothing to wire.
2. To expose your own data to the admin, sitemap or search, implement the type and register it in the project file
the consuming module documents (`src/genpm/admin.ts`, `src/genpm/seo.ts`, `src/genpm/search.ts`):
```ts
import { defineSitemapSource } from './lib/contracts/index.ts';
export const projects = defineSitemapSource({ name: 'projects', async *urls() { yield { loc: '/projects' }; } });
```
3. Validate untrusted tracking payloads with `TrackedEventSchema.parse(body)` before forwarding them.
## Conventions
- Money is always `{ amount: integer minor units, currency: 'EUR' }`; never floats.
- Sources are async iterables: stream rows in pages, don't load whole tables into memory.
- `AdminResource.input` validates create/update input; permissions are `<resource>:<action>` (`posts:update`).
## Don't
- Don't add implementations or helpers with behaviour here; put them in the module that owns the concept.
- Don't change an existing type incompatibly: every catalog module depends on it (major version of the whole train).
- Don't import other modules from this folder.
.genpmignore 適用後に組み込まれる正確なツリーです。固定先:
// Fuente de contenido: lo implementan @core/content y los adaptadores (Payload, Keystatic); lo consumen blog,
// blocks, site y los kits sin saber de dónde viene el contenido.
export type ContentStatus = 'draft' | 'scheduled' | 'published' | 'archived';
export type ContentEntry<D = Record<string, unknown>> = {
id: string;
collection: string;
slug: string;
locale: string;
status: ContentStatus;
data: D;
publishedAt: Date | null;
updatedAt: Date;
};
export type ContentReadOptions = {
/** Idioma pedido; sin entrada en ese idioma, la fuente devuelve la del idioma por defecto. */
locale?: string;
/** Incluir borradores (solo con un token de vista previa válido). */
draft?: boolean;
};
export type ContentListQuery = ContentReadOptions & {
limit?: number;
offset?: number;
/** Campo de orden: `publishedAt`, `updatedAt`, `slug` o un campo de `data`. Prefijo `-` = descendente. */
orderBy?: string;
/** Igualdad sobre campos de `data` (p. ej. `{ category: 'news' }`). */
where?: Record<string, string | number | boolean | null>;
/** El campo de `data` es una lista que contiene este valor (p. ej. `{ tags: 'news' }`). */
contains?: Record<string, string>;
};
export interface ContentSource {
getEntry<D = Record<string, unknown>>(
collection: string,
slug: string,
opts?: ContentReadOptions,
): Promise<ContentEntry<D> | null>;
listEntries<D = Record<string, unknown>>(collection: string, query?: ContentListQuery): Promise<ContentEntry<D>[]>;
}
このパッケージは MCP サーバーを宣言していません。
| バージョン | コミット | 公開日 | スキャン |
|---|---|---|---|
| 1.0.0 | 7266529 | 5 時間前 | スキャン合格 |
- genpm
- なし
- npm
- zod ^4.0.0
- 提案
- GenPM は npm コマンドを提案し、あなたが承認した場合にのみ実行します。
- 利用元(22)
- @core/admin ^1.0.0@core/blocks ^1.0.0@core/blog ^1.0.0@core/cart ^1.0.0@core/catalog ^1.0.0@core/comments ^1.0.0@core/content ^1.0.0@core/experiments ^1.0.0@core/forms ^1.0.0@core/invoices ^1.0.0@core/media ^1.0.0@core/money ^1.0.0@core/newsletter ^1.0.0@core/orders ^1.0.0@core/pixels ^1.0.0@core/pricing ^1.0.0@core/rbac ^1.0.0@core/search ^1.0.0@core/seo ^1.0.0@core/shipping ^1.0.0
- スキャン
- スキャン合格 · 指摘 0 件
- コミット
- v1.0.0 → 7266529e19beb49b518121150977d7b712cb7e5f · 取得後に検証済み
- スクリプト
- なし。GenPM はパッケージのコードを実行しません。
- ライセンス
- MIT
- 品質
- 100/100
- 認識されたライセンス達成
- AGENTS.md に目的の説明がある達成
- AGENTS.md に統合手順がある達成
- AGENTS.md に規約や禁止事項がある達成
- テストを含む達成
- セキュリティスキャンに合格達成
- 過去 6 か月以内に公開達成
- 認証済みの公開者達成
- 概要とキーワード達成
- 報告
- 問題を見つけましたか?