@dosu/cli 0.37.1 → 0.39.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 (3) hide show
  1. package/README.md +1 -1
  2. package/bin/dosu.js +60 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -92,7 +92,7 @@ Or right-click the binary, select "Open", and click "Open" in the dialog.
92
92
  | `dosu setup` | Run the setup wizard (auth → deployment → detect tools → configure) |
93
93
  | `dosu login` | Authenticate with Dosu via browser OAuth |
94
94
  | `dosu logout` | Clear saved credentials |
95
- | `dosu status` | Show current authentication and MCP status |
95
+ | `dosu status [--json]` | Show current authentication and MCP status |
96
96
  | `dosu mcp list` | List supported AI tools |
97
97
  | `dosu mcp add <tool>` | Add the Dosu MCP server to a specific tool |
98
98
  | `dosu logs` | View or manage debug logs (`--tail`, `--clear`) |
package/bin/dosu.js CHANGED
@@ -4759,7 +4759,7 @@ var init_dist4 = __esm(() => {
4759
4759
  function getVersionString() {
4760
4760
  return `v${VERSION}`;
4761
4761
  }
4762
- var VERSION = "0.37.1", INSTALL_CHANNEL = "npm";
4762
+ var VERSION = "0.39.0", INSTALL_CHANNEL = "npm";
4763
4763
 
4764
4764
  // src/debug/logger.ts
4765
4765
  import {
@@ -13632,7 +13632,7 @@ async function runAgentSetup(opts) {
13632
13632
  }
13633
13633
  emitStep({
13634
13634
  step: "done",
13635
- agent_next_steps: `Dosu is configured for ${provider.name()}. Tell the user setup is complete and they can ask their agent a Dosu question. Run 'dosu status' to verify.`
13635
+ agent_next_steps: `Dosu is configured for ${provider.name()}. Tell the user setup is complete and they can ask their agent a Dosu question. Run 'dosu status --json' to verify.`
13636
13636
  });
13637
13637
  return 0;
13638
13638
  }
@@ -15033,6 +15033,7 @@ init_commander();
15033
15033
  init_config();
15034
15034
  init_logger();
15035
15035
  init_prompts();
15036
+ import { execFileSync as execFileSync2 } from "node:child_process";
15036
15037
  import { existsSync as existsSync11, readFileSync as readFileSync11 } from "node:fs";
15037
15038
  import { basename } from "node:path";
15038
15039
 
@@ -15111,6 +15112,27 @@ function errMsg(err) {
15111
15112
  function repoSlug(cwd) {
15112
15113
  return cwd ? basename(cwd) : undefined;
15113
15114
  }
15115
+ function gitContext(cwd) {
15116
+ if (!cwd)
15117
+ return {};
15118
+ const run2 = (args) => {
15119
+ try {
15120
+ const out = execFileSync2("git", args, {
15121
+ cwd,
15122
+ timeout: 1500,
15123
+ encoding: "utf8",
15124
+ stdio: ["ignore", "pipe", "ignore"]
15125
+ });
15126
+ return out.toString().trim() || undefined;
15127
+ } catch {
15128
+ return;
15129
+ }
15130
+ };
15131
+ const repo = run2(["remote", "get-url", "origin"]);
15132
+ if (!repo)
15133
+ return {};
15134
+ return { repo, branch: run2(["branch", "--show-current"]) };
15135
+ }
15114
15136
  async function runUserPromptSubmit(input, now = Date.now(), agent = DEFAULT_AGENT) {
15115
15137
  const sessionId = input.session_id;
15116
15138
  if (!sessionId)
@@ -15135,6 +15157,7 @@ async function runUserPromptSubmit(input, now = Date.now(), agent = DEFAULT_AGEN
15135
15157
  logger.debug("hooks", "submit skipped reason=not-configured");
15136
15158
  return;
15137
15159
  }
15160
+ const git = gitContext(input.cwd);
15138
15161
  const tc = await Promise.resolve().then(() => (init_ticket_client(), exports_ticket_client));
15139
15162
  const startedAt = Date.now();
15140
15163
  let resp;
@@ -15145,7 +15168,8 @@ async function runUserPromptSubmit(input, now = Date.now(), agent = DEFAULT_AGEN
15145
15168
  session_id: sessionId,
15146
15169
  turn_id: turnId,
15147
15170
  prompt,
15148
- repo: repoSlug(input.cwd)
15171
+ repo: git.repo ?? repoSlug(input.cwd),
15172
+ branch: git.branch
15149
15173
  });
15150
15174
  } catch (err) {
15151
15175
  logger.warn("hooks", `error event=user-prompt-submit reason=${errMsg(err)}`);
@@ -16929,14 +16953,45 @@ Run 'dosu --help' to see available commands.`;
16929
16953
  saveConfig(cfg);
16930
16954
  console.log("Successfully logged out.");
16931
16955
  });
16932
- program2.command("status").description("Show current authentication and MCP status").action(async () => {
16956
+ program2.command("status").description("Show current authentication and MCP status").option("--json", "Output as JSON").action(async (opts) => {
16933
16957
  const cfg = loadConfig();
16958
+ const mode = cfg.mode === MODE_OSS ? "oss" : "cloud";
16934
16959
  if (!isAuthenticated(cfg)) {
16960
+ if (opts.json) {
16961
+ console.log(JSON.stringify({
16962
+ authenticated: false,
16963
+ session_status: "missing",
16964
+ mode,
16965
+ mcp: {
16966
+ status: "not_configured",
16967
+ deployment_id: null,
16968
+ deployment_name: null
16969
+ }
16970
+ }, null, 2));
16971
+ return;
16972
+ }
16935
16973
  console.log("Status: Not logged in");
16936
16974
  console.log("Run 'dosu login' to authenticate.");
16937
16975
  return;
16938
16976
  }
16939
- if (isTokenExpired(cfg) && !await ensureFreshSession(cfg)) {
16977
+ const sessionStatus = isTokenExpired(cfg) && !await ensureFreshSession(cfg) ? "expired" : "valid";
16978
+ if (opts.json) {
16979
+ const deploymentId = cfg.active_account.target?.deployment_id ?? null;
16980
+ const deploymentName = cfg.active_account.target?.deployment_name ?? null;
16981
+ const mcpStatus = cfg.mode === MODE_OSS ? "public_libraries" : deploymentId ? "configured" : "not_configured";
16982
+ console.log(JSON.stringify({
16983
+ authenticated: sessionStatus === "valid",
16984
+ session_status: sessionStatus,
16985
+ mode,
16986
+ mcp: {
16987
+ status: mcpStatus,
16988
+ deployment_id: deploymentId,
16989
+ deployment_name: deploymentName
16990
+ }
16991
+ }, null, 2));
16992
+ return;
16993
+ }
16994
+ if (sessionStatus === "expired") {
16940
16995
  console.log("Status: Token expired");
16941
16996
  console.log("Run 'dosu login' to re-authenticate.");
16942
16997
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.37.1",
3
+ "version": "0.39.0",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Manage MCP servers for AI tools",
6
6
  "license": "MIT",