@akanjs/cli 3.0.0-beta.9 → 3.0.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 +1 -1
- package/CodeAgent-2vmp9qe0.js +9 -0
- package/CodeAgentRpcHost-p7h6n2hp.js +7 -0
- package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
- package/CodeTui-5ed6bg2a.js +1457 -0
- package/README.ko.md +83 -28
- package/README.md +70 -27
- package/TunnelShare-cwh9ezsm.js +9 -0
- package/{agent.command-0q17pnrs.js → agent.command-gn73rhe7.js} +8 -9
- package/akanCode.js +102 -0
- package/application.command-e968t0hw.js +246 -0
- package/{applicationBuildRunner-kxwbssgn.js → applicationBuildRunner-64taxseg.js} +121 -77
- package/buildBatch.proc.js +120 -32
- package/cloud.command-0jm301rr.js +95 -0
- package/cloud.script-nemnzjpv.js +20 -0
- package/code.command-18kcm7hq.js +154 -0
- package/commandManifest.json +1 -1
- package/consoleToStderr-h5bryj94.js +7 -0
- package/context.command-trd9bn18.js +48 -0
- package/context.runner-y5hwh673.js +21 -0
- package/{dependencyScanner-shs82ynp.js → dependencyScanner-06z2dmrr.js} +2 -2
- package/{devTui-m1atgkc9.js → devTui-q7k7bakd.js} +122 -40
- package/fileSys-wzzrntkw.js +9 -0
- package/guideline.command-bdmdn2de.js +42 -0
- package/guidelines/agentRule/agentRule.instruction.md +154 -26
- package/guidelines/conventions/conventions.instruction.md +134 -48
- package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
- package/guidelines/queryRule/queryRule.instruction.md +21 -7
- package/guidelines/runtimeRule/runtimeRule.instruction.md +291 -6
- package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
- package/guidelines/transportRule/transportRule.instruction.md +10 -8
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +20 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +66 -3
- package/incrementalBuilder.proc.js +564 -109
- package/index-0wpybxtr.js +2729 -0
- package/{index-kcxmv48c.js → index-2ahj896a.js} +45 -79
- package/index-2wc41k5w.js +49 -0
- package/index-3hx1z96c.js +87 -0
- package/{index-2tv3fdx4.js → index-3w94e7n3.js} +1228 -1458
- package/{index-hwkygn9s.js → index-48k96p55.js} +325 -36
- package/index-4npz05nm.js +187 -0
- package/{index-q0y2jq9j.js → index-52w0fvh8.js} +21 -4
- package/index-6he6gvfg.js +4300 -0
- package/index-7md2g9vw.js +6 -0
- package/{index-04bk599g.js → index-93j60em0.js} +10 -17
- package/index-94s080qm.js +266 -0
- package/index-9dp031by.js +12 -0
- package/{index-ktb5njgy.js → index-9z771ptz.js} +49 -99
- package/{index-y6n8nmny.js → index-abxpehf8.js} +75 -203
- package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
- package/{index-9077wzd2.js → index-by9pxkr0.js} +43 -26
- package/index-c6eggbee.js +123 -0
- package/index-d2242ksy.js +99 -0
- package/index-drehwpdt.js +1119 -0
- package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
- package/{index-ffvk10zz.js → index-f3c78nd6.js} +107 -241
- package/index-gbggbqcp.js +1058 -0
- package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
- package/index-hsmtysz4.js +53 -0
- package/{index-j9yhg404.js → index-jmrn54tt.js} +4 -7
- package/{index-a64esmtb.js → index-kcdj1z5v.js} +523 -1022
- package/{index-d43r08tf.js → index-kqabytj7.js} +77 -150
- package/{index-vyvre9en.js → index-mbxbhay5.js} +6 -2
- package/{index-vxtad5bd.js → index-mgxpx3f2.js} +5 -8
- package/index-p6pbz9n5.js +25 -0
- package/{index-sj5vxr8f.js → index-p993efkq.js} +981 -897
- package/{index-2xp0kfkt.js → index-pmhqttv3.js} +37 -25
- package/index-tqm7jjcn.js +700 -0
- package/{index-0g7r8xz3.js → index-vpj42xwt.js} +114 -232
- package/index-wa5jbxj1.js +760 -0
- package/{index-k2j1hc4r.js → index-wprnsjms.js} +12 -12
- package/{index-gyd220p2.js → index-y3mphr1m.js} +554 -577
- package/index-yg7jhz8x.js +69 -0
- package/{index-h7yw2z9n.js → index-zzvvc845.js} +8 -14
- package/index.js +23 -22
- package/{library.command-qzzbj6d8.js → library.command-9h749a1x.js} +4 -5
- package/{localRegistry.command-vyrgg4xw.js → localRegistry.command-2bqqhxyz.js} +23 -43
- package/{module.command-rq5hq3ax.js → module.command-nv8nzgft.js} +8 -12
- package/{package.command-d9hd6v9n.js → package.command-mq4bggp6.js} +6 -7
- package/package.json +15 -7
- package/{page.command-126d56te.js → page.command-j639n707.js} +4 -5
- package/{primitive.command-taxd1538.js → primitive.command-kz6849th.js} +9 -23
- package/prompter-76k56b37.js +8 -0
- package/{quality.command-6gsna0a3.js → quality.command-4hyabwkb.js} +205 -377
- package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
- package/{repair.command-tq2dgy72.js → repair.command-a9awpbqr.js} +11 -35
- package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
- package/{scalar.command-3bcmrrkv.js → scalar.command-ma4fpm9m.js} +7 -11
- 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-eddzqpx3.js → subspace.command-3k2pmrs4.js} +53 -62
- package/templates/__scalar/__model__/__model__.abstract.md.template +8 -0
- package/templates/app/page/_index.tsx +257 -258
- package/templates/app/page/_layout.tsx +5 -1
- package/templates/app/page/_overrides.tsx +12 -0
- package/templates/app/page/styles.css.template +316 -14
- package/templates/app/public/apple-touch-icon.png +0 -0
- package/templates/app/public/favicon.ico +0 -0
- package/templates/app/public/jelly/cloud.webp +0 -0
- package/templates/app/public/jelly/comet.webp +0 -0
- package/templates/app/public/jelly/moon.webp +0 -0
- package/templates/app/public/jelly/planet.webp +0 -0
- package/templates/app/public/jelly/rocket.webp +0 -0
- package/templates/app/public/jelly/star.webp +0 -0
- package/templates/app/public/jelly/sugar.webp +0 -0
- package/templates/app/public/logo.png +0 -0
- package/templates/app/ui/Recipe/index.ts +9 -0
- package/templates/app/ui/Recipe/jellyButton.ts +63 -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.Unit.tsx +1 -1
- package/templates/appSample/lib/task/Task.Util.tsx +10 -13
- package/templates/appSample/lib/task/Task.View.tsx +2 -2
- package/templates/appSample/lib/task/Task.Zone.tsx +5 -2
- package/templates/appSample/lib/task/task.abstract.ts +12 -32
- package/templates/appSample/lib/task/task.signal.spec.ts +1 -15
- package/templates/appSample/lib/task/task.signal.test.ts +15 -1
- package/templates/appSample/lib/task/task.signal.ts +10 -8
- package/templates/appSample/page/task/[taskId]/_index.tsx +6 -6
- package/templates/appSample/page/task/[taskId]/edit.tsx +5 -4
- package/templates/appSample/page/task/_index.tsx +4 -3
- package/templates/appSample/page/task/_layout.tsx +1 -1
- package/templates/appSample/page/task/new.tsx +5 -4
- package/templates/appSample/srvkit/{AuthGuard.ts → guards.ts} +7 -4
- package/templates/appSample/srvkit/{SessionInternalArg.ts → internalArgs.ts} +6 -4
- package/templates/appSample/ui/GlobalLoading.tsx +2 -1
- package/templates/appSample/ui/QuantityControl.tsx +3 -3
- 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/AGENTS.md.template +6 -0
- package/templates/workspaceRoot/package.json.template +1 -3
- package/tunnel.command-xwr46b66.js +129 -0
- package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/workflow.command-t7wqe4h7.js +79 -0
- package/{workspace.command-06wvstgr.js → workspace.command-4derhzrh.js} +79 -109
- package/abstractCompactor-gmkc0z8j.js +0 -102
- package/application.command-18y0s485.js +0 -204
- package/applicationReleasePackager-4yasxwv9.js +0 -244
- package/capacitorApp-36rbr858.js +0 -12
- package/cloud.command-av97ndh6.js +0 -94
- package/cloud.script-cm11xjdz.js +0 -20
- package/context.command-5v37ef3n.js +0 -81
- package/devTuiView-0hc2emhe.js +0 -9
- package/getDirname-dr3jz1xg.js +0 -7
- package/guideline.command-4pz9g1rt.js +0 -360
- 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-47pj3aee.js +0 -76
- package/index-5ystnsd5.js +0 -841
- package/index-6wwzs1bc.js +0 -7
- package/index-a17x49vg.js +0 -229
- package/index-m0xccmmm.js +0 -228
- package/index-meh558jy.js +0 -65
- package/index-rtxxan88.js +0 -471
- package/index-te54x9zm.js +0 -338
- 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-gtdnzvbz.js +0 -108
package/index-6wwzs1bc.js
DELETED
package/index-a17x49vg.js
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
runner,
|
|
4
|
-
script
|
|
5
|
-
} from "./index-0g7r8xz3.js";
|
|
6
|
-
import {
|
|
7
|
-
generatedFilesForSync,
|
|
8
|
-
createPassedPrimitiveReport,
|
|
9
|
-
scalarChangedFiles
|
|
10
|
-
} from "./index-gyd220p2.js";
|
|
11
|
-
import {
|
|
12
|
-
AiSession
|
|
13
|
-
} from "./index-te54x9zm.js";
|
|
14
|
-
import {
|
|
15
|
-
Prompter
|
|
16
|
-
} from "./index-h7yw2z9n.js";
|
|
17
|
-
import {
|
|
18
|
-
pluralizeName
|
|
19
|
-
} from "./index-nz8prx9g.js";
|
|
20
|
-
|
|
21
|
-
// pkgs/@akanjs/cli/scalar/scalar.prompt.ts
|
|
22
|
-
import { input } from "@inquirer/prompts";
|
|
23
|
-
class ScalarPrompt extends Prompter {
|
|
24
|
-
sys;
|
|
25
|
-
name;
|
|
26
|
-
constructor(sys, name) {
|
|
27
|
-
super();
|
|
28
|
-
this.sys = sys;
|
|
29
|
-
this.name = name;
|
|
30
|
-
}
|
|
31
|
-
async requestUpdateConstant() {
|
|
32
|
-
const request = await input({ message: `What do you want to change?` });
|
|
33
|
-
return { request, validate: undefined };
|
|
34
|
-
}
|
|
35
|
-
async requestCreateConstant() {
|
|
36
|
-
const constantFiles = await this.sys.getConstantFilesWithLibs();
|
|
37
|
-
const description = await input({ message: "description of scalar" });
|
|
38
|
-
const schemaDescription = await input({ message: "schema description of scalar" });
|
|
39
|
-
await this.sys.applyTemplate({
|
|
40
|
-
basePath: "./lib/__scalar",
|
|
41
|
-
template: "__scalar",
|
|
42
|
-
dict: { model: this.name, models: pluralizeName(this.name), sysName: this.sys.name }
|
|
43
|
-
});
|
|
44
|
-
const boilerplate = await this.sys.readFile(`lib/__scalar/${this.name}/${this.name}.constant.ts`);
|
|
45
|
-
return await this.#requestConstant({
|
|
46
|
-
modelDesc: description,
|
|
47
|
-
modelSchemaDesign: schemaDescription,
|
|
48
|
-
boilerplate,
|
|
49
|
-
constantFiles
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
async#requestConstant({
|
|
53
|
-
modelDesc,
|
|
54
|
-
modelSchemaDesign,
|
|
55
|
-
boilerplate,
|
|
56
|
-
constantFiles
|
|
57
|
-
}) {
|
|
58
|
-
const scanInfo = await this.sys.scan();
|
|
59
|
-
const guideJson = await Prompter.getGuideJson("scalarConstant");
|
|
60
|
-
const request = await this.makeTsFileUpdatePrompt({
|
|
61
|
-
context: `
|
|
62
|
-
1. Overview of __scalar/<model>/<model>.constant.ts file
|
|
63
|
-
${await this.getDocumentation("scalarConstant")}
|
|
64
|
-
|
|
65
|
-
2. How to write Enums in __scalar/<model>/<model>.constant.ts file
|
|
66
|
-
${await this.getDocumentation("enumConstant")}
|
|
67
|
-
|
|
68
|
-
3. How to write Fields in __scalar/<model>/<model>.constant.ts file
|
|
69
|
-
${await this.getDocumentation("fieldRule")}
|
|
70
|
-
|
|
71
|
-
4. List of constant.ts files in other libraries connected to current ${this.sys.name} ${this.sys.type === "app" ? "Application" : "Library"} ${scanInfo.getLibs().map((lib) => lib).join(", ")}
|
|
72
|
-
Please understand the content and file patterns below, and feel free to reuse any constants or enums if available.
|
|
73
|
-
${constantFiles.map((constant) => `
|
|
74
|
-
\`\`\`typescript
|
|
75
|
-
// File: ${constant.filePath}
|
|
76
|
-
${constant.content}
|
|
77
|
-
\`\`\`
|
|
78
|
-
`).join(`
|
|
79
|
-
`)}
|
|
80
|
-
`,
|
|
81
|
-
request: `
|
|
82
|
-
Based on the above content, please organize it according to the boilerplate below for easy parsing
|
|
83
|
-
|
|
84
|
-
Application name: ${this.sys.name} (${this.sys.type === "app" ? "Application" : "Library"})
|
|
85
|
-
Model name: ${this.name}
|
|
86
|
-
Model description: ${modelDesc}
|
|
87
|
-
Model schema design: ${modelSchemaDesign}
|
|
88
|
-
Model filename(You can create another connected scalar model file if needed): ${this.name}.constant.ts
|
|
89
|
-
\`\`\`typescript
|
|
90
|
-
// File: lib/__scalar/${this.name}/${this.name}.constant.ts
|
|
91
|
-
${boilerplate}
|
|
92
|
-
\`\`\`
|
|
93
|
-
|
|
94
|
-
If additional connected scalar models need to be written besides ${this.name}.constant.ts file, please write them in the following format
|
|
95
|
-
\`\`\`typescript
|
|
96
|
-
// File: lib/__scalar/otherModel/otherModel.constant.ts
|
|
97
|
-
...file content
|
|
98
|
-
\`\`\`
|
|
99
|
-
|
|
100
|
-
Please provide only the file results without any other content.`
|
|
101
|
-
});
|
|
102
|
-
return { request, validate: guideJson.update.rules };
|
|
103
|
-
}
|
|
104
|
-
async requestUpdateDictonaryWithInstruction() {
|
|
105
|
-
const constant = await this.sys.readFile(`lib/__scalar/${this.name}/${this.name}.constant.ts`);
|
|
106
|
-
const boilerplate = await this.sys.readFile(`lib/__scalar/${this.name}/${this.name}.dictionary.ts`);
|
|
107
|
-
const guideJson = await Prompter.getGuideJson("scalarDictionary");
|
|
108
|
-
const request = `\uB2E4\uC74C ${this.name}.dictionary.ts \uD30C\uC77C\uB3C4 \uC644\uC131\uB41C ${this.name}.constant.ts \uD30C\uC77C\uC744 \uAE30\uBC18\uC73C\uB85C \uC791\uC131\uD574\uC918.
|
|
109
|
-
1. Dictionary \uC791\uC131\uBC95
|
|
110
|
-
${await this.getDocumentation("scalarDictionary")}
|
|
111
|
-
|
|
112
|
-
Model constant file
|
|
113
|
-
\`\`\`typescript
|
|
114
|
-
// File: lib/__scalar/${this.name}/${this.name}.constant.ts
|
|
115
|
-
${constant}
|
|
116
|
-
\`\`\`
|
|
117
|
-
|
|
118
|
-
Model filename: ${this.name}.dictionary.ts
|
|
119
|
-
\`\`\`typescript
|
|
120
|
-
// File: lib/__scalar/${this.name}/${this.name}.dictionary.ts
|
|
121
|
-
${boilerplate}
|
|
122
|
-
\`\`\`
|
|
123
|
-
`;
|
|
124
|
-
return { request, validate: guideJson.update.rules };
|
|
125
|
-
}
|
|
126
|
-
async requestUpdateDictonaryWithFollowing() {
|
|
127
|
-
const [constant, boilerplate] = await Promise.all([
|
|
128
|
-
this.sys.readFile(`lib/__scalar/${this.name}/${this.name}.constant.ts`),
|
|
129
|
-
this.sys.readFile(`lib/__scalar/${this.name}/${this.name}.dictionary.ts`)
|
|
130
|
-
]);
|
|
131
|
-
const request = `\uB2E4\uC74C ${this.name}.dictionary.ts \uD30C\uC77C\uB3C4 \uC644\uC131\uB41C ${this.name}.constant.ts \uD30C\uC77C\uC744 \uAE30\uBC18\uC73C\uB85C \uC791\uC131\uD574\uC918.
|
|
132
|
-
Model constant file
|
|
133
|
-
\`\`\`typescript
|
|
134
|
-
// File: lib/__scalar/${this.name}/${this.name}.constant.ts
|
|
135
|
-
${constant}
|
|
136
|
-
\`\`\`
|
|
137
|
-
|
|
138
|
-
Model filename: ${this.name}.dictionary.ts
|
|
139
|
-
\`\`\`typescript
|
|
140
|
-
// File: lib/__scalar/${this.name}/${this.name}.dictionary.ts
|
|
141
|
-
${boilerplate}
|
|
142
|
-
\`\`\`
|
|
143
|
-
`;
|
|
144
|
-
return { request, validate: [] };
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// pkgs/@akanjs/cli/scalar/scalar.runner.ts
|
|
149
|
-
class ScalarRunner extends runner("scalar") {
|
|
150
|
-
async applyScalarTemplate(sys, scalarName) {
|
|
151
|
-
await sys.applyTemplate({
|
|
152
|
-
basePath: "./lib/__scalar",
|
|
153
|
-
template: "__scalar",
|
|
154
|
-
dict: { model: scalarName, models: pluralizeName(scalarName), sysName: sys.name },
|
|
155
|
-
overwrite: false
|
|
156
|
-
});
|
|
157
|
-
return {
|
|
158
|
-
abstract: {
|
|
159
|
-
filename: `${scalarName}.abstract.md`,
|
|
160
|
-
content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.abstract.md`)
|
|
161
|
-
},
|
|
162
|
-
constant: {
|
|
163
|
-
filename: `${scalarName}.constant.ts`,
|
|
164
|
-
content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.constant.ts`)
|
|
165
|
-
},
|
|
166
|
-
dictionary: {
|
|
167
|
-
filename: `${scalarName}.dictionary.ts`,
|
|
168
|
-
content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.dictionary.ts`)
|
|
169
|
-
},
|
|
170
|
-
document: {
|
|
171
|
-
filename: `${scalarName}.document.ts`,
|
|
172
|
-
content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.document.ts`)
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
async createScalarConstant(sys, scalarName) {
|
|
177
|
-
const isContinued = await sys.exists(`lib/__scalar/${scalarName}/${scalarName}.constant.ts`);
|
|
178
|
-
const prompt = new ScalarPrompt(sys, scalarName);
|
|
179
|
-
const session = new AiSession("createScalar", { workspace: sys.workspace, cacheKey: scalarName, isContinued });
|
|
180
|
-
const { request, validate } = session.isCacheLoaded ? await prompt.requestUpdateConstant() : await prompt.requestCreateConstant();
|
|
181
|
-
const writes = await session.writeTypescripts(request, sys, { validate });
|
|
182
|
-
const scalarNames = writes.map(({ filePath }) => filePath.split("/").at(-2)).filter((name) => !!name);
|
|
183
|
-
if (!scalarNames.includes(scalarName))
|
|
184
|
-
scalarNames.unshift(scalarName);
|
|
185
|
-
for (const name of scalarNames)
|
|
186
|
-
await this.applyScalarTemplate(sys, name);
|
|
187
|
-
return { session, scalarNames, writes, prompt };
|
|
188
|
-
}
|
|
189
|
-
async updateScalarDictionaries(sys, scalarNames, { session }) {
|
|
190
|
-
const [firstScalarName, ...followingScalarNames] = scalarNames;
|
|
191
|
-
const prompt = new ScalarPrompt(sys, firstScalarName);
|
|
192
|
-
const { request, validate } = await prompt.requestUpdateDictonaryWithInstruction();
|
|
193
|
-
await session.writeTypescripts(request, sys, { validate });
|
|
194
|
-
for (const scalarName of followingScalarNames) {
|
|
195
|
-
const prompt = new ScalarPrompt(sys, scalarName);
|
|
196
|
-
const { request, validate } = await prompt.requestUpdateDictonaryWithFollowing();
|
|
197
|
-
await session.writeTypescripts(request, sys, { validate });
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// pkgs/@akanjs/cli/scalar/scalar.script.ts
|
|
203
|
-
class ScalarScript extends script("scalar", [ScalarRunner]) {
|
|
204
|
-
async createScalar(sys, scalarName) {
|
|
205
|
-
const files = await this.scalarRunner.applyScalarTemplate(sys, scalarName);
|
|
206
|
-
return createPassedPrimitiveReport({
|
|
207
|
-
command: "create-scalar",
|
|
208
|
-
changedFiles: scalarChangedFiles(sys, scalarName, files),
|
|
209
|
-
generatedFiles: generatedFilesForSync(sys),
|
|
210
|
-
target: sys.name
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
async createScalarWithAi(sys, scalarName) {
|
|
214
|
-
const { session, scalarNames } = await this.scalarRunner.createScalarConstant(sys, scalarName);
|
|
215
|
-
await this.scalarRunner.updateScalarDictionaries(sys, scalarNames, { session });
|
|
216
|
-
const fileMaps = await Promise.all(scalarNames.map(async (name) => ({ name, files: await this.scalarRunner.applyScalarTemplate(sys, name) })));
|
|
217
|
-
return createPassedPrimitiveReport({
|
|
218
|
-
command: "create-scalar",
|
|
219
|
-
changedFiles: fileMaps.flatMap(({ name, files }) => scalarChangedFiles(sys, name, files)),
|
|
220
|
-
generatedFiles: generatedFilesForSync(sys),
|
|
221
|
-
target: sys.name
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
async removeScalar(sys, scalarName) {
|
|
225
|
-
await sys.removeDir(`lib/__scalar/${scalarName}`);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export { ScalarScript };
|
package/index-m0xccmmm.js
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
FileSys
|
|
4
|
-
} from "./index-q0y2jq9j.js";
|
|
5
|
-
|
|
6
|
-
// pkgs/@akanjs/devkit/cloud/globalConfig.ts
|
|
7
|
-
import { chmod, mkdir } from "fs/promises";
|
|
8
|
-
import dayjs from "dayjs";
|
|
9
|
-
|
|
10
|
-
// pkgs/@akanjs/devkit/cloud/constants.ts
|
|
11
|
-
var basePath = `${Bun.env.HOME ?? Bun.env.USERPROFILE}/.akan`;
|
|
12
|
-
var configPath = `${basePath}/config.json`;
|
|
13
|
-
var getDefaultHostConfig = (host = GlobalConfig.akanCloudHost) => ({ host });
|
|
14
|
-
var defaultAkanGlobalConfig = {
|
|
15
|
-
cloudHost: {},
|
|
16
|
-
remoteEnvServers: {},
|
|
17
|
-
llm: null
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// pkgs/@akanjs/devkit/cloud/globalConfig.ts
|
|
21
|
-
class GlobalConfig {
|
|
22
|
-
static akanCloudHost = process.env.USE_AKANJS_PKGS === "true" ? `http://localhost:${process.env.CLOUD_HOST_PORT ?? 8283}` : "https://cloud.akanjs.com";
|
|
23
|
-
static async#getAkanGlobalConfig() {
|
|
24
|
-
const exists = await FileSys.fileExists(configPath);
|
|
25
|
-
const akanConfig = exists ? await FileSys.readJson(configPath) : {};
|
|
26
|
-
return {
|
|
27
|
-
...defaultAkanGlobalConfig,
|
|
28
|
-
...akanConfig,
|
|
29
|
-
cloudHost: akanConfig.cloudHost ?? defaultAkanGlobalConfig.cloudHost,
|
|
30
|
-
remoteEnvServers: akanConfig.remoteEnvServers ?? defaultAkanGlobalConfig.remoteEnvServers
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
static async#setAkanGlobalConfig(akanConfig) {
|
|
34
|
-
await mkdir(basePath, { recursive: true, mode: 448 });
|
|
35
|
-
await Bun.write(configPath, JSON.stringify(akanConfig, null, 2));
|
|
36
|
-
await chmod(configPath, 384);
|
|
37
|
-
}
|
|
38
|
-
static async getHostConfig(host = GlobalConfig.akanCloudHost) {
|
|
39
|
-
const akanConfig = await GlobalConfig.#getAkanGlobalConfig();
|
|
40
|
-
return GlobalConfig.toHostConfig(akanConfig.cloudHost[host] ?? getDefaultHostConfig(host));
|
|
41
|
-
}
|
|
42
|
-
static async setHostConfig(config = getDefaultHostConfig()) {
|
|
43
|
-
const akanConfig = await GlobalConfig.#getAkanGlobalConfig();
|
|
44
|
-
akanConfig.cloudHost[config.host] = GlobalConfig.toHostConfigDto(config);
|
|
45
|
-
await GlobalConfig.#setAkanGlobalConfig(akanConfig);
|
|
46
|
-
}
|
|
47
|
-
static async getLlmConfig() {
|
|
48
|
-
const akanConfig = await GlobalConfig.#getAkanGlobalConfig();
|
|
49
|
-
return akanConfig.llm ?? null;
|
|
50
|
-
}
|
|
51
|
-
static async setLlmConfig(llmConfig) {
|
|
52
|
-
const akanConfig = await GlobalConfig.#getAkanGlobalConfig();
|
|
53
|
-
await GlobalConfig.#setAkanGlobalConfig({ ...akanConfig, llm: llmConfig });
|
|
54
|
-
}
|
|
55
|
-
static async getRemoteEnvServers() {
|
|
56
|
-
const akanConfig = await GlobalConfig.#getAkanGlobalConfig();
|
|
57
|
-
return akanConfig.remoteEnvServers;
|
|
58
|
-
}
|
|
59
|
-
static async setRemoteEnvServer(name, config) {
|
|
60
|
-
const akanConfig = await GlobalConfig.#getAkanGlobalConfig();
|
|
61
|
-
await GlobalConfig.#setAkanGlobalConfig({
|
|
62
|
-
...akanConfig,
|
|
63
|
-
remoteEnvServers: {
|
|
64
|
-
...akanConfig.remoteEnvServers,
|
|
65
|
-
[name]: config
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
static async removeRemoteEnvServer(name) {
|
|
70
|
-
const akanConfig = await GlobalConfig.#getAkanGlobalConfig();
|
|
71
|
-
const { [name]: _, ...remoteEnvServers } = akanConfig.remoteEnvServers;
|
|
72
|
-
await GlobalConfig.#setAkanGlobalConfig({
|
|
73
|
-
...akanConfig,
|
|
74
|
-
remoteEnvServers
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
static needRefreshToken(accessToken) {
|
|
78
|
-
return !!accessToken?.expiresAt?.isBefore(dayjs().add(1, "hour"));
|
|
79
|
-
}
|
|
80
|
-
static toAccessToken(accessToken) {
|
|
81
|
-
return {
|
|
82
|
-
jwt: accessToken.jwt,
|
|
83
|
-
refreshToken: accessToken.refreshToken ?? null,
|
|
84
|
-
expiresAt: accessToken.expiresAt ? dayjs(accessToken.expiresAt) : null
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
static toAccessTokenDto(accessToken) {
|
|
88
|
-
return {
|
|
89
|
-
jwt: accessToken.jwt,
|
|
90
|
-
refreshToken: accessToken.refreshToken ?? null,
|
|
91
|
-
expiresAt: accessToken.expiresAt?.toString() ?? null
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
static toHostConfigDto(hostConfig) {
|
|
95
|
-
return {
|
|
96
|
-
host: hostConfig.host,
|
|
97
|
-
auth: {
|
|
98
|
-
accessToken: hostConfig.auth?.accessToken ? GlobalConfig.toAccessTokenDto(hostConfig.auth.accessToken) : undefined,
|
|
99
|
-
self: hostConfig.auth?.self
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
static toHostConfig(hostConfigDto) {
|
|
104
|
-
return {
|
|
105
|
-
host: hostConfigDto.host,
|
|
106
|
-
auth: {
|
|
107
|
-
accessToken: hostConfigDto.auth?.accessToken ? GlobalConfig.toAccessToken(hostConfigDto.auth.accessToken) : undefined,
|
|
108
|
-
self: hostConfigDto.auth?.self
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// pkgs/@akanjs/devkit/cloud/cloudApi.ts
|
|
115
|
-
class HttpClient {
|
|
116
|
-
baseUrl;
|
|
117
|
-
headers = {};
|
|
118
|
-
constructor(baseUrl, headers = {}) {
|
|
119
|
-
this.baseUrl = baseUrl;
|
|
120
|
-
this.headers = headers;
|
|
121
|
-
}
|
|
122
|
-
async get(url, { headers } = {}) {
|
|
123
|
-
const response = await fetch(`${this.baseUrl}${url}`, {
|
|
124
|
-
headers: {
|
|
125
|
-
"Content-Type": "application/json",
|
|
126
|
-
...this.headers,
|
|
127
|
-
...headers
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
return await response.json();
|
|
131
|
-
}
|
|
132
|
-
async getFile(url, localPath, headers) {
|
|
133
|
-
const response = await fetch(`${this.baseUrl}${url}`, {
|
|
134
|
-
headers: { ...this.headers, ...headers }
|
|
135
|
-
});
|
|
136
|
-
if (!response.ok)
|
|
137
|
-
throw new Error(`Failed to download file: ${response.status} ${response.statusText}`);
|
|
138
|
-
await Bun.write(localPath, response);
|
|
139
|
-
}
|
|
140
|
-
async post(url, data, { headers } = {}) {
|
|
141
|
-
const isFormData = data instanceof FormData;
|
|
142
|
-
const response = await fetch(`${this.baseUrl}${url}`, {
|
|
143
|
-
method: "POST",
|
|
144
|
-
body: isFormData ? data : JSON.stringify(data),
|
|
145
|
-
headers: isFormData ? { ...this.headers, ...headers } : { "Content-Type": "application/json", ...this.headers, ...headers }
|
|
146
|
-
});
|
|
147
|
-
return await response.json();
|
|
148
|
-
}
|
|
149
|
-
setHeaders(headers) {
|
|
150
|
-
Object.assign(this.headers, headers);
|
|
151
|
-
return this;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
class CloudApi {
|
|
156
|
-
#api;
|
|
157
|
-
#accessToken = null;
|
|
158
|
-
#workspace;
|
|
159
|
-
host;
|
|
160
|
-
url;
|
|
161
|
-
static async fromHost(workspace, host) {
|
|
162
|
-
const hostConfig = await GlobalConfig.getHostConfig(host);
|
|
163
|
-
return new CloudApi(workspace, hostConfig);
|
|
164
|
-
}
|
|
165
|
-
constructor(workspace, hostConfig) {
|
|
166
|
-
this.#workspace = workspace;
|
|
167
|
-
this.#accessToken = hostConfig.auth?.accessToken ?? null;
|
|
168
|
-
this.host = hostConfig.host;
|
|
169
|
-
this.url = `${this.host}/api`;
|
|
170
|
-
this.#api = new HttpClient(this.url);
|
|
171
|
-
if (this.#accessToken && !GlobalConfig.needRefreshToken(this.#accessToken))
|
|
172
|
-
this.#api.setHeaders({
|
|
173
|
-
Authorization: `Bearer ${this.#accessToken.jwt}`
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
async uploadEnv(devProjectId, file) {
|
|
177
|
-
const formData = new FormData;
|
|
178
|
-
formData.append("devProjectId", devProjectId);
|
|
179
|
-
formData.append("file", file);
|
|
180
|
-
const data = await this.#api.post(`/uploadEnv/${devProjectId}`, formData);
|
|
181
|
-
return data;
|
|
182
|
-
}
|
|
183
|
-
async downloadEnv(devProjectId) {
|
|
184
|
-
const localPath = `${this.#workspace.workspaceRoot}/local/env.tar`;
|
|
185
|
-
await this.#api.getFile(`/downloadEnv/${devProjectId}`, localPath);
|
|
186
|
-
return localPath;
|
|
187
|
-
}
|
|
188
|
-
async getRemoteAuthToken(remoteId) {
|
|
189
|
-
try {
|
|
190
|
-
const accessToken = await this.#api.get(`/getRemoteAuthToken/${remoteId}`);
|
|
191
|
-
this.#accessToken = GlobalConfig.toAccessToken(accessToken);
|
|
192
|
-
this.#api.setHeaders({
|
|
193
|
-
Authorization: `Bearer ${this.#accessToken.jwt}`
|
|
194
|
-
});
|
|
195
|
-
return this.#accessToken;
|
|
196
|
-
} catch (_) {
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
async#ensureAccessTokenLive({
|
|
201
|
-
allowUnauthorized = false
|
|
202
|
-
} = {}) {
|
|
203
|
-
if (!this.#accessToken)
|
|
204
|
-
throw new Error("No access token");
|
|
205
|
-
const needRefresh = GlobalConfig.needRefreshToken(this.#accessToken);
|
|
206
|
-
if (!needRefresh)
|
|
207
|
-
return this.#accessToken;
|
|
208
|
-
const refreshToken = this.#accessToken?.refreshToken;
|
|
209
|
-
if (!refreshToken)
|
|
210
|
-
throw new Error("No refresh token");
|
|
211
|
-
return await this.refreshAuthToken(refreshToken);
|
|
212
|
-
}
|
|
213
|
-
async refreshAuthToken(refreshToken) {
|
|
214
|
-
const response = await this.#api.post(`/refreshAuthToken`, { refreshToken });
|
|
215
|
-
this.#accessToken = GlobalConfig.toAccessToken(response);
|
|
216
|
-
this.#api.setHeaders({ Authorization: `Bearer ${this.#accessToken.jwt}` });
|
|
217
|
-
return this.#accessToken;
|
|
218
|
-
}
|
|
219
|
-
async getRemoteSelf() {
|
|
220
|
-
try {
|
|
221
|
-
const data = await this.#api.get(`/getRemoteSelf`);
|
|
222
|
-
return data;
|
|
223
|
-
} catch {
|
|
224
|
-
return null;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
export { getDefaultHostConfig, GlobalConfig, CloudApi };
|
package/index-meh558jy.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// pkgs/@akanjs/devkit/abstractDoc.ts
|
|
3
|
-
class AbstractDoc {
|
|
4
|
-
path;
|
|
5
|
-
content;
|
|
6
|
-
siblingFiles;
|
|
7
|
-
static suffix = ".abstract.md";
|
|
8
|
-
static maxLines = 300;
|
|
9
|
-
static compactMinLines = 40;
|
|
10
|
-
static #facetRoots = "{lib,ui,webkit,srvkit,common,plugin}";
|
|
11
|
-
static isAbstractPath(filePath) {
|
|
12
|
-
return filePath.endsWith(AbstractDoc.suffix);
|
|
13
|
-
}
|
|
14
|
-
static lineCountOf(content) {
|
|
15
|
-
return content.split(/\r?\n/).length;
|
|
16
|
-
}
|
|
17
|
-
static kindOf(filePath) {
|
|
18
|
-
const [root, folder, ...rest] = filePath.split("/");
|
|
19
|
-
if (root !== "lib" || !folder)
|
|
20
|
-
return "other";
|
|
21
|
-
if (folder === "__scalar")
|
|
22
|
-
return rest.length === 2 ? "scalar" : "other";
|
|
23
|
-
if (rest.length !== 1)
|
|
24
|
-
return "other";
|
|
25
|
-
return folder.startsWith("_") ? "service" : "domain";
|
|
26
|
-
}
|
|
27
|
-
static async findAll(sys, { module } = {}) {
|
|
28
|
-
const filePaths = (await sys.getAllFiles(`${AbstractDoc.#facetRoots}/**/*${AbstractDoc.suffix}`)).sort();
|
|
29
|
-
const docs = await Promise.all(filePaths.map((filePath) => AbstractDoc.read(sys, filePath)));
|
|
30
|
-
if (!module)
|
|
31
|
-
return docs;
|
|
32
|
-
return docs.filter((doc) => doc.moduleName === module || doc.folderName === module);
|
|
33
|
-
}
|
|
34
|
-
static async read(sys, filePath) {
|
|
35
|
-
const dirPath = filePath.split("/").slice(0, -1).join("/");
|
|
36
|
-
const [content, folderFiles] = await Promise.all([sys.readFile(filePath), sys.readdir(dirPath)]);
|
|
37
|
-
return new AbstractDoc(filePath, content, folderFiles.filter((fileName) => !AbstractDoc.isAbstractPath(fileName)));
|
|
38
|
-
}
|
|
39
|
-
constructor(path, content, siblingFiles) {
|
|
40
|
-
this.path = path;
|
|
41
|
-
this.content = content;
|
|
42
|
-
this.siblingFiles = siblingFiles;
|
|
43
|
-
}
|
|
44
|
-
get kind() {
|
|
45
|
-
return AbstractDoc.kindOf(this.path);
|
|
46
|
-
}
|
|
47
|
-
get folderName() {
|
|
48
|
-
return this.path.split("/").at(-2) ?? "";
|
|
49
|
-
}
|
|
50
|
-
get moduleName() {
|
|
51
|
-
return (this.path.split("/").at(-1) ?? "").slice(0, -AbstractDoc.suffix.length);
|
|
52
|
-
}
|
|
53
|
-
get lineCount() {
|
|
54
|
-
return AbstractDoc.lineCountOf(this.content);
|
|
55
|
-
}
|
|
56
|
-
canReplaceWith(candidate) {
|
|
57
|
-
const next = candidate.trim();
|
|
58
|
-
if (!next.startsWith("#"))
|
|
59
|
-
return false;
|
|
60
|
-
const lineCount = AbstractDoc.lineCountOf(next);
|
|
61
|
-
return lineCount >= 3 && lineCount < this.lineCount;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export { AbstractDoc };
|