@anna-ai/cli 0.1.49 → 0.1.52
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.
- package/dist/{account-CPnwqXeh.js → account-C-IeQNNr.js} +1 -1
- package/dist/{agent-DAOr_aiE.js → agent-CX2VzG7e.js} +1 -1
- package/dist/{apps-HbfURK6y.js → apps-BRBufSyX.js} +1 -41
- package/dist/{apps-CzqMRLbS.js → apps-CTIiH6a_.js} +1 -1
- package/dist/{apps-cut-BhTJwILv.js → apps-cut-BLtUBokD.js} +20 -22
- package/dist/apps-cut-eOVb1-0y.js +19 -0
- package/dist/{apps-destructive-PlaU93EX.js → apps-destructive-DcG3T1Mx.js} +2 -2
- package/dist/{apps-discard-CFi-GzpU.js → apps-discard-7ERq2pmS.js} +7 -7
- package/dist/{apps-grants-DqaX8UTy.js → apps-grants-DVoSb6-r.js} +7 -2
- package/dist/apps-publish-AdXryRYo.js +22 -0
- package/dist/apps-publish-BzaoSyFn.js +92 -0
- package/dist/{app-bundle-upload-Ca0r-kPy.js → apps-push-DZ1LHDJW.js} +144 -69
- package/dist/apps-push-WBfD0JyE.js +20 -0
- package/dist/{apps-release-DGQv6DDl.js → apps-release-DAV-DB_Q.js} +2 -2
- package/dist/{apps-rename-slug-CCEU_7JJ.js → apps-rename-slug-4_5lsDwg.js} +2 -2
- package/dist/{apps-status-C4Cxc2DF.js → apps-status-hMrRz356.js} +1 -1
- package/dist/{apps-submit-review--hZFZRJ3.js → apps-submit-review-CxoKgexX.js} +1 -1
- package/dist/{apps-sync-meta-DnFwFNl5.js → apps-sync-meta-BwN8g6TO.js} +3 -3
- package/dist/{apps-versions-C7NzG5Dk.js → apps-versions-gfG_sBFv.js} +1 -1
- package/dist/{bridge-sFHqOOat.js → bridge-Bo8eu3-d.js} +1 -1
- package/dist/bridge-nv-le8ff.js +3 -0
- package/dist/cli.js +180 -55
- package/dist/dev-CQIZHt7u.js +4 -0
- package/dist/{dev-Bfv3WQC0.js → dev-uagVfV9Y.js} +7 -5
- package/dist/{doctor-CHnkbamq.js → doctor-qFe9sXxR.js} +1 -1
- package/dist/{executa-destructive-Du7RGJgn.js → executa-destructive-C06mgvfJ.js} +1 -1
- package/dist/{executa-dev-DYO87dzg.js → executa-dev-BeYhrj-n.js} +8 -8
- package/dist/executa-install-Dnerah9u.js +7 -0
- package/dist/{executa-install-DAposiBw.js → executa-install-u0nXcyy7.js} +1 -1
- package/dist/{executa-publish-BKnsUoZq.js → executa-publish-BuakG1RK.js} +38 -11
- package/dist/{executa-publish-6awuH4Ma.js → executa-publish-CVlMaHIY.js} +3 -3
- package/dist/{executa-upload-binaries-FWM2yXfB.js → executa-upload-binaries-BVWs6MFF.js} +2 -2
- package/dist/{executa-upload-binaries-DwWQ18Dq.js → executa-upload-binaries-D0JWYOtK.js} +1 -1
- package/dist/{listing-meta-DgweMStT.js → listing-meta-rIni8tjd.js} +1 -1
- package/dist/{manifest-B_DjigtQ.js → manifest-BCHiC184.js} +49 -3
- package/dist/{publish-D5O5JKRb.js → publish-4C5_TgyZ.js} +13 -10
- package/dist/{server-Dr_htFv8.js → server-CBx61J7s.js} +91 -1
- package/dist/{storage-aii8EyPC.js → storage-CZ4c4ibf.js} +1 -1
- package/dist/{working-orchestration-CpBJLs50.js → working-orchestration-BPMFemcH.js} +9 -5
- package/package.json +5 -4
- package/templates/minimal/manifest.json +0 -1
- package/dist/apps-publish-4IIbF2xr.js +0 -17
- package/dist/apps-publish-8N9x4VEM.js +0 -272
- package/dist/apps-push-CnSeLwdo.js +0 -152
- package/dist/bridge-BP28T06H.js +0 -3
- package/dist/dev-CnDh2_7r.js +0 -4
- package/dist/executa-install-LaAOSkY0.js +0 -7
- /package/dist/{confirm-ChZAVrZe.js → confirm-DplLyBSG.js} +0 -0
- /package/dist/{dev-account-CfVdGa9j.js → dev-account-IrYL4u4F.js} +0 -0
- /package/dist/{dev-app-cache-Dw2JESld.js → dev-app-cache-CScRa7c3.js} +0 -0
- /package/dist/{executa-init-DKy7DMSD.js → executa-init-BM0HR-K7.js} +0 -0
- /package/dist/{executa-reads-BYKUADoL.js → executa-reads-BJpmB-B1.js} +0 -0
- /package/dist/{executa-register-CmqKsoAU.js → executa-register-CDKG3L5c.js} +0 -0
- /package/dist/{executa-trusted-publisher-BGqz6hMt.js → executa-trusted-publisher-n9IbAO5D.js} +0 -0
- /package/dist/{fixture-BF1Z0Rry.js → fixture-CizypXzX.js} +0 -0
- /package/dist/{host_upload-CW_2Fxg6.js → host_upload-BvzJZKAO.js} +0 -0
- /package/dist/{image-B4UrufYH.js → image-C61zRJC8.js} +0 -0
- /package/dist/{login-DbETuUxy.js → login-BleVDjXE.js} +0 -0
- /package/dist/{logout-BzIEf-HU.js → logout-BO4brBaY.js} +0 -0
- /package/dist/{runner-Dq3cluPM.js → runner-aq0n-pdr.js} +0 -0
- /package/dist/{sampling-BpJcd6BC.js → sampling-BQwF3O-4.js} +0 -0
- /package/dist/{token-TgBQumgy.js → token-DeAZLyVz.js} +0 -0
- /package/dist/{whoami-Bn38ns8r.js → whoami-rvVc_nQ9.js} +0 -0
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import { canonicalHost } from "./credentials-BTv2IfUZ.js";
|
|
2
|
-
import { createApp, createVersion, findAppBySlug, getApp } from "./apps-HbfURK6y.js";
|
|
3
|
-
import { CliError } from "./client-sMzq2PWG.js";
|
|
4
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
|
|
5
|
-
import { parseExecutaIdOverrides, readExecutasLock, substituteBundledRefs, validateBundledHandles, writeBundleToolIdSidecar, writeExecutasLock } from "./bundled-executas-BRyQkI9u.js";
|
|
6
|
-
import { loadAppManifest } from "./manifest-B_DjigtQ.js";
|
|
7
|
-
import { bumpVersion, bundleHash, manifestHash, rewriteVersion, runExecutaPublish } from "./executa-publish-BKnsUoZq.js";
|
|
8
|
-
import { appCacheMatches, readAppIdentity, writeAppIdentity } from "./app-cache-Cr3tKbux.js";
|
|
9
|
-
import { syncAppListingMeta } from "./listing-meta-DgweMStT.js";
|
|
10
|
-
import { isExistingDir, uploadAppBundle } from "./app-bundle-upload-Ca0r-kPy.js";
|
|
11
|
-
import { resolve } from "node:path";
|
|
12
|
-
import { bold, cyan, dim, green, yellow } from "kleur/colors";
|
|
13
|
-
|
|
14
|
-
//#region src/commands/apps-publish.ts
|
|
15
|
-
async function runAppsPublish(opts) {
|
|
16
|
-
return withErrorHandling(async () => {
|
|
17
|
-
const cwd = resolve(opts.cwd ?? process.cwd());
|
|
18
|
-
const manifest = loadAppManifest(cwd, opts.manifest);
|
|
19
|
-
const { client, host, source } = resolveClient({ account: opts.account });
|
|
20
|
-
if (!opts.json) {
|
|
21
|
-
console.log(dim(`using PAT from ${source} (host=${host})`));
|
|
22
|
-
console.log(yellow("⚠ `apps publish` mints an immutable version directly. The Option-C working-draft flow is now preferred:"));
|
|
23
|
-
console.log(dim(" anna-app apps push ") + dim("# upsert the mutable working draft (safe every commit)"));
|
|
24
|
-
console.log(dim(" anna-app apps cut <version> ") + dim("# snapshot + freeze executa deps"));
|
|
25
|
-
}
|
|
26
|
-
if (opts.bump) {
|
|
27
|
-
const next = bumpVersion(manifest.version, opts.bump);
|
|
28
|
-
if (!opts.json) console.log(yellow(`↑ bumping manifest.version: ${manifest.version} → ${next}`));
|
|
29
|
-
if (!opts.noWrite && !opts.dryRun) rewriteVersion(manifest.metadataPath, manifest.metadataRaw, next);
|
|
30
|
-
manifest.version = next;
|
|
31
|
-
manifest.metadataRaw.version = next;
|
|
32
|
-
if (manifest.metadataRaw !== manifest.raw && "version" in manifest.raw) manifest.raw.version = next;
|
|
33
|
-
}
|
|
34
|
-
const overrides = parseExecutaIdOverrides(opts.executaId);
|
|
35
|
-
const bundledActive = !opts.noBundledExecutas && (manifest.bundledExecutas.length > 0 || overrides.length > 0);
|
|
36
|
-
let publishManifestRaw = manifest.raw;
|
|
37
|
-
if (bundledActive) {
|
|
38
|
-
const { referenced } = validateBundledHandles(manifest.raw, manifest.bundledExecutas, overrides);
|
|
39
|
-
const overrideMap = new Map(overrides.map((o) => [o.handle, o.toolId]));
|
|
40
|
-
const lock = readExecutasLock(cwd, host);
|
|
41
|
-
const resolved = {};
|
|
42
|
-
const lockEntries = {};
|
|
43
|
-
for (const decl of manifest.bundledExecutas) {
|
|
44
|
-
if (overrideMap.has(decl.handle)) {
|
|
45
|
-
const id = overrideMap.get(decl.handle);
|
|
46
|
-
resolved[decl.handle] = id;
|
|
47
|
-
lockEntries[decl.handle] = {
|
|
48
|
-
tool_id: id,
|
|
49
|
-
path: decl.path,
|
|
50
|
-
source: "override"
|
|
51
|
-
};
|
|
52
|
-
if (!opts.json) console.log(dim(` bundled:${decl.handle} → ${id} (override)`));
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
if (opts.skipExecutaPublish) {
|
|
56
|
-
const cachedId = lock?.executas[decl.handle]?.tool_id;
|
|
57
|
-
if (!cachedId) throw new CliError(`--skip-executa-publish set but no cached tool_id for "${decl.handle}" in .anna/executas.lock.json (run without --skip-executa-publish first, or pass --executa-id ${decl.handle}=<tool-id>)`, 4);
|
|
58
|
-
resolved[decl.handle] = cachedId;
|
|
59
|
-
lockEntries[decl.handle] = {
|
|
60
|
-
tool_id: cachedId,
|
|
61
|
-
path: decl.path,
|
|
62
|
-
source: "cache"
|
|
63
|
-
};
|
|
64
|
-
if (!opts.json) console.log(dim(` bundled:${decl.handle} → ${cachedId} (cache)`));
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
const execCwd = resolve(cwd, decl.path);
|
|
68
|
-
if (opts.dryRun) {
|
|
69
|
-
if (!opts.json) console.log(yellow(` [dry-run] would publish bundled executa "${decl.handle}" from ${decl.path}`));
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
if (!opts.json) console.log(dim(` publishing bundled executa "${decl.handle}" (${decl.path})…`));
|
|
73
|
-
let captured;
|
|
74
|
-
const code = await runExecutaPublish({
|
|
75
|
-
cwd: execCwd,
|
|
76
|
-
account: opts.account,
|
|
77
|
-
quiet: true,
|
|
78
|
-
profile: opts.profile,
|
|
79
|
-
capture: (r) => {
|
|
80
|
-
captured = r;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
if (code !== 0 || !captured) throw new CliError(`failed to publish bundled executa "${decl.handle}" (${decl.path})`, code === 0 ? 4 : code);
|
|
84
|
-
resolved[decl.handle] = captured.tool_id;
|
|
85
|
-
lockEntries[decl.handle] = {
|
|
86
|
-
tool_id: captured.tool_id,
|
|
87
|
-
path: decl.path,
|
|
88
|
-
source: "published"
|
|
89
|
-
};
|
|
90
|
-
if (!opts.json) console.log(green(` ✓ bundled:${decl.handle} → ${captured.tool_id}`) + dim(` (v${captured.version}${captured.idempotent_hit ? ", unchanged" : ""})`));
|
|
91
|
-
}
|
|
92
|
-
for (const o of overrides) if (!(o.handle in resolved)) {
|
|
93
|
-
resolved[o.handle] = o.toolId;
|
|
94
|
-
lockEntries[o.handle] = {
|
|
95
|
-
tool_id: o.toolId,
|
|
96
|
-
source: "override"
|
|
97
|
-
};
|
|
98
|
-
if (!opts.json) console.log(dim(` bundled:${o.handle} → ${o.toolId} (override)`));
|
|
99
|
-
}
|
|
100
|
-
const missing = [...referenced].filter((h) => !(h in resolved));
|
|
101
|
-
if (missing.length > 0 && !opts.dryRun) throw new CliError(`could not resolve bundled handle(s): ${missing.sort().join(", ")}`, 4);
|
|
102
|
-
if (!opts.dryRun) {
|
|
103
|
-
const merged = {
|
|
104
|
-
$schema: "anna-executas-lock/v1",
|
|
105
|
-
host: canonicalHost(host),
|
|
106
|
-
executas: {
|
|
107
|
-
...lock?.executas ?? {},
|
|
108
|
-
...lockEntries
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
writeExecutasLock(cwd, merged);
|
|
112
|
-
publishManifestRaw = substituteBundledRefs(manifest.raw, resolved);
|
|
113
|
-
const bundleEntry = manifest.raw.ui?.bundle?.entry;
|
|
114
|
-
if (bundleEntry) {
|
|
115
|
-
const bundleDir$1 = resolve(cwd, "bundle");
|
|
116
|
-
if (Object.keys(resolved).length > 0) {
|
|
117
|
-
const sidecar = writeBundleToolIdSidecar(bundleDir$1, resolved);
|
|
118
|
-
if (!opts.json) console.log(dim(` wrote ${sidecar.replace(cwd + "/", "")}`));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
let cached = readAppIdentity(cwd);
|
|
124
|
-
if (cached && cached.host !== canonicalHost(host)) cached = null;
|
|
125
|
-
let appId;
|
|
126
|
-
let serverSlug;
|
|
127
|
-
let firstPublish = false;
|
|
128
|
-
let appIdFromCache = false;
|
|
129
|
-
if (cached && appCacheMatches(cached, host, manifest.slug)) {
|
|
130
|
-
appId = cached.app_id;
|
|
131
|
-
serverSlug = cached.slug;
|
|
132
|
-
appIdFromCache = true;
|
|
133
|
-
} else {
|
|
134
|
-
const found = await findAppBySlug(client, manifest.slug);
|
|
135
|
-
if (found) {
|
|
136
|
-
appId = found.id;
|
|
137
|
-
serverSlug = found.slug;
|
|
138
|
-
} else {
|
|
139
|
-
if (opts.dryRun) {
|
|
140
|
-
if (!opts.json) console.log(yellow(`[dry-run] would create AnnaApp slug=${manifest.slug}, then upload version ${manifest.version}`));
|
|
141
|
-
return 0;
|
|
142
|
-
}
|
|
143
|
-
const created = await createApp(client, {
|
|
144
|
-
slug: manifest.slug,
|
|
145
|
-
name: manifest.name,
|
|
146
|
-
category: manifest.category,
|
|
147
|
-
tagline: manifest.tagline,
|
|
148
|
-
description: manifest.description
|
|
149
|
-
});
|
|
150
|
-
appId = created.id;
|
|
151
|
-
serverSlug = created.slug;
|
|
152
|
-
firstPublish = true;
|
|
153
|
-
}
|
|
154
|
-
writeAppIdentity(cwd, {
|
|
155
|
-
$schema: "anna-app-identity/v1",
|
|
156
|
-
host: canonicalHost(host),
|
|
157
|
-
app_id: appId,
|
|
158
|
-
slug: serverSlug,
|
|
159
|
-
first_published_at: cached?.first_published_at ?? new Date().toISOString()
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
if (opts.dryRun) {
|
|
163
|
-
if (!opts.json) {
|
|
164
|
-
console.log(yellow(`[dry-run] resolved app_id=${appId} slug=${serverSlug}; would POST version ${manifest.version}`));
|
|
165
|
-
const uiEntry = publishManifestRaw.ui?.bundle?.entry;
|
|
166
|
-
const dryBundleDir = resolve(cwd, opts.bundleDir ?? "bundle");
|
|
167
|
-
if (uiEntry && !opts.noBundle && isExistingDir(dryBundleDir)) console.log(yellow(`[dry-run] would upload UI bundle from ${dryBundleDir} (entry=${uiEntry})`));
|
|
168
|
-
}
|
|
169
|
-
return 0;
|
|
170
|
-
}
|
|
171
|
-
const hashInput = {
|
|
172
|
-
version: manifest.version,
|
|
173
|
-
manifest: publishManifestRaw
|
|
174
|
-
};
|
|
175
|
-
const hashBundleEntry = publishManifestRaw.ui?.bundle?.entry;
|
|
176
|
-
const hashBundleDir = resolve(cwd, opts.bundleDir ?? "bundle");
|
|
177
|
-
const hash = hashBundleEntry && !opts.noBundle && isExistingDir(hashBundleDir) ? bundleHash(hashInput, hashBundleDir) : manifestHash(hashInput);
|
|
178
|
-
let verResp;
|
|
179
|
-
try {
|
|
180
|
-
verResp = await createVersion(client, appId, {
|
|
181
|
-
version: manifest.version,
|
|
182
|
-
changelog: manifest.changelog,
|
|
183
|
-
manifest: publishManifestRaw
|
|
184
|
-
}, hash);
|
|
185
|
-
} catch (e) {
|
|
186
|
-
if (appIdFromCache && e instanceof CliError && e.status === 404) {
|
|
187
|
-
if (!opts.json) console.log(yellow(`\u26a0 cached app_id=${appId} not found on server (deleted?); re-resolving identity and retrying\u2026`));
|
|
188
|
-
const found = await findAppBySlug(client, manifest.slug);
|
|
189
|
-
if (found) {
|
|
190
|
-
appId = found.id;
|
|
191
|
-
serverSlug = found.slug;
|
|
192
|
-
} else {
|
|
193
|
-
const created = await createApp(client, {
|
|
194
|
-
slug: manifest.slug,
|
|
195
|
-
name: manifest.name,
|
|
196
|
-
category: manifest.category,
|
|
197
|
-
tagline: manifest.tagline,
|
|
198
|
-
description: manifest.description
|
|
199
|
-
});
|
|
200
|
-
appId = created.id;
|
|
201
|
-
serverSlug = created.slug;
|
|
202
|
-
firstPublish = true;
|
|
203
|
-
}
|
|
204
|
-
writeAppIdentity(cwd, {
|
|
205
|
-
$schema: "anna-app-identity/v1",
|
|
206
|
-
host: canonicalHost(host),
|
|
207
|
-
app_id: appId,
|
|
208
|
-
slug: serverSlug,
|
|
209
|
-
first_published_at: cached?.first_published_at ?? new Date().toISOString()
|
|
210
|
-
});
|
|
211
|
-
verResp = await createVersion(client, appId, {
|
|
212
|
-
version: manifest.version,
|
|
213
|
-
changelog: manifest.changelog,
|
|
214
|
-
manifest: publishManifestRaw
|
|
215
|
-
}, hash);
|
|
216
|
-
} else throw e;
|
|
217
|
-
}
|
|
218
|
-
let bundleResult = null;
|
|
219
|
-
const uiBundle = publishManifestRaw.ui?.bundle;
|
|
220
|
-
const bundleDir = resolve(cwd, opts.bundleDir ?? "bundle");
|
|
221
|
-
if (uiBundle?.entry && !opts.noBundle) if (!isExistingDir(bundleDir)) {
|
|
222
|
-
if (!opts.json) console.log(yellow(`⚠ manifest declares ui.bundle.entry="${uiBundle.entry}" but bundle dir not found (${bundleDir}); skipping UI bundle upload`));
|
|
223
|
-
} else bundleResult = await uploadAppBundle({
|
|
224
|
-
client,
|
|
225
|
-
appId,
|
|
226
|
-
versionId: verResp.version.id,
|
|
227
|
-
bundleDir,
|
|
228
|
-
entryPath: uiBundle.entry,
|
|
229
|
-
bundleFormat: uiBundle.format,
|
|
230
|
-
externalOrigins: Array.isArray(uiBundle.external_origins) ? uiBundle.external_origins : [],
|
|
231
|
-
log: opts.json ? void 0 : (m) => console.log(dim(m))
|
|
232
|
-
});
|
|
233
|
-
try {
|
|
234
|
-
await syncAppListingMeta(client, appId, manifest, { cwd });
|
|
235
|
-
} catch (err) {
|
|
236
|
-
if (!opts.json) console.log(yellow(`! listing metadata sync skipped: ${err.message}`));
|
|
237
|
-
}
|
|
238
|
-
const finalApp = await getApp(client, appId);
|
|
239
|
-
if (opts.json) {
|
|
240
|
-
console.log(JSON.stringify({
|
|
241
|
-
app_id: appId,
|
|
242
|
-
slug: serverSlug,
|
|
243
|
-
host,
|
|
244
|
-
version: verResp.version.version,
|
|
245
|
-
version_id: verResp.version.id,
|
|
246
|
-
content_hash: hash,
|
|
247
|
-
idempotent_hit: verResp.idempotentHit,
|
|
248
|
-
first_publish: firstPublish,
|
|
249
|
-
status: finalApp.status,
|
|
250
|
-
bundle: bundleResult ? {
|
|
251
|
-
status: bundleResult.status,
|
|
252
|
-
bundle_status: bundleResult.detail.status,
|
|
253
|
-
file_count: bundleResult.detail.file_count,
|
|
254
|
-
total_size_bytes: bundleResult.detail.total_size_bytes,
|
|
255
|
-
sha256_manifest: bundleResult.detail.sha256_manifest
|
|
256
|
-
} : null
|
|
257
|
-
}, null, 2));
|
|
258
|
-
return 0;
|
|
259
|
-
}
|
|
260
|
-
if (verResp.idempotentHit) console.log(green(`✓ apps/${serverSlug}: version ${manifest.version} already live (content hash unchanged)`));
|
|
261
|
-
else console.log(green(`✓ apps/${serverSlug}: version ${manifest.version} published (id=${verResp.version.id})`));
|
|
262
|
-
if (firstPublish) console.log(dim(` first publish — wrote .anna/app.json`));
|
|
263
|
-
if (bundleResult) if (bundleResult.status === "skipped") console.log(dim(` UI bundle unchanged — skipped`));
|
|
264
|
-
else console.log(green(` ✓ UI bundle: ${bundleResult.fileCount} files, ${(bundleResult.totalBytes / 1024).toFixed(1)} KB → ${bundleResult.detail.status}`));
|
|
265
|
-
console.log(bold(cyan(`status: ${finalApp.status}`)));
|
|
266
|
-
if (!verResp.idempotentHit) console.log(dim(`→ run `) + cyan(`anna-app apps release ${manifest.version}`) + dim(` to freeze & publish this version`));
|
|
267
|
-
return 0;
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
//#endregion
|
|
272
|
-
export { runAppsPublish };
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import "./credentials-BTv2IfUZ.js";
|
|
2
|
-
import "./nexus-root-BlPwOusj.js";
|
|
3
|
-
import { getApp, getWorkingDraft, upsertWorkingDraft } from "./apps-HbfURK6y.js";
|
|
4
|
-
import { CliError } from "./client-sMzq2PWG.js";
|
|
5
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
|
|
6
|
-
import "./executa-cache-BFoUtb4J.js";
|
|
7
|
-
import "./bundled-executas-BRyQkI9u.js";
|
|
8
|
-
import { loadAppManifest } from "./manifest-B_DjigtQ.js";
|
|
9
|
-
import "./executas-CvQY_w2U.js";
|
|
10
|
-
import { bumpVersion, bundleHash, manifestHash, rewriteVersion } from "./executa-publish-BKnsUoZq.js";
|
|
11
|
-
import "./binary-upload-DVhQ0uY0.js";
|
|
12
|
-
import "./executa-upload-binaries-DwWQ18Dq.js";
|
|
13
|
-
import "./dev-Bfv3WQC0.js";
|
|
14
|
-
import "./executa-install-DAposiBw.js";
|
|
15
|
-
import "./app-cache-Cr3tKbux.js";
|
|
16
|
-
import { installLocalBundledShims, resolveAppIdentity, resolveBundledExecutas } from "./working-orchestration-CpBJLs50.js";
|
|
17
|
-
import { syncAppListingMeta } from "./listing-meta-DgweMStT.js";
|
|
18
|
-
import { isExistingDir, uploadWorkingBundle } from "./app-bundle-upload-Ca0r-kPy.js";
|
|
19
|
-
import { resolve } from "node:path";
|
|
20
|
-
import { bold, cyan, dim, green, yellow } from "kleur/colors";
|
|
21
|
-
|
|
22
|
-
//#region src/commands/apps-push.ts
|
|
23
|
-
async function runAppsPush(opts) {
|
|
24
|
-
return withErrorHandling(async () => {
|
|
25
|
-
const cwd = resolve(opts.cwd ?? process.cwd());
|
|
26
|
-
const manifest = loadAppManifest(cwd, opts.manifest);
|
|
27
|
-
const { client, host, source } = resolveClient({ account: opts.account });
|
|
28
|
-
if (!opts.json) console.log(dim(`using PAT from ${source} (host=${host})`));
|
|
29
|
-
if (opts.bump) {
|
|
30
|
-
const next = bumpVersion(manifest.version, opts.bump);
|
|
31
|
-
if (!opts.json) console.log(yellow(`↑ bumping manifest.version: ${manifest.version} → ${next}`));
|
|
32
|
-
if (!opts.noWrite && !opts.dryRun) rewriteVersion(manifest.metadataPath, manifest.metadataRaw, next);
|
|
33
|
-
manifest.version = next;
|
|
34
|
-
manifest.metadataRaw.version = next;
|
|
35
|
-
}
|
|
36
|
-
const { publishManifestRaw, resolved } = await resolveBundledExecutas({
|
|
37
|
-
manifest,
|
|
38
|
-
cwd,
|
|
39
|
-
host,
|
|
40
|
-
executaId: opts.executaId,
|
|
41
|
-
skipExecutaPublish: opts.skipExecutaPublish,
|
|
42
|
-
noBundledExecutas: opts.noBundledExecutas,
|
|
43
|
-
dryRun: opts.dryRun,
|
|
44
|
-
freeze: false,
|
|
45
|
-
lockSource: "working",
|
|
46
|
-
profile: opts.profile,
|
|
47
|
-
account: opts.account,
|
|
48
|
-
json: opts.json
|
|
49
|
-
});
|
|
50
|
-
let installedShims = [];
|
|
51
|
-
if (!opts.dryRun && !opts.noInstallLocal && Object.keys(resolved).length > 0) installedShims = await installLocalBundledShims({
|
|
52
|
-
manifest,
|
|
53
|
-
cwd,
|
|
54
|
-
resolved,
|
|
55
|
-
profile: opts.profile,
|
|
56
|
-
json: opts.json
|
|
57
|
-
});
|
|
58
|
-
const identity = await resolveAppIdentity({
|
|
59
|
-
client,
|
|
60
|
-
cwd,
|
|
61
|
-
host,
|
|
62
|
-
manifest,
|
|
63
|
-
dryRun: opts.dryRun,
|
|
64
|
-
json: opts.json
|
|
65
|
-
});
|
|
66
|
-
if (!identity) return 0;
|
|
67
|
-
const { appId, serverSlug, firstPublish } = identity;
|
|
68
|
-
const hashInput = {
|
|
69
|
-
version: manifest.version,
|
|
70
|
-
manifest: publishManifestRaw
|
|
71
|
-
};
|
|
72
|
-
const bundleEntry = publishManifestRaw.ui?.bundle?.entry;
|
|
73
|
-
const bundleDir = resolve(cwd, opts.bundleDir ?? "bundle");
|
|
74
|
-
const hasBundle = !!bundleEntry && !opts.noBundle && isExistingDir(bundleDir);
|
|
75
|
-
const hash = hasBundle ? bundleHash(hashInput, bundleDir) : manifestHash(hashInput);
|
|
76
|
-
if (opts.dryRun) {
|
|
77
|
-
if (!opts.json) 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}` : "")));
|
|
78
|
-
return 0;
|
|
79
|
-
}
|
|
80
|
-
let resp;
|
|
81
|
-
try {
|
|
82
|
-
resp = await upsertWorkingDraft(client, appId, {
|
|
83
|
-
manifest: publishManifestRaw,
|
|
84
|
-
changelog: manifest.changelog,
|
|
85
|
-
content_hash: hash
|
|
86
|
-
}, opts.ifMatch);
|
|
87
|
-
} catch (e) {
|
|
88
|
-
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);
|
|
89
|
-
throw e;
|
|
90
|
-
}
|
|
91
|
-
let bundleResult = null;
|
|
92
|
-
if (hasBundle) {
|
|
93
|
-
const uiBundle = publishManifestRaw.ui.bundle;
|
|
94
|
-
const skipStage = resp.unchanged && resp.bundle_status === "ready";
|
|
95
|
-
if (!skipStage) bundleResult = await uploadWorkingBundle({
|
|
96
|
-
client,
|
|
97
|
-
appId,
|
|
98
|
-
bundleDir,
|
|
99
|
-
entryPath: uiBundle.entry,
|
|
100
|
-
bundleFormat: uiBundle.format,
|
|
101
|
-
externalOrigins: Array.isArray(uiBundle.external_origins) ? uiBundle.external_origins : [],
|
|
102
|
-
log: opts.json ? void 0 : (m) => console.log(dim(m))
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
await syncAppListingMeta(client, appId, manifest, { cwd });
|
|
107
|
-
} catch (err) {
|
|
108
|
-
if (!opts.json) console.log(yellow(`! listing metadata sync skipped: ${err.message}`));
|
|
109
|
-
}
|
|
110
|
-
const finalApp = await getApp(client, appId);
|
|
111
|
-
const draft = await getWorkingDraft(client, appId);
|
|
112
|
-
if (opts.json) {
|
|
113
|
-
console.log(JSON.stringify({
|
|
114
|
-
app_id: appId,
|
|
115
|
-
slug: serverSlug,
|
|
116
|
-
host,
|
|
117
|
-
revision: resp.revision,
|
|
118
|
-
content_hash: resp.content_hash,
|
|
119
|
-
unchanged: resp.unchanged,
|
|
120
|
-
bundle_status: resp.bundle_status,
|
|
121
|
-
first_publish: firstPublish,
|
|
122
|
-
status: finalApp.status,
|
|
123
|
-
dirty_vs_latest_cut: draft?.dirty_vs_latest_cut ?? null,
|
|
124
|
-
installed_shims: installedShims,
|
|
125
|
-
bundle: bundleResult ? {
|
|
126
|
-
status: bundleResult.status,
|
|
127
|
-
file_count: bundleResult.fileCount,
|
|
128
|
-
total_size_bytes: bundleResult.totalBytes,
|
|
129
|
-
bundle_status: bundleResult.bundleStatus
|
|
130
|
-
} : null
|
|
131
|
-
}, null, 2));
|
|
132
|
-
return 0;
|
|
133
|
-
}
|
|
134
|
-
if (resp.unchanged) console.log(green(`✓ apps/${serverSlug}: working draft unchanged (rev ${resp.revision})`));
|
|
135
|
-
else console.log(green(`✓ apps/${serverSlug}: working draft updated (rev ${resp.revision})`));
|
|
136
|
-
if (firstPublish) console.log(dim(` first push — wrote .anna/app.json`));
|
|
137
|
-
if (bundleResult) if (bundleResult.status === "skipped") console.log(dim(` working bundle unchanged — skipped`));
|
|
138
|
-
else console.log(green(` ✓ working bundle: ${bundleResult.fileCount} files, ${(bundleResult.totalBytes / 1024).toFixed(1)} KB → ${bundleResult.bundleStatus}`));
|
|
139
|
-
console.log(bold(cyan(`status: ${finalApp.status}`)));
|
|
140
|
-
if (draft?.dirty_vs_latest_cut) console.log(dim(` (uncommitted changes vs latest cut version)`));
|
|
141
|
-
if (installedShims.length > 0) {
|
|
142
|
-
for (const s of installedShims) console.log(green(` ✓ installed local dev shim: `) + cyan(s.tool_id));
|
|
143
|
-
console.log(dim(`→ click `) + cyan(`Rediscover Local`) + dim(` in the Agent's Plugin Details to load `) + (installedShims.length === 1 ? dim("it") : dim("them")));
|
|
144
|
-
}
|
|
145
|
-
console.log(dim(`→ install & test the draft (reserved `) + cyan(`0.0.0-draft`) + dim(`) from the Developer Console`));
|
|
146
|
-
console.log(dim(`→ run `) + cyan(`anna-app apps cut ${manifest.version}`) + dim(` to snapshot an immutable version`));
|
|
147
|
-
return 0;
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
//#endregion
|
|
152
|
-
export { runAppsPush };
|
package/dist/bridge-BP28T06H.js
DELETED
package/dist/dev-CnDh2_7r.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{executa-trusted-publisher-BGqz6hMt.js → executa-trusted-publisher-n9IbAO5D.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|