@dosu/cli 0.11.0-alpha.4 → 0.11.0-alpha.5

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 +70 -85
  2. 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.11.0-alpha.4";
4344
+ var VERSION = "0.11.0-alpha.5";
4345
4345
 
4346
4346
  // src/debug/logger.ts
4347
4347
  import {
@@ -4744,10 +4744,11 @@ function checkForSkillUpdates() {
4744
4744
  const isStale = !cache || Date.now() - cache.lastCheck > CHECK_INTERVAL_MS;
4745
4745
  if (isStale) {
4746
4746
  fetchLatestSha().then((latest) => {
4747
+ const fresh = readSkillCache();
4747
4748
  writeSkillCache({
4748
4749
  lastCheck: Date.now(),
4749
- latestSha: latest ?? cache?.latestSha ?? "",
4750
- installedSha: cache?.installedSha ?? ""
4750
+ latestSha: latest ?? fresh?.latestSha ?? "",
4751
+ installedSha: fresh?.installedSha ?? ""
4751
4752
  });
4752
4753
  if (latest) {
4753
4754
  logger.debug("skill-update-check", `Cached latest SHA: ${latest}`);
@@ -6378,6 +6379,28 @@ var init_default_deployment_config = __esm(() => {
6378
6379
  };
6379
6380
  });
6380
6381
 
6382
+ // src/setup/prompt-symbols.ts
6383
+ function symbol(unicodeValue, asciiValue) {
6384
+ return unicode ? unicodeValue : asciiValue;
6385
+ }
6386
+ function supportsUnicode() {
6387
+ if (process.platform !== "win32") {
6388
+ return process.env.TERM !== "linux";
6389
+ }
6390
+ return !!(process.env.CI || process.env.WT_SESSION || process.env.TERMINUS_SUBLIME || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm");
6391
+ }
6392
+ var unicode, ACTIVE_SYMBOL, SUBMIT_SYMBOL, CANCEL_SYMBOL, BAR, FOOTER, CHECKBOX_OFF, CHECKBOX_ON, ELLIPSIS = "...";
6393
+ var init_prompt_symbols = __esm(() => {
6394
+ unicode = supportsUnicode();
6395
+ ACTIVE_SYMBOL = symbol("◆", "*");
6396
+ SUBMIT_SYMBOL = symbol("◇", "o");
6397
+ CANCEL_SYMBOL = symbol("■", "x");
6398
+ BAR = symbol("│", "|");
6399
+ FOOTER = symbol("└", "-");
6400
+ CHECKBOX_OFF = symbol("◻", "[ ]");
6401
+ CHECKBOX_ON = symbol("◼", "[+]");
6402
+ });
6403
+
6381
6404
  // src/setup/github-repo-prompt.ts
6382
6405
  async function promptGitHubRepositories({
6383
6406
  message,
@@ -6416,27 +6439,11 @@ function visibleOptions(cursor, options, maxItems) {
6416
6439
  return { kind: "option", index: start + index };
6417
6440
  });
6418
6441
  }
6419
- function supportsUnicode() {
6420
- if (process.platform !== "win32") {
6421
- return process.env.TERM !== "linux";
6422
- }
6423
- return !!(process.env.CI || process.env.WT_SESSION || process.env.TERMINUS_SUBLIME || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm");
6424
- }
6425
- function symbol(unicodeValue, asciiValue) {
6426
- return unicode ? unicodeValue : asciiValue;
6427
- }
6428
- var import_picocolors22, unicode, ACTIVE_SYMBOL, SUBMIT_SYMBOL, CANCEL_SYMBOL, BAR, FOOTER, CHECKBOX_OFF, CHECKBOX_ON, ACTION_ARROW, ELLIPSIS = "...", ADD_REPOSITORIES_VALUE = "__add_repositories__", GitHubRepoPrompt;
6442
+ var import_picocolors22, ACTION_ARROW, ADD_REPOSITORIES_VALUE = "__add_repositories__", GitHubRepoPrompt;
6429
6443
  var init_github_repo_prompt = __esm(() => {
6430
6444
  init_dist5();
6445
+ init_prompt_symbols();
6431
6446
  import_picocolors22 = __toESM(require_picocolors(), 1);
6432
- unicode = supportsUnicode();
6433
- ACTIVE_SYMBOL = symbol("◆", "*");
6434
- SUBMIT_SYMBOL = symbol("◇", "o");
6435
- CANCEL_SYMBOL = symbol("■", "x");
6436
- BAR = symbol("│", "|");
6437
- FOOTER = symbol("└", "-");
6438
- CHECKBOX_OFF = symbol("◻", "[ ]");
6439
- CHECKBOX_ON = symbol("◼", "[+]");
6440
6447
  ACTION_ARROW = symbol("→", ">");
6441
6448
  GitHubRepoPrompt = class GitHubRepoPrompt extends x {
6442
6449
  options;
@@ -7298,7 +7305,8 @@ async function createDeploymentForRepo(trpc, orgID, spaceID, repo) {
7298
7305
  });
7299
7306
  if (!dataSource?.data_source_id) {
7300
7307
  logger.warn("setup", `dataSource.create returned no data_source for ${repo.slug}`);
7301
- return { deployment_id: deployment.deployment_id };
7308
+ await deleteOrphanDeployment(trpc, deployment.deployment_id, repo.slug);
7309
+ return null;
7302
7310
  }
7303
7311
  await trpc.dataSource.syncDataSource.mutate(dataSource.data_source_id);
7304
7312
  const spaceDeployments = await trpc.workspaces.listForSpace.query(spaceID);
@@ -7422,17 +7430,17 @@ ${lines}`);
7422
7430
  });
7423
7431
  }
7424
7432
  }
7425
- const expectedDsIds = created.map((c) => c.data_source_id).filter((id) => Boolean(id));
7433
+ const expectedDsIds = created.map((c) => c.data_source_id);
7426
7434
  const survivors = await verifyDataSourcesPersist(trpc, orgID, expectedDsIds, opts.verify);
7427
7435
  const reverted = [];
7428
7436
  if (survivors.dropped.size > 0) {
7429
- const droppedEntries = created.filter((c) => c.data_source_id && survivors.dropped.has(c.data_source_id));
7437
+ const droppedEntries = created.filter((c) => survivors.dropped.has(c.data_source_id));
7430
7438
  for (const entry of droppedEntries) {
7431
7439
  await deleteOrphanDeployment(trpc, entry.deployment_id, entry.slug);
7432
7440
  reverted.push({ slug: entry.slug, deployment_id: entry.deployment_id });
7433
7441
  }
7434
7442
  }
7435
- const survived = created.filter((c) => !c.data_source_id || survivors.alive.has(c.data_source_id));
7443
+ const survived = created.filter((c) => survivors.alive.has(c.data_source_id));
7436
7444
  if (survived.length === 0) {
7437
7445
  s.stop("Failed");
7438
7446
  if (reverted.length > 0) {
@@ -7453,13 +7461,12 @@ ${lines}`);
7453
7461
  ${dim(`deployment ${deployment_id}`)}`);
7454
7462
  }
7455
7463
  const primary = (detected && survived.find((c) => c.slug === detected.slug)) ?? survived[0];
7456
- const survivingDataSourceIds = survived.map((c) => c.data_source_id).filter((id) => Boolean(id));
7457
7464
  return {
7458
7465
  advance: true,
7459
7466
  has_connected_repo: true,
7460
7467
  deployment_id: primary.deployment_id,
7461
7468
  space_id: cfg.space_id,
7462
- created_data_source_ids: survivingDataSourceIds
7469
+ created_data_source_ids: survived.map((c) => c.data_source_id)
7463
7470
  };
7464
7471
  }
7465
7472
  }
@@ -7520,28 +7527,12 @@ function wrapIndex(index, length) {
7520
7527
  function isPrintableKey(key) {
7521
7528
  return key.length === 1 && key >= " " && key !== "";
7522
7529
  }
7523
- function supportsUnicode2() {
7524
- if (process.platform !== "win32") {
7525
- return process.env.TERM !== "linux";
7526
- }
7527
- return !!(process.env.CI || process.env.WT_SESSION || process.env.TERMINUS_SUBLIME || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm");
7528
- }
7529
- function symbol2(unicodeValue, asciiValue) {
7530
- return unicode2 ? unicodeValue : asciiValue;
7531
- }
7532
- var import_picocolors23, unicode2, ACTIVE_SYMBOL2, SUBMIT_SYMBOL2, CANCEL_SYMBOL2, BAR2, FOOTER2, CHECKBOX_OFF2, CHECKBOX_ON2, CHECKBOX_PARTIAL, ELLIPSIS2 = "...", MAX_VISIBLE_FILE_ITEMS = 15, GitHubDocsImportPrompt;
7530
+ var import_picocolors23, CHECKBOX_PARTIAL, MAX_VISIBLE_FILE_ITEMS = 15, GitHubDocsImportPrompt;
7533
7531
  var init_github_doc_import_prompt = __esm(() => {
7534
7532
  init_dist5();
7533
+ init_prompt_symbols();
7535
7534
  import_picocolors23 = __toESM(require_picocolors(), 1);
7536
- unicode2 = supportsUnicode2();
7537
- ACTIVE_SYMBOL2 = symbol2("◆", "*");
7538
- SUBMIT_SYMBOL2 = symbol2("◇", "o");
7539
- CANCEL_SYMBOL2 = symbol2("■", "x");
7540
- BAR2 = symbol2("│", "|");
7541
- FOOTER2 = symbol2("└", "-");
7542
- CHECKBOX_OFF2 = symbol2("◻", "[ ]");
7543
- CHECKBOX_ON2 = symbol2("◼", "[+]");
7544
- CHECKBOX_PARTIAL = symbol2("◧", "[-]");
7535
+ CHECKBOX_PARTIAL = symbol("◧", "[-]");
7545
7536
  GitHubDocsImportPrompt = class GitHubDocsImportPrompt extends x {
7546
7537
  repositories;
7547
7538
  mode = "repos";
@@ -7757,24 +7748,24 @@ var init_github_doc_import_prompt = __esm(() => {
7757
7748
  return "partial";
7758
7749
  }
7759
7750
  renderPrompt() {
7760
- const promptSymbol = this.state === "submit" ? import_picocolors23.default.green(SUBMIT_SYMBOL2) : this.state === "cancel" ? import_picocolors23.default.red(CANCEL_SYMBOL2) : import_picocolors23.default.cyan(ACTIVE_SYMBOL2);
7751
+ const promptSymbol = this.state === "submit" ? import_picocolors23.default.green(SUBMIT_SYMBOL) : this.state === "cancel" ? import_picocolors23.default.red(CANCEL_SYMBOL) : import_picocolors23.default.cyan(ACTIVE_SYMBOL);
7761
7752
  const title = this.mode === "repos" ? "Select docs to import" : this.currentRepository?.slug ?? "Files";
7762
- const header = `${import_picocolors23.default.gray(BAR2)}
7753
+ const header = `${import_picocolors23.default.gray(BAR)}
7763
7754
  ${promptSymbol} ${title}
7764
7755
  `;
7765
7756
  if (this.state === "submit") {
7766
- return `${header}${import_picocolors23.default.gray(BAR2)} ${import_picocolors23.default.dim(this.submitLabel())}`;
7757
+ return `${header}${import_picocolors23.default.gray(BAR)} ${import_picocolors23.default.dim(this.submitLabel())}`;
7767
7758
  }
7768
7759
  if (this.state === "cancel") {
7769
- return `${header}${import_picocolors23.default.gray(BAR2)}`;
7760
+ return `${header}${import_picocolors23.default.gray(BAR)}`;
7770
7761
  }
7771
7762
  return this.mode === "repos" ? this.renderRepositoryMode(header) : this.renderFileMode(header);
7772
7763
  }
7773
7764
  renderRepositoryMode(header) {
7774
- const help = `${import_picocolors23.default.gray(BAR2)} ${import_picocolors23.default.dim("space: import all docs in a repo →: browse repo docs Enter: confirm")}`;
7765
+ const help = `${import_picocolors23.default.gray(BAR)} ${import_picocolors23.default.dim("space: import all docs in a repo →: browse repo docs Enter: confirm")}`;
7775
7766
  const body = visibleOptions2(this.repoCursor, this.repositories.length).map((option) => {
7776
7767
  if (option.kind === "ellipsis") {
7777
- return `${import_picocolors23.default.gray(BAR2)} ${import_picocolors23.default.dim(ELLIPSIS2)}`;
7768
+ return `${import_picocolors23.default.gray(BAR)} ${import_picocolors23.default.dim(ELLIPSIS)}`;
7778
7769
  }
7779
7770
  const repo = this.repositories[option.index];
7780
7771
  const isActive = option.index === this.repoCursor;
@@ -7782,53 +7773,53 @@ ${promptSymbol} ${title}
7782
7773
  const marker = this.renderRepositoryMarker(state, isActive);
7783
7774
  const label = isActive ? import_picocolors23.default.cyan(repo.slug) : repo.slug;
7784
7775
  const hint = state === "locked" ? ` ${import_picocolors23.default.dim("(All docs already imported)")}` : "";
7785
- return `${import_picocolors23.default.gray(BAR2)} ${marker} ${label}${hint}`;
7776
+ return `${import_picocolors23.default.gray(BAR)} ${marker} ${label}${hint}`;
7786
7777
  });
7787
7778
  return `${header}${help}
7788
- ${import_picocolors23.default.gray(BAR2)}
7779
+ ${import_picocolors23.default.gray(BAR)}
7789
7780
  ${body.join(`
7790
7781
  `)}
7791
- ${import_picocolors23.default.cyan(FOOTER2)}`;
7782
+ ${import_picocolors23.default.cyan(FOOTER)}`;
7792
7783
  }
7793
7784
  renderFileMode(header) {
7794
- const back = `${import_picocolors23.default.gray(BAR2)} ${import_picocolors23.default.dim("←: back / Enter")}`;
7785
+ const back = `${import_picocolors23.default.gray(BAR)} ${import_picocolors23.default.dim("←: back / Enter")}`;
7795
7786
  const searchValue = this.searchQuery || import_picocolors23.default.dim(this.searchActive ? "" : "type to filter");
7796
- const search = `${import_picocolors23.default.gray(BAR2)} Search: ${searchValue}`;
7797
- const help = `${import_picocolors23.default.gray(BAR2)} ${import_picocolors23.default.dim("space: toggle doc type: search a: select all visible ←: back / Enter")}`;
7787
+ const search = `${import_picocolors23.default.gray(BAR)} Search: ${searchValue}`;
7788
+ const help = `${import_picocolors23.default.gray(BAR)} ${import_picocolors23.default.dim("space: toggle doc type: search a: select all visible ←: back / Enter")}`;
7798
7789
  const body = visibleOptions2(this.fileCursor, this.filteredFiles.length, MAX_VISIBLE_FILE_ITEMS).map((option) => {
7799
7790
  if (option.kind === "ellipsis") {
7800
- return `${import_picocolors23.default.gray(BAR2)} ${import_picocolors23.default.dim(ELLIPSIS2)}`;
7791
+ return `${import_picocolors23.default.gray(BAR)} ${import_picocolors23.default.dim(ELLIPSIS)}`;
7801
7792
  }
7802
7793
  const file = this.filteredFiles[option.index];
7803
7794
  const isActive = option.index === this.fileCursor;
7804
7795
  const isSelected = this.selectedIds.has(file.id);
7805
- const marker = file.is_synced ? isActive ? import_picocolors23.default.cyan(CHECKBOX_OFF2) : import_picocolors23.default.dim(CHECKBOX_OFF2) : isSelected ? isActive ? import_picocolors23.default.cyan(CHECKBOX_ON2) : CHECKBOX_ON2 : isActive ? import_picocolors23.default.cyan(CHECKBOX_OFF2) : CHECKBOX_OFF2;
7796
+ const marker = file.is_synced ? isActive ? import_picocolors23.default.cyan(CHECKBOX_OFF) : import_picocolors23.default.dim(CHECKBOX_OFF) : isSelected ? isActive ? import_picocolors23.default.cyan(CHECKBOX_ON) : CHECKBOX_ON : isActive ? import_picocolors23.default.cyan(CHECKBOX_OFF) : CHECKBOX_OFF;
7806
7797
  const label = file.is_synced ? isActive ? import_picocolors23.default.cyan(file.path) : import_picocolors23.default.dim(file.path) : isActive ? import_picocolors23.default.cyan(file.path) : file.path;
7807
7798
  const hint = file.is_synced ? ` ${import_picocolors23.default.dim("(Already imported)")}` : "";
7808
- return `${import_picocolors23.default.gray(BAR2)} ${marker} ${label}${hint}`;
7799
+ return `${import_picocolors23.default.gray(BAR)} ${marker} ${label}${hint}`;
7809
7800
  });
7810
7801
  const content = body.length > 0 ? body.join(`
7811
- `) : `${import_picocolors23.default.gray(BAR2)} ${import_picocolors23.default.dim("No docs match your search.")}`;
7802
+ `) : `${import_picocolors23.default.gray(BAR)} ${import_picocolors23.default.dim("No docs match your search.")}`;
7812
7803
  return `${header}${back}
7813
- ${import_picocolors23.default.gray(BAR2)}
7804
+ ${import_picocolors23.default.gray(BAR)}
7814
7805
  ${search}
7815
- ${import_picocolors23.default.gray(BAR2)}
7806
+ ${import_picocolors23.default.gray(BAR)}
7816
7807
  ${content}
7817
- ${import_picocolors23.default.gray(BAR2)}
7808
+ ${import_picocolors23.default.gray(BAR)}
7818
7809
  ${help}
7819
- ${import_picocolors23.default.cyan(FOOTER2)}`;
7810
+ ${import_picocolors23.default.cyan(FOOTER)}`;
7820
7811
  }
7821
7812
  renderRepositoryMarker(state, isActive) {
7822
7813
  if (state === "all") {
7823
- return isActive ? import_picocolors23.default.cyan(CHECKBOX_ON2) : CHECKBOX_ON2;
7814
+ return isActive ? import_picocolors23.default.cyan(CHECKBOX_ON) : CHECKBOX_ON;
7824
7815
  }
7825
7816
  if (state === "partial") {
7826
7817
  return isActive ? import_picocolors23.default.cyan(CHECKBOX_PARTIAL) : CHECKBOX_PARTIAL;
7827
7818
  }
7828
7819
  if (state === "locked") {
7829
- return isActive ? import_picocolors23.default.cyan(CHECKBOX_OFF2) : import_picocolors23.default.dim(CHECKBOX_OFF2);
7820
+ return isActive ? import_picocolors23.default.cyan(CHECKBOX_OFF) : import_picocolors23.default.dim(CHECKBOX_OFF);
7830
7821
  }
7831
- return isActive ? import_picocolors23.default.cyan(CHECKBOX_OFF2) : CHECKBOX_OFF2;
7822
+ return isActive ? import_picocolors23.default.cyan(CHECKBOX_OFF) : CHECKBOX_OFF;
7832
7823
  }
7833
7824
  submitLabel() {
7834
7825
  const count = this.selectedIds.size;
@@ -8456,6 +8447,12 @@ async function runSetup(opts = {}) {
8456
8447
  Se("\uD83C\uDF89 Setup complete!");
8457
8448
  }
8458
8449
  }
8450
+ function applyDeployment(cfg, d3) {
8451
+ cfg.deployment_id = d3.deployment_id;
8452
+ cfg.deployment_name = d3.name;
8453
+ cfg.org_id = d3.org_id;
8454
+ cfg.space_id = d3.space_id;
8455
+ }
8459
8456
  function applyModeOverride(cfg, opts) {
8460
8457
  if (!opts.mode)
8461
8458
  return;
@@ -8637,10 +8634,7 @@ async function bindOnboardingDeployment(apiClient, cfg, targetOrg) {
8637
8634
  return false;
8638
8635
  }
8639
8636
  cfg.mode = undefined;
8640
- cfg.deployment_id = deployment.deployment_id;
8641
- cfg.deployment_name = deployment.name;
8642
- cfg.org_id = deployment.org_id;
8643
- cfg.space_id = deployment.space_id;
8637
+ applyDeployment(cfg, deployment);
8644
8638
  logger.info("setup", `Bound onboarding context org=${targetOrg.org_id} deployment=${deployment.deployment_id}`);
8645
8639
  M2.success(`Organization
8646
8640
  ${dim(targetOrg.name)}`);
@@ -8657,19 +8651,13 @@ async function resolveDeployment(apiClient, cfg, opts) {
8657
8651
  if (!d4)
8658
8652
  return false;
8659
8653
  cfg.mode = undefined;
8660
- cfg.deployment_id = d4.deployment_id;
8661
- cfg.deployment_name = d4.name;
8662
- cfg.org_id = d4.org_id;
8663
- cfg.space_id = d4.space_id;
8654
+ applyDeployment(cfg, d4);
8664
8655
  return true;
8665
8656
  }
8666
8657
  if (cfg.mode === MODE_OSS) {
8667
8658
  const deployments = await fetchDeployments(apiClient);
8668
8659
  if (deployments.length > 0) {
8669
- cfg.deployment_id = deployments[0].deployment_id;
8670
- cfg.deployment_name = deployments[0].name;
8671
- cfg.org_id = deployments[0].org_id;
8672
- cfg.space_id = deployments[0].space_id;
8660
+ applyDeployment(cfg, deployments[0]);
8673
8661
  }
8674
8662
  return true;
8675
8663
  }
@@ -8680,10 +8668,7 @@ async function resolveDeployment(apiClient, cfg, opts) {
8680
8668
  if (!d3)
8681
8669
  return false;
8682
8670
  cfg.mode = undefined;
8683
- cfg.deployment_id = d3.deployment_id;
8684
- cfg.deployment_name = d3.name;
8685
- cfg.org_id = d3.org_id;
8686
- cfg.space_id = d3.space_id;
8671
+ applyDeployment(cfg, d3);
8687
8672
  return true;
8688
8673
  }
8689
8674
  async function fetchDeployments(apiClient) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.11.0-alpha.4",
3
+ "version": "0.11.0-alpha.5",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Manage MCP servers for AI tools",
6
6
  "license": "MIT",