@stripe/link-cli 0.2.0 → 0.2.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/README.md +16 -1
- package/dist/cli.js +26 -11
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -16,6 +16,21 @@ npx @stripe/link-cli
|
|
|
16
16
|
|
|
17
17
|
You can install the skill via `npx skills add stripe/link-cli`.
|
|
18
18
|
|
|
19
|
+
### MCP Server
|
|
20
|
+
|
|
21
|
+
Link CLI can also run as a local MCP server. Add the following to your MCP client config (`.mcp.json`, etc.)
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"link": {
|
|
27
|
+
"command": "npx",
|
|
28
|
+
"args": ["@stripe/link-cli", "--mcp"]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
19
34
|
## Quickstart
|
|
20
35
|
|
|
21
36
|
### Login
|
|
@@ -26,7 +41,7 @@ The `link-cli` requires a Link account. You can login to your existing one or [r
|
|
|
26
41
|
link-cli auth login
|
|
27
42
|
```
|
|
28
43
|
|
|
29
|
-
You'll receive a verification URL and a short
|
|
44
|
+
You'll receive a verification URL and a short phrase. Visit the URL, log in to your Link account, and enter the phrase to approve the connection.
|
|
30
45
|
|
|
31
46
|
### List payment methods
|
|
32
47
|
|
package/dist/cli.js
CHANGED
|
@@ -9550,6 +9550,7 @@ var require_semver2 = __commonJS({
|
|
|
9550
9550
|
|
|
9551
9551
|
// src/cli.tsx
|
|
9552
9552
|
import { Cli as Cli5 } from "incur";
|
|
9553
|
+
import updateNotifier from "update-notifier";
|
|
9553
9554
|
|
|
9554
9555
|
// ../sdk/dist/index.js
|
|
9555
9556
|
import fs3 from "fs";
|
|
@@ -11374,7 +11375,7 @@ var Login = ({
|
|
|
11374
11375
|
] }),
|
|
11375
11376
|
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "Press Enter to open in browser" }),
|
|
11376
11377
|
/* @__PURE__ */ jsxs(Text, { children: [
|
|
11377
|
-
"Enter
|
|
11378
|
+
"Enter phrase:",
|
|
11378
11379
|
" ",
|
|
11379
11380
|
/* @__PURE__ */ jsx(Text, { bold: true, color: "yellow", children: userCode })
|
|
11380
11381
|
] })
|
|
@@ -11433,7 +11434,7 @@ var statusOptions = z.object({
|
|
|
11433
11434
|
|
|
11434
11435
|
// src/commands/auth/index.tsx
|
|
11435
11436
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
11436
|
-
function createAuthCli(authResource) {
|
|
11437
|
+
function createAuthCli(authResource, updateInfo) {
|
|
11437
11438
|
const cli2 = Cli.create("auth", {
|
|
11438
11439
|
description: "Authentication commands"
|
|
11439
11440
|
});
|
|
@@ -11473,11 +11474,11 @@ function createAuthCli(authResource) {
|
|
|
11473
11474
|
interval: authRequest.interval,
|
|
11474
11475
|
expires_at: Date.now() + authRequest.expires_in * 1e3,
|
|
11475
11476
|
verification_url: authRequest.verification_url_complete,
|
|
11476
|
-
|
|
11477
|
+
phrase: authRequest.user_code
|
|
11477
11478
|
});
|
|
11478
11479
|
yield {
|
|
11479
11480
|
verification_url: authRequest.verification_url_complete,
|
|
11480
|
-
|
|
11481
|
+
phrase: authRequest.user_code,
|
|
11481
11482
|
instruction: "Present the verification_url to the user and ask them to approve in the Link app. Then call `auth status --interval 5 --max-attempts 60` to poll until authenticated. Do not wait for the user to reply \u2014 start polling immediately.",
|
|
11482
11483
|
_next: {
|
|
11483
11484
|
command: "auth status --interval 5 --max-attempts 60",
|
|
@@ -11534,12 +11535,18 @@ function createAuthCli(authResource) {
|
|
|
11534
11535
|
}
|
|
11535
11536
|
}
|
|
11536
11537
|
const auth = storage.getAuth();
|
|
11538
|
+
const update = updateInfo ? {
|
|
11539
|
+
current_version: updateInfo.current,
|
|
11540
|
+
latest_version: updateInfo.latest,
|
|
11541
|
+
update_command: "npm install -g @stripe/link-cli"
|
|
11542
|
+
} : void 0;
|
|
11537
11543
|
if (auth) {
|
|
11538
11544
|
yield {
|
|
11539
11545
|
authenticated: true,
|
|
11540
11546
|
access_token: `${auth.access_token.substring(0, 20)}...`,
|
|
11541
11547
|
token_type: auth.token_type,
|
|
11542
|
-
credentials_path: storage.getPath()
|
|
11548
|
+
credentials_path: storage.getPath(),
|
|
11549
|
+
...update && { update }
|
|
11543
11550
|
};
|
|
11544
11551
|
return;
|
|
11545
11552
|
}
|
|
@@ -11547,10 +11554,11 @@ function createAuthCli(authResource) {
|
|
|
11547
11554
|
const status = {
|
|
11548
11555
|
authenticated: false,
|
|
11549
11556
|
credentials_path: storage.getPath(),
|
|
11557
|
+
...update && { update },
|
|
11550
11558
|
...currentPending ? {
|
|
11551
11559
|
pending: true,
|
|
11552
11560
|
verification_url: currentPending.verification_url,
|
|
11553
|
-
|
|
11561
|
+
phrase: currentPending.phrase
|
|
11554
11562
|
} : {}
|
|
11555
11563
|
};
|
|
11556
11564
|
attempts++;
|
|
@@ -12821,9 +12829,8 @@ var RetrieveSpendRequest = ({
|
|
|
12821
12829
|
] }),
|
|
12822
12830
|
request?.card.valid_until && /* @__PURE__ */ jsxs10(Text11, { children: [
|
|
12823
12831
|
" ",
|
|
12824
|
-
"Valid Until:",
|
|
12825
|
-
|
|
12826
|
-
/* @__PURE__ */ jsx14(Text11, { bold: true, children: new Date(request.card.valid_until * 1e3).toISOString() })
|
|
12832
|
+
"Valid Until: ",
|
|
12833
|
+
/* @__PURE__ */ jsx14(Text11, { bold: true, children: request.card.valid_until })
|
|
12827
12834
|
] }),
|
|
12828
12835
|
request?.card.billing_address && /* @__PURE__ */ jsxs10(Box11, { flexDirection: "column", marginTop: 1, children: [
|
|
12829
12836
|
/* @__PURE__ */ jsx14(Text11, { bold: true, children: " Billing Address:" }),
|
|
@@ -13586,8 +13593,9 @@ var ResourceFactory = class {
|
|
|
13586
13593
|
};
|
|
13587
13594
|
|
|
13588
13595
|
// src/cli.tsx
|
|
13589
|
-
var cliVersion = "0.2.
|
|
13596
|
+
var cliVersion = "0.2.2";
|
|
13590
13597
|
var buildNumber = "1";
|
|
13598
|
+
var cliName = "@stripe/link-cli";
|
|
13591
13599
|
var defaultHeaders = {
|
|
13592
13600
|
"User-Agent": `link-cli/${cliVersion} (build ${buildNumber})`,
|
|
13593
13601
|
"X-Build-Number": buildNumber
|
|
@@ -13596,16 +13604,23 @@ var verbose = process.argv.includes("--verbose");
|
|
|
13596
13604
|
var factory = new ResourceFactory({ verbose, defaultHeaders });
|
|
13597
13605
|
var authRepo = factory.createAuthResource();
|
|
13598
13606
|
var spendRequestRepo = factory.createSpendRequestResource();
|
|
13607
|
+
var notifier = updateNotifier({
|
|
13608
|
+
pkg: { name: cliName, version: cliVersion }
|
|
13609
|
+
});
|
|
13599
13610
|
var cli = Cli5.create("link-cli", {
|
|
13600
13611
|
description: "Create a secure, one-time payment credential from a Link wallet to let agents complete purchases on behalf of users.",
|
|
13601
13612
|
version: `${cliVersion} (build ${buildNumber})`
|
|
13602
13613
|
});
|
|
13603
|
-
cli.command(createAuthCli(authRepo));
|
|
13614
|
+
cli.command(createAuthCli(authRepo, notifier.update));
|
|
13604
13615
|
cli.command(createSpendRequestCli(spendRequestRepo));
|
|
13605
13616
|
cli.command(
|
|
13606
13617
|
createPaymentMethodsCli(() => factory.createPaymentMethodsResource())
|
|
13607
13618
|
);
|
|
13608
13619
|
cli.command(createMppCli(spendRequestRepo));
|
|
13620
|
+
var isAgent = process.argv.includes("--format") || process.argv.includes("--mcp");
|
|
13621
|
+
if (!isAgent) {
|
|
13622
|
+
notifier.notify({ defer: false });
|
|
13623
|
+
}
|
|
13609
13624
|
cli.serve();
|
|
13610
13625
|
var cli_default = cli;
|
|
13611
13626
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/link-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"link-cli": "./dist/cli.js"
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"tsx": "^4.21.0",
|
|
40
40
|
"typescript": "^5.9.3",
|
|
41
41
|
"vitest": "^4.1.2",
|
|
42
|
-
"@stripe/link-
|
|
43
|
-
"@stripe/link-
|
|
42
|
+
"@stripe/link-typescript-config": "0.0.0",
|
|
43
|
+
"@stripe/link-sdk": "1.0.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsup",
|