clishop 1.4.4 → 1.4.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.
- package/dist/index.js +62 -65
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -776,11 +776,10 @@ Addresses for agent "${agent.name}":
|
|
|
776
776
|
|
|
777
777
|
// src/commands/payment.ts
|
|
778
778
|
import chalk5 from "chalk";
|
|
779
|
-
import
|
|
779
|
+
import ora3 from "ora";
|
|
780
780
|
|
|
781
781
|
// src/commands/setup.ts
|
|
782
782
|
import chalk4 from "chalk";
|
|
783
|
-
import ora3 from "ora";
|
|
784
783
|
import inquirer3 from "inquirer";
|
|
785
784
|
import open from "open";
|
|
786
785
|
import { execFileSync } from "child_process";
|
|
@@ -857,7 +856,7 @@ async function runSetupWizard(emailArg) {
|
|
|
857
856
|
console.log();
|
|
858
857
|
console.log(chalk4.bold.cyan(" W E L C O M E T O C L I S H O P"));
|
|
859
858
|
console.log(chalk4.dim(" Order anything from your terminal."));
|
|
860
|
-
console.log(chalk4.dim(` Build: ${"2026-04-04T17:
|
|
859
|
+
console.log(chalk4.dim(` Build: ${"2026-04-04T17:39:27.295Z"}`));
|
|
861
860
|
console.log();
|
|
862
861
|
divider(chalk4.cyan);
|
|
863
862
|
console.log();
|
|
@@ -888,7 +887,7 @@ async function runSetupWizard(emailArg) {
|
|
|
888
887
|
]);
|
|
889
888
|
email = answers.email;
|
|
890
889
|
}
|
|
891
|
-
|
|
890
|
+
console.log(chalk4.dim(" Creating your account and payment link..."));
|
|
892
891
|
let setupUrl;
|
|
893
892
|
let deviceCode;
|
|
894
893
|
try {
|
|
@@ -896,10 +895,9 @@ async function runSetupWizard(emailArg) {
|
|
|
896
895
|
const res = await axios.post(`${baseUrl2}/auth/setup-link`, { email });
|
|
897
896
|
setupUrl = res.data.setupUrl;
|
|
898
897
|
deviceCode = res.data.deviceCode;
|
|
899
|
-
spinner.stop();
|
|
900
898
|
} catch (error) {
|
|
901
899
|
const msg = error?.response?.data?.message || error.message;
|
|
902
|
-
|
|
900
|
+
console.log(chalk4.red(` \u2717 Setup failed: ${msg}`));
|
|
903
901
|
console.log();
|
|
904
902
|
console.log(chalk4.dim(" You can try again with: ") + chalk4.white("clishop setup"));
|
|
905
903
|
console.log();
|
|
@@ -973,13 +971,12 @@ async function runSetupWizard(emailArg) {
|
|
|
973
971
|
console.log();
|
|
974
972
|
}
|
|
975
973
|
async function runPaymentLinkFlow(config) {
|
|
976
|
-
|
|
974
|
+
console.log(chalk4.dim(" Requesting secure payment setup link..."));
|
|
977
975
|
try {
|
|
978
976
|
const api = getApiClient();
|
|
979
977
|
const agent = getActiveAgent();
|
|
980
978
|
await ensureAgentOnBackend(agent.name);
|
|
981
979
|
const res = await api.post("/payment-methods/setup", { agent: agent.name });
|
|
982
|
-
spinner.stop();
|
|
983
980
|
const { setupUrl } = res.data;
|
|
984
981
|
printSetupLink("Open this link to link your payment method:", setupUrl);
|
|
985
982
|
const opened = await openBrowser(setupUrl);
|
|
@@ -990,19 +987,19 @@ async function runPaymentLinkFlow(config) {
|
|
|
990
987
|
await inquirer3.prompt([
|
|
991
988
|
{ type: "input", name: "done", message: "Press Enter after completing payment setup in your browser..." }
|
|
992
989
|
]);
|
|
993
|
-
|
|
990
|
+
console.log(chalk4.dim(" Checking for your payment method..."));
|
|
994
991
|
const pmRes = await api.get("/payment-methods", { params: { agent: agent.name } });
|
|
995
992
|
const methods = pmRes.data.paymentMethods || [];
|
|
996
993
|
if (methods.length > 0) {
|
|
997
994
|
const latest = methods[methods.length - 1];
|
|
998
995
|
updateAgent(agent.name, { defaultPaymentMethodId: latest.id });
|
|
999
|
-
|
|
996
|
+
console.log(chalk4.green(` \u2713 Payment method "${latest.label}" linked and set as default.`));
|
|
1000
997
|
config.set("setupCompleted", true);
|
|
1001
998
|
} else {
|
|
1002
|
-
|
|
999
|
+
console.log(chalk4.yellow(" \u26A0 No payment method found yet. Run ") + chalk4.white("clishop setup") + chalk4.yellow(" to try again."));
|
|
1003
1000
|
}
|
|
1004
1001
|
} catch (error) {
|
|
1005
|
-
|
|
1002
|
+
console.log(chalk4.red(` \u2717 Could not get setup link: ${error?.response?.data?.message || error.message}`));
|
|
1006
1003
|
}
|
|
1007
1004
|
console.log();
|
|
1008
1005
|
}
|
|
@@ -1014,7 +1011,7 @@ function registerPaymentCommands(program2) {
|
|
|
1014
1011
|
try {
|
|
1015
1012
|
const agent = getActiveAgent();
|
|
1016
1013
|
await ensureAgentOnBackend(agent.name);
|
|
1017
|
-
const spinner =
|
|
1014
|
+
const spinner = ora3("Fetching payment methods...").start();
|
|
1018
1015
|
const api = getApiClient();
|
|
1019
1016
|
const res = await api.get("/payment-methods", {
|
|
1020
1017
|
params: { agent: agent.name }
|
|
@@ -1042,7 +1039,7 @@ Payment methods for agent "${agent.name}":
|
|
|
1042
1039
|
try {
|
|
1043
1040
|
const agent = getActiveAgent();
|
|
1044
1041
|
await ensureAgentOnBackend(agent.name);
|
|
1045
|
-
const spinner =
|
|
1042
|
+
const spinner = ora3("Requesting secure payment setup link...").start();
|
|
1046
1043
|
const api = getApiClient();
|
|
1047
1044
|
const res = await api.post("/payment-methods/setup", {
|
|
1048
1045
|
agent: agent.name
|
|
@@ -1059,7 +1056,7 @@ Payment methods for agent "${agent.name}":
|
|
|
1059
1056
|
await inquirer10.prompt([
|
|
1060
1057
|
{ type: "input", name: "done", message: "Press Enter when done..." }
|
|
1061
1058
|
]);
|
|
1062
|
-
const checkSpinner =
|
|
1059
|
+
const checkSpinner = ora3("Checking for your payment method...").start();
|
|
1063
1060
|
const pmRes = await api.get("/payment-methods", { params: { agent: agent.name } });
|
|
1064
1061
|
const methods = pmRes.data.paymentMethods || [];
|
|
1065
1062
|
if (methods.length > 0) {
|
|
@@ -1079,7 +1076,7 @@ Payment methods for agent "${agent.name}":
|
|
|
1079
1076
|
});
|
|
1080
1077
|
payment.command("remove <id>").alias("rm").description("Remove a payment method").action(async (id) => {
|
|
1081
1078
|
try {
|
|
1082
|
-
const spinner =
|
|
1079
|
+
const spinner = ora3("Removing payment method...").start();
|
|
1083
1080
|
const api = getApiClient();
|
|
1084
1081
|
await api.delete(`/payment-methods/${id}`);
|
|
1085
1082
|
spinner.succeed(chalk5.green("Payment method removed."));
|
|
@@ -1101,7 +1098,7 @@ Payment methods for agent "${agent.name}":
|
|
|
1101
1098
|
|
|
1102
1099
|
// src/commands/search.ts
|
|
1103
1100
|
import chalk6 from "chalk";
|
|
1104
|
-
import
|
|
1101
|
+
import ora4 from "ora";
|
|
1105
1102
|
import inquirer4 from "inquirer";
|
|
1106
1103
|
function formatPrice(cents, currency) {
|
|
1107
1104
|
return new Intl.NumberFormat("en-US", {
|
|
@@ -1494,7 +1491,7 @@ function renderProductInfo(result, index, totalResults, formatPriceFn) {
|
|
|
1494
1491
|
function registerSearchCommands(program2) {
|
|
1495
1492
|
program2.command("search <query>").description("Search for products").option("-c, --category <category>", "Filter by category").option("--brand <brand>", "Filter by brand").option("--model <model>", "Filter by model name/number").option("--sku <sku>", "Filter by SKU").option("--gtin <gtin>", "Filter by GTIN (UPC/EAN/ISBN)").option("--variant <variant>", "Filter by variant (size/color/storage/etc.)").option("--min-price <price>", "Minimum price (cents)", parseFloat).option("--max-price <price>", "Maximum price (cents)", parseFloat).option("--max-shipping <price>", "Maximum shipping cost (cents)", parseInt).option("--max-total <price>", "Maximum landed total: item + shipping (cents)", parseInt).option("--free-shipping", "Only show items with free shipping").option("--ship-to <address>", "Saved address label or ID (resolves country/city/postal automatically)").option("--country <code>", "Delivery country (ISO 3166-1 alpha-2, e.g. US, BE, NL)").option("--city <city>", "Delivery city").option("--postal-code <code>", "Delivery postal/zip code").option("--region <region>", "Delivery state/province/region").option("--lat <latitude>", "Delivery latitude (for local/proximity search)", parseFloat).option("--lng <longitude>", "Delivery longitude (for local/proximity search)", parseFloat).option("--deliver-by <date>", "Need delivery by date (YYYY-MM-DD)").option("--max-delivery-days <days>", "Maximum delivery/transit days", parseInt).option("--in-stock", "Only show in-stock items").option("--exclude-backorder", "Exclude backordered items").option("--min-qty <qty>", "Minimum quantity available", parseInt).option("--free-returns", "Only show items with free returns").option("--min-return-window-days <days>", "Minimum return window in days", parseInt).option("--store <store>", "Limit to a store (ID, slug, or name)").option("--vendor <vendor>", "Filter by vendor name (alias for --store)").option("--trusted-only", "Only show products from verified stores").option("--min-store-rating <rating>", "Minimum store rating (0-5)", parseFloat).option("--min-rating <rating>", "Minimum product rating (1-5)", parseFloat).option("-s, --sort <field>", "Sort by: price, total-cost, rating, relevance, newest, delivery", "relevance").option("--order <dir>", "Sort order: asc, desc", "desc").option("-p, --page <page>", "Page number", parseInt, 1).option("-n, --per-page <count>", "Results per page", parseInt, 10).option("--express", "Only show items with 2-day or faster delivery").option("-e, --extended-search", "Enable extended search: query darkstores when no local results found").option("--no-extended-search", "Disable automatic extended search when no local results found").option("--extended-timeout <seconds>", "Extended search timeout in seconds (default: 30, max: 60)", parseInt).option("--json", "Output raw JSON").option("--compact", "Compact one-line-per-result output").option("--detailed", "Show full product details inline").option("-i, --interactive", "After results, interactively select products to get more info from their store").action(async (query, opts) => {
|
|
1496
1493
|
try {
|
|
1497
|
-
const spinner =
|
|
1494
|
+
const spinner = ora4(`Searching for "${query}"...`).start();
|
|
1498
1495
|
const api = getApiClient();
|
|
1499
1496
|
let maxDeliveryDays = opts.maxDeliveryDays;
|
|
1500
1497
|
if (!maxDeliveryDays && opts.deliverBy) {
|
|
@@ -1912,7 +1909,7 @@ Results for "${query}" \u2014 ${result.total} found (page ${result.page})
|
|
|
1912
1909
|
(id) => allProducts.find((p) => p.id === id && !p.isExtended)
|
|
1913
1910
|
);
|
|
1914
1911
|
if (extendedIds.length > 0) {
|
|
1915
|
-
const infoSpinner =
|
|
1912
|
+
const infoSpinner = ora4(`Requesting detailed info for ${extendedIds.length} product(s) from their stores...`).start();
|
|
1916
1913
|
try {
|
|
1917
1914
|
const infoRes = await api.post("/products/info", {
|
|
1918
1915
|
productIds: extendedIds
|
|
@@ -1939,7 +1936,7 @@ Results for "${query}" \u2014 ${result.total} found (page ${result.page})
|
|
|
1939
1936
|
}
|
|
1940
1937
|
if (localIds.length > 0) {
|
|
1941
1938
|
for (const localId of localIds) {
|
|
1942
|
-
const detailSpinner =
|
|
1939
|
+
const detailSpinner = ora4(`Fetching details for ${localId}...`).start();
|
|
1943
1940
|
try {
|
|
1944
1941
|
const detailRes = await api.get(`/products/${localId}`);
|
|
1945
1942
|
detailSpinner.stop();
|
|
@@ -2015,7 +2012,7 @@ Results for "${query}" \u2014 ${result.total} found (page ${result.page})
|
|
|
2015
2012
|
});
|
|
2016
2013
|
program2.command("product <id>").description("View detailed product information").option("--json", "Output raw JSON").action(async (id, opts) => {
|
|
2017
2014
|
try {
|
|
2018
|
-
const spinner =
|
|
2015
|
+
const spinner = ora4("Fetching product details...").start();
|
|
2019
2016
|
const api = getApiClient();
|
|
2020
2017
|
const res = await api.get(`/products/${id}`);
|
|
2021
2018
|
spinner.stop();
|
|
@@ -2097,7 +2094,7 @@ Results for "${query}" \u2014 ${result.total} found (page ${result.page})
|
|
|
2097
2094
|
ids.push(input);
|
|
2098
2095
|
}
|
|
2099
2096
|
}
|
|
2100
|
-
const spinner =
|
|
2097
|
+
const spinner = ora4(`Requesting detailed info for ${ids.length} product(s)...`).start();
|
|
2101
2098
|
const api = getApiClient();
|
|
2102
2099
|
const res = await api.post("/products/info", {
|
|
2103
2100
|
productIds: ids
|
|
@@ -2130,7 +2127,7 @@ Product Information \u2014 ${total} result(s)
|
|
|
2130
2127
|
|
|
2131
2128
|
// src/commands/order.ts
|
|
2132
2129
|
import chalk7 from "chalk";
|
|
2133
|
-
import
|
|
2130
|
+
import ora5 from "ora";
|
|
2134
2131
|
import inquirer5 from "inquirer";
|
|
2135
2132
|
function formatPrice2(cents, currency) {
|
|
2136
2133
|
return new Intl.NumberFormat("en-US", { style: "currency", currency }).format(cents / 100);
|
|
@@ -2195,7 +2192,7 @@ function registerOrderCommands(program2) {
|
|
|
2195
2192
|
return;
|
|
2196
2193
|
}
|
|
2197
2194
|
const api = getApiClient();
|
|
2198
|
-
const prodSpinner =
|
|
2195
|
+
const prodSpinner = ora5("Fetching product info...").start();
|
|
2199
2196
|
let product;
|
|
2200
2197
|
let isExtended = false;
|
|
2201
2198
|
try {
|
|
@@ -2264,7 +2261,7 @@ function registerOrderCommands(program2) {
|
|
|
2264
2261
|
return;
|
|
2265
2262
|
}
|
|
2266
2263
|
}
|
|
2267
|
-
const spinner =
|
|
2264
|
+
const spinner = ora5("Placing order...").start();
|
|
2268
2265
|
const res = await api.post("/orders", {
|
|
2269
2266
|
agent: agent.name,
|
|
2270
2267
|
items: [{ productId, quantity: opts.quantity }],
|
|
@@ -2288,7 +2285,7 @@ function registerOrderCommands(program2) {
|
|
|
2288
2285
|
});
|
|
2289
2286
|
order.command("list").alias("ls").description("List your orders").option("--status <status>", "Filter by status").option("-p, --page <page>", "Page number", parseInt, 1).option("--json", "Output raw JSON").action(async (opts) => {
|
|
2290
2287
|
try {
|
|
2291
|
-
const spinner =
|
|
2288
|
+
const spinner = ora5("Fetching orders...").start();
|
|
2292
2289
|
const api = getApiClient();
|
|
2293
2290
|
const res = await api.get("/orders", {
|
|
2294
2291
|
params: {
|
|
@@ -2324,7 +2321,7 @@ function registerOrderCommands(program2) {
|
|
|
2324
2321
|
});
|
|
2325
2322
|
order.command("show <id>").description("Show order details").option("--json", "Output raw JSON").action(async (id, opts) => {
|
|
2326
2323
|
try {
|
|
2327
|
-
const spinner =
|
|
2324
|
+
const spinner = ora5("Fetching order...").start();
|
|
2328
2325
|
const api = getApiClient();
|
|
2329
2326
|
const res = await api.get(`/orders/${id}`);
|
|
2330
2327
|
spinner.stop();
|
|
@@ -2407,7 +2404,7 @@ function registerOrderCommands(program2) {
|
|
|
2407
2404
|
}
|
|
2408
2405
|
]);
|
|
2409
2406
|
if (!confirm) return;
|
|
2410
|
-
const spinner =
|
|
2407
|
+
const spinner = ora5("Cancelling order...").start();
|
|
2411
2408
|
const api = getApiClient();
|
|
2412
2409
|
await api.post(`/orders/${id}/cancel`);
|
|
2413
2410
|
spinner.succeed(chalk7.green("Order cancelled."));
|
|
@@ -2419,7 +2416,7 @@ function registerOrderCommands(program2) {
|
|
|
2419
2416
|
|
|
2420
2417
|
// src/commands/review.ts
|
|
2421
2418
|
import chalk8 from "chalk";
|
|
2422
|
-
import
|
|
2419
|
+
import ora6 from "ora";
|
|
2423
2420
|
import inquirer6 from "inquirer";
|
|
2424
2421
|
function renderStars2(rating) {
|
|
2425
2422
|
const filled = Math.round(rating);
|
|
@@ -2448,7 +2445,7 @@ function registerReviewCommands(program2) {
|
|
|
2448
2445
|
review.command("order <orderId>").description("Review items and store from an order").action(async (orderId) => {
|
|
2449
2446
|
try {
|
|
2450
2447
|
const api = getApiClient();
|
|
2451
|
-
const spinner =
|
|
2448
|
+
const spinner = ora6("Fetching order details...").start();
|
|
2452
2449
|
let reviewable;
|
|
2453
2450
|
try {
|
|
2454
2451
|
const res = await api.get(`/orders/${orderId}/reviewable`);
|
|
@@ -2553,7 +2550,7 @@ function registerReviewCommands(program2) {
|
|
|
2553
2550
|
console.log(chalk8.yellow("\nNo reviews submitted.\n"));
|
|
2554
2551
|
return;
|
|
2555
2552
|
}
|
|
2556
|
-
const submitSpinner =
|
|
2553
|
+
const submitSpinner = ora6("Submitting reviews...").start();
|
|
2557
2554
|
try {
|
|
2558
2555
|
const res = await api.post(`/orders/${orderId}/reviews`, {
|
|
2559
2556
|
itemReviews,
|
|
@@ -2596,7 +2593,7 @@ function registerReviewCommands(program2) {
|
|
|
2596
2593
|
message: "Review body (opens your editor):"
|
|
2597
2594
|
}
|
|
2598
2595
|
]);
|
|
2599
|
-
const spinner =
|
|
2596
|
+
const spinner = ora6("Submitting review...").start();
|
|
2600
2597
|
const api = getApiClient();
|
|
2601
2598
|
const res = await api.post(`/products/${productId}/reviews`, {
|
|
2602
2599
|
rating: answers.rating,
|
|
@@ -2629,7 +2626,7 @@ function registerReviewCommands(program2) {
|
|
|
2629
2626
|
message: "Review body (opens your editor):"
|
|
2630
2627
|
}
|
|
2631
2628
|
]);
|
|
2632
|
-
const spinner =
|
|
2629
|
+
const spinner = ora6("Submitting store review...").start();
|
|
2633
2630
|
const api = getApiClient();
|
|
2634
2631
|
const res = await api.post(`/stores/${storeId}/reviews`, {
|
|
2635
2632
|
rating: answers.rating,
|
|
@@ -2648,7 +2645,7 @@ function registerReviewCommands(program2) {
|
|
|
2648
2645
|
});
|
|
2649
2646
|
review.command("list").alias("ls").description("List your reviews").option("--json", "Output raw JSON").action(async (opts) => {
|
|
2650
2647
|
try {
|
|
2651
|
-
const spinner =
|
|
2648
|
+
const spinner = ora6("Fetching reviews...").start();
|
|
2652
2649
|
const api = getApiClient();
|
|
2653
2650
|
const res = await api.get("/reviews/mine");
|
|
2654
2651
|
spinner.stop();
|
|
@@ -2687,7 +2684,7 @@ function registerReviewCommands(program2) {
|
|
|
2687
2684
|
});
|
|
2688
2685
|
review.command("rating <id>").description("View rating details for a product or store").option("--store", "View store rating instead of product").action(async (id, opts) => {
|
|
2689
2686
|
try {
|
|
2690
|
-
const spinner =
|
|
2687
|
+
const spinner = ora6("Fetching rating...").start();
|
|
2691
2688
|
const api = getApiClient();
|
|
2692
2689
|
const endpoint = opts.store ? `/stores/${id}/rating` : `/products/${id}/rating`;
|
|
2693
2690
|
const res = await api.get(endpoint);
|
|
@@ -2726,7 +2723,7 @@ function registerReviewCommands(program2) {
|
|
|
2726
2723
|
}
|
|
2727
2724
|
]);
|
|
2728
2725
|
if (!confirm) return;
|
|
2729
|
-
const spinner =
|
|
2726
|
+
const spinner = ora6("Deleting review...").start();
|
|
2730
2727
|
const api = getApiClient();
|
|
2731
2728
|
const endpoint = opts.store ? `/store-reviews/${reviewId}` : `/reviews/${reviewId}`;
|
|
2732
2729
|
await api.delete(endpoint);
|
|
@@ -2773,7 +2770,7 @@ function registerConfigCommands(program2) {
|
|
|
2773
2770
|
|
|
2774
2771
|
// src/commands/store.ts
|
|
2775
2772
|
import chalk10 from "chalk";
|
|
2776
|
-
import
|
|
2773
|
+
import ora7 from "ora";
|
|
2777
2774
|
function formatPrice3(cents, currency) {
|
|
2778
2775
|
return new Intl.NumberFormat("en-US", {
|
|
2779
2776
|
style: "currency",
|
|
@@ -2796,7 +2793,7 @@ function registerStoreCommands(program2) {
|
|
|
2796
2793
|
const store = program2.command("store").description("Browse stores and their catalogs");
|
|
2797
2794
|
store.command("list").alias("ls").description("List available stores").option("-q, --query <query>", "Search stores by name").option("--verified", "Only show verified stores").option("--min-rating <rating>", "Minimum store rating (0-5)", parseFloat).option("--country <country>", "Filter by country").option("-s, --sort <field>", "Sort by: name, rating, newest, products", "name").option("--order <dir>", "Sort order: asc, desc", "asc").option("-p, --page <page>", "Page number", parseInt, 1).option("-n, --per-page <count>", "Results per page", parseInt, 20).option("--json", "Output raw JSON").action(async (opts) => {
|
|
2798
2795
|
try {
|
|
2799
|
-
const spinner =
|
|
2796
|
+
const spinner = ora7("Fetching stores...").start();
|
|
2800
2797
|
const api = getApiClient();
|
|
2801
2798
|
const res = await api.get("/stores", {
|
|
2802
2799
|
params: {
|
|
@@ -2847,7 +2844,7 @@ Stores \u2014 ${total} found (page ${page})
|
|
|
2847
2844
|
});
|
|
2848
2845
|
store.command("info <store>").description("View store details (by name, slug, or ID)").option("--json", "Output raw JSON").action(async (storeId, opts) => {
|
|
2849
2846
|
try {
|
|
2850
|
-
const spinner =
|
|
2847
|
+
const spinner = ora7("Fetching store info...").start();
|
|
2851
2848
|
const api = getApiClient();
|
|
2852
2849
|
const res = await api.get(`/stores/${encodeURIComponent(storeId)}`);
|
|
2853
2850
|
spinner.stop();
|
|
@@ -2881,7 +2878,7 @@ Stores \u2014 ${total} found (page ${page})
|
|
|
2881
2878
|
});
|
|
2882
2879
|
store.command("catalog <store>").description("Browse a store's product catalog (by name, slug, or ID)").option("-q, --query <query>", "Search within the store's products").option("-c, --category <category>", "Filter by category").option("--min-price <price>", "Minimum price (cents)", parseFloat).option("--max-price <price>", "Maximum price (cents)", parseFloat).option("--min-rating <rating>", "Minimum product rating (1-5)", parseFloat).option("--in-stock", "Only show in-stock items").option("--free-shipping", "Only show items with free shipping").option("-s, --sort <field>", "Sort by: price, rating, newest, name", "newest").option("--order <dir>", "Sort order: asc, desc", "desc").option("-p, --page <page>", "Page number", parseInt, 1).option("-n, --per-page <count>", "Results per page", parseInt, 20).option("--json", "Output raw JSON").action(async (storeId, opts) => {
|
|
2883
2880
|
try {
|
|
2884
|
-
const spinner =
|
|
2881
|
+
const spinner = ora7(`Fetching catalog for "${storeId}"...`).start();
|
|
2885
2882
|
const api = getApiClient();
|
|
2886
2883
|
const res = await api.get(`/stores/${encodeURIComponent(storeId)}/catalog`, {
|
|
2887
2884
|
params: {
|
|
@@ -2951,7 +2948,7 @@ ${storeInfo.name}${badge}${storeRating} \u2014 ${total} products (page ${page})
|
|
|
2951
2948
|
|
|
2952
2949
|
// src/commands/status.ts
|
|
2953
2950
|
import chalk11 from "chalk";
|
|
2954
|
-
import
|
|
2951
|
+
import ora8 from "ora";
|
|
2955
2952
|
function registerStatusCommand(program2) {
|
|
2956
2953
|
program2.command("status").description("Show full account overview \u2014 user, agents, addresses, payment methods").option("--json", "Output raw JSON").action(async (opts) => {
|
|
2957
2954
|
try {
|
|
@@ -2959,7 +2956,7 @@ function registerStatusCommand(program2) {
|
|
|
2959
2956
|
console.log(chalk11.yellow("\nNot set up yet. Run: clishop setup\n"));
|
|
2960
2957
|
return;
|
|
2961
2958
|
}
|
|
2962
|
-
const spinner =
|
|
2959
|
+
const spinner = ora8("Fetching account overview...").start();
|
|
2963
2960
|
const api = getApiClient();
|
|
2964
2961
|
const cfg = getConfig();
|
|
2965
2962
|
const activeAgentName = cfg.get("activeAgent") || "default";
|
|
@@ -3051,7 +3048,7 @@ function registerStatusCommand(program2) {
|
|
|
3051
3048
|
|
|
3052
3049
|
// src/commands/advertise.ts
|
|
3053
3050
|
import chalk12 from "chalk";
|
|
3054
|
-
import
|
|
3051
|
+
import ora9 from "ora";
|
|
3055
3052
|
import inquirer7 from "inquirer";
|
|
3056
3053
|
function formatPrice4(cents, currency) {
|
|
3057
3054
|
return new Intl.NumberFormat("en-US", { style: "currency", currency }).format(cents / 100);
|
|
@@ -3197,7 +3194,7 @@ function registerAdvertiseCommands(program2) {
|
|
|
3197
3194
|
]);
|
|
3198
3195
|
const api = getApiClient();
|
|
3199
3196
|
let addressId;
|
|
3200
|
-
const addrSpinner =
|
|
3197
|
+
const addrSpinner = ora9("Fetching your addresses...").start();
|
|
3201
3198
|
try {
|
|
3202
3199
|
const addrRes = await api.get("/addresses", { params: { agent: agent.name } });
|
|
3203
3200
|
addrSpinner.stop();
|
|
@@ -3233,7 +3230,7 @@ function registerAdvertiseCommands(program2) {
|
|
|
3233
3230
|
console.log(chalk12.dim(" Could not fetch addresses. Skipping delivery location."));
|
|
3234
3231
|
}
|
|
3235
3232
|
let paymentMethods;
|
|
3236
|
-
const paySpinner =
|
|
3233
|
+
const paySpinner = ora9("Fetching your payment methods...").start();
|
|
3237
3234
|
try {
|
|
3238
3235
|
const payRes = await api.get("/payment-methods", { params: { agent: agent.name } });
|
|
3239
3236
|
paySpinner.stop();
|
|
@@ -3303,7 +3300,7 @@ function registerAdvertiseCommands(program2) {
|
|
|
3303
3300
|
body.minReturnDays = days;
|
|
3304
3301
|
}
|
|
3305
3302
|
}
|
|
3306
|
-
const spinner =
|
|
3303
|
+
const spinner = ora9("Publishing your request...").start();
|
|
3307
3304
|
const res = await api.post("/advertise", body);
|
|
3308
3305
|
spinner.succeed(chalk12.green(`Request published! ID: ${chalk12.bold(res.data.advertise.id)}`));
|
|
3309
3306
|
console.log(chalk12.dim("\n Vendors can now see your request and submit bids."));
|
|
@@ -3352,7 +3349,7 @@ function registerAdvertiseCommands(program2) {
|
|
|
3352
3349
|
if (opts.minReturnDays) {
|
|
3353
3350
|
body.minReturnDays = opts.minReturnDays;
|
|
3354
3351
|
}
|
|
3355
|
-
const spinner =
|
|
3352
|
+
const spinner = ora9("Publishing your request...").start();
|
|
3356
3353
|
const api = getApiClient();
|
|
3357
3354
|
const res = await api.post("/advertise", body);
|
|
3358
3355
|
spinner.succeed(chalk12.green(`Request published! ID: ${chalk12.bold(res.data.advertise.id)}`));
|
|
@@ -3362,7 +3359,7 @@ function registerAdvertiseCommands(program2) {
|
|
|
3362
3359
|
});
|
|
3363
3360
|
advertise.command("list").alias("ls").description("List your advertised requests").option("--status <status>", "Filter by status (open, closed, accepted, cancelled, expired)").option("-p, --page <page>", "Page number", parseInt, 1).option("--json", "Output raw JSON").action(async (opts) => {
|
|
3364
3361
|
try {
|
|
3365
|
-
const spinner =
|
|
3362
|
+
const spinner = ora9("Fetching your requests...").start();
|
|
3366
3363
|
const api = getApiClient();
|
|
3367
3364
|
const res = await api.get("/advertise", {
|
|
3368
3365
|
params: { status: opts.status, page: opts.page }
|
|
@@ -3412,7 +3409,7 @@ function registerAdvertiseCommands(program2) {
|
|
|
3412
3409
|
});
|
|
3413
3410
|
advertise.command("show <id>").description("View an advertised request and its bids").option("--json", "Output raw JSON").action(async (id, opts) => {
|
|
3414
3411
|
try {
|
|
3415
|
-
const spinner =
|
|
3412
|
+
const spinner = ora9("Fetching request...").start();
|
|
3416
3413
|
const api = getApiClient();
|
|
3417
3414
|
const res = await api.get(`/advertise/${id}`);
|
|
3418
3415
|
spinner.stop();
|
|
@@ -3497,7 +3494,7 @@ function registerAdvertiseCommands(program2) {
|
|
|
3497
3494
|
advertise.command("accept <advertiseId> <bidId>").description("Accept a vendor's bid on your request").action(async (advertiseId, bidId) => {
|
|
3498
3495
|
try {
|
|
3499
3496
|
const api = getApiClient();
|
|
3500
|
-
const detailSpinner =
|
|
3497
|
+
const detailSpinner = ora9("Fetching bid details...").start();
|
|
3501
3498
|
const detailRes = await api.get(`/advertise/${advertiseId}`);
|
|
3502
3499
|
detailSpinner.stop();
|
|
3503
3500
|
const ad = detailRes.data.advertise;
|
|
@@ -3527,7 +3524,7 @@ function registerAdvertiseCommands(program2) {
|
|
|
3527
3524
|
console.log(chalk12.yellow("Cancelled."));
|
|
3528
3525
|
return;
|
|
3529
3526
|
}
|
|
3530
|
-
const spinner =
|
|
3527
|
+
const spinner = ora9("Accepting bid...").start();
|
|
3531
3528
|
await api.post(`/advertise/${advertiseId}/bids/${bidId}/accept`);
|
|
3532
3529
|
spinner.succeed(chalk12.green("Bid accepted! The vendor will now fulfill your request."));
|
|
3533
3530
|
} catch (error) {
|
|
@@ -3545,7 +3542,7 @@ function registerAdvertiseCommands(program2) {
|
|
|
3545
3542
|
}
|
|
3546
3543
|
]);
|
|
3547
3544
|
if (!confirm) return;
|
|
3548
|
-
const spinner =
|
|
3545
|
+
const spinner = ora9("Rejecting bid...").start();
|
|
3549
3546
|
const api = getApiClient();
|
|
3550
3547
|
await api.post(`/advertise/${advertiseId}/bids/${bidId}/reject`);
|
|
3551
3548
|
spinner.succeed(chalk12.green("Bid rejected."));
|
|
@@ -3564,7 +3561,7 @@ function registerAdvertiseCommands(program2) {
|
|
|
3564
3561
|
}
|
|
3565
3562
|
]);
|
|
3566
3563
|
if (!confirm) return;
|
|
3567
|
-
const spinner =
|
|
3564
|
+
const spinner = ora9("Cancelling request...").start();
|
|
3568
3565
|
const api = getApiClient();
|
|
3569
3566
|
await api.post(`/advertise/${id}/cancel`);
|
|
3570
3567
|
spinner.succeed(chalk12.green("Request cancelled."));
|
|
@@ -3576,7 +3573,7 @@ function registerAdvertiseCommands(program2) {
|
|
|
3576
3573
|
|
|
3577
3574
|
// src/commands/support.ts
|
|
3578
3575
|
import chalk13 from "chalk";
|
|
3579
|
-
import
|
|
3576
|
+
import ora10 from "ora";
|
|
3580
3577
|
import inquirer8 from "inquirer";
|
|
3581
3578
|
var CATEGORY_CHOICES = [
|
|
3582
3579
|
{ name: "General question", value: "general" },
|
|
@@ -3641,7 +3638,7 @@ function registerSupportCommands(program2) {
|
|
|
3641
3638
|
console.error(chalk13.red("\n\u2717 Message is required.\n"));
|
|
3642
3639
|
return;
|
|
3643
3640
|
}
|
|
3644
|
-
const spinner =
|
|
3641
|
+
const spinner = ora10("Creating support ticket...").start();
|
|
3645
3642
|
const api = getApiClient();
|
|
3646
3643
|
const res = await api.post("/support", {
|
|
3647
3644
|
orderId,
|
|
@@ -3668,7 +3665,7 @@ function registerSupportCommands(program2) {
|
|
|
3668
3665
|
});
|
|
3669
3666
|
support.command("list").alias("ls").description("List your support tickets").option("--status <status>", "Filter by status").option("--json", "Output raw JSON").action(async (opts) => {
|
|
3670
3667
|
try {
|
|
3671
|
-
const spinner =
|
|
3668
|
+
const spinner = ora10("Fetching tickets...").start();
|
|
3672
3669
|
const api = getApiClient();
|
|
3673
3670
|
const res = await api.get("/support", {
|
|
3674
3671
|
params: { status: opts.status }
|
|
@@ -3705,7 +3702,7 @@ function registerSupportCommands(program2) {
|
|
|
3705
3702
|
});
|
|
3706
3703
|
support.command("show <ticketId>").description("View a support ticket and its messages").option("--json", "Output raw JSON").action(async (ticketId, opts) => {
|
|
3707
3704
|
try {
|
|
3708
|
-
const spinner =
|
|
3705
|
+
const spinner = ora10("Fetching ticket...").start();
|
|
3709
3706
|
const api = getApiClient();
|
|
3710
3707
|
const res = await api.get(`/support/${ticketId}`);
|
|
3711
3708
|
spinner.stop();
|
|
@@ -3753,7 +3750,7 @@ function registerSupportCommands(program2) {
|
|
|
3753
3750
|
console.error(chalk13.red("\n\u2717 Message is required.\n"));
|
|
3754
3751
|
return;
|
|
3755
3752
|
}
|
|
3756
|
-
const spinner =
|
|
3753
|
+
const spinner = ora10("Sending reply...").start();
|
|
3757
3754
|
const api = getApiClient();
|
|
3758
3755
|
const res = await api.post(`/support/${ticketId}/reply`, {
|
|
3759
3756
|
message: message.trim()
|
|
@@ -3776,7 +3773,7 @@ function registerSupportCommands(program2) {
|
|
|
3776
3773
|
}
|
|
3777
3774
|
]);
|
|
3778
3775
|
if (!confirm) return;
|
|
3779
|
-
const spinner =
|
|
3776
|
+
const spinner = ora10("Closing ticket...").start();
|
|
3780
3777
|
const api = getApiClient();
|
|
3781
3778
|
await api.patch(`/support/${ticketId}/status`, { status: "closed" });
|
|
3782
3779
|
spinner.succeed(chalk13.green("Ticket closed."));
|
|
@@ -3788,7 +3785,7 @@ function registerSupportCommands(program2) {
|
|
|
3788
3785
|
|
|
3789
3786
|
// src/commands/feedback.ts
|
|
3790
3787
|
import chalk14 from "chalk";
|
|
3791
|
-
import
|
|
3788
|
+
import ora11 from "ora";
|
|
3792
3789
|
import inquirer9 from "inquirer";
|
|
3793
3790
|
var STATUS_COLORS4 = {
|
|
3794
3791
|
open: chalk14.green,
|
|
@@ -3863,7 +3860,7 @@ function registerFeedbackCommands(program2) {
|
|
|
3863
3860
|
console.error(chalk14.red("\n\u2717 Steps to reproduce are required.\n"));
|
|
3864
3861
|
return;
|
|
3865
3862
|
}
|
|
3866
|
-
const spinner =
|
|
3863
|
+
const spinner = ora11("Submitting bug report...").start();
|
|
3867
3864
|
const api = getApiClient();
|
|
3868
3865
|
const res = await api.post("/feedback", {
|
|
3869
3866
|
type: "bug",
|
|
@@ -3914,7 +3911,7 @@ function registerFeedbackCommands(program2) {
|
|
|
3914
3911
|
console.error(chalk14.red("\n\u2717 Description is required.\n"));
|
|
3915
3912
|
return;
|
|
3916
3913
|
}
|
|
3917
|
-
const spinner =
|
|
3914
|
+
const spinner = ora11("Submitting suggestion...").start();
|
|
3918
3915
|
const api = getApiClient();
|
|
3919
3916
|
const res = await api.post("/feedback", {
|
|
3920
3917
|
type: "suggestion",
|
|
@@ -3937,7 +3934,7 @@ function registerFeedbackCommands(program2) {
|
|
|
3937
3934
|
});
|
|
3938
3935
|
feedback.command("list").alias("ls").description("List your bug reports and suggestions").option("--type <type>", "Filter by type (bug or suggestion)").option("--status <status>", "Filter by status").option("--json", "Output raw JSON").action(async (opts) => {
|
|
3939
3936
|
try {
|
|
3940
|
-
const spinner =
|
|
3937
|
+
const spinner = ora11("Fetching feedback...").start();
|
|
3941
3938
|
const api = getApiClient();
|
|
3942
3939
|
const res = await api.get("/feedback", {
|
|
3943
3940
|
params: {
|
|
@@ -3976,7 +3973,7 @@ function registerFeedbackCommands(program2) {
|
|
|
3976
3973
|
});
|
|
3977
3974
|
feedback.command("show <id>").description("View a bug report or suggestion").option("--json", "Output raw JSON").action(async (id, opts) => {
|
|
3978
3975
|
try {
|
|
3979
|
-
const spinner =
|
|
3976
|
+
const spinner = ora11("Fetching feedback...").start();
|
|
3980
3977
|
const api = getApiClient();
|
|
3981
3978
|
const res = await api.get(`/feedback/${id}`);
|
|
3982
3979
|
spinner.stop();
|
|
@@ -4074,7 +4071,7 @@ function registerDoctorCommand(program2) {
|
|
|
4074
4071
|
|
|
4075
4072
|
// src/index.ts
|
|
4076
4073
|
var program = new Command();
|
|
4077
|
-
program.name("clishop").version("1.4.
|
|
4074
|
+
program.name("clishop").version("1.4.5").description(
|
|
4078
4075
|
chalk16.bold("CLISHOP") + ` \u2014 Order anything from your terminal.
|
|
4079
4076
|
|
|
4080
4077
|
Run 'clishop setup' to get started with a single payment link.
|