@akanjs/cli 3.2.0-rc.3 → 3.2.0-rc.30
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 +5 -3
- 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 +158 -0
- package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +96 -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 +14 -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,40 +1,48 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ApplicationBuildReporter
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-7v7tvgt7.js";
|
|
5
5
|
import {
|
|
6
6
|
script,
|
|
7
|
-
ExitCodeError,
|
|
8
7
|
markCliErrorPrinted,
|
|
9
8
|
assertPromptable
|
|
10
|
-
} from "./index-
|
|
9
|
+
} from "./index-9rv2zt48.js";
|
|
11
10
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} from "./index-
|
|
11
|
+
CliError
|
|
12
|
+
} from "./index-j4yvgfhr.js";
|
|
13
|
+
import {
|
|
14
|
+
SysExecutor
|
|
15
|
+
} from "./index-qssq2d41.js";
|
|
16
|
+
import {
|
|
17
|
+
AppExecutor2
|
|
18
|
+
} from "./index-ze48c0vd.js";
|
|
19
|
+
import {
|
|
20
|
+
LibExecutor2
|
|
21
|
+
} from "./index-na8r4a27.js";
|
|
22
|
+
import {
|
|
23
|
+
PkgExecutor2
|
|
24
|
+
} from "./index-dss3ds74.js";
|
|
17
25
|
import {
|
|
18
26
|
DesktopServerStage
|
|
19
|
-
} from "./index-
|
|
27
|
+
} from "./index-9wab2ngg.js";
|
|
20
28
|
import {
|
|
21
29
|
LibraryScript
|
|
22
|
-
} from "./index-
|
|
30
|
+
} from "./index-6zb17wcm.js";
|
|
23
31
|
import {
|
|
24
32
|
ApplicationRunner,
|
|
25
33
|
VerifyScope
|
|
26
|
-
} from "./index-
|
|
34
|
+
} from "./index-at6haq2x.js";
|
|
27
35
|
import {
|
|
28
36
|
PreviewChrome2,
|
|
29
37
|
PreviewView2,
|
|
30
38
|
stripAnsi
|
|
31
|
-
} from "./index-
|
|
39
|
+
} from "./index-rwgqba9p.js";
|
|
32
40
|
import {
|
|
33
41
|
formatSlicePlan
|
|
34
|
-
} from "./index-
|
|
42
|
+
} from "./index-g7jgd4xs.js";
|
|
35
43
|
import {
|
|
36
44
|
assertPlainName
|
|
37
|
-
} from "./index-
|
|
45
|
+
} from "./index-va90m8nd.js";
|
|
38
46
|
import {
|
|
39
47
|
openBrowser
|
|
40
48
|
} from "./index-9dp031by.js";
|
|
@@ -625,6 +633,7 @@ class AppPreview {
|
|
|
625
633
|
static mobileViewport = { width: 390, height: 844 };
|
|
626
634
|
static desktopViewport = { width: 1280, height: 800 };
|
|
627
635
|
static csrTarget = "preview";
|
|
636
|
+
static #fullUrl = /^https?:\/\//i;
|
|
628
637
|
static settleMs = 1000;
|
|
629
638
|
static logGraceMs = 300;
|
|
630
639
|
static stopGraceMs = 15000;
|
|
@@ -633,17 +642,10 @@ class AppPreview {
|
|
|
633
642
|
const unavailable = PreviewView2.unavailableReason(engine);
|
|
634
643
|
if (unavailable)
|
|
635
644
|
throw new Error(unavailable);
|
|
636
|
-
const { i18n, api } = await app.getConfig();
|
|
637
645
|
const changed = options.changed ? await AppPreview.#changedPages(app) : { paths: [], skipped: [] };
|
|
638
|
-
if (options.changed && !changed.paths.length && !options.paths?.length)
|
|
639
|
-
throw new Error(`No page to open: ${changed.skipped.join("; ")}. Pass a concrete path, e.g. \`akan preview ${app.name} /memo/1\`.`);
|
|
640
|
-
const paths = AppPreview.pagePaths([...options.paths ?? [], ...changed.paths], i18n, {
|
|
641
|
-
csr: !!options.csr,
|
|
642
|
-
apiPrefix: api.prefix,
|
|
643
|
-
publicDir: path2.join(app.cwdPath, "public")
|
|
644
|
-
});
|
|
645
646
|
const port = await app.getDevPort();
|
|
646
647
|
const origin = `http://localhost:${port}`;
|
|
648
|
+
const plan = await AppPreview.planOf(app, options, changed, origin);
|
|
647
649
|
const root = app.workspace.workspaceRoot;
|
|
648
650
|
const previewDir = path2.join(ApplicationRunner.runtimeDirOf(app), "preview");
|
|
649
651
|
const started = await ApplicationRunner.answers(origin, app.name, root) ? null : await AppPreview.#startServer(app, port, previewDir);
|
|
@@ -658,6 +660,7 @@ class AppPreview {
|
|
|
658
660
|
serverLog: started ? path2.relative(root, started.logPath) : null,
|
|
659
661
|
logsRead: false,
|
|
660
662
|
skipped: changed.skipped,
|
|
663
|
+
notes: plan.notes,
|
|
661
664
|
pages: []
|
|
662
665
|
};
|
|
663
666
|
try {
|
|
@@ -667,7 +670,7 @@ class AppPreview {
|
|
|
667
670
|
const tail = await AppPreview.#tail(app, records);
|
|
668
671
|
report.logsRead = !!tail;
|
|
669
672
|
try {
|
|
670
|
-
for (const pagePath of paths) {
|
|
673
|
+
for (const pagePath of plan.paths) {
|
|
671
674
|
const mark = records.length;
|
|
672
675
|
const page = await AppPreview.#probe(origin, pagePath, {
|
|
673
676
|
engine,
|
|
@@ -693,12 +696,40 @@ class AppPreview {
|
|
|
693
696
|
started?.proc.unref();
|
|
694
697
|
}
|
|
695
698
|
}
|
|
696
|
-
static
|
|
699
|
+
static async planOf(app, options, changed, origin) {
|
|
700
|
+
const typed = options.paths ?? [];
|
|
701
|
+
if (options.changed && !changed.paths.length && !typed.length)
|
|
702
|
+
throw new Error(`No page to open: ${changed.skipped.join("; ")}. Pass a concrete path, e.g. \`akan preview ${app.name} /memo/1\`.`);
|
|
703
|
+
const { i18n, api } = await app.getConfig();
|
|
704
|
+
const { paths, asWritten, folded } = AppPreview.#plan(typed, i18n, {
|
|
705
|
+
csr: !!options.csr,
|
|
706
|
+
apiPrefix: api.prefix,
|
|
707
|
+
publicDir: path2.join(app.cwdPath, "public"),
|
|
708
|
+
pages: changed.paths
|
|
709
|
+
});
|
|
710
|
+
const dev = new URL(origin);
|
|
711
|
+
const isDevServer = (url) => url.protocol === dev.protocol && url.port === dev.port && AppPreview.#isDevHost(url.hostname);
|
|
712
|
+
const elsewhere = [...new Set(typed)].filter((raw) => AppPreview.#fullUrl.test(raw) && !isDevServer(new URL(raw)));
|
|
713
|
+
const skipsBoot = asWritten;
|
|
714
|
+
const notes = [
|
|
715
|
+
...elsewhere.length ? [
|
|
716
|
+
`${elsewhere.join(", ")} ${elsewhere.length === 1 ? "names another server: its path opens" : "name other servers: their paths open"} on ${origin}.`
|
|
717
|
+
] : [],
|
|
718
|
+
...options.csr && skipsBoot.length ? [
|
|
719
|
+
`--csr does not apply to ${skipsBoot.join(", ")}: ${skipsBoot.length === 1 ? "it opens" : "they open"} without the CSR boot.`
|
|
720
|
+
] : [],
|
|
721
|
+
...folded.map(({ raw, kept }) => `${raw} opens as ${kept}, which writes the same screenshot.`)
|
|
722
|
+
];
|
|
723
|
+
return { paths, notes };
|
|
724
|
+
}
|
|
725
|
+
static #plan(paths, i18n, { csr, apiPrefix = "/api", publicDir = null, pages = [] }) {
|
|
697
726
|
const keepsUnprefixed = i18n.localePrefix === "as-needed" && !csr;
|
|
698
|
-
const
|
|
699
|
-
const url =
|
|
700
|
-
|
|
701
|
-
|
|
727
|
+
const urlOf = (raw) => {
|
|
728
|
+
const url = AppPreview.#fullUrl.test(raw) ? new URL(raw) : AppPreview.probeUrlOf("http://localhost", raw);
|
|
729
|
+
url.pathname = url.pathname.replace(/^\/{2,}/, "/");
|
|
730
|
+
return url;
|
|
731
|
+
};
|
|
732
|
+
const asPage = (url) => {
|
|
702
733
|
const [first] = url.pathname.split("/").filter(Boolean);
|
|
703
734
|
if (!keepsUnprefixed && (!first || !i18n.locales.includes(first)))
|
|
704
735
|
url.pathname = `/${i18n.defaultLocale}${url.pathname === "/" ? "/" : url.pathname}`;
|
|
@@ -707,11 +738,45 @@ class AppPreview {
|
|
|
707
738
|
url.searchParams.set("akanMobileTarget", AppPreview.csrTarget);
|
|
708
739
|
}
|
|
709
740
|
return `${url.pathname}${url.search}`;
|
|
741
|
+
};
|
|
742
|
+
const rows = (paths.length || pages.length ? paths : ["/"]).map((raw) => {
|
|
743
|
+
const url = urlOf(raw);
|
|
744
|
+
const isPage = !AppPreview.#fullUrl.test(raw) && AppPreview.#isPagePath(url.pathname, i18n, { apiPrefix, publicDir });
|
|
745
|
+
return { raw, path: isPage ? asPage(url) : `${url.pathname}${url.search}`, asWritten: !isPage };
|
|
710
746
|
});
|
|
711
|
-
|
|
747
|
+
for (const page of pages)
|
|
748
|
+
rows.push({ raw: null, path: asPage(urlOf(page)), asWritten: false });
|
|
749
|
+
const byScreenshot = new Map;
|
|
750
|
+
const folded = [];
|
|
751
|
+
for (const row of rows) {
|
|
752
|
+
const name = AppPreview.screenshotName(row.path);
|
|
753
|
+
const kept = byScreenshot.get(name);
|
|
754
|
+
if (!kept)
|
|
755
|
+
byScreenshot.set(name, row);
|
|
756
|
+
else if (row.raw !== null && kept.path !== row.path)
|
|
757
|
+
folded.push({ raw: row.raw, kept: kept.path });
|
|
758
|
+
}
|
|
759
|
+
const planned = [...byScreenshot.values()];
|
|
760
|
+
return {
|
|
761
|
+
paths: planned.map((row) => row.path),
|
|
762
|
+
asWritten: planned.flatMap((row) => row.asWritten && row.raw !== null ? [row.raw] : []),
|
|
763
|
+
folded
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
static #isDevHost(hostname) {
|
|
767
|
+
return ["localhost", "127.0.0.1", "0.0.0.0"].includes(hostname.replace(/\.$/, ""));
|
|
712
768
|
}
|
|
713
|
-
static
|
|
714
|
-
|
|
769
|
+
static probeUrlOf(origin, pagePath) {
|
|
770
|
+
return new URL(`${origin}${pagePath.startsWith("/") ? "" : "/"}${pagePath}`);
|
|
771
|
+
}
|
|
772
|
+
static #serverFiles = new Set([
|
|
773
|
+
"/favicon.ico",
|
|
774
|
+
"/robots.txt",
|
|
775
|
+
"/sitemap.xml",
|
|
776
|
+
"/manifest.webmanifest",
|
|
777
|
+
"/openapi.json",
|
|
778
|
+
"/mcp"
|
|
779
|
+
]);
|
|
715
780
|
static #isPagePath(pathname, i18n, { apiPrefix, publicDir }) {
|
|
716
781
|
const segments = pathname.split("/").filter(Boolean);
|
|
717
782
|
const [first] = segments;
|
|
@@ -720,9 +785,11 @@ class AppPreview {
|
|
|
720
785
|
const prefixes = ["/_akan", "/__csr", "/__rsc", "/.well-known", apiPrefix.replace(/\/+$/, "")].filter(Boolean);
|
|
721
786
|
if (prefixes.some((prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`)))
|
|
722
787
|
return false;
|
|
788
|
+
if (pathname.endsWith("/"))
|
|
789
|
+
return true;
|
|
723
790
|
if (AppPreview.#serverFiles.has(pathname))
|
|
724
791
|
return false;
|
|
725
|
-
if (segments.length === 2 &&
|
|
792
|
+
if (segments.length === 2 && segments[1] === "manifest.webmanifest")
|
|
726
793
|
return false;
|
|
727
794
|
return !(publicDir && AppPreview.#isPublicFile(publicDir, pathname));
|
|
728
795
|
}
|
|
@@ -776,9 +843,21 @@ class AppPreview {
|
|
|
776
843
|
return { paths, skipped };
|
|
777
844
|
}
|
|
778
845
|
static screenshotName(pagePath) {
|
|
779
|
-
const url =
|
|
780
|
-
const
|
|
781
|
-
|
|
846
|
+
const url = AppPreview.probeUrlOf("http://localhost", pagePath);
|
|
847
|
+
const slugOf = (text) => text.replace(/[^\w-]/g, "_");
|
|
848
|
+
const hashOf = (text) => Bun.hash(text).toString(36).slice(0, 6);
|
|
849
|
+
const pathname = url.pathname.replace(/(.)\/+$/, "$1");
|
|
850
|
+
const plain = pathname.split("/").filter(Boolean).join("-");
|
|
851
|
+
const isPlain = /^(\/[a-z0-9]+)*$/.test(pathname) && plain.length <= 80;
|
|
852
|
+
const page = !plain ? "_index" : isPlain ? plain : `${slugOf(plain).slice(0, 80)}_${hashOf(pathname)}`;
|
|
853
|
+
const boot = ["csr=true", `akanMobileTarget=${AppPreview.csrTarget}`];
|
|
854
|
+
const pairs = url.search.slice(1).split("&").filter(Boolean);
|
|
855
|
+
const isBoot = boot.every((pair) => pairs.includes(pair));
|
|
856
|
+
const rest = isBoot ? pairs.filter((pair) => !boot.includes(pair)) : pairs;
|
|
857
|
+
const params = [...new URLSearchParams(rest.join("&"))];
|
|
858
|
+
const readable = slugOf(params.map(([key, value]) => `${key}-${value}`).join("-")).slice(0, 40);
|
|
859
|
+
const query = rest.length ? `.${readable}-${hashOf(rest.join("&"))}` : "";
|
|
860
|
+
return `${page}${query}${isBoot ? ".csr" : ""}.png`;
|
|
782
861
|
}
|
|
783
862
|
static attribute(page, records) {
|
|
784
863
|
const pathname = new URL(page.finalUrl).pathname;
|
|
@@ -807,6 +886,8 @@ class AppPreview {
|
|
|
807
886
|
lines.push("The app's log socket did not answer, so client and server errors are not shown.");
|
|
808
887
|
for (const reason of report.skipped)
|
|
809
888
|
lines.push(`Not opened: ${reason}.`);
|
|
889
|
+
for (const note of report.notes)
|
|
890
|
+
lines.push(`Note: ${note}`);
|
|
810
891
|
lines.push("");
|
|
811
892
|
for (const page of report.pages) {
|
|
812
893
|
const verdict = page.failed ? "FAIL" : page.domFindings.length || page.consoleWarnings.length ? "warn" : "ok";
|
|
@@ -844,7 +925,7 @@ class AppPreview {
|
|
|
844
925
|
screenshot,
|
|
845
926
|
timeoutMs
|
|
846
927
|
}) {
|
|
847
|
-
const url =
|
|
928
|
+
const url = AppPreview.probeUrlOf(origin, pagePath).toString();
|
|
848
929
|
const at = Date.now();
|
|
849
930
|
const page = {
|
|
850
931
|
path: pagePath,
|
|
@@ -1233,6 +1314,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1233
1314
|
#interrupt = new InterruptTeardown;
|
|
1234
1315
|
async confirmDatabaseModeDependencyInstall(databaseMode, installSpecs) {
|
|
1235
1316
|
assertPromptable(`Database mode '${databaseMode}' requires missing dependencies: ${installSpecs.join(", ")}`, {
|
|
1317
|
+
code: "failed",
|
|
1236
1318
|
remedy: `install them first with \`bun add ${installSpecs.join(" ")}\``
|
|
1237
1319
|
});
|
|
1238
1320
|
return await confirm({
|
|
@@ -1311,7 +1393,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1311
1393
|
Logger3.rawLog(format === "json" ? JSON.stringify(report, null, 2) : AppPreview.render(report));
|
|
1312
1394
|
if (!report.pages.some((page) => page.failed))
|
|
1313
1395
|
return;
|
|
1314
|
-
const failure = new
|
|
1396
|
+
const failure = new CliError("checkFailed", "preview found broken pages");
|
|
1315
1397
|
markCliErrorPrinted(failure);
|
|
1316
1398
|
throw failure;
|
|
1317
1399
|
}
|
|
@@ -1344,7 +1426,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1344
1426
|
quiet = false,
|
|
1345
1427
|
profile,
|
|
1346
1428
|
env,
|
|
1347
|
-
|
|
1429
|
+
budget = "report"
|
|
1348
1430
|
} = {}) {
|
|
1349
1431
|
await app.scanSync({ write });
|
|
1350
1432
|
if (!quiet)
|
|
@@ -1355,10 +1437,12 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1355
1437
|
spinner: !quiet,
|
|
1356
1438
|
envProfile: profile,
|
|
1357
1439
|
environment: env,
|
|
1358
|
-
budget
|
|
1440
|
+
budget
|
|
1359
1441
|
});
|
|
1360
1442
|
Logger3.rawLog(`${app.name} built in dist/apps/${app.name}`);
|
|
1361
|
-
if (
|
|
1443
|
+
if (quiet)
|
|
1444
|
+
ApplicationBuildReporter.printRouteJsWarnings(result);
|
|
1445
|
+
else
|
|
1362
1446
|
ApplicationBuildReporter.printSummary(result);
|
|
1363
1447
|
} catch (error) {
|
|
1364
1448
|
Logger3.rawLog(`${app.name} build failed in dist/apps/${app.name}`, undefined, "error");
|
|
@@ -1368,9 +1452,9 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1368
1452
|
}
|
|
1369
1453
|
}
|
|
1370
1454
|
async typecheck(exec, { write = true, clean = false, incremental = true, tests = false } = {}) {
|
|
1371
|
-
if (!(exec instanceof
|
|
1455
|
+
if (!(exec instanceof AppExecutor2) && !(exec instanceof LibExecutor2))
|
|
1372
1456
|
throw new Error(`akan typecheck takes an app or a library; ${exec.name} is a package, checked by its own tsconfig.`);
|
|
1373
|
-
if (exec instanceof
|
|
1457
|
+
if (exec instanceof AppExecutor2)
|
|
1374
1458
|
await exec.scanSync({ write });
|
|
1375
1459
|
else if (write)
|
|
1376
1460
|
await this.libraryScript.syncLibrary(exec);
|
|
@@ -1378,7 +1462,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1378
1462
|
await exec.scan({ write: false });
|
|
1379
1463
|
const spinner = exec.spinning(`Typechecking ${exec.name}${tests ? " with its tests" : ""}...`);
|
|
1380
1464
|
try {
|
|
1381
|
-
if (exec instanceof
|
|
1465
|
+
if (exec instanceof LibExecutor2)
|
|
1382
1466
|
await this.applicationRunner.typecheckLibrary(exec, { clean, incremental, tests });
|
|
1383
1467
|
else
|
|
1384
1468
|
await this.applicationRunner.typecheck(exec, { clean, incremental, tests });
|
|
@@ -1393,7 +1477,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1393
1477
|
async test(exec, { write = true, files = [], coverage = false } = {}) {
|
|
1394
1478
|
const testPaths = this.applicationRunner.resolveTestPaths(exec, files);
|
|
1395
1479
|
const flags = coverage ? ApplicationScript.#coverageFlagsOf(exec) : [];
|
|
1396
|
-
if (exec instanceof
|
|
1480
|
+
if (exec instanceof LibExecutor2) {
|
|
1397
1481
|
if (write)
|
|
1398
1482
|
await this.libraryScript.syncLibrary(exec);
|
|
1399
1483
|
else
|
|
@@ -1404,7 +1488,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1404
1488
|
}
|
|
1405
1489
|
const spinner = exec.spinning(`Preparing ${exec.name}...`);
|
|
1406
1490
|
try {
|
|
1407
|
-
if (exec instanceof
|
|
1491
|
+
if (exec instanceof PkgExecutor2)
|
|
1408
1492
|
await exec.scan({ refresh: true });
|
|
1409
1493
|
else
|
|
1410
1494
|
await exec.scanSync({ write });
|
|
@@ -1416,7 +1500,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1416
1500
|
await this.applicationRunner.test(exec, testPaths, flags);
|
|
1417
1501
|
}
|
|
1418
1502
|
static #coverageFlagsOf(exec) {
|
|
1419
|
-
const root = exec instanceof SysExecutor || exec instanceof
|
|
1503
|
+
const root = exec instanceof SysExecutor || exec instanceof PkgExecutor2 ? exec.workspace.workspaceRoot : null;
|
|
1420
1504
|
const dir = root ? path3.join(root, "local", "coverage", path3.relative(root, exec.cwdPath)) : "local/coverage";
|
|
1421
1505
|
return ["--coverage", "--coverage-reporter=text", "--coverage-reporter=lcov", `--coverage-dir=${dir}`];
|
|
1422
1506
|
}
|
|
@@ -1487,7 +1571,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1487
1571
|
throw new Error("No app selected to start");
|
|
1488
1572
|
const startedDatabase = dbup ? await this.#prepareSharedDatabase(apps) : false;
|
|
1489
1573
|
const supervisor = new DevSupervisor({ apps, mode, concurrency, open, write, shares });
|
|
1490
|
-
const view = mode === "tui" ? new (await import("./devTui-
|
|
1574
|
+
const view = mode === "tui" ? new (await import("./devTui-rf374y2w.js")).DevTui(supervisor) : new DevStreamView(apps.map((app) => app.name));
|
|
1491
1575
|
await supervisor.run(view);
|
|
1492
1576
|
if (startedDatabase)
|
|
1493
1577
|
await this.#stopDatabase(workspace);
|
|
@@ -1619,7 +1703,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1619
1703
|
await this.applicationRunner.transferDatabase(app, direction, dir);
|
|
1620
1704
|
}
|
|
1621
1705
|
async dbupDeclared(workspace, mode) {
|
|
1622
|
-
const declared = mode ? [mode] : await Promise.all((await workspace.getApps()).map(async (appName) => (await
|
|
1706
|
+
const declared = mode ? [mode] : await Promise.all((await workspace.getApps()).map(async (appName) => (await AppExecutor2.from(workspace, appName).getConfig()).database.modes)).then((modes) => [...new Set(modes.flat())]);
|
|
1623
1707
|
const needing = declared.filter((each) => each !== "single");
|
|
1624
1708
|
if (!needing.length) {
|
|
1625
1709
|
workspace.log("No app here declares a database mode that runs on local services; single needs none.");
|
|
@@ -1651,7 +1735,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1651
1735
|
await Promise.all(shares.map(async (share) => await share.close()));
|
|
1652
1736
|
}, "Abandoning the tunnel release; the shares expire on their own.");
|
|
1653
1737
|
await Promise.all(apps.map(async (app) => {
|
|
1654
|
-
const { TunnelShare } = await import("./TunnelShare-
|
|
1738
|
+
const { TunnelShare } = await import("./TunnelShare-mbfcaqg0.js");
|
|
1655
1739
|
const share = await TunnelShare.open(app, { workspace: app.workspace });
|
|
1656
1740
|
shares.push(share);
|
|
1657
1741
|
urls.set(app.name, share.url);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/workflow/plainName.ts
|
|
3
|
+
var sysNamePattern = /^[a-z0-9][a-zA-Z0-9_-]*$/;
|
|
4
|
+
var identifierPattern = /^_{0,2}[a-zA-Z][a-zA-Z0-9_-]*$/;
|
|
5
|
+
var packageNamePattern = /^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
|
|
6
|
+
var isWorkflowSysName = (value) => typeof value === "string" && sysNamePattern.test(value);
|
|
7
|
+
var isWorkflowModuleName = (value) => typeof value === "string" && identifierPattern.test(value);
|
|
8
|
+
var plainNameProblem = (kind, name) => {
|
|
9
|
+
const isSys = kind === "app" || kind === "lib";
|
|
10
|
+
if (isSys ? isWorkflowSysName(name) : isWorkflowModuleName(name))
|
|
11
|
+
return null;
|
|
12
|
+
return `${JSON.stringify(name)} is no ${kind} name; use letters, digits, - and _, starting with ${isSys ? "a lowercase letter or digit" : "a letter"}`;
|
|
13
|
+
};
|
|
14
|
+
var assertPlainName = (kind, name) => {
|
|
15
|
+
const problem = plainNameProblem(kind, name);
|
|
16
|
+
if (problem)
|
|
17
|
+
throw new Error(problem);
|
|
18
|
+
};
|
|
19
|
+
var assertPackageName = (name) => {
|
|
20
|
+
if (packageNamePattern.test(name))
|
|
21
|
+
return;
|
|
22
|
+
throw new Error(`${JSON.stringify(name)} is no package name; use name or @scope/name, each of lowercase letters, digits, -, . and _, starting with a letter or digit`);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { sysNamePattern, identifierPattern, isWorkflowSysName, isWorkflowModuleName, plainNameProblem, assertPlainName, assertPackageName };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
execEmoji,
|
|
4
|
+
Executor
|
|
5
|
+
} from "./index-qssq2d41.js";
|
|
6
|
+
// pkgs/@akanjs/devkit/executors/moduleExecutor.ts
|
|
7
|
+
class ModuleExecutor extends Executor {
|
|
8
|
+
sys;
|
|
9
|
+
emoji = execEmoji.module;
|
|
10
|
+
constructor({ sys, name }) {
|
|
11
|
+
super(name, `${sys.workspace.workspaceRoot}/${sys.type}s/${sys.name}/lib/${name}`);
|
|
12
|
+
this.sys = sys;
|
|
13
|
+
}
|
|
14
|
+
static from(sysExecutor, name) {
|
|
15
|
+
return new ModuleExecutor({ sys: sysExecutor, name });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// pkgs/@akanjs/devkit/util/errorReport.ts
|
|
19
|
+
import { realpathSync } from "fs";
|
|
20
|
+
import path from "path";
|
|
21
|
+
|
|
22
|
+
class ErrorReport {
|
|
23
|
+
static shownNestedErrors = 20;
|
|
24
|
+
static format(error, workspaceRoot = process.cwd()) {
|
|
25
|
+
return ErrorReport.#format(error, workspaceRoot, []);
|
|
26
|
+
}
|
|
27
|
+
static #format(error, workspaceRoot, ancestors) {
|
|
28
|
+
if (ancestors.includes(error))
|
|
29
|
+
return "[circular]";
|
|
30
|
+
const chain = [...ancestors, error];
|
|
31
|
+
if (error instanceof AggregateError) {
|
|
32
|
+
const shown = error.errors.slice(0, ErrorReport.shownNestedErrors);
|
|
33
|
+
const hidden = error.errors.length - shown.length;
|
|
34
|
+
const nestedMessages = [
|
|
35
|
+
...shown.map((nestedError, index) => ErrorReport.#format(nestedError, workspaceRoot, chain).trim() || `Unknown error ${index + 1}`),
|
|
36
|
+
...hidden > 0 ? [`\u2026and ${hidden} more`] : []
|
|
37
|
+
].map((message) => message.replace(/^/gm, " ")).join(`
|
|
38
|
+
`);
|
|
39
|
+
const message = nestedMessages ? `${error.message}
|
|
40
|
+
${nestedMessages}` : error.message;
|
|
41
|
+
return `${message}${ErrorReport.#causeOf(error, workspaceRoot, chain)}`;
|
|
42
|
+
}
|
|
43
|
+
if (error instanceof Error)
|
|
44
|
+
return `${ErrorReport.#withLocation(error.message, error, workspaceRoot)}${ErrorReport.#causeOf(error, workspaceRoot, chain)}`;
|
|
45
|
+
if (typeof error === "object" && error !== null && "message" in error)
|
|
46
|
+
return ErrorReport.#withLocation(String(error.message), error, workspaceRoot);
|
|
47
|
+
return String(error);
|
|
48
|
+
}
|
|
49
|
+
static #causeOf(error, workspaceRoot, chain) {
|
|
50
|
+
return error.cause ? `
|
|
51
|
+
Caused by: ${ErrorReport.#format(error.cause, workspaceRoot, chain)}` : "";
|
|
52
|
+
}
|
|
53
|
+
static #withLocation(message, error, workspaceRoot) {
|
|
54
|
+
const { position } = error;
|
|
55
|
+
if (!position?.file)
|
|
56
|
+
return message;
|
|
57
|
+
const file = ErrorReport.#relativeToWorkspace(position.file, workspaceRoot);
|
|
58
|
+
const location = position.line > 0 ? `${file}:${position.line}:${position.column}` : file;
|
|
59
|
+
return message.includes(location) ? message : message.replace(/^.*/, (headline) => `${headline} (${location})`);
|
|
60
|
+
}
|
|
61
|
+
static #relativeToWorkspace(file, workspaceRoot) {
|
|
62
|
+
if (!path.isAbsolute(file))
|
|
63
|
+
return file;
|
|
64
|
+
for (const root of [workspaceRoot, ErrorReport.#realpathOf(workspaceRoot)]) {
|
|
65
|
+
const relative = path.relative(root, file);
|
|
66
|
+
if (!relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative))
|
|
67
|
+
return relative.replaceAll(path.sep, "/");
|
|
68
|
+
}
|
|
69
|
+
return file;
|
|
70
|
+
}
|
|
71
|
+
static #realpathOf(dir) {
|
|
72
|
+
try {
|
|
73
|
+
return realpathSync(dir);
|
|
74
|
+
} catch {
|
|
75
|
+
return dir;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { ModuleExecutor, ErrorReport };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// pkgs/@akanjs/devkit/subspaceConfig.ts
|
|
2
|
+
// pkgs/@akanjs/devkit/subspace/subspaceConfig.ts
|
|
3
3
|
class SubspaceConfig {
|
|
4
4
|
static source = "subspace in the workspace root akan.config.ts";
|
|
5
5
|
static defaultPushableBranches = ["main", "develop", "debug"];
|
|
@@ -24,6 +24,8 @@ class SubspaceConfig {
|
|
|
24
24
|
for (const subspace of this.subspaces) {
|
|
25
25
|
if (!subspace.name || !subspace.repo)
|
|
26
26
|
throw new Error(`${SubspaceConfig.source}: every subspace needs a name and a repo`);
|
|
27
|
+
if (subspace.repo.startsWith("-"))
|
|
28
|
+
throw new Error(`${SubspaceConfig.source}: subspace "${subspace.name}" repo "${subspace.repo}" reads as a git option`);
|
|
27
29
|
if (!SubspaceConfig.namePattern.test(subspace.name))
|
|
28
30
|
throw new Error(`${SubspaceConfig.source}: subspace name "${subspace.name}" takes letters, digits, ".", "_" and "-", starting with a letter or digit`);
|
|
29
31
|
if (seenNames.has(subspace.name))
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AkanGraphDiff,
|
|
4
4
|
AkanIndex
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-trffs83s.js";
|
|
6
6
|
import {
|
|
7
7
|
GitRevision
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-zyb0ebm4.js";
|
|
9
9
|
|
|
10
|
-
// pkgs/@akanjs/devkit/workspaceGraph.ts
|
|
10
|
+
// pkgs/@akanjs/devkit/workspace/workspaceGraph.ts
|
|
11
11
|
import { readFile } from "fs/promises";
|
|
12
12
|
import path from "path";
|
|
13
13
|
import ts from "typescript";
|