@akanjs/cli 3.1.2-rc.3 → 3.2.0-rc.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/{CodeAgent-n2tkg59z.js → CodeAgent-h6g8dg3a.js} +2 -2
- package/{CodeTui-9wsdx7ap.js → CodeTui-n9gacepn.js} +1 -1
- package/README.ko.md +9 -0
- package/README.md +9 -0
- package/TunnelShare-k3ja4w9x.js +14 -0
- package/{agent.command-tffz6wdn.js → agent.command-2f657613.js} +19 -17
- package/akanCode.js +2 -2
- package/{application.command-7bkxbrsp.js → application.command-yb8v177e.js} +45 -22
- package/{applicationBuildRunner-s13x3zqb.js → applicationBuildRunner-sctcmkyx.js} +57 -17
- package/buildBatch.proc.js +7 -7
- package/{cloud.command-a792bc10.js → cloud.command-et06ja22.js} +35 -18
- package/cloud.script-s6rbrwer.js +30 -0
- package/{code.command-ma8dtzww.js → code.command-7m67c7zc.js} +6 -6
- package/commandManifest.json +1 -1
- package/{context.command-80a1qhps.js → context.command-569z0rqf.js} +20 -19
- package/context.runner-ms8v1rxy.js +29 -0
- package/{guideline.command-195g0h9a.js → guideline.command-gnv3e8p8.js} +2 -2
- package/guidelines/akanApi/akanApi.instruction.md +317 -0
- package/guidelines/conventions/rules/app.md +5 -5
- package/guidelines/conventions/rules/config.md +1 -1
- package/guidelines/conventions/rules/gates.md +10 -5
- package/guidelines/conventions/rules/page.md +4 -2
- package/guidelines/conventions/rules/server.md +2 -0
- package/guidelines/conventions/rules/style.md +3 -1
- package/guidelines/conventions/rules/ts.md +2 -1
- package/guidelines/cssRule/cssRule.instruction.md +3 -1
- package/guidelines/pageRule/pageRule.instruction.md +3 -0
- package/incrementalBuilder.proc.js +70 -14
- package/{index-tns543wd.js → index-0fb3cpbt.js} +3 -3
- package/{index-zbrwnmf1.js → index-1q1cjn8s.js} +21 -11
- package/{index-wrmq92vk.js → index-3wjbhj2n.js} +1 -1
- package/{index-361ex3rb.js → index-48d5qsj3.js} +4 -4
- package/{index-aayg4dqf.js → index-5w9my9qe.js} +8 -8
- package/{index-1h2jc0x3.js → index-6wpaq392.js} +61 -15
- package/{index-tp56652m.js → index-7xdpww43.js} +69 -12
- package/index-7y5yghjg.js +2969 -0
- package/{index-zttm13c3.js → index-8g7tdsk4.js} +249 -696
- package/{index-m02tdq8a.js → index-8pb9yvp8.js} +63 -21
- package/{index-gbp1q1b5.js → index-8ts9774g.js} +4 -4
- package/{index-9zy8479y.js → index-93ewzmp6.js} +43 -14
- package/{index-zdpte1pj.js → index-9tbgb4d8.js} +1 -1
- package/index-abgh0jve.js +126 -0
- package/{index-khk05tsf.js → index-aj3ehkcx.js} +1 -1
- package/{index-84h43kg6.js → index-d4n1wmrz.js} +37 -4
- package/{index-gr9thy79.js → index-drz9e84d.js} +22 -8
- package/{index-hapx5myy.js → index-e3vmjtph.js} +2 -2
- package/{index-k64mhwbw.js → index-eajbmk10.js} +2 -1
- package/{index-0j1t1h2b.js → index-ed6ea0qp.js} +1 -1
- package/{index-sjabnf7j.js → index-fjr4d6yd.js} +444 -368
- package/index-hqrkqxx2.js +176 -0
- package/{index-z7kbxdqg.js → index-jdamtr7e.js} +3 -3
- package/{index-scck6h6d.js → index-kpdv34rq.js} +4 -4
- package/{index-ppvqy5bc.js → index-ktb3wcqz.js} +73 -34
- package/{index-sveq36gh.js → index-mmym5xmb.js} +4 -2
- package/{index-y4kcmbt2.js → index-mqntfzv5.js} +2 -2
- package/{index-4am4dvmf.js → index-ny2k80mv.js} +15 -3
- package/index-p6hjwt2d.js +1668 -0
- package/{index-wwe9rsrx.js → index-r0a604h4.js} +12 -2
- package/{index-jb2sreps.js → index-rc5fvqj2.js} +18 -18
- package/{index-db2nqrad.js → index-ryrm5z2c.js} +71 -19
- package/{index-eft5c2mp.js → index-s2grpzef.js} +331 -27
- package/{index-g500c5j9.js → index-sr5da35e.js} +33 -10
- package/{index-defp4gmb.js → index-sy481q2x.js} +1 -1
- package/{index-j9d3mjx1.js → index-thckcabc.js} +2 -2
- package/{index-9z3egsmg.js → index-vkzfk7qt.js} +25 -23
- package/index-w639tvkd.js +166 -0
- package/index-ygdbn9jn.js +122 -0
- package/{index-sp0qsr7a.js → index-zpv14wpy.js} +3 -3
- package/{index-sx91nf4z.js → index-zxsygkda.js} +18 -9
- package/index.js +24 -23
- package/{library.command-63hgt9te.js → library.command-1gp5qe3r.js} +3 -3
- package/{localRegistry.command-343ksmn9.js → localRegistry.command-v3g21rex.js} +25 -16
- package/{module.command-2hce9m6k.js → module.command-4xz9he6h.js} +6 -6
- package/{package.command-96eheyvd.js → package.command-s7qpnn1g.js} +12 -3
- package/package.json +2 -2
- package/{page.command-gs6d841d.js → page.command-fan34c49.js} +3 -3
- package/{pipeline.command-wdfvdbfj.js → pipeline.command-ph4fnn9w.js} +2 -2
- package/{primitive.command-7tdj12wn.js → primitive.command-3fqh8emf.js} +7 -7
- package/{projectTypecheck-kqj1t6hb.js → projectTypecheck-vkb40hjc.js} +1 -1
- package/{quality.command-29bgarh1.js → quality.command-ecj6exsh.js} +15 -10
- package/{repair.command-yng4rf5d.js → repair.command-fe9jw719.js} +6 -6
- package/{scalar.command-1nk4329t.js → scalar.command-cnvfhk0n.js} +5 -5
- package/skills/akan-debug/SKILL.md +2 -1
- package/skills/akan-page/SKILL.md +30 -2
- package/skills/akan-service/SKILL.md +77 -1
- package/{subspace.command-5cehmcdd.js → subspace.command-yxtt3v3e.js} +8 -8
- package/templates/app/lib/___appName__/__appName__.abstract.md.template +6 -0
- package/templates/app/page/_index.tsx +4 -284
- package/templates/app/page/_layout.tsx +1 -26
- package/templates/app/page/styles.css.template +58 -318
- package/templates/appSample/page/_index.tsx +281 -0
- package/templates/appSample/page/_layout.tsx +55 -0
- package/templates/appSample/page/styles.css.template +327 -0
- package/templates/libRoot/lib/___libName__/__libName__.abstract.md.template +6 -0
- package/templates/workspaceRoot/package.json.template +1 -12
- package/{tunnel.command-yrd4atqy.js → tunnel.command-ggj38mqf.js} +7 -7
- package/{typeChecker-j2jdnqsr.js → typeChecker-s640r6c0.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/{verify.command-kbq0fcg8.js → verify.command-w9ttxkdz.js} +16 -14
- package/{workflow.command-274qfa8z.js → workflow.command-ss8devj0.js} +12 -12
- package/{workspace.command-r6hgmawy.js → workspace.command-rw1p0xeq.js} +50 -38
- package/TunnelShare-6d7z36sr.js +0 -14
- package/cloud.script-t2n13gv6.js +0 -27
- package/context.runner-wxqb3qcy.js +0 -28
- package/index-j2dgmzbj.js +0 -1259
- package/index-p6x5b7hr.js +0 -839
- package/index-vzpnr12w.js +0 -65
- package/templates/workspaceRoot/patches/zod@3.25.76.patch.template +0 -22
- package/templates/workspaceRoot/patches/zod@4.4.3.patch.template +0 -11
- /package/templates/{app → appSample}/page/_overrides.tsx +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Black.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Bold.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Light.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Medium.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Regular.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Thin.woff2 +0 -0
- /package/templates/{app → appSample}/public/jelly/cloud.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/comet.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/moon.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/planet.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/rocket.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/star.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/sugar.webp +0 -0
- /package/templates/{app → appSample}/public/logo.png +0 -0
- /package/templates/{app → appSample}/ui/Recipe/index.ts +0 -0
- /package/templates/{app → appSample}/ui/Recipe/jellyButton.ts +0 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
JsonFormatter
|
|
4
|
+
} from "./index-sr5da35e.js";
|
|
5
|
+
|
|
6
|
+
// pkgs/@akanjs/devkit/maintainabilityBaseline.ts
|
|
7
|
+
class MaintainabilityBaseline {
|
|
8
|
+
sections;
|
|
9
|
+
reasons;
|
|
10
|
+
static fileName = "akan.baseline.json";
|
|
11
|
+
static reasonMinChars = 10;
|
|
12
|
+
static debtRules = [
|
|
13
|
+
"akan.size.file",
|
|
14
|
+
"akan.size.component",
|
|
15
|
+
"akan.size.function",
|
|
16
|
+
"akan.size.class",
|
|
17
|
+
"akan.component.store-access",
|
|
18
|
+
"akan.store.multi-write",
|
|
19
|
+
"akan.store.root-write-chain",
|
|
20
|
+
"akan.component.write-chain",
|
|
21
|
+
"akan.write.placement",
|
|
22
|
+
"akan.service.call-in-loop"
|
|
23
|
+
];
|
|
24
|
+
static reasonedRules = new Set([
|
|
25
|
+
"akan.size.file",
|
|
26
|
+
"akan.size.component",
|
|
27
|
+
"akan.size.function",
|
|
28
|
+
"akan.size.class",
|
|
29
|
+
"akan.component.store-access",
|
|
30
|
+
"akan.service.call-in-loop"
|
|
31
|
+
]);
|
|
32
|
+
static countOf(violation) {
|
|
33
|
+
if (violation.kind === "size")
|
|
34
|
+
return violation.lineCount;
|
|
35
|
+
if (violation.kind === "classSize")
|
|
36
|
+
return violation.memberCount;
|
|
37
|
+
if (violation.kind === "storeAccess")
|
|
38
|
+
return violation.accessCount;
|
|
39
|
+
if (violation.kind === "multiWrite")
|
|
40
|
+
return violation.writeCount;
|
|
41
|
+
if (violation.kind === "writePlacement")
|
|
42
|
+
return violation.writes.length;
|
|
43
|
+
return violation.calls.length;
|
|
44
|
+
}
|
|
45
|
+
static isDebtRule(name) {
|
|
46
|
+
return MaintainabilityBaseline.debtRules.includes(name);
|
|
47
|
+
}
|
|
48
|
+
static parse(text, source = MaintainabilityBaseline.fileName, { lenient = false } = {}) {
|
|
49
|
+
let json;
|
|
50
|
+
try {
|
|
51
|
+
json = JSON.parse(text);
|
|
52
|
+
} catch {
|
|
53
|
+
throw new Error(`${source} is not valid JSON.`);
|
|
54
|
+
}
|
|
55
|
+
if (typeof json !== "object" || json === null || Array.isArray(json))
|
|
56
|
+
throw new Error(`${source} holds an object keyed by rule id.`);
|
|
57
|
+
const sections = new Map;
|
|
58
|
+
let reasons = new Map;
|
|
59
|
+
for (const [name, value] of Object.entries(json)) {
|
|
60
|
+
if (name === "reasons") {
|
|
61
|
+
const entries = MaintainabilityBaseline.#reasonsOf(value);
|
|
62
|
+
if (!entries)
|
|
63
|
+
throw new Error(`${source}: "reasons" maps an entry's key to a sentence.`);
|
|
64
|
+
reasons = new Map(entries);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (!MaintainabilityBaseline.isDebtRule(name)) {
|
|
68
|
+
if (lenient)
|
|
69
|
+
continue;
|
|
70
|
+
throw new Error(`${source}: "${name}" is not a rule id. Its sections are ${MaintainabilityBaseline.debtRules.join(", ")} and "reasons"; rewrite it with \`akan quality baseline --force\`.`);
|
|
71
|
+
}
|
|
72
|
+
const counts = MaintainabilityBaseline.#countsOf(value);
|
|
73
|
+
if (!counts)
|
|
74
|
+
throw new Error(`${source}: "${name}" maps each key to a whole-number count.`);
|
|
75
|
+
sections.set(name, new Map(counts));
|
|
76
|
+
}
|
|
77
|
+
return new MaintainabilityBaseline(sections, reasons);
|
|
78
|
+
}
|
|
79
|
+
static of(violations, reasons = new Map) {
|
|
80
|
+
const sections = new Map;
|
|
81
|
+
for (const violation of violations) {
|
|
82
|
+
const counts = sections.get(violation.rule) ?? new Map;
|
|
83
|
+
const count = MaintainabilityBaseline.countOf(violation);
|
|
84
|
+
counts.set(violation.key, Math.max(counts.get(violation.key) ?? 0, count));
|
|
85
|
+
sections.set(violation.rule, counts);
|
|
86
|
+
}
|
|
87
|
+
return new MaintainabilityBaseline(sections).#withReasonsOf(reasons);
|
|
88
|
+
}
|
|
89
|
+
constructor(sections = new Map, reasons = new Map) {
|
|
90
|
+
this.sections = sections;
|
|
91
|
+
this.reasons = reasons;
|
|
92
|
+
}
|
|
93
|
+
get isEmpty() {
|
|
94
|
+
return [...this.sections.values()].every((counts) => !counts.size);
|
|
95
|
+
}
|
|
96
|
+
allows(violation) {
|
|
97
|
+
const recorded = this.recordedOf(violation);
|
|
98
|
+
return recorded !== undefined && MaintainabilityBaseline.countOf(violation) <= recorded;
|
|
99
|
+
}
|
|
100
|
+
recordedOf(violation) {
|
|
101
|
+
return this.sections.get(violation.rule)?.get(violation.key);
|
|
102
|
+
}
|
|
103
|
+
reasonOf(key) {
|
|
104
|
+
const reason = this.#holdsReasoned(key) ? this.reasons.get(key) : undefined;
|
|
105
|
+
return reason && reason.replace(/\s/g, "").length >= MaintainabilityBaseline.reasonMinChars ? reason : undefined;
|
|
106
|
+
}
|
|
107
|
+
entriesByRule() {
|
|
108
|
+
return new Map([...this.sections].filter(([, counts]) => counts.size).map(([rule, counts]) => [
|
|
109
|
+
rule,
|
|
110
|
+
[...counts].map(([key, count]) => ({
|
|
111
|
+
key,
|
|
112
|
+
count,
|
|
113
|
+
reason: MaintainabilityBaseline.reasonedRules.has(rule) ? this.reasonOf(key) : undefined
|
|
114
|
+
}))
|
|
115
|
+
]));
|
|
116
|
+
}
|
|
117
|
+
tightenedBy(violations) {
|
|
118
|
+
const current = MaintainabilityBaseline.of(violations);
|
|
119
|
+
const sections = new Map([...this.sections].map(([rule, counts]) => [
|
|
120
|
+
rule,
|
|
121
|
+
MaintainabilityBaseline.#lowered(counts, current.sections.get(rule) ?? new Map)
|
|
122
|
+
]));
|
|
123
|
+
return new MaintainabilityBaseline(sections).#withReasonsOf(this.reasons);
|
|
124
|
+
}
|
|
125
|
+
#withReasonsOf(reasons) {
|
|
126
|
+
return new MaintainabilityBaseline(this.sections, new Map([...reasons].filter(([key]) => this.#holdsReasoned(key))));
|
|
127
|
+
}
|
|
128
|
+
grownFrom(committed) {
|
|
129
|
+
return [...this.sections].flatMap(([rule, counts]) => MaintainabilityBaseline.#raised(counts, committed.sections.get(rule) ?? new Map).filter(([key]) => !(MaintainabilityBaseline.reasonedRules.has(rule) && this.reasonOf(key))).map(([key, count, recorded]) => ({ rule, key, count, committed: recorded })));
|
|
130
|
+
}
|
|
131
|
+
stringify() {
|
|
132
|
+
const sections = MaintainabilityBaseline.debtRules.flatMap((rule) => {
|
|
133
|
+
const counts = this.sections.get(rule);
|
|
134
|
+
return counts?.size ? [[rule, MaintainabilityBaseline.#sortedObjectOf(counts)]] : [];
|
|
135
|
+
});
|
|
136
|
+
return JsonFormatter.stringify({
|
|
137
|
+
...Object.fromEntries(sections),
|
|
138
|
+
...this.reasons.size ? { reasons: MaintainabilityBaseline.#sortedObjectOf(this.reasons) } : {}
|
|
139
|
+
}, MaintainabilityBaseline.fileName);
|
|
140
|
+
}
|
|
141
|
+
#holdsReasoned(key) {
|
|
142
|
+
return [...this.sections].some(([rule, counts]) => MaintainabilityBaseline.reasonedRules.has(rule) && counts.has(key));
|
|
143
|
+
}
|
|
144
|
+
static #countsOf(value) {
|
|
145
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
146
|
+
return null;
|
|
147
|
+
const entries = Object.entries(value);
|
|
148
|
+
return entries.every(([, count]) => Number.isInteger(count)) ? entries : null;
|
|
149
|
+
}
|
|
150
|
+
static #reasonsOf(value) {
|
|
151
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
152
|
+
return null;
|
|
153
|
+
const entries = Object.entries(value);
|
|
154
|
+
return entries.every(([, reason]) => typeof reason === "string") ? entries : null;
|
|
155
|
+
}
|
|
156
|
+
static #lowered(recorded, current) {
|
|
157
|
+
return new Map([...recorded].flatMap(([key, count]) => {
|
|
158
|
+
const measured = current.get(key);
|
|
159
|
+
return measured === undefined ? [] : [[key, Math.min(count, measured)]];
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
static #raised(working, committed) {
|
|
163
|
+
return [...working].flatMap(([key, count]) => {
|
|
164
|
+
const recorded = committed.get(key);
|
|
165
|
+
return recorded !== undefined && count <= recorded ? [] : [[key, count, recorded]];
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
static #sortedObjectOf(values) {
|
|
169
|
+
return Object.fromEntries([...values].sort(([a], [b]) => MaintainabilityBaseline.#byKey(a, b)));
|
|
170
|
+
}
|
|
171
|
+
static #byKey(a, b) {
|
|
172
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export { MaintainabilityBaseline };
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
SubagentPool2,
|
|
16
16
|
McpSignIn,
|
|
17
17
|
AkanCodeCompaction2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-3wjbhj2n.js";
|
|
19
19
|
import {
|
|
20
20
|
PreviewView2,
|
|
21
21
|
stripAnsi
|
|
@@ -659,7 +659,7 @@ class AkanToolPack2 {
|
|
|
659
659
|
return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
|
|
660
660
|
}
|
|
661
661
|
async names() {
|
|
662
|
-
const { ContextRunner } = await import("./context.runner-
|
|
662
|
+
const { ContextRunner } = await import("./context.runner-ms8v1rxy.js");
|
|
663
663
|
return [
|
|
664
664
|
...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
|
|
665
665
|
AkanToolPack2.verifyToolName
|
|
@@ -667,7 +667,7 @@ class AkanToolPack2 {
|
|
|
667
667
|
}
|
|
668
668
|
static verifyToolName = "akan_verify";
|
|
669
669
|
async#register(pi) {
|
|
670
|
-
const { ContextRunner } = await import("./context.runner-
|
|
670
|
+
const { ContextRunner } = await import("./context.runner-ms8v1rxy.js");
|
|
671
671
|
const runner = new ContextRunner;
|
|
672
672
|
const guidelineNames = await AkanToolPack2.#guidelineNames();
|
|
673
673
|
for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
jsonText
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-8pb9yvp8.js";
|
|
5
5
|
import {
|
|
6
6
|
akanMcpInstallTargets
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-thckcabc.js";
|
|
8
8
|
import {
|
|
9
9
|
script
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-93ewzmp6.js";
|
|
11
11
|
import {
|
|
12
12
|
ContextRunner2
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-rc5fvqj2.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/context/context.script.ts
|
|
16
16
|
import { Logger } from "akanjs/common";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
AppExecutor,
|
|
8
8
|
LibExecutor,
|
|
9
9
|
PkgExecutor
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-sr5da35e.js";
|
|
11
11
|
import {
|
|
12
12
|
FileSys2
|
|
13
13
|
} from "./index-bns3wcpc.js";
|
|
@@ -46,28 +46,28 @@ import {
|
|
|
46
46
|
filesChangedSince,
|
|
47
47
|
HmrWatcher,
|
|
48
48
|
WatchRootResolver
|
|
49
|
-
} from "./index-
|
|
49
|
+
} from "./index-p6hjwt2d.js";
|
|
50
50
|
import {
|
|
51
51
|
runner,
|
|
52
52
|
ExitCodeError,
|
|
53
53
|
assertPromptable
|
|
54
|
-
} from "./index-
|
|
54
|
+
} from "./index-93ewzmp6.js";
|
|
55
55
|
import {
|
|
56
56
|
UpdatePackFolder,
|
|
57
57
|
UpdateUploader,
|
|
58
58
|
NativePublicEnv,
|
|
59
59
|
NativeApp
|
|
60
|
-
} from "./index-
|
|
60
|
+
} from "./index-zpv14wpy.js";
|
|
61
61
|
import {
|
|
62
62
|
DesktopServerStage
|
|
63
|
-
} from "./index-
|
|
63
|
+
} from "./index-ed6ea0qp.js";
|
|
64
64
|
import {
|
|
65
65
|
resolveMobileTargets,
|
|
66
66
|
resolveAppId
|
|
67
67
|
} from "./index-m9jj544v.js";
|
|
68
68
|
import {
|
|
69
69
|
SlicePlanner
|
|
70
|
-
} from "./index-
|
|
70
|
+
} from "./index-sy481q2x.js";
|
|
71
71
|
import {
|
|
72
72
|
openBrowser
|
|
73
73
|
} from "./index-9dp031by.js";
|
|
@@ -79,8 +79,8 @@ import {
|
|
|
79
79
|
} from "./index-bqbf654f.js";
|
|
80
80
|
|
|
81
81
|
// pkgs/@akanjs/cli/application/application.runner.ts
|
|
82
|
-
import { existsSync, realpathSync } from "fs";
|
|
83
|
-
import
|
|
82
|
+
import { existsSync, realpathSync as realpathSync2 } from "fs";
|
|
83
|
+
import path7 from "path";
|
|
84
84
|
|
|
85
85
|
// pkgs/@akanjs/devkit/akanApp/akanApp.host.ts
|
|
86
86
|
import path4 from "path";
|
|
@@ -2005,17 +2005,49 @@ ${uniqueCandidates.map((candidate) => ` - ${candidate}`).join(`
|
|
|
2005
2005
|
}
|
|
2006
2006
|
|
|
2007
2007
|
// pkgs/@akanjs/cli/application/application.runner.ts
|
|
2008
|
-
import { Logger as
|
|
2009
|
-
|
|
2008
|
+
import { Logger as Logger4, toError } from "akanjs/common";
|
|
2009
|
+
|
|
2010
|
+
// pkgs/@akanjs/cli/application/testTarget.ts
|
|
2011
|
+
import { readdirSync, realpathSync, statSync } from "fs";
|
|
2012
|
+
import path6 from "path";
|
|
2013
|
+
import { Logger as Logger3 } from "akanjs/common";
|
|
2014
|
+
var testFileName = /[._](test|spec)\.[cm]?[jt]sx?$/i;
|
|
2015
|
+
var hasTestFile = (dir, seen = new Set) => {
|
|
2016
|
+
const real = realpathSync(dir);
|
|
2017
|
+
if (seen.has(real))
|
|
2018
|
+
return false;
|
|
2019
|
+
seen.add(real);
|
|
2020
|
+
return readdirSync(dir, { withFileTypes: true }).some((entry) => {
|
|
2021
|
+
const entryPath = path6.join(dir, entry.name);
|
|
2022
|
+
const isDir = entry.isDirectory() || entry.isSymbolicLink() && statSync(entryPath, { throwIfNoEntry: false })?.isDirectory();
|
|
2023
|
+
if (!isDir)
|
|
2024
|
+
return testFileName.test(entry.name);
|
|
2025
|
+
return !entry.name.startsWith(".") && entry.name !== "node_modules" && hasTestFile(entryPath, seen);
|
|
2026
|
+
});
|
|
2027
|
+
};
|
|
2028
|
+
var testTargetOf = (exec) => {
|
|
2029
|
+
const root = exec instanceof SysExecutor || exec instanceof PkgExecutor ? exec.workspace.workspaceRoot : process.cwd();
|
|
2030
|
+
return { root, target: path6.relative(root, exec.cwdPath).split(path6.sep).join("/") };
|
|
2031
|
+
};
|
|
2032
|
+
var reportsNoTestFile = (exec) => {
|
|
2033
|
+
if (hasTestFile(exec.cwdPath))
|
|
2034
|
+
return false;
|
|
2035
|
+
const hint = exec instanceof AppExecutor || exec instanceof LibExecutor ? " A signal test goes beside its module, as lib/<model>/<model>.signal.test.ts." : "";
|
|
2036
|
+
Logger3.rawLog(`No *.test.ts or *.spec.ts file in ${testTargetOf(exec).target}, so no test ran.${hint}`);
|
|
2037
|
+
return true;
|
|
2038
|
+
};
|
|
2039
|
+
|
|
2040
|
+
// pkgs/@akanjs/cli/application/application.runner.ts
|
|
2041
|
+
var loadBuildRunner = async () => (await import("./applicationBuildRunner-sctcmkyx.js")).ApplicationBuildRunner;
|
|
2010
2042
|
var loadPrompts = async () => await import("@inquirer/prompts");
|
|
2011
2043
|
|
|
2012
2044
|
class ApplicationRunner extends runner("application") {
|
|
2013
|
-
async createApplication(appName, workspace, libs = []
|
|
2045
|
+
async createApplication(appName, workspace, libs = []) {
|
|
2014
2046
|
await workspace.applyTemplate({
|
|
2015
2047
|
basePath: `apps/${appName}`,
|
|
2016
2048
|
template: "app",
|
|
2017
2049
|
dict: { appName },
|
|
2018
|
-
options: { libs
|
|
2050
|
+
options: { libs }
|
|
2019
2051
|
});
|
|
2020
2052
|
return AppExecutor.from(workspace, appName);
|
|
2021
2053
|
}
|
|
@@ -2058,7 +2090,7 @@ class ApplicationRunner extends runner("application") {
|
|
|
2058
2090
|
});
|
|
2059
2091
|
}
|
|
2060
2092
|
static runtimeDirOf(app, override) {
|
|
2061
|
-
return
|
|
2093
|
+
return path7.resolve(override ?? process.env.AKAN_RUNTIME_DIR ?? path7.join(app.workspace.workspaceRoot, "local", "apps", app.name, "runtime"));
|
|
2062
2094
|
}
|
|
2063
2095
|
async runLogs(app, options) {
|
|
2064
2096
|
const { LogControlUnavailableError, LogTailClient } = await import("akanjs/server/logging/logTailClient");
|
|
@@ -2068,7 +2100,7 @@ class ApplicationRunner extends runner("application") {
|
|
|
2068
2100
|
const { level, grep, endpoint, trace, child, role, origin, since } = options;
|
|
2069
2101
|
const query = Object.fromEntries(Object.entries({ level, grep, endpoint, trace, child, role, origin, since }).filter(([, value]) => value !== undefined && value !== null && value !== ""));
|
|
2070
2102
|
const print = (record) => process.stdout.write(options.json ? `${JSON.stringify(record)}
|
|
2071
|
-
` :
|
|
2103
|
+
` : Logger4.render(record));
|
|
2072
2104
|
const note = (text) => process.stderr.write(`[akan logs] ${text}
|
|
2073
2105
|
`);
|
|
2074
2106
|
const { promise: closed, resolve: finish } = Promise.withResolvers();
|
|
@@ -2084,7 +2116,7 @@ class ApplicationRunner extends runner("application") {
|
|
|
2084
2116
|
});
|
|
2085
2117
|
} catch (error) {
|
|
2086
2118
|
if (error instanceof LogControlUnavailableError)
|
|
2087
|
-
throw new Error(`${app.name} is not running (no ${
|
|
2119
|
+
throw new Error(`${app.name} is not running (no ${path7.basename(socketPath)} in ${runtimeDir}). Start it with \`akan start ${app.name}\`, or pass --runtime-dir for a built app.`);
|
|
2088
2120
|
throw error;
|
|
2089
2121
|
}
|
|
2090
2122
|
const sinceMs = since ? LogQueryMatcher.parseSince(since) : undefined;
|
|
@@ -2146,7 +2178,7 @@ try {
|
|
|
2146
2178
|
const serverPath = `${app.cwdPath}/server.ts`;
|
|
2147
2179
|
if (!await app.exists("server.ts"))
|
|
2148
2180
|
throw new Error(`Server file not found: apps/${app.name}/server.ts`);
|
|
2149
|
-
const target =
|
|
2181
|
+
const target = path7.resolve(app.workspace.workspaceRoot, dir);
|
|
2150
2182
|
const code = `
|
|
2151
2183
|
const { server } = await import(${JSON.stringify(serverPath)});
|
|
2152
2184
|
const { DatabaseAdaptorRole, DocumentTransfer } = await import("akanjs/service");
|
|
@@ -2207,7 +2239,7 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
|
|
|
2207
2239
|
await new (await loadBuildRunner())(app).typecheck(options);
|
|
2208
2240
|
}
|
|
2209
2241
|
async typecheckLibrary(lib, options = {}) {
|
|
2210
|
-
const { ProjectTypecheck } = await import("./projectTypecheck-
|
|
2242
|
+
const { ProjectTypecheck } = await import("./projectTypecheck-vkb40hjc.js");
|
|
2211
2243
|
const root = lib.workspace.workspaceRoot;
|
|
2212
2244
|
await new ProjectTypecheck(lib.cwdPath, root, { ...process.env, AKAN_WORKSPACE_ROOT: root }).run([
|
|
2213
2245
|
"../../server.ts",
|
|
@@ -2219,29 +2251,30 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
|
|
|
2219
2251
|
], options);
|
|
2220
2252
|
}
|
|
2221
2253
|
resolveTestPaths(exec, files) {
|
|
2222
|
-
const root
|
|
2223
|
-
const
|
|
2224
|
-
const isInside = (relative) => relative !== ".." && !relative.startsWith(`..${path6.sep}`) && !path6.isAbsolute(relative);
|
|
2254
|
+
const { root, target } = testTargetOf(exec);
|
|
2255
|
+
const isInside = (relative) => relative !== ".." && !relative.startsWith(`..${path7.sep}`) && !path7.isAbsolute(relative);
|
|
2225
2256
|
return files.map((file) => {
|
|
2226
|
-
const candidates =
|
|
2227
|
-
const existing = candidates.filter((candidate) => existsSync(candidate)).map((candidate) =>
|
|
2257
|
+
const candidates = path7.isAbsolute(file) ? [file] : [path7.resolve(exec.cwdPath, file), path7.resolve(root, file)];
|
|
2258
|
+
const existing = candidates.filter((candidate) => existsSync(candidate)).map((candidate) => path7.relative(exec.cwdPath, candidate));
|
|
2228
2259
|
const found = existing.find(isInside);
|
|
2229
2260
|
if (found === undefined)
|
|
2230
2261
|
throw new Error(existing.length ? `${file} is outside ${target}: akan test ${exec.name} runs its own tests only` : `${file} names no file or folder in ${target}`);
|
|
2231
|
-
return `./${found.split(
|
|
2262
|
+
return `./${found.split(path7.sep).join("/")}`;
|
|
2232
2263
|
});
|
|
2233
2264
|
}
|
|
2234
|
-
async test(exec, testPaths = []) {
|
|
2265
|
+
async test(exec, testPaths = [], flags = []) {
|
|
2235
2266
|
const isSignalTarget = exec instanceof AppExecutor || exec instanceof LibExecutor;
|
|
2267
|
+
if (!testPaths.length && reportsNoTestFile(exec))
|
|
2268
|
+
return;
|
|
2236
2269
|
const preloadPath = isSignalTarget ? await resolveSignalTestPreloadPath(exec) : null;
|
|
2237
2270
|
const env = isSignalTarget ? {
|
|
2238
2271
|
AKAN_TEST_SIGNAL: "1",
|
|
2239
2272
|
AKAN_TEST_TARGET_TYPE: exec.type,
|
|
2240
2273
|
AKAN_TEST_TARGET_NAME: exec.name,
|
|
2241
2274
|
AKAN_TEST_LIBS: exec.getScanInfo({ allowEmpty: true })?.getLibs().join(",") ?? "",
|
|
2242
|
-
AKAN_RUNTIME_DIR:
|
|
2275
|
+
AKAN_RUNTIME_DIR: path7.join(exec.workspace.workspaceRoot, "local", `${exec.type}s`, exec.name, "runtime")
|
|
2243
2276
|
} : {};
|
|
2244
|
-
const args = ["test", "--isolate", ...preloadPath ? ["--preload", preloadPath] : [], ...testPaths];
|
|
2277
|
+
const args = ["test", "--isolate", ...flags, ...preloadPath ? ["--preload", preloadPath] : [], ...testPaths];
|
|
2245
2278
|
await exec.spawn("bun", args, {
|
|
2246
2279
|
...isSignalTarget ? { env: { ...process.env, ...env } } : {},
|
|
2247
2280
|
stdio: "inherit"
|
|
@@ -2251,9 +2284,13 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
|
|
|
2251
2284
|
fast = false,
|
|
2252
2285
|
reporter,
|
|
2253
2286
|
spinner = false,
|
|
2254
|
-
envProfile
|
|
2287
|
+
envProfile,
|
|
2288
|
+
environment,
|
|
2289
|
+
budget
|
|
2255
2290
|
} = {}) {
|
|
2256
|
-
return new (await loadBuildRunner())(app, { fast, reporter, profile: envProfile }).build({
|
|
2291
|
+
return new (await loadBuildRunner())(app, { fast, reporter, profile: envProfile, environment, budget }).build({
|
|
2292
|
+
spinner
|
|
2293
|
+
});
|
|
2257
2294
|
}
|
|
2258
2295
|
async start(app, {
|
|
2259
2296
|
open = false,
|
|
@@ -2355,9 +2392,9 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
|
|
|
2355
2392
|
static #sameCheckout(reported, own) {
|
|
2356
2393
|
const canonical = (root) => {
|
|
2357
2394
|
try {
|
|
2358
|
-
return
|
|
2395
|
+
return realpathSync2.native(root);
|
|
2359
2396
|
} catch {
|
|
2360
|
-
return
|
|
2397
|
+
return path7.resolve(root);
|
|
2361
2398
|
}
|
|
2362
2399
|
};
|
|
2363
2400
|
return canonical(reported) === canonical(own);
|
|
@@ -2381,13 +2418,13 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
|
|
|
2381
2418
|
if (!mobileTarget || targets.length > 1)
|
|
2382
2419
|
throw new Error("pack-update packs one native target at a time; pass --target <name>.");
|
|
2383
2420
|
const nativeApp = new NativeApp(app, mobileTarget, env);
|
|
2384
|
-
await UpdatePackFolder.clear(
|
|
2421
|
+
await UpdatePackFolder.clear(path7.resolve(out ?? path7.join(nativeApp.updatesDir, platform)));
|
|
2385
2422
|
const pinned = publicEnv ? await NativePublicEnv.load(publicEnv) : against ? await NativePublicEnv.recordedIn(against) : null;
|
|
2386
2423
|
await this.#buildMobileCsr(app, env, undefined, pinned);
|
|
2387
2424
|
const { pack } = await nativeApp.packUpdate(platform, { out });
|
|
2388
2425
|
app.logger.info(`packed ${mobileTarget.name} ${platform} for channel '${pack.channel}' to ${pack.out}: ${pack.files} files, ${(pack.size / 1024).toFixed(0)} KiB, native API ${pack.nativeApi}`);
|
|
2389
2426
|
if (against) {
|
|
2390
|
-
const bundle =
|
|
2427
|
+
const bundle = path7.join(pack.out, UpdatePackFolder.bundleFile);
|
|
2391
2428
|
const compat = await NativeApp.compareBundles(app.cwdPath, against, bundle);
|
|
2392
2429
|
const envProblem = await NativePublicEnv.problemAgainst(against, bundle);
|
|
2393
2430
|
await UpdatePackFolder.writeCompat(pack, {
|
|
@@ -2540,7 +2577,9 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
|
|
|
2540
2577
|
APP_OPERATION_MODE: "release"
|
|
2541
2578
|
});
|
|
2542
2579
|
try {
|
|
2543
|
-
await new (await loadBuildRunner())(app, { environment: env, profile: envProfile }).build({
|
|
2580
|
+
await new (await loadBuildRunner())(app, { environment: env, profile: envProfile, budget: "off" }).build({
|
|
2581
|
+
spinner: true
|
|
2582
|
+
});
|
|
2544
2583
|
} finally {
|
|
2545
2584
|
for (const [key, value] of Object.entries(prevEnv)) {
|
|
2546
2585
|
if (value === undefined)
|
|
@@ -2570,7 +2609,7 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
|
|
|
2570
2609
|
return;
|
|
2571
2610
|
for (const failure of failures) {
|
|
2572
2611
|
const message = toError(failure.error).message;
|
|
2573
|
-
|
|
2612
|
+
Logger4.rawLog(`Native target ${failure.target} failed: ${message}`, undefined, "error");
|
|
2574
2613
|
}
|
|
2575
2614
|
throw new Error(`${failures.length}/${results.length} native targets failed`);
|
|
2576
2615
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
resolveSsrPageEntriesForApp
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-sr5da35e.js";
|
|
5
5
|
import {
|
|
6
6
|
createBarrelImportsPlugin,
|
|
7
|
+
bundleConditions,
|
|
7
8
|
bundleDefine,
|
|
8
9
|
CsrEntryFiles,
|
|
9
10
|
PagesEntrySourceGenerator,
|
|
10
11
|
PagesBundleBuilder
|
|
11
|
-
} from "./index-
|
|
12
|
+
} from "./index-1q1cjn8s.js";
|
|
12
13
|
|
|
13
14
|
// pkgs/@akanjs/devkit/frontendBuild/csrArtifactBuilder.ts
|
|
14
15
|
import { mkdir as mkdir2, rm as rm2, unlink as unlink2 } from "fs/promises";
|
|
@@ -455,6 +456,7 @@ ${logs}` : ""}`);
|
|
|
455
456
|
splitting: false,
|
|
456
457
|
minify: true,
|
|
457
458
|
define: bundleDefine(app, command, "csr"),
|
|
459
|
+
conditions: bundleConditions(command),
|
|
458
460
|
optimizeImports,
|
|
459
461
|
plugins: [PagesBundleBuilder.createCssStubPlugin(), createBrowserDirnamePlugin(), SideEffectImportOrder.plugin()]
|
|
460
462
|
};
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-93ewzmp6.js";
|
|
6
6
|
import {
|
|
7
7
|
LibSource,
|
|
8
8
|
formatLibStatuses,
|
|
9
9
|
CommandExecutionError,
|
|
10
10
|
LibExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-sr5da35e.js";
|
|
12
12
|
|
|
13
13
|
// pkgs/@akanjs/cli/library/library.script.ts
|
|
14
14
|
import { Logger } from "akanjs/common";
|
|
@@ -13,10 +13,22 @@ var warnIgnoredNpmRegistry = () => {
|
|
|
13
13
|
Logger.warn(line);
|
|
14
14
|
};
|
|
15
15
|
var getNpmRegistryUrl = (registryUrl = npmRegistryFromEnv() ?? defaultNpmRegistry) => registryUrl.replace(/\/+$/, "");
|
|
16
|
+
var packageUrl = (registry, packageName) => `${registry}/${encodeURIComponent(packageName).replace(/^%40/, "@")}`;
|
|
17
|
+
async function getPublishedVersions(packageName, registryUrl) {
|
|
18
|
+
const registry = getNpmRegistryUrl(registryUrl);
|
|
19
|
+
const res = await fetch(packageUrl(registry, packageName), {
|
|
20
|
+
headers: { Accept: "application/vnd.npm.install-v1+json" }
|
|
21
|
+
});
|
|
22
|
+
if (res.status === 404)
|
|
23
|
+
return null;
|
|
24
|
+
if (!res.ok)
|
|
25
|
+
throw new Error(`Failed to fetch ${packageName} metadata from ${registry} (${res.status})`);
|
|
26
|
+
const metadata = await res.json();
|
|
27
|
+
return { tags: metadata["dist-tags"] ?? {}, versions: Object.keys(metadata.versions ?? {}) };
|
|
28
|
+
}
|
|
16
29
|
async function getLatestPackageVersion(packageName, tag = "latest", registryUrl) {
|
|
17
30
|
const registry = getNpmRegistryUrl(registryUrl);
|
|
18
|
-
const
|
|
19
|
-
const res = await fetch(url);
|
|
31
|
+
const res = await fetch(packageUrl(registry, packageName));
|
|
20
32
|
if (!res.ok)
|
|
21
33
|
throw new Error(`Failed to fetch ${packageName} metadata from ${registry}`);
|
|
22
34
|
const metadata = await res.json();
|
|
@@ -26,4 +38,4 @@ async function getLatestPackageVersion(packageName, tag = "latest", registryUrl)
|
|
|
26
38
|
return version;
|
|
27
39
|
}
|
|
28
40
|
|
|
29
|
-
export { npmRegistryFromEnv, warnIgnoredNpmRegistry, getNpmRegistryUrl, getLatestPackageVersion };
|
|
41
|
+
export { npmRegistryFromEnv, warnIgnoredNpmRegistry, getNpmRegistryUrl, getPublishedVersions, getLatestPackageVersion };
|