@akanjs/cli 3.0.0-beta.3 → 3.0.0-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build-stamp +1 -1
- package/CodeAgent-tbdpdjat.js +9 -0
- package/CodeAgentRpcHost-p7h6n2hp.js +7 -0
- package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
- package/CodeTui-my2x5fah.js +1457 -0
- package/README.md +3 -0
- package/TunnelShare-cwh9ezsm.js +9 -0
- package/{agent.command-d2gfxfck.js → agent.command-vz60x05c.js} +8 -9
- package/akanCode.js +102 -0
- package/application.command-pxqfjrqm.js +241 -0
- package/{applicationBuildRunner-kxwbssgn.js → applicationBuildRunner-shnfyfdy.js} +121 -77
- package/buildBatch.proc.js +120 -32
- package/cloud.command-9v9tpgps.js +95 -0
- package/cloud.script-baqdthnz.js +20 -0
- package/code.command-13h14j25.js +154 -0
- package/commandManifest.json +1 -1
- package/consoleToStderr-h5bryj94.js +7 -0
- package/context.command-x1hbasm5.js +48 -0
- package/context.runner-kqbjjea1.js +21 -0
- package/{dependencyScanner-shs82ynp.js → dependencyScanner-06z2dmrr.js} +2 -2
- package/{devTui-40ggmd99.js → devTui-q7k7bakd.js} +122 -40
- package/fileSys-wzzrntkw.js +9 -0
- package/guideline.command-vfk11hpj.js +42 -0
- package/guidelines/agentRule/agentRule.instruction.md +209 -33
- package/guidelines/conventions/conventions.instruction.md +144 -41
- package/guidelines/fieldRule/fieldRule.instruction.md +1 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
- package/guidelines/queryRule/queryRule.instruction.md +21 -7
- package/guidelines/runtimeRule/runtimeRule.instruction.md +271 -6
- package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
- package/guidelines/transportRule/transportRule.instruction.md +51 -0
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +20 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +66 -3
- package/incrementalBuilder.proc.js +564 -109
- package/{index-mak3cd28.js → index-1skctzbq.js} +137 -255
- package/{index-kcxmv48c.js → index-2ahj896a.js} +45 -79
- package/index-2wc41k5w.js +49 -0
- package/index-3hx1z96c.js +87 -0
- package/{index-hwkygn9s.js → index-48k96p55.js} +325 -36
- package/{index-q0y2jq9j.js → index-52w0fvh8.js} +21 -4
- package/index-7md2g9vw.js +6 -0
- package/index-7yf7rnjg.js +53 -0
- package/{index-gyd220p2.js → index-84r80zdx.js} +554 -577
- package/{index-zry5nz81.js → index-8psse8dw.js} +51 -30
- package/index-947t6zm4.js +1119 -0
- package/index-94s080qm.js +266 -0
- package/index-9dp031by.js +12 -0
- package/index-9s5zga3q.js +4300 -0
- package/{index-ws5e0j51.js → index-arnkqb6f.js} +43 -26
- package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
- package/index-c6eggbee.js +123 -0
- package/{index-4edzf1gr.js → index-cxafpw23.js} +77 -150
- package/index-d2242ksy.js +99 -0
- package/index-d5yn19ef.js +700 -0
- package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
- package/{index-2tv3fdx4.js → index-e52z7psd.js} +1212 -1458
- package/{index-a64esmtb.js → index-ew8dna9s.js} +523 -1022
- package/{index-7737gxcp.js → index-f50dy7yq.js} +107 -241
- package/index-f8q701fb.js +1003 -0
- package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
- package/{index-j9yhg404.js → index-ksq4t16z.js} +4 -7
- package/index-nhhrjvk1.js +187 -0
- package/index-p6pbz9n5.js +25 -0
- package/index-ptshj7y1.js +2729 -0
- package/{index-fz5q3gd7.js → index-q9q7x4zj.js} +10 -17
- package/{index-pnqbkf5p.js → index-qk9vv9hm.js} +6 -2
- package/{index-600zhnve.js → index-rqxa9r98.js} +75 -203
- package/{index-ne2qy0nk.js → index-smbecayj.js} +12 -12
- package/{index-ktb5njgy.js → index-vcdxpmsx.js} +49 -99
- package/index-wa5jbxj1.js +760 -0
- package/index-ymnqrsxm.js +69 -0
- package/{index-v0qh106m.js → index-zc90rh75.js} +961 -892
- package/{index-259dsnz3.js → index-zvr7wfyg.js} +5 -8
- package/{index-h7yw2z9n.js → index-zzvvc845.js} +8 -14
- package/index.js +23 -22
- package/{library.command-nbsky672.js → library.command-m52jqc0s.js} +4 -5
- package/{localRegistry.command-yeq57wjr.js → localRegistry.command-x5vs1z43.js} +23 -42
- package/{module.command-29vqzrh8.js → module.command-ty3k6rwd.js} +8 -11
- package/{package.command-axv0abmn.js → package.command-hphdh4g4.js} +6 -7
- package/package.json +15 -7
- package/{page.command-vs9s3zrh.js → page.command-5aq8mzvq.js} +4 -5
- package/{primitive.command-cbxmqbtc.js → primitive.command-adwj84kx.js} +9 -22
- package/prompter-76k56b37.js +8 -0
- package/{quality.command-gmbs7nws.js → quality.command-y10kea2f.js} +205 -377
- package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
- package/{repair.command-bqsjptsj.js → repair.command-v7mwqvjh.js} +11 -35
- package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
- package/{scalar.command-6k1vhe9s.js → scalar.command-pg3gneer.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-ejdmvbq7.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 +1 -3
- package/templates/service/__model__.abstract.md.template +8 -0
- package/templates/workspaceRoot/.gitignore.template +0 -1
- package/templates/workspaceRoot/package.json.template +1 -3
- package/tunnel.command-rz9qf230.js +129 -0
- package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/workflow.command-6r809r2z.js +79 -0
- package/{workspace.command-8s050m0h.js → workspace.command-8g3cw7jd.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-w8kmx1b6.js +0 -2176
- 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/templates/workspaceRoot/patches/react-dom@19.2.7.patch.template +0 -62
- package/workflow.command-nwpcdc8p.js +0 -107
|
@@ -25,12 +25,13 @@ var scanRecipes2 = (sources) => {
|
|
|
25
25
|
const parsed = parseRecipeCall(declaration.initializer);
|
|
26
26
|
if (!parsed)
|
|
27
27
|
continue;
|
|
28
|
+
const doc = getLeadingDoc(source.content, statement);
|
|
28
29
|
recipes.push({
|
|
29
30
|
name: declaration.name.text,
|
|
30
31
|
importFrom: source.importFrom,
|
|
31
32
|
variants: parsed.variants,
|
|
32
33
|
...parsed.defaultVariants ? { defaultVariants: parsed.defaultVariants } : {},
|
|
33
|
-
...
|
|
34
|
+
...doc ? { doc } : {},
|
|
34
35
|
...parsed.base ? { base: parsed.base } : {}
|
|
35
36
|
});
|
|
36
37
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
AppInfo
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-e52z7psd.js";
|
|
5
5
|
|
|
6
6
|
// pkgs/@akanjs/devkit/slicePlanner.ts
|
|
7
7
|
class SlicePlanner {
|
|
@@ -65,9 +65,6 @@ class SlicePlanner {
|
|
|
65
65
|
constructor(app) {
|
|
66
66
|
this.#app = app;
|
|
67
67
|
}
|
|
68
|
-
async#trackedFiles(paths) {
|
|
69
|
-
return await this.#app.workspace.listGitFiles(paths);
|
|
70
|
-
}
|
|
71
68
|
async#untrackedFiles(paths) {
|
|
72
69
|
const [tracked, all] = await Promise.all([
|
|
73
70
|
this.#app.workspace.listGitFiles(paths),
|
|
@@ -102,12 +99,12 @@ class SlicePlanner {
|
|
|
102
99
|
const libs = appInfo.getLibs();
|
|
103
100
|
const slicePaths = [`apps/${this.#app.name}`, ...libs.map((lib) => `libs/${lib}`)];
|
|
104
101
|
const [appFiles, allTracked, untracked, rootPackageJson] = await Promise.all([
|
|
105
|
-
this.#
|
|
106
|
-
this.#
|
|
102
|
+
this.#app.workspace.listGitFiles([`apps/${this.#app.name}`]),
|
|
103
|
+
this.#app.workspace.listGitFiles(["."]),
|
|
107
104
|
this.#untrackedFiles(slicePaths),
|
|
108
105
|
this.#app.workspace.getPackageJson()
|
|
109
106
|
]);
|
|
110
|
-
const libFiles = Object.fromEntries(await Promise.all(libs.map(async (lib) => [lib, await this.#
|
|
107
|
+
const libFiles = Object.fromEntries(await Promise.all(libs.map(async (lib) => [lib, await this.#app.workspace.listGitFiles([`libs/${lib}`])])));
|
|
111
108
|
const rootFiles = allTracked.filter((file) => !this.#isMemberFile(file));
|
|
112
109
|
const required = SlicePlanner.#requiredDependencies(appInfo);
|
|
113
110
|
const {
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
runner,
|
|
4
|
+
script
|
|
5
|
+
} from "./index-1skctzbq.js";
|
|
6
|
+
import {
|
|
7
|
+
ModuleExecutor
|
|
8
|
+
} from "./index-e52z7psd.js";
|
|
9
|
+
import {
|
|
10
|
+
sourceFile,
|
|
11
|
+
moduleSourcePaths,
|
|
12
|
+
generatedFilesForSync,
|
|
13
|
+
createPassedPrimitiveReport,
|
|
14
|
+
bilingualLabelForField,
|
|
15
|
+
bilingualDescriptionForField
|
|
16
|
+
} from "./index-84r80zdx.js";
|
|
17
|
+
import {
|
|
18
|
+
PageScript
|
|
19
|
+
} from "./index-qk9vv9hm.js";
|
|
20
|
+
import {
|
|
21
|
+
pluralizeName
|
|
22
|
+
} from "./index-nz8prx9g.js";
|
|
23
|
+
|
|
24
|
+
// pkgs/@akanjs/cli/module/module.script.ts
|
|
25
|
+
import { capitalize as capitalize2 } from "akanjs/common";
|
|
26
|
+
|
|
27
|
+
// pkgs/@akanjs/cli/module/module.runner.ts
|
|
28
|
+
import { capitalize } from "akanjs/common";
|
|
29
|
+
var purposeByModule = {
|
|
30
|
+
budget: "Budget represents planned or actual money allocated inside the app.",
|
|
31
|
+
project: "Project represents a project workspace or business initiative managed by the app.",
|
|
32
|
+
task: "Task represents work items that move through the app workflow."
|
|
33
|
+
};
|
|
34
|
+
var moduleAbstractContent = (moduleName, sharedGuards) => {
|
|
35
|
+
const title = capitalize(moduleName);
|
|
36
|
+
const noun = bilingualLabelForField(moduleName).en.toLowerCase();
|
|
37
|
+
const purpose = purposeByModule[moduleName] ?? `${title} represents ${noun} records managed by the app.`;
|
|
38
|
+
const writeRule = sharedGuards ? `Anyone may read a ${noun}; only an admin creates, updates or removes one.` : `Anyone may read a ${noun}; nobody creates, updates or removes one until the slice names a guard.`;
|
|
39
|
+
return `# ${moduleName} Abstract
|
|
40
|
+
${purpose}
|
|
41
|
+
|
|
42
|
+
## Rules
|
|
43
|
+
- ${writeRule}
|
|
44
|
+
- Removal is soft: a removed ${noun} keeps its row with \`removedAt\` set.
|
|
45
|
+
`;
|
|
46
|
+
};
|
|
47
|
+
var moduleFileKeys = [
|
|
48
|
+
"abstract",
|
|
49
|
+
"constant",
|
|
50
|
+
"dictionary",
|
|
51
|
+
"service",
|
|
52
|
+
"store",
|
|
53
|
+
"signal",
|
|
54
|
+
"unit",
|
|
55
|
+
"view",
|
|
56
|
+
"template",
|
|
57
|
+
"zone",
|
|
58
|
+
"util"
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
class ModuleRunner extends runner("module") {
|
|
62
|
+
async createService(module) {
|
|
63
|
+
const serviceName = module.name.replace(/^_+/, "");
|
|
64
|
+
await module.applyTemplate({
|
|
65
|
+
basePath: `.`,
|
|
66
|
+
template: "service",
|
|
67
|
+
dict: { model: serviceName, sysName: module.sys.name }
|
|
68
|
+
});
|
|
69
|
+
return await this.#readFiles(module, {
|
|
70
|
+
abstract: `${serviceName}.abstract.md`,
|
|
71
|
+
dictionary: `${serviceName}.dictionary.ts`,
|
|
72
|
+
service: `${serviceName}.service.ts`,
|
|
73
|
+
signal: `${serviceName}.signal.ts`,
|
|
74
|
+
store: `${serviceName}.store.ts`
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
async#readFiles(module, filenames) {
|
|
78
|
+
const files = await Promise.all(Object.entries(filenames).map(async ([key, filename]) => [
|
|
79
|
+
key,
|
|
80
|
+
{ filename, content: await module.readFile(filename) }
|
|
81
|
+
]));
|
|
82
|
+
return Object.fromEntries(files);
|
|
83
|
+
}
|
|
84
|
+
async removeModule(module) {
|
|
85
|
+
await module.sys.removeDir(`lib/${module.name}`);
|
|
86
|
+
}
|
|
87
|
+
async#hasSharedGuards(module) {
|
|
88
|
+
const { sys } = module;
|
|
89
|
+
if (sys.type === "lib" && sys.name === "shared")
|
|
90
|
+
return true;
|
|
91
|
+
if (!await sys.exists("lib/srv.ts"))
|
|
92
|
+
return false;
|
|
93
|
+
return (await sys.readFile("lib/srv.ts")).includes('"@libs/shared/lib/srv"');
|
|
94
|
+
}
|
|
95
|
+
async createComponentTemplate(module, type) {
|
|
96
|
+
await module.sys.applyTemplate({
|
|
97
|
+
basePath: `./lib/${module.name}`,
|
|
98
|
+
template: `module/__Model__.${capitalize(type)}.tsx`,
|
|
99
|
+
dict: { model: module.name, sysName: module.sys.name, sysType: module.sys.type }
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
component: {
|
|
103
|
+
filename: `${capitalize(module.name)}.${capitalize(type)}.tsx`,
|
|
104
|
+
content: await module.sys.readFile(`lib/${module.name}/${capitalize(module.name)}.${capitalize(type)}.tsx`)
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
async createModuleTemplate(module) {
|
|
109
|
+
const names = pluralizeName(module.name);
|
|
110
|
+
const modelLabel = bilingualLabelForField(module.name);
|
|
111
|
+
const modelDescription = bilingualDescriptionForField(module.name);
|
|
112
|
+
const paths = moduleSourcePaths(module.name);
|
|
113
|
+
const filenames = Object.fromEntries(moduleFileKeys.map((key) => [key, paths[key].replace(`lib/${module.name}/`, "")]));
|
|
114
|
+
const sharedGuards = await this.#hasSharedGuards(module);
|
|
115
|
+
await module.applyTemplate({
|
|
116
|
+
basePath: `.`,
|
|
117
|
+
template: "module",
|
|
118
|
+
options: { sharedGuards },
|
|
119
|
+
dict: {
|
|
120
|
+
model: module.name,
|
|
121
|
+
models: names,
|
|
122
|
+
sysName: module.sys.name,
|
|
123
|
+
sysType: module.sys.type,
|
|
124
|
+
modelLabelEn: modelLabel.en,
|
|
125
|
+
modelLabelKo: modelLabel.ko,
|
|
126
|
+
modelDescEn: modelDescription.en,
|
|
127
|
+
modelDescKo: modelDescription.ko
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
await module.writeFile(filenames.abstract, moduleAbstractContent(module.name, sharedGuards));
|
|
131
|
+
return await this.#readFiles(module, filenames);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// pkgs/@akanjs/cli/module/module.script.ts
|
|
136
|
+
var moduleChangedFiles = (sys, moduleName, files) => Object.values(files).map((file) => sourceFile(sys, `lib/${moduleName}/${file.filename}`, "create", "Module source file was created."));
|
|
137
|
+
|
|
138
|
+
class ModuleScript extends script("module", [ModuleRunner, PageScript]) {
|
|
139
|
+
async createModuleTemplate(sys, name, { page = false } = {}) {
|
|
140
|
+
const mod = ModuleExecutor.from(sys, name);
|
|
141
|
+
const files = await this.moduleRunner.createModuleTemplate(mod);
|
|
142
|
+
if (page && sys.type === "app")
|
|
143
|
+
await this.pageScript.createCrudPage(mod, { app: sys, basePath: null, single: false });
|
|
144
|
+
await sys.scan();
|
|
145
|
+
return createPassedPrimitiveReport({
|
|
146
|
+
command: "create-module",
|
|
147
|
+
changedFiles: moduleChangedFiles(sys, name, files),
|
|
148
|
+
generatedFiles: generatedFilesForSync(sys, "Generated files were refreshed after module creation."),
|
|
149
|
+
target: sys.name
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async removeModule(mod) {
|
|
153
|
+
await this.moduleRunner.removeModule(mod);
|
|
154
|
+
}
|
|
155
|
+
async createService(sys, name) {
|
|
156
|
+
const service = ModuleExecutor.from(sys, `_${name}`);
|
|
157
|
+
const files = await this.moduleRunner.createService(service);
|
|
158
|
+
await sys.scan();
|
|
159
|
+
return createPassedPrimitiveReport({
|
|
160
|
+
command: "create-service",
|
|
161
|
+
changedFiles: moduleChangedFiles(sys, `_${name}`, files),
|
|
162
|
+
generatedFiles: generatedFilesForSync(sys, "Generated files were refreshed after service creation."),
|
|
163
|
+
target: sys.name
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
async createTemplate(mod) {
|
|
167
|
+
return await this.#createComponent(mod, "template");
|
|
168
|
+
}
|
|
169
|
+
async createUnit(mod) {
|
|
170
|
+
return await this.#createComponent(mod, "unit");
|
|
171
|
+
}
|
|
172
|
+
async createView(mod) {
|
|
173
|
+
return await this.#createComponent(mod, "view");
|
|
174
|
+
}
|
|
175
|
+
async#createComponent(mod, type) {
|
|
176
|
+
const { component } = await this.moduleRunner.createComponentTemplate(mod, type);
|
|
177
|
+
return createPassedPrimitiveReport({
|
|
178
|
+
command: `create-${type}`,
|
|
179
|
+
changedFiles: [
|
|
180
|
+
sourceFile(mod.sys, `lib/${mod.name}/${component.filename}`, "create", `${capitalize2(type)} UI source was created.`)
|
|
181
|
+
],
|
|
182
|
+
target: mod.sys.name
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export { ModuleScript };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/cli/clipboard.ts
|
|
3
|
+
var clipboardCommands = () => {
|
|
4
|
+
if (process.platform === "darwin")
|
|
5
|
+
return [["pbcopy"]];
|
|
6
|
+
if (process.platform === "win32")
|
|
7
|
+
return [["clip"]];
|
|
8
|
+
return [["wl-copy"], ["xclip", "-selection", "clipboard"], ["xsel", "--clipboard", "--input"]];
|
|
9
|
+
};
|
|
10
|
+
var writeClipboard = async (text) => {
|
|
11
|
+
for (const command of clipboardCommands()) {
|
|
12
|
+
try {
|
|
13
|
+
const proc = Bun.spawn(command, {
|
|
14
|
+
stdin: new TextEncoder().encode(text),
|
|
15
|
+
stdout: "ignore",
|
|
16
|
+
stderr: "ignore"
|
|
17
|
+
});
|
|
18
|
+
if (await proc.exited === 0)
|
|
19
|
+
return true;
|
|
20
|
+
} catch {}
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { writeClipboard };
|