@forinda/kickjs-cli 8.2.4 → 8.4.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-GCMhcDHy.mjs → agent-docs-BIYv2Od-.mjs} +2 -2
- package/dist/{agent-docs-C6ZYsFJV.mjs → agent-docs-DWRW_0cn.mjs} +3 -3
- package/dist/{agent-docs-C6ZYsFJV.mjs.map → agent-docs-DWRW_0cn.mjs.map} +1 -1
- package/dist/{build-DTs2SHKS.mjs → build-BrNa6gYZ.mjs} +2 -2
- package/dist/{build-hdxD_kEK.mjs → build-Bw_SFnBG.mjs} +3 -3
- package/dist/{build-hdxD_kEK.mjs.map → build-Bw_SFnBG.mjs.map} +1 -1
- package/dist/{builtins-Ci7vBC42.mjs → builtins-CNZ4QP-z.mjs} +34 -25
- package/dist/{builtins-BZGJgOyW.mjs → builtins-DHjV84lv.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{config-Dgap2WmJ.mjs → config-B6LRxtE1.mjs} +3 -3
- package/dist/config-B6LRxtE1.mjs.map +1 -0
- package/dist/{config-Bsokk8bV.mjs → config-DIH8bQUO.mjs} +2 -2
- package/dist/{doctor-Crq8eZsF.mjs → doctor-DzqvC6jF.mjs} +4 -4
- package/dist/{doctor-Crq8eZsF.mjs.map → doctor-DzqvC6jF.mjs.map} +1 -1
- package/dist/{fullstack-onQslndx.mjs → fullstack-BwdcyVD3.mjs} +21 -12
- package/dist/fullstack-BwdcyVD3.mjs.map +1 -0
- package/dist/{fullstack-C7Q-BJcj.mjs → fullstack-CkAO5DhE.mjs} +20 -11
- package/dist/index.d.mts +61 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-BuSzbyf2.mjs → plugin-BdN4scZR.mjs} +2 -2
- package/dist/{plugin-BYqbu6uO.mjs → plugin-C11bSFtE.mjs} +2 -2
- package/dist/{project-4kpuS1ud.mjs → project--WiWkarb.mjs} +33 -17
- package/dist/{project-BnXVCMd6.mjs → project-JoccwqS2.mjs} +36 -20
- package/dist/project-JoccwqS2.mjs.map +1 -0
- package/dist/{project-docs-CDr1HNPD.mjs → project-docs-8d5GNDIw.mjs} +2 -2
- package/dist/{project-docs-CDr1HNPD.mjs.map → project-docs-8d5GNDIw.mjs.map} +1 -1
- package/dist/{project-docs-Dn60gTjG.mjs → project-docs-Ck3uzaEG.mjs} +1 -1
- package/dist/{project-root-B1lyUoe8.mjs → project-root-DORRVmte.mjs} +3 -3
- package/dist/{project-root-B1lyUoe8.mjs.map → project-root-DORRVmte.mjs.map} +1 -1
- package/dist/{project-root-B5MNmlIn.mjs → project-root-D_rrQbpy.mjs} +2 -2
- package/dist/{prompts-8ssKQ4Kn.mjs → prompts-DHHDYxLL.mjs} +2 -2
- package/dist/{prompts-8ssKQ4Kn.mjs.map → prompts-DHHDYxLL.mjs.map} +1 -1
- package/dist/{rolldown-runtime-DtbiLYsN.mjs → rolldown-runtime-LCdccCoI.mjs} +1 -1
- package/dist/{run-plugins-CxuPMW4H.mjs → run-plugins-DSYGn4AC.mjs} +81 -72
- package/dist/run-plugins-DSYGn4AC.mjs.map +1 -0
- package/dist/{typegen-ClJqftm9.mjs → typegen-Bv9EzadE.mjs} +4 -4
- package/dist/{typegen-Ca46MGcE.mjs → typegen-COTKpuqW.mjs} +5 -5
- package/dist/{typegen-Ca46MGcE.mjs.map → typegen-COTKpuqW.mjs.map} +1 -1
- package/dist/{types-CJlHwJb4.mjs → types-CW4qiwB1.mjs} +1 -1
- package/package.json +5 -5
- package/dist/config-Dgap2WmJ.mjs.map +0 -1
- package/dist/fullstack-onQslndx.mjs.map +0 -1
- package/dist/project-BnXVCMd6.mjs.map +0 -1
- package/dist/run-plugins-CxuPMW4H.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.4.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{a as e,t}from"./config-
|
|
11
|
+
import{a as e,t}from"./config-DIH8bQUO.mjs";import{l as n,o as r}from"./project-docs-Ck3uzaEG.mjs";import{existsSync as i,readFileSync as a,writeFileSync as o}from"node:fs";import{dirname as s,join as c,resolve as l}from"node:path";import{fileURLToPath as u}from"node:url";import{execFile as d,execFileSync as f,execSync as p,spawnSync as m}from"node:child_process";import{promisify as h}from"node:util";const g=h(d),_=/[&|<>^"'`(){}[\];!%\r\n\\]/;function v(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(_.test(e)||t.some(e=>_.test(e)))return null;let r=[e,...t].map(e=>e.includes(` `)?`"${e}"`:e).join(` `);return[process.env.ComSpec||`cmd.exe`,[`/d`,`/s`,`/c`,r]]}function y(e,t,n={}){let r=v(e,t);if(!r)return null;try{return f(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,stdio:[`ignore`,`pipe`,`ignore`],windowsHide:!0}).toString().trim()||null}catch{return null}}function b(e,t,n={}){let r=v(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);f(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function ee(e,t,n){p(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function te(e,t,n){let r=m(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function ne(e,t,n={}){let r=v(e,t);if(!r)return null;try{let{stdout:e}=await g(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,windowsHide:!0});return e.toString().trim()||null}catch{return null}}const x={swagger:`@forinda/kickjs-swagger`,ws:`@forinda/kickjs-ws`,queue:`@forinda/kickjs-queue`,devtools:`@forinda/kickjs-devtools`},S={zod:`zod`,valibot:`valibot`,yup:`yup`};function C(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 w(e,t,n,r=[],i=`zod`,a=`express`,o=!1){let s=S[i],c={"@forinda/kickjs":C(n,`@forinda/kickjs`),"@forinda/kickjs-schema":C(n,`@forinda/kickjs-schema`),dotenv:C(n,`dotenv`),"reflect-metadata":C(n,`reflect-metadata`),[s]:C(n,s)};a===`express`?c.express=C(n,`express`):a===`fastify`?(c.fastify=C(n,`fastify`),c[`@fastify/middie`]=C(n,`@fastify/middie`),c[`serve-static`]=C(n,`serve-static`)):a===`h3`&&(c.h3=C(n,`h3`),c[`serve-static`]=C(n,`serve-static`));for(let e of r){let t=x[e];t&&!c[t]&&(c[t]=C(n,t))}return JSON.stringify({name:e,version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,build:`kick build`,start:`kick start`,test:`vitest run`,"build:netlify":`kick build && kick build:netlify`,"build:vercel":`kick build && kick build:vercel`},dependencies:c,devDependencies:{"@forinda/kickjs-cli":C(n,`@forinda/kickjs-cli`),"@forinda/kickjs-testing":C(n,`@forinda/kickjs-testing`),"@forinda/kickjs-vite":C(n,`@forinda/kickjs-vite`),"@types/supertest":C(n,`@types/supertest`),"@swc/core":C(n,`@swc/core`),...a===`express`?{"@types/express":C(n,`@types/express`)}:{},"@types/node":C(n,`@types/node`),"unplugin-swc":C(n,`unplugin-swc`),vite:C(n,`vite`),supertest:C(n,`supertest`),vitest:C(n,`vitest`),typescript:C(n,`typescript`),...o?{"@typescript/typescript6":C(n,`@typescript/typescript6`)}:{},oxfmt:C(n,`oxfmt`),oxlint:C(n,`oxlint`)}},null,2)}function re(e={}){return`import { defineConfig } from 'vite'
|
|
12
12
|
import { fileURLToPath } from 'node:url'
|
|
13
13
|
import swc from 'unplugin-swc'
|
|
14
14
|
import { kickjsVitePlugin, envWatchPlugin } from '@forinda/kickjs-vite'
|
|
@@ -43,9 +43,22 @@ ${e.strictPort?` server: {
|
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
})
|
|
46
|
-
`}function
|
|
46
|
+
`}function T(e){let t=e.spa?`
|
|
47
|
+
# Client-side routes fall back to the app shell. The function claims /api/*
|
|
48
|
+
# through its own \`config.path\`, so this rule never sees those requests.
|
|
49
|
+
[[redirects]]
|
|
50
|
+
from = "/*"
|
|
51
|
+
to = "/index.html"
|
|
52
|
+
status = 200
|
|
53
|
+
`:``;return`[build]
|
|
54
|
+
command = "${e.command}"
|
|
55
|
+
publish = "${e.publish}"
|
|
56
|
+
|
|
57
|
+
[build.environment]
|
|
58
|
+
NODE_VERSION = "22"
|
|
59
|
+
${t}`}function E(e){return`${JSON.stringify({$schema:`https://openapi.vercel.sh/vercel.json`,framework:null,buildCommand:e},null,2)}\n`}function ie(e,t){let n=Object.entries(t);if(n.length===0)return e;let r=e===``?[]:e.replace(/\n$/,``).split(`
|
|
47
60
|
`),i=e=>e.trim().replace(/^['"]|['"]$/g,``),a=e=>/^[\w-]+$/.test(e)?e:`'${e}'`,o=(e,t)=>{let n=r.findIndex(t=>t.replace(/\s+$/,``)===`${e}:`);if(n===-1){if(!t)return;r.length>0&&r[r.length-1]!==``&&r.push(``),r.push(`${e}:`),n=r.length-1}let i=n+1;for(let e=n+1;e<r.length&&/^(\s|$)/.test(r[e]);e++)r[e].trim()!==``&&(i=e+1);return{start:n,end:i}},s=[];for(let[e,t]of n){let{start:n,end:c}=o(`allowBuilds`,!0),l=r.slice(n+1,c).findIndex(t=>i(t.split(`:`)[0])===e),u=l===-1?void 0:/:\s*(true|false)\s*$/.exec(r[n+1+l]);if(u){s.push([e,u[1]===`true`]);continue}let d=` ${a(e)}: ${t}`;l===-1?r.splice(c,0,d):r[n+1+l]=d,s.push([e,t])}let c=[`onlyBuiltDependencies`,`ignoredBuiltDependencies`];for(let[e,t]of s){if(c.some(t=>{let n=o(t,!1);return n!==void 0&&r.slice(n.start+1,n.end).some(t=>i(t.replace(/^\s*-/,``))===e)}))continue;let{end:n}=o(t?c[0]:c[1],!0);r.splice(n,0,` - ${a(e)}`)}return`${r.join(`
|
|
48
|
-
`)}\n`}function
|
|
61
|
+
`)}\n`}function ae(){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 oe(){return JSON.stringify({$schema:`./node_modules/oxfmt/configuration_schema.json`,semi:!1,singleQuote:!0,trailingComma:`all`,printWidth:100,tabWidth:2,ignorePatterns:[`**/dist/`,`**/.kickjs/`,`**/node_modules/`]},null,2)}function se(){return`# https://editorconfig.org
|
|
49
62
|
root = true
|
|
50
63
|
|
|
51
64
|
[*]
|
|
@@ -58,7 +71,7 @@ insert_final_newline = true
|
|
|
58
71
|
|
|
59
72
|
[*.md]
|
|
60
73
|
trim_trailing_whitespace = false
|
|
61
|
-
`}function
|
|
74
|
+
`}function ce(){return`node_modules/
|
|
62
75
|
dist/
|
|
63
76
|
.env
|
|
64
77
|
# Machine-specific: each developer's test env differs (database names, ports).
|
|
@@ -69,7 +82,10 @@ coverage/
|
|
|
69
82
|
.DS_Store
|
|
70
83
|
*.tsbuildinfo
|
|
71
84
|
.kickjs/
|
|
72
|
-
|
|
85
|
+
# Platform build output — written by \`kick build:netlify\` / \`kick build:vercel\`.
|
|
86
|
+
.netlify/
|
|
87
|
+
.vercel/
|
|
88
|
+
`}function le(){return`# Auto-detect text files and normalise line endings to LF
|
|
73
89
|
* text=auto eol=lf
|
|
74
90
|
|
|
75
91
|
# Explicitly mark generated / binary files
|
|
@@ -87,9 +103,9 @@ coverage/
|
|
|
87
103
|
pnpm-lock.yaml -diff linguist-generated
|
|
88
104
|
yarn.lock -diff linguist-generated
|
|
89
105
|
package-lock.json -diff linguist-generated
|
|
90
|
-
`}function
|
|
106
|
+
`}function ue(){return`PORT=3000
|
|
91
107
|
NODE_ENV=development
|
|
92
|
-
`}function
|
|
108
|
+
`}function de(){return`PORT=3000
|
|
93
109
|
NODE_ENV=development
|
|
94
110
|
`}function D(){return`# Read INSTEAD of .env when NODE_ENV=test (or under vitest).
|
|
95
111
|
# No fallback to .env — declare here everything the suite needs, so a
|
|
@@ -100,9 +116,9 @@ NODE_ENV=development
|
|
|
100
116
|
NODE_ENV=test
|
|
101
117
|
PORT=0
|
|
102
118
|
LOG_LEVEL=silent
|
|
103
|
-
`}function
|
|
119
|
+
`}function fe(){return`# Template for .env.test. Copy it and fill in your machine's values:
|
|
104
120
|
# cp .env.test.example .env.test
|
|
105
|
-
${D()}`}function
|
|
121
|
+
${D()}`}function pe(){return`import { defineConfig, mergeConfig } from 'vitest/config'
|
|
106
122
|
import viteConfig from './vite.config.ts'
|
|
107
123
|
|
|
108
124
|
// A \`vitest.config.ts\` OVERRIDES \`vite.config.ts\` outright — vitest does not
|
|
@@ -120,7 +136,7 @@ export default mergeConfig(
|
|
|
120
136
|
},
|
|
121
137
|
}),
|
|
122
138
|
)
|
|
123
|
-
`}const
|
|
139
|
+
`}const me={express:{from:`@forinda/kickjs`,name:`expressRuntime`},fastify:{from:`@forinda/kickjs/fastify`,name:`fastifyRuntime`},h3:{from:`@forinda/kickjs/h3`,name:`h3Runtime`}};function O(e,t,n,r=[],i=`express`,a){let o=me[i],s=i===`express`;switch(t){case`minimal`:{let t=[],i=[],c=s?`import { bootstrap, ${o.name} } from '@forinda/kickjs'`:`import { bootstrap } from '@forinda/kickjs'\nimport { ${o.name} } from '${o.from}'`;r.includes(`swagger`)&&(t.push(`import { SwaggerAdapter } from '@forinda/kickjs-swagger'`),i.push(` SwaggerAdapter({ info: { title: '${e}', version: '${n}' } }),`)),r.includes(`devtools`)&&(t.push(`import { DevToolsAdapter } from '@forinda/kickjs-devtools'`),i.push(` DevToolsAdapter(),`)),a&&(t.push(`import { SpaAdapter } from '@forinda/kickjs/spa'`),i.push(` // Serves the built frontend from this origin in production.
|
|
124
140
|
// Inert until the client build exists, so \`kick dev\` (where Vite
|
|
125
141
|
// serves the client and proxies /api here) is unaffected.
|
|
126
142
|
SpaAdapter({ clientDir: ${JSON.stringify(a)} }),`));let l=t.length?t.join(`
|
|
@@ -422,13 +438,13 @@ export default defineConfig({
|
|
|
422
438
|
},
|
|
423
439
|
],
|
|
424
440
|
})
|
|
425
|
-
`}const F={kickjs:{pkg:`@forinda/kickjs`,peers:[],enginePeers:!0,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()`},ai:{pkg:`@forinda/kickjs-ai`,peers:[`zod`],description:`AI toolkit — LLM providers, tool definitions from controllers`},swagger:{pkg:`@forinda/kickjs-swagger`,peers:[],description:`OpenAPI spec + Swagger UI + ReDoc`,builds:{"@scarf/scarf":!0}},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)`},ws:{pkg:`@forinda/kickjs-ws`,peers:[`ws`],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}},I=Object.entries(F).filter(([e,t])=>!t.core&&!t.deprecated&&!e.includes(`:`)&&![`pg`,`sqlite`,`mysql`,`zod`,`valibot`,`yup`].includes(e)).map(([e])=>e).join(`, `),L={express:[`express`],fastify:[`fastify`,`@fastify/middie`,`serve-static`],h3:[`h3`,`serve-static`]},R={express:{prod:`multer`,dev:`@types/multer`,note:`Express uploads use multer (memory/disk storage, ctx.file / ctx.files).`},fastify:{prod:`@fastify/multipart`,note:`Fastify uploads use @fastify/multipart (buffered into ctx.file / ctx.files).`},h3:{note:`h3 parses multipart natively (readMultipartFormData) — no driver to install.`}};function z(e){if(e!==void 0){if(e===`express`||e===`fastify`||e===`h3`)return e;throw Error(`Invalid --runtime '${String(e)}'. Expected express, fastify or h3.`)}}async function B(e=process.cwd()){return(await V(e)).runtime}async function V(t=process.cwd()){let n=(await e(t))?.runtime;return n===`express`||n===`fastify`||n===`h3`?{runtime:n,candidates:[n],ambiguous:!1,fromConfig:!0}:{...
|
|
441
|
+
`}const F={kickjs:{pkg:`@forinda/kickjs`,peers:[],enginePeers:!0,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()`},ai:{pkg:`@forinda/kickjs-ai`,peers:[`zod`],description:`AI toolkit — LLM providers, tool definitions from controllers`},swagger:{pkg:`@forinda/kickjs-swagger`,peers:[],description:`OpenAPI spec + Swagger UI + ReDoc`,builds:{"@scarf/scarf":!0}},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)`},ws:{pkg:`@forinda/kickjs-ws`,peers:[`ws`],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}},I=Object.entries(F).filter(([e,t])=>!t.core&&!t.deprecated&&!e.includes(`:`)&&![`pg`,`sqlite`,`mysql`,`zod`,`valibot`,`yup`].includes(e)).map(([e])=>e).join(`, `),L={express:[`express`],fastify:[`fastify`,`@fastify/middie`,`serve-static`],h3:[`h3`,`serve-static`]},R={express:{prod:`multer`,dev:`@types/multer`,note:`Express uploads use multer (memory/disk storage, ctx.file / ctx.files).`},fastify:{prod:`@fastify/multipart`,note:`Fastify uploads use @fastify/multipart (buffered into ctx.file / ctx.files).`},h3:{note:`h3 parses multipart natively (readMultipartFormData) — no driver to install.`}};function z(e){if(e!==void 0){if(e===`express`||e===`fastify`||e===`h3`)return e;throw Error(`Invalid --runtime '${String(e)}'. Expected express, fastify or h3.`)}}async function B(e=process.cwd()){return(await V(e)).runtime}async function V(t=process.cwd()){let n=(await e(t))?.runtime;return n===`express`||n===`fastify`||n===`h3`?{runtime:n,candidates:[n],ambiguous:!1,fromConfig:!0}:{...he(t),fromConfig:!1}}const H=[[`express`,`express`],[`fastify`,`fastify`],[`h3`,`h3`]];function he(e=process.cwd()){let t=U(`package.json`,e);if(!t)return{runtime:`express`,candidates:[],ambiguous:!1};let n={},r={};try{let e=JSON.parse(a(l(t,`package.json`),`utf-8`));n=e.dependencies??{},r=e.devDependencies??{}}catch{return{runtime:`express`,candidates:[],ambiguous:!1}}let i=H.filter(([e])=>e in n).map(([,e])=>e),o=H.filter(([e])=>e in r&&!(e in n)).map(([,e])=>e),s=[...i,...o];return i.length===1?{runtime:i[0],candidates:s,ambiguous:!1}:i.length===0&&o.length===1?{runtime:o[0],candidates:s,ambiguous:!1}:s.length===0?{runtime:`express`,candidates:s,ambiguous:!1}:{runtime:`express`,candidates:s,ambiguous:!0}}function U(e,t=process.cwd()){let n=t;for(;;){if(i(l(n,e)))return n;let t=s(n);if(t===n)return null;n=t}}function ge(){return U(`pnpm-lock.yaml`)?`pnpm`:U(`yarn.lock`)?`yarn`:U(`bun.lockb`)||U(`bun.lock`)?`bun`:U(`package-lock.json`)?`npm`:null}function _e(){let e=process.cwd();for(;e;){let n=l(e,`package.json`);if(i(n))try{let e=JSON.parse(a(n,`utf-8`)).packageManager;if(typeof e==`string`){let n=e.split(`@`)[0];if(t.includes(n))return n}}catch{}let r=s(e);if(r===e)return null;e=r}return null}async function W(n){if(n&&t.includes(n))return{pm:n,source:`flag`};let r=await e(process.cwd());if(r?.packageManager&&t.includes(r.packageManager))return{pm:r.packageManager,source:`config`};let i=_e();if(i)return{pm:i,source:`package.json`};let a=ge();return a?{pm:a,source:`lockfile`}:{pm:`npm`,source:`default`}}async function ve(e){let{pm:t}=await W(e);return t}function G(e=!1,t){let n=Object.entries(F),r=Math.max(...n.map(([e])=>e.length)),i=n.filter(([,e])=>e.core),a=n.filter(([,e])=>!e.core),o=([e,n])=>{let i=e.padEnd(r+2),a=n.enginePeers?[...n.peers,...L[t??`express`]]:n.peers,o=n.enginePeers?` [${t??`express`} engine]`:``,s=a.length?` (+ ${a.join(`, `)})${o}`:``,c=n.deprecated?` [DEPRECATED — ${n.deprecated}]`:``;return` ${i} ${n.description}${s}${c}`};console.log(`
|
|
426
442
|
Core packages (always installed by \`kick new\`):
|
|
427
443
|
`);for(let e of i)console.log(o(e));if(e){console.log(`
|
|
428
444
|
Optional packages (add as needed):
|
|
429
445
|
`);for(let e of a)console.log(o(e))}else console.log(`\n Plus ${a.length} optional packages (swagger, db, queue, …).`),console.log(" Run `kick add --list --all` for the full catalog.");console.log(`
|
|
430
|
-
Usage: kick add ai db swagger`),console.log(` kick add queue:bullmq`),console.log(` kick add upload # installs the multipart driver for your runtime`),console.log()}const K={"@swc/core":!0,esbuild:!0};function q(e,t,n){if(e===`pnpm`){let e=l(t,`pnpm-workspace.yaml`),r=i(e)?a(e,`utf-8`):``,s=
|
|
431
|
-
`),s.length===0&&c.length===0))return;let f=J(e);if(Object.keys(f).length>0){let e=q(n,
|
|
432
|
-
`)})}const
|
|
433
|
-
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${a} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-
|
|
434
|
-
Project scaffolded successfully!`),console.log();let v=f!==process.cwd();m(`Next steps:`),v&&m(` cd ${t}`),e.installDeps||m(` ${a} install`);let y={rest:`kick g module user`,minimal:`# add your routes to src/index.ts`};m(` ${y[o]??y.rest}`),m(` kick dev`),m(``),m(`Commands:`),m(` kick dev Start dev server with Vite HMR`),m(` kick build Production build via Vite`),m(` kick start Run production build`),m(``),m(`Generators:`),m(` kick g module <name> REST module (controller, service, DTOs, repository)`),m(` kick g scaffold <n> <f..> CRUD module from field definitions`),m(` kick g controller <name> Standalone controller`),m(` kick g service <name> @Service() class`),m(` kick g middleware <name> Global connect-style middleware`),m(` kick g guard <name> Route guard (auth, roles, etc.)`),m(` kick g adapter <name> AppAdapter with lifecycle hooks`),m(` kick g dto <name> DTO schema (Zod / Valibot / Yup)`),m(` kick g config Generate kick.config.ts`),m(``),m(`Add packages:`),m(` kick add <pkg> Install a KickJS package + peers`),m(` kick add --list Show all available packages`),m(``),m(`Available: ${I}`),m(``)}export{R as a,
|
|
446
|
+
Usage: kick add ai db swagger`),console.log(` kick add queue:bullmq`),console.log(` kick add upload # installs the multipart driver for your runtime`),console.log()}const K={"@swc/core":!0,esbuild:!0};function q(e,t,n){if(e===`pnpm`){let e=l(t,`pnpm-workspace.yaml`),r=i(e)?a(e,`utf-8`):``,s=ie(r,n);return s===r?void 0:(o(e,s),e)}if(e!==`npm`&&e!==`bun`)return;let r=l(t,`package.json`);if(!i(r))return;let s=JSON.parse(a(r,`utf-8`)),c=!1;if(e===`npm`){let e=s.allowScripts??{};for(let[t,r]of Object.entries(n))Object.keys(e).some(e=>e===t||e.startsWith(`${t}@`))||(e[t]=r,c=!0);s.allowScripts=e}else{let e=s.trustedDependencies??[];for(let[t,r]of Object.entries(n))r&&!e.includes(t)&&(e.push(t),c=!0);s.trustedDependencies=e}if(c)return o(r,`${JSON.stringify(s,null,2)}\n`),r}function ye(e){if(e===`pnpm`)return U(`pnpm-workspace.yaml`)??process.cwd();for(let e=process.cwd();;e=s(e)){try{if(JSON.parse(a(l(e,`package.json`),`utf-8`)).workspaces)return e}catch{}if(s(e)===e)return process.cwd()}}function J(e){return Object.assign({},...e.map(e=>F[e]?.builds??{}))}function be(e,t,n=`express`){let r=new Set,i=new Set,a=[],o=[],s=[];for(let c of e){if(c===`upload`){let e=R[n];s.push(`upload (${n}): ${e.note}`),e.prod&&(t?i:r).add(e.prod),e.dev&&i.add(e.dev);continue}let e=F[c];if(!e){a.push(c);continue}e.deprecated&&o.push(`'${c}' (${e.pkg}) is deprecated — ${e.deprecated}`);let l=t||e.dev?i:r;l.add(e.pkg);for(let t of e.peers)l.add(t);if(e.enginePeers){let e=L[n];for(let t of e)l.add(t);s.push(`${c} (${n}): engine peers ${e.join(`, `)}`)}}return{prodDeps:[...r],devDeps:[...i],unknown:a,warnings:o,notices:s}}function xe(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`).option(`--runtime <engine>`,`HTTP engine to show peers for: express | fastify | h3`).action(async e=>{G(!!e.all,z(e.runtime)??await B())})}function Se(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(`--runtime <engine>`,`HTTP engine for peer resolution: express | fastify | h3 (overrides kick.config.ts)`).option(`--all`,`When listing, include the full optional catalog`).action(async(e,t)=>{if(t.list||e.length===0){G(!!t.all,z(t.runtime)??await B());return}let{pm:n,source:r}=await W(t.pm);console.log(`\n Using ${n} (resolved from ${r})`);let i=z(t.runtime),a=await V(process.cwd()),o=i??a.runtime;if(!i&&a.ambiguous){console.error(`\n Cannot tell which HTTP engine this app boots on: found ${a.candidates.join(`, `)} in package.json.\n\n Installing engine peers for the wrong one is worse than not installing them, so:\n • set \`runtime: '<engine>'\` in kick.config.ts (permanent, also fixes kick doctor), or\n • pass --runtime <${a.candidates.join(`|`)}> for this command\n`),process.exitCode=1;return}let{prodDeps:s,devDeps:c,unknown:l,warnings:u,notices:d}=be(e,!!t.dev,o);for(let e of u)console.warn(`\n WARNING: ${e}`);for(let e of d)console.log(`\n ${e}`);if(l.length>0&&(console.log(`\n Unknown packages: ${l.join(`, `)}`),console.log(` Run "kick add --list" to see available packages.
|
|
447
|
+
`),s.length===0&&c.length===0))return;let f=J(e);if(Object.keys(f).length>0){let e=q(n,ye(n),f);e&&console.log(`\n Approved install scripts in ${e}`)}if(s.length>0){let e=s,t=`${n} add ${e.join(` `)}`;console.log(`\n Installing ${e.length} dependency(ies):`);for(let t of e)console.log(` + ${t}`);console.log();try{p(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(c.length>0){let e=c,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{p(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}console.log(` Done!
|
|
448
|
+
`)})}const Y=s(u(import.meta.url)),X=JSON.parse(a([c(Y,`..`,`package.json`),c(Y,`..`,`..`,`package.json`)].find(i),`utf-8`)),Z=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-schema`,`@forinda/kickjs-vite`,`@forinda/kickjs-swagger`,`@forinda/kickjs-ws`,`@forinda/kickjs-queue`,`@forinda/kickjs-devtools`,`@forinda/kickjs-testing`,`@forinda/kickjs-client`],Ce={react:{fallback:`^19.0.0`},"react-dom":{fallback:`^19.0.0`},"@types/react":{fallback:`^19.0.0`},"@types/react-dom":{fallback:`^19.0.0`},"@vitejs/plugin-react":{fallback:`^5.0.0`},"@types/node":{fallback:`^25.0.0`},"@types/supertest":{fallback:`^7.2.1`},supertest:{fallback:`^7.2.2`},vitest:{fallback:`^4.1.2`},"@swc/core":{fallback:`^1.15.21`},"unplugin-swc":{fallback:`^1.5.9`},oxfmt:{fallback:`^0.65.0`},oxlint:{fallback:`^1.80.0`},dotenv:{fallback:`^17.3.1`},"reflect-metadata":{fallback:`^0.2.2`},vite:{fallback:`^8.0.3`,cap:`^8`},typescript:{fallback:`^7.0.2`,cap:`^7`},"@typescript/typescript6":{fallback:`^6.0.2`,cap:`^6`},express:{fallback:`^5.1.0`,cap:`^5`},"@types/express":{fallback:`^5.0.6`,cap:`^5`},fastify:{fallback:`^5.0.0`,cap:`^5`},"@fastify/middie":{fallback:`^9.0.0`,cap:`^9`},h3:{fallback:`^1.0.0`,cap:`^1`},"serve-static":{fallback:`^2.2.0`,cap:`^2`},zod:{fallback:`^4.3.6`,cap:`^4`},valibot:{fallback:`^1.4.1`,cap:`^1`},yup:{fallback:`^1.7.1`,cap:`^1`}};function we(e){if(!e)return null;let t=e.trim();if(/^\d+\.\d+\.\d+/.test(t))return t.split(/\s/)[0];try{let e=JSON.parse(t),n=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`);return n.length>0?n[n.length-1]:null}catch{return null}}function Te(e){return e===`@forinda/kickjs-cli`?`^${X.version}`:`latest`}async function Ee(e,t,n){let r=Array.from({length:e.length}),i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let t=i++;r[t]=await n(e[t])}});return await Promise.all(a),r}async function Q(){let e=[...Z.map(e=>({name:e,fallback:Te(e),cap:void 0})),...Object.entries(Ce).map(([e,t])=>({name:e,...t}))],t=Date.now()+2e4,n=await Ee(e,8,async({name:e,fallback:n,cap:r})=>{let i=t-Date.now();if(i<=0)return[e,n];let a=r?`${e}@${r}`:e,o=we(await ne(`npm`,r?[`view`,a,`version`,`--json`]:[`view`,a,`version`],{timeout:i}));return[e,o?`^${o}`:n]});return Object.fromEntries(n)}function De(e,t){let n=y(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function $(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function Oe(e,t){let n=e=>$(e).split(`-`)[0].split(`.`).map(e=>Number.parseInt(e,10)||0),[r=0,i=0,a=0]=n(e),[o=0,s=0,c=0]=n(t);return r===o?i===s?a>=c:i>s:r>o}function ke(e,t,n){let r=y(`npm`,[`view`,`${e}@${t}`,`exports`,`--json`],{timeout:2e4});if(!r)return!1;try{let e=JSON.parse(r);return Object.prototype.hasOwnProperty.call(e,n)}catch{return!1}}async function Ae(e){let{name:t,directory:i,packageManager:a=`pnpm`,template:o=`rest`,defaultRepo:s=`inmemory`,packages:l=[],schemaLib:u=`zod`,runtime:d=`express`}=e,f=i,m=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${t}\n`),e.versions||m(`Resolving package versions...`);let h=e.versions??await Q(),g=Object.keys(h).filter(e=>h[e]===`latest`);if(g.length>0&&m(`WARNING: could not reach npm for ${g.join(`, `)} — pinned to 'latest'`),d!==`express`){if(ke(`@forinda/kickjs`,`latest`,`./${d}`))m(`Using @forinda/kickjs@latest (stable ships the ${d} runtime)`);else{let e=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`],t=[],n=!1;for(let r of e){let e=De(r,`alpha`);e&&Oe(e,$(h[r]))&&(h[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}m(n?`Using the alpha channel for the ${d} runtime: ${t.join(`, `)}`:`WARNING: could not resolve @forinda/kickjs@alpha — the ${d} runtime subpath may be missing. After install, run: ${a} add @forinda/kickjs@alpha`)}}await n(c(f,`package.json`),w(t,o,h,l,u,d,e.withClientMap)),await n(c(f,`vite.config.ts`),re({strictPort:e.strictPort})),await n(c(f,`tsconfig.json`),ae()),await n(c(f,`.oxfmtrc.json`),oe()),await n(c(f,`.editorconfig`),se()),await n(c(f,`.gitignore`),ce()),await n(c(f,`.gitattributes`),le()),await n(c(f,`.env`),ue()),await n(c(f,`.env.example`),de()),await n(c(f,`.env.test`),D()),await n(c(f,`.env.test.example`),fe()),await n(c(f,`src/config/index.ts`),A(u)),await n(c(f,`src/index.ts`),O(t,o,X.version,l,d,e.spaClientDir)),await n(c(f,`src/modules/index.ts`),k()),await n(c(f,`src/modules/hello/hello.service.ts`),j()),await n(c(f,`src/modules/hello/hello.controller.ts`),M()),await n(c(f,`src/modules/hello/hello.module.ts`),N()),await n(c(f,`kick.config.ts`),P(o,s,a,d,e.withClientMap)),await n(c(f,`vitest.config.ts`),pe()),await n(c(f,`README.md`),r(t,o,a));let{generateAgentDocs:_}=await import(`./agent-docs-BIYv2Od-.mjs`).then(e=>e.t);if(await _({outDir:f,name:t,pm:a,template:o,only:`all`,force:!0}),e.platformConfig!==!1&&(await n(c(f,`netlify.toml`),T({command:`${a} run build:netlify`,publish:`dist/public`,spa:!1})),await n(c(f,`vercel.json`),E(`${a} run build:vercel`))),e.approveInstallScripts!==!1&&q(a,f,{...K,...J(l)}),e.installDeps){console.log(`\n Installing dependencies with ${a}...\n`);try{p(`${a} install`,{cwd:f,stdio:`inherit`}),console.log(`
|
|
449
|
+
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${a} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-Bv9EzadE.mjs`).then(e=>e.n);await e({cwd:f,allowDuplicates:!0,silent:!0})}catch{}if(e.initGit)try{p(`git init`,{cwd:f,stdio:`pipe`}),p(`git branch -M main`,{cwd:f,stdio:`pipe`}),p(`git add -A`,{cwd:f,stdio:`pipe`}),p(`git commit -m "chore: initial commit from kick new"`,{cwd:f,stdio:`pipe`}),m(`Git repository initialized`)}catch{m(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
450
|
+
Project scaffolded successfully!`),console.log();let v=f!==process.cwd();m(`Next steps:`),v&&m(` cd ${t}`),e.installDeps||m(` ${a} install`);let y={rest:`kick g module user`,minimal:`# add your routes to src/index.ts`};m(` ${y[o]??y.rest}`),m(` kick dev`),m(``),m(`Commands:`),m(` kick dev Start dev server with Vite HMR`),m(` kick build Production build via Vite`),m(` kick start Run production build`),m(``),m(`Generators:`),m(` kick g module <name> REST module (controller, service, DTOs, repository)`),m(` kick g scaffold <n> <f..> CRUD module from field definitions`),m(` kick g controller <name> Standalone controller`),m(` kick g service <name> @Service() class`),m(` kick g middleware <name> Global connect-style middleware`),m(` kick g guard <name> Route guard (auth, roles, etc.)`),m(` kick g adapter <name> AppAdapter with lifecycle hooks`),m(` kick g dto <name> DTO schema (Zod / Valibot / Yup)`),m(` kick g config Generate kick.config.ts`),m(``),m(`Add packages:`),m(` kick add <pkg> Install a KickJS package + peers`),m(` kick add --list Show all available packages`),m(``),m(`Available: ${I}`),m(``)}export{R as a,xe as c,T as d,E as f,ee as h,K as i,B as l,te as m,Q as n,q as o,b as p,F as r,Se as s,Ae as t,ve as u};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.4.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{l as e,o as t}from"./project-docs-
|
|
11
|
+
import{l as e,o as t}from"./project-docs-8d5GNDIw.mjs";import{o as n,t as r}from"./config-B6LRxtE1.mjs";import{dirname as i,join as a,resolve as o}from"node:path";import{existsSync as s,readFileSync as c,writeFileSync as l}from"node:fs";import{execFile as u,execFileSync as d,execSync as f,spawnSync as p}from"node:child_process";import{fileURLToPath as m}from"node:url";import{promisify as h}from"node:util";const g={express:{from:`@forinda/kickjs`,name:`expressRuntime`},fastify:{from:`@forinda/kickjs/fastify`,name:`fastifyRuntime`},h3:{from:`@forinda/kickjs/h3`,name:`h3Runtime`}};function _(e,t,n,r=[],i=`express`,a){let o=g[i],s=i===`express`;switch(t){case`minimal`:{let t=[],i=[],c=s?`import { bootstrap, ${o.name} } from '@forinda/kickjs'`:`import { bootstrap } from '@forinda/kickjs'\nimport { ${o.name} } from '${o.from}'`;r.includes(`swagger`)&&(t.push(`import { SwaggerAdapter } from '@forinda/kickjs-swagger'`),i.push(` SwaggerAdapter({ info: { title: '${e}', version: '${n}' } }),`)),r.includes(`devtools`)&&(t.push(`import { DevToolsAdapter } from '@forinda/kickjs-devtools'`),i.push(` DevToolsAdapter(),`)),a&&(t.push(`import { SpaAdapter } from '@forinda/kickjs/spa'`),i.push(` // Serves the built frontend from this origin in production.
|
|
12
12
|
// Inert until the client build exists, so \`kick dev\` (where Vite
|
|
13
13
|
// serves the client and proxies /api here) is unaffected.
|
|
14
14
|
SpaAdapter({ clientDir: ${JSON.stringify(a)} }),`));let l=t.length?t.join(`
|
|
@@ -55,14 +55,14 @@ export const app = await bootstrap({
|
|
|
55
55
|
requestLogger(),${d}
|
|
56
56
|
],
|
|
57
57
|
})
|
|
58
|
-
`}}}function
|
|
58
|
+
`}}}function v(){return`import { defineModules } from '@forinda/kickjs'
|
|
59
59
|
import { HelloModule } from './hello/hello.module'
|
|
60
60
|
|
|
61
61
|
// Remove HelloModule and run: kick g module <name>
|
|
62
62
|
// \`defineModules()\` returns a chainable list — \`kick g module\` appends
|
|
63
63
|
// \`.mount(NewModule())\` to the chain on every generation.
|
|
64
64
|
export const modules = defineModules().mount(HelloModule())
|
|
65
|
-
`}function
|
|
65
|
+
`}function y(e=`zod`){return e===`valibot`?`import { loadEnvFromSchema } from '@forinda/kickjs/config'
|
|
66
66
|
import { fromValibot } from '@forinda/kickjs-schema/valibot'
|
|
67
67
|
import * as v from 'valibot'
|
|
68
68
|
|
|
@@ -190,7 +190,7 @@ const envSchema = fromZod(
|
|
|
190
190
|
export const env = loadEnvFromSchema(envSchema)
|
|
191
191
|
|
|
192
192
|
export default envSchema
|
|
193
|
-
`}function
|
|
193
|
+
`}function b(){return`import { Service } from '@forinda/kickjs'
|
|
194
194
|
|
|
195
195
|
@Service()
|
|
196
196
|
export class HelloService {
|
|
@@ -202,7 +202,7 @@ export class HelloService {
|
|
|
202
202
|
return { status: 'ok', uptime: process.uptime() }
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
`}function
|
|
205
|
+
`}function ee(){return`import { Controller, Get, Autowired, type Ctx } from '@forinda/kickjs'
|
|
206
206
|
import { HelloService } from './hello.service'
|
|
207
207
|
|
|
208
208
|
// \`Ctx<KickRoutes.HelloController['<method>']>\` is generated by
|
|
@@ -228,7 +228,7 @@ export class HelloController {
|
|
|
228
228
|
return this.helloService.healthCheck()
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
`}function
|
|
231
|
+
`}function te(){return`import { defineModule } from '@forinda/kickjs'
|
|
232
232
|
import { HelloController } from './hello.controller'
|
|
233
233
|
|
|
234
234
|
export const HelloModule = defineModule({
|
|
@@ -249,7 +249,7 @@ export const HelloModule = defineModule({
|
|
|
249
249
|
},
|
|
250
250
|
}),
|
|
251
251
|
})
|
|
252
|
-
`}function
|
|
252
|
+
`}function ne(e,t=`inmemory`,n=`pnpm`,r=`express`,i=!1){return`import { defineConfig } from '@forinda/kickjs-cli'
|
|
253
253
|
|
|
254
254
|
export default defineConfig({
|
|
255
255
|
pattern: '${e}',
|
|
@@ -310,7 +310,7 @@ export default defineConfig({
|
|
|
310
310
|
},
|
|
311
311
|
],
|
|
312
312
|
})
|
|
313
|
-
`}const
|
|
313
|
+
`}const x=h(u),S=/[&|<>^"'`(){}[\];!%\r\n\\]/;function C(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(S.test(e)||t.some(e=>S.test(e)))return null;let r=[e,...t].map(e=>e.includes(` `)?`"${e}"`:e).join(` `);return[process.env.ComSpec||`cmd.exe`,[`/d`,`/s`,`/c`,r]]}function w(e,t,n={}){let r=C(e,t);if(!r)return null;try{return d(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,stdio:[`ignore`,`pipe`,`ignore`],windowsHide:!0}).toString().trim()||null}catch{return null}}function T(e,t,n={}){let r=C(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);d(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function E(e,t,n){let r=p(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function re(e,t,n={}){let r=C(e,t);if(!r)return null;try{let{stdout:e}=await x(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,windowsHide:!0});return e.toString().trim()||null}catch{return null}}const ie={swagger:`@forinda/kickjs-swagger`,ws:`@forinda/kickjs-ws`,queue:`@forinda/kickjs-queue`,devtools:`@forinda/kickjs-devtools`},ae={zod:`zod`,valibot:`valibot`,yup:`yup`};function D(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 oe(e,t,n,r=[],i=`zod`,a=`express`,o=!1){let s=ae[i],c={"@forinda/kickjs":D(n,`@forinda/kickjs`),"@forinda/kickjs-schema":D(n,`@forinda/kickjs-schema`),dotenv:D(n,`dotenv`),"reflect-metadata":D(n,`reflect-metadata`),[s]:D(n,s)};a===`express`?c.express=D(n,`express`):a===`fastify`?(c.fastify=D(n,`fastify`),c[`@fastify/middie`]=D(n,`@fastify/middie`),c[`serve-static`]=D(n,`serve-static`)):a===`h3`&&(c.h3=D(n,`h3`),c[`serve-static`]=D(n,`serve-static`));for(let e of r){let t=ie[e];t&&!c[t]&&(c[t]=D(n,t))}return JSON.stringify({name:e,version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,build:`kick build`,start:`kick start`,test:`vitest run`,"build:netlify":`kick build && kick build:netlify`,"build:vercel":`kick build && kick build:vercel`},dependencies:c,devDependencies:{"@forinda/kickjs-cli":D(n,`@forinda/kickjs-cli`),"@forinda/kickjs-testing":D(n,`@forinda/kickjs-testing`),"@forinda/kickjs-vite":D(n,`@forinda/kickjs-vite`),"@types/supertest":D(n,`@types/supertest`),"@swc/core":D(n,`@swc/core`),...a===`express`?{"@types/express":D(n,`@types/express`)}:{},"@types/node":D(n,`@types/node`),"unplugin-swc":D(n,`unplugin-swc`),vite:D(n,`vite`),supertest:D(n,`supertest`),vitest:D(n,`vitest`),typescript:D(n,`typescript`),...o?{"@typescript/typescript6":D(n,`@typescript/typescript6`)}:{},oxfmt:D(n,`oxfmt`),oxlint:D(n,`oxlint`)}},null,2)}function se(e={}){return`import { defineConfig } from 'vite'
|
|
314
314
|
import { fileURLToPath } from 'node:url'
|
|
315
315
|
import swc from 'unplugin-swc'
|
|
316
316
|
import { kickjsVitePlugin, envWatchPlugin } from '@forinda/kickjs-vite'
|
|
@@ -345,9 +345,22 @@ ${e.strictPort?` server: {
|
|
|
345
345
|
},
|
|
346
346
|
},
|
|
347
347
|
})
|
|
348
|
-
`}function
|
|
348
|
+
`}function O(e){let t=e.spa?`
|
|
349
|
+
# Client-side routes fall back to the app shell. The function claims /api/*
|
|
350
|
+
# through its own \`config.path\`, so this rule never sees those requests.
|
|
351
|
+
[[redirects]]
|
|
352
|
+
from = "/*"
|
|
353
|
+
to = "/index.html"
|
|
354
|
+
status = 200
|
|
355
|
+
`:``;return`[build]
|
|
356
|
+
command = "${e.command}"
|
|
357
|
+
publish = "${e.publish}"
|
|
358
|
+
|
|
359
|
+
[build.environment]
|
|
360
|
+
NODE_VERSION = "22"
|
|
361
|
+
${t}`}function k(e){return`${JSON.stringify({$schema:`https://openapi.vercel.sh/vercel.json`,framework:null,buildCommand:e},null,2)}\n`}function ce(e,t){let n=Object.entries(t);if(n.length===0)return e;let r=e===``?[]:e.replace(/\n$/,``).split(`
|
|
349
362
|
`),i=e=>e.trim().replace(/^['"]|['"]$/g,``),a=e=>/^[\w-]+$/.test(e)?e:`'${e}'`,o=(e,t)=>{let n=r.findIndex(t=>t.replace(/\s+$/,``)===`${e}:`);if(n===-1){if(!t)return;r.length>0&&r[r.length-1]!==``&&r.push(``),r.push(`${e}:`),n=r.length-1}let i=n+1;for(let e=n+1;e<r.length&&/^(\s|$)/.test(r[e]);e++)r[e].trim()!==``&&(i=e+1);return{start:n,end:i}},s=[];for(let[e,t]of n){let{start:n,end:c}=o(`allowBuilds`,!0),l=r.slice(n+1,c).findIndex(t=>i(t.split(`:`)[0])===e),u=l===-1?void 0:/:\s*(true|false)\s*$/.exec(r[n+1+l]);if(u){s.push([e,u[1]===`true`]);continue}let d=` ${a(e)}: ${t}`;l===-1?r.splice(c,0,d):r[n+1+l]=d,s.push([e,t])}let c=[`onlyBuiltDependencies`,`ignoredBuiltDependencies`];for(let[e,t]of s){if(c.some(t=>{let n=o(t,!1);return n!==void 0&&r.slice(n.start+1,n.end).some(t=>i(t.replace(/^\s*-/,``))===e)}))continue;let{end:n}=o(t?c[0]:c[1],!0);r.splice(n,0,` - ${a(e)}`)}return`${r.join(`
|
|
350
|
-
`)}\n`}function
|
|
363
|
+
`)}\n`}function le(){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 ue(){return JSON.stringify({$schema:`./node_modules/oxfmt/configuration_schema.json`,semi:!1,singleQuote:!0,trailingComma:`all`,printWidth:100,tabWidth:2,ignorePatterns:[`**/dist/`,`**/.kickjs/`,`**/node_modules/`]},null,2)}function de(){return`# https://editorconfig.org
|
|
351
364
|
root = true
|
|
352
365
|
|
|
353
366
|
[*]
|
|
@@ -360,7 +373,7 @@ insert_final_newline = true
|
|
|
360
373
|
|
|
361
374
|
[*.md]
|
|
362
375
|
trim_trailing_whitespace = false
|
|
363
|
-
`}function
|
|
376
|
+
`}function fe(){return`node_modules/
|
|
364
377
|
dist/
|
|
365
378
|
.env
|
|
366
379
|
# Machine-specific: each developer's test env differs (database names, ports).
|
|
@@ -371,7 +384,10 @@ coverage/
|
|
|
371
384
|
.DS_Store
|
|
372
385
|
*.tsbuildinfo
|
|
373
386
|
.kickjs/
|
|
374
|
-
|
|
387
|
+
# Platform build output — written by \`kick build:netlify\` / \`kick build:vercel\`.
|
|
388
|
+
.netlify/
|
|
389
|
+
.vercel/
|
|
390
|
+
`}function pe(){return`# Auto-detect text files and normalise line endings to LF
|
|
375
391
|
* text=auto eol=lf
|
|
376
392
|
|
|
377
393
|
# Explicitly mark generated / binary files
|
|
@@ -422,14 +438,14 @@ export default mergeConfig(
|
|
|
422
438
|
},
|
|
423
439
|
}),
|
|
424
440
|
)
|
|
425
|
-
`}const F={kickjs:{pkg:`@forinda/kickjs`,peers:[],enginePeers:!0,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()`},ai:{pkg:`@forinda/kickjs-ai`,peers:[`zod`],description:`AI toolkit — LLM providers, tool definitions from controllers`},swagger:{pkg:`@forinda/kickjs-swagger`,peers:[],description:`OpenAPI spec + Swagger UI + ReDoc`,builds:{"@scarf/scarf":!0}},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)`},ws:{pkg:`@forinda/kickjs-ws`,peers:[`ws`],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}},I=Object.entries(F).filter(([e,t])=>!t.core&&!t.deprecated&&!e.includes(`:`)&&![`pg`,`sqlite`,`mysql`,`zod`,`valibot`,`yup`].includes(e)).map(([e])=>e).join(`, `),L={express:[`express`],fastify:[`fastify`,`@fastify/middie`,`serve-static`],h3:[`h3`,`serve-static`]},R={express:{prod:`multer`,dev:`@types/multer`,note:`Express uploads use multer (memory/disk storage, ctx.file / ctx.files).`},fastify:{prod:`@fastify/multipart`,note:`Fastify uploads use @fastify/multipart (buffered into ctx.file / ctx.files).`},h3:{note:`h3 parses multipart natively (readMultipartFormData) — no driver to install.`}};function z(e){if(e!==void 0){if(e===`express`||e===`fastify`||e===`h3`)return e;throw Error(`Invalid --runtime '${String(e)}'. Expected express, fastify or h3.`)}}async function B(e=process.cwd()){return(await V(e)).runtime}async function V(e=process.cwd()){let t=(await n(e))?.runtime;return t===`express`||t===`fastify`||t===`h3`?{runtime:t,candidates:[t],ambiguous:!1,fromConfig:!0}:{...
|
|
441
|
+
`}const F={kickjs:{pkg:`@forinda/kickjs`,peers:[],enginePeers:!0,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()`},ai:{pkg:`@forinda/kickjs-ai`,peers:[`zod`],description:`AI toolkit — LLM providers, tool definitions from controllers`},swagger:{pkg:`@forinda/kickjs-swagger`,peers:[],description:`OpenAPI spec + Swagger UI + ReDoc`,builds:{"@scarf/scarf":!0}},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)`},ws:{pkg:`@forinda/kickjs-ws`,peers:[`ws`],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}},I=Object.entries(F).filter(([e,t])=>!t.core&&!t.deprecated&&!e.includes(`:`)&&![`pg`,`sqlite`,`mysql`,`zod`,`valibot`,`yup`].includes(e)).map(([e])=>e).join(`, `),L={express:[`express`],fastify:[`fastify`,`@fastify/middie`,`serve-static`],h3:[`h3`,`serve-static`]},R={express:{prod:`multer`,dev:`@types/multer`,note:`Express uploads use multer (memory/disk storage, ctx.file / ctx.files).`},fastify:{prod:`@fastify/multipart`,note:`Fastify uploads use @fastify/multipart (buffered into ctx.file / ctx.files).`},h3:{note:`h3 parses multipart natively (readMultipartFormData) — no driver to install.`}};function z(e){if(e!==void 0){if(e===`express`||e===`fastify`||e===`h3`)return e;throw Error(`Invalid --runtime '${String(e)}'. Expected express, fastify or h3.`)}}async function B(e=process.cwd()){return(await V(e)).runtime}async function V(e=process.cwd()){let t=(await n(e))?.runtime;return t===`express`||t===`fastify`||t===`h3`?{runtime:t,candidates:[t],ambiguous:!1,fromConfig:!0}:{...me(e),fromConfig:!1}}const H=[[`express`,`express`],[`fastify`,`fastify`],[`h3`,`h3`]];function me(e=process.cwd()){let t=U(`package.json`,e);if(!t)return{runtime:`express`,candidates:[],ambiguous:!1};let n={},r={};try{let e=JSON.parse(c(o(t,`package.json`),`utf-8`));n=e.dependencies??{},r=e.devDependencies??{}}catch{return{runtime:`express`,candidates:[],ambiguous:!1}}let i=H.filter(([e])=>e in n).map(([,e])=>e),a=H.filter(([e])=>e in r&&!(e in n)).map(([,e])=>e),s=[...i,...a];return i.length===1?{runtime:i[0],candidates:s,ambiguous:!1}:i.length===0&&a.length===1?{runtime:a[0],candidates:s,ambiguous:!1}:s.length===0?{runtime:`express`,candidates:s,ambiguous:!1}:{runtime:`express`,candidates:s,ambiguous:!0}}function U(e,t=process.cwd()){let n=t;for(;;){if(s(o(n,e)))return n;let t=i(n);if(t===n)return null;n=t}}function he(){return U(`pnpm-lock.yaml`)?`pnpm`:U(`yarn.lock`)?`yarn`:U(`bun.lockb`)||U(`bun.lock`)?`bun`:U(`package-lock.json`)?`npm`:null}function ge(){let e=process.cwd();for(;e;){let t=o(e,`package.json`);if(s(t))try{let e=JSON.parse(c(t,`utf-8`)).packageManager;if(typeof e==`string`){let t=e.split(`@`)[0];if(r.includes(t))return t}}catch{}let n=i(e);if(n===e)return null;e=n}return null}async function W(e){if(e&&r.includes(e))return{pm:e,source:`flag`};let t=await n(process.cwd());if(t?.packageManager&&r.includes(t.packageManager))return{pm:t.packageManager,source:`config`};let i=ge();if(i)return{pm:i,source:`package.json`};let a=he();return a?{pm:a,source:`lockfile`}:{pm:`npm`,source:`default`}}async function _e(e){let{pm:t}=await W(e);return t}function G(e=!1,t){let n=Object.entries(F),r=Math.max(...n.map(([e])=>e.length)),i=n.filter(([,e])=>e.core),a=n.filter(([,e])=>!e.core),o=([e,n])=>{let i=e.padEnd(r+2),a=n.enginePeers?[...n.peers,...L[t??`express`]]:n.peers,o=n.enginePeers?` [${t??`express`} engine]`:``,s=a.length?` (+ ${a.join(`, `)})${o}`:``,c=n.deprecated?` [DEPRECATED — ${n.deprecated}]`:``;return` ${i} ${n.description}${s}${c}`};console.log(`
|
|
426
442
|
Core packages (always installed by \`kick new\`):
|
|
427
443
|
`);for(let e of i)console.log(o(e));if(e){console.log(`
|
|
428
444
|
Optional packages (add as needed):
|
|
429
445
|
`);for(let e of a)console.log(o(e))}else console.log(`\n Plus ${a.length} optional packages (swagger, db, queue, …).`),console.log(" Run `kick add --list --all` for the full catalog.");console.log(`
|
|
430
|
-
Usage: kick add ai db swagger`),console.log(` kick add queue:bullmq`),console.log(` kick add upload # installs the multipart driver for your runtime`),console.log()}const K={"@swc/core":!0,esbuild:!0};function q(e,t,n){if(e===`pnpm`){let e=o(t,`pnpm-workspace.yaml`),r=s(e)?c(e,`utf-8`):``,i=
|
|
431
|
-
`),s.length===0&&c.length===0))return;let p=J(e);if(Object.keys(p).length>0){let e=q(n,
|
|
432
|
-
`)})}const
|
|
433
|
-
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${o} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-
|
|
434
|
-
Project scaffolded successfully!`),console.log();let
|
|
435
|
-
//# sourceMappingURL=project-
|
|
446
|
+
Usage: kick add ai db swagger`),console.log(` kick add queue:bullmq`),console.log(` kick add upload # installs the multipart driver for your runtime`),console.log()}const K={"@swc/core":!0,esbuild:!0};function q(e,t,n){if(e===`pnpm`){let e=o(t,`pnpm-workspace.yaml`),r=s(e)?c(e,`utf-8`):``,i=ce(r,n);return i===r?void 0:(l(e,i),e)}if(e!==`npm`&&e!==`bun`)return;let r=o(t,`package.json`);if(!s(r))return;let i=JSON.parse(c(r,`utf-8`)),a=!1;if(e===`npm`){let e=i.allowScripts??{};for(let[t,r]of Object.entries(n))Object.keys(e).some(e=>e===t||e.startsWith(`${t}@`))||(e[t]=r,a=!0);i.allowScripts=e}else{let e=i.trustedDependencies??[];for(let[t,r]of Object.entries(n))r&&!e.includes(t)&&(e.push(t),a=!0);i.trustedDependencies=e}if(a)return l(r,`${JSON.stringify(i,null,2)}\n`),r}function ve(e){if(e===`pnpm`)return U(`pnpm-workspace.yaml`)??process.cwd();for(let e=process.cwd();;e=i(e)){try{if(JSON.parse(c(o(e,`package.json`),`utf-8`)).workspaces)return e}catch{}if(i(e)===e)return process.cwd()}}function J(e){return Object.assign({},...e.map(e=>F[e]?.builds??{}))}function ye(e,t,n=`express`){let r=new Set,i=new Set,a=[],o=[],s=[];for(let c of e){if(c===`upload`){let e=R[n];s.push(`upload (${n}): ${e.note}`),e.prod&&(t?i:r).add(e.prod),e.dev&&i.add(e.dev);continue}let e=F[c];if(!e){a.push(c);continue}e.deprecated&&o.push(`'${c}' (${e.pkg}) is deprecated — ${e.deprecated}`);let l=t||e.dev?i:r;l.add(e.pkg);for(let t of e.peers)l.add(t);if(e.enginePeers){let e=L[n];for(let t of e)l.add(t);s.push(`${c} (${n}): engine peers ${e.join(`, `)}`)}}return{prodDeps:[...r],devDeps:[...i],unknown:a,warnings:o,notices:s}}function be(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`).option(`--runtime <engine>`,`HTTP engine to show peers for: express | fastify | h3`).action(async e=>{G(!!e.all,z(e.runtime)??await B())})}function xe(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(`--runtime <engine>`,`HTTP engine for peer resolution: express | fastify | h3 (overrides kick.config.ts)`).option(`--all`,`When listing, include the full optional catalog`).action(async(e,t)=>{if(t.list||e.length===0){G(!!t.all,z(t.runtime)??await B());return}let{pm:n,source:r}=await W(t.pm);console.log(`\n Using ${n} (resolved from ${r})`);let i=z(t.runtime),a=await V(process.cwd()),o=i??a.runtime;if(!i&&a.ambiguous){console.error(`\n Cannot tell which HTTP engine this app boots on: found ${a.candidates.join(`, `)} in package.json.\n\n Installing engine peers for the wrong one is worse than not installing them, so:\n • set \`runtime: '<engine>'\` in kick.config.ts (permanent, also fixes kick doctor), or\n • pass --runtime <${a.candidates.join(`|`)}> for this command\n`),process.exitCode=1;return}let{prodDeps:s,devDeps:c,unknown:l,warnings:u,notices:d}=ye(e,!!t.dev,o);for(let e of u)console.warn(`\n WARNING: ${e}`);for(let e of d)console.log(`\n ${e}`);if(l.length>0&&(console.log(`\n Unknown packages: ${l.join(`, `)}`),console.log(` Run "kick add --list" to see available packages.
|
|
447
|
+
`),s.length===0&&c.length===0))return;let p=J(e);if(Object.keys(p).length>0){let e=q(n,ve(n),p);e&&console.log(`\n Approved install scripts in ${e}`)}if(s.length>0){let e=s,t=`${n} add ${e.join(` `)}`;console.log(`\n Installing ${e.length} dependency(ies):`);for(let t of e)console.log(` + ${t}`);console.log();try{f(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(c.length>0){let e=c,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{f(t,{stdio:`inherit`})}catch{console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}console.log(` Done!
|
|
448
|
+
`)})}const Y=i(m(import.meta.url)),X=JSON.parse(c([a(Y,`..`,`package.json`),a(Y,`..`,`..`,`package.json`)].find(s),`utf-8`)),Se=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-schema`,`@forinda/kickjs-vite`,`@forinda/kickjs-swagger`,`@forinda/kickjs-ws`,`@forinda/kickjs-queue`,`@forinda/kickjs-devtools`,`@forinda/kickjs-testing`,`@forinda/kickjs-client`],Z={react:{fallback:`^19.0.0`},"react-dom":{fallback:`^19.0.0`},"@types/react":{fallback:`^19.0.0`},"@types/react-dom":{fallback:`^19.0.0`},"@vitejs/plugin-react":{fallback:`^5.0.0`},"@types/node":{fallback:`^25.0.0`},"@types/supertest":{fallback:`^7.2.1`},supertest:{fallback:`^7.2.2`},vitest:{fallback:`^4.1.2`},"@swc/core":{fallback:`^1.15.21`},"unplugin-swc":{fallback:`^1.5.9`},oxfmt:{fallback:`^0.65.0`},oxlint:{fallback:`^1.80.0`},dotenv:{fallback:`^17.3.1`},"reflect-metadata":{fallback:`^0.2.2`},vite:{fallback:`^8.0.3`,cap:`^8`},typescript:{fallback:`^7.0.2`,cap:`^7`},"@typescript/typescript6":{fallback:`^6.0.2`,cap:`^6`},express:{fallback:`^5.1.0`,cap:`^5`},"@types/express":{fallback:`^5.0.6`,cap:`^5`},fastify:{fallback:`^5.0.0`,cap:`^5`},"@fastify/middie":{fallback:`^9.0.0`,cap:`^9`},h3:{fallback:`^1.0.0`,cap:`^1`},"serve-static":{fallback:`^2.2.0`,cap:`^2`},zod:{fallback:`^4.3.6`,cap:`^4`},valibot:{fallback:`^1.4.1`,cap:`^1`},yup:{fallback:`^1.7.1`,cap:`^1`}};function Ce(e){if(!e)return null;let t=e.trim();if(/^\d+\.\d+\.\d+/.test(t))return t.split(/\s/)[0];try{let e=JSON.parse(t),n=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`);return n.length>0?n[n.length-1]:null}catch{return null}}function we(e){return e===`@forinda/kickjs-cli`?`^${X.version}`:`latest`}async function Te(e,t,n){let r=Array.from({length:e.length}),i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let t=i++;r[t]=await n(e[t])}});return await Promise.all(a),r}async function Q(){let e=[...Se.map(e=>({name:e,fallback:we(e),cap:void 0})),...Object.entries(Z).map(([e,t])=>({name:e,...t}))],t=Date.now()+2e4,n=await Te(e,8,async({name:e,fallback:n,cap:r})=>{let i=t-Date.now();if(i<=0)return[e,n];let a=r?`${e}@${r}`:e,o=Ce(await re(`npm`,r?[`view`,a,`version`,`--json`]:[`view`,a,`version`],{timeout:i}));return[e,o?`^${o}`:n]});return Object.fromEntries(n)}function Ee(e,t){let n=w(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function $(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function De(e,t){let n=e=>$(e).split(`-`)[0].split(`.`).map(e=>Number.parseInt(e,10)||0),[r=0,i=0,a=0]=n(e),[o=0,s=0,c=0]=n(t);return r===o?i===s?a>=c:i>s:r>o}function Oe(e,t,n){let r=w(`npm`,[`view`,`${e}@${t}`,`exports`,`--json`],{timeout:2e4});if(!r)return!1;try{let e=JSON.parse(r);return Object.prototype.hasOwnProperty.call(e,n)}catch{return!1}}async function ke(n){let{name:r,directory:i,packageManager:o=`pnpm`,template:s=`rest`,defaultRepo:c=`inmemory`,packages:l=[],schemaLib:u=`zod`,runtime:d=`express`}=n,p=i,m=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${r}\n`),n.versions||m(`Resolving package versions...`);let h=n.versions??await Q(),g=Object.keys(h).filter(e=>h[e]===`latest`);if(g.length>0&&m(`WARNING: could not reach npm for ${g.join(`, `)} — pinned to 'latest'`),d!==`express`){if(Oe(`@forinda/kickjs`,`latest`,`./${d}`))m(`Using @forinda/kickjs@latest (stable ships the ${d} runtime)`);else{let e=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`],t=[],n=!1;for(let r of e){let e=Ee(r,`alpha`);e&&De(e,$(h[r]))&&(h[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}m(n?`Using the alpha channel for the ${d} runtime: ${t.join(`, `)}`:`WARNING: could not resolve @forinda/kickjs@alpha — the ${d} runtime subpath may be missing. After install, run: ${o} add @forinda/kickjs@alpha`)}}await e(a(p,`package.json`),oe(r,s,h,l,u,d,n.withClientMap)),await e(a(p,`vite.config.ts`),se({strictPort:n.strictPort})),await e(a(p,`tsconfig.json`),le()),await e(a(p,`.oxfmtrc.json`),ue()),await e(a(p,`.editorconfig`),de()),await e(a(p,`.gitignore`),fe()),await e(a(p,`.gitattributes`),pe()),await e(a(p,`.env`),A()),await e(a(p,`.env.example`),j()),await e(a(p,`.env.test`),M()),await e(a(p,`.env.test.example`),N()),await e(a(p,`src/config/index.ts`),y(u)),await e(a(p,`src/index.ts`),_(r,s,X.version,l,d,n.spaClientDir)),await e(a(p,`src/modules/index.ts`),v()),await e(a(p,`src/modules/hello/hello.service.ts`),b()),await e(a(p,`src/modules/hello/hello.controller.ts`),ee()),await e(a(p,`src/modules/hello/hello.module.ts`),te()),await e(a(p,`kick.config.ts`),ne(s,c,o,d,n.withClientMap)),await e(a(p,`vitest.config.ts`),P()),await e(a(p,`README.md`),t(r,s,o));let{generateAgentDocs:x}=await import(`./agent-docs-DWRW_0cn.mjs`).then(e=>e.t);if(await x({outDir:p,name:r,pm:o,template:s,only:`all`,force:!0}),n.platformConfig!==!1&&(await e(a(p,`netlify.toml`),O({command:`${o} run build:netlify`,publish:`dist/public`,spa:!1})),await e(a(p,`vercel.json`),k(`${o} run build:vercel`))),n.approveInstallScripts!==!1&&q(o,p,{...K,...J(l)}),n.installDeps){console.log(`\n Installing dependencies with ${o}...\n`);try{f(`${o} install`,{cwd:p,stdio:`inherit`}),console.log(`
|
|
449
|
+
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${o} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-COTKpuqW.mjs`).then(e=>e.n);await e({cwd:p,allowDuplicates:!0,silent:!0})}catch{}if(n.initGit)try{f(`git init`,{cwd:p,stdio:`pipe`}),f(`git branch -M main`,{cwd:p,stdio:`pipe`}),f(`git add -A`,{cwd:p,stdio:`pipe`}),f(`git commit -m "chore: initial commit from kick new"`,{cwd:p,stdio:`pipe`}),m(`Git repository initialized`)}catch{m(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
450
|
+
Project scaffolded successfully!`),console.log();let S=p!==process.cwd();m(`Next steps:`),S&&m(` cd ${r}`),n.installDeps||m(` ${o} install`);let C={rest:`kick g module user`,minimal:`# add your routes to src/index.ts`};m(` ${C[s]??C.rest}`),m(` kick dev`),m(``),m(`Commands:`),m(` kick dev Start dev server with Vite HMR`),m(` kick build Production build via Vite`),m(` kick start Run production build`),m(``),m(`Generators:`),m(` kick g module <name> REST module (controller, service, DTOs, repository)`),m(` kick g scaffold <n> <f..> CRUD module from field definitions`),m(` kick g controller <name> Standalone controller`),m(` kick g service <name> @Service() class`),m(` kick g middleware <name> Global connect-style middleware`),m(` kick g guard <name> Route guard (auth, roles, etc.)`),m(` kick g adapter <name> AppAdapter with lifecycle hooks`),m(` kick g dto <name> DTO schema (Zod / Valibot / Yup)`),m(` kick g config Generate kick.config.ts`),m(``),m(`Add packages:`),m(` kick add <pkg> Install a KickJS package + peers`),m(` kick add --list Show all available packages`),m(``),m(`Available: ${I}`),m(``)}export{R as a,be as c,O as d,k as f,K as i,B as l,E as m,Q as n,q as o,T as p,F as r,xe as s,ke as t,_e as u};
|
|
451
|
+
//# sourceMappingURL=project-JoccwqS2.mjs.map
|