@akanjs/cli 3.1.1-rc.9 → 3.1.1
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-35wnb7w5.js +9 -0
- package/{CodeTui-z5vkm9ea.js → CodeTui-h6yz2kvq.js} +1 -1
- package/TunnelShare-xyjpa7gx.js +14 -0
- package/agent.command-3r4jsck8.js +46 -0
- package/akanCode.js +10 -6
- package/{application.command-wthg8nn9.js → application.command-g7xv6ad0.js} +44 -11
- package/{applicationBuildRunner-t2r84sz6.js → applicationBuildRunner-qvjnhr9j.js} +9 -6
- package/buildBatch.proc.js +6 -6
- package/{cloud.command-sz11hpre.js → cloud.command-6ebygmhw.js} +17 -15
- package/cloud.script-0s1jybd5.js +26 -0
- package/{code.command-9h3yrzhe.js → code.command-mpkm2emr.js} +6 -6
- package/commandManifest.json +1 -1
- package/{context.command-15j9b7c0.js → context.command-svdh6b2w.js} +18 -17
- package/context.runner-ch0z3a8g.js +26 -0
- package/{devTui-q7k7bakd.js → devTui-evr3b35y.js} +1 -1
- package/{guideline.command-snh85ctf.js → guideline.command-qwp3tnjx.js} +3 -3
- package/guidelines/conventions/core.md +106 -0
- package/guidelines/conventions/rules/app.md +83 -0
- package/guidelines/conventions/rules/auth.md +45 -0
- package/guidelines/conventions/rules/config.md +56 -0
- package/guidelines/conventions/rules/constant.md +24 -0
- package/guidelines/conventions/rules/gates.md +31 -0
- package/guidelines/conventions/rules/layer.md +25 -0
- package/guidelines/conventions/rules/migration.md +27 -0
- package/guidelines/conventions/rules/module.md +90 -0
- package/guidelines/conventions/rules/page.md +56 -0
- package/guidelines/conventions/rules/sensitive.md +16 -0
- package/guidelines/conventions/rules/server.md +86 -0
- package/guidelines/conventions/rules/ssr.md +47 -0
- package/guidelines/conventions/rules/style.md +43 -0
- package/guidelines/conventions/rules/test.md +34 -0
- package/guidelines/conventions/rules/ts.md +95 -0
- package/guidelines/conventions/rules/tsx.md +75 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +1 -1
- package/guidelines/pageRule/pageRule.instruction.md +4 -3
- package/guidelines/queryRule/queryRule.instruction.md +4 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +3 -3
- package/incrementalBuilder.proc.js +6 -6
- package/{index-pcwzkdqb.js → index-1p0qbq3m.js} +1 -1
- package/{index-xb8809yb.js → index-1shvxzt0.js} +3 -3
- package/{index-a58emady.js → index-266dewjs.js} +11 -11
- package/{index-bt438yxm.js → index-3yz30c07.js} +5 -4
- package/{index-xjf5j657.js → index-4mj92tsh.js} +952 -47
- package/index-4pdts00b.js +1604 -0
- package/{index-42j4a8zq.js → index-8559hsz4.js} +4 -3
- package/{index-wcej7g4z.js → index-8scw1pjk.js} +93 -23
- package/{index-a5dhqkdr.js → index-96wzdhfh.js} +74 -233
- package/index-9bv479q5.js +1 -0
- package/index-9rvcs76p.js +653 -0
- package/index-am36s3jh.js +3582 -0
- package/index-b8c289dx.js +444 -0
- package/{index-espk51ah.js → index-dd44g6vz.js} +3 -3
- package/{index-3wypz6xj.js → index-eja64h28.js} +7 -3
- package/index-fbewhg4g.js +590 -0
- package/index-jje9qzyq.js +27 -0
- package/{index-j9vyj3dj.js → index-k5jbcxyh.js} +3 -3
- package/{index-2mwc0g0d.js → index-ksfgqq1x.js} +1 -1
- package/index-m5n3ka0p.js +18 -0
- package/{index-5nd1wtkv.js → index-p6x5b7hr.js} +1 -1
- package/{index-6txx6a9p.js → index-payhwt51.js} +21 -29
- package/{index-2azahjaw.js → index-qkkdhjm6.js} +2 -2
- package/{index-74tjjsnc.js → index-qxzrp5xt.js} +33 -37
- package/{index-qfp55x1y.js → index-r0k3ham2.js} +4 -4
- package/{index-hmt54t45.js → index-r2w2eh93.js} +4 -4
- package/index-r2wedvqn.js +138 -0
- package/{index-skk9zc1x.js → index-rnphv731.js} +2 -2
- package/{index-9th4gszy.js → index-s6da8ta9.js} +82 -1227
- package/index-tenw3mah.js +225 -0
- package/{index-31es1yev.js → index-tgt2fnd6.js} +107 -6
- package/{index-55j120r8.js → index-vxmy1p4f.js} +16 -36
- package/{index-301pdbzz.js → index-w4k2ragk.js} +7 -7
- package/{index-js6geqjn.js → index-w7q6h97v.js} +1 -1
- package/{index-dy0jx9ay.js → index-wwe9rsrx.js} +14 -0
- package/{index-2xcc2ax5.js → index-xq543a5y.js} +2 -2
- package/{index-0fz95kxe.js → index-xqgwjz7a.js} +1 -1
- package/{index-40brg4px.js → index-xxfy1jp2.js} +4 -4
- package/{index-905qdgqp.js → index-z4b84y6k.js} +1 -1
- package/index-zcf6k8a5.js +410 -0
- package/index.js +23 -22
- package/{library.command-gycrwhf1.js → library.command-2853y6mk.js} +3 -3
- package/{localRegistry.command-jtd8gaes.js → localRegistry.command-76ds31p4.js} +19 -15
- package/{module.command-v6hgs1bc.js → module.command-yfnb0abs.js} +5 -5
- package/{package.command-shzpcfph.js → package.command-d9s86hp9.js} +3 -3
- package/package.json +2 -2
- package/{page.command-ptxn5kqk.js → page.command-6a8a8rd1.js} +3 -3
- package/{pipeline.command-zz31pgax.js → pipeline.command-rt3rwd2z.js} +2 -2
- package/{primitive.command-a1vse91z.js → primitive.command-emcebgrq.js} +6 -6
- package/{projectTypecheck-2ztky9cf.js → projectTypecheck-51m7eh1f.js} +1 -1
- package/{prompter-76k56b37.js → prompter-hgcta8pb.js} +1 -1
- package/quality.command-xtrk0n3x.js +76 -0
- package/{repair.command-cvazbz99.js → repair.command-51szxnxx.js} +5 -5
- package/{routeSourceValidator-6jd0q6r6.js → routeSourceValidator-4h947v7c.js} +13 -3
- package/{scalar.command-0acvyp26.js → scalar.command-8qv27t82.js} +4 -4
- package/skills/akan-agent/SKILL.md +36 -0
- package/skills/akan-code/SKILL.md +1 -0
- package/skills/akan-debug/SKILL.md +40 -6
- package/skills/akan-deps/SKILL.md +1 -2
- package/skills/akan-mcp/SKILL.md +40 -0
- package/skills/akan-page/SKILL.md +44 -0
- package/skills/akan-query/SKILL.md +38 -0
- package/skills/akan-runtime/SKILL.md +40 -0
- package/skills/akan-scaffold/SKILL.md +16 -6
- package/skills/akan-transport/SKILL.md +40 -0
- package/skills/akan-validate/SKILL.md +13 -11
- package/{subspace.command-822qx2bx.js → subspace.command-pn56pnh8.js} +8 -8
- package/templates/__scalar/__model__/__model__.constant.ts +3 -5
- package/templates/__scalar/__model__/__model__.dictionary.ts +6 -5
- package/templates/__scalar/__model__/__model__.document.ts +3 -3
- package/templates/app/akan.config.ts +2 -3
- package/templates/app/env/env.client.ts +2 -4
- package/templates/app/env/env.client.type.ts +2 -3
- package/templates/app/env/env.server.ts +2 -3
- package/templates/app/lib/___appName__/__appName__.dictionary.ts +1 -2
- package/templates/app/lib/___appName__/__appName__.service.ts +3 -3
- package/templates/app/lib/___appName__/__appName__.signal.ts +5 -5
- package/templates/app/lib/___appName__/__appName__.store.ts +4 -6
- package/templates/app/lib/option.ts +2 -3
- package/templates/app/main.ts +2 -4
- package/templates/app/page/_index.tsx +3 -3
- package/templates/app/page/_layout.tsx +13 -10
- package/templates/appSample/lib/__scalar/workHistory/workHistory.constant.ts +1 -5
- package/templates/appSample/lib/__scalar/workHistory/workHistory.dictionary.ts +1 -1
- package/templates/appSample/lib/_noti/noti.signal.ts +1 -1
- package/templates/appSample/lib/task/Task.Template.tsx +2 -1
- package/templates/appSample/lib/task/Task.Unit.tsx +3 -2
- package/templates/appSample/lib/task/Task.Util.tsx +16 -4
- package/templates/appSample/lib/task/task.constant.ts +1 -5
- package/templates/appSample/lib/task/task.dictionary.ts +2 -8
- package/templates/appSample/lib/task/task.document.ts +1 -1
- package/templates/appSample/page/task/_index.tsx +2 -1
- package/templates/appSample/page/task/new.tsx +2 -1
- package/templates/appSample/ui/QuantityControl.tsx +5 -9
- package/templates/biomeForm.ts +144 -0
- package/templates/crudPages/[__model__Id]/edit/page.tsx +3 -3
- package/templates/crudPages/[__model__Id]/page.tsx +5 -5
- package/templates/crudPages/new/page.tsx +4 -3
- package/templates/crudPages/page.tsx +3 -3
- package/templates/crudSinglePage/page.tsx +9 -5
- package/templates/libRoot/akan.config.ts +2 -3
- package/templates/libRoot/lib/___libName__/__libName__.dictionary.ts +1 -2
- package/templates/libRoot/lib/___libName__/__libName__.service.ts +5 -4
- package/templates/libRoot/lib/___libName__/__libName__.signal.ts +6 -5
- package/templates/libRoot/lib/___libName__/__libName__.store.ts +5 -6
- package/templates/libRoot/lib/option.ts +1 -2
- package/templates/module/__Model__.Template.tsx +11 -10
- package/templates/module/__Model__.Unit.tsx +18 -5
- package/templates/module/__Model__.Util.tsx +9 -7
- package/templates/module/__Model__.View.tsx +9 -6
- package/templates/module/__Model__.Zone.tsx +25 -17
- package/templates/module/__model__.constant.ts +8 -9
- package/templates/module/__model__.dictionary.ts +16 -17
- package/templates/module/__model__.document.ts +6 -8
- package/templates/module/__model__.service.ts +3 -3
- package/templates/module/__model__.signal.ts +11 -10
- package/templates/module/__model__.store.ts +3 -5
- package/templates/service/__model__.dictionary.ts +6 -5
- package/templates/service/__model__.service.ts +3 -3
- package/templates/service/__model__.signal.ts +5 -4
- package/templates/service/__model__.store.ts +3 -5
- package/templates/workspaceRoot/.gitignore.template +3 -0
- package/templates/workspaceRoot/.vscode/settings.json.template +21 -21
- package/templates/workspaceRoot/AGENTS.md.template +4 -10
- package/{tunnel.command-ycmja19q.js → tunnel.command-q2h0j2en.js} +7 -7
- package/{typeChecker-px49mezc.js → typeChecker-j2jdnqsr.js} +1 -1
- package/typecheck.proc.js +6 -1
- package/verify.command-z1dsbmrt.js +91 -0
- package/{workflow.command-abb1d5xy.js → workflow.command-r3y67jeq.js} +47 -13
- package/workspace.command-t2f0xsrw.js +263 -0
- package/CodeAgent-8d5qs787.js +0 -9
- package/TunnelShare-qkm8zp03.js +0 -14
- package/agent.command-ydftceda.js +0 -25
- package/cloud.script-nqevg5qw.js +0 -24
- package/context.runner-8gg030b0.js +0 -25
- package/guidelines/conventions/conventions.instruction.md +0 -617
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +0 -291
- package/index-4vgbysa0.js +0 -279
- package/index-7md2g9vw.js +0 -6
- package/index-b70zct19.js +0 -856
- package/index-zzvvc845.js +0 -74
- package/quality.command-ah8qcakd.js +0 -1478
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +0 -69
- package/templates/workspaceRoot/docs/GENERATED.md.template +0 -55
- package/workspace.command-qm7cw29v.js +0 -521
|
@@ -6,44 +6,32 @@ import {
|
|
|
6
6
|
CloudApi,
|
|
7
7
|
CloudUpdates,
|
|
8
8
|
PipelineSecrets
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-qkkdhjm6.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveMobileTargets
|
|
12
12
|
} from "./index-m9jj544v.js";
|
|
13
13
|
import {
|
|
14
14
|
WorkspaceExecutor,
|
|
15
15
|
AppExecutor
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-8scw1pjk.js";
|
|
17
17
|
import {
|
|
18
18
|
NativeApp
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-3yz30c07.js";
|
|
20
20
|
import {
|
|
21
21
|
runner,
|
|
22
22
|
assertPromptable
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-eja64h28.js";
|
|
24
24
|
import {
|
|
25
25
|
SubspaceConfig
|
|
26
26
|
} from "./index-4pf8g7ff.js";
|
|
27
|
+
import {
|
|
28
|
+
getNpmRegistryUrl,
|
|
29
|
+
getLatestPackageVersion
|
|
30
|
+
} from "./index-m5n3ka0p.js";
|
|
27
31
|
import {
|
|
28
32
|
openBrowser
|
|
29
33
|
} from "./index-9dp031by.js";
|
|
30
34
|
|
|
31
|
-
// pkgs/@akanjs/cli/npmRegistry.ts
|
|
32
|
-
var defaultNpmRegistry = "https://registry.npmjs.org";
|
|
33
|
-
var getNpmRegistryUrl = (registryUrl = process.env.AKAN_NPM_REGISTRY ?? defaultNpmRegistry) => registryUrl.replace(/\/+$/, "");
|
|
34
|
-
async function getLatestPackageVersion(packageName, tag = "latest", registryUrl) {
|
|
35
|
-
const registry = getNpmRegistryUrl(registryUrl);
|
|
36
|
-
const url = `${registry}/${encodeURIComponent(packageName).replace(/^%40/, "@")}`;
|
|
37
|
-
const res = await fetch(url);
|
|
38
|
-
if (!res.ok)
|
|
39
|
-
throw new Error(`Failed to fetch ${packageName} metadata from ${registry}`);
|
|
40
|
-
const metadata = await res.json();
|
|
41
|
-
const version = metadata["dist-tags"]?.[tag];
|
|
42
|
-
if (!version)
|
|
43
|
-
throw new Error(`No npm dist-tag "${tag}" found for ${packageName}`);
|
|
44
|
-
return version;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
35
|
// pkgs/@akanjs/cli/cloud/cloud.runner.ts
|
|
48
36
|
import path7 from "path";
|
|
49
37
|
|
|
@@ -294,6 +282,7 @@ class LinuxDockerTarget extends PlatformTestTarget {
|
|
|
294
282
|
"run",
|
|
295
283
|
"-d",
|
|
296
284
|
"--rm",
|
|
285
|
+
"--init",
|
|
297
286
|
"--name",
|
|
298
287
|
container,
|
|
299
288
|
"--cpus",
|
|
@@ -743,7 +732,7 @@ ${chalk2.green("\u27A4")} Authentication Required`));
|
|
|
743
732
|
}
|
|
744
733
|
Logger.rawLog(`
|
|
745
734
|
${chalk2.bold("Your code:")} ${chalk2.bold.inverse(` ${await RemoteAuthCode.of(remoteId)} `)}`);
|
|
746
|
-
Logger.rawLog(chalk2.dim(`Enter this code on the sign-in page
|
|
735
|
+
Logger.rawLog(chalk2.dim(`Enter this code on the sign-in page. Never enter a code that did not come from your own terminal.
|
|
747
736
|
`));
|
|
748
737
|
}
|
|
749
738
|
async#awaitApproval(remoteId, loginId) {
|
|
@@ -778,17 +767,20 @@ ${chalk2.bold("Your code:")} ${chalk2.bold.inverse(` ${await RemoteAuthCode.of(r
|
|
|
778
767
|
async#readSelf() {
|
|
779
768
|
let reason = "";
|
|
780
769
|
for (let attempt = 1;attempt <= this.#selfAttempts; attempt++) {
|
|
770
|
+
let self;
|
|
781
771
|
try {
|
|
782
|
-
|
|
783
|
-
if (self)
|
|
784
|
-
return self;
|
|
785
|
-
reason = "the server did not take the new session";
|
|
786
|
-
break;
|
|
772
|
+
self = await this.#api.getRemoteSelf();
|
|
787
773
|
} catch (error) {
|
|
788
774
|
reason = RemoteLogin.#reasonOf(error);
|
|
775
|
+
if (attempt < this.#selfAttempts)
|
|
776
|
+
await this.#wait(Backoff.delay(attempt, { min: 1000, max: 8000 }));
|
|
777
|
+
continue;
|
|
789
778
|
}
|
|
790
|
-
if (
|
|
791
|
-
|
|
779
|
+
if (self)
|
|
780
|
+
return self;
|
|
781
|
+
const { host } = this.#api;
|
|
782
|
+
await GlobalConfig.setHostConfig(getDefaultHostConfig(host));
|
|
783
|
+
throw new Error(chalk2.red(`\u2716 ${host} did not take the session it handed out. Run akan login again.`));
|
|
792
784
|
}
|
|
793
785
|
Logger.rawLog(chalk2.yellow(`Could not read the signed-in account (${reason}).`));
|
|
794
786
|
return null;
|
|
@@ -1323,4 +1315,4 @@ ${run.format(results)}
|
|
|
1323
1315
|
}
|
|
1324
1316
|
}
|
|
1325
1317
|
|
|
1326
|
-
export {
|
|
1318
|
+
export { PlatformTestRun, CloudRunner };
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
UpdatePackFolder,
|
|
10
10
|
NativePublicEnv,
|
|
11
11
|
NativeApp
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-3yz30c07.js";
|
|
13
13
|
import {
|
|
14
14
|
ExitCodeError
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-eja64h28.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigLock
|
|
18
18
|
} from "./index-bqbf654f.js";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
script
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-eja64h28.js";
|
|
5
5
|
import {
|
|
6
6
|
AppExecutor,
|
|
7
7
|
LibExecutor,
|
|
8
8
|
ModuleExecutor
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-8scw1pjk.js";
|
|
10
10
|
import {
|
|
11
|
+
InteractionScaffold,
|
|
11
12
|
workflowStatus,
|
|
12
13
|
compactDiagnostics,
|
|
13
14
|
sourceFile,
|
|
@@ -40,11 +41,12 @@ import {
|
|
|
40
41
|
insertClassMethod,
|
|
41
42
|
hasSignalFactoryEntry,
|
|
42
43
|
insertSignalFactoryEntry,
|
|
43
|
-
addFieldUiPolicyForType
|
|
44
|
-
|
|
44
|
+
addFieldUiPolicyForType,
|
|
45
|
+
MutationScaffold
|
|
46
|
+
} from "./index-4mj92tsh.js";
|
|
45
47
|
import {
|
|
46
48
|
ModuleScript
|
|
47
|
-
} from "./index-
|
|
49
|
+
} from "./index-r2w2eh93.js";
|
|
48
50
|
|
|
49
51
|
// pkgs/@akanjs/cli/primitive/primitive.script.ts
|
|
50
52
|
import { capitalize, lowerlize } from "akanjs/common";
|
|
@@ -269,38 +271,22 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
|
|
|
269
271
|
return PrimitiveScript.#report(command, sys, changedFiles, diagnostics);
|
|
270
272
|
}
|
|
271
273
|
async addMutation(workspace, input) {
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
` }`
|
|
289
|
-
].join(`
|
|
290
|
-
`)
|
|
291
|
-
} : null,
|
|
292
|
-
signal: name ? {
|
|
293
|
-
className: `${moduleClassName}Endpoint`,
|
|
294
|
-
entryLine: [
|
|
295
|
-
`${name}: mutation(Boolean, { guards: [None] })`,
|
|
296
|
-
` .exec(async function () {`,
|
|
297
|
-
` return await this.${serviceRef}Service.${name}();`,
|
|
298
|
-
` }),`
|
|
299
|
-
].join(`
|
|
300
|
-
`),
|
|
301
|
-
param: { mode: "destructure", name: "mutation" }
|
|
302
|
-
} : null
|
|
303
|
-
});
|
|
274
|
+
const sys = await this.resolveSys(workspace, input.app);
|
|
275
|
+
if (!sys || !input.module || !input.mutation)
|
|
276
|
+
return PrimitiveScript.#refuse("add-mutation", compactDiagnostics([
|
|
277
|
+
!sys && PrimitiveScript.#targetMissing(),
|
|
278
|
+
!input.module && PrimitiveScript.#inputMissing("module"),
|
|
279
|
+
!input.mutation && PrimitiveScript.#inputMissing("mutation", "Mutation name is required.")
|
|
280
|
+
]));
|
|
281
|
+
const { diagnostics, files } = await MutationScaffold.build(sys, input);
|
|
282
|
+
return await PrimitiveScript.#writeScaffold("add-mutation", sys, files, diagnostics);
|
|
283
|
+
}
|
|
284
|
+
async createInteraction(workspace, input) {
|
|
285
|
+
const sys = await this.resolveSys(workspace, input.app);
|
|
286
|
+
if (!sys)
|
|
287
|
+
return PrimitiveScript.#refuse("create-interaction", [PrimitiveScript.#targetMissing()]);
|
|
288
|
+
const { diagnostics, files } = await InteractionScaffold.build(sys, input.interaction);
|
|
289
|
+
return await PrimitiveScript.#writeScaffold("create-interaction", sys, files, diagnostics);
|
|
304
290
|
}
|
|
305
291
|
async addSlice(workspace, input) {
|
|
306
292
|
const moduleClassName = input.module ? moduleComponentName(input.module) : "";
|
|
@@ -423,6 +409,16 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
|
|
|
423
409
|
}
|
|
424
410
|
return PrimitiveScript.#report(spec.command, sys, changedFiles, diagnostics);
|
|
425
411
|
}
|
|
412
|
+
static async#writeScaffold(command, sys, files, diagnostics) {
|
|
413
|
+
const changedFiles = [];
|
|
414
|
+
if (workflowStatus(diagnostics) === "passed") {
|
|
415
|
+
for (const file of files) {
|
|
416
|
+
await sys.writeFile(file.path, file.content, { silent: true });
|
|
417
|
+
changedFiles.push(sourceFile(sys, file.path, file.action, file.reason));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return PrimitiveScript.#report(command, sys, changedFiles, diagnostics);
|
|
421
|
+
}
|
|
426
422
|
static #refuse(command, diagnostics) {
|
|
427
423
|
return createPrimitiveWriteReport({
|
|
428
424
|
command,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
jsonText
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-4mj92tsh.js";
|
|
5
5
|
import {
|
|
6
6
|
akanMcpInstallTargets
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-tgt2fnd6.js";
|
|
8
8
|
import {
|
|
9
9
|
script
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-eja64h28.js";
|
|
11
11
|
import {
|
|
12
12
|
ContextRunner2
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-266dewjs.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/context/context.script.ts
|
|
16
16
|
import { Logger } from "akanjs/common";
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-eja64h28.js";
|
|
6
6
|
import {
|
|
7
7
|
ModuleExecutor
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-8scw1pjk.js";
|
|
9
9
|
import {
|
|
10
10
|
sourceFile,
|
|
11
11
|
moduleSourcePaths,
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
createPassedPrimitiveReport,
|
|
14
14
|
bilingualLabelForField,
|
|
15
15
|
bilingualDescriptionForField
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-4mj92tsh.js";
|
|
17
17
|
import {
|
|
18
18
|
PageScript
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-z4b84y6k.js";
|
|
20
20
|
import {
|
|
21
21
|
pluralizeName
|
|
22
22
|
} from "./index-nz8prx9g.js";
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
getDirname2
|
|
4
|
+
} from "./index-52w0fvh8.js";
|
|
5
|
+
|
|
6
|
+
// pkgs/@akanjs/devkit/conventionSet.ts
|
|
7
|
+
import fsPromise from "fs/promises";
|
|
8
|
+
import path from "path";
|
|
9
|
+
|
|
10
|
+
class ConventionSet {
|
|
11
|
+
core;
|
|
12
|
+
rules;
|
|
13
|
+
constructor(core, rules) {
|
|
14
|
+
this.core = core;
|
|
15
|
+
this.rules = rules;
|
|
16
|
+
}
|
|
17
|
+
static async load(dir) {
|
|
18
|
+
const core = await fsPromise.readFile(path.join(dir, "core.md"), "utf-8");
|
|
19
|
+
const files = (await fsPromise.readdir(path.join(dir, "rules"))).filter((file) => file.endsWith(".md")).sort();
|
|
20
|
+
const rules = await Promise.all(files.map(async (file) => ConventionSet.parseRule(file.slice(0, -3), await fsPromise.readFile(path.join(dir, "rules", file), "utf-8"))));
|
|
21
|
+
return new ConventionSet(core.trim(), rules);
|
|
22
|
+
}
|
|
23
|
+
static parseRule(name, text) {
|
|
24
|
+
const match = /^---\n([\s\S]*?)\n---\n/.exec(text);
|
|
25
|
+
if (!match)
|
|
26
|
+
throw new Error(`Convention rule ${name} has no frontmatter`);
|
|
27
|
+
const front = match[1] ?? "";
|
|
28
|
+
const described = /^description:\s*(.+)$/m.exec(front);
|
|
29
|
+
const description = described?.[1]?.trim() ?? "";
|
|
30
|
+
const paths = [...front.matchAll(/^\s+-\s+"([^"]+)"$/gm)].map((entry) => entry[1] ?? "");
|
|
31
|
+
if (!description || paths.length === 0)
|
|
32
|
+
throw new Error(`Convention rule ${name} needs a description and paths`);
|
|
33
|
+
return { name, description, paths, body: text.slice(match[0].length).trim() };
|
|
34
|
+
}
|
|
35
|
+
static expand(glob) {
|
|
36
|
+
const open = glob.indexOf("{");
|
|
37
|
+
if (open === -1)
|
|
38
|
+
return [glob];
|
|
39
|
+
const close = glob.indexOf("}", open);
|
|
40
|
+
if (close === -1)
|
|
41
|
+
return [glob];
|
|
42
|
+
const head = glob.slice(0, open);
|
|
43
|
+
const tail = glob.slice(close + 1);
|
|
44
|
+
return glob.slice(open + 1, close).split(",").flatMap((choice) => ConventionSet.expand(`${head}${choice}${tail}`));
|
|
45
|
+
}
|
|
46
|
+
static demote(markdown) {
|
|
47
|
+
let fenced = false;
|
|
48
|
+
return markdown.split(`
|
|
49
|
+
`).map((line) => {
|
|
50
|
+
if (line.startsWith("```"))
|
|
51
|
+
fenced = !fenced;
|
|
52
|
+
return !fenced && /^#{1,5} /.test(line) ? `#${line}` : line;
|
|
53
|
+
}).join(`
|
|
54
|
+
`);
|
|
55
|
+
}
|
|
56
|
+
get instruction() {
|
|
57
|
+
return `${[this.core, ...this.rules.map((rule) => ConventionSet.demote(rule.body))].join(`
|
|
58
|
+
|
|
59
|
+
`)}
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// pkgs/@akanjs/devkit/prompter.ts
|
|
65
|
+
import fsPromise2 from "fs/promises";
|
|
66
|
+
import { input, select } from "@inquirer/prompts";
|
|
67
|
+
class Prompter2 {
|
|
68
|
+
static async#getGuidelineRoot() {
|
|
69
|
+
const dirname = getDirname2(import.meta.url);
|
|
70
|
+
const candidates = [`${dirname}/guidelines`, `${dirname}/../cli/guidelines`];
|
|
71
|
+
for (const candidate of candidates) {
|
|
72
|
+
try {
|
|
73
|
+
await fsPromise2.access(candidate);
|
|
74
|
+
return candidate;
|
|
75
|
+
} catch {}
|
|
76
|
+
}
|
|
77
|
+
return candidates[0];
|
|
78
|
+
}
|
|
79
|
+
static async selectGuideline() {
|
|
80
|
+
const guideNames = await Prompter2.listGuidelines();
|
|
81
|
+
return await select({
|
|
82
|
+
message: "Select a guideline",
|
|
83
|
+
choices: guideNames.map((name) => ({ name, value: name }))
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
static async listGuidelines() {
|
|
87
|
+
const guidelineRoot = await Prompter2.#getGuidelineRoot();
|
|
88
|
+
return (await fsPromise2.readdir(guidelineRoot)).filter((name) => !name.startsWith("_")).sort();
|
|
89
|
+
}
|
|
90
|
+
static async getInstruction(guideName) {
|
|
91
|
+
const guideNames = await Prompter2.listGuidelines();
|
|
92
|
+
if (!guideNames.includes(guideName))
|
|
93
|
+
throw new Error(`Unknown guideline "${guideName}". Available: ${guideNames.join(", ")}`);
|
|
94
|
+
const guidelineRoot = await Prompter2.#getGuidelineRoot();
|
|
95
|
+
const composed = `${guidelineRoot}/${guideName}/core.md`;
|
|
96
|
+
if (await Bun.file(composed).exists())
|
|
97
|
+
return (await ConventionSet.load(`${guidelineRoot}/${guideName}`)).instruction;
|
|
98
|
+
return await fsPromise2.readFile(`${guidelineRoot}/${guideName}/${guideName}.instruction.md`, "utf-8");
|
|
99
|
+
}
|
|
100
|
+
static async getConventionSet() {
|
|
101
|
+
return await ConventionSet.load(`${await Prompter2.#getGuidelineRoot()}/conventions`);
|
|
102
|
+
}
|
|
103
|
+
static async getUpdateRequest(guideName) {
|
|
104
|
+
return await input({
|
|
105
|
+
message: `What do you want to update in ${guideName}?`
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async makeTsFileUpdatePrompt({ context, request }) {
|
|
109
|
+
return `You are a senior developer writing TypeScript-based programs using Akan.js, an in-house framework. Here's an overview of the Akan.js framework:
|
|
110
|
+
${await this.getDocumentation("framework")}
|
|
111
|
+
Please understand the following background information, write code that meets the requirements, verify that it satisfies the validation conditions, and return the result.
|
|
112
|
+
|
|
113
|
+
# Code Style
|
|
114
|
+
- Use double quotes for all string literals in TypeScript/TSX code. Do not use single quotes.
|
|
115
|
+
|
|
116
|
+
# Background Information
|
|
117
|
+
\`\`\`markdown
|
|
118
|
+
${context}
|
|
119
|
+
\`\`\`
|
|
120
|
+
|
|
121
|
+
# Requirements
|
|
122
|
+
\`\`\`markdown
|
|
123
|
+
${request}
|
|
124
|
+
\`\`\`
|
|
125
|
+
`;
|
|
126
|
+
}
|
|
127
|
+
async getDocumentation(guideName) {
|
|
128
|
+
const guidelineRoot = await Prompter2.#getGuidelineRoot();
|
|
129
|
+
const filePath = `${guidelineRoot}/${guideName}/${guideName}.instruction.md`;
|
|
130
|
+
const document = await fsPromise2.readFile(filePath, "utf-8");
|
|
131
|
+
return `\`\`\`markdown
|
|
132
|
+
${document}
|
|
133
|
+
\`\`\`
|
|
134
|
+
`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { ConventionSet, Prompter2 };
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-eja64h28.js";
|
|
6
6
|
import {
|
|
7
7
|
generatedFilesForSync,
|
|
8
8
|
createPassedPrimitiveReport,
|
|
9
9
|
scalarChangedFiles
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-4mj92tsh.js";
|
|
11
11
|
import {
|
|
12
12
|
pluralizeName
|
|
13
13
|
} from "./index-nz8prx9g.js";
|