@routecraft/cli 0.3.0-canary.6 → 0.3.0-canary.7
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 +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var[t,c]=process.version.slice(1).split(".").map(Number);t>18||t===18&&c>=19||(console.error(`[routecraft] Node.js ${process.version} is not supported. Routecraft requires Node.js 18.19.0 or later (e.g. 20 or 22). Please upgrade Node or configure your MCP client to use a newer Node.`),process.exit(1));var{Command:p}=await import('commander'),o=new p;o.name("craft").description("A modern routing framework for TypeScript").version("0.3.0-canary.
|
|
2
|
+
var[t,c]=process.version.slice(1).split(".").map(Number);t>18||t===18&&c>=19||(console.error(`[routecraft] Node.js ${process.version} is not supported. Routecraft requires Node.js 18.19.0 or later (e.g. 20 or 22). Please upgrade Node or configure your MCP client to use a newer Node.`),process.exit(1));var{Command:p}=await import('commander'),o=new p;o.name("craft").description("A modern routing framework for TypeScript").version("0.3.0-canary.7").option("--log-level <level>","Log level (e.g. info, warn, error, silent to disable)").option("--log-file <path>","Write logs to a file (keeps stdout clear for MCP stdio)").showSuggestionAfterError().showHelpAfterError().exitOverride(n=>{n.code==="commander.unknownCommand"&&process.exit(0);});process.argv.length<=2&&o.help({error:false});o.command("run").description("Run routes from a single TypeScript/JavaScript file").argument("<file>","Path to a file containing routes").option("--env <path>","Load environment variables from a .env file (default: .env)").action(async(n,s)=>{let e=o.opts();e.logLevel!==void 0&&(process.env.LOG_LEVEL=e.logLevel,process.env.CRAFT_LOG_LEVEL=e.logLevel),e.logFile!==void 0&&(process.env.LOG_FILE=e.logFile,process.env.CRAFT_LOG_FILE=e.logFile);let{loadEnvFile:i}=await import('./util-5TR67ZZL.js');s.env!==void 0?i(s.env):i();let{runCommand:a}=await import('./run-IJNIE5VV.js'),r=await a(n);if(!r.success){r.message&&console.error(r.message);let l=r.code??1;setImmediate(()=>process.exit(l));return}});o.parse();//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["major","minor","Command","program","err","filePath","options","globalOpts","loadEnvFile","runCommand","result","code"],"mappings":";AAUA,GAAM,CAACA,EAAOC,CAAK,CAAA,CAAI,QAAQ,OAAA,CAAQ,KAAA,CAAM,CAAC,CAAA,CAAE,KAAA,CAAM,GAAG,CAAA,CAAE,GAAA,CAAI,MAAM,CAAA,CAK/DD,CAAAA,CAAQ,IAAOA,CAAAA,GAAU,EAAA,EAAMC,CAAAA,EAAS,EAAA,GAE5C,OAAA,CAAQ,KAAA,CACN,wBAAwB,OAAA,CAAQ,OAAO,wJAGzC,CAAA,CACA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA,CAIhB,GAAM,CAAE,OAAA,CAAAC,CAAQ,EAAI,MAAM,OAAO,WAAW,CAAA,CACtCC,CAAAA,CAAU,IAAID,CAAAA,CAEpBC,CAAAA,CACG,IAAA,CAAK,OAAO,CAAA,CACZ,WAAA,CAAY,2CAA2C,CAAA,CACvD,OAAA,CAAQ,gBAAgB,CAAA,CACxB,MAAA,CACC,sBACA,uDACF,CAAA,CACC,OACC,mBAAA,CACA,yDACF,EACC,wBAAA,EAAyB,CACzB,oBAAmB,CACnB,YAAA,CAAcC,GAAQ,CACjBA,CAAAA,CAAI,IAAA,GAAS,0BAAA,EACf,OAAA,CAAQ,IAAA,CAAK,CAAC,EAElB,CAAC,EAGC,OAAA,CAAQ,IAAA,CAAK,QAAU,CAAA,EACzBD,CAAAA,CAAQ,IAAA,CAAK,CAAE,KAAA,CAAO,KAAM,CAAC,CAAA,CAS/BA,CAAAA,CACG,QAAQ,KAAK,CAAA,CACb,YAAY,qDAAqD,CAAA,CACjE,QAAA,CAAS,QAAA,CAAU,kCAAkC,CAAA,CACrD,OACC,cAAA,CACA,6DACF,EACC,MAAA,CAAO,MAAOE,EAAUC,CAAAA,GAAY,CAEnC,IAAMC,CAAAA,CAAaJ,CAAAA,CAAQ,MAAK,CAC5BI,CAAAA,CAAW,WAAgB,MAAA,GAC7B,OAAA,CAAQ,IAAI,SAAA,CAAeA,CAAAA,CAAW,QAAA,CACtC,OAAA,CAAQ,GAAA,CAAI,eAAA,CAAqBA,EAAW,QAAA,CAAA,CAE1CA,CAAAA,CAAW,UAAe,MAAA,GAC5B,OAAA,CAAQ,IAAI,QAAA,CAAcA,CAAAA,CAAW,OAAA,CACrC,OAAA,CAAQ,GAAA,CAAI,cAAA,CAAoBA,EAAW,OAAA,CAAA,CAG7C,GAAM,CAAE,WAAA,CAAAC,CAAY,EAAI,MAAM,OAAO,oBAAW,CAAA,CAC5CF,CAAAA,CAAQ,GAAA,GAAQ,OAClBE,CAAAA,CAAYF,CAAAA,CAAQ,GAAG,CAAA,CAEvBE,CAAAA,GAGF,GAAM,CAAE,UAAA,CAAAC,CAAW,CAAA,CAAI,aAAa,mBAAU,CAAA,CACxCC,EAAS,MAAMD,CAAAA,CAAWJ,CAAQ,CAAA,CACxC,GAAI,CAACK,CAAAA,CAAO,OAAA,CAAS,CACfA,EAAO,OAAA,EAET,OAAA,CAAQ,MAAMA,CAAAA,CAAO,OAAO,EAG9B,IAAMC,CAAAA,CAAOD,CAAAA,CAAO,IAAA,EAAQ,CAAA,CAC5B,YAAA,CAAa,IAAM,OAAA,CAAQ,IAAA,CAAKC,CAAI,CAAC,CAAA,CACrC,MACF,CAIF,CAAC,CAAA,CAGHR,CAAAA,CAAQ,KAAA,EAAM","file":"index.js","sourcesContent":["#!/usr/bin/env node\n\n/**\n * Routecraft CLI — single entry point.\n *\n * 1. Check Node version (Pino 10 needs Node 18.19+)\n * 2. Define program and parse; log options are global and applied before lazy-loading run/util (which load the logger)\n */\n\n// ── 1. Node version gate ────────────────────────────────────────────\nconst [major, minor] = process.version.slice(1).split(\".\").map(Number) as [\n number,\n number,\n];\n\nif (!(major > 18 || (major === 18 && minor >= 19))) {\n // eslint-disable-next-line no-console\n console.error(\n `[routecraft] Node.js ${process.version} is not supported. ` +\n `Routecraft requires Node.js 18.19.0 or later (e.g. 20 or 22). ` +\n `Please upgrade Node or configure your MCP client to use a newer Node.`,\n );\n process.exit(1);\n}\n\n// ── 2. CLI definition (only Commander; run/util are lazy-loaded so logger sees env) ─\nconst { Command } = await import(\"commander\");\nconst program = new Command();\n\nprogram\n .name(\"craft\")\n .description(\"A modern routing framework for TypeScript\")\n .version(\"0.3.0-canary.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["major","minor","Command","program","err","filePath","options","globalOpts","loadEnvFile","runCommand","result","code"],"mappings":";AAUA,GAAM,CAACA,EAAOC,CAAK,CAAA,CAAI,QAAQ,OAAA,CAAQ,KAAA,CAAM,CAAC,CAAA,CAAE,KAAA,CAAM,GAAG,CAAA,CAAE,GAAA,CAAI,MAAM,CAAA,CAK/DD,CAAAA,CAAQ,IAAOA,CAAAA,GAAU,EAAA,EAAMC,CAAAA,EAAS,EAAA,GAE5C,OAAA,CAAQ,KAAA,CACN,wBAAwB,OAAA,CAAQ,OAAO,wJAGzC,CAAA,CACA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA,CAIhB,GAAM,CAAE,OAAA,CAAAC,CAAQ,EAAI,MAAM,OAAO,WAAW,CAAA,CACtCC,CAAAA,CAAU,IAAID,CAAAA,CAEpBC,CAAAA,CACG,IAAA,CAAK,OAAO,CAAA,CACZ,WAAA,CAAY,2CAA2C,CAAA,CACvD,OAAA,CAAQ,gBAAgB,CAAA,CACxB,MAAA,CACC,sBACA,uDACF,CAAA,CACC,OACC,mBAAA,CACA,yDACF,EACC,wBAAA,EAAyB,CACzB,oBAAmB,CACnB,YAAA,CAAcC,GAAQ,CACjBA,CAAAA,CAAI,IAAA,GAAS,0BAAA,EACf,OAAA,CAAQ,IAAA,CAAK,CAAC,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CAAAA,CAAQ,KAAA,EAAM","file":"index.js","sourcesContent":["#!/usr/bin/env node\n\n/**\n * Routecraft CLI — single entry point.\n *\n * 1. Check Node version (Pino 10 needs Node 18.19+)\n * 2. Define program and parse; log options are global and applied before lazy-loading run/util (which load the logger)\n */\n\n// ── 1. Node version gate ────────────────────────────────────────────\nconst [major, minor] = process.version.slice(1).split(\".\").map(Number) as [\n number,\n number,\n];\n\nif (!(major > 18 || (major === 18 && minor >= 19))) {\n // eslint-disable-next-line no-console\n console.error(\n `[routecraft] Node.js ${process.version} is not supported. ` +\n `Routecraft requires Node.js 18.19.0 or later (e.g. 20 or 22). ` +\n `Please upgrade Node or configure your MCP client to use a newer Node.`,\n );\n process.exit(1);\n}\n\n// ── 2. CLI definition (only Commander; run/util are lazy-loaded so logger sees env) ─\nconst { Command } = await import(\"commander\");\nconst program = new Command();\n\nprogram\n .name(\"craft\")\n .description(\"A modern routing framework for TypeScript\")\n .version(\"0.3.0-canary.7\")\n .option(\n \"--log-level <level>\",\n \"Log level (e.g. info, warn, error, silent to disable)\",\n )\n .option(\n \"--log-file <path>\",\n \"Write logs to a file (keeps stdout clear for MCP stdio)\",\n )\n .showSuggestionAfterError()\n .showHelpAfterError()\n .exitOverride((err) => {\n if (err.code === \"commander.unknownCommand\") {\n process.exit(0);\n }\n });\n\n// Show help by default if no arguments provided\nif (process.argv.length <= 2) {\n program.help({ error: false });\n}\n\n/**\n * The 'run' command executes routes from a single file.\n *\n * Example:\n * craft run ./my-routes.ts\n */\nprogram\n .command(\"run\")\n .description(\"Run routes from a single TypeScript/JavaScript file\")\n .argument(\"<file>\", \"Path to a file containing routes\")\n .option(\n \"--env <path>\",\n \"Load environment variables from a .env file (default: .env)\",\n )\n .action(async (filePath, options) => {\n // Apply global log options to env before any import that creates the logger\n const globalOpts = program.opts();\n if (globalOpts[\"logLevel\"] !== undefined) {\n process.env[\"LOG_LEVEL\"] = globalOpts[\"logLevel\"];\n process.env[\"CRAFT_LOG_LEVEL\"] = globalOpts[\"logLevel\"];\n }\n if (globalOpts[\"logFile\"] !== undefined) {\n process.env[\"LOG_FILE\"] = globalOpts[\"logFile\"];\n process.env[\"CRAFT_LOG_FILE\"] = globalOpts[\"logFile\"];\n }\n\n const { loadEnvFile } = await import(\"./util.js\");\n if (options.env !== undefined) {\n loadEnvFile(options.env);\n } else {\n loadEnvFile();\n }\n\n const { runCommand } = await import(\"./run.js\");\n const result = await runCommand(filePath);\n if (!result.success) {\n if (result.message) {\n // eslint-disable-next-line no-console\n console.error(result.message);\n }\n // Defer exit so pino/sonic-boom can finish initializing and avoid \"sonic boom is not ready yet\"\n const code = result.code ?? 1;\n setImmediate(() => process.exit(code));\n return;\n }\n // Don't call process.exit() — let the event loop drain naturally.\n // process.exit() triggers C++ static destructors that race with ONNX\n // Runtime cleanup (onnxruntime#25038: \"mutex lock failed\").\n });\n\n// Parse the command line arguments and execute the appropriate command\nprogram.parse();\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routecraft/cli",
|
|
3
|
-
"version": "0.3.0-canary.
|
|
3
|
+
"version": "0.3.0-canary.7",
|
|
4
4
|
"description": "CLI for running RouteCraft routes",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"prepublishOnly": "pnpm run build"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@routecraft/routecraft": "^0.3.0-canary.
|
|
25
|
+
"@routecraft/routecraft": "^0.3.0-canary.7",
|
|
26
26
|
"commander": "^14.0.3",
|
|
27
27
|
"dotenv": "^17.3.1",
|
|
28
28
|
"pino-pretty": "^13.1.3"
|