@akanjs/cli 3.0.0-beta.3 → 3.0.0-beta.31
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-tbdpdjat.js +9 -0
- package/CodeAgentRpcHost-p7h6n2hp.js +7 -0
- package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
- package/CodeTui-my2x5fah.js +1457 -0
- package/README.md +3 -0
- package/TunnelShare-cwh9ezsm.js +9 -0
- package/{agent.command-d2gfxfck.js → agent.command-vz60x05c.js} +8 -9
- package/akanCode.js +102 -0
- package/application.command-pxqfjrqm.js +241 -0
- package/{applicationBuildRunner-kxwbssgn.js → applicationBuildRunner-shnfyfdy.js} +121 -77
- package/buildBatch.proc.js +120 -32
- package/cloud.command-9v9tpgps.js +95 -0
- package/cloud.script-baqdthnz.js +20 -0
- package/code.command-13h14j25.js +154 -0
- package/commandManifest.json +1 -1
- package/consoleToStderr-h5bryj94.js +7 -0
- package/context.command-x1hbasm5.js +48 -0
- package/context.runner-kqbjjea1.js +21 -0
- package/{dependencyScanner-shs82ynp.js → dependencyScanner-06z2dmrr.js} +2 -2
- package/{devTui-40ggmd99.js → devTui-q7k7bakd.js} +122 -40
- package/fileSys-wzzrntkw.js +9 -0
- package/guideline.command-vfk11hpj.js +42 -0
- package/guidelines/agentRule/agentRule.instruction.md +209 -33
- package/guidelines/conventions/conventions.instruction.md +144 -41
- package/guidelines/fieldRule/fieldRule.instruction.md +1 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
- package/guidelines/queryRule/queryRule.instruction.md +21 -7
- package/guidelines/runtimeRule/runtimeRule.instruction.md +271 -6
- package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
- package/guidelines/transportRule/transportRule.instruction.md +51 -0
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +20 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +66 -3
- package/incrementalBuilder.proc.js +564 -109
- package/{index-mak3cd28.js → index-1skctzbq.js} +137 -255
- package/{index-kcxmv48c.js → index-2ahj896a.js} +45 -79
- package/index-2wc41k5w.js +49 -0
- package/index-3hx1z96c.js +87 -0
- package/{index-hwkygn9s.js → index-48k96p55.js} +325 -36
- package/{index-q0y2jq9j.js → index-52w0fvh8.js} +21 -4
- package/index-7md2g9vw.js +6 -0
- package/index-7yf7rnjg.js +53 -0
- package/{index-gyd220p2.js → index-84r80zdx.js} +554 -577
- package/{index-zry5nz81.js → index-8psse8dw.js} +51 -30
- package/index-947t6zm4.js +1119 -0
- package/index-94s080qm.js +266 -0
- package/index-9dp031by.js +12 -0
- package/index-9s5zga3q.js +4300 -0
- package/{index-ws5e0j51.js → index-arnkqb6f.js} +43 -26
- package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
- package/index-c6eggbee.js +123 -0
- package/{index-4edzf1gr.js → index-cxafpw23.js} +77 -150
- package/index-d2242ksy.js +99 -0
- package/index-d5yn19ef.js +700 -0
- package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
- package/{index-2tv3fdx4.js → index-e52z7psd.js} +1212 -1458
- package/{index-a64esmtb.js → index-ew8dna9s.js} +523 -1022
- package/{index-7737gxcp.js → index-f50dy7yq.js} +107 -241
- package/index-f8q701fb.js +1003 -0
- package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
- package/{index-j9yhg404.js → index-ksq4t16z.js} +4 -7
- package/index-nhhrjvk1.js +187 -0
- package/index-p6pbz9n5.js +25 -0
- package/index-ptshj7y1.js +2729 -0
- package/{index-fz5q3gd7.js → index-q9q7x4zj.js} +10 -17
- package/{index-pnqbkf5p.js → index-qk9vv9hm.js} +6 -2
- package/{index-600zhnve.js → index-rqxa9r98.js} +75 -203
- package/{index-ne2qy0nk.js → index-smbecayj.js} +12 -12
- package/{index-ktb5njgy.js → index-vcdxpmsx.js} +49 -99
- package/index-wa5jbxj1.js +760 -0
- package/index-ymnqrsxm.js +69 -0
- package/{index-v0qh106m.js → index-zc90rh75.js} +961 -892
- package/{index-259dsnz3.js → index-zvr7wfyg.js} +5 -8
- package/{index-h7yw2z9n.js → index-zzvvc845.js} +8 -14
- package/index.js +23 -22
- package/{library.command-nbsky672.js → library.command-m52jqc0s.js} +4 -5
- package/{localRegistry.command-yeq57wjr.js → localRegistry.command-x5vs1z43.js} +23 -42
- package/{module.command-29vqzrh8.js → module.command-ty3k6rwd.js} +8 -11
- package/{package.command-axv0abmn.js → package.command-hphdh4g4.js} +6 -7
- package/package.json +15 -7
- package/{page.command-vs9s3zrh.js → page.command-5aq8mzvq.js} +4 -5
- package/{primitive.command-cbxmqbtc.js → primitive.command-adwj84kx.js} +9 -22
- package/prompter-76k56b37.js +8 -0
- package/{quality.command-gmbs7nws.js → quality.command-y10kea2f.js} +205 -377
- package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
- package/{repair.command-bqsjptsj.js → repair.command-v7mwqvjh.js} +11 -35
- package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
- package/{scalar.command-6k1vhe9s.js → scalar.command-pg3gneer.js} +7 -10
- package/skills/akan-code/SKILL.md +130 -0
- package/skills/akan-debug/SKILL.md +42 -0
- package/skills/akan-deps/SKILL.md +50 -0
- package/skills/akan-err/SKILL.md +39 -0
- package/skills/akan-module/SKILL.md +45 -0
- package/skills/akan-scaffold/SKILL.md +76 -0
- package/skills/akan-scalar/SKILL.md +52 -0
- package/skills/akan-service/SKILL.md +34 -0
- package/skills/akan-store/SKILL.md +67 -0
- package/skills/akan-ui/SKILL.md +63 -0
- package/skills/akan-validate/SKILL.md +44 -0
- package/{subspace.command-fwjfcts7.js → subspace.command-ejdmvbq7.js} +138 -67
- 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 → guards.ts} +7 -4
- package/templates/appSample/srvkit/{SessionInternalArg.ts → internalArgs.ts} +6 -4
- package/templates/client.ts +7 -30
- package/templates/crudPages/[__model__Id]/edit/page.tsx +2 -1
- package/templates/crudPages/[__model__Id]/page.tsx +2 -1
- package/templates/crudPages/new/page.tsx +2 -1
- package/templates/crudPages/page.tsx +2 -1
- package/templates/crudSinglePage/page.tsx +2 -1
- package/templates/lib/__lib/lib.dictionary.ts +0 -2
- package/templates/lib/__lib/lib.document.ts +0 -2
- package/templates/lib/sig.ts +8 -30
- package/templates/localDev/docker-compose.yaml.template +3 -14
- package/templates/module/__model__.signal.ts +12 -4
- package/templates/pkgRoot/tsconfig.json.template +2 -7
- package/templates/server.ts +1 -3
- package/templates/service/__model__.abstract.md.template +8 -0
- package/templates/workspaceRoot/.gitignore.template +0 -1
- package/templates/workspaceRoot/package.json.template +1 -3
- package/tunnel.command-rz9qf230.js +129 -0
- package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/workflow.command-6r809r2z.js +79 -0
- package/{workspace.command-8s050m0h.js → workspace.command-8g3cw7jd.js} +77 -109
- package/abstractCompactor-mjh5ppsq.js +0 -101
- package/application.command-pj2m7584.js +0 -204
- package/applicationReleasePackager-4yasxwv9.js +0 -244
- package/capacitorApp-36rbr858.js +0 -12
- package/cloud.command-jshwdq22.js +0 -93
- package/context.command-ez8a0zyz.js +0 -80
- package/devTuiView-c08ccbat.js +0 -9
- package/getDirname-dr3jz1xg.js +0 -7
- package/guideline.command-xmqwx8zm.js +0 -359
- package/guidelines/agentRule/agentRule.generate.json +0 -31
- package/guidelines/componentRule/componentRule.generate.json +0 -31
- package/guidelines/conventions/conventions.generate.json +0 -25
- package/guidelines/cssRule/cssRule.generate.json +0 -31
- package/guidelines/docPageRule/docPageRule.generate.json +0 -31
- package/guidelines/docPageRule/docPageRule.instruction.md +0 -25
- package/guidelines/docSyncRule/docSyncRule.generate.json +0 -31
- package/guidelines/docSyncRule/docSyncRule.instruction.md +0 -25
- package/guidelines/enumConstant/enumConstant.generate.json +0 -31
- package/guidelines/enumConstant/enumConstant.instruction.md +0 -28
- package/guidelines/fieldRule/fieldRule.generate.json +0 -31
- package/guidelines/framework/framework.generate.json +0 -32
- package/guidelines/mcpRule/mcpRule.generate.json +0 -35
- package/guidelines/modelConstant/modelConstant.generate.json +0 -32
- package/guidelines/modelDictionary/modelDictionary.generate.json +0 -32
- package/guidelines/modelDocument/modelDocument.generate.json +0 -31
- package/guidelines/modelService/modelService.generate.json +0 -31
- package/guidelines/modelSignal/modelSignal.generate.json +0 -31
- package/guidelines/modelStore/modelStore.generate.json +0 -31
- package/guidelines/modelTemplate/modelTemplate.generate.json +0 -31
- package/guidelines/modelUnit/modelUnit.generate.json +0 -31
- package/guidelines/modelUtil/modelUtil.generate.json +0 -31
- package/guidelines/modelView/modelView.generate.json +0 -31
- package/guidelines/modelZone/modelZone.generate.json +0 -31
- package/guidelines/moduleCodegen/moduleCodegen.generate.json +0 -31
- package/guidelines/moduleCodegen/moduleCodegen.instruction.md +0 -28
- package/guidelines/moduleOverview/moduleOverview.generate.json +0 -31
- package/guidelines/queryRule/queryRule.generate.json +0 -31
- package/guidelines/recipeRule/recipeRule.generate.json +0 -31
- package/guidelines/runtimeRule/runtimeRule.generate.json +0 -25
- package/guidelines/scalarConstant/scalarConstant.generate.json +0 -32
- package/guidelines/scalarDictionary/scalarDictionary.generate.json +0 -32
- package/guidelines/scalarModule/scalarModule.generate.json +0 -31
- package/guidelines/sharedUiUsage/sharedUiUsage.generate.json +0 -31
- package/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -25
- package/guidelines/ssrRule/ssrRule.generate.json +0 -31
- package/guidelines/transportRule/transportRule.generate.json +0 -31
- package/guidelines/utilUiUsage/utilUiUsage.generate.json +0 -31
- package/guidelines/utilUiUsage/utilUiUsage.instruction.md +0 -25
- package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +0 -24
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +0 -33
- package/index-2hq52jq3.js +0 -465
- package/index-47pj3aee.js +0 -76
- package/index-6wwzs1bc.js +0 -7
- package/index-8pm30m73.js +0 -841
- package/index-kn1h7p1x.js +0 -560
- package/index-meh558jy.js +0 -65
- package/index-rwg2aa4f.js +0 -229
- package/index-w8kmx1b6.js +0 -2176
- package/index-wt7qrtd4.js +0 -1516
- package/templates/__scalar/__model__/__model__.abstract.md +0 -28
- package/templates/module/__model__.abstract.md +0 -28
- package/templates/service/__model__.abstract.md +0 -28
- package/templates/workspaceRoot/patches/react-dom@19.2.7.patch.template +0 -62
- package/workflow.command-nwpcdc8p.js +0 -107
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-1skctzbq.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
} from "./index-
|
|
7
|
+
FileSys2
|
|
8
|
+
} from "./index-52w0fvh8.js";
|
|
9
9
|
import {
|
|
10
10
|
PkgExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-e52z7psd.js";
|
|
12
12
|
import {
|
|
13
13
|
TypeScriptDependencyScanner2
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-2ahj896a.js";
|
|
15
15
|
|
|
16
16
|
// pkgs/@akanjs/cli/package/package.runner.ts
|
|
17
17
|
import path2 from "path";
|
|
@@ -112,7 +112,7 @@ class PackageRunner extends runner("package") {
|
|
|
112
112
|
"create-akan-workspace"
|
|
113
113
|
];
|
|
114
114
|
async version(workspace, { log = true } = {}) {
|
|
115
|
-
const pkgJson = process.env.USE_AKANJS_PKGS === "true" ? await
|
|
115
|
+
const pkgJson = process.env.USE_AKANJS_PKGS === "true" ? await FileSys2.readJson(`${workspace?.workspaceRoot ?? process.cwd()}/pkgs/akanjs/package.json`) : await this.#getInstalledPackageJson();
|
|
116
116
|
const version = pkgJson.name === "akanjs" ? pkgJson.version : pkgJson.dependencies?.akanjs ?? pkgJson.version;
|
|
117
117
|
if (log)
|
|
118
118
|
Logger.rawLog(`akanjs@${version}`);
|
|
@@ -129,14 +129,19 @@ class PackageRunner extends runner("package") {
|
|
|
129
129
|
for (const packageJsonPath of packageJsonCandidates) {
|
|
130
130
|
if (!await Bun.file(packageJsonPath).exists())
|
|
131
131
|
continue;
|
|
132
|
-
const packageJson = await
|
|
132
|
+
const packageJson = await FileSys2.readJson(packageJsonPath);
|
|
133
133
|
if (packageJson.name === "akanjs" || packageJson.name === "@akanjs/cli")
|
|
134
134
|
return packageJson;
|
|
135
135
|
}
|
|
136
136
|
throw new Error(`[package] failed to locate akanjs package.json from ${path2.dirname(Bun.main)}`);
|
|
137
137
|
}
|
|
138
138
|
async createPackage(workspace, pkgName) {
|
|
139
|
-
|
|
139
|
+
const workspaceRootPath = ["pkgs", ...pkgName.split("/")].map(() => "..").join("/");
|
|
140
|
+
await workspace.applyTemplate({
|
|
141
|
+
basePath: `pkgs/${pkgName}`,
|
|
142
|
+
template: "pkgRoot",
|
|
143
|
+
dict: { pkgName, workspaceRootPath }
|
|
144
|
+
});
|
|
140
145
|
await workspace.setPkgTsPaths(pkgName);
|
|
141
146
|
}
|
|
142
147
|
async removePackage(pkg) {
|
|
@@ -144,8 +149,7 @@ class PackageRunner extends runner("package") {
|
|
|
144
149
|
await pkg.workspace.unsetPkgTsPaths(pkg.name);
|
|
145
150
|
}
|
|
146
151
|
async scanSync(pkg) {
|
|
147
|
-
|
|
148
|
-
return scanResult;
|
|
152
|
+
return await pkg.scan();
|
|
149
153
|
}
|
|
150
154
|
async buildPackage(pkg) {
|
|
151
155
|
await $`rm -rf ${pkg.dist.cwdPath}`;
|
|
@@ -153,7 +157,14 @@ class PackageRunner extends runner("package") {
|
|
|
153
157
|
const scanner = await TypeScriptDependencyScanner2.from(pkg);
|
|
154
158
|
const { npmDeps, npmDevDeps, missingDeps } = await scanner.getPackageBuildDependencies(pkg.name);
|
|
155
159
|
const packageRuntimeDependencies = {
|
|
156
|
-
"@akanjs/devkit": [
|
|
160
|
+
"@akanjs/devkit": [
|
|
161
|
+
"tailwind-scrollbar",
|
|
162
|
+
"@earendil-works/chord",
|
|
163
|
+
"@earendil-works/pi-agent-core",
|
|
164
|
+
"@earendil-works/pi-ai",
|
|
165
|
+
"@earendil-works/pi-telemetry",
|
|
166
|
+
"@earendil-works/pi-tui"
|
|
167
|
+
]
|
|
157
168
|
};
|
|
158
169
|
const packageRuntimeDevDependencies = { akanjs: ["@biomejs/biome", "@types/bun"] };
|
|
159
170
|
if (pkg.name === "@akanjs/cli") {
|
|
@@ -164,17 +175,23 @@ class PackageRunner extends runner("package") {
|
|
|
164
175
|
].filter((dep) => dep !== "akanjs" && dep !== "@akanjs/devkit");
|
|
165
176
|
}
|
|
166
177
|
const packageBundledRuntimeDependencies = {
|
|
167
|
-
"@akanjs/cli": ["@akanjs/devkit"],
|
|
168
|
-
akanjs: ["
|
|
178
|
+
"@akanjs/cli": ["@akanjs/devkit", "@akanjs/native"],
|
|
179
|
+
"@akanjs/devkit": ["@akanjs/native"],
|
|
180
|
+
akanjs: ["use-agentic", "@akanjs/native"]
|
|
169
181
|
};
|
|
170
182
|
const bundledRuntimeDeps = new Set(packageBundledRuntimeDependencies[pkg.name] ?? []);
|
|
171
183
|
const forcedRuntimeDeps = packageRuntimeDependencies[pkg.name] ?? [];
|
|
172
184
|
const forcedRuntimeDevDeps = packageRuntimeDevDependencies[pkg.name] ?? [];
|
|
173
185
|
const [rootPackageJson, pkgJson] = await Promise.all([pkg.workspace.getPackageJson(), pkg.getPackageJson()]);
|
|
174
186
|
const optionalPeerDeps = new Set(Object.entries(pkgJson.peerDependenciesMeta ?? {}).filter(([, meta]) => meta.optional).map(([dep]) => dep));
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
const
|
|
187
|
+
const isShipped = (dep) => !optionalPeerDeps.has(dep) && !bundledRuntimeDeps.has(dep);
|
|
188
|
+
const packageRuntimeDeps = [...new Set([...npmDeps, ...forcedRuntimeDeps])].filter(isShipped);
|
|
189
|
+
const packageRuntimeDevDeps = [...new Set([...npmDevDeps, ...forcedRuntimeDevDeps])].filter(isShipped);
|
|
190
|
+
const rootDeps = {
|
|
191
|
+
...rootPackageJson.overrides,
|
|
192
|
+
...rootPackageJson.dependencies,
|
|
193
|
+
...rootPackageJson.devDependencies
|
|
194
|
+
};
|
|
178
195
|
const missingForcedDeps = forcedRuntimeDeps.filter((dep) => !rootDeps[dep]);
|
|
179
196
|
const missingForcedDevDeps = forcedRuntimeDevDeps.filter((dep) => !rootDeps[dep]);
|
|
180
197
|
const requiredMissingDeps = missingDeps.filter((dep) => !optionalPeerDeps.has(dep));
|
|
@@ -192,7 +209,8 @@ class PackageRunner extends runner("package") {
|
|
|
192
209
|
stdio: "inherit"
|
|
193
210
|
});
|
|
194
211
|
} else {
|
|
195
|
-
await
|
|
212
|
+
await pkg.dist.cp(pkg.cwdPath, pkg.dist.cwdPath);
|
|
213
|
+
await $`rm -rf ${pkg.dist.cwdPath}/local`;
|
|
196
214
|
await Promise.all([
|
|
197
215
|
pkg.generateDistPackageJson(packageRuntimeDeps, packageRuntimeDevDeps),
|
|
198
216
|
pkg.generateTsconfigJson()
|
|
@@ -266,7 +284,7 @@ class PackageRunner extends runner("package") {
|
|
|
266
284
|
if (!await Bun.file(distPackageJsonPath).exists()) {
|
|
267
285
|
throw new Error(`[package] dist package not found for ${pkg.name}. Run build-package first.`);
|
|
268
286
|
}
|
|
269
|
-
const pkgJson = await
|
|
287
|
+
const pkgJson = await FileSys2.readJson(distPackageJsonPath);
|
|
270
288
|
if (pkgJson.name !== pkg.name) {
|
|
271
289
|
throw new Error(`[package] dist package name mismatch: expected ${pkg.name}, got ${pkgJson.name ?? "(missing)"}`);
|
|
272
290
|
}
|
|
@@ -275,12 +293,9 @@ class PackageRunner extends runner("package") {
|
|
|
275
293
|
if (pkgJson.publishConfig?.access !== "public") {
|
|
276
294
|
throw new Error(`[package] ${pkg.name} must publish with publishConfig.access=public`);
|
|
277
295
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
if (!await Bun.file(`${pkg.dist.cwdPath}/README.ko.md`).exists()) {
|
|
282
|
-
throw new Error(`[package] README.ko.md is missing from dist package ${pkg.name}`);
|
|
283
|
-
}
|
|
296
|
+
for (const readme of ["README.md", "README.ko.md"])
|
|
297
|
+
if (!await Bun.file(`${pkg.dist.cwdPath}/${readme}`).exists())
|
|
298
|
+
throw new Error(`[package] ${readme} is missing from dist package ${pkg.name}`);
|
|
284
299
|
const binEntries = typeof pkgJson.bin === "string" ? [pkgJson.bin] : Object.values(pkgJson.bin ?? {});
|
|
285
300
|
if (binEntries.some((binPath) => binPath.endsWith(".ts"))) {
|
|
286
301
|
throw new Error(`[package] ${pkg.name} dist bin entries must not point at TypeScript sources`);
|
|
@@ -297,6 +312,9 @@ class PackageRunner extends runner("package") {
|
|
|
297
312
|
cwd: pkg.workspace.workspaceRoot
|
|
298
313
|
});
|
|
299
314
|
const [packResult] = JSON.parse(packOutput);
|
|
315
|
+
const localFiles = (packResult?.files ?? []).filter((file) => file.path?.startsWith("local/"));
|
|
316
|
+
if (localFiles.length > 0)
|
|
317
|
+
throw new Error(`[package] ${pkg.name} would publish ${localFiles.length} test-run files under local/`);
|
|
300
318
|
return {
|
|
301
319
|
name: pkg.name,
|
|
302
320
|
version: pkgJson.version,
|
|
@@ -313,9 +331,8 @@ class PackageRunner extends runner("package") {
|
|
|
313
331
|
peerExportsMaps.set(pkg.name, await PackageExportsMap.from(pkg.dist.cwdPath));
|
|
314
332
|
}
|
|
315
333
|
const results = [];
|
|
316
|
-
for (const pkg of pkgs)
|
|
334
|
+
for (const pkg of pkgs)
|
|
317
335
|
results.push(await this.verifyDistPackage(pkg, { peerExportsMaps }));
|
|
318
|
-
}
|
|
319
336
|
return results;
|
|
320
337
|
}
|
|
321
338
|
async#copyPackageReadmes(pkg) {
|
|
@@ -14,25 +14,26 @@ class LibSource {
|
|
|
14
14
|
const relative = file.slice(this.#prefix.length);
|
|
15
15
|
return !LibSource.unhashedDirs.includes(relative.split("/")[0] ?? "");
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
if (file !== `${this.#prefix}package.json`)
|
|
20
|
-
return content;
|
|
21
|
-
const manifest = JSON.parse(content);
|
|
17
|
+
static unstamped(manifestContent) {
|
|
18
|
+
const manifest = JSON.parse(manifestContent);
|
|
22
19
|
delete manifest[LibSource.manifestKey];
|
|
23
20
|
return JSON.stringify(manifest);
|
|
24
21
|
}
|
|
25
|
-
async
|
|
26
|
-
const files = (await this.#lib.workspace.listGitFiles([`libs/${this.#lib.name}`], { untracked: true })).filter((file) => this.#isHashed(file));
|
|
22
|
+
static async hashFiles(files, manifestFile, read) {
|
|
27
23
|
const hasher = new Bun.CryptoHasher("sha256");
|
|
28
24
|
for (const file of files) {
|
|
25
|
+
const content = await read(file);
|
|
29
26
|
hasher.update(file);
|
|
30
27
|
hasher.update("\x00");
|
|
31
|
-
hasher.update(
|
|
28
|
+
hasher.update(file === manifestFile ? LibSource.unstamped(content) : content);
|
|
32
29
|
hasher.update("\x00");
|
|
33
30
|
}
|
|
34
31
|
return hasher.digest("hex").slice(0, 32);
|
|
35
32
|
}
|
|
33
|
+
async computeHash() {
|
|
34
|
+
const files = (await this.#lib.workspace.listGitFiles([`libs/${this.#lib.name}`], { untracked: true })).filter((file) => this.#isHashed(file));
|
|
35
|
+
return await LibSource.hashFiles(files, `${this.#prefix}package.json`, (file) => this.#lib.workspace.readFile(file));
|
|
36
|
+
}
|
|
36
37
|
async read() {
|
|
37
38
|
const manifest = await this.#lib.getPackageJson();
|
|
38
39
|
const akan = manifest[LibSource.manifestKey];
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/codeAgent/agent/akanCodeModel.ts
|
|
3
|
+
var akanCodeDefaultModel2 = { provider: "deepseek", id: "deepseek-flash" };
|
|
4
|
+
var catalogueMissesImages = new Set(["deepseek/deepseek-v4-flash"]);
|
|
5
|
+
var correctInputs = (model) => {
|
|
6
|
+
if (!model || model.input.includes("image"))
|
|
7
|
+
return model;
|
|
8
|
+
if (!catalogueMissesImages.has(`${model.provider}/${model.id}`))
|
|
9
|
+
return model;
|
|
10
|
+
return { ...model, input: [...model.input, "image"] };
|
|
11
|
+
};
|
|
12
|
+
var akanCodeModel2 = async (runtime, ref) => {
|
|
13
|
+
if (ref) {
|
|
14
|
+
const requested = runtime.getModel(ref.provider, ref.id);
|
|
15
|
+
if (!requested)
|
|
16
|
+
throw new Error(`Unknown model: ${ref.provider}/${ref.id}`);
|
|
17
|
+
if (!runtime.hasConfiguredAuth(ref.provider))
|
|
18
|
+
throw new Error(`No API key configured for ${ref.provider}. Set ${ref.provider.toUpperCase()}_API_KEY.`);
|
|
19
|
+
return correctInputs(requested);
|
|
20
|
+
}
|
|
21
|
+
const fallback = runtime.getModel(akanCodeDefaultModel2.provider, akanCodeDefaultModel2.id);
|
|
22
|
+
if (fallback && runtime.hasConfiguredAuth(fallback.provider))
|
|
23
|
+
return correctInputs(fallback);
|
|
24
|
+
return correctInputs((await runtime.getAvailable())[0]);
|
|
25
|
+
};
|
|
26
|
+
var akanCodeModelSupportsImages2 = (model) => !!model?.input.includes("image");
|
|
27
|
+
var akanCodeModelWarnings2 = (model, compactionFloor) => {
|
|
28
|
+
if (!model)
|
|
29
|
+
return [];
|
|
30
|
+
if (model.contextWindow >= compactionFloor)
|
|
31
|
+
return [];
|
|
32
|
+
return [
|
|
33
|
+
`${model.provider}/${model.id} declares a ${model.contextWindow}-token context window, below the ${compactionFloor} the compaction policy needs, so every turn will compact immediately. Check the model entry in ~/.akan/code/models.json.`
|
|
34
|
+
];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// pkgs/@akanjs/devkit/codeAgent/agent/CodeAgentStreamPrinter.ts
|
|
38
|
+
import { codeAgentEventLabel } from "akanjs/common";
|
|
39
|
+
import chalk from "chalk";
|
|
40
|
+
|
|
41
|
+
class CodeAgentStreamPrinter2 {
|
|
42
|
+
#options;
|
|
43
|
+
#write;
|
|
44
|
+
#streaming = false;
|
|
45
|
+
constructor(options = {}) {
|
|
46
|
+
this.#options = options;
|
|
47
|
+
this.#write = options.write ?? ((text) => process.stdout.write(text));
|
|
48
|
+
}
|
|
49
|
+
print(event) {
|
|
50
|
+
if (this.#options.json)
|
|
51
|
+
return this.#write(`${JSON.stringify(event)}
|
|
52
|
+
`);
|
|
53
|
+
switch (event.type) {
|
|
54
|
+
case "text_delta":
|
|
55
|
+
this.#streaming = true;
|
|
56
|
+
return this.#write(event.text);
|
|
57
|
+
case "thinking_delta":
|
|
58
|
+
if (!this.#options.thinking)
|
|
59
|
+
return;
|
|
60
|
+
this.#streaming = true;
|
|
61
|
+
return this.#write(chalk.dim(event.text));
|
|
62
|
+
case "tool_start":
|
|
63
|
+
return this.#line(chalk.cyan(`\u2192 ${event.tool.title}`));
|
|
64
|
+
case "tool_end":
|
|
65
|
+
return this.#line(CodeAgentStreamPrinter2.#toolEnd(event));
|
|
66
|
+
case "session":
|
|
67
|
+
return this.#line(chalk.dim(codeAgentEventLabel(event)));
|
|
68
|
+
case "turn_end":
|
|
69
|
+
if (event.stopReason === "truncated")
|
|
70
|
+
return this.#line(chalk.yellow(codeAgentEventLabel(event)));
|
|
71
|
+
return;
|
|
72
|
+
case "message":
|
|
73
|
+
case "tool_progress":
|
|
74
|
+
case "turn_start":
|
|
75
|
+
case "idle":
|
|
76
|
+
case "queue":
|
|
77
|
+
case "context":
|
|
78
|
+
case "subagent":
|
|
79
|
+
return;
|
|
80
|
+
case "question":
|
|
81
|
+
return this.#line(chalk.yellow(`? ${event.question.prompt}`));
|
|
82
|
+
case "approval":
|
|
83
|
+
return this.#line(chalk.yellow(`approve? ${event.request.summary}`));
|
|
84
|
+
case "notice":
|
|
85
|
+
return this.#line(CodeAgentStreamPrinter2.#notice(event.level, event.message));
|
|
86
|
+
case "error":
|
|
87
|
+
return this.#line(chalk.red(`error: ${event.message}`));
|
|
88
|
+
default:
|
|
89
|
+
return this.#line(chalk.dim(codeAgentEventLabel(event)));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
finish() {
|
|
93
|
+
if (this.#streaming)
|
|
94
|
+
this.#write(`
|
|
95
|
+
`);
|
|
96
|
+
this.#streaming = false;
|
|
97
|
+
}
|
|
98
|
+
#line(text) {
|
|
99
|
+
if (this.#streaming)
|
|
100
|
+
this.#write(`
|
|
101
|
+
`);
|
|
102
|
+
this.#streaming = false;
|
|
103
|
+
this.#write(`${text}
|
|
104
|
+
`);
|
|
105
|
+
}
|
|
106
|
+
static #toolEnd(event) {
|
|
107
|
+
if (event.outcome === "ok")
|
|
108
|
+
return chalk.green(`\u2713 ${event.tool.title}`);
|
|
109
|
+
if (event.outcome === "blocked")
|
|
110
|
+
return chalk.yellow(`\u29B8 ${event.tool.title} \u2014 ${event.output}`);
|
|
111
|
+
return chalk.red(`\u2717 ${event.tool.title} \u2014 ${event.output.split(`
|
|
112
|
+
`)[0] ?? ""}`);
|
|
113
|
+
}
|
|
114
|
+
static #notice(level, message) {
|
|
115
|
+
if (level === "error")
|
|
116
|
+
return chalk.red(message);
|
|
117
|
+
if (level === "warning")
|
|
118
|
+
return chalk.yellow(message);
|
|
119
|
+
return chalk.dim(message);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export { akanCodeDefaultModel2, akanCodeModel2, akanCodeModelSupportsImages2, akanCodeModelWarnings2, CodeAgentStreamPrinter2 };
|