@forinda/kickjs-cli 6.10.0 → 6.11.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-CLs1wTpl.mjs → agent-docs-CMTPB5b9.mjs} +3 -3
- package/dist/{agent-docs-CLs1wTpl.mjs.map → agent-docs-CMTPB5b9.mjs.map} +1 -1
- package/dist/{agent-docs-BnGa_odb.mjs → agent-docs-DDEJGEjF.mjs} +2 -2
- package/dist/{build-BX7-8d5h.mjs → build-Ds8bLeuj.mjs} +2 -2
- package/dist/{build-BQUDhMVD.mjs → build-mQoYCV-T.mjs} +3 -3
- package/dist/{build-BQUDhMVD.mjs.map → build-mQoYCV-T.mjs.map} +1 -1
- package/dist/{builtins-DfzsCxQu.mjs → builtins-BikyDIrl.mjs} +58 -18
- package/dist/{builtins-DWngUnQ8.mjs → builtins-Cu07e0bx.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{config-DHHqXYVF.mjs → config-DosoCZJ5.mjs} +2 -2
- package/dist/{config-DYS_-oZ_.mjs → config-zmH4ySDu.mjs} +3 -3
- package/dist/{config-DYS_-oZ_.mjs.map → config-zmH4ySDu.mjs.map} +1 -1
- package/dist/{doctor-CC8eWifc.mjs → doctor-DO7cn-63.mjs} +12 -6
- package/dist/{doctor-CC8eWifc.mjs.map → doctor-DO7cn-63.mjs.map} +1 -1
- package/dist/{fullstack-BWopEQFU.mjs → fullstack-Bj-963OR.mjs} +4 -4
- package/dist/{fullstack-BWopEQFU.mjs.map → fullstack-Bj-963OR.mjs.map} +1 -1
- package/dist/{fullstack-1y-ENahw.mjs → fullstack-CM9oNR2P.mjs} +3 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-CrbgblqR.mjs → plugin-BZ9jndlf.mjs} +2 -2
- package/dist/{plugin-Dgdp1o7e.mjs → plugin-U3dKfUQu.mjs} +3 -3
- package/dist/{plugin-Dgdp1o7e.mjs.map → plugin-U3dKfUQu.mjs.map} +1 -1
- package/dist/{project-BFhosVpo.mjs → project-0Bkq9vh-.mjs} +25 -12
- package/dist/{project-docs-BEnHASsn.mjs → project-docs-1knu6M3m.mjs} +2 -2
- package/dist/{project-docs-BEnHASsn.mjs.map → project-docs-1knu6M3m.mjs.map} +1 -1
- package/dist/{project-docs-BlYdtsfz.mjs → project-docs-BMl8vjLA.mjs} +1 -1
- package/dist/{project-DPQJNbUr.mjs → project-g-SBqy-3.mjs} +30 -17
- package/dist/project-g-SBqy-3.mjs.map +1 -0
- package/dist/{project-root-CSfkrbTB.mjs → project-root-BKng_WIU.mjs} +2 -2
- package/dist/{project-root-74p4iEbS.mjs → project-root-os4Dkulr.mjs} +3 -3
- package/dist/{project-root-74p4iEbS.mjs.map → project-root-os4Dkulr.mjs.map} +1 -1
- package/dist/{prompts-kKPsD4J5.mjs → prompts-o3YVugwj.mjs} +2 -2
- package/dist/{prompts-kKPsD4J5.mjs.map → prompts-o3YVugwj.mjs.map} +1 -1
- package/dist/{rolldown-runtime-Wu10E8Jp.mjs → rolldown-runtime-D1ArRaud.mjs} +1 -1
- package/dist/{run-plugins-BPLz855M.mjs → run-plugins-CwsrWG_a.mjs} +39 -5
- package/dist/run-plugins-CwsrWG_a.mjs.map +1 -0
- package/dist/{typegen-ByZnBYdj.mjs → typegen-BiKNA1Uy.mjs} +4 -4
- package/dist/{typegen-ngGYyfaY.mjs → typegen-CZTRiLnc.mjs} +5 -5
- package/dist/{typegen-ngGYyfaY.mjs.map → typegen-CZTRiLnc.mjs.map} +1 -1
- package/dist/{types-BYbOAJ_d.mjs → types-DKPL6r3s.mjs} +1 -1
- package/package.json +4 -4
- package/dist/project-DPQJNbUr.mjs.map +0 -1
- package/dist/run-plugins-BPLz855M.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v6.
|
|
2
|
+
* @forinda/kickjs-cli v6.11.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{c as e,l as t,s as n}from"./project-docs-
|
|
11
|
+
import{c as e,l as t,s as n}from"./project-docs-1knu6M3m.mjs";import{a as r,c as i,d as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f,u as p}from"./prompts-o3YVugwj.mjs";import{A as m,C as h,D as g,E as _,F as v,M as y,N as b,O as x,P as S,S as C,T as ee,_ as te,a as ne,b as re,c as ie,f as ae,g as oe,h as se,i as ce,j as le,k as ue,l as de,m as fe,p as pe,r as me,u as w,v as he,w as ge,x as _e,y as ve}from"./doctor-DO7cn-63.mjs";import{a as ye,c as be,o as xe,r as Se,t as Ce,u as we}from"./project-g-SBqy-3.mjs";import{a as T,i as E,o as Te,s as Ee}from"./config-zmH4ySDu.mjs";import{t as De}from"./project-root-os4Dkulr.mjs";import{n as D}from"./types-DKPL6r3s.mjs";import{t as Oe}from"./build-mQoYCV-T.mjs";import{n as ke}from"./agent-docs-CMTPB5b9.mjs";import{n as O}from"./plugin-U3dKfUQu.mjs";import{a as Ae,c as je,d as Me,f as Ne,g as Pe,h as Fe,i as Ie,l as Le,m as Re,o as ze,p as Be,r as Ve,s as He,t as k,u as Ue}from"./typegen-CZTRiLnc.mjs";import A,{basename as We,dirname as j,join as M,relative as Ge,resolve as N,sep as Ke}from"node:path";import{cpSync as qe,existsSync as P,mkdirSync as Je,readFileSync as F,readdirSync as Ye,rmSync as Xe,writeFileSync as Ze}from"node:fs";import{copyFile as Qe,mkdir as I,readFile as L,readdir as $e,rm as et,stat as tt,writeFile as R}from"node:fs/promises";import{fork as nt,spawn as rt}from"node:child_process";import{fileURLToPath as it,pathToFileURL as z}from"node:url";import{arch as at,platform as ot,release as st}from"node:os";const ct=[{value:`swagger`,label:`Swagger`,hint:`OpenAPI docs`},{value:`ws`,label:`WebSocket`,hint:`rooms, heartbeat`},{value:`queue`,label:`Queue`,hint:`BullMQ/RabbitMQ/Kafka`},{value:`devtools`,label:`DevTools`,hint:`debug dashboard`}];function lt(e){e.command(`new [name]`).alias(`init`).description(`Create a new KickJS project (use "." for current directory)`).option(`-d, --directory <dir>`,`Target directory (defaults to project name)`).option(`--pm <manager>`,`Package manager: pnpm | npm | yarn | bun`).option(`--git`,`Initialize git repository`).option(`--no-git`,`Skip git initialization`).option(`--install`,`Install dependencies after scaffolding`).option(`--no-install`,`Skip dependency installation`).option(`-f, --force`,`Remove existing files without prompting`).option(`-t, --template <type>`,`Project template: rest | minimal | fullstack`).option(`--runtime <engine>`,`HTTP runtime: express | fastify | h3`).option(`-r, --repo <type>`,`Repository name (inmemory, or any DB name e.g. postgres)`).option(`-s, --schema <lib>`,`Schema library for env / DTOs: zod | valibot | yup (default: zod)`).option(`--packages <packages>`,`Comma-separated packages to include (e.g. auth,swagger,ws,queue)`).option(`-y, --yes`,`Pick safe defaults for every prompt (template=minimal, repo=inmemory, no extras, git+install on)`).option(`--non-interactive`,`alias for --yes`).action(async(e,t)=>{c(`KickJS — Create a new project`);let n=!!(t.yes||t.nonInteractive);e||=n?`my-api`:await i({message:`Project name`,placeholder:`my-api`,defaultValue:`my-api`});let a;if(e===`.`?(a=N(`.`),e=We(a)):a=N(t.directory||e),P(a)){let i=Ye(a);if(i.length>0){if(t.force)u.warn(`Clearing existing files in ${a}`);else if(n){u.warn(`Directory "${e}" is not empty. Pass --force to clear it.`),r(`Aborted.`);return}else{u.warn(`Directory "${e}" is not empty:`);let t=i.slice(0,5);for(let e of t)u.message(` - ${e}`);if(i.length>5&&u.message(` ... and ${i.length-5} more`),!await f({message:p.red(`Remove all existing files and proceed?`),initialValue:!1})){r(`Aborted.`);return}}for(let e of i)Xe(N(a,e),{recursive:!0,force:!0})}}let s=t.template;s||=n?`minimal`:await l({message:`Project template`,options:[{value:`rest`,label:`REST API`,hint:`Express + Swagger`},{value:`minimal`,label:`Minimal`,hint:`bare Express`},{value:`fullstack`,label:`Fullstack`,hint:`server + Vite React web, typed client`}]});let d=t.runtime;d||=n?`express`:await l({message:`HTTP runtime`,options:[{value:`express`,label:`Express`,hint:`default, zero-config`},{value:`fastify`,label:`Fastify`,hint:`fastify + @fastify/middie`},{value:`h3`,label:`h3`,hint:`Nitro / Nuxt engine`}]});let m=t.pm;m||=n?await be(void 0):await l({message:`Package manager`,options:[{value:`pnpm`,label:`pnpm`},{value:`npm`,label:`npm`},{value:`yarn`,label:`yarn`},{value:`bun`,label:`bun`}]});let h=t.repo;h||=n?`inmemory`:await i({message:`Repository name`,placeholder:`inmemory (or a DB name, e.g. postgres)`,defaultValue:`inmemory`}),Ee(h);let g=t.schema;g||=n?`zod`:await l({message:`Schema library (env + DTO validation)`,options:[{value:`zod`,label:`Zod`,hint:`default — broad ecosystem`},{value:`valibot`,label:`Valibot`,hint:`smaller bundle`},{value:`yup`,label:`Yup`,hint:`classic API`}]}),[`zod`,`valibot`,`yup`].includes(g)||(u.warn(`Unknown --schema "${g}", falling back to zod.`),g=`zod`);let _;if(t.packages!==void 0){let e=t.packages.trim().toLowerCase();_=e===``||e===`none`||e===`false`?[]:t.packages.split(`,`).map(e=>e.trim()).filter(Boolean)}else _=n?[]:await o({message:`Select packages to include`,options:[...ct],required:!1});let v;v=t.git===void 0?n?!0:await f({message:`Initialize git repository?`,initialValue:!0}):t.git;let y;if(y=t.install===void 0?n?!0:await f({message:`Install dependencies?`,initialValue:!0}):t.install,s===`fullstack`){let{initFullstackProject:t}=await import(`./fullstack-Bj-963OR.mjs`);await t({name:e,directory:a,packageManager:m,initGit:v,installDeps:y,schemaLib:g,runtime:d}),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${m}${m===`pnpm`?` dev`:` run dev:server`}`)}`);return}await Ce({name:e,directory:a,packageManager:m,initGit:v,installDeps:y,template:s,defaultRepo:h,packages:_,schemaLib:g,runtime:d}),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${m} dev`)}`)})}async function ut(e){let{name:n,outDir:r}=e,i=S(n),a=v(n),o=[],s=M(r,`${i}.plugin.ts`);return await t(s,`import {
|
|
12
12
|
definePlugin,
|
|
13
13
|
type AppAdapter,
|
|
14
14
|
type AppModuleEntry,
|
|
@@ -450,7 +450,41 @@ drop the entry.`,fix:`Open src/modules/index.ts and verify the module is in the
|
|
|
450
450
|
import { UserModule } from './users/user.module'
|
|
451
451
|
import { TaskModule } from './tasks/task.module' // ← was this missing?
|
|
452
452
|
|
|
453
|
-
export const modules: AppModuleEntry[] = [UserModule(), TaskModule()]`,docs:`https://kickjs.app/guide/project-structure.html`}}:null}}
|
|
453
|
+
export const modules: AppModuleEntry[] = [UserModule(), TaskModule()]`,docs:`https://kickjs.app/guide/project-structure.html`}}:null}},{match(e,t){if(!X(e,[`vitest`,`test`,`spec`,`__tests__`,`.test.`,`jest`]))return null;let n=X(e,[`wrong database`,`dev database`,`development database`,`production database`,`wrong db`,`dev db`,`connected to the wrong`,`wiped`,`truncated`,`deleted rows`,`sent a real email`,`real email`,`live api`]),r=X(e,[`stubenv`,`process.env`,`setupfiles`,`test.env`,`env override`])&&X(e,[`no effect`,`not applied`,`ignored`,`still`,`undefined`,`does nothing`,`doesn't work`,`not working`]);if(!n&&!r)return null;let i=t?.hasFile?.(`.env`)===!0||t?.hasFile?.(`.env.local`)===!0,a=t?.hasFile?.(`.env.test`)===!0||t?.hasFile?.(`.env.test.local`)===!0,o=i&&!a,s=n&&r?85:n?75:65;return o&&(s=Math.min(95,s+10)),{confidence:s,diagnosis:{id:`test-env-leaked-from-dotenv`,title:`Test run inherited env vars from your development .env`,explanation:`KickJS loads dotenv as an import-time side effect, with \`override: false\`.
|
|
454
|
+
That protects the vars your test runner pinned — but every var it did NOT
|
|
455
|
+
pin is silently backfilled from your \`.env\`. So a suite can pin its database
|
|
456
|
+
URL and still reach live development services through the vars it forgot,
|
|
457
|
+
and nothing in the run reports it.
|
|
458
|
+
|
|
459
|
+
The second symptom has the same root: \`loadEnv()\` parses process.env ONCE
|
|
460
|
+
into a module-level cache, and ConfigService.get() / @Value() read that
|
|
461
|
+
snapshot. A vi.stubEnv() in beforeAll runs long after the parse, so it is a
|
|
462
|
+
silent no-op for them (it still works for code reading process.env directly).
|
|
463
|
+
|
|
464
|
+
Under a test run (NODE_ENV=test, or vitest's VITEST), KickJS reads \`.env.test\`
|
|
465
|
+
if it exists — and only \`.env.test\`, with no fallback to \`.env\`. Falling
|
|
466
|
+
through is the leak, so one file wins outright.`,fix:`Create a .env.test next to your .env holding the WHOLE environment the suite
|
|
467
|
+
should run against. A var you leave out will be missing rather than
|
|
468
|
+
inherited, which is the point — the run fails loudly instead of quietly
|
|
469
|
+
reaching your dev stack.
|
|
470
|
+
|
|
471
|
+
To stub a var mid-suite, drop the cache and re-parse. To opt out of dotenv
|
|
472
|
+
entirely, set KICKJS_ENV_FILE=off (it also takes a comma-separated file list).`,codeBefore:`# .env ← read by your tests today, including every var you forgot to pin
|
|
473
|
+
DATABASE_URL=postgres://localhost:5432/myapp_dev
|
|
474
|
+
`,codeAfter:`# .env.test ← read INSTEAD of .env under NODE_ENV=test / VITEST
|
|
475
|
+
NODE_ENV=test
|
|
476
|
+
DATABASE_URL=postgres://localhost:5432/myapp_test
|
|
477
|
+
LOG_LEVEL=silent
|
|
478
|
+
|
|
479
|
+
// mid-suite stubs need the cache dropped:
|
|
480
|
+
import { loadEnv, resetEnvCache } from '@forinda/kickjs'
|
|
481
|
+
import { envSchema } from '../src/env'
|
|
482
|
+
|
|
483
|
+
beforeAll(() => {
|
|
484
|
+
vi.stubEnv('JWT_SECRET', 'x'.repeat(32))
|
|
485
|
+
resetEnvCache()
|
|
486
|
+
loadEnv(envSchema)
|
|
487
|
+
})`,docs:`https://kickjs.app/guide/testing.html#environment-isolation`}}}}];function pn(e,t){let n=null;for(let r of fn){let i=null;try{i=r.match(e,t)}catch{continue}!i||i.confidence<40||(!n||i.confidence>n.confidence)&&(n=i)}return n}async function mn(e){let t=e.provider??`openai`,n=process.env.OPENAI_API_KEY;if(t===`openai`&&!n)return{kind:`unavailable`,reason:`OPENAI_API_KEY environment variable is not set`,suggestion:`Set OPENAI_API_KEY in your shell, e.g.
|
|
454
488
|
export OPENAI_API_KEY="sk-..."
|
|
455
489
|
|
|
456
490
|
Then re-run \`kick explain --ai "<your error>"\`.`};let r;try{r=await import(`@forinda/kickjs-ai`)}catch{return{kind:`unavailable`,reason:`@forinda/kickjs-ai is not installed`,suggestion:`Install the AI package to enable the LLM fallback:
|
|
@@ -549,7 +583,7 @@ server.on('exit', () => {
|
|
|
549
583
|
Cancelled.
|
|
550
584
|
`);return}await et(l,{recursive:!0,force:!0}),console.log(` Deleted: ${l}`);let u=M(r,`index.ts`);if(await n(u)){let e=await L(u,`utf-8`),t=e,n=RegExp(`^import\\s*\\{\\s*${m(s)}Module\\s*\\}\\s*from\\s*['"][^'"]*${m(c)}(?:/[^'"]*)?['"].*\\n?`,`gm`);e=e.replace(n,``),e=Ln(e,s),e=e.replace(/\n{3,}/g,`
|
|
551
585
|
|
|
552
|
-
`),e!==t&&(await R(u,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${u}`))}console.log(`\n Module '${c}' removed.\n`)}function zn(e){e.command(`remove`).alias(`rm`).description(`Remove generated code`).command(`module <names...>`).description(`Remove one or more modules (e.g. kick rm module user task)`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular module name`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=T(await E(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Rn({name:n,modulesDir:N(r),force:t.force,pluralize:i})})}function Bn(e){if(e!==void 0){if(e===`false`||e===`off`||e===`none`)return!1;if(e===`zod`)return`zod`;if(e===`kickjs-schema`||e===`schema`)return`kickjs-schema`;console.warn(` kick typegen: unknown --schema-validator '${e}' (supported: 'zod', 'kickjs-schema', 'false'). Falling back to project config.`)}}function Vn(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function Hn(e){e.command(`typegen`).description(`Generate type-safe DI registry and module types into .kickjs/types/`).option(`-w, --watch`,`Watch source files and regenerate on change`).option(`-s, --src <dir>`,`Source directory to scan`,`src`).option(`-o, --out <dir>`,`Output directory`,`.kickjs/types`).option(`--silent`,`Suppress output`).option(`--allow-duplicates`,`Auto-namespace duplicate class names instead of failing (use with caution)`).option(`--schema-validator <name>`,`Schema validator for body/query/params typing (currently 'zod' or 'false')`).option(`--env-file <path>`,`Path to env schema file for KickEnv typing (default 'src/env.ts'; pass 'false' to disable)`).option(`--check`,`CI gate: exit non-zero if any generated file in .kickjs/types/ is out of date (routes, env, db, assets, adopter plugins) instead of writing it`).option(`--fix`,`Patch module import.meta.glob() calls to cover decorated classes that aren't loaded by any glob (orphans)`).option(`--list`,"List every registered typegen plugin id (use to populate `typegen.disable`)").option(`--no-cache`,`Disable the persistent scan cache; re-read + re-extract every file from cold`).action(async e=>{let t=De(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-
|
|
586
|
+
`),e!==t&&(await R(u,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${u}`))}console.log(`\n Module '${c}' removed.\n`)}function zn(e){e.command(`remove`).alias(`rm`).description(`Remove generated code`).command(`module <names...>`).description(`Remove one or more modules (e.g. kick rm module user task)`).option(`--modules-dir <dir>`,`Modules directory`).option(`--no-pluralize`,`Use singular module name`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=T(await E(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Rn({name:n,modulesDir:N(r),force:t.force,pluralize:i})})}function Bn(e){if(e!==void 0){if(e===`false`||e===`off`||e===`none`)return!1;if(e===`zod`)return`zod`;if(e===`kickjs-schema`||e===`schema`)return`kickjs-schema`;console.warn(` kick typegen: unknown --schema-validator '${e}' (supported: 'zod', 'kickjs-schema', 'false'). Falling back to project config.`)}}function Vn(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function Hn(e){e.command(`typegen`).description(`Generate type-safe DI registry and module types into .kickjs/types/`).option(`-w, --watch`,`Watch source files and regenerate on change`).option(`-s, --src <dir>`,`Source directory to scan`,`src`).option(`-o, --out <dir>`,`Output directory`,`.kickjs/types`).option(`--silent`,`Suppress output`).option(`--allow-duplicates`,`Auto-namespace duplicate class names instead of failing (use with caution)`).option(`--schema-validator <name>`,`Schema validator for body/query/params typing (currently 'zod' or 'false')`).option(`--env-file <path>`,`Path to env schema file for KickEnv typing (default 'src/env.ts'; pass 'false' to disable)`).option(`--check`,`CI gate: exit non-zero if any generated file in .kickjs/types/ is out of date (routes, env, db, assets, adopter plugins) instead of writing it`).option(`--fix`,`Patch module import.meta.glob() calls to cover decorated classes that aren't loaded by any glob (orphans)`).option(`--list`,"List every registered typegen plugin id (use to populate `typegen.disable`)").option(`--no-cache`,`Disable the persistent scan cache; re-read + re-extract every file from cold`).action(async e=>{let t=De(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-U3dKfUQu.mjs`).then(e=>e.t),{builtinCliPlugins:t}=await import(`./builtins-Cu07e0bx.mjs`),r=e([...t,...n?.plugins??[]],n?.commands??[]),i=new Set(n?.typegen?.disable??[]);if(r.typegens.length===0){console.log(` No typegen plugins registered.`);return}let a=Math.max(...r.typegens.map(e=>e.id.length));console.log(`
|
|
553
587
|
Registered typegen plugins:
|
|
554
588
|
`);for(let e of r.typegens){let t=i.has(e.id)?` (disabled)`:``;console.log(` ${e.id.padEnd(a+2)}inputs: ${e.inputs.join(`, `)||`(none)`}${t}`)}console.log();return}let r=Bn(e.schemaValidator)??n?.typegen?.schemaValidator??`zod`,i=Vn(e.envFile)??n?.typegen?.envFile,a={cwd:t,srcDir:e.src??n?.typegen?.srcDir,outDir:e.out??n?.typegen?.outDir,silent:e.silent,fix:e.fix,allowDuplicates:e.allowDuplicates,noCache:e.cache===!1,schemaValidator:r,envFile:i,assetMap:n?.assetMap,runPlugins:!1};try{if(e.watch){let t=await Ve(a);e.silent||console.log(` kick typegen: watching for changes (Ctrl-C to exit)`);let n=()=>{t(),process.exit(0)};process.on(`SIGINT`,n),process.on(`SIGTERM`,n),await new Promise(()=>{})}else{await k(a);let r=await Wt({cwd:t,config:n??null,silent:e.silent,check:e.check});e.check&&r.some(e=>e.status===`written`)&&process.exit(1),e.check||await Ie(N(t,e.out??n?.typegen?.outDir??`.kickjs/types`),r,e.silent??!1)}}catch(e){e instanceof He?console.error(`
|
|
555
589
|
`+e.message+`
|
|
@@ -647,4 +681,4 @@ declare global {
|
|
|
647
681
|
export {}
|
|
648
682
|
`}const _r=()=>({id:`kick/env`,outExtension:`.ts`,inputs:[`src/env.ts`,`src/**/env.ts`,`src/**/*.env.ts`],async generate(e){let t=yr(e);if(t===!1)return null;let n=await e.getScanResult({root:vr(e),cwd:e.cwd,envFile:t});if(!n.env)return null;let r=e.config?.typegen?.schemaValidator??`zod`,i=A.resolve(e.cwd,`.kickjs/types/kick__env.ts`);return gr(n.env,i,r)}});function vr(e){return A.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function yr(e){return e.config?.typegen?.envFile}function br(e){return A.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function xr(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}function $(e){return{root:br(e),cwd:e.cwd,envFile:xr(e)}}const Sr=()=>({id:`kick/registry`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=A.resolve(e.cwd,`.kickjs/types/kick__registry.d.ts`),r=new Set(t.collisions.map(e=>e.className));return Be(t.classes,n,r)}}),Cr=()=>({id:`kick/services`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=new Set(t.collisions.map(e=>e.className));return Re(`ServiceToken`,Le(t.classes,t.tokens,t.injects,n),"(no tokens discovered — declare with createToken<T>() or `kick g service <name>`)")}}),wr=()=>({id:`kick/modules`,inputs:[`src/**/*.ts`],async generate(e){return Re(`ModuleToken`,je((await e.getScanResult($(e))).classes),"(no @Module classes discovered — `kick g module <name>` to add one)")}}),Tr=()=>({id:`kick/plugins`,inputs:[`src/**/*.ts`],async generate(e){return Ne((await e.getScanResult($(e))).pluginsAndAdapters)}}),Er=()=>({id:`kick/augmentations`,inputs:[`src/**/*.ts`],async generate(e){return Ue((await e.getScanResult($(e))).augmentations)}}),Dr=()=>({id:`kick/context`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return t.contextKeys.length===0?null:Me(t.contextKeys)}}),Or={fastify:{subpath:`@forinda/kickjs/fastify`,typeName:`FastifyRuntimeTypes`},h3:{subpath:`@forinda/kickjs/h3`,typeName:`H3RuntimeTypes`}},kr=[D({name:`kick/init`,register:lt}),D({name:`kick/generate`,register:Rt}),D({name:`kick/run`,register:Xt}),D({name:`kick/info`,register:tn}),D({name:`kick/inspect`,register:un}),D({name:`kick/add`,register:ye}),D({name:`kick/list`,register:xe}),D({name:`kick/explain`,register:bn}),D({name:`kick/mcp`,register:kn}),D({name:`kick/tinker`,register:Nn}),D({name:`kick/remove`,register:zn}),D({name:`kick/typegen`,register:Hn}),D({name:`kick/check`,register:er}),D({name:`kick/doctor`,register:me}),D({name:`kick/codemod`,register:nr}),D({name:`kick/registry`,typegens:[Sr()]}),D({name:`kick/services`,typegens:[Cr()]}),D({name:`kick/modules`,typegens:[wr()]}),D({name:`kick/plugins`,typegens:[Tr()]}),D({name:`kick/augmentations`,typegens:[Er()]}),D({name:`kick/context`,typegens:[Dr()]}),D({name:`kick/assets`,typegens:[rr()]}),D({name:`kick/routes`,typegens:[pr()]}),D({name:`kick/env`,typegens:[_r()]}),D({name:`kick/runtime`,typegens:[{id:`kick/runtime`,outExtension:`.ts`,inputs:[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`],async generate(e){let t=e.config?.runtime;if(t!==`fastify`&&t!==`h3`)return null;let{subpath:n,typeName:r}=Or[t];return[`// Runtime escape-hatch types for the '${t}' engine (kick.config runtime).`,`declare module '@forinda/kickjs' {`,` interface KickRuntimeRegister {`,` runtime: import('${n}').${r}`,` }`,`}`,``,`export {}`,``].join(`
|
|
649
683
|
`)}}]})];export{Ht as applyDisableFilter,Wt as runAllPluginTypegens,kr as t};
|
|
650
|
-
//# sourceMappingURL=run-plugins-
|
|
684
|
+
//# sourceMappingURL=run-plugins-CwsrWG_a.mjs.map
|