@dosu/cli 0.32.0 → 0.32.1
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/bin/dosu.js +42 -3
- package/package.json +1 -1
package/bin/dosu.js
CHANGED
|
@@ -4577,7 +4577,7 @@ var init_dist4 = __esm(() => {
|
|
|
4577
4577
|
function getVersionString() {
|
|
4578
4578
|
return `v${VERSION}`;
|
|
4579
4579
|
}
|
|
4580
|
-
var VERSION = "0.32.
|
|
4580
|
+
var VERSION = "0.32.1", INSTALL_CHANNEL = "npm";
|
|
4581
4581
|
|
|
4582
4582
|
// src/debug/logger.ts
|
|
4583
4583
|
import {
|
|
@@ -16066,9 +16066,35 @@ function isHookEntrypointInvocation(argv) {
|
|
|
16066
16066
|
const i2 = argv.indexOf("hooks");
|
|
16067
16067
|
return i2 >= 0 && HOOK_ENTRYPOINTS.has(argv[i2 + 1] ?? "");
|
|
16068
16068
|
}
|
|
16069
|
+
function suggestClosestCommand(input, program2) {
|
|
16070
|
+
let best;
|
|
16071
|
+
let bestDistance = Infinity;
|
|
16072
|
+
const candidates = ["help", ...program2.commands.flatMap((c3) => [c3.name(), ...c3.aliases()])];
|
|
16073
|
+
for (const name of candidates) {
|
|
16074
|
+
const d = editDistance2(input.toLowerCase(), name.toLowerCase());
|
|
16075
|
+
if (d < bestDistance) {
|
|
16076
|
+
bestDistance = d;
|
|
16077
|
+
best = name;
|
|
16078
|
+
}
|
|
16079
|
+
}
|
|
16080
|
+
return best !== undefined && bestDistance <= 3 && bestDistance < best.length ? best : undefined;
|
|
16081
|
+
}
|
|
16082
|
+
function editDistance2(a3, b2) {
|
|
16083
|
+
const prev = Array.from({ length: b2.length + 1 }, (_2, i2) => i2);
|
|
16084
|
+
for (let i2 = 1;i2 <= a3.length; i2++) {
|
|
16085
|
+
let diag = prev[0];
|
|
16086
|
+
prev[0] = i2;
|
|
16087
|
+
for (let j = 1;j <= b2.length; j++) {
|
|
16088
|
+
const tmp = prev[j];
|
|
16089
|
+
prev[j] = Math.min(prev[j] + 1, prev[j - 1] + 1, diag + (a3[i2 - 1] === b2[j - 1] ? 0 : 1));
|
|
16090
|
+
diag = tmp;
|
|
16091
|
+
}
|
|
16092
|
+
}
|
|
16093
|
+
return prev[b2.length];
|
|
16094
|
+
}
|
|
16069
16095
|
function createProgram() {
|
|
16070
16096
|
const program2 = new Command;
|
|
16071
|
-
program2.name("dosu").description("Dosu CLI - Manage MCP servers for AI tools").version(getVersionString(), "-v, --version").option("--debug", "Enable debug logging to stderr", false).hook("preAction", (thisCommand) => {
|
|
16097
|
+
program2.name("dosu").description("Dosu CLI - Manage MCP servers for AI tools").version(getVersionString(), "-v, --version").helpCommand("help [command]", "Show help for a command").option("--debug", "Enable debug logging to stderr", false).hook("preAction", (thisCommand) => {
|
|
16072
16098
|
const opts = thisCommand.optsWithGlobals();
|
|
16073
16099
|
logger.init({ debug: opts.debug });
|
|
16074
16100
|
if (!isHookEntrypointInvocation(process.argv)) {
|
|
@@ -16076,7 +16102,20 @@ function createProgram() {
|
|
|
16076
16102
|
checkForSkillUpdates();
|
|
16077
16103
|
checkForReadyTasks();
|
|
16078
16104
|
}
|
|
16079
|
-
}).action(async () => {
|
|
16105
|
+
}).allowExcessArguments(true).action(async () => {
|
|
16106
|
+
const command = program2.args[0];
|
|
16107
|
+
if (command !== undefined) {
|
|
16108
|
+
let message = `error: unknown command '${command}'`;
|
|
16109
|
+
const suggestion = suggestClosestCommand(command, program2);
|
|
16110
|
+
if (suggestion)
|
|
16111
|
+
message += `
|
|
16112
|
+
(Did you mean '${suggestion}'?)`;
|
|
16113
|
+
message += `
|
|
16114
|
+
Run 'dosu --help' to see available commands.`;
|
|
16115
|
+
console.error(message);
|
|
16116
|
+
process.exitCode = 1;
|
|
16117
|
+
return;
|
|
16118
|
+
}
|
|
16080
16119
|
const { runTUI: runTUI2 } = await Promise.resolve().then(() => (init_tui(), exports_tui));
|
|
16081
16120
|
await runTUI2();
|
|
16082
16121
|
});
|