@akanjs/cli 3.0.0-beta.19 → 3.0.0-beta.20
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-6cm97kay.js → CodeAgent-awv258wb.js} +2 -2
- package/{CodeTui-za4jsm41.js → CodeTui-1nqh35ez.js} +20 -22
- package/TunnelShare-scf4e4pd.js +9 -0
- package/{agent.command-e0wpbbyg.js → agent.command-1s9ag7sb.js} +8 -9
- package/akanCode.js +4 -4
- package/{application.command-8wyxqc8q.js → application.command-49hwy6va.js} +25 -56
- package/{applicationBuildRunner-n9gzaxd0.js → applicationBuildRunner-ybyp97pv.js} +33 -59
- package/{applicationReleasePackager-vpggfqgq.js → applicationReleasePackager-esnrphw8.js} +40 -60
- package/buildBatch.proc.js +19 -24
- package/{capacitorApp-q3z0qht0.js → capacitorApp-1synz4en.js} +3 -4
- package/{cloud.command-4zwa5dsx.js → cloud.command-d7rqtzt9.js} +16 -26
- package/cloud.script-bkbpcr96.js +19 -0
- package/{code.command-468c9d7s.js → code.command-nn48xzej.js} +22 -37
- package/context.command-s3mcmvpa.js +48 -0
- package/context.runner-k99nb5pk.js +21 -0
- package/{dependencyScanner-0z2h2tks.js → dependencyScanner-ye2e6pdz.js} +2 -2
- package/{devTui-ffjsarqa.js → devTui-q7k7bakd.js} +5 -9
- package/fileSys-5ngz93ga.js +9 -0
- package/{guideline.command-vhw13pqr.js → guideline.command-sct4qnt5.js} +4 -5
- package/guidelines/conventions/conventions.instruction.md +5 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
- package/incrementalBuilder.proc.js +30 -48
- package/{index-s5rhm04y.js → index-0bq14vr1.js} +1 -1
- package/{index-10dkrrww.js → index-13ffe9wp.js} +4 -4
- package/{index-srmay5jw.js → index-22d57v4c.js} +84 -67
- package/{index-53176s7j.js → index-31yr441d.js} +10 -17
- package/index-3hx1z96c.js +87 -0
- package/{index-4m929vvn.js → index-3sq321ak.js} +10 -18
- package/{index-bhtmj233.js → index-3t7g9e4r.js} +41 -78
- package/{index-q0y2jq9j.js → index-5b6tavv3.js} +6 -3
- package/{index-47pj3aee.js → index-5e0n4hqx.js} +11 -12
- package/{index-7ep8qtvp.js → index-5pc1qrbv.js} +5 -8
- package/{index-esk82rvk.js → index-8mna0947.js} +34 -71
- package/{index-sq2dzkzm.js → index-8sf7wmdr.js} +6 -6
- package/{index-crmeqnmf.js → index-9d9bgcx4.js} +283 -722
- package/{index-bwf965h6.js → index-ahemdr5n.js} +6 -6
- package/{index-ab0c38ea.js → index-as7xmyz8.js} +20 -20
- package/{index-bc88j1ry.js → index-axzjaqve.js} +94 -142
- package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
- package/{index-667w0yah.js → index-c6eggbee.js} +2 -5
- package/{index-a1w6934z.js → index-ddxvdd1p.js} +169 -305
- package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
- package/{index-22xtgmhn.js → index-dzf3r49a.js} +1 -1
- package/{index-89hy31kf.js → index-fgq75haa.js} +172 -287
- package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
- package/{index-hwkygn9s.js → index-khpfpcsd.js} +302 -33
- package/{index-vqx8bdxz.js → index-mxav6j3c.js} +78 -231
- package/{index-2446k7b4.js → index-myhc3c1j.js} +512 -588
- package/{index-3jrp517k.js → index-nv5976x3.js} +45 -128
- package/{index-zqgj2rt2.js → index-przybvy5.js} +69 -147
- package/{index-n3cv0tm4.js → index-smme4r47.js} +1 -1
- package/{index-qdgzsnhg.js → index-w2zdcw3k.js} +110 -231
- package/{index-14zrtgfa.js → index-wa5jbxj1.js} +6 -39
- package/{index-bftkz6cp.js → index-ww4z397j.js} +198 -555
- package/{index-kwaq3n9n.js → index-xqjwd384.js} +4 -7
- package/{index-txr7dj2g.js → index-xqpzbab5.js} +106 -240
- package/{index-e4v6vhxq.js → index-xsjh6nzh.js} +178 -165
- package/{index-18zybgkc.js → index-ygn77a5w.js} +47 -99
- package/{index-9d6nvkz2.js → index-ztp3e73t.js} +79 -35
- package/index.js +23 -24
- package/{library.command-cqr175dy.js → library.command-1gx04jgn.js} +4 -5
- package/{localRegistry.command-49z55qqz.js → localRegistry.command-zndxj1q6.js} +21 -42
- package/{module.command-9p8mm3b0.js → module.command-3waddk95.js} +6 -7
- package/{package.command-wxyz909t.js → package.command-zrc7br1y.js} +5 -6
- package/package.json +2 -2
- package/{page.command-gsrsfqqs.js → page.command-vpjgardh.js} +4 -5
- package/{primitive.command-ns1mptje.js → primitive.command-sz84tk4t.js} +9 -20
- package/{prompter-1f8d9pcc.js → prompter-ptaa3nk0.js} +2 -2
- package/{quality.command-e76k2q9k.js → quality.command-g869hafs.js} +129 -363
- package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
- package/{repair.command-pkrsm3cw.js → repair.command-chsnjvvv.js} +11 -35
- package/{scalar.command-0cpt3fc8.js → scalar.command-2v21newx.js} +5 -6
- package/skills/akan-code/SKILL.md +12 -4
- package/{subspace.command-fktpwp0g.js → subspace.command-ckcbwfp1.js} +39 -58
- package/templates/appSample/srvkit/{AuthGuard.ts → guards.ts} +3 -3
- package/templates/appSample/srvkit/{SessionInternalArg.ts → internalArgs.ts} +3 -3
- package/templates/client.ts +7 -30
- package/templates/lib/__lib/lib.dictionary.ts +0 -2
- package/templates/lib/__lib/lib.document.ts +0 -2
- package/templates/lib/sig.ts +8 -30
- package/templates/server.ts +0 -2
- package/{tunnel.command-d5jy9gk8.js → tunnel.command-kd2yr4fx.js} +5 -6
- package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/workflow.command-44252cqv.js +79 -0
- package/{workspace.command-gv84eh1p.js → workspace.command-fqcztt5p.js} +72 -107
- package/TunnelShare-2j6s511d.js +0 -9
- package/cloud.script-fwx3vb34.js +0 -20
- package/context.command-dsnw0jby.js +0 -80
- package/context.runner-rs4rj15d.js +0 -22
- package/devTuiView-1q1mdgrv.js +0 -9
- package/getDirname-dr3jz1xg.js +0 -7
- package/index-6wwzs1bc.js +0 -7
- package/workflow.command-6tkcysmx.js +0 -105
package/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
0d535360142b0b5d72c4372140a1d5a5403772f09613397de6cb733fa0ff3f6e
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
McpServerConfig,
|
|
5
5
|
McpTokenStore,
|
|
6
6
|
McpSignIn
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-ztp3e73t.js";
|
|
8
8
|
import {
|
|
9
9
|
CodeTuiLines2,
|
|
10
10
|
CodeTuiAgents2,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
CodeTuiFiles2,
|
|
15
15
|
CodeTuiMarkdown2,
|
|
16
16
|
CodeTuiParts2
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-wa5jbxj1.js";
|
|
18
18
|
import {
|
|
19
19
|
openBrowser
|
|
20
20
|
} from "./index-9dp031by.js";
|
|
@@ -354,7 +354,8 @@ class CodeTuiMcp {
|
|
|
354
354
|
"/mcp add --local <name> \u2026 declare it for this repo only, not every repo",
|
|
355
355
|
"/mcp login <name> sign in through the browser (OAuth)",
|
|
356
356
|
"/mcp logout <name> forget the token, leaving the server declared",
|
|
357
|
-
"/mcp remove <name> undeclare it",
|
|
357
|
+
"/mcp remove <name> undeclare it, from this repo's file first",
|
|
358
|
+
"/mcp remove --local <name> undeclare it from this repo's file only",
|
|
358
359
|
"/mcp reload reopen this session so the file takes effect"
|
|
359
360
|
];
|
|
360
361
|
static #where(view) {
|
|
@@ -422,6 +423,8 @@ class CodeTuiMcp {
|
|
|
422
423
|
static tools(status) {
|
|
423
424
|
if (status.error)
|
|
424
425
|
return `${status.name} is unreachable \u2014 ${status.error}`;
|
|
426
|
+
if (status.auth === "required")
|
|
427
|
+
return `${status.name} needs signing in \u2014 /mcp login ${status.name}`;
|
|
425
428
|
if (!status.tools.length)
|
|
426
429
|
return `${status.name} connected and published no tools.`;
|
|
427
430
|
return [`${status.name} \xB7 ${status.target}`, "", status.tools.join(`
|
|
@@ -452,11 +455,7 @@ class CodeTuiModels {
|
|
|
452
455
|
...CodeTuiModels.usage
|
|
453
456
|
].join(`
|
|
454
457
|
`);
|
|
455
|
-
const rows = ready.flatMap((provider) => provider
|
|
456
|
-
`${model.current ? "\u276F " : " "}${provider.id}/${model.id}`,
|
|
457
|
-
model.name,
|
|
458
|
-
CodeTuiModels.#window(model.contextWindow)
|
|
459
|
-
]));
|
|
458
|
+
const rows = ready.flatMap((provider) => CodeTuiModels.#modelRows(provider));
|
|
460
459
|
return [
|
|
461
460
|
`${rows.length} model${rows.length === 1 ? "" : "s"} ready \xB7 ${ready.map((provider) => provider.id).join(", ")}`,
|
|
462
461
|
"",
|
|
@@ -491,17 +490,17 @@ class CodeTuiModels {
|
|
|
491
490
|
const provider = catalogue.find((entry) => entry.id === id);
|
|
492
491
|
if (!provider)
|
|
493
492
|
return;
|
|
494
|
-
const rows = provider
|
|
495
|
-
`${model.current ? "\u276F " : " "}${provider.id}/${model.id}`,
|
|
496
|
-
model.name,
|
|
497
|
-
CodeTuiModels.#window(model.contextWindow)
|
|
498
|
-
]);
|
|
493
|
+
const rows = CodeTuiModels.#modelRows(provider);
|
|
499
494
|
const head = provider.authorized ? `${provider.name} \xB7 ${rows.length} models \xB7 ready` : `${provider.name} \xB7 ${rows.length} models \xB7 set ${CodeTuiModels.envKeyOf(provider.id)} to use it`;
|
|
500
495
|
return [head, "", ...CodeTuiModels.#table(rows)].join(`
|
|
501
496
|
`);
|
|
502
497
|
}
|
|
503
|
-
static #
|
|
504
|
-
return
|
|
498
|
+
static #modelRows(provider) {
|
|
499
|
+
return provider.models.map((model) => [
|
|
500
|
+
`${model.current ? "\u276F " : " "}${provider.id}/${model.id}`,
|
|
501
|
+
model.name,
|
|
502
|
+
model.contextWindow ? `${Math.round(model.contextWindow / 1000)}k ctx` : ""
|
|
503
|
+
]);
|
|
505
504
|
}
|
|
506
505
|
static #table(rows) {
|
|
507
506
|
const width = (at) => Math.max(0, ...rows.map((row) => (row[at] ?? "").length)) + 2;
|
|
@@ -1323,10 +1322,13 @@ ${CodeTuiCommands2.help()}`);
|
|
|
1323
1322
|
return this.#open("mcp", `"${name}" cannot name a server: letters, digits, dash and underscore only.`);
|
|
1324
1323
|
try {
|
|
1325
1324
|
if (verb === "remove") {
|
|
1326
|
-
const scope = McpServerConfig.remove(root, name);
|
|
1325
|
+
const scope = McpServerConfig.remove(root, name, local ? "workspace" : undefined);
|
|
1326
|
+
const remaining = McpServerConfig.declared(root).find((entry) => entry.ref.name === name);
|
|
1327
1327
|
if (!scope)
|
|
1328
|
-
return this.#open("mcp", `No server named "${name}" is declared.`);
|
|
1329
|
-
|
|
1328
|
+
return this.#open("mcp", remaining ? `"${name}" is not declared in this repo's file; the ${remaining.scope} file declares it \u2014 /mcp remove ${name} removes it there.` : `No server named "${name}" is declared.`);
|
|
1329
|
+
if (!remaining)
|
|
1330
|
+
return this.#reload(`removed ${name} from the ${scope} file`);
|
|
1331
|
+
return this.#reload(`removed ${name} from the ${scope} file \u2014 the ${remaining.scope} file still declares it, so it still applies; /mcp remove ${name} again to remove it there`);
|
|
1330
1332
|
}
|
|
1331
1333
|
const scope = local ? "workspace" : "global";
|
|
1332
1334
|
const ref = McpServerConfig.add(root, name, rest, scope);
|
|
@@ -1439,10 +1441,6 @@ ${levels.join(" \xB7 ")}`);
|
|
|
1439
1441
|
this.#transcript.note("error", String(error));
|
|
1440
1442
|
this.#renderNow();
|
|
1441
1443
|
}
|
|
1442
|
-
#note(text) {
|
|
1443
|
-
this.#transcript.note("info", text);
|
|
1444
|
-
this.#renderNow();
|
|
1445
|
-
}
|
|
1446
1444
|
#say(text) {
|
|
1447
1445
|
this.#notice = text;
|
|
1448
1446
|
if (this.#noticeTimer)
|
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Workspace,
|
|
4
4
|
command
|
|
5
|
-
} from "./index-
|
|
6
|
-
import"./index-
|
|
7
|
-
import"./index-
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
10
|
-
import"./index-
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-s5rhm04y.js";
|
|
5
|
+
} from "./index-w2zdcw3k.js";
|
|
6
|
+
import"./index-5b6tavv3.js";
|
|
7
|
+
import"./index-9d9bgcx4.js";
|
|
8
|
+
import"./index-hj6w4ka1.js";
|
|
9
|
+
import"./index-myhc3c1j.js";
|
|
10
|
+
import"./index-ygn77a5w.js";
|
|
11
|
+
import"./index-0bq14vr1.js";
|
|
13
12
|
import {
|
|
14
13
|
AgentScript
|
|
15
|
-
} from "./index-
|
|
14
|
+
} from "./index-ahemdr5n.js";
|
|
16
15
|
|
|
17
16
|
// pkgs/@akanjs/cli/agent/agent.command.ts
|
|
18
17
|
class AgentCommand extends command("agent", [AgentScript], ({ public: target }) => ({
|
package/akanCode.js
CHANGED
|
@@ -28,18 +28,18 @@ import {
|
|
|
28
28
|
CodeMailbox2,
|
|
29
29
|
CodeSessionFork2,
|
|
30
30
|
CodeAgent2
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-xsjh6nzh.js";
|
|
32
32
|
import {
|
|
33
33
|
akanCodeDefaultModel2,
|
|
34
34
|
akanCodeModel2,
|
|
35
35
|
akanCodeModelSupportsImages2,
|
|
36
36
|
akanCodeModelWarnings2,
|
|
37
37
|
CodeAgentStreamPrinter2
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-c6eggbee.js";
|
|
39
39
|
import {
|
|
40
40
|
SubagentPool2,
|
|
41
41
|
akanCodePaths2
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-ztp3e73t.js";
|
|
43
43
|
import"./index-7md2g9vw.js";
|
|
44
44
|
import {
|
|
45
45
|
CodeAgentRpcHost2
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
CodeTuiFiles2,
|
|
54
54
|
CodeTuiMarkdown2,
|
|
55
55
|
CodeTuiParts2
|
|
56
|
-
} from "./index-
|
|
56
|
+
} from "./index-wa5jbxj1.js";
|
|
57
57
|
export {
|
|
58
58
|
AkanCli2 as AkanCli,
|
|
59
59
|
AkanCodePlugins2 as AkanCodePlugins,
|
|
@@ -6,28 +6,34 @@ import {
|
|
|
6
6
|
Exec,
|
|
7
7
|
Workspace,
|
|
8
8
|
command
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-
|
|
9
|
+
} from "./index-w2zdcw3k.js";
|
|
10
|
+
import"./index-5b6tavv3.js";
|
|
11
|
+
import"./index-9d9bgcx4.js";
|
|
12
|
+
import"./index-khpfpcsd.js";
|
|
13
|
+
import"./index-5pc1qrbv.js";
|
|
13
14
|
import {
|
|
14
15
|
ApplicationScript
|
|
15
|
-
} from "./index-
|
|
16
|
-
import"./index-7ep8qtvp.js";
|
|
17
|
-
import"./index-hwkygn9s.js";
|
|
16
|
+
} from "./index-ww4z397j.js";
|
|
18
17
|
import"./index-7md2g9vw.js";
|
|
19
|
-
import"./index-
|
|
18
|
+
import"./index-xqjwd384.js";
|
|
20
19
|
import {
|
|
21
20
|
getMobileTargetChoices
|
|
22
|
-
} from "./index-
|
|
21
|
+
} from "./index-5e0n4hqx.js";
|
|
23
22
|
|
|
24
23
|
// pkgs/@akanjs/cli/application/application.command.ts
|
|
25
|
-
import { select } from "@inquirer/prompts";
|
|
26
24
|
var mobileTargetOption = {
|
|
27
25
|
desc: "mobile target name or all",
|
|
28
26
|
ask: "Select mobile target",
|
|
29
27
|
enum: async ({ app }) => await getMobileTargetChoices(app)
|
|
30
28
|
};
|
|
29
|
+
var devEnvs = ["local", "debug", "develop", "main"];
|
|
30
|
+
var buildEnvOption = { enum: devEnvs, desc: "backend environment", default: "debug" };
|
|
31
|
+
var startEnvOption = { enum: devEnvs, desc: "backend environment", default: "local" };
|
|
32
|
+
var releaseEnvOption = {
|
|
33
|
+
enum: ["debug", "develop", "main", "local"],
|
|
34
|
+
desc: "backend environment",
|
|
35
|
+
default: "main"
|
|
36
|
+
};
|
|
31
37
|
|
|
32
38
|
class ApplicationCommand extends command("application", [ApplicationScript], ({ public: target }) => ({
|
|
33
39
|
createApplication: target({ desc: "Create a new application in the workspace" }).arg("appName", String, { desc: "name of application" }).option("start", Boolean, { desc: "start application", default: false }).with(Workspace).exec(async function(appName, start, workspace) {
|
|
@@ -87,18 +93,10 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
|
|
|
87
93
|
test: target({ desc: "Prepare and test an app, library, or package" }).with(Exec).option("write", Boolean, { desc: "write code generation", default: true }).exec(async function(exec, write) {
|
|
88
94
|
await this.applicationScript.test(exec, { write });
|
|
89
95
|
}),
|
|
90
|
-
buildIos: target({ short: true, desc: "Build iOS app with Capacitor" }).with(App).option("target", String, mobileTargetOption).option("env", String, {
|
|
91
|
-
enum: ["local", "debug", "develop", "main"],
|
|
92
|
-
desc: "backend environment",
|
|
93
|
-
default: "debug"
|
|
94
|
-
}).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).exec(async function(app, target, env, write, regenerate) {
|
|
96
|
+
buildIos: target({ short: true, desc: "Build iOS app with Capacitor" }).with(App).option("target", String, mobileTargetOption).option("env", String, buildEnvOption).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).exec(async function(app, target, env, write, regenerate) {
|
|
95
97
|
await this.applicationScript.buildIos(app, { target, env, write, regenerate });
|
|
96
98
|
}),
|
|
97
|
-
buildAndroid: target({ short: true, desc: "Build Android app with Capacitor" }).with(App).option("target", String, mobileTargetOption).option("env", String, {
|
|
98
|
-
enum: ["local", "debug", "develop", "main"],
|
|
99
|
-
desc: "backend environment",
|
|
100
|
-
default: "debug"
|
|
101
|
-
}).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).exec(async function(app, target, env, write, regenerate) {
|
|
99
|
+
buildAndroid: target({ short: true, desc: "Build Android app with Capacitor" }).with(App).option("target", String, mobileTargetOption).option("env", String, buildEnvOption).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).exec(async function(app, target, env, write, regenerate) {
|
|
102
100
|
await this.applicationScript.buildAndroid(app, { target, env, write, regenerate });
|
|
103
101
|
}),
|
|
104
102
|
start: target({ short: true, desc: "Start development server(s) (frontend SSR + backend)" }).with(Apps).option("plain", Boolean, { desc: "print prefixed lines instead of the full-screen view", default: false }).option("kill", Boolean, { flag: "k", desc: "free the dev ports first, whoever is holding them", default: false }).option("concurrency", Number, {
|
|
@@ -107,11 +105,7 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
|
|
|
107
105
|
}).option("dbup", Boolean, { desc: "start the local database first", default: true }).option("open", Boolean, { desc: "open web browser?", default: false }).option("share", Boolean, { desc: "also share each app on a public URL through an akan tunnel", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).exec(async function(apps, plain, kill, concurrency, dbup, open, share, write) {
|
|
108
106
|
await this.applicationScript.start(apps, { plain, kill, concurrency, dbup, open, share, write });
|
|
109
107
|
}),
|
|
110
|
-
startIos: target({ short: true, desc: "Start iOS app in simulator or device" }).with(App).option("target", String, mobileTargetOption).option("env", String, {
|
|
111
|
-
enum: ["local", "debug", "develop", "main"],
|
|
112
|
-
desc: "backend environment",
|
|
113
|
-
default: "local"
|
|
114
|
-
}).option("open", Boolean, { desc: "open ios simulator", default: false }).option("release", Boolean, { desc: "release mode", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).option("allowProvisioningUpdates", Boolean, {
|
|
108
|
+
startIos: target({ short: true, desc: "Start iOS app in simulator or device" }).with(App).option("target", String, mobileTargetOption).option("env", String, startEnvOption).option("open", Boolean, { desc: "open ios simulator", default: false }).option("release", Boolean, { desc: "release mode", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).option("allowProvisioningUpdates", Boolean, {
|
|
115
109
|
desc: "let Xcode create or update provisioning profiles for a physical device",
|
|
116
110
|
default: true
|
|
117
111
|
}).option("device", String, {
|
|
@@ -129,11 +123,7 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
|
|
|
129
123
|
device: device || undefined
|
|
130
124
|
});
|
|
131
125
|
}),
|
|
132
|
-
startAndroid: target({ short: true, desc: "Start Android app in emulator or device" }).with(App).option("target", String, mobileTargetOption).option("env", String, {
|
|
133
|
-
enum: ["local", "debug", "develop", "main"],
|
|
134
|
-
desc: "backend environment",
|
|
135
|
-
default: "local"
|
|
136
|
-
}).option("release", Boolean, { desc: "release mode", default: false }).option("open", Boolean, { desc: "open android simulator", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).exec(async function(app, target, env, release, open, write, regenerate) {
|
|
126
|
+
startAndroid: target({ short: true, desc: "Start Android app in emulator or device" }).with(App).option("target", String, mobileTargetOption).option("env", String, startEnvOption).option("release", Boolean, { desc: "release mode", default: false }).option("open", Boolean, { desc: "open android simulator", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).exec(async function(app, target, env, release, open, write, regenerate) {
|
|
137
127
|
await this.applicationScript.startAndroid(app, {
|
|
138
128
|
target,
|
|
139
129
|
env,
|
|
@@ -143,24 +133,10 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
|
|
|
143
133
|
regenerate
|
|
144
134
|
});
|
|
145
135
|
}),
|
|
146
|
-
releaseIos: target({ desc: "Build and package iOS app for release (App Store)" }).with(App).option("target", String, mobileTargetOption).option("env", String, {
|
|
147
|
-
|
|
148
|
-
desc: "backend environment",
|
|
149
|
-
default: "main"
|
|
150
|
-
}).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).option("allowLocalRelease", Boolean, { flag: "l", desc: "allow release with --env local", default: false }).exec(async function(app, target, env, write, regenerate, allowLocalRelease) {
|
|
151
|
-
await this.applicationScript.releaseIos(app, {
|
|
152
|
-
target,
|
|
153
|
-
env,
|
|
154
|
-
write,
|
|
155
|
-
regenerate,
|
|
156
|
-
allowLocalRelease
|
|
157
|
-
});
|
|
136
|
+
releaseIos: target({ desc: "Build and package iOS app for release (App Store)" }).with(App).option("target", String, mobileTargetOption).option("env", String, releaseEnvOption).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).option("allowLocalRelease", Boolean, { flag: "l", desc: "allow release with --env local", default: false }).exec(async function(app, target, env, write, regenerate, allowLocalRelease) {
|
|
137
|
+
await this.applicationScript.releaseIos(app, { target, env, write, regenerate, allowLocalRelease });
|
|
158
138
|
}),
|
|
159
|
-
releaseAndroid: target({ desc: "Build and package Android app for release (Play Store)" }).with(App).option("assembleType", String, { enum: ["apk", "aab"], default: "apk" }).option("target", String, mobileTargetOption).option("env", String, {
|
|
160
|
-
enum: ["debug", "develop", "main", "local"],
|
|
161
|
-
desc: "backend environment",
|
|
162
|
-
default: "main"
|
|
163
|
-
}).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).option("allowLocalRelease", Boolean, { flag: "l", desc: "allow release with --env local", default: false }).exec(async function(app, assembleType, target, env, write, regenerate, allowLocalRelease) {
|
|
139
|
+
releaseAndroid: target({ desc: "Build and package Android app for release (Play Store)" }).with(App).option("assembleType", String, { enum: ["apk", "aab"], default: "apk" }).option("target", String, mobileTargetOption).option("env", String, releaseEnvOption).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).option("allowLocalRelease", Boolean, { flag: "l", desc: "allow release with --env local", default: false }).exec(async function(app, assembleType, target, env, write, regenerate, allowLocalRelease) {
|
|
164
140
|
await this.applicationScript.releaseAndroid(app, assembleType, {
|
|
165
141
|
target,
|
|
166
142
|
env,
|
|
@@ -172,15 +148,8 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
|
|
|
172
148
|
releaseSource: target({ desc: "Release app source code with OTA update support" }).with(App).option("rebuild", Boolean, { desc: "rebuild", default: false }).option("buildNum", Number, { desc: "build number", default: 0 }).option("environment", String, { desc: "environment", default: "debug" }).option("local", Boolean, { desc: "local", default: true }).exec(async function(app, rebuild, buildNum, environment, local) {
|
|
173
149
|
await this.applicationScript.releaseSource(app, { rebuild, buildNum, environment, local });
|
|
174
150
|
}),
|
|
175
|
-
codepush: target({ desc: "
|
|
176
|
-
|
|
177
|
-
message: "Select os",
|
|
178
|
-
choices: [
|
|
179
|
-
{ value: "ios", name: "ios", description: "ios" },
|
|
180
|
-
{ value: "android", name: "android", description: "android" }
|
|
181
|
-
]
|
|
182
|
-
});
|
|
183
|
-
await this.applicationScript.codepush(app, os);
|
|
151
|
+
codepush: target({ desc: "Over-the-air (OTA) update for a mobile app \u2014 in development, deploys nothing yet" }).with(App).exec(async function(app) {
|
|
152
|
+
await this.applicationScript.codepush(app);
|
|
184
153
|
}),
|
|
185
154
|
dbup: target({ desc: "Start local database services for a database mode" }).with(Workspace).option("mode", String, {
|
|
186
155
|
desc: "database mode; left out, every mode the workspace's apps declare",
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
Spinner
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-9d9bgcx4.js";
|
|
5
5
|
import {
|
|
6
6
|
AllRoutesBuilder,
|
|
7
7
|
CsrArtifactBuilder,
|
|
8
8
|
FontPruner,
|
|
9
9
|
precompressArtifacts,
|
|
10
10
|
SsrBaseArtifactBuilder
|
|
11
|
-
} from "./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-hwkygn9s.js";
|
|
11
|
+
} from "./index-ddxvdd1p.js";
|
|
12
|
+
import"./index-fgq75haa.js";
|
|
13
|
+
import"./index-5b6tavv3.js";
|
|
15
14
|
import"./index-n68jx79w.js";
|
|
16
15
|
|
|
17
16
|
// pkgs/@akanjs/devkit/applicationBuildRunner.ts
|
|
@@ -51,6 +50,7 @@ class ApplicationBuildRunner {
|
|
|
51
50
|
#app;
|
|
52
51
|
#fast;
|
|
53
52
|
#reporter;
|
|
53
|
+
#spinner;
|
|
54
54
|
#startedAt = Date.now();
|
|
55
55
|
#phases = [];
|
|
56
56
|
constructor(app, { fast = false, reporter } = {}) {
|
|
@@ -59,21 +59,17 @@ class ApplicationBuildRunner {
|
|
|
59
59
|
this.#reporter = reporter;
|
|
60
60
|
}
|
|
61
61
|
async build({ spinner = false } = {}) {
|
|
62
|
-
|
|
62
|
+
this.#spinner = spinner;
|
|
63
63
|
const { web, assets } = await this.#app.getConfig();
|
|
64
|
-
await this.#runPhase("prepare", "Preparing output directory", () => this.#app.prepareCommand("build")
|
|
65
|
-
spinner
|
|
66
|
-
});
|
|
64
|
+
await this.#runPhase("prepare", "Preparing output directory", () => this.#app.prepareCommand("build"));
|
|
67
65
|
if (!this.#fast)
|
|
68
|
-
await this.#runPhase("typecheck", "Typechecking", () => this.typecheck()
|
|
69
|
-
await this.#runPhase("backend", "Compiling backend", () => this.#buildBackend(), (result) => `${result.entrypoints} entrypoints, ${result.outputs} outputs
|
|
70
|
-
await this.#runPhase("ssr", "Building SSR route artifacts", async () => web.ssr ? await this.#buildSsr() : null, (result) => result ? `${result.allRoutes.manifest.routeIds.length} routes, ${result.allRoutes.manifest.knownEntries.length} entries` : web.ssr ? "skipped" : "disabled by akan.config.ts web.ssr"
|
|
71
|
-
await this.#runPhase("csr", "Building CSR assets", async () => web.csr ? await this.#
|
|
72
|
-
await this.#runPhase("assets", "Trimming unread static assets", async () => assets.pruneFonts ? await new FontPruner(this.#app, assets).prune() : null, (result) => result ? `${result.removed.length} font file(s) dropped, ${ApplicationBuildRunner.formatBytes(result.freedBytes)} freed; ${result.kept.length} kept` : "disabled by akan.config.ts assets.pruneFonts"
|
|
73
|
-
await this.#runPhase("compress", "Compressing static assets", () => precompressArtifacts(this.#app), (result) => result.files > 0 ? `${result.files} files, ${ApplicationBuildRunner.formatBytes(result.inputBytes)} -> gzip ${ApplicationBuildRunner.formatBytes(result.outputBytes)} / br ${ApplicationBuildRunner.formatBytes(result.brotliBytes)}` : "no files"
|
|
74
|
-
await this.#runPhase("metadata", "Writing production metadata", () => this.#buildAppMeta()
|
|
75
|
-
spinner
|
|
76
|
-
});
|
|
66
|
+
await this.#runPhase("typecheck", "Typechecking", () => this.typecheck());
|
|
67
|
+
await this.#runPhase("backend", "Compiling backend", () => this.#buildBackend(), (result) => `${result.entrypoints} entrypoints, ${result.outputs} outputs`);
|
|
68
|
+
await this.#runPhase("ssr", "Building SSR route artifacts", async () => web.ssr ? await this.#buildSsr() : null, (result) => result ? `${result.allRoutes.manifest.routeIds.length} routes, ${result.allRoutes.manifest.knownEntries.length} entries` : web.ssr ? "skipped" : "disabled by akan.config.ts web.ssr");
|
|
69
|
+
await this.#runPhase("csr", "Building CSR assets", async () => web.csr ? await new CsrArtifactBuilder(this.#app, "build").build() : null, (result) => result?.outputDir ?? (web.csr ? "skipped" : "disabled by akan.config.ts web.csr"));
|
|
70
|
+
await this.#runPhase("assets", "Trimming unread static assets", async () => assets.pruneFonts ? await new FontPruner(this.#app, assets).prune() : null, (result) => result ? `${result.removed.length} font file(s) dropped, ${ApplicationBuildRunner.formatBytes(result.freedBytes)} freed; ${result.kept.length} kept` : "disabled by akan.config.ts assets.pruneFonts");
|
|
71
|
+
await this.#runPhase("compress", "Compressing static assets", () => precompressArtifacts(this.#app), (result) => result.files > 0 ? `${result.files} files, ${ApplicationBuildRunner.formatBytes(result.inputBytes)} -> gzip ${ApplicationBuildRunner.formatBytes(result.outputBytes)} / br ${ApplicationBuildRunner.formatBytes(result.brotliBytes)}` : "no files");
|
|
72
|
+
await this.#runPhase("metadata", "Writing production metadata", () => this.#buildAppMeta());
|
|
77
73
|
return {
|
|
78
74
|
phases: this.#phases,
|
|
79
75
|
durationMs: Date.now() - this.#startedAt,
|
|
@@ -84,21 +80,20 @@ class ApplicationBuildRunner {
|
|
|
84
80
|
async typecheck(options = {}) {
|
|
85
81
|
const { clean = false, incremental = true } = options;
|
|
86
82
|
await this.#app.getPageKeys({ refresh: true });
|
|
87
|
-
const { typecheckDir, tsconfigPath } = await this.#writeTypecheckTsconfig(
|
|
83
|
+
const { typecheckDir, tsconfigPath } = await this.#writeTypecheckTsconfig(incremental);
|
|
88
84
|
if (clean)
|
|
89
85
|
await rm(path.join(typecheckDir, "tsconfig.tsbuildinfo"), { force: true });
|
|
90
86
|
await this.#checkProjectInChildProcess(tsconfigPath);
|
|
91
87
|
}
|
|
92
|
-
async#runPhase(id, label, task, summarize
|
|
88
|
+
async#runPhase(id, label, task, summarize) {
|
|
93
89
|
this.#reporter?.phaseStart?.({ id, label });
|
|
94
90
|
const phaseStartedAt = Date.now();
|
|
95
|
-
const spinner =
|
|
91
|
+
const spinner = this.#spinner ? new Spinner(label, { prefix: `${BUILD_PHASE_EMOJIS[id]} ${id}` }).start() : undefined;
|
|
96
92
|
try {
|
|
97
93
|
const result = await task();
|
|
98
94
|
const phase = { id, label, durationMs: Date.now() - phaseStartedAt, summary: summarize?.(result) };
|
|
99
95
|
this.#phases.push(phase);
|
|
100
|
-
|
|
101
|
-
spinner?.succeed(`${label}${summary}`);
|
|
96
|
+
spinner?.succeed(`${label}${phase.summary ? `: ${phase.summary}` : ""}`);
|
|
102
97
|
this.#reporter?.phaseDone?.(phase);
|
|
103
98
|
return result;
|
|
104
99
|
} catch (error) {
|
|
@@ -135,51 +130,39 @@ class ApplicationBuildRunner {
|
|
|
135
130
|
return `${sha.stdout.toString().trim()}${suffix}`;
|
|
136
131
|
}
|
|
137
132
|
async#buildBackend() {
|
|
138
|
-
const
|
|
139
|
-
const backendExternals = [
|
|
140
|
-
...new Set([...akanConfig.externalLibs, ...SSR_RENDER_EXTERNALS, ...AKAN_OPTIONAL_BACKEND_EXTERNALS])
|
|
141
|
-
];
|
|
142
|
-
const { web } = akanConfig;
|
|
133
|
+
const { externalLibs, web } = await this.#app.getConfig();
|
|
143
134
|
const backendEntryPoints = [`${this.#app.cwdPath}/main.ts`, `${this.#app.cwdPath}/server.ts`];
|
|
144
135
|
for (const entrypoint of backendEntryPoints) {
|
|
145
136
|
if (!await Bun.file(entrypoint).exists())
|
|
146
137
|
throw new Error(`Backend entrypoint not found: ${entrypoint}`);
|
|
147
138
|
}
|
|
148
|
-
const
|
|
139
|
+
const sharedConfig = {
|
|
149
140
|
outdir: this.#app.dist.cwdPath,
|
|
150
141
|
target: "bun",
|
|
151
142
|
minify: AKAN_BACKEND_MINIFY,
|
|
152
143
|
naming: { entry: "[name].[ext]", chunk: "chunk-[hash].[ext]" },
|
|
153
|
-
define: { "process.env.NODE_ENV": JSON.stringify("production") }
|
|
154
|
-
plugins: backendExternals.length > 0 ? [this.#createExternalSpecifiersPlugin(backendExternals)] : []
|
|
144
|
+
define: { "process.env.NODE_ENV": JSON.stringify("production") }
|
|
155
145
|
};
|
|
146
|
+
const backendConfig = { ...sharedConfig, plugins: [this.#createExternalSpecifiersPlugin(externalLibs)] };
|
|
156
147
|
const [mainResult, serverResult] = [
|
|
157
148
|
await this.#buildOrThrow("backend", { ...backendConfig, entrypoints: [backendEntryPoints[0]] }),
|
|
158
149
|
await this.#buildOrThrow("backend", { ...backendConfig, entrypoints: [backendEntryPoints[1]], splitting: true })
|
|
159
150
|
];
|
|
160
|
-
const backendResult = { outputs: [...mainResult.outputs, ...serverResult.outputs] };
|
|
161
151
|
const rscWorkerResult = web.ssr ? await this.#buildOrThrow("rsc-worker", {
|
|
152
|
+
...backendConfig,
|
|
162
153
|
entrypoints: [this.#resolveRscWorkerBuildEntry()],
|
|
163
|
-
|
|
164
|
-
target: "bun",
|
|
165
|
-
minify: AKAN_BACKEND_MINIFY,
|
|
166
|
-
naming: { entry: "[name].[ext]", chunk: "chunk-[hash].[ext]" },
|
|
167
|
-
conditions: ["react-server"],
|
|
168
|
-
define: { "process.env.NODE_ENV": JSON.stringify("production") },
|
|
169
|
-
plugins: backendExternals.length > 0 ? [this.#createExternalSpecifiersPlugin(backendExternals)] : []
|
|
154
|
+
conditions: ["react-server"]
|
|
170
155
|
}) : null;
|
|
171
156
|
const consoleRuntimeResult = await this.#buildOrThrow("console-runtime", {
|
|
157
|
+
...sharedConfig,
|
|
172
158
|
entrypoints: [this.#resolveConsoleRuntimeBuildEntry()],
|
|
173
|
-
|
|
174
|
-
target: "bun",
|
|
175
|
-
minify: AKAN_BACKEND_MINIFY,
|
|
176
|
-
naming: { entry: "console-runtime.[ext]", chunk: "chunk-[hash].[ext]" },
|
|
177
|
-
define: { "process.env.NODE_ENV": JSON.stringify("production") }
|
|
159
|
+
naming: { entry: "console-runtime.[ext]", chunk: "chunk-[hash].[ext]" }
|
|
178
160
|
});
|
|
179
161
|
await this.#writeConsoleShim();
|
|
162
|
+
const results = [mainResult, serverResult, rscWorkerResult, consoleRuntimeResult];
|
|
180
163
|
return {
|
|
181
164
|
entrypoints: backendEntryPoints.length + (rscWorkerResult ? 2 : 1),
|
|
182
|
-
outputs:
|
|
165
|
+
outputs: results.reduce((sum, result) => sum + (result?.outputs.length ?? 0), 1)
|
|
183
166
|
};
|
|
184
167
|
}
|
|
185
168
|
async#writeConsoleShim() {
|
|
@@ -217,9 +200,6 @@ void run().catch((error) => {
|
|
|
217
200
|
return path.join(this.#app.workspace.workspaceRoot, "pkgs/akanjs/server/console.ts");
|
|
218
201
|
}
|
|
219
202
|
}
|
|
220
|
-
async#buildCsr() {
|
|
221
|
-
return await new CsrArtifactBuilder(this.#app, "build").build();
|
|
222
|
-
}
|
|
223
203
|
async#buildSsr() {
|
|
224
204
|
const pageKeys = await this.#app.getPageKeys();
|
|
225
205
|
if (pageKeys.length === 0) {
|
|
@@ -230,7 +210,7 @@ void run().catch((error) => {
|
|
|
230
210
|
const allRoutes = await new AllRoutesBuilder(this.#app, base.artifact, "build").build();
|
|
231
211
|
return { base, allRoutes };
|
|
232
212
|
}
|
|
233
|
-
async#writeTypecheckTsconfig(
|
|
213
|
+
async#writeTypecheckTsconfig(incremental) {
|
|
234
214
|
const typecheckDir = path.join(this.#app.cwdPath, ".akan", "typecheck");
|
|
235
215
|
await mkdir(typecheckDir, { recursive: true });
|
|
236
216
|
const libPageIncludes = (await this.#app.getPageRoots()).filter((root) => root.keyPrefix).flatMap((root) => {
|
|
@@ -297,9 +277,9 @@ void run().catch((error) => {
|
|
|
297
277
|
throw new AggregateError(result.logs, `[${label}] Bun.build failed`);
|
|
298
278
|
return result;
|
|
299
279
|
}
|
|
300
|
-
#createExternalSpecifiersPlugin(
|
|
301
|
-
const
|
|
302
|
-
const escaped =
|
|
280
|
+
#createExternalSpecifiersPlugin(externalLibs) {
|
|
281
|
+
const specifiers = new Set([...externalLibs, ...SSR_RENDER_EXTERNALS, ...AKAN_OPTIONAL_BACKEND_EXTERNALS]);
|
|
282
|
+
const escaped = [...specifiers].map((specifier) => specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
303
283
|
const filter = new RegExp(`^(${escaped.join("|")})(?:/.*)?$`);
|
|
304
284
|
return {
|
|
305
285
|
name: "akan-backend-externalize-specifiers",
|
|
@@ -308,13 +288,7 @@ void run().catch((error) => {
|
|
|
308
288
|
}
|
|
309
289
|
};
|
|
310
290
|
}
|
|
311
|
-
static formatBytes
|
|
312
|
-
if (bytes < 1024)
|
|
313
|
-
return `${bytes}B`;
|
|
314
|
-
if (bytes < 1024 * 1024)
|
|
315
|
-
return `${(bytes / 1024).toFixed(1)}KB`;
|
|
316
|
-
return `${(bytes / 1024 / 1024).toFixed(1)}MB`;
|
|
317
|
-
}
|
|
291
|
+
static formatBytes = FontPruner.formatBytes;
|
|
318
292
|
}
|
|
319
293
|
export {
|
|
320
294
|
ApplicationBuildRunner
|