clishop 1.5.1 → 1.5.3

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.
package/README.md CHANGED
@@ -76,33 +76,21 @@ npm link
76
76
 
77
77
  You can create your account on [clishop.ai](https://clishop.ai) or do everything from the CLI.
78
78
 
79
- ### Human-friendly setup
79
+ ### Setup
80
80
 
81
- ```bash
82
- clishop setup
83
- ```
84
-
85
- This starts the interactive setup flow, creates a resumable setup session, shows a secure payment link, and waits for completion.
81
+ Setup only needs an email address. Search first, then add your address and payment method when you're ready to buy.
86
82
 
87
- ### Agent-safe setup
88
-
89
- For OpenClaw, MCP clients, Claude-style shells, and other tool runners, use the explicit setup session commands instead of scraping terminal output:
83
+ For OpenClaw, MCP clients, Claude-style shells, and other tool runners, use:
90
84
 
91
85
  ```bash
92
86
  clishop setup start --email user@example.com --json
93
- clishop setup status --setup-id <setup_id> --json
94
- clishop setup wait --setup-id <setup_id> --timeout 300 --json
95
- clishop setup cancel --setup-id <setup_id> --json
96
87
  ```
97
88
 
98
- `setup start` returns immediately with:
99
-
100
- - `setup_id`: the resumable setup session handle for the agent
101
- - `setup_url`: the link the human must open in a browser
102
- - `expires_at`: when the session expires
103
- - `poll_after_seconds`: suggested polling interval
89
+ `setup start` returns immediately with account-ready status and stores auth locally.
104
90
 
105
- The agent sends `setup_url` to the human and keeps `setup_id` locally for `status`, `wait`, or `cancel`.
91
+ - Search products right away with `clishop search <query>`
92
+ - Add a shipping address later with `clishop address add`
93
+ - Add a payment method later with `clishop payment add`
106
94
 
107
95
  After setup is complete, add a shipping address and start ordering:
108
96
 
@@ -203,10 +191,10 @@ clishop-mcp # If installed globally
203
191
  npx -y clishop --mcp # Without installing
204
192
  ```
205
193
 
206
- The MCP onboarding tools now follow the same resumable setup session model:
194
+ The MCP onboarding tools now follow the same email-first model:
207
195
 
208
- - `setup` starts the session and returns `setup_id` plus `setup_url`
209
- - `setup_status` checks progress and finalizes auth when setup is complete
196
+ - `setup` creates the account immediately from the email address
197
+ - `setup_status` remains available only for legacy setup IDs
210
198
 
211
199
  See the [MCP setup guides](https://clishop.ai/docs#mcp-overview) for VS Code, Claude Desktop, Cursor, and Windsurf configuration.
212
200
 
@@ -155,10 +155,27 @@ async function postSetupRequest(path, body) {
155
155
  }
156
156
  async function startSetupSession(email) {
157
157
  const data = await postSetupRequest("/auth/setup-link", { email });
158
- if (!data.setupUrl || !(data.setupId || data.deviceCode) || !data.expiresIn || !data.pollInterval) {
158
+ const setupId = data.setupId || data.deviceCode || data.user?.id;
159
+ if (data.token && data.refreshToken && data.user && setupId) {
160
+ await storeAuthFromSetup({
161
+ token: data.token,
162
+ refreshToken: data.refreshToken,
163
+ user: data.user
164
+ });
165
+ return {
166
+ ok: true,
167
+ setup_id: setupId,
168
+ status: "completed",
169
+ next_action: "search_products",
170
+ expires_at: data.expiresAt,
171
+ poll_after_seconds: 0,
172
+ account_id: data.accountId || data.user.id,
173
+ human_message: data.humanMessage || "Account ready. Search now, then add address and payment when you are ready to buy."
174
+ };
175
+ }
176
+ if (!data.setupUrl || !setupId || !data.expiresIn || !data.pollInterval) {
159
177
  throw new Error(data?.message || "Failed to create setup session.");
160
178
  }
161
- const setupId = data.setupId || data.deviceCode;
162
179
  const expiresAt = data.expiresAt || new Date(Date.now() + data.expiresIn * 1e3).toISOString();
163
180
  return {
164
181
  ok: true,
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  resolveBackend,
15
15
  startSetupSession,
16
16
  waitForSetupSession
17
- } from "./chunk-EM4ZGZOU.js";
17
+ } from "./chunk-UO2N5F5R.js";
18
18
  import {
19
19
  createAgent,
20
20
  deleteAgent,
@@ -785,7 +785,6 @@ import ora3 from "ora";
785
785
 
786
786
  // src/commands/setup.ts
787
787
  import chalk4 from "chalk";
788
- import inquirer3 from "inquirer";
789
788
  import open from "open";
790
789
  import { execFileSync } from "child_process";
791
790
  var DEFAULT_SETUP_TIMEOUT_MS = 30 * 60 * 1e3;
@@ -816,9 +815,6 @@ function divider(color = chalk4.cyan) {
816
815
  function writeJson(payload) {
817
816
  process.stdout.write(JSON.stringify(payload, null, 2) + "\n");
818
817
  }
819
- function isInteractiveSession() {
820
- return Boolean(process.stdin.isTTY && process.stdout.isTTY);
821
- }
822
818
  function isLikelyEmail(value) {
823
819
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value.trim());
824
820
  }
@@ -846,17 +842,54 @@ function printSetupLink(message, setupUrl) {
846
842
  console.log(" " + setupUrl);
847
843
  console.log();
848
844
  }
845
+ function printSetupEmailInstructions() {
846
+ console.log(chalk4.yellow(" Email is required to start setup."));
847
+ console.log();
848
+ console.log(chalk4.dim(" Start setup with:"));
849
+ console.log(chalk4.white(" clishop setup start --email user@example.com --json"));
850
+ console.log();
851
+ }
849
852
  function printSetupStartResult(result) {
853
+ if (result.status === "completed") {
854
+ console.log();
855
+ console.log(chalk4.bold(" Account created."));
856
+ if (result.account_id) {
857
+ console.log(chalk4.dim(` Account: ${result.account_id}`));
858
+ }
859
+ console.log();
860
+ console.log(chalk4.dim(result.human_message));
861
+ console.log();
862
+ return;
863
+ }
850
864
  console.log();
851
865
  console.log(chalk4.bold(" Setup session created."));
852
866
  console.log(chalk4.dim(` Setup ID: ${result.setup_id}`));
853
- console.log(chalk4.dim(` Expires: ${new Date(result.expires_at).toLocaleString()}`));
867
+ if (result.expires_at) {
868
+ console.log(chalk4.dim(` Expires: ${new Date(result.expires_at).toLocaleString()}`));
869
+ }
854
870
  printSetupLink("Give this link to your human to configure the payment method:", result.setup_url);
855
871
  console.log(chalk4.dim(" Check progress later with:"));
856
872
  console.log(chalk4.white(` clishop setup status --setup-id ${result.setup_id}`));
857
873
  console.log(chalk4.white(` clishop setup wait --setup-id ${result.setup_id}`));
858
874
  console.log();
859
875
  }
876
+ function printSetupReadyBanner(userLabel) {
877
+ console.log();
878
+ divider(chalk4.green);
879
+ console.log();
880
+ console.log(chalk4.bold.green(` \u2713 Account ready${userLabel ? ` for ${userLabel}` : ""}`));
881
+ console.log();
882
+ console.log(chalk4.dim(" Search first. Add an address and payment method only when you're ready to buy."));
883
+ console.log();
884
+ console.log(chalk4.dim(" Next steps:"));
885
+ console.log(chalk4.white(" clishop search <query> ") + chalk4.dim("Search for products"));
886
+ console.log(chalk4.white(" clishop address add ") + chalk4.dim("Add a shipping address later"));
887
+ console.log(chalk4.white(" clishop payment add ") + chalk4.dim("Add a payment method when needed"));
888
+ console.log(chalk4.white(" clishop buy <id> ") + chalk4.dim("Buy after choosing address + payment"));
889
+ console.log();
890
+ divider(chalk4.green);
891
+ console.log();
892
+ }
860
893
  function printSetupStatusResult(result) {
861
894
  console.log();
862
895
  if (!result.ok) {
@@ -877,7 +910,7 @@ function printSetupStatusResult(result) {
877
910
  console.log();
878
911
  break;
879
912
  case "completed":
880
- console.log(chalk4.green(" \u2713 Payment linked and account activated!"));
913
+ console.log(chalk4.green(" \u2713 Setup complete."));
881
914
  console.log(chalk4.dim(` Setup ID: ${result.setup_id}`));
882
915
  if (result.account_id) {
883
916
  console.log(chalk4.dim(` Account: ${result.account_id}`));
@@ -940,6 +973,9 @@ async function runSetupStartCommand(email, json = false) {
940
973
  }
941
974
  try {
942
975
  const result = await startSetupSession(normalizedEmail);
976
+ if (result.ok && result.status === "completed") {
977
+ getConfig().set("setupCompleted", true);
978
+ }
943
979
  if (json) {
944
980
  writeJson(sanitizeSetupPayload(result));
945
981
  return;
@@ -1039,10 +1075,10 @@ async function runSetupWaitCommand(setupId, timeoutSeconds, json = false) {
1039
1075
  }
1040
1076
  }
1041
1077
  function registerSetupCommand(program2) {
1042
- const setup = program2.command("setup").description("Set up your CLISHOP account or manage setup sessions").argument("[email]", "Email address for the human-friendly wrapper").action(async (email) => {
1078
+ const setup = program2.command("setup").description("Create your CLISHOP account or manage legacy setup sessions").argument("[email]", "Email address").action(async (email) => {
1043
1079
  await runSetupWizard(email);
1044
1080
  });
1045
- setup.command("start").description("Create a setup session and return immediately").requiredOption("--email <email>", "Email address").option("--json", "Output machine-readable JSON").action(async (opts) => {
1081
+ setup.command("start").description("Create your account and return immediately").requiredOption("--email <email>", "Email address").option("--json", "Output machine-readable JSON").action(async (opts) => {
1046
1082
  await runSetupStartCommand(opts.email, opts.json);
1047
1083
  });
1048
1084
  setup.command("status").description("Check the status of a setup session").requiredOption("--setup-id <setupId>", "Setup session ID").option("--json", "Output machine-readable JSON").action(async (opts) => {
@@ -1069,25 +1105,8 @@ async function runSetupWizard(emailArg, { json = false } = {}) {
1069
1105
  const loggedIn = await isLoggedIn();
1070
1106
  if (loggedIn) {
1071
1107
  const user = await getUserInfo();
1072
- try {
1073
- const api = getApiClient();
1074
- const agent = getActiveAgent();
1075
- const pmRes = await api.get("/payment-methods", { params: { agent: agent.name } });
1076
- const methods = pmRes.data.paymentMethods || [];
1077
- if (methods.length > 0) {
1078
- console.log();
1079
- console.log(chalk4.green(` \u2713 Already set up as ${chalk4.bold(user?.name || user?.email || "unknown")} with a payment method linked.`));
1080
- console.log(chalk4.dim(" Nothing to do. Run ") + chalk4.white("clishop search <query>") + chalk4.dim(" to get started."));
1081
- console.log();
1082
- return;
1083
- }
1084
- } catch {
1085
- }
1086
- console.log();
1087
- console.log(chalk4.green(` \u2713 Logged in as ${chalk4.bold(user?.name || user?.email || "unknown")}`));
1088
- console.log(chalk4.dim(" No payment method linked yet. Let's fix that."));
1089
- console.log();
1090
- await runPaymentLinkFlow(config);
1108
+ config.set("setupCompleted", true);
1109
+ printSetupReadyBanner(user?.name || user?.email || "unknown");
1091
1110
  return;
1092
1111
  }
1093
1112
  console.log();
@@ -1095,14 +1114,14 @@ async function runSetupWizard(emailArg, { json = false } = {}) {
1095
1114
  console.log();
1096
1115
  console.log(chalk4.bold.cyan(" W E L C O M E T O C L I S H O P"));
1097
1116
  console.log(chalk4.dim(" Order anything from your terminal."));
1098
- console.log(chalk4.dim(` npm: v${"1.5.1"}`));
1099
- console.log(chalk4.dim(` Build: ${"2026-04-04T20:33:18.769Z"}`));
1117
+ console.log(chalk4.dim(` npm: v${"1.5.3"}`));
1118
+ console.log(chalk4.dim(` Build: ${"2026-04-04T21:38:36.646Z"}`));
1100
1119
  console.log();
1101
1120
  divider(chalk4.cyan);
1102
1121
  console.log();
1103
- console.log(chalk4.dim(" Set up your account in one step. You'll get a link to"));
1104
- console.log(chalk4.dim(" securely link your payment method in the browser."));
1105
- console.log(chalk4.dim(" Your AI agent can then add addresses and place orders for you."));
1122
+ console.log(chalk4.dim(" Set up your account with your email first."));
1123
+ console.log(chalk4.dim(" Search for products right away."));
1124
+ console.log(chalk4.dim(" Add your address and payment method later, only when you're ready to buy."));
1106
1125
  console.log();
1107
1126
  console.log(chalk4.dim(" By creating an account you agree to the CLISHOP"));
1108
1127
  console.log(chalk4.dim(" Terms & Conditions: ") + chalk4.cyan.underline("https://clishop.ai/terms"));
@@ -1110,15 +1129,9 @@ async function runSetupWizard(emailArg, { json = false } = {}) {
1110
1129
  console.log();
1111
1130
  let email = emailArg?.trim();
1112
1131
  if (!email) {
1113
- if (!isInteractiveSession()) {
1114
- console.error(chalk4.red("\n\u2717 Email is required in non-interactive mode. Use: clishop setup start --email <email> --json\n"));
1115
- process.exitCode = 1;
1116
- return;
1117
- }
1118
- const answers = await inquirer3.prompt([
1119
- { type: "input", name: "email", message: "Email:" }
1120
- ]);
1121
- email = answers.email?.trim();
1132
+ printSetupEmailInstructions();
1133
+ process.exitCode = 1;
1134
+ return;
1122
1135
  }
1123
1136
  if (!email || !isLikelyEmail(email)) {
1124
1137
  console.error(chalk4.red("\n\u2717 A valid email address is required.\n"));
@@ -1127,7 +1140,7 @@ async function runSetupWizard(emailArg, { json = false } = {}) {
1127
1140
  }
1128
1141
  let startResult;
1129
1142
  try {
1130
- console.log(chalk4.dim(" Creating your account and payment link..."));
1143
+ console.log(chalk4.dim(" Creating your account..."));
1131
1144
  startResult = await startSetupSession(email);
1132
1145
  } catch (error) {
1133
1146
  console.log(chalk4.red(` \u2717 Setup failed: ${error?.message || "Unknown error"}`));
@@ -1137,6 +1150,11 @@ async function runSetupWizard(emailArg, { json = false } = {}) {
1137
1150
  process.exitCode = 1;
1138
1151
  return;
1139
1152
  }
1153
+ if (startResult.status === "completed") {
1154
+ config.set("setupCompleted", true);
1155
+ printSetupReadyBanner(email);
1156
+ return;
1157
+ }
1140
1158
  printSetupStartResult(startResult);
1141
1159
  console.log(chalk4.dim(" Waiting for you to complete payment setup..."));
1142
1160
  console.log(chalk4.dim(" You can resume later with the setup ID shown above."));
@@ -1150,57 +1168,7 @@ async function runSetupWizard(emailArg, { json = false } = {}) {
1150
1168
  return;
1151
1169
  }
1152
1170
  config.set("setupCompleted", true);
1153
- console.log();
1154
- divider(chalk4.green);
1155
- console.log();
1156
- console.log(chalk4.bold.green(" \u2713 You're all set!"));
1157
- console.log();
1158
- console.log(chalk4.dim(" Your agent can now add addresses and place orders."));
1159
- console.log(chalk4.dim(" To add a shipping address manually:"));
1160
- console.log(chalk4.white(" clishop address add"));
1161
- console.log();
1162
- console.log(chalk4.dim(" Here are some commands to get you started:"));
1163
- console.log();
1164
- console.log(chalk4.white(" clishop search <query> ") + chalk4.dim("Search for products"));
1165
- console.log(chalk4.white(" clishop buy <id> ") + chalk4.dim("Quick-buy a product"));
1166
- console.log(chalk4.white(" clishop order list ") + chalk4.dim("View your orders"));
1167
- console.log(chalk4.white(" clishop --help ") + chalk4.dim("See all commands"));
1168
- console.log();
1169
- divider(chalk4.green);
1170
- console.log();
1171
- }
1172
- async function runPaymentLinkFlow(config) {
1173
- console.log(chalk4.dim(" Requesting secure payment setup link..."));
1174
- try {
1175
- const api = getApiClient();
1176
- const agent = getActiveAgent();
1177
- await ensureAgentOnBackend(agent.name);
1178
- const res = await api.post("/payment-methods/setup", { agent: agent.name });
1179
- const { setupUrl } = res.data;
1180
- printSetupLink("Open this link to link your payment method:", setupUrl);
1181
- const opened = await openBrowser(setupUrl);
1182
- if (opened) {
1183
- console.log(chalk4.dim(" (Browser opened automatically)"));
1184
- }
1185
- console.log();
1186
- await inquirer3.prompt([
1187
- { type: "input", name: "done", message: "Press Enter after completing payment setup in your browser..." }
1188
- ]);
1189
- console.log(chalk4.dim(" Checking for your payment method..."));
1190
- const pmRes = await api.get("/payment-methods", { params: { agent: agent.name } });
1191
- const methods = pmRes.data.paymentMethods || [];
1192
- if (methods.length > 0) {
1193
- const latest = methods[methods.length - 1];
1194
- updateAgent(agent.name, { defaultPaymentMethodId: latest.id });
1195
- console.log(chalk4.green(` \u2713 Payment method "${latest.label}" linked and set as default.`));
1196
- config.set("setupCompleted", true);
1197
- } else {
1198
- console.log(chalk4.yellow(" \u26A0 No payment method found yet. Run ") + chalk4.white("clishop setup") + chalk4.yellow(" to try again."));
1199
- }
1200
- } catch (error) {
1201
- console.log(chalk4.red(` \u2717 Could not get setup link: ${error?.response?.data?.message || error.message}`));
1202
- }
1203
- console.log();
1171
+ printSetupReadyBanner(email);
1204
1172
  }
1205
1173
 
1206
1174
  // src/commands/payment.ts
@@ -1218,7 +1186,7 @@ function registerPaymentCommands(program2) {
1218
1186
  spinner.stop();
1219
1187
  const methods = res.data.paymentMethods;
1220
1188
  if (methods.length === 0) {
1221
- console.log(chalk5.yellow("\nNo payment methods found. Run: clishop setup\n"));
1189
+ console.log(chalk5.yellow("\nNo payment methods found. Run: clishop payment add\n"));
1222
1190
  return;
1223
1191
  }
1224
1192
  console.log(chalk5.bold(`
@@ -1234,7 +1202,7 @@ Payment methods for agent "${agent.name}":
1234
1202
  handleApiError(error);
1235
1203
  }
1236
1204
  });
1237
- payment.command("add").description("Add an additional payment method (opens browser). First-time setup? Use 'clishop setup' instead.").action(async () => {
1205
+ payment.command("add").description("Add a payment method (opens browser)").action(async () => {
1238
1206
  try {
1239
1207
  const agent = getActiveAgent();
1240
1208
  await ensureAgentOnBackend(agent.name);
@@ -1251,8 +1219,8 @@ Payment methods for agent "${agent.name}":
1251
1219
  `));
1252
1220
  console.log(chalk5.dim("The CLI never collects raw card details. Payment is set up via the secure web portal."));
1253
1221
  console.log(chalk5.dim("Press Enter after completing the setup in your browser.\n"));
1254
- const inquirer10 = (await import("inquirer")).default;
1255
- await inquirer10.prompt([
1222
+ const inquirer9 = (await import("inquirer")).default;
1223
+ await inquirer9.prompt([
1256
1224
  { type: "input", name: "done", message: "Press Enter when done..." }
1257
1225
  ]);
1258
1226
  const checkSpinner = ora3("Checking for your payment method...").start();
@@ -1298,7 +1266,7 @@ Payment methods for agent "${agent.name}":
1298
1266
  // src/commands/search.ts
1299
1267
  import chalk6 from "chalk";
1300
1268
  import ora4 from "ora";
1301
- import inquirer4 from "inquirer";
1269
+ import inquirer3 from "inquirer";
1302
1270
  function formatPrice(cents, currency) {
1303
1271
  return new Intl.NumberFormat("en-US", {
1304
1272
  style: "currency",
@@ -2091,7 +2059,7 @@ Results for "${query}" \u2014 ${result.total} found (page ${result.page})
2091
2059
  short: p.name.length > 40 ? p.name.slice(0, 37) + "..." : p.name
2092
2060
  };
2093
2061
  });
2094
- const { selectedIds } = await inquirer4.prompt([
2062
+ const { selectedIds } = await inquirer3.prompt([
2095
2063
  {
2096
2064
  type: "checkbox",
2097
2065
  name: "selectedIds",
@@ -2327,7 +2295,7 @@ Product Information \u2014 ${total} result(s)
2327
2295
  // src/commands/order.ts
2328
2296
  import chalk7 from "chalk";
2329
2297
  import ora5 from "ora";
2330
- import inquirer5 from "inquirer";
2298
+ import inquirer4 from "inquirer";
2331
2299
  function formatPrice2(cents, currency) {
2332
2300
  return new Intl.NumberFormat("en-US", { style: "currency", currency }).format(cents / 100);
2333
2301
  }
@@ -2405,7 +2373,10 @@ function registerOrderCommands(program2) {
2405
2373
  return;
2406
2374
  }
2407
2375
  if (!paymentId) {
2408
- console.error(chalk7.red("\n\u2717 No payment method linked. Run: clishop setup"));
2376
+ console.error(chalk7.red("\n\u2717 No payment method linked for this agent."));
2377
+ console.error();
2378
+ console.error(chalk7.dim(" Add one when you're ready to buy with:"));
2379
+ console.error(chalk7.white(" clishop payment add"));
2409
2380
  process.exitCode = 1;
2410
2381
  return;
2411
2382
  }
@@ -2466,7 +2437,7 @@ function registerOrderCommands(program2) {
2466
2437
  console.log(` Total: ${chalk7.bold(formatPrice2(totalCents, product.currency))}`);
2467
2438
  console.log(` Agent: ${agent.name}`);
2468
2439
  console.log();
2469
- const { confirm } = await inquirer5.prompt([
2440
+ const { confirm } = await inquirer4.prompt([
2470
2441
  {
2471
2442
  type: "confirm",
2472
2443
  name: "confirm",
@@ -2613,7 +2584,7 @@ function registerOrderCommands(program2) {
2613
2584
  });
2614
2585
  order.command("cancel <id>").description("Cancel an order").action(async (id) => {
2615
2586
  try {
2616
- const { confirm } = await inquirer5.prompt([
2587
+ const { confirm } = await inquirer4.prompt([
2617
2588
  {
2618
2589
  type: "confirm",
2619
2590
  name: "confirm",
@@ -2635,7 +2606,7 @@ function registerOrderCommands(program2) {
2635
2606
  // src/commands/review.ts
2636
2607
  import chalk8 from "chalk";
2637
2608
  import ora6 from "ora";
2638
- import inquirer6 from "inquirer";
2609
+ import inquirer5 from "inquirer";
2639
2610
  function renderStars2(rating) {
2640
2611
  const filled = Math.round(rating);
2641
2612
  const empty = 10 - filled;
@@ -2688,7 +2659,7 @@ function registerReviewCommands(program2) {
2688
2659
  let storeReview = void 0;
2689
2660
  for (const item of unreviewedItems) {
2690
2661
  console.log(chalk8.bold(` Product: ${item.productName}`));
2691
- const { wantReview } = await inquirer6.prompt([
2662
+ const { wantReview } = await inquirer5.prompt([
2692
2663
  {
2693
2664
  type: "confirm",
2694
2665
  name: "wantReview",
@@ -2697,7 +2668,7 @@ function registerReviewCommands(program2) {
2697
2668
  }
2698
2669
  ]);
2699
2670
  if (!wantReview) continue;
2700
- const answers = await inquirer6.prompt([
2671
+ const answers = await inquirer5.prompt([
2701
2672
  {
2702
2673
  type: "select",
2703
2674
  name: "rating",
@@ -2728,7 +2699,7 @@ function registerReviewCommands(program2) {
2728
2699
  }
2729
2700
  if (!storeAlreadyReviewed) {
2730
2701
  console.log(chalk8.bold(` Store: ${reviewable.store.name}`));
2731
- const { wantStoreReview } = await inquirer6.prompt([
2702
+ const { wantStoreReview } = await inquirer5.prompt([
2732
2703
  {
2733
2704
  type: "confirm",
2734
2705
  name: "wantStoreReview",
@@ -2737,7 +2708,7 @@ function registerReviewCommands(program2) {
2737
2708
  }
2738
2709
  ]);
2739
2710
  if (wantStoreReview) {
2740
- const storeAnswers = await inquirer6.prompt([
2711
+ const storeAnswers = await inquirer5.prompt([
2741
2712
  {
2742
2713
  type: "select",
2743
2714
  name: "rating",
@@ -2797,7 +2768,7 @@ function registerReviewCommands(program2) {
2797
2768
  });
2798
2769
  review.command("add <productId>").description("Write a review for a product").option("--order <orderId>", "Associate with an order").action(async (productId, opts) => {
2799
2770
  try {
2800
- const answers = await inquirer6.prompt([
2771
+ const answers = await inquirer5.prompt([
2801
2772
  {
2802
2773
  type: "select",
2803
2774
  name: "rating",
@@ -2830,7 +2801,7 @@ function registerReviewCommands(program2) {
2830
2801
  });
2831
2802
  review.command("store <storeId>").description("Write a review for a store").option("--order <orderId>", "Associate with an order").action(async (storeId, opts) => {
2832
2803
  try {
2833
- const answers = await inquirer6.prompt([
2804
+ const answers = await inquirer5.prompt([
2834
2805
  {
2835
2806
  type: "select",
2836
2807
  name: "rating",
@@ -2932,7 +2903,7 @@ function registerReviewCommands(program2) {
2932
2903
  });
2933
2904
  review.command("delete <reviewId>").alias("rm").description("Delete one of your reviews").option("--store", "Delete a store review").action(async (reviewId, opts) => {
2934
2905
  try {
2935
- const { confirm } = await inquirer6.prompt([
2906
+ const { confirm } = await inquirer5.prompt([
2936
2907
  {
2937
2908
  type: "confirm",
2938
2909
  name: "confirm",
@@ -3244,7 +3215,7 @@ function registerStatusCommand(program2) {
3244
3215
  console.log();
3245
3216
  console.log(chalk11.bold(` \u{1F4B3} Payment Methods (${agent.paymentMethods.length})`));
3246
3217
  if (agent.paymentMethods.length === 0) {
3247
- console.log(chalk11.dim(" None \u2014 run: clishop setup"));
3218
+ console.log(chalk11.dim(" None \u2014 run: clishop payment add"));
3248
3219
  } else {
3249
3220
  for (const pm of agent.paymentMethods) {
3250
3221
  const isDefault = pm.id === agent.defaultPaymentMethodId;
@@ -3268,7 +3239,7 @@ function registerStatusCommand(program2) {
3268
3239
  // src/commands/advertise.ts
3269
3240
  import chalk12 from "chalk";
3270
3241
  import ora9 from "ora";
3271
- import inquirer7 from "inquirer";
3242
+ import inquirer6 from "inquirer";
3272
3243
  function formatPrice4(cents, currency) {
3273
3244
  return new Intl.NumberFormat("en-US", { style: "currency", currency }).format(cents / 100);
3274
3245
  }
@@ -3292,7 +3263,7 @@ function registerAdvertiseCommands(program2) {
3292
3263
  const agent = getActiveAgent();
3293
3264
  console.log(chalk12.bold("\n \u{1F4E2} Advertise a Request\n"));
3294
3265
  console.log(chalk12.dim(" Can't find what you need? Describe it and vendors will bid to fulfill it.\n"));
3295
- const answers = await inquirer7.prompt([
3266
+ const answers = await inquirer6.prompt([
3296
3267
  {
3297
3268
  type: "input",
3298
3269
  name: "title",
@@ -3339,7 +3310,7 @@ function registerAdvertiseCommands(program2) {
3339
3310
  ]);
3340
3311
  let recurringNote;
3341
3312
  if (answers.recurring) {
3342
- const recAnswer = await inquirer7.prompt([
3313
+ const recAnswer = await inquirer6.prompt([
3343
3314
  {
3344
3315
  type: "input",
3345
3316
  name: "recurringNote",
@@ -3348,7 +3319,7 @@ function registerAdvertiseCommands(program2) {
3348
3319
  ]);
3349
3320
  recurringNote = recAnswer.recurringNote || void 0;
3350
3321
  }
3351
- const priceAnswers = await inquirer7.prompt([
3322
+ const priceAnswers = await inquirer6.prompt([
3352
3323
  {
3353
3324
  type: "input",
3354
3325
  name: "bidPrice",
@@ -3357,7 +3328,7 @@ function registerAdvertiseCommands(program2) {
3357
3328
  ]);
3358
3329
  let currency = "USD";
3359
3330
  if (priceAnswers.bidPrice && parseFloat(priceAnswers.bidPrice) > 0) {
3360
- const currencyAnswer = await inquirer7.prompt([
3331
+ const currencyAnswer = await inquirer6.prompt([
3361
3332
  {
3362
3333
  type: "list",
3363
3334
  name: "currency",
@@ -3378,7 +3349,7 @@ function registerAdvertiseCommands(program2) {
3378
3349
  }
3379
3350
  ]);
3380
3351
  if (currencyAnswer.currency === "OTHER") {
3381
- const customCurrency = await inquirer7.prompt([
3352
+ const customCurrency = await inquirer6.prompt([
3382
3353
  {
3383
3354
  type: "input",
3384
3355
  name: "code",
@@ -3391,14 +3362,14 @@ function registerAdvertiseCommands(program2) {
3391
3362
  currency = currencyAnswer.currency;
3392
3363
  }
3393
3364
  }
3394
- const speedAnswer = await inquirer7.prompt([
3365
+ const speedAnswer = await inquirer6.prompt([
3395
3366
  {
3396
3367
  type: "input",
3397
3368
  name: "speedDays",
3398
3369
  message: "Desired delivery speed in days (optional):"
3399
3370
  }
3400
3371
  ]);
3401
- const returnAnswers = await inquirer7.prompt([
3372
+ const returnAnswers = await inquirer6.prompt([
3402
3373
  {
3403
3374
  type: "confirm",
3404
3375
  name: "freeReturns",
@@ -3430,7 +3401,7 @@ function registerAdvertiseCommands(program2) {
3430
3401
  addrChoices.push({ name: chalk12.dim(skipOption), value: skipOption });
3431
3402
  const defaultAddr = addresses.find((a) => a.id === agent.defaultAddressId);
3432
3403
  const defaultDisplay = defaultAddr ? `${defaultAddr.label} \u2014 ${defaultAddr.line1}` : "";
3433
- const { selectedAddress } = await inquirer7.prompt([
3404
+ const { selectedAddress } = await inquirer6.prompt([
3434
3405
  {
3435
3406
  type: "list",
3436
3407
  name: "selectedAddress",
@@ -3464,7 +3435,7 @@ function registerAdvertiseCommands(program2) {
3464
3435
  // Default: all user's payment methods selected
3465
3436
  }))
3466
3437
  ];
3467
- const { selectedPayments } = await inquirer7.prompt([
3438
+ const { selectedPayments } = await inquirer6.prompt([
3468
3439
  {
3469
3440
  type: "checkbox",
3470
3441
  name: "selectedPayments",
@@ -3478,7 +3449,7 @@ function registerAdvertiseCommands(program2) {
3478
3449
  paymentMethods = JSON.stringify(selectedPayments);
3479
3450
  }
3480
3451
  } else {
3481
- console.log(chalk12.dim(" No payment methods found. Run: clishop setup"));
3452
+ console.log(chalk12.dim(" No payment methods found. Run: clishop payment add"));
3482
3453
  }
3483
3454
  } catch {
3484
3455
  paySpinner.stop();
@@ -3731,7 +3702,7 @@ function registerAdvertiseCommands(program2) {
3731
3702
  if (bid.shippingDays != null) console.log(` Delivery: ${bid.shippingDays}-day`);
3732
3703
  if (bid.note) console.log(` Note: ${bid.note}`);
3733
3704
  console.log();
3734
- const { confirm } = await inquirer7.prompt([
3705
+ const { confirm } = await inquirer6.prompt([
3735
3706
  {
3736
3707
  type: "confirm",
3737
3708
  name: "confirm",
@@ -3752,7 +3723,7 @@ function registerAdvertiseCommands(program2) {
3752
3723
  });
3753
3724
  advertise.command("reject <advertiseId> <bidId>").description("Reject a vendor's bid").action(async (advertiseId, bidId) => {
3754
3725
  try {
3755
- const { confirm } = await inquirer7.prompt([
3726
+ const { confirm } = await inquirer6.prompt([
3756
3727
  {
3757
3728
  type: "confirm",
3758
3729
  name: "confirm",
@@ -3771,7 +3742,7 @@ function registerAdvertiseCommands(program2) {
3771
3742
  });
3772
3743
  advertise.command("cancel <id>").description("Cancel an advertised request").action(async (id) => {
3773
3744
  try {
3774
- const { confirm } = await inquirer7.prompt([
3745
+ const { confirm } = await inquirer6.prompt([
3775
3746
  {
3776
3747
  type: "confirm",
3777
3748
  name: "confirm",
@@ -3793,7 +3764,7 @@ function registerAdvertiseCommands(program2) {
3793
3764
  // src/commands/support.ts
3794
3765
  import chalk13 from "chalk";
3795
3766
  import ora10 from "ora";
3796
- import inquirer8 from "inquirer";
3767
+ import inquirer7 from "inquirer";
3797
3768
  var CATEGORY_CHOICES = [
3798
3769
  { name: "General question", value: "general" },
3799
3770
  { name: "Damaged item", value: "damaged" },
@@ -3827,7 +3798,7 @@ function registerSupportCommands(program2) {
3827
3798
  const support = program2.command("support").description("Manage support tickets for orders");
3828
3799
  support.command("create <orderId>").alias("new").description("Create a support ticket for an order").action(async (orderId) => {
3829
3800
  try {
3830
- const answers = await inquirer8.prompt([
3801
+ const answers = await inquirer7.prompt([
3831
3802
  {
3832
3803
  type: "select",
3833
3804
  name: "category",
@@ -3958,7 +3929,7 @@ function registerSupportCommands(program2) {
3958
3929
  });
3959
3930
  support.command("reply <ticketId>").description("Reply to a support ticket").action(async (ticketId) => {
3960
3931
  try {
3961
- const { message } = await inquirer8.prompt([
3932
+ const { message } = await inquirer7.prompt([
3962
3933
  {
3963
3934
  type: "editor",
3964
3935
  name: "message",
@@ -3983,7 +3954,7 @@ function registerSupportCommands(program2) {
3983
3954
  });
3984
3955
  support.command("close <ticketId>").description("Close a resolved ticket").action(async (ticketId) => {
3985
3956
  try {
3986
- const { confirm } = await inquirer8.prompt([
3957
+ const { confirm } = await inquirer7.prompt([
3987
3958
  {
3988
3959
  type: "confirm",
3989
3960
  name: "confirm",
@@ -4005,7 +3976,7 @@ function registerSupportCommands(program2) {
4005
3976
  // src/commands/feedback.ts
4006
3977
  import chalk14 from "chalk";
4007
3978
  import ora11 from "ora";
4008
- import inquirer9 from "inquirer";
3979
+ import inquirer8 from "inquirer";
4009
3980
  var STATUS_COLORS4 = {
4010
3981
  open: chalk14.green,
4011
3982
  acknowledged: chalk14.cyan,
@@ -4038,7 +4009,7 @@ function registerFeedbackCommands(program2) {
4038
4009
  if (!title || !description || !stepsToReproduce || !actualBehavior || !expectedBehavior) {
4039
4010
  console.log(chalk14.bold("\n\u{1F41B} Report a Bug\n"));
4040
4011
  console.log(chalk14.dim("Help us fix issues by describing what went wrong.\n"));
4041
- const answers = await inquirer9.prompt([
4012
+ const answers = await inquirer8.prompt([
4042
4013
  ...!title ? [{
4043
4014
  type: "input",
4044
4015
  name: "title",
@@ -4110,7 +4081,7 @@ function registerFeedbackCommands(program2) {
4110
4081
  if (!title || !description) {
4111
4082
  console.log(chalk14.bold("\n\u{1F4A1} Suggest an Improvement\n"));
4112
4083
  console.log(chalk14.dim("Tell us how we can make CLISHOP better.\n"));
4113
- const answers = await inquirer9.prompt([
4084
+ const answers = await inquirer8.prompt([
4114
4085
  ...!title ? [{
4115
4086
  type: "input",
4116
4087
  name: "title",
@@ -4290,11 +4261,10 @@ function registerDoctorCommand(program2) {
4290
4261
 
4291
4262
  // src/index.ts
4292
4263
  var program = new Command();
4293
- program.name("clishop").version("1.5.1").description(
4264
+ program.name("clishop").version("1.5.3").description(
4294
4265
  chalk16.bold("CLISHOP") + ` \u2014 Order anything from your terminal.
4295
4266
 
4296
- Run 'clishop setup' for the human-friendly flow, or
4297
- 'clishop setup start --email <email> --json' for agent-safe setup.
4267
+ Run 'clishop setup <email>' or 'clishop setup start --email <email> --json' to create your account.
4298
4268
  Use agents to set safety limits, addresses, and payment methods.
4299
4269
  The "default" agent is used when no agent is specified.`
4300
4270
  ).option("--agent <name>", "Use a specific agent for this command").hook("preAction", (thisCommand) => {
@@ -4339,7 +4309,7 @@ async function main() {
4339
4309
  }
4340
4310
  console.error(
4341
4311
  chalk16.yellow(
4342
- "CLISHOP setup is incomplete. Run 'clishop setup start --email <email> --json' in non-interactive environments."
4312
+ "CLISHOP setup is incomplete. Run 'clishop setup start --email <email> --json' in non-interactive environments, or 'clishop setup <email>' in the CLI."
4343
4313
  )
4344
4314
  );
4345
4315
  process.exit(1);
package/dist/mcp.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  getUserInfo,
7
7
  isLoggedIn,
8
8
  startSetupSession
9
- } from "./chunk-EM4ZGZOU.js";
9
+ } from "./chunk-UO2N5F5R.js";
10
10
  import {
11
11
  __export,
12
12
  getActiveAgent,
@@ -13823,7 +13823,7 @@ var server = new McpServer(
13823
13823
  );
13824
13824
  server.registerTool("setup", {
13825
13825
  title: "Setup",
13826
- description: "Start a resumable setup session. Returns a setup URL for the human and a setup_id for the agent to check later. After the human completes the link, call setup_status with the returned setup_id.",
13826
+ description: "Create or sign in a CLISHOP account using an email address. Setup now completes immediately; add address and payment later when the user is ready to buy.",
13827
13827
  inputSchema: {
13828
13828
  email: external_exports.string().email().describe("User's email address")
13829
13829
  },
@@ -13835,15 +13835,18 @@ server.registerTool("setup", {
13835
13835
  }, async (args) => {
13836
13836
  return safeCall(async () => {
13837
13837
  const data = await startSetupSession(args.email);
13838
+ if (data.ok && data.status === "completed") {
13839
+ getConfig().set("setupCompleted", true);
13840
+ }
13838
13841
  return {
13839
13842
  ...data,
13840
- message: "Give this link to your human to configure their payment method in the browser. Then call setup_status with the setup_id to check when they're done."
13843
+ message: data.status === "completed" ? "Account ready. Search products now. Only add address and payment once the user decides to buy." : "Legacy setup session created. Call setup_status with the setup_id if you still need to wait for completion."
13841
13844
  };
13842
13845
  });
13843
13846
  });
13844
13847
  server.registerTool("setup_status", {
13845
13848
  title: "Setup Status",
13846
- description: "Check the current setup state using the setup_id returned by the setup tool. If setup is complete, auth is stored locally so later CLISHOP calls can proceed.",
13849
+ description: "Check a legacy setup session by setup_id. Modern email-only setup completes immediately and usually does not need this tool.",
13847
13850
  inputSchema: {
13848
13851
  setupId: external_exports.string().describe("The setup_id returned by the setup tool")
13849
13852
  },
@@ -13994,7 +13997,7 @@ server.registerTool("buy_product", {
13994
13997
  throw new Error("No shipping address set. Add one first via the add_address tool.");
13995
13998
  }
13996
13999
  if (!paymentId) {
13997
- throw new Error("No payment method linked. Use the setup tool to onboard the user first.");
14000
+ throw new Error("No payment method linked. Add one with the payment method tools before placing the order.");
13998
14001
  }
13999
14002
  const api = getApiClient();
14000
14003
  let product;
@@ -14330,7 +14333,7 @@ server.registerTool("account_status", {
14330
14333
  return safeCall(async () => {
14331
14334
  const loggedIn = await isLoggedIn();
14332
14335
  if (!loggedIn) {
14333
- return { loggedIn: false, message: "Not set up yet. Use the setup tool to onboard the user with a payment link." };
14336
+ return { loggedIn: false, message: "Not set up yet. Use the setup tool with an email address to create the account." };
14334
14337
  }
14335
14338
  const api = getApiClient();
14336
14339
  const cfg = getConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clishop",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "mcpName": "io.github.StefDCL/clishop",
5
5
  "description": "CLISHOP — Order anything from your terminal",
6
6
  "main": "dist/index.js",