@jixo/cli 0.13.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 (121) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +18 -71
  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/daemon.d.ts +0 -5
  23. package/dist/commands/daemon.d.ts.map +0 -1
  24. package/dist/commands/daemon.js +0 -20
  25. package/dist/commands/daemon.js.map +0 -1
  26. package/dist/commands/doctor/config.d.ts +0 -3
  27. package/dist/commands/doctor/config.d.ts.map +0 -1
  28. package/dist/commands/doctor/config.js +0 -17
  29. package/dist/commands/doctor/config.js.map +0 -1
  30. package/dist/commands/doctor/doctor.d.ts +0 -3
  31. package/dist/commands/doctor/doctor.d.ts.map +0 -1
  32. package/dist/commands/doctor/doctor.js +0 -158
  33. package/dist/commands/doctor/doctor.js.map +0 -1
  34. package/dist/commands/doctor/doctor.test.d.ts +0 -2
  35. package/dist/commands/doctor/doctor.test.d.ts.map +0 -1
  36. package/dist/commands/doctor/doctor.test.js +0 -14
  37. package/dist/commands/doctor/doctor.test.js.map +0 -1
  38. package/dist/commands/doctor/index.d.ts +0 -2
  39. package/dist/commands/doctor/index.d.ts.map +0 -1
  40. package/dist/commands/doctor/index.js +0 -8
  41. package/dist/commands/doctor/index.js.map +0 -1
  42. package/dist/commands/doctor/types.d.ts +0 -45
  43. package/dist/commands/doctor/types.d.ts.map +0 -1
  44. package/dist/commands/doctor/types.js +0 -3
  45. package/dist/commands/doctor/types.js.map +0 -1
  46. package/dist/commands/init.d.ts +0 -2
  47. package/dist/commands/init.d.ts.map +0 -1
  48. package/dist/commands/init.js +0 -40
  49. package/dist/commands/init.js.map +0 -1
  50. package/dist/commands/prompts/list.d.ts +0 -2
  51. package/dist/commands/prompts/list.d.ts.map +0 -1
  52. package/dist/commands/prompts/list.js +0 -14
  53. package/dist/commands/prompts/list.js.map +0 -1
  54. package/dist/commands/prompts/upgrade.d.ts +0 -4
  55. package/dist/commands/prompts/upgrade.d.ts.map +0 -1
  56. package/dist/commands/prompts/upgrade.js +0 -17
  57. package/dist/commands/prompts/upgrade.js.map +0 -1
  58. package/dist/commands/tasks/AiTaskTui.d.ts +0 -22
  59. package/dist/commands/tasks/AiTaskTui.d.ts.map +0 -1
  60. package/dist/commands/tasks/AiTaskTui.js +0 -52
  61. package/dist/commands/tasks/AiTaskTui.js.map +0 -1
  62. package/dist/commands/tasks/ai-tasl-tui.d.ts +0 -22
  63. package/dist/commands/tasks/ai-tasl-tui.d.ts.map +0 -1
  64. package/dist/commands/tasks/ai-tasl-tui.js +0 -53
  65. package/dist/commands/tasks/ai-tasl-tui.js.map +0 -1
  66. package/dist/commands/tasks/ai-tools.d.ts +0 -804
  67. package/dist/commands/tasks/ai-tools.d.ts.map +0 -1
  68. package/dist/commands/tasks/ai-tools.js +0 -140
  69. package/dist/commands/tasks/ai-tools.js.map +0 -1
  70. package/dist/commands/tasks/model-providers.d.ts +0 -13
  71. package/dist/commands/tasks/model-providers.d.ts.map +0 -1
  72. package/dist/commands/tasks/model-providers.js +0 -84
  73. package/dist/commands/tasks/model-providers.js.map +0 -1
  74. package/dist/commands/tasks/run-ai-task.d.ts +0 -4
  75. package/dist/commands/tasks/run-ai-task.d.ts.map +0 -1
  76. package/dist/commands/tasks/run-ai-task.js +0 -348
  77. package/dist/commands/tasks/run-ai-task.js.map +0 -1
  78. package/dist/commands/tasks/run.d.ts +0 -10
  79. package/dist/commands/tasks/run.d.ts.map +0 -1
  80. package/dist/commands/tasks/run.js +0 -44
  81. package/dist/commands/tasks/run.js.map +0 -1
  82. package/dist/config.d.ts +0 -15
  83. package/dist/config.d.ts.map +0 -1
  84. package/dist/config.js +0 -23
  85. package/dist/config.js.map +0 -1
  86. package/dist/env.d.ts +0 -6
  87. package/dist/env.d.ts.map +0 -1
  88. package/dist/env.js +0 -16
  89. package/dist/env.js.map +0 -1
  90. package/dist/helper/ai-retry-error.d.ts +0 -3
  91. package/dist/helper/ai-retry-error.d.ts.map +0 -1
  92. package/dist/helper/ai-retry-error.js +0 -108
  93. package/dist/helper/ai-retry-error.js.map +0 -1
  94. package/dist/helper/find-changes.d.ts +0 -3
  95. package/dist/helper/find-changes.d.ts.map +0 -1
  96. package/dist/helper/find-changes.js +0 -113
  97. package/dist/helper/find-changes.js.map +0 -1
  98. package/dist/helper/find-changes.test.d.ts +0 -2
  99. package/dist/helper/find-changes.test.d.ts.map +0 -1
  100. package/dist/helper/find-changes.test.js +0 -22
  101. package/dist/helper/find-changes.test.js.map +0 -1
  102. package/dist/helper/handle-ai-error.d.ts +0 -5
  103. package/dist/helper/handle-ai-error.d.ts.map +0 -1
  104. package/dist/helper/handle-ai-error.js +0 -122
  105. package/dist/helper/handle-ai-error.js.map +0 -1
  106. package/dist/helper/logger.d.ts +0 -3
  107. package/dist/helper/logger.d.ts.map +0 -1
  108. package/dist/helper/logger.js +0 -26
  109. package/dist/helper/logger.js.map +0 -1
  110. package/dist/helper/parse-progress.d.ts +0 -2
  111. package/dist/helper/parse-progress.d.ts.map +0 -1
  112. package/dist/helper/parse-progress.js +0 -28
  113. package/dist/helper/parse-progress.js.map +0 -1
  114. package/dist/helper/prompts-loader.d.ts +0 -11
  115. package/dist/helper/prompts-loader.d.ts.map +0 -1
  116. package/dist/helper/prompts-loader.js +0 -28
  117. package/dist/helper/prompts-loader.js.map +0 -1
  118. package/dist/helper/resolve-ai-tasks.d.ts +0 -42
  119. package/dist/helper/resolve-ai-tasks.d.ts.map +0 -1
  120. package/dist/helper/resolve-ai-tasks.js +0 -162
  121. package/dist/helper/resolve-ai-tasks.js.map +0 -1
@@ -1,158 +0,0 @@
1
- import { blue, cyan, green, red, spinner, yellow } from "@gaubee/nodekit";
2
- import { iter_map_not_null } from "@gaubee/util";
3
- import { execSync } from "node:child_process";
4
- import semver from "semver";
5
- import { safeEnv } from "../../env.js";
6
- const CHECK_MARK = green("✔");
7
- const CROSS_MARK = red("✖");
8
- const WARN_MARK = yellow("⚠");
9
- async function executeCommand(command) {
10
- return new Promise((resolve) => {
11
- try {
12
- const stdout = execSync(command, { encoding: "utf8", stdio: "pipe" });
13
- resolve({ stdout, stderr: "" });
14
- }
15
- catch (e) {
16
- resolve({ stdout: "", stderr: e.stderr || "", error: e });
17
- }
18
- });
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
- }
47
- export async function runDoctor(config, enableLog = true) {
48
- const LOG_TITLE = "Running Environment Doctor 🏥\n\n";
49
- const logger = spinner(LOG_TITLE);
50
- if (enableLog) {
51
- logger.start();
52
- }
53
- const results = [];
54
- let overallSuccess = true;
55
- let overallWarn = false;
56
- const tool_logs = [];
57
- for (const [index, tool] of config.entries()) {
58
- const TOOL_LOG_TITLE = `${blue(`[${tool.id}]`)} ${cyan(tool.displayName)}`;
59
- const SUCCESS_MARK = () => CHECK_MARK;
60
- const FAIL_MARK = () => {
61
- overallWarn = true;
62
- return tool.optional ? WARN_MARK : CROSS_MARK;
63
- };
64
- const setToolLog = (update) => {
65
- const log = update(tool_logs[index] ?? "");
66
- tool_logs[index] = (Array.isArray(log) ? iter_map_not_null(log, (v) => (v ? v : null)) : [log]).map((line) => " " + line).join("\n");
67
- logger.text = LOG_TITLE + tool_logs.join("\n");
68
- };
69
- setToolLog(() => `Checking ${TOOL_LOG_TITLE}... `);
70
- let tool_log = [];
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
- }
81
- }
82
- else {
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
- }
121
- }
122
- else {
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)`);
126
- }
127
- }
128
- else {
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)}`);
133
- }
134
- }
135
- else {
136
- result.meetsVersionRequirement = false;
137
- result.message = `Could not parse version from output: "${output}".`;
138
- tool_log.push(`${FAIL_MARK()} ${TOOL_LOG_TITLE}`);
139
- tool_log.push(` ${red(result.message)}`);
140
- }
141
- }
142
- }
143
- setToolLog(() => tool_log);
144
- results.push(result);
145
- if (!result.meetsVersionRequirement && !result.isOptional) {
146
- overallSuccess = false;
147
- }
148
- }
149
- const LOG_SUMMERY = `${overallSuccess ? (overallWarn ? "⚠️ " : "✅") : "💊"} JIXO Environment Doctor 🏥\n\n`;
150
- logger.stopAndPersist({
151
- text: LOG_SUMMERY + tool_logs.join("\n") + "\n",
152
- });
153
- return {
154
- overallSuccess,
155
- results,
156
- };
157
- }
158
- //# sourceMappingURL=doctor.js.map
@@ -1 +0,0 @@
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,kBAAkB,CAAC,EAAU,EAAE,WAAmB,EAAE,IAAa;IAC9E,MAAM,MAAM,GAAoB;QAC9B,EAAE;QAC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AAC;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 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=doctor.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doctor.test.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor/doctor.test.ts"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- // Example Usage (e.g., in an index.ts or app.ts)
2
- import { myDoctorConfig } from "./config.js"; // Assuming config.ts
3
- import { runDoctor } from "./doctor.js";
4
- async function main() {
5
- await runDoctor(myDoctorConfig);
6
- // console.log("\n\n--- Structured Report ---");
7
- // console.log(JSON.stringify(report, null, 2));
8
- // if (!report.overallSuccess) {
9
- // console.error(bgRed(white("\nCritical environment checks failed. Please fix the issues above before proceeding.")));
10
- // // process.exit(1); // Optionally exit if critical checks fail
11
- // }
12
- }
13
- main().catch(console.error);
14
- //# sourceMappingURL=doctor.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doctor.test.js","sourceRoot":"","sources":["../../../src/commands/doctor/doctor.test.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC,CAAC,qBAAqB;AACjE,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,CAAC,cAAc,CAAC,CAAC;IAChC,kDAAkD;IAClD,kDAAkD;IAElD,kCAAkC;IAClC,2HAA2H;IAC3H,qEAAqE;IACrE,MAAM;AACR,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["// Example Usage (e.g., in an index.ts or app.ts)\n\nimport {myDoctorConfig} from \"./config.js\"; // Assuming config.ts\nimport {runDoctor} from \"./doctor.js\";\n\nasync function main() {\n await runDoctor(myDoctorConfig);\n // console.log(\"\\n\\n--- Structured Report ---\");\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\n // }\n}\n\nmain().catch(console.error);\n"]}
@@ -1,2 +0,0 @@
1
- export declare const doctor: import("@gaubee/util").FuncRemember<(enableLog?: boolean) => Promise<import("./types.js").DoctorReport>, void | ((this: unknown, enableLog?: boolean | undefined) => any)>;
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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,8 +0,0 @@
1
- import { func_remember } from "@gaubee/util";
2
- import { myDoctorConfig } from "./config.js";
3
- import { runDoctor } from "./doctor.js";
4
- export const doctor = func_remember(async (enableLog = true) => {
5
- const report = await runDoctor(myDoctorConfig, enableLog);
6
- return report;
7
- });
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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"]}
@@ -1,45 +0,0 @@
1
- export interface ToolCheckConfig {
2
- /** A unique identifier for this check (e.g., 'pnpm', 'uvx-cli') */
3
- id: string;
4
- /** User-friendly name for display purposes (e.g., "PNPM Package Manager") */
5
- displayName: string;
6
- /** The command to execute to get the version (e.g., "pnpm --version") */
7
- versionCommand?: string;
8
- /**
9
- * A regular expression to parse the version string from the command's output.
10
- * It MUST have at least one capturing group, which should capture the version string.
11
- * Example: For "pnpm 10.11.0", regex could be /pnpm\s+([\d.]+)/ or simply /([\d.]+)/
12
- */
13
- versionParseRegex?: RegExp;
14
- /**
15
- * The minimum required version (Semantic Versioning string).
16
- * If undefined, only existence is checked.
17
- */
18
- minVersion?: string;
19
- /**
20
- * Optional: A hint or URL for installation if the tool is missing or version is too low.
21
- */
22
- installationHint?: string;
23
- /**
24
- * Optional: If true, a failure for this tool won't cause the overall doctor check to fail.
25
- * It will still be reported. Defaults to false.
26
- */
27
- optional?: boolean;
28
- }
29
- export type DoctorConfig = ToolCheckConfig[];
30
- export interface ToolCheckResult {
31
- id: string;
32
- displayName: string;
33
- exists: boolean;
34
- version?: string;
35
- requiredVersion?: string;
36
- meetsVersionRequirement: boolean;
37
- isOptional: boolean;
38
- message: string;
39
- installationHint?: string;
40
- }
41
- export interface DoctorReport {
42
- overallSuccess: boolean;
43
- results: ToolCheckResult[];
44
- }
45
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAC;IAEX,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;IAEpB,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;AAE7C,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"}
@@ -1,3 +0,0 @@
1
- // types.ts (or directly in your doctor.ts)
2
- export {};
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/doctor/types.ts"],"names":[],"mappings":"AAAA,2CAA2C","sourcesContent":["// types.ts (or directly in your doctor.ts)\n\nexport interface ToolCheckConfig {\n /** A unique identifier for this check (e.g., 'pnpm', 'uvx-cli') */\n id: string;\n\n /** User-friendly name for display purposes (e.g., \"PNPM Package Manager\") */\n displayName: string;\n\n /** The command to execute to get the version (e.g., \"pnpm --version\") */\n versionCommand?: string;\n\n /**\n * A regular expression to parse the version string from the command's output.\n * It MUST have at least one capturing group, which should capture the version string.\n * Example: For \"pnpm 10.11.0\", regex could be /pnpm\\s+([\\d.]+)/ or simply /([\\d.]+)/\n */\n versionParseRegex?: RegExp;\n\n /**\n * The minimum required version (Semantic Versioning string).\n * If undefined, only existence is checked.\n */\n minVersion?: string;\n\n /**\n * Optional: A hint or URL for installation if the tool is missing or version is too low.\n */\n installationHint?: string;\n\n /**\n * Optional: If true, a failure for this tool won't cause the overall doctor check to fail.\n * It will still be reported. Defaults to false.\n */\n optional?: boolean;\n}\n\nexport type DoctorConfig = ToolCheckConfig[];\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"]}
@@ -1,2 +0,0 @@
1
- export declare const init: (dir: string) => void;
2
- //# sourceMappingURL=init.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,GAAI,KAAK,MAAM,SA8B/B,CAAC"}
@@ -1,40 +0,0 @@
1
- import { writeText } from "@gaubee/nodekit";
2
- import { str_trim_indent } from "@gaubee/util";
3
- import fs from "node:fs";
4
- import path from "node:path";
5
- export const init = (dir) => {
6
- // Create .jixo directory
7
- const jixoDir = path.join(dir, ".jixo");
8
- fs.mkdirSync(jixoDir, { recursive: true });
9
- // Create .jixo.env file
10
- const jixoEnvFilepath = path.join(dir, ".jixo.env");
11
- if (!fs.existsSync(jixoEnvFilepath)) {
12
- writeText(jixoEnvFilepath, str_trim_indent(`
13
- # JIXO Core Service Configuration
14
- JIXO_CORE_URL=http://localhost:4111
15
- JIXO_API_KEY=
16
-
17
- # LLM Provider API Keys (to be used by jixo-core)
18
- # ANTHROPIC_API_KEY=
19
- # GOOGLE_API_KEY=
20
- # OPENAI_API_KEY=
21
- `));
22
- console.log(`✅ Created configuration template at: ${jixoEnvFilepath}`);
23
- }
24
- // Update root .gitignore
25
- const gitignoreFilepath = path.join(dir, ".gitignore");
26
- addRulesToGitIgnore(gitignoreFilepath, [".jixo.env", ".jixo/memory/"]);
27
- console.log(`✅ Updated .gitignore`);
28
- console.log("\nJIXO initialized successfully!");
29
- };
30
- const addRulesToGitIgnore = (gitignoreFilepath, rules) => {
31
- const existingRules = fs.existsSync(gitignoreFilepath) ? fs.readFileSync(gitignoreFilepath, "utf-8").split("\n") : [];
32
- let changed = false;
33
- const newRules = rules.filter((rule) => !existingRules.includes(rule));
34
- if (newRules.length > 0) {
35
- fs.appendFileSync(gitignoreFilepath, "\n# JIXO\n" + newRules.join("\n") + "\n");
36
- changed = true;
37
- }
38
- return changed;
39
- };
40
- //# sourceMappingURL=init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;IAClC,yBAAyB;IACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACxC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;IAEzC,wBAAwB;IACxB,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IACpD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACpC,SAAS,CACP,eAAe,EACf,eAAe,CAAC;;;;;;;;;OASf,CAAC,CACH,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,wCAAwC,eAAe,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,yBAAyB;IACzB,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IACvD,mBAAmB,CAAC,iBAAiB,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;IACvE,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAEpC,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,iBAAyB,EAAE,KAAe,EAAE,EAAE;IACzE,MAAM,aAAa,GAAG,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtH,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,EAAE,CAAC,cAAc,CAAC,iBAAiB,EAAE,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAChF,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {writeText} from \"@gaubee/nodekit\";\nimport {str_trim_indent} from \"@gaubee/util\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nexport const init = (dir: string) => {\n // Create .jixo directory\n const jixoDir = path.join(dir, \".jixo\");\n fs.mkdirSync(jixoDir, {recursive: true});\n\n // Create .jixo.env file\n const jixoEnvFilepath = path.join(dir, \".jixo.env\");\n if (!fs.existsSync(jixoEnvFilepath)) {\n writeText(\n jixoEnvFilepath,\n str_trim_indent(`\n # JIXO Core Service Configuration\n JIXO_CORE_URL=http://localhost:4111\n JIXO_API_KEY=\n\n # LLM Provider API Keys (to be used by jixo-core)\n # ANTHROPIC_API_KEY=\n # GOOGLE_API_KEY=\n # OPENAI_API_KEY=\n `),\n );\n console.log(`✅ Created configuration template at: ${jixoEnvFilepath}`);\n }\n\n // Update root .gitignore\n const gitignoreFilepath = path.join(dir, \".gitignore\");\n addRulesToGitIgnore(gitignoreFilepath, [\".jixo.env\", \".jixo/memory/\"]);\n console.log(`✅ Updated .gitignore`);\n\n console.log(\"\\nJIXO initialized successfully!\");\n};\n\nconst addRulesToGitIgnore = (gitignoreFilepath: string, rules: string[]) => {\n const existingRules = fs.existsSync(gitignoreFilepath) ? fs.readFileSync(gitignoreFilepath, \"utf-8\").split(\"\\n\") : [];\n let changed = false;\n const newRules = rules.filter((rule) => !existingRules.includes(rule));\n\n if (newRules.length > 0) {\n fs.appendFileSync(gitignoreFilepath, \"\\n# JIXO\\n\" + newRules.join(\"\\n\") + \"\\n\");\n changed = true;\n }\n return changed;\n};\n"]}
@@ -1,2 +0,0 @@
1
- export declare const listPrompts: () => Promise<void>;
2
- //# sourceMappingURL=list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/prompts/list.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,qBASvB,CAAC"}
@@ -1,14 +0,0 @@
1
- import { cyan, gray } from "@gaubee/nodekit";
2
- import { obj_props } from "@gaubee/util";
3
- import { getAllPromptConfigs } from "../../helper/prompts-loader.js";
4
- export const listPrompts = async () => {
5
- const configs = await getAllPromptConfigs();
6
- for (const key of obj_props(configs)) {
7
- const config = configs[key];
8
- console.log(`- ${cyan(key)}: ${gray(config.content.split("\n")[0])}...`);
9
- if (config.data.parent.length) {
10
- console.log(` parent: ${config.data.parent.map(cyan).join(", ")}`);
11
- }
12
- }
13
- };
14
- //# sourceMappingURL=list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/prompts/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AAEnE,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;IACpC,MAAM,OAAO,GAAG,MAAM,mBAAmB,EAAE,CAAC;IAC5C,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACzE,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["import {cyan, gray} from \"@gaubee/nodekit\";\nimport {obj_props} from \"@gaubee/util\";\nimport {getAllPromptConfigs} from \"../../helper/prompts-loader.js\";\n\nexport const listPrompts = async () => {\n const configs = await getAllPromptConfigs();\n for (const key of obj_props(configs)) {\n const config = configs[key];\n console.log(`- ${cyan(key)}: ${gray(config.content.split(\"\\n\")[0])}...`);\n if (config.data.parent.length) {\n console.log(` parent: ${config.data.parent.map(cyan).join(\", \")}`);\n }\n }\n};\n"]}
@@ -1,4 +0,0 @@
1
- export declare const upgradePrompts: (dir: string, options: {
2
- mirrorUrl?: string;
3
- }) => Promise<void>;
4
- //# sourceMappingURL=upgrade.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../../src/commands/prompts/upgrade.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,GAAU,KAAK,MAAM,EAAE,SAAS;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAC,kBAa9E,CAAC"}
@@ -1,17 +0,0 @@
1
- import { spinner, writeJson } from "@gaubee/nodekit";
2
- export const upgradePrompts = async (dir, options) => {
3
- // TODO 下载最新的提示词集合
4
- const mirrorUrl = options.mirrorUrl || "https://jixo.ai/jixo-prompts.json";
5
- const loading = spinner("Upgrading prompts");
6
- loading.start("Downloading...");
7
- // await delay(1000);
8
- try {
9
- const prompts = await fetch(mirrorUrl).then((res) => res.json());
10
- loading.stopAndPersist({ symbol: "✅", text: "Download completed" });
11
- writeJson(import.meta.resolve("jixo-prompts.json"), prompts);
12
- }
13
- catch (e) {
14
- loading.stopAndPersist({ symbol: "❌", text: "Download failed" });
15
- }
16
- };
17
- //# sourceMappingURL=upgrade.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../src/commands/prompts/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAEnD,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,GAAW,EAAE,OAA6B,EAAE,EAAE;IACjF,kBAAkB;IAClB,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,mCAAmC,CAAC;IAC3E,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC7C,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAChC,uBAAuB;IACvB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QACjE,OAAO,CAAC,cAAc,CAAC,EAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,oBAAoB,EAAC,CAAC,CAAC;QAClE,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,cAAc,CAAC,EAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,iBAAiB,EAAC,CAAC,CAAC;IACjE,CAAC;AACH,CAAC,CAAC","sourcesContent":["import {spinner, writeJson} from \"@gaubee/nodekit\";\n\nexport const upgradePrompts = async (dir: string, options: {mirrorUrl?: string}) => {\n // TODO 下载最新的提示词集合\n const mirrorUrl = options.mirrorUrl || \"https://jixo.ai/jixo-prompts.json\";\n const loading = spinner(\"Upgrading prompts\");\n loading.start(\"Downloading...\");\n // await delay(1000);\n try {\n const prompts = await fetch(mirrorUrl).then((res) => res.json());\n loading.stopAndPersist({symbol: \"✅\", text: \"Download completed\"});\n writeJson(import.meta.resolve(\"jixo-prompts.json\"), prompts);\n } catch (e) {\n loading.stopAndPersist({symbol: \"❌\", text: \"Download failed\"});\n }\n};\n"]}
@@ -1,22 +0,0 @@
1
- import { type Spinner } from "@gaubee/nodekit";
2
- import type { AiTask } from "../../helper/resolve-ai-tasks.js";
3
- export declare class AiTaskTui {
4
- #private;
5
- readonly ai_task: AiTask;
6
- readonly spinner: Spinner;
7
- endInfo: {
8
- prefixText: string;
9
- text: string;
10
- readonly suffixText: string;
11
- };
12
- constructor(ai_task: AiTask, spinner: Spinner);
13
- setStatus(key: string, value: string): void;
14
- getStatus(key: string): string | undefined;
15
- removeStatus(key: string): boolean;
16
- get text(): string;
17
- set text(v: string);
18
- get prefixText(): string;
19
- set prefixText(v: string);
20
- stop(): void;
21
- }
22
- //# sourceMappingURL=AiTaskTui.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AiTaskTui.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/AiTaskTui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE/D,qBAAa,SAAS;;IAYlB,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO;IAZ3B,OAAO;;;;MASF;gBAEM,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO;IAK3B,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIpC,SAAS,CAAC,GAAG,EAAE,MAAM;IAGrB,YAAY,CAAC,GAAG,EAAE,MAAM;IAOxB,IAAI,IAAI,WAEP;IACD,IAAI,IAAI,CAAC,CAAC,QAAA,EAET;IACD,IAAI,UAAU,WAEb;IACD,IAAI,UAAU,CAAC,CAAC,QAAA,EAGf;IACD,IAAI;CAGL"}
@@ -1,52 +0,0 @@
1
- import { gray } from "@gaubee/nodekit";
2
- export class AiTaskTui {
3
- ai_task;
4
- spinner;
5
- endInfo = (() => {
6
- const self = this;
7
- return {
8
- prefixText: "",
9
- text: "",
10
- get suffixText() {
11
- return `⏱️ ${gray(ms(new Date().getTime() - new Date(self.ai_task.startTime).getTime(), { long: true }))}`;
12
- },
13
- };
14
- })();
15
- constructor(ai_task, spinner) {
16
- this.ai_task = ai_task;
17
- this.spinner = spinner;
18
- this.prefixText = this.spinner.prefixText;
19
- }
20
- #status = new Map();
21
- setStatus(key, value) {
22
- this.#status.set(key, value);
23
- this.#updatePrefixText();
24
- }
25
- getStatus(key) {
26
- return this.#status.get(key);
27
- }
28
- removeStatus(key) {
29
- return this.#status.delete(key);
30
- }
31
- #prefixText = "";
32
- #updatePrefixText = () => {
33
- this.spinner.prefixText = `${[...this.#status.values()].join(" ")}\n${this.#prefixText}`;
34
- };
35
- get text() {
36
- return this.spinner.text;
37
- }
38
- set text(v) {
39
- this.spinner.text = v;
40
- }
41
- get prefixText() {
42
- return this.#prefixText;
43
- }
44
- set prefixText(v) {
45
- this.#prefixText = v;
46
- this.#updatePrefixText();
47
- }
48
- stop() {
49
- this.spinner.stopAndPersist(this.endInfo);
50
- }
51
- }
52
- //# sourceMappingURL=AiTaskTui.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AiTaskTui.js","sourceRoot":"","sources":["../../../src/commands/tasks/AiTaskTui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,MAAM,iBAAiB,CAAC;AAIrD,MAAM,OAAO,SAAS;IAYT;IACA;IAZX,OAAO,GAAG,CAAC,GAAG,EAAE;QACd,MAAM,IAAI,GAAG,IAAI,CAAC;QAClB,OAAO;YACL,UAAU,EAAE,EAAE;YACd,IAAI,EAAE,EAAE;YACR,IAAI,UAAU;gBACZ,OAAO,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;YAC9G,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,EAAE,CAAC;IACL,YACW,OAAe,EACf,OAAgB;QADhB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAS;QAEzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IAC5C,CAAC;IACD,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IACpC,SAAS,CAAC,GAAW,EAAE,KAAa;QAClC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IACD,SAAS,CAAC,GAAW;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IACD,YAAY,CAAC,GAAW;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IACD,WAAW,GAAG,EAAE,CAAC;IACjB,iBAAiB,GAAG,GAAG,EAAE;QACvB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;IAC3F,CAAC,CAAC;IACF,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IACD,IAAI,IAAI,CAAC,CAAC;QACR,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;IACxB,CAAC;IACD,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IACD,IAAI,UAAU,CAAC,CAAC;QACd,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI;QACF,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF","sourcesContent":["import { gray, type Spinner } from \"@gaubee/nodekit\";\nimport type ms from \"ms\";\nimport type { AiTask } from \"../../helper/resolve-ai-tasks.js\";\n\nexport class AiTaskTui {\n endInfo = (() => {\n const self = this;\n return {\n prefixText: \"\",\n text: \"\",\n get suffixText() {\n return `⏱️ ${gray(ms(new Date().getTime() - new Date(self.ai_task.startTime).getTime(), { long: true }))}`;\n },\n };\n })();\n constructor(\n readonly ai_task: AiTask,\n readonly spinner: Spinner\n ) {\n this.prefixText = this.spinner.prefixText;\n }\n #status = new Map<string, string>();\n setStatus(key: string, value: string) {\n this.#status.set(key, value);\n this.#updatePrefixText();\n }\n getStatus(key: string) {\n return this.#status.get(key);\n }\n removeStatus(key: string) {\n return this.#status.delete(key);\n }\n #prefixText = \"\";\n #updatePrefixText = () => {\n this.spinner.prefixText = `${[...this.#status.values()].join(\" \")}\\n${this.#prefixText}`;\n };\n get text() {\n return this.spinner.text;\n }\n set text(v) {\n this.spinner.text = v;\n }\n get prefixText() {\n return this.#prefixText;\n }\n set prefixText(v) {\n this.#prefixText = v;\n this.#updatePrefixText();\n }\n stop() {\n this.spinner.stopAndPersist(this.endInfo);\n }\n}\n"]}
@@ -1,22 +0,0 @@
1
- import { type Spinner } from "@gaubee/nodekit";
2
- import type { AiTask } from "../../helper/resolve-ai-tasks.js";
3
- export declare class AiTaskTui {
4
- #private;
5
- readonly ai_task: AiTask;
6
- readonly spinner: Spinner;
7
- endInfo: {
8
- prefixText: string;
9
- text: string;
10
- readonly suffixText: string;
11
- };
12
- constructor(ai_task: AiTask, spinner: Spinner);
13
- setStatus(key: string, value: string): void;
14
- getStatus(key: string): string | undefined;
15
- removeStatus(key: string): boolean;
16
- get text(): string;
17
- set text(v: string);
18
- get prefixText(): string;
19
- set prefixText(v: string);
20
- stop(): void;
21
- }
22
- //# sourceMappingURL=ai-tasl-tui.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-tasl-tui.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/ai-tasl-tui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,kCAAkC,CAAC;AAE7D,qBAAa,SAAS;;IAYlB,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO;IAZ3B,OAAO;;;;MASF;gBAEM,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO;IAK3B,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIpC,SAAS,CAAC,GAAG,EAAE,MAAM;IAGrB,YAAY,CAAC,GAAG,EAAE,MAAM;IAOxB,IAAI,IAAI,WAEP;IACD,IAAI,IAAI,CAAC,CAAC,QAAA,EAET;IACD,IAAI,UAAU,WAEb;IACD,IAAI,UAAU,CAAC,CAAC,QAAA,EAGf;IACD,IAAI;CAGL"}
@@ -1,53 +0,0 @@
1
- import { gray } from "@gaubee/nodekit";
2
- import ms from "ms";
3
- export class AiTaskTui {
4
- ai_task;
5
- spinner;
6
- endInfo = (() => {
7
- const self = this;
8
- return {
9
- prefixText: "",
10
- text: "",
11
- get suffixText() {
12
- return `⏱️ ${gray(ms(new Date().getTime() - new Date(self.ai_task.startTime).getTime(), { long: true }))}`;
13
- },
14
- };
15
- })();
16
- constructor(ai_task, spinner) {
17
- this.ai_task = ai_task;
18
- this.spinner = spinner;
19
- this.prefixText = this.spinner.prefixText;
20
- }
21
- #status = new Map();
22
- setStatus(key, value) {
23
- this.#status.set(key, value);
24
- this.#updatePrefixText();
25
- }
26
- getStatus(key) {
27
- return this.#status.get(key);
28
- }
29
- removeStatus(key) {
30
- return this.#status.delete(key);
31
- }
32
- #prefixText = "";
33
- #updatePrefixText = () => {
34
- this.spinner.prefixText = `${[...this.#status.values()].join(" ")}\n${this.#prefixText}`;
35
- };
36
- get text() {
37
- return this.spinner.text;
38
- }
39
- set text(v) {
40
- this.spinner.text = v;
41
- }
42
- get prefixText() {
43
- return this.#prefixText;
44
- }
45
- set prefixText(v) {
46
- this.#prefixText = v;
47
- this.#updatePrefixText();
48
- }
49
- stop() {
50
- this.spinner.stopAndPersist(this.endInfo);
51
- }
52
- }
53
- //# sourceMappingURL=ai-tasl-tui.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-tasl-tui.js","sourceRoot":"","sources":["../../../src/commands/tasks/ai-tasl-tui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAe,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB,MAAM,OAAO,SAAS;IAYT;IACA;IAZX,OAAO,GAAG,CAAC,GAAG,EAAE;QACd,MAAM,IAAI,GAAG,IAAI,CAAC;QAClB,OAAO;YACL,UAAU,EAAE,EAAE;YACd,IAAI,EAAE,EAAE;YACR,IAAI,UAAU;gBACZ,OAAO,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC,EAAE,CAAC;YAC5G,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,EAAE,CAAC;IACL,YACW,OAAe,EACf,OAAgB;QADhB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAS;QAEzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IAC5C,CAAC;IACD,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IACpC,SAAS,CAAC,GAAW,EAAE,KAAa;QAClC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IACD,SAAS,CAAC,GAAW;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IACD,YAAY,CAAC,GAAW;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IACD,WAAW,GAAG,EAAE,CAAC;IACjB,iBAAiB,GAAG,GAAG,EAAE;QACvB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;IAC3F,CAAC,CAAC;IACF,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IACD,IAAI,IAAI,CAAC,CAAC;QACR,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;IACxB,CAAC;IACD,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IACD,IAAI,UAAU,CAAC,CAAC;QACd,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI;QACF,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF","sourcesContent":["import {gray, type Spinner} from \"@gaubee/nodekit\";\nimport ms from \"ms\";\nimport type {AiTask} from \"../../helper/resolve-ai-tasks.js\";\n\nexport class AiTaskTui {\n endInfo = (() => {\n const self = this;\n return {\n prefixText: \"\",\n text: \"\",\n get suffixText() {\n return `⏱️ ${gray(ms(new Date().getTime() - new Date(self.ai_task.startTime).getTime(), {long: true}))}`;\n },\n };\n })();\n constructor(\n readonly ai_task: AiTask,\n readonly spinner: Spinner,\n ) {\n this.prefixText = this.spinner.prefixText;\n }\n #status = new Map<string, string>();\n setStatus(key: string, value: string) {\n this.#status.set(key, value);\n this.#updatePrefixText();\n }\n getStatus(key: string) {\n return this.#status.get(key);\n }\n removeStatus(key: string) {\n return this.#status.delete(key);\n }\n #prefixText = \"\";\n #updatePrefixText = () => {\n this.spinner.prefixText = `${[...this.#status.values()].join(\" \")}\\n${this.#prefixText}`;\n };\n get text() {\n return this.spinner.text;\n }\n set text(v) {\n this.spinner.text = v;\n }\n get prefixText() {\n return this.#prefixText;\n }\n set prefixText(v) {\n this.#prefixText = v;\n this.#updatePrefixText();\n }\n stop() {\n this.spinner.stopAndPersist(this.endInfo);\n }\n}\n"]}