@akanjs/cli 3.0.0-alpha.98 → 3.0.0-beta.0
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/{abstractCompactor-cefxzggj.js → abstractCompactor-mjh5ppsq.js} +1 -1
- package/{agent.command-r93wmq7m.js → agent.command-d2gfxfck.js} +5 -5
- package/{application.command-c4zsbmjj.js → application.command-pj2m7584.js} +9 -6
- package/{applicationBuildRunner-nqvj15x7.js → applicationBuildRunner-kxwbssgn.js} +2 -2
- package/{applicationReleasePackager-3wh58n2m.js → applicationReleasePackager-4yasxwv9.js} +1 -1
- package/buildBatch.proc.js +2 -2
- package/{capacitorApp-gzcx6txb.js → capacitorApp-36rbr858.js} +2 -2
- package/{cloud.command-me9e9dwb.js → cloud.command-jshwdq22.js} +9 -9
- package/{context.command-qd8kqrnh.js → context.command-ez8a0zyz.js} +13 -13
- package/{devTui-jbn7cjfg.js → devTui-40ggmd99.js} +85 -84
- package/{devTuiView-2jffndk4.js → devTuiView-c08ccbat.js} +1 -1
- package/{guideline.command-f38x8jhw.js → guideline.command-xmqwx8zm.js} +11 -7
- package/guidelines/agentRule/agentRule.instruction.md +92 -28
- package/guidelines/conventions/conventions.instruction.md +105 -43
- package/guidelines/mcpRule/mcpRule.generate.json +11 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +296 -53
- package/guidelines/queryRule/queryRule.instruction.md +17 -9
- package/guidelines/runtimeRule/runtimeRule.instruction.md +7 -0
- package/guidelines/ssrRule/ssrRule.instruction.md +15 -13
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +10 -5
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +68 -3
- package/incrementalBuilder.proc.js +1 -1
- package/{index-zkvpaggp.js → index-259dsnz3.js} +2 -2
- package/{index-vp0509kc.js → index-2hq52jq3.js} +9 -7
- package/{index-q8sn827n.js → index-2tv3fdx4.js} +27 -12
- package/{index-3vvbv974.js → index-4edzf1gr.js} +4 -4
- package/{index-r50qen0z.js → index-600zhnve.js} +10 -10
- package/{index-h759vjfa.js → index-7737gxcp.js} +3 -3
- package/{index-9bwhxrqf.js → index-8pm30m73.js} +5 -5
- package/{index-jydtyzva.js → index-a64esmtb.js} +54 -9
- package/{index-y74k5anj.js → index-fz5q3gd7.js} +3 -3
- package/{index-e82dyeqy.js → index-gyd220p2.js} +1 -1
- package/{index-pvb4vdwr.js → index-j9yhg404.js} +1 -1
- package/{index-n85fer99.js → index-kn1h7p1x.js} +1 -1
- package/{index-0emb9eat.js → index-ktb5njgy.js} +2 -2
- package/{index-cezy7yb3.js → index-mak3cd28.js} +1 -1
- package/{index-rntcdss1.js → index-ne2qy0nk.js} +3 -3
- package/{index-mpmyqm1y.js → index-pnqbkf5p.js} +1 -1
- package/{index-5xdqxbn9.js → index-rwg2aa4f.js} +3 -3
- package/{index-8qcydz5h.js → index-v0qh106m.js} +257 -14
- package/{index-sjak5v5b.js → index-ws5e0j51.js} +2 -2
- package/{index-pgsswppj.js → index-wt7qrtd4.js} +1 -1
- package/{index-4ravxy65.js → index-zry5nz81.js} +6 -6
- package/index.js +19 -19
- package/{library.command-em103wtn.js → library.command-nbsky672.js} +3 -3
- package/{localRegistry.command-81acqng9.js → localRegistry.command-yeq57wjr.js} +8 -8
- package/{module.command-451pztkc.js → module.command-29vqzrh8.js} +6 -6
- package/{package.command-rfhyf38t.js → package.command-axv0abmn.js} +3 -3
- package/package.json +2 -2
- package/{page.command-kt19da5g.js → page.command-vs9s3zrh.js} +3 -3
- package/{primitive.command-pgy69ere.js → primitive.command-cbxmqbtc.js} +7 -7
- package/{quality.command-gpe2vqb5.js → quality.command-gmbs7nws.js} +2 -2
- package/{repair.command-2sbrz187.js → repair.command-bqsjptsj.js} +5 -5
- package/{routeSourceValidator-ze6x894c.js → routeSourceValidator-apyqw7wk.js} +90 -17
- package/{scalar.command-jcf4e5sv.js → scalar.command-6k1vhe9s.js} +5 -5
- package/{subspace.command-kqzqtk0p.js → subspace.command-fwjfcts7.js} +7 -5
- package/templates/app/page/_index.tsx +3 -3
- package/templates/app/page/_layout.tsx +31 -32
- package/templates/appSample/page/task/[taskId]/_index.tsx +22 -27
- package/templates/appSample/page/task/[taskId]/edit.tsx +25 -30
- package/templates/appSample/page/task/_index.tsx +3 -7
- package/templates/appSample/page/task/_layout.tsx +4 -15
- package/templates/appSample/page/task/new.tsx +4 -10
- package/templates/crudPages/[__model__Id]/edit/page.tsx +26 -28
- package/templates/crudPages/[__model__Id]/page.tsx +20 -25
- package/templates/crudPages/new/page.tsx +24 -23
- package/templates/crudPages/page.tsx +25 -24
- package/templates/crudSinglePage/page.tsx +25 -24
- package/templates/lib/sig.ts +4 -0
- package/{workflow.command-m4z25a2p.js → workflow.command-nwpcdc8p.js} +10 -10
- package/{workspace.command-t2v12ewm.js → workspace.command-8s050m0h.js} +20 -20
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-mak3cd28.js";
|
|
6
6
|
import {
|
|
7
7
|
WorkspaceExecutor,
|
|
8
8
|
AppExecutor,
|
|
9
9
|
LibExecutor,
|
|
10
10
|
PkgExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-2tv3fdx4.js";
|
|
12
12
|
import {
|
|
13
13
|
LibraryScript
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-259dsnz3.js";
|
|
15
15
|
import {
|
|
16
16
|
HmrWatcher,
|
|
17
17
|
WatchRootResolver
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
SlicePlanner,
|
|
21
21
|
formatSlicePlan
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-j9yhg404.js";
|
|
23
23
|
import {
|
|
24
24
|
resolveMobileTargets
|
|
25
25
|
} from "./index-47pj3aee.js";
|
|
@@ -34,6 +34,91 @@ function openBrowser(url) {
|
|
|
34
34
|
return Promise.resolve();
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
// pkgs/@akanjs/cli/application/devLogBuffer.ts
|
|
38
|
+
var ansi = new RegExp(`${String.fromCharCode(27)}(?:[@-Z\\\\-_]|\\[[\\s\\S]*?[@-~])`, "g");
|
|
39
|
+
var stripAnsi = (text) => text.replace(ansi, "");
|
|
40
|
+
var plainTextOf = (lines, { withApp = false } = {}) => {
|
|
41
|
+
const width = withApp ? lines.reduce((max, line) => Math.max(max, line.app.length), 0) : 0;
|
|
42
|
+
return lines.map((line) => `${withApp ? `${line.app.padEnd(width)} \u2502 ` : ""}${stripAnsi(line.text)}`).join(`
|
|
43
|
+
`);
|
|
44
|
+
};
|
|
45
|
+
var HOST_SOURCE = "host";
|
|
46
|
+
var childPrefix = /^\[child:(\d+) ([a-z-]+)\] \[(?:stdout|stderr)\] /;
|
|
47
|
+
var sourceOf = (text) => {
|
|
48
|
+
const match = childPrefix.exec(text);
|
|
49
|
+
return match ? `#${match[1]} ${match[2]}` : HOST_SOURCE;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
class DevLogBuffer {
|
|
53
|
+
static defaultLimit = 5000;
|
|
54
|
+
#limit;
|
|
55
|
+
#lines = [];
|
|
56
|
+
#partial = new Map;
|
|
57
|
+
#sources = new Map;
|
|
58
|
+
#seq = 0;
|
|
59
|
+
constructor({ limit = DevLogBuffer.defaultLimit } = {}) {
|
|
60
|
+
this.#limit = Math.max(1, limit);
|
|
61
|
+
}
|
|
62
|
+
get size() {
|
|
63
|
+
return this.#lines.length;
|
|
64
|
+
}
|
|
65
|
+
sourcesOf(app) {
|
|
66
|
+
return [...this.#sources.get(app) ?? []];
|
|
67
|
+
}
|
|
68
|
+
push(app, kind, chunk) {
|
|
69
|
+
const key = `${app}:${kind}`;
|
|
70
|
+
const parts = `${this.#partial.get(key) ?? ""}${chunk}`.split(`
|
|
71
|
+
`);
|
|
72
|
+
this.#partial.set(key, parts.pop() ?? "");
|
|
73
|
+
return this.#append(app, kind, parts);
|
|
74
|
+
}
|
|
75
|
+
flushPartials() {
|
|
76
|
+
const flushed = [];
|
|
77
|
+
for (const [key, remainder] of [...this.#partial]) {
|
|
78
|
+
this.#partial.set(key, "");
|
|
79
|
+
if (!remainder)
|
|
80
|
+
continue;
|
|
81
|
+
const split = key.lastIndexOf(":");
|
|
82
|
+
const app = key.slice(0, split);
|
|
83
|
+
const kind = key.slice(split + 1) === "stderr" ? "stderr" : "stdout";
|
|
84
|
+
flushed.push(...this.#append(app, kind, [remainder]));
|
|
85
|
+
}
|
|
86
|
+
return flushed;
|
|
87
|
+
}
|
|
88
|
+
select({ app = null, source = null, grep, errorsOnly = false } = {}) {
|
|
89
|
+
const needle = grep?.trim().toLowerCase();
|
|
90
|
+
return this.#lines.filter((line) => {
|
|
91
|
+
if (app !== null && line.app !== app)
|
|
92
|
+
return false;
|
|
93
|
+
if (source !== null && line.source !== source)
|
|
94
|
+
return false;
|
|
95
|
+
if (errorsOnly && line.kind !== "stderr")
|
|
96
|
+
return false;
|
|
97
|
+
if (needle && !stripAnsi(line.text).toLowerCase().includes(needle))
|
|
98
|
+
return false;
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
clear(app = null) {
|
|
103
|
+
const kept = app === null ? [] : this.#lines.filter((line) => line.app !== app);
|
|
104
|
+
this.#lines.length = 0;
|
|
105
|
+
this.#lines.push(...kept);
|
|
106
|
+
}
|
|
107
|
+
#append(app, kind, texts) {
|
|
108
|
+
const known = this.#sources.get(app) ?? new Set;
|
|
109
|
+
this.#sources.set(app, known);
|
|
110
|
+
const added = texts.map((text) => {
|
|
111
|
+
const source = sourceOf(text);
|
|
112
|
+
known.add(source);
|
|
113
|
+
return { seq: ++this.#seq, app, source, kind, text };
|
|
114
|
+
});
|
|
115
|
+
this.#lines.push(...added);
|
|
116
|
+
if (this.#lines.length > this.#limit)
|
|
117
|
+
this.#lines.splice(0, this.#lines.length - this.#limit);
|
|
118
|
+
return added;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
37
122
|
// pkgs/@akanjs/devkit/applicationBuildReporter.ts
|
|
38
123
|
import { Logger } from "akanjs/common";
|
|
39
124
|
|
|
@@ -1964,10 +2049,10 @@ ${uniqueCandidates.map((candidate) => ` - ${candidate}`).join(`
|
|
|
1964
2049
|
// pkgs/@akanjs/cli/application/application.runner.ts
|
|
1965
2050
|
import { Logger as Logger4 } from "akanjs/common";
|
|
1966
2051
|
import ora from "ora";
|
|
1967
|
-
var loadBuildRunner = async () => (await import("./applicationBuildRunner-
|
|
1968
|
-
var loadReleasePackager = async () => (await import("./applicationReleasePackager-
|
|
1969
|
-
var loadCapacitorApp = async () => (await import("./capacitorApp-
|
|
1970
|
-
var loadAbstractCompactor = async () => (await import("./abstractCompactor-
|
|
2052
|
+
var loadBuildRunner = async () => (await import("./applicationBuildRunner-kxwbssgn.js")).ApplicationBuildRunner;
|
|
2053
|
+
var loadReleasePackager = async () => (await import("./applicationReleasePackager-4yasxwv9.js")).ApplicationReleasePackager;
|
|
2054
|
+
var loadCapacitorApp = async () => (await import("./capacitorApp-36rbr858.js")).CapacitorApp;
|
|
2055
|
+
var loadAbstractCompactor = async () => (await import("./abstractCompactor-mjh5ppsq.js")).AbstractCompactor;
|
|
1971
2056
|
var loadPrompts = async () => await import("@inquirer/prompts");
|
|
1972
2057
|
|
|
1973
2058
|
class ApplicationRunner extends runner("application") {
|
|
@@ -2566,6 +2651,145 @@ class DevStreamView {
|
|
|
2566
2651
|
}
|
|
2567
2652
|
}
|
|
2568
2653
|
|
|
2654
|
+
// pkgs/@akanjs/cli/application/devBootConcurrency.ts
|
|
2655
|
+
import os from "os";
|
|
2656
|
+
import { MemoryLimit as MemoryLimit2 } from "akanjs/server/memoryLimit";
|
|
2657
|
+
|
|
2658
|
+
class DevBootConcurrency {
|
|
2659
|
+
static perAppBytes = 900 * 1024 * 1024;
|
|
2660
|
+
static memoryShare = 0.5;
|
|
2661
|
+
static coresPerApp = 4;
|
|
2662
|
+
static budget() {
|
|
2663
|
+
const hostBytes = os.totalmem();
|
|
2664
|
+
const declaredBytes = MemoryLimit2.parseBytesEnv("AKAN_MEMORY_LIMIT") ?? MemoryLimit2.readCgroupBytes();
|
|
2665
|
+
return { memoryBytes: Math.min(hostBytes, declaredBytes ?? hostBytes), cores: os.availableParallelism() };
|
|
2666
|
+
}
|
|
2667
|
+
static resolve(appCount, requested, budget = DevBootConcurrency.budget()) {
|
|
2668
|
+
const apps = Math.max(1, Math.trunc(appCount));
|
|
2669
|
+
if (requested !== null && Number.isFinite(requested)) {
|
|
2670
|
+
const asked = Math.max(1, Math.trunc(requested));
|
|
2671
|
+
return { concurrency: Math.min(apps, asked), reason: `--concurrency ${asked}` };
|
|
2672
|
+
}
|
|
2673
|
+
const byMemory = Math.floor(budget.memoryBytes * DevBootConcurrency.memoryShare / DevBootConcurrency.perAppBytes);
|
|
2674
|
+
const byCores = Math.floor(budget.cores / DevBootConcurrency.coresPerApp);
|
|
2675
|
+
return {
|
|
2676
|
+
concurrency: Math.max(1, Math.min(apps, byMemory, byCores)),
|
|
2677
|
+
reason: `${budget.cores} cores, ${DevBootConcurrency.#formatBytes(budget.memoryBytes)} memory`
|
|
2678
|
+
};
|
|
2679
|
+
}
|
|
2680
|
+
static describe(appCount, plan) {
|
|
2681
|
+
if (plan.concurrency >= appCount)
|
|
2682
|
+
return `booting all ${appCount} apps at once (${plan.reason})`;
|
|
2683
|
+
return `booting ${plan.concurrency} of ${appCount} apps at a time (${plan.reason}) \u2014 --concurrency raises it`;
|
|
2684
|
+
}
|
|
2685
|
+
static #formatBytes(bytes) {
|
|
2686
|
+
const gigabytes = bytes / 1024 ** 3;
|
|
2687
|
+
return gigabytes >= 10 ? `${Math.round(gigabytes)}GB` : `${gigabytes.toFixed(1)}GB`;
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
// pkgs/@akanjs/cli/application/devSessionLog.ts
|
|
2692
|
+
import { mkdir, rename } from "fs/promises";
|
|
2693
|
+
import path6 from "path";
|
|
2694
|
+
import dayjs from "dayjs";
|
|
2695
|
+
class DevSessionLog {
|
|
2696
|
+
static fileName = "dev.log";
|
|
2697
|
+
static previousFileName = "dev.prev.log";
|
|
2698
|
+
static flushMs = 200;
|
|
2699
|
+
static bufferBytes = 64 * 1024;
|
|
2700
|
+
#workspaceRoot;
|
|
2701
|
+
#appNames;
|
|
2702
|
+
#now;
|
|
2703
|
+
#writers = new Map;
|
|
2704
|
+
#partial = new Map;
|
|
2705
|
+
#lastState = new Map;
|
|
2706
|
+
#flushTimer = null;
|
|
2707
|
+
constructor({ workspaceRoot, apps, now = () => new Date }) {
|
|
2708
|
+
this.#workspaceRoot = workspaceRoot;
|
|
2709
|
+
this.#appNames = [...apps];
|
|
2710
|
+
this.#now = now;
|
|
2711
|
+
}
|
|
2712
|
+
get appNames() {
|
|
2713
|
+
return [...this.#appNames];
|
|
2714
|
+
}
|
|
2715
|
+
pathOf(app) {
|
|
2716
|
+
return path6.join(this.#runtimeDirOf(app), DevSessionLog.fileName);
|
|
2717
|
+
}
|
|
2718
|
+
previousPathOf(app) {
|
|
2719
|
+
return path6.join(this.#runtimeDirOf(app), DevSessionLog.previousFileName);
|
|
2720
|
+
}
|
|
2721
|
+
relativePathOf(app) {
|
|
2722
|
+
return path6.relative(this.#workspaceRoot, this.pathOf(app));
|
|
2723
|
+
}
|
|
2724
|
+
async open() {
|
|
2725
|
+
const stamp = dayjs(this.#now()).format("YYYY-MM-DD HH:mm:ss");
|
|
2726
|
+
for (const app of this.#appNames) {
|
|
2727
|
+
const file = this.pathOf(app);
|
|
2728
|
+
await mkdir(path6.dirname(file), { recursive: true });
|
|
2729
|
+
await rename(file, this.previousPathOf(app)).catch(() => {
|
|
2730
|
+
return;
|
|
2731
|
+
});
|
|
2732
|
+
this.#writers.set(app, Bun.file(file).writer({ highWaterMark: DevSessionLog.bufferBytes }));
|
|
2733
|
+
this.#writeLine(app, `\u2500\u2500 akan start \xB7 ${app} \xB7 ${stamp} \u2500\u2500`);
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
write(app, kind, chunk) {
|
|
2737
|
+
const key = `${app}:${kind}`;
|
|
2738
|
+
const parts = `${this.#partial.get(key) ?? ""}${chunk}`.split(`
|
|
2739
|
+
`);
|
|
2740
|
+
this.#partial.set(key, parts.pop() ?? "");
|
|
2741
|
+
for (const line of parts)
|
|
2742
|
+
this.#writeLine(app, stripAnsi(line));
|
|
2743
|
+
}
|
|
2744
|
+
note(text) {
|
|
2745
|
+
for (const app of this.#appNames)
|
|
2746
|
+
this.#writeLine(app, `[akan] ${text}`);
|
|
2747
|
+
}
|
|
2748
|
+
status(statuses) {
|
|
2749
|
+
for (const status of statuses) {
|
|
2750
|
+
if (this.#lastState.get(status.name) === status.state)
|
|
2751
|
+
continue;
|
|
2752
|
+
this.#lastState.set(status.name, status.state);
|
|
2753
|
+
const detail = status.detail ? ` (${status.detail})` : "";
|
|
2754
|
+
const where = status.state === "ready" ? ` \u2014 ${status.url}` : "";
|
|
2755
|
+
this.#writeLine(status.name, `[akan] ${status.name} ${status.state}${detail}${where}`);
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
async close() {
|
|
2759
|
+
for (const [key, remainder] of this.#partial) {
|
|
2760
|
+
if (!remainder)
|
|
2761
|
+
continue;
|
|
2762
|
+
this.#writeLine(key.slice(0, key.lastIndexOf(":")), stripAnsi(remainder));
|
|
2763
|
+
}
|
|
2764
|
+
this.#partial.clear();
|
|
2765
|
+
if (this.#flushTimer)
|
|
2766
|
+
clearTimeout(this.#flushTimer);
|
|
2767
|
+
this.#flushTimer = null;
|
|
2768
|
+
await Promise.all([...this.#writers.values()].map(async (writer) => await writer.end()));
|
|
2769
|
+
this.#writers.clear();
|
|
2770
|
+
}
|
|
2771
|
+
#runtimeDirOf(app) {
|
|
2772
|
+
return path6.join(this.#workspaceRoot, "local", "apps", app, "runtime");
|
|
2773
|
+
}
|
|
2774
|
+
#writeLine(app, text) {
|
|
2775
|
+
const writer = this.#writers.get(app);
|
|
2776
|
+
if (!writer)
|
|
2777
|
+
return;
|
|
2778
|
+
writer.write(`${text}
|
|
2779
|
+
`);
|
|
2780
|
+
this.#scheduleFlush();
|
|
2781
|
+
}
|
|
2782
|
+
#scheduleFlush() {
|
|
2783
|
+
if (this.#flushTimer)
|
|
2784
|
+
return;
|
|
2785
|
+
this.#flushTimer = setTimeout(() => {
|
|
2786
|
+
this.#flushTimer = null;
|
|
2787
|
+
for (const writer of this.#writers.values())
|
|
2788
|
+
writer.flush();
|
|
2789
|
+
}, DevSessionLog.flushMs);
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2569
2793
|
// pkgs/@akanjs/cli/application/devSupervisor.ts
|
|
2570
2794
|
class DevSupervisor {
|
|
2571
2795
|
static supervisedEnvKey = "AKAN_DEV_SUPERVISED";
|
|
@@ -2586,25 +2810,37 @@ class DevSupervisor {
|
|
|
2586
2810
|
static shutdownGraceMs = 12000;
|
|
2587
2811
|
#options;
|
|
2588
2812
|
#children = new Map;
|
|
2813
|
+
#sessionLog;
|
|
2589
2814
|
#view = null;
|
|
2590
2815
|
#stopping = false;
|
|
2591
2816
|
constructor(options) {
|
|
2592
2817
|
this.#options = options;
|
|
2818
|
+
this.#sessionLog = new DevSessionLog({
|
|
2819
|
+
workspaceRoot: options.apps[0]?.workspace.workspaceRoot ?? process.cwd(),
|
|
2820
|
+
apps: options.apps.map((app) => app.name)
|
|
2821
|
+
});
|
|
2593
2822
|
}
|
|
2594
2823
|
get statuses() {
|
|
2595
2824
|
return [...this.#children.values()].map((child) => child.status);
|
|
2596
2825
|
}
|
|
2826
|
+
get sessionLog() {
|
|
2827
|
+
return this.#sessionLog;
|
|
2828
|
+
}
|
|
2597
2829
|
async run(view) {
|
|
2598
2830
|
this.#view = view;
|
|
2831
|
+
await this.#sessionLog.open();
|
|
2599
2832
|
const ports = await this.#assignPorts();
|
|
2600
2833
|
for (const app of this.#options.apps)
|
|
2601
2834
|
this.#children.set(app.name, this.#makeChild(app, ports.get(app.name) ?? 0));
|
|
2602
2835
|
this.#publishStatus();
|
|
2836
|
+
const logPaths = this.#sessionLog.appNames.map((name) => this.#sessionLog.relativePathOf(name));
|
|
2837
|
+
this.#note(`session log: ${logPaths.join(" \xB7 ")}`, "info");
|
|
2603
2838
|
const stopped = this.#installSignalHandlers();
|
|
2604
2839
|
this.#bootInOrder();
|
|
2605
2840
|
await Promise.race([view.waitForExit(), stopped]);
|
|
2606
2841
|
await this.stop();
|
|
2607
2842
|
view.close?.();
|
|
2843
|
+
await this.#sessionLog.close();
|
|
2608
2844
|
}
|
|
2609
2845
|
async#assignPorts() {
|
|
2610
2846
|
const taken = new Set;
|
|
@@ -2640,8 +2876,11 @@ class DevSupervisor {
|
|
|
2640
2876
|
};
|
|
2641
2877
|
}
|
|
2642
2878
|
async#bootInOrder() {
|
|
2643
|
-
const concurrency = Math.max(1, Math.trunc(this.#options.concurrency ?? 1));
|
|
2644
2879
|
const queue = [...this.#children.values()];
|
|
2880
|
+
const plan = DevBootConcurrency.resolve(queue.length, this.#options.concurrency ?? null);
|
|
2881
|
+
const concurrency = plan.concurrency;
|
|
2882
|
+
if (queue.length > 1)
|
|
2883
|
+
this.#note(DevBootConcurrency.describe(queue.length, plan), "info");
|
|
2645
2884
|
const waves = [];
|
|
2646
2885
|
for (let idx = 0;idx < queue.length; idx += concurrency)
|
|
2647
2886
|
waves.push(queue.slice(idx, idx + concurrency));
|
|
@@ -2732,16 +2971,20 @@ class DevSupervisor {
|
|
|
2732
2971
|
try {
|
|
2733
2972
|
for await (const chunk of stream) {
|
|
2734
2973
|
const text = decoder.decode(chunk, { stream: true });
|
|
2735
|
-
if (text)
|
|
2736
|
-
|
|
2974
|
+
if (!text)
|
|
2975
|
+
continue;
|
|
2976
|
+
this.#view?.onOutput(name, kind, text);
|
|
2977
|
+
this.#sessionLog.write(name, kind, text);
|
|
2737
2978
|
}
|
|
2738
2979
|
} catch {}
|
|
2739
2980
|
}
|
|
2740
2981
|
#publishStatus() {
|
|
2741
2982
|
this.#view?.onStatus(this.statuses);
|
|
2983
|
+
this.#sessionLog.status(this.statuses);
|
|
2742
2984
|
}
|
|
2743
2985
|
#note(text, level) {
|
|
2744
2986
|
this.#view?.onNote(text, level);
|
|
2987
|
+
this.#sessionLog.note(text);
|
|
2745
2988
|
}
|
|
2746
2989
|
#installSignalHandlers() {
|
|
2747
2990
|
return new Promise((resolve) => {
|
|
@@ -2987,7 +3230,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
2987
3230
|
}
|
|
2988
3231
|
await this.applicationRunner.test(exec);
|
|
2989
3232
|
}
|
|
2990
|
-
async start(apps, { open = false, dbup = true, write = true, plain = false, kill = false, concurrency =
|
|
3233
|
+
async start(apps, { open = false, dbup = true, write = true, plain = false, kill = false, concurrency = null } = {}) {
|
|
2991
3234
|
const first = apps[0];
|
|
2992
3235
|
if (!first)
|
|
2993
3236
|
throw new Error("No app selected to start");
|
|
@@ -3040,7 +3283,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
3040
3283
|
throw new Error("No app selected to start");
|
|
3041
3284
|
const startedDatabase = dbup ? await this.#prepareSharedDatabase(apps) : false;
|
|
3042
3285
|
const supervisor = new DevSupervisor({ apps, mode, concurrency, open, write });
|
|
3043
|
-
const view = mode === "tui" ? await (await import("./devTuiView-
|
|
3286
|
+
const view = mode === "tui" ? await (await import("./devTuiView-c08ccbat.js")).createDevTuiView(supervisor) : new DevStreamView(apps.map((app) => app.name));
|
|
3044
3287
|
await supervisor.run(view);
|
|
3045
3288
|
if (startedDatabase)
|
|
3046
3289
|
await this.#stopDatabase(workspace);
|
|
@@ -3188,4 +3431,4 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
3188
3431
|
}
|
|
3189
3432
|
}
|
|
3190
3433
|
|
|
3191
|
-
export { openBrowser, ApplicationScript };
|
|
3434
|
+
export { openBrowser, plainTextOf, HOST_SOURCE, DevLogBuffer, ApplicationScript };
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-mak3cd28.js";
|
|
6
6
|
import {
|
|
7
7
|
FileSys
|
|
8
8
|
} from "./index-q0y2jq9j.js";
|
|
9
9
|
import {
|
|
10
10
|
PkgExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-2tv3fdx4.js";
|
|
12
12
|
import {
|
|
13
13
|
TypeScriptDependencyScanner2
|
|
14
14
|
} from "./index-kcxmv48c.js";
|
|
@@ -3,22 +3,22 @@ import {
|
|
|
3
3
|
GlobalConfig,
|
|
4
4
|
CloudApi,
|
|
5
5
|
AiSession
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-kn1h7p1x.js";
|
|
7
7
|
import {
|
|
8
8
|
PkgExecutor
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-2tv3fdx4.js";
|
|
10
10
|
import {
|
|
11
11
|
script
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-mak3cd28.js";
|
|
13
13
|
import {
|
|
14
14
|
ApplicationScript
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-v0qh106m.js";
|
|
16
16
|
import {
|
|
17
17
|
PackageScript
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-ws5e0j51.js";
|
|
19
19
|
import {
|
|
20
20
|
CloudRunner
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-2hq52jq3.js";
|
|
22
22
|
|
|
23
23
|
// pkgs/@akanjs/cli/cloud/cloud.script.ts
|
|
24
24
|
import { Logger } from "akanjs/common";
|
package/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
getTargetMetas,
|
|
5
5
|
getTargetCommandNames,
|
|
6
6
|
runCommands
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-mak3cd28.js";
|
|
8
8
|
import"./index-q0y2jq9j.js";
|
|
9
|
-
import"./index-
|
|
9
|
+
import"./index-2tv3fdx4.js";
|
|
10
10
|
import"./index-6wwzs1bc.js";
|
|
11
11
|
|
|
12
12
|
// pkgs/@akanjs/cli/commandManifest.ts
|
|
@@ -14,23 +14,23 @@ import path from "path";
|
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/commandModules.ts
|
|
16
16
|
var commandModules = {
|
|
17
|
-
workspace: async () => (await import("./workspace.command-
|
|
18
|
-
agent: async () => (await import("./agent.command-
|
|
19
|
-
application: async () => (await import("./application.command-
|
|
20
|
-
library: async () => (await import("./library.command-
|
|
21
|
-
localRegistry: async () => (await import("./localRegistry.command-
|
|
22
|
-
package: async () => (await import("./package.command-
|
|
23
|
-
module: async () => (await import("./module.command-
|
|
24
|
-
page: async () => (await import("./page.command-
|
|
25
|
-
context: async () => (await import("./context.command-
|
|
26
|
-
cloud: async () => (await import("./cloud.command-
|
|
27
|
-
subspace: async () => (await import("./subspace.command-
|
|
28
|
-
guideline: async () => (await import("./guideline.command-
|
|
29
|
-
scalar: async () => (await import("./scalar.command-
|
|
30
|
-
primitive: async () => (await import("./primitive.command-
|
|
31
|
-
quality: async () => (await import("./quality.command-
|
|
32
|
-
repair: async () => (await import("./repair.command-
|
|
33
|
-
workflow: async () => (await import("./workflow.command-
|
|
17
|
+
workspace: async () => (await import("./workspace.command-8s050m0h.js")).WorkspaceCommand,
|
|
18
|
+
agent: async () => (await import("./agent.command-d2gfxfck.js")).AgentCommand,
|
|
19
|
+
application: async () => (await import("./application.command-pj2m7584.js")).ApplicationCommand,
|
|
20
|
+
library: async () => (await import("./library.command-nbsky672.js")).LibraryCommand,
|
|
21
|
+
localRegistry: async () => (await import("./localRegistry.command-yeq57wjr.js")).LocalRegistryCommand,
|
|
22
|
+
package: async () => (await import("./package.command-axv0abmn.js")).PackageCommand,
|
|
23
|
+
module: async () => (await import("./module.command-29vqzrh8.js")).ModuleCommand,
|
|
24
|
+
page: async () => (await import("./page.command-vs9s3zrh.js")).PageCommand,
|
|
25
|
+
context: async () => (await import("./context.command-ez8a0zyz.js")).ContextCommand,
|
|
26
|
+
cloud: async () => (await import("./cloud.command-jshwdq22.js")).CloudCommand,
|
|
27
|
+
subspace: async () => (await import("./subspace.command-fwjfcts7.js")).SubspaceCommand,
|
|
28
|
+
guideline: async () => (await import("./guideline.command-xmqwx8zm.js")).GuidelineCommand,
|
|
29
|
+
scalar: async () => (await import("./scalar.command-6k1vhe9s.js")).ScalarCommand,
|
|
30
|
+
primitive: async () => (await import("./primitive.command-cbxmqbtc.js")).PrimitiveCommand,
|
|
31
|
+
quality: async () => (await import("./quality.command-gmbs7nws.js")).QualityCommand,
|
|
32
|
+
repair: async () => (await import("./repair.command-bqsjptsj.js")).RepairCommand,
|
|
33
|
+
workflow: async () => (await import("./workflow.command-nwpcdc8p.js")).WorkflowCommand
|
|
34
34
|
};
|
|
35
35
|
var commandModuleIds = Object.keys(commandModules);
|
|
36
36
|
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
Lib,
|
|
4
4
|
Workspace,
|
|
5
5
|
command
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-mak3cd28.js";
|
|
7
7
|
import"./index-q0y2jq9j.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-2tv3fdx4.js";
|
|
9
9
|
import"./index-6wwzs1bc.js";
|
|
10
10
|
import {
|
|
11
11
|
LibraryScript
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-259dsnz3.js";
|
|
13
13
|
|
|
14
14
|
// pkgs/@akanjs/cli/library/library.command.ts
|
|
15
15
|
class LibraryCommand extends command("library", [LibraryScript], ({ public: target }) => ({
|
|
@@ -4,27 +4,27 @@ import {
|
|
|
4
4
|
runner,
|
|
5
5
|
script,
|
|
6
6
|
command
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-mak3cd28.js";
|
|
8
8
|
import"./index-q0y2jq9j.js";
|
|
9
9
|
import {
|
|
10
10
|
PkgExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-2tv3fdx4.js";
|
|
12
12
|
import"./index-6wwzs1bc.js";
|
|
13
13
|
import {
|
|
14
14
|
ApplicationScript
|
|
15
|
-
} from "./index-
|
|
16
|
-
import"./index-
|
|
15
|
+
} from "./index-v0qh106m.js";
|
|
16
|
+
import"./index-259dsnz3.js";
|
|
17
17
|
import"./index-hwkygn9s.js";
|
|
18
|
-
import"./index-
|
|
18
|
+
import"./index-kn1h7p1x.js";
|
|
19
19
|
import {
|
|
20
20
|
getNpmRegistryUrl,
|
|
21
21
|
CloudRunner
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-2hq52jq3.js";
|
|
23
23
|
import"./index-kcxmv48c.js";
|
|
24
24
|
import {
|
|
25
25
|
PackageScript
|
|
26
|
-
} from "./index-
|
|
27
|
-
import"./index-
|
|
26
|
+
} from "./index-ws5e0j51.js";
|
|
27
|
+
import"./index-j9yhg404.js";
|
|
28
28
|
|
|
29
29
|
// pkgs/@akanjs/cli/localRegistry/localRegistry.runner.ts
|
|
30
30
|
import { mkdir, rm } from "fs/promises";
|
|
@@ -3,18 +3,18 @@ import {
|
|
|
3
3
|
Sys,
|
|
4
4
|
Module,
|
|
5
5
|
command
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-mak3cd28.js";
|
|
7
7
|
import"./index-q0y2jq9j.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-2tv3fdx4.js";
|
|
9
9
|
import"./index-6wwzs1bc.js";
|
|
10
10
|
import {
|
|
11
11
|
renderPrimitiveReport
|
|
12
|
-
} from "./index-
|
|
13
|
-
import"./index-
|
|
12
|
+
} from "./index-gyd220p2.js";
|
|
13
|
+
import"./index-kn1h7p1x.js";
|
|
14
14
|
import {
|
|
15
15
|
ModuleScript
|
|
16
|
-
} from "./index-
|
|
17
|
-
import"./index-
|
|
16
|
+
} from "./index-8pm30m73.js";
|
|
17
|
+
import"./index-pnqbkf5p.js";
|
|
18
18
|
import"./index-h7yw2z9n.js";
|
|
19
19
|
|
|
20
20
|
// pkgs/@akanjs/cli/module/module.command.ts
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
Pkg,
|
|
4
4
|
Workspace,
|
|
5
5
|
command
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-mak3cd28.js";
|
|
7
7
|
import"./index-q0y2jq9j.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-2tv3fdx4.js";
|
|
9
9
|
import"./index-6wwzs1bc.js";
|
|
10
10
|
import"./index-kcxmv48c.js";
|
|
11
11
|
import {
|
|
12
12
|
PackageScript
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-ws5e0j51.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/package/package.command.ts
|
|
16
16
|
class PackageCommand extends command("package", [PackageScript], ({ public: target }) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@langchain/openai": "^1.4.6",
|
|
34
34
|
"@tailwindcss/node": "^4.3.0",
|
|
35
35
|
"@trapezedev/project": "^7.1.4",
|
|
36
|
-
"akanjs": "3.0.0-
|
|
36
|
+
"akanjs": "3.0.0-beta.0",
|
|
37
37
|
"chalk": "^5.6.2",
|
|
38
38
|
"commander": "^14.0.3",
|
|
39
39
|
"dayjs": "^1.11.20",
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
App,
|
|
4
4
|
Module,
|
|
5
5
|
command
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-mak3cd28.js";
|
|
7
7
|
import"./index-q0y2jq9j.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-2tv3fdx4.js";
|
|
9
9
|
import"./index-6wwzs1bc.js";
|
|
10
10
|
import {
|
|
11
11
|
PageScript
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-pnqbkf5p.js";
|
|
13
13
|
|
|
14
14
|
// pkgs/@akanjs/cli/page/page.command.ts
|
|
15
15
|
class PageCommand extends command("page", [PageScript], ({ public: target }) => ({
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Workspace,
|
|
4
4
|
command
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-mak3cd28.js";
|
|
6
6
|
import"./index-q0y2jq9j.js";
|
|
7
|
-
import"./index-
|
|
7
|
+
import"./index-2tv3fdx4.js";
|
|
8
8
|
import"./index-6wwzs1bc.js";
|
|
9
9
|
import {
|
|
10
10
|
renderPrimitiveReport
|
|
11
|
-
} from "./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
11
|
+
} from "./index-gyd220p2.js";
|
|
12
|
+
import"./index-kn1h7p1x.js";
|
|
13
|
+
import"./index-8pm30m73.js";
|
|
14
|
+
import"./index-pnqbkf5p.js";
|
|
15
15
|
import"./index-h7yw2z9n.js";
|
|
16
16
|
import {
|
|
17
17
|
PrimitiveScript
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-4edzf1gr.js";
|
|
19
19
|
|
|
20
20
|
// pkgs/@akanjs/cli/primitive/primitive.command.ts
|
|
21
21
|
import { Logger } from "akanjs/common";
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
runner,
|
|
5
5
|
script,
|
|
6
6
|
command
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-mak3cd28.js";
|
|
8
8
|
import"./index-q0y2jq9j.js";
|
|
9
9
|
import {
|
|
10
10
|
rootAllowedFiles,
|
|
11
11
|
rootAllowedDirs,
|
|
12
12
|
isAllowedLibFacetRootFile
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-2tv3fdx4.js";
|
|
14
14
|
import"./index-6wwzs1bc.js";
|
|
15
15
|
import {
|
|
16
16
|
AbstractDoc
|