@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
@@ -1,125 +0,0 @@
1
- // doctor.ts
2
- import { blue, cyan, green, red, spinner, yellow } from "@gaubee/nodekit";
3
- import { execSync } from "node:child_process";
4
- import semver from "semver";
5
- import { iter_map_not_null } from "@gaubee/util";
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
- export async function runDoctor(config, enableLog = true) {
21
- const LOG_TITLE = "Running Environment Doctor 🏥\n\n";
22
- const logger = spinner(LOG_TITLE);
23
- if (enableLog) {
24
- logger.start();
25
- }
26
- const results = [];
27
- let overallSuccess = true;
28
- let overallWarn = false;
29
- const tool_logs = [];
30
- for (const [index, tool] of config.entries()) {
31
- const TOOL_LOG_TITLE = `${blue(`[${tool.id}]`)} ${cyan(tool.displayName)}`;
32
- const SUCCESS_MARK = () => CHECK_MARK;
33
- const FAIL_MARK = () => {
34
- overallWarn = true;
35
- return tool.optional ? WARN_MARK : CROSS_MARK;
36
- };
37
- const setToolLog = (update) => {
38
- const log = update(tool_logs[index] ?? "");
39
- tool_logs[index] = (Array.isArray(log) ? iter_map_not_null(log, (v) => (v ? v : null)) : [log]).map((line) => " " + line).join("\n");
40
- logger.text = LOG_TITLE + tool_logs.join("\n");
41
- };
42
- setToolLog(() => `Checking ${TOOL_LOG_TITLE}... `);
43
- 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
- ];
64
- }
65
- 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})`);
77
- }
78
- 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
- }
86
- }
87
- }
88
- 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)`);
93
- }
94
- }
95
- else {
96
- // Regex matched but couldn't clean version (should be rare with semver.clean)
97
- result.meetsVersionRequirement = false;
98
- result.message = `Could not parse a valid version string from output: "${output}". Regex: ${tool.versionParseRegex}`;
99
- tool_log.push(`${FAIL_MARK()} ${TOOL_LOG_TITLE}`);
100
- tool_log.push(` ${red(result.message)}`);
101
- }
102
- }
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
- }
110
- setToolLog(() => tool_log);
111
- results.push(result);
112
- if (!result.meetsVersionRequirement && !result.isOptional) {
113
- overallSuccess = false;
114
- }
115
- }
116
- const LOG_SUMMERY = `${overallSuccess ? (overallWarn ? "⚠️ " : "✅") : "💊"} JIXO Environment Doctor 🏥\n\n`;
117
- logger.stopAndPersist({
118
- text: LOG_SUMMERY + tool_logs.join("\n") + "\n",
119
- });
120
- return {
121
- overallSuccess,
122
- results,
123
- };
124
- }
125
- //# sourceMappingURL=doctor.js.map
@@ -1 +0,0 @@
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,E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M,CAAC,OAAO,GAAG,yCAAyC,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,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("./doctor.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":"AAKA,eAAO,MAAM,MAAM,mDAAmC,OAAO,mHAe3D,CAAC"}
@@ -1,19 +0,0 @@
1
- // import {bgGreen, bgRed, black, white} from "@gaubee/nodekit"; // For the final message
2
- import { func_remember } from "@gaubee/util";
3
- import { myDoctorConfig } from "./config.js";
4
- import { runDoctor } from "./doctor.js";
5
- export const doctor = func_remember(async (enableLog = true) => {
6
- 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
- return report;
18
- });
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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,30 +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
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor/types.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAC;IAEX,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;IAEpB,yEAAyE;IACzE,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;;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"}
@@ -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":"AACA,2CAA2C","sourcesContent":["\n// 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"]}
@@ -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":"AAMA,eAAO,MAAM,IAAI,GAAI,KAAK,MAAM,SAkD/B,CAAC"}
@@ -1,63 +0,0 @@
1
- import { writeJson, writeMarkdown, 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
- import { safeEnv } from "../env.js";
6
- export const init = (dir) => {
7
- {
8
- const jixoDirname = path.join(dir, ".jixo");
9
- /// 创建 .jixo 目录
10
- fs.mkdirSync(jixoDirname, { recursive: true });
11
- /// .jixo/readme.job.md
12
- const readmeTaskFilepath = path.join(jixoDirname, "readme.job.md");
13
- if (!fs.existsSync(readmeTaskFilepath)) {
14
- writeMarkdown(readmeTaskFilepath, str_trim_indent(`
15
- <!-- 您可以自定义 readme.md 文件的格式 -->
16
- 请JIXO帮我生成或者追加 README 文件
17
- `), {
18
- agents: ["readme-writer"],
19
- });
20
- }
21
- /// .jixo/.gitignore
22
- const gitignoreFilepath = path.join(jixoDirname, ".gitignore");
23
- addRulesToGitIgnore(gitignoreFilepath, ["*.log.jsonl", "*.log.jsonl.txt"]);
24
- }
25
- /// jixo.config.json
26
- {
27
- const jixoConfigFilepath = path.join(dir, "jixo.config.json");
28
- if (!fs.existsSync(jixoConfigFilepath)) {
29
- writeJson(jixoConfigFilepath, {
30
- tasks: { type: "dir", dirname: ".jixo" },
31
- });
32
- }
33
- }
34
- /// .jixo.env
35
- {
36
- const jixoEnvFilepath = path.join(dir, ".jixo.env");
37
- if (!fs.existsSync(jixoEnvFilepath)) {
38
- writeText(jixoEnvFilepath, Object.keys(safeEnv)
39
- .filter((key) => key.startsWith("JIXO_"))
40
- .map((key) => `${key}=""`)
41
- .join("\n"));
42
- }
43
- }
44
- /// .gitignore
45
- {
46
- const gitignoreFilepath = path.join(dir, ".gitignore");
47
- addRulesToGitIgnore(gitignoreFilepath, ["*.memory.json", "memory.json", ".jixo.env"]);
48
- }
49
- };
50
- const addRulesToGitIgnore = (gitignoreFilepath, rules) => {
51
- const gitignoreLines = (fs.existsSync(gitignoreFilepath) ? fs.readFileSync(gitignoreFilepath, "utf-8") : "").split(/\n+/);
52
- let changed = false;
53
- for (const line of rules) {
54
- if (!gitignoreLines.includes(line)) {
55
- gitignoreLines.unshift(line);
56
- changed = true;
57
- }
58
- }
59
- if (changed) {
60
- fs.writeFileSync(gitignoreFilepath, gitignoreLines.join("\n"));
61
- }
62
- };
63
- //# 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,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;IAClC,CAAC;QACC,MAAM,WAAW,GAAG,IAAI,C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G,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;iBACxC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC;iBACzB,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;QACJ,CAAC;IACH,CAAC;IACD,cAAc;IACd,CAAC;QACC,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QACvD,mBAAmB,CAAC,iBAAiB,EAAE,CAAC,eAAe,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;IACxF,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,iBAAyB,EAAE,KAAe,EAAE,EAAE;IACzE,MAAM,cAAc,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1H,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC7B,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC;IACD,IAAI,OAAO,EAAE,CAAC;QACZ,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC;AACH,CAAC,CAAC","sourcesContent":["import {writeJson, writeMarkdown, writeText} from \"@gaubee/nodekit\";\nimport {str_trim_indent} from \"@gaubee/util\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type {JixoConfig} from \"../config.js\";\nimport {safeEnv} from \"../env.js\";\nexport const init = (dir: string) => {\n {\n const jixoDirname = path.join(dir, \".jixo\");\n /// 创建 .jixo 目录\n fs.mkdirSync(jixoDirname, {recursive: true});\n /// .jixo/readme.job.md\n const readmeTaskFilepath = path.join(jixoDirname, \"readme.job.md\");\n if (!fs.existsSync(readmeTaskFilepath)) {\n writeMarkdown(\n readmeTaskFilepath,\n str_trim_indent(`\n <!-- 您可以自定义 readme.md 文件的格式 -->\n 请JIXO帮我生成或者追加 README 文件\n `),\n {\n agents: [\"readme-writer\"],\n },\n );\n }\n /// .jixo/.gitignore\n const gitignoreFilepath = path.join(jixoDirname, \".gitignore\");\n addRulesToGitIgnore(gitignoreFilepath, [\"*.log.jsonl\", \"*.log.jsonl.txt\"]);\n }\n /// jixo.config.json\n {\n const jixoConfigFilepath = path.join(dir, \"jixo.config.json\");\n if (!fs.existsSync(jixoConfigFilepath)) {\n writeJson(jixoConfigFilepath, {\n tasks: {type: \"dir\", dirname: \".jixo\"},\n } satisfies JixoConfig);\n }\n }\n /// .jixo.env\n {\n const jixoEnvFilepath = path.join(dir, \".jixo.env\");\n if (!fs.existsSync(jixoEnvFilepath)) {\n writeText(\n jixoEnvFilepath,\n Object.keys(safeEnv)\n .filter((key) => key.startsWith(\"JIXO_\"))\n .map((key) => `${key}=\"\"`)\n .join(\"\\n\"),\n );\n }\n }\n /// .gitignore\n {\n const gitignoreFilepath = path.join(dir, \".gitignore\");\n addRulesToGitIgnore(gitignoreFilepath, [\"*.memory.json\", \"memory.json\", \".jixo.env\"]);\n }\n};\n\nconst addRulesToGitIgnore = (gitignoreFilepath: string, rules: string[]) => {\n const gitignoreLines = (fs.existsSync(gitignoreFilepath) ? fs.readFileSync(gitignoreFilepath, \"utf-8\") : \"\").split(/\\n+/);\n let changed = false;\n for (const line of rules) {\n if (!gitignoreLines.includes(line)) {\n gitignoreLines.unshift(line);\n changed = true;\n }\n }\n if (changed) {\n fs.writeFileSync(gitignoreFilepath, gitignoreLines.join(\"\\n\"));\n }\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,IAA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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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ubee/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"]}