@akanjs/cli 3.0.0-beta.2 → 3.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build-stamp +1 -1
- package/CodeAgent-q2m47rqp.js +9 -0
- package/CodeAgentRpcHost-p7h6n2hp.js +7 -0
- package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
- package/CodeTui-pdqhc3sn.js +1457 -0
- package/README.md +3 -0
- package/TunnelShare-scf4e4pd.js +9 -0
- package/{agent.command-d2gfxfck.js → agent.command-ttn09rx3.js} +8 -9
- package/akanCode.js +102 -0
- package/application.command-7gweenv7.js +179 -0
- package/{applicationBuildRunner-kxwbssgn.js → applicationBuildRunner-38exmejd.js} +63 -64
- package/buildBatch.proc.js +26 -25
- package/cloud.command-bhztw7c2.js +95 -0
- package/cloud.script-aabyhgba.js +20 -0
- package/code.command-6s8c0k91.js +154 -0
- package/commandManifest.json +1 -1
- package/consoleToStderr-h5bryj94.js +7 -0
- package/context.command-phmgywt2.js +48 -0
- package/context.runner-yvyw5g2d.js +21 -0
- package/{dependencyScanner-shs82ynp.js → dependencyScanner-ye2e6pdz.js} +2 -2
- package/{devTui-40ggmd99.js → devTui-q7k7bakd.js} +122 -40
- package/fileSys-5ngz93ga.js +9 -0
- package/guideline.command-7jk47fgq.js +42 -0
- package/guidelines/agentRule/agentRule.instruction.md +209 -28
- package/guidelines/conventions/conventions.instruction.md +96 -29
- package/guidelines/fieldRule/fieldRule.instruction.md +1 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
- package/guidelines/queryRule/queryRule.instruction.md +17 -7
- package/guidelines/runtimeRule/runtimeRule.instruction.md +77 -3
- package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
- package/guidelines/transportRule/transportRule.instruction.md +51 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +66 -3
- package/incrementalBuilder.proc.js +31 -48
- package/{index-h7yw2z9n.js → index-0bq14vr1.js} +8 -14
- package/{index-259dsnz3.js → index-1db2cw0y.js} +5 -8
- package/index-22d57v4c.js +266 -0
- package/index-3hx1z96c.js +87 -0
- package/{index-kcxmv48c.js → index-3t7g9e4r.js} +45 -79
- package/{index-ne2qy0nk.js → index-4dn1p115.js} +12 -12
- package/{index-q0y2jq9j.js → index-5b6tavv3.js} +6 -3
- package/index-7cqjvraf.js +69 -0
- package/index-7md2g9vw.js +6 -0
- package/{index-zry5nz81.js → index-8kb5p54p.js} +51 -30
- package/{index-ktb5njgy.js → index-9629w7ns.js} +49 -99
- package/index-9dp031by.js +12 -0
- package/{index-a64esmtb.js → index-aadpbnt2.js} +172 -308
- package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
- package/index-c6eggbee.js +123 -0
- package/index-d0arnrm8.js +700 -0
- package/index-d2242ksy.js +99 -0
- package/{index-600zhnve.js → index-dg97qp24.js} +70 -200
- package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
- package/{index-w8kmx1b6.js → index-fgq75haa.js} +198 -290
- package/{index-2tv3fdx4.js → index-ga6hygxr.js} +944 -1333
- package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
- package/index-hr5n7t4x.js +465 -0
- package/{index-hwkygn9s.js → index-khpfpcsd.js} +302 -33
- package/{index-7737gxcp.js → index-m0ms3n1c.js} +107 -241
- package/{index-ws5e0j51.js → index-mgfx3mfs.js} +43 -26
- package/index-p6pbz9n5.js +25 -0
- package/index-pp54p5zk.js +53 -0
- package/{index-j9yhg404.js → index-q44jbw48.js} +4 -7
- package/{index-mak3cd28.js → index-rmcw8yc8.js} +137 -255
- package/{index-pnqbkf5p.js → index-rnt66vym.js} +6 -2
- package/index-smme4r47.js +49 -0
- package/index-tgjy8xf3.js +187 -0
- package/index-v5eayqqw.js +2729 -0
- package/index-wa5jbxj1.js +760 -0
- package/{index-4edzf1gr.js → index-wp43xrjv.js} +77 -150
- package/{index-fz5q3gd7.js → index-ya5qbmyg.js} +10 -17
- package/index-yjkte9aj.js +1119 -0
- package/{index-gyd220p2.js → index-yy4s1j72.js} +554 -577
- package/{index-v0qh106m.js → index-z50k041j.js} +580 -862
- package/index.js +23 -22
- package/{library.command-nbsky672.js → library.command-ccb1cp92.js} +4 -5
- package/{localRegistry.command-yeq57wjr.js → localRegistry.command-ajb9n87j.js} +23 -42
- package/{module.command-29vqzrh8.js → module.command-5k6h407d.js} +8 -11
- package/{package.command-axv0abmn.js → package.command-e6ntvpez.js} +6 -7
- package/package.json +14 -6
- package/{page.command-vs9s3zrh.js → page.command-v4f90wb8.js} +4 -5
- package/{primitive.command-cbxmqbtc.js → primitive.command-g6km57q5.js} +9 -22
- package/prompter-ptaa3nk0.js +8 -0
- package/{quality.command-gmbs7nws.js → quality.command-de3p36pz.js} +205 -377
- package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
- package/{repair.command-bqsjptsj.js → repair.command-d3x1javq.js} +11 -35
- package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
- package/{scalar.command-6k1vhe9s.js → scalar.command-7ezrac2b.js} +7 -10
- package/skills/akan-code/SKILL.md +130 -0
- package/skills/akan-debug/SKILL.md +42 -0
- package/skills/akan-deps/SKILL.md +50 -0
- package/skills/akan-err/SKILL.md +39 -0
- package/skills/akan-module/SKILL.md +45 -0
- package/skills/akan-scaffold/SKILL.md +76 -0
- package/skills/akan-scalar/SKILL.md +52 -0
- package/skills/akan-service/SKILL.md +34 -0
- package/skills/akan-store/SKILL.md +67 -0
- package/skills/akan-ui/SKILL.md +63 -0
- package/skills/akan-validate/SKILL.md +44 -0
- package/{subspace.command-fwjfcts7.js → subspace.command-ps71ynp6.js} +138 -67
- package/templates/__scalar/__model__/__model__.abstract.md.template +8 -0
- package/templates/appSample/lib/__scalar/workHistory/workHistory.abstract.ts +8 -39
- package/templates/appSample/lib/_noti/noti.abstract.ts +6 -29
- package/templates/appSample/lib/task/task.abstract.ts +12 -32
- package/templates/appSample/lib/task/task.signal.spec.ts +15 -18
- package/templates/appSample/lib/task/task.signal.test.ts +15 -1
- package/templates/appSample/lib/task/task.signal.ts +1 -1
- package/templates/appSample/srvkit/{AuthGuard.ts → guards.ts} +7 -4
- package/templates/appSample/srvkit/{SessionInternalArg.ts → internalArgs.ts} +6 -4
- package/templates/client.ts +7 -30
- package/templates/crudPages/[__model__Id]/edit/page.tsx +2 -1
- package/templates/crudPages/[__model__Id]/page.tsx +2 -1
- package/templates/crudPages/new/page.tsx +2 -1
- package/templates/crudPages/page.tsx +2 -1
- package/templates/crudSinglePage/page.tsx +2 -1
- package/templates/lib/__lib/lib.dictionary.ts +0 -2
- package/templates/lib/__lib/lib.document.ts +0 -2
- package/templates/lib/sig.ts +8 -30
- package/templates/localDev/docker-compose.yaml.template +3 -14
- package/templates/module/__model__.signal.ts +12 -4
- package/templates/pkgRoot/tsconfig.json.template +2 -7
- package/templates/server.ts +0 -2
- package/templates/service/__model__.abstract.md.template +8 -0
- package/templates/workspaceRoot/.gitignore.template +0 -1
- package/tunnel.command-hsrv2mny.js +129 -0
- package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/workflow.command-z2p32nmf.js +79 -0
- package/{workspace.command-8s050m0h.js → workspace.command-tmdqkrh0.js} +77 -109
- package/abstractCompactor-mjh5ppsq.js +0 -101
- package/application.command-pj2m7584.js +0 -204
- package/applicationReleasePackager-4yasxwv9.js +0 -244
- package/capacitorApp-36rbr858.js +0 -12
- package/cloud.command-jshwdq22.js +0 -93
- package/context.command-ez8a0zyz.js +0 -80
- package/devTuiView-c08ccbat.js +0 -9
- package/getDirname-dr3jz1xg.js +0 -7
- package/guideline.command-xmqwx8zm.js +0 -359
- package/guidelines/agentRule/agentRule.generate.json +0 -31
- package/guidelines/componentRule/componentRule.generate.json +0 -31
- package/guidelines/conventions/conventions.generate.json +0 -25
- package/guidelines/cssRule/cssRule.generate.json +0 -31
- package/guidelines/docPageRule/docPageRule.generate.json +0 -31
- package/guidelines/docPageRule/docPageRule.instruction.md +0 -25
- package/guidelines/docSyncRule/docSyncRule.generate.json +0 -31
- package/guidelines/docSyncRule/docSyncRule.instruction.md +0 -25
- package/guidelines/enumConstant/enumConstant.generate.json +0 -31
- package/guidelines/enumConstant/enumConstant.instruction.md +0 -28
- package/guidelines/fieldRule/fieldRule.generate.json +0 -31
- package/guidelines/framework/framework.generate.json +0 -32
- package/guidelines/mcpRule/mcpRule.generate.json +0 -35
- package/guidelines/modelConstant/modelConstant.generate.json +0 -32
- package/guidelines/modelDictionary/modelDictionary.generate.json +0 -32
- package/guidelines/modelDocument/modelDocument.generate.json +0 -31
- package/guidelines/modelService/modelService.generate.json +0 -31
- package/guidelines/modelSignal/modelSignal.generate.json +0 -31
- package/guidelines/modelStore/modelStore.generate.json +0 -31
- package/guidelines/modelTemplate/modelTemplate.generate.json +0 -31
- package/guidelines/modelUnit/modelUnit.generate.json +0 -31
- package/guidelines/modelUtil/modelUtil.generate.json +0 -31
- package/guidelines/modelView/modelView.generate.json +0 -31
- package/guidelines/modelZone/modelZone.generate.json +0 -31
- package/guidelines/moduleCodegen/moduleCodegen.generate.json +0 -31
- package/guidelines/moduleCodegen/moduleCodegen.instruction.md +0 -28
- package/guidelines/moduleOverview/moduleOverview.generate.json +0 -31
- package/guidelines/queryRule/queryRule.generate.json +0 -31
- package/guidelines/recipeRule/recipeRule.generate.json +0 -31
- package/guidelines/runtimeRule/runtimeRule.generate.json +0 -25
- package/guidelines/scalarConstant/scalarConstant.generate.json +0 -32
- package/guidelines/scalarDictionary/scalarDictionary.generate.json +0 -32
- package/guidelines/scalarModule/scalarModule.generate.json +0 -31
- package/guidelines/sharedUiUsage/sharedUiUsage.generate.json +0 -31
- package/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -25
- package/guidelines/ssrRule/ssrRule.generate.json +0 -31
- package/guidelines/transportRule/transportRule.generate.json +0 -31
- package/guidelines/utilUiUsage/utilUiUsage.generate.json +0 -31
- package/guidelines/utilUiUsage/utilUiUsage.instruction.md +0 -25
- package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +0 -24
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +0 -33
- package/index-2hq52jq3.js +0 -465
- package/index-47pj3aee.js +0 -76
- package/index-6wwzs1bc.js +0 -7
- package/index-8pm30m73.js +0 -841
- package/index-kn1h7p1x.js +0 -560
- package/index-meh558jy.js +0 -65
- package/index-rwg2aa4f.js +0 -229
- package/index-wt7qrtd4.js +0 -1516
- package/templates/__scalar/__model__/__model__.abstract.md +0 -28
- package/templates/module/__model__.abstract.md +0 -28
- package/templates/service/__model__.abstract.md +0 -28
- package/workflow.command-nwpcdc8p.js +0 -107
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
getDirname2,
|
|
4
|
+
FileSys2
|
|
5
|
+
} from "./index-5b6tavv3.js";
|
|
5
6
|
import {
|
|
6
7
|
Executor,
|
|
7
8
|
WorkspaceExecutor,
|
|
@@ -9,10 +10,10 @@ import {
|
|
|
9
10
|
LibExecutor,
|
|
10
11
|
PkgExecutor,
|
|
11
12
|
ModuleExecutor
|
|
12
|
-
} from "./index-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
} from "./index-ga6hygxr.js";
|
|
14
|
+
|
|
15
|
+
// pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
|
|
16
|
+
var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
16
17
|
|
|
17
18
|
// pkgs/@akanjs/devkit/commandDecorators/targetMeta.ts
|
|
18
19
|
var COMMAND_META = Symbol("akan.command.meta");
|
|
@@ -22,7 +23,6 @@ var getTargetMetas = (command) => {
|
|
|
22
23
|
throw new Error(`TargetMeta is not defined for ${command.name}`);
|
|
23
24
|
return [...targetMetaMap.values()];
|
|
24
25
|
};
|
|
25
|
-
var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
26
26
|
var getTargetCommandNames = (targetMeta) => {
|
|
27
27
|
const kebabKey = camelToKebabCase(targetMeta.key);
|
|
28
28
|
if (targetMeta.targetOption.short !== true)
|
|
@@ -59,30 +59,6 @@ var Pkg = createInternalArgToken("Pkg");
|
|
|
59
59
|
var Module = createInternalArgToken("Module");
|
|
60
60
|
var Workspace = createInternalArgToken("Workspace");
|
|
61
61
|
|
|
62
|
-
// pkgs/@akanjs/devkit/commandDecorators/command.ts
|
|
63
|
-
import path2 from "path";
|
|
64
|
-
import { Logger } from "akanjs/common";
|
|
65
|
-
import chalk2 from "chalk";
|
|
66
|
-
import { program } from "commander";
|
|
67
|
-
|
|
68
|
-
// pkgs/@akanjs/devkit/appSelectionMemory.ts
|
|
69
|
-
import path from "path";
|
|
70
|
-
class AppSelectionMemory {
|
|
71
|
-
static pathIn(workspaceRoot) {
|
|
72
|
-
return path.join(workspaceRoot, "local", ".akan", "lastStart.json");
|
|
73
|
-
}
|
|
74
|
-
static async read(workspaceRoot) {
|
|
75
|
-
const stored = await Bun.file(AppSelectionMemory.pathIn(workspaceRoot)).json().catch(() => null);
|
|
76
|
-
const apps = stored?.apps;
|
|
77
|
-
return Array.isArray(apps) ? apps.filter((name) => typeof name === "string") : [];
|
|
78
|
-
}
|
|
79
|
-
static async write(workspaceRoot, apps) {
|
|
80
|
-
await FileSys.writeJson(AppSelectionMemory.pathIn(workspaceRoot), { apps }).catch(() => {
|
|
81
|
-
return;
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
62
|
// pkgs/@akanjs/devkit/commandDecorators/dependencyBuilder.ts
|
|
87
63
|
var capitalize = (value) => value.slice(0, 1).toUpperCase() + value.slice(1);
|
|
88
64
|
var createDependencyKey = (refName, kind) => `${refName}${capitalize(kind)}`;
|
|
@@ -160,20 +136,38 @@ var script = (refName, deps = []) => {
|
|
|
160
136
|
return ScriptBase;
|
|
161
137
|
};
|
|
162
138
|
|
|
139
|
+
// pkgs/@akanjs/devkit/commandDecorators/command.ts
|
|
140
|
+
import path2 from "path";
|
|
141
|
+
import { Logger } from "akanjs/common";
|
|
142
|
+
import chalk2 from "chalk";
|
|
143
|
+
import { program } from "commander";
|
|
144
|
+
|
|
145
|
+
// pkgs/@akanjs/devkit/appSelectionMemory.ts
|
|
146
|
+
import path from "path";
|
|
147
|
+
class AppSelectionMemory {
|
|
148
|
+
static pathIn(workspaceRoot) {
|
|
149
|
+
return path.join(workspaceRoot, "local", ".akan", "lastStart.json");
|
|
150
|
+
}
|
|
151
|
+
static async read(workspaceRoot) {
|
|
152
|
+
const stored = await Bun.file(AppSelectionMemory.pathIn(workspaceRoot)).json().catch(() => null);
|
|
153
|
+
const apps = stored?.apps;
|
|
154
|
+
return Array.isArray(apps) ? apps.filter((name) => typeof name === "string") : [];
|
|
155
|
+
}
|
|
156
|
+
static async write(workspaceRoot, apps) {
|
|
157
|
+
await FileSys2.writeJson(AppSelectionMemory.pathIn(workspaceRoot), { apps }).catch(() => {
|
|
158
|
+
return;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
163
|
// pkgs/@akanjs/devkit/commandDecorators/helpFormatter.ts
|
|
164
164
|
import chalk from "chalk";
|
|
165
|
-
var camelToKebabCase2 = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
166
165
|
var formatChoice = (choice) => typeof choice === "object" ? choice.label : choice.toString();
|
|
167
166
|
var groupCommands = (commands) => {
|
|
168
167
|
const groups = new Map;
|
|
169
168
|
for (const command of commands) {
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
if (!groups.has(groupName)) {
|
|
173
|
-
groups.set(groupName, { name: groupName, commands: [] });
|
|
174
|
-
}
|
|
175
|
-
const targetMetas = getTargetMetas(command);
|
|
176
|
-
for (const targetMeta of targetMetas) {
|
|
169
|
+
const group = groups.getOrInsert(command.name.replace("Command", ""), []);
|
|
170
|
+
for (const targetMeta of getTargetMetas(command)) {
|
|
177
171
|
if (targetMeta.targetOption.devOnly)
|
|
178
172
|
continue;
|
|
179
173
|
const [allArgMetas] = getArgMetas(command, targetMeta.key);
|
|
@@ -182,119 +176,72 @@ var groupCommands = (commands) => {
|
|
|
182
176
|
return "";
|
|
183
177
|
if (arg.type === "Module")
|
|
184
178
|
return "[sys:module]";
|
|
185
|
-
if (arg.type === "Argument")
|
|
179
|
+
if (arg.type === "Argument")
|
|
186
180
|
return `[${arg.name}]`;
|
|
187
|
-
}
|
|
188
181
|
return `[${arg.type.toLowerCase()}]`;
|
|
189
182
|
}).filter(Boolean);
|
|
190
|
-
|
|
191
|
-
if (group) {
|
|
192
|
-
group.commands.push({
|
|
193
|
-
key: camelToKebabCase2(targetMeta.key),
|
|
194
|
-
args,
|
|
195
|
-
desc: targetMeta.targetOption.desc
|
|
196
|
-
});
|
|
197
|
-
}
|
|
183
|
+
group.push({ key: camelToKebabCase(targetMeta.key), args, desc: targetMeta.targetOption.desc });
|
|
198
184
|
}
|
|
199
185
|
}
|
|
200
186
|
return groups;
|
|
201
187
|
};
|
|
202
188
|
var formatHelp = (commands, version) => {
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
for (const [groupName,
|
|
219
|
-
if (
|
|
189
|
+
const lines = [
|
|
190
|
+
"",
|
|
191
|
+
chalk.bold.cyan(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),
|
|
192
|
+
chalk.bold.cyan(" \u2551") + chalk.bold.white(" Akan.js Framework CLI ") + chalk.bold.cyan(" \u2551"),
|
|
193
|
+
chalk.bold.cyan(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),
|
|
194
|
+
"",
|
|
195
|
+
chalk.gray(` Version: ${version}`),
|
|
196
|
+
"",
|
|
197
|
+
chalk.bold.yellow(" USAGE"),
|
|
198
|
+
"",
|
|
199
|
+
chalk.gray(" $ ") + chalk.white("akan") + chalk.gray(" <command> [options]"),
|
|
200
|
+
"",
|
|
201
|
+
chalk.bold.yellow(" COMMANDS"),
|
|
202
|
+
""
|
|
203
|
+
];
|
|
204
|
+
for (const [groupName, cmds] of groupCommands(commands)) {
|
|
205
|
+
if (cmds.length === 0)
|
|
220
206
|
continue;
|
|
221
|
-
lines.push(chalk.bold.magenta(` ${groupName}`));
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (cmd.desc)
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if (cmdPrefix.length + cmd.desc.length + 3 < maxLineLength) {
|
|
231
|
-
lines.push(`${cmdPrefix} ${chalk.gray(cmd.desc)}`);
|
|
232
|
-
} else {
|
|
233
|
-
lines.push(cmdPrefix);
|
|
234
|
-
lines.push(`${indent}${chalk.gray(cmd.desc)}`);
|
|
235
|
-
}
|
|
236
|
-
} else {
|
|
237
|
-
lines.push(` ${cmdName}${cmdArgs}`);
|
|
238
|
-
}
|
|
207
|
+
lines.push(chalk.bold.magenta(` ${groupName}`), "");
|
|
208
|
+
for (const cmd of cmds) {
|
|
209
|
+
const cmdPrefix = ` ${chalk.green(cmd.key)}${cmd.args.length > 0 ? chalk.gray(` ${cmd.args.join(" ")}`) : ""}`;
|
|
210
|
+
if (!cmd.desc)
|
|
211
|
+
lines.push(cmdPrefix);
|
|
212
|
+
else if (cmdPrefix.length + cmd.desc.length + 3 < 70)
|
|
213
|
+
lines.push(`${cmdPrefix} ${chalk.gray(cmd.desc)}`);
|
|
214
|
+
else
|
|
215
|
+
lines.push(cmdPrefix, ` ${chalk.gray(cmd.desc)}`);
|
|
239
216
|
}
|
|
240
217
|
lines.push("");
|
|
241
218
|
}
|
|
242
|
-
lines.push(chalk.bold.yellow(" OPTIONS"));
|
|
243
|
-
lines.push("");
|
|
244
|
-
lines.push(` ${chalk.green("-v, --verbose")} ${chalk.gray("Enable verbose output")}`);
|
|
245
|
-
lines.push(` ${chalk.green("-h, --help")} ${chalk.gray("Display this help message")}`);
|
|
246
|
-
lines.push(` ${chalk.green("-V, --version")} ${chalk.gray("Output version number")}`);
|
|
247
|
-
lines.push("");
|
|
248
|
-
lines.push(chalk.bold.yellow(" EXAMPLES"));
|
|
249
|
-
lines.push("");
|
|
250
|
-
lines.push(chalk.gray(" # Create a new workspace"));
|
|
251
|
-
lines.push(chalk.white(" $ akan create-workspace myproject"));
|
|
252
|
-
lines.push("");
|
|
253
|
-
lines.push(chalk.gray(" # Start development server"));
|
|
254
|
-
lines.push(chalk.white(" $ akan start myapp"));
|
|
255
|
-
lines.push("");
|
|
256
|
-
lines.push(chalk.gray(" # Create a new module"));
|
|
257
|
-
lines.push(chalk.white(" $ akan create-module userProfile"));
|
|
258
|
-
lines.push("");
|
|
259
|
-
lines.push(chalk.gray(" Documentation: ") + chalk.cyan("https://akanjs.com/docs"));
|
|
260
|
-
lines.push(chalk.gray(" Report issues: ") + chalk.cyan("https://github.com/akan-team/akanjs/issues"));
|
|
261
|
-
lines.push("");
|
|
219
|
+
lines.push(chalk.bold.yellow(" OPTIONS"), "", ` ${chalk.green("-v, --verbose")} ${chalk.gray("Enable verbose output")}`, ` ${chalk.green("-h, --help")} ${chalk.gray("Display this help message")}`, ` ${chalk.green("-V, --version")} ${chalk.gray("Output version number")}`, "", chalk.bold.yellow(" EXAMPLES"), "", chalk.gray(" # Create a new workspace"), chalk.white(" $ akan create-workspace myproject"), "", chalk.gray(" # Start development server"), chalk.white(" $ akan start myapp"), "", chalk.gray(" # Create a new module"), chalk.white(" $ akan create-module userProfile"), "", chalk.gray(" Documentation: ") + chalk.cyan("https://akanjs.com/docs"), chalk.gray(" Report issues: ") + chalk.cyan("https://github.com/akan-team/akanjs/issues"), "");
|
|
262
220
|
return lines.join(`
|
|
263
221
|
`);
|
|
264
222
|
};
|
|
265
223
|
var formatCommandHelp = (command, key) => {
|
|
266
|
-
const [allArgMetas,
|
|
267
|
-
const kebabKey =
|
|
268
|
-
const
|
|
269
|
-
const
|
|
270
|
-
const
|
|
271
|
-
const commandDesc = targetMeta?.targetOption.desc;
|
|
272
|
-
lines.push("");
|
|
273
|
-
lines.push(chalk.bold.cyan(` Command: ${kebabKey}`));
|
|
274
|
-
if (commandDesc) {
|
|
275
|
-
lines.push(chalk.gray(` ${commandDesc}`));
|
|
276
|
-
}
|
|
277
|
-
lines.push("");
|
|
278
|
-
const args = allArgMetas.filter((arg) => arg.type !== "Option").map((arg) => {
|
|
224
|
+
const [allArgMetas, optionArgs] = getArgMetas(command, key);
|
|
225
|
+
const kebabKey = camelToKebabCase(key);
|
|
226
|
+
const commandDesc = getTargetMetas(command).find((t) => t.key === key)?.targetOption.desc;
|
|
227
|
+
const nonOptionArgs = allArgMetas.filter((arg) => arg.type !== "Option");
|
|
228
|
+
const args = nonOptionArgs.map((arg) => {
|
|
279
229
|
if (arg.type === "Workspace")
|
|
280
230
|
return "";
|
|
281
231
|
if (arg.type === "Module")
|
|
282
232
|
return "[sys:module]";
|
|
283
233
|
if (arg.type === "Apps")
|
|
284
234
|
return "[apps...]";
|
|
285
|
-
if (arg.type === "Argument")
|
|
286
|
-
return `[${
|
|
287
|
-
}
|
|
235
|
+
if (arg.type === "Argument")
|
|
236
|
+
return `[${camelToKebabCase(arg.name)}]`;
|
|
288
237
|
return `[${arg.type.toLowerCase()}]`;
|
|
289
238
|
}).filter(Boolean).join(" ");
|
|
290
|
-
lines
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
lines.push("");
|
|
294
|
-
const nonOptionArgs = allArgMetas.filter((arg) => arg.type !== "Option");
|
|
239
|
+
const lines = ["", chalk.bold.cyan(` Command: ${kebabKey}`)];
|
|
240
|
+
if (commandDesc)
|
|
241
|
+
lines.push(chalk.gray(` ${commandDesc}`));
|
|
242
|
+
lines.push("", chalk.bold.yellow(" USAGE"), "", chalk.gray(" $ ") + chalk.white(`akan ${kebabKey}`) + (args ? chalk.gray(` ${args}`) : ""), "");
|
|
295
243
|
if (nonOptionArgs.length > 0) {
|
|
296
|
-
lines.push(chalk.bold.yellow(" ARGUMENTS"));
|
|
297
|
-
lines.push("");
|
|
244
|
+
lines.push(chalk.bold.yellow(" ARGUMENTS"), "");
|
|
298
245
|
for (const arg of nonOptionArgs) {
|
|
299
246
|
if (arg.type === "Workspace")
|
|
300
247
|
continue;
|
|
@@ -302,7 +249,7 @@ var formatCommandHelp = (command, key) => {
|
|
|
302
249
|
let argDesc;
|
|
303
250
|
let example = "";
|
|
304
251
|
if (arg.type === "Argument") {
|
|
305
|
-
argName =
|
|
252
|
+
argName = camelToKebabCase(arg.name);
|
|
306
253
|
argDesc = arg.argsOption.desc ?? "";
|
|
307
254
|
example = arg.argsOption.example ? chalk.gray(` (e.g., ${String(arg.argsOption.example)})`) : "";
|
|
308
255
|
} else if (arg.type === "Module") {
|
|
@@ -319,15 +266,14 @@ var formatCommandHelp = (command, key) => {
|
|
|
319
266
|
}
|
|
320
267
|
lines.push("");
|
|
321
268
|
}
|
|
322
|
-
const optionArgs = argMetas.filter((a) => a.type === "Option");
|
|
323
269
|
if (optionArgs.length > 0) {
|
|
324
|
-
lines.push(chalk.bold.yellow(" OPTIONS"));
|
|
325
|
-
lines.push("");
|
|
270
|
+
lines.push(chalk.bold.yellow(" OPTIONS"), "");
|
|
326
271
|
for (const arg of optionArgs) {
|
|
327
272
|
const opt = arg.argsOption;
|
|
328
273
|
const flag = opt.flag ? `-${opt.flag}, ` : "";
|
|
329
|
-
const kebabName =
|
|
330
|
-
const
|
|
274
|
+
const kebabName = camelToKebabCase(arg.name);
|
|
275
|
+
const negation = opt.type === "boolean" && opt.default === true ? `, --no-${kebabName}` : "";
|
|
276
|
+
const optName = `${flag}--${kebabName}${negation}`;
|
|
331
277
|
const optDesc = opt.desc ?? "";
|
|
332
278
|
const defaultVal = opt.default !== undefined ? chalk.gray(` [default: ${String(opt.default)}]`) : "";
|
|
333
279
|
const choices = opt.enum ? chalk.gray(typeof opt.enum === "function" ? " ([dynamic choices])" : ` (${opt.enum.map(formatChoice).join(", ")})`) : "";
|
|
@@ -340,7 +286,6 @@ var formatCommandHelp = (command, key) => {
|
|
|
340
286
|
};
|
|
341
287
|
|
|
342
288
|
// pkgs/@akanjs/devkit/commandDecorators/command.ts
|
|
343
|
-
var camelToKebabCase3 = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
344
289
|
var loggedCliErrorObjects = new WeakSet;
|
|
345
290
|
var loggedCliErrorMessages = new Set;
|
|
346
291
|
var formatCliError = (error) => {
|
|
@@ -381,13 +326,15 @@ var handleOption = (programCommand, argMeta) => {
|
|
|
381
326
|
enum: enumChoices,
|
|
382
327
|
ask
|
|
383
328
|
} = argMeta.argsOption;
|
|
384
|
-
const kebabName =
|
|
329
|
+
const kebabName = camelToKebabCase(argMeta.name);
|
|
385
330
|
const choices = enumChoices && typeof enumChoices !== "function" ? normalizeEnumChoices(enumChoices) : null;
|
|
386
331
|
programCommand.option(`-${flag}, --${kebabName}${type === "boolean" ? " [boolean]" : ` <${kebabName}>`}`, `${desc}${ask ? ` (${ask})` : ""}${example ? ` (example: ${example})` : ""}${choices ? ` (choices: ${choices.map((choice) => choice.name).join(", ")})` : ""}`);
|
|
332
|
+
if (type === "boolean" && argMeta.argsOption.default === true)
|
|
333
|
+
programCommand.option(`--no-${kebabName}`, `turn off --${kebabName}`);
|
|
387
334
|
return programCommand;
|
|
388
335
|
};
|
|
389
336
|
var handleArgument = (programCommand, argMeta) => {
|
|
390
|
-
const kebabName =
|
|
337
|
+
const kebabName = camelToKebabCase(argMeta.name);
|
|
391
338
|
programCommand.argument(`[${kebabName}]`, `${argMeta.argsOption.desc}${argMeta.argsOption.example ? ` (example: ${argMeta.argsOption.example})` : ""}`);
|
|
392
339
|
return programCommand;
|
|
393
340
|
};
|
|
@@ -412,21 +359,14 @@ var assertEnumChoice = (argMeta, value) => {
|
|
|
412
359
|
const choices = normalizeEnumChoices(enumChoices);
|
|
413
360
|
if (choices.some((choice) => String(choice.value) === String(value)))
|
|
414
361
|
return;
|
|
415
|
-
const label = argMeta.type === "Option" ? `option '--${
|
|
362
|
+
const label = argMeta.type === "Option" ? `option '--${camelToKebabCase(argMeta.name)}'` : `argument '${argMeta.name}'`;
|
|
416
363
|
throw new Error(`${label} argument '${String(value)}' is invalid. Allowed choices are ${choices.map((choice) => choice.name).join(", ")}.`);
|
|
417
364
|
};
|
|
418
|
-
var
|
|
419
|
-
const enumChoices = argMeta.argsOption.enum;
|
|
420
|
-
if (!enumChoices)
|
|
421
|
-
return null;
|
|
422
|
-
if (typeof enumChoices === "function")
|
|
423
|
-
return await enumChoices(context);
|
|
424
|
-
return enumChoices;
|
|
425
|
-
};
|
|
365
|
+
var inputMessageOf = ({ name, argsOption: { desc, example, ask } }) => ask ? `${ask}: ` : desc ? `${desc}: ` : `Enter the ${name} value${example ? ` (example: ${example})` : ""}: `;
|
|
426
366
|
var getOptionValue = async (argMeta, opt, context) => {
|
|
427
367
|
const {
|
|
428
368
|
name,
|
|
429
|
-
argsOption: { enum: enumChoices, default: defaultValue, type, desc, nullable,
|
|
369
|
+
argsOption: { enum: enumChoices, default: defaultValue, type, desc, nullable, ask }
|
|
430
370
|
} = argMeta;
|
|
431
371
|
if (opt[argMeta.name] !== undefined) {
|
|
432
372
|
assertEnumChoice(argMeta, opt[argMeta.name]);
|
|
@@ -434,29 +374,20 @@ var getOptionValue = async (argMeta, opt, context) => {
|
|
|
434
374
|
} else if (defaultValue !== undefined)
|
|
435
375
|
return defaultValue;
|
|
436
376
|
if (enumChoices) {
|
|
437
|
-
const choices = normalizeEnumChoices(await
|
|
377
|
+
const choices = normalizeEnumChoices((typeof enumChoices === "function" ? await enumChoices(context) : enumChoices) ?? []);
|
|
438
378
|
if (choices.length === 1)
|
|
439
379
|
return choices[0]?.value;
|
|
440
|
-
|
|
441
|
-
return choice;
|
|
380
|
+
return await select({ message: ask ?? desc ?? `Select the ${name} value`, choices });
|
|
442
381
|
} else if (nullable)
|
|
443
382
|
return null;
|
|
444
383
|
else if (type === "boolean") {
|
|
445
384
|
const message = ask ?? desc ?? `Do you want to set ${name}? ${desc ? ` (${desc})` : ""}: `;
|
|
446
385
|
return await confirm({ message });
|
|
447
|
-
} else
|
|
448
|
-
|
|
449
|
-
if (argMeta.argsOption.nullable)
|
|
450
|
-
return await input({ message });
|
|
451
|
-
else
|
|
452
|
-
return convertArgValue(await input({ message }), type ?? "string");
|
|
453
|
-
}
|
|
386
|
+
} else
|
|
387
|
+
return convertArgValue(await input({ message: inputMessageOf(argMeta) }), type ?? "string");
|
|
454
388
|
};
|
|
455
389
|
var getArgumentValue = async (argMeta, value) => {
|
|
456
|
-
const {
|
|
457
|
-
name,
|
|
458
|
-
argsOption: { default: defaultValue, type, desc, nullable, example, ask }
|
|
459
|
-
} = argMeta;
|
|
390
|
+
const { default: defaultValue, type, nullable } = argMeta.argsOption;
|
|
460
391
|
if (value !== undefined) {
|
|
461
392
|
assertEnumChoice(argMeta, value);
|
|
462
393
|
return convertArgValue(value, type ?? "string");
|
|
@@ -464,8 +395,7 @@ var getArgumentValue = async (argMeta, value) => {
|
|
|
464
395
|
return defaultValue;
|
|
465
396
|
else if (nullable)
|
|
466
397
|
return null;
|
|
467
|
-
|
|
468
|
-
return convertArgValue(await input({ message }), type ?? "string");
|
|
398
|
+
return convertArgValue(await input({ message: inputMessageOf(argMeta) }), type ?? "string");
|
|
469
399
|
};
|
|
470
400
|
var assignCommandContext = (context, argMeta, value) => {
|
|
471
401
|
if (value instanceof AppExecutor)
|
|
@@ -486,9 +416,9 @@ var assignCommandContext = (context, argMeta, value) => {
|
|
|
486
416
|
var assertCurrentDirectoryIsWorkspaceRoot = async () => {
|
|
487
417
|
const cwd = process.cwd();
|
|
488
418
|
const [hasPackageJson, hasTsConfig, hasEnv] = await Promise.all([
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
419
|
+
FileSys2.fileExists(`${cwd}/package.json`),
|
|
420
|
+
FileSys2.fileExists(`${cwd}/tsconfig.json`),
|
|
421
|
+
FileSys2.fileExists(`${cwd}/.env`)
|
|
492
422
|
]);
|
|
493
423
|
if (hasPackageJson && hasTsConfig && hasEnv)
|
|
494
424
|
return;
|
|
@@ -529,44 +459,28 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
|
529
459
|
return workspace;
|
|
530
460
|
const sysType = argMeta.type.toLowerCase();
|
|
531
461
|
const [appNames, libNames, pkgNames] = await workspace.getExecs();
|
|
532
|
-
if (sysType === "sys") {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
else if (value && pkgNames.includes(value))
|
|
555
|
-
return PkgExecutor.from(workspace, value);
|
|
556
|
-
else {
|
|
557
|
-
const execName = await select({
|
|
558
|
-
message: `Select the App or Lib or Pkg name`,
|
|
559
|
-
choices: [...appNames, ...libNames, ...pkgNames]
|
|
560
|
-
});
|
|
561
|
-
if (appNames.includes(execName))
|
|
562
|
-
return AppExecutor.from(workspace, execName);
|
|
563
|
-
else if (libNames.includes(execName))
|
|
564
|
-
return LibExecutor.from(workspace, execName);
|
|
565
|
-
else if (pkgNames.includes(execName))
|
|
566
|
-
return PkgExecutor.from(workspace, execName);
|
|
567
|
-
else
|
|
568
|
-
throw new Error(`Invalid system name: ${execName}`);
|
|
569
|
-
}
|
|
462
|
+
if (sysType === "sys" || sysType === "exec") {
|
|
463
|
+
const pkgChoices = sysType === "exec" ? pkgNames : [];
|
|
464
|
+
const execOf = (name) => {
|
|
465
|
+
if (appNames.includes(name))
|
|
466
|
+
return AppExecutor.from(workspace, name);
|
|
467
|
+
if (libNames.includes(name))
|
|
468
|
+
return LibExecutor.from(workspace, name);
|
|
469
|
+
if (pkgChoices.includes(name))
|
|
470
|
+
return PkgExecutor.from(workspace, name);
|
|
471
|
+
return null;
|
|
472
|
+
};
|
|
473
|
+
const found = value ? execOf(value) : null;
|
|
474
|
+
if (found)
|
|
475
|
+
return found;
|
|
476
|
+
const name = await select({
|
|
477
|
+
message: sysType === "exec" ? `Select the App or Lib or Pkg name` : `Select the App or Lib name`,
|
|
478
|
+
choices: [...appNames, ...libNames, ...pkgChoices]
|
|
479
|
+
});
|
|
480
|
+
const picked = execOf(name);
|
|
481
|
+
if (!picked)
|
|
482
|
+
throw new Error(`Invalid system name: ${name}`);
|
|
483
|
+
return picked;
|
|
570
484
|
} else if (sysType === "app") {
|
|
571
485
|
if (value && appNames.includes(value))
|
|
572
486
|
return AppExecutor.from(workspace, value);
|
|
@@ -631,9 +545,9 @@ var runCommands = async (...commands) => {
|
|
|
631
545
|
const packageJsonCandidates = [`${path2.dirname(Bun.main)}/package.json`, `${__dirname2}/../package.json`];
|
|
632
546
|
let cliPackageJson = null;
|
|
633
547
|
for (const packageJsonPath of packageJsonCandidates) {
|
|
634
|
-
if (!await
|
|
548
|
+
if (!await FileSys2.fileExists(packageJsonPath))
|
|
635
549
|
continue;
|
|
636
|
-
const packageJson = await
|
|
550
|
+
const packageJson = await FileSys2.readJson(packageJsonPath);
|
|
637
551
|
if (packageJson.name === "@akanjs/cli" || packageJson.name === "@akanjs/devkit") {
|
|
638
552
|
cliPackageJson = packageJson;
|
|
639
553
|
break;
|
|
@@ -641,17 +555,14 @@ var runCommands = async (...commands) => {
|
|
|
641
555
|
}
|
|
642
556
|
process.env.AKAN_VERSION = cliPackageJson?.version ?? "0.0.1";
|
|
643
557
|
const hasHelpFlag = process.argv.includes("--help") || process.argv.includes("-h");
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
Logger.rawLog(formatHelp(commands, process.env.AKAN_VERSION));
|
|
648
|
-
process.exit(0);
|
|
649
|
-
}
|
|
558
|
+
if (process.argv.length === 2 || process.argv.length === 3 && hasHelpFlag) {
|
|
559
|
+
Logger.rawLog(formatHelp(commands, process.env.AKAN_VERSION));
|
|
560
|
+
process.exit(0);
|
|
650
561
|
}
|
|
651
562
|
program.version(process.env.AKAN_VERSION).description("Akan CLI").configureHelp({
|
|
652
563
|
helpWidth: 100
|
|
653
564
|
});
|
|
654
|
-
const installedAkanPackageJson = await
|
|
565
|
+
const installedAkanPackageJson = await FileSys2.fileExists("./node_modules/akanjs/package.json") ? await FileSys2.readJson("./node_modules/akanjs/package.json") : null;
|
|
655
566
|
if (installedAkanPackageJson && installedAkanPackageJson.version !== process.env.AKAN_VERSION) {
|
|
656
567
|
Logger.rawLog(chalk2.yellow(`
|
|
657
568
|
Akan CLI version is mismatch with installed package. ${process.env.AKAN_VERSION} (global) vs ${installedAkanPackageJson.version} (akanjs)
|
|
@@ -729,10 +640,15 @@ It may cause unexpected behavior. Run \`akan update\` to update latest akanjs.`)
|
|
|
729
640
|
}
|
|
730
641
|
}
|
|
731
642
|
}
|
|
732
|
-
await program.parseAsync(process.argv)
|
|
643
|
+
await program.parseAsync(process.argv).catch((error) => {
|
|
644
|
+
printCliError(error);
|
|
645
|
+
process.exit(1);
|
|
646
|
+
});
|
|
733
647
|
};
|
|
734
648
|
|
|
735
649
|
// pkgs/@akanjs/devkit/commandDecorators/commandBuilder.ts
|
|
650
|
+
var argMetaOf = (type, name, primitive, argsOption, idx) => ({ name, argsOption: { ...argsOption, type: normalizePrimitiveArgType(primitive) }, key: "", idx, type });
|
|
651
|
+
|
|
736
652
|
class TargetBuilder {
|
|
737
653
|
targetOption;
|
|
738
654
|
#args;
|
|
@@ -740,39 +656,17 @@ class TargetBuilder {
|
|
|
740
656
|
this.targetOption = targetOption;
|
|
741
657
|
this.#args = args;
|
|
742
658
|
}
|
|
659
|
+
#add(...argMetas) {
|
|
660
|
+
return new TargetBuilder(this.targetOption, [...this.#args, ...argMetas]);
|
|
661
|
+
}
|
|
743
662
|
arg(name, type, argsOption = {}) {
|
|
744
|
-
return
|
|
745
|
-
...this.#args,
|
|
746
|
-
{
|
|
747
|
-
name,
|
|
748
|
-
argsOption: { ...argsOption, type: normalizePrimitiveArgType(type) },
|
|
749
|
-
key: "",
|
|
750
|
-
idx: this.#args.length,
|
|
751
|
-
type: "Argument"
|
|
752
|
-
}
|
|
753
|
-
]);
|
|
663
|
+
return this.#add(argMetaOf("Argument", name, type, argsOption, this.#args.length));
|
|
754
664
|
}
|
|
755
665
|
option(name, type, argsOption = {}) {
|
|
756
|
-
return
|
|
757
|
-
...this.#args,
|
|
758
|
-
{
|
|
759
|
-
name,
|
|
760
|
-
argsOption: { ...argsOption, type: normalizePrimitiveArgType(type) },
|
|
761
|
-
key: "",
|
|
762
|
-
idx: this.#args.length,
|
|
763
|
-
type: "Option"
|
|
764
|
-
}
|
|
765
|
-
]);
|
|
666
|
+
return this.#add(argMetaOf("Option", name, type, argsOption, this.#args.length));
|
|
766
667
|
}
|
|
767
668
|
with(...tokens) {
|
|
768
|
-
return
|
|
769
|
-
...this.#args,
|
|
770
|
-
...tokens.map((token, offset) => ({
|
|
771
|
-
key: "",
|
|
772
|
-
idx: this.#args.length + offset,
|
|
773
|
-
type: token.type
|
|
774
|
-
}))
|
|
775
|
-
]);
|
|
669
|
+
return this.#add(...tokens.map((token, offset) => ({ key: "", idx: this.#args.length + offset, type: token.type })));
|
|
776
670
|
}
|
|
777
671
|
exec(handler) {
|
|
778
672
|
return {
|
|
@@ -787,20 +681,8 @@ var createContext = () => ({
|
|
|
787
681
|
public: createTarget("public"),
|
|
788
682
|
cloud: createTarget("cloud"),
|
|
789
683
|
dev: createTarget("dev"),
|
|
790
|
-
arg: (name, type, argsOption) => (
|
|
791
|
-
|
|
792
|
-
argsOption: { ...argsOption ?? {}, type: normalizePrimitiveArgType(type) },
|
|
793
|
-
key: "",
|
|
794
|
-
idx: -1,
|
|
795
|
-
type: "Argument"
|
|
796
|
-
}),
|
|
797
|
-
option: (name, type, argsOption) => ({
|
|
798
|
-
name,
|
|
799
|
-
argsOption: { ...argsOption ?? {}, type: normalizePrimitiveArgType(type) },
|
|
800
|
-
key: "",
|
|
801
|
-
idx: -1,
|
|
802
|
-
type: "Option"
|
|
803
|
-
})
|
|
684
|
+
arg: (name, type, argsOption) => argMetaOf("Argument", name, type, argsOption, -1),
|
|
685
|
+
option: (name, type, argsOption) => argMetaOf("Option", name, type, argsOption, -1)
|
|
804
686
|
});
|
|
805
687
|
var buildCommandMeta = (definitions) => {
|
|
806
688
|
const commandMeta = new Map;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-rmcw8yc8.js";
|
|
6
6
|
|
|
7
7
|
// pkgs/@akanjs/cli/page/page.runner.ts
|
|
8
8
|
class PageRunner extends runner("page") {
|
|
@@ -10,7 +10,11 @@ class PageRunner extends runner("page") {
|
|
|
10
10
|
await app.applyTemplate({
|
|
11
11
|
basePath: basePath ?? `page/(${app.name})/(public)/${module.name}`,
|
|
12
12
|
template: single ? "crudSinglePage" : "crudPages",
|
|
13
|
-
dict: {
|
|
13
|
+
dict: {
|
|
14
|
+
model: module.name,
|
|
15
|
+
appName: module.sys.name,
|
|
16
|
+
clientPath: `@${module.sys.type}s/${module.sys.name}/client`
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
19
|
}
|
|
16
20
|
}
|