@jixo/cli 0.12.0 → 0.20.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 (117) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +17 -95
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/apply.d.ts +9 -0
  6. package/dist/commands/apply.d.ts.map +1 -0
  7. package/dist/commands/apply.js +59 -0
  8. package/dist/commands/apply.js.map +1 -0
  9. package/dist/commands/gen.d.ts +9 -0
  10. package/dist/commands/gen.d.ts.map +1 -0
  11. package/dist/commands/gen.js +43 -0
  12. package/dist/commands/gen.js.map +1 -0
  13. package/dist/commands/google-aistudio.d.ts +8 -0
  14. package/dist/commands/google-aistudio.d.ts.map +1 -0
  15. package/dist/commands/google-aistudio.js +51 -0
  16. package/dist/commands/google-aistudio.js.map +1 -0
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -4
  20. package/dist/index.js.map +1 -1
  21. package/package.json +4 -25
  22. package/dist/commands/doctor/config.d.ts +0 -3
  23. package/dist/commands/doctor/config.d.ts.map +0 -1
  24. package/dist/commands/doctor/config.js +0 -30
  25. package/dist/commands/doctor/config.js.map +0 -1
  26. package/dist/commands/doctor/doctor.d.ts +0 -18
  27. package/dist/commands/doctor/doctor.d.ts.map +0 -1
  28. package/dist/commands/doctor/doctor.js +0 -125
  29. package/dist/commands/doctor/doctor.js.map +0 -1
  30. package/dist/commands/doctor/doctor.test.d.ts +0 -2
  31. package/dist/commands/doctor/doctor.test.d.ts.map +0 -1
  32. package/dist/commands/doctor/doctor.test.js +0 -14
  33. package/dist/commands/doctor/doctor.test.js.map +0 -1
  34. package/dist/commands/doctor/index.d.ts +0 -2
  35. package/dist/commands/doctor/index.d.ts.map +0 -1
  36. package/dist/commands/doctor/index.js +0 -19
  37. package/dist/commands/doctor/index.js.map +0 -1
  38. package/dist/commands/doctor/types.d.ts +0 -30
  39. package/dist/commands/doctor/types.d.ts.map +0 -1
  40. package/dist/commands/doctor/types.js +0 -3
  41. package/dist/commands/doctor/types.js.map +0 -1
  42. package/dist/commands/init.d.ts +0 -2
  43. package/dist/commands/init.d.ts.map +0 -1
  44. package/dist/commands/init.js +0 -63
  45. package/dist/commands/init.js.map +0 -1
  46. package/dist/commands/prompts/list.d.ts +0 -2
  47. package/dist/commands/prompts/list.d.ts.map +0 -1
  48. package/dist/commands/prompts/list.js +0 -14
  49. package/dist/commands/prompts/list.js.map +0 -1
  50. package/dist/commands/prompts/upgrade.d.ts +0 -4
  51. package/dist/commands/prompts/upgrade.d.ts.map +0 -1
  52. package/dist/commands/prompts/upgrade.js +0 -17
  53. package/dist/commands/prompts/upgrade.js.map +0 -1
  54. package/dist/commands/tasks/AiTaskTui.d.ts +0 -22
  55. package/dist/commands/tasks/AiTaskTui.d.ts.map +0 -1
  56. package/dist/commands/tasks/AiTaskTui.js +0 -52
  57. package/dist/commands/tasks/AiTaskTui.js.map +0 -1
  58. package/dist/commands/tasks/ai-tasl-tui.d.ts +0 -22
  59. package/dist/commands/tasks/ai-tasl-tui.d.ts.map +0 -1
  60. package/dist/commands/tasks/ai-tasl-tui.js +0 -53
  61. package/dist/commands/tasks/ai-tasl-tui.js.map +0 -1
  62. package/dist/commands/tasks/ai-tools.d.ts +0 -811
  63. package/dist/commands/tasks/ai-tools.d.ts.map +0 -1
  64. package/dist/commands/tasks/ai-tools.js +0 -140
  65. package/dist/commands/tasks/ai-tools.js.map +0 -1
  66. package/dist/commands/tasks/model-providers.d.ts +0 -13
  67. package/dist/commands/tasks/model-providers.d.ts.map +0 -1
  68. package/dist/commands/tasks/model-providers.js +0 -84
  69. package/dist/commands/tasks/model-providers.js.map +0 -1
  70. package/dist/commands/tasks/run-ai-task.d.ts +0 -4
  71. package/dist/commands/tasks/run-ai-task.d.ts.map +0 -1
  72. package/dist/commands/tasks/run-ai-task.js +0 -343
  73. package/dist/commands/tasks/run-ai-task.js.map +0 -1
  74. package/dist/commands/tasks/run.d.ts +0 -7
  75. package/dist/commands/tasks/run.d.ts.map +0 -1
  76. package/dist/commands/tasks/run.js +0 -91
  77. package/dist/commands/tasks/run.js.map +0 -1
  78. package/dist/config.d.ts +0 -206
  79. package/dist/config.d.ts.map +0 -1
  80. package/dist/config.js +0 -35
  81. package/dist/config.js.map +0 -1
  82. package/dist/env.d.ts +0 -17
  83. package/dist/env.d.ts.map +0 -1
  84. package/dist/env.js +0 -26
  85. package/dist/env.js.map +0 -1
  86. package/dist/helper/ai-retry-error.d.ts +0 -3
  87. package/dist/helper/ai-retry-error.d.ts.map +0 -1
  88. package/dist/helper/ai-retry-error.js +0 -108
  89. package/dist/helper/ai-retry-error.js.map +0 -1
  90. package/dist/helper/find-changes.d.ts +0 -3
  91. package/dist/helper/find-changes.d.ts.map +0 -1
  92. package/dist/helper/find-changes.js +0 -113
  93. package/dist/helper/find-changes.js.map +0 -1
  94. package/dist/helper/find-changes.test.d.ts +0 -2
  95. package/dist/helper/find-changes.test.d.ts.map +0 -1
  96. package/dist/helper/find-changes.test.js +0 -22
  97. package/dist/helper/find-changes.test.js.map +0 -1
  98. package/dist/helper/handle-ai-error.d.ts +0 -5
  99. package/dist/helper/handle-ai-error.d.ts.map +0 -1
  100. package/dist/helper/handle-ai-error.js +0 -122
  101. package/dist/helper/handle-ai-error.js.map +0 -1
  102. package/dist/helper/logger.d.ts +0 -3
  103. package/dist/helper/logger.d.ts.map +0 -1
  104. package/dist/helper/logger.js +0 -26
  105. package/dist/helper/logger.js.map +0 -1
  106. package/dist/helper/parse-progress.d.ts +0 -2
  107. package/dist/helper/parse-progress.d.ts.map +0 -1
  108. package/dist/helper/parse-progress.js +0 -28
  109. package/dist/helper/parse-progress.js.map +0 -1
  110. package/dist/helper/prompts-loader.d.ts +0 -11
  111. package/dist/helper/prompts-loader.d.ts.map +0 -1
  112. package/dist/helper/prompts-loader.js +0 -28
  113. package/dist/helper/prompts-loader.js.map +0 -1
  114. package/dist/helper/resolve-ai-tasks.d.ts +0 -42
  115. package/dist/helper/resolve-ai-tasks.d.ts.map +0 -1
  116. package/dist/helper/resolve-ai-tasks.js +0 -162
  117. package/dist/helper/resolve-ai-tasks.js.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @jixo/cli
2
2
 
3
- AI 工具集、助手
3
+ AI 工具集
4
4
 
5
5
  ## Install
6
6
 
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,kBAqHzD,CAAC"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,GAAU,OAAM,MAAM,EAAiB,kBAyBzD,CAAC"}
package/dist/cli.js CHANGED
@@ -1,108 +1,30 @@
1
- import { cwdResolver } from "@gaubee/node";
2
- import { match, P } from "ts-pattern";
1
+ process.removeAllListeners("warning");
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
3
5
  import yargs from "yargs";
4
6
  import { hideBin } from "yargs/helpers";
5
7
  import packageJson from "../package.json" with { type: "json" };
6
- import { doctor } from "./commands/doctor/index.js";
7
- import { init } from "./commands/init.js";
8
- import { listPrompts } from "./commands/prompts/list.js";
9
- import { upgradePrompts } from "./commands/prompts/upgrade.js";
10
- import { run } from "./commands/tasks/run.js";
11
8
  export const runCli = async (args = process.argv) => {
12
- const cli = await yargs(hideBin(args))
13
- .scriptName("jixo")
14
- .version(packageJson.version)
15
- .command("doctor", "Check the requirements for run jixo", (yargs) => yargs, () => {
16
- doctor();
17
- })
18
- .command("init [dir]", "Create a new JIXO project", (yargs) => {
19
- return yargs.positional("dir", {
20
- describe: "The directory to create the JIXO config",
21
- default: "./",
22
- });
23
- }, (argv) => {
24
- init(cwdResolver(argv.dir));
25
- })
26
- .command("run [filter...]", "Run JIXO tasks", (yargs) => {
27
- return yargs
28
- .positional("filter", {
29
- describe: 'Fliter tasks by name or directory(starts with "./")',
30
- array: true,
31
- default: [],
32
- })
33
- .option("dir", {
34
- alias: "D",
35
- 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
- type: "boolean",
45
- description: "The task is executed only once in the loop, equal to --loop=1",
46
- })
47
- .option("loop", {
48
- alias: "L",
49
- type: "number",
50
- description: "The task is executed N times in the loop",
51
- });
52
- }, (argv) => {
53
- const filters = argv.filter.map((v) => v.toString().split(/[\s,]+/)).flat();
54
- const nameFilter = [];
55
- const dirFilter = [];
56
- for (const f of filters) {
57
- if (f.startsWith("./") || f.startsWith("../") || f.startsWith("~/")) {
58
- dirFilter.push(f);
9
+ let cli = yargs(hideBin(args)).scriptName("jixo").version(packageJson.version).demandCommand(1, "You need at least one command before moving on").strict().help();
10
+ // 动态加载命令
11
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
12
+ const commandsDir = path.join(__dirname, "commands");
13
+ const commandFiles = fs.readdirSync(commandsDir).filter((file) => file.endsWith(".js") || file.endsWith(".ts"));
14
+ for (const file of commandFiles) {
15
+ const commandModule = await import(path.join(commandsDir, file));
16
+ // 假设每个模块导出一个或多个 yargs 命令模块
17
+ for (const key in commandModule) {
18
+ if (typeof commandModule[key] === "object" && commandModule[key].command) {
19
+ cli = cli.command(commandModule[key]);
59
20
  }
60
- else {
61
- nameFilter.push(f);
62
- }
63
- }
64
- run(cwdResolver(argv.dir ?? ""), {
65
- nameFilter,
66
- dirFilter,
67
- force: argv.force,
68
- loopTimes: match(argv)
69
- .with({ loop: P.number.gt(0).select() }, (loop) => loop)
70
- .with({ once: P.boolean.select() }, (once) => (once ? 1 : Infinity))
71
- .otherwise(() => Infinity),
72
- });
73
- })
74
- .command("prompts", "Manage prompts", (yargs) => {
75
- return (yargs
76
- //
77
- .option("dir", {
78
- alias: "D",
79
- type: "string",
80
- description: "The project directory with JIXO config",
81
- })
82
- .option("mirrorUrl", {
83
- alias: "M",
84
- type: "string",
85
- description: "The Url for download prompts",
86
- })
87
- .option("upgrade", {
88
- alias: "U",
89
- type: "boolean",
90
- description: "Upgrade builtin prompts",
91
- }));
92
- }, async (argv) => {
93
- if (argv.upgrade) {
94
- upgradePrompts(argv.dir ? cwdResolver(argv.dir) : cwdResolver(), { mirrorUrl: argv.mirrorUrl });
95
21
  }
96
- else {
97
- listPrompts();
98
- }
99
- })
100
- .strict();
22
+ }
101
23
  const argv = await cli.parse();
24
+ // 如果没有命令被执行,显示帮助信息
102
25
  if (argv._.length === 0) {
103
26
  cli.showHelp();
104
27
  console.log(" " + "─".repeat(Math.max(4, process.stdout.columns - 2)));
105
- await doctor();
106
28
  }
107
29
  };
108
30
  //# sourceMappingURL=cli.js.map
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,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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 type: \"boolean\",\n description: \"The task is executed only once in the loop, equal to --loop=1\",\n })\n .option(\"loop\", {\n alias: \"L\",\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({loop: P.number.gt(0).select()}, (loop) => loop)\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,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACtC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AACvC,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;AAE9D,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,OAAiB,OAAO,CAAC,IAAI,EAAE,EAAE;IAC5D,IAAI,G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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;IACzE,CAAC;AACH,CAAC,CAAC","sourcesContent":["process.removeAllListeners(\"warning\");\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport {fileURLToPath} from \"node:url\";\nimport yargs from \"yargs\";\nimport {hideBin} from \"yargs/helpers\";\nimport packageJson from \"../package.json\" with {type: \"json\"};\n\nexport const runCli = async (args: string[] = process.argv) => {\n let cli = yargs(hideBin(args)).scriptName(\"jixo\").version(packageJson.version).demandCommand(1, \"You need at least one command before moving on\").strict().help();\n\n // 动态加载命令\n const __dirname = path.dirname(fileURLToPath(import.meta.url));\n const commandsDir = path.join(__dirname, \"commands\");\n const commandFiles = fs.readdirSync(commandsDir).filter((file) => file.endsWith(\".js\") || file.endsWith(\".ts\"));\n\n for (const file of commandFiles) {\n const commandModule = await import(path.join(commandsDir, file));\n // 假设每个模块导出一个或多个 yargs 命令模块\n for (const key in commandModule) {\n if (typeof commandModule[key] === \"object\" && commandModule[key].command) {\n cli = cli.command(commandModule[key]);\n }\n }\n }\n\n const argv = await cli.parse();\n\n // 如果没有命令被执行,显示帮助信息\n if (argv._.length === 0) {\n cli.showHelp();\n console.log(\" \" + \"─\".repeat(Math.max(4, process.stdout.columns - 2)));\n }\n};\n"]}
@@ -0,0 +1,9 @@
1
+ import { type ApplyOptions } from "@jixo/dev/apply-ai-response";
2
+ import type { CommandModule } from "yargs";
3
+ /**
4
+ * @jixo/cli apply
5
+ *
6
+ * Apply changes from AI-generated markdown file.
7
+ */
8
+ export declare const applyCommand: CommandModule<object, ApplyOptions>;
9
+ //# sourceMappingURL=apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/commands/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,YAAY,EAAC,MAAM,6BAA6B,CAAC;AACjF,OAAO,KAAK,EAAY,aAAa,EAAC,MAAM,OAAO,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,MAAM,EAAE,YAAY,CAoD5D,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { doApplyAiResponse } from "@jixo/dev/apply-ai-response";
2
+ /**
3
+ * @jixo/cli apply
4
+ *
5
+ * Apply changes from AI-generated markdown file.
6
+ */
7
+ export const applyCommand = {
8
+ command: "apply <files...>",
9
+ aliases: ["A"],
10
+ describe: "Apply changes from AI-generated markdown files",
11
+ builder: (yargs) => yargs
12
+ .positional("files", {
13
+ describe: "Paths or glob patterns to the markdown files",
14
+ type: "string",
15
+ demandOption: true,
16
+ array: true,
17
+ })
18
+ .option("yes", {
19
+ alias: "Y",
20
+ type: "boolean",
21
+ describe: "Skip confirmation prompt and apply all changes",
22
+ default: false,
23
+ })
24
+ .option("cwd", {
25
+ alias: "C",
26
+ type: "string",
27
+ describe: "Set the working directory",
28
+ default: process.cwd(),
29
+ })
30
+ .option("unsafe", {
31
+ type: "boolean",
32
+ describe: "Allow unsafe file paths (e.g., outside of project root)",
33
+ default: false,
34
+ })
35
+ .option("format", {
36
+ alias: "F",
37
+ type: "boolean",
38
+ describe: "Format code after applying changes",
39
+ default: true,
40
+ })
41
+ .option("gitCommit", {
42
+ alias: ["G", "git-commit"],
43
+ type: "boolean",
44
+ describe: "Automatically commit changes with the message from markdown",
45
+ default: false,
46
+ }),
47
+ handler: async (argv) => {
48
+ // yargs 的 argv 结构与 ApplyOptions 几乎完全兼容
49
+ // files 参数会被 yargs 正确处理为 string[]
50
+ await doApplyAiResponse(argv.files, {
51
+ yes: argv.yes,
52
+ cwd: argv.cwd,
53
+ unsafe: argv.unsafe,
54
+ format: argv.format,
55
+ gitCommit: argv.gitCommit,
56
+ });
57
+ },
58
+ };
59
+ //# sourceMappingURL=apply.js.map
@@ -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AE;QAC/C,uCAAuC;QACvC,kCAAkC;QAClC,MAAM,iBAAiB,CAAC,IAAI,CAAC,KAAiB,EAAE;YAC9C,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAC;IACL,CAAC;CACF,CAAC","sourcesContent":["import {doApplyAiResponse, type ApplyOptions} from \"@jixo/dev/apply-ai-response\";\nimport type {Arguments, CommandModule} from \"yargs\";\n\n/**\n * @jixo/cli apply\n *\n * Apply changes from AI-generated markdown file.\n */\nexport const applyCommand: CommandModule<object, ApplyOptions> = {\n command: \"apply <files...>\",\n aliases: [\"A\"],\n describe: \"Apply changes from AI-generated markdown files\",\n builder: (yargs) =>\n yargs\n .positional(\"files\", {\n describe: \"Paths or glob patterns to the markdown files\",\n type: \"string\",\n demandOption: true,\n array: true,\n })\n .option(\"yes\", {\n alias: \"Y\",\n type: \"boolean\",\n describe: \"Skip confirmation prompt and apply all changes\",\n default: false,\n })\n .option(\"cwd\", {\n alias: \"C\",\n type: \"string\",\n describe: \"Set the working directory\",\n default: process.cwd(),\n })\n .option(\"unsafe\", {\n type: \"boolean\",\n describe: \"Allow unsafe file paths (e.g., outside of project root)\",\n default: false,\n })\n .option(\"format\", {\n alias: \"F\",\n type: \"boolean\",\n describe: \"Format code after applying changes\",\n default: true,\n })\n .option(\"gitCommit\", {\n alias: [\"G\", \"git-commit\"],\n type: \"boolean\",\n describe: \"Automatically commit changes with the message from markdown\",\n default: false,\n }),\n handler: async (argv: Arguments<ApplyOptions>) => {\n // yargs 的 argv 结构与 ApplyOptions 几乎完全兼容\n // files 参数会被 yargs 正确处理为 string[]\n await doApplyAiResponse(argv.files as string[], {\n yes: argv.yes,\n cwd: argv.cwd,\n unsafe: argv.unsafe,\n format: argv.format,\n gitCommit: argv.gitCommit,\n });\n },\n};\n"]}
@@ -0,0 +1,9 @@
1
+ import { type GenOptions } from "@jixo/dev/gen-prompt";
2
+ import type { CommandModule } from "yargs";
3
+ /**
4
+ * @jixo/cli gen
5
+ *
6
+ * Generate AI prompts from metadata files (*.meta.md).
7
+ */
8
+ export declare const genCommand: CommandModule<object, GenOptions>;
9
+ //# sourceMappingURL=gen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gen.d.ts","sourceRoot":"","sources":["../../src/commands/gen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,UAAU,EAAC,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAY,aAAa,EAAC,MAAM,OAAO,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,MAAM,EAAE,UAAU,CAoCxD,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { doGenPrompts } from "@jixo/dev/gen-prompt";
2
+ /**
3
+ * @jixo/cli gen
4
+ *
5
+ * Generate AI prompts from metadata files (*.meta.md).
6
+ */
7
+ export const genCommand = {
8
+ command: "gen <inputs...>",
9
+ aliases: ["G"],
10
+ describe: "Generate AI prompts from metadata files (*.meta.md)",
11
+ builder: (yargs) => yargs
12
+ .positional("inputs", {
13
+ describe: "Input files, directories, or glob patterns",
14
+ type: "string",
15
+ demandOption: true,
16
+ array: true,
17
+ })
18
+ .option("outFile", {
19
+ alias: ["O", "out-file"],
20
+ type: "string",
21
+ describe: "Specify the output file path (for single file input only)",
22
+ })
23
+ .option("watch", {
24
+ alias: "W",
25
+ type: "boolean",
26
+ describe: "Watch for file changes and regenerate automatically",
27
+ default: false,
28
+ })
29
+ .option("cwd", {
30
+ type: "string",
31
+ describe: "Set the working directory for glob patterns",
32
+ })
33
+ .option("glob", {
34
+ type: "string",
35
+ describe: "Glob pattern for batch processing when an input is a directory",
36
+ default: "*.meta.md",
37
+ }),
38
+ handler: async (argv) => {
39
+ // 直接调用封装好的核心逻辑
40
+ await doGenPrompts(argv);
41
+ },
42
+ };
43
+ //# sourceMappingURL=gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gen.js","sourceRoot":"","sources":["../../src/commands/gen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAkB,MAAM,sBAAsB,CAAC;AAGnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsC;IAC3D,OAAO,EAAE,iBAAiB;IAC1B,OAAO,EAAE,CAAC,GAAG,CAAC;IACd,QAAQ,EAAE,qDAAqD;IAC/D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK;SACF,UAAU,CAAC,QAAQ,EAAE;QACpB,QAAQ,EAAE,4CAA4C;QACtD,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,IAAI;KACZ,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QACjB,KAAK,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC;QACxB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,2DAA2D;KACtE,CAAC;SACD,MAAM,CAAC,OAAO,EAAE;QACf,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,qDAAqD;QAC/D,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,KAAK,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,6CAA6C;KACxD,CAAC;SACD,MAAM,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,gEAAgE;QAC1E,OAAO,EAAE,WAAW;KACrB,CAAC;IACN,OAAO,EAAE,KAAK,EAAE,IAA2B,EAAE,EAAE;QAC7C,eAAe;QACf,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;CACF,CAAC","sourcesContent":["import {doGenPrompts, type GenOptions} from \"@jixo/dev/gen-prompt\";\nimport type {Arguments, CommandModule} from \"yargs\";\n\n/**\n * @jixo/cli gen\n *\n * Generate AI prompts from metadata files (*.meta.md).\n */\nexport const genCommand: CommandModule<object, GenOptions> = {\n command: \"gen <inputs...>\",\n aliases: [\"G\"],\n describe: \"Generate AI prompts from metadata files (*.meta.md)\",\n builder: (yargs) =>\n yargs\n .positional(\"inputs\", {\n describe: \"Input files, directories, or glob patterns\",\n type: \"string\",\n demandOption: true,\n array: true,\n })\n .option(\"outFile\", {\n alias: [\"O\", \"out-file\"],\n type: \"string\",\n describe: \"Specify the output file path (for single file input only)\",\n })\n .option(\"watch\", {\n alias: \"W\",\n type: \"boolean\",\n describe: \"Watch for file changes and regenerate automatically\",\n default: false,\n })\n .option(\"cwd\", {\n type: \"string\",\n describe: \"Set the working directory for glob patterns\",\n })\n .option(\"glob\", {\n type: \"string\",\n describe: \"Glob pattern for batch processing when an input is a directory\",\n default: \"*.meta.md\",\n }),\n handler: async (argv: Arguments<GenOptions>) => {\n // 直接调用封装好的核心逻辑\n await doGenPrompts(argv);\n },\n};\n"]}
@@ -0,0 +1,8 @@
1
+ import type { CommandModule } from "yargs";
2
+ /**
3
+ * @jixo/cli google-aistudio
4
+ *
5
+ * Group of commands for interacting with Google AI Studio.
6
+ */
7
+ export declare const googleAistudioCommand: CommandModule<object, object>;
8
+ //# sourceMappingURL=google-aistudio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-aistudio.d.ts","sourceRoot":"","sources":["../../src/commands/google-aistudio.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,aAAa,EAAC,MAAM,OAAO,CAAC;AA4CpD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,MAAM,CAU/D,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { doSync } from "@jixo/dev/google-aistudio";
2
+ // 定义 'sync' 子命令
3
+ const syncCommand = {
4
+ command: "sync [path]",
5
+ aliases: ["S"],
6
+ describe: "Sync with aistudio.google.com contents",
7
+ builder: (yargs) => yargs
8
+ .positional("path", {
9
+ describe: "Directory or file path to sync",
10
+ type: "string",
11
+ default: process.cwd(),
12
+ })
13
+ .option("watch", {
14
+ alias: "W",
15
+ type: "boolean",
16
+ describe: "Watch for file changes and sync automatically",
17
+ default: false,
18
+ })
19
+ .option("outDir", {
20
+ alias: "O",
21
+ type: "string",
22
+ describe: "Specify the output directory for generated markdown files",
23
+ }),
24
+ handler: async (argv) => {
25
+ // 将 yargs 的解析结果适配为 doSync 函数期望的格式。
26
+ // 关键是 yargs 的位置参数是命名好的 (argv.path),而 doSync
27
+ // 期望它在 `_` 数组的第一个位置。
28
+ const optionsForDoSync = {
29
+ ...argv,
30
+ _: [argv.path],
31
+ };
32
+ doSync(optionsForDoSync);
33
+ },
34
+ };
35
+ /**
36
+ * @jixo/cli google-aistudio
37
+ *
38
+ * Group of commands for interacting with Google AI Studio.
39
+ */
40
+ export const googleAistudioCommand = {
41
+ command: "google-aistudio <command>",
42
+ aliases: ["GO"],
43
+ describe: "Commands for Google AI Studio integration",
44
+ builder: (yargs) => {
45
+ // 将 syncCommand 注册为 google-aistudio 的子命令
46
+ return yargs.command(syncCommand).demandCommand(1, "You must provide a sub-command for 'google-aistudio'.");
47
+ },
48
+ // 这个 handler 理论上不会被执行,因为 yargs 会要求一个子命令
49
+ handler: () => { },
50
+ };
51
+ //# sourceMappingURL=google-aistudio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-aistudio.js","sourceRoot":"","sources":["../../src/commands/google-aistudio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAmB,MAAM,2BAA2B,CAAC;AAUnE,gBAAgB;AAChB,MAAM,WAAW,GAAoC;IACnD,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,CAAC,GAAG,CAAC;IACd,QAAQ,EAAE,wCAAwC;IAClD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK;SACF,UAAU,CAAC,MAAM,EAAE;QAClB,QAAQ,EAAE,gCAAgC;QAC1C,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE;KACvB,CAAC;SACD,MAAM,CAAC,OAAO,EAAE;QACf,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,+CAA+C;QACzD,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,QAAQ,EAAE;QAChB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,2DAA2D;KACtE,CAAC;IACN,OAAO,EAAE,KAAK,EAAE,IAAyB,EAAE,EAAE;QAC3C,mCAAmC;QACnC,4CAA4C;QAC5C,qBAAqB;QACrB,MAAM,gBAAgB,GAAgB;YACpC,GAAG,IAAI;YACP,CAAC,EAAE,CAAC,IAAI,CAAC,IAAc,CAAC;SACzB,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAC3B,CAAC;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAkC;IAClE,OAAO,EAAE,2BAA2B;IACpC,OAAO,EAAE,CAAC,IAAI,CAAC;IACf,QAAQ,EAAE,2CAA2C;IACrD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QACjB,yCAAyC;QACzC,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,aAAa,CAAC,CAAC,EAAE,uDAAuD,CAAC,CAAC;IAC9G,CAAC;IACD,wCAAwC;IACxC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;CAClB,CAAC","sourcesContent":["import {doSync, type SyncOptions} from \"@jixo/dev/google-aistudio\";\nimport type {Arguments, CommandModule} from \"yargs\";\n\n// 定义 yargs builder 所需的参数接口\ninterface SyncArgs {\n path?: string;\n watch?: boolean;\n outDir?: string;\n}\n\n// 定义 'sync' 子命令\nconst syncCommand: CommandModule<object, SyncArgs> = {\n command: \"sync [path]\",\n aliases: [\"S\"],\n describe: \"Sync with aistudio.google.com contents\",\n builder: (yargs) =>\n yargs\n .positional(\"path\", {\n describe: \"Directory or file path to sync\",\n type: \"string\",\n default: process.cwd(),\n })\n .option(\"watch\", {\n alias: \"W\",\n type: \"boolean\",\n describe: \"Watch for file changes and sync automatically\",\n default: false,\n })\n .option(\"outDir\", {\n alias: \"O\",\n type: \"string\",\n describe: \"Specify the output directory for generated markdown files\",\n }),\n handler: async (argv: Arguments<SyncArgs>) => {\n // 将 yargs 的解析结果适配为 doSync 函数期望的格式。\n // 关键是 yargs 的位置参数是命名好的 (argv.path),而 doSync\n // 期望它在 `_` 数组的第一个位置。\n const optionsForDoSync: SyncOptions = {\n ...argv,\n _: [argv.path as string],\n };\n doSync(optionsForDoSync);\n },\n};\n\n/**\n * @jixo/cli google-aistudio\n *\n * Group of commands for interacting with Google AI Studio.\n */\nexport const googleAistudioCommand: CommandModule<object, object> = {\n command: \"google-aistudio <command>\",\n aliases: [\"GO\"],\n describe: \"Commands for Google AI Studio integration\",\n builder: (yargs) => {\n // 将 syncCommand 注册为 google-aistudio 的子命令\n return yargs.command(syncCommand).demandCommand(1, \"You must provide a sub-command for 'google-aistudio'.\");\n },\n // 这个 handler 理论上不会被执行,因为 yargs 会要求一个子命令\n handler: () => {},\n};\n"]}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./config.js";
1
+ export {};
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js CHANGED
@@ -1,7 +1,4 @@
1
- export * from "./config.js";
2
1
  import { runCli } from "./cli.js";
3
- // import {import_meta_ponyfill} from "import-meta-ponyfill";
4
- // if (import_meta_ponyfill(import.meta).main) {
2
+ // 启动 CLI
5
3
  runCli();
6
- // }
7
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,6DAA6D;AAC7D,gDAAgD;AAChD,MAAM,EAAE,CAAC;AACT,IAAI","sourcesContent":["export * from \"./config.js\";\n\nimport {runCli} from \"./cli.js\";\n\n// import {import_meta_ponyfill} from \"import-meta-ponyfill\";\n// if (import_meta_ponyfill(import.meta).main) {\nrunCli();\n// }\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,SAAS;AACT,MAAM,EAAE,CAAC","sourcesContent":["import {runCli} from \"./cli.js\";\n\n// 启动 CLI\nrunCli();\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jixo/cli",
3
- "version": "0.12.0",
3
+ "version": "0.20.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "jixo": "./dist/index.js"
@@ -14,40 +14,19 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ai-sdk/anthropic": "alpha",
18
- "@ai-sdk/deepinfra": "alpha",
19
- "@ai-sdk/deepseek": "alpha",
20
- "@ai-sdk/google": "alpha",
21
- "@ai-sdk/openai": "alpha",
22
- "@ai-sdk/provider": "alpha",
23
- "@ai-sdk/xai": "alpha",
24
- "@gaubee/node": "^0.2.1",
25
- "@gaubee/nodekit": "^0.9.1",
26
- "@gaubee/util": "^0.32.1",
27
- "ai": "alpha",
28
- "commander": "^14.0.0",
29
- "cosmiconfig": "^9.0.0",
30
- "debug": "^4.4.1",
31
- "defu": "^6.1.4",
32
- "dotenv": "^16.5.0",
33
17
  "import-meta-ponyfill": "^3.2.2",
34
- "marked": "^15.0.12",
35
- "ms": "^2.1.3",
36
- "semver": "^7.7.2",
37
18
  "ts-pattern": "^5.7.1",
38
19
  "tslib": "^2.8.1",
39
- "uuidv7": "^1.0.2",
40
20
  "yargs": "^18.0.0",
41
- "zod": "^3.25.53",
42
- "@jixo/mcp-fs": "^1.3.0",
43
- "@jixo/mcp-pnpm": "^1.3.0"
21
+ "zod": "^3.25.76",
22
+ "@jixo/dev": "^1.11.4"
44
23
  },
45
24
  "devDependencies": {
46
25
  "@parcel/watcher": "^2.5.1",
47
26
  "@types/debug": "^4.1.12",
48
27
  "@types/json-schema": "^7.0.15",
49
28
  "@types/ms": "^2.1.0",
50
- "@types/node": "^22.15.30",
29
+ "@types/node": "^24.0.12",
51
30
  "@types/semver": "^7.7.0",
52
31
  "@types/yargs": "^17.0.33"
53
32
  },
@@ -1,3 +0,0 @@
1
- import type { DoctorConfig } from "./types.js";
2
- export declare const myDoctorConfig: DoctorConfig;
3
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
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,30 +0,0 @@
1
- import { blue, green } from "@gaubee/nodekit";
2
- export const myDoctorConfig = [
3
- {
4
- id: "pnpm",
5
- displayName: "PNPM Package Manager",
6
- versionCommand: "pnpm --version",
7
- versionParseRegex: /(\d+\.\d+\.\d+)/, // Assumes pnpm --version outputs just the version or "X.Y.Z ..."
8
- minVersion: "10.9.0",
9
- installationHint: `Install pnpm via npm: ${green("npm install -g pnpm")}. Or visit ${blue("https://pnpm.io/installation")}`,
10
- },
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
- ];
30
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
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,18 +0,0 @@
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
- }
17
- export declare function runDoctor(config: DoctorConfig, enableLog?: boolean): Promise<DoctorReport>;
18
- //# sourceMappingURL=doctor.d.ts.map
@@ -1 +0,0 @@
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"}