@forinda/kickjs-cli 8.5.0 → 8.6.1
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/{project-docs-Y6vOc-Uj.mjs → agent-docs-BO_QMIkN.mjs} +9 -71
- package/dist/agent-docs-BO_QMIkN.mjs.map +1 -0
- package/dist/{project-docs-BE8DKCWP.mjs → agent-docs-DTg4y5mT.mjs} +3 -65
- package/dist/{build-D3rNfcxu.mjs → build-DSQ6SPr4.mjs} +3 -3
- package/dist/{build-D3rNfcxu.mjs.map → build-DSQ6SPr4.mjs.map} +1 -1
- package/dist/{build-DwfrMHgx.mjs → build-DfrjvGMx.mjs} +2 -2
- package/dist/{builtins-DtTYiDg0.mjs → builtins-A-wfYHI9.mjs} +36 -31
- package/dist/{builtins-D4pwODzu.mjs → builtins-KQmcywFY.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/config-BoXFaObA.mjs +13 -0
- package/dist/config-BoXFaObA.mjs.map +1 -0
- package/dist/config-Bz1suLYz.mjs +12 -0
- package/dist/{doctor-Df6zCPr5.mjs → doctor-p4bjILiU.mjs} +6 -6
- package/dist/{doctor-Df6zCPr5.mjs.map → doctor-p4bjILiU.mjs.map} +1 -1
- package/dist/fs-DH9oxW0t.mjs +11 -0
- package/dist/fs-Dz7zBXL4.mjs +12 -0
- package/dist/fs-Dz7zBXL4.mjs.map +1 -0
- package/dist/fullstack-BKD9McZF.mjs +96 -0
- package/dist/fullstack-BKD9McZF.mjs.map +1 -0
- package/dist/fullstack-DQbVCW5U.mjs +95 -0
- package/dist/index.d.mts +15 -24
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-B8fmVbk8.mjs → plugin-Aof9UWs7.mjs} +2 -2
- package/dist/{plugin-B-mP0jvi.mjs → plugin-B-kr8WAU.mjs} +2 -2
- package/dist/project-BAGDIkJa.mjs +45 -0
- package/dist/project-BjxeGJBn.mjs +46 -0
- package/dist/project-BjxeGJBn.mjs.map +1 -0
- package/dist/{project-root-CSHMf3L7.mjs → project-root-4oQKPMOs.mjs} +2 -2
- package/dist/{project-root-BzyIWFlH.mjs → project-root-D8VclnwB.mjs} +3 -3
- package/dist/{project-root-BzyIWFlH.mjs.map → project-root-D8VclnwB.mjs.map} +1 -1
- package/dist/{prompts-wFEGsPZt.mjs → prompts-BIl0rZ4C.mjs} +2 -2
- package/dist/{prompts-wFEGsPZt.mjs.map → prompts-BIl0rZ4C.mjs.map} +1 -1
- package/dist/{rolldown-runtime-DzFISCwE.mjs → rolldown-runtime-DElgkk48.mjs} +1 -1
- package/dist/{run-plugins-ByRyAAZe.mjs → run-plugins-DCVSqa5a.mjs} +34 -29
- package/dist/run-plugins-DCVSqa5a.mjs.map +1 -0
- package/dist/typegen-BOxA_1DU.mjs +132 -0
- package/dist/{typegen-Bx2IQ-w5.mjs.map → typegen-BOxA_1DU.mjs.map} +1 -1
- package/dist/{typegen-BfOYvlWo.mjs → typegen-Dss5L5p7.mjs} +4 -4
- package/dist/{types-dUiZnaWm.mjs → types-Dudqvbd1.mjs} +1 -1
- package/package.json +9 -8
- package/templates/base/feature.json +18 -0
- package/templates/base/files/README.md +61 -0
- package/templates/base/files/_dot_editorconfig +13 -0
- package/templates/base/files/_dot_env +2 -0
- package/templates/base/files/_dot_env.example +2 -0
- package/templates/base/files/_dot_env.test +9 -0
- package/templates/base/files/_dot_env.test.example +11 -0
- package/templates/base/files/_dot_gitattributes +18 -0
- package/templates/base/files/_dot_gitignore +14 -0
- package/templates/base/files/_dot_oxfmtrc.json +9 -0
- package/templates/base/files/kick.config.ts +58 -0
- package/templates/base/files/src/modules/hello/hello.controller.ts +26 -0
- package/templates/base/files/src/modules/hello/hello.module.ts +21 -0
- package/templates/base/files/src/modules/hello/hello.service.ts +12 -0
- package/templates/base/files/src/modules/index.ts +7 -0
- package/templates/base/files/tsconfig.json +21 -0
- package/templates/base/files/vite.config.ts +31 -0
- package/templates/base/files/vitest.config.ts +18 -0
- package/templates/feature-devtools/feature.json +13 -0
- package/templates/feature-queue/feature.json +16 -0
- package/templates/feature-queue/files/_dot_env.append +2 -0
- package/templates/feature-queue/files/_dot_env.example.append +2 -0
- package/templates/feature-swagger/feature.json +16 -0
- package/templates/feature-ws/feature.json +13 -0
- package/templates/fullstack-root/files/_dot_gitignore +8 -0
- package/templates/fullstack-root/files/netlify.toml +13 -0
- package/templates/fullstack-root/files/vercel.json +5 -0
- package/templates/host-config/files/netlify.toml +6 -0
- package/templates/host-config/files/vercel.json +5 -0
- package/templates/runtime-express/feature.json +22 -0
- package/templates/runtime-fastify/feature.json +13 -0
- package/templates/runtime-h3/feature.json +13 -0
- package/templates/schema-valibot/feature.json +3 -0
- package/templates/schema-valibot/files/src/config/index.ts +41 -0
- package/templates/schema-yup/feature.json +3 -0
- package/templates/schema-yup/files/src/config/index.ts +43 -0
- package/templates/schema-zod/feature.json +3 -0
- package/templates/schema-zod/files/src/config/index.ts +41 -0
- package/templates/server-fullstack/feature.json +13 -0
- package/templates/template-minimal/feature.json +10 -0
- package/templates/template-minimal/files/src/index.ts +17 -0
- package/templates/template-rest/feature.json +10 -0
- package/templates/template-rest/files/src/index.ts +28 -0
- package/templates/web-kick/files/web/index.html +12 -0
- package/templates/web-kick/files/web/src/App.tsx +45 -0
- package/templates/web-kick/files/web/src/api.ts +14 -0
- package/templates/web-kick/files/web/src/main.tsx +9 -0
- package/templates/web-kick/files/web/tsconfig.json +15 -0
- package/templates/web-kick/files/web/vite.config.ts +13 -0
- package/dist/agent-docs-CXX06wib.mjs +0 -11
- package/dist/agent-docs-CXs5UDAM.mjs +0 -12
- package/dist/agent-docs-CXs5UDAM.mjs.map +0 -1
- package/dist/config-BUYf44lU.mjs +0 -13
- package/dist/config-BUYf44lU.mjs.map +0 -1
- package/dist/config-F1NW28_P.mjs +0 -12
- package/dist/fullstack-BcJ5lOwt.mjs +0 -194
- package/dist/fullstack-D3W7RS2W.mjs +0 -195
- package/dist/fullstack-D3W7RS2W.mjs.map +0 -1
- package/dist/project-5aAVIQV5.mjs +0 -450
- package/dist/project-DdYD7xPw.mjs +0 -451
- package/dist/project-DdYD7xPw.mjs.map +0 -1
- package/dist/project-docs-Y6vOc-Uj.mjs.map +0 -1
- package/dist/run-plugins-ByRyAAZe.mjs.map +0 -1
- package/dist/typegen-Bx2IQ-w5.mjs +0 -132
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependencies": ["@forinda/kickjs-swagger"],
|
|
3
|
+
"builds": {
|
|
4
|
+
"@scarf/scarf": true
|
|
5
|
+
},
|
|
6
|
+
"integrations": [
|
|
7
|
+
{
|
|
8
|
+
"import": {
|
|
9
|
+
"from": "@forinda/kickjs-swagger",
|
|
10
|
+
"names": ["SwaggerAdapter"]
|
|
11
|
+
},
|
|
12
|
+
"slot": "adapter",
|
|
13
|
+
"code": "SwaggerAdapter({ info: { title: '{{name}}', version: '{{version}}' } })"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependencies": ["@forinda/kickjs-ws", "ws"],
|
|
3
|
+
"integrations": [
|
|
4
|
+
{
|
|
5
|
+
"import": {
|
|
6
|
+
"from": "@forinda/kickjs-ws",
|
|
7
|
+
"names": ["WsAdapter"]
|
|
8
|
+
},
|
|
9
|
+
"slot": "adapter",
|
|
10
|
+
"code": "// WebSocket upgrades on /ws \u2014 see guide/websockets.\nWsAdapter({ path: '/ws' })"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[build]
|
|
2
|
+
command = "{{packageManager}} run build:netlify"
|
|
3
|
+
publish = "web/dist"
|
|
4
|
+
|
|
5
|
+
[build.environment]
|
|
6
|
+
NODE_VERSION = "22"
|
|
7
|
+
|
|
8
|
+
# Client-side routes fall back to the app shell. The function claims /api/*
|
|
9
|
+
# through its own `config.path`, so this rule never sees those requests.
|
|
10
|
+
[[redirects]]
|
|
11
|
+
from = "/*"
|
|
12
|
+
to = "/index.html"
|
|
13
|
+
status = 200
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependencies": ["express"],
|
|
3
|
+
"devDependencies": ["@types/express"],
|
|
4
|
+
"integrations": [
|
|
5
|
+
{
|
|
6
|
+
"import": {
|
|
7
|
+
"from": "@forinda/kickjs",
|
|
8
|
+
"names": ["expressRuntime"]
|
|
9
|
+
},
|
|
10
|
+
"slot": "runtime",
|
|
11
|
+
"code": "runtime: expressRuntime()"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"import": {
|
|
15
|
+
"from": "express",
|
|
16
|
+
"default": "express"
|
|
17
|
+
},
|
|
18
|
+
"slot": "middleware",
|
|
19
|
+
"code": "// Express needs a body parser; Fastify and h3 parse bodies natively.\nexpress.json()"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { loadEnvFromSchema } from '@forinda/kickjs/config'
|
|
2
|
+
import { fromValibot } from '@forinda/kickjs-schema/valibot'
|
|
3
|
+
import * as v from 'valibot'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Project environment schema (Valibot).
|
|
7
|
+
*
|
|
8
|
+
* `fromValibot` wraps the Valibot schema as a `KickSchema` so the
|
|
9
|
+
* env loader, validate middleware, and swagger spec generator all see
|
|
10
|
+
* the same shape. The default export is the contract `kick typegen`
|
|
11
|
+
* reads to populate `KickEnv` via `InferSchemaOutput<typeof _envSchema>`
|
|
12
|
+
* — that's what makes `@Value('FOO')` autocomplete and
|
|
13
|
+
* `process.env.FOO` typed.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* DATABASE_URL: v.pipe(v.string(), v.url()),
|
|
17
|
+
* JWT_SECRET: v.pipe(v.string(), v.minLength(32)),
|
|
18
|
+
* REDIS_URL: v.optional(v.pipe(v.string(), v.url())),
|
|
19
|
+
*/
|
|
20
|
+
const envSchema = fromValibot(
|
|
21
|
+
v.object({
|
|
22
|
+
PORT: v.optional(v.pipe(v.string(), v.transform(Number)), '3000'),
|
|
23
|
+
NODE_ENV: v.optional(v.picklist(['development', 'production', 'test']), 'development'),
|
|
24
|
+
LOG_LEVEL: v.optional(v.string(), 'info'),
|
|
25
|
+
// DATABASE_URL: v.pipe(v.string(), v.url()),
|
|
26
|
+
}),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* IMPORTANT — side effect: register the schema with kickjs's env cache
|
|
31
|
+
* **at module-load time**. `ConfigService` and `@Value()` both consume
|
|
32
|
+
* this cache, and they will fall back to the base schema (or undefined)
|
|
33
|
+
* if no extended schema has been registered before they're resolved.
|
|
34
|
+
*
|
|
35
|
+
* As long as `src/index.ts` imports this file (`import './config'`) at
|
|
36
|
+
* the top — before `bootstrap()` runs — every controller and service
|
|
37
|
+
* in the app sees the typed extended values.
|
|
38
|
+
*/
|
|
39
|
+
export const env = loadEnvFromSchema(envSchema)
|
|
40
|
+
|
|
41
|
+
export default envSchema
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { loadEnvFromSchema } from '@forinda/kickjs/config'
|
|
2
|
+
import { fromYup } from '@forinda/kickjs-schema/yup'
|
|
3
|
+
import * as yup from 'yup'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Project environment schema (Yup).
|
|
7
|
+
*
|
|
8
|
+
* `fromYup` wraps the Yup schema as a `KickSchema` so the env loader,
|
|
9
|
+
* validate middleware, and swagger spec generator all see the same
|
|
10
|
+
* shape. The default export is the contract `kick typegen` reads to
|
|
11
|
+
* populate `KickEnv` via `InferSchemaOutput<typeof _envSchema>`.
|
|
12
|
+
*
|
|
13
|
+
* Note: Yup's `.url()` defaults to http/https; database connection
|
|
14
|
+
* strings like `postgres://` use `.matches(/^[a-z]+:\/\/.+/i)` or
|
|
15
|
+
* a plain `.string().required()`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* DATABASE_URL: yup.string().required(),
|
|
19
|
+
* JWT_SECRET: yup.string().min(32).required(),
|
|
20
|
+
* REDIS_URL: yup.string().url().optional(),
|
|
21
|
+
*/
|
|
22
|
+
const envSchema = fromYup(
|
|
23
|
+
yup.object({
|
|
24
|
+
PORT: yup.number().default(3000),
|
|
25
|
+
NODE_ENV: yup.string().oneOf(['development', 'production', 'test']).default('development'),
|
|
26
|
+
LOG_LEVEL: yup.string().default('info'),
|
|
27
|
+
// DATABASE_URL: yup.string().required(),
|
|
28
|
+
}),
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* IMPORTANT — side effect: register the schema with kickjs's env cache
|
|
33
|
+
* **at module-load time**. `ConfigService` and `@Value()` both consume
|
|
34
|
+
* this cache, and they will fall back to the base schema (or undefined)
|
|
35
|
+
* if no extended schema has been registered before they're resolved.
|
|
36
|
+
*
|
|
37
|
+
* As long as `src/index.ts` imports this file (`import './config'`) at
|
|
38
|
+
* the top — before `bootstrap()` runs — every controller and service
|
|
39
|
+
* in the app sees the typed extended values.
|
|
40
|
+
*/
|
|
41
|
+
export const env = loadEnvFromSchema(envSchema)
|
|
42
|
+
|
|
43
|
+
export default envSchema
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { loadEnvFromSchema } from '@forinda/kickjs/config'
|
|
2
|
+
import { fromZod } from '@forinda/kickjs-schema/zod'
|
|
3
|
+
import { z } from 'zod'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Project environment schema (Zod).
|
|
7
|
+
*
|
|
8
|
+
* `fromZod` wraps the Zod schema as a `KickSchema` so the env loader,
|
|
9
|
+
* validate middleware, and swagger spec generator all see the same
|
|
10
|
+
* shape. The default export is the contract `kick typegen` reads to
|
|
11
|
+
* populate `KickEnv` via `InferSchemaOutput<typeof _envSchema>` —
|
|
12
|
+
* that's what makes `@Value('FOO')` autocomplete and
|
|
13
|
+
* `process.env.FOO` typed.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* DATABASE_URL: z.string().url(),
|
|
17
|
+
* JWT_SECRET: z.string().min(32),
|
|
18
|
+
* REDIS_URL: z.string().url().optional(),
|
|
19
|
+
*/
|
|
20
|
+
const envSchema = fromZod(
|
|
21
|
+
z.object({
|
|
22
|
+
PORT: z.coerce.number().default(3000),
|
|
23
|
+
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
|
|
24
|
+
LOG_LEVEL: z.string().default('info'),
|
|
25
|
+
// DATABASE_URL: z.string().url(),
|
|
26
|
+
}),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* IMPORTANT — side effect: register the schema with kickjs's env cache
|
|
31
|
+
* **at module-load time**. `ConfigService` and `@Value()` both consume
|
|
32
|
+
* this cache, and they will fall back to the base schema (or undefined)
|
|
33
|
+
* if no extended schema has been registered before they're resolved.
|
|
34
|
+
*
|
|
35
|
+
* As long as `src/index.ts` imports this file (`import './config'`) at
|
|
36
|
+
* the top — before `bootstrap()` runs — every controller and service
|
|
37
|
+
* in the app sees the typed extended values.
|
|
38
|
+
*/
|
|
39
|
+
export const env = loadEnvFromSchema(envSchema)
|
|
40
|
+
|
|
41
|
+
export default envSchema
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"devDependencies": ["@typescript/typescript6"],
|
|
3
|
+
"integrations": [
|
|
4
|
+
{
|
|
5
|
+
"slot": "vite-option",
|
|
6
|
+
"code": "server: {\n // web/vite.config.ts proxies /api to this port \u2014 fail instead of moving\n // to another port when it's taken, or the proxy would reach the wrong process.\n strictPort: true,\n}"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"slot": "typegen-option",
|
|
10
|
+
"code": "// web/ reads this map from the ambient KickClientApi namespace. Producing\n// it builds a TypeScript program over the server, so it stays off unless a\n// project actually consumes it.\nclient: true"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import 'reflect-metadata'
|
|
2
|
+
// Side-effect import — registers the extended env schema with kickjs
|
|
3
|
+
// **before** any controller / service / @Value gets resolved. Without
|
|
4
|
+
// this line ConfigService.get('YOUR_KEY') returns undefined because the
|
|
5
|
+
// cached schema would still be the base shape. See guide/configuration.
|
|
6
|
+
import './config'
|
|
7
|
+
// @kick:imports
|
|
8
|
+
import { modules } from './modules'
|
|
9
|
+
|
|
10
|
+
// Export the app for the Vite plugin (dev mode)
|
|
11
|
+
export const app = await bootstrap({
|
|
12
|
+
modules,
|
|
13
|
+
// @kick:runtime
|
|
14
|
+
adapters: [
|
|
15
|
+
// @kick:adapter
|
|
16
|
+
],
|
|
17
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import 'reflect-metadata'
|
|
2
|
+
// Side-effect import — registers the extended env schema with kickjs
|
|
3
|
+
// **before** any controller / service / @Value gets resolved. Without
|
|
4
|
+
// this line ConfigService.get('YOUR_KEY') returns undefined because the
|
|
5
|
+
// cached schema would still be the base shape. See guide/configuration.
|
|
6
|
+
import './config'
|
|
7
|
+
// @kick:imports
|
|
8
|
+
import { modules } from './modules'
|
|
9
|
+
|
|
10
|
+
// Export the app for the Vite plugin (dev mode)
|
|
11
|
+
export const app = await bootstrap({
|
|
12
|
+
modules,
|
|
13
|
+
// @kick:runtime
|
|
14
|
+
adapters: [
|
|
15
|
+
// @kick:adapter
|
|
16
|
+
],
|
|
17
|
+
middlewares: [
|
|
18
|
+
// Security headers. The framework injects helmet() with these defaults
|
|
19
|
+
// anyway — declaring it here is what lets you CHANGE them, e.g.
|
|
20
|
+
// helmet({ frameguard: 'SAMEORIGIN' }) or helmet({ hsts: false }).
|
|
21
|
+
// Auto-injection stands down as soon as this line is present.
|
|
22
|
+
helmet(),
|
|
23
|
+
cors({ origin: '*' }),
|
|
24
|
+
requestId(),
|
|
25
|
+
requestLogger(),
|
|
26
|
+
// @kick:middleware
|
|
27
|
+
],
|
|
28
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>{{name}}</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import { api } from './api'
|
|
3
|
+
|
|
4
|
+
// The response types below are INFERRED from the server's handlers —
|
|
5
|
+
// change server/src/modules/hello/hello.service.ts and these types follow on
|
|
6
|
+
// the next `kick typegen`. Not under `kick dev`: resolving the client map
|
|
7
|
+
// builds a whole TypeScript program, so it is a build step, not a per-save one.
|
|
8
|
+
type Greeting = Awaited<ReturnType<typeof fetchGreeting>>
|
|
9
|
+
|
|
10
|
+
function fetchGreeting() {
|
|
11
|
+
return api.get('/hello')
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function App() {
|
|
15
|
+
const [greeting, setGreeting] = useState<Greeting | null>(null)
|
|
16
|
+
const [health, setHealth] = useState<string>('checking…')
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
fetchGreeting().then(setGreeting).catch(console.error)
|
|
20
|
+
api
|
|
21
|
+
.get('/hello/health')
|
|
22
|
+
.then((h) => setHealth(h.status))
|
|
23
|
+
.catch(() => setHealth('down'))
|
|
24
|
+
}, [])
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<main
|
|
28
|
+
style={{ fontFamily: 'system-ui', maxWidth: 640, margin: '4rem auto', padding: '0 1rem' }}
|
|
29
|
+
>
|
|
30
|
+
<h1>KickJS fullstack</h1>
|
|
31
|
+
<p>
|
|
32
|
+
<strong>{greeting?.message ?? 'loading…'}</strong>
|
|
33
|
+
</p>
|
|
34
|
+
<p>
|
|
35
|
+
Server said hello at <code>{greeting?.timestamp ?? '…'}</code> — health:{' '}
|
|
36
|
+
<code>{health}</code>
|
|
37
|
+
</p>
|
|
38
|
+
<p style={{ color: '#666' }}>
|
|
39
|
+
This call is typed end to end: <code>api.get('/hello')</code> returns the exact shape
|
|
40
|
+
<code> HelloService.greet()</code> produces. Rename a field on the server and this file
|
|
41
|
+
stops compiling.
|
|
42
|
+
</p>
|
|
43
|
+
</main>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createClient } from '@forinda/kickjs-client'
|
|
2
|
+
|
|
3
|
+
// KickClientApi is ambient — the resolved route map from
|
|
4
|
+
// server/.kickjs/types/kick__client.d.ts, wired in tsconfig's `types`. Every
|
|
5
|
+
// response type is a literal shape, so nothing from the server's source graph
|
|
6
|
+
// enters this program.
|
|
7
|
+
//
|
|
8
|
+
// Keys are module-mount-relative paths; the bootstrap-level '/api/v1' prefix
|
|
9
|
+
// lives here in baseUrl, and the Vite dev proxy forwards it to the KickJS
|
|
10
|
+
// server.
|
|
11
|
+
//
|
|
12
|
+
// Prefer an explicit import? The same file exports the type:
|
|
13
|
+
// import type { Api } from '../../server/.kickjs/types/kick__client'
|
|
14
|
+
export const api = createClient<KickClientApi.Api>({ baseUrl: '/api/v1' })
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"types": ["../server/.kickjs/types/kick__client"]
|
|
13
|
+
},
|
|
14
|
+
"include": ["src"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import react from '@vitejs/plugin-react'
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [react()],
|
|
6
|
+
server: {
|
|
7
|
+
// The KickJS server (kick dev) listens on 3000; the client's baseUrl is
|
|
8
|
+
// the relative '/api/v1', so the browser hits Vite and Vite forwards.
|
|
9
|
+
proxy: {
|
|
10
|
+
'/api': 'http://localhost:3000',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
})
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.5.0
|
|
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{t as e}from"./rolldown-runtime-DzFISCwE.mjs";import{a as t}from"./config-F1NW28_P.mjs";import{a as n,i as r,l as i,n as a,r as o,t as s}from"./project-docs-BE8DKCWP.mjs";import{existsSync as c,readFileSync as l}from"node:fs";import{join as u}from"node:path";import*as d from"@clack/prompts";import f from"picocolors";const p={GET:f.green,POST:f.cyan,PUT:f.yellow,PATCH:f.magenta,DELETE:f.red};function m(e){return(p[e]??f.dim)(e.padEnd(7))}function h(e){let t=`[${e}]`.padEnd(10);switch(e){case`CRITICAL`:return f.red(t);case`WARNING`:return f.yellow(t);case`INFO`:return f.blue(f.dim(t));default:return t}}f.green(`✓`),f.red(`✖`),f.yellow(`⚠`),f.blue(`ℹ`);function g(e){d.intro(f.bgCyan(f.black(` ${e} `)))}function _(e){d.outro(e)}function v(e){d.isCancel(e)&&(d.cancel(`Operation cancelled.`),process.exit(0))}async function y(e){let t=await d.text(e);return v(t),t}async function b(e){let t=await d.select(e);return v(t),t}async function x(e){let t=await d.multiselect(e);return v(t),t}async function S(e){let t=await d.confirm(e);return v(t),t}function C(){return d.spinner()}const w=d.log;var T=e({generateAgentDocs:()=>M});const E=`.agents`,D=new Set([`rest`,`minimal`,`fullstack`]);function O(e,t){if(t)return t;try{let t=JSON.parse(l(u(e,`package.json`),`utf-8`));if(t.name)return t.name.replace(/^@[^/]+\//,``)}catch{}return e.split(`/`).findLast(Boolean)??`app`}function k(e,t){if(t)return t;try{let t=JSON.parse(l(u(e,`package.json`),`utf-8`));if(t.packageManager)return t.packageManager.split(`@`)[0]}catch{}return`pnpm`}async function A(e){try{return(await t(e))?.modules?.style===`class`?`class`:`define`}catch{return`define`}}async function j(e,n){if(n)return n;try{let n=(await t(e))?.pattern;if(n&&D.has(n))return n}catch{}return`rest`}async function M(e){let t=e.only??`all`,l=O(e.outDir,e.name),d=k(e.outDir,e.pm),f=await j(e.outDir,e.template),p=await A(e.outDir),m=t===`agents`||t===`both`||t===`all`,h=t===`claude`||t===`both`||t===`all`,g=t===`skills`||t===`all`,_=t===`gemini`||t===`all`,v=t===`copilot`||t===`all`,y=[];if(m&&y.push({file:u(e.outDir,E,`AGENTS.md`),render:()=>s(l,f,d)}),h&&y.push({file:u(e.outDir,`CLAUDE.md`),render:()=>a(l,f,d)}),g)for(let t of n(l,f,d,p))y.push({file:u(e.outDir,E,`skills`,t.slug,`SKILL.md`),render:()=>t.content});_&&y.push({file:u(e.outDir,E,`GEMINI.md`),render:()=>r(l,f,d)}),v&&y.push({file:u(e.outDir,E,`COPILOT.md`),render:()=>o(l,f,d)});let b=[];for(let{file:t,render:n}of y){if(c(t)&&!e.force&&!await S({message:`${t.replace(e.outDir+`/`,``)} already exists. Overwrite?`,initialValue:!1})){console.log(` Skipped — existing ${t.replace(e.outDir+`/`,``)} preserved.`);continue}await i(t,n()),b.push(t)}return b}export{w as a,b as c,m as d,f,g as i,C as l,M as n,x as o,h as p,S as r,_ as s,T as t,y as u};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.5.0
|
|
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{t as e}from"./rolldown-runtime-DzFISCwE.mjs";import{a as t,i as n,l as r,n as i,r as a,t as o}from"./project-docs-Y6vOc-Uj.mjs";import{t as s}from"./prompts-wFEGsPZt.mjs";import{o as c}from"./config-BUYf44lU.mjs";import{join as l}from"node:path";import{existsSync as u,readFileSync as d}from"node:fs";var f=e({generateAgentDocs:()=>y});const p=`.agents`,m=new Set([`rest`,`minimal`,`fullstack`]);function h(e,t){if(t)return t;try{let t=JSON.parse(d(l(e,`package.json`),`utf-8`));if(t.name)return t.name.replace(/^@[^/]+\//,``)}catch{}return e.split(`/`).findLast(Boolean)??`app`}function g(e,t){if(t)return t;try{let t=JSON.parse(d(l(e,`package.json`),`utf-8`));if(t.packageManager)return t.packageManager.split(`@`)[0]}catch{}return`pnpm`}async function _(e){try{return(await c(e))?.modules?.style===`class`?`class`:`define`}catch{return`define`}}async function v(e,t){if(t)return t;try{let t=(await c(e))?.pattern;if(t&&m.has(t))return t}catch{}return`rest`}async function y(e){let c=e.only??`all`,d=h(e.outDir,e.name),f=g(e.outDir,e.pm),m=await v(e.outDir,e.template),y=await _(e.outDir),b=c===`agents`||c===`both`||c===`all`,x=c===`claude`||c===`both`||c===`all`,S=c===`skills`||c===`all`,C=c===`gemini`||c===`all`,w=c===`copilot`||c===`all`,T=[];if(b&&T.push({file:l(e.outDir,p,`AGENTS.md`),render:()=>o(d,m,f)}),x&&T.push({file:l(e.outDir,`CLAUDE.md`),render:()=>i(d,m,f)}),S)for(let n of t(d,m,f,y))T.push({file:l(e.outDir,p,`skills`,n.slug,`SKILL.md`),render:()=>n.content});C&&T.push({file:l(e.outDir,p,`GEMINI.md`),render:()=>n(d,m,f)}),w&&T.push({file:l(e.outDir,p,`COPILOT.md`),render:()=>a(d,m,f)});let E=[];for(let{file:t,render:n}of T){if(u(t)&&!e.force&&!await s({message:`${t.replace(e.outDir+`/`,``)} already exists. Overwrite?`,initialValue:!1})){console.log(` Skipped — existing ${t.replace(e.outDir+`/`,``)} preserved.`);continue}await r(t,n()),E.push(t)}return E}export{y as n,f as t};
|
|
12
|
-
//# sourceMappingURL=agent-docs-CXs5UDAM.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-docs-CXs5UDAM.mjs","names":[],"sources":["../src/generators/agent-docs.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { writeFileSafe } from '../utils/fs'\nimport { confirm } from '../utils/prompts'\nimport {\n generateClaude,\n generateAgents,\n generateKickJsSkillFiles,\n generateGemini,\n generateCopilot,\n} from './templates/project-docs'\nimport { loadKickConfig } from '../config'\nimport type { ModuleStyle } from './templates/types'\n\ntype ProjectTemplate = 'rest' | 'minimal' | 'fullstack'\n\n/**\n * Subdirectory (relative to the project root) where every shared\n * agent-context file lands. CLAUDE.md is the only exception — it stays\n * at the project root because Claude Code auto-loads CLAUDE.md from\n * there. CLAUDE.md is generated as a thin pointer that tells Claude\n * to read `.agents/AGENTS.md` first.\n *\n * Existing root-level AGENTS.md / kickjs-skills.md files (from older\n * scaffolds before this restructure) are left untouched — the\n * generator emits the new layout alongside them and leaves migration\n * to the adopter.\n */\nconst AGENTS_DIR = '.agents'\n\nexport interface GenerateAgentDocsOptions {\n outDir: string\n /** Override project name (defaults to package.json `name`). */\n name?: string\n /** Override package manager (defaults to package.json `packageManager` field, then 'pnpm'). */\n pm?: string\n /** Override template (defaults to kick.config.ts `pattern`, then 'rest'). */\n template?: ProjectTemplate\n /**\n * Which file(s) to (re)generate. All `.agents/`-bound files land in\n * the project's `.agents/` subdirectory; `claude` is the only file\n * that stays at the project root.\n *\n * - `agents` → `.agents/AGENTS.md`\n * - `claude` → `CLAUDE.md` (root; thin pointer to .agents/)\n * - `skills` → `.agents/skills/<slug>/SKILL.md` (one per skill)\n * - `gemini` → `.agents/GEMINI.md`\n * - `copilot` → `.agents/COPILOT.md`\n * - `both` → `.agents/AGENTS.md` + `CLAUDE.md` (legacy alias)\n * - `all` → every file above\n */\n only?: 'agents' | 'claude' | 'skills' | 'gemini' | 'copilot' | 'both' | 'all'\n /** Skip the overwrite prompt. */\n force?: boolean\n}\n\nconst VALID_TEMPLATES = new Set<ProjectTemplate>(['rest', 'minimal', 'fullstack'])\n\nfunction detectName(outDir: string, override?: string): string {\n if (override) return override\n try {\n const pkg = JSON.parse(readFileSync(join(outDir, 'package.json'), 'utf-8')) as { name?: string }\n if (pkg.name) return pkg.name.replace(/^@[^/]+\\//, '')\n } catch {\n // No package.json — fall back to folder name\n }\n return outDir.split('/').findLast(Boolean) ?? 'app'\n}\n\nfunction detectPm(outDir: string, override?: string): string {\n if (override) return override\n try {\n const pkg = JSON.parse(readFileSync(join(outDir, 'package.json'), 'utf-8')) as {\n packageManager?: string\n }\n if (pkg.packageManager) return pkg.packageManager.split('@')[0]\n } catch {\n // ignore\n }\n return 'pnpm'\n}\n\n/**\n * Module declaration style, so generated examples show the form this project\n * actually uses. A `class` module passed as `UserModule()` calls a class\n * without `new`; a `define` module passed bare is refused when it takes config.\n */\nasync function detectStyle(outDir: string): Promise<ModuleStyle> {\n try {\n const cfg = await loadKickConfig(outDir)\n return cfg?.modules?.style === 'class' ? 'class' : 'define'\n } catch {\n return 'define'\n }\n}\n\nasync function detectTemplate(\n outDir: string,\n override?: ProjectTemplate,\n): Promise<ProjectTemplate> {\n if (override) return override\n try {\n const cfg = await loadKickConfig(outDir)\n const pattern = cfg?.pattern as ProjectTemplate | undefined\n if (pattern && VALID_TEMPLATES.has(pattern)) return pattern\n } catch {\n // ignore\n }\n return 'rest'\n}\n\nexport async function generateAgentDocs(options: GenerateAgentDocsOptions): Promise<string[]> {\n const only = options.only ?? 'all'\n const name = detectName(options.outDir, options.name)\n const pm = detectPm(options.outDir, options.pm)\n const template = await detectTemplate(options.outDir, options.template)\n const style = await detectStyle(options.outDir)\n\n const wantsAgents = only === 'agents' || only === 'both' || only === 'all'\n const wantsClaude = only === 'claude' || only === 'both' || only === 'all'\n const wantsSkills = only === 'skills' || only === 'all'\n const wantsGemini = only === 'gemini' || only === 'all'\n const wantsCopilot = only === 'copilot' || only === 'all'\n\n // CLAUDE.md stays at the project root because Claude Code auto-loads\n // it from there. Every other shared-context file lands under\n // `.agents/` so the root stays uncluttered. `writeFileSafe` creates\n // parent directories automatically — no need to pre-mkdir.\n const targets: { file: string; render: () => string }[] = []\n if (wantsAgents) {\n targets.push({\n file: join(options.outDir, AGENTS_DIR, 'AGENTS.md'),\n render: () => generateAgents(name, template, pm),\n })\n }\n if (wantsClaude) {\n targets.push({\n file: join(options.outDir, 'CLAUDE.md'),\n render: () => generateClaude(name, template, pm),\n })\n }\n if (wantsSkills) {\n // Per-skill SKILL.md under `.agents/skills/<slug>/` so agents that\n // auto-discover skills (Claude Code, Copilot CLI plugins, Gemini's\n // activate_skill) pick each up by its frontmatter without needing\n // a separate index file.\n for (const skill of generateKickJsSkillFiles(name, template, pm, style)) {\n targets.push({\n file: join(options.outDir, AGENTS_DIR, 'skills', skill.slug, 'SKILL.md'),\n render: () => skill.content,\n })\n }\n }\n if (wantsGemini) {\n targets.push({\n file: join(options.outDir, AGENTS_DIR, 'GEMINI.md'),\n render: () => generateGemini(name, template, pm),\n })\n }\n if (wantsCopilot) {\n targets.push({\n file: join(options.outDir, AGENTS_DIR, 'COPILOT.md'),\n render: () => generateCopilot(name, template, pm),\n })\n }\n\n const written: string[] = []\n for (const { file, render } of targets) {\n if (existsSync(file) && !options.force) {\n const overwrite = await confirm({\n message: `${file.replace(options.outDir + '/', '')} already exists. Overwrite?`,\n initialValue: false,\n })\n if (!overwrite) {\n console.log(` Skipped — existing ${file.replace(options.outDir + '/', '')} preserved.`)\n continue\n }\n }\n await writeFileSafe(file, render())\n written.push(file)\n }\n return written\n}\n"],"mappings":"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"}
|
package/dist/config-BUYf44lU.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.5.0
|
|
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{t as e}from"./rolldown-runtime-DzFISCwE.mjs";import{isAbsolute as t,join as n,relative as r,resolve as i}from"node:path";import{existsSync as a,mkdirSync as o,readFileSync as s,writeFileSync as c}from"node:fs";import{access as l,readFile as u}from"node:fs/promises";var d=e({BUILTIN_REPO_TYPES:()=>p,DEPRECATED_REPO_TYPES:()=>m,PACKAGE_MANAGERS:()=>f,defineConfig:()=>g,hasDependency:()=>_,hasSwagger:()=>v,loadKickConfig:()=>w,resolveModuleConfig:()=>S,resolveSchemaLib:()=>y,resolveTokenScope:()=>b,validateAssetMap:()=>E,warnIfDeprecatedRepo:()=>h,writeAssetConfigSnapshot:()=>T});const f=[`pnpm`,`npm`,`yarn`,`bun`],p=[`inmemory`],m=[`prisma`,`drizzle`];function h(e){return m.includes(e)?(console.warn(` Note: '${e}' is no longer a built-in repository preset — a repository shaped to it is that library's interface, not KickJS's.\n Scaffolding a generic custom-repository stub instead; wire it to ${e} yourself.`),!0):!1}function g(e){return e}function _(e,t,r=`runtime`){try{let i=n(e,`package.json`);if(!a(i))return!1;let o=JSON.parse(s(i,`utf-8`));return o.dependencies?.[t]?!0:r===`any`&&!!o.devDependencies?.[t]}catch{return!1}}function v(e){return _(e,`@forinda/kickjs-swagger`,`runtime`)}function y(e){return _(e,`valibot`,`runtime`)?`valibot`:_(e,`yup`,`runtime`)?`yup`:`zod`}function b(e,t){if(e?.tokenScope&&typeof e.tokenScope==`string`&&e.tokenScope.length>0){let t=x(e.tokenScope);if(t.length>0)return t}try{let e=n(t,`package.json`);if(a(e)){let t=JSON.parse(s(e,`utf-8`));if(typeof t.name==`string`&&t.name.length>0){let e=t.name.match(/^@([^/]+)\//),n=x(e?e[1]:t.name);if(n.length>0)return n}}}catch{}return`app`}function x(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,`-`).replace(/^-+|-+$/g,``).replace(/-{2,}/g,`-`)}function S(e){if(!e)return{};let t={dir:e.modules?.dir,repo:e.modules?.repo,schemaDir:e.modules?.schemaDir,pluralize:e.modules?.pluralize,style:e.modules?.style};return t.style!==void 0&&t.style!==`define`&&t.style!==`class`&&(console.warn(` Warning: modules.style '${t.style}' is not a valid value (expected 'define' or 'class'). Falling back to 'define'.`),t.style=`define`),t.repo&&typeof t.repo==`string`&&!p.includes(t.repo)&&(h(t.repo)||console.warn(` Warning: modules.repo '${t.repo}' is not a built-in type (${p.join(`, `)}). It will generate a stub repository. Use { name: '${t.repo}' } to silence this warning.`)),t}const C=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];async function w(e){let{findProjectRoot:t}=await import(`./project-root-BzyIWFlH.mjs`).then(e=>e.n),r=t(e);for(let e of C){let t=n(r,e);try{await l(t)}catch{continue}if(e.endsWith(`.json`)){let e=await u(t,`utf-8`);return JSON.parse(e)}if(e.endsWith(`.ts`)){let n;try{n=await import(`jiti`)}catch(t){let n=t instanceof Error?t.message:String(t);n.includes(`Cannot find package 'jiti'`)||n.includes(`ERR_MODULE_NOT_FOUND`)?console.warn(`Warning: Failed to load ${e} — 'jiti' is required for TypeScript configs. Run \`pnpm add -D jiti\` (or your package manager's equivalent), or rename the file to kick.config.js / kick.config.mjs / kick.config.json.`):console.warn(`Warning: Failed to initialize jiti for ${e}: ${n}`);continue}try{let e=await n.createJiti(r,{interopDefault:!0,fsCache:!1}).import(t,{default:!0}),i=E(e,r);for(let e of i)console.warn(` Warning: ${e}`);return T(r,e),e}catch(t){let n=t instanceof Error?t.message:String(t);console.warn(`Warning: Failed to load ${e}: ${n}`);continue}}try{let{pathToFileURL:e}=await import(`node:url`),n=await import(e(t).href),i=n.default??n,a=E(i,r);for(let e of a)console.warn(` Warning: ${e}`);return T(r,i),i}catch(t){let n=t instanceof Error?t.message:String(t);console.warn(`Warning: Failed to load ${e}: ${n}`);continue}}return null}function T(e,t){if(t?.assetMap&&Object.keys(t.assetMap).length!==0)try{let r=n(e,`.kickjs`);o(r,{recursive:!0});let i={version:1,assetMap:t.assetMap,...t.build?.outDir?{build:{outDir:t.build.outDir}}:{}};c(n(r,`kick.config.json`),JSON.stringify(i,null,2)+`
|
|
12
|
-
`,`utf-8`)}catch{}}function E(e,t){let n=[];if(!e?.assetMap)return n;let r=i(t);for(let[o,s]of Object.entries(e.assetMap)){if(!o||o.includes(`/`)){n.push(`assetMap key '${o}' is invalid — must be a non-empty string without '/'`);continue}if(typeof s?.src!=`string`||s.src.length===0){n.push(`assetMap.${o} is missing a non-empty 'src' field`);continue}let e=i(t,s.src);a(e)||n.push(`assetMap.${o}.src ('${s.src}') does not exist — typegen + build will fail`),s.dest&&D(i(t,s.dest),r)&&n.push(`assetMap.${o}.dest ('${s.dest}') resolves outside the project root — refusing to copy`)}return n}function D(e,n){let i=r(n,e);return i===``?!1:i.startsWith(`..`)||t(i)}export{v as a,y as c,_ as i,b as l,d as n,w as o,g as r,S as s,f as t,h as u};
|
|
13
|
-
//# sourceMappingURL=config-BUYf44lU.mjs.map
|