@anna-ai/cli 0.1.47 → 0.1.51

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 (63) hide show
  1. package/dist/{account-BBMYzSH7.js → account-C-IeQNNr.js} +1 -1
  2. package/dist/{agent-DAOr_aiE.js → agent-CX2VzG7e.js} +1 -1
  3. package/dist/{apps-DlVsVHQ5.js → apps-BRBufSyX.js} +8 -41
  4. package/dist/{apps-BQcbrExH.js → apps-CTIiH6a_.js} +4 -2
  5. package/dist/apps-cut-35wivw1Z.js +19 -0
  6. package/dist/{apps-cut-DWodD5oE.js → apps-cut-L7T8b5RS.js} +20 -22
  7. package/dist/{apps-destructive-BVjpOxNF.js → apps-destructive-DcG3T1Mx.js} +2 -2
  8. package/dist/{apps-discard-5z0K4-o3.js → apps-discard-CKA_m7Yw.js} +7 -7
  9. package/dist/apps-grants-B5MpWhSO.js +70 -0
  10. package/dist/apps-publish-CGfzN7tI.js +92 -0
  11. package/dist/apps-publish-CUJILNOt.js +22 -0
  12. package/dist/apps-push-BcYNGSYx.js +20 -0
  13. package/dist/{app-bundle-upload-CzWR9jxI.js → apps-push-d1C0eePp.js} +144 -69
  14. package/dist/{apps-release-DuaJI9iX.js → apps-release-DxRHjEYJ.js} +2 -2
  15. package/dist/{apps-rename-slug-BGpitGyw.js → apps-rename-slug-4_5lsDwg.js} +2 -2
  16. package/dist/{apps-status-BVIL6DYc.js → apps-status-hMrRz356.js} +6 -1
  17. package/dist/{apps-submit-review-BmPjkoe9.js → apps-submit-review-CxoKgexX.js} +9 -3
  18. package/dist/{apps-sync-meta-87RK1Usm.js → apps-sync-meta-BwN8g6TO.js} +3 -3
  19. package/dist/{apps-versions-DfapYfW-.js → apps-versions-gfG_sBFv.js} +10 -5
  20. package/dist/{bridge-sFHqOOat.js → bridge-Bo8eu3-d.js} +1 -1
  21. package/dist/bridge-nv-le8ff.js +3 -0
  22. package/dist/cli.js +45 -45
  23. package/dist/{dev-ClCDRplP.js → dev-BB1oS-1o.js} +4 -4
  24. package/dist/dev-DAkNdyJ-.js +4 -0
  25. package/dist/{dev-app-cache-B3Wa5t6X.js → dev-app-cache-CScRa7c3.js} +9 -2
  26. package/dist/{doctor-CHnkbamq.js → doctor-qFe9sXxR.js} +1 -1
  27. package/dist/{executa-destructive-Du7RGJgn.js → executa-destructive-C06mgvfJ.js} +1 -1
  28. package/dist/{executa-dev-CSzM-Oha.js → executa-dev-ONm9di1H.js} +8 -8
  29. package/dist/executa-install-DKMwLq-V.js +7 -0
  30. package/dist/{executa-install-CM4x4doq.js → executa-install-n1oRAoYJ.js} +1 -1
  31. package/dist/{executa-publish-BKnsUoZq.js → executa-publish-BuakG1RK.js} +38 -11
  32. package/dist/{executa-publish-6awuH4Ma.js → executa-publish-CVlMaHIY.js} +3 -3
  33. package/dist/{executa-upload-binaries-FWM2yXfB.js → executa-upload-binaries-BVWs6MFF.js} +2 -2
  34. package/dist/{executa-upload-binaries-DwWQ18Dq.js → executa-upload-binaries-D0JWYOtK.js} +1 -1
  35. package/dist/{listing-meta-35VYXW5a.js → listing-meta-rIni8tjd.js} +1 -1
  36. package/dist/{manifest-B_DjigtQ.js → manifest-BCHiC184.js} +49 -3
  37. package/dist/{publish-Bg4TkKoX.js → publish-CIaosgo4.js} +13 -10
  38. package/dist/{server-Dr_htFv8.js → server-poDjwty-.js} +1 -1
  39. package/dist/{storage-aii8EyPC.js → storage-CZ4c4ibf.js} +1 -1
  40. package/dist/{working-orchestration-CKXkvXVC.js → working-orchestration-BRU7FV-b.js} +9 -5
  41. package/package.json +3 -3
  42. package/dist/apps-grants-baOFOxnO.js +0 -34
  43. package/dist/apps-publish-Ck-2BEu3.js +0 -272
  44. package/dist/apps-publish-CrpTz6WY.js +0 -17
  45. package/dist/apps-push-CNOI2ruX.js +0 -152
  46. package/dist/bridge-BP28T06H.js +0 -3
  47. package/dist/dev-C251jRh2.js +0 -4
  48. package/dist/executa-install-V5fSZRdO.js +0 -7
  49. /package/dist/{confirm-ChZAVrZe.js → confirm-DplLyBSG.js} +0 -0
  50. /package/dist/{dev-account-CfVdGa9j.js → dev-account-IrYL4u4F.js} +0 -0
  51. /package/dist/{executa-init-DKy7DMSD.js → executa-init-BM0HR-K7.js} +0 -0
  52. /package/dist/{executa-reads-BYKUADoL.js → executa-reads-BJpmB-B1.js} +0 -0
  53. /package/dist/{executa-register-CmqKsoAU.js → executa-register-CDKG3L5c.js} +0 -0
  54. /package/dist/{executa-trusted-publisher-BGqz6hMt.js → executa-trusted-publisher-n9IbAO5D.js} +0 -0
  55. /package/dist/{fixture-BF1Z0Rry.js → fixture-CizypXzX.js} +0 -0
  56. /package/dist/{host_upload-CW_2Fxg6.js → host_upload-BvzJZKAO.js} +0 -0
  57. /package/dist/{image-B4UrufYH.js → image-C61zRJC8.js} +0 -0
  58. /package/dist/{login-DbETuUxy.js → login-BleVDjXE.js} +0 -0
  59. /package/dist/{logout-BzIEf-HU.js → logout-BO4brBaY.js} +0 -0
  60. /package/dist/{runner-Dq3cluPM.js → runner-aq0n-pdr.js} +0 -0
  61. /package/dist/{sampling-BpJcd6BC.js → sampling-BQwF3O-4.js} +0 -0
  62. /package/dist/{token-TgBQumgy.js → token-DeAZLyVz.js} +0 -0
  63. /package/dist/{whoami-Bn38ns8r.js → whoami-rvVc_nQ9.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import "./credentials-BTv2IfUZ.js";
2
- import { setDeveloperHandle } from "./apps-DlVsVHQ5.js";
2
+ import { setDeveloperHandle } from "./apps-BRBufSyX.js";
3
3
  import { CliError } from "./client-sMzq2PWG.js";
4
4
  import { reportError, resolveClient } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
5
  import { bold, dim, green, red } from "kleur/colors";
@@ -1,5 +1,5 @@
1
1
  import { canonicalHost } from "./credentials-BTv2IfUZ.js";
2
- import { hostOf, mintAppSession, requireAccount, withCode } from "./dev-account-CfVdGa9j.js";
2
+ import { hostOf, mintAppSession, requireAccount, withCode } from "./dev-account-IrYL4u4F.js";
3
3
  import { resolve } from "node:path";
4
4
  import { existsSync, readFileSync } from "node:fs";
5
5
 
@@ -66,18 +66,6 @@ async function listVersions(client, appId) {
66
66
  const r = await client.request({ path: `/api/v1/developer/apps/${appId}/versions` });
67
67
  return Array.isArray(r.data) ? r.data : [];
68
68
  }
69
- async function createVersion(client, appId, body, contentHash) {
70
- const r = await client.request({
71
- method: "POST",
72
- path: `/api/v1/developer/apps/${appId}/versions`,
73
- query: contentHash ? { content_hash: contentHash } : void 0,
74
- body
75
- });
76
- return {
77
- version: r.data,
78
- idempotentHit: r.idempotentHit
79
- };
80
- }
81
69
  async function submitForReview(client, appId) {
82
70
  const r = await client.request({
83
71
  method: "POST",
@@ -133,6 +121,13 @@ async function getAppGrants(client, appId) {
133
121
  });
134
122
  return r.status === 404 ? null : r.data;
135
123
  }
124
+ async function getAppPermissions(client, appId) {
125
+ const r = await client.request({
126
+ path: `/api/v1/apps/${appId}/permissions`,
127
+ allowStatuses: [404]
128
+ });
129
+ return r.status === 404 ? null : r.data;
130
+ }
136
131
  /**
137
132
  * Set (or rename) the caller's developer handle — the per-developer
138
133
  * namespace for `@handle/slug` public app refs.
@@ -157,34 +152,6 @@ async function getBundle(client, appId, versionId) {
157
152
  });
158
153
  return r.status === 404 ? null : r.data;
159
154
  }
160
- async function initBundle(client, appId, versionId, body) {
161
- const r = await client.request({
162
- method: "POST",
163
- path: `/api/v1/developer/apps/${appId}/versions/${versionId}/bundle/init`,
164
- body
165
- });
166
- return r.data;
167
- }
168
- /** Upload one file via the same-origin proxy endpoint (multipart). */
169
- async function uploadBundleFile(client, appId, versionId, relativePath, blob) {
170
- await client.request({
171
- method: "POST",
172
- path: `/api/v1/developer/apps/${appId}/versions/${versionId}/bundle/file`,
173
- multipart: { fields: {
174
- relative_path: relativePath,
175
- file: blob
176
- } },
177
- allowStatuses: [201]
178
- });
179
- }
180
- async function finalizeBundle(client, appId, versionId, skipRemoteCheck = false) {
181
- const r = await client.request({
182
- method: "POST",
183
- path: `/api/v1/developer/apps/${appId}/versions/${versionId}/bundle/finalize`,
184
- body: { skip_remote_check: skipRemoteCheck }
185
- });
186
- return r.data;
187
- }
188
155
  /**
189
156
  * Upsert the single mutable working draft for an app. `ifMatch` sends an
190
157
  * `If-Match: <revision>` optimistic-lock header (stale → 409). Returns
@@ -263,4 +230,4 @@ async function finalizeWorkingBundle(client, appId, skipRemoteCheck = false) {
263
230
  }
264
231
 
265
232
  //#endregion
266
- export { archiveApp, createApp, createVersion, cutWorkingDraft, deleteApp, deleteWorkingDraft, finalizeBundle, finalizeWorkingBundle, findAppBySlug, getApp, getAppGrants, getBundle, getWorkingDraft, initBundle, initWorkingBundle, listMyApps, listVersions, patchApp, publishVersion, setDeveloperHandle, submitForReview, unarchiveApp, unpublishApp, uploadAppLogo, uploadAppScreenshot, uploadBundleFile, uploadWorkingBundleFile, upsertWorkingDraft };
233
+ export { archiveApp, createApp, cutWorkingDraft, deleteApp, deleteWorkingDraft, finalizeWorkingBundle, findAppBySlug, getApp, getAppGrants, getAppPermissions, getBundle, getWorkingDraft, initWorkingBundle, listMyApps, listVersions, patchApp, publishVersion, setDeveloperHandle, submitForReview, unarchiveApp, unpublishApp, uploadAppLogo, uploadAppScreenshot, uploadWorkingBundleFile, upsertWorkingDraft };
@@ -1,5 +1,5 @@
1
1
  import "./credentials-BTv2IfUZ.js";
2
- import { listMyApps } from "./apps-DlVsVHQ5.js";
2
+ import { listMyApps } from "./apps-BRBufSyX.js";
3
3
  import "./client-sMzq2PWG.js";
4
4
  import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
5
  import { bold, cyan, dim, green, magenta, red, yellow } from "kleur/colors";
@@ -30,6 +30,7 @@ async function runAppsList(opts) {
30
30
  name: a.name,
31
31
  status: a.status,
32
32
  is_dev: a.is_dev ?? false,
33
+ review_candidate_version: a.review_candidate_version ?? null,
33
34
  updated_at: a.updated_at ?? null
34
35
  }))
35
36
  }, null, 2));
@@ -42,7 +43,8 @@ async function runAppsList(opts) {
42
43
  }
43
44
  for (const a of apps) {
44
45
  const dev = a.is_dev ? " " + yellow("[dev]") : "";
45
- console.log(` ${statusTag(a.status)}${dev} ${bold(a.slug)} ${dim(`(id=${a.id})`)}`);
46
+ const inReview = a.review_candidate_version ? " " + yellow(`(v${a.review_candidate_version} in review)`) : "";
47
+ console.log(` ${statusTag(a.status)}${dev} ${bold(a.slug)} ${dim(`(id=${a.id})`)}${inReview}`);
46
48
  if (a.name && a.name !== a.slug) console.log(` ${dim(a.name)}`);
47
49
  }
48
50
  return 0;
@@ -0,0 +1,19 @@
1
+ import "./credentials-BTv2IfUZ.js";
2
+ import "./nexus-root-BlPwOusj.js";
3
+ import "./apps-BRBufSyX.js";
4
+ import "./client-sMzq2PWG.js";
5
+ import "./_lifecycle-shared-_9BzQ9Y2.js";
6
+ import "./executa-cache-BFoUtb4J.js";
7
+ import "./bundled-executas-BRyQkI9u.js";
8
+ import "./manifest-BCHiC184.js";
9
+ import "./executas-CvQY_w2U.js";
10
+ import "./executa-publish-BuakG1RK.js";
11
+ import "./binary-upload-DVhQ0uY0.js";
12
+ import "./executa-upload-binaries-D0JWYOtK.js";
13
+ import "./dev-BB1oS-1o.js";
14
+ import "./executa-install-n1oRAoYJ.js";
15
+ import "./app-cache-Cr3tKbux.js";
16
+ import "./working-orchestration-BRU7FV-b.js";
17
+ import { runAppsCut } from "./apps-cut-L7T8b5RS.js";
18
+
19
+ export { runAppsCut };
@@ -1,19 +1,12 @@
1
1
  import { canonicalHost } from "./credentials-BTv2IfUZ.js";
2
- import "./nexus-root-BlPwOusj.js";
3
- import { cutWorkingDraft } from "./apps-DlVsVHQ5.js";
2
+ import { cutWorkingDraft } from "./apps-BRBufSyX.js";
4
3
  import { CliError } from "./client-sMzq2PWG.js";
5
4
  import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
6
5
  import { readExecutaIdentity } from "./executa-cache-BFoUtb4J.js";
7
6
  import { readExecutasLock, writeExecutasLock } from "./bundled-executas-BRyQkI9u.js";
8
- import { loadAppManifest, loadExecutaManifest } from "./manifest-B_DjigtQ.js";
9
- import "./executas-CvQY_w2U.js";
10
- import "./executa-publish-BKnsUoZq.js";
11
- import "./binary-upload-DVhQ0uY0.js";
12
- import { uploadExecutaBinaries } from "./executa-upload-binaries-DwWQ18Dq.js";
13
- import "./dev-ClCDRplP.js";
14
- import "./executa-install-CM4x4doq.js";
15
- import "./app-cache-Cr3tKbux.js";
16
- import { resolveAppBySlugOrCache } from "./working-orchestration-CKXkvXVC.js";
7
+ import { loadAppManifest, loadExecutaManifest } from "./manifest-BCHiC184.js";
8
+ import { uploadExecutaBinaries } from "./executa-upload-binaries-D0JWYOtK.js";
9
+ import { resolveAppBySlugOrCache } from "./working-orchestration-BRU7FV-b.js";
17
10
  import { resolve } from "node:path";
18
11
  import { existsSync } from "node:fs";
19
12
  import { bold, cyan, dim, green, yellow } from "kleur/colors";
@@ -80,6 +73,7 @@ async function preUploadBundledBinaries(params) {
80
73
  }
81
74
  async function runAppsCut(opts) {
82
75
  return withErrorHandling(async () => {
76
+ const silent = opts.json === true || opts.quiet === true;
83
77
  const { client, host } = resolveClient({
84
78
  account: opts.account,
85
79
  fetchImpl: opts.fetchImpl
@@ -93,11 +87,11 @@ async function runAppsCut(opts) {
93
87
  host,
94
88
  cwd: resolve(opts.cwd ?? process.cwd()),
95
89
  dryRun: opts.dryRun === true,
96
- json: opts.json === true,
90
+ json: silent,
97
91
  fetchImpl: opts.fetchImpl
98
92
  });
99
93
  if (opts.dryRun) {
100
- if (!opts.json) console.log(yellow(`[dry-run] would cut version ${opts.version} for apps/${app.slug} (app_id=${app.id})`));
94
+ if (!silent) console.log(yellow(`[dry-run] would cut version ${opts.version} for apps/${app.slug} (app_id=${app.id})`));
101
95
  return 0;
102
96
  }
103
97
  let result;
@@ -131,18 +125,22 @@ async function runAppsCut(opts) {
131
125
  });
132
126
  }
133
127
  }
128
+ const captured = {
129
+ app_id: app.id,
130
+ slug: app.slug,
131
+ host,
132
+ version_id: result.version_id,
133
+ version: result.version,
134
+ frozen_executas: result.frozen_executas,
135
+ bundle: result.bundle,
136
+ status: app.status
137
+ };
138
+ opts.capture?.(captured);
134
139
  if (opts.json) {
135
- console.log(JSON.stringify({
136
- app_id: app.id,
137
- slug: app.slug,
138
- host,
139
- version_id: result.version_id,
140
- version: result.version,
141
- frozen_executas: result.frozen_executas,
142
- bundle: result.bundle
143
- }, null, 2));
140
+ if (!opts.quiet) console.log(JSON.stringify(captured, null, 2));
144
141
  return 0;
145
142
  }
143
+ if (opts.quiet) return 0;
146
144
  console.log(green(`✓ apps/${app.slug}: cut immutable version ${result.version} `) + dim(`(version_id=${result.version_id})`));
147
145
  for (const fr of result.frozen_executas) console.log(dim(` froze ${fr.tool_id} → executa_version=${fr.executa_version_id}`) + (fr.version ? dim(` (v${fr.version})`) : ""));
148
146
  if (result.bundle && typeof result.bundle === "object") {
@@ -1,8 +1,8 @@
1
1
  import "./credentials-BTv2IfUZ.js";
2
- import { archiveApp, deleteApp, findAppBySlug, unarchiveApp, unpublishApp } from "./apps-DlVsVHQ5.js";
2
+ import { archiveApp, deleteApp, findAppBySlug, unarchiveApp, unpublishApp } from "./apps-BRBufSyX.js";
3
3
  import { CliError } from "./client-sMzq2PWG.js";
4
4
  import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
- import { ensureDestructiveAllowed } from "./confirm-ChZAVrZe.js";
5
+ import { ensureDestructiveAllowed } from "./confirm-DplLyBSG.js";
6
6
  import { dim, green, yellow } from "kleur/colors";
7
7
 
8
8
  //#region src/commands/apps-destructive.ts
@@ -1,19 +1,19 @@
1
1
  import "./credentials-BTv2IfUZ.js";
2
2
  import "./nexus-root-BlPwOusj.js";
3
- import { deleteWorkingDraft, getWorkingDraft } from "./apps-DlVsVHQ5.js";
3
+ import { deleteWorkingDraft, getWorkingDraft } from "./apps-BRBufSyX.js";
4
4
  import "./client-sMzq2PWG.js";
5
5
  import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
6
6
  import "./executa-cache-BFoUtb4J.js";
7
7
  import "./bundled-executas-BRyQkI9u.js";
8
- import "./manifest-B_DjigtQ.js";
8
+ import "./manifest-BCHiC184.js";
9
9
  import "./executas-CvQY_w2U.js";
10
- import "./executa-publish-BKnsUoZq.js";
10
+ import "./executa-publish-BuakG1RK.js";
11
11
  import "./binary-upload-DVhQ0uY0.js";
12
- import "./executa-upload-binaries-DwWQ18Dq.js";
13
- import "./dev-ClCDRplP.js";
14
- import "./executa-install-CM4x4doq.js";
12
+ import "./executa-upload-binaries-D0JWYOtK.js";
13
+ import "./dev-BB1oS-1o.js";
14
+ import "./executa-install-n1oRAoYJ.js";
15
15
  import "./app-cache-Cr3tKbux.js";
16
- import { resolveAppBySlugOrCache } from "./working-orchestration-CKXkvXVC.js";
16
+ import { resolveAppBySlugOrCache } from "./working-orchestration-BRU7FV-b.js";
17
17
  import { dim, green, yellow } from "kleur/colors";
18
18
 
19
19
  //#region src/commands/apps-discard.ts
@@ -0,0 +1,70 @@
1
+ import "./credentials-BTv2IfUZ.js";
2
+ import { findAppBySlug, getAppGrants, getAppPermissions } from "./apps-BRBufSyX.js";
3
+ import { CliError } from "./client-sMzq2PWG.js";
4
+ import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
+ import { bold, cyan, dim, yellow } from "kleur/colors";
6
+
7
+ //#region src/commands/apps-grants.ts
8
+ /** Pick the `*_grant` sections off a bundled executa's custom_config. */
9
+ function executaGrantSections(ex) {
10
+ const cfg = ex.custom_config;
11
+ if (!cfg || typeof cfg !== "object") return {};
12
+ const out = {};
13
+ for (const [k, v] of Object.entries(cfg)) if (k.endsWith("_grant")) out[k] = v;
14
+ return out;
15
+ }
16
+ async function runAppsGrants(opts) {
17
+ return withErrorHandling(async () => {
18
+ const { client, host } = resolveClient({ account: opts.account });
19
+ const app = await findAppBySlug(client, opts.slug);
20
+ if (!app) throw new CliError(`no app with slug "${opts.slug}" on ${host}`, 5);
21
+ const perms = await getAppPermissions(client, app.id);
22
+ const grants = perms?.app ?? await getAppGrants(client, app.id);
23
+ if (opts.json) {
24
+ console.log(JSON.stringify({
25
+ host,
26
+ app_id: app.id,
27
+ slug: app.slug,
28
+ grants,
29
+ ...perms ? {
30
+ executa_grants: (perms.executas ?? []).map((ex) => ({
31
+ name: ex.name,
32
+ executa_id: ex.executa_id,
33
+ is_enabled: ex.is_enabled,
34
+ ...executaGrantSections(ex)
35
+ })),
36
+ satisfied: perms.satisfied ?? true,
37
+ missing: perms.missing ?? []
38
+ } : {}
39
+ }, null, 2));
40
+ return 0;
41
+ }
42
+ console.log(bold(cyan(`apps/${app.slug}`)) + " " + dim(`grants`));
43
+ if (!grants) {
44
+ console.log(dim(" (no grants endpoint data available)"));
45
+ return 0;
46
+ }
47
+ console.log(JSON.stringify(grants, null, 2));
48
+ if (perms) {
49
+ const executas = perms.executas ?? [];
50
+ if (executas.length > 0) {
51
+ console.log(bold(cyan("bundled executa grants")));
52
+ for (const ex of executas) {
53
+ console.log(` ${String(ex.name ?? ex.executa_id)}:`);
54
+ const sections = executaGrantSections(ex);
55
+ if (Object.keys(sections).length === 0) console.log(dim(" (no grants configured)"));
56
+ else for (const [k, v] of Object.entries(sections)) console.log(` ${k}: ${JSON.stringify(v)}`);
57
+ }
58
+ }
59
+ const missing = perms.missing ?? [];
60
+ if (missing.length > 0) {
61
+ console.log(yellow("! missing grants (enable in the Anna dashboard permissions modal):"));
62
+ for (const m of missing) console.log(yellow(` - ${m}`));
63
+ }
64
+ }
65
+ return 0;
66
+ });
67
+ }
68
+
69
+ //#endregion
70
+ export { runAppsGrants };
@@ -0,0 +1,92 @@
1
+ import { listVersions } from "./apps-BRBufSyX.js";
2
+ import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
3
+ import { loadAppManifest } from "./manifest-BCHiC184.js";
4
+ import { bumpVersion } from "./executa-publish-BuakG1RK.js";
5
+ import { runAppsCut } from "./apps-cut-L7T8b5RS.js";
6
+ import { runAppsPush } from "./apps-push-d1C0eePp.js";
7
+ import { resolve } from "node:path";
8
+ import { bold, cyan, dim, green, yellow } from "kleur/colors";
9
+
10
+ //#region src/commands/apps-publish.ts
11
+ async function runAppsPublish(opts) {
12
+ return withErrorHandling(async () => {
13
+ const cwd = resolve(opts.cwd ?? process.cwd());
14
+ const manifest = loadAppManifest(cwd, opts.manifest);
15
+ const version = opts.bump ? bumpVersion(manifest.version, opts.bump) : manifest.version;
16
+ if (!opts.json) console.log(dim("`apps publish` = `apps push` (stage) + `apps cut ") + cyan(version) + dim("` (snapshot + freeze executa deps)"));
17
+ let pushed;
18
+ const pushCode = await runAppsPush({
19
+ cwd: opts.cwd,
20
+ manifest: opts.manifest,
21
+ bump: opts.bump,
22
+ noWrite: opts.noWrite,
23
+ dryRun: opts.dryRun,
24
+ account: opts.account,
25
+ json: opts.json,
26
+ quiet: opts.json,
27
+ executaId: opts.executaId,
28
+ skipExecutaPublish: opts.skipExecutaPublish,
29
+ noBundledExecutas: opts.noBundledExecutas,
30
+ noBundle: opts.noBundle,
31
+ bundleDir: opts.bundleDir,
32
+ noInstallLocal: true,
33
+ profile: opts.profile,
34
+ capture: (r) => {
35
+ pushed = r;
36
+ }
37
+ });
38
+ if (pushCode !== 0) return pushCode;
39
+ if (opts.dryRun) {
40
+ if (!opts.json) console.log(yellow(`[dry-run] would cut immutable version ${version} (freeze executa deps)`));
41
+ return 0;
42
+ }
43
+ if (!pushed) return 1;
44
+ let idempotentHit = false;
45
+ let versionId = null;
46
+ if (pushed.unchanged && pushed.dirty_vs_latest_cut === false) {
47
+ const { client } = resolveClient({ account: opts.account });
48
+ const rows = await listVersions(client, pushed.app_id);
49
+ versionId = rows.find((v) => v.version === version)?.id ?? null;
50
+ idempotentHit = versionId !== null;
51
+ }
52
+ let cutRes;
53
+ if (!idempotentHit) {
54
+ const cutCode = await runAppsCut({
55
+ version,
56
+ cwd: opts.cwd,
57
+ account: opts.account,
58
+ json: opts.json,
59
+ quiet: opts.json,
60
+ capture: (r) => {
61
+ cutRes = r;
62
+ }
63
+ });
64
+ if (cutCode !== 0) return cutCode;
65
+ versionId = cutRes?.version_id ?? null;
66
+ }
67
+ if (opts.json) {
68
+ console.log(JSON.stringify({
69
+ app_id: pushed.app_id,
70
+ slug: pushed.slug,
71
+ host: pushed.host,
72
+ version,
73
+ version_id: versionId,
74
+ content_hash: pushed.content_hash,
75
+ idempotent_hit: idempotentHit,
76
+ first_publish: pushed.first_publish,
77
+ status: pushed.status,
78
+ frozen_executas: cutRes?.frozen_executas ?? [],
79
+ bundle: pushed.bundle
80
+ }, null, 2));
81
+ return 0;
82
+ }
83
+ if (idempotentHit) {
84
+ console.log(green(`✓ apps/${pushed.slug}: version ${version} already cut (content hash unchanged)`));
85
+ console.log(bold(cyan(`status: ${pushed.status}`)));
86
+ }
87
+ return 0;
88
+ });
89
+ }
90
+
91
+ //#endregion
92
+ export { runAppsPublish };
@@ -0,0 +1,22 @@
1
+ import "./credentials-BTv2IfUZ.js";
2
+ import "./nexus-root-BlPwOusj.js";
3
+ import "./apps-BRBufSyX.js";
4
+ import "./client-sMzq2PWG.js";
5
+ import "./_lifecycle-shared-_9BzQ9Y2.js";
6
+ import "./executa-cache-BFoUtb4J.js";
7
+ import "./bundled-executas-BRyQkI9u.js";
8
+ import "./manifest-BCHiC184.js";
9
+ import "./executas-CvQY_w2U.js";
10
+ import "./executa-publish-BuakG1RK.js";
11
+ import "./binary-upload-DVhQ0uY0.js";
12
+ import "./executa-upload-binaries-D0JWYOtK.js";
13
+ import "./dev-BB1oS-1o.js";
14
+ import "./executa-install-n1oRAoYJ.js";
15
+ import "./app-cache-Cr3tKbux.js";
16
+ import "./working-orchestration-BRU7FV-b.js";
17
+ import "./apps-cut-L7T8b5RS.js";
18
+ import "./listing-meta-rIni8tjd.js";
19
+ import "./apps-push-d1C0eePp.js";
20
+ import { runAppsPublish } from "./apps-publish-CGfzN7tI.js";
21
+
22
+ export { runAppsPublish };
@@ -0,0 +1,20 @@
1
+ import "./credentials-BTv2IfUZ.js";
2
+ import "./nexus-root-BlPwOusj.js";
3
+ import "./apps-BRBufSyX.js";
4
+ import "./client-sMzq2PWG.js";
5
+ import "./_lifecycle-shared-_9BzQ9Y2.js";
6
+ import "./executa-cache-BFoUtb4J.js";
7
+ import "./bundled-executas-BRyQkI9u.js";
8
+ import "./manifest-BCHiC184.js";
9
+ import "./executas-CvQY_w2U.js";
10
+ import "./executa-publish-BuakG1RK.js";
11
+ import "./binary-upload-DVhQ0uY0.js";
12
+ import "./executa-upload-binaries-D0JWYOtK.js";
13
+ import "./dev-BB1oS-1o.js";
14
+ import "./executa-install-n1oRAoYJ.js";
15
+ import "./app-cache-Cr3tKbux.js";
16
+ import "./working-orchestration-BRU7FV-b.js";
17
+ import "./listing-meta-rIni8tjd.js";
18
+ import { runAppsPush } from "./apps-push-d1C0eePp.js";
19
+
20
+ export { runAppsPush };