aiupdate 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +13 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -50,14 +50,14 @@ function selectTools(targetArgs) {
|
|
|
50
50
|
}
|
|
51
51
|
async function run(targetArgs, executor = async (cmd, args) => {
|
|
52
52
|
await execa(cmd, args);
|
|
53
|
-
}, checker = defaultChecker, versioner = getVersion) {
|
|
53
|
+
}, checker = defaultChecker, versioner = getVersion, logger = (message) => console.error(message)) {
|
|
54
54
|
const { selectedAITools, includeSkills } = selectTools(targetArgs);
|
|
55
55
|
const toolsToCheck = includeSkills ? [...selectedAITools, SKILLS_TASK] : selectedAITools;
|
|
56
56
|
const checks = await Promise.all(
|
|
57
57
|
toolsToCheck.map(async (t) => ({ tool: t, installed: await checker(t.command) }))
|
|
58
58
|
);
|
|
59
59
|
const allTools = checks.filter((c) => c.installed).map((c) => c.tool);
|
|
60
|
-
|
|
60
|
+
const failures = [];
|
|
61
61
|
const runner = new Listr(
|
|
62
62
|
allTools.map((tool) => ({
|
|
63
63
|
title: tool.name,
|
|
@@ -66,9 +66,10 @@ async function run(targetArgs, executor = async (cmd, args) => {
|
|
|
66
66
|
try {
|
|
67
67
|
await executor(tool.command, tool.args);
|
|
68
68
|
} catch (err) {
|
|
69
|
-
hasFailures = true;
|
|
70
69
|
const e = err;
|
|
71
|
-
|
|
70
|
+
const message = e.stderr || e.shortMessage || String(e);
|
|
71
|
+
failures.push({ name: tool.name, message });
|
|
72
|
+
throw new Error(message);
|
|
72
73
|
}
|
|
73
74
|
if (before) {
|
|
74
75
|
const after = await versioner(tool.command);
|
|
@@ -80,7 +81,14 @@ async function run(targetArgs, executor = async (cmd, args) => {
|
|
|
80
81
|
);
|
|
81
82
|
await runner.run().catch(() => {
|
|
82
83
|
});
|
|
83
|
-
|
|
84
|
+
if (failures.length > 0) {
|
|
85
|
+
logger("");
|
|
86
|
+
logger(`Errors (${failures.length}):`);
|
|
87
|
+
for (const failure of failures) {
|
|
88
|
+
logger(` - ${failure.name}: ${failure.message}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return failures.length === 0;
|
|
84
92
|
}
|
|
85
93
|
if (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) {
|
|
86
94
|
const success = await run(process.argv.slice(2));
|