@superwall/cli 2.5.0 → 2.5.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.
Files changed (103) hide show
  1. package/README.md +7 -0
  2. package/dist/{apple-Dyr7OFBx.js → apple-D2z3tALE.js} +14 -14
  3. package/dist/{approve-Czs1-JO9.js → approve-I-lvTanp.js} +35 -28
  4. package/dist/{assets-BrB9jQPQ.js → assets-oo93EFou.js} +3 -3
  5. package/dist/auth.d.ts +1 -1
  6. package/dist/auth.js +3 -3
  7. package/dist/{session-D3fgXQBt.js → base-Cft9NZfU.js} +35 -35
  8. package/dist/{billing-D5qqIlVb.js → billing-Bo1UEKqV.js} +3 -3
  9. package/dist/{bind-B3eEcRyp.js → bind-BvScWziR.js} +4 -4
  10. package/dist/{build-DD9pSwHX.js → build-Co487gha.js} +11 -9
  11. package/dist/{client-AI9H4GGB.js → client-Tp6iD66_.js} +55 -5
  12. package/dist/create-CHIPz5vb.js +20 -0
  13. package/dist/{create-ChfgWpiM.js → create-G3HuOHZ4.js} +31 -31
  14. package/dist/{create-B4m-IKlr.js → create-uA3nrMIa.js} +6 -6
  15. package/dist/design-lint-CiFc78aM.js +158 -0
  16. package/dist/{doctor-XtXW6tKE.js → doctor-CHF9aNFc.js} +6 -6
  17. package/dist/{drivers-CMEL13gp.js → drivers-YZEcBiSV.js} +3 -3
  18. package/dist/entry.js +20 -20
  19. package/dist/{environment-BWT2S4qC.js → environment-EU7Mrk7j.js} +3 -3
  20. package/dist/{existing-b0GxFcnc.js → existing-DV_6NLfW.js} +2 -2
  21. package/dist/{selection-BltBpyp5.js → framework-b-Yf8sP1.js} +50 -50
  22. package/dist/held-Dd19AduK.js +17 -0
  23. package/dist/{held-D3PUNky2.js → held-L0vz0_hA.js} +6 -6
  24. package/dist/install-CXfLcLhU.js +109 -0
  25. package/dist/{integrate-qvKd9pVW.js → integrate-DS2YGLsM.js} +23 -23
  26. package/dist/{types-JdxmnCko.js → lock-DgSx-p8Y.js} +79 -79
  27. package/dist/login-C0BjJmFy.js +17 -0
  28. package/dist/{login-PMoXUGqq.js → login-Ca6FhI6R.js} +6 -6
  29. package/dist/{login-COmGHrU5.js → login-DoMmU3Bq.js} +1 -1
  30. package/dist/{lookup-gjcKIZvh.js → lookup-DhMLZmdW.js} +3 -3
  31. package/dist/{migrate-SkkLLdmr.js → migrate-CoQWqzhJ.js} +29 -29
  32. package/dist/{migration-DS44-3Zr.js → migration-C22iQzAW.js} +29 -11
  33. package/dist/{notification-url-BjQPLf4-.js → notification-url-CqnXE9yB.js} +2 -2
  34. package/dist/{open-DQpm2yVs.js → open-DriuY3di.js} +2 -2
  35. package/dist/{org-C04eAO-j.js → org-D7LQrg3k.js} +3 -3
  36. package/dist/{organization-BOECL3vZ.js → organization-DDidaGRK.js} +8 -8
  37. package/dist/{orgs-D6Kk96mG.js → orgs-CYXjVdxM.js} +1 -1
  38. package/dist/{paths-REb-GrbX.js → paths-Bf3othB-.js} +1 -1
  39. package/dist/{playbook-Du4Oydbf.js → playbook-K7vmAUsu.js} +10 -10
  40. package/dist/{project-CP6hiHra.js → project-NoMtbMyl.js} +9 -9
  41. package/dist/{promote-Dm2_b1WK.js → promote-DXxxj4BU.js} +23 -22
  42. package/dist/pull-Bfa3_SBt.js +106 -0
  43. package/dist/pull-DGrlBSAG.js +36 -0
  44. package/dist/{pull-F6pvO4To.js → pull-DuFUkP7t.js} +8 -8
  45. package/dist/{push-D_l9KJZN.js → push-CrowxhpU.js} +54 -48
  46. package/dist/push-DPZdch2W.js +30 -0
  47. package/dist/push-DV-kJZdw.js +22 -0
  48. package/dist/{push-BIFLhAiO.js → push-Dk5x2xP3.js} +122 -22
  49. package/dist/{registry-DIJB0mJa.js → registry-HhZVRBqY.js} +178 -155
  50. package/dist/resolve-D3RBtfkI.js +242 -0
  51. package/dist/{resources-BaP3p_LY.js → resources-CkG6SCia.js} +2 -2
  52. package/dist/{run-C5OPwhvS.js → run-CL5ZnujW.js} +2 -2
  53. package/dist/{run-CgLmD2vR.js → run-Co8u_BkN.js} +93 -70
  54. package/dist/scan-BQmjhs3g.js +4 -0
  55. package/dist/{scan-Bj5y0zTZ.js → scan-DhmGH1rF.js} +1 -1
  56. package/dist/{scope-Bp_zwJOo.js → scope-D0XpYMn4.js} +5 -5
  57. package/dist/{scope-CCb_7UvN.js → scope-ehZ7L1nj.js} +25 -11
  58. package/dist/{sdk-TvT0p_nO.js → sdk-DEfQttek.js} +7 -7
  59. package/dist/{series-TAixFBWW.js → series-D2ZpZ8cx.js} +96 -63
  60. package/dist/server-4ZK_1Off.js +29 -0
  61. package/dist/{server-CdVIboQn.js → server-DamMN_ig.js} +9 -9
  62. package/dist/session-4F_YWSul.js +6 -0
  63. package/dist/{session-Ywim-P8M.js → session-G1uwJI8L.js} +1 -1
  64. package/dist/{setup-zzjtTy8k.js → setup-BFTSxEWU.js} +9 -9
  65. package/dist/skills/index.json +2 -2
  66. package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
  67. package/dist/skills/{superwall-workspaces → superwall-artifacts}/SKILL.md +47 -32
  68. package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/cli.md +35 -29
  69. package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/slots.md +9 -9
  70. package/dist/{skills-2qYaUXGE.js → skills-CE4c9eHX.js} +4 -4
  71. package/dist/{skills-8um2fBPS.js → skills-ClEVgXUB.js} +8 -8
  72. package/dist/{git-D7AVdugb.js → source-BccdO4aL.js} +111 -102
  73. package/dist/{source-push-kAep4gPe.js → source-push-EyF02ekO.js} +43 -26
  74. package/dist/{spinner-BANVLncC.js → spinner-mWZnJCkN.js} +3 -3
  75. package/dist/{starter-CiLrp1cN.js → starter-BtUUQWhd.js} +38 -28
  76. package/dist/{status-CoYMK7QL.js → status-SAZxltzW.js} +42 -39
  77. package/dist/{storage-DzP22xKn.js → storage-R5-qDvHq.js} +1 -1
  78. package/dist/{storekit-n1x0bWkQ.js → storekit-CQHVFTOC.js} +3 -3
  79. package/dist/storekit-DK3xXKoY.js +17 -0
  80. package/dist/{telemetry-CXN6f-ZX.js → telemetry-B-uKuu49.js} +1 -1
  81. package/dist/{token-FmeHywYt.js → token-C2kzntVM.js} +1 -1
  82. package/dist/tools.d.ts +6 -1
  83. package/dist/tools.js +208 -130
  84. package/dist/{try-BWbzgelb.js → try-BrJJyXgq.js} +32 -32
  85. package/dist/{upgrade-CoWCEnoi.js → upgrade-g_Bd9oJe.js} +2 -2
  86. package/dist/{upgrade-Bk5boOgW.js → upgrade-zOXTIaAZ.js} +2 -2
  87. package/package.json +2 -2
  88. package/dist/create-CJljlkJK.js +0 -20
  89. package/dist/held-CX7Zf8u-.js +0 -17
  90. package/dist/install-CVUXsx8c.js +0 -103
  91. package/dist/login-ClnJi1Ea.js +0 -17
  92. package/dist/pull-DsdOoG-D.js +0 -36
  93. package/dist/pull-zYAbqo9n.js +0 -106
  94. package/dist/push-CJVfvFZq.js +0 -29
  95. package/dist/push-SVzv7fzE.js +0 -22
  96. package/dist/resolve--GsHj0Q1.js +0 -171
  97. package/dist/scan-v_WTE722.js +0 -4
  98. package/dist/server-CvJVusw3.js +0 -29
  99. package/dist/session-B8JNXkwN.js +0 -6
  100. package/dist/storekit-D5eopLM0.js +0 -17
  101. /package/dist/{download-2Zu2I_Og.js → download-DhGd4hOB.js} +0 -0
  102. /package/dist/{reports-CuhB1_ub.js → reports-HYVp169R.js} +0 -0
  103. /package/dist/{storage-BjQCiTuz.d.ts → storage-Bdz5AmqS.d.ts} +0 -0
@@ -1,50 +1,50 @@
1
- import "./token-FmeHywYt.js";
1
+ import "./token-C2kzntVM.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import { t as ApiError } from "./client-AI9H4GGB.js";
3
+ import "./environment-EU7Mrk7j.js";
4
+ import "./storage-R5-qDvHq.js";
5
+ import { t as ApiError } from "./client-Tp6iD66_.js";
6
6
  import "./config-CGcG7GOt.js";
7
- import "./spinner-BANVLncC.js";
7
+ import "./spinner-mWZnJCkN.js";
8
8
  import "./ui-D_qf3Gvw.js";
9
- import "./orgs-D6Kk96mG.js";
10
- import "./resources-BaP3p_LY.js";
11
- import "./lookup-gjcKIZvh.js";
9
+ import "./orgs-CYXjVdxM.js";
10
+ import "./resources-CkG6SCia.js";
11
+ import "./lookup-DhMLZmdW.js";
12
12
  import { n as openBrowser } from "./browser-Bp3yRKlU.js";
13
- import "./types-JdxmnCko.js";
14
- import "./scope-CCb_7UvN.js";
15
- import "./download-2Zu2I_Og.js";
16
- import { n as dashboardOrigin } from "./resolve--GsHj0Q1.js";
17
- import { a as findEntrypoint, r as WorkspaceError, s as readProject } from "./project-CP6hiHra.js";
18
- import { a as summarizeSeries, c as defaultRange, h as DRAFT_MODULE_MAX_BYTES, n as parseFilters, u as bundleWorkspace } from "./series-TAixFBWW.js";
19
- import { n as resolveOrganization, t as resolveAppScope } from "./organization-BOECL3vZ.js";
20
- import { i as warnIfSdkBehind } from "./sdk-TvT0p_nO.js";
13
+ import { r as dashboardOrigin } from "./resolve-D3RBtfkI.js";
14
+ import { a as findEntrypoint, s as readProject, t as ArtifactError } from "./project-NoMtbMyl.js";
15
+ import "./lock-DgSx-p8Y.js";
16
+ import "./scope-ehZ7L1nj.js";
17
+ import { _ as DRAFT_MODULE_MAX_BYTES, a as summarizeSeries, c as defaultRange, n as parseFilters, u as bundleArtifact } from "./series-D2ZpZ8cx.js";
18
+ import { n as resolveOrganization, t as resolveAppScope } from "./organization-DDidaGRK.js";
19
+ import "./download-DhGd4hOB.js";
20
+ import { i as warnIfSdkBehind } from "./sdk-DEfQttek.js";
21
21
 
22
- //#region src/core/workspaces/try.ts
23
- async function postDraft(ctx, path, body) {
22
+ //#region src/core/artifacts/try.ts
23
+ async function postDraft(ctx, path, body, options = {}) {
24
24
  try {
25
- return await ctx.api.post(path, body);
25
+ return await ctx.api.post(path, body, options);
26
26
  } catch (error) {
27
- if (error instanceof ApiError && error.status === 400) throw new WorkspaceError(error.message);
27
+ if (error instanceof ApiError && error.status === 400) throw new ArtifactError(error.message);
28
28
  throw error;
29
29
  }
30
30
  }
31
31
  async function uploadDraft(ctx, project, organizationId, wrangler) {
32
- const { module, bytes } = await bundleWorkspace(project.root, wrangler);
33
- if (bytes > DRAFT_MODULE_MAX_BYTES) throw new WorkspaceError(`The bundle is ${bytes} bytes; a draft can be ${DRAFT_MODULE_MAX_BYTES} at most.`);
34
- return postDraft(ctx, "/v2/workspaces/drafts", {
32
+ const { module, bytes } = await bundleArtifact(project.root, wrangler);
33
+ if (bytes > DRAFT_MODULE_MAX_BYTES) throw new ArtifactError(`The bundle is ${bytes} bytes; a draft can be ${DRAFT_MODULE_MAX_BYTES} at most.`);
34
+ return postDraft(ctx, "/v2/artifacts/drafts", {
35
35
  organization_id: Number(organizationId),
36
36
  manifest: project.manifest,
37
37
  module
38
- });
38
+ }, { idempotent: true });
39
39
  }
40
40
  async function tryMetric(ctx, project, entrypoint, input, wrangler) {
41
- if (input.app === void 0) throw new WorkspaceError("A metric runs for one app. Say which with --app <id>.");
41
+ if (input.app === void 0) throw new ArtifactError("A metric runs for one app. Say which with --app <id>.");
42
42
  const { organizationId, applicationId } = await resolveAppScope(ctx.api, input.app, input.org);
43
- if (organizationId === void 0) throw new WorkspaceError(`Couldn't find the organization of app ${input.app}. Say which with --org <id>.`);
43
+ if (organizationId === void 0) throw new ArtifactError(`Couldn't find the organization of app ${input.app}. Say which with --org <id>.`);
44
44
  const range = defaultRange(input.days);
45
45
  const filters = parseFilters(input.filter);
46
46
  const draft = await uploadDraft(ctx, project, organizationId, wrangler);
47
- const run = await postDraft(ctx, `/v2/workspaces/drafts/${encodeURIComponent(draft.id)}/metric`, {
47
+ const run = await postDraft(ctx, `/v2/artifacts/drafts/${encodeURIComponent(draft.id)}/metric`, {
48
48
  organization_id: Number(organizationId),
49
49
  application_id: Number(applicationId),
50
50
  entrypoint_id: entrypoint.id,
@@ -82,14 +82,14 @@ async function tryMetric(ctx, project, entrypoint, input, wrangler) {
82
82
  const round = (value) => Math.round(value * 1e3) / 1e3;
83
83
  async function tryFrame(ctx, project, entrypoint, input, seams) {
84
84
  const scope = input.app === void 0 ? { organizationId: await resolveOrganization(ctx, input.org) } : await resolveAppScope(ctx.api, input.app, input.org);
85
- if (scope.organizationId === void 0) throw new WorkspaceError(`Couldn't find the organization of app ${input.app}. Say which with --org <id>.`);
85
+ if (scope.organizationId === void 0) throw new ArtifactError(`Couldn't find the organization of app ${input.app}. Say which with --org <id>.`);
86
86
  const draft = await uploadDraft(ctx, project, scope.organizationId, seams.wrangler);
87
87
  const search = new URLSearchParams({ entrypoint: entrypoint.id });
88
88
  if (scope.applicationId !== void 0) search.set("app", scope.applicationId);
89
89
  if (input.campaign !== void 0) search.set("campaign", input.campaign);
90
90
  if (input.user !== void 0) search.set("user", input.user);
91
91
  if (input.environment !== void 0) search.set("environment", input.environment);
92
- const url = `${dashboardOrigin(ctx.api.host)}/${scope.organizationId}/workspace-drafts/${draft.id}?${search}`;
92
+ const url = `${dashboardOrigin(ctx.api.host)}/${scope.organizationId}/artifact-drafts/${draft.id}?${search}`;
93
93
  if (ctx.json) {
94
94
  ctx.output.data({
95
95
  draft_id: draft.id,
@@ -105,9 +105,9 @@ async function tryFrame(ctx, project, entrypoint, input, seams) {
105
105
  if (input.open && ctx.outputMode === "rich") await (seams.open ?? openBrowser)(url);
106
106
  }
107
107
  function tryReadout(entrypoint) {
108
- throw new WorkspaceError(`\`${entrypoint.id}\` (${entrypoint.slot}) is a readout, and readouts can't be tried on the real runtime yet. Run \`superwall workspaces dev\` to run it locally.`);
108
+ throw new ArtifactError(`\`${entrypoint.id}\` (${entrypoint.slot}) is a readout, and readouts can't be tried on the real runtime yet. Run \`superwall artifacts dev\` to run it locally.`);
109
109
  }
110
- async function runWorkspaceTry(ctx, input, seams = {}) {
110
+ async function runArtifactTry(ctx, input, seams = {}) {
111
111
  const project = readProject(input.dir);
112
112
  const entrypoint = findEntrypoint(project.manifest, input.entrypoint);
113
113
  await warnIfSdkBehind(ctx.ui, project.root);
@@ -117,4 +117,4 @@ async function runWorkspaceTry(ctx, input, seams = {}) {
117
117
  }
118
118
 
119
119
  //#endregion
120
- export { runWorkspaceTry };
120
+ export { runArtifactTry };
@@ -1,7 +1,7 @@
1
1
  import "./output-Ggzq5_-t.js";
2
- import "./environment-BWT2S4qC.js";
2
+ import "./environment-EU7Mrk7j.js";
3
3
  import "./config-CGcG7GOt.js";
4
4
  import "./spawn-DmmmHIP-.js";
5
- import { a as printAutoUpdate, c as runUpgrade, i as maybeNotifyUpdate, l as selectAutoUpdate, n as isGlobalInstall, o as recordAutoUpdate, r as isNewerVersion, s as refreshUpdateCheck, t as flushUpdateCheck } from "./upgrade-Bk5boOgW.js";
5
+ import { a as printAutoUpdate, c as runUpgrade, i as maybeNotifyUpdate, l as selectAutoUpdate, n as isGlobalInstall, o as recordAutoUpdate, r as isNewerVersion, s as refreshUpdateCheck, t as flushUpdateCheck } from "./upgrade-zOXTIaAZ.js";
6
6
 
7
7
  export { flushUpdateCheck, isGlobalInstall, isNewerVersion, maybeNotifyUpdate, printAutoUpdate, recordAutoUpdate, refreshUpdateCheck, runUpgrade, selectAutoUpdate };
@@ -1,4 +1,4 @@
1
- import { _ as RUNNING_VIA_NPX, a as AUTO_UPDATE, x as VERSION } from "./environment-BWT2S4qC.js";
1
+ import { _ as RUNNING_VIA_NPX, a as AUTO_UPDATE, x as VERSION } from "./environment-EU7Mrk7j.js";
2
2
  import { c as readSkillsSync, d as writeAutoUpdate, l as readUpdateCheck, n as readAutoUpdate, v as writeUpdateCheck } from "./config-CGcG7GOt.js";
3
3
  import { r as spawnStream } from "./spawn-DmmmHIP-.js";
4
4
  import { execFileSync } from "node:child_process";
@@ -111,7 +111,7 @@ async function updateAgentSkills(ctx, work) {
111
111
  return skills;
112
112
  }
113
113
  async function updateSkillsInProcess() {
114
- const { updateSkills } = await import("./skills-8um2fBPS.js");
114
+ const { updateSkills } = await import("./skills-ClEVgXUB.js");
115
115
  return updateSkills();
116
116
  }
117
117
  async function updateSkillsWithInstalledCli(version) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superwall/cli",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "The official CLI for managing Superwall from your terminal or coding agent.",
5
5
  "keywords": [
6
6
  "agent",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "dependencies": {
66
66
  "@anthropic-ai/claude-agent-sdk": "0.3.201",
67
- "@superwall/studio": "2.5.0",
67
+ "@superwall/studio": "2.5.2",
68
68
  "ansi-escapes": "^7.3.0",
69
69
  "fast-glob": "^3.3.3",
70
70
  "ink": "^5.2.1",
@@ -1,20 +0,0 @@
1
- import "./token-FmeHywYt.js";
2
- import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
6
- import "./held-D3PUNky2.js";
7
- import "./config-CGcG7GOt.js";
8
- import "./spinner-BANVLncC.js";
9
- import "./ui-D_qf3Gvw.js";
10
- import "./paths-REb-GrbX.js";
11
- import "./orgs-D6Kk96mG.js";
12
- import "./resources-BaP3p_LY.js";
13
- import "./org-C04eAO-j.js";
14
- import "./lookup-gjcKIZvh.js";
15
- import "./scope-Bp_zwJOo.js";
16
- import "./client-BJQXl62Q.js";
17
- import "./timing-Ca0TXY-A.js";
18
- import { i as runAscKeysCreate, n as keyAccess, r as keyRole, t as createAndSaveKey } from "./create-B4m-IKlr.js";
19
-
20
- export { createAndSaveKey, keyAccess, keyRole, runAscKeysCreate };
@@ -1,17 +0,0 @@
1
- import "./token-FmeHywYt.js";
2
- import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
6
- import { t as upsertHeldKey } from "./held-D3PUNky2.js";
7
- import "./config-CGcG7GOt.js";
8
- import "./spinner-BANVLncC.js";
9
- import "./ui-D_qf3Gvw.js";
10
- import "./orgs-D6Kk96mG.js";
11
- import "./resources-BaP3p_LY.js";
12
- import "./org-C04eAO-j.js";
13
- import "./lookup-gjcKIZvh.js";
14
- import "./scope-Bp_zwJOo.js";
15
- import "./client-BJQXl62Q.js";
16
-
17
- export { upsertHeldKey };
@@ -1,103 +0,0 @@
1
- import "./token-FmeHywYt.js";
2
- import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
6
- import "./config-CGcG7GOt.js";
7
- import "./spinner-BANVLncC.js";
8
- import "./ui-D_qf3Gvw.js";
9
- import "./orgs-D6Kk96mG.js";
10
- import "./resources-BaP3p_LY.js";
11
- import "./lookup-gjcKIZvh.js";
12
- import { n as openBrowser } from "./browser-Bp3yRKlU.js";
13
- import "./types-JdxmnCko.js";
14
- import "./scope-CCb_7UvN.js";
15
- import { S as listWorkspaces, T as setInstallation, a as openLink, c as resolveWorkspace, d as readBinding, g as deleteInstallation, r as latestManifest, s as projectRoot, t as appEntrypointUrl, x as listVersions, y as listInstallations } from "./resolve--GsHj0Q1.js";
16
- import { r as WorkspaceError } from "./project-CP6hiHra.js";
17
- import { n as resolveOrganization, t as resolveAppScope } from "./organization-BOECL3vZ.js";
18
-
19
- //#region src/core/workspaces/install.ts
20
- const whereLabel = (application) => application === null || application === void 0 ? "the whole organization" : `app ${application}`;
21
- const installationItem = (installation) => ({
22
- label: installation.entrypoint_id,
23
- meta: [
24
- installation.slot,
25
- whereLabel(installation.application_id),
26
- installation.enabled ? "on" : "off",
27
- `position ${installation.position}`
28
- ].join(", ")
29
- });
30
- async function runWorkspaceInstall(ctx, input) {
31
- const workspace = await resolveWorkspace(ctx, input);
32
- if (input.entrypoint === void 0) {
33
- if (input.remove || input.disable || input.app !== void 0 || input.position !== void 0) throw new WorkspaceError("Say which entrypoint: `superwall workspaces install <entrypoint>`.");
34
- const installations = await listInstallations(ctx.api, workspace.id);
35
- if (ctx.json) ctx.output.data({ data: installations });
36
- else ctx.ui.list({
37
- empty: "Nothing is installed yet.",
38
- items: installations.map(installationItem)
39
- });
40
- return;
41
- }
42
- const applicationId = input.app === void 0 ? void 0 : (await resolveAppScope(ctx.api, input.app, String(workspace.organization_id))).applicationId;
43
- if (input.remove) {
44
- if (!input.yes) {
45
- if (!ctx.interactive) throw new WorkspaceError("Removing an installation ends sessions that are open. Pass --yes to go ahead.");
46
- if (!await ctx.ui.confirm({
47
- message: `Remove \`${input.entrypoint}\` from ${whereLabel(applicationId)}? Sessions that are open will end.`,
48
- initial: false
49
- })) {
50
- ctx.ui.outro("Nothing was removed.");
51
- return;
52
- }
53
- }
54
- const left = await deleteInstallation(ctx.api, workspace.id, input.entrypoint, applicationId);
55
- if (ctx.json) ctx.output.data(left);
56
- else ctx.ui.success(`Removed \`${input.entrypoint}\` from ${whereLabel(applicationId)}.`);
57
- return;
58
- }
59
- const installation = await setInstallation(ctx.api, workspace.id, {
60
- entrypoint_id: input.entrypoint,
61
- application_id: applicationId === void 0 ? null : Number(applicationId),
62
- enabled: !input.disable,
63
- ...input.position === void 0 ? {} : { position: input.position }
64
- });
65
- if (ctx.json) {
66
- ctx.output.data(installation);
67
- return;
68
- }
69
- ctx.ui.success(input.disable ? `Turned \`${input.entrypoint}\` off for ${whereLabel(applicationId)}.` : `Installed \`${input.entrypoint}\` for ${whereLabel(applicationId)}.`);
70
- }
71
- async function runWorkspaceList(ctx, input) {
72
- const organizationId = await resolveOrganization(ctx, input.org ?? readBinding(projectRoot(input.dir))?.organizationId);
73
- const workspaces = await listWorkspaces(ctx.api, organizationId);
74
- if (ctx.json) {
75
- ctx.output.data({ data: workspaces });
76
- return;
77
- }
78
- ctx.ui.list({
79
- empty: `No workspaces in organization ${organizationId} yet.`,
80
- items: workspaces.map((workspace) => ({
81
- label: workspace.name,
82
- meta: `${workspace.slug}, id ${workspace.id}, ${workspace.state.replaceAll("_", " ")}`
83
- }))
84
- });
85
- }
86
- async function runWorkspaceOpen(ctx, input, seams = {}) {
87
- const workspace = await resolveWorkspace(ctx, input);
88
- if (input.entrypoint !== void 0 && input.app === void 0) throw new WorkspaceError("An entrypoint opens inside an app. Say which with --app <id>.");
89
- let url;
90
- if (input.entrypoint !== void 0 && input.app !== void 0) {
91
- const { applicationId } = await resolveAppScope(ctx.api, input.app, String(workspace.organization_id));
92
- url = appEntrypointUrl(ctx.api.host, workspace, String(applicationId), input.entrypoint);
93
- } else url = (await openLink(ctx, workspace, latestManifest(await listVersions(ctx.api, workspace.id).catch(() => [])))).url;
94
- if (ctx.json) {
95
- ctx.output.data({ url });
96
- return;
97
- }
98
- ctx.ui.info(`Open ${url}`);
99
- if (input.open && ctx.outputMode === "rich") await (seams.open ?? openBrowser)(url);
100
- }
101
-
102
- //#endregion
103
- export { runWorkspaceInstall, runWorkspaceList, runWorkspaceOpen };
@@ -1,17 +0,0 @@
1
- import "./token-FmeHywYt.js";
2
- import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
6
- import "./config-CGcG7GOt.js";
7
- import "./telemetry-CXN6f-ZX.js";
8
- import "./spawn-DmmmHIP-.js";
9
- import "./spinner-BANVLncC.js";
10
- import "./ui-D_qf3Gvw.js";
11
- import "./scan-Bj5y0zTZ.js";
12
- import "./paths-REb-GrbX.js";
13
- import { i as startLogin, n as pollLogin, r as runLogin, t as performLogin } from "./login-PMoXUGqq.js";
14
- import "./skills-2qYaUXGE.js";
15
- import "./browser-Bp3yRKlU.js";
16
-
17
- export { performLogin, pollLogin, runLogin, startLogin };
@@ -1,36 +0,0 @@
1
- import "./token-FmeHywYt.js";
2
- import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
6
- import "./config-CGcG7GOt.js";
7
- import "./telemetry-CXN6f-ZX.js";
8
- import "./spawn-DmmmHIP-.js";
9
- import "./spinner-BANVLncC.js";
10
- import "./ui-D_qf3Gvw.js";
11
- import "./theme-DUsCh-Vd.js";
12
- import "./log-C0MDCfA2.js";
13
- import "./scan-Bj5y0zTZ.js";
14
- import "./existing-b0GxFcnc.js";
15
- import "./paths-REb-GrbX.js";
16
- import "./orgs-D6Kk96mG.js";
17
- import "./resources-BaP3p_LY.js";
18
- import "./org-C04eAO-j.js";
19
- import "./lookup-gjcKIZvh.js";
20
- import "./bind-B3eEcRyp.js";
21
- import "./login-PMoXUGqq.js";
22
- import "./skills-2qYaUXGE.js";
23
- import "./browser-Bp3yRKlU.js";
24
- import "./selection-BltBpyp5.js";
25
- import "./types-JdxmnCko.js";
26
- import "./session-D3fgXQBt.js";
27
- import "./git-D7AVdugb.js";
28
- import "./scope-CCb_7UvN.js";
29
- import "./login-COmGHrU5.js";
30
- import "./run-C5OPwhvS.js";
31
- import "./drivers-CMEL13gp.js";
32
- import "./migration-DS44-3Zr.js";
33
- import "./setup-zzjtTy8k.js";
34
- import { a as cloneInto, c as pullInto, i as boundPaywall, l as runPull, n as applyPulledChanges, o as cloneTarget, r as appsToPull, s as mergePulledLock, t as PullPathError } from "./pull-F6pvO4To.js";
35
-
36
- export { PullPathError, applyPulledChanges, appsToPull, boundPaywall, cloneInto, cloneTarget, mergePulledLock, pullInto, runPull };
@@ -1,106 +0,0 @@
1
- import "./token-FmeHywYt.js";
2
- import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
6
- import "./config-CGcG7GOt.js";
7
- import "./telemetry-CXN6f-ZX.js";
8
- import "./spawn-DmmmHIP-.js";
9
- import "./spinner-BANVLncC.js";
10
- import "./ui-D_qf3Gvw.js";
11
- import "./theme-DUsCh-Vd.js";
12
- import "./log-C0MDCfA2.js";
13
- import "./scan-Bj5y0zTZ.js";
14
- import "./existing-b0GxFcnc.js";
15
- import "./paths-REb-GrbX.js";
16
- import "./orgs-D6Kk96mG.js";
17
- import "./resources-BaP3p_LY.js";
18
- import "./org-C04eAO-j.js";
19
- import "./lookup-gjcKIZvh.js";
20
- import "./bind-B3eEcRyp.js";
21
- import "./login-PMoXUGqq.js";
22
- import "./skills-2qYaUXGE.js";
23
- import "./browser-Bp3yRKlU.js";
24
- import "./selection-BltBpyp5.js";
25
- import "./types-JdxmnCko.js";
26
- import "./session-D3fgXQBt.js";
27
- import { a as collectSourceFiles, n as pullSourceTree } from "./git-D7AVdugb.js";
28
- import { r as WORKSPACE_DERIVED_FILES } from "./scope-CCb_7UvN.js";
29
- import "./login-COmGHrU5.js";
30
- import "./run-C5OPwhvS.js";
31
- import "./drivers-CMEL13gp.js";
32
- import "./migration-DS44-3Zr.js";
33
- import "./download-2Zu2I_Og.js";
34
- import "./setup-zzjtTy8k.js";
35
- import { n as applyPulledChanges } from "./pull-F6pvO4To.js";
36
- import { C as mintSourceAccess, c as resolveWorkspace, d as readBinding, f as readSourceFile, p as writeBinding, s as projectRoot } from "./resolve--GsHj0Q1.js";
37
- import { r as WorkspaceError } from "./project-CP6hiHra.js";
38
- import "./organization-BOECL3vZ.js";
39
- import "./sdk-TvT0p_nO.js";
40
- import { a as toSourceAccess } from "./push-D_l9KJZN.js";
41
- import * as fs from "node:fs";
42
- import * as path from "node:path";
43
-
44
- //#region src/core/workspaces/pull.ts
45
- const NOT_PUSHED = "Its source repo is empty: nobody has pushed yet. Run `superwall workspaces push` first.";
46
- function report(ctx, slug, head, written, skipped) {
47
- if (ctx.json) {
48
- ctx.output.data({
49
- slug,
50
- head,
51
- written,
52
- skipped
53
- });
54
- return;
55
- }
56
- ctx.ui.success(written.length === 0 ? "Already up to date." : `Pulled ${written.length} ${written.length === 1 ? "file" : "files"} of \`${slug}\`.`);
57
- if (written.length > 0) ctx.ui.list({ items: written.map((label) => ({ label })) });
58
- if (skipped.length > 0) ctx.ui.warn(`Not pulled, because a file of yours that git doesn't track is in the way: ${skipped.join(", ")}. Move it, then pull again.`);
59
- }
60
- function assertCloneTarget(root) {
61
- if (!fs.existsSync(root)) return;
62
- if (fs.readdirSync(root).length > 0) throw new WorkspaceError(`${root} already has files and isn't linked to this workspace. Pick an empty directory.`);
63
- }
64
- async function runWorkspacePull(ctx, input) {
65
- const root = projectRoot(input.dir);
66
- const linked = readBinding(root);
67
- const workspace = await resolveWorkspace(ctx, input);
68
- if (linked && linked.workspaceId !== String(workspace.id)) throw new WorkspaceError(`This project is linked to workspace ${linked.workspaceId}, not ${workspace.id}. Pull into an empty directory instead.`);
69
- if (!linked) assertCloneTarget(root);
70
- fs.mkdirSync(root, { recursive: true });
71
- const collected = linked ? await collectSourceFiles(root, readSourceFile) : {
72
- ok: true,
73
- files: []
74
- };
75
- if (!collected.ok) throw new WorkspaceError(collected.reason);
76
- const pulled = await pullSourceTree({
77
- access: toSourceAccess(await mintSourceAccess(ctx.api, workspace.id)),
78
- files: collected.files,
79
- base: linked?.syncedCommit,
80
- theirs: input.theirs,
81
- derived: WORKSPACE_DERIVED_FILES
82
- });
83
- if (pulled.status === "empty") throw new WorkspaceError(NOT_PUSHED);
84
- const { written, skipped } = applyPulledChanges(root, pulled.changes, new Set(collected.files.map((file) => file.path)));
85
- writeBinding(root, {
86
- workspaceId: String(workspace.id),
87
- organizationId: String(workspace.organization_id),
88
- slug: workspace.slug,
89
- ...skipped.length > 0 ? {
90
- syncedCommit: linked?.syncedCommit,
91
- reviewedCommit: linked?.reviewedCommit
92
- } : {
93
- syncedCommit: pulled.head,
94
- reviewedCommit: pulled.head
95
- }
96
- });
97
- report(ctx, workspace.slug, pulled.head, written, skipped);
98
- if (linked && written.length > 0 && !ctx.json) ctx.ui.info("Read what came in before you push: your own copy runs all of it with your reads.");
99
- if (!linked && !ctx.json) {
100
- const where = path.relative(process.cwd(), root) || ".";
101
- ctx.ui.info(`Next: cd ${where} && npm install && superwall workspaces dev`);
102
- }
103
- }
104
-
105
- //#endregion
106
- export { runWorkspacePull };
@@ -1,29 +0,0 @@
1
- import "./token-FmeHywYt.js";
2
- import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
6
- import "./config-CGcG7GOt.js";
7
- import "./telemetry-CXN6f-ZX.js";
8
- import "./spawn-DmmmHIP-.js";
9
- import "./spinner-BANVLncC.js";
10
- import "./ui-D_qf3Gvw.js";
11
- import "./scan-Bj5y0zTZ.js";
12
- import "./paths-REb-GrbX.js";
13
- import "./orgs-D6Kk96mG.js";
14
- import "./resources-BaP3p_LY.js";
15
- import "./lookup-gjcKIZvh.js";
16
- import "./login-PMoXUGqq.js";
17
- import "./skills-2qYaUXGE.js";
18
- import "./browser-Bp3yRKlU.js";
19
- import "./assets-BrB9jQPQ.js";
20
- import "./selection-BltBpyp5.js";
21
- import "./types-JdxmnCko.js";
22
- import "./session-D3fgXQBt.js";
23
- import "./source-push-kAep4gPe.js";
24
- import { i as timed, n as runPush, r as runPushPipeline, t as group } from "./push-BIFLhAiO.js";
25
- import "./git-D7AVdugb.js";
26
- import "./scope-CCb_7UvN.js";
27
- import "./login-COmGHrU5.js";
28
-
29
- export { group, runPush, runPushPipeline, timed };
@@ -1,22 +0,0 @@
1
- import "./token-FmeHywYt.js";
2
- import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
6
- import "./config-CGcG7GOt.js";
7
- import "./spinner-BANVLncC.js";
8
- import "./ui-D_qf3Gvw.js";
9
- import "./orgs-D6Kk96mG.js";
10
- import "./resources-BaP3p_LY.js";
11
- import "./lookup-gjcKIZvh.js";
12
- import "./types-JdxmnCko.js";
13
- import "./git-D7AVdugb.js";
14
- import "./scope-CCb_7UvN.js";
15
- import "./download-2Zu2I_Og.js";
16
- import "./resolve--GsHj0Q1.js";
17
- import "./project-CP6hiHra.js";
18
- import "./organization-BOECL3vZ.js";
19
- import "./sdk-TvT0p_nO.js";
20
- import { a as toSourceAccess, i as slugOfName, n as namesOf, o as waitForBuild, r as runWorkspacePush, t as IncomingCommitsRefused } from "./push-D_l9KJZN.js";
21
-
22
- export { IncomingCommitsRefused, namesOf, runWorkspacePush, slugOfName, toSourceAccess, waitForBuild };