@kubb/cli 4.28.0 → 4.29.0
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/{agent-DrV6PuuK.js → agent-BzD6f3mV.js} +4 -5
- package/dist/{agent-DrV6PuuK.js.map → agent-BzD6f3mV.js.map} +1 -1
- package/dist/{agent-BHBMSAC7.cjs → agent-NAhMf2ot.cjs} +4 -5
- package/dist/{agent-BHBMSAC7.cjs.map → agent-NAhMf2ot.cjs.map} +1 -1
- package/dist/{chunk-C1_xRkKa.cjs → chunk-CNbaEX1y.cjs} +1 -1
- package/dist/{chunk-jHaXqnEa.js → chunk-DKWOrOAv.js} +1 -1
- package/dist/{generate-CQYwekvF.cjs → generate-C8gS4Z2F.cjs} +190 -188
- package/dist/generate-C8gS4Z2F.cjs.map +1 -0
- package/dist/{generate-Cj8cU5XB.js → generate-CnKaIwc7.js} +191 -185
- package/dist/generate-CnKaIwc7.js.map +1 -0
- package/dist/index.cjs +9 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/{init-BVwhJb7n.js → init-B5qnw1XS.js} +22 -23
- package/dist/init-B5qnw1XS.js.map +1 -0
- package/dist/{init-Ckt9G-Yf.cjs → init-BDWQO7I8.cjs} +22 -24
- package/dist/init-BDWQO7I8.cjs.map +1 -0
- package/dist/{mcp-DGyip5BX.cjs → mcp-97TXkJVX.cjs} +5 -7
- package/dist/mcp-97TXkJVX.cjs.map +1 -0
- package/dist/{mcp-C-e4yatL.js → mcp-Jboea6xH.js} +5 -6
- package/dist/mcp-Jboea6xH.js.map +1 -0
- package/dist/{package-CeCGexzv.cjs → package-oo3QhWS5.cjs} +2 -2
- package/dist/package-oo3QhWS5.cjs.map +1 -0
- package/dist/package-veMf5zNr.js +6 -0
- package/dist/package-veMf5zNr.js.map +1 -0
- package/dist/{start-jaV7_Xss.js → start-CYuU23PX.js} +27 -24
- package/dist/start-CYuU23PX.js.map +1 -0
- package/dist/{start-DqKYNdp1.cjs → start-lrn1-P52.cjs} +27 -25
- package/dist/start-lrn1-P52.cjs.map +1 -0
- package/dist/{validate-Cvb5aOEb.cjs → validate-BgYhe_55.cjs} +3 -4
- package/dist/{validate-Cvb5aOEb.cjs.map → validate-BgYhe_55.cjs.map} +1 -1
- package/dist/{validate-YI4YkVTl.js → validate-DOeZKiGx.js} +3 -4
- package/dist/{validate-YI4YkVTl.js.map → validate-DOeZKiGx.js.map} +1 -1
- package/package.json +12 -21
- package/src/commands/agent/start.ts +17 -16
- package/src/commands/generate.ts +11 -7
- package/src/commands/init.ts +14 -14
- package/src/commands/mcp.ts +2 -2
- package/src/loggers/clackLogger.ts +49 -40
- package/src/loggers/githubActionsLogger.ts +36 -32
- package/src/loggers/plainLogger.ts +9 -9
- package/src/runners/generate.ts +9 -7
- package/src/utils/Writables.ts +2 -2
- package/src/utils/executeHooks.ts +4 -5
- package/src/utils/formatMsWithColor.ts +4 -4
- package/src/utils/getIntro.ts +52 -6
- package/src/utils/getSummary.ts +6 -6
- package/src/utils/packageManager.ts +3 -9
- package/src/utils/randomColor.ts +5 -6
- package/src/utils/watcher.ts +3 -3
- package/dist/generate-CQYwekvF.cjs.map +0 -1
- package/dist/generate-Cj8cU5XB.js.map +0 -1
- package/dist/index.d.cts +0 -6
- package/dist/init-BVwhJb7n.js.map +0 -1
- package/dist/init-Ckt9G-Yf.cjs.map +0 -1
- package/dist/mcp-C-e4yatL.js.map +0 -1
- package/dist/mcp-DGyip5BX.cjs.map +0 -1
- package/dist/package-CeCGexzv.cjs.map +0 -1
- package/dist/package-DNxKRFpk.js +0 -6
- package/dist/package-DNxKRFpk.js.map +0 -1
- package/dist/start-DqKYNdp1.cjs.map +0 -1
- package/dist/start-jaV7_Xss.js.map +0 -1
- package/src/utils/ansiColors.ts +0 -23
package/dist/mcp-C-e4yatL.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-C-e4yatL.js","names":[],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import type { ArgsDef } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\nimport pc from 'picocolors'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nconst command = defineCommand({\n meta: {\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n let mod: any\n try {\n mod = await jiti.import('@kubb/mcp', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n process.exit(1)\n }\n\n const { run } = mod\n try {\n console.log('⏳ Starting MCP server...')\n console.warn(pc.yellow('This feature is still under development — use with caution'))\n await run()\n } catch (error) {\n console.error((error as Error)?.message)\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;AAKA,MAAM,OAAO,WAAW,OAAO,KAAK,KAAK,EACvC,YAAY,MACb,CAAC;AAWF,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAdW,EACX,MAAM;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACP,SAAS;EACV,EACF;CAQC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,QAAO,UAAU,QAAQ;EAG3B,IAAI;AACJ,MAAI;AACF,SAAM,MAAM,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;WAChD,IAAI;AACX,WAAQ,MAAM,4DAA4D;AAC1E,WAAQ,KAAK,EAAE;;EAGjB,MAAM,EAAE,QAAQ;AAChB,MAAI;AACF,WAAQ,IAAI,2BAA2B;AACvC,WAAQ,KAAK,GAAG,OAAO,6DAA6D,CAAC;AACrF,SAAM,KAAK;WACJ,OAAO;AACd,WAAQ,MAAO,OAAiB,QAAQ;;;CAG7C,CAAC;AAEF,kBAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-DGyip5BX.cjs","names":["jiti","pc"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import type { ArgsDef } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\nimport pc from 'picocolors'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nconst command = defineCommand({\n meta: {\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n let mod: any\n try {\n mod = await jiti.import('@kubb/mcp', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n process.exit(1)\n }\n\n const { run } = mod\n try {\n console.log('⏳ Starting MCP server...')\n console.warn(pc.yellow('This feature is still under development — use with caution'))\n await run()\n } catch (error) {\n console.error((error as Error)?.message)\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;AAKA,MAAMA,6EAAmC,EACvC,YAAY,MACb,CAAC;AAWF,MAAM,mCAAwB;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAdW,EACX,MAAM;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACP,SAAS;EACV,EACF;CAQC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,6BAAiB,QAAQ;EAG3B,IAAI;AACJ,MAAI;AACF,SAAM,MAAMA,OAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;WAChD,IAAI;AACX,WAAQ,MAAM,4DAA4D;AAC1E,WAAQ,KAAK,EAAE;;EAGjB,MAAM,EAAE,QAAQ;AAChB,MAAI;AACF,WAAQ,IAAI,2BAA2B;AACvC,WAAQ,KAAKC,mBAAG,OAAO,6DAA6D,CAAC;AACrF,SAAM,KAAK;WACJ,OAAO;AACd,WAAQ,MAAO,OAAiB,QAAQ;;;CAG7C,CAAC;AAEF,kBAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package-CeCGexzv.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
|
package/dist/package-DNxKRFpk.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package-DNxKRFpk.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start-DqKYNdp1.cjs","names":["path","process","pc","args"],"sources":["../src/commands/agent/start.ts"],"sourcesContent":["import path from 'node:path'\nimport * as process from 'node:process'\nimport { fileURLToPath } from 'node:url'\n\nimport * as clack from '@clack/prompts'\nimport type { ArgsDef } from 'citty'\nimport { defineCommand } from 'citty'\nimport { config as loadEnv } from 'dotenv'\nimport { execa } from 'execa'\nimport pc from 'picocolors'\n\nconst args = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n alias: 'c',\n },\n port: {\n type: 'string',\n description: 'Port for the server. If not specified, an available port is automatically selected.',\n alias: 'p',\n },\n host: {\n type: 'string',\n description: 'Host for the server',\n default: 'localhost',\n },\n 'no-cache': {\n type: 'boolean',\n description: 'Disable session caching',\n default: false,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': {\n type: 'boolean',\n description: 'Grant all permissions (implies --allow-write).',\n default: false,\n },\n} as const satisfies ArgsDef\n\ntype StartServerProps = {\n port: number\n host: string\n configPath: string\n noCache: boolean\n allowWrite: boolean\n allowAll: boolean\n}\n\nasync function startServer({ port, host, configPath, noCache, allowWrite, allowAll }: StartServerProps): Promise<void> {\n try {\n // Load .env files into process.env (supports .env, .env.local, .env.*.local)\n loadEnv() // .env\n\n // Resolve the @kubb/agent package path\n const agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, '.output', 'server', 'index.mjs')\n\n // nitro env\n const PORT = process.env.PORT || (port === 0 ? '3000' : String(port))\n const HOST = process.env.HOST || host || '0.0.0.0'\n\n // kubb env\n const KUBB_AGENT_ROOT = process.env.KUBB_AGENT_ROOT || process.cwd()\n const KUBB_AGENT_CONFIG = process.env.KUBB_AGENT_CONFIG || configPath || 'kubb.config.ts'\n const KUBB_AGENT_NO_CACHE = noCache ? 'true' : 'false'\n const KUBB_AGENT_ALLOW_WRITE = allowAll || allowWrite ? 'true' : (process.env.KUBB_AGENT_ALLOW_WRITE ?? 'false')\n const KUBB_AGENT_ALLOW_ALL = allowAll ? 'true' : (process.env.KUBB_AGENT_ALLOW_ALL ?? 'false')\n const KUBB_AGENT_TOKEN = process.env.KUBB_AGENT_TOKEN\n const KUBB_AGENT_RETRY_TIMEOUT = process.env.KUBB_AGENT_RETRY_TIMEOUT || '30000'\n const KUBB_STUDIO_URL = process.env.KUBB_STUDIO_URL || 'https://studio.kubb.dev'\n\n // Set environment variables\n const env = {\n PORT,\n HOST,\n KUBB_AGENT_ROOT,\n KUBB_AGENT_CONFIG,\n KUBB_AGENT_NO_CACHE,\n KUBB_AGENT_ALLOW_WRITE,\n KUBB_AGENT_ALLOW_ALL,\n KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT,\n KUBB_STUDIO_URL,\n }\n\n clack.log.step(pc.cyan('Starting agent server...'))\n clack.log.info(pc.dim(`Config: ${KUBB_AGENT_CONFIG}`))\n clack.log.info(pc.dim(`Host: ${HOST}`))\n clack.log.info(pc.dim(`Port: ${PORT}`))\n if (noCache) {\n clack.log.info(pc.dim('Session caching: disabled'))\n }\n if (!KUBB_AGENT_ALLOW_WRITE && !KUBB_AGENT_ALLOW_ALL) {\n clack.log.warn(pc.yellow('Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n // Use execa to spawn the server process\n await execa('node', [serverPath], {\n env,\n stdio: 'inherit',\n cwd: process.cwd(),\n })\n } catch (error) {\n console.error('Failed to start agent server:', error)\n process.exit(1)\n }\n}\n\nconst command = defineCommand({\n meta: {\n name: 'start',\n description: 'Start the Agent server',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n try {\n const configPath = path.resolve(process.cwd(), args.config || 'kubb.config.ts')\n const port = args.port ? Number.parseInt(args.port, 10) : 0\n const host = args.host\n const noCache = args['no-cache']\n const allowWrite = args['allow-write']\n const allowAll = args['allow-all']\n\n await startServer({ port, host, configPath, noCache, allowWrite, allowAll })\n } catch (error) {\n clack.log.error(pc.red('Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;;;;;;;;;AAWA,MAAM,OAAO;CACX,QAAQ;EACN,MAAM;EACN,aAAa;EACb,OAAO;EACR;CACD,MAAM;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACR;CACD,MAAM;EACJ,MAAM;EACN,aAAa;EACb,SAAS;EACV;CACD,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;EACV;CACD,eAAe;EACb,MAAM;EACN,aAAa;EACb,SAAS;EACV;CACD,aAAa;EACX,MAAM;EACN,aAAa;EACb,SAAS;EACV;CACF;AAWD,eAAe,YAAY,EAAE,MAAM,MAAM,YAAY,SAAS,YAAY,YAA6C;AACrH,KAAI;AAEF,sBAAS;EAIT,MAAM,8CAD0B,QAAQ,2BAA2B,CACpB;EAC/C,MAAM,WAAWA,kBAAK,QAAQ,aAAa;EAC3C,MAAM,aAAaA,kBAAK,KAAK,UAAU,WAAW,UAAU,YAAY;EAGxE,MAAM,OAAOC,aAAQ,IAAI,SAAS,SAAS,IAAI,SAAS,OAAO,KA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M,OAAOA,OAAK,OAAO,OAAO,SAASA,OAAK,MAAM,GAAG,GAAG;GAC1D,MAAM,OAAOA,OAAK;GAClB,MAAM,UAAUA,OAAK;GACrB,MAAM,aAAaA,OAAK;GACxB,MAAM,WAAWA,OAAK;AAEtB,SAAM,YAAY;IAAE;IAAM;IAAM;IAAY;IAAS;IAAY;IAAU,CAAC;WACrE,OAAO;AACd,kBAAM,IAAI,MAAMD,mBAAG,IAAI,+BAA+B,CAAC;AACvD,WAAQ,MAAM,MAAM;AACpB,gBAAQ,KAAK,EAAE;;;CAGpB,CAAC;AAEF,oBAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start-jaV7_Xss.js","names":["process","args"],"sources":["../src/commands/agent/start.ts"],"sourcesContent":["import path from 'node:path'\nimport * as process from 'node:process'\nimport { fileURLToPath } from 'node:url'\n\nimport * as clack from '@clack/prompts'\nimport type { ArgsDef } from 'citty'\nimport { defineCommand } from 'citty'\nimport { config as loadEnv } from 'dotenv'\nimport { execa } from 'execa'\nimport pc from 'picocolors'\n\nconst args = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n alias: 'c',\n },\n port: {\n type: 'string',\n description: 'Port for the server. If not specified, an available port is automatically selected.',\n alias: 'p',\n },\n host: {\n type: 'string',\n description: 'Host for the server',\n default: 'localhost',\n },\n 'no-cache': {\n type: 'boolean',\n description: 'Disable session caching',\n default: false,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': {\n type: 'boolean',\n description: 'Grant all permissions (implies --allow-write).',\n default: false,\n },\n} as const satisfies ArgsDef\n\ntype StartServerProps = {\n port: number\n host: string\n configPath: string\n noCache: boolean\n allowWrite: boolean\n allowAll: boolean\n}\n\nasync function startServer({ port, host, configPath, noCache, allowWrite, allowAll }: StartServerProps): Promise<void> {\n try {\n // Load .env files into process.env (supports .env, .env.local, .env.*.local)\n loadEnv() // .env\n\n // Resolve the @kubb/agent package path\n const agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, '.output', 'server', 'index.mjs')\n\n // nitro env\n const PORT = process.env.PORT || (port === 0 ? '3000' : String(port))\n const HOST = process.env.HOST || host || '0.0.0.0'\n\n // kubb env\n const KUBB_AGENT_ROOT = process.env.KUBB_AGENT_ROOT || process.cwd()\n const KUBB_AGENT_CONFIG = process.env.KUBB_AGENT_CONFIG || configPath || 'kubb.config.ts'\n const KUBB_AGENT_NO_CACHE = noCache ? 'true' : 'false'\n const KUBB_AGENT_ALLOW_WRITE = allowAll || allowWrite ? 'true' : (process.env.KUBB_AGENT_ALLOW_WRITE ?? 'false')\n const KUBB_AGENT_ALLOW_ALL = allowAll ? 'true' : (process.env.KUBB_AGENT_ALLOW_ALL ?? 'false')\n const KUBB_AGENT_TOKEN = process.env.KUBB_AGENT_TOKEN\n const KUBB_AGENT_RETRY_TIMEOUT = process.env.KUBB_AGENT_RETRY_TIMEOUT || '30000'\n const KUBB_STUDIO_URL = process.env.KUBB_STUDIO_URL || 'https://studio.kubb.dev'\n\n // Set environment variables\n const env = {\n PORT,\n HOST,\n KUBB_AGENT_ROOT,\n KUBB_AGENT_CONFIG,\n KUBB_AGENT_NO_CACHE,\n KUBB_AGENT_ALLOW_WRITE,\n KUBB_AGENT_ALLOW_ALL,\n KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT,\n KUBB_STUDIO_URL,\n }\n\n clack.log.step(pc.cyan('Starting agent server...'))\n clack.log.info(pc.dim(`Config: ${KUBB_AGENT_CONFIG}`))\n clack.log.info(pc.dim(`Host: ${HOST}`))\n clack.log.info(pc.dim(`Port: ${PORT}`))\n if (noCache) {\n clack.log.info(pc.dim('Session caching: disabled'))\n }\n if (!KUBB_AGENT_ALLOW_WRITE && !KUBB_AGENT_ALLOW_ALL) {\n clack.log.warn(pc.yellow('Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n // Use execa to spawn the server process\n await execa('node', [serverPath], {\n env,\n stdio: 'inherit',\n cwd: process.cwd(),\n })\n } catch (error) {\n console.error('Failed to start agent server:', error)\n process.exit(1)\n }\n}\n\nconst command = defineCommand({\n meta: {\n name: 'start',\n description: 'Start the Agent server',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n try {\n const configPath = path.resolve(process.cwd(), args.config || 'kubb.config.ts')\n const port = args.port ? Number.parseInt(args.port, 10) : 0\n const host = args.host\n const noCache = args['no-cache']\n const allowWrite = args['allow-write']\n const allowAll = args['allow-all']\n\n await startServer({ port, host, configPath, noCache, allowWrite, allowAll })\n } catch (error) {\n clack.log.error(pc.red('Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,OAAO;CACX,QAAQ;EACN,MAAM;EACN,aAAa;EACb,OAAO;EACR;CACD,MAAM;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACR;CACD,MAAM;EACJ,MAAM;EACN,aAAa;EACb,SAAS;EACV;CACD,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;EACV;CACD,eAAe;EACb,MAAM;EACN,aAAa;EACb,SAAS;EACV;CACD,aAAa;EACX,MAAM;EACN,aAAa;EACb,SAAS;EACV;CACF;AAWD,eAAe,YAAY,EAAE,MAAM,MAAM,YAAY,SAAS,YAAY,YAA6C;AACrH,KAAI;AAEF,UAAS;EAIT,MAAM,eAAe,cADD,OAAO,KAAK,QAAQ,2BAA2B,CACpB;EAC/C,MAAM,WAAW,KAAK,QAAQ,aAAa;EAC3C,MAAM,aAAa,KAAK,KAAK,UAAU,WAAW,UAAU,YAAY;EAGxE,MAAM,OAAOA,UAAQ,IAAI,SAAS,SAAS,IAAI,SAAS,OAAO,KAAK;EACpE,MAAM,OAAOA,UAAQ,IAAI,QAAQ,QAAQ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MAAM,OAAOA,OAAK;GAClB,MAAM,UAAUA,OAAK;GACrB,MAAM,aAAaA,OAAK;GACxB,MAAM,WAAWA,OAAK;AAEtB,SAAM,YAAY;IAAE;IAAM;IAAM;IAAY;IAAS;IAAY;IAAU,CAAC;WACrE,OAAO;AACd,SAAM,IAAI,MAAM,GAAG,IAAI,+BAA+B,CAAC;AACvD,WAAQ,MAAM,MAAM;AACpB,aAAQ,KAAK,EAAE;;;CAGpB,CAAC;AAEF,oBAAe"}
|
package/src/utils/ansiColors.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ANSI True Color (24-bit) utilities for terminal output
|
|
3
|
-
* Supports hex color codes without external dependencies like chalk
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Convert hex color to ANSI 24-bit true color escape sequence
|
|
8
|
-
* @param color - Hex color code (with or without #), e.g., '#FF5500' or 'FF5500'
|
|
9
|
-
* @returns Function that wraps text with the color
|
|
10
|
-
*/
|
|
11
|
-
export function hex(color: string): (text: string) => string {
|
|
12
|
-
const cleanHex = color.replace('#', '')
|
|
13
|
-
const r = Number.parseInt(cleanHex.slice(0, 2), 16)
|
|
14
|
-
const g = Number.parseInt(cleanHex.slice(2, 4), 16)
|
|
15
|
-
const b = Number.parseInt(cleanHex.slice(4, 6), 16)
|
|
16
|
-
|
|
17
|
-
// Default to white (255) if parsing fails (NaN)
|
|
18
|
-
const safeR = Number.isNaN(r) ? 255 : r
|
|
19
|
-
const safeG = Number.isNaN(g) ? 255 : g
|
|
20
|
-
const safeB = Number.isNaN(b) ? 255 : b
|
|
21
|
-
|
|
22
|
-
return (text: string) => `\x1b[38;2;${safeR};${safeG};${safeB}m${text}\x1b[0m`
|
|
23
|
-
}
|