@dosu/cli 0.14.0 → 0.14.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 +29 -105
- package/package.json +1 -1
package/bin/dosu.js
CHANGED
|
@@ -4341,7 +4341,7 @@ function getSupabaseAnonKey() {
|
|
|
4341
4341
|
function getVersionString() {
|
|
4342
4342
|
return `v${VERSION}`;
|
|
4343
4343
|
}
|
|
4344
|
-
var VERSION = "0.14.
|
|
4344
|
+
var VERSION = "0.14.1";
|
|
4345
4345
|
|
|
4346
4346
|
// src/debug/logger.ts
|
|
4347
4347
|
import {
|
|
@@ -9865,7 +9865,7 @@ var exports_flow = {};
|
|
|
9865
9865
|
__export(exports_flow, {
|
|
9866
9866
|
startOAuthFlow: () => startOAuthFlow
|
|
9867
9867
|
});
|
|
9868
|
-
async function startOAuthFlow(signal, path2 = "/cli/auth", params = {}
|
|
9868
|
+
async function startOAuthFlow(signal, path2 = "/cli/auth", params = {}) {
|
|
9869
9869
|
const { server, tokenPromise } = await startCallbackServer();
|
|
9870
9870
|
let timeoutId;
|
|
9871
9871
|
try {
|
|
@@ -9873,12 +9873,9 @@ async function startOAuthFlow(signal, path2 = "/cli/auth", params = {}, opts = {
|
|
|
9873
9873
|
logger.debug("auth.flow", `Callback URL: ${callbackURL}`);
|
|
9874
9874
|
const authURL = buildAuthURL(callbackURL, path2, params);
|
|
9875
9875
|
logger.info("auth.flow", `Auth URL: ${authURL}`);
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
await open2.default(authURL);
|
|
9880
|
-
logger.info("auth.flow", "Browser open command executed");
|
|
9881
|
-
}
|
|
9876
|
+
const open2 = await Promise.resolve().then(() => (init_open(), exports_open));
|
|
9877
|
+
await open2.default(authURL);
|
|
9878
|
+
logger.info("auth.flow", "Browser open command executed");
|
|
9882
9879
|
const timeout = new Promise((_3, reject) => {
|
|
9883
9880
|
timeoutId = setTimeout(() => {
|
|
9884
9881
|
logger.warn("auth.flow", "Authentication timed out (8min)");
|
|
@@ -9938,7 +9935,7 @@ async function runSetup(opts = {}) {
|
|
|
9938
9935
|
cfg.mode = undefined;
|
|
9939
9936
|
saveConfig(cfg);
|
|
9940
9937
|
}
|
|
9941
|
-
const authedCfg = await stepAuthenticate(cfg, onboardingRunID
|
|
9938
|
+
const authedCfg = await stepAuthenticate(cfg, onboardingRunID);
|
|
9942
9939
|
if (!authedCfg)
|
|
9943
9940
|
return;
|
|
9944
9941
|
cfg = authedCfg;
|
|
@@ -9988,8 +9985,7 @@ async function runSetup(opts = {}) {
|
|
|
9988
9985
|
cfg.api_key = apiKey;
|
|
9989
9986
|
saveConfig(cfg);
|
|
9990
9987
|
const choices = await stepOneShotConfirm({
|
|
9991
|
-
includeGitHub: cloudSetupContext?.kind === "onboarding"
|
|
9992
|
-
setupOptions: opts
|
|
9988
|
+
includeGitHub: cloudSetupContext?.kind === "onboarding"
|
|
9993
9989
|
});
|
|
9994
9990
|
if (!choices) {
|
|
9995
9991
|
await trackCliOnboardingEvent(cfg, onboardingRunID, "cli_onboarding_cancelled", {
|
|
@@ -10007,7 +10003,7 @@ async function runSetup(opts = {}) {
|
|
|
10007
10003
|
let skillCompleted = false;
|
|
10008
10004
|
let docsImported = false;
|
|
10009
10005
|
if (choices.configureMcp) {
|
|
10010
|
-
const configured = await stepConfigureMcpTools(cfg
|
|
10006
|
+
const configured = await stepConfigureMcpTools(cfg);
|
|
10011
10007
|
if (configured === null) {
|
|
10012
10008
|
await trackCliOnboardingEvent(cfg, onboardingRunID, "cli_onboarding_cancelled", {
|
|
10013
10009
|
reason: "mcp_selection_cancelled"
|
|
@@ -10130,13 +10126,6 @@ function applyModeOverride(cfg, opts) {
|
|
|
10130
10126
|
saveConfig(cfg);
|
|
10131
10127
|
}
|
|
10132
10128
|
async function stepOneShotConfirm(opts) {
|
|
10133
|
-
if (opts.setupOptions?.yes) {
|
|
10134
|
-
return {
|
|
10135
|
-
configureMcp: !opts.setupOptions.skipMcp,
|
|
10136
|
-
installSkill: !opts.setupOptions.skipSkill,
|
|
10137
|
-
connectGitHub: opts.includeGitHub && !opts.setupOptions.skipGitHub
|
|
10138
|
-
};
|
|
10139
|
-
}
|
|
10140
10129
|
const items = [
|
|
10141
10130
|
{ value: "configureMcp", label: "Install Dosu MCP" },
|
|
10142
10131
|
{ value: "installSkill", label: "Install Dosu skill" }
|
|
@@ -10164,15 +10153,7 @@ async function stepOneShotConfirm(opts) {
|
|
|
10164
10153
|
connectGitHub: chosen.has("connectGitHub")
|
|
10165
10154
|
};
|
|
10166
10155
|
}
|
|
10167
|
-
async function stepConfigureMcpTools(cfg
|
|
10168
|
-
if (requestedToolIDs && requestedToolIDs.length > 0) {
|
|
10169
|
-
const selection2 = selectRequestedTools(requestedToolIDs);
|
|
10170
|
-
if (!selection2)
|
|
10171
|
-
return null;
|
|
10172
|
-
const results2 = stepConfigureTools(cfg, selection2);
|
|
10173
|
-
stepShowSummary(results2);
|
|
10174
|
-
return results2;
|
|
10175
|
-
}
|
|
10156
|
+
async function stepConfigureMcpTools(cfg) {
|
|
10176
10157
|
const detected = stepDetectTools();
|
|
10177
10158
|
if (detected.length === 0) {
|
|
10178
10159
|
M2.warn(`No supported AI agents detected on your system.
|
|
@@ -10204,7 +10185,7 @@ async function runInstallSkill() {
|
|
|
10204
10185
|
return false;
|
|
10205
10186
|
}
|
|
10206
10187
|
}
|
|
10207
|
-
async function stepAuthenticate(existingCfg, onboardingRunID
|
|
10188
|
+
async function stepAuthenticate(existingCfg, onboardingRunID) {
|
|
10208
10189
|
logger.info("setup", "Step: authenticate");
|
|
10209
10190
|
const cfg = existingCfg ?? loadConfig();
|
|
10210
10191
|
if (cfg.access_token) {
|
|
@@ -10234,36 +10215,26 @@ async function stepAuthenticate(existingCfg, onboardingRunID, opts = {}) {
|
|
|
10234
10215
|
s.stop("Session verification failed");
|
|
10235
10216
|
}
|
|
10236
10217
|
}
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
if (
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
});
|
|
10244
|
-
}
|
|
10245
|
-
return null;
|
|
10218
|
+
const shouldLogin = await ye({ message: "Open browser to log in?" });
|
|
10219
|
+
if (pD(shouldLogin) || !shouldLogin) {
|
|
10220
|
+
if (onboardingRunID) {
|
|
10221
|
+
await trackCliOnboardingPreAuthEvent(onboardingRunID, "cli_onboarding_auth_cancelled", {
|
|
10222
|
+
reason: pD(shouldLogin) ? "prompt_cancelled" : "login_declined"
|
|
10223
|
+
});
|
|
10246
10224
|
}
|
|
10225
|
+
return null;
|
|
10247
10226
|
}
|
|
10248
10227
|
if (onboardingRunID) {
|
|
10249
10228
|
await trackCliOnboardingPreAuthEvent(onboardingRunID, "cli_onboarding_auth_started");
|
|
10250
10229
|
}
|
|
10251
|
-
return await openBrowserForSetup(cfg, onboardingRunID
|
|
10230
|
+
return await openBrowserForSetup(cfg, onboardingRunID);
|
|
10252
10231
|
}
|
|
10253
|
-
async function openBrowserForSetup(cfg, onboardingRunID
|
|
10232
|
+
async function openBrowserForSetup(cfg, onboardingRunID) {
|
|
10254
10233
|
try {
|
|
10255
10234
|
const { startOAuthFlow: startOAuthFlow2 } = await Promise.resolve().then(() => (init_flow(), exports_flow));
|
|
10256
10235
|
const s = Y2();
|
|
10257
10236
|
s.start("Waiting for authentication...");
|
|
10258
|
-
const token = await startOAuthFlow2(undefined, "/cli/auth", onboardingRunID ? { onboarding_run_id: onboardingRunID } : {}
|
|
10259
|
-
openBrowser: opts.openBrowser !== false,
|
|
10260
|
-
onAuthURL: opts.openBrowser === false ? (url) => {
|
|
10261
|
-
M2.info(`Open this URL to authenticate:
|
|
10262
|
-
${url}
|
|
10263
|
-
|
|
10264
|
-
Waiting for login to complete...`);
|
|
10265
|
-
} : undefined
|
|
10266
|
-
});
|
|
10237
|
+
const token = await startOAuthFlow2(undefined, "/cli/auth", onboardingRunID ? { onboarding_run_id: onboardingRunID } : {});
|
|
10267
10238
|
s.stop("Authenticated");
|
|
10268
10239
|
logger.info("setup", "Browser auth completed");
|
|
10269
10240
|
cfg.access_token = token.access_token;
|
|
@@ -10372,10 +10343,10 @@ async function resolveDeployment(apiClient, cfg, opts) {
|
|
|
10372
10343
|
}
|
|
10373
10344
|
return true;
|
|
10374
10345
|
}
|
|
10375
|
-
const org = await stepSelectOrg(apiClient
|
|
10346
|
+
const org = await stepSelectOrg(apiClient);
|
|
10376
10347
|
if (!org)
|
|
10377
10348
|
return false;
|
|
10378
|
-
const d3 = await stepSelectDeployment(apiClient, org
|
|
10349
|
+
const d3 = await stepSelectDeployment(apiClient, org);
|
|
10379
10350
|
if (!d3)
|
|
10380
10351
|
return false;
|
|
10381
10352
|
cfg.mode = undefined;
|
|
@@ -10389,7 +10360,7 @@ async function fetchDeployments(apiClient) {
|
|
|
10389
10360
|
return [];
|
|
10390
10361
|
}
|
|
10391
10362
|
}
|
|
10392
|
-
async function stepSelectOrg(apiClient
|
|
10363
|
+
async function stepSelectOrg(apiClient) {
|
|
10393
10364
|
try {
|
|
10394
10365
|
const orgs = await apiClient.getOrgs();
|
|
10395
10366
|
if (orgs.length === 0) {
|
|
@@ -10402,10 +10373,6 @@ async function stepSelectOrg(apiClient, noPrompt = false) {
|
|
|
10402
10373
|
${dim(orgs[0].name)}`);
|
|
10403
10374
|
return orgs[0];
|
|
10404
10375
|
}
|
|
10405
|
-
if (noPrompt) {
|
|
10406
|
-
M2.error("Multiple organizations found. Run `dosu deployments list --json`, choose a deployment, then re-run setup with `--deployment <id>`.");
|
|
10407
|
-
return null;
|
|
10408
|
-
}
|
|
10409
10376
|
const selected = await ve({
|
|
10410
10377
|
message: "Select an organization",
|
|
10411
10378
|
options: orgs.map((o2) => ({ label: o2.name, value: o2.org_id }))
|
|
@@ -10443,7 +10410,7 @@ ${dim(d3.name)}`);
|
|
|
10443
10410
|
return null;
|
|
10444
10411
|
}
|
|
10445
10412
|
}
|
|
10446
|
-
async function stepSelectDeployment(apiClient, org
|
|
10413
|
+
async function stepSelectDeployment(apiClient, org) {
|
|
10447
10414
|
try {
|
|
10448
10415
|
const allDeployments = await apiClient.getDeployments();
|
|
10449
10416
|
const deployments = allDeployments.filter((d4) => d4.org_id === org.org_id);
|
|
@@ -10457,10 +10424,6 @@ async function stepSelectDeployment(apiClient, org, noPrompt = false) {
|
|
|
10457
10424
|
${dim(deployments[0].name)}`);
|
|
10458
10425
|
return deployments[0];
|
|
10459
10426
|
}
|
|
10460
|
-
if (noPrompt) {
|
|
10461
|
-
M2.error("Multiple MCPs found. Run `dosu deployments list --json`, choose one, then re-run setup with `--deployment <id>`.");
|
|
10462
|
-
return null;
|
|
10463
|
-
}
|
|
10464
10427
|
const selected = await ve({
|
|
10465
10428
|
message: "Select an MCP",
|
|
10466
10429
|
options: deployments.map((d4) => ({ label: d4.name, value: d4.deployment_id }))
|
|
@@ -10508,24 +10471,6 @@ function isStdioOnly(p2) {
|
|
|
10508
10471
|
function stepDetectTools() {
|
|
10509
10472
|
return allSetupProviders().filter((p2) => p2.isInstalled() && !isStdioOnly(p2));
|
|
10510
10473
|
}
|
|
10511
|
-
function selectRequestedTools(requestedToolIDs) {
|
|
10512
|
-
const normalized = [...new Set(requestedToolIDs.map((id) => id.toLowerCase()))];
|
|
10513
|
-
const providers = allSetupProviders();
|
|
10514
|
-
const selected = [];
|
|
10515
|
-
for (const id of normalized) {
|
|
10516
|
-
const provider = providers.find((p2) => p2.id() === id);
|
|
10517
|
-
if (!provider) {
|
|
10518
|
-
M2.error(`Unknown AI tool '${id}'. Run 'dosu mcp list' to see available tools.`);
|
|
10519
|
-
return null;
|
|
10520
|
-
}
|
|
10521
|
-
if (isStdioOnly(provider)) {
|
|
10522
|
-
M2.error(`${provider.name()} is not supported by setup. Use 'dosu mcp add ${id}'.`);
|
|
10523
|
-
return null;
|
|
10524
|
-
}
|
|
10525
|
-
selected.push(provider);
|
|
10526
|
-
}
|
|
10527
|
-
return { toInstall: selected, toRemove: [], skipped: [] };
|
|
10528
|
-
}
|
|
10529
10474
|
async function stepSelectTools(detected) {
|
|
10530
10475
|
const configuredMap = new Map;
|
|
10531
10476
|
for (const p2 of detected) {
|
|
@@ -12583,27 +12528,19 @@ function createProgram() {
|
|
|
12583
12528
|
const { runTUI: runTUI2 } = await Promise.resolve().then(() => (init_tui(), exports_tui));
|
|
12584
12529
|
await runTUI2();
|
|
12585
12530
|
});
|
|
12586
|
-
program2.command("login").description("Authenticate with Dosu via OAuth").
|
|
12531
|
+
program2.command("login").description("Authenticate with Dosu via OAuth").action(async () => {
|
|
12587
12532
|
const cfg = loadConfig();
|
|
12588
12533
|
if (isAuthenticated(cfg) && !isTokenExpired(cfg)) {
|
|
12589
12534
|
console.log("You are already logged in.");
|
|
12590
12535
|
console.log("Run 'dosu logout' first to re-authenticate.");
|
|
12591
12536
|
return;
|
|
12592
12537
|
}
|
|
12593
|
-
console.log(
|
|
12538
|
+
console.log("Opening browser for authentication...");
|
|
12594
12539
|
const { startOAuthFlow: startOAuthFlow2 } = await Promise.resolve().then(() => (init_flow(), exports_flow));
|
|
12595
12540
|
const { OAuthCallbackError: OAuthCallbackError2 } = await Promise.resolve().then(() => (init_errors(), exports_errors));
|
|
12596
12541
|
let token;
|
|
12597
12542
|
try {
|
|
12598
|
-
token = await startOAuthFlow2(
|
|
12599
|
-
openBrowser: opts.open !== false,
|
|
12600
|
-
onAuthURL: opts.open === false ? (url) => {
|
|
12601
|
-
console.log("Open this URL to authenticate:");
|
|
12602
|
-
console.log(url);
|
|
12603
|
-
console.log(`
|
|
12604
|
-
Waiting for login to complete...`);
|
|
12605
|
-
} : undefined
|
|
12606
|
-
});
|
|
12543
|
+
token = await startOAuthFlow2();
|
|
12607
12544
|
} catch (err) {
|
|
12608
12545
|
if (err instanceof OAuthCallbackError2) {
|
|
12609
12546
|
console.error(err.userMessage);
|
|
@@ -12733,7 +12670,7 @@ Use 'dosu mcp add <agent>' to add Dosu MCP to a tool.`);
|
|
|
12733
12670
|
program2.addCommand(tagsCommand());
|
|
12734
12671
|
program2.addCommand(threadsCommand());
|
|
12735
12672
|
program2.addCommand(skillCommand());
|
|
12736
|
-
program2.command("setup").description("Set up Dosu MCP for your AI tools").option("--deployment <id>", "Skip to tool configuration for a specific MCP").option("--mode <mode>", "Force OSS or Cloud mode, skipping the interactive prompt (oss|cloud)").
|
|
12673
|
+
program2.command("setup").description("Set up Dosu MCP for your AI tools").option("--deployment <id>", "Skip to tool configuration for a specific MCP").option("--mode <mode>", "Force OSS or Cloud mode, skipping the interactive prompt (oss|cloud)").action(async (opts) => {
|
|
12737
12674
|
const { runSetup: runSetup2 } = await Promise.resolve().then(() => (init_flow2(), exports_flow2));
|
|
12738
12675
|
let mode;
|
|
12739
12676
|
if (opts.mode !== undefined) {
|
|
@@ -12743,16 +12680,7 @@ Use 'dosu mcp add <agent>' to add Dosu MCP to a tool.`);
|
|
|
12743
12680
|
}
|
|
12744
12681
|
mode = normalized;
|
|
12745
12682
|
}
|
|
12746
|
-
await runSetup2({
|
|
12747
|
-
deploymentID: opts.deployment,
|
|
12748
|
-
mode,
|
|
12749
|
-
yes: opts.agent === true || opts.yes === true,
|
|
12750
|
-
openBrowser: opts.agent === true ? false : opts.open !== false,
|
|
12751
|
-
toolIDs: opts.tool ?? [],
|
|
12752
|
-
skipMcp: opts.skipMcp === true,
|
|
12753
|
-
skipSkill: opts.skipSkill === true,
|
|
12754
|
-
skipGitHub: opts.agent === true || opts.skipGithub === true
|
|
12755
|
-
});
|
|
12683
|
+
await runSetup2({ deploymentID: opts.deployment, mode });
|
|
12756
12684
|
});
|
|
12757
12685
|
program2.command("logs").description("View or manage debug logs").option("-t, --tail [n]", "Show last N lines (default: 50)").option("--clear", "Delete the log file").action((opts) => {
|
|
12758
12686
|
const logPath = logger.getLogPath();
|
|
@@ -12782,10 +12710,6 @@ Use 'dosu mcp add <agent>' to add Dosu MCP to a tool.`);
|
|
|
12782
12710
|
});
|
|
12783
12711
|
return program2;
|
|
12784
12712
|
}
|
|
12785
|
-
function collectValues(value, previous) {
|
|
12786
|
-
previous.push(value);
|
|
12787
|
-
return previous;
|
|
12788
|
-
}
|
|
12789
12713
|
async function execute() {
|
|
12790
12714
|
const program2 = createProgram();
|
|
12791
12715
|
await program2.parseAsync(process.argv);
|