@forinda/kickjs-cli 8.8.0 → 8.9.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-BsXKM5QH.mjs → agent-docs-DUB-1Z6Q.mjs} +34 -13
- package/dist/{agent-docs-BsXKM5QH.mjs.map → agent-docs-DUB-1Z6Q.mjs.map} +1 -1
- package/dist/{agent-docs-DQksWOe5.mjs → agent-docs-bVMPt2m5.mjs} +33 -12
- package/dist/{build-Bnd_mk4h.mjs → build-C30mBgw6.mjs} +3 -3
- package/dist/{build-Bnd_mk4h.mjs.map → build-C30mBgw6.mjs.map} +1 -1
- package/dist/{build-DPUojF2G.mjs → build-xQXbdDpw.mjs} +2 -2
- package/dist/{builtins-BEBO5upe.mjs → builtins-CtpLZ4FY.mjs} +2 -2
- package/dist/{builtins-CJTP3xQj.mjs → builtins-DiWfXc-D.mjs} +115 -101
- package/dist/cli.mjs +2 -2
- package/dist/{config-ty1Nc3PN.mjs → config-YvIngROH.mjs} +2 -2
- package/dist/{config-F9g6CNDA.mjs → config-ZHuFjsKI.mjs} +3 -3
- package/dist/config-ZHuFjsKI.mjs.map +1 -0
- package/dist/{doctor-C8TAKn1d.mjs → doctor-CnsnRW7T.mjs} +4 -4
- package/dist/{doctor-C8TAKn1d.mjs.map → doctor-CnsnRW7T.mjs.map} +1 -1
- package/dist/{fs-BGHl3dHm.mjs → fs-Bm2St4gk.mjs} +1 -1
- package/dist/{fs-BB3QxPj8.mjs → fs-BvGbbHY0.mjs} +2 -2
- package/dist/{fs-BB3QxPj8.mjs.map → fs-BvGbbHY0.mjs.map} +1 -1
- package/dist/fullstack-B0g06sSQ.mjs +96 -0
- package/dist/fullstack-B0g06sSQ.mjs.map +1 -0
- package/dist/fullstack-CZ9XQYk-.mjs +95 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-C4Dl_s4-.mjs → plugin-BfdvW6_r.mjs} +2 -2
- package/dist/{plugin-Y7BoYk1K.mjs → plugin-Bs0soxrU.mjs} +2 -2
- package/dist/{project-3LsfnPLE.mjs → project-B_qDdkYQ.mjs} +89 -23
- package/dist/project-B_qDdkYQ.mjs.map +1 -0
- package/dist/{project-BIq7_Fzk.mjs → project-Bp-KfBNb.mjs} +88 -22
- package/dist/{project-root-CFrn6ftT.mjs → project-root-B9BrO1na.mjs} +3 -3
- package/dist/{project-root-CFrn6ftT.mjs.map → project-root-B9BrO1na.mjs.map} +1 -1
- package/dist/{project-root-BDRPMlb9.mjs → project-root-LYOxQHXp.mjs} +2 -2
- package/dist/{prompts-BJTp1w0l.mjs → prompts-BEAqcbPT.mjs} +2 -2
- package/dist/{prompts-BJTp1w0l.mjs.map → prompts-BEAqcbPT.mjs.map} +1 -1
- package/dist/{rolldown-runtime-OACgOwtl.mjs → rolldown-runtime-Da-NDvKz.mjs} +1 -1
- package/dist/{run-plugins-2DJy76gx.mjs → run-plugins-0AfIgIsZ.mjs} +89 -75
- package/dist/run-plugins-0AfIgIsZ.mjs.map +1 -0
- package/dist/{typegen-BBzX2LDz.mjs → typegen-BzgWveE_.mjs} +5 -5
- package/dist/{typegen-BBzX2LDz.mjs.map → typegen-BzgWveE_.mjs.map} +1 -1
- package/dist/{typegen-COAIhZZ4.mjs → typegen-up-UkaNc.mjs} +4 -4
- package/dist/{types-gy6PkRFW.mjs → types-ChFFRT8E.mjs} +1 -1
- package/package.json +3 -3
- package/templates/base/files/src/serverless.ts +6 -0
- package/templates/host-config/files/netlify.toml +1 -1
- package/templates/template-inertia/files/src/index.ts +4 -2
- package/templates/template-inertia/files/vite.client.config.ts +14 -3
- package/templates/template-inertia/files/vite.config.ts +9 -5
- package/dist/config-F9g6CNDA.mjs.map +0 -1
- package/dist/fullstack-D25STbVk.mjs +0 -95
- package/dist/fullstack-DWcfo-zl.mjs +0 -96
- package/dist/fullstack-DWcfo-zl.mjs.map +0 -1
- package/dist/project-3LsfnPLE.mjs.map +0 -1
- package/dist/run-plugins-2DJy76gx.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.9.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,39 +8,105 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{a as e,t}from"./config-
|
|
11
|
+
import{a as e,t}from"./config-YvIngROH.mjs";import{r as n}from"./fs-Bm2St4gk.mjs";import{existsSync as r,readFileSync as i,readdirSync as a,statSync as o,writeFileSync as s}from"node:fs";import{dirname as c,join as l,resolve as u,sep as d}from"node:path";import{fileURLToPath as f}from"node:url";import{execFile as p,execFileSync as m,execSync as h,spawnSync as g}from"node:child_process";import{promisify as _}from"node:util";import{randomBytes as v}from"node:crypto";import{parseSync as y}from"oxc-parser";const b=_(p),x=/[&|<>^"'`(){}[\];!%\r\n\\]/;function S(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(x.test(e)||t.some(e=>x.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 C(e,t,n={}){let r=S(e,t);if(!r)return null;try{return m(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 w(e,t,n={}){let r=S(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);m(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function ee(e,t,n){h(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function te(e,t,n){let r=g(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=S(e,t);if(!r)return null;try{let{stdout:e}=await b(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 T=c(f(import.meta.url)),E=[l(T,`..`,`templates`),l(T,`..`,`..`,`templates`)].find(e=>r(l(e,`base`)));function re(e){return e.split(`/`).map(e=>e.startsWith(`_dot_`)?`.${e.slice(5)}`:e).join(`/`)}function D(e,t={}){let n=t.templatesDir??E,s=/* @__PURE__ */ new Map,c=[],u=[],f={},p=[],m={};for(let t of e){let e=l(n,t);if(!r(e))throw Error(`Unknown scaffold layer "${t}" (${e})`);let h=l(e,`feature.json`);if(r(h)){let e=JSON.parse(i(h,`utf-8`));c.push(...e.dependencies??[]),u.push(...e.devDependencies??[]),Object.assign(f,e.builds),p.push(...e.integrations??[]),Object.assign(m,e.scripts)}let g=l(e,`files`);if(r(g))for(let e of a(g,{recursive:!0,encoding:`utf-8`}).toSorted()){let t=l(g,e);if(!o(t).isFile())continue;let n=i(t,`utf-8`),r=re(e.split(d).join(`/`));if(r.endsWith(`.append`)){let e=r.slice(0,-7);s.set(e,(s.get(e)??``)+n)}else s.set(r,n)}}p.push(...t.extra??[]);let h=t.vars??{},g=e=>e.replace(/\{\{(\w+)\}\}/g,(e,t)=>h[t]??e);for(let[e,t]of s)t.includes(`// @kick:`)&&s.set(e,ie(t,p,g));return{files:s,dependencies:[...new Set(c)],devDependencies:[...new Set(u)],builds:f,integrations:p,scripts:m}}function O(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 k=/^([ \t]*)\/\/ @kick:([\w-]+)[ \t]*$/;function ie(e,t,n=e=>e){let r=e.split(`
|
|
12
12
|
`),i=new Set(r.map(e=>k.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=k.exec(r[e]);if(!t){o.push(r[e]);continue}let[,i,s]=t,c=s===`imports`?oe(a.flatMap(e=>e.import?[e.import]:[])):a.filter(e=>e.slot===s&&e.code).map(e=>ae(`${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
13
|
`)}function ae(e,t){return e.split(`
|
|
14
14
|
`).map(e=>e&&t+e).join(`
|
|
15
15
|
`)}function oe(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}'`})}
|
|
16
|
+
`)}\n} from '${e}'`})}const A=`node:22-slim`,se={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:A,setup:`RUN corepack enable`},npm:{lockfile:`package-lock.json`,installFiles:[],install:`npm ci`,installProd:`npm ci --omit=dev`,run:e=>`npm run ${e}`,image:A},yarn:{lockfile:`yarn.lock`,installFiles:[],install:`yarn install --frozen-lockfile`,installProd:`yarn install --production --frozen-lockfile`,run:e=>`yarn run ${e}`,image:A,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`}},ce={api:`docker run -p 3000:3000 <name>`,inertia:`docker run -p 3000:3000 -e SESSION_SECRET=<a long random string> <name>`,fullstack:`docker run -p 3000:3000 <name>`};function j(e,t,n){let r=se[t],i=r.setup?`\n${r.setup}`:``,a=(e===`fullstack`?[`package.json`,r.lockfile,...r.installFiles,`server/package.json`,`web/package.json`]:[`package.json`,r.lockfile,...r.installFiles]).map(e=>`COPY ${e} ./${e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)+1):``}`).join(`
|
|
17
|
+
`),o=`# syntax=docker/dockerfile:1
|
|
18
|
+
# ${n} — the long-running server in one image.
|
|
19
|
+
#
|
|
20
|
+
# docker build -t ${n} .
|
|
21
|
+
# ${ce[e].replace(`<name>`,n)}
|
|
22
|
+
#
|
|
23
|
+
# Environment comes from the platform or \`docker run\`; .env files are not
|
|
24
|
+
# copied into the image. The lockfile must be committed — installs are frozen.
|
|
25
|
+
`;if(e===`fullstack`)return`${o}
|
|
26
|
+
FROM ${r.image} AS base
|
|
27
|
+
WORKDIR /app${i}
|
|
28
|
+
|
|
29
|
+
# Production dependencies of every workspace member.
|
|
30
|
+
FROM base AS deps
|
|
31
|
+
${a}
|
|
32
|
+
RUN ${r.installProd}
|
|
33
|
+
# Hoisting may leave a member without its own node_modules; the runtime copies both.
|
|
34
|
+
RUN mkdir -p node_modules server/node_modules
|
|
35
|
+
|
|
36
|
+
# The server bundle and the built web app.
|
|
37
|
+
FROM base AS build
|
|
38
|
+
${a}
|
|
39
|
+
RUN ${r.install}
|
|
40
|
+
COPY . .
|
|
41
|
+
RUN ${r.run(`build`)}
|
|
42
|
+
|
|
43
|
+
FROM ${A}
|
|
44
|
+
ENV NODE_ENV=production PORT=3000
|
|
45
|
+
WORKDIR /app
|
|
46
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
47
|
+
COPY --from=deps /app/server/node_modules ./server/node_modules
|
|
48
|
+
COPY --from=build /app/package.json ./
|
|
49
|
+
COPY --from=build /app/server/package.json ./server/
|
|
50
|
+
COPY --from=build /app/server/dist ./server/dist
|
|
51
|
+
# SpaAdapter serves ../web/dist relative to the server.
|
|
52
|
+
COPY --from=build /app/web/dist ./web/dist
|
|
53
|
+
WORKDIR /app/server
|
|
54
|
+
USER node
|
|
55
|
+
EXPOSE 3000
|
|
56
|
+
CMD ["node", "dist/index.js"]
|
|
57
|
+
`;let s=e===`inertia`?`# The server, the pages (dist/client) and the SSR bundle (dist/ssr).`:`# The server bundle.`;return`${o}
|
|
58
|
+
FROM ${r.image} AS base
|
|
59
|
+
WORKDIR /app${i}
|
|
60
|
+
|
|
61
|
+
FROM base AS deps
|
|
62
|
+
${a}
|
|
63
|
+
RUN ${r.installProd}
|
|
64
|
+
|
|
65
|
+
${s}
|
|
66
|
+
FROM base AS build
|
|
67
|
+
${a}
|
|
68
|
+
RUN ${r.install}
|
|
69
|
+
COPY . .
|
|
70
|
+
RUN ${r.run(`build`)}
|
|
71
|
+
|
|
72
|
+
FROM ${A}
|
|
73
|
+
ENV NODE_ENV=production PORT=3000
|
|
74
|
+
WORKDIR /app
|
|
75
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
76
|
+
COPY --from=build /app/package.json ./
|
|
77
|
+
COPY --from=build /app/dist ./dist
|
|
78
|
+
USER node
|
|
79
|
+
EXPOSE 3000
|
|
80
|
+
CMD ["node", "dist/index.js"]
|
|
81
|
+
`}function M(){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(`
|
|
82
|
+
`)}\n`}function le(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 N(e,t){return Object.fromEntries(e.toSorted().map(e=>[e,le(t,e)]))}function P(e){try{let t=m(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 ue(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`,"build:netlify":`kick build && kick build:netlify`,"build:vercel":`kick build && kick build:vercel`,...n.scripts},dependencies:N(n.dependencies,t),devDependencies:N(n.devDependencies,t)},null,2)}function de(e,t){let n=Object.entries(t);if(n.length===0)return e;let r=e===``?[]:e.replace(/\n$/,``).split(`
|
|
17
83
|
`),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(`
|
|
18
|
-
`)}\n`}const
|
|
19
|
-
`).find(e=>e.trim()&&!e.trim().startsWith(`//`));return/^\s*([A-Za-z_$][\w$.]*)\s*\(/.exec(t??``)?.[1]}const
|
|
20
|
-
`).find(e=>e.trim()&&!e.trim().startsWith(`//`))?.trim()??e,
|
|
21
|
-
`,t-1)+1))[0],
|
|
84
|
+
`)}\n`}const fe={adapter:`adapters`,middleware:`middlewares`};function pe(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)continue;let t=fe[e.slot],a=n(e.code),o=ge(a),s=y(r,i.source).program,c=t?me(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?he(s,e.import.from,o):o;l&&u&&i.source.slice(l.value.start,l.value.end).includes(`${u}(`)?i.present.push(o??F(a)):(i.source=l?_e(i.source,l.value,a):ve(i.source,c,t,a),e.import&&(i.source=ye(i.source,e.import,r)),i.added.push(o??F(a)))}return i}function me(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 he(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 ge(e){let t=e.split(`
|
|
85
|
+
`).find(e=>e.trim()&&!e.trim().startsWith(`//`));return/^\s*([A-Za-z_$][\w$.]*)\s*\(/.exec(t??``)?.[1]}const F=e=>e.split(`
|
|
86
|
+
`).find(e=>e.trim()&&!e.trim().startsWith(`//`))?.trim()??e,I=(e,t)=>/^[ \t]*/.exec(e.slice(e.lastIndexOf(`
|
|
87
|
+
`,t-1)+1))[0],L=(e,t)=>e.split(`
|
|
22
88
|
`).map(e=>e&&t+e).join(`
|
|
23
|
-
`);function
|
|
24
|
-
`).filter(Boolean).map(e=>e.slice(3))}catch{return[]}}async function
|
|
25
|
-
`).map(e=>
|
|
26
|
-
`).filter(e=>e.trim()&&!u.has(
|
|
89
|
+
`);function _e(e,t,n){let r=t.elements.filter(Boolean),i=I(e,t.start);if(r.length===0){let r=L(`${n},`,`${i} `);return`${e.slice(0,t.start)}[\n${r}\n${i}]${e.slice(t.end)}`}let a=r.at(-1),o=I(e,a.start),s=e.slice(a.end,t.end-1).match(/^\s*,/),c=s?a.end+s[0].length:a.end,l=`\n${L(`${n},`,o)}`;return s?e.slice(0,c)+l+e.slice(c):`${e.slice(0,c)},${l.replace(/,$/,``)}${e.slice(c)}`}function ve(e,t,n,r){let i=t.properties.at(-1),a=i?I(e,i.start):`${I(e,t.start)} `,o=`${a}${n}: [\n${L(`${r},`,`${a} `)}\n${a}],`;if(!i)return`${e.slice(0,t.start)}{\n${o}\n${I(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 ye(e,t,n=`src/index.ts`){let r=y(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 be={swagger:`feature-swagger`,devtools:`feature-devtools`,ws:`feature-ws`,queue:`feature-queue`,"queue:bullmq":`feature-queue`};function xe(e){let t=[...new Set(e.map(e=>be[e]).filter(Boolean))];return t.length>0?D(t):void 0}function Se(e,t){return(t?[t]:[`src/index.ts`,`src/main.ts`]).find(t=>r(l(e,t)))}function Ce(e,t){try{return m(`git`,[`status`,`--porcelain`,`--`,...t],{cwd:e,encoding:`utf-8`,stdio:[`ignore`,`pipe`,`ignore`]}).split(`
|
|
90
|
+
`).filter(Boolean).map(e=>e.slice(3))}catch{return[]}}async function we(e,t){let a=[];for(let[o,s]of t){let t=l(e,o);if(!r(t)){await n(t,s),a.push(o);continue}let c=i(t,`utf-8`),u=new Set(c.split(`
|
|
91
|
+
`).map(e=>R(e)??e)),d=s.split(`
|
|
92
|
+
`).filter(e=>e.trim()&&!u.has(R(e)??e));if(d.length===0)continue;let f=c===``||c.endsWith(`
|
|
27
93
|
`)?``:`
|
|
28
94
|
`;await n(t,`${c}${f}${d.join(`
|
|
29
|
-
`)}\n`),a.push(o)}return a}const
|
|
30
|
-
`)}const
|
|
95
|
+
`)}\n`),a.push(o)}return a}const R=e=>/^\s*([A-Za-z_][\w]*)\s*=/.exec(e)?.[1];async function Te(e,t,r){let a=l(e,t),o=i(a,`utf-8`),s=pe(o,r,z(e),t);return s.source!==o&&await n(a,s.source),s}function z(e){let t=Ee(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 Ee(e){try{return JSON.parse(i(l(e,`package.json`),`utf-8`))}catch{return{}}}function De(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(`
|
|
96
|
+
`)}const B={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`],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}},Oe=Object.entries(B).filter(([e,t])=>!t.core&&!t.deprecated&&!e.includes(`:`)&&![`pg`,`sqlite`,`mysql`,`zod`,`valibot`,`yup`].includes(e)).map(([e])=>e).join(`, `),V={express:[`express`],fastify:[`fastify`,`@fastify/middie`,`serve-static`],h3:[`h3@^2`,`serve-static`]},H={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 U(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 W(e=process.cwd()){return(await G(e)).runtime}async function G(t=process.cwd()){let n=(await e(t))?.runtime;return n===`express`||n===`fastify`||n===`h3`?{runtime:n,candidates:[n],ambiguous:!1,fromConfig:!0}:{...ke(t),fromConfig:!1}}const K=[[`express`,`express`],[`fastify`,`fastify`],[`h3`,`h3`]];function ke(e=process.cwd()){let t=q(`package.json`,e);if(!t)return{runtime:`express`,candidates:[],ambiguous:!1};let n={},r={};try{let e=JSON.parse(i(u(t,`package.json`),`utf-8`));n=e.dependencies??{},r=e.devDependencies??{}}catch{return{runtime:`express`,candidates:[],ambiguous:!1}}let a=K.filter(([e])=>e in n).map(([,e])=>e),o=K.filter(([e])=>e in r&&!(e in n)).map(([,e])=>e),s=[...a,...o];return a.length===1?{runtime:a[0],candidates:s,ambiguous:!1}:a.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 q(e,t=process.cwd()){let n=t;for(;;){if(r(u(n,e)))return n;let t=c(n);if(t===n)return null;n=t}}function Ae(){return q(`pnpm-lock.yaml`)?`pnpm`:q(`yarn.lock`)?`yarn`:q(`bun.lockb`)||q(`bun.lock`)?`bun`:q(`package-lock.json`)?`npm`:null}function je(){let e=process.cwd();for(;e;){let n=u(e,`package.json`);if(r(n))try{let e=JSON.parse(i(n,`utf-8`)).packageManager;if(typeof e==`string`){let n=e.split(`@`)[0];if(t.includes(n))return n}}catch{}let a=c(e);if(a===e)return null;e=a}return null}async function J(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=je();if(i)return{pm:i,source:`package.json`};let a=Ae();return a?{pm:a,source:`lockfile`}:{pm:`npm`,source:`default`}}async function Me(e){let{pm:t}=await J(e);return t}function Y(e=!1,t){let n=Object.entries(B),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,...V[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(`
|
|
31
97
|
Core packages (always installed by \`kick new\`):
|
|
32
98
|
`);for(let e of i)console.log(o(e));if(e){console.log(`
|
|
33
99
|
Optional packages (add as needed):
|
|
34
100
|
`);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(`
|
|
35
|
-
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
|
|
36
|
-
`),p.length===0&&m.length===0))return;let y={...
|
|
37
|
-
`);else{for(let e of await
|
|
38
|
-
`),console.log(
|
|
101
|
+
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 Ne={"@swc/core":!0,esbuild:!0};function X(e,t,n){if(e===`pnpm`){let e=u(t,`pnpm-workspace.yaml`),a=r(e)?i(e,`utf-8`):``,o=de(a,n);return o===a?void 0:(s(e,o),e)}if(e!==`npm`&&e!==`bun`)return;let a=u(t,`package.json`);if(!r(a))return;let o=JSON.parse(i(a,`utf-8`)),c=!1;if(e===`npm`){let e=o.allowScripts??{};for(let[t,r]of Object.entries(n))Object.keys(e).some(e=>e===t||e.startsWith(`${t}@`))||(e[t]=r,c=!0);o.allowScripts=e}else{let e=o.trustedDependencies??[];for(let[t,r]of Object.entries(n))r&&!e.includes(t)&&(e.push(t),c=!0);o.trustedDependencies=e}if(c)return s(a,`${JSON.stringify(o,null,2)}\n`),a}function Pe(e){if(e===`pnpm`)return q(`pnpm-workspace.yaml`)??process.cwd();for(let e=process.cwd();;e=c(e)){try{if(JSON.parse(i(u(e,`package.json`),`utf-8`)).workspaces)return e}catch{}if(c(e)===e)return process.cwd()}}function Z(e){return Object.assign({},...e.map(e=>B[e]?.builds??{}))}function Fe(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=H[n];s.push(`upload (${n}): ${e.note}`),e.prod&&(t?i:r).add(e.prod),e.dev&&i.add(e.dev);continue}let e=B[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=V[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 Ie(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=>{Y(!!e.all,U(e.runtime)??await W())})}function Le(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){Y(!!t.all,U(t.runtime)??await W());return}let{pm:n,source:i}=await J(t.pm);console.log(`\n Using ${n} (resolved from ${i})`);let a=U(t.runtime),o=await G(process.cwd()),s=a??o.runtime;if(!a&&o.ambiguous){console.error(`\n Cannot tell which HTTP engine this app boots on: found ${o.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 <${o.candidates.join(`|`)}> for this command\n`),process.exitCode=1;return}let c=Fe(e,!!t.dev,s),{unknown:l,warnings:d,notices:f}=c,{prodDeps:p,devDeps:m}=c,g=process.cwd();if(t.entry&&!r(u(g,t.entry))){console.error(`\n --entry ${t.entry} does not exist.\n`),process.exitCode=1;return}let _=t.wire===!1?void 0:xe(e),v=_?Se(g,t.entry):void 0;if(_){p=[.../* @__PURE__ */ new Set([...p,..._.dependencies])],m=[...new Set([...m,..._.devDependencies].filter(e=>!p.includes(e)))];let e=Ce(g,[...v?[v]:[],..._.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 or stash first, pass --force to edit anyway, or --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(l.length>0&&(console.log(`\n Unknown packages: ${l.join(`, `)}`),console.log(` Run "kick add --list" to see available packages.
|
|
102
|
+
`),p.length===0&&m.length===0))return;let y={...Z(e),..._?.builds};if(Object.keys(y).length>0){let e=X(n,Pe(n),y);e&&console.log(`\n Approved install scripts in ${e}`)}let b=!0;if(p.length>0){let e=p,t=`${n} add ${e.join(` `)}`;console.log(`\n Installing ${e.length} dependency(ies):`);for(let t of e)console.log(` + ${t}`);console.log();try{h(t,{stdio:`inherit`})}catch{b=!1,console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(m.length>0){let e=m,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{h(t,{stdio:`inherit`})}catch{b=!1,console.log(`\n Installation failed. Run manually:\n ${t}\n`)}}if(_){if(!b)console.log(` Skipped wiring — the install did not finish.
|
|
103
|
+
`);else{for(let e of await we(g,_.files))console.log(` Updated ${e}`);let e=v?await Te(g,v,_.integrations):void 0;for(let t of e?.added??[])console.log(` Added ${t} to ${v}`);for(let t of e?.present??[])console.log(` ${t} is already in ${v}`);let t=z(g),n=e?e.manual:_.integrations.filter(e=>e.slot&&e.code).map(e=>({...e,code:t(e.code)}));n.length>0&&(console.log(`\n ${v?`Could not find bootstrap({ adapters: [...] }) in ${v}`:`No entry file found`} — add this yourself:
|
|
104
|
+
`),console.log(De(n).replace(/^/gm,` `)),console.log())}}b?console.log(` Done!
|
|
39
105
|
`):(console.log(` Finished with errors — the install above did not complete.
|
|
40
|
-
`),process.exitCode=1)})}const
|
|
41
|
-
`)});for(let[e,t]of b)await n(l(f,e),t);let{generateAgentDocs:x}=await import(`./agent-docs-
|
|
42
|
-
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${a} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-
|
|
43
|
-
Project scaffolded successfully!`),console.log();let C=f!==process.cwd();p(`Next steps:`),C&&p(` cd ${t}`),e.installDeps||p(` ${a} install`);let w={rest:`kick g module user`,minimal:`# add your routes to src/index.ts`,inertia:`# pages: src/modules/pages + src/client/pages`};return p(` ${w[o]??w.rest}`),p(` kick dev`),p(``),p(`Commands:`),p(` kick dev Start dev server with Vite HMR`),p(` kick build Production build via Vite`),p(` kick start Run production build`),p(``),p(`Generators:`),p(` kick g module <name> REST module (controller, service, DTOs, repository)`),p(` kick g scaffold <n> <f..> CRUD module from field definitions`),p(` kick g controller <name> Standalone controller`),p(` kick g service <name> @Service() class`),p(` kick g middleware <name> Global connect-style middleware`),p(` kick g guard <name> Route guard (auth, roles, etc.)`),p(` kick g adapter <name> AppAdapter with lifecycle hooks`),p(` kick g dto <name> DTO schema (Zod / Valibot / Yup)`),p(` kick g config Generate kick.config.ts`),p(``),p(`Add packages:`),p(` kick add <pkg> Install a KickJS package + peers`),p(` kick add --list Show all available packages`),p(``),p(`Available: ${
|
|
106
|
+
`),process.exitCode=1)})}const Q=c(f(import.meta.url)),$=JSON.parse(i([l(Q,`..`,`package.json`),l(Q,`..`,`..`,`package.json`)].find(r),`utf-8`)),Re=[`@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`],ze={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 Be(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 Ve(e){return e===`@forinda/kickjs-cli`?`^${$.version}`:`latest`}async function He(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 Ue(){let e=[...Re.map(e=>({name:e,fallback:Ve(e),cap:void 0})),...Object.entries(ze).map(([e,t])=>({name:e,...t}))],t=Date.now()+2e4,n=await He(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=Be(await ne(`npm`,r?[`view`,a,`version`,`--json`]:[`view`,a,`version`],{timeout:i}));return[e,o?`^${o}`:n]});return Object.fromEntries(n)}function We(e,t){let n=C(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function Ge(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function Ke(e,t){let n=e=>Ge(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 qe(e,t,n){let r=C(`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 Je(e){let{name:t,directory:i,packageManager:a=`pnpm`,template:o=`rest`,defaultRepo:s=`inmemory`,packages:c=[],schemaLib:u=`zod`,runtime:d=`express`}=e,f=i,p=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${t}\n`),e.versions||p(`Resolving package versions...`);let m=e.versions??await Ue(),g=Object.keys(m).filter(e=>m[e]===`latest`);if(g.length>0&&p(`WARNING: could not reach npm for ${g.join(`, `)} — pinned to 'latest'`),d!==`express`){if(qe(`@forinda/kickjs`,`latest`,`./${d}`))p(`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=We(r,`alpha`);e&&Ke(e,Ge(m[r]))&&(m[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}p(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`)}}let _=c.filter(e=>!r(l(E,`feature-${e}`)));_.length>0&&p(`WARNING: skipping unknown package(s): ${_.join(`, `)} — add them later with kick add`);let y=D([...Xe({template:o,runtime:d,schemaLib:u,packages:c}),...e.platformConfig===!1?[]:[`host-config`],...e.extraLayers??[]],{vars:{name:t,version:$.version},extra:[{slot:`repo`,code:s===`inmemory`?`repo: 'inmemory'`:`repo: { name: '${s.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)}' }`},...e.spaClientDir?[Ye(e.spaClientDir)]:[]]});await n(l(f,`package.json`),ue(t,m,y,e.platformConfig===!1?void 0:P(a)));let b=O(y.files,{name:t,template:o,runtime:d,packageManager:a,netlifyPublish:o===`inertia`?`dist/client`:`dist/public`,templateLabel:{rest:`REST API`,minimal:`Minimal`,inertia:`Inertia (React)`}[o],sessionSecret:v(32).toString(`hex`),packages:[...y.dependencies,...y.devDependencies].filter(e=>e.startsWith(`@forinda/`)).map(e=>`- \`${e}\``).join(`
|
|
107
|
+
`)});for(let[e,t]of b)await n(l(f,e),t);if(e.platformConfig!==!1){let e=o===`inertia`?`inertia`:`api`;await n(l(f,`Dockerfile`),j(e,a,t)),await n(l(f,`.dockerignore`),M())}let{generateAgentDocs:x}=await import(`./agent-docs-bVMPt2m5.mjs`).then(e=>e.t);await x({outDir:f,name:t,pm:a,template:o,only:`all`,force:!0});let S={...Ne,...Z(c),...y.builds};if(e.approveInstallScripts!==!1&&X(a,f,S),e.installDeps){console.log(`\n Installing dependencies with ${a}...\n`);try{h(`${a} install`,{cwd:f,stdio:`inherit`}),console.log(`
|
|
108
|
+
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${a} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-up-UkaNc.mjs`).then(e=>e.n);await e({cwd:f,allowDuplicates:!0,silent:!0})}catch{}if(e.initGit)try{h(`git init`,{cwd:f,stdio:`pipe`}),h(`git branch -M main`,{cwd:f,stdio:`pipe`}),h(`git add -A`,{cwd:f,stdio:`pipe`}),h(`git commit -m "chore: initial commit from kick new"`,{cwd:f,stdio:`pipe`}),p(`Git repository initialized`)}catch{p(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
109
|
+
Project scaffolded successfully!`),console.log();let C=f!==process.cwd();p(`Next steps:`),C&&p(` cd ${t}`),e.installDeps||p(` ${a} install`);let w={rest:`kick g module user`,minimal:`# add your routes to src/index.ts`,inertia:`# pages: src/modules/pages + src/client/pages`};return p(` ${w[o]??w.rest}`),p(` kick dev`),p(``),p(`Commands:`),p(` kick dev Start dev server with Vite HMR`),p(` kick build Production build via Vite`),p(` kick start Run production build`),p(``),p(`Generators:`),p(` kick g module <name> REST module (controller, service, DTOs, repository)`),p(` kick g scaffold <n> <f..> CRUD module from field definitions`),p(` kick g controller <name> Standalone controller`),p(` kick g service <name> @Service() class`),p(` kick g middleware <name> Global connect-style middleware`),p(` kick g guard <name> Route guard (auth, roles, etc.)`),p(` kick g adapter <name> AppAdapter with lifecycle hooks`),p(` kick g dto <name> DTO schema (Zod / Valibot / Yup)`),p(` kick g config Generate kick.config.ts`),p(``),p(`Add packages:`),p(` kick add <pkg> Install a KickJS package + peers`),p(` kick add --list Show all available packages`),p(``),p(`Available: ${Oe}`),p(``),{builds:S}}function Ye(e){return{import:{from:`@forinda/kickjs/spa`,names:[`SpaAdapter`]},slot:`adapter`,code:`// Serves the built frontend from this origin in production.
|
|
44
110
|
// Inert until the client build exists, so \`kick dev\` (where Vite
|
|
45
111
|
// serves the client and proxies /api here) is unaffected.
|
|
46
|
-
SpaAdapter({ clientDir: ${JSON.stringify(e)} })`}}function
|
|
112
|
+
SpaAdapter({ clientDir: ${JSON.stringify(e)} })`}}function Xe(e){return[`base`,`template-${e.template}`,`runtime-${e.runtime}`,`schema-${e.schemaLib}`,...e.packages.filter(e=>r(l(E,`feature-${e}`))).map(e=>`feature-${e}`)]}export{ee as _,X as a,W as c,j as d,M as f,te as g,w as h,H as i,Me as l,D as m,Ue as n,Le as o,O as p,B as r,Ie as s,Je as t,P as u};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.9.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{t as e}from"./rolldown-runtime-
|
|
12
|
-
//# sourceMappingURL=project-root-
|
|
11
|
+
import{t as e}from"./rolldown-runtime-Da-NDvKz.mjs";import{dirname as t,parse as n,resolve as r}from"node:path";import{existsSync as i}from"node:fs";var a=/* @__PURE__ */ e({findProjectRoot:()=>s});const o=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];function s(e=process.cwd()){let a=r(e),{root:s}=n(a),c=null,l=a;for(;;){for(let e of o)if(i(r(l,e)))return l;if(c===null&&i(r(l,`package.json`))&&(c=l),l===s)break;let e=t(l);if(e===l)break;l=e}return c??a}export{a as n,s as t};
|
|
12
|
+
//# sourceMappingURL=project-root-B9BrO1na.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-root-
|
|
1
|
+
{"version":3,"file":"project-root-B9BrO1na.mjs","names":["__exportAll","project_root_exports","findProjectRoot","CONFIG_FILENAMES","start","resolve","startDir","fsRoot","parse","firstPackageJson","cursor","name","existsSync","parent","dirname"],"sources":["../src/utils/project-root.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { dirname, parse, resolve } from 'node:path'\n\nconst CONFIG_FILENAMES = ['kick.config.ts', 'kick.config.js', 'kick.config.mjs', 'kick.config.json']\n\n/**\n * Walk up from `startDir` looking for the project root. A directory\n * counts as the root when it contains any of:\n * - `kick.config.{ts,js,mjs,json}` (strongest signal)\n * - `package.json` (fallback when no config file exists yet)\n *\n * Returns the absolute path of the first matching directory, or\n * `startDir` itself when nothing was found (no surprises — callers\n * that didn't find a config still get a reasonable cwd).\n *\n * `kick.config.*` wins over `package.json` when both appear at\n * different levels, so adopters running `kick typegen` from `src/`\n * land on the project root that owns the config, not on the nearest\n * workspace package boundary in a monorepo.\n */\nexport function findProjectRoot(startDir: string = process.cwd()): string {\n const start = resolve(startDir)\n const { root: fsRoot } = parse(start)\n\n let firstPackageJson: string | null = null\n let cursor = start\n while (true) {\n for (const name of CONFIG_FILENAMES) {\n if (existsSync(resolve(cursor, name))) return cursor\n }\n if (firstPackageJson === null && existsSync(resolve(cursor, 'package.json'))) {\n firstPackageJson = cursor\n }\n if (cursor === fsRoot) break\n const parent = dirname(cursor)\n if (parent === cursor) break\n cursor = parent\n }\n\n return firstPackageJson ?? start\n}\n"],"mappings":";;;;;;;;;;sMAGA,MAAMG,EAAmB,CAAC,iBAAkB,iBAAkB,kBAAmB,kBAAkB,EAiBnG,SAAgBD,EAAgB,EAAmB,QAAQ,IAAI,EAAW,CACxE,IAAME,EAAQC,EAAQC,CAAQ,EACxB,CAAE,KAAMC,GAAWC,EAAMJ,CAAK,EAEhCK,EAAkC,KAClCC,EAASN,EACb,OAAa,CACX,IAAK,IAAMO,KAAQR,EACjB,GAAIS,EAAWP,EAAQK,EAAQC,CAAI,CAAC,EAAG,OAAOD,EAKhD,GAHID,IAAqB,MAAQG,EAAWP,EAAQK,EAAQ,cAAc,CAAC,IACzE,EAAmBA,GAEjBA,IAAWH,EAAQ,MACvB,IAAMM,EAASC,EAAQJ,CAAM,EAC7B,GAAIG,IAAWH,EAAQ,MACvB,EAASG,CACX,CAEA,OAAOJ,GAAoBL,CAC7B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.9.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{t as e}from"./rolldown-runtime-
|
|
11
|
+
import{t as e}from"./rolldown-runtime-Da-NDvKz.mjs";import{existsSync as t}from"node:fs";import{dirname as n,parse as r,resolve as i}from"node:path";var a=/* @__PURE__ */ e({findProjectRoot:()=>s});const o=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];function s(e=process.cwd()){let a=i(e),{root:s}=r(a),c=null,l=a;for(;;){for(let e of o)if(t(i(l,e)))return l;if(c===null&&t(i(l,`package.json`))&&(c=l),l===s)break;let e=n(l);if(e===l)break;l=e}return c??a}export{a as n,s as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.
|
|
2
|
+
* @forinda/kickjs-cli v8.9.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
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-
|
|
12
|
+
//# sourceMappingURL=prompts-BEAqcbPT.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts-
|
|
1
|
+
{"version":3,"file":"prompts-BEAqcbPT.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"}
|