@dosu/cli 0.57.0 → 0.57.2

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 +81 -30
  2. package/package.json +1 -1
package/bin/dosu.js CHANGED
@@ -1083,7 +1083,7 @@ function isNpxInvocation(channel = INSTALL_CHANNEL, env = process.env) {
1083
1083
  function getVersionString() {
1084
1084
  return `v${VERSION}`;
1085
1085
  }
1086
- var VERSION = "0.57.0", INSTALL_CHANNEL = "npm";
1086
+ var VERSION = "0.57.2", INSTALL_CHANNEL = "npm";
1087
1087
 
1088
1088
  // src/debug/logger.ts
1089
1089
  import {
@@ -6869,8 +6869,11 @@ function messageLimit(value) {
6869
6869
  }
6870
6870
  return parsed;
6871
6871
  }
6872
+ function isUuid(value) {
6873
+ return UUID_RE.test(value);
6874
+ }
6872
6875
  function uuid(value) {
6873
- if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value)) {
6876
+ if (!isUuid(value)) {
6874
6877
  throw new InvalidArgumentError("must be a UUID");
6875
6878
  }
6876
6879
  return value;
@@ -6913,8 +6916,10 @@ function boundedText(maximum) {
6913
6916
  return trimmed;
6914
6917
  };
6915
6918
  }
6919
+ var UUID_RE;
6916
6920
  var init_arguments = __esm(() => {
6917
6921
  init_commander();
6922
+ UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
6918
6923
  });
6919
6924
 
6920
6925
  // src/commands/auth.ts
@@ -8548,6 +8553,9 @@ function layoutMargin(columns = process.stdout.columns ?? 80) {
8548
8553
  function frameTopMargin(rows = process.stdout.rows ?? 24) {
8549
8554
  return Math.max(2, Math.min(6, Math.floor(rows / 8)));
8550
8555
  }
8556
+ function frameMaxLines(rows = process.stdout.rows ?? 24) {
8557
+ return Math.max(1, rows - frameTopMargin(rows) - 2);
8558
+ }
8551
8559
  function breadcrumb(segments, width = contentWidth()) {
8552
8560
  const head = segments.slice(0, -1);
8553
8561
  const leaf = segments[segments.length - 1] ?? "";
@@ -11167,6 +11175,25 @@ async function listAccessibleDeployments(client, activeOrgId) {
11167
11175
  const deployments = await Promise.all(orgs.map((org) => client.workspaces.listForOrg.query(org.org_id)));
11168
11176
  return deployments.flat();
11169
11177
  }
11178
+ async function resolveDeploymentId(client, activeOrgId, id) {
11179
+ const needle = id.trim();
11180
+ if (isUuid(needle))
11181
+ return needle;
11182
+ const prefix = needle.toLowerCase();
11183
+ const matches = (await listAccessibleDeployments(client, activeOrgId)).filter((d) => d.provider_slug === MCP_PROVIDER_SLUG && prefix.length > 0 && d.deployment_id.toLowerCase().startsWith(prefix));
11184
+ if (matches.length === 1)
11185
+ return matches[0].deployment_id;
11186
+ if (matches.length === 0) {
11187
+ console.error(import_picocolors15.default.red(`Deployment not found: ${id}`));
11188
+ console.error(import_picocolors15.default.dim("Expected a full deployment ID (UUID). Run 'dosu deployments list --json' to see full IDs."));
11189
+ process.exit(1);
11190
+ }
11191
+ console.error(import_picocolors15.default.red(`Ambiguous deployment ID prefix: ${id} matches ${matches.length}:`));
11192
+ for (const d of matches) {
11193
+ console.error(import_picocolors15.default.dim(` ${d.deployment_id} ${d.name}`));
11194
+ }
11195
+ process.exit(1);
11196
+ }
11170
11197
  function deploymentsCommand() {
11171
11198
  const cmd = new Command("deployments").description("Manage deployments");
11172
11199
  cmd.command("list").description("List all deployments").option("--json", "Output as JSON").action(async (opts) => {
@@ -11220,9 +11247,10 @@ ${import_picocolors15.default.dim(`Current: ${cfg.active_account?.target?.deploy
11220
11247
  ["Created", formatDate(deployment.created_at)]
11221
11248
  ], { rawData: deployment });
11222
11249
  });
11223
- cmd.command("switch").description("Switch to a different deployment").argument("<id>", "Deployment ID").option("--json", "Output as JSON").action(async (id, opts) => {
11250
+ cmd.command("switch").description("Switch to a different deployment").argument("<id>", "Deployment ID (full UUID, or a unique prefix as shown by 'list')").option("--json", "Output as JSON").action(async (rawId, opts) => {
11224
11251
  const cfg = requireConfig4();
11225
11252
  const client = createTypedClient(cfg);
11253
+ const id = await resolveDeploymentId(client, cfg.active_account?.target?.org_id, rawId);
11226
11254
  const deployment = await client.workspaces.get.query(id);
11227
11255
  if (!deployment) {
11228
11256
  console.error(import_picocolors15.default.red(`Deployment not found: ${id}`));
@@ -11255,6 +11283,7 @@ var init_deployments = __esm(() => {
11255
11283
  init_client();
11256
11284
  init_trpc();
11257
11285
  init_config();
11286
+ init_arguments();
11258
11287
  init_auth();
11259
11288
  init_output();
11260
11289
  import_picocolors15 = __toESM(require_picocolors(), 1);
@@ -13713,7 +13742,7 @@ var init_sync = __esm(() => {
13713
13742
  });
13714
13743
 
13715
13744
  // src/telemetry/debug-id.ts
13716
- var BUNDLE_DEBUG_ID_PLACEHOLDER = "6712b11a-8117-30cb-6475-6e2164756e21";
13745
+ var BUNDLE_DEBUG_ID_PLACEHOLDER = "46f904ed-b3a2-d9c5-6475-6e2164756e21";
13717
13746
 
13718
13747
  // src/telemetry/telemetry.ts
13719
13748
  import { randomUUID as randomUUID2 } from "node:crypto";
@@ -62523,7 +62552,7 @@ function confirmBox(queuedCount, backlog, width, mode = "start") {
62523
62552
  import_picocolors34.default.dim(`╰${"─".repeat(inner + 2)}╯`)
62524
62553
  ];
62525
62554
  }
62526
- function renderActivityFrame(status, activity, width, backlog = null, pane = DEFAULT_PANE, queued = [], studiedBeforeRun = 0, open = [], runProgress = null, projectNames = {}, sessionNames = {}) {
62555
+ function buildActivityFrame(status, activity, width, backlog = null, pane = DEFAULT_PANE, queued = [], studiedBeforeRun = 0, open = [], runProgress = null, projectNames = {}, sessionNames = {}, frameLines) {
62527
62556
  const studied = status.state.watermark ? `Studied sessions up to ${localTime(status.state.watermark)}` : "Nothing studied yet";
62528
62557
  const queueDetail = [];
62529
62558
  if (status.backoffUntil) {
@@ -62558,16 +62587,7 @@ function renderActivityFrame(status, activity, width, backlog = null, pane = DEF
62558
62587
  const source = pane.tab === "activity" ? activity.map((line) => formatActivityLine(line, width, fullRows)) : pane.tab === "queued" ? queuedRows : pane.tab === "open" ? openRows : studiedRows;
62559
62588
  const emptyStudied = status.state.watermark ? "No sessions recorded yet. History starts with the next study run." : "No studied sessions yet.";
62560
62589
  const empty = pane.tab === "activity" ? "No sync activity in the log yet." : pane.tab === "queued" ? "Queue empty. Finished agent sessions appear here." : pane.tab === "open" ? "No open sessions. Live agent sessions sit here until they go quiet." : emptyStudied;
62561
- const height = fullRows ? ACTIVITY_VIEW_FULL_LIST_ROWS : ACTIVITY_VIEW_LIST_LINES;
62562
- const { visible, above, below } = windowList(source, pane.scroll, height);
62563
- const display = fullRows ? visible.flatMap((row) => wrapRow(row, width)) : visible;
62564
- const listRows = display.length > 0 ? display.map((row) => import_picocolors34.default.dim(row)) : [import_picocolors34.default.dim(empty)];
62565
- const scrollParts = [];
62566
- if (above > 0)
62567
- scrollParts.push(`↑ ${above} earlier`);
62568
- if (below > 0)
62569
- scrollParts.push(`↓ ${below} newer`);
62570
- const lines = [
62590
+ const header = [
62571
62591
  breadcrumb(["home", "activity"], width),
62572
62592
  "",
62573
62593
  statusLine(status),
@@ -62576,9 +62596,9 @@ function renderActivityFrame(status, activity, width, backlog = null, pane = DEF
62576
62596
  ...progress ? [progress] : [],
62577
62597
  ...refusalLines,
62578
62598
  "",
62579
- ...tabBar(pane.tab, queued.length, open.length, latestPass.size, width),
62580
- ...listRows,
62581
- ...scrollParts.length > 0 ? [import_picocolors34.default.dim(clip(scrollParts.join(" · "), width))] : [],
62599
+ ...tabBar(pane.tab, queued.length, open.length, latestPass.size, width)
62600
+ ];
62601
+ const footer = [
62582
62602
  "",
62583
62603
  ...pane.confirm ? centerBlock(confirmBox(queued.length, backlog, width, pane.confirm), width) : [
62584
62604
  ...wrapLine([
@@ -62591,8 +62611,29 @@ function renderActivityFrame(status, activity, width, backlog = null, pane = DEF
62591
62611
  ].join(" · "), width, "").map((line) => import_picocolors34.default.dim(line))
62592
62612
  ]
62593
62613
  ];
62594
- return lines.join(`
62595
- `);
62614
+ const defaultHeight = fullRows ? ACTIVITY_VIEW_FULL_LIST_ROWS : ACTIVITY_VIEW_LIST_LINES;
62615
+ const listBudget = frameLines === undefined ? defaultHeight : Math.max(1, Math.min(defaultHeight, frameLines - header.length - footer.length - 1));
62616
+ let height = listBudget;
62617
+ let { visible, above, below } = windowList(source, pane.scroll, height);
62618
+ let display = fullRows ? visible.flatMap((row) => wrapRow(row, width)) : visible;
62619
+ while (fullRows && frameLines !== undefined && display.length > listBudget && height > 1) {
62620
+ height -= 1;
62621
+ ({ visible, above, below } = windowList(source, pane.scroll, height));
62622
+ display = visible.flatMap((row) => wrapRow(row, width));
62623
+ }
62624
+ const listRows = display.length > 0 ? display.map((row) => import_picocolors34.default.dim(row)) : [import_picocolors34.default.dim(empty)];
62625
+ const scrollParts = [];
62626
+ if (above > 0)
62627
+ scrollParts.push(`↑ ${above} earlier`);
62628
+ if (below > 0)
62629
+ scrollParts.push(`↓ ${below} newer`);
62630
+ const lines = [
62631
+ ...header,
62632
+ ...listRows,
62633
+ ...scrollParts.length > 0 ? [import_picocolors34.default.dim(clip(scrollParts.join(" · "), width))] : [],
62634
+ ...footer
62635
+ ];
62636
+ return { lines, listHeight: height };
62596
62637
  }
62597
62638
  function createRowNamer() {
62598
62639
  const dirs = createProjectDirResolver();
@@ -62704,7 +62745,7 @@ function runActivityView(io = {}) {
62704
62745
  return sessions.open.length;
62705
62746
  return (status.state.mined_sessions ?? []).length;
62706
62747
  };
62707
- const listHeight = () => fullRows ? ACTIVITY_VIEW_FULL_LIST_ROWS : ACTIVITY_VIEW_LIST_LINES;
62748
+ let listHeight = ACTIVITY_VIEW_LIST_LINES;
62708
62749
  let lastFrame = null;
62709
62750
  let studiedBeforeRun = null;
62710
62751
  const draw = () => {
@@ -62729,7 +62770,11 @@ function runActivityView(io = {}) {
62729
62770
  confirmSync = null;
62730
62771
  const width = activityWidth(output.columns ?? 80);
62731
62772
  const rowNames = rowNamesFor(status, sessions);
62732
- const frame = renderActivityFrame(status, activity, width, backlog, { tab, scroll, confirm: confirmSync ?? undefined, fullRows }, sessions.queued, studiedBeforeRun ?? 0, sessions.open, runProgress, rowNames.projects, rowNames.titles);
62773
+ scroll = Math.min(scroll, Math.max(0, activeListLength() - listHeight));
62774
+ const built = buildActivityFrame(status, activity, width, backlog, { tab, scroll, confirm: confirmSync ?? undefined, fullRows }, sessions.queued, studiedBeforeRun ?? 0, sessions.open, runProgress, rowNames.projects, rowNames.titles, frameMaxLines(output.rows ?? 24));
62775
+ listHeight = built.listHeight;
62776
+ const frame = built.lines.join(`
62777
+ `);
62733
62778
  if (frame === lastFrame)
62734
62779
  return;
62735
62780
  lastFrame = frame;
@@ -62824,7 +62869,7 @@ ${CLEAR_BELOW}`);
62824
62869
  scroll = 0;
62825
62870
  draw();
62826
62871
  } else if (action === "up") {
62827
- const maxScroll = Math.max(0, activeListLength() - listHeight());
62872
+ const maxScroll = Math.max(0, activeListLength() - listHeight);
62828
62873
  if (scroll < maxScroll) {
62829
62874
  scroll += 1;
62830
62875
  draw();
@@ -64553,6 +64598,10 @@ var init_flow2 = __esm(() => {
64553
64598
  });
64554
64599
 
64555
64600
  // src/tui/analytics-view.ts
64601
+ function analyticsListHeight(rows) {
64602
+ const room = frameMaxLines(rows) - ANALYTICS_VIEW_CHROME_LINES;
64603
+ return Math.max(1, Math.min(ANALYTICS_VIEW_LINES, room));
64604
+ }
64556
64605
  function reduceAnalyticsViewKey(key) {
64557
64606
  if (key === "q" || key === ESC8 || key === CTRL_C5)
64558
64607
  return "back";
@@ -64662,9 +64711,9 @@ function analyticsTabRows(tab, state, pageStats) {
64662
64711
  return projectRows(state);
64663
64712
  return pageRows(pageStats);
64664
64713
  }
64665
- function renderAnalyticsFrame(state, tab, scroll, pageStats = null, pagesPending = false, width = contentWidth()) {
64714
+ function renderAnalyticsFrame(state, tab, scroll, pageStats = null, pagesPending = false, width = contentWidth(), height = ANALYTICS_VIEW_LINES) {
64666
64715
  const rows = analyticsTabRows(tab, state, pageStats);
64667
- const { visible, above, below } = windowReport(rows, scroll);
64716
+ const { visible, above, below } = windowReport(rows, scroll, height);
64668
64717
  const empty = tab === "overview" ? "No analytics yet. They appear after the first study run." : tab === "projects" ? "No per-project history yet. It fills in as sessions are studied." : pagesPending ? "Loading page analytics..." : "No page analytics yet.";
64669
64718
  const listRows = visible.length > 0 ? visible.map((row) => import_picocolors36.default.dim(row)) : [import_picocolors36.default.dim(empty)];
64670
64719
  const scrollParts = [];
@@ -64704,10 +64753,13 @@ function runAnalyticsView(io = {}) {
64704
64753
  let pagesPending = true;
64705
64754
  let closed = false;
64706
64755
  let lastFrame = null;
64756
+ const listHeight = () => analyticsListHeight(output.rows ?? 24);
64757
+ const maxScroll = () => Math.max(0, analyticsTabRows(tab, status.state, pageStats).length - listHeight());
64707
64758
  const draw = () => {
64708
64759
  status = getStatus();
64760
+ scroll = Math.min(scroll, maxScroll());
64709
64761
  const width = Math.min(contentWidth(output.columns ?? 80), (output.columns ?? 80) - 1);
64710
- const frame = renderAnalyticsFrame(status.state, tab, scroll, pageStats, pagesPending, width);
64762
+ const frame = renderAnalyticsFrame(status.state, tab, scroll, pageStats, pagesPending, width, listHeight());
64711
64763
  if (frame === lastFrame)
64712
64764
  return;
64713
64765
  lastFrame = frame;
@@ -64768,8 +64820,7 @@ ${CLEAR_BELOW2}`);
64768
64820
  draw();
64769
64821
  }
64770
64822
  } else if (action === "down") {
64771
- const maxScroll = Math.max(0, analyticsTabRows(tab, status.state, pageStats).length - ANALYTICS_VIEW_LINES);
64772
- if (scroll < maxScroll) {
64823
+ if (scroll < maxScroll()) {
64773
64824
  scroll += 1;
64774
64825
  draw();
64775
64826
  }
@@ -64779,7 +64830,7 @@ ${CLEAR_BELOW2}`);
64779
64830
  input.on("data", onData);
64780
64831
  });
64781
64832
  }
64782
- var import_picocolors36, ESC8, HIDE_CURSOR4, SHOW_CURSOR4, CTRL_C5, KEY_UP5, KEY_DOWN5, KEY_RIGHT4, KEY_LEFT4, CURSOR_HOME2, CLEAR_BELOW2, CLEAR_EOL2, ANALYTICS_VIEW_POLL_MS = 1000, ANALYTICS_VIEW_LINES = 14, ANALYTICS_VIEW_TABS, TOP_PAGES_LIMIT = 5, TOP_CITED_DAYS = 30, label = (text) => text.padEnd(26);
64833
+ var import_picocolors36, ESC8, HIDE_CURSOR4, SHOW_CURSOR4, CTRL_C5, KEY_UP5, KEY_DOWN5, KEY_RIGHT4, KEY_LEFT4, CURSOR_HOME2, CLEAR_BELOW2, CLEAR_EOL2, ANALYTICS_VIEW_POLL_MS = 1000, ANALYTICS_VIEW_LINES = 14, ANALYTICS_VIEW_CHROME_LINES = 8, ANALYTICS_VIEW_TABS, TOP_PAGES_LIMIT = 5, TOP_CITED_DAYS = 30, label = (text) => text.padEnd(26);
64783
64834
  var init_analytics_view = __esm(() => {
64784
64835
  init_trpc();
64785
64836
  init_config();
@@ -66788,4 +66839,4 @@ main().catch((err) => {
66788
66839
  process.exit(1);
66789
66840
  });
66790
66841
 
66791
- //# debugId=6712b11a-8117-30cb-6475-6e2164756e21
66842
+ //# debugId=46f904ed-b3a2-d9c5-6475-6e2164756e21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.57.0",
3
+ "version": "0.57.2",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Manage MCP servers for AI tools",
6
6
  "license": "MIT",