@dosu/cli 0.5.0 → 0.7.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 (2) hide show
  1. package/bin/dosu.js +135 -245
  2. package/package.json +1 -1
package/bin/dosu.js CHANGED
@@ -2772,13 +2772,6 @@ var init_zed = __esm(() => {
2772
2772
  });
2773
2773
 
2774
2774
  // src/mcp/providers.ts
2775
- var exports_providers = {};
2776
- __export(exports_providers, {
2777
- getProvider: () => getProvider,
2778
- detectInstalledProviders: () => detectInstalledProviders,
2779
- allSetupProviders: () => allSetupProviders,
2780
- allProviders: () => allProviders
2781
- });
2782
2775
  function allProviders() {
2783
2776
  return [
2784
2777
  ClaudeProvider(),
@@ -2802,9 +2795,6 @@ function allSetupProviders() {
2802
2795
  const providers = allProviders().filter((p) => ("detectPaths" in p) && ("isInstalled" in p));
2803
2796
  return providers.sort((a, b) => a.priority() - b.priority());
2804
2797
  }
2805
- function detectInstalledProviders() {
2806
- return allSetupProviders().filter((p) => p.isInstalled());
2807
- }
2808
2798
  function getProvider(toolID) {
2809
2799
  const provider = allProviders().find((p) => p.id() === toolID);
2810
2800
  if (!provider)
@@ -3751,6 +3741,18 @@ var init_client = __esm(() => {
3751
3741
  };
3752
3742
  });
3753
3743
 
3744
+ // src/setup/styles.ts
3745
+ function dim(msg) {
3746
+ return import_picocolors2.default.dim(msg);
3747
+ }
3748
+ function info(msg) {
3749
+ return import_picocolors2.default.cyan(msg);
3750
+ }
3751
+ var import_picocolors2;
3752
+ var init_styles = __esm(() => {
3753
+ import_picocolors2 = __toESM(require_picocolors(), 1);
3754
+ });
3755
+
3754
3756
  // src/auth/server.ts
3755
3757
  function buildSuccessHtml(email) {
3756
3758
  const emailLine = email ? `<p class="email">Signed in as <strong>${email.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")}</strong></p>` : "";
@@ -4527,240 +4529,6 @@ var init_flow = __esm(() => {
4527
4529
  init_server();
4528
4530
  });
4529
4531
 
4530
- // src/tui/tui.ts
4531
- var exports_tui = {};
4532
- __export(exports_tui, {
4533
- runTUI: () => runTUI,
4534
- handleLogout: () => handleLogout
4535
- });
4536
- async function runTUI() {
4537
- console.log(import_picocolors2.default.magenta(LOGO));
4538
- const cfg = loadConfig();
4539
- if (!isAuthenticated(cfg)) {
4540
- await handleAuthenticate(cfg);
4541
- if (!isAuthenticated(cfg))
4542
- return;
4543
- }
4544
- while (true) {
4545
- const hasMcpTarget = cfg.mode === MODE_OSS || !!cfg.deployment_id;
4546
- const action = await ve({
4547
- message: "What would you like to do?",
4548
- options: [
4549
- {
4550
- label: "Authenticate",
4551
- value: "auth",
4552
- hint: isAuthenticated(cfg) ? "Re-authenticate" : undefined
4553
- },
4554
- {
4555
- label: "Choose MCP",
4556
- value: "deployments",
4557
- hint: !isAuthenticated(cfg) ? "Login first" : undefined
4558
- },
4559
- {
4560
- label: "Add MCP",
4561
- value: "mcp-add",
4562
- hint: !hasMcpTarget ? "Select deployment first" : undefined
4563
- },
4564
- {
4565
- label: "Remove MCP",
4566
- value: "mcp-remove",
4567
- hint: !hasMcpTarget ? "Select deployment first" : undefined
4568
- },
4569
- { label: "Clear Credentials", value: "logout" },
4570
- { label: "Exit", value: "exit" }
4571
- ]
4572
- });
4573
- if (pD(action) || action === "exit") {
4574
- break;
4575
- }
4576
- switch (action) {
4577
- case "auth":
4578
- await handleAuthenticate(cfg);
4579
- break;
4580
- case "deployments":
4581
- await handleDeployments(cfg);
4582
- break;
4583
- case "mcp-add":
4584
- if (!hasMcpTarget) {
4585
- M2.warn("Please select a deployment first.");
4586
- continue;
4587
- }
4588
- await handleMCPAdd(cfg);
4589
- break;
4590
- case "mcp-remove":
4591
- if (!hasMcpTarget) {
4592
- M2.warn("Please select a deployment first.");
4593
- continue;
4594
- }
4595
- await handleMCPRemove(cfg);
4596
- break;
4597
- case "logout":
4598
- handleLogout(cfg);
4599
- break;
4600
- }
4601
- }
4602
- Se("Goodbye!");
4603
- }
4604
- async function handleDeployments(cfg) {
4605
- if (!isAuthenticated(cfg)) {
4606
- M2.warn("Please authenticate first.");
4607
- return;
4608
- }
4609
- const client = new Client(cfg);
4610
- try {
4611
- const deployments = await client.getDeployments();
4612
- if (deployments.length === 0) {
4613
- M2.warn("No deployments found.");
4614
- return;
4615
- }
4616
- const selected = await ve({
4617
- message: "Select an MCP",
4618
- options: deployments.map((d3) => ({
4619
- label: `${d3.name} ${import_picocolors2.default.dim(`(${d3.org_name})`)}`,
4620
- value: d3.deployment_id
4621
- }))
4622
- });
4623
- if (pD(selected))
4624
- return;
4625
- const deployment = deployments.find((d3) => d3.deployment_id === selected);
4626
- if (deployment) {
4627
- cfg.deployment_id = deployment.deployment_id;
4628
- cfg.deployment_name = deployment.name;
4629
- saveConfig(cfg);
4630
- M2.success(`Selected: ${deployment.name}`);
4631
- }
4632
- } catch (err) {
4633
- M2.error(`Failed: ${err instanceof Error ? err.message : String(err)}`);
4634
- }
4635
- }
4636
- async function handleMCPAdd(cfg) {
4637
- const { allProviders: allProviders2 } = await Promise.resolve().then(() => (init_providers(), exports_providers));
4638
- const providers = allProviders2();
4639
- const selected = await ve({
4640
- message: "Select tool to add MCP to",
4641
- options: providers.map((p2) => ({
4642
- label: p2.name(),
4643
- value: p2.id(),
4644
- hint: p2.supportsLocal() ? "local + global" : "global only"
4645
- }))
4646
- });
4647
- if (pD(selected))
4648
- return;
4649
- const provider = providers.find((p2) => p2.id() === selected);
4650
- if (!provider)
4651
- return;
4652
- try {
4653
- provider.install(cfg, true);
4654
- M2.success(`Added Dosu MCP to ${provider.name()}`);
4655
- } catch (err) {
4656
- M2.error(`Failed: ${err instanceof Error ? err.message : String(err)}`);
4657
- }
4658
- }
4659
- async function handleMCPRemove(_cfg) {
4660
- const { allProviders: allProviders2 } = await Promise.resolve().then(() => (init_providers(), exports_providers));
4661
- const providers = allProviders2();
4662
- const selected = await ve({
4663
- message: "Select tool to remove MCP from",
4664
- options: providers.filter((p2) => p2.id() !== "manual").map((p2) => ({
4665
- label: p2.name(),
4666
- value: p2.id()
4667
- }))
4668
- });
4669
- if (pD(selected))
4670
- return;
4671
- const provider = providers.find((p2) => p2.id() === selected);
4672
- if (!provider)
4673
- return;
4674
- try {
4675
- provider.remove(true);
4676
- M2.success(`Removed Dosu MCP from ${provider.name()}`);
4677
- } catch (err) {
4678
- M2.error(`Failed: ${err instanceof Error ? err.message : String(err)}`);
4679
- }
4680
- }
4681
- async function handleAuthenticate(cfg) {
4682
- if (cfg.access_token) {
4683
- const s = Y2();
4684
- s.start("Verifying session...");
4685
- try {
4686
- const apiClient = new Client(cfg);
4687
- const resp = await apiClient.doRequestRaw("GET", "/v1/mcp/deployments");
4688
- if (resp.status === 200) {
4689
- s.stop("Already authenticated.");
4690
- return;
4691
- }
4692
- try {
4693
- await apiClient.refreshToken();
4694
- s.stop("Session refreshed.");
4695
- return;
4696
- } catch {}
4697
- s.stop("Session expired.");
4698
- } catch {
4699
- s.stop("Verification failed.");
4700
- }
4701
- }
4702
- const shouldLogin = await ye({ message: "Open browser to log in?" });
4703
- if (pD(shouldLogin) || !shouldLogin)
4704
- return;
4705
- try {
4706
- const { startOAuthFlow: startOAuthFlow2 } = await Promise.resolve().then(() => (init_flow(), exports_flow));
4707
- const s = Y2();
4708
- s.start("Waiting for authentication...");
4709
- const token = await startOAuthFlow2(undefined, "/cli/auth");
4710
- s.stop("Authenticated");
4711
- cfg.access_token = token.access_token;
4712
- cfg.refresh_token = token.refresh_token;
4713
- cfg.expires_at = Math.floor(Date.now() / 1000) + token.expires_in;
4714
- cfg.mode = token.mode === MODE_OSS ? MODE_OSS : undefined;
4715
- saveConfig(cfg);
4716
- } catch (err) {
4717
- M2.error(`Authentication failed: ${err instanceof Error ? err.message : String(err)}`);
4718
- }
4719
- }
4720
- function handleLogout(cfg) {
4721
- if (!isAuthenticated(cfg)) {
4722
- M2.warn("You are not logged in.");
4723
- return;
4724
- }
4725
- cfg.access_token = "";
4726
- cfg.refresh_token = "";
4727
- cfg.expires_at = 0;
4728
- cfg.mode = undefined;
4729
- cfg.deployment_id = undefined;
4730
- cfg.deployment_name = undefined;
4731
- cfg.api_key = undefined;
4732
- saveConfig(cfg);
4733
- M2.success("Credentials cleared.");
4734
- }
4735
- var import_picocolors2, LOGO = `
4736
- /$$$$$$$
4737
- | $$__ $$
4738
- | $$ \\ $$ /$$$$$$ /$$$$$$$ /$$ /$$
4739
- | $$ | $$ /$$__ $$ /$$_____/| $$ | $$
4740
- | $$ | $$| $$ \\ $$| $$$$$$ | $$ | $$
4741
- | $$ | $$| $$ | $$ \\____ $$| $$ | $$
4742
- | $$$$$$$/| $$$$$$/ /$$$$$$$/| $$$$$$/
4743
- |_______/ \\______/ |_______/ \\______/
4744
- `;
4745
- var init_tui = __esm(() => {
4746
- init_dist2();
4747
- init_client();
4748
- init_config();
4749
- import_picocolors2 = __toESM(require_picocolors(), 1);
4750
- });
4751
-
4752
- // src/setup/styles.ts
4753
- function dim(msg) {
4754
- return import_picocolors3.default.dim(msg);
4755
- }
4756
- function info(msg) {
4757
- return import_picocolors3.default.cyan(msg);
4758
- }
4759
- var import_picocolors3;
4760
- var init_styles = __esm(() => {
4761
- import_picocolors3 = __toESM(require_picocolors(), 1);
4762
- });
4763
-
4764
4532
  // src/setup/flow.ts
4765
4533
  var exports_flow2 = {};
4766
4534
  __export(exports_flow2, {
@@ -5090,6 +4858,128 @@ var init_flow2 = __esm(() => {
5090
4858
  init_styles();
5091
4859
  });
5092
4860
 
4861
+ // src/tui/tui.ts
4862
+ var exports_tui = {};
4863
+ __export(exports_tui, {
4864
+ runTUI: () => runTUI,
4865
+ handleLogout: () => handleLogout
4866
+ });
4867
+ async function runTUI() {
4868
+ console.log(import_picocolors3.default.magenta(LOGO));
4869
+ const cfg = loadConfig();
4870
+ if (!isAuthenticated(cfg)) {
4871
+ await handleAuthenticate(cfg);
4872
+ if (!isAuthenticated(cfg))
4873
+ return;
4874
+ }
4875
+ while (true) {
4876
+ const action = await ve({
4877
+ message: "What would you like to do?",
4878
+ options: [
4879
+ {
4880
+ label: "Setup",
4881
+ value: "setup",
4882
+ hint: "Configure MCP for your AI tools"
4883
+ },
4884
+ {
4885
+ label: "Authenticate",
4886
+ value: "auth",
4887
+ hint: isAuthenticated(cfg) ? "Re-authenticate" : undefined
4888
+ },
4889
+ { label: "Clear Credentials", value: "logout" },
4890
+ { label: "Exit", value: "exit" }
4891
+ ]
4892
+ });
4893
+ if (pD(action) || action === "exit") {
4894
+ break;
4895
+ }
4896
+ switch (action) {
4897
+ case "auth":
4898
+ await handleAuthenticate(cfg);
4899
+ break;
4900
+ case "setup":
4901
+ await runSetup();
4902
+ Object.assign(cfg, loadConfig());
4903
+ break;
4904
+ case "logout":
4905
+ handleLogout(cfg);
4906
+ break;
4907
+ }
4908
+ }
4909
+ Se("Goodbye!");
4910
+ }
4911
+ async function handleAuthenticate(cfg) {
4912
+ if (cfg.access_token) {
4913
+ const s = Y2();
4914
+ s.start("Verifying session...");
4915
+ try {
4916
+ const apiClient = new Client(cfg);
4917
+ const resp = await apiClient.doRequestRaw("GET", "/v1/mcp/deployments");
4918
+ if (resp.status === 200) {
4919
+ s.stop("Already authenticated.");
4920
+ return;
4921
+ }
4922
+ try {
4923
+ await apiClient.refreshToken();
4924
+ s.stop("Session refreshed.");
4925
+ return;
4926
+ } catch {}
4927
+ s.stop("Session expired.");
4928
+ } catch {
4929
+ s.stop("Verification failed.");
4930
+ }
4931
+ }
4932
+ const shouldLogin = await ye({ message: "Open browser to log in?" });
4933
+ if (pD(shouldLogin) || !shouldLogin)
4934
+ return;
4935
+ try {
4936
+ const { startOAuthFlow: startOAuthFlow2 } = await Promise.resolve().then(() => (init_flow(), exports_flow));
4937
+ const s = Y2();
4938
+ s.start("Waiting for authentication...");
4939
+ const token = await startOAuthFlow2(undefined, "/cli/auth");
4940
+ s.stop("Authenticated");
4941
+ cfg.access_token = token.access_token;
4942
+ cfg.refresh_token = token.refresh_token;
4943
+ cfg.expires_at = Math.floor(Date.now() / 1000) + token.expires_in;
4944
+ cfg.mode = token.mode === MODE_OSS ? MODE_OSS : undefined;
4945
+ saveConfig(cfg);
4946
+ } catch (err) {
4947
+ M2.error(`Authentication failed: ${err instanceof Error ? err.message : String(err)}`);
4948
+ }
4949
+ }
4950
+ function handleLogout(cfg) {
4951
+ if (!isAuthenticated(cfg)) {
4952
+ M2.warn("You are not logged in.");
4953
+ return;
4954
+ }
4955
+ cfg.access_token = "";
4956
+ cfg.refresh_token = "";
4957
+ cfg.expires_at = 0;
4958
+ cfg.mode = undefined;
4959
+ cfg.deployment_id = undefined;
4960
+ cfg.deployment_name = undefined;
4961
+ cfg.api_key = undefined;
4962
+ saveConfig(cfg);
4963
+ M2.success("Credentials cleared.");
4964
+ }
4965
+ var import_picocolors3, LOGO = `
4966
+ /$$$$$$$
4967
+ | $$__ $$
4968
+ | $$ \\ $$ /$$$$$$ /$$$$$$$ /$$ /$$
4969
+ | $$ | $$ /$$__ $$ /$$_____/| $$ | $$
4970
+ | $$ | $$| $$ \\ $$| $$$$$$ | $$ | $$
4971
+ | $$ | $$| $$ | $$ \\____ $$| $$ | $$
4972
+ | $$$$$$$/| $$$$$$/ /$$$$$$$/| $$$$$$/
4973
+ |_______/ \\______/ |_______/ \\______/
4974
+ `;
4975
+ var init_tui = __esm(() => {
4976
+ init_dist2();
4977
+ init_client();
4978
+ init_config();
4979
+ init_flow2();
4980
+ import_picocolors3 = __toESM(require_picocolors(), 1);
4981
+ });
4982
+
5093
4983
  // node_modules/commander/esm.mjs
5094
4984
  var import__ = __toESM(require_commander(), 1);
5095
4985
  var {
@@ -5111,7 +5001,7 @@ init_config();
5111
5001
  init_providers();
5112
5002
 
5113
5003
  // src/version/version.ts
5114
- var VERSION = "0.5.0";
5004
+ var VERSION = "0.7.0";
5115
5005
  function getVersionString() {
5116
5006
  return `v${VERSION}`;
5117
5007
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Manage MCP servers for AI tools",
6
6
  "license": "MIT",