@forinda/kickjs-cli 8.14.5 → 8.14.6

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.
Files changed (41) hide show
  1. package/bin.js +56 -1
  2. package/dist/{agent-docs-DNQorrtT.mjs → agent-docs-C1fM3mXV.mjs} +3 -3
  3. package/dist/{agent-docs-DNQorrtT.mjs.map → agent-docs-C1fM3mXV.mjs.map} +1 -1
  4. package/dist/{agent-docs-BzkolHEL.mjs → agent-docs-DLkqhKAx.mjs} +2 -2
  5. package/dist/{build-DjiwDZg0.mjs → build-B4vPtyvv.mjs} +3 -3
  6. package/dist/{build-DjiwDZg0.mjs.map → build-B4vPtyvv.mjs.map} +1 -1
  7. package/dist/{build-CXRLhYaB.mjs → build-C7756Hsu.mjs} +2 -2
  8. package/dist/{builtins-VGdcIA6Z.mjs → builtins-CtquiRQB.mjs} +2 -2
  9. package/dist/{builtins-DYG_4-Fn.mjs → builtins-DXacDUD_.mjs} +4 -4
  10. package/dist/cli.mjs +2 -2
  11. package/dist/{config-B51qVk5T.mjs → config-CI9pVF5P.mjs} +3 -3
  12. package/dist/{config-B51qVk5T.mjs.map → config-CI9pVF5P.mjs.map} +1 -1
  13. package/dist/{config-CvpZKFzB.mjs → config-D80wnWgv.mjs} +2 -2
  14. package/dist/{doctor-CEJXaiwI.mjs → doctor-CfU8GbJz.mjs} +4 -4
  15. package/dist/{doctor-CEJXaiwI.mjs.map → doctor-CfU8GbJz.mjs.map} +1 -1
  16. package/dist/{fullstack-DlmzMZNi.mjs → fullstack-BNgFfRiv.mjs} +4 -4
  17. package/dist/{fullstack-DlmzMZNi.mjs.map → fullstack-BNgFfRiv.mjs.map} +1 -1
  18. package/dist/{fullstack-IN6jQfwx.mjs → fullstack-CaIzq2C5.mjs} +3 -3
  19. package/dist/index.mjs +2 -2
  20. package/dist/{package-manager-DeHrd_BV.mjs → package-manager-BSW23HwO.mjs} +3 -3
  21. package/dist/{package-manager-DeHrd_BV.mjs.map → package-manager-BSW23HwO.mjs.map} +1 -1
  22. package/dist/{package-manager-yLhGBcnM.mjs → package-manager-ZvCCh0kq.mjs} +2 -2
  23. package/dist/{plugin-GBO30iR4.mjs → plugin-CXaj2i5Y.mjs} +2 -2
  24. package/dist/{plugin-B5QkcWS5.mjs → plugin-DKrL6WH5.mjs} +2 -2
  25. package/dist/{project-B4Xwpwxd.mjs → project-Bwt2uuHp.mjs} +8 -6
  26. package/dist/project-Bwt2uuHp.mjs.map +1 -0
  27. package/dist/{project-GItSBp-6.mjs → project-Q1ml7trN.mjs} +7 -5
  28. package/dist/{project-root-BfLTYQeu.mjs → project-root-DGZ8lAPG.mjs} +2 -2
  29. package/dist/{project-root-D43RHpE_.mjs → project-root-dQZYvCXv.mjs} +3 -3
  30. package/dist/{project-root-D43RHpE_.mjs.map → project-root-dQZYvCXv.mjs.map} +1 -1
  31. package/dist/{rolldown-runtime-DX2JheQY.mjs → rolldown-runtime-B3K4rer-.mjs} +1 -1
  32. package/dist/{run-plugins-D-K2eEF1.mjs → run-plugins-C9dOrOSt.mjs} +4 -4
  33. package/dist/{run-plugins-D-K2eEF1.mjs.map → run-plugins-C9dOrOSt.mjs.map} +1 -1
  34. package/dist/{typegen-DEEdgsu_.mjs → typegen-BwnKoL1q.mjs} +5 -5
  35. package/dist/{typegen-DEEdgsu_.mjs.map → typegen-BwnKoL1q.mjs.map} +1 -1
  36. package/dist/{typegen-Dk5QYucs.mjs → typegen-VBagOQY4.mjs} +4 -4
  37. package/dist/{types-DDmkeXnW.mjs → types-CHsKxl8b.mjs} +1 -1
  38. package/package.json +3 -3
  39. package/templates/template-inertia/files/src/client/main.tsx +9 -2
  40. package/templates/template-inertia/files/src/modules/pages/pages.test.ts +3 -0
  41. package/dist/project-B4Xwpwxd.mjs.map +0 -1
package/bin.js CHANGED
@@ -2,7 +2,62 @@
2
2
 
3
3
  // ESM wrapper for the ESM CLI entry.
4
4
  // Bin entries must be plain .js (not .mjs) for universal Node.js compatibility.
5
- import('./dist/cli.mjs').catch((err) => {
5
+ import { existsSync, readFileSync, realpathSync, statSync } from 'node:fs'
6
+ import { dirname, join, sep } from 'node:path'
7
+ import { fileURLToPath, pathToFileURL } from 'node:url'
8
+
9
+ // A `kick` installed elsewhere (globally, or in a parent folder) run inside a
10
+ // project hands off to the project's own CLI. Otherwise both copies of
11
+ // @forinda/kickjs load into one process — this CLI's and the one kick.config.ts
12
+ // imports — each with its own DI container, and the project's version is the
13
+ // one that should answer.
14
+ //
15
+ // Only the project the command runs in counts: the nearest folder with a
16
+ // package.json, which has to list @forinda/kickjs-cli (as `kick new` writes it).
17
+ // It never looks past that folder, so a node_modules in a parent (/tmp, a
18
+ // shared drive) is never run. The folder and the CLI package must belong to
19
+ // the user running kick and not be writable by everyone; where there are no
20
+ // owners to check (Windows), only the current folder counts.
21
+ // KICK_NO_HANDOFF=1 opts out.
22
+ function ownedByMe(path) {
23
+ const { uid, mode } = statSync(path)
24
+ return uid === process.getuid() && (mode & 0o002) === 0
25
+ }
26
+
27
+ function projectCli() {
28
+ if (process.env.KICK_NO_HANDOFF === '1') return undefined
29
+ const posix = typeof process.getuid === 'function'
30
+ let dir = process.cwd()
31
+ while (!existsSync(join(dir, 'package.json'))) {
32
+ if (!posix || dirname(dir) === dir) return undefined
33
+ dir = dirname(dir)
34
+ }
35
+ if (posix && !ownedByMe(dir)) return undefined
36
+ const { dependencies, devDependencies } = JSON.parse(
37
+ readFileSync(join(dir, 'package.json'), 'utf8'),
38
+ )
39
+ if ({ ...dependencies, ...devDependencies }['@forinda/kickjs-cli'] === undefined) return undefined
40
+ const pkg = join(dir, 'node_modules', '@forinda', 'kickjs-cli', 'package.json')
41
+ if (!existsSync(pkg)) return undefined
42
+ const root = realpathSync(dirname(pkg))
43
+ if (root === realpathSync(dirname(fileURLToPath(import.meta.url)))) return undefined
44
+ if (posix && !ownedByMe(root)) return undefined
45
+ const bin = JSON.parse(readFileSync(pkg, 'utf8')).bin
46
+ const file = typeof bin === 'string' ? bin : bin?.kick
47
+ if (typeof file !== 'string') return undefined
48
+ const target = realpathSync(join(root, file))
49
+ // The bin has to live in the package it came from.
50
+ return target.startsWith(root + sep) ? target : undefined
51
+ }
52
+
53
+ let local
54
+ try {
55
+ local = projectCli()
56
+ } catch {
57
+ // Unreadable package.json or the like: run this copy.
58
+ }
59
+
60
+ import(local ? pathToFileURL(local).href : './dist/cli.mjs').catch((err) => {
6
61
  console.error('Failed to load CLI:', err)
7
62
  process.exit(1)
8
63
  })
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-cli v8.14.5
2
+ * @forinda/kickjs-cli v8.14.6
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{t as e}from"./rolldown-runtime-DX2JheQY.mjs";import{_ as t,i as n,n as r}from"./package-manager-DeHrd_BV.mjs";import{i,p as a,s as o}from"./config-B51qVk5T.mjs";import{join as s}from"node:path";import{existsSync as c,readFileSync as l}from"node:fs";function u(e,t){let n=e;return t===`fullstack`&&n!==`pnpm`?`${a(n,`dev:server`)} + ${a(n,`dev:web`)}`:a(n,`dev`)}function d(e,t,n){return`# CLAUDE.md — ${e}
11
+ import{t as e}from"./rolldown-runtime-B3K4rer-.mjs";import{_ as t,i as n,n as r}from"./package-manager-BSW23HwO.mjs";import{i,p as a,s as o}from"./config-CI9pVF5P.mjs";import{join as s}from"node:path";import{existsSync as c,readFileSync as l}from"node:fs";function u(e,t){let n=e;return t===`fullstack`&&n!==`pnpm`?`${a(n,`dev:server`)} + ${a(n,`dev:web`)}`:a(n,`dev`)}function d(e,t,n){return`# CLAUDE.md — ${e}
12
12
 
13
13
  **Read \`./.agents/AGENTS.md\` first.** It is the canonical, multi-agent
14
14
  reference for this project (Claude, Copilot, Codex, Gemini, etc.) —
@@ -930,4 +930,4 @@ Codex / Cursor / Gemini / Claude Code without copy-pasting.
930
930
  CLI template. Hand-edited content is overwritten — keep customisation
931
931
  in \`.agents/COPILOT.local.md\`.
932
932
  `}var _=/* @__PURE__ */ e({generateAgentDocs:()=>C});const v=`.agents`,y=/* @__PURE__ */ new Set([`rest`,`minimal`,`fullstack`,`inertia`]);function b(e,t){if(t)return t;try{let t=JSON.parse(l(s(e,`package.json`),`utf-8`));if(t.name)return t.name.replace(/^@[^/]+\//,``)}catch{}return e.split(`/`).findLast(Boolean)??`app`}async function x(e){try{return(await o(e))?.modules?.style===`class`?`class`:`define`}catch{return`define`}}async function S(e,t){if(t)return t;try{let t=(await o(e))?.pattern;if(t&&y.has(t))return t}catch{}return`rest`}async function C(e){let i=e.only??`all`,a=b(e.outDir,e.name),o=await r(e.pm,e.outDir),l=await S(e.outDir,e.template),u=await x(e.outDir),p=i===`agents`||i===`both`||i===`all`,_=i===`claude`||i===`both`||i===`all`,y=i===`skills`||i===`all`,C=i===`gemini`||i===`all`,w=i===`copilot`||i===`all`,T=[];if(p&&T.push({file:s(e.outDir,v,`AGENTS.md`),render:()=>f(a,l,o)}),_&&T.push({file:s(e.outDir,`CLAUDE.md`),render:()=>d(a,l,o)}),y)for(let t of m(a,l,o,u))T.push({file:s(e.outDir,v,`skills`,t.slug,`SKILL.md`),render:()=>t.content});C&&T.push({file:s(e.outDir,v,`GEMINI.md`),render:()=>h(a,l,o)}),w&&T.push({file:s(e.outDir,v,`COPILOT.md`),render:()=>g(a,l,o)});let E=[];for(let{file:r,render:i}of T)c(r)&&!e.force&&!await n({message:`${r.replace(e.outDir+`/`,``)} already exists. Overwrite?`,initialValue:!1})?console.log(` Skipped — existing ${r.replace(e.outDir+`/`,``)} preserved.`):(await t(r,i()),E.push(r));return E}export{C as n,_ as t};
933
- //# sourceMappingURL=agent-docs-DNQorrtT.mjs.map
933
+ //# sourceMappingURL=agent-docs-C1fM3mXV.mjs.map