kodu 2.1.0 → 2.1.2

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.
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: liteend-init
3
+ description: Bootstrap a new backend project from LiteEnd template with Docker, Prisma, and initial setup
4
+ ---
5
+
6
+ You are a senior backend engineer. Your task is to initialize a new project from the LiteEnd template in a clean,
7
+ reproducible way.
8
+
9
+ ## Input
10
+
11
+ - project_name: string (required)
12
+ - use_docker: boolean (default: true)
13
+ - install_deps: boolean (default: true)
14
+
15
+ ## Steps
16
+
17
+ 1. Validate input
18
+
19
+ - Check Node.js version: `node -v` must be >= 20. Fail with a clear message if not.
20
+ - project_name must be a valid folder name (no spaces, no special chars except `-` and `_`)
21
+ - fail if directory already exists and is not empty
22
+
23
+ 2. Scaffold project
24
+ Run:
25
+ npx degit uxname/liteend {{project_name}}
26
+
27
+ 3. Enter directory
28
+ cd {{project_name}}
29
+
30
+ 4. Initialize git (if .git does not exist)
31
+ git init
32
+ git add .
33
+ git commit -m "Initial commit"
34
+
35
+ 5. Setup environment
36
+ If .env does not exist:
37
+ cp .env.example .env
38
+
39
+ 6. Install dependencies (if install_deps = true)
40
+ npm install
41
+
42
+ 7. Start infrastructure (if use_docker = true)
43
+ docker compose up -d db redis
44
+
45
+ 8. Run database migrations
46
+ npm run db:migrations:apply
47
+
48
+ 9. Seed database
49
+ Check if `db:seed` key exists in package.json scripts. If yes:
50
+ npm run db:seed
51
+
52
+ 10. Verify setup
53
+ Launch dev server in background, then check endpoints:
54
+ npm run start:dev &
55
+ - GET /health → expect 200
56
+ - GET /swagger → expect 200
57
+ Stop the dev server after verification.
58
+
59
+ 11. Read project AGENTS.md
60
+ Read the file `AGENTS.md` in the project root to understand conventions,
61
+ available commands, and how to work with this project further.
62
+
63
+ 12. Output result
64
+
65
+ Return:
66
+
67
+ - project path
68
+ - next steps:
69
+ - edit .env (DATABASE_URL, Redis config, etc.)
70
+ - run `docker compose up -d` (if skipped)
71
+ - `npm run start:dev`
72
+
73
+ ## Failure handling
74
+
75
+ - If Node.js < 20 → stop immediately, instruct user to upgrade
76
+ - If docker is not running → suggest fallback to manual PostgreSQL + Redis
77
+ - If migrations fail → show prisma error and suggest checking DATABASE_URL
78
+ - If port is busy → suggest changing PORT in .env
79
+
80
+ ## Notes
81
+
82
+ - Requires Node.js LTS (>=20)
83
+ - Requires Docker for full setup
84
+ - Uses Prisma + PostgreSQL + Redis
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: litefront-init
3
+ description: Bootstrap a new frontend project from LiteFront template with Vite, React, GraphQL, and OIDC setup
4
+ ---
5
+
6
+ You are a senior frontend engineer. Your task is to initialize a new project from the LiteFront template in a
7
+ deterministic and production-aware way.
8
+
9
+ ## Input
10
+
11
+ - project_name: string (required)
12
+ - install_deps: boolean (default: true)
13
+ - setup_env: boolean (default: true)
14
+ - run_dev: boolean (default: true)
15
+
16
+ ## Steps
17
+
18
+ 1. Validate input
19
+
20
+ - Check Node.js version: `node -v` must be >= 20. Fail with a clear message if not.
21
+ - project_name must be a valid folder name (no spaces, no special chars except `-` and `_`)
22
+ - fail if directory exists and is not empty
23
+
24
+ 2. Scaffold project
25
+ Run:
26
+ npx degit uxname/litefront {{project_name}}
27
+
28
+ 3. Enter directory
29
+ cd {{project_name}}
30
+
31
+ 4. Initialize git (if .git does not exist)
32
+ git init
33
+ git add .
34
+ git commit -m "Initial commit"
35
+
36
+ 5. Install dependencies (if install_deps = true)
37
+ npm install
38
+ After install, commit the generated lockfile:
39
+ git add package-lock.json && git commit -m "Add package-lock.json"
40
+
41
+ 6. Setup environment (if setup_env = true)
42
+ If .env does not exist:
43
+ cp .env.example .env
44
+
45
+ Warn user — these variables are REQUIRED before the app works:
46
+ - VITE_GRAPHQL_API_URL (GraphQL endpoint)
47
+ - VITE_BASE_URL
48
+ - VITE_OIDC_AUTHORITY
49
+ - VITE_OIDC_CLIENT_ID
50
+
51
+ 7. Generate GraphQL types
52
+ Only run if VITE_GRAPHQL_API_URL is set in .env AND the endpoint is reachable.
53
+ Run:
54
+ npm run gen
55
+
56
+ If endpoint is not reachable or gen fails:
57
+ - warn user that types generation was skipped
58
+ - instruct to run `npm run gen` manually once the backend is available
59
+
60
+ 8. Run dev server (if run_dev = true)
61
+ npm run start:dev
62
+
63
+ 9. Verify setup (only if run_dev = true)
64
+ - app is accessible at http://localhost:3000 (or PORT from .env)
65
+ - no critical runtime errors in console
66
+ - GraphQL client initializes
67
+
68
+ 10. Read project AGENTS.md
69
+ Read the file `AGENTS.md` in the project root to understand conventions,
70
+ available commands, and how to work with this project further.
71
+
72
+ 11. Output result
73
+
74
+ Return:
75
+
76
+ - project path
77
+ - dev URL
78
+ - checklist:
79
+ - configure .env (OIDC + GraphQL) if not done yet
80
+ - run `npm run gen` after every schema change
81
+ - run `npm run check` before commits
82
+
83
+ ## Failure handling
84
+
85
+ - If Node.js < 20 → stop immediately, instruct user to upgrade
86
+ - If npm install fails → suggest clearing cache: `npm cache clean --force`, then retry
87
+ - If dev server fails → check PORT conflict, suggest changing PORT in .env
88
+ - If GraphQL types fail → backend likely not running; skip gen and continue
89
+ - If auth fails → OIDC misconfiguration; check VITE_OIDC_* vars
90
+
91
+ ## Notes
92
+
93
+ - Requires Node.js LTS (>=20)
94
+ - Designed to pair with LiteEnd backend
95
+ - Uses Vite dev server (fast HMR)
96
+ - GraphQL types MUST be regenerated on schema change
@@ -0,0 +1,285 @@
1
+ ---
2
+ name: project-setup-standardizer
3
+ description: Enforces a unified, production-ready project setup (scripts, linting, testing, biome, lefthook) across any JS/TS project (backend, frontend, CLI, etc.). This skill MUST be invoked when initializing a new project.
4
+ ---
5
+
6
+ **This skill is MANDATORY and must be invoked when creating a new project.**
7
+
8
+ You are responsible for transforming an existing JavaScript/TypeScript project into a **production-ready, standardized
9
+ structure**.
10
+
11
+ Your goal is NOT to suggest — you MUST **apply and enforce** the conventions below.
12
+
13
+ ---
14
+
15
+ ## 1. PROJECT TYPE DETECTION
16
+
17
+ Before making any changes, detect the project type using these signals:
18
+
19
+ | Signal | Type |
20
+ |------------------------------------------------------------------|----------|
21
+ | `dependencies` contains `react` or `vue` | frontend |
22
+ | `devDependencies` contains `vite` (without react/vue) | frontend |
23
+ | `dependencies` contains `@nestjs/core` or `express` or `fastify` | backend |
24
+ | `bin` field exists in package.json | CLI |
25
+ | None of the above | library |
26
+
27
+ Frontend projects get additional tools (stylelint, steiger). All other types share the base setup.
28
+
29
+ ---
30
+
31
+ ## 2. MIGRATION: REMOVE CONFLICTING TOOLS FIRST
32
+
33
+ Before installing Biome, you MUST remove ESLint and Prettier if present:
34
+
35
+ 1. Delete config files: `.eslintrc*`, `.eslintignore`, `.prettierrc*`, `.prettierignore`
36
+ 2. Remove from `package.json` dependencies/devDependencies: `eslint`, `prettier`, and all `eslint-*` / `prettier-*`
37
+ packages
38
+ 3. Only after removal, proceed with Biome setup
39
+
40
+ ---
41
+
42
+ ## 3. PACKAGE.JSON SCRIPTS (MANDATORY STRUCTURE)
43
+
44
+ You MUST normalize `package.json/scripts` into clearly separated sections using visual separators.
45
+
46
+ Use this exact pattern:
47
+
48
+ ```json
49
+ "scripts": {
50
+ "________________ BUILD AND RUN ________________": "",
51
+ "build": "...",
52
+ "start:dev": "...",
53
+ "start:prod": "...",
54
+ "________________ FORMAT AND LINT ________________": "",
55
+ "lint": "biome check",
56
+ "lint:fix": "biome check --write",
57
+ "lint:fix:unsafe": "biome check --write --unsafe",
58
+ "ts:check": "tsc --noEmit",
59
+ "knip": "knip --production",
60
+ "check": "run-p ts:check lint:fix knip",
61
+ "________________ TEST ________________": "",
62
+ "test": "vitest run",
63
+ "test:watch": "vitest",
64
+ "test:cov": "vitest run --coverage",
65
+
66
+ "________________ OTHER ________________": "",
67
+ "prepare": "is-ci || lefthook install",
68
+ "update": "npx npm-check-updates -u && rimraf node_modules package-lock.json && npm i",
69
+ "postupdate": "npm run lint:fix && npm run check"
70
+ }
71
+ ```
72
+
73
+ If the project has distinct unit and e2e test layers, add:
74
+
75
+ ```json
76
+ "test:unit": "...",
77
+ "test:e2e": "...",
78
+ "test:all": "run-s test:unit test:e2e"
79
+ ```
80
+
81
+ Otherwise omit `test:all` — do not duplicate `test` under a different name.
82
+
83
+ ### Rules:
84
+
85
+ - ALWAYS include `check` script → central quality gate
86
+ - ALWAYS include `ts:check`; if no `tsconfig.json` exists, create a minimal one (see section 7)
87
+ - ALWAYS include `knip` for unused exports/deps detection
88
+ - ALWAYS include `lint:fix` in `check`
89
+ - Use `run-p` (from `npm-run-all`) for parallel execution — never `npx run-p`
90
+ - `prepare` MUST use `is-ci || lefthook install` to avoid CI failures when lefthook is not yet installed
91
+
92
+ ---
93
+
94
+ ## 4. FRONTEND-SPECIFIC REQUIREMENTS
95
+
96
+ If project type is **frontend**, additionally include:
97
+
98
+ ```json
99
+ "lint:fsd": "steiger ./src",
100
+ "lint:style": "stylelint '**/*.{css,scss}'",
101
+ "lint:style:fix": "npm run lint:style -- --fix",
102
+ "check": "run-p lint:style ts:check lint:fix knip lint:fsd"
103
+ ```
104
+
105
+ ### Mandatory:
106
+
107
+ - FSD validation via `steiger`
108
+ - stylelint integration
109
+ - include ALL checks in `check`
110
+
111
+ ---
112
+
113
+ ## 5. TESTING STANDARD (MANDATORY)
114
+
115
+ Use **vitest only**.
116
+
117
+ Rules:
118
+
119
+ - NO jest
120
+ - NO mixed frameworks
121
+ - coverage MUST be supported via `test:cov`
122
+
123
+ ---
124
+
125
+ ## 6. BIOME CONFIG (MANDATORY)
126
+
127
+ You MUST ensure `biome.json` exists with this content:
128
+
129
+ ```json
130
+ {
131
+ "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
132
+ "formatter": {
133
+ "enabled": true,
134
+ "indentStyle": "space",
135
+ "lineEnding": "lf"
136
+ },
137
+ "javascript": {
138
+ "formatter": {
139
+ "quoteStyle": "single"
140
+ }
141
+ },
142
+ "linter": {
143
+ "enabled": true,
144
+ "rules": {
145
+ "recommended": true,
146
+ "correctness": {
147
+ "noUnusedImports": "error",
148
+ "noUnusedVariables": "error",
149
+ "noUnusedFunctionParameters": "error"
150
+ }
151
+ }
152
+ },
153
+ "files": {
154
+ "includes": [
155
+ "**",
156
+ "!node_modules",
157
+ "!dist"
158
+ ]
159
+ },
160
+ "vcs": {
161
+ "enabled": true,
162
+ "clientKind": "git",
163
+ "useIgnoreFile": true
164
+ }
165
+ }
166
+ ```
167
+
168
+ ---
169
+
170
+ ## 7. LEFTHOOK (MANDATORY)
171
+
172
+ You MUST write `lefthook.yml` with this exact content:
173
+
174
+ ```yaml
175
+ pre-commit:
176
+ parallel: false
177
+ commands:
178
+ check:
179
+ run: npm run check
180
+
181
+ pre-push:
182
+ parallel: false
183
+ commands:
184
+ test-all:
185
+ run: npm run test:all
186
+ ```
187
+
188
+ Rules:
189
+
190
+ - `check` (lint + types + knip) gates every commit
191
+ - tests gate every push — `pre-push` does NOT re-run `check` (already gated at commit)
192
+ - no bypassing allowed
193
+
194
+ ---
195
+
196
+ ## 8. MINIMAL TSCONFIG (if missing)
197
+
198
+ If `tsconfig.json` does not exist, create it:
199
+
200
+ ```json
201
+ {
202
+ "compilerOptions": {
203
+ "target": "ES2022",
204
+ "module": "NodeNext",
205
+ "moduleResolution": "NodeNext",
206
+ "strict": true,
207
+ "noEmit": true,
208
+ "skipLibCheck": true
209
+ },
210
+ "include": [
211
+ "src",
212
+ "*.ts"
213
+ ]
214
+ }
215
+ ```
216
+
217
+ ---
218
+
219
+ ## 9. REQUIRED DEV DEPENDENCIES
220
+
221
+ Ensure these are installed (add any that are missing):
222
+
223
+ Core (all project types):
224
+
225
+ - `@biomejs/biome`
226
+ - `typescript`
227
+ - `vitest`
228
+ - `lefthook`
229
+ - `is-ci`
230
+ - `npm-run-all`
231
+ - `knip`
232
+ - `rimraf`
233
+ - `npm-check-updates`
234
+
235
+ Frontend only:
236
+
237
+ - `stylelint`
238
+ - `steiger`
239
+
240
+ ---
241
+
242
+ ## 10. ENFORCEMENT LOGIC
243
+
244
+ You MUST follow this order:
245
+
246
+ 1. Detect project type (section 1)
247
+ 2. Remove conflicting tools (section 2)
248
+ 3. Rewrite `package.json` scripts (section 3, or 4 for frontend)
249
+ 4. Write/update `biome.json` (section 6)
250
+ 5. Write/update `lefthook.yml` (section 7)
251
+ 6. Create `tsconfig.json` if missing (section 8)
252
+ 7. Install missing dev dependencies (section 9)
253
+
254
+ NEVER:
255
+
256
+ - keep inconsistent scripts
257
+ - mix tools (eslint + biome)
258
+ - leave partial setup
259
+
260
+ ---
261
+
262
+ ## 11. OUTPUT FORMAT
263
+
264
+ You must output:
265
+
266
+ 1. Updated `package.json` (only the `scripts` and `devDependencies` sections)
267
+ 2. `biome.json`
268
+ 3. `lefthook.yml`
269
+ 4. `tsconfig.json` (if created)
270
+ 5. List of removed files and packages
271
+
272
+ All configs must be **complete and copy-paste ready**.
273
+
274
+ ---
275
+
276
+ ## 12. PRINCIPLE
277
+
278
+ Your job is to enforce:
279
+
280
+ - determinism
281
+ - reproducibility
282
+ - zero-config onboarding
283
+ - strict quality gates
284
+
285
+ If something is ambiguous — choose the stricter option.
@@ -19,13 +19,10 @@ export class ConfigService {
19
19
  const explorer = lilconfigSync('kodu', { searchPlaces: ['kodu.json'] });
20
20
  const result = explorer.search(process.cwd());
21
21
 
22
- if (!result || result.isEmpty || !result.config) {
23
- this.terminate(
24
- 'kodu.json not found. Create it in the project root to configure kodu.',
25
- );
26
- }
22
+ const rawConfig =
23
+ result && !result.isEmpty && result.config ? result.config : {};
27
24
 
28
- const parsed = configSchema.safeParse(result.config);
25
+ const parsed = configSchema.safeParse(rawConfig);
29
26
 
30
27
  if (!parsed.success) {
31
28
  console.error(pc.red('kodu.json is invalid:'));
@@ -1,4 +1,7 @@
1
1
  {
2
2
  "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": false
5
+ },
3
6
  "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
4
7
  }
package/tsconfig.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "target": "ES2023",
3
4
  "module": "nodenext",
4
5
  "moduleResolution": "nodenext",
5
6
  "resolvePackageJsonExports": true,
@@ -10,16 +11,18 @@
10
11
  "emitDecoratorMetadata": true,
11
12
  "experimentalDecorators": true,
12
13
  "allowSyntheticDefaultImports": true,
13
- "target": "ES2023",
14
14
  "sourceMap": true,
15
15
  "outDir": "./dist",
16
16
  "baseUrl": "./",
17
17
  "incremental": true,
18
18
  "skipLibCheck": true,
19
+ "strict": true,
19
20
  "strictNullChecks": true,
20
21
  "forceConsistentCasingInFileNames": true,
21
22
  "noImplicitAny": false,
23
+ "noEmit": true,
22
24
  "strictBindCallApply": false,
23
25
  "noFallthroughCasesInSwitch": false
24
- }
26
+ },
27
+ "include": ["src", "*.ts"]
25
28
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const promises_1 = require("node:fs/promises");
4
- const execa_1 = require("execa");
5
- const config_schema_1 = require("../src/core/config/config.schema");
6
- async function main() {
7
- const schema = config_schema_1.configSchema.toJSONSchema();
8
- const schemaString = JSON.stringify(schema, null, 2);
9
- await (0, promises_1.writeFile)('kodu.schema.json', schemaString, 'utf8');
10
- await (0, execa_1.execa)('biome', ['format', '--write', 'kodu.schema.json']);
11
- console.log('✅ JSON schema generated: kodu.schema.json');
12
- }
13
- main().catch((error) => {
14
- console.error(error);
15
- process.exitCode = 1;
16
- });
17
- //# sourceMappingURL=generate-json-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-json-schema.js","sourceRoot":"","sources":["../../scripts/generate-json-schema.ts"],"names":[],"mappings":";;AAAA,+CAA6C;AAC7C,iCAA8B;AAC9B,oEAAgE;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,4BAAY,CAAC,YAAY,EAAE,CAAC;IAC3C,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAErD,MAAM,IAAA,oBAAS,EAAC,kBAAkB,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;IAC1D,MAAM,IAAA,aAAK,EAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEhE,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;AAC3D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}