@akanjs/cli 3.0.0-alpha.10 → 3.0.0-alpha.100
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/README.ko.md +1 -1
- package/README.md +1 -1
- package/{abstractCompactor-e5yq60qz.js → abstractCompactor-byytxs22.js} +3 -5
- package/{agent.command-f0gqkfgz.js → agent.command-v1a4746v.js} +11 -13
- package/{application.command-x903m2qq.js → application.command-fzdcnzhg.js} +65 -38
- package/{applicationBuildRunner-ha3y8ew8.js → applicationBuildRunner-s4gsk728.js} +27 -23
- package/{applicationReleasePackager-gg8ccbeh.js → applicationReleasePackager-28v9vbzk.js} +8 -9
- package/buildBatch.proc.js +12 -14
- package/capacitorApp-8d6d4zkm.js +12 -0
- package/{cloud.command-zs6kyf83.js → cloud.command-wygy2z05.js} +15 -18
- package/commandManifest.json +1 -1
- package/{context.command-fmepgjzg.js → context.command-4vdt1aqq.js} +19 -23
- package/dependencyScanner-shs82ynp.js +8 -0
- package/devTui-qnf1txdz.js +553 -0
- package/devTuiView-yzct2cq6.js +9 -0
- package/getDirname-dr3jz1xg.js +7 -0
- package/{guideline.command-n6sw0a0c.js → guideline.command-p92dq6ts.js} +16 -18
- package/guidelines/agentRule/agentRule.generate.json +31 -0
- package/guidelines/agentRule/agentRule.instruction.md +533 -0
- package/guidelines/conventions/conventions.instruction.md +437 -197
- package/guidelines/cssRule/cssRule.instruction.md +7 -0
- package/guidelines/framework/framework.generate.json +3 -2
- package/guidelines/framework/framework.instruction.md +1 -9
- package/guidelines/mcpRule/mcpRule.generate.json +25 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +217 -0
- package/guidelines/modelStore/modelStore.instruction.md +12 -0
- package/guidelines/modelTemplate/modelTemplate.instruction.md +5 -0
- package/guidelines/queryRule/queryRule.generate.json +31 -0
- package/guidelines/queryRule/queryRule.instruction.md +175 -0
- package/guidelines/runtimeRule/runtimeRule.generate.json +25 -0
- package/guidelines/runtimeRule/runtimeRule.instruction.md +220 -0
- package/guidelines/ssrRule/ssrRule.instruction.md +49 -5
- package/guidelines/transportRule/transportRule.generate.json +31 -0
- package/guidelines/transportRule/transportRule.instruction.md +60 -0
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +51 -760
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +33 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +402 -0
- package/incrementalBuilder.proc.js +26 -25
- package/{index-jf2ya7r2.js → index-0amdxycf.js} +8 -8
- package/{index-779ske1y.js → index-1yxtbmbj.js} +27 -27
- package/{index-eyyf2149.js → index-29sxqfaw.js} +36 -37
- package/index-3d9y066c.js +76 -0
- package/{index-76rn3g2c.js → index-47pj3aee.js} +4 -4
- package/index-5svjba73.js +159 -0
- package/{index-1577bej2.js → index-6wwzs1bc.js} +2 -2
- package/{index-gcv8ncfh.js → index-7d6vny25.js} +16 -12
- package/{index-y4vkyhvv.js → index-8p8p0cf8.js} +14 -14
- package/{index-wnp7hwq7.js → index-92zztqy1.js} +7 -7
- package/{index-fgc8r6dj.js → index-a5vmm6x4.js} +3 -1
- package/{index-xys926f2.js → index-by5gpp8x.js} +4 -4
- package/{index-0cj2zxbm.js → index-c69j78kk.js} +12 -11
- package/{index-rxkpk7n4.js → index-fc1bh0a7.js} +4 -4
- package/{index-d43t8af2.js → index-gq44bqjt.js} +58 -25
- package/{index-774gcx29.js → index-gtmz74tj.js} +41 -34
- package/{index-j37qq1f2.js → index-h7yw2z9n.js} +7 -7
- package/{index-bjpxzr6s.js → index-hwkygn9s.js} +51 -3
- package/{index-xmmzf150.js → index-hyywke0f.js} +1 -1
- package/{index-46tjzh6s.js → index-kcxmv48c.js} +29 -29
- package/{index-xjd3rqzj.js → index-n68jx79w.js} +6 -15
- package/{index-qb61h0k7.js → index-p5neav9b.js} +1098 -1360
- package/{index-67546d0j.js → index-q0y2jq9j.js} +14 -2
- package/{index-3vta1tqa.js → index-qkk27bk6.js} +32 -32
- package/{index-z8ptfkzv.js → index-qsq3q8fy.js} +975 -242
- package/{index-qzdjd4ct.js → index-srdssqj7.js} +18 -18
- package/{index-j9cxndc0.js → index-w8kmx1b6.js} +20 -11
- package/{index-82jrh4hj.js → index-yks023mb.js} +13 -13
- package/{index-5sn5w2mt.js → index-yza7zkpt.js} +94 -61
- package/{index-jhpa13zj.js → index-zmjppp25.js} +57 -57
- package/{index-kdh76j26.js → index-znynzt5w.js} +100 -32
- package/{index-4m0bphac.js → index-zxgr3s8s.js} +31 -30
- package/{index-62955kn5.js → index-zz5jyd94.js} +1002 -128
- package/index.js +22 -25
- package/{library.command-cv9gdbmg.js → library.command-s4fszngs.js} +11 -10
- package/{localRegistry.command-d8fg36zc.js → localRegistry.command-gyw4da9z.js} +20 -23
- package/{module.command-qyr1s9cn.js → module.command-6n7dwvav.js} +13 -16
- package/{package.command-wsjx0k47.js → package.command-gr82ypnr.js} +8 -10
- package/package.json +5 -7
- package/{page.command-rdzg65rm.js → page.command-7gvgb3jb.js} +7 -9
- package/{primitive.command-89g38b53.js → primitive.command-tk5ckw38.js} +13 -16
- package/{quality.command-0cs2z92d.js → quality.command-38v81baf.js} +226 -105
- package/recipeScanner-fpagtgc1.js +11 -0
- package/{repair.command-6fphxfwj.js → repair.command-5xbwvsxp.js} +12 -14
- package/{routeSourceValidator-e4jmbfcx.js → routeSourceValidator-ze6x894c.js} +0 -2
- package/{scalar.command-xfer69s6.js → scalar.command-0epwcr5k.js} +11 -14
- package/subspace.command-e2t36xb2.js +755 -0
- package/templates/app/env/env.client.debug.ts.template +1 -5
- package/templates/app/env/env.client.develop.ts.template +1 -5
- package/templates/app/env/env.client.local.ts.template +1 -5
- package/templates/app/env/env.client.main.ts.template +1 -5
- package/templates/app/env/env.client.testing.ts.template +1 -5
- package/templates/app/env/env.client.type.ts +2 -6
- package/templates/app/env/env.server.debug.ts.template +1 -5
- package/templates/app/env/env.server.develop.ts.template +1 -5
- package/templates/app/env/env.server.local.ts.template +1 -5
- package/templates/app/env/env.server.main.ts.template +1 -5
- package/templates/app/main.ts +3 -1
- package/templates/appSample/lib/task/task.signal.ts +11 -6
- package/templates/appSample/srvkit/AuthGuard.ts +9 -5
- package/templates/appSample/srvkit/SessionInternalArg.ts +4 -3
- package/templates/crudPages/[__model__Id]/edit/page.tsx +5 -5
- package/templates/crudPages/[__model__Id]/page.tsx +10 -13
- package/templates/crudPages/new/page.tsx +5 -5
- package/templates/crudPages/page.tsx +9 -9
- package/templates/crudSinglePage/page.tsx +11 -7
- package/templates/env/_env.server.type.ts +7 -5
- package/templates/lib/db.ts +1 -1
- package/templates/lib/dict.ts +1 -1
- package/templates/lib/sig.ts +5 -1
- package/templates/lib/srv.ts +6 -2
- package/templates/module/__model__.dictionary.ts +4 -1
- package/templates/module/__model__.signal.ts +2 -3
- package/templates/module/__model__.store.ts +1 -2
- package/templates/workspaceRoot/.gitignore.template +0 -1
- package/templates/workspaceRoot/.husky/pre-commit.template +16 -0
- package/templates/workspaceRoot/.vscode/settings.json.template +1 -1
- package/templates/workspaceRoot/AGENTS.md.template +4 -0
- package/templates/workspaceRoot/CLAUDE.md.template +19 -0
- package/templates/workspaceRoot/biome.json.template +2 -1
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +10 -14
- package/templates/workspaceRoot/docs/GENERATED.md.template +12 -10
- package/templates/workspaceRoot/package.json.template +2 -4
- package/typeChecker-3xgrzc2v.js +7 -0
- package/typecheck.proc.js +4 -5
- package/{workflow.command-2ygfqt4f.js → workflow.command-kphbr7eh.js} +22 -25
- package/{workspace.command-vbgpjkf9.js → workspace.command-j1gatz3d.js} +96 -81
- package/capacitorApp-9xswcgx7.js +0 -61
- package/dependencyScanner-f6grrep3.js +0 -9
- package/getDirname-m9s0cmhq.js +0 -8
- package/index-mxvakhsm.js +0 -66
- package/index-r24hmh0q.js +0 -4
- package/recipeScanner-tghkzrrt.js +0 -12
- package/typeChecker-kravn7ns.js +0 -8
- /package/{index-0wae5ebk.js → index-meh558jy.js} +0 -0
- /package/{index-ss469dec.js → index-nz8prx9g.js} +0 -0
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
WorkflowExecutor,
|
|
7
|
-
compactWorkflowInputs,
|
|
8
|
-
createDryRunWorkflowApplyReport,
|
|
3
|
+
jsonText,
|
|
4
|
+
workflowPlanApproval,
|
|
9
5
|
createWorkflowApplyReport,
|
|
6
|
+
workflowCommandsForPlan,
|
|
7
|
+
writeWorkflowRunArtifact,
|
|
8
|
+
readWorkflowRunArtifact,
|
|
10
9
|
createWorkflowBaselineSummary,
|
|
11
|
-
createWorkflowPlan,
|
|
12
10
|
createWorkflowValidationRunReport,
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
createDryRunWorkflowApplyReport,
|
|
12
|
+
WorkflowExecutor,
|
|
15
13
|
listWorkflowSpecs,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
getWorkflowSpec,
|
|
15
|
+
compactWorkflowInputs,
|
|
16
|
+
createWorkflowPlan,
|
|
19
17
|
renderWorkflowList,
|
|
18
|
+
renderWorkflowExplain,
|
|
20
19
|
renderWorkflowPlan,
|
|
21
|
-
|
|
20
|
+
renderWorkflowApply,
|
|
22
21
|
renderWorkflowValidation,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
renderWorkflowRunArtifact
|
|
23
|
+
} from "./index-fc1bh0a7.js";
|
|
24
|
+
import {
|
|
25
|
+
AkanContextAnalyzer
|
|
26
|
+
} from "./index-gtmz74tj.js";
|
|
27
27
|
import {
|
|
28
28
|
runner
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-znynzt5w.js";
|
|
30
30
|
|
|
31
31
|
// pkgs/@akanjs/cli/workflow/workflow.runner.ts
|
|
32
32
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
FileSys
|
|
4
|
+
} from "./index-q0y2jq9j.js";
|
|
5
|
+
|
|
2
6
|
// pkgs/@akanjs/devkit/frontendBuild/clientEntryDiscovery.ts
|
|
3
7
|
import path3 from "path";
|
|
4
8
|
|
|
@@ -349,7 +353,7 @@ var resolveNodePackageExport = async (workspaceRoot, specifier) => {
|
|
|
349
353
|
const subpath = specifier === packageName ? "." : `.${specifier.slice(packageName.length)}`;
|
|
350
354
|
const exported = resolvePackageExport(pkgJson.exports, subpath);
|
|
351
355
|
const rel = exported ?? (subpath === "." ? pkgJson.module ?? pkgJson.main ?? "index.js" : null);
|
|
352
|
-
if (!rel
|
|
356
|
+
if (!rel?.startsWith("."))
|
|
353
357
|
return null;
|
|
354
358
|
const entryFile = await resolveFileCandidate(path2.resolve(pkgDir, rel));
|
|
355
359
|
if (!entryFile)
|
|
@@ -849,6 +853,7 @@ class ClientEntriesBundler {
|
|
|
849
853
|
#externalSubpaths;
|
|
850
854
|
#externalAliases;
|
|
851
855
|
#command;
|
|
856
|
+
#target;
|
|
852
857
|
#outputSubdir;
|
|
853
858
|
#reactFastRefresh;
|
|
854
859
|
#artifactDir;
|
|
@@ -870,6 +875,7 @@ class ClientEntriesBundler {
|
|
|
870
875
|
this.#externalSubpaths = options.externalSubpaths ?? [];
|
|
871
876
|
this.#externalAliases = options.externalAliases ?? {};
|
|
872
877
|
this.#command = options.command ?? "start";
|
|
878
|
+
this.#target = options.target ?? "browser";
|
|
873
879
|
this.#outputSubdir = options.outputSubdir ?? "client";
|
|
874
880
|
this.#reactFastRefresh = options.reactFastRefresh ?? false;
|
|
875
881
|
this.#artifactDir = `${this.#command === "build" ? this.#app.dist.cwdPath : this.#app.cwdPath}/.akan/artifact`;
|
|
@@ -883,7 +889,7 @@ class ClientEntriesBundler {
|
|
|
883
889
|
entrypoints: this.#opaqueEntries.entries,
|
|
884
890
|
outdir: this.#outdir,
|
|
885
891
|
splitting: true,
|
|
886
|
-
target:
|
|
892
|
+
target: this.#target,
|
|
887
893
|
format: "esm",
|
|
888
894
|
naming: CLIENT_BUNDLE_NAMING,
|
|
889
895
|
metafile: true,
|
|
@@ -1117,7 +1123,8 @@ var VENDOR_SPECIFIERS = [
|
|
|
1117
1123
|
"akanjs/store",
|
|
1118
1124
|
"akanjs/base",
|
|
1119
1125
|
"akanjs/common",
|
|
1120
|
-
"akanjs/constant"
|
|
1126
|
+
"akanjs/constant",
|
|
1127
|
+
"akanjs/fetch"
|
|
1121
1128
|
];
|
|
1122
1129
|
|
|
1123
1130
|
// pkgs/@akanjs/devkit/frontendBuild/routeClientBuilder.ts
|
|
@@ -1226,12 +1233,11 @@ class RouteClientBuilder {
|
|
|
1226
1233
|
}).bundle();
|
|
1227
1234
|
}
|
|
1228
1235
|
async#buildSsrBundle(bootstrapEntries) {
|
|
1229
|
-
const externalOptions = RouteClientBuilder.resolveSsrClientExternalOptions(this.#command);
|
|
1230
1236
|
return new ClientEntriesBundler({
|
|
1231
1237
|
app: this.#app,
|
|
1232
1238
|
entries: bootstrapEntries.buildEntries,
|
|
1233
1239
|
plugins: [await createBarrelImportsPlugin(this.#app)],
|
|
1234
|
-
...
|
|
1240
|
+
...RouteClientBuilder.resolveSsrClientBundleOptions(this.#command),
|
|
1235
1241
|
outputSubdir: "client-ssr",
|
|
1236
1242
|
command: this.#command
|
|
1237
1243
|
}).bundle();
|
|
@@ -1293,15 +1299,16 @@ ${defaultNames.map((name) => `export default ${name};`).join(`
|
|
|
1293
1299
|
const serverEntry = RouteClientBuilder.resolveAkanServerEntry();
|
|
1294
1300
|
return { [Bun.resolveSync("akanjs/fetch", serverEntry)]: "akanjs/fetch" };
|
|
1295
1301
|
}
|
|
1296
|
-
static
|
|
1302
|
+
static resolveSsrClientBundleOptions(command) {
|
|
1297
1303
|
if (command === "start") {
|
|
1298
1304
|
return {
|
|
1305
|
+
target: "bun",
|
|
1299
1306
|
external: SSR_CLIENT_EXTERNALS,
|
|
1300
1307
|
externalSubpaths: ["akanjs/fetch"],
|
|
1301
1308
|
externalAliases: RouteClientBuilder.resolveSsrClientRuntimeAliases()
|
|
1302
1309
|
};
|
|
1303
1310
|
}
|
|
1304
|
-
return { external: SSR_CLIENT_ALIAS_EXTERNALS };
|
|
1311
|
+
return { target: "bun", external: SSR_CLIENT_ALIAS_EXTERNALS };
|
|
1305
1312
|
}
|
|
1306
1313
|
static resolveAkanServerEntry() {
|
|
1307
1314
|
try {
|
|
@@ -1337,7 +1344,7 @@ ${defaultNames.map((name) => `export default ${name};`).join(`
|
|
|
1337
1344
|
}
|
|
1338
1345
|
|
|
1339
1346
|
// pkgs/@akanjs/devkit/frontendBuild/autoImportSync.ts
|
|
1340
|
-
import { readdir, readFile, stat
|
|
1347
|
+
import { readdir, readFile, stat } from "fs/promises";
|
|
1341
1348
|
import path7 from "path";
|
|
1342
1349
|
import ts2 from "typescript";
|
|
1343
1350
|
var TEST_FILE_RE = /\.(test|spec)\.(ts|tsx)$/;
|
|
@@ -1515,6 +1522,8 @@ class AutoImportSync {
|
|
|
1515
1522
|
const [scope, project, facet] = parts;
|
|
1516
1523
|
if (scope !== "apps" && scope !== "libs" || !project || !facet)
|
|
1517
1524
|
return null;
|
|
1525
|
+
if (facet === "lib" && parts[3] === "__lib")
|
|
1526
|
+
return null;
|
|
1518
1527
|
const role = roleFor(facet, base);
|
|
1519
1528
|
if (!role)
|
|
1520
1529
|
return null;
|
|
@@ -1529,7 +1538,7 @@ class AutoImportSync {
|
|
|
1529
1538
|
const next = transformSource(source, abs, ctx, resolveExtra);
|
|
1530
1539
|
if (next === null || next === source)
|
|
1531
1540
|
return false;
|
|
1532
|
-
await
|
|
1541
|
+
await FileSys.writeTextAtomic(abs, next);
|
|
1533
1542
|
return true;
|
|
1534
1543
|
}
|
|
1535
1544
|
async#extraResolverFor(abs, ctx) {
|
|
@@ -2010,7 +2019,7 @@ class DevChangePlanner {
|
|
|
2010
2019
|
var uniqueResolved = (files) => [...new Set(files.map((file) => path8.resolve(file)))].sort();
|
|
2011
2020
|
|
|
2012
2021
|
// pkgs/@akanjs/devkit/frontendBuild/devGeneratedIndexSync.ts
|
|
2013
|
-
import { mkdir as mkdir2, readdir as readdir2, readFile as readFile2, rm, stat as stat2
|
|
2022
|
+
import { mkdir as mkdir2, readdir as readdir2, readFile as readFile2, rm, stat as stat2 } from "fs/promises";
|
|
2014
2023
|
import path9 from "path";
|
|
2015
2024
|
var BARREL_FACETS2 = new Set(["common", "srvkit", "ui", "webkit", "plugin"]);
|
|
2016
2025
|
var FACET_SOURCE_FILE_RE = /\.(ts|tsx)$/;
|
|
@@ -2102,7 +2111,7 @@ class DevGeneratedIndexSync {
|
|
|
2102
2111
|
if (current === content)
|
|
2103
2112
|
return false;
|
|
2104
2113
|
await mkdir2(dir, { recursive: true });
|
|
2105
|
-
await
|
|
2114
|
+
await FileSys.writeTextAtomic(indexPath, content);
|
|
2106
2115
|
return true;
|
|
2107
2116
|
}
|
|
2108
2117
|
async#contentForIndex(indexPath) {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
GlobalConfig,
|
|
4
|
+
CloudApi,
|
|
5
|
+
AiSession
|
|
6
|
+
} from "./index-c69j78kk.js";
|
|
5
7
|
import {
|
|
6
|
-
|
|
7
|
-
} from "./index-
|
|
8
|
+
PkgExecutor
|
|
9
|
+
} from "./index-qsq3q8fy.js";
|
|
8
10
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
GlobalConfig
|
|
12
|
-
} from "./index-0cj2zxbm.js";
|
|
11
|
+
script
|
|
12
|
+
} from "./index-znynzt5w.js";
|
|
13
13
|
import {
|
|
14
14
|
ApplicationScript
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-zz5jyd94.js";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
} from "./index-
|
|
17
|
+
PackageScript
|
|
18
|
+
} from "./index-7d6vny25.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./index-
|
|
20
|
+
CloudRunner
|
|
21
|
+
} from "./index-zxgr3s8s.js";
|
|
22
22
|
|
|
23
23
|
// pkgs/@akanjs/cli/cloud/cloud.script.ts
|
|
24
24
|
import { Logger } from "akanjs/common";
|
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-
|
|
5
|
-
import {
|
|
6
|
-
WorkflowRunner
|
|
7
|
-
} from "./index-qzdjd4ct.js";
|
|
8
|
-
import {
|
|
9
|
-
ScalarScript
|
|
10
|
-
} from "./index-y4vkyhvv.js";
|
|
11
|
-
import {
|
|
12
|
-
PrimitiveScript
|
|
13
|
-
} from "./index-3vta1tqa.js";
|
|
14
|
-
import {
|
|
15
|
-
ModuleScript
|
|
16
|
-
} from "./index-jhpa13zj.js";
|
|
3
|
+
AppExecutor
|
|
4
|
+
} from "./index-qsq3q8fy.js";
|
|
17
5
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
jsonText,
|
|
7
|
+
createWorkflowBaselineSummary,
|
|
8
|
+
buildAkanModuleContextIndex,
|
|
9
|
+
createWorkflowStepRegistry,
|
|
10
|
+
toolingRolloutGate
|
|
11
|
+
} from "./index-fc1bh0a7.js";
|
|
20
12
|
import {
|
|
21
|
-
|
|
22
|
-
akanMcpInstallConfigPaths,
|
|
23
|
-
akanMcpInstallTargets,
|
|
13
|
+
buildResourceList,
|
|
24
14
|
codexMcpConfigPath,
|
|
25
|
-
|
|
15
|
+
akanMcpInstallTargets,
|
|
16
|
+
akanMcpInstallConfigPaths,
|
|
26
17
|
createAkanMcpServer,
|
|
18
|
+
createAkanCodexMcpServerBlock,
|
|
19
|
+
upsertCodexMcpServerBlock,
|
|
27
20
|
renderDoctorText,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} from "./index-774gcx29.js";
|
|
21
|
+
AkanContextAnalyzer
|
|
22
|
+
} from "./index-gtmz74tj.js";
|
|
31
23
|
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
CommandContainer,
|
|
25
|
+
runner,
|
|
26
|
+
script
|
|
27
|
+
} from "./index-znynzt5w.js";
|
|
28
|
+
import {
|
|
29
|
+
isPlaceholderAppId2
|
|
30
|
+
} from "./index-1yxtbmbj.js";
|
|
38
31
|
import {
|
|
39
32
|
Prompter
|
|
40
|
-
} from "./index-
|
|
33
|
+
} from "./index-h7yw2z9n.js";
|
|
41
34
|
import {
|
|
42
|
-
|
|
43
|
-
} from "./index-
|
|
35
|
+
RepairRunner
|
|
36
|
+
} from "./index-0amdxycf.js";
|
|
44
37
|
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
script
|
|
48
|
-
} from "./index-kdh76j26.js";
|
|
38
|
+
WorkflowRunner
|
|
39
|
+
} from "./index-srdssqj7.js";
|
|
49
40
|
import {
|
|
50
|
-
|
|
51
|
-
} from "./index-
|
|
41
|
+
ModuleScript
|
|
42
|
+
} from "./index-zmjppp25.js";
|
|
43
|
+
import {
|
|
44
|
+
PrimitiveScript
|
|
45
|
+
} from "./index-qkk27bk6.js";
|
|
46
|
+
import {
|
|
47
|
+
ScalarScript
|
|
48
|
+
} from "./index-8p8p0cf8.js";
|
|
49
|
+
import {
|
|
50
|
+
getMobileTargets
|
|
51
|
+
} from "./index-47pj3aee.js";
|
|
52
52
|
|
|
53
53
|
// pkgs/@akanjs/cli/context/context.script.ts
|
|
54
54
|
import { Logger } from "akanjs/common";
|
|
@@ -380,12 +380,15 @@ var applyMcpTools = [
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
];
|
|
383
|
-
var listAkanMcpTools = (mode = "readonly") => {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
383
|
+
var listAkanMcpTools = (mode = "readonly", { guidelineNames = [] } = {}) => {
|
|
384
|
+
const tools = mode === "readonly" ? readonlyMcpTools : mode === "plan" ? [...readonlyMcpTools, ...planMcpTools] : [...readonlyMcpTools, ...planMcpTools, ...applyMcpTools];
|
|
385
|
+
if (guidelineNames.length === 0)
|
|
386
|
+
return tools;
|
|
387
|
+
return tools.map((tool) => tool.name === "get_guideline" ? {
|
|
388
|
+
...tool,
|
|
389
|
+
description: `${tool.description ?? ""} One of: ${guidelineNames.join(", ")}.`.trim(),
|
|
390
|
+
inputSchema: { ...tool.inputSchema, properties: { name: { type: "string", enum: [...guidelineNames] } } }
|
|
391
|
+
} : tool);
|
|
389
392
|
};
|
|
390
393
|
var createAkanValidationContract = (listTools = listAkanMcpTools) => ({
|
|
391
394
|
schemaVersion: 1,
|
|
@@ -604,6 +607,10 @@ var createCliWorkflowStepRegistry = (workspace) => createWorkflowStepRegistry({
|
|
|
604
607
|
});
|
|
605
608
|
|
|
606
609
|
// pkgs/@akanjs/cli/context/context.runner.ts
|
|
610
|
+
var toolErrorText = (error) => {
|
|
611
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
612
|
+
return message.replace(/\/(?:[^\s"'/]+\/)*(?=(?:pkgs|apps|libs|infra)\/)/g, "<workspace>/");
|
|
613
|
+
};
|
|
607
614
|
var workflowDiagnosticFromContext = (diagnostic) => ({
|
|
608
615
|
severity: diagnostic.severity,
|
|
609
616
|
code: diagnostic.code,
|
|
@@ -662,7 +669,7 @@ class ContextRunner extends runner("context") {
|
|
|
662
669
|
if (!config.hasMobileConfig)
|
|
663
670
|
continue;
|
|
664
671
|
for (const { name, config: target } of await getMobileTargets(app)) {
|
|
665
|
-
if (!
|
|
672
|
+
if (!isPlaceholderAppId2(target.appId))
|
|
666
673
|
continue;
|
|
667
674
|
diagnostics.push({
|
|
668
675
|
severity: "warning",
|
|
@@ -720,8 +727,8 @@ class ContextRunner extends runner("context") {
|
|
|
720
727
|
await workspace.writeFile(codexMcpConfigPath, merged);
|
|
721
728
|
return codexMcpConfigPath;
|
|
722
729
|
}
|
|
723
|
-
listMcpTools(mode = "readonly") {
|
|
724
|
-
return listAkanMcpTools(mode);
|
|
730
|
+
listMcpTools(mode = "readonly", { guidelineNames = [] } = {}) {
|
|
731
|
+
return listAkanMcpTools(mode, { guidelineNames });
|
|
725
732
|
}
|
|
726
733
|
async callMcpTool(workspace, name, args = {}, { mode = "readonly" } = {}) {
|
|
727
734
|
const availableTools = this.listMcpTools(mode);
|
|
@@ -776,7 +783,7 @@ class ContextRunner extends runner("context") {
|
|
|
776
783
|
if (name === "explain_command")
|
|
777
784
|
return this.explainCommand(stringArg(args, "command"));
|
|
778
785
|
if (name === "get_validation_contract")
|
|
779
|
-
return createAkanValidationContract((
|
|
786
|
+
return createAkanValidationContract((mode) => this.listMcpTools(mode));
|
|
780
787
|
if (name === "list_workflows")
|
|
781
788
|
return parseJsonOutput(new WorkflowRunner().list({ format: "json" }));
|
|
782
789
|
if (name === "explain_workflow")
|
|
@@ -851,17 +858,20 @@ class ContextRunner extends runner("context") {
|
|
|
851
858
|
${payload}`);
|
|
852
859
|
};
|
|
853
860
|
const respond = (id, result, framing) => {
|
|
854
|
-
writeMessage({ jsonrpc: "2.0", id, result }, framing);
|
|
861
|
+
writeMessage({ jsonrpc: "2.0", id: id ?? null, result }, framing);
|
|
855
862
|
};
|
|
856
863
|
const respondError = (id, code, message, framing) => {
|
|
857
|
-
writeMessage({ jsonrpc: "2.0", id, error: { code, message } }, framing);
|
|
864
|
+
writeMessage({ jsonrpc: "2.0", id: id ?? null, error: { code, message } }, framing);
|
|
858
865
|
};
|
|
866
|
+
const guidelineNames = await Prompter.listGuidelines();
|
|
867
|
+
const resources = buildResourceList(guidelineNames);
|
|
859
868
|
const readResource = async (uri) => {
|
|
860
|
-
|
|
861
|
-
if (uri === "akan://docs/framework" || uri === "akan://guidelines/framework")
|
|
869
|
+
if (uri === "akan://docs/framework")
|
|
862
870
|
return { uri, mimeType: "text/markdown", text: await Prompter.getInstruction("framework") };
|
|
863
|
-
|
|
864
|
-
|
|
871
|
+
const guideline = /^akan:\/\/guidelines\/(.+)$/.exec(uri)?.[1];
|
|
872
|
+
if (guideline)
|
|
873
|
+
return { uri, mimeType: "text/markdown", text: await Prompter.getInstruction(guideline) };
|
|
874
|
+
const context = await AkanContextAnalyzer.analyze(workspace);
|
|
865
875
|
if (uri === "akan://workspace/summary")
|
|
866
876
|
return { uri, mimeType: "application/json", text: jsonText(context, { trailingNewline: false }) };
|
|
867
877
|
if (uri === "akan://workspace/apps")
|
|
@@ -883,7 +893,7 @@ ${payload}`);
|
|
|
883
893
|
}
|
|
884
894
|
throw new Error(`Unknown resource: ${uri}`);
|
|
885
895
|
};
|
|
886
|
-
const
|
|
896
|
+
const handleRequest = async (request, framing) => {
|
|
887
897
|
const params = request.params ?? {};
|
|
888
898
|
if (request.method === "initialize") {
|
|
889
899
|
respond(request.id, {
|
|
@@ -893,7 +903,7 @@ ${payload}`);
|
|
|
893
903
|
}, framing);
|
|
894
904
|
} else if (request.method === "tools/list") {
|
|
895
905
|
respond(request.id, {
|
|
896
|
-
tools: this.listMcpTools(mode)
|
|
906
|
+
tools: this.listMcpTools(mode, { guidelineNames })
|
|
897
907
|
}, framing);
|
|
898
908
|
} else if (request.method === "tools/call") {
|
|
899
909
|
const name = params.name;
|
|
@@ -909,16 +919,39 @@ ${payload}`);
|
|
|
909
919
|
]
|
|
910
920
|
}, framing);
|
|
911
921
|
} catch (error) {
|
|
912
|
-
|
|
922
|
+
respond(request.id, { content: [{ type: "text", text: toolErrorText(error) }], isError: true }, framing);
|
|
913
923
|
}
|
|
914
924
|
} else if (request.method === "resources/list") {
|
|
915
|
-
respond(request.id, { resources
|
|
925
|
+
respond(request.id, { resources }, framing);
|
|
916
926
|
} else if (request.method === "resources/read") {
|
|
917
927
|
respond(request.id, { contents: [await readResource(params.uri)] }, framing);
|
|
918
|
-
} else
|
|
928
|
+
} else {
|
|
919
929
|
respondError(request.id, -32601, `Unknown method: ${request.method}`, framing);
|
|
920
930
|
}
|
|
921
931
|
};
|
|
932
|
+
const handle = async (request, framing) => {
|
|
933
|
+
if (request.id === undefined || request.id === null)
|
|
934
|
+
return;
|
|
935
|
+
try {
|
|
936
|
+
await handleRequest(request, framing);
|
|
937
|
+
} catch (error) {
|
|
938
|
+
respondError(request.id, -32603, error instanceof Error ? error.message : String(error), framing);
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
const handleFrame = async (payload, framing) => {
|
|
942
|
+
let request;
|
|
943
|
+
try {
|
|
944
|
+
request = JSON.parse(payload);
|
|
945
|
+
} catch (error) {
|
|
946
|
+
respondError(null, -32700, error instanceof Error ? error.message : String(error), framing);
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
if (!request || typeof request !== "object" || typeof request.method !== "string") {
|
|
950
|
+
respondError(null, -32600, "Invalid Request: expected a JSON-RPC 2.0 object with a method", framing);
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
await handle(request, framing);
|
|
954
|
+
};
|
|
922
955
|
const parseContentLengthMessage = async () => {
|
|
923
956
|
const headerEnd = buffer.indexOf(`\r
|
|
924
957
|
\r
|
|
@@ -938,7 +971,7 @@ ${payload}`);
|
|
|
938
971
|
return false;
|
|
939
972
|
const body = buffer.slice(bodyStart, bodyEnd);
|
|
940
973
|
buffer = buffer.slice(bodyEnd);
|
|
941
|
-
await
|
|
974
|
+
await handleFrame(body, "content-length");
|
|
942
975
|
return true;
|
|
943
976
|
};
|
|
944
977
|
const parseLineMessage = async () => {
|
|
@@ -950,7 +983,7 @@ ${payload}`);
|
|
|
950
983
|
buffer = buffer.slice(lineEnd + 1);
|
|
951
984
|
if (!line)
|
|
952
985
|
return true;
|
|
953
|
-
await
|
|
986
|
+
await handleFrame(line, "newline");
|
|
954
987
|
return true;
|
|
955
988
|
};
|
|
956
989
|
const parse = async () => {
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-
|
|
5
|
-
import {
|
|
6
|
-
PageScript
|
|
7
|
-
} from "./index-xmmzf150.js";
|
|
3
|
+
FileSys
|
|
4
|
+
} from "./index-q0y2jq9j.js";
|
|
8
5
|
import {
|
|
9
6
|
AiSession
|
|
10
|
-
} from "./index-
|
|
7
|
+
} from "./index-c69j78kk.js";
|
|
11
8
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
createPassedPrimitiveReport,
|
|
15
|
-
generatedFilesForSync,
|
|
16
|
-
moduleSourcePaths,
|
|
17
|
-
sourceFile
|
|
18
|
-
} from "./index-rxkpk7n4.js";
|
|
19
|
-
import {
|
|
20
|
-
Prompter
|
|
21
|
-
} from "./index-j37qq1f2.js";
|
|
9
|
+
ModuleExecutor
|
|
10
|
+
} from "./index-qsq3q8fy.js";
|
|
22
11
|
import {
|
|
23
12
|
runner,
|
|
24
13
|
script
|
|
25
|
-
} from "./index-
|
|
14
|
+
} from "./index-znynzt5w.js";
|
|
26
15
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
sourceFile,
|
|
17
|
+
moduleSourcePaths,
|
|
18
|
+
generatedFilesForSync,
|
|
19
|
+
createPassedPrimitiveReport,
|
|
20
|
+
bilingualLabelForField,
|
|
21
|
+
bilingualDescriptionForField
|
|
22
|
+
} from "./index-fc1bh0a7.js";
|
|
29
23
|
import {
|
|
30
|
-
|
|
31
|
-
} from "./index-
|
|
24
|
+
PageScript
|
|
25
|
+
} from "./index-hyywke0f.js";
|
|
26
|
+
import {
|
|
27
|
+
Prompter
|
|
28
|
+
} from "./index-h7yw2z9n.js";
|
|
29
|
+
import {
|
|
30
|
+
pluralizeName
|
|
31
|
+
} from "./index-nz8prx9g.js";
|
|
32
32
|
|
|
33
33
|
// pkgs/@akanjs/devkit/getRelatedCnsts.ts
|
|
34
34
|
import { readFileSync, realpathSync } from "fs";
|
|
@@ -662,39 +662,39 @@ class ModuleRunner extends runner("module") {
|
|
|
662
662
|
}
|
|
663
663
|
|
|
664
664
|
// pkgs/@akanjs/cli/module/module.script.ts
|
|
665
|
-
var moduleChangedFiles = (
|
|
665
|
+
var moduleChangedFiles = (sys, moduleName, files) => Object.values(files).map((file) => sourceFile(sys, `lib/${moduleName}/${file.filename}`, "create", "Module source file was created."));
|
|
666
666
|
|
|
667
667
|
class ModuleScript extends script("module", [ModuleRunner, PageScript]) {
|
|
668
|
-
async createModuleTemplate(
|
|
669
|
-
const mod = ModuleExecutor.from(
|
|
668
|
+
async createModuleTemplate(sys, name, { page = false } = {}) {
|
|
669
|
+
const mod = ModuleExecutor.from(sys, name);
|
|
670
670
|
const files = await this.moduleRunner.createModuleTemplate(mod);
|
|
671
|
-
if (page &&
|
|
672
|
-
await this.pageScript.createCrudPage(mod, { app:
|
|
673
|
-
await
|
|
671
|
+
if (page && sys.type === "app")
|
|
672
|
+
await this.pageScript.createCrudPage(mod, { app: sys, basePath: null, single: false });
|
|
673
|
+
await sys.scan();
|
|
674
674
|
return createPassedPrimitiveReport({
|
|
675
675
|
command: "create-module",
|
|
676
|
-
changedFiles: moduleChangedFiles(
|
|
677
|
-
generatedFiles: generatedFilesForSync(
|
|
678
|
-
target:
|
|
676
|
+
changedFiles: moduleChangedFiles(sys, name, files),
|
|
677
|
+
generatedFiles: generatedFilesForSync(sys, "Generated files were refreshed after module creation."),
|
|
678
|
+
target: sys.name
|
|
679
679
|
});
|
|
680
680
|
}
|
|
681
|
-
async createModule(
|
|
681
|
+
async createModule(sys, name, {
|
|
682
682
|
page = false,
|
|
683
683
|
description,
|
|
684
684
|
schemaDescription
|
|
685
685
|
} = {}) {
|
|
686
|
-
const isContinued = await
|
|
687
|
-
const session = new AiSession("createModule", { workspace:
|
|
688
|
-
const moduleConstantExampleFiles = await
|
|
689
|
-
const executor = ModuleExecutor.from(
|
|
686
|
+
const isContinued = await sys.exists(`lib/${name}/${name}.constant.ts`);
|
|
687
|
+
const session = new AiSession("createModule", { workspace: sys.workspace, cacheKey: name, isContinued });
|
|
688
|
+
const moduleConstantExampleFiles = await sys.workspace.getConstantFiles();
|
|
689
|
+
const executor = ModuleExecutor.from(sys, name);
|
|
690
690
|
const files = await this.moduleRunner.createModuleTemplate(executor);
|
|
691
691
|
const { constant, dictionary } = files;
|
|
692
|
-
if (page &&
|
|
693
|
-
await this.pageScript.createCrudPage(executor, { app:
|
|
692
|
+
if (page && sys.type === "app")
|
|
693
|
+
await this.pageScript.createCrudPage(executor, { app: sys, basePath: null, single: false });
|
|
694
694
|
const modelDesc = description ?? await input({ message: "description of module" });
|
|
695
695
|
const modelSchemaDesign = schemaDescription ?? await input({ message: "schema description of module" });
|
|
696
|
-
const config = await
|
|
697
|
-
const moduleRequest = new ModuleRequest({ sysType:
|
|
696
|
+
const config = await sys.getConfig();
|
|
697
|
+
const moduleRequest = new ModuleRequest({ sysType: sys.type, sysName: sys.name, modelName: name, config });
|
|
698
698
|
const constantRequestPrompt = await moduleRequest.requestModelConstant({
|
|
699
699
|
modelDesc,
|
|
700
700
|
modelSchemaDesign,
|
|
@@ -702,38 +702,38 @@ class ModuleScript extends script("module", [ModuleRunner, PageScript]) {
|
|
|
702
702
|
exampleFiles: randomPicks(moduleConstantExampleFiles, Math.min(10, moduleConstantExampleFiles.length))
|
|
703
703
|
});
|
|
704
704
|
const constantGuide = await ModuleRequest.getGuideJson("modelConstant");
|
|
705
|
-
const constantWrites = await session.writeTypescripts(constantRequestPrompt,
|
|
705
|
+
const constantWrites = await session.writeTypescripts(constantRequestPrompt, sys, {
|
|
706
706
|
validate: constantGuide.update.rules
|
|
707
707
|
});
|
|
708
708
|
for (const scalarName of this.#getCreatedScalarNames(constantWrites.map(({ filePath }) => filePath))) {
|
|
709
|
-
await
|
|
709
|
+
await sys.applyTemplate({
|
|
710
710
|
basePath: "./lib/__scalar",
|
|
711
711
|
template: "__scalar",
|
|
712
|
-
dict: { model: scalarName, models: pluralizeName(scalarName), sysName:
|
|
712
|
+
dict: { model: scalarName, models: pluralizeName(scalarName), sysName: sys.name },
|
|
713
713
|
overwrite: false
|
|
714
714
|
});
|
|
715
715
|
}
|
|
716
|
-
const constantContent = await
|
|
716
|
+
const constantContent = await sys.readFile(`lib/${name}/${name}.constant.ts`);
|
|
717
717
|
const dictionaryGuide = await ModuleRequest.getGuideJson("modelDictionary");
|
|
718
718
|
await session.writeTypescripts(requestDictionary({
|
|
719
|
-
sysName:
|
|
719
|
+
sysName: sys.name,
|
|
720
720
|
modelName: name,
|
|
721
721
|
constant: constantContent,
|
|
722
722
|
modelDesc,
|
|
723
723
|
modelSchemaDesign,
|
|
724
724
|
boilerplate: dictionary.content,
|
|
725
725
|
exampleFiles: randomPicks(moduleConstantExampleFiles, Math.min(10, moduleConstantExampleFiles.length))
|
|
726
|
-
}),
|
|
727
|
-
await
|
|
728
|
-
|
|
726
|
+
}), sys, { validate: dictionaryGuide.update.rules });
|
|
727
|
+
await sys.scan();
|
|
728
|
+
sys.log(`Module ${name} created in ${sys.type}s/${sys.name}/lib/${name}`);
|
|
729
729
|
return createPassedPrimitiveReport({
|
|
730
730
|
command: "create-module",
|
|
731
731
|
changedFiles: [
|
|
732
|
-
...moduleChangedFiles(
|
|
733
|
-
...constantWrites.map((write) => sourceFile(
|
|
732
|
+
...moduleChangedFiles(sys, name, files),
|
|
733
|
+
...constantWrites.map((write) => sourceFile(sys, write.filePath, "modify", "AI-assisted module constant source was updated."))
|
|
734
734
|
],
|
|
735
|
-
generatedFiles: generatedFilesForSync(
|
|
736
|
-
target:
|
|
735
|
+
generatedFiles: generatedFilesForSync(sys, "Generated files were refreshed after module creation."),
|
|
736
|
+
target: sys.name
|
|
737
737
|
});
|
|
738
738
|
}
|
|
739
739
|
#getCreatedScalarNames(filePaths) {
|
|
@@ -744,15 +744,15 @@ class ModuleScript extends script("module", [ModuleRunner, PageScript]) {
|
|
|
744
744
|
async removeModule(mod) {
|
|
745
745
|
await this.moduleRunner.removeModule(mod);
|
|
746
746
|
}
|
|
747
|
-
async createService(
|
|
748
|
-
const service = ModuleExecutor.from(
|
|
747
|
+
async createService(sys, name) {
|
|
748
|
+
const service = ModuleExecutor.from(sys, `_${name}`);
|
|
749
749
|
const files = await this.moduleRunner.createService(service);
|
|
750
|
-
await
|
|
750
|
+
await sys.scan();
|
|
751
751
|
return createPassedPrimitiveReport({
|
|
752
752
|
command: "create-service",
|
|
753
|
-
changedFiles: moduleChangedFiles(
|
|
754
|
-
generatedFiles: generatedFilesForSync(
|
|
755
|
-
target:
|
|
753
|
+
changedFiles: moduleChangedFiles(sys, `_${name}`, files),
|
|
754
|
+
generatedFiles: generatedFilesForSync(sys, "Generated files were refreshed after service creation."),
|
|
755
|
+
target: sys.name
|
|
756
756
|
});
|
|
757
757
|
}
|
|
758
758
|
async createTest(workspace, name) {}
|