@akanjs/cli 3.1.1-rc.9 → 3.1.2-rc.0
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-dyc45f5w.js +11 -0
- package/{CodeAgentRpcHost-9g27hmer.js → CodeAgentRpcHost-6dzfkvsc.js} +1 -1
- package/CodeAgentRpcListener-tcwrdvst.js +182 -0
- package/{CodeTui-z5vkm9ea.js → CodeTui-q55b2zrn.js} +25 -8
- package/TunnelShare-hdq9h1hr.js +14 -0
- package/agent.command-20zaqe60.js +49 -0
- package/akanCode.js +13 -8
- package/{application.command-wthg8nn9.js → application.command-nd0fshsk.js} +45 -12
- package/{applicationBuildRunner-t2r84sz6.js → applicationBuildRunner-s13x3zqb.js} +14 -10
- package/buildBatch.proc.js +7 -7
- package/{cloud.command-sz11hpre.js → cloud.command-8kbddsz9.js} +28 -19
- package/cloud.script-hgvvajm3.js +27 -0
- package/code.command-625bg8s8.js +345 -0
- package/commandManifest.json +1 -1
- package/{context.command-15j9b7c0.js → context.command-p6haqjay.js} +20 -18
- package/context.runner-rsnqnk9j.js +27 -0
- package/{dependencyScanner-3afj2vt1.js → dependencyScanner-78sq8m4q.js} +2 -2
- package/{devTui-q7k7bakd.js → devTui-evr3b35y.js} +1 -1
- package/{fileSys-wzzrntkw.js → fileSys-zpvt5gtf.js} +1 -1
- package/{guideline.command-snh85ctf.js → guideline.command-195g0h9a.js} +4 -4
- package/guidelines/agentRule/agentRule.instruction.md +22 -8
- package/guidelines/conventions/core.md +106 -0
- package/guidelines/conventions/rules/app.md +83 -0
- package/guidelines/conventions/rules/auth.md +46 -0
- package/guidelines/conventions/rules/config.md +60 -0
- package/guidelines/conventions/rules/constant.md +24 -0
- package/guidelines/conventions/rules/gates.md +32 -0
- package/guidelines/conventions/rules/layer.md +25 -0
- package/guidelines/conventions/rules/migration.md +27 -0
- package/guidelines/conventions/rules/module.md +90 -0
- package/guidelines/conventions/rules/page.md +56 -0
- package/guidelines/conventions/rules/sensitive.md +16 -0
- package/guidelines/conventions/rules/server.md +91 -0
- package/guidelines/conventions/rules/ssr.md +47 -0
- package/guidelines/conventions/rules/style.md +43 -0
- package/guidelines/conventions/rules/test.md +34 -0
- package/guidelines/conventions/rules/ts.md +95 -0
- package/guidelines/conventions/rules/tsx.md +76 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +1 -1
- package/guidelines/pageRule/pageRule.instruction.md +8 -7
- package/guidelines/queryRule/queryRule.instruction.md +4 -0
- package/guidelines/runtimeRule/runtimeRule.instruction.md +35 -25
- package/guidelines/ssrRule/ssrRule.instruction.md +11 -10
- package/guidelines/transportRule/transportRule.instruction.md +5 -4
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +4 -4
- package/incrementalBuilder.proc.js +7 -7
- package/{index-301pdbzz.js → index-00a7j05x.js} +7 -7
- package/{index-js6geqjn.js → index-0j1t1h2b.js} +3 -1
- package/{index-6txx6a9p.js → index-1h2jc0x3.js} +154 -88
- package/{index-55j120r8.js → index-1qsd8ft1.js} +65 -145
- package/{index-9th4gszy.js → index-2mwjshz5.js} +233 -1271
- package/index-2nxk8wgs.js +266 -0
- package/{index-j9vyj3dj.js → index-2phm56a1.js} +49 -8
- package/index-35j83zkd.js +61 -0
- package/index-4am4dvmf.js +29 -0
- package/index-75y7bcz4.js +28 -0
- package/index-7apsdr5g.js +487 -0
- package/{index-42j4a8zq.js → index-84h43kg6.js} +8 -6
- package/index-9bv479q5.js +1 -0
- package/{index-3wypz6xj.js → index-9zy8479y.js} +11 -5
- package/{index-a5dhqkdr.js → index-a1vb3x7t.js} +273 -259
- package/{index-52w0fvh8.js → index-bns3wcpc.js} +15 -0
- package/index-cjmjvg4r.js +3622 -0
- package/{index-pcwzkdqb.js → index-defp4gmb.js} +1 -1
- package/index-ewbmfarf.js +1606 -0
- package/index-fbewhg4g.js +590 -0
- package/index-fhw7yq2d.js +653 -0
- package/{index-wcej7g4z.js → index-g500c5j9.js} +271 -105
- package/{index-74tjjsnc.js → index-g841cap9.js} +33 -37
- package/{index-2azahjaw.js → index-gr9thy79.js} +5 -5
- package/{index-4pf8g7ff.js → index-h7hehkw6.js} +3 -0
- package/{index-xjf5j657.js → index-hm0tn7qv.js} +1001 -91
- package/index-j6eeh5d7.js +138 -0
- package/{index-31es1yev.js → index-j7hwy56s.js} +108 -7
- package/{index-skk9zc1x.js → index-jc2zbwra.js} +2 -2
- package/{index-905qdgqp.js → index-khk05tsf.js} +1 -1
- package/{index-5nd1wtkv.js → index-p6x5b7hr.js} +1 -1
- package/{index-tvehn2sp.js → index-qd7xn2bk.js} +1 -1
- package/{index-a58emady.js → index-qw6814m4.js} +55 -17
- package/index-raz588b3.js +445 -0
- package/{index-at7bz0xq.js → index-s4nvxpzm.js} +2 -0
- package/{index-bt438yxm.js → index-sp0qsr7a.js} +116 -13
- package/{index-xb8809yb.js → index-sveq36gh.js} +40 -43
- package/{index-hmt54t45.js → index-t1t9wq9a.js} +4 -4
- package/index-t78230d7.js +191 -0
- package/index-tenw3mah.js +225 -0
- package/{index-qfp55x1y.js → index-tgqameyb.js} +4 -4
- package/{index-espk51ah.js → index-tp56652m.js} +6 -6
- package/index-w15mg3km.js +389 -0
- package/{index-dy0jx9ay.js → index-wwe9rsrx.js} +14 -0
- package/{index-2xcc2ax5.js → index-y4kcmbt2.js} +2 -2
- package/index-yf9wc28h.js +52 -0
- package/{index-0fz95kxe.js → index-zbrwnmf1.js} +9 -7
- package/{index-40brg4px.js → index-zttm13c3.js} +5 -5
- package/index.js +24 -23
- package/{library.command-gycrwhf1.js → library.command-63hgt9te.js} +4 -4
- package/{localRegistry.command-jtd8gaes.js → localRegistry.command-g3f8k25t.js} +46 -22
- package/{module.command-v6hgs1bc.js → module.command-r4sa2khp.js} +7 -6
- package/{package.command-shzpcfph.js → package.command-96eheyvd.js} +5 -5
- package/package.json +2 -2
- package/{page.command-ptxn5kqk.js → page.command-gs6d841d.js} +4 -4
- package/{pipeline.command-zz31pgax.js → pipeline.command-wdfvdbfj.js} +3 -3
- package/{primitive.command-a1vse91z.js → primitive.command-dfsv4mpe.js} +8 -7
- package/{projectTypecheck-2ztky9cf.js → projectTypecheck-kqj1t6hb.js} +1 -1
- package/{prompter-76k56b37.js → prompter-qrwx1p17.js} +2 -2
- package/quality.command-webzxee2.js +78 -0
- package/{repair.command-cvazbz99.js → repair.command-3r3j1xre.js} +7 -6
- package/{routeSourceValidator-6jd0q6r6.js → routeSourceValidator-4h947v7c.js} +13 -3
- package/{scalar.command-0acvyp26.js → scalar.command-e8y47j6d.js} +6 -5
- package/skills/akan-agent/SKILL.md +43 -0
- package/skills/akan-code/SKILL.md +38 -11
- package/skills/akan-debug/SKILL.md +41 -6
- package/skills/akan-deps/SKILL.md +1 -2
- package/skills/akan-err/SKILL.md +2 -1
- package/skills/akan-mcp/SKILL.md +40 -0
- package/skills/akan-page/SKILL.md +44 -0
- package/skills/akan-query/SKILL.md +39 -0
- package/skills/akan-runtime/SKILL.md +43 -0
- package/skills/akan-scaffold/SKILL.md +16 -6
- package/skills/akan-transport/SKILL.md +40 -0
- package/skills/akan-validate/SKILL.md +13 -11
- package/{subspace.command-822qx2bx.js → subspace.command-a1sf9n5a.js} +12 -10
- package/templates/__scalar/__model__/__model__.constant.ts +3 -5
- package/templates/__scalar/__model__/__model__.dictionary.ts +6 -5
- package/templates/__scalar/__model__/__model__.document.ts +3 -3
- package/templates/app/akan.config.ts +2 -3
- package/templates/app/env/env.client.ts +2 -4
- package/templates/app/env/env.client.type.ts +2 -3
- package/templates/app/env/env.server.ts +2 -3
- package/templates/app/lib/___appName__/__appName__.dictionary.ts +1 -2
- package/templates/app/lib/___appName__/__appName__.service.ts +3 -3
- package/templates/app/lib/___appName__/__appName__.signal.ts +5 -5
- package/templates/app/lib/___appName__/__appName__.store.ts +4 -6
- package/templates/app/lib/option.ts +2 -3
- package/templates/app/main.ts +2 -4
- package/templates/app/page/_index.tsx +3 -3
- package/templates/app/page/_layout.tsx +13 -10
- package/templates/appSample/lib/__scalar/workHistory/workHistory.constant.ts +1 -5
- package/templates/appSample/lib/__scalar/workHistory/workHistory.dictionary.ts +1 -1
- package/templates/appSample/lib/_noti/noti.signal.ts +1 -1
- package/templates/appSample/lib/task/Task.Template.tsx +2 -1
- package/templates/appSample/lib/task/Task.Unit.tsx +3 -2
- package/templates/appSample/lib/task/Task.Util.tsx +16 -4
- package/templates/appSample/lib/task/task.constant.ts +1 -5
- package/templates/appSample/lib/task/task.dictionary.ts +2 -8
- package/templates/appSample/lib/task/task.document.ts +1 -1
- package/templates/appSample/lib/task/task.signal.ts +14 -9
- package/templates/appSample/page/task/_index.tsx +2 -1
- package/templates/appSample/page/task/new.tsx +2 -1
- package/templates/appSample/srvkit/guards.ts +11 -0
- package/templates/appSample/ui/QuantityControl.tsx +5 -9
- package/templates/biomeForm.ts +144 -0
- package/templates/crudPages/[__model__Id]/edit/page.tsx +3 -3
- package/templates/crudPages/[__model__Id]/page.tsx +5 -5
- package/templates/crudPages/new/page.tsx +4 -3
- package/templates/crudPages/page.tsx +3 -3
- package/templates/crudSinglePage/page.tsx +9 -5
- package/templates/libRoot/akan.config.ts +2 -3
- package/templates/libRoot/lib/___libName__/__libName__.dictionary.ts +1 -2
- package/templates/libRoot/lib/___libName__/__libName__.service.ts +5 -4
- package/templates/libRoot/lib/___libName__/__libName__.signal.ts +6 -5
- package/templates/libRoot/lib/___libName__/__libName__.store.ts +5 -6
- package/templates/libRoot/lib/option.ts +1 -2
- package/templates/module/__Model__.Template.tsx +11 -10
- package/templates/module/__Model__.Unit.tsx +18 -5
- package/templates/module/__Model__.Util.tsx +9 -7
- package/templates/module/__Model__.View.tsx +9 -6
- package/templates/module/__Model__.Zone.tsx +25 -17
- package/templates/module/__model__.constant.ts +8 -9
- package/templates/module/__model__.dictionary.ts +16 -17
- package/templates/module/__model__.document.ts +6 -8
- package/templates/module/__model__.service.ts +3 -3
- package/templates/module/__model__.signal.ts +11 -10
- package/templates/module/__model__.store.ts +3 -5
- package/templates/service/__model__.dictionary.ts +5 -6
- package/templates/service/__model__.service.ts +3 -3
- package/templates/service/__model__.signal.ts +5 -4
- package/templates/service/__model__.store.ts +3 -5
- package/templates/workspaceRoot/.gitignore.template +4 -0
- package/templates/workspaceRoot/.vscode/settings.json.template +21 -21
- package/templates/workspaceRoot/AGENTS.md.template +4 -10
- package/{tunnel.command-ycmja19q.js → tunnel.command-dcb0wg93.js} +25 -13
- package/{typeChecker-px49mezc.js → typeChecker-j2jdnqsr.js} +1 -1
- package/typecheck.proc.js +6 -1
- package/verify.command-yyepccbh.js +93 -0
- package/{workflow.command-abb1d5xy.js → workflow.command-z5pg9ay0.js} +49 -14
- package/workspace.command-d7x5jttw.js +290 -0
- package/CodeAgent-8d5qs787.js +0 -9
- package/CodeAgentRpcListener-7p7z5dd7.js +0 -97
- package/TunnelShare-qkm8zp03.js +0 -14
- package/agent.command-ydftceda.js +0 -25
- package/cloud.script-nqevg5qw.js +0 -24
- package/code.command-9h3yrzhe.js +0 -167
- package/context.runner-8gg030b0.js +0 -25
- package/guidelines/conventions/conventions.instruction.md +0 -617
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +0 -291
- package/index-2mwc0g0d.js +0 -49
- package/index-4vgbysa0.js +0 -279
- package/index-7md2g9vw.js +0 -6
- package/index-b70zct19.js +0 -856
- package/index-c6eggbee.js +0 -123
- package/index-zzvvc845.js +0 -74
- package/quality.command-ah8qcakd.js +0 -1478
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +0 -69
- package/templates/workspaceRoot/docs/GENERATED.md.template +0 -55
- package/workspace.command-qm7cw29v.js +0 -521
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// pkgs/@akanjs/devkit/codeAgent/agent/CodeAgentRpcListener.ts
|
|
3
|
-
import { existsSync, rmSync } from "fs";
|
|
4
|
-
|
|
5
|
-
class CodeAgentRpcListener {
|
|
6
|
-
#host;
|
|
7
|
-
#address;
|
|
8
|
-
#listener = null;
|
|
9
|
-
#client = null;
|
|
10
|
-
constructor(host, address) {
|
|
11
|
-
this.#host = host;
|
|
12
|
-
this.#address = address;
|
|
13
|
-
}
|
|
14
|
-
static parse(spec) {
|
|
15
|
-
if (spec.startsWith("unix:"))
|
|
16
|
-
return { unix: spec.slice("unix:".length) };
|
|
17
|
-
const rest = spec.startsWith("tcp:") ? spec.slice("tcp:".length) : spec;
|
|
18
|
-
const separator = rest.lastIndexOf(":");
|
|
19
|
-
const hostname = separator >= 0 ? rest.slice(0, separator) : "127.0.0.1";
|
|
20
|
-
const port = Number(separator >= 0 ? rest.slice(separator + 1) : rest);
|
|
21
|
-
if (!Number.isInteger(port) || port < 0 || port > 65535)
|
|
22
|
-
throw new Error(`--rpc-listen takes unix:<path> or tcp:[host:]<port>, not "${spec}"`);
|
|
23
|
-
return { hostname: hostname || "127.0.0.1", port };
|
|
24
|
-
}
|
|
25
|
-
get port() {
|
|
26
|
-
return this.#listener && "port" in this.#listener ? this.#listener.port : null;
|
|
27
|
-
}
|
|
28
|
-
listen() {
|
|
29
|
-
if ("unix" in this.#address && existsSync(this.#address.unix))
|
|
30
|
-
rmSync(this.#address.unix);
|
|
31
|
-
const socket = {
|
|
32
|
-
open: (client) => this.#open(client),
|
|
33
|
-
data: (client, data) => this.#data(client, data),
|
|
34
|
-
drain: (client) => this.#drain(client),
|
|
35
|
-
close: (client) => this.#close(client),
|
|
36
|
-
error: (client) => this.#close(client)
|
|
37
|
-
};
|
|
38
|
-
this.#listener = "unix" in this.#address ? Bun.listen({ unix: this.#address.unix, socket }) : Bun.listen({ hostname: this.#address.hostname, port: this.#address.port, socket });
|
|
39
|
-
this.#host.start();
|
|
40
|
-
return this;
|
|
41
|
-
}
|
|
42
|
-
async serve() {
|
|
43
|
-
if (!this.#listener)
|
|
44
|
-
this.listen();
|
|
45
|
-
await this.#host.shutdown;
|
|
46
|
-
this.stop();
|
|
47
|
-
}
|
|
48
|
-
stop() {
|
|
49
|
-
this.#client?.end();
|
|
50
|
-
this.#client = null;
|
|
51
|
-
this.#host.attach(null);
|
|
52
|
-
this.#listener?.stop(true);
|
|
53
|
-
this.#listener = null;
|
|
54
|
-
if ("unix" in this.#address && existsSync(this.#address.unix))
|
|
55
|
-
rmSync(this.#address.unix);
|
|
56
|
-
}
|
|
57
|
-
#open(client) {
|
|
58
|
-
client.data = { pending: null, decoder: new TextDecoder };
|
|
59
|
-
const previous = this.#client;
|
|
60
|
-
this.#client = client;
|
|
61
|
-
previous?.end();
|
|
62
|
-
this.#host.attach((line) => this.#write(client, line));
|
|
63
|
-
}
|
|
64
|
-
#data(client, data) {
|
|
65
|
-
if (client !== this.#client)
|
|
66
|
-
return;
|
|
67
|
-
this.#host.feed(client.data.decoder.decode(data, { stream: true }));
|
|
68
|
-
}
|
|
69
|
-
#write(client, line) {
|
|
70
|
-
if (client !== this.#client)
|
|
71
|
-
return;
|
|
72
|
-
const bytes = Buffer.from(line);
|
|
73
|
-
if (client.data.pending) {
|
|
74
|
-
client.data.pending = Buffer.concat([client.data.pending, bytes]);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const written = client.write(bytes);
|
|
78
|
-
if (written < bytes.length)
|
|
79
|
-
client.data.pending = bytes.subarray(Math.max(0, written));
|
|
80
|
-
}
|
|
81
|
-
#drain(client) {
|
|
82
|
-
const pending = client.data.pending;
|
|
83
|
-
if (!pending)
|
|
84
|
-
return;
|
|
85
|
-
const written = client.write(pending);
|
|
86
|
-
client.data.pending = written < pending.length ? pending.subarray(Math.max(0, written)) : null;
|
|
87
|
-
}
|
|
88
|
-
#close(client) {
|
|
89
|
-
if (client !== this.#client)
|
|
90
|
-
return;
|
|
91
|
-
this.#client = null;
|
|
92
|
-
this.#host.attach(null);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
export {
|
|
96
|
-
CodeAgentRpcListener
|
|
97
|
-
};
|
package/TunnelShare-qkm8zp03.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
TunnelShare2
|
|
4
|
-
} from "./index-2mwc0g0d.js";
|
|
5
|
-
import"./index-2azahjaw.js";
|
|
6
|
-
import"./index-bt438yxm.js";
|
|
7
|
-
import"./index-m9jj544v.js";
|
|
8
|
-
import"./index-xb8809yb.js";
|
|
9
|
-
import"./index-0fz95kxe.js";
|
|
10
|
-
import"./index-wcej7g4z.js";
|
|
11
|
-
import"./index-52w0fvh8.js";
|
|
12
|
-
export {
|
|
13
|
-
TunnelShare2 as TunnelShare
|
|
14
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
Workspace,
|
|
4
|
-
command
|
|
5
|
-
} from "./index-3wypz6xj.js";
|
|
6
|
-
import"./index-52w0fvh8.js";
|
|
7
|
-
import"./index-wcej7g4z.js";
|
|
8
|
-
import"./index-hj6w4ka1.js";
|
|
9
|
-
import"./index-xjf5j657.js";
|
|
10
|
-
import"./index-31es1yev.js";
|
|
11
|
-
import"./index-zzvvc845.js";
|
|
12
|
-
import {
|
|
13
|
-
AgentScript
|
|
14
|
-
} from "./index-4vgbysa0.js";
|
|
15
|
-
|
|
16
|
-
// pkgs/@akanjs/cli/agent/agent.command.ts
|
|
17
|
-
class AgentCommand extends command("agent", [AgentScript], ({ public: target }) => ({
|
|
18
|
-
agent: target({ desc: "Install Akan agent rules for editors and coding agents" }).arg("action", String, { desc: "install" }).arg("target", String, { desc: "cursor, agents-md, claude, or all", nullable: true }).option("force", Boolean, { desc: "overwrite existing rule files", default: false }).with(Workspace).exec(async function(action, targetName, force, workspace) {
|
|
19
|
-
await this.agentScript.agent(workspace, action, targetName, { force });
|
|
20
|
-
})
|
|
21
|
-
})) {
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
AgentCommand
|
|
25
|
-
};
|
package/cloud.script-nqevg5qw.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
CloudScript2
|
|
4
|
-
} from "./index-301pdbzz.js";
|
|
5
|
-
import"./index-6txx6a9p.js";
|
|
6
|
-
import"./index-9th4gszy.js";
|
|
7
|
-
import"./index-pcwzkdqb.js";
|
|
8
|
-
import"./index-2xcc2ax5.js";
|
|
9
|
-
import"./index-42j4a8zq.js";
|
|
10
|
-
import"./index-js6geqjn.js";
|
|
11
|
-
import"./index-2azahjaw.js";
|
|
12
|
-
import"./index-bt438yxm.js";
|
|
13
|
-
import"./index-m9jj544v.js";
|
|
14
|
-
import"./index-3wypz6xj.js";
|
|
15
|
-
import"./index-7md2g9vw.js";
|
|
16
|
-
import"./index-xb8809yb.js";
|
|
17
|
-
import"./index-5nd1wtkv.js";
|
|
18
|
-
import"./index-0fz95kxe.js";
|
|
19
|
-
import"./index-wcej7g4z.js";
|
|
20
|
-
import"./index-tvehn2sp.js";
|
|
21
|
-
import"./index-52w0fvh8.js";
|
|
22
|
-
export {
|
|
23
|
-
CloudScript2 as CloudScript
|
|
24
|
-
};
|
package/code.command-9h3yrzhe.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
Workspace,
|
|
4
|
-
runner,
|
|
5
|
-
script,
|
|
6
|
-
command
|
|
7
|
-
} from "./index-3wypz6xj.js";
|
|
8
|
-
import"./index-52w0fvh8.js";
|
|
9
|
-
import"./index-wcej7g4z.js";
|
|
10
|
-
import {
|
|
11
|
-
akanCodeDefaultModel2,
|
|
12
|
-
CodeAgentStreamPrinter2
|
|
13
|
-
} from "./index-c6eggbee.js";
|
|
14
|
-
|
|
15
|
-
// pkgs/@akanjs/cli/code/code.runner.ts
|
|
16
|
-
import { codeAgentPresets, isCodeAgentPresetName } from "akanjs/common";
|
|
17
|
-
|
|
18
|
-
class CodeRunner extends runner("code") {
|
|
19
|
-
async serve(options, listen) {
|
|
20
|
-
await import("./consoleToStderr-h5bryj94.js");
|
|
21
|
-
const [{ CodeAgent }, { CodeAgentRpcHost }, { CodeAgentRpcListener }] = await Promise.all([
|
|
22
|
-
import("./CodeAgent-8d5qs787.js"),
|
|
23
|
-
import("./CodeAgentRpcHost-9g27hmer.js"),
|
|
24
|
-
import("./CodeAgentRpcListener-7p7z5dd7.js")
|
|
25
|
-
]);
|
|
26
|
-
const address = listen ? CodeAgentRpcListener.parse(listen) : null;
|
|
27
|
-
const agent = await CodeAgent.create({ ...await CodeRunner.#agentOptions(options, true), mode: "rpc" });
|
|
28
|
-
if (!address)
|
|
29
|
-
return await new CodeAgentRpcHost(agent).serve();
|
|
30
|
-
const listener = new CodeAgentRpcListener(new CodeAgentRpcHost(agent, null), address).listen();
|
|
31
|
-
process.stderr.write(`akan code rpc listening on ${"unix" in address ? address.unix : `${address.hostname}:${listener.port}`}
|
|
32
|
-
`);
|
|
33
|
-
await listener.serve();
|
|
34
|
-
}
|
|
35
|
-
async tui(options, seed) {
|
|
36
|
-
const [{ CodeAgent }, { CodeTui }] = await Promise.all([
|
|
37
|
-
import("./CodeAgent-8d5qs787.js"),
|
|
38
|
-
import("./CodeTui-z5vkm9ea.js")
|
|
39
|
-
]);
|
|
40
|
-
const agentOptions = await CodeRunner.#agentOptions(options, false);
|
|
41
|
-
let resume = options.resume;
|
|
42
|
-
let autoCompactAt = agentOptions.autoCompactAt;
|
|
43
|
-
let prompt = seed;
|
|
44
|
-
let notice;
|
|
45
|
-
for (;; ) {
|
|
46
|
-
const agent = await CodeAgent.create({
|
|
47
|
-
...agentOptions,
|
|
48
|
-
mode: "tui",
|
|
49
|
-
...resume ? { resume } : {},
|
|
50
|
-
...autoCompactAt ? { autoCompactAt } : {}
|
|
51
|
-
});
|
|
52
|
-
let next;
|
|
53
|
-
try {
|
|
54
|
-
next = await new CodeTui(agent, {
|
|
55
|
-
thinking: options.thinking,
|
|
56
|
-
...notice ? { notice } : {}
|
|
57
|
-
}).run(prompt);
|
|
58
|
-
autoCompactAt = agent.info.autoCompactAt;
|
|
59
|
-
} finally {
|
|
60
|
-
agent.dispose();
|
|
61
|
-
}
|
|
62
|
-
if (!next)
|
|
63
|
-
return;
|
|
64
|
-
resume = next.id;
|
|
65
|
-
notice = next.notice;
|
|
66
|
-
prompt = "";
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async run(prompt, options) {
|
|
70
|
-
const { CodeAgent } = await import("./CodeAgent-8d5qs787.js");
|
|
71
|
-
const agent = await CodeAgent.create(await CodeRunner.#agentOptions(options, false));
|
|
72
|
-
const printer = new CodeAgentStreamPrinter2({ json: options.json, thinking: options.thinking });
|
|
73
|
-
agent.on((event) => printer.print(event));
|
|
74
|
-
agent.announce();
|
|
75
|
-
try {
|
|
76
|
-
await agent.prompt(prompt);
|
|
77
|
-
await agent.waitForIdle();
|
|
78
|
-
} finally {
|
|
79
|
-
printer.finish();
|
|
80
|
-
agent.dispose();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
static async#agentOptions(options, hostAttached) {
|
|
84
|
-
const profile = CodeRunner.profileOf(options, { hostAttached });
|
|
85
|
-
return {
|
|
86
|
-
workspace: options.workspace,
|
|
87
|
-
cwd: profile.paths.root,
|
|
88
|
-
profile,
|
|
89
|
-
apps: options.app ? [options.app] : await options.workspace.getApps(),
|
|
90
|
-
model: CodeRunner.modelOf(options.model),
|
|
91
|
-
...options.compactAt !== undefined ? { autoCompactAt: options.compactAt } : {}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
static profileOf(options, { hostAttached }) {
|
|
95
|
-
if (!isCodeAgentPresetName(options.profile))
|
|
96
|
-
throw new Error(`Unknown profile: ${options.profile}. Use local, pod, review, or web.`);
|
|
97
|
-
const root = options.app ? `${options.workspace.workspaceRoot}/apps/${options.app}` : options.workspace.workspaceRoot;
|
|
98
|
-
const profile = codeAgentPresets[options.profile](root);
|
|
99
|
-
return { ...profile, ui: { ...profile.ui, canPrompt: CodeRunner.canPrompt(profile, hostAttached) } };
|
|
100
|
-
}
|
|
101
|
-
static canPrompt(profile, hostAttached) {
|
|
102
|
-
const forced = process.env.AKAN_CODE_CAN_PROMPT;
|
|
103
|
-
if (forced === "1")
|
|
104
|
-
return true;
|
|
105
|
-
if (forced === "0")
|
|
106
|
-
return false;
|
|
107
|
-
return hostAttached || profile.ui.canPrompt;
|
|
108
|
-
}
|
|
109
|
-
static modelOf(model) {
|
|
110
|
-
if (!model)
|
|
111
|
-
return;
|
|
112
|
-
const [provider, ...rest] = model.split("/");
|
|
113
|
-
if (!provider || !rest.length)
|
|
114
|
-
throw new Error(`Model must be "<provider>/<id>", e.g. ${akanCodeDefaultModel2.provider}/${akanCodeDefaultModel2.id}`);
|
|
115
|
-
return { provider, id: rest.join("/") };
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// pkgs/@akanjs/cli/code/code.script.ts
|
|
120
|
-
class CodeScript extends script("code", [CodeRunner]) {
|
|
121
|
-
async run(workspace, prompt, options) {
|
|
122
|
-
const run = {
|
|
123
|
-
workspace,
|
|
124
|
-
...options.app ? { app: options.app } : {},
|
|
125
|
-
profile: options.profile,
|
|
126
|
-
...options.model ? { model: options.model } : {},
|
|
127
|
-
...options.compactAt !== null ? { compactAt: options.compactAt } : {},
|
|
128
|
-
json: options.json,
|
|
129
|
-
thinking: options.thinking,
|
|
130
|
-
...options.resume ? { resume: options.resume } : {}
|
|
131
|
-
};
|
|
132
|
-
if (options.rpcListen)
|
|
133
|
-
return await this.codeRunner.serve(run, options.rpcListen);
|
|
134
|
-
if (options.rpc)
|
|
135
|
-
return await this.codeRunner.serve(run);
|
|
136
|
-
const interactive = options.interactive || !prompt.trim() && !options.json && !!process.stdout.isTTY;
|
|
137
|
-
if (interactive)
|
|
138
|
-
return await this.codeRunner.tui(run, prompt);
|
|
139
|
-
if (!prompt.trim())
|
|
140
|
-
throw new Error('akan code needs a prompt when it has no terminal: akan code "add a comment module"');
|
|
141
|
-
await this.codeRunner.run(prompt, run);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// pkgs/@akanjs/cli/code/code.command.ts
|
|
146
|
-
class CodeCommand extends command("code", [CodeScript], ({ public: target }) => ({
|
|
147
|
-
code: target({ desc: "Run the akan coding agent on a prompt" }).arg("prompt", String, { desc: "what the agent should do", nullable: true }).option("app", String, { desc: "narrow the agent to one app instead of the whole repo", nullable: true }).option("profile", String, { desc: "local, pod, review, or web", default: "local" }).option("model", String, { desc: "<provider>/<id>, e.g. deepseek/deepseek-flash", nullable: true }).option("compactAt", Number, {
|
|
148
|
-
desc: "compact once the context window is this full, in percent: 10, 20, \u2026 100",
|
|
149
|
-
flag: "c",
|
|
150
|
-
nullable: true
|
|
151
|
-
}).option("json", Boolean, { desc: "print one event per line as JSON", default: false }).option("thinking", Boolean, { desc: "print the model's reasoning", default: false }).option("rpc", Boolean, { desc: "serve the agent over stdio for another process to drive", default: false }).option("rpcListen", String, {
|
|
152
|
-
desc: "serve the RPC wire on unix:<path> or tcp:[host:]<port> instead of stdio",
|
|
153
|
-
flag: "L",
|
|
154
|
-
nullable: true
|
|
155
|
-
}).option("resume", String, { desc: "continue a stored session by id", flag: "R", nullable: true }).option("interactive", Boolean, {
|
|
156
|
-
desc: "open the full-screen session even when a prompt is given",
|
|
157
|
-
flag: "i",
|
|
158
|
-
default: false
|
|
159
|
-
}).with(Workspace).exec(async function(prompt, app, profile, model, compactAt, json, thinking, rpc, rpcListen, resume, interactive, workspace) {
|
|
160
|
-
const options = { app, profile, model, compactAt, json, thinking, rpc, rpcListen, interactive, resume };
|
|
161
|
-
await this.codeScript.run(workspace, prompt ?? "", options);
|
|
162
|
-
})
|
|
163
|
-
})) {
|
|
164
|
-
}
|
|
165
|
-
export {
|
|
166
|
-
CodeCommand
|
|
167
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
ContextRunner2
|
|
4
|
-
} from "./index-a58emady.js";
|
|
5
|
-
import"./index-b70zct19.js";
|
|
6
|
-
import"./index-skk9zc1x.js";
|
|
7
|
-
import"./index-74tjjsnc.js";
|
|
8
|
-
import"./index-j9vyj3dj.js";
|
|
9
|
-
import"./index-hmt54t45.js";
|
|
10
|
-
import"./index-905qdgqp.js";
|
|
11
|
-
import"./index-js6geqjn.js";
|
|
12
|
-
import"./index-bt438yxm.js";
|
|
13
|
-
import"./index-m9jj544v.js";
|
|
14
|
-
import"./index-31es1yev.js";
|
|
15
|
-
import"./index-xjf5j657.js";
|
|
16
|
-
import"./index-zzvvc845.js";
|
|
17
|
-
import"./index-3wypz6xj.js";
|
|
18
|
-
import"./index-xb8809yb.js";
|
|
19
|
-
import"./index-0fz95kxe.js";
|
|
20
|
-
import"./index-wcej7g4z.js";
|
|
21
|
-
import"./index-hj6w4ka1.js";
|
|
22
|
-
import"./index-52w0fvh8.js";
|
|
23
|
-
export {
|
|
24
|
-
ContextRunner2 as ContextRunner
|
|
25
|
-
};
|