@akanjs/cli 3.0.0-alpha.1 → 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-yv00p0s0.js → agent.command-v1a4746v.js} +11 -12
- package/{application.command-0qsczf4k.js → application.command-fzdcnzhg.js} +65 -37
- package/{applicationBuildRunner-ct2pxyvw.js → applicationBuildRunner-s4gsk728.js} +28 -24
- package/{applicationReleasePackager-gg8ccbeh.js → applicationReleasePackager-28v9vbzk.js} +8 -9
- package/buildBatch.proc.js +12 -13
- package/capacitorApp-8d6d4zkm.js +12 -0
- package/{cloud.command-dxfv18sa.js → cloud.command-wygy2z05.js} +15 -17
- package/commandManifest.json +1 -1
- package/{context.command-8d9e3k6b.js → context.command-4vdt1aqq.js} +19 -22
- 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-3jbkxzh6.js → guideline.command-p92dq6ts.js} +16 -17
- package/guidelines/agentRule/agentRule.generate.json +31 -0
- package/guidelines/agentRule/agentRule.instruction.md +533 -0
- package/guidelines/conventions/conventions.generate.json +25 -0
- package/guidelines/conventions/conventions.instruction.md +908 -0
- 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.generate.json +24 -0
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +263 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +33 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +402 -0
- package/incrementalBuilder.proc.js +26 -24
- package/{index-mr5s7mqd.js → index-0amdxycf.js} +8 -8
- package/{index-t3723f99.js → index-1yxtbmbj.js} +111 -42
- package/{index-ej426mcr.js → index-29sxqfaw.js} +65 -38
- package/index-3d9y066c.js +76 -0
- package/{index-76rn3g2c.js → index-47pj3aee.js} +4 -4
- package/index-5svjba73.js +159 -0
- package/index-6wwzs1bc.js +7 -0
- package/{index-k95xkh4p.js → index-7d6vny25.js} +16 -12
- package/{index-ec09pws3.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-rzwcpcc3.js → index-fc1bh0a7.js} +4 -4
- package/{index-7c6k4yvg.js → index-gq44bqjt.js} +58 -25
- package/{index-a00jg8x8.js → index-gtmz74tj.js} +79 -55
- package/{index-tdbas9r0.js → index-h7yw2z9n.js} +7 -7
- package/{index-bjpxzr6s.js → index-hwkygn9s.js} +51 -3
- package/{index-bbkek1bp.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-pyt2b4nw.js → index-p5neav9b.js} +1129 -1356
- package/{index-67546d0j.js → index-q0y2jq9j.js} +14 -2
- package/{index-bekddz9q.js → index-qkk27bk6.js} +32 -32
- package/{index-hgna5rjy.js → index-qsq3q8fy.js} +1034 -257
- package/{index-2q1f5j9k.js → index-srdssqj7.js} +18 -18
- package/{index-rh16j3c7.js → index-w8kmx1b6.js} +23 -13
- package/{index-nm6wghb6.js → index-yks023mb.js} +13 -13
- package/{index-1pvex4az.js → index-yza7zkpt.js} +94 -61
- package/{index-yzmhasdb.js → index-zmjppp25.js} +57 -57
- package/{index-8hsbnyes.js → index-znynzt5w.js} +100 -30
- package/{index-zasydjxd.js → index-zxgr3s8s.js} +31 -30
- package/{index-e16gnn26.js → index-zz5jyd94.js} +1002 -128
- package/index.js +22 -24
- package/{library.command-ebdj1vnm.js → library.command-s4fszngs.js} +11 -9
- package/{localRegistry.command-gb178ne8.js → localRegistry.command-gyw4da9z.js} +20 -22
- package/{module.command-9c1bnsx4.js → module.command-6n7dwvav.js} +13 -15
- package/{package.command-t93p4jkj.js → package.command-gr82ypnr.js} +8 -9
- package/package.json +5 -7
- package/{page.command-k3k0meh2.js → page.command-7gvgb3jb.js} +7 -8
- package/{primitive.command-de6nktdt.js → primitive.command-tk5ckw38.js} +13 -15
- package/{quality.command-z5kth2wa.js → quality.command-38v81baf.js} +229 -138
- package/recipeScanner-fpagtgc1.js +11 -0
- package/{repair.command-ehf2g112.js → repair.command-5xbwvsxp.js} +12 -13
- package/{routeSourceValidator-cncd92fv.js → routeSourceValidator-ze6x894c.js} +2 -40
- package/{scalar.command-7a2jtv33.js → scalar.command-0epwcr5k.js} +11 -13
- 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/app/page/styles.css.template +3 -3
- 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 +6 -6
- package/templates/crudPages/[__model__Id]/page.tsx +10 -13
- package/templates/crudPages/new/page.tsx +6 -6
- 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 +4 -2
- package/templates/lib/dict.ts +1 -1
- package/templates/lib/sig.ts +5 -1
- package/templates/lib/srv.ts +6 -2
- package/templates/lib/useClient.ts +9 -3
- package/templates/module/__Model__.Util.tsx +1 -1
- package/templates/module/__Model__.Zone.tsx +3 -5
- 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 -948
- package/templates/workspaceRoot/CLAUDE.md.template +19 -0
- package/templates/workspaceRoot/biome.json.template +4 -198
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +15 -16
- 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-e0tt0vk2.js → workflow.command-kphbr7eh.js} +21 -23
- package/{workspace.command-fpda0evj.js → workspace.command-j1gatz3d.js} +108 -91
- package/capacitorApp-4r9sm3qg.js +0 -58
- package/dependencyScanner-f6grrep3.js +0 -9
- package/index-mxvakhsm.js +0 -66
- package/index-r24hmh0q.js +0 -4
- package/recipeScanner-tghkzrrt.js +0 -12
- package/templates/libRoot/base/baseLogic.ts +0 -14
- package/templates/libRoot/base/index.ts +0 -8
- package/templates/workspaceRoot/.cursor/rules/akan-page-routing.mdc.template +0 -43
- package/templates/workspaceRoot/.cursor/rules/akan-sync-conventions.mdc.template +0 -33
- package/templates/workspaceRoot/.cursor/rules/application-test-commands.mdc.template +0 -16
- package/templates/workspaceRoot/.cursor/rules/change-scope.mdc.template +0 -12
- package/templates/workspaceRoot/.cursor/rules/client-server-boundaries.mdc.template +0 -18
- package/templates/workspaceRoot/.cursor/rules/coding-comments.mdc.template +0 -25
- package/templates/workspaceRoot/.cursor/rules/coding-style.mdc.template +0 -44
- package/templates/workspaceRoot/.cursor/rules/domain-module-conventions.mdc.template +0 -17
- package/templates/workspaceRoot/.cursor/rules/format-lint.mdc.template +0 -12
- package/templates/workspaceRoot/.cursor/rules/lint-enforced-rules.mdc.template +0 -18
- package/templates/workspaceRoot/.cursor/rules/module-file-playbook.mdc.template +0 -61
- package/templates/workspaceRoot/.cursor/rules/naming-conventions.mdc.template +0 -15
- package/templates/workspaceRoot/.cursor/rules/react-component-style.mdc.template +0 -21
- package/templates/workspaceRoot/.cursor/rules/repo-overview.mdc.template +0 -17
- package/templates/workspaceRoot/.cursor/rules/scalar-modeling.mdc.template +0 -58
- package/templates/workspaceRoot/.cursor/rules/secrets-and-env.mdc.template +0 -13
- package/templates/workspaceRoot/.cursor/rules/service-signal-conventions.mdc.template +0 -83
- package/templates/workspaceRoot/.cursor/rules/srvkit-adapters-and-guards.mdc.template +0 -50
- package/templates/workspaceRoot/.cursor/rules/ssr-first.mdc.template +0 -59
- package/templates/workspaceRoot/.cursor/rules/typescript-imports.mdc.template +0 -16
- 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
|
|
@@ -1143,16 +1150,17 @@ class RouteClientBuilder {
|
|
|
1143
1150
|
#knownEntries;
|
|
1144
1151
|
#command;
|
|
1145
1152
|
#discovery;
|
|
1153
|
+
#entries;
|
|
1146
1154
|
constructor(options) {
|
|
1147
1155
|
this.#app = options.app;
|
|
1148
1156
|
this.#seeds = options.seeds;
|
|
1149
1157
|
this.#knownEntries = options.knownEntries ?? new Set;
|
|
1150
1158
|
this.#command = options.command ?? "start";
|
|
1151
1159
|
this.#discovery = options.discovery;
|
|
1160
|
+
this.#entries = options.entries;
|
|
1152
1161
|
}
|
|
1153
1162
|
async build() {
|
|
1154
|
-
const
|
|
1155
|
-
const discovered = await discovery.discover(this.#seeds);
|
|
1163
|
+
const discovered = this.#entries ?? await (this.#discovery ?? await GraphClientEntryDiscovery.create(this.#app)).discover(this.#seeds);
|
|
1156
1164
|
const entries = discovered.filter((e) => !this.#knownEntries.has(e));
|
|
1157
1165
|
if (entries.length === 0)
|
|
1158
1166
|
return this.#emptyResult(discovered);
|
|
@@ -1225,12 +1233,11 @@ class RouteClientBuilder {
|
|
|
1225
1233
|
}).bundle();
|
|
1226
1234
|
}
|
|
1227
1235
|
async#buildSsrBundle(bootstrapEntries) {
|
|
1228
|
-
const externalOptions = RouteClientBuilder.resolveSsrClientExternalOptions(this.#command);
|
|
1229
1236
|
return new ClientEntriesBundler({
|
|
1230
1237
|
app: this.#app,
|
|
1231
1238
|
entries: bootstrapEntries.buildEntries,
|
|
1232
1239
|
plugins: [await createBarrelImportsPlugin(this.#app)],
|
|
1233
|
-
...
|
|
1240
|
+
...RouteClientBuilder.resolveSsrClientBundleOptions(this.#command),
|
|
1234
1241
|
outputSubdir: "client-ssr",
|
|
1235
1242
|
command: this.#command
|
|
1236
1243
|
}).bundle();
|
|
@@ -1292,15 +1299,16 @@ ${defaultNames.map((name) => `export default ${name};`).join(`
|
|
|
1292
1299
|
const serverEntry = RouteClientBuilder.resolveAkanServerEntry();
|
|
1293
1300
|
return { [Bun.resolveSync("akanjs/fetch", serverEntry)]: "akanjs/fetch" };
|
|
1294
1301
|
}
|
|
1295
|
-
static
|
|
1302
|
+
static resolveSsrClientBundleOptions(command) {
|
|
1296
1303
|
if (command === "start") {
|
|
1297
1304
|
return {
|
|
1305
|
+
target: "bun",
|
|
1298
1306
|
external: SSR_CLIENT_EXTERNALS,
|
|
1299
1307
|
externalSubpaths: ["akanjs/fetch"],
|
|
1300
1308
|
externalAliases: RouteClientBuilder.resolveSsrClientRuntimeAliases()
|
|
1301
1309
|
};
|
|
1302
1310
|
}
|
|
1303
|
-
return { external: SSR_CLIENT_ALIAS_EXTERNALS };
|
|
1311
|
+
return { target: "bun", external: SSR_CLIENT_ALIAS_EXTERNALS };
|
|
1304
1312
|
}
|
|
1305
1313
|
static resolveAkanServerEntry() {
|
|
1306
1314
|
try {
|
|
@@ -1336,7 +1344,7 @@ ${defaultNames.map((name) => `export default ${name};`).join(`
|
|
|
1336
1344
|
}
|
|
1337
1345
|
|
|
1338
1346
|
// pkgs/@akanjs/devkit/frontendBuild/autoImportSync.ts
|
|
1339
|
-
import { readdir, readFile, stat
|
|
1347
|
+
import { readdir, readFile, stat } from "fs/promises";
|
|
1340
1348
|
import path7 from "path";
|
|
1341
1349
|
import ts2 from "typescript";
|
|
1342
1350
|
var TEST_FILE_RE = /\.(test|spec)\.(ts|tsx)$/;
|
|
@@ -1514,6 +1522,8 @@ class AutoImportSync {
|
|
|
1514
1522
|
const [scope, project, facet] = parts;
|
|
1515
1523
|
if (scope !== "apps" && scope !== "libs" || !project || !facet)
|
|
1516
1524
|
return null;
|
|
1525
|
+
if (facet === "lib" && parts[3] === "__lib")
|
|
1526
|
+
return null;
|
|
1517
1527
|
const role = roleFor(facet, base);
|
|
1518
1528
|
if (!role)
|
|
1519
1529
|
return null;
|
|
@@ -1528,7 +1538,7 @@ class AutoImportSync {
|
|
|
1528
1538
|
const next = transformSource(source, abs, ctx, resolveExtra);
|
|
1529
1539
|
if (next === null || next === source)
|
|
1530
1540
|
return false;
|
|
1531
|
-
await
|
|
1541
|
+
await FileSys.writeTextAtomic(abs, next);
|
|
1532
1542
|
return true;
|
|
1533
1543
|
}
|
|
1534
1544
|
async#extraResolverFor(abs, ctx) {
|
|
@@ -2009,7 +2019,7 @@ class DevChangePlanner {
|
|
|
2009
2019
|
var uniqueResolved = (files) => [...new Set(files.map((file) => path8.resolve(file)))].sort();
|
|
2010
2020
|
|
|
2011
2021
|
// pkgs/@akanjs/devkit/frontendBuild/devGeneratedIndexSync.ts
|
|
2012
|
-
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";
|
|
2013
2023
|
import path9 from "path";
|
|
2014
2024
|
var BARREL_FACETS2 = new Set(["common", "srvkit", "ui", "webkit", "plugin"]);
|
|
2015
2025
|
var FACET_SOURCE_FILE_RE = /\.(ts|tsx)$/;
|
|
@@ -2101,7 +2111,7 @@ class DevGeneratedIndexSync {
|
|
|
2101
2111
|
if (current === content)
|
|
2102
2112
|
return false;
|
|
2103
2113
|
await mkdir2(dir, { recursive: true });
|
|
2104
|
-
await
|
|
2114
|
+
await FileSys.writeTextAtomic(indexPath, content);
|
|
2105
2115
|
return true;
|
|
2106
2116
|
}
|
|
2107
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-2q1f5j9k.js";
|
|
8
|
-
import {
|
|
9
|
-
PrimitiveScript
|
|
10
|
-
} from "./index-bekddz9q.js";
|
|
11
|
-
import {
|
|
12
|
-
ModuleScript
|
|
13
|
-
} from "./index-yzmhasdb.js";
|
|
14
|
-
import {
|
|
15
|
-
ScalarScript
|
|
16
|
-
} from "./index-ec09pws3.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-a00jg8x8.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-8hsbnyes.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 () => {
|