@dosu/cli 0.37.0 → 0.38.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 +46 -7
  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.0", INSTALL_CHANNEL = "npm";
4762
+ var VERSION = "0.38.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
  }
@@ -15066,6 +15066,11 @@ function saveState(state) {
15066
15066
  writeFileSync5(file, JSON.stringify(state, null, 2), { mode: 384 });
15067
15067
  } catch {}
15068
15068
  }
15069
+ function clearState(sessionId) {
15070
+ try {
15071
+ rmSync2(stateFile(sessionId), { force: true });
15072
+ } catch {}
15073
+ }
15069
15074
 
15070
15075
  // src/commands/hooks.ts
15071
15076
  var COOLDOWN_DEFAULT_MS = 3000;
@@ -15117,11 +15122,14 @@ async function runUserPromptSubmit(input, now = Date.now(), agent = DEFAULT_AGEN
15117
15122
  logger.debug("hooks", "submit skipped reason=own-stop-envelope");
15118
15123
  return;
15119
15124
  }
15125
+ const turnId = input.turn_id ?? String(now);
15120
15126
  const existing = loadState(sessionId);
15121
- if (existing && existing.status === "pending" && now <= existing.expiresAt) {
15127
+ if (existing && existing.status === "pending" && now <= existing.expiresAt && input.turn_id !== undefined && existing.turnId === turnId) {
15122
15128
  logger.debug("hooks", `submit sid=${sid8(sessionId)} reuse tid=${existing.ticketId}`);
15123
15129
  return;
15124
15130
  }
15131
+ if (existing)
15132
+ clearState(sessionId);
15125
15133
  const cfg = loadConfig();
15126
15134
  if (!cfg.active_account?.target?.api_key || !cfg.active_account?.target?.deployment_id) {
15127
15135
  logger.debug("hooks", "submit skipped reason=not-configured");
@@ -15135,7 +15143,7 @@ async function runUserPromptSubmit(input, now = Date.now(), agent = DEFAULT_AGEN
15135
15143
  deployment_id: cfg.active_account?.target?.deployment_id,
15136
15144
  agent,
15137
15145
  session_id: sessionId,
15138
- turn_id: input.turn_id ?? String(now),
15146
+ turn_id: turnId,
15139
15147
  prompt,
15140
15148
  repo: repoSlug(input.cwd)
15141
15149
  });
@@ -15146,7 +15154,7 @@ async function runUserPromptSubmit(input, now = Date.now(), agent = DEFAULT_AGEN
15146
15154
  saveState({
15147
15155
  ticketId: resp.ticket_id,
15148
15156
  sessionId,
15149
- turnId: input.turn_id ?? String(now),
15157
+ turnId,
15150
15158
  status: "pending",
15151
15159
  createdAt: now,
15152
15160
  expiresAt: now + ttlMs()
@@ -16921,14 +16929,45 @@ Run 'dosu --help' to see available commands.`;
16921
16929
  saveConfig(cfg);
16922
16930
  console.log("Successfully logged out.");
16923
16931
  });
16924
- program2.command("status").description("Show current authentication and MCP status").action(async () => {
16932
+ program2.command("status").description("Show current authentication and MCP status").option("--json", "Output as JSON").action(async (opts) => {
16925
16933
  const cfg = loadConfig();
16934
+ const mode = cfg.mode === MODE_OSS ? "oss" : "cloud";
16926
16935
  if (!isAuthenticated(cfg)) {
16936
+ if (opts.json) {
16937
+ console.log(JSON.stringify({
16938
+ authenticated: false,
16939
+ session_status: "missing",
16940
+ mode,
16941
+ mcp: {
16942
+ status: "not_configured",
16943
+ deployment_id: null,
16944
+ deployment_name: null
16945
+ }
16946
+ }, null, 2));
16947
+ return;
16948
+ }
16927
16949
  console.log("Status: Not logged in");
16928
16950
  console.log("Run 'dosu login' to authenticate.");
16929
16951
  return;
16930
16952
  }
16931
- if (isTokenExpired(cfg) && !await ensureFreshSession(cfg)) {
16953
+ const sessionStatus = isTokenExpired(cfg) && !await ensureFreshSession(cfg) ? "expired" : "valid";
16954
+ if (opts.json) {
16955
+ const deploymentId = cfg.active_account.target?.deployment_id ?? null;
16956
+ const deploymentName = cfg.active_account.target?.deployment_name ?? null;
16957
+ const mcpStatus = cfg.mode === MODE_OSS ? "public_libraries" : deploymentId ? "configured" : "not_configured";
16958
+ console.log(JSON.stringify({
16959
+ authenticated: sessionStatus === "valid",
16960
+ session_status: sessionStatus,
16961
+ mode,
16962
+ mcp: {
16963
+ status: mcpStatus,
16964
+ deployment_id: deploymentId,
16965
+ deployment_name: deploymentName
16966
+ }
16967
+ }, null, 2));
16968
+ return;
16969
+ }
16970
+ if (sessionStatus === "expired") {
16932
16971
  console.log("Status: Token expired");
16933
16972
  console.log("Run 'dosu login' to re-authenticate.");
16934
16973
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Manage MCP servers for AI tools",
6
6
  "license": "MIT",