@prismakit/cli 3.2.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  # PrismaKit NestJS reference
2
2
 
3
- API surface for `@prismakit/nestjs` 3.x. Repository methods, cache, compose, and locks are documented in skill `prismakit` (`reference.md` in that skill). This file covers the Nest adapter only.
3
+ API surface for `@prismakit/nestjs` **4.0** (pre-stable). Repository methods, cache, compose, and locks are documented in skill `prismakit` (`reference.md` in that skill). This file covers the Nest adapter only.
4
4
 
5
5
  ## `PrismaKitModuleOptions`
6
6
 
@@ -13,13 +13,11 @@ API surface for `@prismakit/nestjs` 3.x. Repository methods, cache, compose, and
13
13
  | `validateCompose` | no | When `true`, `assertSelectComposeValid` on module init. |
14
14
  | `strictCachedRepos` | no | Fail boot when a cached repo is missing from `providers`, or listed in two modules. Default `true`. |
15
15
  | `modulesRoot` | no | Directory scanned by `strictCachedRepos`. Default `src/modules`. |
16
- | `cacheModels` | no | Optional extra allowlist. Omit — repo `cache` is the source of truth. |
17
- | `compose` | no | `ComposeOptions`: `maxDepth` (default 10), `parallel` (default true), `setCache` (default true). `tx` is per-call only. |
18
- | `telemetry` | no | `{ enabled?: boolean; onEvent?: (event) => void }`. |
19
- | `queryLog` | no | `{ slowThreshold?: number; onSlowQuery?: (e) => void }`. Default threshold 500ms. Setting this enables telemetry. |
16
+ | `compose` | no | `ComposeOptions`: `maxDepth` (default 10), `parallel` (default true), `setCache` (default true). |
17
+ | `telemetry` | no | `{ enabled?, slowThreshold?, onSlowQuery?, onEvent? }`. |
20
18
  | `autoRegisterModels` | no | `true` = stub repos for all schema/DMMF models; `string[]` = those client keys only. |
21
19
 
22
- `queryLog.onSlowQuery` receives `{ model?, method?, durationMs, thresholdMs }` for `query.complete` events at/above the threshold.
20
+ `onSlowQuery` receives `{ model?, method?, durationMs, thresholdMs }` for slow queries. Setting `slowThreshold` / `onSlowQuery` enables telemetry unless `enabled: false`.
23
21
 
24
22
  ## Async config
25
23
 
@@ -42,6 +40,10 @@ PrismaKitModule.forRootAsync({
42
40
  prefix: config.get('CACHE_PREFIX') ?? 'myapp',
43
41
  }),
44
42
  schemaPath: 'prisma/schema.prisma',
43
+ telemetry: {
44
+ enabled: true,
45
+ slowThreshold: 500,
46
+ },
45
47
  }),
46
48
  });
47
49
  ```
@@ -68,74 +70,32 @@ execTx<T, TClient = unknown>(
68
70
 
69
71
  `TransactionOptions`: `{ maxWait?: number; timeout?: number; isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable' | string }`.
70
72
 
71
- Type the client when useful:
72
-
73
- ```typescript
74
- await this.tx.execTx<User, Prisma.TransactionClient>(async (tx) => { /* ... */ });
75
- ```
76
-
77
73
  `afterCommit` runs only after `prisma.$transaction` resolves successfully.
78
74
 
79
75
  ## Repository factories
80
76
 
81
77
  | Factory | When |
82
78
  |---------|------|
83
- | `createDefineRepo<Prisma.TypeMap>()` then local `defineRepo({ model, ... })` | **Default** for apps. Zero phantoms; `model` + `scalarFields` + `cache` / `lock`. |
84
- | `defineInjectableRepository({ model, select, create, update, where, orderBy, payload, ... })` | TypeMap unavailable. Package aliases: `defineRepository`. |
85
- | `createInjectableRepository({ model, ... })` | Thin / untyped. Results `unknown` unless `toPayload` is supplied. Alias: `createPrismaRepository`. |
79
+ | `createDefineRepo<Prisma.TypeMap>()` then app `defineAppRepo({ model, ... })` | **Default** for apps. Zero phantoms; `model` + `cache` / `lock` / `toPayload`. |
80
+ | `createInjectableRepository({ model, ... })` | Low-level escape hatch. Results thinly typed unless `toPayload` is supplied. |
86
81
 
87
- `createDefineRepo` runtime options: `model`, `scalarFields?`, `primaryKey?`, `cache?`, `lock?`, `schemaPath?`.
82
+ `createDefineRepo` accepts app-wide defaults (`cache`) and per-repo options: `model`, `cache?` (`true` inherits app defaults), `lock?`, `toPayload?`.
88
83
 
89
84
  When `cache` is set, the returned API includes `setCache` / `cacheTags` / `invalidate` / `tags` / `invalidateCache`. Otherwise those fields are omitted from the type (`HasCacheFromOptions`).
90
85
 
91
- `createDefineRepo` / `RepositoryApiFromTypeMap` includes the full runtime surface: `createMany`, `updateMany`, `upsert`, `deleteMany`, `lock` + `orderBy` on `getFirst`, `lock` on `getMany`, and composite-PK `id` on `*ById`. `primaryKey` is optional — composite `@@id` is read from schema meta.
92
-
93
- Export the instance type with interface merging so `cache` on options gates `setCache` (a same-name `type` alias collapses to `any`):
86
+ Export the instance type with interface merging so `cache` on options gates `setCache`:
94
87
 
95
88
  ```typescript
96
89
  export interface UserRepository extends InstanceType<typeof UserRepository> {}
97
90
  ```
98
91
 
99
- ## `defineInjectableRepository` shape (escape hatch)
100
-
101
- ```typescript
102
- import { Prisma } from '@prisma/client';
103
- import { defineInjectableRepository } from '@prismakit/nestjs';
104
-
105
- type Of<S> = S extends Prisma.UserSelect
106
- ? Prisma.UserGetPayload<{ select: S }>
107
- : never;
108
-
109
- export const UserRepository = defineInjectableRepository({
110
- model: 'user',
111
- scalarFields: Prisma.UserScalarFieldEnum,
112
- select: null! as Prisma.UserSelect,
113
- create: null! as Prisma.UserCreateInput,
114
- update: null! as Prisma.UserUpdateInput,
115
- where: null! as Prisma.UserWhereInput,
116
- orderBy: null! as Prisma.UserOrderByWithRelationInput,
117
- payload: class {
118
- declare readonly _select: unknown;
119
- declare type: () => Of<this['_select']>;
120
- },
121
- cache: { ttl: 86_400, sensitiveFields: ['password'] },
122
- lock: true,
123
- });
124
- ```
125
-
126
- ## Re-exports from core
127
-
128
- `@prismakit/nestjs` re-exports: `AutoComposer`, `RepositoryRegistry`, `CacheAdapter`, repository option/instance types, `RepoPayloadHKT`, `ComposeOptions`, `TelemetryOptions`, `TelemetryEvent`, `loadPrismaMetaFromDmmf`, `loadPrismaMetaFromSchema`, `setComposeOptions`, `setTelemetry`.
129
-
130
- Prefer importing Nest-only APIs from `@prismakit/nestjs` and core-only helpers from `@prismakit/core`.
131
-
132
92
  ## Layout
133
93
 
134
94
  ```
135
95
  src/
136
96
  app.module.ts # PrismaKitModule.forRootAsync
137
97
  infrastructure/prisma/
138
- define-repo.ts # createDefineRepo<Prisma.TypeMap>()
98
+ define-app-repo.ts # createDefineRepo<Prisma.TypeMap>({ cache defaults })
139
99
  prisma.service.ts # client construction only
140
100
  modules/<feature>/
141
101
  <feature>.module.ts # providers: [Service, XRepository]
@@ -22,7 +22,6 @@ Task Progress:
22
22
  - [ ] `prisma` is the shared client instance
23
23
  - [ ] Prisma meta is loaded: `dmmf: Prisma.dmmf` (Prisma 5/6) or `schemaPath: 'prisma/schema.prisma'` (Prisma 7)
24
24
  - [ ] Production cache uses `RedisCacheAdapter` with a stable `prefix`
25
- - [ ] `cacheModels` is omitted (repo `cache` is source of truth), or lists every cached model if an allowlist is used
26
25
  - [ ] `validateCompose: true` is on for apps that nest relations in `select`
27
26
  - [ ] Cached repo classes are in feature `providers` (`strictCachedRepos` fails boot otherwise)
28
27
 
@@ -32,7 +31,7 @@ Task Progress:
32
31
  - [ ] Feature repos call that binder — not `createInjectableRepository` unless types are intentionally thin
33
32
  - [ ] `export interface XRepository extends InstanceType<typeof XRepository> {}` (infers cache from options; do not use a same-name `type` alias)
34
33
  - [ ] Repo class is in `providers` and `exports` of the feature module
35
- - [ ] `lock: true` (or table/client key) is set when any call uses `lock`
34
+ - [ ] `lock: true` (or `{ tableName, columns }`) is set when any call uses `lock`
36
35
 
37
36
  ## DI
38
37
 
@@ -20,10 +20,13 @@ describe('cli generate templates', () => {
20
20
  expect(files).toHaveLength(1);
21
21
  expect(files[0].relativePath).toContain('repositories/product.repository.ts');
22
22
  expect(files[0].content).toContain("model: 'product'");
23
- expect(files[0].content).toContain('cache: {');
23
+ expect(files[0].content).toContain('cache: true');
24
24
  expect(files[0].content).not.toContain('getDelegate');
25
25
  expect(files[0].content).not.toContain('scalarFields');
26
- expect(files[0].content).toContain("from '@prismakit/nestjs'");
26
+ expect(files[0].content).toContain('defineAppRepo');
27
+ expect(files[0].content).toContain(
28
+ "from 'src/infrastructure/prisma/define-app-repo'",
29
+ );
27
30
  });
28
31
 
29
32
  it('emits full Nest module when full: true', () => {
@@ -44,7 +44,6 @@ export function findSkillsRoot(startDir: string): string | undefined {
44
44
  for (const candidate of [
45
45
  path.join(dir, 'skills'),
46
46
  dir,
47
- path.join(dir, 'templates', 'cursor-skills'),
48
47
  ]) {
49
48
  if (isSkillsRoot(candidate)) return candidate;
50
49
  }
package/src/templates.ts CHANGED
@@ -40,19 +40,16 @@ function renderRepository(
40
40
  prismaImport: string,
41
41
  base: string,
42
42
  ): GeneratedFile {
43
- const cacheBlock = cacheEnabled
44
- ? ` cache: {
45
- ttl: 86400,
46
- sensitiveFields: ['password'],
47
- defaultSetCache: true,
48
- },
49
- `
50
- : '';
43
+ const cacheBlock = cacheEnabled ? ` cache: true,\n` : '';
51
44
 
52
45
  const content = apply(
53
- `import { createInjectableRepository } from '@prismakit/nestjs';
46
+ `import { defineAppRepo } from 'src/infrastructure/prisma/define-app-repo';
54
47
 
55
- export class {{pascal}}Repository extends createInjectableRepository({
48
+ /**
49
+ * Bind once in infrastructure:
50
+ * export const defineAppRepo = createDefineRepo<Prisma.TypeMap>({ cache: { ... } });
51
+ */
52
+ export class {{pascal}}Repository extends defineAppRepo({
56
53
  model: '{{repoModel}}',
57
54
  {{cacheBlock}}}) {}
58
55
  `,
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/naming.ts","../src/templates.ts","../src/commands/generate.ts","../src/commands/validate.ts","../src/commands/skills.ts"],"sourcesContent":["export interface ModuleNames {\n kebab: string;\n camel: string;\n pascal: string;\n repoModel: string;\n route: string;\n}\n\nconst KEBAB_NAME_RE = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;\n\nexport function assertKebabName(name: string): void {\n if (!KEBAB_NAME_RE.test(name)) {\n throw new Error(\n `Invalid module name \"${name}\". Use kebab-case (e.g. product, blog-post).`,\n );\n }\n}\n\nfunction kebabToPascal(kebab: string): string {\n return kebab\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('');\n}\n\nfunction kebabToCamel(kebab: string): string {\n const pascal = kebabToPascal(kebab);\n return pascal.charAt(0).toLowerCase() + pascal.slice(1);\n}\n\nexport function resolveNames(kebab: string, route?: string): ModuleNames {\n assertKebabName(kebab);\n const pascal = kebabToPascal(kebab);\n const camel = kebabToCamel(kebab);\n return {\n kebab,\n camel,\n pascal,\n repoModel: camel,\n route: route ?? kebab,\n };\n}\n","import type { ModuleNames } from './naming';\n\nexport type GenerateOptions = {\n names: ModuleNames;\n cacheEnabled: boolean;\n /** When false (default), only emit the repository file. */\n full?: boolean;\n /** Emit validate + mapper helpers. */\n helpers?: boolean;\n /** Emit class-validator DTOs with @ApiProperty. */\n dto?: boolean;\n /** Prisma client import path (default `@prisma/client`). */\n prismaImport?: string;\n};\n\nfunction apply(template: string, names: ModuleNames, extras: Record<string, string>): string {\n const replacements: Record<string, string> = {\n '{{pascal}}': names.pascal,\n '{{camel}}': names.camel,\n '{{kebab}}': names.kebab,\n '{{route}}': names.route,\n '{{repoModel}}': names.repoModel,\n ...extras,\n };\n let result = template;\n for (const [key, value] of Object.entries(replacements)) {\n result = result.split(key).join(value);\n }\n return result;\n}\n\nexport type GeneratedFile = {\n relativePath: string;\n content: string;\n};\n\nfunction renderRepository(\n names: ModuleNames,\n cacheEnabled: boolean,\n prismaImport: string,\n base: string,\n): GeneratedFile {\n const cacheBlock = cacheEnabled\n ? ` cache: {\n ttl: 86400,\n sensitiveFields: ['password'],\n defaultSetCache: true,\n },\n`\n : '';\n\n const content = apply(\n `import { createInjectableRepository } from '@prismakit/nestjs';\n\nexport class {{pascal}}Repository extends createInjectableRepository({\n model: '{{repoModel}}',\n{{cacheBlock}}}) {}\n`,\n names,\n {\n '{{cacheBlock}}': cacheBlock,\n '{{prismaImport}}': prismaImport,\n },\n );\n\n return {\n relativePath: `${base}/repositories/${names.kebab}.repository.ts`,\n content,\n };\n}\n\nexport function renderModuleFiles(options: GenerateOptions): GeneratedFile[] {\n const { names, cacheEnabled, full = false, helpers = false, dto = false } =\n options;\n const prismaImport = options.prismaImport ?? '@prisma/client';\n const base = `src/modules/${names.kebab}`;\n\n const repository = renderRepository(names, cacheEnabled, prismaImport, base);\n\n if (!full) {\n return [repository];\n }\n\n const service = apply(\n `import { Injectable } from '@nestjs/common';\n\nimport { {{pascal}}Repository } from '../repositories/{{kebab}}.repository';\nimport { get{{pascal}}Select } from '../types/select-{{kebab}}.type';\nimport { where{{pascal}}GetManyPaginate } from '../types/where-{{kebab}}.type';\n{{dtoImport}}\n@Injectable()\nexport class {{pascal}}Service {\n constructor(private readonly {{camel}}Repository: {{pascal}}Repository) {}\n\n async handleCreate(dto: Create{{pascal}}Dto) {\n return await this.{{camel}}Repository.create({\n data: { ...dto },\n select: get{{pascal}}Select('general'),\n });\n }\n\n async handleGetById(id: string) {\n return await this.{{camel}}Repository.getThrowById({\n id,\n select: get{{pascal}}Select('general'),\n setCache: true,\n });\n }\n\n async handleGetManyPaginate(filter: Filter{{pascal}}Dto) {\n const { where } = where{{pascal}}GetManyPaginate(filter);\n return await this.{{camel}}Repository.getManyPaginate({\n where,\n select: get{{pascal}}Select('general'),\n page: filter.page,\n pageSize: filter.pageSize,\n setCache: true,\n });\n }\n\n async handleUpdateById(id: string, dto: Update{{pascal}}Dto) {\n return await this.{{camel}}Repository.updateById({\n id,\n data: { ...dto },\n select: get{{pascal}}Select('general'),\n });\n }\n\n async handleDeleteById(id: string) {\n return await this.{{camel}}Repository.deleteById({\n id,\n select: get{{pascal}}Select('minimal'),\n });\n }\n}\n`,\n names,\n {\n '{{dtoImport}}': dto\n ? `import type {\\n Create{{pascal}}Dto,\\n Update{{pascal}}Dto,\\n Filter{{pascal}}Dto,\\n} from '../dto/{{kebab}}.dto';\\n`\n : `type Create{{pascal}}Dto = Record<string, unknown>;\\ntype Update{{pascal}}Dto = Record<string, unknown>;\\ntype Filter{{pascal}}Dto = { page?: number; pageSize?: number; q?: string };\\n`,\n },\n );\n\n const controller = apply(\n `import {\n Body,\n Controller,\n Delete,\n Get,\n HttpStatus,\n Param,\n Patch,\n Post,\n Query,\n Res,\n} from '@nestjs/common';\nimport type { Response } from 'express';\n\nimport { {{pascal}}Service } from '../services/{{kebab}}.service';\n{{dtoImport}}\n@Controller('{{route}}')\nexport class {{pascal}}Controller {\n constructor(private readonly {{camel}}Service: {{pascal}}Service) {}\n\n @Post()\n async create(@Body() dto: Create{{pascal}}Dto, @Res() res: Response) {\n try {\n const result = await this.{{camel}}Service.handleCreate(dto);\n return res.status(HttpStatus.CREATED).json({ data: result });\n } catch (error) {\n const status = (error as { statusCode?: number })?.statusCode ?? 500;\n return res.status(status).json({\n error: { message: (error as Error).message, httpStatus: status },\n });\n }\n }\n\n @Get()\n async getMany(@Query() filter: Filter{{pascal}}Dto, @Res() res: Response) {\n try {\n const result = await this.{{camel}}Service.handleGetManyPaginate(filter);\n return res.status(HttpStatus.OK).json({ data: result.data, meta: result.meta });\n } catch (error) {\n const status = (error as { statusCode?: number })?.statusCode ?? 500;\n return res.status(status).json({\n error: { message: (error as Error).message, httpStatus: status },\n });\n }\n }\n\n @Get(':id')\n async getById(@Param('id') id: string, @Res() res: Response) {\n try {\n const result = await this.{{camel}}Service.handleGetById(id);\n return res.status(HttpStatus.OK).json({ data: result });\n } catch (error) {\n const status = (error as { statusCode?: number })?.statusCode ?? 500;\n return res.status(status).json({\n error: { message: (error as Error).message, httpStatus: status },\n });\n }\n }\n\n @Patch(':id')\n async update(\n @Param('id') id: string,\n @Body() dto: Update{{pascal}}Dto,\n @Res() res: Response,\n ) {\n try {\n const result = await this.{{camel}}Service.handleUpdateById(id, dto);\n return res.status(HttpStatus.OK).json({ data: result });\n } catch (error) {\n const status = (error as { statusCode?: number })?.statusCode ?? 500;\n return res.status(status).json({\n error: { message: (error as Error).message, httpStatus: status },\n });\n }\n }\n\n @Delete(':id')\n async delete(@Param('id') id: string, @Res() res: Response) {\n try {\n const result = await this.{{camel}}Service.handleDeleteById(id);\n return res.status(HttpStatus.OK).json({ data: result });\n } catch (error) {\n const status = (error as { statusCode?: number })?.statusCode ?? 500;\n return res.status(status).json({\n error: { message: (error as Error).message, httpStatus: status },\n });\n }\n }\n}\n`,\n names,\n {\n '{{dtoImport}}': dto\n ? `import type {\\n Create{{pascal}}Dto,\\n Update{{pascal}}Dto,\\n Filter{{pascal}}Dto,\\n} from '../dto/{{kebab}}.dto';\\n`\n : `type Create{{pascal}}Dto = Record<string, unknown>;\\ntype Update{{pascal}}Dto = Record<string, unknown>;\\ntype Filter{{pascal}}Dto = { page?: number; pageSize?: number; q?: string };\\n`,\n },\n );\n\n const moduleFile = apply(\n `import { Module } from '@nestjs/common';\n\nimport { {{pascal}}Controller } from './controllers/{{kebab}}.controller';\nimport { {{pascal}}Service } from './services/{{kebab}}.service';\nimport { {{pascal}}Repository } from './repositories/{{kebab}}.repository';\n{{helpersImport}}\n@Module({\n controllers: [{{pascal}}Controller],\n providers: [{{pascal}}Service, {{pascal}}Repository{{helpersProviders}}],\n exports: [{{pascal}}Service, {{pascal}}Repository],\n})\nexport class {{pascal}}Module {}\n`,\n names,\n {\n '{{helpersImport}}': helpers\n ? `import { {{pascal}}ValidateHelper } from './helpers/{{kebab}}-validate.helper';\\nimport { {{pascal}}MapperHelper } from './helpers/{{kebab}}-mapper.helper';\\n`\n : '',\n '{{helpersProviders}}': helpers\n ? `, {{pascal}}ValidateHelper, {{pascal}}MapperHelper`\n : '',\n },\n );\n\n const select = apply(\n `import { Prisma } from '{{prismaImport}}';\n\ntype {{pascal}}SelectPresetKey = keyof typeof {{camel}}SelectPresets;\n\nexport function get{{pascal}}Select<K extends {{pascal}}SelectPresetKey>(key: K) {\n return {{camel}}SelectPresets[key];\n}\n\nexport const {{camel}}SelectPresets = {\n minimal: {\n id: true,\n } satisfies Prisma.{{pascal}}Select,\n\n general: {\n id: true,\n } satisfies Prisma.{{pascal}}Select,\n};\n`,\n names,\n { '{{prismaImport}}': prismaImport },\n );\n\n const where = apply(\n `import { Prisma } from '{{prismaImport}}';\n\nexport function where{{pascal}}GetManyPaginate(filter: {\n q?: string;\n}): {\n where: Prisma.{{pascal}}WhereInput;\n} {\n const { q } = filter;\n const where: Prisma.{{pascal}}WhereInput = {\n ...(q ? { /* add searchable fields */ } : {}),\n };\n return { where };\n}\n`,\n names,\n { '{{prismaImport}}': prismaImport },\n );\n\n const files: GeneratedFile[] = [\n { relativePath: `${base}/${names.kebab}.module.ts`, content: moduleFile },\n {\n relativePath: `${base}/controllers/${names.kebab}.controller.ts`,\n content: controller,\n },\n {\n relativePath: `${base}/services/${names.kebab}.service.ts`,\n content: service,\n },\n repository,\n {\n relativePath: `${base}/types/select-${names.kebab}.type.ts`,\n content: select,\n },\n {\n relativePath: `${base}/types/where-${names.kebab}.type.ts`,\n content: where,\n },\n ];\n\n if (dto) {\n files.push({\n relativePath: `${base}/dto/${names.kebab}.dto.ts`,\n content: apply(\n `import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';\nimport { IsOptional, IsString } from 'class-validator';\n\nexport class Create{{pascal}}Dto {\n @ApiProperty({ example: 'name' })\n @IsString()\n name!: string;\n}\n\nexport class Update{{pascal}}Dto {\n @ApiPropertyOptional({ example: 'name' })\n @IsOptional()\n @IsString()\n name?: string;\n}\n\nexport class Filter{{pascal}}Dto {\n @ApiPropertyOptional()\n @IsOptional()\n page?: number;\n\n @ApiPropertyOptional()\n @IsOptional()\n pageSize?: number;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n q?: string;\n}\n`,\n names,\n {},\n ),\n });\n }\n\n if (helpers) {\n files.push(\n {\n relativePath: `${base}/helpers/${names.kebab}-validate.helper.ts`,\n content: apply(\n `import { Injectable } from '@nestjs/common';\n\nimport { {{pascal}}Repository } from '../repositories/{{kebab}}.repository';\nimport { get{{pascal}}Select } from '../types/select-{{kebab}}.type';\n\n@Injectable()\nexport class {{pascal}}ValidateHelper {\n constructor(private readonly {{camel}}Repository: {{pascal}}Repository) {}\n\n async assertExists(id: string) {\n return this.{{camel}}Repository.getThrowById({\n id,\n select: get{{pascal}}Select('minimal'),\n });\n }\n}\n`,\n names,\n {},\n ),\n },\n {\n relativePath: `${base}/helpers/${names.kebab}-mapper.helper.ts`,\n content: apply(\n `import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class {{pascal}}MapperHelper {\n toResponse(entity: Record<string, unknown>) {\n return entity;\n }\n}\n`,\n names,\n {},\n ),\n },\n );\n }\n\n return files;\n}\n","import * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport { resolveNames } from '../naming';\nimport { renderModuleFiles } from '../templates';\n\nexport type GenerateCommandOptions = {\n name: string;\n cache?: boolean;\n route?: string;\n cwd?: string;\n dryRun?: boolean;\n /** Emit full Nest module (controller/service/types). Default: repo-only. */\n full?: boolean;\n /** Emit validate + mapper helpers. */\n helpers?: boolean;\n /** Emit class-validator DTOs. */\n dto?: boolean;\n /** Prisma client import path (default `@prisma/client`). */\n prismaImport?: string;\n};\n\nexport function runGenerate(options: GenerateCommandOptions): void {\n const cwd = options.cwd ?? process.cwd();\n const names = resolveNames(options.name, options.route);\n const full = !!options.full;\n const files = renderModuleFiles({\n names,\n cacheEnabled: !!options.cache,\n full,\n helpers: !!options.helpers,\n dto: !!options.dto,\n prismaImport: options.prismaImport,\n });\n\n for (const file of files) {\n const fullPath = path.join(cwd, file.relativePath);\n if (options.dryRun) {\n console.log(`[dry-run] would write ${file.relativePath}`);\n continue;\n }\n if (fs.existsSync(fullPath)) {\n console.warn(`skip (exists): ${file.relativePath}`);\n continue;\n }\n fs.mkdirSync(path.dirname(fullPath), { recursive: true });\n const content = file.content.endsWith('\\n')\n ? file.content\n : `${file.content}\\n`;\n fs.writeFileSync(fullPath, content, 'utf-8');\n console.log(`created ${file.relativePath}`);\n }\n\n if (full) {\n console.log(\n `\\nScaffolded module \"${names.kebab}\". Register ${names.pascal}Module in app.module.ts.`,\n );\n } else {\n console.log(\n `\\nScaffolded repository \"${names.pascal}Repository\". Register it in your feature module providers.`,\n );\n }\n}\n","import {\n assertSelectComposeValid,\n validateSelectCompose,\n} from '@prismakit/core';\n\nexport type ValidateCommandOptions = {\n cwd?: string;\n assert?: boolean;\n schemaPath?: string;\n autoRegisterModels?: boolean;\n};\n\n/**\n * Run select-compose validation from @prismakit/core.\n */\nexport function runValidate(options: ValidateCommandOptions = {}): void {\n const cwd = options.cwd ?? process.cwd();\n const validateOptions = {\n schemaPath: options.schemaPath,\n autoRegisterModels: options.autoRegisterModels,\n };\n\n if (options.assert !== false) {\n try {\n assertSelectComposeValid(cwd, validateOptions);\n console.log('Select compose validation passed.');\n } catch (err) {\n console.error((err as Error).message);\n process.exitCode = 1;\n }\n return;\n }\n\n const issues = validateSelectCompose(cwd, validateOptions);\n if (issues.length === 0) {\n console.log('Select compose validation passed.');\n return;\n }\n\n for (const issue of issues) {\n console.error(` - ${issue.file}: ${issue.message}`);\n }\n process.exitCode = 1;\n}\n","import * as fs from 'node:fs';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst SKILL_NAMES = ['prismakit', 'prismakit-nestjs'] as const;\nconst RULE_NAME = 'data-access.mdc';\n\nexport type SkillsCommandOptions = {\n cwd?: string;\n /** Install into ~/.cursor/skills (all projects). Default: <cwd>/.cursor/skills */\n global?: boolean;\n /** Override project root when not using --global. */\n projectRoot?: string;\n /** Subset of skill folder names. Default: both. */\n skill?: string[];\n /** Also copy templates/cursor-rules/data-access.mdc into .cursor/rules. */\n withRules?: boolean;\n dryRun?: boolean;\n list?: boolean;\n /** Test override: directory that contains prismakit/ and prismakit-nestjs/. */\n skillsRoot?: string;\n /** Test override: path to data-access.mdc. */\n rulesPath?: string;\n};\n\nexport type SkillsInstallResult = {\n dest: string;\n installed: string[];\n ruleDest?: string;\n};\n\nfunction isSkillsRoot(dir: string): boolean {\n return fs.existsSync(path.join(dir, 'prismakit', 'SKILL.md'));\n}\n\n/**\n * Walk up from the CLI entrypoint looking for bundled `skills/` (published\n * package) or the monorepo `skills/` directory.\n */\nexport function findSkillsRoot(startDir: string): string | undefined {\n let dir = path.resolve(startDir);\n for (let i = 0; i < 10; i++) {\n for (const candidate of [\n path.join(dir, 'skills'),\n dir,\n path.join(dir, 'templates', 'cursor-skills'),\n ]) {\n if (isSkillsRoot(candidate)) return candidate;\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return undefined;\n}\n\nexport function findRulesPath(skillsRoot: string): string | undefined {\n const candidates = [\n path.join(skillsRoot, '..', 'templates', 'cursor-rules', RULE_NAME),\n path.join(skillsRoot, '..', 'rules', RULE_NAME),\n path.join(path.dirname(skillsRoot), 'rules', RULE_NAME),\n ];\n return candidates.find((p) => fs.existsSync(p));\n}\n\nfunction copyDir(src: string, dest: string): void {\n fs.mkdirSync(dest, { recursive: true });\n for (const entry of fs.readdirSync(src, { withFileTypes: true })) {\n if (entry.name === '.git') continue;\n const from = path.join(src, entry.name);\n const to = path.join(dest, entry.name);\n if (entry.isDirectory()) {\n copyDir(from, to);\n } else if (entry.isFile()) {\n fs.copyFileSync(from, to);\n }\n }\n}\n\nfunction resolveHome(): string {\n return process.env.HOME || os.homedir();\n}\n\nfunction assertNotBuiltinSkills(dest: string): void {\n const forbidden = path.join(resolveHome(), '.cursor', 'skills-cursor');\n const resolved = path.resolve(dest);\n if (resolved === forbidden || resolved.startsWith(`${forbidden}${path.sep}`)) {\n throw new Error(\n `Refusing to install into ${resolved} (reserved for Cursor built-ins).`,\n );\n }\n}\n\nfunction cliStartDir(): string {\n try {\n const url = import.meta.url;\n if (typeof url === 'string' && url.length > 0) {\n return path.dirname(fileURLToPath(url));\n }\n } catch {\n // CJS bundle has an empty import.meta\n }\n return process.cwd();\n}\n\nexport function runSkills(options: SkillsCommandOptions = {}): SkillsInstallResult {\n const skillsRoot =\n options.skillsRoot ??\n findSkillsRoot(cliStartDir()) ??\n findSkillsRoot(process.cwd());\n if (!skillsRoot) {\n throw new Error(\n 'Could not find PrismaKit skills. Reinstall @prismakit/cli or clone fikiap23/prismakit.',\n );\n }\n\n const available = SKILL_NAMES.filter((name) =>\n fs.existsSync(path.join(skillsRoot, name, 'SKILL.md')),\n );\n if (available.length === 0) {\n throw new Error(`No skills found in ${skillsRoot}`);\n }\n\n const requested = options.skill?.length\n ? options.skill.map((s) => s.trim()).filter(Boolean)\n : [...available];\n\n for (const name of requested) {\n if (!available.includes(name as (typeof SKILL_NAMES)[number])) {\n throw new Error(\n `Unknown skill \"${name}\". Available: ${available.join(', ')}`,\n );\n }\n }\n\n if (options.list) {\n console.log(`Skills in ${skillsRoot}:`);\n for (const name of available) {\n console.log(` - ${name}`);\n }\n return { dest: skillsRoot, installed: [] };\n }\n\n const cwd = options.cwd ?? process.cwd();\n const dest = options.global\n ? path.join(resolveHome(), '.cursor', 'skills')\n : path.join(\n path.resolve(options.projectRoot ?? cwd),\n '.cursor',\n 'skills',\n );\n\n assertNotBuiltinSkills(dest);\n\n if (!options.dryRun) {\n fs.mkdirSync(dest, { recursive: true });\n }\n\n const installed: string[] = [];\n for (const name of requested) {\n const src = path.join(skillsRoot, name);\n const target = path.join(dest, name);\n if (options.dryRun) {\n console.log(`[dry-run] would install ${name} -> ${target}`);\n } else {\n fs.rmSync(target, { recursive: true, force: true });\n copyDir(src, target);\n console.log(`Installed ${name} -> ${target}`);\n }\n installed.push(name);\n }\n\n let ruleDest: string | undefined;\n if (options.withRules) {\n const rulesSrc = options.rulesPath ?? findRulesPath(skillsRoot);\n if (!rulesSrc) {\n throw new Error(`Could not find ${RULE_NAME} next to skills.`);\n }\n const rulesDir = options.global\n ? path.join(resolveHome(), '.cursor', 'rules')\n : path.join(path.resolve(options.projectRoot ?? cwd), '.cursor', 'rules');\n ruleDest = path.join(rulesDir, RULE_NAME);\n if (options.dryRun) {\n console.log(`[dry-run] would install rule -> ${ruleDest}`);\n } else {\n fs.mkdirSync(rulesDir, { recursive: true });\n fs.copyFileSync(rulesSrc, ruleDest);\n console.log(`Installed rule -> ${ruleDest}`);\n }\n }\n\n const scope = options.global\n ? 'global (~/.cursor/skills)'\n : 'project (.cursor/skills)';\n if (options.dryRun) {\n console.log(`Dry-run complete (${scope}).`);\n } else if (options.global) {\n console.log(`Done. Skills are available in all Cursor projects on this machine (${scope}).`);\n } else {\n console.log(\n `Done. Commit .cursor/skills so the team shares the same agent contract (${scope}).`,\n );\n }\n\n return { dest, installed, ruleDest };\n}\n"],"mappings":";AAQA,IAAM,gBAAgB;AAEf,SAAS,gBAAgB,MAAoB;AAClD,MAAI,CAAC,cAAc,KAAK,IAAI,GAAG;AAC7B,UAAM,IAAI;AAAA,MACR,wBAAwB,IAAI;AAAA,IAC9B;AAAA,EACF;AACF;AAEA,SAAS,cAAc,OAAuB;AAC5C,SAAO,MACJ,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,EAAE,YAAY,IAAI,KAAK,MAAM,CAAC,CAAC,EAC1D,KAAK,EAAE;AACZ;AAEA,SAAS,aAAa,OAAuB;AAC3C,QAAM,SAAS,cAAc,KAAK;AAClC,SAAO,OAAO,OAAO,CAAC,EAAE,YAAY,IAAI,OAAO,MAAM,CAAC;AACxD;AAEO,SAAS,aAAa,OAAe,OAA6B;AACvE,kBAAgB,KAAK;AACrB,QAAM,SAAS,cAAc,KAAK;AAClC,QAAM,QAAQ,aAAa,KAAK;AAChC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,OAAO,SAAS;AAAA,EAClB;AACF;;;AC1BA,SAAS,MAAM,UAAkB,OAAoB,QAAwC;AAC3F,QAAM,eAAuC;AAAA,IAC3C,cAAc,MAAM;AAAA,IACpB,aAAa,MAAM;AAAA,IACnB,aAAa,MAAM;AAAA,IACnB,aAAa,MAAM;AAAA,IACnB,iBAAiB,MAAM;AAAA,IACvB,GAAG;AAAA,EACL;AACA,MAAI,SAAS;AACb,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,YAAY,G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