clishop 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +33 -22
- package/dist/mcp.js +4 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -812,11 +812,11 @@ function divider(color = chalk4.cyan) {
|
|
|
812
812
|
function registerSetupCommand(program2) {
|
|
813
813
|
program2.command("setup").description(
|
|
814
814
|
"Set up your CLISHOP account \u2014 links your payment method via a secure browser link"
|
|
815
|
-
).option("--email <email>", "Email address (skips prompt)").
|
|
816
|
-
await runSetupWizard(opts.email
|
|
815
|
+
).option("--email <email>", "Email address (skips prompt)").action(async (opts) => {
|
|
816
|
+
await runSetupWizard(opts.email);
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
|
-
async function runSetupWizard(emailArg
|
|
819
|
+
async function runSetupWizard(emailArg) {
|
|
820
820
|
const config = getConfig();
|
|
821
821
|
const loggedIn = await isLoggedIn();
|
|
822
822
|
if (loggedIn) {
|
|
@@ -847,7 +847,7 @@ async function runSetupWizard(emailArg, nameArg) {
|
|
|
847
847
|
console.log();
|
|
848
848
|
console.log(chalk4.bold.cyan(" W E L C O M E T O C L I S H O P"));
|
|
849
849
|
console.log(chalk4.dim(" Order anything from your terminal."));
|
|
850
|
-
console.log(chalk4.dim(` Build: ${"2026-
|
|
850
|
+
console.log(chalk4.dim(` Build: ${"2026-04-03T15:25:04.257Z"}`));
|
|
851
851
|
console.log();
|
|
852
852
|
divider(chalk4.cyan);
|
|
853
853
|
console.log();
|
|
@@ -872,21 +872,18 @@ async function runSetupWizard(emailArg, nameArg) {
|
|
|
872
872
|
);
|
|
873
873
|
console.log();
|
|
874
874
|
let email = emailArg;
|
|
875
|
-
|
|
876
|
-
if (!email || !name) {
|
|
875
|
+
if (!email) {
|
|
877
876
|
const answers = await inquirer3.prompt([
|
|
878
|
-
|
|
879
|
-
...!name ? [{ type: "input", name: "name", message: "Your name:" }] : []
|
|
877
|
+
{ type: "input", name: "email", message: "Email:" }
|
|
880
878
|
]);
|
|
881
|
-
email =
|
|
882
|
-
name = name || answers.name;
|
|
879
|
+
email = answers.email;
|
|
883
880
|
}
|
|
884
881
|
const spinner = ora3("Creating your account and payment link...").start();
|
|
885
882
|
let setupUrl;
|
|
886
883
|
let deviceCode;
|
|
887
884
|
try {
|
|
888
885
|
const baseUrl2 = getApiBaseUrl();
|
|
889
|
-
const res = await axios.post(`${baseUrl2}/auth/setup-link`, { email
|
|
886
|
+
const res = await axios.post(`${baseUrl2}/auth/setup-link`, { email });
|
|
890
887
|
setupUrl = res.data.setupUrl;
|
|
891
888
|
deviceCode = res.data.deviceCode;
|
|
892
889
|
spinner.stop();
|
|
@@ -900,7 +897,7 @@ async function runSetupWizard(emailArg, nameArg) {
|
|
|
900
897
|
return;
|
|
901
898
|
}
|
|
902
899
|
console.log();
|
|
903
|
-
console.log(chalk4.bold("
|
|
900
|
+
console.log(chalk4.bold(" Give this link to your human to configure the payment method:"));
|
|
904
901
|
console.log();
|
|
905
902
|
console.log(" " + chalk4.cyan.underline(setupUrl));
|
|
906
903
|
console.log();
|
|
@@ -908,7 +905,7 @@ async function runSetupWizard(emailArg, nameArg) {
|
|
|
908
905
|
if (opened) {
|
|
909
906
|
console.log(chalk4.dim(" (Browser opened automatically)"));
|
|
910
907
|
} else {
|
|
911
|
-
console.log(chalk4.yellow(" Could not open browser automatically. Please
|
|
908
|
+
console.log(chalk4.yellow(" Could not open browser automatically. Please share the link above."));
|
|
912
909
|
}
|
|
913
910
|
console.log();
|
|
914
911
|
const pollSpinner = ora3("Waiting for you to complete payment setup...").start();
|
|
@@ -1554,15 +1551,17 @@ function registerSearchCommands(program2) {
|
|
|
1554
1551
|
}
|
|
1555
1552
|
}
|
|
1556
1553
|
if (!shipToCountry) {
|
|
1557
|
-
|
|
1558
|
-
spinner.fail(chalk6.red("No shipping address set \u2014 a country is required for searches."));
|
|
1554
|
+
spinner.stop();
|
|
1559
1555
|
console.log();
|
|
1560
|
-
console.log(chalk6.yellow(
|
|
1561
|
-
console.log(chalk6.yellow(" Add an address to this agent:"));
|
|
1562
|
-
console.log(chalk6.white(` clishop address add`));
|
|
1556
|
+
console.log(chalk6.yellow(" Please specify where you want your order shipped:"));
|
|
1563
1557
|
console.log();
|
|
1564
|
-
console.log(chalk6.
|
|
1565
|
-
console.log(chalk6.white(` clishop search "
|
|
1558
|
+
console.log(chalk6.white(` clishop search "${query}" --country US`));
|
|
1559
|
+
console.log(chalk6.white(` clishop search "${query}" --country BE`));
|
|
1560
|
+
console.log(chalk6.white(` clishop search "${query}" --country NL`));
|
|
1561
|
+
console.log();
|
|
1562
|
+
console.log(chalk6.dim(" You can use any ISO country code (US, GB, DE, FR, BE, NL, ...)."));
|
|
1563
|
+
console.log(chalk6.dim(" Or add an address to skip this step next time:"));
|
|
1564
|
+
console.log(chalk6.white(` clishop address add`));
|
|
1566
1565
|
console.log();
|
|
1567
1566
|
return;
|
|
1568
1567
|
}
|
|
@@ -2172,7 +2171,19 @@ function registerOrderCommands(program2) {
|
|
|
2172
2171
|
`));
|
|
2173
2172
|
}
|
|
2174
2173
|
const addressId = opts.address || agent.defaultAddressId;
|
|
2175
|
-
|
|
2174
|
+
let paymentId = opts.payment || agent.defaultPaymentMethodId;
|
|
2175
|
+
if (!paymentId) {
|
|
2176
|
+
try {
|
|
2177
|
+
const api2 = getApiClient();
|
|
2178
|
+
const pmRes = await api2.get("/payment-methods", { params: { agent: agent.name } });
|
|
2179
|
+
const methods = pmRes.data.paymentMethods || [];
|
|
2180
|
+
if (methods.length > 0) {
|
|
2181
|
+
paymentId = methods[0].id;
|
|
2182
|
+
updateAgent(agent.name, { defaultPaymentMethodId: paymentId });
|
|
2183
|
+
}
|
|
2184
|
+
} catch {
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2176
2187
|
if (!addressId) {
|
|
2177
2188
|
console.error(chalk7.red("\n\u2717 No address set. Add one with: clishop address add"));
|
|
2178
2189
|
process.exitCode = 1;
|
|
@@ -4063,7 +4074,7 @@ function registerDoctorCommand(program2) {
|
|
|
4063
4074
|
|
|
4064
4075
|
// src/index.ts
|
|
4065
4076
|
var program = new Command();
|
|
4066
|
-
program.name("clishop").version("1.
|
|
4077
|
+
program.name("clishop").version("1.4.2").description(
|
|
4067
4078
|
chalk16.bold("CLISHOP") + ` \u2014 Order anything from your terminal.
|
|
4068
4079
|
|
|
4069
4080
|
Run 'clishop setup' to get started with a single payment link.
|
package/dist/mcp.js
CHANGED
|
@@ -13825,8 +13825,7 @@ server.registerTool("setup", {
|
|
|
13825
13825
|
title: "Setup",
|
|
13826
13826
|
description: "Onboard a new user by creating their account and generating a Stripe payment setup link. The user must open this link in their browser to link their payment method. This is the ONLY step requiring human interaction. After the user completes the link, call setup_status with the returned deviceCode to get auth tokens. The agent can then use add_address to set up shipping autonomously.",
|
|
13827
13827
|
inputSchema: {
|
|
13828
|
-
email: external_exports.string().email().describe("User's email address")
|
|
13829
|
-
name: external_exports.string().describe("User's full name")
|
|
13828
|
+
email: external_exports.string().email().describe("User's email address")
|
|
13830
13829
|
},
|
|
13831
13830
|
annotations: {
|
|
13832
13831
|
title: "Setup",
|
|
@@ -13837,12 +13836,11 @@ server.registerTool("setup", {
|
|
|
13837
13836
|
return safeCall(async () => {
|
|
13838
13837
|
const baseUrl = getApiBaseUrl();
|
|
13839
13838
|
const res = await axios.post(`${baseUrl}/auth/setup-link`, {
|
|
13840
|
-
email: args.email
|
|
13841
|
-
name: args.name
|
|
13839
|
+
email: args.email
|
|
13842
13840
|
});
|
|
13843
13841
|
return {
|
|
13844
13842
|
...res.data,
|
|
13845
|
-
message: "
|
|
13843
|
+
message: "Give this link to your human to configure their payment method in the browser. Then call setup_status with the deviceCode to check when they're done."
|
|
13846
13844
|
};
|
|
13847
13845
|
});
|
|
13848
13846
|
});
|
|
@@ -13924,7 +13922,7 @@ server.registerTool("search_products", {
|
|
|
13924
13922
|
}
|
|
13925
13923
|
}
|
|
13926
13924
|
if (!country) {
|
|
13927
|
-
throw new Error("No delivery country
|
|
13925
|
+
throw new Error("No delivery country specified. Pass the 'country' parameter with an ISO code (e.g. 'US', 'NL', 'BE', 'GB', 'DE'). You can also add a shipping address via the add_address tool to skip this next time.");
|
|
13928
13926
|
}
|
|
13929
13927
|
const res = await api.get("/products/search", {
|
|
13930
13928
|
params: {
|