@jixo/cli 0.11.0 → 0.13.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.
Files changed (67) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +41 -67
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/daemon.d.ts +5 -0
  5. package/dist/commands/daemon.d.ts.map +1 -0
  6. package/dist/commands/daemon.js +20 -0
  7. package/dist/commands/daemon.js.map +1 -0
  8. package/dist/commands/doctor/config.d.ts.map +1 -1
  9. package/dist/commands/doctor/config.js +5 -18
  10. package/dist/commands/doctor/config.js.map +1 -1
  11. package/dist/commands/doctor/doctor.d.ts +1 -16
  12. package/dist/commands/doctor/doctor.d.ts.map +1 -1
  13. package/dist/commands/doctor/doctor.js +85 -52
  14. package/dist/commands/doctor/doctor.js.map +1 -1
  15. package/dist/commands/doctor/index.d.ts +1 -1
  16. package/dist/commands/doctor/index.d.ts.map +1 -1
  17. package/dist/commands/doctor/index.js +0 -11
  18. package/dist/commands/doctor/index.js.map +1 -1
  19. package/dist/commands/doctor/types.d.ts +17 -2
  20. package/dist/commands/doctor/types.d.ts.map +1 -1
  21. package/dist/commands/doctor/types.js.map +1 -1
  22. package/dist/commands/init.d.ts.map +1 -1
  23. package/dist/commands/init.js +32 -49
  24. package/dist/commands/init.js.map +1 -1
  25. package/dist/commands/tasks/AiTaskTui.d.ts +22 -0
  26. package/dist/commands/tasks/AiTaskTui.d.ts.map +1 -0
  27. package/dist/commands/tasks/AiTaskTui.js +52 -0
  28. package/dist/commands/tasks/AiTaskTui.js.map +1 -0
  29. package/dist/commands/tasks/ai-tasl-tui.d.ts +22 -0
  30. package/dist/commands/tasks/ai-tasl-tui.d.ts.map +1 -0
  31. package/dist/commands/tasks/ai-tasl-tui.js +53 -0
  32. package/dist/commands/tasks/ai-tasl-tui.js.map +1 -0
  33. package/dist/commands/tasks/ai-tools.d.ts +4 -10
  34. package/dist/commands/tasks/ai-tools.d.ts.map +1 -1
  35. package/dist/commands/tasks/ai-tools.js +15 -11
  36. package/dist/commands/tasks/ai-tools.js.map +1 -1
  37. package/dist/commands/tasks/model-providers.d.ts +5 -1
  38. package/dist/commands/tasks/model-providers.d.ts.map +1 -1
  39. package/dist/commands/tasks/model-providers.js +31 -0
  40. package/dist/commands/tasks/model-providers.js.map +1 -1
  41. package/dist/commands/tasks/run-ai-task.d.ts.map +1 -1
  42. package/dist/commands/tasks/run-ai-task.js +110 -126
  43. package/dist/commands/tasks/run-ai-task.js.map +1 -1
  44. package/dist/commands/tasks/run.d.ts +9 -6
  45. package/dist/commands/tasks/run.d.ts.map +1 -1
  46. package/dist/commands/tasks/run.js +38 -84
  47. package/dist/commands/tasks/run.js.map +1 -1
  48. package/dist/config.d.ts +5 -196
  49. package/dist/config.d.ts.map +1 -1
  50. package/dist/config.js +9 -21
  51. package/dist/config.js.map +1 -1
  52. package/dist/env.d.ts +2 -13
  53. package/dist/env.d.ts.map +1 -1
  54. package/dist/env.js +3 -13
  55. package/dist/env.js.map +1 -1
  56. package/dist/helper/handle-ai-error.js +1 -1
  57. package/dist/helper/handle-ai-error.js.map +1 -1
  58. package/dist/helper/logger.d.ts +3 -0
  59. package/dist/helper/logger.d.ts.map +1 -0
  60. package/dist/helper/logger.js +26 -0
  61. package/dist/helper/logger.js.map +1 -0
  62. package/dist/helper/resolve-ai-tasks.d.ts +7 -6
  63. package/dist/helper/resolve-ai-tasks.d.ts.map +1 -1
  64. package/dist/helper/resolve-ai-tasks.js +22 -19
  65. package/dist/helper/resolve-ai-tasks.js.map +1 -1
  66. package/dist/prompts.json +2 -14
  67. package/package.json +14 -10
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,MAAM,GAAU,OAAM,MAAM,EAAiB,kBAsHzD,CAAC"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,MAAM,GAAU,OAAM,MAAM,EAAiB,kBA+FzD,CAAC"}
package/dist/cli.js CHANGED
@@ -1,21 +1,19 @@
1
1
  import { cwdResolver } from "@gaubee/node";
2
- import { match, P } from "ts-pattern";
3
2
  import yargs from "yargs";
4
3
  import { hideBin } from "yargs/helpers";
5
4
  import packageJson from "../package.json" with { type: "json" };
5
+ import { restartDaemon, startDaemon, statusDaemon, stopDaemon } from "./commands/daemon.js";
6
6
  import { doctor } from "./commands/doctor/index.js";
7
7
  import { init } from "./commands/init.js";
8
- import { listPrompts } from "./commands/prompts/list.js";
9
- import { upgradePrompts } from "./commands/prompts/upgrade.js";
10
8
  import { run } from "./commands/tasks/run.js";
11
9
  export const runCli = async (args = process.argv) => {
12
10
  const cli = await yargs(hideBin(args))
13
11
  .scriptName("jixo")
14
12
  .version(packageJson.version)
15
- .command("doctor", "Check the requirements for run jixo", (yargs) => yargs, () => {
13
+ .command("doctor", "Check the requirements and health of the JIXO environment", (yargs) => yargs, () => {
16
14
  doctor();
17
15
  })
18
- .command("init [dir]", "Create a new JIXO project", (yargs) => {
16
+ .command("init [dir]", "Create a new JIXO project configuration", (yargs) => {
19
17
  return yargs.positional("dir", {
20
18
  describe: "The directory to create the JIXO config",
21
19
  default: "./",
@@ -23,82 +21,58 @@ export const runCli = async (args = process.argv) => {
23
21
  }, (argv) => {
24
22
  init(cwdResolver(argv.dir));
25
23
  })
26
- .command("run [filter...]", "Run JIXO tasks", (yargs) => {
24
+ .command("run <goal>", "Run a JIXO job with a specific goal", (yargs) => {
27
25
  return yargs
28
- .positional("filter", {
29
- describe: 'Fliter tasks by name or directory(starts with "./")',
30
- array: true,
31
- default: [],
26
+ .positional("goal", {
27
+ describe: "The high-level goal for the job",
28
+ type: "string",
29
+ demandOption: true,
32
30
  })
33
31
  .option("dir", {
34
32
  alias: "D",
35
33
  type: "string",
36
- description: "The project directory with JIXO config",
37
- })
38
- .option("force", {
39
- alias: "F",
40
- type: "boolean",
41
- description: "Tasks are forced to run, even at 100% progress. It is suitable for running after modifying the content of the task",
42
- })
43
- .option("once", {
44
- alias: "O",
45
- type: "boolean",
46
- description: "The task is executed only once in the loop, equal to --step=1",
34
+ description: "The project directory to run in",
35
+ default: process.cwd(),
47
36
  })
48
- .option("step", {
49
- alias: "S",
37
+ .option("loop", {
38
+ alias: "L",
50
39
  type: "number",
51
- description: "The task is executed N times in the loop",
40
+ description: "The max loop times for the job",
41
+ default: 20,
52
42
  });
53
43
  }, (argv) => {
54
- const filters = argv.filter.map((v) => v.toString().split(/[\s,]+/)).flat();
55
- const nameFilter = [];
56
- const dirFilter = [];
57
- for (const f of filters) {
58
- if (f.startsWith("./") || f.startsWith("../") || f.startsWith("~/")) {
59
- dirFilter.push(f);
60
- }
61
- else {
62
- nameFilter.push(f);
63
- }
64
- }
65
- run(cwdResolver(argv.dir ?? ""), {
66
- nameFilter,
67
- dirFilter,
68
- force: argv.force,
69
- loopTimes: match(argv)
70
- .with({ step: P.number.gt(0).select() }, (step) => step)
71
- .with({ once: P.boolean.select() }, (once) => (once ? 1 : Infinity))
72
- .otherwise(() => Infinity),
44
+ run({
45
+ jobGoal: argv.goal,
46
+ workDir: cwdResolver(argv.dir),
47
+ maxLoops: argv.loop,
73
48
  });
74
49
  })
75
- .command("prompts", "Manage prompts", (yargs) => {
76
- return (yargs
77
- //
78
- .option("dir", {
79
- alias: "D",
50
+ .command("daemon <action>", "Manage the JIXO Core daemon", (yargs) => {
51
+ return yargs.positional("action", {
52
+ describe: "The action to perform on the daemon",
80
53
  type: "string",
81
- description: "The project directory with JIXO config",
82
- })
83
- .option("mirrorUrl", {
84
- alias: "M",
85
- type: "string",
86
- description: "The Url for download prompts",
87
- })
88
- .option("upgrade", {
89
- alias: "U",
90
- type: "boolean",
91
- description: "Upgrade builtin prompts",
92
- }));
93
- }, async (argv) => {
94
- if (argv.upgrade) {
95
- upgradePrompts(argv.dir ? cwdResolver(argv.dir) : cwdResolver(), { mirrorUrl: argv.mirrorUrl });
96
- }
97
- else {
98
- listPrompts();
54
+ choices: ["start", "stop", "status", "restart"],
55
+ demandOption: true,
56
+ });
57
+ }, (argv) => {
58
+ switch (argv.action) {
59
+ case "start":
60
+ startDaemon();
61
+ break;
62
+ case "stop":
63
+ stopDaemon();
64
+ break;
65
+ case "status":
66
+ statusDaemon();
67
+ break;
68
+ case "restart":
69
+ restartDaemon();
70
+ break;
99
71
  }
100
72
  })
101
- .strict();
73
+ .demandCommand(1, "You need at least one command before moving on")
74
+ .strict()
75
+ .help();
102
76
  const argv = await cli.parse();
103
77
  if (argv._.length === 0) {
104
78
  cli.showHelp();
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EAAC,KAAK,EAAE,CAAC,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAC9D,OAAO,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAC,GAAG,EAAC,MAAM,yBAAyB,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,OAAiB,OAAO,CAAC,IAAI,EAAE,EAAE;IAC5D,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SACnC,UAAU,CAAC,MAAM,CA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AAK;YACH,EAAE;aACD,MAAM,CAAC,KAAK,EAAE;YACb,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wCAAwC;SACtD,CAAC;aACD,MAAM,CAAC,WAAW,EAAE;YACnB,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,8BAA8B;SAC5C,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,yBAAyB;SACvC,CAAC,CACL,CAAC;IACJ,CAAC,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,EAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAC,CAAC,CAAC;QAChG,CAAC;aAAM,CAAC;YACN,WAAW,EAAE,CAAC;QAChB,CAAC;IACH,CAAC,CACF;SACA,MAAM,EAAE,CAAC;IACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;IAE/B,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,GAAG,CAAC,QAAQ,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,MAAM,MAAM,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC","sourcesContent":["import {cwdResolver} from \"@gaubee/node\";\nimport {match, P} from \"ts-pattern\";\nimport yargs from \"yargs\";\nimport {hideBin} from \"yargs/helpers\";\nimport packageJson from \"../package.json\" with {type: \"json\"};\nimport {doctor} from \"./commands/doctor/index.js\";\nimport {init} from \"./commands/init.js\";\nimport {listPrompts} from \"./commands/prompts/list.js\";\nimport {upgradePrompts} from \"./commands/prompts/upgrade.js\";\nimport {run} from \"./commands/tasks/run.js\";\n\nexport const runCli = async (args: string[] = process.argv) => {\n const cli = await yargs(hideBin(args))\n .scriptName(\"jixo\")\n .version(packageJson.version)\n .command(\n \"doctor\",\n \"Check the requirements for run jixo\",\n (yargs) => yargs,\n () => {\n doctor();\n },\n )\n .command(\n \"init [dir]\",\n \"Create a new JIXO project\",\n (yargs) => {\n return yargs.positional(\"dir\", {\n describe: \"The directory to create the JIXO config\",\n default: \"./\",\n });\n },\n (argv) => {\n init(cwdResolver(argv.dir));\n },\n )\n .command(\n \"run [filter...]\",\n \"Run JIXO tasks\",\n (yargs) => {\n return yargs\n .positional(\"filter\", {\n describe: 'Fliter tasks by name or directory(starts with \"./\")',\n array: true,\n default: [],\n })\n .option(\"dir\", {\n alias: \"D\",\n type: \"string\",\n description: \"The project directory with JIXO config\",\n })\n .option(\"force\", {\n alias: \"F\",\n type: \"boolean\",\n description: \"Tasks are forced to run, even at 100% progress. It is suitable for running after modifying the content of the task\",\n })\n .option(\"once\", {\n alias: \"O\",\n type: \"boolean\",\n description: \"The task is executed only once in the loop, equal to --step=1\",\n })\n .option(\"step\", {\n alias: \"S\",\n type: \"number\",\n description: \"The task is executed N times in the loop\",\n });\n },\n (argv) => {\n const filters = argv.filter.map((v) => v.toString().split(/[\\s,]+/)).flat();\n const nameFilter: string[] = [];\n const dirFilter: string[] = [];\n for (const f of filters) {\n if (f.startsWith(\"./\") || f.startsWith(\"../\") || f.startsWith(\"~/\")) {\n dirFilter.push(f);\n } else {\n nameFilter.push(f);\n }\n }\n run(cwdResolver(argv.dir ?? \"\"), {\n nameFilter,\n dirFilter,\n force: argv.force,\n loopTimes: match(argv)\n .with({step: P.number.gt(0).select()}, (step) => step)\n .with({once: P.boolean.select()}, (once) => (once ? 1 : Infinity))\n .otherwise(() => Infinity),\n });\n },\n )\n .command(\n \"prompts\",\n \"Manage prompts\",\n (yargs) => {\n return (\n yargs\n //\n .option(\"dir\", {\n alias: \"D\",\n type: \"string\",\n description: \"The project directory with JIXO config\",\n })\n .option(\"mirrorUrl\", {\n alias: \"M\",\n type: \"string\",\n description: \"The Url for download prompts\",\n })\n .option(\"upgrade\", {\n alias: \"U\",\n type: \"boolean\",\n description: \"Upgrade builtin prompts\",\n })\n );\n },\n async (argv) => {\n if (argv.upgrade) {\n upgradePrompts(argv.dir ? cwdResolver(argv.dir) : cwdResolver(), {mirrorUrl: argv.mirrorUrl});\n } else {\n listPrompts();\n }\n },\n )\n .strict();\n const argv = await cli.parse();\n\n if (argv._.length === 0) {\n cli.showHelp();\n console.log(\" \" + \"─\".repeat(Math.max(4, process.stdout.columns - 2)));\n await doctor();\n }\n};\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAC9D,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,GAAG,EAAC,MAAM,yBAAyB,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,OAAiB,OAAO,CAAC,IAAI,EAAE,EAAE;IAC5D,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CA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C,CACF;SACA,OAAO,CACN,iBAAiB,EACjB,6BAA6B,EAC7B,CAAC,KAAK,EAAE,EAAE;QACR,OAAO,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE;YAChC,QAAQ,EAAE,qCAAqC;YAC/C,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC;YAC/C,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;IACL,CAAC,EACD,CAAC,IAAI,EAAE,EAAE;QACP,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;YACpB,KAAK,OAAO;gBACV,WAAW,EAAE,CAAC;gBACd,MAAM;YACR,KAAK,MAAM;gBACT,UAAU,EAAE,CAAC;gBACb,MAAM;YACR,KAAK,QAAQ;gBACX,YAAY,EAAE,CAAC;gBACf,MAAM;YACR,KAAK,SAAS;gBACZ,aAAa,EAAE,CAAC;gBAChB,MAAM;QACV,CAAC;IACH,CAAC,CACF;SACA,aAAa,CAAC,CAAC,EAAE,gDAAgD,CAAC;SAClE,MAAM,EAAE;SACR,IAAI,EAAE,CAAC;IAEV,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;IAE/B,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,GAAG,CAAC,QAAQ,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,MAAM,MAAM,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC","sourcesContent":["import {cwdResolver} from \"@gaubee/node\";\nimport yargs from \"yargs\";\nimport {hideBin} from \"yargs/helpers\";\nimport packageJson from \"../package.json\" with {type: \"json\"};\nimport {restartDaemon, startDaemon, statusDaemon, stopDaemon} from \"./commands/daemon.js\";\nimport {doctor} from \"./commands/doctor/index.js\";\nimport {init} from \"./commands/init.js\";\nimport {run} from \"./commands/tasks/run.js\";\n\nexport const runCli = async (args: string[] = process.argv) => {\n const cli = await yargs(hideBin(args))\n .scriptName(\"jixo\")\n .version(packageJson.version)\n .command(\n \"doctor\",\n \"Check the requirements and health of the JIXO environment\",\n (yargs) => yargs,\n () => {\n doctor();\n },\n )\n .command(\n \"init [dir]\",\n \"Create a new JIXO project configuration\",\n (yargs) => {\n return yargs.positional(\"dir\", {\n describe: \"The directory to create the JIXO config\",\n default: \"./\",\n });\n },\n (argv) => {\n init(cwdResolver(argv.dir));\n },\n )\n .command(\n \"run <goal>\",\n \"Run a JIXO job with a specific goal\",\n (yargs) => {\n return yargs\n .positional(\"goal\", {\n describe: \"The high-level goal for the job\",\n type: \"string\",\n demandOption: true,\n })\n .option(\"dir\", {\n alias: \"D\",\n type: \"string\",\n description: \"The project directory to run in\",\n default: process.cwd(),\n })\n .option(\"loop\", {\n alias: \"L\",\n type: \"number\",\n description: \"The max loop times for the job\",\n default: 20,\n });\n },\n (argv) => {\n run({\n jobGoal: argv.goal,\n workDir: cwdResolver(argv.dir),\n maxLoops: argv.loop,\n });\n },\n )\n .command(\n \"daemon <action>\",\n \"Manage the JIXO Core daemon\",\n (yargs) => {\n return yargs.positional(\"action\", {\n describe: \"The action to perform on the daemon\",\n type: \"string\",\n choices: [\"start\", \"stop\", \"status\", \"restart\"],\n demandOption: true,\n });\n },\n (argv) => {\n switch (argv.action) {\n case \"start\":\n startDaemon();\n break;\n case \"stop\":\n stopDaemon();\n break;\n case \"status\":\n statusDaemon();\n break;\n case \"restart\":\n restartDaemon();\n break;\n }\n },\n )\n .demandCommand(1, \"You need at least one command before moving on\")\n .strict()\n .help();\n\n const argv = await cli.parse();\n\n if (argv._.length === 0) {\n cli.showHelp();\n console.log(\" \" + \"─\".repeat(Math.max(4, process.stdout.columns - 2)));\n await doctor();\n }\n};\n"]}
@@ -0,0 +1,5 @@
1
+ export declare const startDaemon: () => void;
2
+ export declare const stopDaemon: () => void;
3
+ export declare const statusDaemon: () => void;
4
+ export declare const restartDaemon: () => void;
5
+ //# sourceMappingURL=daemon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../src/commands/daemon.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,YAGvB,CAAC;AAEF,eAAO,MAAM,UAAU,YAEtB,CAAC;AAEF,eAAO,MAAM,YAAY,YAGxB,CAAC;AAEF,eAAO,MAAM,aAAa,YAIzB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { green, red, yellow } from "@gaubee/nodekit";
2
+ // NOTE: This is a placeholder implementation. A robust solution would use
3
+ // libraries like 'pm2', 'forever', or manage PID files directly.
4
+ export const startDaemon = () => {
5
+ console.log(green("Starting JIXO Core service in the background... (stub)"));
6
+ console.log(yellow("In a real implementation, this would spawn the core service process."));
7
+ };
8
+ export const stopDaemon = () => {
9
+ console.log(red("Stopping JIXO Core service... (stub)"));
10
+ };
11
+ export const statusDaemon = () => {
12
+ console.log(yellow("Checking JIXO Core service status... (stub)"));
13
+ console.log("Service is not running (default stub response).");
14
+ };
15
+ export const restartDaemon = () => {
16
+ console.log(yellow("Restarting JIXO Core service... (stub)"));
17
+ stopDaemon();
18
+ startDaemon();
19
+ };
20
+ //# sourceMappingURL=daemon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon.js","sourceRoot":"","sources":["../../src/commands/daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAEnD,0EAA0E;AAC1E,iEAAiE;AAEjE,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC,CAAC;IAC7E,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,sEAAsE,CAAC,CAAC,CAAC;AAC9F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC,CAAC;AAC3D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,6CAA6C,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,wCAAwC,CAAC,CAAC,CAAC;IAC9D,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import {green, red, yellow} from \"@gaubee/nodekit\";\n\n// NOTE: This is a placeholder implementation. A robust solution would use\n// libraries like 'pm2', 'forever', or manage PID files directly.\n\nexport const startDaemon = () => {\n console.log(green(\"Starting JIXO Core service in the background... (stub)\"));\n console.log(yellow(\"In a real implementation, this would spawn the core service process.\"));\n};\n\nexport const stopDaemon = () => {\n console.log(red(\"Stopping JIXO Core service... (stub)\"));\n};\n\nexport const statusDaemon = () => {\n console.log(yellow(\"Checking JIXO Core service status... (stub)\"));\n console.log(\"Service is not running (default stub response).\");\n};\n\nexport const restartDaemon = () => {\n console.log(yellow(\"Restarting JIXO Core service... (stub)\"));\n stopDaemon();\n startDaemon();\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAC7C,eAAO,MAAM,cAAc,EAAE,YA2B5B,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,cAAc,EAAE,YAc5B,CAAC"}
@@ -1,5 +1,10 @@
1
1
  import { blue, green } from "@gaubee/nodekit";
2
2
  export const myDoctorConfig = [
3
+ {
4
+ id: "jixo-core-service",
5
+ displayName: "JIXO Core Service",
6
+ installationHint: `Ensure the JIXO Core service is running. You can start it with 'jixo daemon start'.`,
7
+ },
3
8
  {
4
9
  id: "pnpm",
5
10
  displayName: "PNPM Package Manager",
@@ -8,23 +13,5 @@ export const myDoctorConfig = [
8
13
  minVersion: "10.9.0",
9
14
  installationHint: `Install pnpm via npm: ${green("npm install -g pnpm")}. Or visit ${blue("https://pnpm.io/installation")}`,
10
15
  },
11
- {
12
- id: "uv",
13
- displayName: "UVX CLI",
14
- versionCommand: "uvx --version",
15
- // Let's assume uvx outputs something like "uvx version 0.7.8"
16
- versionParseRegex: /uvx\s+(\d+\.\d+\.\d+)/,
17
- minVersion: "0.7.0",
18
- installationHint: `Install uv via pip: ${green("pip install uv")}. Or visit ${blue("https://docs.astral.sh/uv/getting-started/installation")}`,
19
- },
20
- {
21
- id: "node",
22
- displayName: "Node.js Runtime",
23
- versionCommand: "node --version",
24
- versionParseRegex: /v([\d.]+)/, // node --version outputs "v18.17.0"
25
- minVersion: "18.0.0",
26
- installationHint: "Install Node.js from https://nodejs.org/",
27
- optional: true, // Example of an optional check
28
- },
29
16
  ];
30
17
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/commands/doctor/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C;QACE,EAAE,EAAE,MAAM;QACV,WAAW,EAAE,sBAAsB;QACnC,cAAc,EAAE,gBAAgB;QAChC,iBAAiB,EAAE,iBAAiB,EAAE,iEAAiE;QACvG,UAAU,EAAE,QAAQ;QACpB,gBAAgB,EAAE,yBAAyB,KAAK,CAAC,qBAAqB,CAAC,cAAc,IAAI,CAAC,8BAA8B,CAAC,EAAE;KAC5H;IACD;QACE,EAAE,EAAE,IAAI;QACR,WAAW,EAAE,SAAS;QACtB,cAAc,EAAE,eAAe;QAC/B,8DAA8D;QAC9D,iBAAiB,EAAE,uBAAuB;QAC1C,UAAU,EAAE,OAAO;QACnB,gBAAgB,EAAE,uBAAuB,KAAK,CAAC,gBAAgB,CAAC,cAAc,IAAI,CAAC,wDAAwD,CAAC,EAAE;KAC/I;IACD;QACE,EAAE,EAAE,MAAM;QACV,WAAW,EAAE,iBAAiB;QAC9B,cAAc,EAAE,gBAAgB;QAChC,iBAAiB,EAAE,WAAW,EAAE,oCAAoC;QACpE,UAAU,EAAE,QAAQ;QACpB,gBAAgB,EAAE,0CAA0C;QAC5D,QAAQ,EAAE,IAAI,EAAE,+BAA+B;KAChD;CACF,CAAC","sourcesContent":["import {blue, green} from \"@gaubee/nodekit\";\nimport type {DoctorConfig} from \"./types.js\";\nexport const myDoctorConfig: DoctorConfig = [\n {\n id: \"pnpm\",\n displayName: \"PNPM Package Manager\",\n versionCommand: \"pnpm --version\",\n versionParseRegex: /(\\d+\\.\\d+\\.\\d+)/, // Assumes pnpm --version outputs just the version or \"X.Y.Z ...\"\n minVersion: \"10.9.0\", \n installationHint: `Install pnpm via npm: ${green(\"npm install -g pnpm\")}. Or visit ${blue(\"https://pnpm.io/installation\")}`,\n },\n {\n id: \"uv\",\n displayName: \"UVX CLI\",\n versionCommand: \"uvx --version\",\n // Let's assume uvx outputs something like \"uvx version 0.7.8\"\n versionParseRegex: /uvx\\s+(\\d+\\.\\d+\\.\\d+)/,\n minVersion: \"0.7.0\",\n installationHint: `Install uv via pip: ${green(\"pip install uv\")}. Or visit ${blue(\"https://docs.astral.sh/uv/getting-started/installation\")}`,\n },\n {\n id: \"node\",\n displayName: \"Node.js Runtime\",\n versionCommand: \"node --version\",\n versionParseRegex: /v([\\d.]+)/, // node --version outputs \"v18.17.0\"\n minVersion: \"18.0.0\",\n installationHint: \"Install Node.js from https://nodejs.org/\",\n optional: true, // Example of an optional check\n },\n];\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/commands/doctor/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAG5C,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C;QACE,EAAE,EAAE,mBAAmB;QACvB,WAAW,EAAE,mBAAmB;QAChC,gBAAgB,EAAE,qFAAqF;KACxG;IACD;QACE,EAAE,EAAE,MAAM;QACV,WAAW,EAAE,sBAAsB;QACnC,cAAc,EAAE,gBAAgB;QAChC,iBAAiB,EAAE,iBAAiB,EAAE,iEAAiE;QACvG,UAAU,EAAE,QAAQ;QACpB,gBAAgB,EAAE,yBAAyB,KAAK,CAAC,qBAAqB,CAAC,cAAc,IAAI,CAAC,8BAA8B,CAAC,EAAE;KAC5H;CACF,CAAC","sourcesContent":["import {blue, green} from \"@gaubee/nodekit\";\nimport type {DoctorConfig} from \"./types.js\";\n\nexport const myDoctorConfig: DoctorConfig = [\n {\n id: \"jixo-core-service\",\n displayName: \"JIXO Core Service\",\n installationHint: `Ensure the JIXO Core service is running. You can start it with 'jixo daemon start'.`,\n },\n {\n id: \"pnpm\",\n displayName: \"PNPM Package Manager\",\n versionCommand: \"pnpm --version\",\n versionParseRegex: /(\\d+\\.\\d+\\.\\d+)/, // Assumes pnpm --version outputs just the version or \"X.Y.Z ...\"\n minVersion: \"10.9.0\",\n installationHint: `Install pnpm via npm: ${green(\"npm install -g pnpm\")}. Or visit ${blue(\"https://pnpm.io/installation\")}`,\n },\n];\n"]}
@@ -1,18 +1,3 @@
1
- import type { DoctorConfig } from "./types.js";
2
- export interface ToolCheckResult {
3
- id: string;
4
- displayName: string;
5
- exists: boolean;
6
- version?: string;
7
- requiredVersion?: string;
8
- meetsVersionRequirement: boolean;
9
- isOptional: boolean;
10
- message: string;
11
- installationHint?: string;
12
- }
13
- export interface DoctorReport {
14
- overallSuccess: boolean;
15
- results: ToolCheckResult[];
16
- }
1
+ import type { DoctorConfig, DoctorReport } from "./types.js";
17
2
  export declare function runDoctor(config: DoctorConfig, enableLog?: boolean): Promise<DoctorReport>;
18
3
  //# sourceMappingURL=doctor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor/doctor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAM7C,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,OAAO,CAAC;IACjC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAaD,wBAAsB,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,GAAE,OAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CA8GtG"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor/doctor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAkB,MAAM,YAAY,CAAC;AA4C5E,wBAAsB,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,GAAE,OAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAkHtG"}
@@ -1,8 +1,8 @@
1
- // doctor.ts
2
1
  import { blue, cyan, green, red, spinner, yellow } from "@gaubee/nodekit";
2
+ import { iter_map_not_null } from "@gaubee/util";
3
3
  import { execSync } from "node:child_process";
4
4
  import semver from "semver";
5
- import { iter_map_not_null } from "@gaubee/util";
5
+ import { safeEnv } from "../../env.js";
6
6
  const CHECK_MARK = green("✔");
7
7
  const CROSS_MARK = red("✖");
8
8
  const WARN_MARK = yellow("⚠");
@@ -17,6 +17,33 @@ async function executeCommand(command) {
17
17
  }
18
18
  });
19
19
  }
20
+ async function checkServiceHealth(id, displayName, hint) {
21
+ const result = {
22
+ id,
23
+ displayName,
24
+ exists: false,
25
+ meetsVersionRequirement: false,
26
+ isOptional: false,
27
+ message: "",
28
+ installationHint: hint,
29
+ };
30
+ const url = `${safeEnv.JIXO_CORE_URL}/jixo/v1/health`;
31
+ try {
32
+ const response = await fetch(url, { signal: AbortSignal.timeout(3000) });
33
+ if (response.ok) {
34
+ result.exists = true;
35
+ result.meetsVersionRequirement = true;
36
+ result.message = `Service is running and healthy at ${url}`;
37
+ }
38
+ else {
39
+ result.message = `Service responded with status ${response.status} at ${url}`;
40
+ }
41
+ }
42
+ catch (e) {
43
+ result.message = `Could not connect to service at ${url}. Is it running?`;
44
+ }
45
+ return result;
46
+ }
20
47
  export async function runDoctor(config, enableLog = true) {
21
48
  const LOG_TITLE = "Running Environment Doctor 🏥\n\n";
22
49
  const logger = spinner(LOG_TITLE);
@@ -41,71 +68,77 @@ export async function runDoctor(config, enableLog = true) {
41
68
  };
42
69
  setToolLog(() => `Checking ${TOOL_LOG_TITLE}... `);
43
70
  let tool_log = [];
44
- const result = {
45
- id: tool.id,
46
- displayName: tool.displayName,
47
- exists: false,
48
- meetsVersionRequirement: false, // Assume failure until proven otherwise
49
- isOptional: !!tool.optional,
50
- message: "",
51
- requiredVersion: tool.minVersion,
52
- installationHint: tool.installationHint,
53
- };
54
- const execResult = await executeCommand(tool.versionCommand);
55
- if (execResult.error || execResult.stderr.includes("command not found") || execResult.stderr.includes("not recognized")) {
56
- result.exists = false;
57
- result.message = `'${tool.id}' command not found or failed to execute.`;
58
- tool_log = [
59
- //
60
- `${FAIL_MARK()} ${TOOL_LOG_TITLE}`,
61
- ` ${red(result.message)}`,
62
- tool.installationHint && ` ${yellow("Hint:")} ${tool.installationHint}`,
63
- ];
71
+ let result;
72
+ if (!tool.versionCommand) {
73
+ // Custom check logic for services
74
+ result = await checkServiceHealth(tool.id, tool.displayName, tool.installationHint);
75
+ if (result.exists) {
76
+ tool_log = [`${SUCCESS_MARK()} ${TOOL_LOG_TITLE}`, ` ${green(result.message)}`];
77
+ }
78
+ else {
79
+ tool_log = [`${FAIL_MARK()} ${TOOL_LOG_TITLE}`, ` ${red(result.message)}`, tool.installationHint && ` ${yellow("Hint:")} ${tool.installationHint}`];
80
+ }
64
81
  }
65
82
  else {
66
- result.exists = true;
67
- const output = execResult.stdout.trim();
68
- const match = output.match(tool.versionParseRegex);
69
- if (match && match[1]) {
70
- result.version = semver.clean(match[1]) || undefined; // Clean the version string
71
- if (result.version) {
72
- if (tool.minVersion) {
73
- if (semver.gte(result.version, tool.minVersion)) {
74
- result.meetsVersionRequirement = true;
75
- result.message = `Version ${result.version} satisfies >=${tool.minVersion}.`;
76
- tool_log.push(`${SUCCESS_MARK()} ${TOOL_LOG_TITLE} (v${result.version})`);
83
+ // Original command-based check logic
84
+ result = {
85
+ id: tool.id,
86
+ displayName: tool.displayName,
87
+ exists: false,
88
+ meetsVersionRequirement: false,
89
+ isOptional: !!tool.optional,
90
+ message: "",
91
+ requiredVersion: tool.minVersion,
92
+ installationHint: tool.installationHint,
93
+ };
94
+ const execResult = await executeCommand(tool.versionCommand);
95
+ if (execResult.error || execResult.stderr.includes("command not found") || execResult.stderr.includes("not recognized")) {
96
+ result.exists = false;
97
+ result.message = `'${tool.id}' command not found or failed to execute.`;
98
+ tool_log = [`${FAIL_MARK()} ${TOOL_LOG_TITLE}`, ` ${red(result.message)}`, tool.installationHint && ` ${yellow("Hint:")} ${tool.installationHint}`];
99
+ }
100
+ else {
101
+ result.exists = true;
102
+ const output = execResult.stdout.trim();
103
+ const match = output.match(tool.versionParseRegex);
104
+ if (match && match[1]) {
105
+ result.version = semver.clean(match[1]) || undefined;
106
+ if (result.version) {
107
+ if (tool.minVersion) {
108
+ if (semver.gte(result.version, tool.minVersion)) {
109
+ result.meetsVersionRequirement = true;
110
+ result.message = `Version ${result.version} satisfies >=${tool.minVersion}.`;
111
+ tool_log.push(`${SUCCESS_MARK()} ${TOOL_LOG_TITLE} (v${result.version})`);
112
+ }
113
+ else {
114
+ result.meetsVersionRequirement = false;
115
+ result.message = `Version ${result.version} is older than required >=${tool.minVersion}.`;
116
+ tool_log.push(`${FAIL_MARK()} ${TOOL_LOG_TITLE} (v${result.version} - required: >=${tool.minVersion})`);
117
+ if (tool.installationHint) {
118
+ tool_log.push(` ${yellow("Hint:")} ${tool.installationHint}`);
119
+ }
120
+ }
77
121
  }
78
122
  else {
79
- result.meetsVersionRequirement = false;
80
- result.message = `Version ${result.version} is older than required >=${tool.minVersion}.`;
81
- tool_log.push(`${FAIL_MARK()} ${TOOL_LOG_TITLE} (v${result.version} - required: >=${tool.minVersion})`);
82
- tool_log.push(` ${red(result.message)}`);
83
- if (tool.installationHint) {
84
- tool_log.push(` ${yellow("Hint:")} ${tool.installationHint}`);
85
- }
123
+ result.meetsVersionRequirement = true;
124
+ result.message = `Found version ${result.version}. No minimum version specified.`;
125
+ tool_log.push(`${SUCCESS_MARK()} ${TOOL_LOG_TITLE} (v${result.version} - existence check only)`);
86
126
  }
87
127
  }
88
128
  else {
89
- // No minimum version specified, just existence is enough
90
- result.meetsVersionRequirement = true;
91
- result.message = `Found version ${result.version}. No minimum version specified.`;
92
- tool_log.push(`${SUCCESS_MARK()} ${TOOL_LOG_TITLE} (v${result.version} - existence check only)`);
129
+ result.meetsVersionRequirement = false;
130
+ result.message = `Could not parse a valid version string from output: "${output}".`;
131
+ tool_log.push(`${FAIL_MARK()} ${TOOL_LOG_TITLE}`);
132
+ tool_log.push(` ${red(result.message)}`);
93
133
  }
94
134
  }
95
135
  else {
96
- // Regex matched but couldn't clean version (should be rare with semver.clean)
97
136
  result.meetsVersionRequirement = false;
98
- result.message = `Could not parse a valid version string from output: "${output}". Regex: ${tool.versionParseRegex}`;
137
+ result.message = `Could not parse version from output: "${output}".`;
99
138
  tool_log.push(`${FAIL_MARK()} ${TOOL_LOG_TITLE}`);
100
139
  tool_log.push(` ${red(result.message)}`);
101
140
  }
102
141
  }
103
- else {
104
- result.meetsVersionRequirement = false;
105
- result.message = `Could not parse version from output: "${output}". Regex: ${tool.versionParseRegex}`;
106
- tool_log.push(`${FAIL_MARK}`);
107
- tool_log.push(` ${red(result.message)}`);
108
- }
109
142
  }
110
143
  setToolLog(() => tool_log);
111
144
  results.push(result);
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/commands/doctor/doctor.ts"],"names":[],"mappings":"AAAA,YAAY;AACZ,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAC5C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAG/C,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAC9B,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;AAC5B,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAmB9B,KAAK,UAAU,cAAc,CAAC,OAAe;IAC3C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAC,QAAQ,EAA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CAAyC,MAAM,aAAa,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACtG,QAAQ,CAAC,IAAI,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC;gBAC9B,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QAED,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;QAE3B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,CAAC,uBAAuB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YAC1D,cAAc,GAAG,KAAK,CAAC;QACzB,CAAC;IACH,CAAC;IAED,MAAM,WAAW,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,iCAAiC,CAAC;IAC5G,MAAM,CAAC,cAAc,CAAC;QACpB,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI;KAChD,CAAC,CAAC;IAEH,OAAO;QACL,cAAc;QACd,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["// doctor.ts\nimport {blue, cyan, green, red, spinner, yellow} from \"@gaubee/nodekit\";\nimport {execSync} from \"node:child_process\";\nimport semver from \"semver\";\n\nimport {iter_map_not_null} from \"@gaubee/util\";\nimport type {DoctorConfig} from \"./types.js\"; // Assuming types.ts\n\nconst CHECK_MARK = green(\"✔\");\nconst CROSS_MARK = red(\"✖\");\nconst WARN_MARK = yellow(\"⚠\");\n\nexport interface ToolCheckResult {\n id: string;\n displayName: string;\n exists: boolean;\n version?: string; // Actual version found\n requiredVersion?: string; // From config\n meetsVersionRequirement: boolean; // True if version >= minVersion or if minVersion not set & exists\n isOptional: boolean;\n message: string;\n installationHint?: string;\n}\n\nexport interface DoctorReport {\n overallSuccess: boolean;\n results: ToolCheckResult[];\n}\n\nasync function executeCommand(command: string): Promise<{stdout: string; stderr: string; error?: Error}> {\n return new Promise((resolve) => {\n try {\n const stdout = execSync(command, {encoding: \"utf8\", stdio: \"pipe\"});\n resolve({stdout, stderr: \"\"});\n } catch (e: any) {\n resolve({stdout: \"\", stderr: e.stderr || \"\", error: e});\n }\n });\n}\n\nexport async function runDoctor(config: DoctorConfig, enableLog: boolean = true): Promise<DoctorReport> {\n const LOG_TITLE = \"Running Environment Doctor 🏥\\n\\n\";\n const logger = spinner(LOG_TITLE);\n if (enableLog) {\n logger.start();\n }\n\n const results: ToolCheckResult[] = [];\n let overallSuccess = true;\n let overallWarn = false;\n\n const tool_logs: string[] = [];\n\n for (const [index, tool] of config.entries()) {\n const TOOL_LOG_TITLE = `${blue(`[${tool.id}]`)} ${cyan(tool.displayName)}`;\n const SUCCESS_MARK = () => CHECK_MARK;\n const FAIL_MARK = () => {\n overallWarn = true;\n return tool.optional ? WARN_MARK : CROSS_MARK;\n };\n const setToolLog = (update: (cur: string) => string | (string | undefined | null)[]) => {\n const log = update(tool_logs[index] ?? \"\");\n tool_logs[index] = (Array.isArray(log) ? iter_map_not_null(log, (v) => (v ? v : null)) : [log]).map((line) => \" \" + line).join(\"\\n\");\n logger.text = LOG_TITLE + tool_logs.join(\"\\n\");\n };\n setToolLog(() => `Checking ${TOOL_LOG_TITLE}... `);\n let tool_log: (string | undefined | null)[] = [];\n\n const result: ToolCheckResult = {\n id: tool.id,\n displayName: tool.displayName,\n exists: false,\n meetsVersionRequirement: false, // Assume failure until proven otherwise\n isOptional: !!tool.optional,\n message: \"\",\n requiredVersion: tool.minVersion,\n installationHint: tool.installationHint,\n };\n\n const execResult = await executeCommand(tool.versionCommand);\n\n if (execResult.error || execResult.stderr.includes(\"command not found\") || execResult.stderr.includes(\"not recognized\")) {\n result.exists = false;\n result.message = `'${tool.id}' command not found or failed to execute.`;\n tool_log = [\n //\n `${FAIL_MARK()} ${TOOL_LOG_TITLE}`,\n ` ${red(result.message)}`,\n tool.installationHint && ` ${yellow(\"Hint:\")} ${tool.installationHint}`,\n ];\n } else {\n result.exists = true;\n const output = execResult.stdout.trim();\n const match = output.match(tool.versionParseRegex);\n\n if (match && match[1]) {\n result.version = semver.clean(match[1]) || undefined; // Clean the version string\n if (result.version) {\n if (tool.minVersion) {\n if (semver.gte(result.version, tool.minVersion)) {\n result.meetsVersionRequirement = true;\n result.message = `Version ${result.version} satisfies >=${tool.minVersion}.`;\n tool_log.push(`${SUCCESS_MARK()} ${TOOL_LOG_TITLE} (v${result.version})`);\n } else {\n result.meetsVersionRequirement = false;\n result.message = `Version ${result.version} is older than required >=${tool.minVersion}.`;\n tool_log.push(`${FAIL_MARK()} ${TOOL_LOG_TITLE} (v${result.version} - required: >=${tool.minVersion})`);\n tool_log.push(` ${red(result.message)}`);\n if (tool.installationHint) {\n tool_log.push(` ${yellow(\"Hint:\")} ${tool.installationHint}`);\n }\n }\n } else {\n // No minimum version specified, just existence is enough\n result.meetsVersionRequirement = true;\n result.message = `Found version ${result.version}. No minimum version specified.`;\n tool_log.push(`${SUCCESS_MARK()} ${TOOL_LOG_TITLE} (v${result.version} - existence check only)`);\n }\n } else {\n // Regex matched but couldn't clean version (should be rare with semver.clean)\n result.meetsVersionRequirement = false;\n result.message = `Could not parse a valid version string from output: \"${output}\". Regex: ${tool.versionParseRegex}`;\n tool_log.push(`${FAIL_MARK()} ${TOOL_LOG_TITLE}`);\n tool_log.push(` ${red(result.message)}`);\n }\n } else {\n result.meetsVersionRequirement = false;\n result.message = `Could not parse version from output: \"${output}\". Regex: ${tool.versionParseRegex}`;\n tool_log.push(`${FAIL_MARK}`);\n tool_log.push(` ${red(result.message)}`);\n }\n }\n\n setToolLog(() => tool_log);\n\n results.push(result);\n if (!result.meetsVersionRequirement && !result.isOptional) {\n overallSuccess = false;\n }\n }\n\n const LOG_SUMMERY = `${overallSuccess ? (overallWarn ? \"⚠️ \" : \"✅\") : \"💊\"} JIXO Environment Doctor 🏥\\n\\n`;\n logger.stopAndPersist({\n text: LOG_SUMMERY + tool_logs.join(\"\\n\") + \"\\n\",\n });\n\n return {\n overallSuccess,\n results,\n };\n}\n"]}
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/commands/doctor/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAC5C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAGrC,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAC9B,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;AAC5B,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAE9B,KAAK,UAAU,cAAc,CAAC,OAAe;IAC3C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAC,CAAC,CAAC;YACpE,OAAO,CAAC,EAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAC,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,CAAC,EAAC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,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C;gBAC5C,CAAC;YACH,CAAC;QACH,CAAC;QAED,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;QAE3B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,CAAC,uBAAuB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YAC1D,cAAc,GAAG,KAAK,CAAC;QACzB,CAAC;IACH,CAAC;IAED,MAAM,WAAW,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,iCAAiC,CAAC;IAC5G,MAAM,CAAC,cAAc,CAAC;QACpB,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI;KAChD,CAAC,CAAC;IAEH,OAAO;QACL,cAAc;QACd,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["import {blue, cyan, green, red, spinner, yellow} from \"@gaubee/nodekit\";\nimport {iter_map_not_null} from \"@gaubee/util\";\nimport {execSync} from \"node:child_process\";\nimport semver from \"semver\";\nimport {safeEnv} from \"../../env.js\";\nimport type {DoctorConfig, DoctorReport, ToolCheckResult} from \"./types.js\";\n\nconst CHECK_MARK = green(\"✔\");\nconst CROSS_MARK = red(\"✖\");\nconst WARN_MARK = yellow(\"⚠\");\n\nasync function executeCommand(command: string): Promise<{stdout: string; stderr: string; error?: Error}> {\n return new Promise((resolve) => {\n try {\n const stdout = execSync(command, {encoding: \"utf8\", stdio: \"pipe\"});\n resolve({stdout, stderr: \"\"});\n } catch (e: any) {\n resolve({stdout: \"\", stderr: e.stderr || \"\", error: e});\n }\n });\n}\n\nasync function checkServiceHealth(id: string, displayName: string, hint?: string): Promise<ToolCheckResult> {\n const result: ToolCheckResult = {\n id,\n displayName,\n exists: false,\n meetsVersionRequirement: false,\n isOptional: false,\n message: \"\",\n installationHint: hint,\n };\n\n const url = `${safeEnv.JIXO_CORE_URL}/jixo/v1/health`;\n try {\n const response = await fetch(url, {signal: AbortSignal.timeout(3000)});\n if (response.ok) {\n result.exists = true;\n result.meetsVersionRequirement = true;\n result.message = `Service is running and healthy at ${url}`;\n } else {\n result.message = `Service responded with status ${response.status} at ${url}`;\n }\n } catch (e) {\n result.message = `Could not connect to service at ${url}. Is it running?`;\n }\n return result;\n}\n\nexport async function runDoctor(config: DoctorConfig, enableLog: boolean = true): Promise<DoctorReport> {\n const LOG_TITLE = \"Running Environment Doctor 🏥\\n\\n\";\n const logger = spinner(LOG_TITLE);\n if (enableLog) {\n logger.start();\n }\n\n const results: ToolCheckResult[] = [];\n let overallSuccess = true;\n let overallWarn = false;\n\n const tool_logs: string[] = [];\n\n for (const [index, tool] of config.entries()) {\n const TOOL_LOG_TITLE = `${blue(`[${tool.id}]`)} ${cyan(tool.displayName)}`;\n const SUCCESS_MARK = () => CHECK_MARK;\n const FAIL_MARK = () => {\n overallWarn = true;\n return tool.optional ? WARN_MARK : CROSS_MARK;\n };\n const setToolLog = (update: (cur: string) => string | (string | undefined | null)[]) => {\n const log = update(tool_logs[index] ?? \"\");\n tool_logs[index] = (Array.isArray(log) ? iter_map_not_null(log, (v) => (v ? v : null)) : [log]).map((line) => \" \" + line).join(\"\\n\");\n logger.text = LOG_TITLE + tool_logs.join(\"\\n\");\n };\n setToolLog(() => `Checking ${TOOL_LOG_TITLE}... `);\n let tool_log: (string | undefined | null)[] = [];\n\n let result: ToolCheckResult;\n\n if (!tool.versionCommand) {\n // Custom check logic for services\n result = await checkServiceHealth(tool.id, tool.displayName, tool.installationHint);\n if (result.exists) {\n tool_log = [`${SUCCESS_MARK()} ${TOOL_LOG_TITLE}`, ` ${green(result.message)}`];\n } else {\n tool_log = [`${FAIL_MARK()} ${TOOL_LOG_TITLE}`, ` ${red(result.message)}`, tool.installationHint && ` ${yellow(\"Hint:\")} ${tool.installationHint}`];\n }\n } else {\n // Original command-based check logic\n result = {\n id: tool.id,\n displayName: tool.displayName,\n exists: false,\n meetsVersionRequirement: false,\n isOptional: !!tool.optional,\n message: \"\",\n requiredVersion: tool.minVersion,\n installationHint: tool.installationHint,\n };\n const execResult = await executeCommand(tool.versionCommand);\n\n if (execResult.error || execResult.stderr.includes(\"command not found\") || execResult.stderr.includes(\"not recognized\")) {\n result.exists = false;\n result.message = `'${tool.id}' command not found or failed to execute.`;\n tool_log = [`${FAIL_MARK()} ${TOOL_LOG_TITLE}`, ` ${red(result.message)}`, tool.installationHint && ` ${yellow(\"Hint:\")} ${tool.installationHint}`];\n } else {\n result.exists = true;\n const output = execResult.stdout.trim();\n const match = output.match(tool.versionParseRegex!);\n\n if (match && match[1]) {\n result.version = semver.clean(match[1]) || undefined;\n if (result.version) {\n if (tool.minVersion) {\n if (semver.gte(result.version, tool.minVersion)) {\n result.meetsVersionRequirement = true;\n result.message = `Version ${result.version} satisfies >=${tool.minVersion}.`;\n tool_log.push(`${SUCCESS_MARK()} ${TOOL_LOG_TITLE} (v${result.version})`);\n } else {\n result.meetsVersionRequirement = false;\n result.message = `Version ${result.version} is older than required >=${tool.minVersion}.`;\n tool_log.push(`${FAIL_MARK()} ${TOOL_LOG_TITLE} (v${result.version} - required: >=${tool.minVersion})`);\n if (tool.installationHint) {\n tool_log.push(` ${yellow(\"Hint:\")} ${tool.installationHint}`);\n }\n }\n } else {\n result.meetsVersionRequirement = true;\n result.message = `Found version ${result.version}. No minimum version specified.`;\n tool_log.push(`${SUCCESS_MARK()} ${TOOL_LOG_TITLE} (v${result.version} - existence check only)`);\n }\n } else {\n result.meetsVersionRequirement = false;\n result.message = `Could not parse a valid version string from output: \"${output}\".`;\n tool_log.push(`${FAIL_MARK()} ${TOOL_LOG_TITLE}`);\n tool_log.push(` ${red(result.message)}`);\n }\n } else {\n result.meetsVersionRequirement = false;\n result.message = `Could not parse version from output: \"${output}\".`;\n tool_log.push(`${FAIL_MARK()} ${TOOL_LOG_TITLE}`);\n tool_log.push(` ${red(result.message)}`);\n }\n }\n }\n\n setToolLog(() => tool_log);\n\n results.push(result);\n if (!result.meetsVersionRequirement && !result.isOptional) {\n overallSuccess = false;\n }\n }\n\n const LOG_SUMMERY = `${overallSuccess ? (overallWarn ? \"⚠️ \" : \"✅\") : \"💊\"} JIXO Environment Doctor 🏥\\n\\n`;\n logger.stopAndPersist({\n text: LOG_SUMMERY + tool_logs.join(\"\\n\") + \"\\n\",\n });\n\n return {\n overallSuccess,\n results,\n };\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const doctor: import("@gaubee/util").FuncRemember<(enableLog?: boolean) => Promise<import("./doctor.js").DoctorReport>, void | ((this: unknown, enableLog?: boolean | undefined) => any)>;
1
+ export declare const doctor: import("@gaubee/util").FuncRemember<(enableLog?: boolean) => Promise<import("./types.js").DoctorReport>, void | ((this: unknown, enableLog?: boolean | undefined) => any)>;
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,MAAM,mDAAmC,OAAO,mHAe3D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,mDAAmC,OAAO,kHAG3D,CAAC"}
@@ -1,19 +1,8 @@
1
- // import {bgGreen, bgRed, black, white} from "@gaubee/nodekit"; // For the final message
2
1
  import { func_remember } from "@gaubee/util";
3
2
  import { myDoctorConfig } from "./config.js";
4
3
  import { runDoctor } from "./doctor.js";
5
4
  export const doctor = func_remember(async (enableLog = true) => {
6
5
  const report = await runDoctor(myDoctorConfig, enableLog);
7
- // if (log) {
8
- // console.log("\n\n--- Structured Report (for programmatic use) ---");
9
- // console.log(JSON.stringify(report, null, 2));
10
- // if (!report.overallSuccess) {
11
- // console.error(bgRed(white("\nCritical environment checks failed. Please fix the issues above before proceeding.")));
12
- // // process.exit(1); // Optionally exit if critical checks fail in a real CLI
13
- // } else {
14
- // console.log(bgGreen(black("\nAll critical checks passed successfully!")));
15
- // }
16
- // }
17
6
  return report;
18
7
  });
19
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/doctor/index.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,EAAE,YAAqB,IAAI,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAE1D,eAAe;IACf,2EAA2E;IAC3E,oDAAoD;IAEpD,oCAAoC;IACpC,6HAA6H;IAC7H,qFAAqF;IACrF,eAAe;IACf,mFAAmF;IACnF,QAAQ;IACR,MAAM;IACN,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC","sourcesContent":["// import {bgGreen, bgRed, black, white} from \"@gaubee/nodekit\"; // For the final message\nimport {func_remember} from \"@gaubee/util\";\nimport {myDoctorConfig} from \"./config.js\";\nimport {runDoctor} from \"./doctor.js\";\n\nexport const doctor = func_remember(async (enableLog: boolean = true) => {\n const report = await runDoctor(myDoctorConfig, enableLog);\n\n // if (log) {\n // console.log(\"\\n\\n--- Structured Report (for programmatic use) ---\");\n // console.log(JSON.stringify(report, null, 2));\n\n // if (!report.overallSuccess) {\n // console.error(bgRed(white(\"\\nCritical environment checks failed. Please fix the issues above before proceeding.\")));\n // // process.exit(1); // Optionally exit if critical checks fail in a real CLI\n // } else {\n // console.log(bgGreen(black(\"\\nAll critical checks passed successfully!\")));\n // }\n // }\n return report;\n});\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/doctor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,EAAE,YAAqB,IAAI,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC","sourcesContent":["import {func_remember} from \"@gaubee/util\";\nimport {myDoctorConfig} from \"./config.js\";\nimport {runDoctor} from \"./doctor.js\";\n\nexport const doctor = func_remember(async (enableLog: boolean = true) => {\n const report = await runDoctor(myDoctorConfig, enableLog);\n return report;\n});\n"]}