@stripe/link-cli 0.2.0 → 0.2.1

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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +24 -8
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -26,7 +26,7 @@ The `link-cli` requires a Link account. You can login to your existing one or [r
26
26
  link-cli auth login
27
27
  ```
28
28
 
29
- You'll receive a verification URL and a short passphrase. Visit the URL, log in to your Link account, and enter the passphrase to approve the connection.
29
+ 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
30
 
31
31
  ### List payment methods
32
32
 
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 passphrase:",
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
- passphrase: authRequest.user_code
11477
+ phrase: authRequest.user_code
11477
11478
  });
11478
11479
  yield {
11479
11480
  verification_url: authRequest.verification_url_complete,
11480
- passphrase: authRequest.user_code,
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
- passphrase: currentPending.passphrase
11561
+ phrase: currentPending.phrase
11554
11562
  } : {}
11555
11563
  };
11556
11564
  attempts++;
@@ -13586,8 +13594,9 @@ var ResourceFactory = class {
13586
13594
  };
13587
13595
 
13588
13596
  // src/cli.tsx
13589
- var cliVersion = "0.2.0";
13597
+ var cliVersion = "0.2.1";
13590
13598
  var buildNumber = "1";
13599
+ var cliName = "@stripe/link-cli";
13591
13600
  var defaultHeaders = {
13592
13601
  "User-Agent": `link-cli/${cliVersion} (build ${buildNumber})`,
13593
13602
  "X-Build-Number": buildNumber
@@ -13596,16 +13605,23 @@ var verbose = process.argv.includes("--verbose");
13596
13605
  var factory = new ResourceFactory({ verbose, defaultHeaders });
13597
13606
  var authRepo = factory.createAuthResource();
13598
13607
  var spendRequestRepo = factory.createSpendRequestResource();
13608
+ var notifier = updateNotifier({
13609
+ pkg: { name: cliName, version: cliVersion }
13610
+ });
13599
13611
  var cli = Cli5.create("link-cli", {
13600
13612
  description: "Create a secure, one-time payment credential from a Link wallet to let agents complete purchases on behalf of users.",
13601
13613
  version: `${cliVersion} (build ${buildNumber})`
13602
13614
  });
13603
- cli.command(createAuthCli(authRepo));
13615
+ cli.command(createAuthCli(authRepo, notifier.update));
13604
13616
  cli.command(createSpendRequestCli(spendRequestRepo));
13605
13617
  cli.command(
13606
13618
  createPaymentMethodsCli(() => factory.createPaymentMethodsResource())
13607
13619
  );
13608
13620
  cli.command(createMppCli(spendRequestRepo));
13621
+ var isAgent = process.argv.includes("--format") || process.argv.includes("--mcp");
13622
+ if (!isAgent) {
13623
+ notifier.notify({ defer: false });
13624
+ }
13609
13625
  cli.serve();
13610
13626
  var cli_default = cli;
13611
13627
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/link-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "link-cli": "./dist/cli.js"