@anna-ai/cli 0.1.49 → 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 (62) hide show
  1. package/dist/{account-CPnwqXeh.js → account-C-IeQNNr.js} +1 -1
  2. package/dist/{agent-DAOr_aiE.js → agent-CX2VzG7e.js} +1 -1
  3. package/dist/{apps-HbfURK6y.js → apps-BRBufSyX.js} +1 -41
  4. package/dist/{apps-CzqMRLbS.js → apps-CTIiH6a_.js} +1 -1
  5. package/dist/apps-cut-35wivw1Z.js +19 -0
  6. package/dist/{apps-cut-BhTJwILv.js → apps-cut-L7T8b5RS.js} +20 -22
  7. package/dist/{apps-destructive-PlaU93EX.js → apps-destructive-DcG3T1Mx.js} +2 -2
  8. package/dist/{apps-discard-CFi-GzpU.js → apps-discard-CKA_m7Yw.js} +7 -7
  9. package/dist/{apps-grants-DqaX8UTy.js → apps-grants-B5MpWhSO.js} +1 -1
  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-Ca0r-kPy.js → apps-push-d1C0eePp.js} +144 -69
  14. package/dist/{apps-release-DGQv6DDl.js → apps-release-DxRHjEYJ.js} +2 -2
  15. package/dist/{apps-rename-slug-CCEU_7JJ.js → apps-rename-slug-4_5lsDwg.js} +2 -2
  16. package/dist/{apps-status-C4Cxc2DF.js → apps-status-hMrRz356.js} +1 -1
  17. package/dist/{apps-submit-review--hZFZRJ3.js → apps-submit-review-CxoKgexX.js} +1 -1
  18. package/dist/{apps-sync-meta-DnFwFNl5.js → apps-sync-meta-BwN8g6TO.js} +3 -3
  19. package/dist/{apps-versions-C7NzG5Dk.js → apps-versions-gfG_sBFv.js} +1 -1
  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-Bfv3WQC0.js → dev-BB1oS-1o.js} +4 -4
  24. package/dist/dev-DAkNdyJ-.js +4 -0
  25. package/dist/{doctor-CHnkbamq.js → doctor-qFe9sXxR.js} +1 -1
  26. package/dist/{executa-destructive-Du7RGJgn.js → executa-destructive-C06mgvfJ.js} +1 -1
  27. package/dist/{executa-dev-DYO87dzg.js → executa-dev-ONm9di1H.js} +8 -8
  28. package/dist/executa-install-DKMwLq-V.js +7 -0
  29. package/dist/{executa-install-DAposiBw.js → executa-install-n1oRAoYJ.js} +1 -1
  30. package/dist/{executa-publish-BKnsUoZq.js → executa-publish-BuakG1RK.js} +38 -11
  31. package/dist/{executa-publish-6awuH4Ma.js → executa-publish-CVlMaHIY.js} +3 -3
  32. package/dist/{executa-upload-binaries-FWM2yXfB.js → executa-upload-binaries-BVWs6MFF.js} +2 -2
  33. package/dist/{executa-upload-binaries-DwWQ18Dq.js → executa-upload-binaries-D0JWYOtK.js} +1 -1
  34. package/dist/{listing-meta-DgweMStT.js → listing-meta-rIni8tjd.js} +1 -1
  35. package/dist/{manifest-B_DjigtQ.js → manifest-BCHiC184.js} +49 -3
  36. package/dist/{publish-D5O5JKRb.js → publish-CIaosgo4.js} +13 -10
  37. package/dist/{server-Dr_htFv8.js → server-poDjwty-.js} +1 -1
  38. package/dist/{storage-aii8EyPC.js → storage-CZ4c4ibf.js} +1 -1
  39. package/dist/{working-orchestration-CpBJLs50.js → working-orchestration-BRU7FV-b.js} +9 -5
  40. package/package.json +3 -3
  41. package/dist/apps-publish-4IIbF2xr.js +0 -17
  42. package/dist/apps-publish-8N9x4VEM.js +0 -272
  43. package/dist/apps-push-CnSeLwdo.js +0 -152
  44. package/dist/bridge-BP28T06H.js +0 -3
  45. package/dist/dev-CnDh2_7r.js +0 -4
  46. package/dist/executa-install-LaAOSkY0.js +0 -7
  47. /package/dist/{confirm-ChZAVrZe.js → confirm-DplLyBSG.js} +0 -0
  48. /package/dist/{dev-account-CfVdGa9j.js → dev-account-IrYL4u4F.js} +0 -0
  49. /package/dist/{dev-app-cache-Dw2JESld.js → dev-app-cache-CScRa7c3.js} +0 -0
  50. /package/dist/{executa-init-DKy7DMSD.js → executa-init-BM0HR-K7.js} +0 -0
  51. /package/dist/{executa-reads-BYKUADoL.js → executa-reads-BJpmB-B1.js} +0 -0
  52. /package/dist/{executa-register-CmqKsoAU.js → executa-register-CDKG3L5c.js} +0 -0
  53. /package/dist/{executa-trusted-publisher-BGqz6hMt.js → executa-trusted-publisher-n9IbAO5D.js} +0 -0
  54. /package/dist/{fixture-BF1Z0Rry.js → fixture-CizypXzX.js} +0 -0
  55. /package/dist/{host_upload-CW_2Fxg6.js → host_upload-BvzJZKAO.js} +0 -0
  56. /package/dist/{image-B4UrufYH.js → image-C61zRJC8.js} +0 -0
  57. /package/dist/{login-DbETuUxy.js → login-BleVDjXE.js} +0 -0
  58. /package/dist/{logout-BzIEf-HU.js → logout-BO4brBaY.js} +0 -0
  59. /package/dist/{runner-Dq3cluPM.js → runner-aq0n-pdr.js} +0 -0
  60. /package/dist/{sampling-BpJcd6BC.js → sampling-BQwF3O-4.js} +0 -0
  61. /package/dist/{token-TgBQumgy.js → token-DeAZLyVz.js} +0 -0
  62. /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-HbfURK6y.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",
@@ -164,34 +152,6 @@ async function getBundle(client, appId, versionId) {
164
152
  });
165
153
  return r.status === 404 ? null : r.data;
166
154
  }
167
- async function initBundle(client, appId, versionId, body) {
168
- const r = await client.request({
169
- method: "POST",
170
- path: `/api/v1/developer/apps/${appId}/versions/${versionId}/bundle/init`,
171
- body
172
- });
173
- return r.data;
174
- }
175
- /** Upload one file via the same-origin proxy endpoint (multipart). */
176
- async function uploadBundleFile(client, appId, versionId, relativePath, blob) {
177
- await client.request({
178
- method: "POST",
179
- path: `/api/v1/developer/apps/${appId}/versions/${versionId}/bundle/file`,
180
- multipart: { fields: {
181
- relative_path: relativePath,
182
- file: blob
183
- } },
184
- allowStatuses: [201]
185
- });
186
- }
187
- async function finalizeBundle(client, appId, versionId, skipRemoteCheck = false) {
188
- const r = await client.request({
189
- method: "POST",
190
- path: `/api/v1/developer/apps/${appId}/versions/${versionId}/bundle/finalize`,
191
- body: { skip_remote_check: skipRemoteCheck }
192
- });
193
- return r.data;
194
- }
195
155
  /**
196
156
  * Upsert the single mutable working draft for an app. `ifMatch` sends an
197
157
  * `If-Match: <revision>` optimistic-lock header (stale → 409). Returns
@@ -270,4 +230,4 @@ async function finalizeWorkingBundle(client, appId, skipRemoteCheck = false) {
270
230
  }
271
231
 
272
232
  //#endregion
273
- export { archiveApp, createApp, createVersion, cutWorkingDraft, deleteApp, deleteWorkingDraft, finalizeBundle, finalizeWorkingBundle, findAppBySlug, getApp, getAppGrants, getAppPermissions, 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-HbfURK6y.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";
@@ -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-HbfURK6y.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-Bfv3WQC0.js";
14
- import "./executa-install-DAposiBw.js";
15
- import "./app-cache-Cr3tKbux.js";
16
- import { resolveAppBySlugOrCache } from "./working-orchestration-CpBJLs50.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-HbfURK6y.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-HbfURK6y.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-Bfv3WQC0.js";
14
- import "./executa-install-DAposiBw.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-CpBJLs50.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
@@ -1,5 +1,5 @@
1
1
  import "./credentials-BTv2IfUZ.js";
2
- import { findAppBySlug, getAppGrants, getAppPermissions } from "./apps-HbfURK6y.js";
2
+ import { findAppBySlug, getAppGrants, getAppPermissions } from "./apps-BRBufSyX.js";
3
3
  import { CliError } from "./client-sMzq2PWG.js";
4
4
  import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
5
  import { bold, cyan, dim, yellow } from "kleur/colors";
@@ -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 };
@@ -1,8 +1,13 @@
1
- import { finalizeBundle, finalizeWorkingBundle, getBundle, initBundle, initWorkingBundle, uploadBundleFile, uploadWorkingBundleFile } from "./apps-HbfURK6y.js";
1
+ import { finalizeWorkingBundle, getApp, getWorkingDraft, initWorkingBundle, uploadWorkingBundleFile, upsertWorkingDraft } from "./apps-BRBufSyX.js";
2
2
  import { CliError } from "./client-sMzq2PWG.js";
3
- import { canonicalize } from "./executa-publish-BKnsUoZq.js";
4
- import { join, relative, sep } from "node:path";
3
+ import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
4
+ import { loadAppManifest } from "./manifest-BCHiC184.js";
5
+ import { bumpVersion, bundleHash, canonicalize, manifestHash, rewriteVersion } from "./executa-publish-BuakG1RK.js";
6
+ import { installLocalBundledShims, resolveAppIdentity, resolveBundledExecutas } from "./working-orchestration-BRU7FV-b.js";
7
+ import { syncAppListingMeta } from "./listing-meta-rIni8tjd.js";
8
+ import { join, relative, resolve, sep } from "node:path";
5
9
  import { readFileSync, readdirSync, statSync } from "node:fs";
10
+ import { bold, cyan, dim, green, yellow } from "kleur/colors";
6
11
  import { createHash } from "node:crypto";
7
12
 
8
13
  //#region src/publish/app-bundle-upload.ts
@@ -84,71 +89,6 @@ function manifestFingerprint(files) {
84
89
  };
85
90
  return createHash("sha256").update(canonicalize(obj)).digest("hex");
86
91
  }
87
- /**
88
- * Upload + finalize the UI bundle for one app version. Returns
89
- * `{ status: "skipped" }` when the version's bundle is already finalized
90
- * with identical content.
91
- */
92
- async function uploadAppBundle(params) {
93
- const { client, appId, versionId, bundleDir, entryPath, bundleFormat = "static-spa", externalOrigins = [], log } = params;
94
- const files = collectFiles(bundleDir);
95
- if (files.length === 0) throw new CliError(`bundle directory is empty: ${bundleDir}`, 4);
96
- if (files.length > MAX_FILES) throw new CliError(`too many bundle files (${files.length} > ${MAX_FILES})`, 4);
97
- const totalBytes = files.reduce((s, f) => s + f.entry.byte_size, 0);
98
- if (totalBytes > MAX_TOTAL_BYTES) throw totalSizeError(totalBytes);
99
- const tooBig = files.find((f) => f.entry.byte_size > MAX_FILE_BYTES);
100
- if (tooBig) throw fileSizeError(tooBig.relativePath, tooBig.entry.byte_size);
101
- if (!files.some((f) => f.relativePath === entryPath)) throw new CliError(`manifest entry "${entryPath}" not found in bundle dir ${bundleDir}`, 4);
102
- const fingerprint = manifestFingerprint(files);
103
- const existing = await getBundle(client, appId, versionId);
104
- if (existing && existing.status === "bundle_ready") {
105
- if (existing.sha256_manifest === fingerprint) {
106
- log?.(` bundle unchanged (${files.length} files, sha ${fingerprint.slice(0, 12)}…) — skipped`);
107
- return {
108
- status: "skipped",
109
- reason: "unchanged",
110
- detail: existing
111
- };
112
- }
113
- throw new CliError("version already has a finalized bundle with different content; bump the app version (e.g. --bump patch) to upload a new bundle", 4);
114
- }
115
- log?.(` uploading UI bundle: ${files.length} files, ${(totalBytes / 1024).toFixed(1)} KB`);
116
- const fileMap = {};
117
- for (const f of files) fileMap[f.relativePath] = f.entry;
118
- const initResp = await initBundle(client, appId, versionId, {
119
- file_map: fileMap,
120
- total_size_bytes: totalBytes,
121
- file_count: files.length,
122
- bundle_format: bundleFormat,
123
- entry_path: entryPath,
124
- external_origins: externalOrigins
125
- });
126
- const proxyByPath = new Map(initResp.files.map((p) => [p.relative_path, p.proxy_upload_url]));
127
- const skipSet = new Set(initResp.files.filter((p) => p.skip_upload).map((p) => p.relative_path));
128
- const toUpload = files.filter((f) => !skipSet.has(f.relativePath));
129
- if (skipSet.size > 0) log?.(` ♻ ${skipSet.size}/${files.length} files unchanged on server — skipped (dedup)`);
130
- const queue = [...toUpload];
131
- const uploadOne = async () => {
132
- for (;;) {
133
- const f = queue.shift();
134
- if (!f) return;
135
- const proxyUrl = proxyByPath.get(f.relativePath);
136
- if (!proxyUrl) throw new CliError(`server did not return an upload URL for ${f.relativePath}`, 6);
137
- const ab = f.bytes.buffer.slice(f.bytes.byteOffset, f.bytes.byteOffset + f.bytes.byteLength);
138
- const blob = new Blob([ab], { type: f.entry.content_type });
139
- await uploadBundleFile(client, appId, versionId, f.relativePath, blob);
140
- }
141
- };
142
- await Promise.all(Array.from({ length: Math.min(UPLOAD_PARALLEL, toUpload.length) }, uploadOne));
143
- const detail = await finalizeBundle(client, appId, versionId, false);
144
- log?.(` ✓ bundle finalized (${detail.file_count} files, status=${detail.status})`);
145
- return {
146
- status: "uploaded",
147
- detail,
148
- fileCount: files.length,
149
- totalBytes
150
- };
151
- }
152
92
  /** True when `path` is an existing directory. */
153
93
  function isExistingDir(path) {
154
94
  try {
@@ -223,4 +163,139 @@ async function uploadWorkingBundle(params) {
223
163
  }
224
164
 
225
165
  //#endregion
226
- export { isExistingDir, uploadAppBundle, uploadWorkingBundle };
166
+ //#region src/commands/apps-push.ts
167
+ async function runAppsPush(opts) {
168
+ return withErrorHandling(async () => {
169
+ const cwd = resolve(opts.cwd ?? process.cwd());
170
+ const manifest = loadAppManifest(cwd, opts.manifest);
171
+ const silent = opts.json === true || opts.quiet === true;
172
+ const { client, host, source } = resolveClient({ account: opts.account });
173
+ if (!silent) console.log(dim(`using PAT from ${source} (host=${host})`));
174
+ if (opts.bump) {
175
+ const next = bumpVersion(manifest.version, opts.bump);
176
+ if (!silent) console.log(yellow(`↑ bumping manifest.version: ${manifest.version} → ${next}`));
177
+ if (!opts.noWrite && !opts.dryRun) rewriteVersion(manifest.metadataPath, manifest.metadataRaw, next);
178
+ manifest.version = next;
179
+ manifest.metadataRaw.version = next;
180
+ }
181
+ const { publishManifestRaw, resolved } = await resolveBundledExecutas({
182
+ manifest,
183
+ cwd,
184
+ host,
185
+ executaId: opts.executaId,
186
+ skipExecutaPublish: opts.skipExecutaPublish,
187
+ noBundledExecutas: opts.noBundledExecutas,
188
+ dryRun: opts.dryRun,
189
+ freeze: false,
190
+ lockSource: "working",
191
+ profile: opts.profile,
192
+ account: opts.account,
193
+ json: silent
194
+ });
195
+ let installedShims = [];
196
+ if (!opts.dryRun && !opts.noInstallLocal && Object.keys(resolved).length > 0) installedShims = await installLocalBundledShims({
197
+ manifest,
198
+ cwd,
199
+ resolved,
200
+ profile: opts.profile,
201
+ json: silent
202
+ });
203
+ const identity = await resolveAppIdentity({
204
+ client,
205
+ cwd,
206
+ host,
207
+ manifest,
208
+ dryRun: opts.dryRun,
209
+ json: silent
210
+ });
211
+ if (!identity) return 0;
212
+ const { appId, serverSlug, firstPublish } = identity;
213
+ const hashInput = {
214
+ version: manifest.version,
215
+ manifest: publishManifestRaw
216
+ };
217
+ const bundleEntry = publishManifestRaw.ui?.bundle?.entry;
218
+ const bundleDir = resolve(cwd, opts.bundleDir ?? "bundle");
219
+ const hasBundle = !!bundleEntry && !opts.noBundle && isExistingDir(bundleDir);
220
+ const hash = hasBundle ? bundleHash(hashInput, bundleDir) : manifestHash(hashInput);
221
+ if (opts.dryRun) {
222
+ if (!silent) console.log(yellow(`[dry-run] app_id=${appId} slug=${serverSlug}; would PUT /working (content_hash=${hash.slice(0, 12)}…)` + (hasBundle ? ` + stage working bundle from ${bundleDir}` : "")));
223
+ return 0;
224
+ }
225
+ let resp;
226
+ try {
227
+ resp = await upsertWorkingDraft(client, appId, {
228
+ manifest: publishManifestRaw,
229
+ changelog: manifest.changelog,
230
+ content_hash: hash
231
+ }, opts.ifMatch);
232
+ } catch (e) {
233
+ if (e instanceof CliError && e.status === 409) throw new CliError(`working draft was modified concurrently (If-Match=${opts.ifMatch} is stale); re-run \`apps push\` without --if-match for last-writer-wins, or fetch the current revision with \`apps status\``, 4);
234
+ throw e;
235
+ }
236
+ let bundleResult = null;
237
+ if (hasBundle) {
238
+ const uiBundle = publishManifestRaw.ui.bundle;
239
+ const skipStage = resp.unchanged && resp.bundle_status === "ready";
240
+ if (!skipStage) bundleResult = await uploadWorkingBundle({
241
+ client,
242
+ appId,
243
+ bundleDir,
244
+ entryPath: uiBundle.entry,
245
+ bundleFormat: uiBundle.format,
246
+ externalOrigins: Array.isArray(uiBundle.external_origins) ? uiBundle.external_origins : [],
247
+ log: silent ? void 0 : (m) => console.log(dim(m))
248
+ });
249
+ }
250
+ try {
251
+ await syncAppListingMeta(client, appId, manifest, { cwd });
252
+ } catch (err) {
253
+ if (!silent) console.log(yellow(`! listing metadata sync skipped: ${err.message}`));
254
+ }
255
+ const finalApp = await getApp(client, appId);
256
+ const draft = await getWorkingDraft(client, appId);
257
+ const captured = {
258
+ app_id: appId,
259
+ slug: serverSlug,
260
+ host,
261
+ version: manifest.version,
262
+ revision: resp.revision,
263
+ content_hash: resp.content_hash,
264
+ unchanged: resp.unchanged,
265
+ bundle_status: resp.bundle_status,
266
+ first_publish: firstPublish,
267
+ status: finalApp.status,
268
+ dirty_vs_latest_cut: draft?.dirty_vs_latest_cut ?? null,
269
+ installed_shims: installedShims,
270
+ bundle: bundleResult ? {
271
+ status: bundleResult.status,
272
+ file_count: bundleResult.fileCount,
273
+ total_size_bytes: bundleResult.totalBytes,
274
+ bundle_status: bundleResult.bundleStatus
275
+ } : null
276
+ };
277
+ opts.capture?.(captured);
278
+ if (opts.json) {
279
+ if (!opts.quiet) console.log(JSON.stringify(captured, null, 2));
280
+ return 0;
281
+ }
282
+ if (opts.quiet) return 0;
283
+ if (resp.unchanged) console.log(green(`✓ apps/${serverSlug}: working draft unchanged (rev ${resp.revision})`));
284
+ else console.log(green(`✓ apps/${serverSlug}: working draft updated (rev ${resp.revision})`));
285
+ if (firstPublish) console.log(dim(` first push — wrote .anna/app.json`));
286
+ if (bundleResult) if (bundleResult.status === "skipped") console.log(dim(` working bundle unchanged — skipped`));
287
+ else console.log(green(` ✓ working bundle: ${bundleResult.fileCount} files, ${(bundleResult.totalBytes / 1024).toFixed(1)} KB → ${bundleResult.bundleStatus}`));
288
+ console.log(bold(cyan(`status: ${finalApp.status}`)));
289
+ if (draft?.dirty_vs_latest_cut) console.log(dim(` (uncommitted changes vs latest cut version)`));
290
+ if (installedShims.length > 0) {
291
+ for (const s of installedShims) console.log(green(` ✓ installed local dev shim: `) + cyan(s.tool_id));
292
+ console.log(dim(`→ click `) + cyan(`Rediscover Local`) + dim(` in the Agent's Plugin Details to load `) + (installedShims.length === 1 ? dim("it") : dim("them")));
293
+ }
294
+ console.log(dim(`→ install & test the draft (reserved `) + cyan(`0.0.0-draft`) + dim(`) from the Developer Console`));
295
+ console.log(dim(`→ run `) + cyan(`anna-app apps cut ${manifest.version}`) + dim(` to snapshot an immutable version`));
296
+ return 0;
297
+ });
298
+ }
299
+
300
+ //#endregion
301
+ export { runAppsPush };
@@ -1,5 +1,5 @@
1
1
  import { canonicalHost } from "./credentials-BTv2IfUZ.js";
2
- import { findAppBySlug, getApp, getBundle, listVersions, publishVersion } from "./apps-HbfURK6y.js";
2
+ import { findAppBySlug, getApp, getBundle, listVersions, publishVersion } from "./apps-BRBufSyX.js";
3
3
  import { CliError } from "./client-sMzq2PWG.js";
4
4
  import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
5
  import { readAppIdentity } from "./app-cache-Cr3tKbux.js";
@@ -59,7 +59,7 @@ async function runAppsRelease(opts) {
59
59
  if (!target) {
60
60
  if (opts.allowCreate) {
61
61
  if (!opts.json) console.log(yellow(`version ${opts.version} not found remotely; running 'apps publish' first (--allow-create)…`));
62
- const { runAppsPublish } = await import("./apps-publish-4IIbF2xr.js");
62
+ const { runAppsPublish } = await import("./apps-publish-CUJILNOt.js");
63
63
  const code = await runAppsPublish({
64
64
  cwd: opts.cwd,
65
65
  account: opts.account,
@@ -1,8 +1,8 @@
1
1
  import "./credentials-BTv2IfUZ.js";
2
- import { findAppBySlug, patchApp } from "./apps-HbfURK6y.js";
2
+ import { findAppBySlug, patchApp } from "./apps-BRBufSyX.js";
3
3
  import { CliError } from "./client-sMzq2PWG.js";
4
4
  import { reportError, resolveClient } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
- import { loadAppManifest } from "./manifest-B_DjigtQ.js";
5
+ import { loadAppManifest } from "./manifest-BCHiC184.js";
6
6
  import { readAppIdentity, writeAppIdentity } from "./app-cache-Cr3tKbux.js";
7
7
  import { writeFileSync } from "node:fs";
8
8
  import { bold, dim, green, red, yellow } from "kleur/colors";
@@ -1,5 +1,5 @@
1
1
  import "./credentials-BTv2IfUZ.js";
2
- import { findAppBySlug, getApp, listVersions } from "./apps-HbfURK6y.js";
2
+ import { findAppBySlug, getApp, listVersions } from "./apps-BRBufSyX.js";
3
3
  import { CliError } from "./client-sMzq2PWG.js";
4
4
  import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
5
  import { bold, cyan, dim, green, red, yellow } from "kleur/colors";
@@ -1,5 +1,5 @@
1
1
  import { canonicalHost } from "./credentials-BTv2IfUZ.js";
2
- import { findAppBySlug, getApp, submitForReview } from "./apps-HbfURK6y.js";
2
+ import { findAppBySlug, getApp, submitForReview } from "./apps-BRBufSyX.js";
3
3
  import { CliError } from "./client-sMzq2PWG.js";
4
4
  import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
5
  import { readAppIdentity } from "./app-cache-Cr3tKbux.js";
@@ -1,10 +1,10 @@
1
1
  import { canonicalHost } from "./credentials-BTv2IfUZ.js";
2
- import { findAppBySlug, getApp } from "./apps-HbfURK6y.js";
2
+ import { findAppBySlug, getApp } from "./apps-BRBufSyX.js";
3
3
  import { CliError } from "./client-sMzq2PWG.js";
4
4
  import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
- import { loadAppManifest } from "./manifest-B_DjigtQ.js";
5
+ import { loadAppManifest } from "./manifest-BCHiC184.js";
6
6
  import { readAppIdentity } from "./app-cache-Cr3tKbux.js";
7
- import { syncAppListingMeta } from "./listing-meta-DgweMStT.js";
7
+ import { syncAppListingMeta } from "./listing-meta-rIni8tjd.js";
8
8
  import { resolve } from "node:path";
9
9
  import { bold, cyan, dim, green } from "kleur/colors";
10
10