salesprompter-cli 0.1.30 → 0.1.31

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/dist/cli.js +41 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2540,9 +2540,22 @@ function writeWizardSection(title, description) {
2540
2540
  }
2541
2541
  writeWizardLine();
2542
2542
  }
2543
+ function compactOptionalText(value) {
2544
+ const compacted = value?.trim();
2545
+ return compacted && compacted.length > 0 ? compacted : null;
2546
+ }
2543
2547
  function getOrgLabel(session) {
2544
- const label = session.user.orgName ?? session.user.orgSlug ?? session.user.orgId ?? null;
2545
- return label;
2548
+ const orgName = compactOptionalText(session.user.orgName);
2549
+ const orgSlug = compactOptionalText(session.user.orgSlug);
2550
+ const orgId = compactOptionalText(session.user.orgId);
2551
+ if (orgName) {
2552
+ const details = [orgSlug, orgId].filter((value) => Boolean(value));
2553
+ return details.length > 0 ? `${orgName} (${details.join(", ")})` : orgName;
2554
+ }
2555
+ if (orgSlug) {
2556
+ return orgId ? `${orgSlug} (${orgId})` : orgSlug;
2557
+ }
2558
+ return orgId;
2546
2559
  }
2547
2560
  function resolveSessionOrgId(session) {
2548
2561
  const orgId = session.user.orgId?.trim();
@@ -2800,9 +2813,32 @@ async function ensureWizardSession(options) {
2800
2813
  }
2801
2814
  async function confirmWizardWorkspace(rl, session, options) {
2802
2815
  const orgLabel = getOrgLabel(session);
2803
- const promptLabel = orgLabel ? `workspace ${orgLabel}` : "this signed-in account without a selected workspace";
2804
- const useCurrentWorkspace = await promptYesNo(rl, `Use ${promptLabel} for this CLI run?`, true);
2805
- if (useCurrentWorkspace) {
2816
+ const hasNamedOrg = Boolean(compactOptionalText(session.user.orgName) || compactOptionalText(session.user.orgSlug));
2817
+ const currentLabel = orgLabel
2818
+ ? hasNamedOrg
2819
+ ? `Use ${orgLabel}`
2820
+ : `Use current workspace (${orgLabel})`
2821
+ : "Use signed-in account without a selected workspace";
2822
+ const currentDescription = orgLabel
2823
+ ? hasNamedOrg
2824
+ ? "Current cached CLI workspace"
2825
+ : "Workspace name is not available in this cached token"
2826
+ : "Choose another workspace in the browser if this account belongs to more than one";
2827
+ const workspaceChoice = await promptChoice(rl, "Which workspace should I use?", [
2828
+ {
2829
+ value: "current",
2830
+ label: currentLabel,
2831
+ description: currentDescription,
2832
+ aliases: ["current", "cached", "this workspace", "use current"]
2833
+ },
2834
+ {
2835
+ value: "browser",
2836
+ label: "Choose another workspace in the browser",
2837
+ description: "Opens Salesprompter so you can pick from your organizations",
2838
+ aliases: ["browser", "choose another", "switch workspace", "select organization"]
2839
+ }
2840
+ ], "current");
2841
+ if (workspaceChoice === "current") {
2806
2842
  writeWizardLine();
2807
2843
  return session;
2808
2844
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "salesprompter-cli",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "description": "Sales workflow CLI for guided lead generation, enrichment, scoring, and sync.",
5
5
  "author": "Daniel Sinewe <hello@danielsinewe.com>",
6
6
  "type": "module",