@kalphq/cli 0.0.0-dev-20260506062515 โ 0.0.0-dev-20260506065806
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/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import pc from "picocolors";
|
|
|
8
8
|
// package.json
|
|
9
9
|
var package_default = {
|
|
10
10
|
name: "@kalphq/cli",
|
|
11
|
-
version: "0.0.0-dev-
|
|
11
|
+
version: "0.0.0-dev-20260506065806",
|
|
12
12
|
description: "Zero-config CLI for deploying Kalp agents",
|
|
13
13
|
type: "module",
|
|
14
14
|
license: "MIT",
|
|
@@ -85,7 +85,7 @@ var main = defineCommand({
|
|
|
85
85
|
},
|
|
86
86
|
subCommands: {
|
|
87
87
|
create: () => import("./create-7J5R6OVF.js").then((r) => r.default),
|
|
88
|
-
push: () => import("./push-
|
|
88
|
+
push: () => import("./push-YT3AVVC2.js").then((r) => r.default),
|
|
89
89
|
link: () => import("./link-WZQSR2TM.js").then((r) => r.default),
|
|
90
90
|
secrets: () => import("./secrets-KFMVBKJQ.js").then((r) => r.default),
|
|
91
91
|
login: () => import("./login-JYPWGL6P.js").then((r) => r.default),
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../package.json"],"sourcesContent":["import { defineCommand, runMain } from \"citty\";\nimport * as p from \"@clack/prompts\";\nimport pc from \"picocolors\";\nimport pkg from \"../package.json\";\n\nconst LOGO = \"๐ฆ\";\n\nconst COMMANDS = [\n [\"create\", \"Add a new agent\"],\n [\"push\", \"Push agent to Kalp\"],\n [\"link\", \"Link project to Kalp cloud\"],\n [\"secrets\", \"Manage secrets\"],\n [\"login\", \"Authenticate with Kalp\"],\n [\"logout\", \"Sign out from Kalp\"],\n] as const;\n\nfunction printHelp(): void {\n p.log.info(`${pc.bold(\"Usage\")}: kalp <command> [options]`);\n console.log(\"\");\n p.log.info(pc.bold(\"Commands\"));\n\n for (const [name, desc] of COMMANDS) {\n console.log(` ${pc.cyan(name.padEnd(10))}${desc}`);\n }\n\n console.log(\"\");\n p.log.info(`Run ${pc.cyan(\"kalp <command> --help\")} for more info.`);\n}\n\nconst main = defineCommand({\n meta: {\n name: \"kalp\",\n version: pkg.version,\n description: \"๐ฆ Zero-config agent infrastructure\",\n },\n args: {\n help: {\n type: \"boolean\",\n alias: \"h\",\n description: \"Show help\",\n default: false,\n },\n },\n subCommands: {\n create: () => import(\"./commands/create\").then((r) => r.default),\n push: () => import(\"./commands/push\").then((r) => r.default),\n link: () => import(\"./commands/link\").then((r) => r.default),\n secrets: () => import(\"./commands/secrets\").then((r) => r.default),\n login: () => import(\"./commands/login\").then((r) => r.default),\n logout: () => import(\"./commands/logout\").then((r) => r.default),\n },\n run({ args }) {\n const firstArg = process.argv[2];\n\n if (args.help) {\n p.intro(`${LOGO} ${pc.bold(\"kalp\")}`);\n printHelp();\n p.outro(\"Happy coding ๐ฆ\");\n return;\n }\n\n if (firstArg) {\n return;\n }\n\n p.intro(`${LOGO} ${pc.bold(\"kalp\")}`);\n printHelp();\n p.outro(\"Happy coding ๐ฆ\");\n },\n});\n\nrunMain(main);\n","{\n \"name\": \"@kalphq/cli\",\n \"version\": \"0.0.0-dev-
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../package.json"],"sourcesContent":["import { defineCommand, runMain } from \"citty\";\nimport * as p from \"@clack/prompts\";\nimport pc from \"picocolors\";\nimport pkg from \"../package.json\";\n\nconst LOGO = \"๐ฆ\";\n\nconst COMMANDS = [\n [\"create\", \"Add a new agent\"],\n [\"push\", \"Push agent to Kalp\"],\n [\"link\", \"Link project to Kalp cloud\"],\n [\"secrets\", \"Manage secrets\"],\n [\"login\", \"Authenticate with Kalp\"],\n [\"logout\", \"Sign out from Kalp\"],\n] as const;\n\nfunction printHelp(): void {\n p.log.info(`${pc.bold(\"Usage\")}: kalp <command> [options]`);\n console.log(\"\");\n p.log.info(pc.bold(\"Commands\"));\n\n for (const [name, desc] of COMMANDS) {\n console.log(` ${pc.cyan(name.padEnd(10))}${desc}`);\n }\n\n console.log(\"\");\n p.log.info(`Run ${pc.cyan(\"kalp <command> --help\")} for more info.`);\n}\n\nconst main = defineCommand({\n meta: {\n name: \"kalp\",\n version: pkg.version,\n description: \"๐ฆ Zero-config agent infrastructure\",\n },\n args: {\n help: {\n type: \"boolean\",\n alias: \"h\",\n description: \"Show help\",\n default: false,\n },\n },\n subCommands: {\n create: () => import(\"./commands/create\").then((r) => r.default),\n push: () => import(\"./commands/push\").then((r) => r.default),\n link: () => import(\"./commands/link\").then((r) => r.default),\n secrets: () => import(\"./commands/secrets\").then((r) => r.default),\n login: () => import(\"./commands/login\").then((r) => r.default),\n logout: () => import(\"./commands/logout\").then((r) => r.default),\n },\n run({ args }) {\n const firstArg = process.argv[2];\n\n if (args.help) {\n p.intro(`${LOGO} ${pc.bold(\"kalp\")}`);\n printHelp();\n p.outro(\"Happy coding ๐ฆ\");\n return;\n }\n\n if (firstArg) {\n return;\n }\n\n p.intro(`${LOGO} ${pc.bold(\"kalp\")}`);\n printHelp();\n p.outro(\"Happy coding ๐ฆ\");\n },\n});\n\nrunMain(main);\n","{\n \"name\": \"@kalphq/cli\",\n \"version\": \"0.0.0-dev-20260506065806\",\n \"description\": \"Zero-config CLI for deploying Kalp agents\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"author\": \"Kalp HQ\",\n \"bin\": {\n \"kalp\": \"./dist/index.js\"\n },\n \"main\": \"./dist/index.js\",\n \"files\": [\n \"dist\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"lint\": \"tsc --noEmit\",\n \"prepublishOnly\": \"pnpm build\"\n },\n \"dependencies\": {\n \"@antfu/ni\": \"24.4.0\",\n \"@clack/prompts\": \"0.9.1\",\n \"@kalphq/compiler\": \"workspace:*\",\n \"@kalphq/project\": \"workspace:*\",\n \"@kalphq/sdk\": \"workspace:*\",\n \"citty\": \"0.1.6\",\n \"esbuild\": \"0.25.0\",\n \"json-stable-stringify\": \"1.3.0\",\n \"picocolors\": \"1.1.1\",\n \"zod\": \"3.25.76\"\n },\n \"devDependencies\": {\n \"@types/json-stable-stringify\": \"1.2.0\",\n \"@types/node\": \"^22.15.3\",\n \"tsup\": \"^8.3.5\",\n \"typescript\": \"^5.0.0\"\n }\n}\n"],"mappings":";;;AAAA,SAAS,eAAe,eAAe;AACvC,YAAY,OAAO;AACnB,OAAO,QAAQ;;;ACFf;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,QAAU;AAAA,EACV,KAAO;AAAA,IACL,MAAQ;AAAA,EACV;AAAA,EACA,MAAQ;AAAA,EACR,OAAS;AAAA,IACP;AAAA,EACF;AAAA,EACA,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,KAAO;AAAA,IACP,MAAQ;AAAA,IACR,gBAAkB;AAAA,EACpB;AAAA,EACA,cAAgB;AAAA,IACd,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,oBAAoB;AAAA,IACpB,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,OAAS;AAAA,IACT,SAAW;AAAA,IACX,yBAAyB;AAAA,IACzB,YAAc;AAAA,IACd,KAAO;AAAA,EACT;AAAA,EACA,iBAAmB;AAAA,IACjB,gCAAgC;AAAA,IAChC,eAAe;AAAA,IACf,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AACF;;;ADpCA,IAAM,OAAO;AAEb,IAAM,WAAW;AAAA,EACf,CAAC,UAAU,iBAAiB;AAAA,EAC5B,CAAC,QAAQ,oBAAoB;AAAA,EAC7B,CAAC,QAAQ,4BAA4B;AAAA,EACrC,CAAC,WAAW,gBAAgB;AAAA,EAC5B,CAAC,SAAS,wBAAwB;AAAA,EACl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AAM;AACb,MAAE,QAAM,GAAG,IAAI,IAAI,GAAG,KAAK,MAAM,CAAC,EAAE;AACpC,gBAAU;AACV,MAAE,QAAM,wBAAiB;AACzB;AAAA,IACF;AAEA,QAAI,UAAU;AACZ;AAAA,IACF;AAEA,IAAE,QAAM,GAAG,IAAI,IAAI,GAAG,KAAK,MAAM,CAAC,EAAE;AACpC,cAAU;AACV,IAAE,QAAM,wBAAiB;AAAA,EAC3B;AACF,CAAC;AAED,QAAQ,IAAI;","names":[]}
|
|
@@ -186,54 +186,8 @@ function renderLegacyError(error, showDebug = true) {
|
|
|
186
186
|
return lines.join("\n");
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
// package.json with { type: 'json' }
|
|
190
|
-
var package_default = {
|
|
191
|
-
name: "@kalphq/cli",
|
|
192
|
-
version: "0.0.0-dev-20260506062515",
|
|
193
|
-
description: "Zero-config CLI for deploying Kalp agents",
|
|
194
|
-
type: "module",
|
|
195
|
-
license: "MIT",
|
|
196
|
-
author: "Kalp HQ",
|
|
197
|
-
bin: {
|
|
198
|
-
kalp: "./dist/index.js"
|
|
199
|
-
},
|
|
200
|
-
main: "./dist/index.js",
|
|
201
|
-
files: [
|
|
202
|
-
"dist"
|
|
203
|
-
],
|
|
204
|
-
publishConfig: {
|
|
205
|
-
access: "public"
|
|
206
|
-
},
|
|
207
|
-
scripts: {
|
|
208
|
-
build: "tsup",
|
|
209
|
-
dev: "tsup --watch",
|
|
210
|
-
lint: "tsc --noEmit",
|
|
211
|
-
prepublishOnly: "pnpm build"
|
|
212
|
-
},
|
|
213
|
-
dependencies: {
|
|
214
|
-
"@antfu/ni": "24.4.0",
|
|
215
|
-
"@clack/prompts": "0.9.1",
|
|
216
|
-
"@kalphq/compiler": "workspace:*",
|
|
217
|
-
"@kalphq/project": "workspace:*",
|
|
218
|
-
"@kalphq/sdk": "workspace:*",
|
|
219
|
-
citty: "0.1.6",
|
|
220
|
-
esbuild: "0.25.0",
|
|
221
|
-
"json-stable-stringify": "1.3.0",
|
|
222
|
-
picocolors: "1.1.1",
|
|
223
|
-
zod: "3.25.76"
|
|
224
|
-
},
|
|
225
|
-
devDependencies: {
|
|
226
|
-
"@types/json-stable-stringify": "1.2.0",
|
|
227
|
-
"@types/node": "^22.15.3",
|
|
228
|
-
tsup: "^8.3.5",
|
|
229
|
-
typescript: "^5.0.0"
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
|
|
233
189
|
// src/commands/push.ts
|
|
234
190
|
var LOGO = "\u{1F98B}";
|
|
235
|
-
var CLI_VERSION = package_default.version;
|
|
236
|
-
var CLOUD_API = process.env.KALP_CLOUD_URL;
|
|
237
191
|
function formatBytes(bytes) {
|
|
238
192
|
if (bytes < 1024) return `${bytes} B`;
|
|
239
193
|
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
@@ -315,7 +269,7 @@ var push_default = defineCommand({
|
|
|
315
269
|
`Compiled ${pc.cyan(agentName)} \u2014 ${Object.keys(manifest.handlers).length} handlers`
|
|
316
270
|
);
|
|
317
271
|
s.start(`Pushing to cloud`);
|
|
318
|
-
const response = await fetch(
|
|
272
|
+
const response = await fetch(`http://localhost:3000/api/agents/push`, {
|
|
319
273
|
method: "POST",
|
|
320
274
|
headers: { "Content-Type": "application/json" },
|
|
321
275
|
body: JSON.stringify({
|
|
@@ -336,11 +290,11 @@ var push_default = defineCommand({
|
|
|
336
290
|
}
|
|
337
291
|
s.stop(pc.green("Pushed successfully"));
|
|
338
292
|
printPushResult(agentName, hash, manifest.handlers);
|
|
339
|
-
const dashboardUrl =
|
|
293
|
+
const dashboardUrl = `http://localhost:3000/a/${agentName}`;
|
|
340
294
|
p2.outro(`${LOGO} ${pc.green("Agent live at")} ${pc.cyan(dashboardUrl)}`);
|
|
341
295
|
}
|
|
342
296
|
});
|
|
343
297
|
export {
|
|
344
298
|
push_default as default
|
|
345
299
|
};
|
|
346
|
-
//# sourceMappingURL=push-
|
|
300
|
+
//# sourceMappingURL=push-YT3AVVC2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/push.ts","../src/utils/manifest/index.ts","../src/utils/manifest/build.ts","../src/utils/ir/hashIR.ts","../src/utils/issues.ts"],"sourcesContent":["import { access } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { defineCommand } from \"citty\";\nimport * as p from \"@clack/prompts\";\nimport pc from \"picocolors\";\nimport { ensureConfig } from \"@/utils/fs\";\nimport { readAgentManifest, computePushHash } from \"@/utils/manifest\";\nimport { renderLegacyError } from \"@/utils/issues\";\n\nconst LOGO = \"๐ฆ\";\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n return `${(bytes / 1024).toFixed(1)} KB`;\n}\n\nfunction printPushResult(\n agentName: string,\n hash: string,\n handlers: Record<string, { size: number }>,\n) {\n const div = pc.dim(\"โ\".repeat(48));\n const handlerCount = Object.keys(handlers).length;\n const totalSize = Object.values(handlers).reduce((sum, h) => sum + h.size, 0);\n\n console.log(\"\\n\" + div);\n console.log(pc.green(\"โ Deployed\"));\n console.log(\"\");\n console.log(` ${pc.bold(agentName)} ${pc.dim(hash.slice(0, 7))}...`);\n console.log(\n ` ${pc.dim(String(handlerCount))} handlers ยท ${formatBytes(totalSize)}`,\n );\n console.log(div + \"\\n\");\n}\n\nfunction printPushError(\n phase: string,\n errors: string[],\n blockers?: string[],\n verbose?: boolean,\n) {\n const div = pc.dim(\"โ\".repeat(48));\n console.log(\"\\n\" + div);\n\n // Use DX-first rendering for all errors\n for (const e of errors) {\n console.log(renderLegacyError(e, verbose));\n console.log(\"\"); // Empty line between errors\n }\n\n if (phase === \"analysis\" && blockers) {\n for (const b of blockers) {\n console.log(pc.red(`โ Blocker: ${b}`));\n }\n }\n\n if (!verbose) {\n console.log(pc.dim(`\\nRun with --verbose for more details.\\n`));\n }\n\n console.log(div + \"\\n\");\n}\n\nexport default defineCommand({\n meta: { name: \"push\", description: \"Push agent to Kalp cloud\" },\n args: {\n agent: {\n type: \"string\",\n alias: \"a\",\n description: \"Agent name to push\",\n required: false,\n },\n verbose: {\n type: \"boolean\",\n alias: \"v\",\n description: \"Show debug information\",\n default: false,\n },\n },\n async run({ args }) {\n const cwd = process.cwd();\n const agentName = args.agent;\n\n p.intro(`${LOGO} ${pc.bold(\"kalp push\")}`);\n\n if (!agentName) {\n p.log.error(`Missing required flag ${pc.cyan(\"-a <agent-name>\")}`);\n process.exit(1);\n }\n\n try {\n await ensureConfig(cwd);\n } catch {\n p.log.error(`${pc.cyan(\"kalp.config.ts\")} not found`);\n process.exit(1);\n }\n\n const agentPath = join(cwd, \"agents\", agentName, \"index.ts\");\n try {\n await access(agentPath);\n } catch {\n p.log.error(`Agent ${pc.cyan(agentName)} not found`);\n process.exit(1);\n }\n\n const s = p.spinner();\n s.start(`Compiling ${pc.cyan(agentName)}`);\n\n const manifest = await readAgentManifest({ cwd, agentName });\n const hash = computePushHash(manifest.ir, manifest.handlers);\n\n s.stop(\n `Compiled ${pc.cyan(agentName)} โ ${Object.keys(manifest.handlers).length} handlers`,\n );\n s.start(`Pushing to cloud`);\n\n const response = await fetch(`http://localhost:3000/api/agents/push`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n agentName,\n ir: manifest.ir,\n hash,\n bundle: { handlers: manifest.handlers },\n }),\n });\n\n const body = (await response.json().catch(() => null)) as Record<\n string,\n unknown\n > | null;\n\n if (!response.ok) {\n s.stop(pc.red(\"Push failed\"));\n const phase = (body?.phase as string) ?? \"unknown\";\n const errors = (body?.errors as string[]) ?? [`HTTP ${response.status}`];\n const blockers = body?.blockers as string[] | undefined;\n printPushError(phase, errors, blockers);\n process.exit(1);\n }\n\n s.stop(pc.green(\"Pushed successfully\"));\n printPushResult(agentName, hash, manifest.handlers);\n\n const dashboardUrl = `http://localhost:3000/a/${agentName}`;\n p.outro(`${LOGO} ${pc.green(\"Agent live at\")} ${pc.cyan(dashboardUrl)}`);\n },\n});\n","// packages/cli/src/utils/manifest/index.ts\nimport { access, readFile, readdir, rm, mkdtemp } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { tmpdir } from \"node:os\";\nimport { buildAgent } from \"@kalphq/compiler\";\nimport { loadAgentModule, cleanupTempDir } from \"@/utils/manifest/build\";\nimport type { AgentManifestV2 } from \"@/utils/manifest/types\";\n\nexport type {\n AgentManifestV2,\n LoadedAgentModule,\n} from \"@/utils/manifest/types\";\nexport type { HandlerMap, HandlerEntry } from \"@/utils/manifest/handlers\";\nexport { computePushHash } from \"@/utils/ir/hashIR\";\n\n/**\n * Reads and compiles an agent into a pushable manifest.\n */\nexport async function readAgentManifest(params: {\n cwd: string;\n agentName: string;\n}): Promise<AgentManifestV2> {\n const { cwd, agentName } = params;\n const agentPath = join(cwd, \"agents\", agentName, \"index.ts\");\n await access(agentPath);\n\n // Use a temporary directory for the compiler output\n const tempOutDir = await mkdtemp(join(tmpdir(), \"kalp-build-\"));\n\n try {\n // 1. Build the agent using the official compiler pipeline\n await buildAgent(agentPath, tempOutDir, cwd);\n\n // 2. Load the IR generated by the compiler\n const irContent = await readFile(join(tempOutDir, \"ir.json\"), \"utf-8\");\n const ir = JSON.parse(irContent);\n\n // 3. Collect bundled handlers\n const handlersDir = join(tempOutDir, \"handlers\");\n const handlerFiles = await readdir(handlersDir);\n const handlers: any = {};\n\n for (const file of handlerFiles) {\n if (!file.endsWith(\".js\")) continue;\n const code = await readFile(join(handlersDir, file), \"utf-8\");\n\n // Filename format: name.hash.js\n const parts = file.split(\".\");\n const hash = parts[1] || \"no-hash\";\n\n handlers[file] = {\n name: file,\n code,\n hash,\n size: Buffer.byteLength(code),\n };\n }\n\n // 4. Also load the module to get the codeHash (for legacy reasons)\n const loaded = await loadAgentModule(agentPath, cwd);\n const codeHash = loaded.codeHash;\n await cleanupTempDir(loaded.tempDir);\n\n return {\n format: \"kalp-agent-manifest\",\n schemaVersion: 2,\n codeHash,\n ir,\n handlers,\n metadata: {\n generatedAt: new Date().toISOString(),\n },\n };\n } finally {\n // Cleanup temp build directory\n await rm(tempOutDir, { recursive: true, force: true });\n }\n}\n","import { existsSync } from \"node:fs\";\nimport { mkdtemp, readFile, rm } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { build } from \"esbuild\";\nimport type { LoadedAgentModule } from \"@/utils/manifest/types\";\n\nasync function getHash(payload: string): Promise<string> {\n const { createHash } = await import(\"node:crypto\");\n return createHash(\"sha256\").update(payload).digest(\"hex\");\n}\n\nexport async function loadAgentModule(\n agentPath: string,\n cwd: string,\n): Promise<LoadedAgentModule> {\n const tempDir = await mkdtemp(join(cwd, \".kalp-temp-\"));\n const outFile = join(tempDir, \"agent.manifest.mjs\");\n\n await build({\n entryPoints: [agentPath],\n outfile: outFile,\n bundle: true,\n format: \"esm\",\n platform: \"node\",\n target: \"node18\",\n logLevel: \"silent\",\n packages: \"external\",\n plugins: [\n {\n name: \"relative-js-to-ts\",\n setup(buildCtx) {\n buildCtx.onResolve({ filter: /^\\.\\/.*\\.js$/ }, (args) => {\n const resolved = resolve(args.resolveDir, args.path);\n if (existsSync(resolved)) {\n return { path: resolved };\n }\n\n const tsPath = resolved.replace(/\\.js$/, \".ts\");\n if (existsSync(tsPath)) {\n return { path: tsPath };\n }\n\n const tsxPath = resolved.replace(/\\.js$/, \".tsx\");\n if (existsSync(tsxPath)) {\n return { path: tsxPath };\n }\n\n return null;\n });\n },\n },\n {\n name: \"tsconfig-paths\",\n setup(buildCtx) {\n buildCtx.onResolve({ filter: /^@\\// }, (args) => {\n const withoutPrefix = args.path.replace(/^@\\//, \"\");\n const resolved = resolve(cwd, withoutPrefix);\n\n if (existsSync(resolved)) {\n return { path: resolved };\n }\n\n const tsPath = resolved + \".ts\";\n if (existsSync(tsPath)) {\n return { path: tsPath };\n }\n\n const tsxPath = resolved + \".tsx\";\n if (existsSync(tsxPath)) {\n return { path: tsxPath };\n }\n\n const indexTsPath = join(resolved, \"index.ts\");\n if (existsSync(indexTsPath)) {\n return { path: indexTsPath };\n }\n\n return null;\n });\n },\n },\n ],\n });\n\n const loaded = (await import(\n `${pathToFileURL(outFile).href}?t=${Date.now()}`\n )) as { default?: unknown };\n\n const bundledCode = await readFile(outFile, \"utf-8\");\n const codeHash = await getHash(bundledCode);\n\n return {\n agent: loaded.default,\n tempDir,\n codeHash,\n };\n}\n\nexport async function cleanupTempDir(tempDir: string): Promise<void> {\n await rm(tempDir, { recursive: true, force: true });\n}\n","import type { IRGraph } from \"@kalphq/sdk\";\nimport { createHash } from \"crypto\";\nimport stableStringify from \"json-stable-stringify\";\nimport type { HandlerMap } from \"@/utils/manifest/handlers\";\n\nexport function getIRHash(ir: IRGraph): string {\n return createHash(\"sha256\")\n .update(stableStringify(ir) ?? JSON.stringify(ir))\n .digest(\"hex\");\n}\n\nexport function computePushHash(ir: IRGraph, handlers: HandlerMap): string {\n const sortedHandlerHashes = Object.keys(handlers)\n .sort()\n .map((k) => handlers[k]!.hash)\n .join(\"|\");\n const bundleHash = createHash(\"sha256\")\n .update(sortedHandlerHashes)\n .digest(\"hex\");\n const payload =\n stableStringify({ ir, bundleHash }) ?? JSON.stringify({ ir, bundleHash });\n return createHash(\"sha256\").update(payload).digest(\"hex\");\n}\n","import type { ValidationIssue, Severity } from \"@kalphq/compiler\";\nimport p from \"picocolors\";\n\ninterface RenderOptions {\n format?: \"pretty\" | \"json\" | \"minimal\";\n showDebug?: boolean;\n}\n\nconst severityIcons: Record<Severity, string> = {\n error: p.red(\"โ\"),\n warning: p.yellow(\"โ \"),\n info: p.blue(\"โน\"),\n};\n\nconst severityLabels: Record<Severity, string> = {\n error: p.red(\"Error\"),\n warning: p.yellow(\"Warning\"),\n info: p.blue(\"Info\"),\n};\n\nfunction groupByContext(\n issues: ValidationIssue[],\n): Map<string, ValidationIssue[]> {\n const groups = new Map<string, ValidationIssue[]>();\n\n for (const issue of issues) {\n const context = issue.context ?? \"General\";\n const existing = groups.get(context) ?? [];\n existing.push(issue);\n groups.set(context, existing);\n }\n\n return groups;\n}\n\nfunction renderPrettyIssue(issue: ValidationIssue, showDebug: boolean): string {\n const lines: string[] = [];\n\n // Header with icon, severity label, and message\n lines.push(\n `${severityIcons[issue.severity]} ${severityLabels[issue.severity]}: ${p.bold(issue.message)}`,\n );\n\n // Context (location in code)\n if (issue.context) {\n lines.push(p.dim(` Found in: ${issue.context}`));\n }\n if (issue.location) {\n lines.push(p.dim(` Location: ${issue.location}`));\n }\n\n // Empty line before fix\n lines.push(\"\");\n\n // Fix section\n if (issue.fix) {\n lines.push(p.green(\" Fix:\"));\n const fixLines = issue.fix.split(\"\\n\");\n for (const fixLine of fixLines) {\n lines.push(` ${fixLine}`);\n }\n }\n\n // Debug info (optional)\n if (showDebug && issue.debug) {\n lines.push(\"\");\n lines.push(p.dim(` (debug: ${issue.debug})`));\n }\n\n return lines.join(\"\\n\");\n}\n\nfunction renderGroupedIssues(\n issues: ValidationIssue[],\n showDebug: boolean,\n): string {\n const groups = groupByContext(issues);\n const output: string[] = [];\n\n for (const [context, contextIssues] of groups) {\n // Context header\n output.push(p.cyan(p.bold(`โ ${context}`)));\n output.push(\"\");\n\n // Issues in this context\n for (const issue of contextIssues) {\n output.push(renderPrettyIssue(issue, showDebug));\n output.push(\"\"); // Empty line between issues\n }\n }\n\n return output.join(\"\\n\");\n}\n\nfunction renderMinimalIssue(issue: ValidationIssue): string {\n const icon =\n issue.severity === \"error\" ? \"โ\" : issue.severity === \"warning\" ? \"โ \" : \"โน\";\n const context = issue.context ? ` [${issue.context}]` : \"\";\n return `${icon} ${issue.message}${context}`;\n}\n\nexport function renderIssues(\n issues: ValidationIssue[],\n options: RenderOptions = {},\n): string {\n const { format = \"pretty\", showDebug = false } = options;\n\n if (issues.length === 0) {\n return p.green(\"โ No issues found\");\n }\n\n // Sort by severity: errors first, then warnings, then info\n const sorted = [...issues].sort((a, b) => {\n const severityOrder = { error: 0, warning: 1, info: 2 };\n return severityOrder[a.severity] - severityOrder[b.severity];\n });\n\n switch (format) {\n case \"json\":\n return JSON.stringify(sorted, null, 2);\n\n case \"minimal\":\n return sorted.map(renderMinimalIssue).join(\"\\n\");\n\n case \"pretty\":\n default: {\n const output: string[] = [];\n\n // Summary header\n const errorCount = issues.filter((i) => i.severity === \"error\").length;\n const warningCount = issues.filter(\n (i) => i.severity === \"warning\",\n ).length;\n const infoCount = issues.filter((i) => i.severity === \"info\").length;\n\n if (errorCount > 0) {\n output.push(\n p.red(\n p.bold(`Found ${errorCount} error${errorCount > 1 ? \"s\" : \"\"}`),\n ),\n );\n }\n if (warningCount > 0) {\n output.push(\n p.yellow(`${warningCount} warning${warningCount > 1 ? \"s\" : \"\"}`),\n );\n }\n if (infoCount > 0) {\n output.push(p.blue(`${infoCount} info`));\n }\n output.push(\"\");\n\n // Grouped issues\n output.push(renderGroupedIssues(sorted, showDebug));\n\n return output.join(\"\\n\");\n }\n }\n}\n\n// Render legacy error strings in DX-first format\nexport function renderLegacyError(\n error: string,\n showDebug: boolean = true,\n): string {\n const lines: string[] = [];\n\n // Extract debug info if present\n const debugMatch = error.match(/\\(debug: (.+)\\)$/);\n const debug = debugMatch ? debugMatch[1] : undefined;\n const mainError = debugMatch\n ? error.replace(/\\(debug: .+\\)$/, \"\").trim()\n : error;\n\n lines.push(p.red(p.bold(`โ ${mainError.split(\"\\n\")[0]}`)));\n\n // Show fix if present in the error\n const fixMatch = mainError.match(/Fix:\\n((?:- .+\\n?)+)/);\n if (fixMatch) {\n lines.push(\"\");\n lines.push(p.green(\" Fix:\"));\n const fixLines = fixMatch[1]?.split(\"\\n\").filter(Boolean) ?? [];\n for (const line of fixLines) {\n lines.push(` ${line.replace(/^- /, \"\")}`);\n }\n }\n\n if (showDebug && debug) {\n lines.push(\"\");\n lines.push(p.dim(` (debug: ${debug})`));\n }\n\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;AAAA,SAAS,UAAAA,eAAc;AACvB,SAAS,QAAAC,aAAY;AACrB,SAAS,qBAAqB;AAC9B,YAAYC,Q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AAE,MAAM,kBAAkB;AAE1B,UAAM,WAAW,MAAM,MAAM,yCAAyC;AAAA,MACpE,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM,KAAK,UAAU;AAAA,QACnB;AAAA,QACA,IAAI,SAAS;AAAA,QACb;AAAA,QACA,QAAQ,EAAE,UAAU,SAAS,SAAS;AAAA,MACxC,CAAC;AAAA,IACH,CAAC;AAED,UAAM,OAAQ,MAAM,SAAS,KAAK,EAAE,MAAM,MAAM,IAAI;AAKpD,QAAI,CAAC,SAAS,IAAI;AAChB,QAAE,KAAK,GAAG,IAAI,aAAa,CAAC;AAC5B,YAAM,QAAS,MAAM,SAAoB;AACzC,YAAM,SAAU,MAAM,UAAuB,CAAC,QAAQ,SAAS,MAAM,EAAE;AACvE,YAAM,WAAW,MAAM;AACvB,qBAAe,OAAO,QAAQ,QAAQ;AACtC,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,MAAE,KAAK,GAAG,MAAM,qBAAqB,CAAC;AACtC,oBAAgB,WAAW,MAAM,SAAS,QAAQ;AAElD,UAAM,eAAe,2BAA2B,SAAS;AACzD,IAAE,SAAM,GAAG,IAAI,IAAI,GAAG,MAAM,eAAe,CAAC,IAAI,GAAG,KAAK,YAAY,CAAC,EAAE;AAAA,EACzE;AACF,CAAC;","names":["access","join","p","readFile","rm","mkdtemp","join","createHash","join","mkdtemp","readFile","rm","join","access"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalphq/cli",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260506065806",
|
|
4
4
|
"description": "Zero-config CLI for deploying Kalp agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"json-stable-stringify": "1.3.0",
|
|
24
24
|
"picocolors": "1.1.1",
|
|
25
25
|
"zod": "3.25.76",
|
|
26
|
-
"@kalphq/compiler": "0.0.0-dev-
|
|
27
|
-
"@kalphq/project": "0.0.0-dev-
|
|
28
|
-
"@kalphq/sdk": "0.0.0-dev-
|
|
26
|
+
"@kalphq/compiler": "0.0.0-dev-20260506065806",
|
|
27
|
+
"@kalphq/project": "0.0.0-dev-20260506065806",
|
|
28
|
+
"@kalphq/sdk": "0.0.0-dev-20260506065806"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/json-stable-stringify": "1.2.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/push.ts","../src/utils/manifest/index.ts","../src/utils/manifest/build.ts","../src/utils/ir/hashIR.ts","../src/utils/issues.ts","../package.json"],"sourcesContent":["import { access } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { defineCommand } from \"citty\";\nimport * as p from \"@clack/prompts\";\nimport pc from \"picocolors\";\nimport { ensureConfig } from \"@/utils/fs\";\nimport { readAgentManifest, computePushHash } from \"@/utils/manifest\";\nimport { renderLegacyError } from \"@/utils/issues\";\nimport packageJson from \"../../package.json\" with { type: \"json\" };\n\nconst LOGO = \"๐ฆ\";\n\nconst CLI_VERSION: string = packageJson.version;\nconst CLOUD_API = process.env.KALP_CLOUD_URL;\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n return `${(bytes / 1024).toFixed(1)} KB`;\n}\n\nfunction printPushResult(\n agentName: string,\n hash: string,\n handlers: Record<string, { size: number }>,\n) {\n const div = pc.dim(\"โ\".repeat(48));\n const handlerCount = Object.keys(handlers).length;\n const totalSize = Object.values(handlers).reduce((sum, h) => sum + h.size, 0);\n\n console.log(\"\\n\" + div);\n console.log(pc.green(\"โ Deployed\"));\n console.log(\"\");\n console.log(` ${pc.bold(agentName)} ${pc.dim(hash.slice(0, 7))}...`);\n console.log(\n ` ${pc.dim(String(handlerCount))} handlers ยท ${formatBytes(totalSize)}`,\n );\n console.log(div + \"\\n\");\n}\n\nfunction printPushError(\n phase: string,\n errors: string[],\n blockers?: string[],\n verbose?: boolean,\n) {\n const div = pc.dim(\"โ\".repeat(48));\n console.log(\"\\n\" + div);\n\n // Use DX-first rendering for all errors\n for (const e of errors) {\n console.log(renderLegacyError(e, verbose));\n console.log(\"\"); // Empty line between errors\n }\n\n if (phase === \"analysis\" && blockers) {\n for (const b of blockers) {\n console.log(pc.red(`โ Blocker: ${b}`));\n }\n }\n\n if (!verbose) {\n console.log(pc.dim(`\\nRun with --verbose for more details.\\n`));\n }\n\n console.log(div + \"\\n\");\n}\n\nexport default defineCommand({\n meta: { name: \"push\", description: \"Push agent to Kalp cloud\" },\n args: {\n agent: {\n type: \"string\",\n alias: \"a\",\n description: \"Agent name to push\",\n required: false,\n },\n verbose: {\n type: \"boolean\",\n alias: \"v\",\n description: \"Show debug information\",\n default: false,\n },\n },\n async run({ args }) {\n const cwd = process.cwd();\n const agentName = args.agent;\n\n p.intro(`${LOGO} ${pc.bold(\"kalp push\")}`);\n\n if (!agentName) {\n p.log.error(`Missing required flag ${pc.cyan(\"-a <agent-name>\")}`);\n process.exit(1);\n }\n\n try {\n await ensureConfig(cwd);\n } catch {\n p.log.error(`${pc.cyan(\"kalp.config.ts\")} not found`);\n process.exit(1);\n }\n\n const agentPath = join(cwd, \"agents\", agentName, \"index.ts\");\n try {\n await access(agentPath);\n } catch {\n p.log.error(`Agent ${pc.cyan(agentName)} not found`);\n process.exit(1);\n }\n\n const s = p.spinner();\n s.start(`Compiling ${pc.cyan(agentName)}`);\n\n const manifest = await readAgentManifest({ cwd, agentName });\n const hash = computePushHash(manifest.ir, manifest.handlers);\n\n s.stop(\n `Compiled ${pc.cyan(agentName)} โ ${Object.keys(manifest.handlers).length} handlers`,\n );\n s.start(`Pushing to cloud`);\n\n const response = await fetch(`${CLOUD_API}/api/agents/push`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n agentName,\n ir: manifest.ir,\n hash,\n bundle: { handlers: manifest.handlers },\n }),\n });\n\n const body = (await response.json().catch(() => null)) as Record<\n string,\n unknown\n > | null;\n\n if (!response.ok) {\n s.stop(pc.red(\"Push failed\"));\n const phase = (body?.phase as string) ?? \"unknown\";\n const errors = (body?.errors as string[]) ?? [`HTTP ${response.status}`];\n const blockers = body?.blockers as string[] | undefined;\n printPushError(phase, errors, blockers);\n process.exit(1);\n }\n\n s.stop(pc.green(\"Pushed successfully\"));\n printPushResult(agentName, hash, manifest.handlers);\n\n const dashboardUrl = `${CLOUD_API}/a/${agentName}`;\n p.outro(`${LOGO} ${pc.green(\"Agent live at\")} ${pc.cyan(dashboardUrl)}`);\n },\n});\n","// packages/cli/src/utils/manifest/index.ts\nimport { access, readFile, readdir, rm, mkdtemp } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { tmpdir } from \"node:os\";\nimport { buildAgent } from \"@kalphq/compiler\";\nimport { loadAgentModule, cleanupTempDir } from \"@/utils/manifest/build\";\nimport type { AgentManifestV2 } from \"@/utils/manifest/types\";\n\nexport type {\n AgentManifestV2,\n LoadedAgentModule,\n} from \"@/utils/manifest/types\";\nexport type { HandlerMap, HandlerEntry } from \"@/utils/manifest/handlers\";\nexport { computePushHash } from \"@/utils/ir/hashIR\";\n\n/**\n * Reads and compiles an agent into a pushable manifest.\n */\nexport async function readAgentManifest(params: {\n cwd: string;\n agentName: string;\n}): Promise<AgentManifestV2> {\n const { cwd, agentName } = params;\n const agentPath = join(cwd, \"agents\", agentName, \"index.ts\");\n await access(agentPath);\n\n // Use a temporary directory for the compiler output\n const tempOutDir = await mkdtemp(join(tmpdir(), \"kalp-build-\"));\n\n try {\n // 1. Build the agent using the official compiler pipeline\n await buildAgent(agentPath, tempOutDir, cwd);\n\n // 2. Load the IR generated by the compiler\n const irContent = await readFile(join(tempOutDir, \"ir.json\"), \"utf-8\");\n const ir = JSON.parse(irContent);\n\n // 3. Collect bundled handlers\n const handlersDir = join(tempOutDir, \"handlers\");\n const handlerFiles = await readdir(handlersDir);\n const handlers: any = {};\n\n for (const file of handlerFiles) {\n if (!file.endsWith(\".js\")) continue;\n const code = await readFile(join(handlersDir, file), \"utf-8\");\n\n // Filename format: name.hash.js\n const parts = file.split(\".\");\n const hash = parts[1] || \"no-hash\";\n\n handlers[file] = {\n name: file,\n code,\n hash,\n size: Buffer.byteLength(code),\n };\n }\n\n // 4. Also load the module to get the codeHash (for legacy reasons)\n const loaded = await loadAgentModule(agentPath, cwd);\n const codeHash = loaded.codeHash;\n await cleanupTempDir(loaded.tempDir);\n\n return {\n format: \"kalp-agent-manifest\",\n schemaVersion: 2,\n codeHash,\n ir,\n handlers,\n metadata: {\n generatedAt: new Date().toISOString(),\n },\n };\n } finally {\n // Cleanup temp build directory\n await rm(tempOutDir, { recursive: true, force: true });\n }\n}\n","import { existsSync } from \"node:fs\";\nimport { mkdtemp, readFile, rm } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { build } from \"esbuild\";\nimport type { LoadedAgentModule } from \"@/utils/manifest/types\";\n\nasync function getHash(payload: string): Promise<string> {\n const { createHash } = await import(\"node:crypto\");\n return createHash(\"sha256\").update(payload).digest(\"hex\");\n}\n\nexport async function loadAgentModule(\n agentPath: string,\n cwd: string,\n): Promise<LoadedAgentModule> {\n const tempDir = await mkdtemp(join(cwd, \".kalp-temp-\"));\n const outFile = join(tempDir, \"agent.manifest.mjs\");\n\n await build({\n entryPoints: [agentPath],\n outfile: outFile,\n bundle: true,\n format: \"esm\",\n platform: \"node\",\n target: \"node18\",\n logLevel: \"silent\",\n packages: \"external\",\n plugins: [\n {\n name: \"relative-js-to-ts\",\n setup(buildCtx) {\n buildCtx.onResolve({ filter: /^\\.\\/.*\\.js$/ }, (args) => {\n const resolved = resolve(args.resolveDir, args.path);\n if (existsSync(resolved)) {\n return { path: resolved };\n }\n\n const tsPath = resolved.replace(/\\.js$/, \".ts\");\n if (existsSync(tsPath)) {\n return { path: tsPath };\n }\n\n const tsxPath = resolved.replace(/\\.js$/, \".tsx\");\n if (existsSync(tsxPath)) {\n return { path: tsxPath };\n }\n\n return null;\n });\n },\n },\n {\n name: \"tsconfig-paths\",\n setup(buildCtx) {\n buildCtx.onResolve({ filter: /^@\\// }, (args) => {\n const withoutPrefix = args.path.replace(/^@\\//, \"\");\n const resolved = resolve(cwd, withoutPrefix);\n\n if (existsSync(resolved)) {\n return { path: resolved };\n }\n\n const tsPath = resolved + \".ts\";\n if (existsSync(tsPath)) {\n return { path: tsPath };\n }\n\n const tsxPath = resolved + \".tsx\";\n if (existsSync(tsxPath)) {\n return { path: tsxPath };\n }\n\n const indexTsPath = join(resolved, \"index.ts\");\n if (existsSync(indexTsPath)) {\n return { path: indexTsPath };\n }\n\n return null;\n });\n },\n },\n ],\n });\n\n const loaded = (await import(\n `${pathToFileURL(outFile).href}?t=${Date.now()}`\n )) as { default?: unknown };\n\n const bundledCode = await readFile(outFile, \"utf-8\");\n const codeHash = await getHash(bundledCode);\n\n return {\n agent: loaded.default,\n tempDir,\n codeHash,\n };\n}\n\nexport async function cleanupTempDir(tempDir: string): Promise<void> {\n await rm(tempDir, { recursive: true, force: true });\n}\n","import type { IRGraph } from \"@kalphq/sdk\";\nimport { createHash } from \"crypto\";\nimport stableStringify from \"json-stable-stringify\";\nimport type { HandlerMap } from \"@/utils/manifest/handlers\";\n\nexport function getIRHash(ir: IRGraph): string {\n return createHash(\"sha256\")\n .update(stableStringify(ir) ?? JSON.stringify(ir))\n .digest(\"hex\");\n}\n\nexport function computePushHash(ir: IRGraph, handlers: HandlerMap): string {\n const sortedHandlerHashes = Object.keys(handlers)\n .sort()\n .map((k) => handlers[k]!.hash)\n .join(\"|\");\n const bundleHash = createHash(\"sha256\")\n .update(sortedHandlerHashes)\n .digest(\"hex\");\n const payload =\n stableStringify({ ir, bundleHash }) ?? JSON.stringify({ ir, bundleHash });\n return createHash(\"sha256\").update(payload).digest(\"hex\");\n}\n","import type { ValidationIssue, Severity } from \"@kalphq/compiler\";\nimport p from \"picocolors\";\n\ninterface RenderOptions {\n format?: \"pretty\" | \"json\" | \"minimal\";\n showDebug?: boolean;\n}\n\nconst severityIcons: Record<Severity, string> = {\n error: p.red(\"โ\"),\n warning: p.yellow(\"โ \"),\n info: p.blue(\"โน\"),\n};\n\nconst severityLabels: Record<Severity, string> = {\n error: p.red(\"Error\"),\n warning: p.yellow(\"Warning\"),\n info: p.blue(\"Info\"),\n};\n\nfunction groupByContext(\n issues: ValidationIssue[],\n): Map<string, ValidationIssue[]> {\n const groups = new Map<string, ValidationIssue[]>();\n\n for (const issue of issues) {\n const context = issue.context ?? \"General\";\n const existing = groups.get(context) ?? [];\n existing.push(issue);\n groups.set(context, existing);\n }\n\n return groups;\n}\n\nfunction renderPrettyIssue(issue: ValidationIssue, showDebug: boolean): string {\n const lines: string[] = [];\n\n // Header with icon, severity label, and message\n lines.push(\n `${severityIcons[issue.severity]} ${severityLabels[issue.severity]}: ${p.bold(issue.message)}`,\n );\n\n // Context (location in code)\n if (issue.context) {\n lines.push(p.dim(` Found in: ${issue.context}`));\n }\n if (issue.location) {\n lines.push(p.dim(` Location: ${issue.location}`));\n }\n\n // Empty line before fix\n lines.push(\"\");\n\n // Fix section\n if (issue.fix) {\n lines.push(p.green(\" Fix:\"));\n const fixLines = issue.fix.split(\"\\n\");\n for (const fixLine of fixLines) {\n lines.push(` ${fixLine}`);\n }\n }\n\n // Debug info (optional)\n if (showDebug && issue.debug) {\n lines.push(\"\");\n lines.push(p.dim(` (debug: ${issue.debug})`));\n }\n\n return lines.join(\"\\n\");\n}\n\nfunction renderGroupedIssues(\n issues: ValidationIssue[],\n showDebug: boolean,\n): string {\n const groups = groupByContext(issues);\n const output: string[] = [];\n\n for (const [context, contextIssues] of groups) {\n // Context header\n output.push(p.cyan(p.bold(`โ ${context}`)));\n output.push(\"\");\n\n // Issues in this context\n for (const issue of contextIssues) {\n output.push(renderPrettyIssue(issue, showDebug));\n output.push(\"\"); // Empty line between issues\n }\n }\n\n return output.join(\"\\n\");\n}\n\nfunction renderMinimalIssue(issue: ValidationIssue): string {\n const icon =\n issue.severity === \"error\" ? \"โ\" : issue.severity === \"warning\" ? \"โ \" : \"โน\";\n const context = issue.context ? ` [${issue.context}]` : \"\";\n return `${icon} ${issue.message}${context}`;\n}\n\nexport function renderIssues(\n issues: ValidationIssue[],\n options: RenderOptions = {},\n): string {\n const { format = \"pretty\", showDebug = false } = options;\n\n if (issues.length === 0) {\n return p.green(\"โ No issues found\");\n }\n\n // Sort by severity: errors first, then warnings, then info\n const sorted = [...issues].sort((a, b) => {\n const severityOrder = { error: 0, warning: 1, info: 2 };\n return severityOrder[a.severity] - severityOrder[b.severity];\n });\n\n switch (format) {\n case \"json\":\n return JSON.stringify(sorted, null, 2);\n\n case \"minimal\":\n return sorted.map(renderMinimalIssue).join(\"\\n\");\n\n case \"pretty\":\n default: {\n const output: string[] = [];\n\n // Summary header\n const errorCount = issues.filter((i) => i.severity === \"error\").length;\n const warningCount = issues.filter(\n (i) => i.severity === \"warning\",\n ).length;\n const infoCount = issues.filter((i) => i.severity === \"info\").length;\n\n if (errorCount > 0) {\n output.push(\n p.red(\n p.bold(`Found ${errorCount} error${errorCount > 1 ? \"s\" : \"\"}`),\n ),\n );\n }\n if (warningCount > 0) {\n output.push(\n p.yellow(`${warningCount} warning${warningCount > 1 ? \"s\" : \"\"}`),\n );\n }\n if (infoCount > 0) {\n output.push(p.blue(`${infoCount} info`));\n }\n output.push(\"\");\n\n // Grouped issues\n output.push(renderGroupedIssues(sorted, showDebug));\n\n return output.join(\"\\n\");\n }\n }\n}\n\n// Render legacy error strings in DX-first format\nexport function renderLegacyError(\n error: string,\n showDebug: boolean = true,\n): string {\n const lines: string[] = [];\n\n // Extract debug info if present\n const debugMatch = error.match(/\\(debug: (.+)\\)$/);\n const debug = debugMatch ? debugMatch[1] : undefined;\n const mainError = debugMatch\n ? error.replace(/\\(debug: .+\\)$/, \"\").trim()\n : error;\n\n lines.push(p.red(p.bold(`โ ${mainError.split(\"\\n\")[0]}`)));\n\n // Show fix if present in the error\n const fixMatch = mainError.match(/Fix:\\n((?:- .+\\n?)+)/);\n if (fixMatch) {\n lines.push(\"\");\n lines.push(p.green(\" Fix:\"));\n const fixLines = fixMatch[1]?.split(\"\\n\").filter(Boolean) ?? [];\n for (const line of fixLines) {\n lines.push(` ${line.replace(/^- /, \"\")}`);\n }\n }\n\n if (showDebug && debug) {\n lines.push(\"\");\n lines.push(p.dim(` (debug: ${debug})`));\n }\n\n return lines.join(\"\\n\");\n}\n","{\n \"name\": \"@kalphq/cli\",\n \"version\": \"0.0.0-dev-20260506062515\",\n \"description\": \"Zero-config CLI for deploying Kalp agents\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"author\": \"Kalp HQ\",\n \"bin\": {\n \"kalp\": \"./dist/index.js\"\n },\n \"main\": \"./dist/index.js\",\n \"files\": [\n \"dist\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"lint\": \"tsc --noEmit\",\n \"prepublishOnly\": \"pnpm build\"\n },\n \"dependencies\": {\n \"@antfu/ni\": \"24.4.0\",\n \"@clack/prompts\": \"0.9.1\",\n \"@kalphq/compiler\": \"workspace:*\",\n \"@kalphq/project\": \"workspace:*\",\n \"@kalphq/sdk\": \"workspace:*\",\n \"citty\": \"0.1.6\",\n \"esbuild\": \"0.25.0\",\n \"json-stable-stringify\": \"1.3.0\",\n \"picocolors\": \"1.1.1\",\n \"zod\": \"3.25.76\"\n },\n \"devDependencies\": {\n \"@types/json-stable-stringify\": \"1.2.0\",\n \"@types/node\": \"^22.15.3\",\n \"tsup\": \"^8.3.5\",\n \"typescript\": \"^5.0.0\"\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,UAAAA,eAAc;AACvB,SAAS,QAAAC,aAAY;AACrB,SAAS,qBAAqB;AAC9B,YAAYC,QAAO;AACnB,OAAO,QAAQ;;;ACHf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