@forinda/kickjs-cli 6.0.0 → 6.0.1
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-Dmku65k2.mjs → agent-docs-hbOXsAAh.mjs} +3 -3
- package/dist/{agent-docs-Dmku65k2.mjs.map → agent-docs-hbOXsAAh.mjs.map} +1 -1
- package/dist/{builtins-G49e_Qsj.mjs → builtins-Dyk9a-mv.mjs} +2 -2
- package/dist/cli.mjs +1 -1
- package/dist/{config-DdtRfl33.mjs → config-DSpcRefL.mjs} +3 -3
- package/dist/{config-DdtRfl33.mjs.map → config-DSpcRefL.mjs.map} +1 -1
- package/dist/{doctor-SUUDEI1J.mjs → doctor-559QZlHi.mjs} +5 -5
- package/dist/{doctor-SUUDEI1J.mjs.map → doctor-559QZlHi.mjs.map} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-Dg0Lk2Lp.mjs → plugin-DK01q7wy.mjs} +3 -3
- package/dist/{plugin-Dg0Lk2Lp.mjs.map → plugin-DK01q7wy.mjs.map} +1 -1
- package/dist/{project-docs-C-dA6-TO.mjs → project-docs-CrfNQIZA.mjs} +2 -2
- package/dist/{project-docs-C-dA6-TO.mjs.map → project-docs-CrfNQIZA.mjs.map} +1 -1
- package/dist/{project-root-so4F5DRN.mjs → project-root-BdTe6EpE.mjs} +3 -3
- package/dist/{project-root-so4F5DRN.mjs.map → project-root-BdTe6EpE.mjs.map} +1 -1
- package/dist/{rolldown-runtime-DrKbExWn.mjs → rolldown-runtime-CoN4EDcd.mjs} +1 -1
- package/dist/{run-plugins-B2_AT35s.mjs → run-plugins-BAYoDnFI.mjs} +4 -4
- package/dist/{run-plugins-B2_AT35s.mjs.map → run-plugins-BAYoDnFI.mjs.map} +1 -1
- package/dist/{typegen-5MX2F5iL.mjs → typegen-CwtvFZ0t.mjs} +5 -5
- package/dist/{typegen-5MX2F5iL.mjs.map → typegen-CwtvFZ0t.mjs.map} +1 -1
- package/dist/{types-C5PH0h7Z.mjs → types-BKKzf_bU.mjs} +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-root-
|
|
1
|
+
{"version":3,"file":"project-root-BdTe6EpE.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 v6.0.
|
|
2
|
+
* @forinda/kickjs-cli v6.0.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
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-CrfNQIZA.mjs";import{A as m,C as h,D as g,E as _,M as v,O as y,S as b,T as x,_ as S,a as C,b as ee,c as te,d as ne,f as re,g as ie,h as ae,i as oe,j as w,k as se,l as ce,m as le,p as ue,r as de,u as fe,v as pe,w as me,x as he,y as ge}from"./doctor-559QZlHi.mjs";import{a as T,i as E,o as _e,s as ve,t as ye}from"./config-DSpcRefL.mjs";import{t as be}from"./project-root-BdTe6EpE.mjs";import{n as D}from"./types-BKKzf_bU.mjs";import{n as xe}from"./agent-docs-hbOXsAAh.mjs";import{n as Se}from"./plugin-DK01q7wy.mjs";import{a as Ce,c as we,d as Te,f as Ee,g as De,h as Oe,i as ke,l as Ae,m as je,o as Me,p as Ne,r as Pe,s as Fe,t as O,u as Ie}from"./typegen-CwtvFZ0t.mjs";import k,{basename as Le,dirname as A,isAbsolute as Re,join as j,relative as M,resolve as N,sep as ze}from"node:path";import{cpSync as Be,existsSync as P,mkdirSync as Ve,readFileSync as F,readdirSync as He,rmSync as Ue,statSync as We,writeFileSync as Ge}from"node:fs";import{copyFile as Ke,mkdir as qe,readFile as I,readdir as Je,rm as Ye,stat as Xe,writeFile as L}from"node:fs/promises";import{execSync as Ze,fork as Qe,spawn as $e,spawnSync as et}from"node:child_process";import{pathToFileURL as R}from"node:url";import{glob as tt}from"glob";import{groupAssetKeys as nt}from"@forinda/kickjs";import{arch as rt,platform as it,release as at}from"node:os";const ot={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},zod:{pkg:`zod`,peers:[],description:`Zod schema validation (env, DTOs, OpenAPI) — wrap with fromZod()`},valibot:{pkg:`valibot`,peers:[],description:`Valibot schema validation — wrap with fromValibot()`},yup:{pkg:`yup`,peers:[],description:`Yup schema validation — wrap with fromYup()`},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`},pg:{pkg:`@forinda/kickjs-db`,peers:[`pg`],description:`kick/db + PostgreSQL driver (use @forinda/kickjs-db/pg)`},sqlite:{pkg:`@forinda/kickjs-db`,peers:[`better-sqlite3`],description:`kick/db + SQLite driver (use @forinda/kickjs-db/sqlite)`},mysql:{pkg:`@forinda/kickjs-db`,peers:[`mysql2`],description:`kick/db + MySQL driver (use @forinda/kickjs-db/mysql)`},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 z(e,t=process.cwd()){let n=t;for(;;){if(P(N(n,e)))return n;let t=A(n);if(t===n)return null;n=t}}function st(){return z(`pnpm-lock.yaml`)?`pnpm`:z(`yarn.lock`)?`yarn`:z(`bun.lockb`)||z(`bun.lock`)?`bun`:z(`package-lock.json`)?`npm`:null}function ct(){let e=process.cwd();for(;e;){let t=N(e,`package.json`);if(P(t))try{let e=JSON.parse(F(t,`utf-8`)).packageManager;if(typeof e==`string`){let t=e.split(`@`)[0];if(ye.includes(t))return t}}catch{}let n=A(e);if(n===e)return null;e=n}return null}async function lt(e){if(e&&ye.includes(e))return{pm:e,source:`flag`};let t=await E(process.cwd());if(t?.packageManager&&ye.includes(t.packageManager))return{pm:t.packageManager,source:`config`};let n=ct();if(n)return{pm:n,source:`package.json`};let r=st();return r?{pm:r,source:`lockfile`}:{pm:`npm`,source:`default`}}async function ut(e){let{pm:t}=await lt(e);return t}function dt(e=!1){let t=Object.entries(ot),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):
|
|
@@ -554,7 +554,7 @@ server.on('exit', () => {
|
|
|
554
554
|
Cancelled.
|
|
555
555
|
`);return}await Ye(l,{recursive:!0,force:!0}),console.log(` Deleted: ${l}`);let d=j(n,`index.ts`);if(await f(d)){let e=await I(d,`utf-8`),t=e,n=RegExp(`^import\\s*\\{\\s*${g(s)}Module\\s*\\}\\s*from\\s*['"][^'"]*${g(c)}(?:/[^'"]*)?['"].*\\n?`,`gm`);e=e.replace(n,``),e=Wn(e,s),e=e.replace(/\n{3,}/g,`
|
|
556
556
|
|
|
557
|
-
`),e!==t&&(await L(d,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${d}`))}console.log(`\n Module '${c}' removed.\n`)}function Kn(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=T(await E(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Gn({name:n,modulesDir:N(r),force:t.force,pluralize:i})})}function qn(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 Jn(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function Yn(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=be(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-
|
|
557
|
+
`),e!==t&&(await L(d,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${d}`))}console.log(`\n Module '${c}' removed.\n`)}function Kn(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=T(await E(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Gn({name:n,modulesDir:N(r),force:t.force,pluralize:i})})}function qn(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 Jn(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function Yn(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=be(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-DK01q7wy.mjs`).then(e=>e.t),{builtinCliPlugins:t}=await import(`./builtins-Dyk9a-mv.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(`
|
|
558
558
|
Registered typegen plugins:
|
|
559
559
|
`);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=qn(e.schemaValidator)??n?.typegen?.schemaValidator??`zod`,i=Jn(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 Pe(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{await O(a);let r=await G({cwd:t,config:n??null,silent:e.silent,check:e.check});e.check&&r.some(e=>e.status===`written`)&&process.exit(1),e.check||await ke(N(t,e.out??n?.typegen?.outDir??`.kickjs/types`),r,e.silent??!1)}}catch(e){e instanceof Fe?console.error(`
|
|
560
560
|
`+e.message+`
|
|
@@ -633,4 +633,4 @@ declare global {
|
|
|
633
633
|
|
|
634
634
|
export {}
|
|
635
635
|
`}const Sr=()=>({id:`kick/env`,outExtension:`.ts`,inputs:[`src/env.ts`,`src/**/env.ts`,`src/**/*.env.ts`],async generate(e){let t=wr(e);if(t===!1)return null;let n=await e.getScanResult({root:Cr(e),cwd:e.cwd,envFile:t});if(!n.env)return null;let r=e.config?.typegen?.schemaValidator??`zod`,i=k.resolve(e.cwd,`.kickjs/types/kick__env.ts`);return xr(n.env,i,r)}});function Cr(e){return k.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function wr(e){return e.config?.typegen?.envFile}function Tr(e){return k.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function Er(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}function $(e){return{root:Tr(e),cwd:e.cwd,envFile:Er(e)}}const Dr=[D({name:`kick/init`,register:ht}),D({name:`kick/generate`,register:Kt}),D({name:`kick/run`,register:cn}),D({name:`kick/info`,register:ln}),D({name:`kick/inspect`,register:_n}),D({name:`kick/add`,register:pt}),D({name:`kick/list`,register:ft}),D({name:`kick/explain`,register:Dn}),D({name:`kick/mcp`,register:In}),D({name:`kick/tinker`,register:Bn}),D({name:`kick/remove`,register:Kn}),D({name:`kick/typegen`,register:Yn}),D({name:`kick/check`,register:sr}),D({name:`kick/doctor`,register:de}),D({name:`kick/codemod`,register:lr}),D({name:`kick/registry`,typegens:[{id:`kick/registry`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=k.resolve(e.cwd,`.kickjs/types/kick__registry.d.ts`),r=new Set(t.collisions.map(e=>e.className));return Ne(t.classes,n,r)}}]}),D({name:`kick/services`,typegens:[{id:`kick/services`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=new Set(t.collisions.map(e=>e.className));return je(`ServiceToken`,Ae(t.classes,t.tokens,t.injects,n),"(no tokens discovered — declare with createToken<T>() or `kick g service <name>`)")}}]}),D({name:`kick/modules`,typegens:[{id:`kick/modules`,inputs:[`src/**/*.ts`],async generate(e){return je(`ModuleToken`,we((await e.getScanResult($(e))).classes),"(no @Module classes discovered — `kick g module <name>` to add one)")}}]}),D({name:`kick/plugins`,typegens:[{id:`kick/plugins`,inputs:[`src/**/*.ts`],async generate(e){return Ee((await e.getScanResult($(e))).pluginsAndAdapters)}}]}),D({name:`kick/augmentations`,typegens:[{id:`kick/augmentations`,inputs:[`src/**/*.ts`],async generate(e){return Ie((await e.getScanResult($(e))).augmentations)}}]}),D({name:`kick/context`,typegens:[{id:`kick/context`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return t.contextKeys.length===0?null:Te(t.contextKeys)}}]}),D({name:`kick/assets`,typegens:[ur()]}),D({name:`kick/routes`,typegens:[vr()]}),D({name:`kick/env`,typegens:[Sr()]})];export{Zt as applyDisableFilter,G as runAllPluginTypegens,Dr as t};
|
|
636
|
-
//# sourceMappingURL=run-plugins-
|
|
636
|
+
//# sourceMappingURL=run-plugins-BAYoDnFI.mjs.map
|