@akanjs/cli 3.2.0-rc.8 → 3.2.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 +2 -2
- package/CodeAgent-fx6088tv.js +11 -0
- package/{CodeTui-qstk5vpj.js → CodeTui-zee8atsr.js} +822 -666
- package/README.ko.md +7 -0
- package/README.md +7 -0
- package/TunnelShare-9ry4vh0y.js +18 -0
- package/agent.command-x65f2ags.js +61 -0
- package/akanCode.js +12 -12
- package/appExecutor-79azsb2w.js +11 -0
- package/{application.command-m4rq4wc2.js → application.command-azbd1pb2.js} +83 -37
- package/{applicationBuildRunner-df7rx3ra.js → applicationBuildRunner-trfxv3pd.js} +49 -18
- package/buildBatch.proc.js +25 -11
- package/{cloud.command-a0gy0qq2.js → cloud.command-gapp4634.js} +33 -29
- package/cloud.script-3b401efv.js +35 -0
- package/{code.command-5rsdqw8s.js → code.command-5smx61yf.js} +13 -9
- package/context.command-ym5jbkny.js +64 -0
- package/context.runner-kctbfsde.js +34 -0
- package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
- package/{devTui-h77zrjv5.js → devTui-rf374y2w.js} +1 -1
- package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
- package/{guideline.command-mffxknbr.js → guideline.command-zwypaqsh.js} +9 -5
- package/guidelines/agentRule/agentRule.instruction.md +25 -9
- 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 -4
- package/guidelines/conventions/rules/ts.md +3 -3
- package/guidelines/errorCodes/errorCodes.instruction.md +165 -0
- package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +225 -5
- package/guidelines/pageRule/pageRule.instruction.md +10 -1
- package/guidelines/queryRule/queryRule.instruction.md +3 -1
- package/guidelines/runtimeRule/runtimeRule.instruction.md +14 -8
- package/guidelines/transportRule/transportRule.instruction.md +31 -1
- package/incrementalBuilder.proc.js +577 -411
- package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
- package/{index-0gg15zwa.js → index-0s7w2085.js} +6 -6
- package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
- package/{index-swwjakt0.js → index-275a4r3n.js} +11 -11
- package/{index-j6gc8n14.js → index-2jmvfa62.js} +11 -9
- package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
- package/{index-exn38bzx.js → index-2yn3r67f.js} +116 -54
- package/{index-34792nh7.js → index-3txdtztz.js} +1 -1
- package/{index-28x1aszt.js → index-41a03gkj.js} +149 -53
- package/{index-2mf1aen9.js → index-4ss4gkv3.js} +2 -2
- package/{index-an76bdrv.js → index-612fdtbk.js} +1 -1
- package/{index-5radqwn2.js → index-67sd09ag.js} +12 -12
- package/{index-0hbtve0a.js → index-6dzjer7p.js} +32 -28
- package/{index-3ghdb7p5.js → index-71y6176j.js} +2777 -3676
- package/{index-xyn02k0w.js → index-78y75t0a.js} +662 -433
- package/index-7wf8snar.js +80 -0
- package/{index-skmtj8rm.js → index-8jtqfye2.js} +27 -10
- package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
- package/{index-nmvhjn8c.js → index-9wh04mqy.js} +93 -82
- package/{index-xvk2a75m.js → index-a860mx0m.js} +3 -3
- package/{index-5zwr4n6k.js → index-baccvws5.js} +65 -8
- package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
- package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
- package/{index-r0a604h4.js → index-c669pbyb.js} +5 -4
- package/{index-x40bdsca.js → index-dadwp2aw.js} +33 -98
- package/{index-vm0dn0mt.js → index-dmcpetwe.js} +200 -138
- package/{index-43f4h4cm.js → index-ebn9kgea.js} +6 -6
- package/{index-hqv34wzq.js → index-gt8phqpt.js} +10 -10
- package/{index-yckz5t8b.js → index-h901f24n.js} +516 -434
- package/{index-j3v29pq7.js → index-j0wr4e32.js} +219 -175
- package/{index-gcx48get.js → index-j592zfqc.js} +2 -2
- package/{index-grxs6fts.js → index-j6jjmn2r.js} +57 -31
- package/{index-w8yasvpc.js → index-jek2re5k.js} +2136 -2175
- package/{index-ny2k80mv.js → index-jf4vk1s0.js} +9 -2
- package/{index-gxav1bjz.js → index-k6vwww45.js} +9 -9
- package/{index-99qvtff2.js → index-kfvjzk8r.js} +5 -5
- package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
- package/{index-2r9ff9qm.js → index-nc3br31y.js} +2 -2
- package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
- package/{index-cmg5ngqa.js → index-p7beqww9.js} +2 -2
- package/{index-b4qq3rq0.js → index-rwgqba9p.js} +1 -1
- package/{index-rfzp4pqs.js → index-s885g0jj.js} +3 -3
- package/{index-9p260r4e.js → index-trffs83s.js} +538 -250
- package/{index-k92x3vne.js → index-v7ajmsh3.js} +1 -1
- package/index-w1zexzpx.js +127 -0
- package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
- package/{index-39jz41jb.js → index-xs9a3ddt.js} +3 -3
- package/{index-rp4yf32g.js → index-xwwex8rf.js} +36 -29
- package/{index-ra9fvn7s.js → index-ybcb9wc8.js} +74 -38
- package/index-z92zm3wd.js +788 -0
- package/{index-j9790rhk.js → index-z96ks033.js} +1509 -1121
- package/index-zfnz878d.js +30 -0
- package/{index-2vgv7fs7.js → index-zmd9xxgd.js} +727 -693
- package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
- package/index.js +28 -24
- package/libExecutor-jc6f8hm6.js +10 -0
- package/{library.command-bmd7zc5m.js → library.command-nxvesvhb.js} +12 -5
- package/{localRegistry.command-y6en1599.js → localRegistry.command-xz62e4ng.js} +29 -24
- package/{module.command-7exfffqw.js → module.command-aaws9byg.js} +11 -7
- package/{package.command-adskw2rj.js → package.command-j7hv26p0.js} +14 -10
- package/package.json +8 -8
- package/{page.command-dw01272p.js → page.command-7yffs7n9.js} +8 -4
- package/{pipeline.command-0b1r3y5r.js → pipeline.command-7yk0zcng.js} +15 -9
- package/pkgExecutor-arxmvx4t.js +10 -0
- package/{primitive.command-byw6vc04.js → primitive.command-7a1pt715.js} +12 -8
- package/{projectTypecheck-kkrpq60a.js → projectTypecheck-f4qhbecd.js} +1 -1
- package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
- package/{quality.command-6rqnhzct.js → quality.command-c6mvrjh1.js} +25 -16
- package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
- package/{repair.command-rw5zymak.js → repair.command-093adzt9.js} +12 -8
- package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
- package/{scalar.command-2dyp9nh9.js → scalar.command-2ex84spb.js} +10 -6
- package/skills/akan-debug/SKILL.md +8 -5
- package/skills/akan-err/SKILL.md +7 -0
- package/skills/akan-mcp/SKILL.md +19 -1
- package/skills/akan-scaffold/SKILL.md +1 -1
- package/skills/akan-validate/SKILL.md +3 -3
- package/{subspace.command-111ynwv1.js → subspace.command-4n4n4jpv.js} +32 -24
- 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/.devcontainer/devcontainer.json.template +1 -1
- package/templates/workspaceRoot/AGENTS.md.template +2 -1
- package/templates/workspaceRoot/README.ts +4 -2
- package/{tunnel.command-2gcpfbdj.js → tunnel.command-f7ep1qfa.js} +17 -13
- package/{typeChecker-s640r6c0.js → typeChecker-7jt6abrs.js} +1 -1
- package/typecheck.proc.js +3 -2
- package/{verify.command-djgs86ma.js → verify.command-zrkxnvct.js} +21 -17
- package/{workflow.command-n0k2mxr5.js → workflow.command-ks16jegk.js} +21 -14
- package/{workspace.command-fh1qwxfx.js → workspace.command-ahhfpaag.js} +60 -54
- package/CodeAgent-x2p3a3e0.js +0 -11
- package/TunnelShare-c4xsfzg5.js +0 -15
- package/agent.command-9et2e27p.js +0 -52
- package/cloud.script-xze4zh7n.js +0 -31
- package/context.command-rk1dwrg4.js +0 -57
- package/context.runner-83ky5m1b.js +0 -30
- /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,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-
|
|
3
|
+
script
|
|
4
|
+
} from "./index-2yn3r67f.js";
|
|
5
5
|
import {
|
|
6
6
|
jsonText
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-zmd9xxgd.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
} from "./index-
|
|
9
|
+
akanMcpInstallTargets
|
|
10
|
+
} from "./index-h901f24n.js";
|
|
11
11
|
import {
|
|
12
12
|
ContextRunner2
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-j0wr4e32.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/context/context.script.ts
|
|
16
16
|
import { Logger } from "akanjs/common";
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-2yn3r67f.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-w1zexzpx.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-baccvws5.js";
|
|
18
|
+
import {
|
|
19
|
+
TypeScriptDependencyScanner2
|
|
20
|
+
} from "./index-2ny1e95c.js";
|
|
21
21
|
import {
|
|
22
22
|
assertPackageName
|
|
23
23
|
} from "./index-va90m8nd.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
// pkgs/@akanjs/cli/package/package.runner.ts
|
|
26
26
|
import path2 from "path";
|
|
27
27
|
|
|
28
|
-
// pkgs/@akanjs/devkit/packageExportsMap.ts
|
|
28
|
+
// pkgs/@akanjs/devkit/workspace/packageExportsMap.ts
|
|
29
29
|
import { statSync } from "fs";
|
|
30
30
|
import path from "path";
|
|
31
31
|
|
|
@@ -373,7 +373,7 @@ ${problems.join(`
|
|
|
373
373
|
return { file: FrameworkGraph.architectureFile, changed: next !== current };
|
|
374
374
|
}
|
|
375
375
|
async verifyAkanPublishPackages(workspace) {
|
|
376
|
-
const pkgs = PackageRunner.publishableAkanPackages.map((pkgName) =>
|
|
376
|
+
const pkgs = PackageRunner.publishableAkanPackages.map((pkgName) => PkgExecutor2.from(workspace, pkgName));
|
|
377
377
|
const peerExportsMaps = new Map;
|
|
378
378
|
for (const pkg of pkgs) {
|
|
379
379
|
if (!await Bun.file(`${pkg.dist.cwdPath}/package.json`).exists())
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-2yn3r67f.js";
|
|
6
6
|
import {
|
|
7
|
-
LibSource,
|
|
8
|
-
formatLibStatuses,
|
|
9
7
|
CommandExecutionError,
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
LibSource,
|
|
9
|
+
formatLibStatuses
|
|
10
|
+
} from "./index-71y6176j.js";
|
|
11
|
+
import {
|
|
12
|
+
LibExecutor2
|
|
13
|
+
} from "./index-zfnz878d.js";
|
|
12
14
|
import {
|
|
13
15
|
assertPlainName
|
|
14
16
|
} from "./index-va90m8nd.js";
|
|
@@ -16,7 +18,7 @@ import {
|
|
|
16
18
|
// pkgs/@akanjs/cli/library/library.script.ts
|
|
17
19
|
import { Logger } from "akanjs/common";
|
|
18
20
|
|
|
19
|
-
// pkgs/@akanjs/devkit/semver.ts
|
|
21
|
+
// pkgs/@akanjs/devkit/util/semver.ts
|
|
20
22
|
var stripRangeOperator = (version) => version.replace(/^[\s^~>=<v]+/, "").trim();
|
|
21
23
|
var parseVersion = (version) => version.replace(/^[^\d]*/, "").split(/[.-]/).map((part) => Number.parseInt(part, 10)).map((part) => Number.isFinite(part) ? part : 0);
|
|
22
24
|
var compareNumeric = (a, b) => {
|
|
@@ -46,7 +48,7 @@ class LibraryRunner extends runner("library") {
|
|
|
46
48
|
async createLibrary(libName, workspace) {
|
|
47
49
|
await workspace.mkdir(`libs/${libName}`);
|
|
48
50
|
await workspace.applyTemplate({ basePath: `libs/${libName}`, template: "libRoot", dict: { libName } });
|
|
49
|
-
return
|
|
51
|
+
return LibExecutor2.from(workspace, libName);
|
|
50
52
|
}
|
|
51
53
|
async removeLibrary(lib) {
|
|
52
54
|
await lib.workspace.removeDir(`libs/${lib.name}`);
|
|
@@ -102,7 +104,7 @@ class LibraryRunner extends runner("library") {
|
|
|
102
104
|
const testingEnv = `libs/${libName}/env/env.server.testing.ts`;
|
|
103
105
|
if (!await workspace.exists(testingEnv))
|
|
104
106
|
await workspace.cp(`libs/${libName}/env/env.server.example.ts`, testingEnv);
|
|
105
|
-
const lib =
|
|
107
|
+
const lib = LibExecutor2.from(workspace, libName);
|
|
106
108
|
const stamp = await new LibSource(lib).write(source);
|
|
107
109
|
if (await workspace.hasChanges())
|
|
108
110
|
await workspace.commit(`Install ${libName} library from ${stamp.origin}`);
|
|
@@ -110,7 +112,7 @@ class LibraryRunner extends runner("library") {
|
|
|
110
112
|
}
|
|
111
113
|
async libraryStatuses(workspace) {
|
|
112
114
|
const libNames = await workspace.getLibs();
|
|
113
|
-
return await Promise.all(libNames.map((libName) => new LibSource(
|
|
115
|
+
return await Promise.all(libNames.map((libName) => new LibSource(LibExecutor2.from(workspace, libName)).status()));
|
|
114
116
|
}
|
|
115
117
|
async mergeLibraryDependencies(lib) {
|
|
116
118
|
const [libPackageJson, rootPackageJson] = await Promise.all([lib.getPackageJson(), lib.workspace.getPackageJson()]);
|
|
@@ -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";
|
|
@@ -2,18 +2,27 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CliError
|
|
4
4
|
} from "./index-j4yvgfhr.js";
|
|
5
|
+
import {
|
|
6
|
+
Executor,
|
|
7
|
+
WorkspaceExecutor
|
|
8
|
+
} from "./index-71y6176j.js";
|
|
5
9
|
import {
|
|
6
10
|
getDirname2,
|
|
7
11
|
FileSys2
|
|
8
|
-
} from "./index-
|
|
12
|
+
} from "./index-by2tvsq6.js";
|
|
9
13
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
AppExecutor2
|
|
15
|
+
} from "./index-z92zm3wd.js";
|
|
16
|
+
import {
|
|
17
|
+
LibExecutor2
|
|
18
|
+
} from "./index-zfnz878d.js";
|
|
19
|
+
import {
|
|
20
|
+
PkgExecutor2
|
|
21
|
+
} from "./index-w1zexzpx.js";
|
|
22
|
+
import {
|
|
23
|
+
ModuleExecutor,
|
|
24
|
+
ErrorReport
|
|
25
|
+
} from "./index-7wf8snar.js";
|
|
17
26
|
|
|
18
27
|
// pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
|
|
19
28
|
var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
@@ -69,7 +78,7 @@ import { Logger } from "akanjs/common";
|
|
|
69
78
|
import chalk2 from "chalk";
|
|
70
79
|
import { program } from "commander";
|
|
71
80
|
|
|
72
|
-
// pkgs/@akanjs/devkit/appSelectionMemory.ts
|
|
81
|
+
// pkgs/@akanjs/devkit/workspace/appSelectionMemory.ts
|
|
73
82
|
import path from "path";
|
|
74
83
|
class AppSelectionMemory {
|
|
75
84
|
static pathIn(workspaceRoot) {
|
|
@@ -295,35 +304,46 @@ import { existsSync, readFileSync, realpathSync } from "fs";
|
|
|
295
304
|
import path2 from "path";
|
|
296
305
|
|
|
297
306
|
class WorkspaceVersionCheck {
|
|
307
|
+
static overrideEnv = "AKAN_ALLOW_VERSION_MISMATCH";
|
|
298
308
|
static #exemptCommands = new Set(["update", "create-workspace"]);
|
|
299
309
|
static #infoFlags = new Set(["--help", "-h", "--version", "-V"]);
|
|
300
310
|
static #updateTags = new Set(["dev", "canary", "beta", "rc", "alpha"]);
|
|
301
311
|
static warning(cliVersion, argv, workspaceRoot) {
|
|
302
|
-
const
|
|
303
|
-
if (!
|
|
304
|
-
return null;
|
|
305
|
-
if (args.some((arg) => WorkspaceVersionCheck.#infoFlags.has(arg)))
|
|
306
|
-
return null;
|
|
307
|
-
const installed = WorkspaceVersionCheck.installedAkanVersion(workspaceRoot);
|
|
308
|
-
if (!installed || installed === cliVersion)
|
|
312
|
+
const mismatch = WorkspaceVersionCheck.#mismatchOf(cliVersion, argv, workspaceRoot);
|
|
313
|
+
if (!mismatch)
|
|
309
314
|
return null;
|
|
310
|
-
const pinnedCli =
|
|
311
|
-
const runner = pinnedCli === installed ? ["bunx"] : ["bunx", "-p", `@akanjs/cli@${installed}`];
|
|
312
|
-
const rerun = [...runner, "akan", ...args].map(WorkspaceVersionCheck.#quote).join(" ");
|
|
313
|
-
const [, prerelease = ""] = cliVersion.split("-");
|
|
314
|
-
const tag = prerelease.split(".")[0];
|
|
315
|
-
const update = `akan update${WorkspaceVersionCheck.#updateTags.has(tag) ? ` --tag ${tag}` : ""}`;
|
|
315
|
+
const { cliVersion: cli, installed, pinnedCli, rerun, update } = mismatch;
|
|
316
316
|
const lines = [
|
|
317
|
-
`This akan is @akanjs/cli ${
|
|
317
|
+
`This akan is @akanjs/cli ${cli}, but this workspace has akanjs ${installed}: what it generates may not match the installed framework.`,
|
|
318
318
|
`Run the matching CLI: ${rerun}`
|
|
319
319
|
];
|
|
320
|
-
if (Bun.semver.order(
|
|
320
|
+
if (Bun.semver.order(cli, installed) > 0)
|
|
321
321
|
lines.push(`Or move the workspace and this CLI to the newest release of the line together: ${update}`);
|
|
322
322
|
else if (pinnedCli !== installed)
|
|
323
323
|
lines.push(`Pin it so \`bunx akan\` runs it: bun add -d @akanjs/cli@${installed}`);
|
|
324
324
|
return lines.join(`
|
|
325
325
|
`);
|
|
326
326
|
}
|
|
327
|
+
static refusal(cliVersion, argv, workspaceRoot, env = process.env) {
|
|
328
|
+
const mismatch = WorkspaceVersionCheck.#mismatchOf(cliVersion, argv, workspaceRoot);
|
|
329
|
+
if (!mismatch || ["1", "true"].includes(env[WorkspaceVersionCheck.overrideEnv] ?? ""))
|
|
330
|
+
return null;
|
|
331
|
+
const { args, cliVersion: cli, installed, rerun, update } = mismatch;
|
|
332
|
+
if (WorkspaceVersionCheck.#lineOf(cli) === WorkspaceVersionCheck.#lineOf(installed))
|
|
333
|
+
return null;
|
|
334
|
+
const realign = Bun.semver.order(cli, installed) > 0 ? `Move the workspace and this CLI to one release together: ${update}` : `Install the CLI this workspace was moved to: bun add -g @akanjs/cli@${installed}`;
|
|
335
|
+
return [
|
|
336
|
+
`This akan is @akanjs/cli ${cli}, but this workspace has akanjs ${installed}, another major.minor, so \`akan ${args[0]}\` is refused: it writes to the workspace, and what it writes would not match the installed framework.`,
|
|
337
|
+
realign,
|
|
338
|
+
`Or run the matching CLI once: ${rerun}`,
|
|
339
|
+
`Or set ${WorkspaceVersionCheck.overrideEnv}=1 to run it anyway.`
|
|
340
|
+
].join(`
|
|
341
|
+
`);
|
|
342
|
+
}
|
|
343
|
+
static readsOnly(targetOption, values) {
|
|
344
|
+
const { readOnly = false } = targetOption;
|
|
345
|
+
return typeof readOnly === "function" ? readOnly(values) : readOnly;
|
|
346
|
+
}
|
|
327
347
|
static installedAkanVersion(workspaceRoot) {
|
|
328
348
|
const packageDir = path2.join(workspaceRoot, "node_modules", "akanjs");
|
|
329
349
|
if (!existsSync(packageDir))
|
|
@@ -332,6 +352,26 @@ class WorkspaceVersionCheck {
|
|
|
332
352
|
return null;
|
|
333
353
|
return WorkspaceVersionCheck.#versionAt(packageDir);
|
|
334
354
|
}
|
|
355
|
+
static #mismatchOf(cliVersion, argv, workspaceRoot) {
|
|
356
|
+
const args = argv.slice(2);
|
|
357
|
+
if (!cliVersion || WorkspaceVersionCheck.#exemptCommands.has(args[0] ?? ""))
|
|
358
|
+
return null;
|
|
359
|
+
if (args.some((arg) => WorkspaceVersionCheck.#infoFlags.has(arg)))
|
|
360
|
+
return null;
|
|
361
|
+
const installed = WorkspaceVersionCheck.installedAkanVersion(workspaceRoot);
|
|
362
|
+
if (!installed || installed === cliVersion)
|
|
363
|
+
return null;
|
|
364
|
+
const pinnedCli = WorkspaceVersionCheck.#versionAt(path2.join(workspaceRoot, "node_modules/@akanjs/cli"));
|
|
365
|
+
const runner = pinnedCli === installed ? ["bunx"] : ["bunx", "-p", `@akanjs/cli@${installed}`];
|
|
366
|
+
const rerun = [...runner, "akan", ...args].map(WorkspaceVersionCheck.#quote).join(" ");
|
|
367
|
+
const [, prerelease = ""] = cliVersion.split("-");
|
|
368
|
+
const tag = prerelease.split(".")[0];
|
|
369
|
+
const update = `akan update${WorkspaceVersionCheck.#updateTags.has(tag) ? ` --tag ${tag}` : ""}`;
|
|
370
|
+
return { args, cliVersion, installed, pinnedCli, rerun, update };
|
|
371
|
+
}
|
|
372
|
+
static #lineOf(version) {
|
|
373
|
+
return version.split("-")[0]?.split(".").slice(0, 2).join(".");
|
|
374
|
+
}
|
|
335
375
|
static #versionAt(packageDir) {
|
|
336
376
|
const packageJsonPath = path2.join(packageDir, "package.json");
|
|
337
377
|
if (!existsSync(packageJsonPath))
|
|
@@ -363,7 +403,7 @@ var printCliError = (error, stream = "log") => {
|
|
|
363
403
|
return;
|
|
364
404
|
loggedCliErrorObjects.add(error);
|
|
365
405
|
}
|
|
366
|
-
const message = CliError.messageOf(error);
|
|
406
|
+
const message = error instanceof Error ? ErrorReport.format(error) || error.name : CliError.messageOf(error);
|
|
367
407
|
if (loggedCliErrorMessages.has(message))
|
|
368
408
|
return;
|
|
369
409
|
loggedCliErrorMessages.add(message);
|
|
@@ -443,6 +483,29 @@ var givenOptionsOf = (argMetas, opt) => {
|
|
|
443
483
|
}
|
|
444
484
|
return given;
|
|
445
485
|
};
|
|
486
|
+
var argValuesOf = (argMetas, cmdArgs, opt) => {
|
|
487
|
+
const values = givenOptionsOf(argMetas, opt);
|
|
488
|
+
for (const argMeta of argMetas) {
|
|
489
|
+
if (argMeta.type === "Argument")
|
|
490
|
+
values[argMeta.name] = cmdArgs[argMeta.idx] ?? argMeta.argsOption.default;
|
|
491
|
+
else if (argMeta.type === "Option")
|
|
492
|
+
values[argMeta.name] ??= argMeta.argsOption.default;
|
|
493
|
+
}
|
|
494
|
+
return values;
|
|
495
|
+
};
|
|
496
|
+
var resolvedValuesOf = (argMetas, commandArgs) => Object.fromEntries(argMetas.flatMap((argMeta) => argMeta.type === "Option" || argMeta.type === "Argument" ? [[argMeta.name, commandArgs[argMeta.idx]]] : []));
|
|
497
|
+
var versionGateOf = (cliVersion) => {
|
|
498
|
+
let warning = WorkspaceVersionCheck.warning(cliVersion, process.argv, process.cwd());
|
|
499
|
+
const refusal = WorkspaceVersionCheck.refusal(cliVersion, process.argv, process.cwd());
|
|
500
|
+
return (targetOption, values) => {
|
|
501
|
+
if (refusal && !WorkspaceVersionCheck.readsOnly(targetOption, values))
|
|
502
|
+
throw new CliError("refused", refusal);
|
|
503
|
+
if (warning)
|
|
504
|
+
Logger.rawLog(chalk2.yellow(`
|
|
505
|
+
${warning}`), undefined, "error");
|
|
506
|
+
warning = null;
|
|
507
|
+
};
|
|
508
|
+
};
|
|
446
509
|
var normalizeEnumChoices = (enumChoices) => enumChoices.map((choice) => typeof choice === "object" ? { value: choice.value, name: choice.label } : { value: choice, name: choice.toString() });
|
|
447
510
|
var prompts = async () => await import("@inquirer/prompts");
|
|
448
511
|
var select = (config, context) => prompts().then((m) => m.select(config, context));
|
|
@@ -514,11 +577,11 @@ var getArgumentValue = async (argMeta, value) => {
|
|
|
514
577
|
return convertArgValue(await input({ message: inputMessageOf(argMeta) }), type ?? "string");
|
|
515
578
|
};
|
|
516
579
|
var assignCommandContext = (context, argMeta, value) => {
|
|
517
|
-
if (value instanceof
|
|
580
|
+
if (value instanceof AppExecutor2)
|
|
518
581
|
context.app = value;
|
|
519
|
-
else if (value instanceof
|
|
582
|
+
else if (value instanceof LibExecutor2)
|
|
520
583
|
context.lib = value;
|
|
521
|
-
else if (value instanceof
|
|
584
|
+
else if (value instanceof PkgExecutor2)
|
|
522
585
|
context.pkg = value;
|
|
523
586
|
else if (value instanceof ModuleExecutor)
|
|
524
587
|
context.module = value;
|
|
@@ -569,15 +632,15 @@ var getAppsArgumentValue = async (value, workspace, rerun) => {
|
|
|
569
632
|
throw new Error("No apps found in this workspace (apps/<appName>/akan.config.ts)");
|
|
570
633
|
const requested = parseAppNameList(value);
|
|
571
634
|
if (requested.includes("all"))
|
|
572
|
-
return appNames.map((name) =>
|
|
635
|
+
return appNames.map((name) => AppExecutor2.from(workspace, name));
|
|
573
636
|
if (requested.length) {
|
|
574
637
|
const unknown = requested.filter((name) => !appNames.includes(name));
|
|
575
638
|
if (unknown.length)
|
|
576
639
|
throw new CliError("unknownTarget", `Unknown app${unknown.length > 1 ? "s" : ""}: ${unknown.join(", ")}. Available: ${appNames.join(", ")}, all`);
|
|
577
|
-
return [...new Set(requested)].map((name) =>
|
|
640
|
+
return [...new Set(requested)].map((name) => AppExecutor2.from(workspace, name));
|
|
578
641
|
}
|
|
579
642
|
if (appNames.length === 1 && appNames[0])
|
|
580
|
-
return [
|
|
643
|
+
return [AppExecutor2.from(workspace, appNames[0])];
|
|
581
644
|
assertPromptable("Missing apps", { choices: [...appNames, "all"], ...rerunRemedyOf(rerun, "<apps...>") });
|
|
582
645
|
const remembered = new Set(await AppSelectionMemory.read(workspace.workspaceRoot));
|
|
583
646
|
const picked = await checkbox({
|
|
@@ -586,7 +649,7 @@ var getAppsArgumentValue = async (value, workspace, rerun) => {
|
|
|
586
649
|
required: true
|
|
587
650
|
});
|
|
588
651
|
await AppSelectionMemory.write(workspace.workspaceRoot, picked);
|
|
589
|
-
return picked.map((name) =>
|
|
652
|
+
return picked.map((name) => AppExecutor2.from(workspace, name));
|
|
590
653
|
};
|
|
591
654
|
var getInternalArgumentValue = async (argMeta, value, workspace, rerun, { destructive = false } = {}) => {
|
|
592
655
|
if (argMeta.type === "Workspace")
|
|
@@ -612,18 +675,18 @@ var getInternalArgumentValue = async (argMeta, value, workspace, rerun, { destru
|
|
|
612
675
|
const pkgChoices = sysType === "exec" ? pkgNames : [];
|
|
613
676
|
const execOf = (name) => {
|
|
614
677
|
if (appNames.includes(name))
|
|
615
|
-
return
|
|
678
|
+
return AppExecutor2.from(workspace, name);
|
|
616
679
|
if (libNames.includes(name))
|
|
617
|
-
return
|
|
680
|
+
return LibExecutor2.from(workspace, name);
|
|
618
681
|
if (pkgChoices.includes(name))
|
|
619
|
-
return
|
|
682
|
+
return PkgExecutor2.from(workspace, name);
|
|
620
683
|
return null;
|
|
621
684
|
};
|
|
622
685
|
const found = value ? execOf(value) : null;
|
|
623
686
|
if (found)
|
|
624
687
|
return found;
|
|
625
688
|
if (!value && !destructive && argMeta.option?.onlyApp && appNames.length === 1 && appNames[0])
|
|
626
|
-
return
|
|
689
|
+
return AppExecutor2.from(workspace, appNames[0]);
|
|
627
690
|
const [kind, placeholder] = sysType === "exec" ? ["app, lib or pkg", "<app-lib-or-pkg>"] : ["app or lib", "<app-or-lib>"];
|
|
628
691
|
const choices = [...appNames, ...libNames, ...pkgChoices];
|
|
629
692
|
const only = takeOnly(kind, choices, execOf);
|
|
@@ -640,35 +703,35 @@ var getInternalArgumentValue = async (argMeta, value, workspace, rerun, { destru
|
|
|
640
703
|
return picked;
|
|
641
704
|
} else if (sysType === "app") {
|
|
642
705
|
if (value && appNames.includes(value))
|
|
643
|
-
return
|
|
706
|
+
return AppExecutor2.from(workspace, value);
|
|
644
707
|
if (!value && !destructive && appNames.length === 1 && appNames[0])
|
|
645
|
-
return
|
|
708
|
+
return AppExecutor2.from(workspace, appNames[0]);
|
|
646
709
|
assertAskable("app", appNames, "<app>");
|
|
647
710
|
const appName = await select({ message: `Select the ${sysType} name`, choices: appNames });
|
|
648
|
-
return
|
|
711
|
+
return AppExecutor2.from(workspace, appName);
|
|
649
712
|
} else if (sysType === "lib") {
|
|
650
713
|
if (value && libNames.includes(value))
|
|
651
|
-
return
|
|
652
|
-
const only = takeOnly("lib", libNames, (name) =>
|
|
714
|
+
return LibExecutor2.from(workspace, value);
|
|
715
|
+
const only = takeOnly("lib", libNames, (name) => LibExecutor2.from(workspace, name));
|
|
653
716
|
if (only)
|
|
654
717
|
return only;
|
|
655
718
|
assertAskable("lib", libNames, "<lib>");
|
|
656
719
|
const libName = await select({ message: `Select the ${sysType} name`, choices: libNames });
|
|
657
|
-
return
|
|
720
|
+
return LibExecutor2.from(workspace, libName);
|
|
658
721
|
} else if (sysType === "pkg") {
|
|
659
722
|
const pkgs = await workspace.getPkgs();
|
|
660
723
|
if (value && pkgs.includes(value))
|
|
661
|
-
return
|
|
662
|
-
const only = takeOnly("pkg", pkgs, (name) =>
|
|
724
|
+
return PkgExecutor2.from(workspace, value);
|
|
725
|
+
const only = takeOnly("pkg", pkgs, (name) => PkgExecutor2.from(workspace, name));
|
|
663
726
|
if (only)
|
|
664
727
|
return only;
|
|
665
728
|
assertAskable("pkg", pkgs, "<pkg>");
|
|
666
729
|
const pkgName = await select({ message: `Select the ${sysType} name`, choices: pkgs });
|
|
667
|
-
return
|
|
730
|
+
return PkgExecutor2.from(workspace, pkgName);
|
|
668
731
|
} else if (sysType === "module") {
|
|
669
732
|
const systems = [
|
|
670
|
-
...appNames.map((name) =>
|
|
671
|
-
...libNames.map((name) =>
|
|
733
|
+
...appNames.map((name) => AppExecutor2.from(workspace, name)),
|
|
734
|
+
...libNames.map((name) => LibExecutor2.from(workspace, name))
|
|
672
735
|
];
|
|
673
736
|
const modulesOf = async (sys) => [
|
|
674
737
|
...await sys.getModules(),
|
|
@@ -706,7 +769,7 @@ var getInternalArgumentValue = async (argMeta, value, workspace, rerun, { destru
|
|
|
706
769
|
...libNames.map((name) => ({ name, value: { type: "lib", name } }))
|
|
707
770
|
]
|
|
708
771
|
});
|
|
709
|
-
const executor = type === "app" ?
|
|
772
|
+
const executor = type === "app" ? AppExecutor2.from(workspace, name) : LibExecutor2.from(workspace, name);
|
|
710
773
|
const modules = await modulesOf(executor);
|
|
711
774
|
const moduleName = await select({
|
|
712
775
|
message: `Select the module name`,
|
|
@@ -764,10 +827,7 @@ var runCommands = async (...commands) => {
|
|
|
764
827
|
program.version(process.env.AKAN_VERSION).description("Akan CLI").configureHelp({
|
|
765
828
|
helpWidth: 100
|
|
766
829
|
});
|
|
767
|
-
const
|
|
768
|
-
if (versionWarning)
|
|
769
|
-
Logger.rawLog(chalk2.yellow(`
|
|
770
|
-
${versionWarning}`), undefined, "error");
|
|
830
|
+
const checkVersion = versionGateOf(cliPackageJson?.version);
|
|
771
831
|
for (const command of commands) {
|
|
772
832
|
const targetMetas = getTargetMetas(command);
|
|
773
833
|
for (const targetMeta of targetMetas) {
|
|
@@ -819,6 +879,7 @@ ${versionWarning}`), undefined, "error");
|
|
|
819
879
|
usage: false,
|
|
820
880
|
given: givenOptionsOf(allArgMetas, opt)
|
|
821
881
|
});
|
|
882
|
+
checkVersion(targetMeta.targetOption, argValuesOf(allArgMetas, cmdArgs, opt));
|
|
822
883
|
const commandArgs = [];
|
|
823
884
|
if (targetMeta.targetOption.runsOnWorkspaceRoot) {
|
|
824
885
|
await assertCurrentDirectoryIsWorkspaceRoot();
|
|
@@ -836,7 +897,7 @@ ${versionWarning}`), undefined, "error");
|
|
|
836
897
|
commandArgs[argMeta.idx] = await getAppsArgumentValue(cmdArgs[argMeta.idx], workspace, rerun);
|
|
837
898
|
else
|
|
838
899
|
commandArgs[argMeta.idx] = await getInternalArgumentValue(argMeta, cmdArgs[argMeta.idx], workspace, rerun, { destructive: targetMeta.targetOption.destructive });
|
|
839
|
-
if (commandArgs[argMeta.idx] instanceof
|
|
900
|
+
if (commandArgs[argMeta.idx] instanceof AppExecutor2)
|
|
840
901
|
process.env.AKAN_PUBLIC_APP_NAME = commandArgs[argMeta.idx].name;
|
|
841
902
|
else if (Array.isArray(commandArgs[argMeta.idx])) {
|
|
842
903
|
const apps = commandArgs[argMeta.idx];
|
|
@@ -847,6 +908,7 @@ ${versionWarning}`), undefined, "error");
|
|
|
847
908
|
if (opt.verbose)
|
|
848
909
|
Executor.setVerbose(true);
|
|
849
910
|
}
|
|
911
|
+
checkVersion(targetMeta.targetOption, resolvedValuesOf(allArgMetas, commandArgs));
|
|
850
912
|
const cmd = CommandContainer.get(command);
|
|
851
913
|
try {
|
|
852
914
|
await targetMeta.handler.call(cmd, ...commandArgs);
|
|
@@ -951,4 +1013,4 @@ class ExitCodeError extends CliError {
|
|
|
951
1013
|
return CliError.exitCodeOf(error);
|
|
952
1014
|
}
|
|
953
1015
|
}
|
|
954
|
-
export { camelToKebabCase, getTargetMetas, getTargetCommandNames, App, Apps, Lib, Sys, SysOrOnlyApp, Exec, Pkg, Module, ModuleOrService, Workspace, CommandContainer, runner, script, markCliErrorPrinted, assertPromptable, runCommands, command, ExitCodeError };
|
|
1016
|
+
export { camelToKebabCase, getTargetMetas, getTargetCommandNames, App, Apps, Lib, Sys, SysOrOnlyApp, Exec, Pkg, Module, ModuleOrService, Workspace, CommandContainer, runner, script, WorkspaceVersionCheck, markCliErrorPrinted, assertPromptable, runCommands, command, ExitCodeError };
|