@forinda/kickjs-cli 8.12.1 → 8.13.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-GBEi-4ZM.mjs → agent-docs-D0qgHBA8.mjs} +25 -21
- package/dist/{agent-docs-DZJSoa_5.mjs → agent-docs-DD0hT2pE.mjs} +18 -14
- package/dist/agent-docs-DD0hT2pE.mjs.map +1 -0
- package/dist/{build-DkjrK7QX.mjs → build-C1ZgYqj7.mjs} +2 -2
- package/dist/{build-DZtpU_3Z.mjs → build-DEdLI54B.mjs} +3 -3
- package/dist/{build-DZtpU_3Z.mjs.map → build-DEdLI54B.mjs.map} +1 -1
- package/dist/{builtins-h-f_jNxU.mjs → builtins-BWtf5CEP.mjs} +2 -2
- package/dist/{builtins-BMZz5lPx.mjs → builtins-DZ-kQSyt.mjs} +121 -121
- package/dist/cli.mjs +2 -2
- package/dist/{config-aEXDfmSS.mjs → config-CHRM7WLZ.mjs} +3 -3
- package/dist/{config-aEXDfmSS.mjs.map → config-CHRM7WLZ.mjs.map} +1 -1
- package/dist/{config-B7d6wm08.mjs → config-CQGH0FTE.mjs} +2 -2
- package/dist/{doctor-DKtiOCf2.mjs → doctor-D0uazKD7.mjs} +20 -20
- package/dist/{doctor-DKtiOCf2.mjs.map → doctor-D0uazKD7.mjs.map} +1 -1
- package/dist/fullstack-C8k03oM8.mjs +110 -0
- package/dist/fullstack-Cr5tath7.mjs +111 -0
- package/dist/fullstack-Cr5tath7.mjs.map +1 -0
- package/dist/index.d.mts +8 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/package-manager-B-BW1RBj.mjs +11 -0
- package/dist/package-manager-mqxVziQ9.mjs +12 -0
- package/dist/package-manager-mqxVziQ9.mjs.map +1 -0
- package/dist/{plugin-BqNQkm01.mjs → plugin-DSgKyJSD.mjs} +2 -2
- package/dist/{plugin-Dc9DwVlE.mjs → plugin-MPu_4sWN.mjs} +2 -2
- package/dist/project--T8NPgfc.mjs +133 -0
- package/dist/{project-root-By-1PuaD.mjs → project-root-BsIxM6Gj.mjs} +2 -2
- package/dist/{project-root-C_H7sWTH.mjs → project-root-C4lAZePJ.mjs} +3 -3
- package/dist/{project-root-C_H7sWTH.mjs.map → project-root-C4lAZePJ.mjs.map} +1 -1
- package/dist/project-w-OcvS26.mjs +134 -0
- package/dist/project-w-OcvS26.mjs.map +1 -0
- package/dist/{rolldown-runtime-De7_Z3h7.mjs → rolldown-runtime-BVrPnwAV.mjs} +1 -1
- package/dist/{run-plugins-DY4qiPTu.mjs → run-plugins-cqNounm7.mjs} +108 -108
- package/dist/run-plugins-cqNounm7.mjs.map +1 -0
- package/dist/{typegen-ajfH3dB8.mjs → typegen-BfFiyGeh.mjs} +4 -4
- package/dist/{typegen-C13eMf8Q.mjs → typegen-Ctafx65M.mjs} +5 -5
- package/dist/{typegen-C13eMf8Q.mjs.map → typegen-Ctafx65M.mjs.map} +1 -1
- package/dist/{types-m-1iCFmy.mjs → types-CH5itn9u.mjs} +1 -1
- package/package.json +4 -4
- package/templates/base/files/README.md +11 -0
- package/templates/template-inertia/feature.json +1 -3
- package/templates/template-inertia/files/vite.client.config.ts +4 -1
- package/templates/web-kick/files/web/vite.config.ts +4 -1
- package/dist/agent-docs-DZJSoa_5.mjs.map +0 -1
- package/dist/fullstack-B6ZY4jGe.mjs +0 -100
- package/dist/fullstack-B6ZY4jGe.mjs.map +0 -1
- package/dist/fullstack-DBLIBX52.mjs +0 -99
- package/dist/package-manager-2OKBz8KC.mjs +0 -11
- package/dist/package-manager-C9253oKe.mjs +0 -12
- package/dist/package-manager-C9253oKe.mjs.map +0 -1
- package/dist/project-BktC0yLE.mjs +0 -134
- package/dist/project-BktC0yLE.mjs.map +0 -1
- package/dist/project-Cr8KrIZg.mjs +0 -133
- package/dist/prompts-iLmIrMD4.mjs +0 -12
- package/dist/prompts-iLmIrMD4.mjs.map +0 -1
- package/dist/run-plugins-DY4qiPTu.mjs.map +0 -1
- package/templates/host-config/files/vercel.json +0 -5
- /package/templates/{host-config → deploy-netlify}/files/netlify.toml +0 -0
- /package/templates/{fullstack-root → deploy-netlify-workspace}/files/netlify.toml +0 -0
- /package/templates/{base → deploy-serverless}/files/src/serverless.ts +0 -0
- /package/templates/{fullstack-root → deploy-vercel}/files/vercel.json +0 -0
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.12.1
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) Felix Orinda
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
import{f as e,o as t,r as n}from"./config-B7d6wm08.mjs";import{o as r,r as i}from"./package-manager-2OKBz8KC.mjs";import{existsSync as a,readFileSync as o,readdirSync as s,statSync as c,writeFileSync as l}from"node:fs";import{dirname as u,join as d,posix as f,resolve as p,sep as m}from"node:path";import{fileURLToPath as h}from"node:url";import{execFile as g,execFileSync as _,execSync as v,spawnSync as y}from"node:child_process";import{promisify as b}from"node:util";import{randomBytes as x}from"node:crypto";import{parseSync as S}from"oxc-parser";const C=b(g),w=/[&|<>^"'`(){}[\];!%\r\n\\]/;function T(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(w.test(e)||t.some(e=>w.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 E(e,t,n={}){let r=T(e,t);if(!r)return null;try{return _(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 ee(e,t,n={}){let r=T(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);_(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function D(e,t,n){v(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function O(e,t,n){let r=y(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function k(e,t,n={}){let r=T(e,t);if(!r)return null;try{let{stdout:e}=await C(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 te=u(h(import.meta.url)),A=[d(te,`..`,`templates`),d(te,`..`,`..`,`templates`)].find(e=>a(d(e,`base`)));function ne(e){return e.split(`/`).map(e=>e.startsWith(`_dot_`)?`.${e.slice(5)}`:e).join(`/`)}function j(e,t={}){let n=t.templatesDir??A,r=/* @__PURE__ */ new Map,i=[],l=[],u={},f=[],p={};for(let t of e){let e=d(n,t);if(!a(e))throw Error(`Unknown scaffold layer "${t}" (${e})`);let h=d(e,`feature.json`);if(a(h)){let e=JSON.parse(o(h,`utf-8`));i.push(...e.dependencies??[]),l.push(...e.devDependencies??[]),Object.assign(u,e.builds),f.push(...e.integrations??[]),Object.assign(p,e.scripts)}let g=d(e,`files`);if(a(g))for(let e of s(g,{recursive:!0,encoding:`utf-8`}).toSorted()){let t=d(g,e);if(!c(t).isFile())continue;let n=o(t,`utf-8`),i=ne(e.split(m).join(`/`));if(i.endsWith(`.append`)){let e=i.slice(0,-7);r.set(e,(r.get(e)??``)+n)}else r.set(i,n)}}f.push(...t.extra??[]);let h=t.vars??{},g=e=>e.replace(/\{\{(\w+)\}\}/g,(e,t)=>h[t]??e);for(let[e,t]of r)t.includes(`// @kick:`)&&r.set(e,re(t,f,g));return{files:r,dependencies:[...new Set(i)],devDependencies:[...new Set(l)],builds:u,integrations:f,scripts:p}}function M(e,t){let n=e=>e.replace(/\{\{(\w+)\}\}/g,(e,n)=>n in t?t[n]:e);return new Map([...e].map(([e,t])=>[e,n(t)]))}const N=/^([ \t]*)\/\/ @kick:([\w-]+)[ \t]*$/;function re(e,t,n=e=>e){let r=e.split(`
|
|
12
|
-
`),i=new Set(r.map(e=>N.exec(e)?.[2]).filter(Boolean)),a=t.filter(e=>!e.slot||i.has(e.slot)),o=[];for(let e=0;e<r.length;e++){let t=N.exec(r[e]);if(!t){o.push(r[e]);continue}let[,i,s]=t,c=s===`imports`?ae(a.flatMap(e=>e.import?[e.import]:[])):a.filter(e=>e.slot===s&&e.code).map(e=>ie(`${n(e.code)},`,i));c.length>0?o.push(...c):o.at(-1)?.trimEnd().endsWith(`[`)&&r[e+1]?.trim().startsWith(`]`)&&(o.pop(),e++)}return o.join(`
|
|
13
|
-
`)}function ie(e,t){return e.split(`
|
|
14
|
-
`).map(e=>e&&t+e).join(`
|
|
15
|
-
`)}function ae(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=t.get(n.from)??{names:[]};e.default??=n.default;for(let t of n.names??[])e.names.includes(t)||e.names.push(t);t.set(n.from,e)}return[...t].map(([e,{names:t,default:n}])=>{let r=`import ${[n,t.length?`{ ${t.join(`, `)} }`:void 0].filter(Boolean).join(`, `)} from '${e}'`;return r.length<=100||t.length===0?r:`import ${n?`${n}, `:``}{\n${t.map(e=>` ${e},`).join(`
|
|
16
|
-
`)}\n} from '${e}'`})}function oe(e,t){let n=e[t];if(!n)throw Error(`generatePackageJson: missing resolved version for ${t}. Add it to SIBLING_PACKAGES or THIRD_PARTY_PACKAGES in generators/project.ts.`);return n}function P(e,t){return Object.fromEntries(e.toSorted().map(e=>[e,oe(t,e)]))}function F(e){try{let t=_(e,[`--version`],{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`ignore`],timeout:1e4}).trim();return/^\d+\.\d+\.\d+$/.test(t)?`${e}@${t}`:void 0}catch{return}}function se(e){let t=e?.match(/@(\d+)\.(\d+)\./);return t?[Number(t[1]),Number(t[2])]:void 0}function ce(e,t){let n=se(t)?.[0];return e===`yarn`&&n!==void 0&&n>=2?`nodeLinker: node-modules
|
|
17
|
-
`:void 0}function le(e,t,n,r){return JSON.stringify({name:e,...r?{packageManager:r}:{},version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,build:`kick build`,start:`kick start`,test:`vitest run --passWithNoTests`,"build:netlify":`kick build && kick build:netlify`,"build:vercel":`kick build && kick build:vercel`,...n.scripts},dependencies:P(n.dependencies,t),devDependencies:P(n.devDependencies,t)},null,2)}function ue(e,t){let n=Object.entries(t);if(n.length===0)return e;let r=e===``?[]:e.replace(/\n$/,``).split(`
|
|
18
|
-
`),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(`
|
|
19
|
-
`)}\n`}const I=`node:22-slim`,de={pnpm:{lockfile:`pnpm-lock.yaml`,installFiles:[`pnpm-workspace.yaml`],install:`pnpm install --frozen-lockfile`,installProd:`pnpm install --prod --frozen-lockfile`,run:e=>`pnpm run ${e}`,image:I,setup:`RUN corepack enable`},npm:{lockfile:`package-lock.json`,installFiles:[],install:`npm ci`,installProd:`npm ci --omit=dev`,run:e=>`npm run ${e}`,image:I},yarn:{lockfile:`yarn.lock`,installFiles:[],install:`yarn install --frozen-lockfile`,installProd:`yarn install --production --frozen-lockfile`,run:e=>`yarn run ${e}`,image:I,setup:`RUN corepack enable`},bun:{lockfile:`bun.lock`,installFiles:[],install:`bun install --frozen-lockfile`,installProd:`bun install --production --frozen-lockfile`,run:e=>`bun run ${e}`,image:`oven/bun:1`}},L={lockfile:`yarn.lock`,installFiles:[`.yarnrc.yml`],install:`yarn install --immutable`,installProd:`yarn workspaces focus --all --production`,run:e=>`yarn run ${e}`,image:I,setup:`RUN corepack enable`},fe={api:`docker run -p 3000:3000 <name>`,inertia:`docker run -p 3000:3000 -e SESSION_SECRET=<a long random string> -e APP_URL=<https://your.site> <name>`,fullstack:`docker run -p 3000:3000 <name>`};function pe(e,t,n,r){let[i=0,a=0]=se(r)??[],o=t===`yarn`&&i>=2?i>=4?L:{...L,installProd:L.install}:t===`bun`&&r&&(i<1||i===1&&a<2)?{...de.bun,lockfile:`bun.lockb`}:de[t],s=`${o.setup?`\n${o.setup}`:``}
|
|
20
|
-
# Compilers for native addons (better-sqlite3, …) that have no prebuilt binary.
|
|
21
|
-
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \\
|
|
22
|
-
&& rm -rf /var/lib/apt/lists/*`,c=`# The build stage generates the Prisma client, if any.
|
|
23
|
-
ENV PRISMA_SKIP_POSTINSTALL_GENERATE=1`,l=(e===`fullstack`?[`package.json`,o.lockfile,...o.installFiles,`server/package.json`,`web/package.json`]:[`package.json`,o.lockfile,...o.installFiles]).map(e=>`COPY ${e} ./${e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)+1):``}`).join(`
|
|
24
|
-
`),u=`# syntax=docker/dockerfile:1
|
|
25
|
-
# ${n} — the long-running server in one image.
|
|
26
|
-
#
|
|
27
|
-
# docker build -t ${n} .
|
|
28
|
-
# ${fe[e].replace(`<name>`,n)}
|
|
29
|
-
#
|
|
30
|
-
# Environment comes from the platform or \`docker run\`; .env files are not
|
|
31
|
-
# copied into the image. The lockfile must be committed — installs are frozen.
|
|
32
|
-
`;if(e===`fullstack`)return`${u}
|
|
33
|
-
FROM ${o.image} AS base
|
|
34
|
-
WORKDIR /app${s}
|
|
35
|
-
|
|
36
|
-
# Production dependencies of every workspace member.
|
|
37
|
-
FROM base AS deps
|
|
38
|
-
${c}
|
|
39
|
-
${l}
|
|
40
|
-
RUN ${o.installProd}
|
|
41
|
-
# Hoisting may leave a member without its own node_modules; the runtime copies both.
|
|
42
|
-
RUN mkdir -p node_modules server/node_modules
|
|
43
|
-
|
|
44
|
-
# The server bundle and the built web app.
|
|
45
|
-
FROM base AS build
|
|
46
|
-
${l}
|
|
47
|
-
RUN ${o.install}
|
|
48
|
-
COPY . .
|
|
49
|
-
RUN ${o.run(`build`)}
|
|
50
|
-
# The generated Prisma client lands beside whichever install holds @prisma/client.
|
|
51
|
-
RUN mkdir -p node_modules/.prisma server/node_modules/.prisma
|
|
52
|
-
|
|
53
|
-
FROM ${I}
|
|
54
|
-
ENV NODE_ENV=production PORT=3000
|
|
55
|
-
WORKDIR /app
|
|
56
|
-
COPY --from=deps /app/node_modules ./node_modules
|
|
57
|
-
COPY --from=deps /app/server/node_modules ./server/node_modules
|
|
58
|
-
COPY --from=build /app/node_modules/.prisma ./node_modules/.prisma
|
|
59
|
-
COPY --from=build /app/server/node_modules/.prisma ./server/node_modules/.prisma
|
|
60
|
-
COPY --from=build /app/package.json ./
|
|
61
|
-
COPY --from=build /app/server/package.json ./server/
|
|
62
|
-
COPY --from=build /app/server/dist ./server/dist
|
|
63
|
-
# SpaAdapter serves ../web/dist relative to the server.
|
|
64
|
-
COPY --from=build /app/web/dist ./web/dist
|
|
65
|
-
WORKDIR /app/server
|
|
66
|
-
USER node
|
|
67
|
-
EXPOSE 3000
|
|
68
|
-
CMD ["node", "dist/index.js"]
|
|
69
|
-
`;let d=e===`inertia`?`# The server, the pages (dist/client) and the SSR bundle (dist/ssr).`:`# The server bundle.`;return`${u}
|
|
70
|
-
FROM ${o.image} AS base
|
|
71
|
-
WORKDIR /app${s}
|
|
72
|
-
|
|
73
|
-
FROM base AS deps
|
|
74
|
-
${c}
|
|
75
|
-
${l}
|
|
76
|
-
RUN ${o.installProd}
|
|
77
|
-
|
|
78
|
-
${d}
|
|
79
|
-
FROM base AS build
|
|
80
|
-
${l}
|
|
81
|
-
RUN ${o.install}
|
|
82
|
-
COPY . .
|
|
83
|
-
RUN ${o.run(`build`)}
|
|
84
|
-
RUN mkdir -p node_modules/.prisma
|
|
85
|
-
|
|
86
|
-
FROM ${I}
|
|
87
|
-
ENV NODE_ENV=production PORT=3000
|
|
88
|
-
WORKDIR /app
|
|
89
|
-
COPY --from=deps /app/node_modules ./node_modules
|
|
90
|
-
# A Prisma client generated into node_modules (empty otherwise).
|
|
91
|
-
COPY --from=build /app/node_modules/.prisma ./node_modules/.prisma
|
|
92
|
-
COPY --from=build /app/package.json ./
|
|
93
|
-
COPY --from=build /app/dist ./dist
|
|
94
|
-
# The image's filesystem is replaced on every deploy. Keep a SQLite file (or
|
|
95
|
-
# uploads) in /app/data and mount a volume there: docker run -v ${n}-data:/app/data
|
|
96
|
-
RUN mkdir -p data && chown node:node data
|
|
97
|
-
USER node
|
|
98
|
-
EXPOSE 3000
|
|
99
|
-
CMD ["node", "dist/index.js"]
|
|
100
|
-
`}function R(){return`${[`# Rebuilt inside the image.`,`**/node_modules`,`**/dist`,`**/.kickjs`,`# Secrets stay out of the image; pass them at run time.`,`**/.env`,`**/.env.*`,`!**/.env.example`,`# Platform and tooling output.`,`.netlify`,`.vercel`,`.git`,`**/coverage`,`*.log`].join(`
|
|
101
|
-
`)}\n`}const me={adapter:`adapters`,middleware:`middlewares`};function he(e,t,n=e=>e,r=`src/index.ts`){let i={source:e,added:[],present:[],manual:[]};for(let e of t){if(!e.slot||!e.code||e.slot.startsWith(`env-`))continue;let t=me[e.slot],a=n(e.code),o=_e(a),s=S(r,i.source).program,c=t?ge(s):void 0;if(!c){i.manual.push({...e,code:a});continue}let l=c.properties.find(e=>e.type===`Property`&&(e.key?.name??e.key?.value)===t);if(l&&l.value.type!==`ArrayExpression`){i.manual.push({...e,code:a});continue}let u=o&&e.import?z(s,e.import.from,o):o;l&&u&&i.source.slice(l.value.start,l.value.end).includes(`${u}(`)?i.present.push(o??B(a)):(i.source=l?U(i.source,l.value,l.value.elements,a):be(i.source,c,t,a),e.import&&(i.source=xe(i.source,e.import,r)),i.added.push(o??B(a)))}return i}function ge(e){let t,n=e=>{if(t||!e||typeof e!=`object`)return;if(Array.isArray(e))return e.forEach(n);let r=e;if(r.type===`CallExpression`&&r.callee?.type===`Identifier`&&r.callee.name===`bootstrap`&&r.arguments?.[0]?.type===`ObjectExpression`)t=r.arguments[0];else for(let e in r)n(r[e])};return n(e),t}function z(e,t,n){for(let r of e.body)if(r.type===`ImportDeclaration`&&r.source.value===t)for(let e of r.specifiers){let t=e.imported?.name??e.imported?.value;if(e.type===`ImportSpecifier`&&t===n)return e.local.name}return n}function _e(e){let t=e.split(`
|
|
102
|
-
`).filter(e=>!e.trim().startsWith(`//`)).join(`
|
|
103
|
-
`),n=/^\s*([A-Za-z_$][\w$.]*)\s*\(/.exec(t)?.[1];if(n)return n;for(let e of t.matchAll(/(?<![\w$])([A-Za-z_$][\w$]*)\s*\(/g))if(e[1]!==`import`)return e[1]}const B=e=>e.split(`
|
|
104
|
-
`).find(e=>e.trim()&&!e.trim().startsWith(`//`))?.trim()??e,V=(e,t)=>/^[ \t]*/.exec(e.slice(e.lastIndexOf(`
|
|
105
|
-
`,t-1)+1))[0],H=(e,t)=>e.split(`
|
|
106
|
-
`).map(e=>e&&t+e).join(`
|
|
107
|
-
`);function U(e,t,n,r){let i=n.filter(Boolean),a=V(e,t.start);if(i.length===0){let n=H(`${r},`,`${a} `),[i,o]=t.type===`ObjectExpression`?[`{`,`}`]:[`[`,`]`];return`${e.slice(0,t.start)}${i}\n${n}\n${a}${o}${e.slice(t.end)}`}let o=i.at(-1),s=V(e,o.start),c=e.slice(o.end,t.end-1).match(/^\s*,/),l=c?o.end+c[0].length:o.end,u=`\n${H(`${r},`,s)}`;return c?e.slice(0,l)+u+e.slice(l):`${e.slice(0,l)},${u.replace(/,$/,``)}${e.slice(l)}`}const W=[`zod`,`valibot`,`yup`];function ve(e,t,n=`src/config/index.ts`){let r={source:e,added:[],present:[],manual:[]},{lib:i,object:a}=K(S(n,e).program),o=t.filter(e=>e.slot===`env-${i??`zod`}`&&e.code);if(o.length===0)return r;if(!i||!a)return r.manual.push(...o),r;for(let e of o){let t=ye(e.code),i=K(S(n,r.source).program).object;i.properties.some(e=>e.type===`Property`&&(e.key?.name??e.key?.value)===t)?r.present.push(t):(r.source=U(r.source,i,i.properties,e.code),r.added.push(t))}return r}const ye=e=>/^\s*['"]?(\w+)['"]?\s*:/m.exec(e)?.[1]??B(e),G=e=>e?.type===`CallExpression`&&e.callee?.type===`MemberExpression`&&e.callee.property?.name===`object`&&e.arguments?.[0]?.type===`ObjectExpression`?e.arguments[0]:void 0;function K(e){let t=e.body,n=/* @__PURE__ */ new Map;for(let r of W){let i=`from${r[0].toUpperCase()}${r.slice(1)}`;t.some(e=>e.type===`ImportDeclaration`&&e.source.value===`@forinda/kickjs-schema/${r}`&&e.specifiers.some(e=>(e.imported?.name??e.imported?.value)===i))&&n.set(z(e,`@forinda/kickjs-schema/${r}`,i),r)}let r=[],i=[],a=e=>{if(!e||typeof e!=`object`)return;if(Array.isArray(e))return e.forEach(a);let t=e,o=G(t);o&&i.push(o);let s=t.type===`CallExpression`?n.get(t.callee?.name):void 0,c=G(t.arguments?.[0]);s&&c&&r.push({call:t,lib:s,object:c});for(let e in t)a(t[e])};if(a(e),r.length>0){let e=t.find(e=>e.type===`ExportDefaultDeclaration`)?.declaration;if(e?.type===`Identifier`){let n=e.name;e=t.map(e=>e.type===`ExportNamedDeclaration`?e.declaration:e).filter(e=>e?.type===`VariableDeclaration`).flatMap(e=>e.declarations).find(e=>e.id?.name===n)?.init}let{lib:n,object:i}=r.find(t=>t.call===e)??r[0];return{lib:n,object:i}}return{lib:W.find(e=>t.some(t=>t.type===`ImportDeclaration`&&t.source.value===e)),object:i[0]}}function be(e,t,n,r){let i=t.properties.at(-1),a=i?V(e,i.start):`${V(e,t.start)} `,o=`${a}${n}: [\n${H(`${r},`,`${a} `)}\n${a}],`;if(!i)return`${e.slice(0,t.start)}{\n${o}\n${V(e,t.start)}}${e.slice(t.end)}`;let s=e.slice(i.end,t.end-1).match(/^\s*,/),c=s?i.end+s[0].length:i.end;return`${e.slice(0,c)}${s?``:`,`}\n${o}${e.slice(c)}`}function xe(e,t,n=`src/index.ts`){let r=S(n,e).program.body.filter(e=>e.type===`ImportDeclaration`),i=r.find(e=>e.source.value===t.from&&e.importKind!==`type`&&e.specifiers.length>0&&!e.specifiers.some(e=>e.type===`ImportNamespaceSpecifier`)),a=t.names??[];if(i){let t=new Set(i.specifiers.map(e=>e.local?.name)),n=a.filter(e=>!t.has(e));if(n.length===0)return e;let r=i.specifiers.filter(e=>e.type===`ImportSpecifier`);if(r.length>0){let t=r.at(-1).end;return`${e.slice(0,t)}, ${n.join(`, `)}${e.slice(t)}`}let o=i.specifiers[0];return`${e.slice(0,o.end)}, { ${n.join(`, `)} }${e.slice(o.end)}`}let o=`import ${[t.default,a.length?`{ ${a.join(`, `)} }`:void 0].filter(Boolean).join(`, `)} from '${t.from}'`,s=r.at(-1);return s?`${e.slice(0,s.end)}\n${o}${e.slice(s.end)}`:`${o}\n${e}`}const Se={swagger:`feature-swagger`,devtools:`feature-devtools`,ws:`feature-ws`,queue:`feature-queue`,"queue:bullmq":`feature-queue`,storage:`feature-storage`};function Ce(e){let t=[...new Set(e.map(e=>Se[e]).filter(Boolean))];return t.length>0?j(t):void 0}function we(e,t){return(t?[t]:[`src/index.ts`,`src/main.ts`]).find(t=>a(d(e,t)))}function Te(e,t){try{let n=_(`git`,[`ls-files`,`--modified`,`--`,...t],{cwd:e,encoding:`utf-8`,stdio:[`ignore`,`pipe`,`ignore`]});return[...new Set(n.split(`
|
|
108
|
-
`).filter(Boolean))]}catch{return[]}}function Ee(e){return[`src/config/index.ts`,`src/env.ts`].find(t=>a(d(e,t)))}async function De(e,t,n){let i=d(e,t),a=o(i,`utf-8`),s=ve(a,n,t);return s.source!==a&&await r(i,s.source),s}const q=/\.(?:[cm]?[jt]sx?)$/;function Oe(e,t){return[...t].filter(([t,n])=>{let r=d(e,t);return q.test(t)&&a(r)&&o(r,`utf-8`)!==n}).map(([e])=>e)}async function ke(e,t){let n=[],i=[];for(let[s,c]of t){let t=d(e,s);if(!a(t)){await r(t,c),n.push(s);continue}if(q.test(s))continue;let l=o(t,`utf-8`),u=new Set(l.split(`
|
|
109
|
-
`).map(e=>J(e)??e)),f=c.split(`
|
|
110
|
-
`).filter(e=>e.trim()&&!u.has(J(e)??e));if(f.length===0)continue;let p=l===``||l.endsWith(`
|
|
111
|
-
`)?``:`
|
|
112
|
-
`;await r(t,`${l}${p}${f.join(`
|
|
113
|
-
`)}\n`),i.push(s)}return{created:n,updated:i}}function Ae(e,t,n){let r=e.import?.from;if(!r?.startsWith(`.`))return!1;let i=f.join(f.dirname(t.replaceAll(`\\`,`/`)),r);return n.some(e=>e.replace(q,``)===i)}function je(e,t){let n=f.dirname(t.replaceAll(`\\`,`/`));return e.map(e=>{let t=e.import?.from;if(!t?.startsWith(`.`))return e;let r=f.relative(n,f.join(`src`,t));return{...e,import:{...e.import,from:r.startsWith(`.`)?r:`./${r}`}}})}const J=e=>/^\s*([A-Za-z_][\w]*)\s*=/.exec(e)?.[1];async function Me(e,t,n){let i=d(e,t),a=o(i,`utf-8`),s=he(a,n,Ne(e),t);return s.source!==a&&await r(i,s.source),s}function Ne(e){let t=Pe(e),n={name:String(t.name??`app`),version:String(t.version??`0.0.0`)};return e=>e.replace(/\{\{(\w+)\}\}/g,(e,t)=>n[t]??e)}function Pe(e){try{return JSON.parse(o(d(e,`package.json`),`utf-8`))}catch{return{}}}function Fe(e){let t=e.flatMap(e=>e.import?[e.import]:[]).map(e=>`import ${[e.default,e.names?.length?`{ ${e.names.join(`, `)} }`:void 0].filter(Boolean).join(`, `)} from '${e.from}'`),n=e.map(e=>`${e.code},`);return[...t,``,`// in bootstrap({ adapters: [ ... ] }):`,...n].join(`
|
|
114
|
-
`)}const Y={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`},storage:{pkg:`@forinda/kickjs-storage`,peers:[],description:`File storage — memory, disk, S3-compatible buckets, signed URLs`},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`],typePeers:[`@types/pg`],description:`kick/db + PostgreSQL driver (use @forinda/kickjs-db/pg)`},sqlite:{pkg:`@forinda/kickjs-db`,peers:[`better-sqlite3`],builds:{"better-sqlite3":!0},typePeers:[`@types/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`],builds:{"msgpackr-extract":!1},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/server`],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}},Ie=Object.entries(Y).filter(([e,t])=>!t.core&&!t.deprecated&&!e.includes(`:`)&&![`pg`,`sqlite`,`mysql`,`zod`,`valibot`,`yup`].includes(e)).map(([e])=>e).concat(`upload`).join(`, `),Le={express:[`express`],fastify:[`fastify`,`@fastify/middie`,`serve-static`],h3:[`h3@^2`,`serve-static`]},Re={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 X(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 Z(e=process.cwd()){return(await ze(e)).runtime}async function ze(e=process.cwd()){let n=(await t(e))?.runtime;return n===`express`||n===`fastify`||n===`h3`?{runtime:n,candidates:[n],ambiguous:!1,fromConfig:!0}:{...Ve(e),fromConfig:!1}}const Be=[[`express`,`express`],[`fastify`,`fastify`],[`h3`,`h3`]];function Ve(e=process.cwd()){let t=He(`package.json`,e);if(!t)return{runtime:`express`,candidates:[],ambiguous:!1};let n={},r={};try{let e=JSON.parse(o(p(t,`package.json`),`utf-8`));n=e.dependencies??{},r=e.devDependencies??{}}catch{return{runtime:`express`,candidates:[],ambiguous:!1}}let i=Be.filter(([e])=>e in n).map(([,e])=>e),a=Be.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 He(e,t=process.cwd()){let n=t;for(;;){if(a(p(n,e)))return n;let t=u(n);if(t===n)return null;n=t}}function Ue(e=!1,t){let n=Object.entries(Y),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,...Le[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(`
|
|
115
|
-
Core packages (always installed by \`kick new\`):
|
|
116
|
-
`);for(let e of i)console.log(o(e));if(e){console.log(`
|
|
117
|
-
Optional packages (add as needed):
|
|
118
|
-
`);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(`
|
|
119
|
-
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 We={"@swc/core":!0,esbuild:!0};function Q(e,t,n){if(e===`pnpm`){let e=p(t,`pnpm-workspace.yaml`),r=a(e)?o(e,`utf-8`):``,i=ue(r,n);return i===r?void 0:(l(e,i),e)}if(e!==`npm`&&e!==`bun`)return;let r=p(t,`package.json`);if(!a(r))return;let i=JSON.parse(o(r,`utf-8`)),s=!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,s=!0);i.allowScripts=e}else{let e=i.trustedDependencies??[];for(let[t,r]of Object.entries(n))r&&!e.includes(t)&&(e.push(t),s=!0);i.trustedDependencies=e}if(s)return l(r,`${JSON.stringify(i,null,2)}\n`),r}function Ge(e){if(e===`pnpm`)return He(`pnpm-workspace.yaml`)??process.cwd();for(let e=process.cwd();;e=u(e)){try{if(JSON.parse(o(p(e,`package.json`),`utf-8`)).workspaces)return e}catch{}if(u(e)===e)return process.cwd()}}function Ke(e){return Object.assign({},...e.map(e=>Y[e]?.builds??{}))}function qe(e,t,n=`express`){let r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a=[],o=[],s=[];for(let c of e){if(c===`upload`){let e=Re[n];s.push(`upload (${n}): ${e.note}`),e.prod&&(t?i:r).add(e.prod),e.dev&&i.add(e.dev);continue}let e=Y[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);for(let t of e.typePeers??[])i.add(t);if(e.enginePeers){let e=Le[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 Je(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=>{Ue(!!e.all,X(e.runtime)??await Z())})}function Ye(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`).option(`--no-wire`,`Install only — do not add adapters to the entry file or .env`).option(`--entry <file>`,`Entry file to wire (default: src/index.ts, then src/main.ts)`).option(`-f, --force`,`Wire even when the files it edits have uncommitted changes`).action(async(e,t)=>{if(t.list||e.length===0){Ue(!!t.all,X(t.runtime)??await Z());return}let{pm:n,source:r}=await i(t.pm);console.log(`\n Using ${n} (resolved from ${r})`);let o=X(t.runtime),s=await ze(process.cwd()),c=o??s.runtime;if(!o&&s.ambiguous){console.error(`\n Cannot tell which HTTP engine this app boots on: found ${s.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 <${s.candidates.join(`|`)}> for this command\n`),process.exitCode=1;return}let l=qe(e,!!t.dev,c),{unknown:u,warnings:d,notices:f}=l,{prodDeps:m,devDeps:h}=l,g=process.cwd();if(t.entry&&!a(p(g,t.entry))){console.error(`\n --entry ${t.entry} does not exist.\n`),process.exitCode=1;return}let _=t.wire===!1?void 0:Ce(e),y=_?we(g,t.entry):void 0;_&&y&&(_.integrations=je(_.integrations,y));let b=_?.integrations.filter(e=>e.slot?.startsWith(`env-`))??[],x=b.length>0?Ee(g):void 0;if(_){m=[.../* @__PURE__ */ new Set([...m,..._.dependencies])],h=[...new Set([...h,..._.devDependencies].filter(e=>!m.includes(e)))];let e=Te(g,[...y?[y]:[],...x?[x]:[],..._.files.keys()]);if(e.length>0&&!t.force){console.error(`\n ${e.join(`, `)} ${e.length===1?`has`:`have`} uncommitted changes, and kick add would edit ${e.length===1?`it`:`them`}.\n Commit, stage (git add) or stash them first, rerun with --force to edit anyway, or with --no-wire to install only.\n`),process.exitCode=1;return}}for(let e of d)console.warn(`\n WARNING: ${e}`);for(let e of f)console.log(`\n ${e}`);if(u.length>0&&(console.log(`\n Unknown packages: ${u.join(`, `)}`),console.log(` Run "kick add --list" to see available packages.
|
|
120
|
-
`),m.length===0&&h.length===0))return;let S={...Ke(e),..._?.builds};if(Object.keys(S).length>0){let e=Q(n,Ge(n),S);e&&console.log(`\n Approved install scripts in ${e}`)}let C=!0;if(m.length>0){let e=m,t=`${n} add ${e.join(` `)}`;console.log(`\n Installing ${e.length} dependency(ies):`);for(let t of e)console.log(` + ${t}`);console.log();try{v(t,{stdio:`inherit`})}catch{C=!1,console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(h.length>0){let e=h,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{v(t,{stdio:`inherit`})}catch{C=!1,console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(_){if(!C)console.log(` Skipped wiring — the install did not finish.
|
|
121
|
-
`);else{let e=Oe(g,_.files),{created:t,updated:n}=await ke(g,_.files);for(let e of t)console.log(` Created ${e}`);for(let e of n)console.log(` Updated ${e}`);let r=y?_.integrations.filter(t=>Ae(t,y,e)):[],i=_.integrations.filter(e=>!r.includes(e)),a=y?await Me(g,y,i):void 0;for(let e of a?.added??[])console.log(` Added ${e} to ${y}`);for(let e of a?.present??[])console.log(` ${e} is already in ${y}`);let o=x?await De(g,x,b):void 0;o?.added.length&&console.log(` Declared ${o.added.join(`, `)} in ${x}`);let s=o?o.manual:b.filter(e=>e.slot===`env-zod`);s.length>0&&(console.log(`\n ${x?`Could not find the env schema object in ${x}`:`No env schema (src/config/index.ts) found`} — declare these keys in it yourself:
|
|
122
|
-
`),console.log(s.map(e=>`${e.code},`).join(`
|
|
123
|
-
`).replace(/^/gm,` `)),console.log());let c=Ne(g),l=a?a.manual:_.integrations.filter(e=>e.slot&&e.code&&!e.slot.startsWith(`env-`)).map(e=>({...e,code:c(e.code)}));if(e.length>0){let t=r.map(e=>({...e,code:c(e.code??``)}));console.log(`\n ${e.join(`, `)} already exist${e.length===1?`s`:``} — left as ${e.length===1?`it is`:`they are`}. Merge in what the layer needs, then wire it yourself:
|
|
124
|
-
`),console.log(`${Fe(t)}`.replace(/^/gm,` `)),console.log()}l.length>0&&(console.log(`\n ${y?`Could not find bootstrap({ adapters: [...] }) in ${y}`:`No entry file found`} — add this yourself:
|
|
125
|
-
`),console.log(Fe(l).replace(/^/gm,` `)),console.log())}}C?console.log(` Done!
|
|
126
|
-
`):(console.log(` Finished with errors — the install above did not complete.
|
|
127
|
-
`),process.exitCode=1)})}const $=u(h(import.meta.url));function Xe(t){return{kick:n(t,`kick`),runDev:e(t,`dev`),runBuild:e(t,`build`),runStart:e(t,`start`),runTest:e(t,`test`)}}const Ze=JSON.parse(o([d($,`..`,`package.json`),d($,`..`,`..`,`package.json`)].find(a),`utf-8`)),Qe=[`@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`,`@forinda/kickjs-inertia`,`@forinda/kickjs-storage`],$e={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`},"@inertiajs/react":{fallback:`^3.9.0`,cap:`^3`},"@inertiajs/core":{fallback:`^3.9.0`,cap:`^3`},"@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`,cap:`^17`},"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:`^2.0.2`,cap:`^2`},"serve-static":{fallback:`^2.2.0`,cap:`^2`},zod:{fallback:`^4.3.6`,cap:`^4`},valibot:{fallback:`^1.4.1`,cap:`^1`},"@valibot/to-json-schema":{fallback:`^1.8.0`,cap:`^1`},yup:{fallback:`^1.7.1`,cap:`^1`},ws:{fallback:`^8.18.0`,cap:`^8`},bullmq:{fallback:`^5.0.0`,cap:`^5`},ioredis:{fallback:`^5.0.0`,cap:`^5`}};function et(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 tt(e){return e===`@forinda/kickjs-cli`?`^${Ze.version}`:`latest`}async function nt(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 rt(){let e=[...Qe.map(e=>({name:e,fallback:tt(e),cap:void 0})),...Object.entries($e).map(([e,t])=>({name:e,...t}))],t=Date.now()+2e4,n=await nt(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=et(await k(`npm`,r?[`view`,a,`version`,`--json`]:[`view`,a,`version`],{timeout:i}));return[e,o?`^${o}`:n]});return Object.fromEntries(n)}function it(e,t){let n=E(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function at(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function ot(e,t){let n=e=>at(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 st(e,t,n){let r=E(`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 ct(t){let{name:i,directory:o,packageManager:s=`pnpm`,template:c=`rest`,defaultRepo:l=`inmemory`,packages:u=[],schemaLib:f=`zod`,runtime:p=`express`}=t,m=o,h=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${i}\n`),t.versions||h(`Resolving package versions...`);let g=t.versions??await rt(),_=Object.keys(g).filter(e=>g[e]===`latest`);if(_.length>0&&h(`WARNING: could not reach npm for ${_.join(`, `)} — pinned to 'latest'`),p!==`express`){if(st(`@forinda/kickjs`,`latest`,`./${p}`))h(`Using @forinda/kickjs@latest (stable ships the ${p} runtime)`);else{let e=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`],t=[],n=!1;for(let r of e){let e=it(r,`alpha`);e&&ot(e,at(g[r]))&&(g[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}h(n?`Using the alpha channel for the ${p} runtime: ${t.join(`, `)}`:`WARNING: could not resolve @forinda/kickjs@alpha — the ${p} runtime subpath may be missing. After install, run: ${s} add @forinda/kickjs@alpha`)}}let y=u.filter(e=>!a(d(A,`feature-${e}`)));y.length>0&&h(`WARNING: skipping unknown package(s): ${y.join(`, `)} — add them later with kick add`);let b=j([...dt({template:c,runtime:p,schemaLib:f,packages:u}),...t.platformConfig===!1?[]:[`host-config`],...t.extraLayers??[]],{vars:{name:i,version:Ze.version},extra:[{slot:`repo`,code:l===`inmemory`?`repo: 'inmemory'`:`repo: { name: '${l.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)}' }`},...t.spaClientDir?[ut(t.spaClientDir)]:[]]}),S=t.platformConfig===!1?void 0:F(s);await r(d(m,`package.json`),le(i,g,b,S));let C=ce(s,S);C&&await r(d(m,`.yarnrc.yml`),C);let w=M(b.files,{name:i,template:c,runtime:p,packageManager:s,...Xe(s),netlifyPublish:c===`inertia`?`dist/client`:`dist/public`,templateLabel:{rest:`REST API`,minimal:`Minimal`,inertia:`Inertia (React)`}[c],sessionSecret:x(32).toString(`hex`),packages:[...b.dependencies,...b.devDependencies].filter(e=>e.startsWith(`@forinda/`)).map(e=>`- \`${e}\``).join(`
|
|
128
|
-
`)});for(let[e,t]of w)await r(d(m,e),t);if(t.platformConfig!==!1){let e=c===`inertia`?`inertia`:`api`;await r(d(m,`Dockerfile`),pe(e,s,i,S)),await r(d(m,`.dockerignore`),R())}let{generateAgentDocs:T}=await import(`./agent-docs-GBEi-4ZM.mjs`).then(e=>e.t);await T({outDir:m,name:i,pm:s,template:c,only:`all`,force:!0});let E={...We,...Ke(u),...b.builds};if(t.approveInstallScripts!==!1&&Q(s,m,E),t.installDeps){console.log(`\n Installing dependencies with ${s}...\n`);try{v(`${s} install`,{cwd:m,stdio:`inherit`}),console.log(`
|
|
129
|
-
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${s} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-ajfH3dB8.mjs`).then(e=>e.n);await e({cwd:m,allowDuplicates:!0,silent:!0})}catch{}if(t.initGit)try{v(`git init`,{cwd:m,stdio:`pipe`}),v(`git branch -M main`,{cwd:m,stdio:`pipe`}),v(`git add -A`,{cwd:m,stdio:`pipe`}),v(`git commit -m "chore: initial commit from kick new"`,{cwd:m,stdio:`pipe`}),h(`Git repository initialized`)}catch{h(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
130
|
-
Project scaffolded successfully!`),console.log();let ee=m!==process.cwd();h(`Next steps:`),ee&&h(` cd ${i}`),t.installDeps||h(` ${s} install`);let D=n(s,`kick`),O={rest:`${D} g module user`,minimal:`# add your routes to src/index.ts`,inertia:`# pages: src/modules/pages + src/client/pages`};h(` ${O[c]??O.rest}`),h(` ${e(s,`dev`)}`);let k=e=>{let t=Math.max(...e.map(([e])=>e.length))+2;for(let[n,r]of e)h(` ${n.padEnd(t)}${r}`)};return h(``),h(`Commands:`),k([[e(s,`dev`),`Start dev server with Vite HMR`],[e(s,`build`),`Production build via Vite`],[e(s,`start`),`Run production build`]]),h(``),h(`Generators:`),k([[`${D} g module <name>`,`REST module (controller, service, DTOs, repository)`],[`${D} g scaffold <n> <f..>`,`CRUD module from field definitions`],[`${D} g controller <name>`,`Standalone controller`],[`${D} g service <name>`,`@Service() class`],[`${D} g middleware <name>`,`Global connect-style middleware`],[`${D} g guard <name>`,`Route guard (auth, roles, etc.)`],[`${D} g adapter <name>`,`AppAdapter with lifecycle hooks`],[`${D} g dto <name>`,`DTO schema (Zod / Valibot / Yup)`],[`${D} g config`,`Generate kick.config.ts`]]),h(``),h(`Add packages:`),k([[`${D} add <pkg>`,`Install a KickJS package + peers`],[`${D} add --list`,`Show all available packages`]]),h(``),h(`Available: ${Ie}`),h(``),{builds:E}}const lt=e=>`'${JSON.stringify(e).slice(1,-1).replaceAll(`\\"`,`"`).replaceAll(`'`,`\\'`)}'`;function ut(e){return{import:{from:`@forinda/kickjs/spa`,names:[`SpaAdapter`]},slot:`adapter`,code:`// Serves the built frontend from this origin in production.
|
|
131
|
-
// Inert until the client build exists, so \`kick dev\` (where Vite
|
|
132
|
-
// serves the client and proxies /api here) is unaffected.
|
|
133
|
-
SpaAdapter({ clientDir: ${lt(e)} })`}}function dt(e){return[`base`,`template-${e.template}`,`runtime-${e.runtime}`,`schema-${e.schemaLib}`,...e.packages.filter(e=>a(d(A,`feature-${e}`))).map(e=>`feature-${e}`)]}export{D as _,Q as a,Z as c,F as d,ce as f,O as g,ee as h,Re as i,pe as l,j as m,rt as n,Ye as o,M as p,Y as r,Je as s,ct as t,R as u};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.12.1
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) Felix Orinda
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
import*as e from"@clack/prompts";import t from"picocolors";const n={GET:t.green,POST:t.cyan,PUT:t.yellow,PATCH:t.magenta,DELETE:t.red};function r(e){return(n[e]??t.dim)(e.padEnd(7))}function i(e){let n=`[${e}]`.padEnd(10);switch(e){case`CRITICAL`:return t.red(n);case`WARNING`:return t.yellow(n);case`INFO`:return t.blue(t.dim(n));default:return n}}t.green(`✓`),t.red(`✖`),t.yellow(`⚠`),t.blue(`ℹ`);function a(n){e.intro(t.bgCyan(t.black(` ${n} `)))}function o(t){e.outro(t)}function s(t){e.isCancel(t)&&(e.cancel(`Operation cancelled.`),process.exit(0))}async function c(t){let n=await e.text(t);return s(n),n}async function l(t){let n=await e.select(t);return s(n),n}async function u(t){let n=await e.multiselect(t);return s(n),n}async function d(t){let n=await e.confirm(t);return s(n),n}function f(){return e.spinner()}const p=e.log;export{o as a,c,i as d,u as i,r as l,a as n,l as o,p as r,f as s,d as t,t as u};
|
|
12
|
-
//# sourceMappingURL=prompts-iLmIrMD4.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompts-iLmIrMD4.mjs","names":["colors","clack","pc","METHOD_COLOR_MAP","httpMethodColor","method","severityColor","tag","severity","intro","title","outro","message","handleCancel","value","text","opts","select","multiSelect","confirm","spinner","log"],"sources":["../src/utils/colors.ts","../src/utils/prompts.ts"],"sourcesContent":["import pc from 'picocolors'\n\nexport { pc as colors }\n\nconst METHOD_COLOR_MAP: Record<string, (s: string) => string> = {\n GET: pc.green,\n POST: pc.cyan,\n PUT: pc.yellow,\n PATCH: pc.magenta,\n DELETE: pc.red,\n}\n\n/** Color an HTTP method string for terminal display */\nexport function httpMethodColor(method: string): string {\n const fn = METHOD_COLOR_MAP[method] ?? pc.dim\n return fn(method.padEnd(7))\n}\n\n/** Color a severity tag for terminal display (padded to 10 chars) */\nexport function severityColor(severity: string): string {\n const tag = `[${severity}]`.padEnd(10)\n switch (severity) {\n case 'CRITICAL':\n return pc.red(tag)\n case 'WARNING':\n return pc.yellow(tag)\n case 'INFO':\n return pc.blue(pc.dim(tag))\n default:\n return tag\n }\n}\n","import * as clack from '@clack/prompts'\nimport { colors } from './colors'\n\nexport const symbols = {\n success: colors.green('✓'),\n error: colors.red('✖'),\n warning: colors.yellow('⚠'),\n info: colors.blue('ℹ'),\n}\n\n/** Show branded intro banner */\nexport function intro(title: string): void {\n clack.intro(colors.bgCyan(colors.black(` ${title} `)))\n}\n\n/** Show closing message */\nexport function outro(message: string): void {\n clack.outro(message)\n}\n\n/** Handle cancellation — print message and exit */\nfunction handleCancel(value: unknown): void {\n if (clack.isCancel(value)) {\n clack.cancel('Operation cancelled.')\n process.exit(0)\n }\n}\n\n/** Text input prompt */\nexport async function text(opts: {\n message: string\n placeholder?: string\n defaultValue?: string\n validate?: (value: string) => string | void\n}): Promise<string> {\n const value = await clack.text(opts as any)\n handleCancel(value)\n return value as string\n}\n\n/** Single select prompt */\nexport async function select<T>(opts: {\n message: string\n options: { value: T; label: string; hint?: string }[]\n initialValue?: T\n}): Promise<T> {\n const value = await clack.select(opts as any)\n handleCancel(value)\n return value as T\n}\n\n/** Multi-select prompt with checkboxes */\nexport async function multiSelect<T>(opts: {\n message: string\n options: { value: T; label: string; hint?: string }[]\n required?: boolean\n initialValues?: T[]\n}): Promise<T[]> {\n const value = await clack.multiselect(opts as any)\n handleCancel(value)\n return value as T[]\n}\n\n/** Yes/no confirmation prompt */\nexport async function confirm(opts: {\n message: string\n active?: string\n inactive?: string\n initialValue?: boolean\n}): Promise<boolean> {\n const value = await clack.confirm(opts)\n handleCancel(value)\n return value as boolean\n}\n\n/** Create a spinner for progress indication */\nexport function spinner() {\n return clack.spinner()\n}\n\n/** Log utilities for styled messages inside clack flow */\nexport const log = clack.log\n"],"mappings":";;;;;;;;;;2DAIA,MAAMG,EAA0D,CAC9D,IAAKD,EAAG,MACR,KAAMA,EAAG,KACT,IAAKA,EAAG,OACR,MAAOA,EAAG,QACV,OAAQA,EAAG,GACb,EAGA,SAAgBE,EAAgB,EAAwB,CAEtD,OADWD,EAAiBE,IAAWH,EAAG,IAAA,CAChCG,EAAO,OAAO,CAAC,CAAC,CAC5B,CAGA,SAAgBC,EAAc,EAA0B,CACtD,IAAMC,EAAM,IAAIC,EAAS,GAAG,OAAO,EAAE,EACrC,OAAQA,EAAR,CACE,IAAK,WACH,OAAON,EAAG,IAAIK,CAAG,EACnB,IAAK,UACH,OAAOL,EAAG,OAAOK,CAAG,EACtB,IAAK,OACH,OAAOL,EAAG,KAAKA,EAAG,IAAIK,CAAG,CAAC,EAC5B,QACE,OAAOA,CACX,CACF,CC3BWP,EAAO,MAAM,GAAG,EAClBA,EAAO,IAAI,GAAG,EACZA,EAAO,OAAO,GAAG,EACpBA,EAAO,KAAK,GAAG,EAIvB,SAAgBS,EAAM,EAAqB,CACzCR,EAAM,MAAMD,EAAO,OAAOA,EAAO,MAAM,IAAIU,EAAM,EAAE,CAAC,CAAC,CACvD,CAGA,SAAgBC,EAAM,EAAuB,CAC3CV,EAAM,MAAMW,CAAO,CACrB,CAGA,SAASC,EAAa,EAAsB,CACtCZ,EAAM,SAASa,CAAK,IACtBb,EAAM,OAAO,sBAAsB,EACnC,QAAQ,KAAK,CAAC,EAElB,CAGA,eAAsBc,EAAK,EAKP,CAClB,IAAMD,EAAQ,MAAMb,EAAM,KAAKe,CAAW,EAE1C,OADAH,EAAaC,CAAK,EACXA,CACT,CAGA,eAAsBG,EAAU,EAIjB,CACb,IAAMH,EAAQ,MAAMb,EAAM,OAAOe,CAAW,EAE5C,OADAH,EAAaC,CAAK,EACXA,CACT,CAGA,eAAsBI,EAAe,EAKpB,CACf,IAAMJ,EAAQ,MAAMb,EAAM,YAAYe,CAAW,EAEjD,OADAH,EAAaC,CAAK,EACXA,CACT,CAGA,eAAsBK,EAAQ,EAKT,CACnB,IAAML,EAAQ,MAAMb,EAAM,QAAQe,CAAI,EAEtC,OADAH,EAAaC,CAAK,EACXA,CACT,CAGA,SAAgBM,GAAU,CACxB,OAAOnB,EAAM,QAAQ,CACvB,CAGA,MAAaoB,EAAMpB,EAAM"}
|