@cimplify/cli 0.15.0 → 0.15.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 (42) hide show
  1. package/README.md +1 -1
  2. package/dist/{add-EPY25NNV.mjs → add-X3OUBJ7D.mjs} +1 -1
  3. package/dist/{auth-step-up-VL742AS7.mjs → auth-step-up-Z6KOTTV7.mjs} +17 -15
  4. package/dist/{chunk-3KRSHO6J.mjs → chunk-DMLQBAGC.mjs} +3 -10
  5. package/dist/{chunk-GCQKTUXN.mjs → chunk-MGQD5MEC.mjs} +3 -3
  6. package/dist/chunk-MTEMM6WI.mjs +6463 -0
  7. package/dist/{chunk-5SMYK3U2.mjs → chunk-WAHYTXOF.mjs} +1 -1
  8. package/dist/dispatcher.mjs +13 -13
  9. package/dist/{doctor-TTI237ZY.mjs → doctor-YP5NOD75.mjs} +7 -9
  10. package/dist/{explain-HVK5ZNTV.mjs → explain-YX5DKW5T.mjs} +4 -4
  11. package/dist/{introspect-KTB4BXU5.mjs → introspect-HI65VEHQ.mjs} +2 -2
  12. package/dist/{list-L6FMY3AF.mjs → list-PRB7KCPF.mjs} +1 -1
  13. package/dist/{login-ZTSWYO5G.mjs → login-RLMDEWAL.mjs} +8 -12
  14. package/dist/{update-XUDRJZDE.mjs → update-62RJTAMU.mjs} +1 -1
  15. package/dist/{whoami-ZWTJMEDB.mjs → whoami-CQPPARRS.mjs} +1 -1
  16. package/package.json +3 -3
  17. package/templates/manifest.json +26 -26
  18. package/templates/storefront-auto/app/account/orders/page.tsx +1 -2
  19. package/templates/storefront-auto/bun.lock +7 -69
  20. package/templates/storefront-auto/package.json +1 -1
  21. package/templates/storefront-bakery/app/account/orders/page.tsx +1 -2
  22. package/templates/storefront-bakery/bun.lock +7 -69
  23. package/templates/storefront-bakery/package.json +1 -1
  24. package/templates/storefront-fashion/app/account/orders/page.tsx +1 -2
  25. package/templates/storefront-fashion/bun.lock +7 -69
  26. package/templates/storefront-fashion/package.json +1 -1
  27. package/templates/storefront-grocery/app/account/orders/page.tsx +1 -2
  28. package/templates/storefront-grocery/bun.lock +7 -69
  29. package/templates/storefront-grocery/package.json +1 -1
  30. package/templates/storefront-pharmacy/app/account/orders/page.tsx +1 -2
  31. package/templates/storefront-pharmacy/bun.lock +7 -69
  32. package/templates/storefront-pharmacy/package.json +1 -1
  33. package/templates/storefront-restaurant/app/account/orders/page.tsx +1 -2
  34. package/templates/storefront-restaurant/bun.lock +7 -69
  35. package/templates/storefront-restaurant/package.json +1 -1
  36. package/templates/storefront-retail/app/account/orders/page.tsx +1 -2
  37. package/templates/storefront-retail/bun.lock +7 -69
  38. package/templates/storefront-retail/package.json +1 -1
  39. package/templates/storefront-services/app/account/orders/page.tsx +1 -2
  40. package/templates/storefront-services/bun.lock +7 -69
  41. package/templates/storefront-services/package.json +1 -1
  42. package/dist/chunk-YJDQYKZU.mjs +0 -6463
package/README.md CHANGED
@@ -34,7 +34,7 @@ cimplify lint --fix --format json # safe fixes + stable machine-re
34
34
  ## Conventions
35
35
 
36
36
  - **Project link:** `cimplify link <project-id>` writes `.cimplify/project.json` in the working directory. Subsequent commands read it to know which project to act on — no `--project` flag needed for the common case.
37
- - **Auth:** credentials persist at `~/.config/cimplify/auth.json`. CI uses `--api-key dk_live_…` to skip the browser.
37
+ - **Auth:** credentials persist at `~/.config/cimplify/auth.json`. Headless login accepts a user-bound Personal key via `--api-key cak_…`.
38
38
  - **JSON mode:** pass `--json` (or set `CIMPLIFY_JSON=1`) for `{ ok, data | error }` machine-readable output on stdout.
39
39
  - **Lint rules:** `cimplify lint` reads the current project's `@cimplify/sdk/lint-rules` JSON as bounded, validated data and falls back to the rule set bundled with the CLI when an older SDK has no rules asset. It never imports project code. Exit 0 means clean, 1 means diagnostics remain, and 2 means the lint run itself could not start.
40
40
  - **Yes/no prompts:** pass `--yes` (or `-y`) to auto-confirm.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { promptYesNo } from './chunk-TH4XENKH.mjs';
3
- import { REGISTRY_INDEX, REGISTRY } from './chunk-YJDQYKZU.mjs';
3
+ import { REGISTRY_INDEX, REGISTRY } from './chunk-MTEMM6WI.mjs';
4
4
  import { parseArgs, flagString, flagBool } from './chunk-5KYR6WJB.mjs';
5
5
  import { CliError, CLI_ERROR_CODE, info, bold, dim, success, result, yellow } from './chunk-3QUK5BPY.mjs';
6
6
  import { mkdirSync, existsSync, writeFileSync } from 'fs';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { startLoopbackServer, generateState, openBrowser } from './chunk-3KRSHO6J.mjs';
2
+ import { startLoopbackServer, generateState, generatePkcePair, openBrowser } from './chunk-DMLQBAGC.mjs';
3
3
  import { parseArgs, flagString, flagBool } from './chunk-5KYR6WJB.mjs';
4
- import { resolveBaseUrl } from './chunk-NYXA6X56.mjs';
4
+ import { resolveBaseUrl, ApiClient } from './chunk-NYXA6X56.mjs';
5
5
  import { readAuth, writeStepUp } from './chunk-MLE4MVYC.mjs';
6
6
  import { isJsonMode, CliError, CLI_ERROR_CODE, step, info, dim, success, result } from './chunk-3QUK5BPY.mjs';
7
7
 
@@ -9,7 +9,7 @@ import { isJsonMode, CliError, CLI_ERROR_CODE, step, info, dim, success, result
9
9
  var FLAG_NO_BROWSER = "no-browser";
10
10
  var FLAG_BASE_URL = "base-url";
11
11
  var STEP_UP_PATH = "/cli/step-up";
12
- var STEP_UP_JWT_TTL_MS = 5 * 6e4;
12
+ var STEP_UP_EXCHANGE_PATH = "/v1/auth/cli/step-up/exchange";
13
13
  var CALLBACK_TIMEOUT_MS = 10 * 6e4;
14
14
  async function run(argv) {
15
15
  if (isJsonMode()) {
@@ -26,8 +26,10 @@ async function run(argv) {
26
26
  const loopback = await startLoopbackServer(baseUrl);
27
27
  const state = generateState();
28
28
  const requestId = generateState();
29
+ const pkce = generatePkcePair();
29
30
  const url = new URL(`${dashboardUrl}${STEP_UP_PATH}`);
30
31
  url.searchParams.set("request_id", requestId);
32
+ url.searchParams.set("code_challenge", pkce.codeChallenge);
31
33
  url.searchParams.set("redirect_uri", loopback.redirectUri);
32
34
  url.searchParams.set("state", state);
33
35
  step("Opening browser for fresh-auth...");
@@ -51,20 +53,23 @@ async function run(argv) {
51
53
  "Step-up state mismatch. Possible CSRF attempt \u2014 try again."
52
54
  );
53
55
  }
54
- if (!callback.step_up_token) {
55
- throw new CliError(
56
- CLI_ERROR_CODE.UNAUTHORIZED,
57
- "Step-up callback missing step_up_token."
58
- );
56
+ if (!callback.code) {
57
+ throw new CliError(CLI_ERROR_CODE.UNAUTHORIZED, "Step-up callback missing one-time code.");
59
58
  }
59
+ const exchange = await ApiClient.unauthenticated(baseUrl).post(STEP_UP_EXCHANGE_PATH, {
60
+ request_id: requestId,
61
+ code: callback.code,
62
+ code_verifier: pkce.codeVerifier
63
+ });
64
+ const ttlMs = exchange.expires_in_secs * 1e3;
60
65
  const token = {
61
- token: callback.step_up_token,
62
- expiresAt: Date.now() + STEP_UP_JWT_TTL_MS,
66
+ token: exchange.step_up_token,
67
+ expiresAt: Date.now() + ttlMs,
63
68
  savedAt: (/* @__PURE__ */ new Date()).toISOString()
64
69
  };
65
70
  await writeStepUp(token);
66
71
  success(
67
- `Step-up complete. Re-run your destructive command within ${Math.round(STEP_UP_JWT_TTL_MS / 6e4)} minutes.`
72
+ `Step-up complete. Re-run your destructive command within ${Math.max(1, Math.floor(ttlMs / 6e4))} minutes.`
68
73
  );
69
74
  result({
70
75
  step_up_active: true,
@@ -73,10 +78,7 @@ async function run(argv) {
73
78
  });
74
79
  }
75
80
  function deriveDashboardUrl(apiBaseUrl) {
76
- return apiBaseUrl.replace(
77
- /^https?:\/\/api\./,
78
- (m) => m.replace("api.", "app.")
79
- );
81
+ return apiBaseUrl.replace(/^https?:\/\/api\./, (m) => m.replace("api.", "app."));
80
82
  }
81
83
 
82
84
  export { run as default };
@@ -11,9 +11,7 @@ var CALLBACK_PATH = "/callback";
11
11
  var CALLBACK_TIMEOUT_MS = 10 * 60 * 1e3;
12
12
  function generatePkcePair() {
13
13
  const codeVerifier = base64UrlEncode(randomBytes(CODE_VERIFIER_BYTES));
14
- const codeChallenge = base64UrlEncode(
15
- createHash("sha256").update(codeVerifier).digest()
16
- );
14
+ const codeChallenge = base64UrlEncode(createHash("sha256").update(codeVerifier).digest());
17
15
  return { codeVerifier, codeChallenge, codeChallengeMethod: "S256" };
18
16
  }
19
17
  function generateState() {
@@ -69,7 +67,6 @@ async function startLoopbackServer(apiBaseUrl) {
69
67
  return;
70
68
  }
71
69
  const code = parsed.searchParams.get("code");
72
- const stepUpToken = parsed.searchParams.get("step_up_token");
73
70
  const state = parsed.searchParams.get("state");
74
71
  const error = parsed.searchParams.get("error");
75
72
  if (error) {
@@ -77,7 +74,7 @@ async function startLoopbackServer(apiBaseUrl) {
77
74
  rejectCb?.(new CliError(CLI_ERROR_CODE.UNAUTHORIZED, `OAuth error: ${error}`));
78
75
  return;
79
76
  }
80
- if (!state || !code && !stepUpToken) {
77
+ if (!state || !code) {
81
78
  res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" }).end(HTML_ERROR("Missing code or token in callback"));
82
79
  rejectCb?.(new CliError(CLI_ERROR_CODE.UNAUTHORIZED, "Malformed callback"));
83
80
  return;
@@ -85,7 +82,6 @@ async function startLoopbackServer(apiBaseUrl) {
85
82
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" }).end(HTML_SUCCESS(apiBaseUrl));
86
83
  resolveCb?.({
87
84
  code: code ?? void 0,
88
- step_up_token: stepUpToken ?? void 0,
89
85
  state
90
86
  });
91
87
  });
@@ -96,10 +92,7 @@ async function startLoopbackServer(apiBaseUrl) {
96
92
  const address = server.address();
97
93
  if (!address || typeof address === "string") {
98
94
  server.close();
99
- throw new CliError(
100
- CLI_ERROR_CODE.UNAUTHORIZED,
101
- "Could not bind loopback server"
102
- );
95
+ throw new CliError(CLI_ERROR_CODE.UNAUTHORIZED, "Could not bind loopback server");
103
96
  }
104
97
  const redirectUri = `http://${LOOPBACK_HOST}:${address.port}${CALLBACK_PATH}`;
105
98
  return {
@@ -2,7 +2,7 @@
2
2
  // package.json
3
3
  var package_default = {
4
4
  name: "@cimplify/cli",
5
- version: "0.15.0",
5
+ version: "0.15.1",
6
6
  description: "Cimplify CLI \u2014 deploy, manage env vars, link projects, and scaffold storefronts",
7
7
  keywords: [
8
8
  "cimplify",
@@ -43,7 +43,7 @@ var package_default = {
43
43
  "@babel/parser": "^8.0.4",
44
44
  "@babel/traverse": "^8.0.4",
45
45
  "@babel/types": "^8.0.4",
46
- "@cimplify/sdk": "^0.102.0",
46
+ "@cimplify/sdk": "^0.104.1",
47
47
  re2js: "^1.4.0"
48
48
  },
49
49
  devDependencies: {
@@ -54,7 +54,7 @@ var package_default = {
54
54
  "@typescript/native-preview": "^7.0.0-dev.20260616.1",
55
55
  tsup: "^8.5.1",
56
56
  typescript: "6.0.3",
57
- vitest: "^4.1.9"
57
+ vitest: "^4.1.10"
58
58
  }
59
59
  };
60
60