@akanjs/cli 3.0.0-beta.17 → 3.0.0-beta.19
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-gjqnc2mg.js → CodeAgent-6cm97kay.js} +2 -2
- package/{CodeAgentRpcHost-qvwfv0n9.js → CodeAgentRpcHost-p7h6n2hp.js} +1 -1
- package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
- package/{CodeTui-nd9hqvrw.js → CodeTui-za4jsm41.js} +205 -34
- package/{TunnelShare-r5tc2qk5.js → TunnelShare-2j6s511d.js} +2 -2
- package/{agent.command-n664dtcv.js → agent.command-e0wpbbyg.js} +6 -6
- package/akanCode.js +7 -5
- package/{application.command-t5542jte.js → application.command-8wyxqc8q.js} +28 -15
- package/{applicationBuildRunner-x4gbfn7y.js → applicationBuildRunner-n9gzaxd0.js} +35 -10
- package/{applicationReleasePackager-z61ep017.js → applicationReleasePackager-vpggfqgq.js} +1 -1
- package/buildBatch.proc.js +3 -3
- package/{capacitorApp-shv3ajh5.js → capacitorApp-q3z0qht0.js} +2 -2
- package/{cloud.command-dk5tj39k.js → cloud.command-4zwa5dsx.js} +34 -12
- package/cloud.script-fwx3vb34.js +20 -0
- package/{code.command-88sebgnn.js → code.command-468c9d7s.js} +41 -19
- package/commandManifest.json +1 -1
- package/{context.command-pqsm5jrk.js → context.command-dsnw0jby.js} +14 -14
- package/context.runner-rs4rj15d.js +22 -0
- package/{dependencyScanner-shs82ynp.js → dependencyScanner-0z2h2tks.js} +1 -1
- package/{devTui-gy6mendg.js → devTui-ffjsarqa.js} +3 -3
- package/{devTuiView-y1548wy6.js → devTuiView-1q1mdgrv.js} +1 -1
- package/{guideline.command-rpc2emw8.js → guideline.command-vhw13pqr.js} +8 -13
- package/guidelines/agentRule/agentRule.instruction.md +27 -10
- package/guidelines/conventions/conventions.instruction.md +53 -26
- package/guidelines/queryRule/queryRule.instruction.md +17 -7
- package/guidelines/runtimeRule/runtimeRule.instruction.md +74 -0
- package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
- package/guidelines/transportRule/transportRule.instruction.md +10 -8
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +4 -3
- package/incrementalBuilder.proc.js +3 -2
- package/{index-4n4821gp.js → index-10dkrrww.js} +4 -4
- package/{index-bzakk0c2.js → index-14zrtgfa.js} +5 -3
- package/{index-v17gj504.js → index-18zybgkc.js} +2 -2
- package/{index-qh7brn20.js → index-22xtgmhn.js} +6 -2
- package/{index-qhtj9y6j.js → index-2446k7b4.js} +74 -21
- package/{index-g9zghs4h.js → index-3jrp517k.js} +12 -12
- package/{index-vpx68e4x.js → index-4m929vvn.js} +2 -2
- package/{index-4cvpzkq6.js → index-53176s7j.js} +3 -3
- package/{index-jwrpsrg3.js → index-667w0yah.js} +1 -1
- package/{index-3mg4h788.js → index-7ep8qtvp.js} +2 -2
- package/{index-w8kmx1b6.js → index-89hy31kf.js} +30 -7
- package/index-9d6nvkz2.js +656 -0
- package/index-9dp031by.js +12 -0
- package/{index-zn8qgeqx.js → index-a1w6934z.js} +3 -3
- package/{index-p0tew3fq.js → index-ab0c38ea.js} +10 -5
- package/index-bc88j1ry.js +1166 -0
- package/{index-ns128c4q.js → index-bftkz6cp.js} +280 -73
- package/{index-kcxmv48c.js → index-bhtmj233.js} +4 -1
- package/{index-kvzjda3v.js → index-bwf965h6.js} +5 -5
- package/{index-p4p9t45x.js → index-crmeqnmf.js} +56 -44
- package/{index-8k16atqy.js → index-d2242ksy.js} +23 -6
- package/{index-2sq06vv0.js → index-e4v6vhxq.js} +417 -105
- package/{index-xjc7gg65.js → index-esk82rvk.js} +23 -33
- package/{index-sn7dnzq4.js → index-kwaq3n9n.js} +1 -1
- package/{index-gm76f0qb.js → index-n3cv0tm4.js} +1 -1
- package/{index-6na0sd2b.js → index-qdgzsnhg.js} +5 -2
- package/{index-twq9p2sp.js → index-s5rhm04y.js} +0 -6
- package/{index-n8kt2wh6.js → index-sq2dzkzm.js} +35 -10
- package/{index-myj01w9r.js → index-srmay5jw.js} +15 -2
- package/{index-2pm1j01n.js → index-txr7dj2g.js} +4 -4
- package/{index-3cymrzsb.js → index-vqx8bdxz.js} +17 -3
- package/{index-te0y1c0m.js → index-zqgj2rt2.js} +12 -7
- package/index.js +21 -21
- package/{library.command-m8p2r1dh.js → library.command-cqr175dy.js} +3 -3
- package/{localRegistry.command-yppdqrxv.js → localRegistry.command-49z55qqz.js} +9 -9
- package/{module.command-mfzvqt0n.js → module.command-9p8mm3b0.js} +5 -5
- package/{package.command-cgp2p2v5.js → package.command-wxyz909t.js} +5 -5
- package/package.json +2 -2
- package/{page.command-taenb02b.js → page.command-gsrsfqqs.js} +3 -3
- package/{primitive.command-7kpncmkk.js → primitive.command-ns1mptje.js} +6 -6
- package/{prompter-9mn3kp36.js → prompter-1f8d9pcc.js} +1 -1
- package/{quality.command-1ar94hrw.js → quality.command-e76k2q9k.js} +18 -17
- package/{repair.command-n08t6j8p.js → repair.command-pkrsm3cw.js} +5 -5
- package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
- package/{scalar.command-mq8qfp4t.js → scalar.command-0cpt3fc8.js} +4 -4
- package/skills/akan-code/SKILL.md +122 -0
- package/skills/akan-module/SKILL.md +2 -2
- package/skills/akan-store/SKILL.md +6 -2
- package/{subspace.command-jqv5n79w.js → subspace.command-fktpwp0g.js} +20 -10
- package/templates/__scalar/__model__/__model__.abstract.md.template +8 -0
- package/templates/appSample/lib/__scalar/workHistory/workHistory.abstract.ts +8 -39
- package/templates/appSample/lib/_noti/noti.abstract.ts +6 -29
- package/templates/appSample/lib/task/task.abstract.ts +12 -32
- package/templates/appSample/lib/task/task.signal.spec.ts +15 -18
- package/templates/appSample/lib/task/task.signal.test.ts +15 -1
- package/templates/appSample/lib/task/task.signal.ts +1 -1
- package/templates/appSample/srvkit/AuthGuard.ts +4 -1
- package/templates/appSample/srvkit/SessionInternalArg.ts +3 -1
- package/templates/crudPages/[__model__Id]/edit/page.tsx +2 -1
- package/templates/crudPages/[__model__Id]/page.tsx +2 -1
- package/templates/crudPages/new/page.tsx +2 -1
- package/templates/crudPages/page.tsx +2 -1
- package/templates/crudSinglePage/page.tsx +2 -1
- package/templates/localDev/docker-compose.yaml.template +3 -14
- package/templates/module/__model__.signal.ts +12 -4
- package/templates/pkgRoot/tsconfig.json.template +2 -7
- package/templates/service/__model__.abstract.md.template +8 -0
- package/{tunnel.command-ht2es78c.js → tunnel.command-d5jy9gk8.js} +4 -4
- package/{workflow.command-tvz4nm9n.js → workflow.command-6tkcysmx.js} +9 -9
- package/{workspace.command-txv1yv5e.js → workspace.command-gv84eh1p.js} +25 -24
- package/cloud.script-ch3xrw3s.js +0 -20
- package/context.runner-bys6ykcp.js +0 -22
- package/guidelines/agentRule/agentRule.generate.json +0 -31
- package/guidelines/componentRule/componentRule.generate.json +0 -31
- package/guidelines/conventions/conventions.generate.json +0 -25
- package/guidelines/cssRule/cssRule.generate.json +0 -31
- package/guidelines/docPageRule/docPageRule.generate.json +0 -31
- package/guidelines/docPageRule/docPageRule.instruction.md +0 -25
- package/guidelines/docSyncRule/docSyncRule.generate.json +0 -31
- package/guidelines/docSyncRule/docSyncRule.instruction.md +0 -25
- package/guidelines/enumConstant/enumConstant.generate.json +0 -31
- package/guidelines/enumConstant/enumConstant.instruction.md +0 -28
- package/guidelines/fieldRule/fieldRule.generate.json +0 -31
- package/guidelines/framework/framework.generate.json +0 -32
- package/guidelines/mcpRule/mcpRule.generate.json +0 -35
- package/guidelines/modelConstant/modelConstant.generate.json +0 -32
- package/guidelines/modelDictionary/modelDictionary.generate.json +0 -32
- package/guidelines/modelDocument/modelDocument.generate.json +0 -31
- package/guidelines/modelService/modelService.generate.json +0 -31
- package/guidelines/modelSignal/modelSignal.generate.json +0 -31
- package/guidelines/modelStore/modelStore.generate.json +0 -31
- package/guidelines/modelTemplate/modelTemplate.generate.json +0 -31
- package/guidelines/modelUnit/modelUnit.generate.json +0 -31
- package/guidelines/modelUtil/modelUtil.generate.json +0 -31
- package/guidelines/modelView/modelView.generate.json +0 -31
- package/guidelines/modelZone/modelZone.generate.json +0 -31
- package/guidelines/moduleCodegen/moduleCodegen.generate.json +0 -31
- package/guidelines/moduleCodegen/moduleCodegen.instruction.md +0 -28
- package/guidelines/moduleOverview/moduleOverview.generate.json +0 -31
- package/guidelines/queryRule/queryRule.generate.json +0 -31
- package/guidelines/recipeRule/recipeRule.generate.json +0 -31
- package/guidelines/runtimeRule/runtimeRule.generate.json +0 -25
- package/guidelines/scalarConstant/scalarConstant.generate.json +0 -32
- package/guidelines/scalarDictionary/scalarDictionary.generate.json +0 -32
- package/guidelines/scalarModule/scalarModule.generate.json +0 -31
- package/guidelines/sharedUiUsage/sharedUiUsage.generate.json +0 -31
- package/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -25
- package/guidelines/ssrRule/ssrRule.generate.json +0 -31
- package/guidelines/transportRule/transportRule.generate.json +0 -31
- package/guidelines/utilUiUsage/utilUiUsage.generate.json +0 -31
- package/guidelines/utilUiUsage/utilUiUsage.instruction.md +0 -25
- package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +0 -24
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +0 -34
- package/index-57p9p179.js +0 -461
- package/index-qt8dqgnf.js +0 -250
- package/templates/__scalar/__model__/__model__.abstract.md +0 -28
- package/templates/module/__model__.abstract.md +0 -28
- package/templates/service/__model__.abstract.md +0 -28
|
@@ -195,6 +195,7 @@ import { readFileSync as readFileSync2 } from "fs";
|
|
|
195
195
|
import {
|
|
196
196
|
copyFile,
|
|
197
197
|
cp as cpEntry,
|
|
198
|
+
lstat,
|
|
198
199
|
mkdir as mkdir3,
|
|
199
200
|
readdir as readDirEntries,
|
|
200
201
|
realpath,
|
|
@@ -358,7 +359,7 @@ ${CLAUDE_COMMENT_RULE}
|
|
|
358
359
|
import fs from "fs";
|
|
359
360
|
import path2 from "path";
|
|
360
361
|
import { fileURLToPath } from "url";
|
|
361
|
-
import { normalizeRoutePrefix } from "akanjs/base";
|
|
362
|
+
import { DatabaseModes, normalizeRoutePrefix } from "akanjs/base";
|
|
362
363
|
import { resolveAkanI18nConfig } from "akanjs/common";
|
|
363
364
|
|
|
364
365
|
// pkgs/@akanjs/devkit/akanConfig/types.ts
|
|
@@ -417,16 +418,6 @@ var MOBILE_APP_CAPACITOR_PLUGINS = [
|
|
|
417
418
|
"@capacitor/push-notifications",
|
|
418
419
|
"capacitor-plugin-safe-area"
|
|
419
420
|
];
|
|
420
|
-
var DATABASE_MODE_RUNTIME_PACKAGES = {
|
|
421
|
-
single: [],
|
|
422
|
-
multiple: ["@libsql/client", "bullmq", "ioredis", "protobufjs"],
|
|
423
|
-
cluster: ["bullmq", "ioredis", "postgres", "protobufjs"]
|
|
424
|
-
};
|
|
425
|
-
var AKAN_RUNTIME_PACKAGES = new Set([
|
|
426
|
-
...SSR_RUNTIME_PACKAGES,
|
|
427
|
-
...MOBILE_RUNTIME_PACKAGES,
|
|
428
|
-
...Object.values(DATABASE_MODE_RUNTIME_PACKAGES).flat()
|
|
429
|
-
]);
|
|
430
421
|
var DEFAULT_AKAN_IMAGE_CONFIG = {
|
|
431
422
|
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
|
|
432
423
|
imageSizes: [32, 48, 64, 96, 128, 256, 384],
|
|
@@ -506,7 +497,7 @@ class AkanAppConfig {
|
|
|
506
497
|
rootPackageJson;
|
|
507
498
|
docker;
|
|
508
499
|
dockerfile;
|
|
509
|
-
|
|
500
|
+
database;
|
|
510
501
|
web;
|
|
511
502
|
externalLibs;
|
|
512
503
|
barrelImports;
|
|
@@ -534,7 +525,7 @@ class AkanAppConfig {
|
|
|
534
525
|
this.baseDevEnv = baseDevEnv;
|
|
535
526
|
this.plugins = plugins;
|
|
536
527
|
this.#applyRoutes(config?.routes);
|
|
537
|
-
this.
|
|
528
|
+
this.database = AkanAppConfig.#database(app, config);
|
|
538
529
|
this.externalLibs = [...new Set([...config?.externalLibs ?? [], ...libContributions.externalLibs])];
|
|
539
530
|
this.barrelImports = [
|
|
540
531
|
...DEFAULT_BARREL_IMPORTS,
|
|
@@ -730,6 +721,7 @@ ENV AKAN_PUBLIC_LOCALES=${this.i18n.locales.join(",")}
|
|
|
730
721
|
ENV AKAN_PUBLIC_API_PREFIX=${this.api.prefix}
|
|
731
722
|
ENV AKAN_PUBLIC_WS_PREFIX=${this.api.websocketPrefix}
|
|
732
723
|
ENV AKAN_PUBLIC_OPERATION_MODE=cloud
|
|
724
|
+
ENV AKAN_DATABASE_MODES=${this.database.modes.join(",")}
|
|
733
725
|
ENV AKAN_LOG_TO_FILE=0
|
|
734
726
|
${webEnvLines}
|
|
735
727
|
CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
@@ -774,14 +766,30 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
774
766
|
return akanPackageJson.dependencies?.[lib] ?? akanPackageJson.peerDependencies?.[lib];
|
|
775
767
|
}
|
|
776
768
|
#getProductionRuntimePackages() {
|
|
777
|
-
return [
|
|
769
|
+
return [
|
|
770
|
+
...this.externalLibs,
|
|
771
|
+
...SSR_RUNTIME_PACKAGES,
|
|
772
|
+
...this.database.modes.flatMap((mode) => this.getDatabaseModeRuntimePackages(mode))
|
|
773
|
+
];
|
|
778
774
|
}
|
|
779
|
-
getDatabaseModeRuntimePackages(databaseMode
|
|
780
|
-
return [...
|
|
775
|
+
getDatabaseModeRuntimePackages(databaseMode) {
|
|
776
|
+
return [...DatabaseModes.drivers[databaseMode]];
|
|
781
777
|
}
|
|
782
|
-
getMissingDatabaseModeDependencySpecs(databaseMode
|
|
778
|
+
getMissingDatabaseModeDependencySpecs(databaseMode) {
|
|
783
779
|
return this.#getMissingDependencySpecs(this.getDatabaseModeRuntimePackages(databaseMode));
|
|
784
780
|
}
|
|
781
|
+
resolveDatabaseMode() {
|
|
782
|
+
return DatabaseModes.resolve({
|
|
783
|
+
requested: process.env.AKAN_DATABASE_MODE,
|
|
784
|
+
declared: this.database.modes.join(","),
|
|
785
|
+
local: true
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
static #database(app, config) {
|
|
789
|
+
const declared = config?.database?.modes?.filter((mode) => !!mode);
|
|
790
|
+
const modes = declared?.length ? declared : ["single"];
|
|
791
|
+
return { modes: DatabaseModes.parseList(modes.join(","), `database.modes in apps/${app.name}/akan.config.ts`) };
|
|
792
|
+
}
|
|
785
793
|
getMobileRuntimePackages() {
|
|
786
794
|
return [...new Set([...MOBILE_RUNTIME_PACKAGES, ...MOBILE_APP_CAPACITOR_PLUGINS])];
|
|
787
795
|
}
|
|
@@ -803,6 +811,9 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
803
811
|
return `${lib}@${version}`;
|
|
804
812
|
});
|
|
805
813
|
}
|
|
814
|
+
get akanVersion() {
|
|
815
|
+
return getAkanPackageJson().version;
|
|
816
|
+
}
|
|
806
817
|
getProductionPackageJson(data = {}) {
|
|
807
818
|
return {
|
|
808
819
|
name: this.app.name,
|
|
@@ -1141,13 +1152,6 @@ export async function generateHead(props: PageProps) {
|
|
|
1141
1152
|
return inheritedLayout.head;
|
|
1142
1153
|
}
|
|
1143
1154
|
|
|
1144
|
-
export async function generateMetadata(props: PageProps) {
|
|
1145
|
-
if (userLayout.generateMetadata) return userLayout.generateMetadata(props);
|
|
1146
|
-
if (userLayout.metadata !== undefined) return userLayout.metadata;
|
|
1147
|
-
if (inheritedLayout.generateMetadata) return inheritedLayout.generateMetadata(props);
|
|
1148
|
-
return inheritedLayout.metadata;
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
1155
|
export const NotFound = userLayout.NotFound ?? inheritedLayout.NotFound;
|
|
1152
1156
|
export const Error = userLayout.Error ?? inheritedLayout.Error;
|
|
1153
1157
|
export const pageConfig = userLayout.pageConfig ?? inheritedLayout.pageConfig;
|
|
@@ -1164,7 +1168,6 @@ ${layoutBinding} return (
|
|
|
1164
1168
|
theme={userLayout.theme ?? inheritedLayout.theme}
|
|
1165
1169
|
fonts={loadFonts(userFonts)}
|
|
1166
1170
|
className={defaultFontClassName}
|
|
1167
|
-
gaTrackingId={userLayout.gaTrackingId ?? inheritedLayout.gaTrackingId}
|
|
1168
1171
|
layoutStyle={userLayout.layoutStyle ?? inheritedLayout.layoutStyle}
|
|
1169
1172
|
reconnect={userLayout.reconnect ?? inheritedLayout.reconnect ?? false}
|
|
1170
1173
|
wsConnect={userLayout.wsConnect ?? inheritedLayout.wsConnect ?? true}
|
|
@@ -1185,13 +1188,6 @@ export async function generateHead(props: PageProps) {
|
|
|
1185
1188
|
return inheritedLayout.head;
|
|
1186
1189
|
}
|
|
1187
1190
|
|
|
1188
|
-
export async function generateMetadata(props: PageProps) {
|
|
1189
|
-
if (userLayout.generateMetadata) return userLayout.generateMetadata(props);
|
|
1190
|
-
if (userLayout.metadata !== undefined) return userLayout.metadata;
|
|
1191
|
-
if (inheritedLayout.generateMetadata) return inheritedLayout.generateMetadata(props);
|
|
1192
|
-
return inheritedLayout.metadata;
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
1191
|
export const NotFound = userLayout.NotFound ?? inheritedLayout.NotFound;
|
|
1196
1192
|
export const Error = userLayout.Error ?? inheritedLayout.Error;
|
|
1197
1193
|
export const pageConfig = userLayout.pageConfig ?? inheritedLayout.pageConfig;
|
|
@@ -1301,13 +1297,14 @@ var asBiomeReport = (candidate) => {
|
|
|
1301
1297
|
var BIOME_CONFIG_FILES = ["biome.json", "biome.jsonc"];
|
|
1302
1298
|
|
|
1303
1299
|
class Linter {
|
|
1300
|
+
static biomeBinName = process.platform === "win32" ? "biome.exe" : "biome";
|
|
1304
1301
|
lintRoot;
|
|
1305
1302
|
configPath;
|
|
1306
1303
|
#biomeBin;
|
|
1307
1304
|
constructor(cwdPath) {
|
|
1308
1305
|
this.lintRoot = this.#findBiomeRootPath(cwdPath);
|
|
1309
1306
|
this.configPath = Linter.#configPathIn(this.lintRoot) ?? path5.join(this.lintRoot, "biome.json");
|
|
1310
|
-
const localBiomeBin = path5.join(this.lintRoot, "node_modules
|
|
1307
|
+
const localBiomeBin = path5.join(this.lintRoot, "node_modules", ".bin", Linter.biomeBinName);
|
|
1311
1308
|
this.#biomeBin = existsSync(localBiomeBin) ? localBiomeBin : "biome";
|
|
1312
1309
|
}
|
|
1313
1310
|
static #configPathIn(dir) {
|
|
@@ -1717,7 +1714,7 @@ var moduleUiFileTypes = {
|
|
|
1717
1714
|
scalar: new Set(["Template", "Unit"])
|
|
1718
1715
|
};
|
|
1719
1716
|
var testFilePattern = /\.(test|spec)\.(ts|tsx)$/;
|
|
1720
|
-
var createDependencyScanner = async (exec) => (await import("./dependencyScanner-
|
|
1717
|
+
var createDependencyScanner = async (exec) => (await import("./dependencyScanner-0z2h2tks.js")).TypeScriptDependencyScanner.from(exec);
|
|
1721
1718
|
var isAllowedTestFile = (filename) => testFilePattern.test(filename);
|
|
1722
1719
|
var getScanPath = (exec, relativePath) => path7.posix.join(`${exec.type}s`, exec.name, relativePath.split(path7.sep).join("/"));
|
|
1723
1720
|
async function clearGeneratedRootCapacitorConfigs(exec) {
|
|
@@ -2139,11 +2136,12 @@ class PkgInfo {
|
|
|
2139
2136
|
const [tsconfig, rootPackageJson] = await Promise.all([exec.getTsConfig(), exec.workspace.getPackageJson()]);
|
|
2140
2137
|
const scanner = await createDependencyScanner(exec);
|
|
2141
2138
|
const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
|
|
2142
|
-
const
|
|
2139
|
+
const workspacePathOf = (resolve) => resolve.replace(/^\.\//, "");
|
|
2140
|
+
const pkgPathSet = new Set(Object.keys(tsconfig.compilerOptions.paths ?? {}).filter((path) => tsconfig.compilerOptions.paths?.[path]?.some((resolve) => workspacePathOf(resolve).startsWith("pkgs/"))).map((path) => path.replace("/*", "")));
|
|
2143
2141
|
const [npmDepSet, pkgPathDepSet] = await scanner.getImportSets([npmSet, pkgPathSet]);
|
|
2144
2142
|
const pkgDeps = [...pkgPathDepSet].map((path) => {
|
|
2145
2143
|
const pathSplitLength = path.split("/").length;
|
|
2146
|
-
return (tsconfig.compilerOptions.paths?.[path]?.[0] ?? "*").split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
2144
|
+
return workspacePathOf(tsconfig.compilerOptions.paths?.[path]?.[0] ?? "*").split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
2147
2145
|
}).filter((pkg) => pkg !== exec.name);
|
|
2148
2146
|
const pkgScanResult = {
|
|
2149
2147
|
name: exec.name,
|
|
@@ -2240,7 +2238,8 @@ var staticTemplateFileExtensions = new Set([
|
|
|
2240
2238
|
".woff2",
|
|
2241
2239
|
".xml"
|
|
2242
2240
|
]);
|
|
2243
|
-
var
|
|
2241
|
+
var plainCommandArgPattern = process.platform === "win32" ? /^[\w@%+=:,./\\-]+$/ : /^[\w@%+=:,./-]+$/;
|
|
2242
|
+
var formatCommandArg = (value) => plainCommandArgPattern.test(value) ? value : JSON.stringify(value);
|
|
2244
2243
|
var formatCommandForDisplay = (command, args = []) => [command, ...args].map(formatCommandArg).join(" ");
|
|
2245
2244
|
|
|
2246
2245
|
class CommandExecutionError extends Error {
|
|
@@ -2594,7 +2593,7 @@ class Executor {
|
|
|
2594
2593
|
const isDirectory = (await stat2(src)).isDirectory();
|
|
2595
2594
|
if (!await FileSys.exists(dest) && isDirectory)
|
|
2596
2595
|
await mkdir3(dest, { recursive: true });
|
|
2597
|
-
if (dereference)
|
|
2596
|
+
if (dereference || process.platform === "win32")
|
|
2598
2597
|
await cpEntry(src, dest, { recursive: isDirectory, dereference: true, force: true });
|
|
2599
2598
|
else
|
|
2600
2599
|
await $`cp -r ${src}${isDirectory ? "/." : ""} ${dest}`;
|
|
@@ -3255,7 +3254,7 @@ class SysExecutor extends Executor {
|
|
|
3255
3254
|
class AppExecutor extends SysExecutor {
|
|
3256
3255
|
static #routeSourceValidator = null;
|
|
3257
3256
|
static async#getRouteSourceValidator() {
|
|
3258
|
-
AppExecutor.#routeSourceValidator ??= (await import("./routeSourceValidator-
|
|
3257
|
+
AppExecutor.#routeSourceValidator ??= (await import("./routeSourceValidator-7ycnfz0e.js")).RouteSourceValidator;
|
|
3259
3258
|
return AppExecutor.#routeSourceValidator;
|
|
3260
3259
|
}
|
|
3261
3260
|
dist;
|
|
@@ -3303,14 +3302,20 @@ class AppExecutor extends SysExecutor {
|
|
|
3303
3302
|
...env
|
|
3304
3303
|
};
|
|
3305
3304
|
}
|
|
3305
|
+
async getDatabaseModeEnv() {
|
|
3306
|
+
const akanConfig = await this.getConfig();
|
|
3307
|
+
return {
|
|
3308
|
+
AKAN_DATABASE_MODE: akanConfig.resolveDatabaseMode(),
|
|
3309
|
+
AKAN_DATABASE_MODES: akanConfig.database.modes.join(",")
|
|
3310
|
+
};
|
|
3311
|
+
}
|
|
3306
3312
|
async prepareCommand(type) {
|
|
3307
3313
|
const akanConfig = await this.getConfig();
|
|
3308
|
-
const databaseMode = process.env.AKAN_DATABASE_MODE ?? akanConfig.defaultDatabaseMode ?? "single";
|
|
3309
3314
|
const routeEnv = {
|
|
3310
3315
|
AKAN_PUBLIC_BASE_PATHS: [...akanConfig.basePaths].join(","),
|
|
3311
3316
|
AKAN_PUBLIC_API_PREFIX: akanConfig.api.prefix,
|
|
3312
3317
|
AKAN_PUBLIC_WS_PREFIX: akanConfig.api.websocketPrefix,
|
|
3313
|
-
|
|
3318
|
+
...await this.getDatabaseModeEnv()
|
|
3314
3319
|
};
|
|
3315
3320
|
Object.assign(process.env, routeEnv);
|
|
3316
3321
|
if (type === "build") {
|
|
@@ -3339,6 +3344,8 @@ class AppExecutor extends SysExecutor {
|
|
|
3339
3344
|
const buildEnv = { ...env };
|
|
3340
3345
|
delete buildEnv.AKAN_PUBLIC_CLIENT_PORT;
|
|
3341
3346
|
delete buildEnv.AKAN_PUBLIC_SERVER_PORT;
|
|
3347
|
+
delete buildEnv.AKAN_PUBLIC_OPERATION_MODE;
|
|
3348
|
+
delete process.env.AKAN_PUBLIC_OPERATION_MODE;
|
|
3342
3349
|
Object.assign(process.env, buildEnv);
|
|
3343
3350
|
}
|
|
3344
3351
|
return { env };
|
|
@@ -3386,7 +3393,9 @@ class AppExecutor extends SysExecutor {
|
|
|
3386
3393
|
const owners = new Map;
|
|
3387
3394
|
const devOnlyKeys = new Set;
|
|
3388
3395
|
const devOnlyDirs = [];
|
|
3389
|
-
|
|
3396
|
+
const pageRoots = await this.getPageRoots();
|
|
3397
|
+
const libKeyPrefixes = pageRoots.map((root) => root.keyPrefix).filter(Boolean);
|
|
3398
|
+
for (const root of pageRoots) {
|
|
3390
3399
|
if (!await FileSys.dirExists(root.dir))
|
|
3391
3400
|
continue;
|
|
3392
3401
|
for await (const rel of glob.scan({
|
|
@@ -3398,6 +3407,8 @@ class AppExecutor extends SysExecutor {
|
|
|
3398
3407
|
if (segments.some((s) => s === "node_modules"))
|
|
3399
3408
|
continue;
|
|
3400
3409
|
const posix = `${root.keyPrefix}${segments.join("/")}`;
|
|
3410
|
+
if (!root.keyPrefix && libKeyPrefixes.some((prefix) => posix.startsWith(prefix)))
|
|
3411
|
+
continue;
|
|
3401
3412
|
const absPath = path8.join(root.dir, ...segments);
|
|
3402
3413
|
validatePageSourceFile(posix, { filePath: absPath });
|
|
3403
3414
|
if (!isRouteSourceFile(posix))
|
|
@@ -3487,7 +3498,8 @@ class AppExecutor extends SysExecutor {
|
|
|
3487
3498
|
return entries.map((entry) => `${parent}${AppExecutor.#pageLibsDir}/${entry}/`);
|
|
3488
3499
|
}))).flat();
|
|
3489
3500
|
const wanted = parents.flatMap((parent) => libs.map((lib) => `${parent}${AppExecutor.#pageLibsDir}/(${lib})/`));
|
|
3490
|
-
|
|
3501
|
+
const isLink = async (key) => (await lstat(`${this.cwdPath}/page/${key.slice(0, -1)}`).catch(() => null))?.isSymbolicLink() ?? false;
|
|
3502
|
+
if (linked.sort().join(",") === wanted.sort().join(",") && (await Promise.all(linked.map(isLink))).every(Boolean))
|
|
3491
3503
|
return false;
|
|
3492
3504
|
await Promise.all(parents.map((parent) => this.removeDir(`${this.cwdPath}/page/${parent}${AppExecutor.#pageLibsDir}`)));
|
|
3493
3505
|
for (const parent of parents) {
|
|
@@ -3795,4 +3807,4 @@ class ModuleExecutor extends Executor {
|
|
|
3795
3807
|
}
|
|
3796
3808
|
}
|
|
3797
3809
|
|
|
3798
|
-
export { AGENT_BLOCK_START, AGENT_BLOCK_END, stampBlockVersion, extractBlockVersion, readDevkitVersion, upsertAgentBlock, extractAgentBlock, renderRecipeEntries, collectScopeRecipeSources, renderScopeAgentBlock, CLAUDE_COMMENT_RULE, AsyncDefaultExportDetector, resolveSsrPageEntriesForApp, CodegenLock, rootAllowedFiles, rootAllowedDirs, isAllowedLibFacetRootFile, isScannedRootEntry, AppInfo, Spinner, CommandExecutionError, Executor, WorkspaceExecutor, SysExecutor, AppExecutor, LibExecutor, PkgExecutor, ModuleExecutor };
|
|
3810
|
+
export { AGENT_BLOCK_START, AGENT_BLOCK_END, stampBlockVersion, extractBlockVersion, readDevkitVersion, upsertAgentBlock, extractAgentBlock, renderRecipeEntries, collectScopeRecipeSources, renderScopeAgentBlock, CLAUDE_COMMENT_RULE, AsyncDefaultExportDetector, resolveSsrPageEntriesForApp, CodegenLock, Linter, rootAllowedFiles, rootAllowedDirs, isAllowedLibFacetRootFile, isScannedRootEntry, AppInfo, Spinner, CommandExecutionError, Executor, WorkspaceExecutor, SysExecutor, AppExecutor, LibExecutor, PkgExecutor, ModuleExecutor };
|
|
@@ -4,19 +4,34 @@ class CodeAgentRpcHost2 {
|
|
|
4
4
|
#agent;
|
|
5
5
|
#write;
|
|
6
6
|
#buffer = "";
|
|
7
|
+
#started = false;
|
|
8
|
+
#resolveShutdown = () => {};
|
|
9
|
+
shutdown = new Promise((resolve) => {
|
|
10
|
+
this.#resolveShutdown = resolve;
|
|
11
|
+
});
|
|
7
12
|
constructor(agent, write = (line) => process.stdout.write(line)) {
|
|
8
13
|
this.#agent = agent;
|
|
9
14
|
this.#write = write;
|
|
10
15
|
}
|
|
11
16
|
async serve(input = process.stdin) {
|
|
12
|
-
this
|
|
13
|
-
this.#agent.announce();
|
|
17
|
+
this.start();
|
|
14
18
|
const decoder = new TextDecoder;
|
|
15
19
|
for await (const chunk of input)
|
|
16
|
-
await this
|
|
20
|
+
await this.feed(decoder.decode(chunk, { stream: true }));
|
|
17
21
|
await this.#agent.abort().catch(() => {});
|
|
18
22
|
}
|
|
19
|
-
|
|
23
|
+
start() {
|
|
24
|
+
if (this.#started)
|
|
25
|
+
return;
|
|
26
|
+
this.#started = true;
|
|
27
|
+
this.#agent.on((event) => this.#emit(event));
|
|
28
|
+
this.#agent.announce();
|
|
29
|
+
}
|
|
30
|
+
attach(write) {
|
|
31
|
+
this.#write = write;
|
|
32
|
+
this.#buffer = "";
|
|
33
|
+
}
|
|
34
|
+
async feed(text) {
|
|
20
35
|
this.#buffer += text;
|
|
21
36
|
let index = this.#buffer.indexOf(`
|
|
22
37
|
`);
|
|
@@ -41,6 +56,8 @@ class CodeAgentRpcHost2 {
|
|
|
41
56
|
} catch (error) {
|
|
42
57
|
this.#reply({ type: "reply", id: request.id, ok: false, error: String(error) });
|
|
43
58
|
}
|
|
59
|
+
if (request.command?.type === "shutdown")
|
|
60
|
+
this.#resolveShutdown();
|
|
44
61
|
}
|
|
45
62
|
async#run(command) {
|
|
46
63
|
switch (command.type) {
|
|
@@ -70,11 +87,11 @@ class CodeAgentRpcHost2 {
|
|
|
70
87
|
}
|
|
71
88
|
}
|
|
72
89
|
#emit(event) {
|
|
73
|
-
this.#write(`${JSON.stringify({ type: "event", event })}
|
|
90
|
+
this.#write?.(`${JSON.stringify({ type: "event", event })}
|
|
74
91
|
`);
|
|
75
92
|
}
|
|
76
93
|
#reply(reply) {
|
|
77
|
-
this.#write(`${JSON.stringify(reply)}
|
|
94
|
+
this.#write?.(`${JSON.stringify(reply)}
|
|
78
95
|
`);
|
|
79
96
|
}
|
|
80
97
|
}
|