@forinda/kickjs-cli 5.9.1 → 5.10.0-alpha.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/{agent-docs-CxuUgXF_.mjs → agent-docs-D28p084u.mjs} +3 -3
- package/dist/{agent-docs-CxuUgXF_.mjs.map → agent-docs-D28p084u.mjs.map} +1 -1
- package/dist/{builtins-yDCsD2ae.mjs → builtins-DQYGadNr.mjs} +2 -2
- package/dist/cli.mjs +262 -164
- package/dist/{config-icjz-b4f.mjs → config-D88F6N-F.mjs} +3 -3
- package/dist/config-D88F6N-F.mjs.map +1 -0
- package/dist/{doctor-BrkA44Gz.mjs → doctor-CrcAgy78.mjs} +126 -30
- package/dist/doctor-CrcAgy78.mjs.map +1 -0
- package/dist/index.d.mts +11 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-CdC5d4kw.mjs → plugin-CVLGiqTz.mjs} +3 -3
- package/dist/{plugin-CdC5d4kw.mjs.map → plugin-CVLGiqTz.mjs.map} +1 -1
- package/dist/{project-docs-LqGoslXZ.mjs → project-docs-Crf8Isi0.mjs} +2 -2
- package/dist/{project-docs-LqGoslXZ.mjs.map → project-docs-Crf8Isi0.mjs.map} +1 -1
- package/dist/{project-root-CM9jhMiW.mjs → project-root-CoRj39UG.mjs} +3 -3
- package/dist/{project-root-CM9jhMiW.mjs.map → project-root-CoRj39UG.mjs.map} +1 -1
- package/dist/{rolldown-runtime-My-8F9u3.mjs → rolldown-runtime-D75pbbHH.mjs} +1 -1
- package/dist/{run-plugins-B3Ooiczg.mjs → run-plugins-gGJZ3-LN.mjs} +14 -12
- package/dist/run-plugins-gGJZ3-LN.mjs.map +1 -0
- package/dist/{typegen-Cd0w7Al-.mjs → typegen-CKkEXPeQ.mjs} +5 -5
- package/dist/typegen-CKkEXPeQ.mjs.map +1 -0
- package/dist/{types-Dry-y2AZ.mjs → types-vUgXYtWR.mjs} +2 -2
- package/dist/{types-Dry-y2AZ.mjs.map → types-vUgXYtWR.mjs.map} +1 -1
- package/package.json +10 -10
- package/dist/config-icjz-b4f.mjs.map +0 -1
- package/dist/doctor-BrkA44Gz.mjs.map +0 -1
- package/dist/run-plugins-B3Ooiczg.mjs.map +0 -1
- package/dist/typegen-Cd0w7Al-.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v5.
|
|
2
|
+
* @forinda/kickjs-cli v5.10.0-alpha.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{t as e}from"./rolldown-runtime-
|
|
12
|
-
//# sourceMappingURL=project-root-
|
|
11
|
+
import{t as e}from"./rolldown-runtime-D75pbbHH.mjs";import{dirname as t,parse as n,resolve as r}from"node:path";import{existsSync as i}from"node:fs";var a=e({findProjectRoot:()=>s});const o=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];function s(e=process.cwd()){let a=r(e),{root:s}=n(a),c=null,l=a;for(;;){for(let e of o)if(i(r(l,e)))return l;if(c===null&&i(r(l,`package.json`))&&(c=l),l===s)break;let e=t(l);if(e===l)break;l=e}return c??a}export{a as n,s as t};
|
|
12
|
+
//# sourceMappingURL=project-root-CoRj39UG.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-root-
|
|
1
|
+
{"version":3,"file":"project-root-CoRj39UG.mjs","names":[],"sources":["../src/utils/project-root.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { dirname, parse, resolve } from 'node:path'\n\nconst CONFIG_FILENAMES = ['kick.config.ts', 'kick.config.js', 'kick.config.mjs', 'kick.config.json']\n\n/**\n * Walk up from `startDir` looking for the project root. A directory\n * counts as the root when it contains any of:\n * - `kick.config.{ts,js,mjs,json}` (strongest signal)\n * - `package.json` (fallback when no config file exists yet)\n *\n * Returns the absolute path of the first matching directory, or\n * `startDir` itself when nothing was found (no surprises — callers\n * that didn't find a config still get a reasonable cwd).\n *\n * `kick.config.*` wins over `package.json` when both appear at\n * different levels, so adopters running `kick typegen` from `src/`\n * land on the project root that owns the config, not on the nearest\n * workspace package boundary in a monorepo.\n */\nexport function findProjectRoot(startDir: string = process.cwd()): string {\n const start = resolve(startDir)\n const { root: fsRoot } = parse(start)\n\n let firstPackageJson: string | null = null\n let cursor = start\n while (true) {\n for (const name of CONFIG_FILENAMES) {\n if (existsSync(resolve(cursor, name))) return cursor\n }\n if (firstPackageJson === null && existsSync(resolve(cursor, 'package.json'))) {\n firstPackageJson = cursor\n }\n if (cursor === fsRoot) break\n const parent = dirname(cursor)\n if (parent === cursor) break\n cursor = parent\n }\n\n return firstPackageJson ?? start\n}\n"],"mappings":";;;;;;;;;;sLAGA,MAAM,EAAmB,CAAC,iBAAkB,iBAAkB,kBAAmB,kBAAkB,EAiBnG,SAAgB,EAAgB,EAAmB,QAAQ,IAAI,EAAW,CACxE,IAAM,EAAQ,EAAQ,CAAQ,EACxB,CAAE,KAAM,GAAW,EAAM,CAAK,EAEhC,EAAkC,KAClC,EAAS,EACb,OAAa,CACX,IAAK,IAAM,KAAQ,EACjB,GAAI,EAAW,EAAQ,EAAQ,CAAI,CAAC,EAAG,OAAO,EAKhD,GAHI,IAAqB,MAAQ,EAAW,EAAQ,EAAQ,cAAc,CAAC,IACzE,EAAmB,GAEjB,IAAW,EAAQ,MACvB,IAAM,EAAS,EAAQ,CAAM,EAC7B,GAAI,IAAW,EAAQ,MACvB,EAAS,CACX,CAEA,OAAO,GAAoB,CAC7B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v5.
|
|
2
|
+
* @forinda/kickjs-cli v5.10.0-alpha.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{_ as e,b as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,p as l,s as u,u as d,v as f,y as p}from"./project-docs-
|
|
11
|
+
import{_ as e,b as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,p as l,s as u,u as d,v as f,y as p}from"./project-docs-Crf8Isi0.mjs";import{C as m,S as h,_ as g,a as _,b as v,c as y,d as b,f as ee,g as te,h as ne,i as re,l as ie,m as ae,p as oe,r as se,u as ce,v as le,w as x,x as ue,y as S}from"./doctor-CrcAgy78.mjs";import{a as C,i as w,o as de,t as fe}from"./config-D88F6N-F.mjs";import{t as pe}from"./project-root-CoRj39UG.mjs";import{n as T}from"./types-vUgXYtWR.mjs";import{n as me}from"./agent-docs-D28p084u.mjs";import{n as he}from"./plugin-CVLGiqTz.mjs";import{a as ge,c as _e,i as ve,n as ye,o as be,s as xe,t as E}from"./typegen-CKkEXPeQ.mjs";import D,{basename as Se,dirname as O,isAbsolute as Ce,join as k,relative as A,resolve as j,sep as we}from"node:path";import{cpSync as Te,existsSync as M,mkdirSync as N,readFileSync as P,readdirSync as Ee,rmSync as De,statSync as Oe,writeFileSync as ke}from"node:fs";import{copyFile as Ae,mkdir as je,readFile as F,readdir as Me,rm as Ne,stat as Pe,writeFile as I}from"node:fs/promises";import{execSync as Fe,fork as Ie,spawn as Le,spawnSync as Re}from"node:child_process";import{pathToFileURL as L}from"node:url";import{glob as ze}from"glob";import{groupAssetKeys as Be}from"@forinda/kickjs";import{arch as Ve,platform as He,release as Ue}from"node:os";import{detectCompositeReferences as We,generate as Ge,migrateDown as Ke,migrateLatest as qe,migrateRollback as Je,migrateStatus as Ye,migrateUp as Xe,renderSchemaSource as Ze,resolveDbConfig as Qe}from"@forinda/kickjs-db";const $e={kickjs:{pkg:`@forinda/kickjs`,peers:[`express`],description:`Unified framework: DI, decorators, routing, middleware`,core:!0},vite:{pkg:`@forinda/kickjs-vite`,peers:[`vite`],description:`Vite plugin: dev server, HMR, module discovery`,dev:!0,core:!0},cli:{pkg:`@forinda/kickjs-cli`,peers:[],description:`CLI tool and code generators`,dev:!0,core:!0},swagger:{pkg:`@forinda/kickjs-swagger`,peers:[],description:`OpenAPI spec + Swagger UI + ReDoc`},db:{pkg:`@forinda/kickjs-db`,peers:[],description:`kick/db core — schema DSL, migrations, KickDbClient, customType`},"db-pg":{pkg:`@forinda/kickjs-db-pg`,peers:[`pg`],description:`kick/db PostgreSQL dialect + adapter (pgDialect, pgAdapter)`},drizzle:{pkg:`@forinda/kickjs-drizzle`,peers:[`drizzle-orm`],description:`Drizzle ORM adapter + query builder`},prisma:{pkg:`@forinda/kickjs-prisma`,peers:[`@prisma/client`],description:`Prisma adapter + query builder`},ws:{pkg:`@forinda/kickjs-ws`,peers:[`socket.io`],description:`WebSocket with @WsController decorators`},devtools:{pkg:`@forinda/kickjs-devtools`,peers:[],description:`Development dashboard — routes, DI, metrics, health`,dev:!0},queue:{pkg:`@forinda/kickjs-queue`,peers:[],description:`Queue adapter (BullMQ/RabbitMQ/Kafka)`},"queue:bullmq":{pkg:`@forinda/kickjs-queue`,peers:[`bullmq`,`ioredis`],description:`Queue with BullMQ + Redis`},"queue:rabbitmq":{pkg:`@forinda/kickjs-queue`,peers:[`amqplib`],description:`Queue with RabbitMQ`},"queue:kafka":{pkg:`@forinda/kickjs-queue`,peers:[`kafkajs`],description:`Queue with Kafka`},"queue:redis-pubsub":{pkg:`@forinda/kickjs-queue`,peers:[`ioredis`],description:`Lightweight pub/sub via Redis (no persistence)`},mcp:{pkg:`@forinda/kickjs-mcp`,peers:[`@modelcontextprotocol/sdk`],description:`Model Context Protocol server — expose @Controller endpoints as AI tools`},testing:{pkg:`@forinda/kickjs-testing`,peers:[],description:`Test utilities and TestModule builder`,dev:!0}};function R(e,t=process.cwd()){let n=t;for(;;){if(M(j(n,e)))return n;let t=O(n);if(t===n)return null;n=t}}function et(){return R(`pnpm-lock.yaml`)?`pnpm`:R(`yarn.lock`)?`yarn`:R(`bun.lockb`)||R(`bun.lock`)?`bun`:R(`package-lock.json`)?`npm`:null}function tt(){let e=process.cwd();for(;e;){let t=j(e,`package.json`);if(M(t))try{let e=JSON.parse(P(t,`utf-8`)).packageManager;if(typeof e==`string`){let t=e.split(`@`)[0];if(fe.includes(t))return t}}catch{}let n=O(e);if(n===e)return null;e=n}return null}async function nt(e){if(e&&fe.includes(e))return{pm:e,source:`flag`};let t=await w(process.cwd());if(t?.packageManager&&fe.includes(t.packageManager))return{pm:t.packageManager,source:`config`};let n=tt();if(n)return{pm:n,source:`package.json`};let r=et();return r?{pm:r,source:`lockfile`}:{pm:`npm`,source:`default`}}async function rt(e){let{pm:t}=await nt(e);return t}function it(e=!1){let t=Object.entries($e),n=Math.max(...t.map(([e])=>e.length)),r=t.filter(([,e])=>e.core),i=t.filter(([,e])=>!e.core),a=([e,t])=>{let r=e.padEnd(n+2),i=t.peers.length?` (+ ${t.peers.join(`, `)})`:``;return` ${r} ${t.description}${i}`};console.log(`
|
|
12
12
|
Core packages (always installed by \`kick new\`):
|
|
13
13
|
`);for(let e of r)console.log(a(e));if(e){console.log(`
|
|
14
14
|
Optional packages (add as needed):
|
|
15
15
|
`);for(let e of i)console.log(a(e))}else console.log(`\n Plus ${i.length} optional packages (auth, swagger, db, queue, …).`),console.log(" Run `kick add --list --all` for the full catalog.");console.log(`
|
|
16
16
|
Usage: kick add auth drizzle swagger`),console.log(` kick add queue:bullmq`),console.log()}function at(e){e.command(`list`).alias(`ls`).description(`List KickJS packages (core only; pair with --all for the full catalog)`).option(`--all`,`Include the full optional catalog`).action(e=>{it(!!e.all)})}function ot(e){e.command(`add [packages...]`).description(`Add KickJS packages with their required dependencies`).option(`--pm <manager>`,`Package manager override`).option(`-D, --dev`,`Install as dev dependency`).option(`--list`,`List packages (core only by default; pair with --all)`).option(`--all`,`When listing, include the full optional catalog`).action(async(e,t)=>{if(t.list||e.length===0){it(!!t.all);return}let{pm:n,source:r}=await nt(t.pm);console.log(`\n Using ${n} (resolved from ${r})`);let i=t.dev,a=new Set,o=new Set,s=[];for(let t of e){let e=$e[t];if(!e){s.push(t);continue}let n=i||e.dev?o:a;n.add(e.pkg);for(let t of e.peers)n.add(t)}if(!(s.length>0&&(console.log(`\n Unknown packages: ${s.join(`, `)}`),console.log(` Run "kick add --list" to see available packages.
|
|
17
17
|
`),a.size===0&&o.size===0))){if(a.size>0){let e=Array.from(a),t=`${n} add ${e.join(` `)}`;console.log(`\n Installing ${e.length} dependency(ies):`);for(let t of e)console.log(` + ${t}`);console.log();try{Fe(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(o.size>0){let e=Array.from(o),t=`${n} add -D ${e.join(` `)}`;console.log(`\n Installing ${e.length} dev dependency(ies):`);for(let t of e)console.log(` + ${t} (dev)`);console.log();try{Fe(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}console.log(` Done!
|
|
18
|
-
`)}})}const st=[{value:`swagger`,label:`Swagger`,hint:`OpenAPI docs`},{value:`ws`,label:`WebSocket`,hint:`rooms, heartbeat`},{value:`queue`,label:`Queue`,hint:`BullMQ/RabbitMQ/Kafka`},{value:`devtools`,label:`DevTools`,hint:`debug dashboard`}];function ct(e){e.command(`new [name]`).alias(`init`).description(`Create a new KickJS project (use "." for current directory)`).option(`-d, --directory <dir>`,`Target directory (defaults to project name)`).option(`--pm <manager>`,`Package manager: pnpm | npm | yarn | bun`).option(`--git`,`Initialize git repository`).option(`--no-git`,`Skip git initialization`).option(`--install`,`Install dependencies after scaffolding`).option(`--no-install`,`Skip dependency installation`).option(`-f, --force`,`Remove existing files without prompting`).option(`-t, --template <type>`,`Project template: rest | ddd | cqrs | minimal`).option(`-r, --repo <type>`,`Default repository: prisma | drizzle | inmemory | custom`).option(`--packages <packages>`,`Comma-separated packages to include (e.g. auth,swagger,ws,queue)`).option(`-y, --yes`,`Pick safe defaults for every prompt (template=minimal, repo=inmemory, no extras, git+install on)`).option(`--non-interactive`,`alias for --yes`).action(async(e,t)=>{n(`KickJS — Create a new project`);let o=!!(t.yes||t.nonInteractive);e||=o?`my-api`:await c({message:`Project name`,placeholder:`my-api`,defaultValue:`my-api`});let l;if(e===`.`?(l=j(`.`),e=Se(l)):l=j(t.directory||e),M(l)){let n=Ee(l);if(n.length>0){if(t.force)s.warn(`Clearing existing files in ${l}`);else if(o){s.warn(`Directory "${e}" is not empty. Pass --force to clear it.`),r(`Aborted.`);return}else{s.warn(`Directory "${e}" is not empty:`);let t=n.slice(0,5);for(let e of t)s.message(` - ${e}`);if(n.length>5&&s.message(` ... and ${n.length-5} more`),!await u({message:a.red(`Remove all existing files and proceed?`),initialValue:!1})){r(`Aborted.`);return}}for(let e of n)De(j(l,e),{recursive:!0,force:!0})}}let f=t.template;f||=o?`minimal`:await i({message:`Project template`,options:[{value:`rest`,label:`REST API`,hint:`Express + Swagger`},{value:`ddd`,label:`DDD`,hint:`Domain-Driven Design modules`},{value:`cqrs`,label:`CQRS`,hint:`Commands, Queries, Events + WS/Queue`},{value:`minimal`,label:`Minimal`,hint:`bare Express`}]});let p=t.pm;p||=o?await rt(void 0):await i({message:`Package manager`,options:[{value:`pnpm`,label:`pnpm`},{value:`npm`,label:`npm`},{value:`yarn`,label:`yarn`},{value:`bun`,label:`bun`}]});let m=t.repo;m||(o?m=`inmemory`:(m=await i({message:`Default repository/ORM`,options:[{value:`prisma`,label:`Prisma`},{value:`drizzle`,label:`Drizzle`},{value:`inmemory`,label:`In-Memory`},{value:`custom`,label:`Custom`,hint:`specify later`}]}),m===`custom`&&(m=await c({message:`Custom repository name`,defaultValue:`custom`}))));let h;if(t.packages!==void 0){let e=t.packages.trim().toLowerCase();
|
|
18
|
+
`)}})}const st=[{value:`swagger`,label:`Swagger`,hint:`OpenAPI docs`},{value:`ws`,label:`WebSocket`,hint:`rooms, heartbeat`},{value:`queue`,label:`Queue`,hint:`BullMQ/RabbitMQ/Kafka`},{value:`devtools`,label:`DevTools`,hint:`debug dashboard`}];function ct(e){e.command(`new [name]`).alias(`init`).description(`Create a new KickJS project (use "." for current directory)`).option(`-d, --directory <dir>`,`Target directory (defaults to project name)`).option(`--pm <manager>`,`Package manager: pnpm | npm | yarn | bun`).option(`--git`,`Initialize git repository`).option(`--no-git`,`Skip git initialization`).option(`--install`,`Install dependencies after scaffolding`).option(`--no-install`,`Skip dependency installation`).option(`-f, --force`,`Remove existing files without prompting`).option(`-t, --template <type>`,`Project template: rest | ddd | cqrs | minimal`).option(`-r, --repo <type>`,`Default repository: prisma | drizzle | inmemory | custom`).option(`-s, --schema <lib>`,`Schema library for env / DTOs: zod | valibot | yup (default: zod)`).option(`--packages <packages>`,`Comma-separated packages to include (e.g. auth,swagger,ws,queue)`).option(`-y, --yes`,`Pick safe defaults for every prompt (template=minimal, repo=inmemory, no extras, git+install on)`).option(`--non-interactive`,`alias for --yes`).action(async(e,t)=>{n(`KickJS — Create a new project`);let o=!!(t.yes||t.nonInteractive);e||=o?`my-api`:await c({message:`Project name`,placeholder:`my-api`,defaultValue:`my-api`});let l;if(e===`.`?(l=j(`.`),e=Se(l)):l=j(t.directory||e),M(l)){let n=Ee(l);if(n.length>0){if(t.force)s.warn(`Clearing existing files in ${l}`);else if(o){s.warn(`Directory "${e}" is not empty. Pass --force to clear it.`),r(`Aborted.`);return}else{s.warn(`Directory "${e}" is not empty:`);let t=n.slice(0,5);for(let e of t)s.message(` - ${e}`);if(n.length>5&&s.message(` ... and ${n.length-5} more`),!await u({message:a.red(`Remove all existing files and proceed?`),initialValue:!1})){r(`Aborted.`);return}}for(let e of n)De(j(l,e),{recursive:!0,force:!0})}}let f=t.template;f||=o?`minimal`:await i({message:`Project template`,options:[{value:`rest`,label:`REST API`,hint:`Express + Swagger`},{value:`ddd`,label:`DDD`,hint:`Domain-Driven Design modules`},{value:`cqrs`,label:`CQRS`,hint:`Commands, Queries, Events + WS/Queue`},{value:`minimal`,label:`Minimal`,hint:`bare Express`}]});let p=t.pm;p||=o?await rt(void 0):await i({message:`Package manager`,options:[{value:`pnpm`,label:`pnpm`},{value:`npm`,label:`npm`},{value:`yarn`,label:`yarn`},{value:`bun`,label:`bun`}]});let m=t.repo;m||(o?m=`inmemory`:(m=await i({message:`Default repository/ORM`,options:[{value:`prisma`,label:`Prisma`},{value:`drizzle`,label:`Drizzle`},{value:`inmemory`,label:`In-Memory`},{value:`custom`,label:`Custom`,hint:`specify later`}]}),m===`custom`&&(m=await c({message:`Custom repository name`,defaultValue:`custom`}))));let h=t.schema;h||=o?`zod`:await i({message:`Schema library (env + DTO validation)`,options:[{value:`zod`,label:`Zod`,hint:`default — broad ecosystem`},{value:`valibot`,label:`Valibot`,hint:`smaller bundle`},{value:`yup`,label:`Yup`,hint:`classic API`}]}),[`zod`,`valibot`,`yup`].includes(h)||(s.warn(`Unknown --schema "${h}", falling back to zod.`),h=`zod`);let g;if(t.packages!==void 0){let e=t.packages.trim().toLowerCase();g=e===``||e===`none`||e===`false`?[]:t.packages.split(`,`).map(e=>e.trim()).filter(Boolean)}else g=o?[]:await d({message:`Select packages to include`,options:[...st],required:!1});let _;_=t.git===void 0?o?!0:await u({message:`Initialize git repository?`,initialValue:!0}):t.git;let v;v=t.install===void 0?o?!0:await u({message:`Install dependencies?`,initialValue:!0}):t.install,await y({name:e,directory:l,packageManager:p,initGit:_,installDeps:v,template:f,defaultRepo:m,packages:g,schemaLib:h}),r(`Done! Next steps: ${a.cyan(`cd ${e} && ${p} dev`)}`)})}async function lt(e){let{name:n,outDir:r}=e,i=m(n),a=x(n),o=[],s=k(r,`${i}.plugin.ts`);return await t(s,`import {
|
|
19
19
|
definePlugin,
|
|
20
20
|
type AppAdapter,
|
|
21
21
|
type AppModuleEntry,
|
|
@@ -850,7 +850,7 @@ server.on('exit', () => {
|
|
|
850
850
|
Cancelled.
|
|
851
851
|
`);return}await Ne(l,{recursive:!0,force:!0}),console.log(` Deleted: ${l}`);let d=k(n,`index.ts`);if(await f(d)){let e=await F(d,`utf-8`),t=e,n=RegExp(`^import\\s*\\{\\s*${S(s)}Module\\s*\\}\\s*from\\s*['"][^'"]*${S(c)}(?:/[^'"]*)?['"].*\\n?`,`gm`);e=e.replace(n,``),e=Bn(e,s),e=e.replace(/\n{3,}/g,`
|
|
852
852
|
|
|
853
|
-
`),e!==t&&(await I(d,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${d}`))}console.log(`\n Module '${c}' removed.\n`)}function Hn(e){e.command(`remove`).alias(`rm`).description(`Remove generated code`).command(`module <names...>`).description(`Remove one or more modules (e.g. kick rm module user task)`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular module name`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=C(await w(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Vn({name:n,modulesDir:j(r),force:t.force,pluralize:i})})}function Un(e){if(e!==void 0){if(e===`false`||e===`off`||e===`none`)return!1;if(e===`zod`)return`zod`;console.warn(` kick typegen: unknown --schema-validator '${e}' (
|
|
853
|
+
`),e!==t&&(await I(d,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${d}`))}console.log(`\n Module '${c}' removed.\n`)}function Hn(e){e.command(`remove`).alias(`rm`).description(`Remove generated code`).command(`module <names...>`).description(`Remove one or more modules (e.g. kick rm module user task)`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular module name`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=C(await w(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Vn({name:n,modulesDir:j(r),force:t.force,pluralize:i})})}function Un(e){if(e!==void 0){if(e===`false`||e===`off`||e===`none`)return!1;if(e===`zod`)return`zod`;if(e===`kickjs-schema`||e===`schema`)return`kickjs-schema`;console.warn(` kick typegen: unknown --schema-validator '${e}' (supported: 'zod', 'kickjs-schema', 'false'). Falling back to project config.`)}}function Wn(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function Gn(e){e.command(`typegen`).description(`Generate type-safe DI registry and module types into .kickjs/types/`).option(`-w, --watch`,`Watch source files and regenerate on change`).option(`-s, --src <dir>`,`Source directory to scan`,`src`).option(`-o, --out <dir>`,`Output directory`,`.kickjs/types`).option(`--silent`,`Suppress output`).option(`--allow-duplicates`,`Auto-namespace duplicate class names instead of failing (use with caution)`).option(`--schema-validator <name>`,`Schema validator for body/query/params typing (currently 'zod' or 'false')`).option(`--env-file <path>`,`Path to env schema file for KickEnv typing (default 'src/env.ts'; pass 'false' to disable)`).option(`--check`,`CI gate: fail on plugin-typegen drift instead of writing`).option(`--list`,"List every registered typegen plugin id (use to populate `typegen.disable`)").action(async e=>{let t=pe(process.cwd()),n=await w(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-CVLGiqTz.mjs`).then(e=>e.t),{builtinCliPlugins:t}=await import(`./builtins-DQYGadNr.mjs`),r=e([...t,...n?.plugins??[]],n?.commands??[]),i=new Set(n?.typegen?.disable??[]);if(r.typegens.length===0){console.log(` No typegen plugins registered.`);return}let a=Math.max(...r.typegens.map(e=>e.id.length));console.log(`
|
|
854
854
|
Registered typegen plugins:
|
|
855
855
|
`);for(let e of r.typegens){let t=i.has(e.id)?` (disabled)`:``;console.log(` ${e.id.padEnd(a+2)}inputs: ${e.inputs.join(`, `)||`(none)`}${t}`)}console.log();return}let r=Un(e.schemaValidator)??n?.typegen?.schemaValidator??`zod`,i=Wn(e.envFile)??n?.typegen?.envFile,a={cwd:t,srcDir:e.src??n?.typegen?.srcDir,outDir:e.out??n?.typegen?.outDir,silent:e.silent,allowDuplicates:e.allowDuplicates,schemaValidator:r,envFile:i,assetMap:n?.assetMap,runPlugins:!1};try{if(e.watch){let t=await ve(a);e.silent||console.log(` kick typegen: watching for changes (Ctrl-C to exit)`);let n=()=>{t(),process.exit(0)};process.on(`SIGINT`,n),process.on(`SIGTERM`,n),await new Promise(()=>{})}else{let{result:r}=await E(a),i=await W({cwd:t,config:n??null,silent:e.silent,check:e.check});e.check&&i.some(e=>e.status===`written`)&&process.exit(1),e.check||await ye(j(t,e.out??n?.typegen?.outDir??`.kickjs/types`),r.written,i,e.silent??!1)}}catch(e){e instanceof xe?console.error(`
|
|
856
856
|
`+e.message+`
|
|
@@ -878,7 +878,7 @@ declare global {
|
|
|
878
878
|
}
|
|
879
879
|
|
|
880
880
|
export {}
|
|
881
|
-
`;let r=new Map;for(let t of e){let e=r.get(t.controller)??[];e.push(t),r.set(t.controller,e)}let i=new Map,a=(e,r)=>{let a=vr(e,r,t,n,i);return a
|
|
881
|
+
`;let r=new Map;for(let t of e){let e=r.get(t.controller)??[];e.push(t),r.set(t.controller,e)}let i=new Map,a=(e,r)=>{let a=vr(e,r,t,n,i);return a?n===`kickjs-schema`?`import('@forinda/kickjs-schema').InferSchemaOutput<typeof ${a}>`:`import('zod').infer<typeof ${a}>`:null},o=[];for(let[e,t]of r){let n=[` interface ${e} {`];for(let e of t){let t=e.pathParams.length>0?`{ ${e.pathParams.map(e=>`${e}: string`).join(`; `)} }`:`{}`,r=a(e.bodySchema,e.filePath),i=a(e.querySchema,e.filePath),o=a(e.paramsSchema,e.filePath)??t,s=r??`unknown`,c=i??gr(e),l=_r(e);n.push(` /**`,` * ${e.httpMethod} ${e.path}`,...l.map(e=>` * ${e}`),` */`,` ${e.method}: {`,` params: ${o}`,` body: ${s}`,` query: ${c}`,` response: unknown`,` }`)}n.push(` }`),o.push(n.join(`
|
|
882
882
|
`))}return`${mr}${yr(i)}
|
|
883
883
|
declare global {
|
|
884
884
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
@@ -889,21 +889,23 @@ ${o.join(`
|
|
|
889
889
|
}
|
|
890
890
|
|
|
891
891
|
export {}
|
|
892
|
-
`}function gr(e){if(e.queryFilterable===null)return`unknown`;let t=e.querySortable??[];return`{ filter?: string | string[]; sort?: ${t.length>0?t.flatMap(e=>[`'${e}'`,`'-${e}'`]).join(` | `):`string`}; q?: string; page?: string; limit?: string }`}function _r(e){let t=[];return e.queryFilterable&&e.queryFilterable.length>0&&t.push(`Filterable: ${e.queryFilterable.join(`, `)}`),e.querySortable&&e.querySortable.length>0&&t.push(`Sortable: ${e.querySortable.join(`, `)}`),e.querySearchable&&e.querySearchable.length>0&&t.push(`Searchable: ${e.querySearchable.join(`, `)}`),t}function vr(e,t,n,r,i){if(!e||r
|
|
892
|
+
`}function gr(e){if(e.queryFilterable===null)return`unknown`;let t=e.querySortable??[];return`{ filter?: string | string[]; sort?: ${t.length>0?t.flatMap(e=>[`'${e}'`,`'-${e}'`]).join(` | `):`string`}; q?: string; page?: string; limit?: string }`}function _r(e){let t=[];return e.queryFilterable&&e.queryFilterable.length>0&&t.push(`Filterable: ${e.queryFilterable.join(`, `)}`),e.querySortable&&e.querySortable.length>0&&t.push(`Sortable: ${e.querySortable.join(`, `)}`),e.querySearchable&&e.querySearchable.length>0&&t.push(`Searchable: ${e.querySearchable.join(`, `)}`),t}function vr(e,t,n,r,i){if(!e||r===!1||e.source===null)return null;let a=br(e.source,t,n);if(a===`unknown`)return null;let o=`${a}::${e.identifier}`,s=i.get(o)?.specifier;return s?s=i.get(o).specifier:(s=`_S${i.size}`,i.set(o,{identifier:e.identifier,specifier:s})),s}function yr(e){if(e.size===0)return``;let t=[];for(let[n,r]of e){let[e]=n.split(`::`);t.push(`import type { ${r.identifier} as ${r.specifier} } from '${e}'`)}return t.join(`
|
|
893
893
|
`)+`
|
|
894
|
-
`}function br(e,t,n){if(e===null)return`unknown`;let r=O(n);if(e===``){let e=A(r,t).split(we).join(`/`);return e=e.replace(/\.(ts|tsx|mts|cts)$/i,``),e.startsWith(`.`)||(e=`./`+e),e}if(!e.startsWith(`.`)&&!e.startsWith(`/`))return e;let i=A(r,j(O(t),e)).split(we).join(`/`);return i=i.replace(/\.(ts|tsx|mts|cts)$/i,``),i.startsWith(`.`)||(i=`./`+i),i}const xr=()=>({id:`kick/routes`,outExtension:`.ts`,inputs:[`src/**/*.controller.ts`,`src/**/*.module.ts`],async generate(e){let t=await e.getScanResult({root:Sr(e),cwd:e.cwd,envFile:Cr(e)}),n=e.config?.typegen?.schemaValidator??`zod`,r=D.resolve(e.cwd,`.kickjs/types/kick__routes.ts`);return hr(t.routes,r,n)}});function Sr(e){return D.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function Cr(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}function wr(e,t){if(!e)return null;let
|
|
894
|
+
`}function br(e,t,n){if(e===null)return`unknown`;let r=O(n);if(e===``){let e=A(r,t).split(we).join(`/`);return e=e.replace(/\.(ts|tsx|mts|cts)$/i,``),e.startsWith(`.`)||(e=`./`+e),e}if(!e.startsWith(`.`)&&!e.startsWith(`/`))return e;let i=A(r,j(O(t),e)).split(we).join(`/`);return i=i.replace(/\.(ts|tsx|mts|cts)$/i,``),i.startsWith(`.`)||(i=`./`+i),i}const xr=()=>({id:`kick/routes`,outExtension:`.ts`,inputs:[`src/**/*.controller.ts`,`src/**/*.module.ts`],async generate(e){let t=await e.getScanResult({root:Sr(e),cwd:e.cwd,envFile:Cr(e)}),n=e.config?.typegen?.schemaValidator??`zod`,r=D.resolve(e.cwd,`.kickjs/types/kick__routes.ts`);return hr(t.routes,r,n)}});function Sr(e){return D.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function Cr(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}function wr(e,t,n=`zod`){if(!e)return null;let r=A(O(t),e.filePath).split(we).join(`/`);return r=r.replace(/\.(ts|tsx|mts|cts)$/i,``),r.startsWith(`.`)||(r=`./`+r),`/* eslint-disable */
|
|
895
895
|
// AUTO-GENERATED by \`kick typegen\`. DO NOT EDIT.
|
|
896
896
|
// Re-run with \`kick typegen\` or rely on \`kick dev\` to refresh.
|
|
897
897
|
|
|
898
898
|
// Importing the schema as a type lets us infer its shape without
|
|
899
899
|
// pulling in any runtime code. \`Awaited<>\` strips an accidental
|
|
900
900
|
// Promise wrap on dynamic-imported defaults.
|
|
901
|
-
import type _envSchema from '${
|
|
901
|
+
import type _envSchema from '${r}'
|
|
902
902
|
|
|
903
|
-
|
|
903
|
+
${n===`kickjs-schema`?`type _Raw = import('@forinda/kickjs-schema').InferSchemaOutput<typeof _envSchema>
|
|
904
|
+
type _Resolved = { [K in keyof _Raw]: _Raw[K] }
|
|
905
|
+
`:``}// Local type alias — interfaces can only \`extend\` an identifier,
|
|
904
906
|
// not an inline import expression, so we resolve the schema's
|
|
905
907
|
// inferred shape into a named type first.
|
|
906
|
-
type _KickEnvShape = import('zod').infer<typeof _envSchema
|
|
908
|
+
type _KickEnvShape = ${n===`kickjs-schema`?`_Resolved`:`import('zod').infer<typeof _envSchema>`}
|
|
907
909
|
|
|
908
910
|
declare global {
|
|
909
911
|
/**
|
|
@@ -927,5 +929,5 @@ declare global {
|
|
|
927
929
|
}
|
|
928
930
|
|
|
929
931
|
export {}
|
|
930
|
-
`}const Tr=()=>({id:`kick/env`,outExtension:`.ts`,inputs:[`src/env.ts`,`src/**/env.ts`,`src/**/*.env.ts`],async generate(e){let t=Dr(e);if(t===!1)return null;let n=await e.getScanResult({root:Er(e),cwd:e.cwd,envFile:t});if(!n.env)return null;let r=D.resolve(e.cwd,`.kickjs/types/kick__env.ts`);return wr(n.env,r)}});function Er(e){return D.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function Dr(e){return e.config?.typegen?.envFile}const Or=[T({name:`kick/init`,register:ct}),T({name:`kick/generate`,register:Wt}),T({name:`kick/run`,register:rn}),T({name:`kick/info`,register:an}),T({name:`kick/inspect`,register:pn}),T({name:`kick/add`,register:ot}),T({name:`kick/list`,register:at}),T({name:`kick/explain`,register:Cn}),T({name:`kick/mcp`,register:Mn}),T({name:`kick/tinker`,register:In}),T({name:`kick/remove`,register:Hn}),T({name:`kick/typegen`,register:Gn}),T({name:`kick/check`,register:rr}),T({name:`kick/doctor`,register:se}),T({name:`kick/db`,register:or,typegens:[ur()]}),T({name:`kick/codemod`,register:cr}),T({name:`kick/assets`,typegens:[pr()]}),T({name:`kick/routes`,typegens:[xr()]}),T({name:`kick/env`,typegens:[Tr()]})];export{Yt as applyDisableFilter,W as runAllPluginTypegens,Or as t};
|
|
931
|
-
//# sourceMappingURL=run-plugins-
|
|
932
|
+
`}const Tr=()=>({id:`kick/env`,outExtension:`.ts`,inputs:[`src/env.ts`,`src/**/env.ts`,`src/**/*.env.ts`],async generate(e){let t=Dr(e);if(t===!1)return null;let n=await e.getScanResult({root:Er(e),cwd:e.cwd,envFile:t});if(!n.env)return null;let r=e.config?.typegen?.schemaValidator??`zod`,i=D.resolve(e.cwd,`.kickjs/types/kick__env.ts`);return wr(n.env,i,r)}});function Er(e){return D.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function Dr(e){return e.config?.typegen?.envFile}const Or=[T({name:`kick/init`,register:ct}),T({name:`kick/generate`,register:Wt}),T({name:`kick/run`,register:rn}),T({name:`kick/info`,register:an}),T({name:`kick/inspect`,register:pn}),T({name:`kick/add`,register:ot}),T({name:`kick/list`,register:at}),T({name:`kick/explain`,register:Cn}),T({name:`kick/mcp`,register:Mn}),T({name:`kick/tinker`,register:In}),T({name:`kick/remove`,register:Hn}),T({name:`kick/typegen`,register:Gn}),T({name:`kick/check`,register:rr}),T({name:`kick/doctor`,register:se}),T({name:`kick/db`,register:or,typegens:[ur()]}),T({name:`kick/codemod`,register:cr}),T({name:`kick/assets`,typegens:[pr()]}),T({name:`kick/routes`,typegens:[xr()]}),T({name:`kick/env`,typegens:[Tr()]})];export{Yt as applyDisableFilter,W as runAllPluginTypegens,Or as t};
|
|
933
|
+
//# sourceMappingURL=run-plugins-gGJZ3-LN.mjs.map
|