@forinda/kickjs-cli 5.7.0 → 5.8.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.
- package/dist/{builtins-BIpoT6cb.mjs → builtins-CYSzLo7U.mjs} +2 -2
- package/dist/cli.mjs +116 -116
- package/dist/{config-BQUzGk6m.mjs → config-ierHW69f.mjs} +3 -3
- package/dist/{config-BQUzGk6m.mjs.map → config-ierHW69f.mjs.map} +1 -1
- package/dist/{generator-extension-Cd2DU_XX.mjs → generator-extension-BXLt3Tp_.mjs} +60 -60
- package/dist/{generator-extension-Cd2DU_XX.mjs.map → generator-extension-BXLt3Tp_.mjs.map} +1 -1
- package/dist/index.d.mts +41 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-B6ANfh7O.mjs → plugin-D_nBy6VP.mjs} +3 -3
- package/dist/{plugin-B6ANfh7O.mjs.map → plugin-D_nBy6VP.mjs.map} +1 -1
- package/dist/{project-root-Dsxhm7OL.mjs → project-root-CqGZOrRR.mjs} +3 -3
- package/dist/{project-root-Dsxhm7OL.mjs.map → project-root-CqGZOrRR.mjs.map} +1 -1
- package/dist/{rolldown-runtime-jjtMmVBF.mjs → rolldown-runtime-B8-Ifyj3.mjs} +1 -1
- package/dist/{run-plugins-DaO1FtZb.mjs → run-plugins-Cvgyo_th.mjs} +6 -6
- package/dist/run-plugins-Cvgyo_th.mjs.map +1 -0
- package/dist/{typegen-D-1Q9yBD.mjs → typegen-C3G375CR.mjs} +4 -4
- package/dist/{typegen-D-1Q9yBD.mjs.map → typegen-C3G375CR.mjs.map} +1 -1
- package/dist/{types-Du3p7CZ5.mjs → types-Kj2ldTnQ.mjs} +2 -2
- package/dist/types-Kj2ldTnQ.mjs.map +1 -0
- package/package.json +5 -5
- package/dist/run-plugins-DaO1FtZb.mjs.map +0 -1
- package/dist/types-Du3p7CZ5.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v5.
|
|
2
|
+
* @forinda/kickjs-cli v5.8.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{
|
|
11
|
+
import{t as e}from"./project-root-CqGZOrRR.mjs";import{createRequire as t}from"node:module";import{dirname as n,extname as r,join as i,resolve as a}from"node:path";import{existsSync as o,readFileSync as s}from"node:fs";import{access as c,mkdir as l,readFile as u,writeFile as d}from"node:fs/promises";import*as f from"@clack/prompts";import p from"picocolors";import m from"pluralize";import{execFileSync as h,execSync as g}from"node:child_process";import{fileURLToPath as _,pathToFileURL as v}from"node:url";let y=!1;function ee(e){y=e}const te=new Set([`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`,`.json`,`.md`]);async function b(e,t){y||(await l(n(e),{recursive:!0}),await d(e,t,`utf-8`),te.has(r(e))&&await re(e,t).catch(()=>{}))}let x;async function ne(e){if(x!==void 0)return x;try{x=await import(t(i(e,`package.json`)).resolve(`oxfmt`))}catch{x=null}return x}async function re(e,t){let n=await ne(process.cwd());if(!n)return;let r=await ie(e);if(r===null)return;let i=await n.format(e,t,r);i.code!==t&&await d(e,i.code,`utf-8`)}const S=new Map;async function ie(e){let t=n(e),r=t;if(S.has(r))return S.get(r);for(;;){let e=i(t,`.oxfmtrc.json`);if(o(e))try{let t=await u(e,`utf-8`),n=JSON.parse(t);return delete n.$schema,delete n.ignorePatterns,S.set(r,n),n}catch{return S.set(r,null),null}let a=n(t);if(a===t)return S.set(r,null),null;t=a}}async function C(e){try{return await c(e),!0}catch{return!1}}const ae={GET:p.green,POST:p.cyan,PUT:p.yellow,PATCH:p.magenta,DELETE:p.red};function oe(e){return(ae[e]??p.dim)(e.padEnd(7))}function se(e){let t=`[${e}]`.padEnd(10);switch(e){case`CRITICAL`:return p.red(t);case`WARNING`:return p.yellow(t);case`INFO`:return p.blue(p.dim(t));default:return t}}p.green(`✓`),p.red(`✖`),p.yellow(`⚠`),p.blue(`ℹ`);function ce(e){f.intro(p.bgCyan(p.black(` ${e} `)))}function le(e){f.outro(e)}function w(e){f.isCancel(e)&&(f.cancel(`Operation cancelled.`),process.exit(0))}async function ue(e){let t=await f.text(e);return w(t),t}async function de(e){let t=await f.select(e);return w(t),t}async function fe(e){let t=await f.multiselect(e);return w(t),t}async function T(e){let t=await f.confirm(e);return w(t),t}function pe(){return f.spinner()}const E=f.log;function D(e){return e.replace(/[-_\s]+(.)?/g,(e,t)=>t?t.toUpperCase():``).replace(/^(.)/,e=>e.toUpperCase())}function O(e){let t=D(e);return t.charAt(0).toLowerCase()+t.slice(1)}function k(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).replace(/[\s_]+/g,`-`).toLowerCase()}function A(e){return m.plural(e)}function me(e){return m.plural(e)}function j(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const he={inmemory:`in-memory`,drizzle:`Drizzle`,prisma:`Prisma`};function M(e){return e.charAt(0).toUpperCase()+e.slice(1).replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function ge(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function N(e){return he[e]??M(e)}function P(e,t,n){let r={inmemory:`InMemory${e}Repository`,drizzle:`Drizzle${e}Repository`,prisma:`Prisma${e}Repository`},i={inmemory:`in-memory-${t}`,drizzle:`drizzle-${t}`,prisma:`prisma-${t}`};return{repoClass:r[n]??`${M(n)}${e}Repository`,repoFile:i[n]??`${ge(n)}-${t}`}}function F(e){return e??`define`}function _e(e){let{pascal:t,kebab:n,plural:r=``,repo:i,style:a}=e,{repoClass:o,repoFile:s}=P(t,n,i),c=F(a),l=`/**
|
|
12
12
|
* ${t} Module
|
|
13
13
|
*
|
|
14
14
|
* Self-contained feature module following Domain-Driven Design (DDD).
|
|
@@ -95,7 +95,7 @@ ${d}
|
|
|
95
95
|
},
|
|
96
96
|
}),
|
|
97
97
|
})
|
|
98
|
-
`}function
|
|
98
|
+
`}function ve(e){let{pascal:t,kebab:n,plural:r=``,repo:i,style:a}=e,{repoClass:o,repoFile:s}=P(t,n,i),c=F(a),l=`/**
|
|
99
99
|
* ${t} Module
|
|
100
100
|
*
|
|
101
101
|
* REST module with a flat folder structure.
|
|
@@ -167,7 +167,7 @@ ${d}
|
|
|
167
167
|
},
|
|
168
168
|
}),
|
|
169
169
|
})
|
|
170
|
-
`}function
|
|
170
|
+
`}function ye(e){let{pascal:t,kebab:n,plural:r=``,style:i}=e,a=F(i),o=` /**
|
|
171
171
|
* Declare HTTP routes. Return value shape:
|
|
172
172
|
*
|
|
173
173
|
* - \`path\` — URL prefix for this route set.
|
|
@@ -207,7 +207,7 @@ ${o}
|
|
|
207
207
|
},
|
|
208
208
|
}),
|
|
209
209
|
})
|
|
210
|
-
`}function
|
|
210
|
+
`}function be(e){let{pascal:t,kebab:n,plural:r=``,pluralPascal:i=``}=e;return`import { Controller, Get, Post, Put, Delete, Autowired, ApiQueryParams, type Ctx } from '@forinda/kickjs'
|
|
211
211
|
import { ApiTags } from '@forinda/kickjs-swagger'
|
|
212
212
|
import { Create${t}UseCase } from '../application/use-cases/create-${n}.use-case'
|
|
213
213
|
import { Get${t}UseCase } from '../application/use-cases/get-${n}.use-case'
|
|
@@ -270,7 +270,7 @@ export class ${t}Controller {
|
|
|
270
270
|
ctx.noContent()
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
`}function
|
|
273
|
+
`}function xe(e){let{pascal:t,kebab:n}=e,r=t.charAt(0).toLowerCase()+t.slice(1);return`import { Controller, Get, Post, Put, Delete, Autowired, ApiQueryParams, type Ctx } from '@forinda/kickjs'
|
|
274
274
|
import { ApiTags } from '@forinda/kickjs-swagger'
|
|
275
275
|
import { ${t}Service } from './${n}.service'
|
|
276
276
|
import { create${t}Schema } from './dtos/create-${n}.dto'
|
|
@@ -325,7 +325,7 @@ export class ${t}Controller {
|
|
|
325
325
|
ctx.noContent()
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
`}function
|
|
328
|
+
`}function Se(e){let{pascal:t}=e;return`import type { QueryParamsConfig } from '@forinda/kickjs'
|
|
329
329
|
|
|
330
330
|
export const ${t.toUpperCase()}_QUERY_CONFIG: QueryParamsConfig = {
|
|
331
331
|
filterable: ['name'],
|
|
@@ -361,7 +361,7 @@ export type Update${t}DTO = z.infer<typeof update${t}Schema>
|
|
|
361
361
|
createdAt: string
|
|
362
362
|
updatedAt: string
|
|
363
363
|
}
|
|
364
|
-
`}function
|
|
364
|
+
`}function Ce(e){let{pascal:t,kebab:n,plural:r=``,pluralPascal:i=``}=e;return[{file:`create-${n}.use-case.ts`,content:`/**
|
|
365
365
|
* Create ${t} Use Case
|
|
366
366
|
*
|
|
367
367
|
* Application layer — orchestrates a single business operation.
|
|
@@ -603,7 +603,7 @@ export class ${o}${t}Repository implements I${t}Repository {
|
|
|
603
603
|
this.store.delete(id)
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
|
-
`}function
|
|
606
|
+
`}function we(e){let{pascal:t,kebab:n}=e;return`/**
|
|
607
607
|
* ${t} Domain Service
|
|
608
608
|
*
|
|
609
609
|
* Domain layer — contains business rules that don't belong to a single entity.
|
|
@@ -626,7 +626,7 @@ export class ${t}DomainService {
|
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
|
-
`}function
|
|
629
|
+
`}function Te(e){let{pascal:t,kebab:n}=e;return`/**
|
|
630
630
|
* ${t} Entity
|
|
631
631
|
*
|
|
632
632
|
* Domain layer — the core business object.
|
|
@@ -695,7 +695,7 @@ export class ${t} {
|
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
`}function
|
|
698
|
+
`}function Ee(e){let{pascal:t}=e;return`/**
|
|
699
699
|
* ${t} ID Value Object
|
|
700
700
|
*
|
|
701
701
|
* Domain layer — wraps a primitive ID with type safety and validation.
|
|
@@ -843,7 +843,7 @@ describe('InMemory${t}Repository', () => {
|
|
|
843
843
|
expect(found).toBeNull()
|
|
844
844
|
})
|
|
845
845
|
})
|
|
846
|
-
`}function
|
|
846
|
+
`}function De(e){let{pascal:t,kebab:n}=e;return`import { Service, Inject, HttpException } from '@forinda/kickjs'
|
|
847
847
|
import type { ParsedQuery } from '@forinda/kickjs'
|
|
848
848
|
import { ${t.toUpperCase()}_REPOSITORY, type I${t}Repository } from './${n}.repository'
|
|
849
849
|
import type { ${t}ResponseDTO } from './dtos/${n}-response.dto'
|
|
@@ -887,7 +887,7 @@ export const ${t.toUpperCase()}_QUERY_CONFIG: QueryFieldConfig = {
|
|
|
887
887
|
sortable: ['name', 'createdAt'],
|
|
888
888
|
searchable: ['name'],
|
|
889
889
|
}
|
|
890
|
-
`}function
|
|
890
|
+
`}function Oe(e){let{pascal:t,kebab:n,plural:r=``,repo:i,style:a}=e,o={inmemory:`InMemory${t}Repository`,drizzle:`Drizzle${t}Repository`,prisma:`Prisma${t}Repository`},s={inmemory:`in-memory-${n}`,drizzle:`drizzle-${n}`,prisma:`prisma-${n}`},c=o[i]??o.inmemory,l=s[i]??s.inmemory,u=a??`define`,d=`/**
|
|
891
891
|
* ${t} Module — CQRS Pattern
|
|
892
892
|
*
|
|
893
893
|
* Separates read (queries) and write (commands) operations.
|
|
@@ -966,7 +966,7 @@ ${p}
|
|
|
966
966
|
},
|
|
967
967
|
}),
|
|
968
968
|
})
|
|
969
|
-
`}function
|
|
969
|
+
`}function ke(e){let{pascal:t,kebab:n,plural:r=``,pluralPascal:i=``}=e;return`import { Controller, Get, Post, Put, Delete, Autowired, ApiQueryParams, type Ctx } from '@forinda/kickjs'
|
|
970
970
|
import { ApiTags } from '@forinda/kickjs-swagger'
|
|
971
971
|
import { Create${t}Command } from './commands/create-${n}.command'
|
|
972
972
|
import { Update${t}Command } from './commands/update-${n}.command'
|
|
@@ -1029,7 +1029,7 @@ export class ${t}Controller {
|
|
|
1029
1029
|
ctx.noContent()
|
|
1030
1030
|
}
|
|
1031
1031
|
}
|
|
1032
|
-
`}function
|
|
1032
|
+
`}function Ae(e){let{pascal:t,kebab:n}=e;return[{file:`create-${n}.command.ts`,content:`import { Service, Inject } from '@forinda/kickjs'
|
|
1033
1033
|
import { ${t.toUpperCase()}_REPOSITORY, type I${t}Repository } from '../${n}.repository'
|
|
1034
1034
|
import type { Create${t}DTO } from '../dtos/create-${n}.dto'
|
|
1035
1035
|
import type { ${t}ResponseDTO } from '../dtos/${n}-response.dto'
|
|
@@ -1083,7 +1083,7 @@ export class Delete${t}Command {
|
|
|
1083
1083
|
this.events.emit('${n}.deleted', { id })
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
|
-
`}]}function
|
|
1086
|
+
`}]}function je(e){let{pascal:t,kebab:n,plural:r=``,pluralPascal:i=``}=e;return[{file:`get-${n}.query.ts`,content:`import { Service, Inject } from '@forinda/kickjs'
|
|
1087
1087
|
import { ${t.toUpperCase()}_REPOSITORY, type I${t}Repository } from '../${n}.repository'
|
|
1088
1088
|
import type { ${t}ResponseDTO } from '../dtos/${n}-response.dto'
|
|
1089
1089
|
|
|
@@ -1111,7 +1111,7 @@ export class List${i}Query {
|
|
|
1111
1111
|
return this.repo.findPaginated(parsed)
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
|
-
`}]}function
|
|
1114
|
+
`}]}function Me(e){let{pascal:t,kebab:n}=e;return[{file:`${n}.events.ts`,content:`import { Service } from '@forinda/kickjs'
|
|
1115
1115
|
import { EventEmitter } from 'node:events'
|
|
1116
1116
|
import type { ${t}ResponseDTO } from '../dtos/${n}-response.dto'
|
|
1117
1117
|
|
|
@@ -1279,7 +1279,7 @@ export class Drizzle${t}Repository implements I${t}Repository {
|
|
|
1279
1279
|
throw new Error('Drizzle ${t} repository not yet implemented')
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
|
-
`}function
|
|
1282
|
+
`}function Ne(e){let{pascal:t,kebab:n}=e;return`import type { DrizzleQueryParamsConfig } from '@forinda/kickjs-drizzle'
|
|
1283
1283
|
// TODO: Import your schema table and reference actual columns for type safety
|
|
1284
1284
|
// import { ${n}s } from '@/db/schema'
|
|
1285
1285
|
|
|
@@ -1355,7 +1355,7 @@ export class Prisma${t}Repository implements I${t}Repository {
|
|
|
1355
1355
|
await this.prisma.${a}.deleteMany({ where: { id } })
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
1358
|
-
`}function
|
|
1358
|
+
`}function Pe(e,t,n,r=[]){switch(t){case`cqrs`:{let t=[],i=[];return r.includes(`devtools`)&&(t.push(`import { DevToolsAdapter } from '@forinda/kickjs-devtools'`),i.push(` DevToolsAdapter(),`)),r.includes(`swagger`)&&(t.push(`import { SwaggerAdapter } from '@forinda/kickjs-swagger'`),i.push(` SwaggerAdapter({\n info: { title: '${e}', version: '${n}' },\n }),`)),`import 'reflect-metadata'
|
|
1359
1359
|
// Side-effect import — registers the extended env schema with kickjs
|
|
1360
1360
|
// **before** any controller / service / @Value gets resolved. Without
|
|
1361
1361
|
// this line ConfigService.get('YOUR_KEY') returns undefined because the
|
|
@@ -1425,14 +1425,14 @@ export const app = await bootstrap({
|
|
|
1425
1425
|
express.json(),
|
|
1426
1426
|
],
|
|
1427
1427
|
})
|
|
1428
|
-
`}}}function
|
|
1428
|
+
`}}}function Fe(){return`import { defineModules } from '@forinda/kickjs'
|
|
1429
1429
|
import { HelloModule } from './hello/hello.module'
|
|
1430
1430
|
|
|
1431
1431
|
// Remove HelloModule and run: kick g module <name>
|
|
1432
1432
|
// \`defineModules()\` returns a chainable list — \`kick g module\` appends
|
|
1433
1433
|
// \`.mount(NewModule())\` to the chain on every generation.
|
|
1434
1434
|
export const modules = defineModules().mount(HelloModule())
|
|
1435
|
-
`}function
|
|
1435
|
+
`}function Ie(){return`import { defineEnv, loadEnv } from '@forinda/kickjs/config'
|
|
1436
1436
|
import { z } from 'zod'
|
|
1437
1437
|
|
|
1438
1438
|
/**
|
|
@@ -1467,7 +1467,7 @@ const envSchema = defineEnv((base) =>
|
|
|
1467
1467
|
export const env = loadEnv(envSchema)
|
|
1468
1468
|
|
|
1469
1469
|
export default envSchema
|
|
1470
|
-
`}function
|
|
1470
|
+
`}function Le(){return`import { Service } from '@forinda/kickjs'
|
|
1471
1471
|
|
|
1472
1472
|
@Service()
|
|
1473
1473
|
export class HelloService {
|
|
@@ -1479,7 +1479,7 @@ export class HelloService {
|
|
|
1479
1479
|
return { status: 'ok', uptime: process.uptime() }
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
|
-
`}function
|
|
1482
|
+
`}function Re(){return`import { Controller, Get, Autowired, type Ctx } from '@forinda/kickjs'
|
|
1483
1483
|
import { HelloService } from './hello.service'
|
|
1484
1484
|
|
|
1485
1485
|
// \`Ctx<KickRoutes.HelloController['<method>']>\` is generated by
|
|
@@ -1501,7 +1501,7 @@ export class HelloController {
|
|
|
1501
1501
|
ctx.json(this.helloService.healthCheck())
|
|
1502
1502
|
}
|
|
1503
1503
|
}
|
|
1504
|
-
`}function
|
|
1504
|
+
`}function ze(){return`import { defineModule } from '@forinda/kickjs'
|
|
1505
1505
|
import { HelloController } from './hello.controller'
|
|
1506
1506
|
|
|
1507
1507
|
export const HelloModule = defineModule({
|
|
@@ -1522,7 +1522,7 @@ export const HelloModule = defineModule({
|
|
|
1522
1522
|
},
|
|
1523
1523
|
}),
|
|
1524
1524
|
})
|
|
1525
|
-
`}function
|
|
1525
|
+
`}function Be(e,t=`inmemory`,n=`pnpm`){return`import { defineConfig } from '@forinda/kickjs-cli'
|
|
1526
1526
|
|
|
1527
1527
|
export default defineConfig({
|
|
1528
1528
|
pattern: '${e}',
|
|
@@ -1566,7 +1566,7 @@ export default defineConfig({
|
|
|
1566
1566
|
},
|
|
1567
1567
|
],
|
|
1568
1568
|
})
|
|
1569
|
-
`}async function
|
|
1569
|
+
`}async function Ve(e){let{pascal:t,kebab:n,plural:r,style:i,write:a}=e;await a(`${n}.module.ts`,ye({pascal:t,kebab:n,plural:r,style:i})),await a(`${n}.controller.ts`,`import { Controller, Get, type Ctx } from '@forinda/kickjs'
|
|
1570
1570
|
|
|
1571
1571
|
// \`Ctx<KickRoutes.${t}Controller['<method>']>\` is generated by
|
|
1572
1572
|
// \`kick typegen\` (auto-run on \`kick dev\`).
|
|
@@ -1578,19 +1578,19 @@ export class ${t}Controller {
|
|
|
1578
1578
|
ctx.json({ message: '${t} list' })
|
|
1579
1579
|
}
|
|
1580
1580
|
}
|
|
1581
|
-
`)}async function
|
|
1581
|
+
`)}async function He(e){let{pascal:t,kebab:n,plural:r,pluralPascal:i,repo:a,noTests:o,prismaClientPath:s,tokenScope:c,style:l,write:u}=e;await u(`${n}.module.ts`,ve({pascal:t,kebab:n,plural:r,repo:a,style:l})),await u(`${n}.constants.ts`,W({pascal:t,kebab:n})),await u(`${n}.controller.ts`,xe({pascal:t,kebab:n,plural:r,pluralPascal:i})),await u(`${n}.service.ts`,De({pascal:t,kebab:n})),await u(`dtos/create-${n}.dto.ts`,I({pascal:t,kebab:n})),await u(`dtos/update-${n}.dto.ts`,L({pascal:t,kebab:n})),await u(`dtos/${n}-response.dto.ts`,R({pascal:t,kebab:n})),await u(`${n}.repository.ts`,z({pascal:t,kebab:n,dtoPrefix:`./dtos`,tokenScope:c}));let d={inmemory:`in-memory-${n}`,drizzle:`drizzle-${n}`,prisma:`prisma-${n}`},f={inmemory:()=>B({pascal:t,kebab:n,repoPrefix:`.`,dtoPrefix:`./dtos`}),drizzle:()=>G({pascal:t,kebab:n,repoPrefix:`.`,dtoPrefix:`./dtos`}),prisma:()=>K({pascal:t,kebab:n,repoPrefix:`.`,dtoPrefix:`./dtos`,prismaClientPath:s})},p=d[a]??`${k(a)}-${n}`,m=f[a]??(()=>V({pascal:t,kebab:n,repoType:a,repoPrefix:`.`,dtoPrefix:`./dtos`}));await u(`${p}.repository.ts`,m()),o||(a!==`inmemory`&&await u(`in-memory-${n}.repository.ts`,B({pascal:t,kebab:n,repoPrefix:`.`,dtoPrefix:`./dtos`})),await u(`__tests__/${n}.controller.test.ts`,H({pascal:t,kebab:n,plural:r})),await u(`__tests__/${n}.repository.test.ts`,U({pascal:t,kebab:n,plural:r,repoPrefix:`../${d.inmemory??`in-memory-${n}`}.repository`})))}async function Ue(e){let{pascal:t,kebab:n,plural:r,pluralPascal:i,repo:a,noTests:o,prismaClientPath:s,tokenScope:c,style:l,write:u}=e;await u(`${n}.module.ts`,Oe({pascal:t,kebab:n,plural:r,repo:a,style:l})),await u(`${n}.constants.ts`,W({pascal:t,kebab:n})),await u(`${n}.controller.ts`,ke({pascal:t,kebab:n,plural:r,pluralPascal:i})),await u(`dtos/create-${n}.dto.ts`,I({pascal:t,kebab:n})),await u(`dtos/update-${n}.dto.ts`,L({pascal:t,kebab:n})),await u(`dtos/${n}-response.dto.ts`,R({pascal:t,kebab:n}));let d=Ae({pascal:t,kebab:n});for(let e of d)await u(`commands/${e.file}`,e.content);let f=je({pascal:t,kebab:n,plural:r,pluralPascal:i});for(let e of f)await u(`queries/${e.file}`,e.content);let p=Me({pascal:t,kebab:n});for(let e of p)await u(`events/${e.file}`,e.content);await u(`${n}.repository.ts`,z({pascal:t,kebab:n,dtoPrefix:`./dtos`,tokenScope:c}));let m={inmemory:`in-memory-${n}`,drizzle:`drizzle-${n}`,prisma:`prisma-${n}`},h={inmemory:()=>B({pascal:t,kebab:n,repoPrefix:`.`,dtoPrefix:`./dtos`}),drizzle:()=>G({pascal:t,kebab:n,repoPrefix:`.`,dtoPrefix:`./dtos`}),prisma:()=>K({pascal:t,kebab:n,repoPrefix:`.`,dtoPrefix:`./dtos`,prismaClientPath:s})},g=m[a]??`${k(a)}-${n}`,_=h[a]??(()=>V({pascal:t,kebab:n,repoType:a,repoPrefix:`.`,dtoPrefix:`./dtos`}));await u(`${g}.repository.ts`,_()),o||(a!==`inmemory`&&await u(`in-memory-${n}.repository.ts`,B({pascal:t,kebab:n,repoPrefix:`.`,dtoPrefix:`./dtos`})),await u(`__tests__/${n}.controller.test.ts`,H({pascal:t,kebab:n,plural:r})),await u(`__tests__/${n}.repository.test.ts`,U({pascal:t,kebab:n,plural:r,repoPrefix:`../${m.inmemory??`in-memory-${n}`}.repository`})))}async function We(e){let{pascal:t,kebab:n,plural:r,pluralPascal:i,repo:a,noEntity:o,noTests:s,prismaClientPath:c,tokenScope:l,style:u,write:d}=e;await d(`${n}.module.ts`,_e({pascal:t,kebab:n,plural:r,repo:a,style:u})),await d(`constants.ts`,a===`drizzle`?Ne({pascal:t,kebab:n}):Se({pascal:t,kebab:n})),await d(`presentation/${n}.controller.ts`,be({pascal:t,kebab:n,plural:r,pluralPascal:i})),await d(`application/dtos/create-${n}.dto.ts`,I({pascal:t,kebab:n})),await d(`application/dtos/update-${n}.dto.ts`,L({pascal:t,kebab:n})),await d(`application/dtos/${n}-response.dto.ts`,R({pascal:t,kebab:n}));let f=Ce({pascal:t,kebab:n,plural:r,pluralPascal:i});for(let e of f)await d(`application/use-cases/${e.file}`,e.content);await d(`domain/repositories/${n}.repository.ts`,z({pascal:t,kebab:n,tokenScope:l})),await d(`domain/services/${n}-domain.service.ts`,we({pascal:t,kebab:n}));let p={inmemory:`in-memory-${n}`,drizzle:`drizzle-${n}`,prisma:`prisma-${n}`},m={inmemory:()=>B({pascal:t,kebab:n}),drizzle:()=>G({pascal:t,kebab:n}),prisma:()=>K({pascal:t,kebab:n,prismaClientPath:c})},h=p[a]??`${k(a)}-${n}`,g=m[a]??(()=>V({pascal:t,kebab:n,repoType:a}));await d(`infrastructure/repositories/${h}.repository.ts`,g()),o||(await d(`domain/entities/${n}.entity.ts`,Te({pascal:t,kebab:n})),await d(`domain/value-objects/${n}-id.vo.ts`,Ee({pascal:t,kebab:n}))),s||(a!==`inmemory`&&await d(`infrastructure/repositories/in-memory-${n}.repository.ts`,B({pascal:t,kebab:n})),await d(`__tests__/${n}.controller.test.ts`,H({pascal:t,kebab:n,plural:r})),await d(`__tests__/${n}.repository.test.ts`,U({pascal:t,kebab:n,plural:r})))}function Ge(e){return e?typeof e==`string`?e:e.name:`inmemory`}async function Ke(e){let{name:t,modulesDir:n,noEntity:r,noTests:a,repo:o=`inmemory`,force:s,dryRun:c}=e,l=e.pluralize!==!1,u=e.pattern??`ddd`;e.minimal&&(u=`minimal`);let d=k(t),f=D(t),m=l?A(d):d,h=l?me(f):f,g=i(n,m),_=[],v=s??!1,y={kebab:d,pascal:f,plural:m,pluralPascal:h,moduleDir:g,repo:o,noEntity:r??!1,noTests:a??!1,prismaClientPath:e.prismaClientPath??`@prisma/client`,tokenScope:e.tokenScope??`app`,style:e.style??`define`,write:async(e,t)=>{let n=i(g,e);if(c){_.push(n);return}if(!v&&await C(n)&&!await T({message:`File exists: ${p.dim(e)}. Overwrite?`,initialValue:!1})){E.warn(`Skipped: ${e}`);return}await b(n,t),_.push(n)},files:_};switch(u){case`minimal`:await Ve(y);break;case`rest`:await He(y);break;case`cqrs`:await Ue(y);break;default:await We(y);break}return c||await q(n,f,m,d,y.style),_}async function q(e,t,n,r,a=`define`){let o=i(e,`index.ts`),s=await C(o),c=`./${n}/${r}.module`,l=a===`class`?`${t}Module`:`${t}Module()`;if(!s){await b(o,a===`class`?`import type { AppModuleEntry } from '@forinda/kickjs'
|
|
1582
1582
|
import { ${t}Module } from '${c}'
|
|
1583
1583
|
|
|
1584
|
-
export const modules: AppModuleEntry[] = [${
|
|
1584
|
+
export const modules: AppModuleEntry[] = [${l}]
|
|
1585
1585
|
`:`import { defineModules } from '@forinda/kickjs'
|
|
1586
1586
|
import { ${t}Module } from '${c}'
|
|
1587
1587
|
|
|
1588
|
-
export const modules = defineModules().mount(${
|
|
1589
|
-
`);return}let f=await
|
|
1588
|
+
export const modules = defineModules().mount(${l})
|
|
1589
|
+
`);return}let f=await u(o,`utf-8`),p=`import { ${t}Module } from '${c}'`,m=j(c);if(!RegExp(`^import\\s*\\{[^}]*\\b${j(t)}Module\\b[^}]*\\}\\s*from\\s*['"]${m}['"]`,`m`).test(f)){let e=f.lastIndexOf(`import `);if(e!==-1){let t=f.indexOf(`
|
|
1590
1590
|
`,e);f=f.slice(0,t+1)+p+`
|
|
1591
1591
|
`+f.slice(t+1)}else f=p+`
|
|
1592
|
-
`+f}let h=Y(f);if(h){let e=f.slice(h.rhsStart,h.rhsEnd+1);RegExp(`\\b${
|
|
1593
|
-
`;)t++;return t}if(n===`/*`){for(t+=2;t+1<e.length&&!(e[t]===`*`&&e[t+1]===`/`);)t++;return t+2}return t}function
|
|
1592
|
+
`+f}let h=Y(f);if(h){let e=f.slice(h.rhsStart,h.rhsEnd+1);RegExp(`\\b${j(t)}Module\\b`).test(e)||(f=J(f,l))}else f=J(f,l);await d(o,f,`utf-8`)}function J(e,t){let n=Y(e);if(!n)return e;if(n.shape===`array`){let r=e.slice(n.rhsStart+1,n.rhsEnd),i=r.trim(),a;if(!i)a=`[${t}]`;else{let e=i.endsWith(`,`)?``:`,`;a=`[${r.trimEnd()}${e} ${t}]`}return e.slice(0,n.rhsStart)+a+e.slice(n.rhsEnd+1)}return`${e.slice(0,n.chainEnd)}\n .mount(${t})${e.slice(n.chainEnd)}`}function Y(e){let t=/export\s+const\s+modules\b[^=]*=/.exec(e);if(!t)return null;let n=t.index+t[0].length;for(;n<e.length&&/\s/.test(e[n]??``);)n++;if(e[n]===`[`){let t=Je(e,n);return t===-1?null:{shape:`array`,rhsStart:n,rhsEnd:t}}if(e.slice(n,n+13)===`defineModules`){let t=qe(e,n);return t===-1?null:{shape:`chain`,rhsStart:n,rhsEnd:t-1,chainEnd:t}}return null}function qe(e,t=0){let n=/defineModules\s*\(/g;n.lastIndex=t;let r=n.exec(e);if(!r)return-1;let i=r.index+r[0].length-1;if(e[i]!==`(`||(i=Z(e,i),i===-1))return-1;for(i++;;){let t=i;for(;t<e.length&&/\s/.test(e[t]??``);)t++;if(e[t]!==`.`||e.slice(t,t+6)!==`.mount`)break;for(t+=6;t<e.length&&/\s/.test(e[t]??``);)t++;if(e[t]!==`(`)break;let n=Z(e,t);if(n===-1)break;i=n+1}return i}function X(e,t){let n=e.slice(t,t+2);if(n===`//`){for(t+=2;t<e.length&&e[t]!==`
|
|
1593
|
+
`;)t++;return t}if(n===`/*`){for(t+=2;t+1<e.length&&!(e[t]===`*`&&e[t+1]===`/`);)t++;return t+2}return t}function Je(e,t){if(e[t]!==`[`)return-1;let n=1,r=t+1;for(;r<e.length;){let t=e.slice(r,r+2);if(t===`//`||t===`/*`){r=X(e,r);continue}let i=e[r]??``;if(i===`'`||i===`"`||i==="`"){let t=i;for(r++;r<e.length&&e[r]!==t;)e[r]===`\\`&&r++,r++;r<e.length&&r++;continue}if(i===`[`)n++;else if(i===`]`&&(n--,n===0))return r;r++}return-1}function Z(e,t){if(e[t]!==`(`)return-1;let n=1,r=t+1;for(;r<e.length;){let t=e.slice(r,r+2);if(t===`//`||t===`/*`){r=X(e,r);continue}let i=e[r]??``;if(i===`'`||i===`"`||i==="`"){let t=i;for(r++;r<e.length&&e[r]!==t;)e[r]===`\\`&&r++,r++;r<e.length&&r++;continue}if(i===`(`)n++;else if(i===`)`&&(n--,n===0))return r;r++}return-1}async function Ye(e){let{name:t,outDir:n}=e,r=k(t),a=D(t),o=[],s=i(n,`${r}.adapter.ts`);return await b(s,`import {
|
|
1594
1594
|
defineAdapter,
|
|
1595
1595
|
type AdapterContext,
|
|
1596
1596
|
type AdapterMiddleware,
|
|
@@ -1627,7 +1627,7 @@ export interface ${a}AdapterConfig {
|
|
|
1627
1627
|
* @example
|
|
1628
1628
|
* \`\`\`ts
|
|
1629
1629
|
* import { bootstrap } from '@forinda/kickjs'
|
|
1630
|
-
* import { ${a}Adapter } from './adapters/${
|
|
1630
|
+
* import { ${a}Adapter } from './adapters/${r}.adapter'
|
|
1631
1631
|
*
|
|
1632
1632
|
* bootstrap({
|
|
1633
1633
|
* modules,
|
|
@@ -1686,7 +1686,7 @@ export const ${a}Adapter = defineAdapter<${a}AdapterConfig>({
|
|
|
1686
1686
|
*/
|
|
1687
1687
|
beforeMount(_ctx: AdapterContext): void {
|
|
1688
1688
|
// Example:
|
|
1689
|
-
// _ctx.app.get('/${
|
|
1689
|
+
// _ctx.app.get('/${r}/status', (_req, res) => res.json({ status: 'ok' }))
|
|
1690
1690
|
},
|
|
1691
1691
|
|
|
1692
1692
|
/**
|
|
@@ -1734,10 +1734,10 @@ export const ${a}Adapter = defineAdapter<${a}AdapterConfig>({
|
|
|
1734
1734
|
return [
|
|
1735
1735
|
// Example:
|
|
1736
1736
|
// import { defineHttpContextDecorator } from '@forinda/kickjs'
|
|
1737
|
-
// declare module '@forinda/kickjs' { interface ContextMeta { ${
|
|
1737
|
+
// declare module '@forinda/kickjs' { interface ContextMeta { ${r}: { id: string } } }
|
|
1738
1738
|
// const Load${a} = defineHttpContextDecorator({
|
|
1739
|
-
// key: '${
|
|
1740
|
-
// resolve: (ctx) => ({ id: ctx.req.headers['x-${
|
|
1739
|
+
// key: '${r}',
|
|
1740
|
+
// resolve: (ctx) => ({ id: ctx.req.headers['x-${r}-id'] as string }),
|
|
1741
1741
|
// })
|
|
1742
1742
|
// return [Load${a}.registration]
|
|
1743
1743
|
]
|
|
@@ -1759,7 +1759,7 @@ export const ${a}Adapter = defineAdapter<${a}AdapterConfig>({
|
|
|
1759
1759
|
}
|
|
1760
1760
|
},
|
|
1761
1761
|
})
|
|
1762
|
-
`),o.push(s),o}const
|
|
1762
|
+
`),o.push(s),o}const Xe={controller:`presentation`,service:`domain/services`,dto:`application/dtos`,guard:`presentation/guards`,middleware:`middleware`},Ze={controller:``,service:``,dto:`dtos`,guard:`guards`,middleware:`middleware`},Qe={controller:``,service:``,dto:`dtos`,guard:`guards`,middleware:`middleware`,command:`commands`,query:`queries`,event:`events`};function Q(e){let{type:t,outDir:n,moduleName:r,modulesDir:o=`src/modules`,defaultDir:s,pattern:c=`ddd`,shouldPluralize:l=!0}=e;if(n)return a(n);if(r){let e=c===`ddd`?Xe:c===`cqrs`?Qe:Ze,n=k(r),s=l?A(n):n,u=e[t]??``,d=i(o,s);return a(u?i(d,u):d)}return a(s)}async function $e(e){let{name:t,moduleName:n,modulesDir:r,pattern:a}=e,o=Q({type:`middleware`,outDir:e.outDir,moduleName:n,modulesDir:r,defaultDir:`src/middleware`,pattern:a,shouldPluralize:e.pluralize??!0}),s=k(t),c=O(t),l=[],u=i(o,`${s}.middleware.ts`);return await b(u,`import type { Request, Response, NextFunction } from 'express'
|
|
1763
1763
|
|
|
1764
1764
|
export interface ${D(t)}Options {
|
|
1765
1765
|
// Add configuration options here. The factory below closes over the
|
|
@@ -1809,7 +1809,7 @@ export function ${c}(options: ${D(t)}Options = {}) {
|
|
|
1809
1809
|
next()
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
1812
|
-
`),l.push(u),l}async function
|
|
1812
|
+
`),l.push(u),l}async function et(e){let{name:t,moduleName:n,modulesDir:r,pattern:a}=e,o=Q({type:`guard`,outDir:e.outDir,moduleName:n,modulesDir:r,defaultDir:`src/guards`,pattern:a,shouldPluralize:e.pluralize??!0}),s=k(t),c=O(t),l=D(t),u=[],d=i(o,`${s}.guard.ts`);return await b(d,`import { Container, HttpException } from '@forinda/kickjs'
|
|
1813
1813
|
import type { RequestContext } from '@forinda/kickjs'
|
|
1814
1814
|
|
|
1815
1815
|
/**
|
|
@@ -1845,7 +1845,7 @@ export async function ${c}Guard(ctx: RequestContext, next: () => void): Promise<
|
|
|
1845
1845
|
ctx.res.status(401).json({ message: 'Invalid or expired token' })
|
|
1846
1846
|
}
|
|
1847
1847
|
}
|
|
1848
|
-
`),u.push(d),u}async function
|
|
1848
|
+
`),u.push(d),u}async function tt(e){let{name:t,moduleName:n,modulesDir:r,pattern:a}=e,o=Q({type:`service`,outDir:e.outDir,moduleName:n,modulesDir:r,defaultDir:`src/services`,pattern:a,shouldPluralize:e.pluralize??!0}),s=k(t),c=D(t),l=[],u=i(o,`${s}.service.ts`);return await b(u,`import { Service } from '@forinda/kickjs'
|
|
1849
1849
|
|
|
1850
1850
|
@Service()
|
|
1851
1851
|
export class ${c}Service {
|
|
@@ -1854,7 +1854,7 @@ export class ${c}Service {
|
|
|
1854
1854
|
// @Inject(MY_REPO) private readonly repo: IMyRepository,
|
|
1855
1855
|
// ) {}
|
|
1856
1856
|
}
|
|
1857
|
-
`),l.push(u),l}async function
|
|
1857
|
+
`),l.push(u),l}async function nt(e){let{name:t,moduleName:n,modulesDir:r,pattern:a}=e,o=Q({type:`controller`,outDir:e.outDir,moduleName:n,modulesDir:r,defaultDir:`src/controllers`,pattern:a,shouldPluralize:e.pluralize??!0}),s=k(t),c=D(t),l=[],u=i(o,`${s}.controller.ts`);return await b(u,`import { Controller, Get, Post, type Ctx } from '@forinda/kickjs'
|
|
1858
1858
|
|
|
1859
1859
|
// \`Ctx<KickRoutes.${c}Controller['<method>']>\` is generated by
|
|
1860
1860
|
// \`kick typegen\` (auto-run on \`kick dev\`). After the first run, your IDE
|
|
@@ -1875,7 +1875,7 @@ export class ${c}Controller {
|
|
|
1875
1875
|
ctx.created({ message: '${c} created', data: ctx.body })
|
|
1876
1876
|
}
|
|
1877
1877
|
}
|
|
1878
|
-
`),l.push(u),l}async function
|
|
1878
|
+
`),l.push(u),l}async function rt(e){let{name:t,moduleName:n,modulesDir:r,pattern:a}=e,o=Q({type:`dto`,outDir:e.outDir,moduleName:n,modulesDir:r,defaultDir:`src/dtos`,pattern:a,shouldPluralize:e.pluralize??!0}),s=k(t),c=D(t),l=O(t),u=[],d=i(o,`${s}.dto.ts`);return await b(d,`import { z } from 'zod'
|
|
1879
1879
|
|
|
1880
1880
|
export const ${l}Schema = z.object({
|
|
1881
1881
|
// Define your schema fields here
|
|
@@ -1883,7 +1883,7 @@ export const ${l}Schema = z.object({
|
|
|
1883
1883
|
})
|
|
1884
1884
|
|
|
1885
1885
|
export type ${c}DTO = z.infer<typeof ${l}Schema>
|
|
1886
|
-
`),u.push(d),u}const
|
|
1886
|
+
`),u.push(d),u}const it={swagger:`@forinda/kickjs-swagger`,ws:`@forinda/kickjs-ws`,queue:`@forinda/kickjs-queue`,devtools:`@forinda/kickjs-devtools`};function $(e,t){let n=e[t];if(!n)throw Error(`generatePackageJson: missing resolved version for ${t}. Add it to SIBLING_PACKAGES in generators/project.ts.`);return n}function at(e,t,n,r=[]){let i={"@forinda/kickjs":$(n,`@forinda/kickjs`),dotenv:`^17.3.1`,express:`^5.1.0`,"reflect-metadata":`^0.2.2`,zod:`^4.3.6`,pino:`^10.3.1`,"pino-pretty":`^13.1.3`};for(let e of r){let t=it[e];t&&!i[t]&&(i[t]=$(n,t))}return JSON.stringify({name:e,version:`0.0.0`,type:`module`,scripts:{dev:`vite`,"dev:debug":`kick dev:debug`,build:`kick build`,start:`kick start`,test:`vitest run`,"test:watch":`vitest`,typecheck:`tsc --noEmit`,typegen:`kick typegen`,lint:`eslint src/`,format:`prettier --write src/`},dependencies:i,devDependencies:{"@forinda/kickjs-cli":$(n,`@forinda/kickjs-cli`),"@forinda/kickjs-vite":$(n,`@forinda/kickjs-vite`),"@swc/core":`^1.15.21`,"@types/express":`^5.0.6`,"@types/node":`^25.0.0`,"unplugin-swc":`^1.5.9`,vite:`^8.0.3`,vitest:`^4.1.2`,typescript:`^6.0.3`,prettier:`^3.8.1`}},null,2)}function ot(){return`import { defineConfig } from 'vite'
|
|
1887
1887
|
import { resolve } from 'node:path'
|
|
1888
1888
|
import swc from 'unplugin-swc'
|
|
1889
1889
|
import { kickjsVitePlugin, envWatchPlugin } from '@forinda/kickjs-vite'
|
|
@@ -1918,7 +1918,7 @@ export default defineConfig({
|
|
|
1918
1918
|
},
|
|
1919
1919
|
},
|
|
1920
1920
|
})
|
|
1921
|
-
`}function
|
|
1921
|
+
`}function st(){return JSON.stringify({compilerOptions:{target:`ES2022`,module:`ESNext`,moduleResolution:`bundler`,lib:[`ES2022`],types:[`node`,`vite/client`],strict:!0,esModuleInterop:!0,skipLibCheck:!0,sourceMap:!0,declaration:!0,experimentalDecorators:!0,emitDecoratorMetadata:!0,outDir:`dist`,paths:{"@/*":[`./src/*`]}},include:[`src`,`.kickjs/types/**/*.d.ts`,`.kickjs/types/**/*.ts`]},null,2)}function ct(){return JSON.stringify({semi:!1,singleQuote:!0,trailingComma:`all`,printWidth:100,tabWidth:2},null,2)}function lt(){return`# https://editorconfig.org
|
|
1922
1922
|
root = true
|
|
1923
1923
|
|
|
1924
1924
|
[*]
|
|
@@ -1931,14 +1931,14 @@ insert_final_newline = true
|
|
|
1931
1931
|
|
|
1932
1932
|
[*.md]
|
|
1933
1933
|
trim_trailing_whitespace = false
|
|
1934
|
-
`}function
|
|
1934
|
+
`}function ut(){return`node_modules/
|
|
1935
1935
|
dist/
|
|
1936
1936
|
.env
|
|
1937
1937
|
coverage/
|
|
1938
1938
|
.DS_Store
|
|
1939
1939
|
*.tsbuildinfo
|
|
1940
1940
|
.kickjs/
|
|
1941
|
-
`}function
|
|
1941
|
+
`}function dt(){return`# Auto-detect text files and normalise line endings to LF
|
|
1942
1942
|
* text=auto eol=lf
|
|
1943
1943
|
|
|
1944
1944
|
# Explicitly mark generated / binary files
|
|
@@ -1956,11 +1956,11 @@ coverage/
|
|
|
1956
1956
|
pnpm-lock.yaml -diff linguist-generated
|
|
1957
1957
|
yarn.lock -diff linguist-generated
|
|
1958
1958
|
package-lock.json -diff linguist-generated
|
|
1959
|
-
`}function dt(){return`PORT=3000
|
|
1960
|
-
NODE_ENV=development
|
|
1961
1959
|
`}function ft(){return`PORT=3000
|
|
1962
1960
|
NODE_ENV=development
|
|
1963
|
-
`}function pt(){return`
|
|
1961
|
+
`}function pt(){return`PORT=3000
|
|
1962
|
+
NODE_ENV=development
|
|
1963
|
+
`}function mt(){return`import { defineConfig } from 'vitest/config'
|
|
1964
1964
|
import swc from 'unplugin-swc'
|
|
1965
1965
|
|
|
1966
1966
|
export default defineConfig({
|
|
@@ -1971,7 +1971,7 @@ export default defineConfig({
|
|
|
1971
1971
|
include: ['src/**/*.test.ts'],
|
|
1972
1972
|
},
|
|
1973
1973
|
})
|
|
1974
|
-
`}function
|
|
1974
|
+
`}function ht(e,t,n){let r={rest:`REST API`,ddd:`Domain-Driven Design`,cqrs:`CQRS + Event-Driven`,minimal:`Minimal`},i=[`@forinda/kickjs`,`@forinda/kickjs-vite`];return t!==`minimal`&&i.push(`@forinda/kickjs-swagger`,`@forinda/kickjs-devtools`),t===`cqrs`&&i.push(`@forinda/kickjs-queue`,`@forinda/kickjs-ws`),`# ${e}
|
|
1975
1975
|
|
|
1976
1976
|
A **${r[t]??`REST API`}** built with [KickJS](https://forinda.github.io/kick-js/) — a decorator-driven Node.js framework on Express 5 and TypeScript.
|
|
1977
1977
|
|
|
@@ -2034,7 +2034,7 @@ Copy \`.env.example\` to \`.env\` and configure:
|
|
|
2034
2034
|
|
|
2035
2035
|
- [KickJS Documentation](https://forinda.github.io/kick-js/)
|
|
2036
2036
|
- [CLI Reference](https://forinda.github.io/kick-js/api/cli.html)
|
|
2037
|
-
`}function
|
|
2037
|
+
`}function gt(e,t,n){return`# CLAUDE.md — ${e}
|
|
2038
2038
|
|
|
2039
2039
|
**Read \`./.agents/AGENTS.md\` first.** It is the canonical, multi-agent
|
|
2040
2040
|
reference for this project (Claude, Copilot, Codex, Gemini, etc.) —
|
|
@@ -2108,7 +2108,7 @@ When generating or modifying code in this project, stay aligned with the v4 conv
|
|
|
2108
2108
|
- **Refresh these files**: \`kick g agents -f\` regenerates \`CLAUDE.md\` at the project root and \`.agents/AGENTS.md\` + \`.agents/GEMINI.md\` + \`.agents/COPILOT.md\` + every \`.agents/skills/<name>/SKILL.md\` from the latest CLI templates. Hand-edited content is overwritten — keep customisation in \`.agents/AGENTS.local.md\` or per-skill \`SKILL.local.md\` files alongside.
|
|
2109
2109
|
|
|
2110
2110
|
For everything else (controllers, services, modules, RequestContext API, generators, CLI commands, package additions, env wiring, troubleshooting) → \`.agents/AGENTS.md\`.
|
|
2111
|
-
`}function
|
|
2111
|
+
`}function _t(e,t,n){return`# AGENTS.md — AI Agent Guide for ${e}
|
|
2112
2112
|
|
|
2113
2113
|
This guide is the **canonical, multi-agent reference** for this KickJS
|
|
2114
2114
|
application — Claude, Copilot, Codex, Gemini, etc. all read it first.
|
|
@@ -2615,7 +2615,7 @@ ${t===`cqrs`?`### Background Jobs
|
|
|
2615
2615
|
- [Decorators Guide](https://forinda.github.io/kick-js/guide/decorators.html)
|
|
2616
2616
|
- [DI System](https://forinda.github.io/kick-js/guide/dependency-injection.html)
|
|
2617
2617
|
- [Testing](https://forinda.github.io/kick-js/api/testing.html)
|
|
2618
|
-
`}function
|
|
2618
|
+
`}function vt(e,t,n){let r=`<!-- Generated by \`kick g agents\` for ${e}. Edits are overwritten on the next refresh; keep customisation in a SKILL.local.md alongside. -->`;return[{slug:`add-module`,frontmatterName:`kickjs-add-module`,description:`Use when the user asks to add a new feature module (controller + service + repo + DTOs).`,body:`**Trigger phrases**: "add a users module", "scaffold tasks", "new feature for X".
|
|
2619
2619
|
|
|
2620
2620
|
**Steps**:
|
|
2621
2621
|
1. Run \`kick g module <name>\` (use plural form if the project pluralizes — check \`kick.config.ts\`).
|
|
@@ -2750,7 +2750,7 @@ description: ${e.description}
|
|
|
2750
2750
|
${r}
|
|
2751
2751
|
|
|
2752
2752
|
${e.body}
|
|
2753
|
-
`}))}function
|
|
2753
|
+
`}))}function yt(e,t,n){return`# kickjs-skills.md — Task Skills for AI Agents (${e})
|
|
2754
2754
|
|
|
2755
2755
|
This file is the agent-facing **skills index** for KickJS work in this
|
|
2756
2756
|
repo. Each block below is a short, rigid workflow keyed to a specific
|
|
@@ -2999,7 +2999,7 @@ description: Patterns to refuse outright when the user asks for them — they br
|
|
|
2999
2999
|
- [Decorators](https://forinda.github.io/kick-js/guide/decorators.html)
|
|
3000
3000
|
- [Context Decorators](https://forinda.github.io/kick-js/guide/context-decorators.html)
|
|
3001
3001
|
- [Testing](https://forinda.github.io/kick-js/api/testing.html)
|
|
3002
|
-
`}function
|
|
3002
|
+
`}function bt(e,t,n){return`# GEMINI.md — ${e}
|
|
3003
3003
|
|
|
3004
3004
|
**Read \`./AGENTS.md\` first.** It is the canonical, multi-agent
|
|
3005
3005
|
reference for this project — every convention, structure, decorator
|
|
@@ -3033,7 +3033,7 @@ without us copy-pasting.
|
|
|
3033
3033
|
\`kick g agents --only gemini -f\` regenerates this file from the
|
|
3034
3034
|
CLI template. Hand-edited content is overwritten — keep customisation
|
|
3035
3035
|
in \`.agents/GEMINI.local.md\`.
|
|
3036
|
-
`}function
|
|
3036
|
+
`}function xt(e,t,n){return`# COPILOT.md — ${e}
|
|
3037
3037
|
|
|
3038
3038
|
**Read \`./AGENTS.md\` first.** It is the canonical, multi-agent
|
|
3039
3039
|
reference for this project — every convention, structure, decorator
|
|
@@ -3066,7 +3066,7 @@ Codex / Cursor / Gemini / Claude Code without copy-pasting.
|
|
|
3066
3066
|
\`kick g agents --only copilot -f\` regenerates this file from the
|
|
3067
3067
|
CLI template. Hand-edited content is overwritten — keep customisation
|
|
3068
3068
|
in \`.agents/COPILOT.local.md\`.
|
|
3069
|
-
`}const
|
|
3070
|
-
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${
|
|
3071
|
-
Project scaffolded successfully!`),console.log();let d=c!==process.cwd();l(`Next steps:`),d&&l(` cd ${t}`),e.installDeps||l(` ${
|
|
3072
|
-
//# sourceMappingURL=generator-extension-
|
|
3069
|
+
`}const St=n(_(import.meta.url)),Ct=JSON.parse(s(i(St,`..`,`package.json`),`utf-8`)),wt=`^${Ct.version}`,Tt=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`,`@forinda/kickjs-swagger`,`@forinda/kickjs-ws`,`@forinda/kickjs-queue`,`@forinda/kickjs-devtools`,`@forinda/kickjs-testing`];async function Et(){let e=await Promise.all(Tt.map(async e=>{try{let t=h(`npm`,[`view`,e,`version`],{encoding:`utf-8`,timeout:5e3,stdio:[`ignore`,`pipe`,`ignore`]}).toString().trim();if(t&&/^\d+\.\d+\.\d+/.test(t))return[e,`^${t}`]}catch{}return[e,wt]}));return Object.fromEntries(e)}async function Dt(e){let{name:t,directory:n,packageManager:r=`pnpm`,template:a=`rest`,defaultRepo:o=`inmemory`,packages:s=[]}=e,c=n,l=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${t}\n`),l(`Resolving package versions...`);let u=await Et();if(await b(i(c,`package.json`),at(t,a,u,s)),await b(i(c,`vite.config.ts`),ot()),await b(i(c,`tsconfig.json`),st()),await b(i(c,`.prettierrc`),ct()),await b(i(c,`.editorconfig`),lt()),await b(i(c,`.gitignore`),ut()),await b(i(c,`.gitattributes`),dt()),await b(i(c,`.env`),ft()),await b(i(c,`.env.example`),pt()),await b(i(c,`src/config/index.ts`),Ie()),await b(i(c,`src/index.ts`),Pe(t,a,Ct.version,s)),await b(i(c,`src/modules/index.ts`),Fe()),await b(i(c,`src/modules/hello/hello.service.ts`),Le()),await b(i(c,`src/modules/hello/hello.controller.ts`),Re()),await b(i(c,`src/modules/hello/hello.module.ts`),ze()),await b(i(c,`kick.config.ts`),Be(a,o,r)),await b(i(c,`vitest.config.ts`),mt()),await b(i(c,`README.md`),ht(t,a,r)),await b(i(c,`CLAUDE.md`),gt(t,a,r)),await b(i(c,`AGENTS.md`),_t(t,a,r)),await b(i(c,`kickjs-skills.md`),yt(t,a,r)),e.installDeps){console.log(`\n Installing dependencies with ${r}...\n`);try{g(`${r} install`,{cwd:c,stdio:`inherit`}),console.log(`
|
|
3070
|
+
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${r} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-C3G375CR.mjs`).then(e=>e.r);await e({cwd:c,allowDuplicates:!0,silent:!0})}catch{}if(e.initGit)try{g(`git init`,{cwd:c,stdio:`pipe`}),g(`git branch -M main`,{cwd:c,stdio:`pipe`}),g(`git add -A`,{cwd:c,stdio:`pipe`}),g(`git commit -m "chore: initial commit from kick new"`,{cwd:c,stdio:`pipe`}),l(`Git repository initialized`)}catch{l(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
3071
|
+
Project scaffolded successfully!`),console.log();let d=c!==process.cwd();l(`Next steps:`),d&&l(` cd ${t}`),e.installDeps||l(` ${r} install`);let f={rest:`kick g module user`,ddd:`kick g module user --repo drizzle`,cqrs:`kick g module user --pattern cqrs`,minimal:`# add your routes to src/index.ts`};l(` ${f[a]??f.rest}`),l(` kick dev`),l(``),l(`Commands:`),l(` kick dev Start dev server with Vite HMR`),l(` kick build Production build via Vite`),l(` kick start Run production build`),l(``),l(`Generators:`),l(` kick g module <name> Full DDD module (controller, DTOs, use-cases, repo)`),l(` kick g scaffold <n> <f..> CRUD module from field definitions`),l(` kick g controller <name> Standalone controller`),l(` kick g service <name> @Service() class`),l(` kick g middleware <name> Express middleware`),l(` kick g guard <name> Route guard (auth, roles, etc.)`),l(` kick g adapter <name> AppAdapter with lifecycle hooks`),l(` kick g dto <name> Zod DTO schema`),a===`cqrs`&&l(` kick g job <name> Queue job processor`),l(` kick g config Generate kick.config.ts`),l(``),l(`Add packages:`),l(` kick add <pkg> Install a KickJS package + peers`),l(` kick add --list Show all available packages`),l(``),l(`Available: auth, swagger, drizzle, prisma, ws, queue, devtools, mcp, testing`),l(``)}function Ot(e){return e}function kt(e){return k(e).replace(/-/g,`_`)}function At(t){let n=t.cwd??process.cwd(),r=t.projectRoot??e(n),i=t.pluralize??!0,a=D(t.name),o=O(t.name),s=k(t.name),c=kt(t.name),l={name:t.name,pascal:a,camel:o,kebab:s,snake:c,modulesDir:t.modulesDir??`src/modules`,cwd:n,projectRoot:r,args:t.args??[],flags:t.flags??{}};if(i){let e=A(s);l.pluralKebab=e,l.pluralPascal=D(e),l.pluralCamel=O(e)}return l}function jt(e,t){return a(e.cwd,t)}async function Mt(e){return import(v(e).href)}const Nt=new Map;async function Pt(e){let t=Nt.get(e);if(t)return t;let n=Ft(e);return Nt.set(e,n),n}async function Ft(e){let r=a(e,`package.json`);if(!o(r))return{generators:[],loaded:[],failed:[]};let i=It(JSON.parse(await u(r,`utf-8`))),s=t(a(e,`package.json`)),c=[],l=[],d=[];for(let e of i){let t;try{t=s.resolve(`${e}/package.json`)}catch{continue}let r;try{r=JSON.parse(await u(t,`utf-8`))}catch(t){d.push({source:e,reason:`failed to parse package.json: ${t}`});continue}if(!r.kickjs?.generators)continue;let i=r.kickjs.generators,f=a(n(t),i);if(!o(f)){d.push({source:e,reason:`kickjs.generators points to missing file: ${i}`});continue}let p;try{p=await Mt(f)}catch(t){d.push({source:e,reason:`failed to import manifest: ${t}`});continue}let m=p.default;if(!Array.isArray(m)){d.push({source:e,reason:`manifest's default export is not an array of GeneratorSpec`});continue}for(let t of m){if(!Lt(t)){d.push({source:e,reason:`manifest entry is not a valid GeneratorSpec (missing name/files)`});continue}c.push({source:e,spec:t})}l.push(e)}return{generators:c,loaded:l,failed:d}}function It(e){let t=new Set;for(let n of[e.dependencies,e.devDependencies,e.peerDependencies])if(n)for(let e of Object.keys(n))t.add(e);return Array.from(t)}function Lt(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.name==`string`&&typeof t.files==`function`}async function Rt(e,t=[]){let n=e.cwd??process.cwd(),r=t.find(t=>t.spec.name===e.generatorName);if(r)return Vt(r.spec,r.source,e,n);let i=Bt(await Pt(n),e.generatorName);return i?Vt(i.spec,i.source,e,n):null}async function zt(e,t=[]){let n=await Pt(e),r=new Set(t.map(e=>e.spec.name)),i=n.generators.filter(e=>!r.has(e.spec.name));return{generators:[...t,...i],loaded:n.loaded,failed:n.failed}}function Bt(e,t){return e.generators.find(e=>e.spec.name===t)}async function Vt(e,t,n,r){let i=At({name:n.itemName,args:n.args,flags:n.flags,modulesDir:n.modulesDir,pluralize:n.pluralize,cwd:r,projectRoot:n.projectRoot}),a=await e.files(i),o=[];for(let e of a){let t=jt(i,e.path);await b(t,e.content),o.push(t)}return{files:o,source:t}}export{fe as A,b as B,me as C,T as D,D as E,oe as F,p as I,se as L,de as M,pe as N,ce as O,ue as P,C as R,A as S,k as T,q as _,Dt as a,Ge as b,xt as c,rt as d,nt as f,Ye as g,$e as h,Ot as i,le as j,E as k,bt as l,et as m,Rt as n,_t as o,tt as p,At as r,gt as s,zt as t,vt as u,Y as v,O as w,j as x,Ke as y,ee as z};
|
|
3072
|
+
//# sourceMappingURL=generator-extension-BXLt3Tp_.mjs.map
|