@ultrst-armada/krnl 1.0.0 → 1.0.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.
@@ -1,94 +1,79 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import * as fs from "fs";
5
- import * as path from "path";
4
+ import * as fs3 from "fs";
5
+ import * as path3 from "path";
6
6
  import { KrnlPackageReconciler } from "@dinilmusick/krnl-core";
7
- var rawArg = process.argv[2] || "my-krnl-app";
8
- var targetDir = path.resolve(process.cwd(), rawArg);
9
- var projectName = path.basename(targetDir);
10
- console.log(`
11
- \u{1F680} [create-krnl] Scaffolding new Krnl project with symmetric backend/frontend planes in: ${targetDir}
12
- `);
13
- if (fs.existsSync(targetDir)) {
14
- console.error(`\u274C Directory "${projectName}" already exists.`);
15
- process.exit(1);
7
+
8
+ // src/templates/configTemplates.ts
9
+ function getBasePackageJson(projectName2) {
10
+ return JSON.stringify(
11
+ {
12
+ name: projectName2,
13
+ version: "1.0.0",
14
+ description: "Full-stack application powered by Krnl symmetric architecture",
15
+ type: "module",
16
+ main: "dist/index.js",
17
+ scripts: {
18
+ dev: "krnl dev",
19
+ build: "krnl build",
20
+ validate: "krnl validate",
21
+ test: "vitest run",
22
+ sync: "krnl sync"
23
+ },
24
+ dependencies: {
25
+ "@dinilmusick/krnl": "^1.0.0",
26
+ "@dinilmusick/krnl-core": "^1.0.0",
27
+ "@dinilmusick/krnl-ui": "^1.0.0"
28
+ },
29
+ devDependencies: {
30
+ "@dinilmusick/krnl-cli": "^1.0.0",
31
+ "@dinilmusick/krnl-validate": "^1.0.0",
32
+ "@dinilmusick/eslint-plugin-krnl": "^1.0.0",
33
+ typescript: "^5.7.3",
34
+ vitest: "^1.6.0"
35
+ }
36
+ },
37
+ null,
38
+ 2
39
+ );
16
40
  }
17
- fs.mkdirSync(targetDir, { recursive: true });
18
- var bLibDir = path.join(targetDir, "krnl", "backend", "libraries", "AppConcepts");
19
- var bEntityDir = path.join(targetDir, "krnl", "backend", "entities", "App");
20
- var bFuncDir = path.join(targetDir, "krnl", "backend", "functionalities", "Hello");
21
- fs.mkdirSync(path.join(bLibDir, "tests"), { recursive: true });
22
- fs.mkdirSync(path.join(bEntityDir, "orchestrations"), { recursive: true });
23
- fs.mkdirSync(path.join(bEntityDir, "tests"), { recursive: true });
24
- fs.mkdirSync(path.join(bFuncDir, "main_function"), { recursive: true });
25
- fs.mkdirSync(path.join(bFuncDir, "state_data"), { recursive: true });
26
- fs.mkdirSync(path.join(bFuncDir, "helper_functions"), { recursive: true });
27
- fs.mkdirSync(path.join(bFuncDir, "events"), { recursive: true });
28
- fs.mkdirSync(path.join(bFuncDir, "tests"), { recursive: true });
29
- var fLibDir = path.join(targetDir, "krnl", "frontend", "libraries", "ButtonConcepts");
30
- var fEntityDir = path.join(targetDir, "krnl", "frontend", "entities", "App");
31
- var fFuncDir = path.join(targetDir, "krnl", "frontend", "functionalities", "Hello");
32
- fs.mkdirSync(path.join(fLibDir, "tests"), { recursive: true });
33
- fs.mkdirSync(path.join(fEntityDir, "tests"), { recursive: true });
34
- fs.mkdirSync(path.join(fFuncDir, "tests"), { recursive: true });
35
- fs.mkdirSync(path.join(targetDir, "docs"), { recursive: true });
36
- fs.mkdirSync(path.join(targetDir, ".skipo"), { recursive: true });
37
- fs.writeFileSync(path.join(targetDir, "package.json"), JSON.stringify({
38
- name: projectName,
39
- version: "1.0.0",
40
- description: "Full-stack application powered by Krnl symmetric architecture",
41
- type: "module",
42
- main: "dist/index.js",
43
- scripts: {
44
- dev: "krnl dev",
45
- build: "krnl build",
46
- validate: "krnl validate",
47
- test: "vitest run",
48
- sync: "krnl sync"
49
- },
50
- dependencies: {
51
- "@dinilmusick/krnl": "^1.0.0",
52
- "@dinilmusick/krnl-core": "^1.0.0",
53
- "@dinilmusick/krnl-ui": "^1.0.0"
54
- },
55
- devDependencies: {
56
- "@dinilmusick/krnl-cli": "^1.0.0",
57
- "@dinilmusick/krnl-validate": "^1.0.0",
58
- "@dinilmusick/eslint-plugin-krnl": "^1.0.0",
59
- "typescript": "^5.7.3",
60
- "vitest": "^1.6.0"
61
- }
62
- }, null, 2));
63
- fs.writeFileSync(path.join(targetDir, "tsconfig.json"), JSON.stringify({
64
- compilerOptions: {
65
- target: "ESNext",
66
- module: "NodeNext",
67
- moduleResolution: "NodeNext",
68
- lib: ["ESNext", "DOM"],
69
- jsx: "react-jsx",
70
- strict: true,
71
- outDir: "./dist",
72
- skipLibCheck: true,
73
- resolveJsonModule: true,
74
- paths: {
75
- "@/*": ["./krnl/*"]
76
- }
77
- },
78
- include: ["krnl/**/*", `${projectName}.ts`, "krnl-magnetic.d.ts"],
79
- exclude: ["node_modules", "dist"]
80
- }, null, 2));
81
- fs.writeFileSync(path.join(targetDir, `${projectName}.ts`), `import { defineApp, Protocols } from "@dinilmusick/krnl-core";
41
+ function getTsConfig(projectName2) {
42
+ return JSON.stringify(
43
+ {
44
+ compilerOptions: {
45
+ target: "ESNext",
46
+ module: "NodeNext",
47
+ moduleResolution: "NodeNext",
48
+ lib: ["ESNext", "DOM"],
49
+ jsx: "react-jsx",
50
+ strict: true,
51
+ outDir: "./dist",
52
+ skipLibCheck: true,
53
+ resolveJsonModule: true,
54
+ paths: {
55
+ "@/*": ["./krnl/*"]
56
+ }
57
+ },
58
+ include: ["krnl/**/*", `${projectName2}.ts`, "krnl-magnetic.d.ts"],
59
+ exclude: ["node_modules", "dist"]
60
+ },
61
+ null,
62
+ 2
63
+ );
64
+ }
65
+ function getAppEntrypoint(projectName2) {
66
+ return `import { defineApp, Protocols } from "@dinilmusick/krnl-core";
82
67
  import { App } from "./krnl/backend/entities/App/App.js";
83
68
 
84
69
  export default defineApp({
85
- name: "${projectName}",
70
+ name: "${projectName2}",
86
71
  version: "1.0.0",
87
- description: "${projectName} application entrypoint",
72
+ description: "${projectName2} application entrypoint",
88
73
  protocols: [
89
74
  Protocols.HTTP({ port: 8080, prefix: "/api" }),
90
75
  Protocols.WebSocket({ port: 8081 }),
91
- Protocols.MCP({ name: "${projectName}-agent-tools" })
76
+ Protocols.MCP({ name: "${projectName2}-agent-tools" })
92
77
  ],
93
78
  entities: [
94
79
  App
@@ -98,199 +83,170 @@ export default defineApp({
98
83
  variant: 0
99
84
  }
100
85
  });
101
- `);
102
- fs.writeFileSync(path.join(bLibDir, "definitions.ts"), `/**
103
- * @file definitions.ts
104
- * @role component
105
- * @description Types, interfaces, and contracts for AppConcepts.
106
- */
107
-
108
- export interface AppTransformOptions {
109
- normalize?: boolean;
86
+ `;
110
87
  }
111
- `);
112
- fs.writeFileSync(path.join(bLibDir, "functions.ts"), `/**
113
- * @file functions.ts
114
- * @role component
115
- * @description Pure functions (Layer 0A) for AppConcepts.
116
- */
117
-
118
- import type { AppTransformOptions } from "./definitions.js";
119
88
 
120
- export function pureTransform<T>(data: T, _options?: AppTransformOptions): T {
121
- return data;
122
- }
123
- `);
124
- fs.writeFileSync(path.join(bLibDir, "manifest.json"), JSON.stringify({
125
- name: "AppConcepts",
126
- description: "Core utility concept library for App",
127
- dependencies: {}
128
- }, null, 2));
129
- fs.writeFileSync(path.join(bLibDir, "tests", "AppConcepts.test.ts"), `import { describe, it, expect } from "vitest";
89
+ // src/templates/backendTemplates.ts
90
+ import * as fs from "fs";
91
+ import * as path from "path";
92
+ function scaffoldBackend(targetDir2) {
93
+ const bLibDir = path.join(targetDir2, "krnl", "backend", "libraries", "AppConcepts");
94
+ const bEntityDir = path.join(targetDir2, "krnl", "backend", "entities", "App");
95
+ const bFuncDir = path.join(targetDir2, "krnl", "backend", "functionalities", "Hello");
96
+ fs.mkdirSync(path.join(bLibDir, "tests"), { recursive: true });
97
+ fs.mkdirSync(path.join(bEntityDir, "orchestrations"), { recursive: true });
98
+ fs.mkdirSync(path.join(bEntityDir, "tests"), { recursive: true });
99
+ fs.mkdirSync(path.join(bFuncDir, "main_function"), { recursive: true });
100
+ fs.mkdirSync(path.join(bFuncDir, "state_data"), { recursive: true });
101
+ fs.mkdirSync(path.join(bFuncDir, "helper_functions"), { recursive: true });
102
+ fs.mkdirSync(path.join(bFuncDir, "events"), { recursive: true });
103
+ fs.mkdirSync(path.join(bFuncDir, "tests"), { recursive: true });
104
+ fs.writeFileSync(
105
+ path.join(bLibDir, "definitions.ts"),
106
+ `export interface AppTransformOptions { normalize?: boolean; }
107
+ `
108
+ );
109
+ fs.writeFileSync(
110
+ path.join(bLibDir, "functions.ts"),
111
+ `import type { AppTransformOptions } from "./definitions.js";
112
+ export function pureTransform<T>(data: T, _options?: AppTransformOptions): T { return data; }
113
+ `
114
+ );
115
+ fs.writeFileSync(
116
+ path.join(bLibDir, "manifest.json"),
117
+ JSON.stringify({ name: "AppConcepts", description: "Core utility concept library for App", dependencies: {} }, null, 2)
118
+ );
119
+ fs.writeFileSync(
120
+ path.join(bLibDir, "tests", "AppConcepts.test.ts"),
121
+ `import { describe, it, expect } from "vitest";
130
122
  import { pureTransform } from "../functions.js";
131
-
132
- describe("AppConcepts", () => {
133
- it("transforms data deterministically", () => {
134
- expect(pureTransform(42)).toBe(42);
135
- });
136
- });
137
- `);
138
- fs.writeFileSync(path.join(bEntityDir, "App.ts"), `import { Entity, KrnlMagneticLoader } from "@dinilmusick/krnl-core";
139
-
140
- /**
141
- * @role skeleton
142
- */
123
+ describe("AppConcepts", () => { it("transforms data", () => { expect(pureTransform(42)).toBe(42); }); });
124
+ `
125
+ );
126
+ fs.writeFileSync(
127
+ path.join(bEntityDir, "App.ts"),
128
+ `import { Entity, KrnlMagneticLoader } from "@dinilmusick/krnl-core";
143
129
  export class App extends Entity {
144
- constructor() {
145
- super({
146
- id: "App",
147
- version: "1.0.0",
148
- description: "Root application entity"
149
- });
150
- }
151
-
152
- async boot(): Promise<void> {
153
- await KrnlMagneticLoader.loadAll(this, import.meta.url);
154
- }
130
+ constructor() { super({ id: "App", version: "1.0.0", description: "Root application entity" }); }
131
+ async boot(): Promise<void> { await KrnlMagneticLoader.loadAll(this, import.meta.url); }
155
132
  }
156
-
157
133
  export default App;
158
- `);
159
- fs.writeFileSync(path.join(bEntityDir, "orchestrations", "BootFlow.ts"), `import { KrnlFlowBuilder } from "@dinilmusick/krnl-core";
160
-
161
- export function configureBootFlow(entity: any) {
162
- return entity.flow("bootSequence")
163
- .thenFunctionality("Hello")
164
- .register({ visibility: "public" });
134
+ `
135
+ );
136
+ fs.writeFileSync(
137
+ path.join(bEntityDir, "orchestrations", "BootFlow.ts"),
138
+ `export function configureBootFlow(entity: any) {
139
+ return entity.flow("bootSequence").thenFunctionality("Hello").register({ visibility: "public" });
165
140
  }
166
- `);
167
- fs.writeFileSync(path.join(bEntityDir, "tests", "App.test.ts"), `import { describe, it, expect } from "vitest";
141
+ `
142
+ );
143
+ fs.writeFileSync(
144
+ path.join(bEntityDir, "tests", "App.test.ts"),
145
+ `import { describe, it, expect } from "vitest";
168
146
  import { App } from "../App.js";
169
-
170
- describe("App Entity", () => {
171
- it("initializes with id App", () => {
172
- const app = new App();
173
- expect(app.id).toBe("App");
174
- });
175
- });
176
- `);
177
- fs.writeFileSync(path.join(bFuncDir, "HelloAtom.ts"), `export interface HelloInput {
178
- name?: string;
179
- }
180
-
181
- export interface HelloOutput {
182
- greeting: string;
183
- timestamp: number;
184
- }
185
- `);
186
- fs.writeFileSync(path.join(bFuncDir, "manifest.json"), JSON.stringify({
187
- name: "Hello",
188
- description: "Greeting quad-unit functionality",
189
- dependencies: {}
190
- }, null, 2));
191
- fs.writeFileSync(path.join(bFuncDir, "main_function", "logic.ts"), `import type { HelloInput, HelloOutput } from "../HelloAtom.js";
147
+ describe("App Entity", () => { it("initializes with id App", () => { expect(new App().id).toBe("App"); }); });
148
+ `
149
+ );
150
+ fs.writeFileSync(
151
+ path.join(bFuncDir, "HelloAtom.ts"),
152
+ `export interface HelloInput { name?: string; }
153
+ export interface HelloOutput { greeting: string; timestamp: number; }
154
+ `
155
+ );
156
+ fs.writeFileSync(
157
+ path.join(bFuncDir, "manifest.json"),
158
+ JSON.stringify({ name: "Hello", description: "Greeting quad-unit functionality", dependencies: {} }, null, 2)
159
+ );
160
+ fs.writeFileSync(
161
+ path.join(bFuncDir, "main_function", "logic.ts"),
162
+ `import type { HelloInput, HelloOutput } from "../HelloAtom.js";
192
163
  import { formatGreeting } from "../helper_functions/formatGreeting.js";
193
-
194
164
  export const main = async (input: HelloInput, { state }: any): Promise<HelloOutput> => {
195
165
  const greeting = formatGreeting(input.name || "World");
196
166
  if (state) state.callCount = (state.callCount || 0) + 1;
197
- return {
198
- greeting,
199
- timestamp: Date.now()
200
- };
167
+ return { greeting, timestamp: Date.now() };
201
168
  };
202
- `);
203
- fs.writeFileSync(path.join(bFuncDir, "main_function", "lifecycle.ts"), `export async function onMount() {
204
- console.log("[Hello] Mounted");
205
- }
206
-
207
- export async function onTeardown() {
208
- console.log("[Hello] Teardown");
209
- }
210
- `);
211
- fs.writeFileSync(path.join(bFuncDir, "state_data", "state.ts"), `export interface HelloState {
212
- callCount: number;
213
- }
214
-
215
- export const initialState: HelloState = {
216
- callCount: 0
217
- };
218
- `);
219
- fs.writeFileSync(path.join(bFuncDir, "helper_functions", "formatGreeting.ts"), `/**
220
- * @role component
221
- */
222
- export function formatGreeting(name: string): string {
223
- return "Hello, " + name + "! Welcome to Krnl.";
224
- }
225
- `);
226
- fs.writeFileSync(path.join(bFuncDir, "events", "helloEvents.ts"), `/**
227
- * @role component
228
- */
229
- export interface HelloGreetedEvent {
230
- name: string;
231
- timestamp: number;
232
- }
233
- `);
234
- fs.writeFileSync(path.join(bFuncDir, "tests", "Hello.test.ts"), `import { describe, it, expect } from "vitest";
169
+ `
170
+ );
171
+ fs.writeFileSync(
172
+ path.join(bFuncDir, "main_function", "lifecycle.ts"),
173
+ `export async function onMount() {}
174
+ export async function onTeardown() {}
175
+ `
176
+ );
177
+ fs.writeFileSync(
178
+ path.join(bFuncDir, "state_data", "state.ts"),
179
+ `export interface HelloState { callCount: number; }
180
+ export const initialState: HelloState = { callCount: 0 };
181
+ `
182
+ );
183
+ fs.writeFileSync(
184
+ path.join(bFuncDir, "helper_functions", "formatGreeting.ts"),
185
+ `export function formatGreeting(name: string): string { return "Hello, " + name + "! Welcome to Krnl."; }
186
+ `
187
+ );
188
+ fs.writeFileSync(
189
+ path.join(bFuncDir, "events", "helloEvents.ts"),
190
+ `export interface HelloGreetedEvent { name: string; timestamp: number; }
191
+ `
192
+ );
193
+ fs.writeFileSync(
194
+ path.join(bFuncDir, "tests", "Hello.test.ts"),
195
+ `import { describe, it, expect } from "vitest";
235
196
  import { formatGreeting } from "../helper_functions/formatGreeting.js";
236
-
237
- describe("Hello functionality", () => {
238
- it("formats greeting properly", () => {
239
- expect(formatGreeting("Alice")).toContain("Alice");
240
- });
241
- });
242
- `);
243
- fs.writeFileSync(path.join(fLibDir, "definitions.ts"), `export type ButtonVariant = "primary" | "secondary" | "danger" | "ghost";
244
-
245
- export interface ButtonProps {
246
- label: string;
247
- variant?: ButtonVariant;
248
- disabled?: boolean;
249
- onClick?: () => void;
197
+ describe("Hello functionality", () => { it("formats greeting", () => { expect(formatGreeting("Alice")).toContain("Alice"); }); });
198
+ `
199
+ );
250
200
  }
251
- `);
252
- fs.writeFileSync(path.join(fLibDir, "components.tsx"), `import React from "react";
201
+
202
+ // src/templates/frontendTemplates.ts
203
+ import * as fs2 from "fs";
204
+ import * as path2 from "path";
205
+ function scaffoldFrontend(targetDir2, projectName2) {
206
+ const fLibDir = path2.join(targetDir2, "krnl", "frontend", "libraries", "ButtonConcepts");
207
+ const fEntityDir = path2.join(targetDir2, "krnl", "frontend", "entities", "App");
208
+ const fFuncDir = path2.join(targetDir2, "krnl", "frontend", "functionalities", "Hello");
209
+ fs2.mkdirSync(path2.join(fLibDir, "tests"), { recursive: true });
210
+ fs2.mkdirSync(path2.join(fEntityDir, "tests"), { recursive: true });
211
+ fs2.mkdirSync(path2.join(fFuncDir, "tests"), { recursive: true });
212
+ fs2.mkdirSync(path2.join(targetDir2, "docs"), { recursive: true });
213
+ fs2.mkdirSync(path2.join(targetDir2, ".skipo"), { recursive: true });
214
+ fs2.writeFileSync(
215
+ path2.join(fLibDir, "definitions.ts"),
216
+ `export type ButtonVariant = "primary" | "secondary";
217
+ export interface ButtonProps { label: string; variant?: ButtonVariant; disabled?: boolean; onClick?: () => void; }
218
+ `
219
+ );
220
+ fs2.writeFileSync(
221
+ path2.join(fLibDir, "components.tsx"),
222
+ `import React from "react";
253
223
  import type { ButtonProps } from "./definitions.js";
254
224
  import "./styles.css";
255
-
256
225
  export const Button: React.FC<ButtonProps> = ({ label, variant = "primary", disabled, onClick }) => {
257
- return (
258
- <button className={"krnl-btn krnl-btn--" + variant} disabled={disabled} onClick={onClick}>
259
- {label}
260
- </button>
261
- );
226
+ return <button className={"krnl-btn krnl-btn--" + variant} disabled={disabled} onClick={onClick}>{label}</button>;
262
227
  };
263
- `);
264
- fs.writeFileSync(path.join(fLibDir, "styles.css"), `.krnl-btn {
265
- padding: 8px 16px;
266
- border-radius: 4px;
267
- font-weight: 600;
268
- cursor: pointer;
269
- border: 2px solid #111;
270
- box-shadow: 2px 2px 0px #111;
271
- }
272
- .krnl-btn--primary {
273
- background: #38bdf8;
274
- color: #0f172a;
275
- }
276
- `);
277
- fs.writeFileSync(path.join(fLibDir, "manifest.json"), JSON.stringify({
278
- name: "ButtonConcepts",
279
- dependencies: {
280
- "react": "^18.3.1"
281
- }
282
- }, null, 2));
283
- fs.writeFileSync(path.join(fLibDir, "tests", "Button.test.tsx"), `import { describe, it, expect } from "vitest";
284
-
285
- describe("Button component", () => {
286
- it("defined correctly", () => {
287
- expect(true).toBe(true);
288
- });
289
- });
290
- `);
291
- fs.writeFileSync(path.join(fEntityDir, "App0.tsx"), `import React from "react";
228
+ `
229
+ );
230
+ fs2.writeFileSync(
231
+ path2.join(fLibDir, "styles.css"),
232
+ `.krnl-btn { padding: 8px 16px; border-radius: 4px; font-weight: 600; cursor: pointer; }
233
+ .krnl-btn--primary { background: #38bdf8; color: #0f172a; }
234
+ `
235
+ );
236
+ fs2.writeFileSync(
237
+ path2.join(fLibDir, "manifest.json"),
238
+ JSON.stringify({ name: "ButtonConcepts", dependencies: { react: "^18.3.1" } }, null, 2)
239
+ );
240
+ fs2.writeFileSync(
241
+ path2.join(fLibDir, "tests", "Button.test.tsx"),
242
+ `import { describe, it, expect } from "vitest";
243
+ describe("Button component", () => { it("defined correctly", () => { expect(true).toBe(true); }); });
244
+ `
245
+ );
246
+ fs2.writeFileSync(
247
+ path2.join(fEntityDir, "App0.tsx"),
248
+ `import React from "react";
292
249
  import { Button } from "../../libraries/ButtonConcepts/components.js";
293
-
294
250
  export const App0: React.FC = () => {
295
251
  return (
296
252
  <div className="krnl-entity-app">
@@ -299,69 +255,82 @@ export const App0: React.FC = () => {
299
255
  </div>
300
256
  );
301
257
  };
302
-
303
258
  export default App0;
304
- `);
305
- fs.writeFileSync(path.join(fEntityDir, "tests", "App0.test.tsx"), `import { describe, it, expect } from "vitest";
306
-
307
- describe("App0 Component", () => {
308
- it("mounts variant 0", () => {
309
- expect(true).toBe(true);
310
- });
311
- });
312
- `);
313
- fs.writeFileSync(path.join(fFuncDir, "Hello0.tsx"), `import React from "react";
314
-
315
- export interface HelloProps {
316
- greeting?: string;
317
- }
318
-
319
- export const Hello0: React.FC<HelloProps> = ({ greeting = "Hello World!" }) => {
320
- return (
321
- <div className="krnl-func-hello">
322
- <p>{greeting}</p>
323
- </div>
259
+ `
324
260
  );
261
+ fs2.writeFileSync(
262
+ path2.join(fEntityDir, "tests", "App0.test.tsx"),
263
+ `import { describe, it, expect } from "vitest";
264
+ describe("App0 Component", () => { it("mounts variant 0", () => { expect(true).toBe(true); }); });
265
+ `
266
+ );
267
+ fs2.writeFileSync(
268
+ path2.join(fFuncDir, "Hello0.tsx"),
269
+ `import React from "react";
270
+ export interface HelloProps { greeting?: string; }
271
+ export const Hello0: React.FC<HelloProps> = ({ greeting = "Hello World!" }) => {
272
+ return <div className="krnl-func-hello"><p>{greeting}</p></div>;
325
273
  };
326
-
327
274
  export default Hello0;
328
- `);
329
- fs.writeFileSync(path.join(fFuncDir, "manifest.json"), JSON.stringify({
330
- name: "HelloUI",
331
- dependencies: {
332
- "react": "^18.3.1"
333
- }
334
- }, null, 2));
335
- fs.writeFileSync(path.join(fFuncDir, "tests", "Hello0.test.tsx"), `import { describe, it, expect } from "vitest";
275
+ `
276
+ );
277
+ fs2.writeFileSync(
278
+ path2.join(fFuncDir, "manifest.json"),
279
+ JSON.stringify({ name: "HelloUI", dependencies: { react: "^18.3.1" } }, null, 2)
280
+ );
281
+ fs2.writeFileSync(
282
+ path2.join(fFuncDir, "tests", "Hello0.test.tsx"),
283
+ `import { describe, it, expect } from "vitest";
284
+ describe("Hello0 Component", () => { it("renders correctly", () => { expect(true).toBe(true); }); });
285
+ `
286
+ );
287
+ fs2.writeFileSync(
288
+ path2.join(targetDir2, "docs", "HISTORY.md"),
289
+ `# ${projectName2} - Project History
336
290
 
337
- describe("Hello0 Component", () => {
338
- it("renders correctly", () => {
339
- expect(true).toBe(true);
340
- });
341
- });
342
- `);
343
- KrnlPackageReconciler.reconcile(targetDir, true);
344
- fs.writeFileSync(path.join(targetDir, "docs", "HISTORY.md"), `# ${projectName} - Project History & Invariants
291
+ Initialized Krnl symmetric architecture.
292
+ `
293
+ );
294
+ fs2.writeFileSync(
295
+ path2.join(targetDir2, ".skipo", "agent-state.json"),
296
+ JSON.stringify(
297
+ {
298
+ schemaVersion: "1.0.0",
299
+ turnsSinceLastAudit: 0,
300
+ auditCadenceThreshold: 5,
301
+ totalTurns: 0,
302
+ lastAudit: {
303
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
304
+ status: "INITIALIZED",
305
+ refactorsPerformed: [],
306
+ checksPassed: ["symmetric_planes", "concept_folders", "manifest_reconciliation"]
307
+ },
308
+ history: []
309
+ },
310
+ null,
311
+ 2
312
+ )
313
+ );
314
+ }
345
315
 
346
- ## Initial Scaffolding
347
- - Initialized Krnl symmetric architecture (krnl/backend & krnl/frontend).
348
- - Configured code-as-config entrypoint: ${projectName}.ts.
349
- - Co-located manifest.json and tests/ across all concept libraries and functionalities.
350
- - Programmatically reconciled package.json dependencies.
316
+ // src/index.ts
317
+ var rawArg = process.argv[2] || "my-krnl-app";
318
+ var targetDir = path3.resolve(process.cwd(), rawArg);
319
+ var projectName = path3.basename(targetDir);
320
+ console.log(`
321
+ \u{1F680} [create-krnl] Scaffolding new Krnl project in: ${targetDir}
351
322
  `);
352
- fs.writeFileSync(path.join(targetDir, ".skipo", "agent-state.json"), JSON.stringify({
353
- schemaVersion: "1.0.0",
354
- turnsSinceLastAudit: 0,
355
- auditCadenceThreshold: 5,
356
- totalTurns: 0,
357
- lastAudit: {
358
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
359
- status: "INITIALIZED",
360
- refactorsPerformed: [],
361
- checksPassed: ["symmetric_planes", "concept_folders", "manifest_reconciliation", "tests_colocation"]
362
- },
363
- history: []
364
- }, null, 2));
323
+ if (fs3.existsSync(targetDir)) {
324
+ console.error(`\u274C Directory "${projectName}" already exists.`);
325
+ process.exit(1);
326
+ }
327
+ fs3.mkdirSync(targetDir, { recursive: true });
328
+ fs3.writeFileSync(path3.join(targetDir, "package.json"), getBasePackageJson(projectName));
329
+ fs3.writeFileSync(path3.join(targetDir, "tsconfig.json"), getTsConfig(projectName));
330
+ fs3.writeFileSync(path3.join(targetDir, `${projectName}.ts`), getAppEntrypoint(projectName));
331
+ scaffoldBackend(targetDir);
332
+ scaffoldFrontend(targetDir, projectName);
333
+ KrnlPackageReconciler.reconcile(targetDir, true);
365
334
  console.log(`
366
335
  \u{1F389} Project successfully scaffolded at: ${targetDir}`);
367
336
  console.log(`
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-krnl",
3
- "version": "1.0.0",
4
- "description": "Interactive project scaffolder for the Krnl Framework",
3
+ "version": "1.0.1",
4
+ "description": "Interactive project scaffolder for Krnl backend service projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dinilmusick/eslint-plugin-krnl",
3
- "version": "1.0.0",
4
- "description": "ESLint plugin enforcing Krnl 4-layer function purity, line limits, and architectural paradigms",
3
+ "version": "1.0.1",
4
+ "description": "ESLint plugin enforcing Krnl backend service purity, 4-layer architecture, and backend standards",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",