ai-todo-cli 0.1.0 → 0.1.2
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/index.js +14 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -263,18 +263,21 @@ program.command("whoami").description("Show current authenticated user").action(
|
|
|
263
263
|
}));
|
|
264
264
|
});
|
|
265
265
|
async function main() {
|
|
266
|
-
const authCommands = ["login", "logout", "whoami", "help", "--help", "-h", "--version", "-V"];
|
|
267
266
|
const firstArg = process.argv[2];
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
267
|
+
const skipCommands = ["login", "logout", "whoami"];
|
|
268
|
+
const isVersionFlag = firstArg === "--version" || firstArg === "-V";
|
|
269
|
+
const isBuiltinCommand = firstArg !== void 0 && skipCommands.includes(firstArg);
|
|
270
|
+
if (!isVersionFlag && !isBuiltinCommand) {
|
|
271
|
+
try {
|
|
272
|
+
const manifest = await fetchManifest();
|
|
273
|
+
registerDynamicCommands(program, manifest.operations);
|
|
274
|
+
} catch {
|
|
275
|
+
const isHelpOrEmpty = !firstArg || ["help", "--help", "-h"].includes(firstArg);
|
|
276
|
+
if (!isHelpOrEmpty) {
|
|
277
|
+
console.log(JSON.stringify({ error: "Failed to load commands from server" }));
|
|
278
|
+
process.exit(1);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
278
281
|
}
|
|
279
282
|
await program.parseAsync(process.argv);
|
|
280
283
|
}
|