@akanjs/cli 3.2.0-rc.3 → 3.2.0-rc.31
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 +2 -1
- package/CodeAgent-c17abdbf.js +11 -0
- package/{CodeTui-wv9yf7eq.js → CodeTui-jed1nj82.js} +822 -666
- package/README.ko.md +26 -1
- package/README.md +26 -1
- package/TunnelShare-mbfcaqg0.js +18 -0
- package/agent.command-9whnc6vb.js +56 -0
- package/akanCode.js +12 -12
- package/appExecutor-020cyesq.js +11 -0
- package/{application.command-6515t682.js → application.command-4eqvyxkw.js} +77 -36
- package/{applicationBuildRunner-bqbyeg84.js → applicationBuildRunner-frtcrqfd.js} +18 -13
- package/buildBatch.proc.js +26 -11
- package/{cloud.command-32esk0v1.js → cloud.command-hbvmeezn.js} +31 -28
- package/cloud.script-9kmbr3d6.js +35 -0
- package/{code.command-xk7rwq2x.js → code.command-0ayrenk4.js} +14 -9
- package/{context.command-jwenkkf0.js → context.command-php852kf.js} +28 -23
- package/context.runner-nngmn7c0.js +34 -0
- package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
- package/{devTui-cd03z4mx.js → devTui-rf374y2w.js} +1 -1
- package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
- package/{guideline.command-w6yqpdec.js → guideline.command-w1grfwh7.js} +9 -4
- package/guidelines/agentRule/agentRule.instruction.md +29 -12
- package/guidelines/akanApi/akanApi.instruction.md +6 -4
- package/guidelines/conventions/core.md +23 -5
- package/guidelines/conventions/rules/app.md +4 -1
- package/guidelines/conventions/rules/page.md +5 -0
- package/guidelines/conventions/rules/ts.md +3 -3
- package/guidelines/errorCodes/errorCodes.instruction.md +164 -0
- package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +171 -2
- package/guidelines/pageRule/pageRule.instruction.md +15 -1
- package/guidelines/runtimeRule/runtimeRule.instruction.md +12 -6
- package/guidelines/transportRule/transportRule.instruction.md +8 -1
- package/incrementalBuilder.proc.js +574 -410
- package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
- package/{index-xrmrvafh.js → index-0gaj78wn.js} +808 -694
- package/{index-j1hjb477.js → index-11d7nh8a.js} +1 -1
- package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
- package/{index-ygrdw6jw.js → index-1pjwsh2g.js} +65 -8
- package/{index-43acpsc7.js → index-28nk8w3j.js} +12 -12
- package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
- package/{index-8gm4yag8.js → index-42jhx2ya.js} +6 -6
- package/{index-2rqyrvcy.js → index-4st0hq72.js} +62 -33
- package/{index-bak9f2br.js → index-5d57kx0s.js} +15 -11
- package/{index-bdmgqzb5.js → index-6469101k.js} +58 -29
- package/{index-7kmbqp0b.js → index-6pxmcaq8.js} +1 -1
- package/{index-54s6knqe.js → index-6zb17wcm.js} +12 -10
- package/{index-0ba8nj4d.js → index-7bs463x7.js} +50 -38
- package/{index-y725zb1a.js → index-7v7tvgt7.js} +196 -168
- package/{index-r0a604h4.js → index-99kjwyma.js} +1 -1
- package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
- package/{index-386canwe.js → index-9rv2zt48.js} +186 -121
- package/{index-20wvskt8.js → index-9wab2ngg.js} +1 -1
- package/{index-2eym1yjb.js → index-9wjrwjgz.js} +288 -209
- package/{index-kcpk2d20.js → index-at6haq2x.js} +1474 -1139
- package/{index-6h775rv3.js → index-ba2xd32s.js} +53 -12
- package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
- package/{index-ngpt3zz3.js → index-bj8s07s7.js} +525 -440
- package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
- package/{index-vbhx60x5.js → index-cb91b6d8.js} +2140 -2165
- package/index-dss3ds74.js +127 -0
- package/{index-e22zedc2.js → index-f16kr6vj.js} +3 -3
- package/{index-ny2k80mv.js → index-ffa52fwf.js} +1 -1
- package/{index-djc5nxpy.js → index-fp5xf6ef.js} +6 -6
- package/{index-qrk06tfp.js → index-g45y5f3e.js} +2 -2
- package/{index-8jpc5fqv.js → index-g7jgd4xs.js} +2 -2
- package/index-j4yvgfhr.js +70 -0
- package/{index-ytpmk3pb.js → index-jgj31xvw.js} +18 -11
- package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
- package/{index-s34v3y28.js → index-m3t28rt3.js} +11 -11
- package/{index-dpgywgeq.js → index-m5gg0wzv.js} +27 -16
- package/index-na8r4a27.js +30 -0
- package/{index-h0p6n4k1.js → index-nm7nt9vm.js} +3 -3
- package/{index-j4hkbzj6.js → index-p06kfhdf.js} +6 -6
- package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
- package/{index-cmg5ngqa.js → index-p7beqww9.js} +2 -2
- package/{index-zhkcab5a.js → index-prgvqqxe.js} +580 -364
- package/{index-wfmpxke3.js → index-qssq2d41.js} +2775 -3677
- package/{index-sc0g6zbm.js → index-rwgqba9p.js} +24 -11
- package/{index-zcdmnfrf.js → index-s3m89wt2.js} +9 -9
- package/{index-v50xjbbe.js → index-t4d0ckde.js} +1 -1
- package/{index-9p260r4e.js → index-trffs83s.js} +538 -250
- package/{index-ddk49ypz.js → index-v929w7j7.js} +133 -49
- package/index-va90m8nd.js +25 -0
- package/index-vjbne22r.js +80 -0
- package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
- package/{index-39jz41jb.js → index-xs9a3ddt.js} +3 -3
- package/{index-84c2pgak.js → index-yvzm8mby.js} +94 -82
- package/{index-wr9magsr.js → index-yxkjsyx8.js} +3 -3
- package/index-ze48c0vd.js +788 -0
- package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
- package/index.js +29 -24
- package/libExecutor-tq994592.js +10 -0
- package/{library.command-qs8beggh.js → library.command-x219mhcx.js} +9 -4
- package/{localRegistry.command-hz4ged9n.js → localRegistry.command-zvdcejhn.js} +30 -24
- package/{module.command-z9js77m2.js → module.command-k6cwcm7g.js} +17 -8
- package/{package.command-zqenq8c0.js → package.command-vw7x09f8.js} +13 -8
- package/package.json +2 -2
- package/{page.command-t0nx1jat.js → page.command-gf06paq2.js} +9 -4
- package/{pipeline.command-2yjeas7m.js → pipeline.command-y07dgj9b.js} +14 -8
- package/pkgExecutor-stde3yc3.js +10 -0
- package/{primitive.command-v5kypwy4.js → primitive.command-edydvh07.js} +13 -8
- package/{projectTypecheck-s9hhe5sa.js → projectTypecheck-mk8wefvd.js} +2 -1
- package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
- package/{quality.command-q55j2htd.js → quality.command-mdb45vyr.js} +23 -16
- package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
- package/{repair.command-7ssbbdq2.js → repair.command-kvtaeecy.js} +13 -8
- package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
- package/{scalar.command-p5jb7z57.js → scalar.command-sjt9p5e1.js} +11 -6
- package/skills/akan-debug/SKILL.md +10 -3
- package/skills/akan-err/SKILL.md +7 -0
- package/skills/akan-mcp/SKILL.md +17 -2
- package/skills/akan-scaffold/SKILL.md +2 -2
- package/skills/akan-transport/SKILL.md +2 -0
- package/skills/akan-validate/SKILL.md +1 -0
- package/{subspace.command-7wxy6ptj.js → subspace.command-mkkqync4.js} +29 -23
- package/templates/app/page/_layout.tsx +13 -0
- package/templates/app/page/styles.css.template +40 -0
- package/templates/appSample/page/_index.tsx +9 -9
- package/templates/appSample/page/_layout.tsx +1 -0
- package/templates/appSample/page/styles.css.template +40 -5
- package/templates/appSample/ui/Recipe/jellyButton.ts +1 -1
- package/templates/biomeForm.ts +1 -1
- package/templates/env/_env.server.type.ts +1 -1
- package/templates/facetIndex/index.ts +2 -37
- package/templates/lib/sig.ts +0 -4
- package/templates/lib/useClient.ts +1 -1
- package/templates/workspaceRoot/AGENTS.md.template +2 -1
- package/{tunnel.command-22g11n0x.js → tunnel.command-tr5b3030.js} +17 -12
- package/{typeChecker-s640r6c0.js → typeChecker-bfrd1n9n.js} +1 -1
- package/typecheck.proc.js +6 -3
- package/{verify.command-m0wnndd7.js → verify.command-0p9h8tpp.js} +26 -20
- package/{workflow.command-jx8dqs9n.js → workflow.command-9mfcwqzj.js} +37 -19
- package/{workspace.command-ca9kfyt3.js → workspace.command-5hjtmcfs.js} +61 -54
- package/CodeAgent-e9c712an.js +0 -11
- package/TunnelShare-zkfkrw8w.js +0 -14
- package/agent.command-9erafkcb.js +0 -51
- package/cloud.script-arsagnq6.js +0 -30
- package/context.runner-mqpp67br.js +0 -29
- package/index-x3x31df8.js +0 -14
- /package/templates/{appSample → app}/public/fonts/Pretendard-Bold.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-Medium.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-Regular.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
JsonFormatter
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-qssq2d41.js";
|
|
5
5
|
|
|
6
|
-
// pkgs/@akanjs/devkit/maintainabilityBaseline.ts
|
|
6
|
+
// pkgs/@akanjs/devkit/quality/maintainabilityBaseline.ts
|
|
7
7
|
class MaintainabilityBaseline {
|
|
8
8
|
sections;
|
|
9
9
|
reasons;
|
|
@@ -19,8 +19,12 @@ class MaintainabilityBaseline {
|
|
|
19
19
|
"akan.store.root-write-chain",
|
|
20
20
|
"akan.component.write-chain",
|
|
21
21
|
"akan.write.placement",
|
|
22
|
-
"akan.service.call-in-loop"
|
|
22
|
+
"akan.service.call-in-loop",
|
|
23
|
+
"akan.error.bare-error"
|
|
23
24
|
];
|
|
25
|
+
static lateRules = new Set(["akan.error.bare-error"]);
|
|
26
|
+
static totalRules = new Set(["akan.error.bare-error"]);
|
|
27
|
+
static totalKey = "(total)";
|
|
24
28
|
static reasonedRules = new Set([
|
|
25
29
|
"akan.size.file",
|
|
26
30
|
"akan.size.component",
|
|
@@ -40,6 +44,8 @@ class MaintainabilityBaseline {
|
|
|
40
44
|
return violation.writeCount;
|
|
41
45
|
if (violation.kind === "writePlacement")
|
|
42
46
|
return violation.writes.length;
|
|
47
|
+
if (violation.kind === "bareError")
|
|
48
|
+
return violation.lines.length;
|
|
43
49
|
return violation.calls.length;
|
|
44
50
|
}
|
|
45
51
|
static isDebtRule(name) {
|
|
@@ -97,6 +103,21 @@ class MaintainabilityBaseline {
|
|
|
97
103
|
const recorded = this.recordedOf(violation);
|
|
98
104
|
return recorded !== undefined && MaintainabilityBaseline.countOf(violation) <= recorded;
|
|
99
105
|
}
|
|
106
|
+
unallowed(violations) {
|
|
107
|
+
const measured = MaintainabilityBaseline.of(violations);
|
|
108
|
+
return violations.filter((violation) => !(MaintainabilityBaseline.totalRules.has(violation.rule) && measured.totalOf(violation.rule) <= this.totalOf(violation.rule)) && !this.allows(violation));
|
|
109
|
+
}
|
|
110
|
+
staleTotals(violations) {
|
|
111
|
+
const measured = MaintainabilityBaseline.of(violations);
|
|
112
|
+
return [...MaintainabilityBaseline.totalRules].flatMap((rule) => {
|
|
113
|
+
const count = measured.totalOf(rule);
|
|
114
|
+
const recorded = this.totalOf(rule);
|
|
115
|
+
return count < recorded ? [{ rule, count, recorded }] : [];
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
totalOf(rule) {
|
|
119
|
+
return [...this.sections.get(rule)?.values() ?? []].reduce((sum, count) => sum + count, 0);
|
|
120
|
+
}
|
|
100
121
|
recordedOf(violation) {
|
|
101
122
|
return this.sections.get(violation.rule)?.get(violation.key);
|
|
102
123
|
}
|
|
@@ -114,19 +135,55 @@ class MaintainabilityBaseline {
|
|
|
114
135
|
}))
|
|
115
136
|
]));
|
|
116
137
|
}
|
|
138
|
+
rulesOutside(other) {
|
|
139
|
+
return [...this.sections].filter(([rule, counts]) => counts.size && (other === null || MaintainabilityBaseline.lateRules.has(rule) && !other.sections.has(rule))).map(([rule]) => rule);
|
|
140
|
+
}
|
|
141
|
+
withSectionsOf(other, rules) {
|
|
142
|
+
if (!other)
|
|
143
|
+
return this;
|
|
144
|
+
const sections = new Map(this.sections);
|
|
145
|
+
for (const rule of rules)
|
|
146
|
+
sections.set(rule, other.sections.get(rule) ?? new Map);
|
|
147
|
+
return new MaintainabilityBaseline(sections, this.reasons);
|
|
148
|
+
}
|
|
149
|
+
movedBy(moves) {
|
|
150
|
+
if (!moves.size)
|
|
151
|
+
return this;
|
|
152
|
+
const movedKey = (key) => {
|
|
153
|
+
const file = key.split("#", 1)[0] ?? key;
|
|
154
|
+
const to = moves.get(file);
|
|
155
|
+
return to === undefined ? key : `${to}${key.slice(file.length)}`;
|
|
156
|
+
};
|
|
157
|
+
const sections = new Map([...this.sections].map(([rule, counts]) => {
|
|
158
|
+
const moved = new Map;
|
|
159
|
+
for (const [key, count] of counts) {
|
|
160
|
+
const to = movedKey(key);
|
|
161
|
+
moved.set(to, Math.max(moved.get(to) ?? 0, count));
|
|
162
|
+
}
|
|
163
|
+
return [rule, moved];
|
|
164
|
+
}));
|
|
165
|
+
return new MaintainabilityBaseline(sections, new Map([...this.reasons].map(([key, reason]) => [movedKey(key), reason])));
|
|
166
|
+
}
|
|
117
167
|
tightenedBy(violations) {
|
|
118
168
|
const current = MaintainabilityBaseline.of(violations);
|
|
119
|
-
const sections = new Map([...this.sections].map(([rule, counts]) =>
|
|
120
|
-
rule
|
|
121
|
-
MaintainabilityBaseline
|
|
122
|
-
|
|
169
|
+
const sections = new Map([...this.sections].map(([rule, counts]) => {
|
|
170
|
+
const measured = current.sections.get(rule) ?? new Map;
|
|
171
|
+
if (!MaintainabilityBaseline.totalRules.has(rule))
|
|
172
|
+
return [rule, MaintainabilityBaseline.#lowered(counts, measured)];
|
|
173
|
+
return [rule, current.totalOf(rule) > this.totalOf(rule) ? counts : measured];
|
|
174
|
+
}));
|
|
123
175
|
return new MaintainabilityBaseline(sections).#withReasonsOf(this.reasons);
|
|
124
176
|
}
|
|
125
177
|
#withReasonsOf(reasons) {
|
|
126
178
|
return new MaintainabilityBaseline(this.sections, new Map([...reasons].filter(([key]) => this.#holdsReasoned(key))));
|
|
127
179
|
}
|
|
128
180
|
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 })));
|
|
181
|
+
return [...this.sections].flatMap(([rule, counts]) => MaintainabilityBaseline.totalRules.has(rule) ? this.#totalGrownFrom(committed, rule) : 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 })));
|
|
182
|
+
}
|
|
183
|
+
#totalGrownFrom(committed, rule) {
|
|
184
|
+
const count = this.totalOf(rule);
|
|
185
|
+
const recorded = committed.sections.has(rule) ? committed.totalOf(rule) : undefined;
|
|
186
|
+
return count > (recorded ?? 0) ? [{ rule, key: MaintainabilityBaseline.totalKey, count, committed: recorded }] : [];
|
|
130
187
|
}
|
|
131
188
|
stringify() {
|
|
132
189
|
const sections = MaintainabilityBaseline.debtRules.flatMap((rule) => {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
CommandContainer,
|
|
4
|
+
runner
|
|
5
|
+
} from "./index-9rv2zt48.js";
|
|
5
6
|
import {
|
|
6
7
|
WorkspaceExecutor
|
|
7
|
-
} from "./index-
|
|
8
|
+
} from "./index-qssq2d41.js";
|
|
8
9
|
import {
|
|
9
10
|
jsonText,
|
|
10
11
|
workflowPlanApproval,
|
|
@@ -30,27 +31,26 @@ import {
|
|
|
30
31
|
renderWorkflowApply,
|
|
31
32
|
renderWorkflowValidation,
|
|
32
33
|
renderWorkflowRunArtifact
|
|
33
|
-
} from "./index-
|
|
34
|
+
} from "./index-0gaj78wn.js";
|
|
34
35
|
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} from "./index-386canwe.js";
|
|
36
|
+
AkanContextAnalyzer
|
|
37
|
+
} from "./index-bj8s07s7.js";
|
|
38
38
|
import {
|
|
39
39
|
ModuleScript
|
|
40
|
-
} from "./index-
|
|
40
|
+
} from "./index-m3t28rt3.js";
|
|
41
41
|
import {
|
|
42
42
|
PrimitiveScript
|
|
43
|
-
} from "./index-
|
|
43
|
+
} from "./index-7bs463x7.js";
|
|
44
44
|
import {
|
|
45
45
|
spawnAkan,
|
|
46
46
|
isWorkspaceTarget
|
|
47
|
-
} from "./index-
|
|
47
|
+
} from "./index-42jhx2ya.js";
|
|
48
48
|
import {
|
|
49
49
|
ScalarScript
|
|
50
|
-
} from "./index-
|
|
50
|
+
} from "./index-nm7nt9vm.js";
|
|
51
51
|
import {
|
|
52
52
|
workflowSpecs
|
|
53
|
-
} from "./index-
|
|
53
|
+
} from "./index-t4d0ckde.js";
|
|
54
54
|
|
|
55
55
|
// pkgs/@akanjs/cli/workflow/workflow.runner.ts
|
|
56
56
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
FileSys2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-by2tvsq6.js";
|
|
5
5
|
|
|
6
|
-
// pkgs/@akanjs/devkit/dependencyScanner.ts
|
|
6
|
+
// pkgs/@akanjs/devkit/workspace/dependencyScanner.ts
|
|
7
7
|
import { builtinModules } from "module";
|
|
8
8
|
import * as path from "path";
|
|
9
9
|
import ignore from "ignore";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-
|
|
3
|
+
runner
|
|
4
|
+
} from "./index-9rv2zt48.js";
|
|
5
5
|
import {
|
|
6
6
|
writeWorkflowRunArtifact,
|
|
7
7
|
generatedFilePathsForTarget,
|
|
8
8
|
writeGeneratedSyncState,
|
|
9
9
|
createRepairReport,
|
|
10
10
|
renderRepairReport
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-0gaj78wn.js";
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
} from "./index-
|
|
13
|
+
AkanContextAnalyzer
|
|
14
|
+
} from "./index-bj8s07s7.js";
|
|
15
15
|
import {
|
|
16
16
|
isWorkflowSysName,
|
|
17
17
|
isWorkflowModuleName
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-va90m8nd.js";
|
|
19
19
|
|
|
20
20
|
// pkgs/@akanjs/cli/repair/repair.runner.ts
|
|
21
21
|
var akanArgPattern = /^(?:--?[a-z][a-zA-Z0-9-]*|[A-Za-z0-9@_][A-Za-z0-9@._/:,=-]*)$/;
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script,
|
|
5
|
-
ExitCodeError,
|
|
6
5
|
markCliErrorPrinted
|
|
7
|
-
} from "./index-
|
|
6
|
+
} from "./index-9rv2zt48.js";
|
|
7
|
+
import {
|
|
8
|
+
CliError
|
|
9
|
+
} from "./index-j4yvgfhr.js";
|
|
8
10
|
import {
|
|
9
11
|
AGENT_BLOCK_START,
|
|
10
12
|
AGENT_BLOCK_END,
|
|
@@ -12,41 +14,45 @@ import {
|
|
|
12
14
|
readDevkitVersion,
|
|
13
15
|
upsertAgentBlock,
|
|
14
16
|
renderRecipeEntries,
|
|
15
|
-
CLAUDE_COMMENT_RULE
|
|
16
|
-
|
|
17
|
-
LibExecutor
|
|
18
|
-
} from "./index-wfmpxke3.js";
|
|
17
|
+
CLAUDE_COMMENT_RULE
|
|
18
|
+
} from "./index-qssq2d41.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./index-
|
|
20
|
+
AppExecutor2
|
|
21
|
+
} from "./index-ze48c0vd.js";
|
|
22
22
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} from "./index-j6eeh5d7.js";
|
|
23
|
+
LibExecutor2
|
|
24
|
+
} from "./index-na8r4a27.js";
|
|
26
25
|
import {
|
|
27
26
|
AkanContextAnalyzer
|
|
28
|
-
} from "./index-
|
|
27
|
+
} from "./index-bj8s07s7.js";
|
|
29
28
|
import {
|
|
30
29
|
collectRecipeSources2,
|
|
31
30
|
scanRecipes2
|
|
32
|
-
} from "./index-
|
|
31
|
+
} from "./index-1p81ecbz.js";
|
|
32
|
+
import {
|
|
33
|
+
akanCodePaths2
|
|
34
|
+
} from "./index-p5zh7pmc.js";
|
|
35
|
+
import {
|
|
36
|
+
ConventionSet,
|
|
37
|
+
Prompter2
|
|
38
|
+
} from "./index-knpm8sdm.js";
|
|
33
39
|
import {
|
|
34
40
|
ApplicationRunner,
|
|
35
41
|
VerifyScope
|
|
36
|
-
} from "./index-
|
|
42
|
+
} from "./index-at6haq2x.js";
|
|
37
43
|
import {
|
|
38
44
|
WorkspaceRunner
|
|
39
|
-
} from "./index-
|
|
45
|
+
} from "./index-prgvqqxe.js";
|
|
40
46
|
import {
|
|
41
47
|
VerifyComments,
|
|
42
48
|
VerifyPipeline,
|
|
43
49
|
VerifyReport
|
|
44
|
-
} from "./index-
|
|
50
|
+
} from "./index-m5gg0wzv.js";
|
|
45
51
|
|
|
46
52
|
// pkgs/@akanjs/cli/agent/agent.script.ts
|
|
47
53
|
import { Logger as Logger3 } from "akanjs/common";
|
|
48
54
|
|
|
49
|
-
// pkgs/@akanjs/devkit/agentAssets.ts
|
|
55
|
+
// pkgs/@akanjs/devkit/guideline/agentAssets.ts
|
|
50
56
|
import fsPromise from "fs/promises";
|
|
51
57
|
import path from "path";
|
|
52
58
|
class AgentAssets {
|
|
@@ -79,7 +85,7 @@ class AgentAssets {
|
|
|
79
85
|
"modelUtil",
|
|
80
86
|
"framework"
|
|
81
87
|
],
|
|
82
|
-
"akan-err": [],
|
|
88
|
+
"akan-err": ["errorCodes"],
|
|
83
89
|
"akan-deps": [],
|
|
84
90
|
"akan-debug": [],
|
|
85
91
|
"akan-page": ["pageRule", "akanApi"],
|
|
@@ -432,6 +438,21 @@ ${Object.keys(AgentAssets.skillReferences).map((name) => `\`${name}\``).join(",
|
|
|
432
438
|
guideline.
|
|
433
439
|
|
|
434
440
|
`;
|
|
441
|
+
var maxListedChars = 160;
|
|
442
|
+
var renderNames = (names) => {
|
|
443
|
+
if (!names.length)
|
|
444
|
+
return "none";
|
|
445
|
+
const shown = [];
|
|
446
|
+
let length = 0;
|
|
447
|
+
for (const name of names) {
|
|
448
|
+
if (shown.length && length + name.length > maxListedChars)
|
|
449
|
+
break;
|
|
450
|
+
shown.push(name);
|
|
451
|
+
length += name.length + 2;
|
|
452
|
+
}
|
|
453
|
+
const rest = names.length - shown.length;
|
|
454
|
+
return rest ? `${shown.join(", ")}, and ${rest} more` : shown.join(", ");
|
|
455
|
+
};
|
|
435
456
|
var renderManagedBlock = async (workspace) => {
|
|
436
457
|
const context = await AkanContextAnalyzer.analyze(workspace);
|
|
437
458
|
const conventions = await Prompter2.getConventionSet();
|
|
@@ -441,9 +462,9 @@ var renderManagedBlock = async (workspace) => {
|
|
|
441
462
|
const block = `## Workspace
|
|
442
463
|
|
|
443
464
|
- Repo: ${context.repoName}
|
|
444
|
-
- Apps: ${appNames
|
|
445
|
-
- Libraries: ${context.libs.map((lib) => lib.name)
|
|
446
|
-
- Packages: ${context.pkgs.map((pkg) => pkg.name)
|
|
465
|
+
- Apps: ${renderNames(appNames)}
|
|
466
|
+
- Libraries: ${renderNames(context.libs.map((lib) => lib.name))}
|
|
467
|
+
- Packages: ${renderNames(context.pkgs.map((pkg) => pkg.name))}
|
|
447
468
|
|
|
448
469
|
${conventions.core}
|
|
449
470
|
|
|
@@ -593,9 +614,9 @@ class AgentRunner extends runner("agent") {
|
|
|
593
614
|
}
|
|
594
615
|
};
|
|
595
616
|
for (const name of libNames)
|
|
596
|
-
await syncScope(
|
|
617
|
+
await syncScope(LibExecutor2.from(workspace, name));
|
|
597
618
|
for (const name of appNames)
|
|
598
|
-
await syncScope(
|
|
619
|
+
await syncScope(AppExecutor2.from(workspace, name));
|
|
599
620
|
return written;
|
|
600
621
|
}
|
|
601
622
|
}
|
|
@@ -610,7 +631,7 @@ var resolveTargets = (target) => {
|
|
|
610
631
|
const single = singleTargets.find((name) => name === target);
|
|
611
632
|
if (single)
|
|
612
633
|
return [single];
|
|
613
|
-
throw new
|
|
634
|
+
throw new CliError("usage", `Unknown agent target: ${target}. Use cursor, agents-md, claude, rules, skills, hooks, or all.`);
|
|
614
635
|
};
|
|
615
636
|
|
|
616
637
|
class AgentScript extends script("agent", [AgentRunner]) {
|
|
@@ -618,7 +639,7 @@ class AgentScript extends script("agent", [AgentRunner]) {
|
|
|
618
639
|
if (action === "hook")
|
|
619
640
|
return await this.#hook(workspace, target);
|
|
620
641
|
if (action !== "install")
|
|
621
|
-
throw new
|
|
642
|
+
throw new CliError("usage", `Unknown agent action: ${action}. Use "install" or "hook".`);
|
|
622
643
|
if (check)
|
|
623
644
|
return await this.#check(workspace, resolveTargets(target));
|
|
624
645
|
const written = await this.agentRunner.install(workspace, resolveTargets(target), { force });
|
|
@@ -634,19 +655,27 @@ ${written.map((file) => `- ${file}`).join(`
|
|
|
634
655
|
const lines = drift.map(({ path, change }) => `${path} ${change}`);
|
|
635
656
|
Logger3.rawLog([`agent files differ \xB7 ${files} \xB7 run \`akan agent install\``, ...lines].join(`
|
|
636
657
|
`));
|
|
637
|
-
const failure = new
|
|
658
|
+
const failure = new CliError("checkFailed", "agent files differ");
|
|
638
659
|
markCliErrorPrinted(failure);
|
|
639
660
|
throw failure;
|
|
640
661
|
}
|
|
641
662
|
async#hook(workspace, event) {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
663
|
+
try {
|
|
664
|
+
if (!AgentHook.isEvent(event))
|
|
665
|
+
throw new CliError("usage", `Unknown hook: ${event}. Use ${AgentHook.events.join(", ")}.`);
|
|
666
|
+
const raw = (await Bun.stdin.text()).trim();
|
|
667
|
+
const input = raw ? JSON.parse(raw) : {};
|
|
668
|
+
const response = AgentHook.respond(event, await new AgentHook(workspace).run(event, input));
|
|
669
|
+
if (response)
|
|
670
|
+
process.stdout.write(`${response}
|
|
649
671
|
`);
|
|
672
|
+
} catch (error) {
|
|
673
|
+
const message = CliError.messageOf(error);
|
|
674
|
+
Logger3.rawLog(message, undefined, "error");
|
|
675
|
+
const failure = new CliError("failed", message, { cause: error });
|
|
676
|
+
markCliErrorPrinted(failure);
|
|
677
|
+
throw failure;
|
|
678
|
+
}
|
|
650
679
|
}
|
|
651
680
|
}
|
|
652
681
|
|
|
@@ -2,27 +2,30 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-9rv2zt48.js";
|
|
6
6
|
import {
|
|
7
7
|
FileSys2
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-by2tvsq6.js";
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
} from "./index-
|
|
12
|
-
import {
|
|
13
|
-
TypeScriptDependencyScanner2
|
|
14
|
-
} from "./index-qd7xn2bk.js";
|
|
10
|
+
PkgExecutor2
|
|
11
|
+
} from "./index-dss3ds74.js";
|
|
15
12
|
import {
|
|
16
13
|
FrameworkGraph
|
|
17
|
-
} from "./index-
|
|
14
|
+
} from "./index-p7beqww9.js";
|
|
18
15
|
import {
|
|
19
16
|
MaintainabilityBaseline
|
|
20
|
-
} from "./index-
|
|
17
|
+
} from "./index-1pjwsh2g.js";
|
|
18
|
+
import {
|
|
19
|
+
TypeScriptDependencyScanner2
|
|
20
|
+
} from "./index-2ny1e95c.js";
|
|
21
|
+
import {
|
|
22
|
+
assertPackageName
|
|
23
|
+
} from "./index-va90m8nd.js";
|
|
21
24
|
|
|
22
25
|
// pkgs/@akanjs/cli/package/package.runner.ts
|
|
23
26
|
import path2 from "path";
|
|
24
27
|
|
|
25
|
-
// pkgs/@akanjs/devkit/packageExportsMap.ts
|
|
28
|
+
// pkgs/@akanjs/devkit/workspace/packageExportsMap.ts
|
|
26
29
|
import { statSync } from "fs";
|
|
27
30
|
import path from "path";
|
|
28
31
|
|
|
@@ -370,7 +373,7 @@ ${problems.join(`
|
|
|
370
373
|
return { file: FrameworkGraph.architectureFile, changed: next !== current };
|
|
371
374
|
}
|
|
372
375
|
async verifyAkanPublishPackages(workspace) {
|
|
373
|
-
const pkgs = PackageRunner.publishableAkanPackages.map((pkgName) =>
|
|
376
|
+
const pkgs = PackageRunner.publishableAkanPackages.map((pkgName) => PkgExecutor2.from(workspace, pkgName));
|
|
374
377
|
const peerExportsMaps = new Map;
|
|
375
378
|
for (const pkg of pkgs) {
|
|
376
379
|
if (!await Bun.file(`${pkg.dist.cwdPath}/package.json`).exists())
|
|
@@ -404,6 +407,7 @@ class PackageScript extends script("package", [PackageRunner]) {
|
|
|
404
407
|
return await this.packageRunner.version(workspace, { log });
|
|
405
408
|
}
|
|
406
409
|
async createPackage(workspace, pkgName) {
|
|
410
|
+
assertPackageName(pkgName);
|
|
407
411
|
const spinner = workspace.spinning(`Creating package in pkgs/${pkgName}...`);
|
|
408
412
|
await this.packageRunner.createPackage(workspace, pkgName);
|
|
409
413
|
spinner.succeed(`Package in pkgs/${pkgName} is created`);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
+
ROOT_LAYOUT_SYSTEM,
|
|
4
|
+
isImplicitRootLayoutKey,
|
|
3
5
|
resolveSsrPageEntriesForApp
|
|
4
|
-
} from "./index-
|
|
6
|
+
} from "./index-ze48c0vd.js";
|
|
5
7
|
import {
|
|
6
8
|
computeRouteSeedIndex,
|
|
7
9
|
saveRouteSeedIndex,
|
|
@@ -9,12 +11,12 @@ import {
|
|
|
9
11
|
ClientEntriesBundler,
|
|
10
12
|
VENDOR_SPECIFIERS,
|
|
11
13
|
RouteClientBuilder
|
|
12
|
-
} from "./index-
|
|
14
|
+
} from "./index-cb91b6d8.js";
|
|
13
15
|
import {
|
|
14
16
|
SOURCE_EXTS,
|
|
15
17
|
FontOptimizer,
|
|
16
18
|
FontPruner
|
|
17
|
-
} from "./index-
|
|
19
|
+
} from "./index-7v7tvgt7.js";
|
|
18
20
|
import {
|
|
19
21
|
BarrelAnalyzer,
|
|
20
22
|
createTsconfigPackageResolver,
|
|
@@ -22,7 +24,7 @@ import {
|
|
|
22
24
|
CsrEntryFiles,
|
|
23
25
|
toClientReferencePath,
|
|
24
26
|
PagesBundleBuilder
|
|
25
|
-
} from "./index-
|
|
27
|
+
} from "./index-yvzm8mby.js";
|
|
26
28
|
import {
|
|
27
29
|
CssBlockParser
|
|
28
30
|
} from "./index-62md4dwy.js";
|
|
@@ -98,7 +100,7 @@ class AllRoutesBuilder {
|
|
|
98
100
|
};
|
|
99
101
|
#knownSet = new Set;
|
|
100
102
|
#routeIds = [];
|
|
101
|
-
#
|
|
103
|
+
#ssrEntriesByRoute = new Map;
|
|
102
104
|
#externalsByChunkUrl = {};
|
|
103
105
|
#discovery = null;
|
|
104
106
|
constructor(app, command = "start") {
|
|
@@ -111,14 +113,16 @@ class AllRoutesBuilder {
|
|
|
111
113
|
const pageEntries = await resolveSsrPageEntriesForApp(this.#app, pageKeys);
|
|
112
114
|
const seedIndex = computeRouteSeedIndex(pageEntries);
|
|
113
115
|
this.#app.verbose(`[build-all] discovered ${seedIndex.entries.length} routes`);
|
|
114
|
-
|
|
116
|
+
const discovery = await GraphClientEntryDiscovery.create(this.#app);
|
|
117
|
+
this.#discovery = discovery;
|
|
118
|
+
const importsAs = await this.#ssrImportsAs(discovery, pageEntries);
|
|
115
119
|
const allEntries = new Set;
|
|
116
120
|
for (const entry of seedIndex.entries) {
|
|
117
121
|
const seeds = Array.from(new Set([...seedIndex.globalLayoutFiles, ...entry.seeds]));
|
|
118
|
-
const routeEntries = await
|
|
122
|
+
const routeEntries = await discovery.discover(seeds);
|
|
119
123
|
for (const discovered of routeEntries)
|
|
120
124
|
allEntries.add(discovered);
|
|
121
|
-
this.#
|
|
125
|
+
this.#ssrEntriesByRoute.set(entry.routeId, await discovery.discover(seeds, { importsAs }));
|
|
122
126
|
this.#routeIds.push(entry.routeId);
|
|
123
127
|
}
|
|
124
128
|
this.#app.verbose(`[build-all] ${allEntries.size} client entries across ${this.#routeIds.length} routes`);
|
|
@@ -134,10 +138,22 @@ class AllRoutesBuilder {
|
|
|
134
138
|
this.#app.verbose(`[build-all] wrote ${manifestPath} routes=${this.#routeIds.length} entries=${this.#merged.knownEntries.length}`);
|
|
135
139
|
return { manifest, manifestPath, seedIndex };
|
|
136
140
|
}
|
|
141
|
+
async#ssrImportsAs(discovery, pageEntries) {
|
|
142
|
+
const { specifier, ssrShell, importsNoSsrPageRenders } = ROOT_LAYOUT_SYSTEM;
|
|
143
|
+
const importsAs = new Map;
|
|
144
|
+
const toShell = new Map([[specifier, ssrShell]]);
|
|
145
|
+
for (const { key, moduleAbsPath } of pageEntries)
|
|
146
|
+
if (isImplicitRootLayoutKey(key))
|
|
147
|
+
importsAs.set(path.resolve(moduleAbsPath), toShell);
|
|
148
|
+
const system = await discovery.resolveImport(specifier, this.#app.cwdPath);
|
|
149
|
+
if (system)
|
|
150
|
+
importsAs.set(system, new Map(importsNoSsrPageRenders.map((spec) => [spec, null])));
|
|
151
|
+
return importsAs;
|
|
152
|
+
}
|
|
137
153
|
async writeModulePreloads(runtimeChunks) {
|
|
138
154
|
const preloads = new RouteModulePreloads({
|
|
139
155
|
runtimeChunks,
|
|
140
|
-
entriesByRoute: this.#
|
|
156
|
+
entriesByRoute: this.#ssrEntriesByRoute,
|
|
141
157
|
clientManifest: this.#merged.clientManifest,
|
|
142
158
|
externalsByChunkUrl: this.#externalsByChunkUrl,
|
|
143
159
|
workspaceRoot: this.#app.workspace.workspaceRoot
|
|
@@ -975,16 +991,7 @@ class SsrBaseArtifactBuilder {
|
|
|
975
991
|
const rscClientUrl = clientBundle.entryUrlsByAbsPath.get(rscClientEntry) ?? "";
|
|
976
992
|
const rscRuntimeSsrManifest = {
|
|
977
993
|
moduleLoading: null,
|
|
978
|
-
moduleMap:
|
|
979
|
-
const ssrOutput = ssrBundle.entryOutputAbsByAbsPath.get(rscSegmentOutletEntry);
|
|
980
|
-
if (!ssrOutput || key !== `${clientBundle.clientReferenceIdByAbsPath.get(rscSegmentOutletEntry)}#${row.name}`) {
|
|
981
|
-
return null;
|
|
982
|
-
}
|
|
983
|
-
return [
|
|
984
|
-
row.id,
|
|
985
|
-
{ [row.name]: { id: ssrOutput, chunks: [ssrOutput, ssrOutput], name: row.name, async: true } }
|
|
986
|
-
];
|
|
987
|
-
}).filter((entry) => Boolean(entry)))
|
|
994
|
+
moduleMap: SsrBaseArtifactBuilder.outletModuleMap(clientBundle.manifest, clientBundle.clientReferenceIdByAbsPath.get(rscSegmentOutletEntry), ssrBundle.entryOutputAbsByAbsPath.get(rscSegmentOutletEntry))
|
|
988
995
|
};
|
|
989
996
|
const vendorMap = Object.fromEntries(vendorEntries.map(({ specifier, absPath }) => [specifier, clientBundle.entryUrlsByAbsPath.get(absPath) ?? ""]));
|
|
990
997
|
this.#app.verbose(`[base-artifact] rscClientUrl=${rscClientUrl} vendors=${Object.keys(vendorMap).length}`);
|
|
@@ -1000,6 +1007,20 @@ class SsrBaseArtifactBuilder {
|
|
|
1000
1007
|
}
|
|
1001
1008
|
};
|
|
1002
1009
|
}
|
|
1010
|
+
static outletModuleMap(manifest, outletReferenceId, ssrOutput) {
|
|
1011
|
+
const moduleMap = {};
|
|
1012
|
+
if (!ssrOutput || !outletReferenceId)
|
|
1013
|
+
return moduleMap;
|
|
1014
|
+
for (const [key, row] of Object.entries(manifest)) {
|
|
1015
|
+
if (key !== `${outletReferenceId}#${row.name}`)
|
|
1016
|
+
continue;
|
|
1017
|
+
moduleMap[row.id] = {
|
|
1018
|
+
...moduleMap[row.id],
|
|
1019
|
+
[row.name]: { id: ssrOutput, chunks: [ssrOutput, ssrOutput], name: row.name, async: true }
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
return moduleMap;
|
|
1023
|
+
}
|
|
1003
1024
|
async#resolveAkanServerPath() {
|
|
1004
1025
|
const candidates = [];
|
|
1005
1026
|
try {
|
|
@@ -1070,28 +1091,36 @@ class VendorImportScanner {
|
|
|
1070
1091
|
for (const specifier of specifiers)
|
|
1071
1092
|
this.#names.set(specifier, new Set);
|
|
1072
1093
|
}
|
|
1073
|
-
static async exportsUsedIn(dir, specifiers) {
|
|
1094
|
+
static async exportsUsedIn(dir, specifiers, entryUrls) {
|
|
1074
1095
|
const scanner = new VendorImportScanner(specifiers);
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1096
|
+
const scanned = [];
|
|
1097
|
+
if (fs3.existsSync(dir))
|
|
1098
|
+
for await (const relative of new Bun.Glob("**/*.js").scan({ cwd: dir })) {
|
|
1099
|
+
scanner.scan(await Bun.file(path8.join(dir, relative)).text(), relative);
|
|
1100
|
+
scanned.push(`/${relative.split(path8.sep).join("/")}`);
|
|
1101
|
+
}
|
|
1102
|
+
const unread = [...new Set(entryUrls)].filter((url) => !scanned.some((relative) => url.endsWith(relative)));
|
|
1103
|
+
if (unread.length > 0) {
|
|
1104
|
+
const named = `${unread.slice(0, 3).join(", ")}${unread.length > 3 ? `, and ${unread.length - 3} more` : ""}`;
|
|
1105
|
+
throw new Error(`[VendorImportScanner] no file under ${dir} for the route client entries ${named}; narrowing the vendor entries without them would drop names those pages import`);
|
|
1106
|
+
}
|
|
1079
1107
|
return scanner.usedExports();
|
|
1080
1108
|
}
|
|
1081
1109
|
scan(source, fileName = "chunk.js") {
|
|
1082
1110
|
if (![...this.#specifiers].some((specifier) => source.includes(specifier)))
|
|
1083
1111
|
return this;
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1112
|
+
const stack = [ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, false, ts.ScriptKind.JS)];
|
|
1113
|
+
for (let node = stack.pop();node; node = stack.pop()) {
|
|
1086
1114
|
if (ts.isImportDeclaration(node))
|
|
1087
1115
|
this.#readImport(node);
|
|
1088
1116
|
else if (ts.isExportDeclaration(node))
|
|
1089
1117
|
this.#readExport(node);
|
|
1090
1118
|
else if (ts.isCallExpression(node))
|
|
1091
1119
|
this.#readCall(node);
|
|
1092
|
-
ts.forEachChild(node,
|
|
1093
|
-
|
|
1094
|
-
|
|
1120
|
+
ts.forEachChild(node, (child) => {
|
|
1121
|
+
stack.push(child);
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1095
1124
|
return this;
|
|
1096
1125
|
}
|
|
1097
1126
|
usedExports() {
|