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