@akanjs/cli 3.1.1-rc.8 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build-stamp +1 -1
- package/CodeAgent-35wnb7w5.js +9 -0
- package/{CodeTui-rqxarxsn.js → CodeTui-h6yz2kvq.js} +1 -1
- package/TunnelShare-xyjpa7gx.js +14 -0
- package/agent.command-3r4jsck8.js +46 -0
- package/akanCode.js +10 -6
- package/{application.command-14xsthcr.js → application.command-g7xv6ad0.js} +46 -13
- package/{applicationBuildRunner-t2r84sz6.js → applicationBuildRunner-qvjnhr9j.js} +9 -6
- package/buildBatch.proc.js +6 -6
- package/{cloud.command-rmw1kcf1.js → cloud.command-6ebygmhw.js} +17 -15
- package/cloud.script-0s1jybd5.js +26 -0
- package/{code.command-719k3e9q.js → code.command-mpkm2emr.js} +6 -6
- package/commandManifest.json +1 -1
- package/{context.command-c4t4z1vy.js → context.command-svdh6b2w.js} +18 -17
- package/context.runner-ch0z3a8g.js +26 -0
- package/{devTui-q7k7bakd.js → devTui-evr3b35y.js} +1 -1
- package/{guideline.command-snh85ctf.js → guideline.command-qwp3tnjx.js} +3 -3
- package/guidelines/conventions/core.md +106 -0
- package/guidelines/conventions/rules/app.md +83 -0
- package/guidelines/conventions/rules/auth.md +45 -0
- package/guidelines/conventions/rules/config.md +56 -0
- package/guidelines/conventions/rules/constant.md +24 -0
- package/guidelines/conventions/rules/gates.md +31 -0
- package/guidelines/conventions/rules/layer.md +25 -0
- package/guidelines/conventions/rules/migration.md +27 -0
- package/guidelines/conventions/rules/module.md +90 -0
- package/guidelines/conventions/rules/page.md +56 -0
- package/guidelines/conventions/rules/sensitive.md +16 -0
- package/guidelines/conventions/rules/server.md +86 -0
- package/guidelines/conventions/rules/ssr.md +47 -0
- package/guidelines/conventions/rules/style.md +43 -0
- package/guidelines/conventions/rules/test.md +34 -0
- package/guidelines/conventions/rules/ts.md +95 -0
- package/guidelines/conventions/rules/tsx.md +75 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +1 -1
- package/guidelines/pageRule/pageRule.instruction.md +4 -3
- package/guidelines/queryRule/queryRule.instruction.md +4 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +3 -3
- package/incrementalBuilder.proc.js +6 -6
- package/{index-pcwzkdqb.js → index-1p0qbq3m.js} +1 -1
- package/{index-xb8809yb.js → index-1shvxzt0.js} +3 -3
- package/{index-8w76g4rm.js → index-266dewjs.js} +11 -11
- package/{index-5max10jx.js → index-3yz30c07.js} +72 -53
- package/{index-xjf5j657.js → index-4mj92tsh.js} +952 -47
- package/index-4pdts00b.js +1604 -0
- package/{index-42j4a8zq.js → index-8559hsz4.js} +4 -3
- package/{index-wcej7g4z.js → index-8scw1pjk.js} +93 -23
- package/{index-5phjb48k.js → index-96wzdhfh.js} +74 -233
- package/index-9bv479q5.js +1 -0
- package/index-9rvcs76p.js +653 -0
- package/index-am36s3jh.js +3582 -0
- package/index-b8c289dx.js +444 -0
- package/{index-espk51ah.js → index-dd44g6vz.js} +3 -3
- package/{index-3wypz6xj.js → index-eja64h28.js} +7 -3
- package/index-fbewhg4g.js +590 -0
- package/index-jje9qzyq.js +27 -0
- package/{index-j9vyj3dj.js → index-k5jbcxyh.js} +3 -3
- package/{index-hmmv2cah.js → index-ksfgqq1x.js} +1 -1
- package/index-m5n3ka0p.js +18 -0
- package/{index-5nd1wtkv.js → index-p6x5b7hr.js} +1 -1
- package/{index-0p37cz91.js → index-payhwt51.js} +21 -29
- package/{index-myc22sgv.js → index-qkkdhjm6.js} +5 -4
- package/{index-74tjjsnc.js → index-qxzrp5xt.js} +33 -37
- package/{index-zrte51fn.js → index-r0k3ham2.js} +4 -4
- package/{index-hmt54t45.js → index-r2w2eh93.js} +4 -4
- package/index-r2wedvqn.js +138 -0
- package/{index-skk9zc1x.js → index-rnphv731.js} +2 -2
- package/{index-pa3c2mb8.js → index-s6da8ta9.js} +82 -1227
- package/index-tenw3mah.js +225 -0
- package/{index-31es1yev.js → index-tgt2fnd6.js} +107 -6
- package/{index-8ap5z1n5.js → index-vxmy1p4f.js} +16 -36
- package/{index-mdqr41sp.js → index-w4k2ragk.js} +7 -7
- package/{index-qd5km521.js → index-w7q6h97v.js} +1 -1
- package/{index-dy0jx9ay.js → index-wwe9rsrx.js} +14 -0
- package/{index-2xcc2ax5.js → index-xq543a5y.js} +2 -2
- package/{index-0fz95kxe.js → index-xqgwjz7a.js} +1 -1
- package/{index-40brg4px.js → index-xxfy1jp2.js} +4 -4
- package/{index-905qdgqp.js → index-z4b84y6k.js} +1 -1
- package/index-zcf6k8a5.js +410 -0
- package/index.js +23 -22
- package/{library.command-gycrwhf1.js → library.command-2853y6mk.js} +3 -3
- package/{localRegistry.command-2t3fghje.js → localRegistry.command-76ds31p4.js} +19 -15
- package/{module.command-v6hgs1bc.js → module.command-yfnb0abs.js} +5 -5
- package/{package.command-shzpcfph.js → package.command-d9s86hp9.js} +3 -3
- package/package.json +2 -2
- package/{page.command-ptxn5kqk.js → page.command-6a8a8rd1.js} +3 -3
- package/{pipeline.command-zz31pgax.js → pipeline.command-rt3rwd2z.js} +2 -2
- package/{primitive.command-a1vse91z.js → primitive.command-emcebgrq.js} +6 -6
- package/{projectTypecheck-2ztky9cf.js → projectTypecheck-51m7eh1f.js} +1 -1
- package/{prompter-76k56b37.js → prompter-hgcta8pb.js} +1 -1
- package/quality.command-xtrk0n3x.js +76 -0
- package/{repair.command-cvazbz99.js → repair.command-51szxnxx.js} +5 -5
- package/{routeSourceValidator-6jd0q6r6.js → routeSourceValidator-4h947v7c.js} +13 -3
- package/{scalar.command-0acvyp26.js → scalar.command-8qv27t82.js} +4 -4
- package/skills/akan-agent/SKILL.md +36 -0
- package/skills/akan-code/SKILL.md +1 -0
- package/skills/akan-debug/SKILL.md +40 -6
- package/skills/akan-deps/SKILL.md +1 -2
- package/skills/akan-mcp/SKILL.md +40 -0
- package/skills/akan-page/SKILL.md +44 -0
- package/skills/akan-query/SKILL.md +38 -0
- package/skills/akan-runtime/SKILL.md +40 -0
- package/skills/akan-scaffold/SKILL.md +16 -6
- package/skills/akan-transport/SKILL.md +40 -0
- package/skills/akan-validate/SKILL.md +13 -11
- package/{subspace.command-kvxmyxtf.js → subspace.command-pn56pnh8.js} +8 -8
- package/templates/__scalar/__model__/__model__.constant.ts +3 -5
- package/templates/__scalar/__model__/__model__.dictionary.ts +6 -5
- package/templates/__scalar/__model__/__model__.document.ts +3 -3
- package/templates/app/akan.config.ts +2 -3
- package/templates/app/env/env.client.ts +2 -4
- package/templates/app/env/env.client.type.ts +2 -3
- package/templates/app/env/env.server.ts +2 -3
- package/templates/app/lib/___appName__/__appName__.dictionary.ts +1 -2
- package/templates/app/lib/___appName__/__appName__.service.ts +3 -3
- package/templates/app/lib/___appName__/__appName__.signal.ts +5 -5
- package/templates/app/lib/___appName__/__appName__.store.ts +4 -6
- package/templates/app/lib/option.ts +2 -3
- package/templates/app/main.ts +2 -4
- package/templates/app/page/_index.tsx +3 -3
- package/templates/app/page/_layout.tsx +13 -10
- package/templates/appSample/lib/__scalar/workHistory/workHistory.constant.ts +1 -5
- package/templates/appSample/lib/__scalar/workHistory/workHistory.dictionary.ts +1 -1
- package/templates/appSample/lib/_noti/noti.signal.ts +1 -1
- package/templates/appSample/lib/task/Task.Template.tsx +2 -1
- package/templates/appSample/lib/task/Task.Unit.tsx +3 -2
- package/templates/appSample/lib/task/Task.Util.tsx +16 -4
- package/templates/appSample/lib/task/task.constant.ts +1 -5
- package/templates/appSample/lib/task/task.dictionary.ts +2 -8
- package/templates/appSample/lib/task/task.document.ts +1 -1
- package/templates/appSample/page/task/_index.tsx +2 -1
- package/templates/appSample/page/task/new.tsx +2 -1
- package/templates/appSample/ui/QuantityControl.tsx +5 -9
- package/templates/biomeForm.ts +144 -0
- package/templates/crudPages/[__model__Id]/edit/page.tsx +3 -3
- package/templates/crudPages/[__model__Id]/page.tsx +5 -5
- package/templates/crudPages/new/page.tsx +4 -3
- package/templates/crudPages/page.tsx +3 -3
- package/templates/crudSinglePage/page.tsx +9 -5
- package/templates/libRoot/akan.config.ts +2 -3
- package/templates/libRoot/lib/___libName__/__libName__.dictionary.ts +1 -2
- package/templates/libRoot/lib/___libName__/__libName__.service.ts +5 -4
- package/templates/libRoot/lib/___libName__/__libName__.signal.ts +6 -5
- package/templates/libRoot/lib/___libName__/__libName__.store.ts +5 -6
- package/templates/libRoot/lib/option.ts +1 -2
- package/templates/module/__Model__.Template.tsx +11 -10
- package/templates/module/__Model__.Unit.tsx +18 -5
- package/templates/module/__Model__.Util.tsx +9 -7
- package/templates/module/__Model__.View.tsx +9 -6
- package/templates/module/__Model__.Zone.tsx +25 -17
- package/templates/module/__model__.constant.ts +8 -9
- package/templates/module/__model__.dictionary.ts +16 -17
- package/templates/module/__model__.document.ts +6 -8
- package/templates/module/__model__.service.ts +3 -3
- package/templates/module/__model__.signal.ts +11 -10
- package/templates/module/__model__.store.ts +3 -5
- package/templates/service/__model__.dictionary.ts +6 -5
- package/templates/service/__model__.service.ts +3 -3
- package/templates/service/__model__.signal.ts +5 -4
- package/templates/service/__model__.store.ts +3 -5
- package/templates/workspaceRoot/.gitignore.template +3 -0
- package/templates/workspaceRoot/.vscode/settings.json.template +21 -21
- package/templates/workspaceRoot/AGENTS.md.template +4 -10
- package/{tunnel.command-kxv0ddmp.js → tunnel.command-q2h0j2en.js} +7 -7
- package/{typeChecker-px49mezc.js → typeChecker-j2jdnqsr.js} +1 -1
- package/typecheck.proc.js +6 -1
- package/verify.command-z1dsbmrt.js +91 -0
- package/{workflow.command-abb1d5xy.js → workflow.command-r3y67jeq.js} +47 -13
- package/workspace.command-t2f0xsrw.js +263 -0
- package/CodeAgent-3sy7kjgj.js +0 -9
- package/TunnelShare-2ef94kha.js +0 -14
- package/agent.command-ydftceda.js +0 -25
- package/cloud.script-v1ysyerg.js +0 -24
- package/context.runner-qb15sjf8.js +0 -25
- package/guidelines/conventions/conventions.instruction.md +0 -617
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +0 -291
- package/index-4vgbysa0.js +0 -279
- package/index-7md2g9vw.js +0 -6
- package/index-b70zct19.js +0 -856
- package/index-zzvvc845.js +0 -74
- package/quality.command-ah8qcakd.js +0 -1478
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +0 -69
- package/templates/workspaceRoot/docs/GENERATED.md.template +0 -55
- package/workspace.command-tsc99yec.js +0 -521
|
@@ -5,17 +5,17 @@ import {
|
|
|
5
5
|
AkanAppConfig,
|
|
6
6
|
Executor,
|
|
7
7
|
WorkspaceExecutor
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-8scw1pjk.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveAppId,
|
|
11
11
|
targetHtmlFilename
|
|
12
12
|
} from "./index-m9jj544v.js";
|
|
13
13
|
import {
|
|
14
14
|
CsrArtifactBuilder
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-1shvxzt0.js";
|
|
16
16
|
import {
|
|
17
17
|
ExitCodeError
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-eja64h28.js";
|
|
19
19
|
|
|
20
20
|
// pkgs/@akanjs/devkit/mobile/desktopBin.ts
|
|
21
21
|
import { chmod, mkdir, rename, rm, writeFile } from "fs/promises";
|
|
@@ -138,7 +138,6 @@ class DesktopBin {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
// pkgs/@akanjs/devkit/mobile/desktopRelease.ts
|
|
141
|
-
import { createPublicKey, verify } from "crypto";
|
|
142
141
|
import { mkdtemp as mkdtemp2, readFile, rm as rm3 } from "fs/promises";
|
|
143
142
|
import os2 from "os";
|
|
144
143
|
import path4 from "path";
|
|
@@ -337,25 +336,28 @@ class UpdateUploader {
|
|
|
337
336
|
}
|
|
338
337
|
static async releaseFiles(updatesDir, { dir, channel, bundle }) {
|
|
339
338
|
const keyOf = (file) => UpdateUploader.#keyOf(updatesDir, dir, file);
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
const archive = desktop.archive?.url;
|
|
343
|
-
const patches = UpdateUploader.#field(desktop.patches, "url");
|
|
344
|
-
return [archive, ...patches, `${channel}.json.sig`, `${channel}.json`].map(keyOf);
|
|
345
|
-
}
|
|
339
|
+
const v1 = await UpdateUploader.#read(path3.join(dir, `${channel}.json`));
|
|
340
|
+
const pair = v1?.bundle === bundle ? [`${channel}.json.sig`, `${channel}.json`] : [];
|
|
346
341
|
const names = await readdir(path3.join(dir, channel)).catch(() => []);
|
|
347
342
|
for (const name of names.filter((name) => name.endsWith(".json"))) {
|
|
348
343
|
const envelope = await UpdateUploader.#read(path3.join(dir, channel, name));
|
|
349
344
|
const manifest = typeof envelope?.manifest === "string" ? UpdateUploader.#parse(Buffer.from(envelope.manifest, "base64").toString("utf8")) : null;
|
|
350
345
|
if (manifest?.bundle !== bundle)
|
|
351
346
|
continue;
|
|
347
|
+
if (manifest.kind === "app")
|
|
348
|
+
return [...UpdateUploader.#appFiles(manifest), ...pair, `${channel}/${name}`].map(keyOf);
|
|
352
349
|
const hashes = [...new Set(UpdateUploader.#field(manifest.files, "sha256"))];
|
|
353
350
|
if (!hashes.every((hash) => typeof hash === "string" && /^[0-9a-f]{64}$/.test(hash)))
|
|
354
351
|
throw new Error(`${path3.join(dir, channel, name)} lists a file whose sha256 is not 64 hex digits; nothing was uploaded.`);
|
|
355
352
|
return [...hashes.map((hash) => `${UpdatePackFolder.filesDir}/${hash}`), `${channel}/${name}`].map(keyOf);
|
|
356
353
|
}
|
|
354
|
+
if (v1 && pair.length)
|
|
355
|
+
return [...UpdateUploader.#appFiles(v1), ...pair].map(keyOf);
|
|
357
356
|
throw new Error(`${dir} holds no ${channel} manifest of release ${bundle}; nothing was uploaded.`);
|
|
358
357
|
}
|
|
358
|
+
static #appFiles(manifest) {
|
|
359
|
+
return [manifest.archive?.url, ...UpdateUploader.#field(manifest.patches, "url")];
|
|
360
|
+
}
|
|
359
361
|
static #keyOf(updatesDir, dir, file) {
|
|
360
362
|
const resolved = typeof file === "string" ? path3.resolve(dir, file) : "";
|
|
361
363
|
const key = path3.relative(updatesDir, resolved);
|
|
@@ -416,46 +418,46 @@ class DesktopRelease {
|
|
|
416
418
|
platform;
|
|
417
419
|
arch;
|
|
418
420
|
channel;
|
|
419
|
-
|
|
420
|
-
signatureBytes;
|
|
421
|
-
static #ed25519Spki = Buffer.from("302a300506032b6570032100", "hex");
|
|
421
|
+
manifestFiles;
|
|
422
422
|
static #authenticode = `$ErrorActionPreference = 'Stop'
|
|
423
423
|
$ProgressPreference = 'SilentlyContinue'
|
|
424
424
|
$signature = Get-AuthenticodeSignature -LiteralPath $env:AKAN_RELEASE_EXE
|
|
425
425
|
$subject = if ("$($signature.Status)" -ceq 'Valid') { "$($signature.SignerCertificate.Subject)" } else { '' }
|
|
426
426
|
Set-Content -LiteralPath $env:AKAN_SIGNER_OUT -Value $subject -Encoding UTF8`;
|
|
427
|
-
constructor(dir, manifest, payloads, platform, arch, channel,
|
|
427
|
+
constructor(dir, manifest, payloads, platform, arch, channel, manifestFiles) {
|
|
428
428
|
this.dir = dir;
|
|
429
429
|
this.manifest = manifest;
|
|
430
430
|
this.payloads = payloads;
|
|
431
431
|
this.platform = platform;
|
|
432
432
|
this.arch = arch;
|
|
433
433
|
this.channel = channel;
|
|
434
|
-
this.
|
|
435
|
-
this.signatureBytes = signatureBytes;
|
|
434
|
+
this.manifestFiles = manifestFiles;
|
|
436
435
|
}
|
|
437
436
|
static async read(updatesDir, {
|
|
438
437
|
platform,
|
|
439
438
|
arch,
|
|
440
439
|
channel,
|
|
441
440
|
appId,
|
|
442
|
-
|
|
441
|
+
target,
|
|
442
|
+
publicKeys,
|
|
443
|
+
revokedKeys = [],
|
|
444
|
+
api
|
|
443
445
|
}) {
|
|
444
446
|
const folder = `${platform}-${arch}`;
|
|
445
447
|
const dir = path4.join(updatesDir, folder);
|
|
446
|
-
const
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
throw new Error(`${manifestPath} is not a release of ${appId} for ${folder} on channel ${channel}.`);
|
|
448
|
+
const envelopeName = `${channel}/app.json`;
|
|
449
|
+
const envelopePath = path4.join(dir, channel, "app.json");
|
|
450
|
+
const envelope = await readFile(envelopePath).catch(() => null);
|
|
451
|
+
if (!envelope)
|
|
452
|
+
throw new Error(`${envelopePath} is missing: run \`akan publish-update\` first.`);
|
|
453
|
+
const opened = DesktopRelease.#open(api, envelope, publicKeys, revokedKeys);
|
|
454
|
+
if (typeof opened === "string")
|
|
455
|
+
throw new Error(`${envelopePath}: ${opened}; publish the release again.`);
|
|
456
|
+
const manifest = DesktopRelease.#parse(opened);
|
|
457
|
+
if (manifest?.schema !== 2 || manifest.kind !== "app" || manifest.app !== appId || manifest.platform !== platform || manifest.arch !== arch || manifest.channel !== channel || manifest.target !== target || typeof manifest.bundle !== "string" || typeof manifest.sequence !== "number" || typeof manifest.build !== "number" || !manifest.archive)
|
|
458
|
+
throw new Error(`${envelopePath} is not a release of ${appId}${target ? ` target ${target}` : ""} for ${folder} on channel ${channel}.`);
|
|
458
459
|
const { archive, bundle, sequence, build } = manifest;
|
|
460
|
+
const legacy = await DesktopRelease.#legacyPair(api, dir, channel, publicKeys[0], manifest);
|
|
459
461
|
const keys = await UpdateUploader.releaseFiles(updatesDir, { dir, channel, bundle });
|
|
460
462
|
const expected = new Map([{ url: archive.url, size: archive.size, sha256: archive.gzSha256 }, ...manifest.patches ?? []].map(({ url, size, sha256 }) => [path4.posix.normalize(url), { size, sha256 }]));
|
|
461
463
|
const payloads = keys.flatMap((key) => {
|
|
@@ -463,12 +465,26 @@ Set-Content -LiteralPath $env:AKAN_SIGNER_OUT -Value $subject -Encoding UTF8`;
|
|
|
463
465
|
const digest = expected.get(name);
|
|
464
466
|
return digest ? [{ name, ...digest }] : [];
|
|
465
467
|
});
|
|
466
|
-
return new DesktopRelease(dir, { ...manifest, archive, bundle, sequence, build }, payloads, platform, arch, channel,
|
|
468
|
+
return new DesktopRelease(dir, { ...manifest, archive, bundle, sequence, build }, payloads, platform, arch, channel, [{ name: envelopeName, bytes: envelope }, ...legacy]);
|
|
469
|
+
}
|
|
470
|
+
static async#legacyPair(api, dir, channel, publicKey, manifest) {
|
|
471
|
+
const [bytes, signature] = await Promise.all([`${channel}.json`, `${channel}.json.sig`].map((name) => readFile(path4.join(dir, name)).catch(() => null)));
|
|
472
|
+
if (!bytes || !signature || !publicKey)
|
|
473
|
+
return [];
|
|
474
|
+
const v1 = DesktopRelease.#parse(bytes);
|
|
475
|
+
if (v1?.schema !== 1 || v1.bundle !== manifest.bundle || v1.sequence !== manifest.sequence)
|
|
476
|
+
return [];
|
|
477
|
+
if (!api.verifyManifest(bytes, new TextDecoder().decode(signature).trim(), publicKey))
|
|
478
|
+
return [];
|
|
479
|
+
return [
|
|
480
|
+
{ name: `${channel}.json`, bytes },
|
|
481
|
+
{ name: `${channel}.json.sig`, bytes: signature }
|
|
482
|
+
];
|
|
467
483
|
}
|
|
468
484
|
record(signer) {
|
|
469
485
|
const { platform, arch, channel } = this;
|
|
470
486
|
const builtAt = new Date(this.manifest.build * 1000).toISOString();
|
|
471
|
-
return { schema:
|
|
487
|
+
return { schema: 2, cli: AkanAppConfig.akanVersion, platform, arch, channel, signer, builtAt };
|
|
472
488
|
}
|
|
473
489
|
async withArchive(record, use) {
|
|
474
490
|
const tmp = await mkdtemp2(path4.join(os2.tmpdir(), "akan-release-"));
|
|
@@ -478,11 +494,11 @@ Set-Content -LiteralPath $env:AKAN_SIGNER_OUT -Value $subject -Encoding UTF8`;
|
|
|
478
494
|
try {
|
|
479
495
|
await tar.add("./release.json", new Blob([`${JSON.stringify(record, null, 2)}
|
|
480
496
|
`]));
|
|
481
|
-
|
|
482
|
-
|
|
497
|
+
for (const { name, bytes } of this.manifestFiles)
|
|
498
|
+
await tar.add(`./${name}`, new Blob([bytes]));
|
|
483
499
|
for (const { name, size, sha256 } of this.payloads) {
|
|
484
500
|
const file = Bun.file(path4.join(this.dir, name));
|
|
485
|
-
const what = `${path4.join(this.dir, name)} is not the file ${this.channel}.json names`;
|
|
501
|
+
const what = `${path4.join(this.dir, name)} is not the file ${this.channel}/app.json names`;
|
|
486
502
|
if (!await file.exists() || file.size !== size)
|
|
487
503
|
throw new Error(`${what}: publish the release again.`);
|
|
488
504
|
if (await tar.add(`./${name}`, file) !== sha256)
|
|
@@ -507,7 +523,7 @@ Set-Content -LiteralPath $env:AKAN_SIGNER_OUT -Value $subject -Encoding UTF8`;
|
|
|
507
523
|
return { signer: null, unread: null };
|
|
508
524
|
const app = this.manifest.files?.[0]?.path;
|
|
509
525
|
if (!app || !/^[^/\\]+$/.test(app) || app === "." || app === "..")
|
|
510
|
-
return { signer: null, unread: `${this.channel}.json names no app folder` };
|
|
526
|
+
return { signer: null, unread: `${this.channel}/app.json names no app folder` };
|
|
511
527
|
if (this.platform === "macos" && host !== "darwin")
|
|
512
528
|
return { signer: null, unread: "codesign reads a macOS app's signer on macOS only" };
|
|
513
529
|
if (this.platform === "windows" && host !== "win32")
|
|
@@ -542,7 +558,8 @@ Set-Content -LiteralPath $env:AKAN_SIGNER_OUT -Value $subject -Encoding UTF8`;
|
|
|
542
558
|
`)[0] ?? ""}` };
|
|
543
559
|
}
|
|
544
560
|
static async#subjectOf(run, archive, tmp, exe) {
|
|
545
|
-
|
|
561
|
+
const tar = path4.join(process.env.SystemRoot ?? "C:\\Windows", "System32", "tar.exe");
|
|
562
|
+
await run([tar, "-xzf", archive, "-C", tmp, exe]);
|
|
546
563
|
const extracted = path4.join(tmp, exe);
|
|
547
564
|
if (!await Bun.file(extracted).exists())
|
|
548
565
|
return { signer: null, unread: `the archive holds no ${exe}` };
|
|
@@ -559,16 +576,11 @@ Set-Content -LiteralPath $env:AKAN_SIGNER_OUT -Value $subject -Encoding UTF8`;
|
|
|
559
576
|
const subject = (await readFile(out, "utf8").catch(() => "")).replace(/^\uFEFF/, "").trim();
|
|
560
577
|
return { signer: subject ? { subject } : null, unread: null };
|
|
561
578
|
}
|
|
562
|
-
static #
|
|
579
|
+
static #open(api, envelope, publicKeys, revokedKeys) {
|
|
563
580
|
try {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
type: "spki"
|
|
568
|
-
});
|
|
569
|
-
return verify(null, manifest, key, Buffer.from(new TextDecoder().decode(signature).trim(), "base64"));
|
|
570
|
-
} catch {
|
|
571
|
-
return false;
|
|
581
|
+
return api.openEnvelope(new TextDecoder().decode(envelope), publicKeys, revokedKeys).manifest;
|
|
582
|
+
} catch (error) {
|
|
583
|
+
return toError(error).message;
|
|
572
584
|
}
|
|
573
585
|
}
|
|
574
586
|
static #parse(bytes) {
|
|
@@ -604,7 +616,7 @@ import path5 from "path";
|
|
|
604
616
|
|
|
605
617
|
class NativeApi {
|
|
606
618
|
static supportedMajor = 0;
|
|
607
|
-
static minimumVersion = "0.
|
|
619
|
+
static minimumVersion = "0.13.0";
|
|
608
620
|
static entryOf(appDir) {
|
|
609
621
|
const workspaceEntry = NativeApi.#resolve("@akanjs/native/api", appDir);
|
|
610
622
|
if (workspaceEntry)
|
|
@@ -894,7 +906,7 @@ class NativeConfig {
|
|
|
894
906
|
static #updates(target, env) {
|
|
895
907
|
const { url, publicKey, publicKeys, channel = env, ...rest } = target.updates ?? {};
|
|
896
908
|
const keys = publicKeys ? { publicKeys: [...publicKeys] } : publicKey ? { publicKey } : null;
|
|
897
|
-
return url && keys ? { ...rest, url, ...keys, ...channel ? { channel } : {} } : undefined;
|
|
909
|
+
return url && keys ? { ...rest, url, ...keys, ...channel ? { channel } : {}, target: target.name } : undefined;
|
|
898
910
|
}
|
|
899
911
|
static fileNameOf(name) {
|
|
900
912
|
return /[^-.](?:.*[^-.])?/.exec(name.replace(/[^A-Za-z0-9._-]/g, "-"))?.[0] ?? "app";
|
|
@@ -1432,18 +1444,25 @@ class NativeApp {
|
|
|
1432
1444
|
}
|
|
1433
1445
|
async publishedRelease(platform, { arch, channel }) {
|
|
1434
1446
|
this.#assertUpdates();
|
|
1435
|
-
const { config } = await
|
|
1436
|
-
|
|
1437
|
-
|
|
1447
|
+
const [api, { config }] = await Promise.all([
|
|
1448
|
+
NativeApi.load(this.app.cwdPath),
|
|
1449
|
+
this.config({ platform, stageBin: false })
|
|
1450
|
+
]);
|
|
1451
|
+
const { updates } = config;
|
|
1452
|
+
const publicKeys = updates?.publicKeys ?? (updates?.publicKey ? [updates.publicKey] : []);
|
|
1453
|
+
if (!updates || !publicKeys.length)
|
|
1438
1454
|
throw new Error(`Native target '${this.target.name}' has no updates key.`);
|
|
1439
1455
|
const release = await DesktopRelease.read(this.updatesDir, {
|
|
1440
1456
|
platform,
|
|
1441
1457
|
arch,
|
|
1442
|
-
channel: channel ??
|
|
1458
|
+
channel: channel ?? updates.channel ?? "production",
|
|
1443
1459
|
appId: config.app.id,
|
|
1444
|
-
|
|
1460
|
+
...updates.target ? { target: updates.target } : {},
|
|
1461
|
+
publicKeys,
|
|
1462
|
+
revokedKeys: updates.revokedKeys ?? [],
|
|
1463
|
+
api
|
|
1445
1464
|
});
|
|
1446
|
-
return { release, url:
|
|
1465
|
+
return { release, url: updates.url, exeName: config.app.fileName ?? "" };
|
|
1447
1466
|
}
|
|
1448
1467
|
async publishUpdate(platform, {
|
|
1449
1468
|
channel,
|