@akanjs/cli 3.0.0-beta.18 → 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.
Files changed (75) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-0035exh3.js → CodeAgent-6cm97kay.js} +2 -2
  3. package/{CodeAgentRpcHost-qvwfv0n9.js → CodeAgentRpcHost-p7h6n2hp.js} +1 -1
  4. package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
  5. package/{CodeTui-eweg1hep.js → CodeTui-za4jsm41.js} +1 -1
  6. package/{TunnelShare-r5tc2qk5.js → TunnelShare-2j6s511d.js} +2 -2
  7. package/{agent.command-65zqfkg0.js → agent.command-e0wpbbyg.js} +5 -5
  8. package/akanCode.js +4 -4
  9. package/{application.command-2wcj5da3.js → application.command-8wyxqc8q.js} +15 -9
  10. package/{applicationBuildRunner-m0hhgwsx.js → applicationBuildRunner-n9gzaxd0.js} +31 -7
  11. package/{applicationReleasePackager-vykfzgx3.js → applicationReleasePackager-vpggfqgq.js} +1 -1
  12. package/buildBatch.proc.js +3 -3
  13. package/{capacitorApp-2daqhb5h.js → capacitorApp-q3z0qht0.js} +2 -2
  14. package/{cloud.command-960bgbf4.js → cloud.command-4zwa5dsx.js} +34 -12
  15. package/cloud.script-fwx3vb34.js +20 -0
  16. package/{code.command-4feh3ef7.js → code.command-468c9d7s.js} +41 -19
  17. package/commandManifest.json +1 -1
  18. package/{context.command-kzehkx48.js → context.command-dsnw0jby.js} +13 -13
  19. package/context.runner-rs4rj15d.js +22 -0
  20. package/{dependencyScanner-shs82ynp.js → dependencyScanner-0z2h2tks.js} +1 -1
  21. package/{guideline.command-3w2g20x4.js → guideline.command-vhw13pqr.js} +2 -2
  22. package/guidelines/agentRule/agentRule.instruction.md +27 -10
  23. package/guidelines/conventions/conventions.instruction.md +16 -4
  24. package/guidelines/queryRule/queryRule.instruction.md +16 -6
  25. package/guidelines/runtimeRule/runtimeRule.instruction.md +74 -0
  26. package/incrementalBuilder.proc.js +3 -2
  27. package/{index-dw943k93.js → index-10dkrrww.js} +4 -4
  28. package/{index-rpgxs245.js → index-18zybgkc.js} +2 -2
  29. package/{index-mt2154s2.js → index-22xtgmhn.js} +1 -1
  30. package/{index-yw6g3bbv.js → index-2446k7b4.js} +1 -1
  31. package/{index-cjw1sj1x.js → index-3jrp517k.js} +10 -10
  32. package/{index-q9c3c0hy.js → index-4m929vvn.js} +2 -2
  33. package/{index-ef228gzf.js → index-53176s7j.js} +3 -3
  34. package/{index-jwrpsrg3.js → index-667w0yah.js} +1 -1
  35. package/{index-6q589y9t.js → index-7ep8qtvp.js} +2 -2
  36. package/{index-w8kmx1b6.js → index-89hy31kf.js} +30 -7
  37. package/{index-jd01kj5r.js → index-9d6nvkz2.js} +1 -1
  38. package/{index-zq0mr3hh.js → index-a1w6934z.js} +3 -3
  39. package/{index-sbfk9daf.js → index-ab0c38ea.js} +4 -4
  40. package/index-bc88j1ry.js +1166 -0
  41. package/{index-h94faz96.js → index-bftkz6cp.js} +274 -60
  42. package/{index-kcxmv48c.js → index-bhtmj233.js} +4 -1
  43. package/{index-m41ptvat.js → index-bwf965h6.js} +3 -3
  44. package/{index-bwxpk2cj.js → index-crmeqnmf.js} +52 -26
  45. package/{index-8k16atqy.js → index-d2242ksy.js} +23 -6
  46. package/{index-jwexzh42.js → index-e4v6vhxq.js} +222 -56
  47. package/{index-pn8mhpps.js → index-esk82rvk.js} +4 -4
  48. package/{index-4r42ext5.js → index-kwaq3n9n.js} +1 -1
  49. package/{index-gm76f0qb.js → index-n3cv0tm4.js} +1 -1
  50. package/{index-ycy302an.js → index-qdgzsnhg.js} +1 -1
  51. package/{index-wcg582a8.js → index-sq2dzkzm.js} +35 -10
  52. package/{index-myj01w9r.js → index-srmay5jw.js} +15 -2
  53. package/{index-zmj143x7.js → index-txr7dj2g.js} +3 -3
  54. package/{index-erfc1x40.js → index-vqx8bdxz.js} +1 -1
  55. package/{index-d9fjz06h.js → index-zqgj2rt2.js} +4 -4
  56. package/index.js +21 -21
  57. package/{library.command-fp0nhr62.js → library.command-cqr175dy.js} +3 -3
  58. package/{localRegistry.command-8y0ecxb9.js → localRegistry.command-49z55qqz.js} +9 -9
  59. package/{module.command-kqkn48t2.js → module.command-9p8mm3b0.js} +5 -5
  60. package/{package.command-qverjh22.js → package.command-wxyz909t.js} +4 -4
  61. package/package.json +2 -2
  62. package/{page.command-94bwhd0g.js → page.command-gsrsfqqs.js} +3 -3
  63. package/{primitive.command-2ydvtah2.js → primitive.command-ns1mptje.js} +6 -6
  64. package/{quality.command-fa0gth4p.js → quality.command-e76k2q9k.js} +17 -15
  65. package/{repair.command-4qng2hpm.js → repair.command-pkrsm3cw.js} +5 -5
  66. package/{scalar.command-pb2y95sh.js → scalar.command-0cpt3fc8.js} +4 -4
  67. package/{subspace.command-vkxmwp74.js → subspace.command-fktpwp0g.js} +20 -10
  68. package/templates/appSample/lib/task/task.signal.test.ts +1 -1
  69. package/templates/localDev/docker-compose.yaml.template +3 -14
  70. package/{tunnel.command-02cvp9nf.js → tunnel.command-d5jy9gk8.js} +4 -4
  71. package/{workflow.command-132txnrh.js → workflow.command-6tkcysmx.js} +9 -9
  72. package/{workspace.command-d5wkswek.js → workspace.command-gv84eh1p.js} +24 -23
  73. package/cloud.script-qhcnqt1n.js +0 -20
  74. package/context.runner-z0rrcz7b.js +0 -22
  75. package/index-3hpxeys1.js +0 -462
package/.build-stamp CHANGED
@@ -1 +1 @@
1
- d79f8789b2f3ccd418de907777c842f30b9db11bb3c64eda43e42036d960faf4
1
+ 54a8d9f8d1b98d302928a879423c5be74f2316a5c28baad5f32fed8da1db0ca1
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  CodeAgent2
4
- } from "./index-jwexzh42.js";
5
- import"./index-jd01kj5r.js";
4
+ } from "./index-e4v6vhxq.js";
5
+ import"./index-9d6nvkz2.js";
6
6
  import"./index-7md2g9vw.js";
7
7
  export {
8
8
  CodeAgent2 as CodeAgent
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  CodeAgentRpcHost2
4
- } from "./index-8k16atqy.js";
4
+ } from "./index-d2242ksy.js";
5
5
  export {
6
6
  CodeAgentRpcHost2 as CodeAgentRpcHost
7
7
  };
@@ -0,0 +1,97 @@
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
+ };
@@ -4,7 +4,7 @@ import {
4
4
  McpServerConfig,
5
5
  McpTokenStore,
6
6
  McpSignIn
7
- } from "./index-jd01kj5r.js";
7
+ } from "./index-9d6nvkz2.js";
8
8
  import {
9
9
  CodeTuiLines2,
10
10
  CodeTuiAgents2,
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  TunnelShare2
4
- } from "./index-gm76f0qb.js";
5
- import"./index-myj01w9r.js";
4
+ } from "./index-n3cv0tm4.js";
5
+ import"./index-srmay5jw.js";
6
6
  import"./index-q0y2jq9j.js";
7
7
  export {
8
8
  TunnelShare2 as TunnelShare
@@ -2,17 +2,17 @@
2
2
  import {
3
3
  Workspace,
4
4
  command
5
- } from "./index-ycy302an.js";
5
+ } from "./index-qdgzsnhg.js";
6
6
  import"./index-q0y2jq9j.js";
7
- import"./index-bwxpk2cj.js";
7
+ import"./index-crmeqnmf.js";
8
8
  import"./index-6wwzs1bc.js";
9
9
  import"./index-by5gpp8x.js";
10
- import"./index-yw6g3bbv.js";
11
- import"./index-rpgxs245.js";
10
+ import"./index-2446k7b4.js";
11
+ import"./index-18zybgkc.js";
12
12
  import"./index-s5rhm04y.js";
13
13
  import {
14
14
  AgentScript
15
- } from "./index-m41ptvat.js";
15
+ } from "./index-bwf965h6.js";
16
16
 
17
17
  // pkgs/@akanjs/cli/agent/agent.command.ts
18
18
  class AgentCommand extends command("agent", [AgentScript], ({ public: target }) => ({
package/akanCode.js CHANGED
@@ -28,22 +28,22 @@ import {
28
28
  CodeMailbox2,
29
29
  CodeSessionFork2,
30
30
  CodeAgent2
31
- } from "./index-jwexzh42.js";
31
+ } from "./index-e4v6vhxq.js";
32
32
  import {
33
33
  akanCodeDefaultModel2,
34
34
  akanCodeModel2,
35
35
  akanCodeModelSupportsImages2,
36
36
  akanCodeModelWarnings2,
37
37
  CodeAgentStreamPrinter2
38
- } from "./index-jwrpsrg3.js";
38
+ } from "./index-667w0yah.js";
39
39
  import {
40
40
  SubagentPool2,
41
41
  akanCodePaths2
42
- } from "./index-jd01kj5r.js";
42
+ } from "./index-9d6nvkz2.js";
43
43
  import"./index-7md2g9vw.js";
44
44
  import {
45
45
  CodeAgentRpcHost2
46
- } from "./index-8k16atqy.js";
46
+ } from "./index-d2242ksy.js";
47
47
  import {
48
48
  CodeTuiLines2,
49
49
  CodeTuiAgents2,
@@ -6,17 +6,17 @@ import {
6
6
  Exec,
7
7
  Workspace,
8
8
  command
9
- } from "./index-ycy302an.js";
9
+ } from "./index-qdgzsnhg.js";
10
10
  import"./index-q0y2jq9j.js";
11
- import"./index-bwxpk2cj.js";
11
+ import"./index-crmeqnmf.js";
12
12
  import"./index-6wwzs1bc.js";
13
13
  import {
14
14
  ApplicationScript
15
- } from "./index-h94faz96.js";
16
- import"./index-6q589y9t.js";
15
+ } from "./index-bftkz6cp.js";
16
+ import"./index-7ep8qtvp.js";
17
17
  import"./index-hwkygn9s.js";
18
18
  import"./index-7md2g9vw.js";
19
- import"./index-4r42ext5.js";
19
+ import"./index-kwaq3n9n.js";
20
20
  import {
21
21
  getMobileTargetChoices
22
22
  } from "./index-47pj3aee.js";
@@ -183,11 +183,17 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
183
183
  await this.applicationScript.codepush(app, os);
184
184
  }),
185
185
  dbup: target({ desc: "Start local database services for a database mode" }).with(Workspace).option("mode", String, {
186
- desc: "database mode",
187
- default: "multiple",
188
- enum: ["single", "multiple", "cluster"]
186
+ desc: "database mode; left out, every mode the workspace's apps declare",
187
+ enum: ["single", "multiple", "cluster"],
188
+ nullable: true
189
189
  }).exec(async function(workspace, mode) {
190
- await this.applicationScript.dbup(workspace, mode);
190
+ await this.applicationScript.dbupDeclared(workspace, mode);
191
+ }),
192
+ dbExport: target({ desc: "Write every model table of an app to one NDJSON file each" }).with(App).option("dir", String, { desc: "directory under the workspace to write", default: "local/transfer" }).exec(async function(app, dir) {
193
+ await this.applicationScript.transferDatabase(app, "export", dir);
194
+ }),
195
+ dbImport: target({ desc: "Read files db-export wrote into an app's database, in the mode the shell names" }).with(App).option("dir", String, { desc: "directory under the workspace to read", default: "local/transfer" }).exec(async function(app, dir) {
196
+ await this.applicationScript.transferDatabase(app, "import", dir);
191
197
  }),
192
198
  dbdown: target({ desc: "Stop local database services" }).with(Workspace).exec(async function(workspace) {
193
199
  await this.applicationScript.dbdown(workspace);
@@ -1,15 +1,15 @@
1
1
  // @bun
2
2
  import {
3
3
  Spinner
4
- } from "./index-bwxpk2cj.js";
4
+ } from "./index-crmeqnmf.js";
5
5
  import {
6
6
  AllRoutesBuilder,
7
7
  CsrArtifactBuilder,
8
8
  FontPruner,
9
9
  precompressArtifacts,
10
10
  SsrBaseArtifactBuilder
11
- } from "./index-zq0mr3hh.js";
12
- import"./index-w8kmx1b6.js";
11
+ } from "./index-a1w6934z.js";
12
+ import"./index-89hy31kf.js";
13
13
  import"./index-q0y2jq9j.js";
14
14
  import"./index-hwkygn9s.js";
15
15
  import"./index-n68jx79w.js";
@@ -111,9 +111,29 @@ class ApplicationBuildRunner {
111
111
  const akanConfig = await this.#app.getConfig();
112
112
  await Promise.all([
113
113
  this.#app.dist.writeJson("package.json", akanConfig.getProductionPackageJson()),
114
- this.#app.dist.writeFile(`${this.#app.dist.cwdPath}/Dockerfile`, akanConfig.dockerfile)
114
+ this.#app.dist.writeFile(`${this.#app.dist.cwdPath}/Dockerfile`, akanConfig.dockerfile),
115
+ this.#app.dist.writeJson("akan.build.json", {
116
+ buildId: await this.#resolveBuildId(),
117
+ akanVersion: akanConfig.akanVersion,
118
+ builtAt: new Date().toISOString()
119
+ })
115
120
  ]);
116
121
  }
122
+ async#resolveBuildId() {
123
+ const fromEnv = process.env.AKAN_BUILD_ID?.trim();
124
+ if (fromEnv)
125
+ return fromEnv;
126
+ const root = this.#app.workspace.workspaceRoot;
127
+ const sha = Bun.spawnSync(["git", "rev-parse", "--short=12", "HEAD"], { cwd: root, stderr: "ignore" });
128
+ if (sha.exitCode !== 0)
129
+ return null;
130
+ const dirty = Bun.spawnSync(["git", "status", "--porcelain", "--untracked-files=no"], {
131
+ cwd: root,
132
+ stderr: "ignore"
133
+ });
134
+ const suffix = dirty.exitCode === 0 && dirty.stdout.toString().trim() ? "-dirty" : "";
135
+ return `${sha.stdout.toString().trim()}${suffix}`;
136
+ }
117
137
  async#buildBackend() {
118
138
  const akanConfig = await this.#app.getConfig();
119
139
  const backendExternals = [
@@ -125,15 +145,19 @@ class ApplicationBuildRunner {
125
145
  if (!await Bun.file(entrypoint).exists())
126
146
  throw new Error(`Backend entrypoint not found: ${entrypoint}`);
127
147
  }
128
- const backendResult = await this.#buildOrThrow("backend", {
129
- entrypoints: backendEntryPoints,
148
+ const backendConfig = {
130
149
  outdir: this.#app.dist.cwdPath,
131
150
  target: "bun",
132
151
  minify: AKAN_BACKEND_MINIFY,
133
152
  naming: { entry: "[name].[ext]", chunk: "chunk-[hash].[ext]" },
134
153
  define: { "process.env.NODE_ENV": JSON.stringify("production") },
135
154
  plugins: backendExternals.length > 0 ? [this.#createExternalSpecifiersPlugin(backendExternals)] : []
136
- });
155
+ };
156
+ const [mainResult, serverResult] = [
157
+ await this.#buildOrThrow("backend", { ...backendConfig, entrypoints: [backendEntryPoints[0]] }),
158
+ await this.#buildOrThrow("backend", { ...backendConfig, entrypoints: [backendEntryPoints[1]], splitting: true })
159
+ ];
160
+ const backendResult = { outputs: [...mainResult.outputs, ...serverResult.outputs] };
137
161
  const rscWorkerResult = web.ssr ? await this.#buildOrThrow("rsc-worker", {
138
162
  entrypoints: [this.#resolveRscWorkerBuildEntry()],
139
163
  outdir: this.#app.dist.cwdPath,
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-q0y2jq9j.js";
5
5
  import {
6
6
  Spinner
7
- } from "./index-bwxpk2cj.js";
7
+ } from "./index-crmeqnmf.js";
8
8
 
9
9
  // pkgs/@akanjs/devkit/applicationReleasePackager.ts
10
10
  import { cp, mkdir, rm } from "fs/promises";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  WorkspaceExecutor,
4
4
  AppExecutor
5
- } from "./index-bwxpk2cj.js";
5
+ } from "./index-crmeqnmf.js";
6
6
  import"./index-q0y2jq9j.js";
7
7
  import"./index-6wwzs1bc.js";
8
8
  import {
@@ -11,8 +11,8 @@ import {
11
11
  CsrArtifactBuilder,
12
12
  FontOptimizer,
13
13
  SsrBaseArtifactBuilder
14
- } from "./index-zq0mr3hh.js";
15
- import"./index-w8kmx1b6.js";
14
+ } from "./index-a1w6934z.js";
15
+ import"./index-89hy31kf.js";
16
16
  import"./index-hwkygn9s.js";
17
17
  import"./index-n68jx79w.js";
18
18
 
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  isPlaceholderAppId2,
4
4
  CapacitorApp2
5
- } from "./index-erfc1x40.js";
6
- import"./index-bwxpk2cj.js";
5
+ } from "./index-vqx8bdxz.js";
6
+ import"./index-crmeqnmf.js";
7
7
  import"./index-6wwzs1bc.js";
8
8
  import"./index-q0y2jq9j.js";
9
9
  export {
@@ -2,24 +2,26 @@
2
2
  import"./index-q0y2jq9j.js";
3
3
  import {
4
4
  GlobalConfig
5
- } from "./index-myj01w9r.js";
5
+ } from "./index-srmay5jw.js";
6
6
  import {
7
7
  Workspace,
8
8
  command
9
- } from "./index-ycy302an.js";
10
- import"./index-bwxpk2cj.js";
9
+ } from "./index-qdgzsnhg.js";
10
+ import"./index-crmeqnmf.js";
11
11
  import"./index-6wwzs1bc.js";
12
- import"./index-h94faz96.js";
13
- import"./index-6q589y9t.js";
12
+ import {
13
+ PlatformTestRun
14
+ } from "./index-bc88j1ry.js";
15
+ import"./index-bftkz6cp.js";
16
+ import"./index-7ep8qtvp.js";
14
17
  import"./index-hwkygn9s.js";
15
18
  import"./index-7md2g9vw.js";
16
- import"./index-kcxmv48c.js";
17
- import"./index-sbfk9daf.js";
18
- import"./index-3hpxeys1.js";
19
+ import"./index-bhtmj233.js";
20
+ import"./index-ab0c38ea.js";
19
21
  import {
20
22
  CloudScript2
21
- } from "./index-wcg582a8.js";
22
- import"./index-4r42ext5.js";
23
+ } from "./index-sq2dzkzm.js";
24
+ import"./index-kwaq3n9n.js";
23
25
 
24
26
  // pkgs/@akanjs/cli/cloud/cloud.command.ts
25
27
  var localRegistryUrl = () => process.env.AKAN_NPM_REGISTRY ?? "http://127.0.0.1:4873";
@@ -42,10 +44,30 @@ class CloudCommand extends command("cloud", [CloudScript2], ({ public: target })
42
44
  { label: "local", value: "local" },
43
45
  { label: "npm", value: "npm" }
44
46
  ]
45
- }).with(Workspace).exec(async function(test, registry, workspace) {
47
+ }).option("platforms", String, {
48
+ desc: "platforms to test on besides this machine, comma-separated: linux, windows (none to skip)",
49
+ default: "linux,windows"
50
+ }).with(Workspace).exec(async function(test, registry, platforms, workspace) {
46
51
  await this.cloudScript.deployAkan(workspace, {
47
52
  test,
48
- registryUrl: resolveRegistryUrl(registry)
53
+ registryUrl: resolveRegistryUrl(registry),
54
+ platforms: PlatformTestRun.parsePlatforms(platforms)
55
+ });
56
+ }),
57
+ testPlatforms: target({
58
+ devOnly: true,
59
+ desc: "Run the Akan package suites on Linux (Docker) and Windows (SSH) against a snapshot of this tree"
60
+ }).option("platforms", String, {
61
+ desc: "platforms to test on, comma-separated: linux, windows",
62
+ default: "linux,windows"
63
+ }).option("pkgs", String, {
64
+ flag: "k",
65
+ desc: "packages to test, comma-separated (default: every Akan package)",
66
+ nullable: true
67
+ }).with(Workspace).exec(async function(platforms, pkgs, workspace) {
68
+ await this.cloudScript.testPlatforms(workspace, {
69
+ platforms: PlatformTestRun.parsePlatforms(platforms),
70
+ pkgs: pkgs?.split(",").map((pkg) => pkg.trim()).filter(Boolean)
49
71
  });
50
72
  }),
51
73
  update: target({ desc: "Update Akan.js framework to the latest version" }).with(Workspace).option("tag", String, {
@@ -0,0 +1,20 @@
1
+ // @bun
2
+ import {
3
+ CloudScript2
4
+ } from "./index-sq2dzkzm.js";
5
+ import"./index-bc88j1ry.js";
6
+ import"./index-bftkz6cp.js";
7
+ import"./index-kwaq3n9n.js";
8
+ import"./index-7ep8qtvp.js";
9
+ import"./index-ab0c38ea.js";
10
+ import"./index-srmay5jw.js";
11
+ import"./index-qdgzsnhg.js";
12
+ import"./index-7md2g9vw.js";
13
+ import"./index-hwkygn9s.js";
14
+ import"./index-crmeqnmf.js";
15
+ import"./index-6wwzs1bc.js";
16
+ import"./index-bhtmj233.js";
17
+ import"./index-q0y2jq9j.js";
18
+ export {
19
+ CloudScript2 as CloudScript
20
+ };
@@ -4,26 +4,28 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-ycy302an.js";
7
+ } from "./index-qdgzsnhg.js";
8
8
  import"./index-q0y2jq9j.js";
9
- import"./index-bwxpk2cj.js";
9
+ import"./index-crmeqnmf.js";
10
10
  import"./index-6wwzs1bc.js";
11
11
  import {
12
12
  akanCodeDefaultModel2,
13
13
  CodeAgentStreamPrinter2
14
- } from "./index-jwrpsrg3.js";
14
+ } from "./index-667w0yah.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/code/code.runner.ts
17
17
  import { codeAgentPresets, isCodeAgentPresetName } from "akanjs/common";
18
18
 
19
19
  class CodeRunner extends runner("code") {
20
- async serve(options) {
20
+ async serve(options, listen) {
21
21
  await import("./consoleToStderr-h5bryj94.js");
22
- const [{ CodeAgent }, { CodeAgentRpcHost }] = await Promise.all([
23
- import("./CodeAgent-0035exh3.js"),
24
- import("./CodeAgentRpcHost-qvwfv0n9.js")
22
+ const [{ CodeAgent }, { CodeAgentRpcHost }, { CodeAgentRpcListener }] = await Promise.all([
23
+ import("./CodeAgent-6cm97kay.js"),
24
+ import("./CodeAgentRpcHost-p7h6n2hp.js"),
25
+ import("./CodeAgentRpcListener-7p7z5dd7.js")
25
26
  ]);
26
- const profile = CodeRunner.profileOf(options);
27
+ const address = listen ? CodeAgentRpcListener.parse(listen) : null;
28
+ const profile = CodeRunner.profileOf(options, { hostAttached: true });
27
29
  const agent = await CodeAgent.create({
28
30
  workspace: options.workspace,
29
31
  cwd: profile.paths.root,
@@ -32,14 +34,19 @@ class CodeRunner extends runner("code") {
32
34
  model: CodeRunner.modelOf(options.model),
33
35
  mode: "rpc"
34
36
  });
35
- await new CodeAgentRpcHost(agent).serve();
37
+ if (!address)
38
+ return await new CodeAgentRpcHost(agent).serve();
39
+ const listener = new CodeAgentRpcListener(new CodeAgentRpcHost(agent, null), address).listen();
40
+ process.stderr.write(`akan code rpc listening on ${"unix" in address ? address.unix : `${address.hostname}:${listener.port}`}
41
+ `);
42
+ await listener.serve();
36
43
  }
37
44
  async tui(options, seed) {
38
45
  const [{ CodeAgent }, { CodeTui }] = await Promise.all([
39
- import("./CodeAgent-0035exh3.js"),
40
- import("./CodeTui-eweg1hep.js")
46
+ import("./CodeAgent-6cm97kay.js"),
47
+ import("./CodeTui-za4jsm41.js")
41
48
  ]);
42
- const profile = CodeRunner.profileOf(options);
49
+ const profile = CodeRunner.profileOf(options, { hostAttached: false });
43
50
  const apps = options.app ? [options.app] : await options.workspace.getApps();
44
51
  let resume = options.resume;
45
52
  let prompt = seed;
@@ -71,8 +78,8 @@ class CodeRunner extends runner("code") {
71
78
  }
72
79
  }
73
80
  async run(prompt, options) {
74
- const { CodeAgent } = await import("./CodeAgent-0035exh3.js");
75
- const profile = CodeRunner.profileOf(options);
81
+ const { CodeAgent } = await import("./CodeAgent-6cm97kay.js");
82
+ const profile = CodeRunner.profileOf(options, { hostAttached: false });
76
83
  const agent = await CodeAgent.create({
77
84
  workspace: options.workspace,
78
85
  cwd: profile.paths.root,
@@ -91,11 +98,20 @@ class CodeRunner extends runner("code") {
91
98
  agent.dispose();
92
99
  }
93
100
  }
94
- static profileOf(options) {
101
+ static profileOf(options, { hostAttached }) {
95
102
  if (!isCodeAgentPresetName(options.profile))
96
103
  throw new Error(`Unknown profile: ${options.profile}. Use local, pod, review, or web.`);
97
104
  const root = options.app ? `${options.workspace.workspaceRoot}/apps/${options.app}` : options.workspace.workspaceRoot;
98
- return codeAgentPresets[options.profile](root);
105
+ const profile = codeAgentPresets[options.profile](root);
106
+ return { ...profile, ui: { ...profile.ui, canPrompt: CodeRunner.canPrompt(profile, hostAttached) } };
107
+ }
108
+ static canPrompt(profile, hostAttached) {
109
+ const forced = process.env.AKAN_CODE_CAN_PROMPT;
110
+ if (forced === "1")
111
+ return true;
112
+ if (forced === "0")
113
+ return false;
114
+ return hostAttached || profile.ui.canPrompt;
99
115
  }
100
116
  static modelOf(model) {
101
117
  if (!model)
@@ -119,6 +135,8 @@ class CodeScript extends script("code", [CodeRunner]) {
119
135
  thinking: options.thinking,
120
136
  ...options.resume ? { resume: options.resume } : {}
121
137
  };
138
+ if (options.rpcListen)
139
+ return await this.codeRunner.serve(run, options.rpcListen);
122
140
  if (options.rpc)
123
141
  return await this.codeRunner.serve(run);
124
142
  const interactive = options.interactive || !prompt.trim() && !options.json && !!process.stdout.isTTY;
@@ -132,12 +150,16 @@ class CodeScript extends script("code", [CodeRunner]) {
132
150
 
133
151
  // pkgs/@akanjs/cli/code/code.command.ts
134
152
  class CodeCommand extends command("code", [CodeScript], ({ public: target }) => ({
135
- 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-v4-flash", nullable: true }).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("resume", String, { desc: "continue a stored session by id", flag: "R", nullable: true }).option("interactive", Boolean, {
153
+ 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("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, {
154
+ desc: "serve the RPC wire on unix:<path> or tcp:[host:]<port> instead of stdio",
155
+ flag: "L",
156
+ nullable: true
157
+ }).option("resume", String, { desc: "continue a stored session by id", flag: "R", nullable: true }).option("interactive", Boolean, {
136
158
  desc: "open the full-screen session even when a prompt is given",
137
159
  flag: "i",
138
160
  default: false
139
- }).with(Workspace).exec(async function(prompt, app, profile, model, json, thinking, rpc, resume, interactive, workspace) {
140
- const options = { app, profile, model, json, thinking, rpc, interactive, resume };
161
+ }).with(Workspace).exec(async function(prompt, app, profile, model, json, thinking, rpc, rpcListen, resume, interactive, workspace) {
162
+ const options = { app, profile, model, json, thinking, rpc, rpcListen, interactive, resume };
141
163
  await this.codeScript.run(workspace, prompt ?? "", options);
142
164
  })
143
165
  })) {
@@ -1 +1 @@
1
- {"byCommand":{"create-workspace":"workspace","generate-agent-rules":"workspace","lint":"workspace","lint-all":"workspace","sync-all":"workspace","init":"workspace","agent":"agent","code":"code","create-application":"application","remove-application":"application","plan-slice":"application","sync":"application","script":"application","console":"application","logs":"application","build":"application","b":"application","typecheck":"application","t":"application","test":"application","build-ios":"application","bi":"application","build-android":"application","ba":"application","start":"application","s":"application","start-ios":"application","si":"application","start-android":"application","sa":"application","release-ios":"application","release-android":"application","release-source":"application","codepush":"application","dbup":"application","dbdown":"application","configure-app":"application","create-library":"library","remove-library":"library","sync-library":"library","library-status":"library","install-library":"library","start-registry":"localRegistry","reset-registry":"localRegistry","smoke-registry":"localRegistry","version":"package","create-package":"package","remove-package":"package","sync-package":"package","build-package":"package","verify-dist-package":"package","verify-akan-publish-packages":"package","create-module":"module","remove-module":"module","create-service":"module","create-view":"module","create-unit":"module","create-template":"module","create-crud-page":"page","context":"context","doctor":"context","mcp-install":"context","mcp":"context","mcp-call":"context","login":"cloud","logout":"cloud","deploy-akan":"cloud","update":"cloud","download-env":"cloud","upload-env":"cloud","subspace":"subspace","guideline":"guideline","create-scalar":"scalar","remove-scalar":"scalar","create-ui":"primitive","add-field":"primitive","add-enum-field":"primitive","quality":"quality","repair":"repair","workflow":"workflow","tunnel":"tunnel"}}
1
+ {"byCommand":{"create-workspace":"workspace","generate-agent-rules":"workspace","lint":"workspace","lint-all":"workspace","sync-all":"workspace","init":"workspace","agent":"agent","code":"code","create-application":"application","remove-application":"application","plan-slice":"application","sync":"application","script":"application","console":"application","logs":"application","build":"application","b":"application","typecheck":"application","t":"application","test":"application","build-ios":"application","bi":"application","build-android":"application","ba":"application","start":"application","s":"application","start-ios":"application","si":"application","start-android":"application","sa":"application","release-ios":"application","release-android":"application","release-source":"application","codepush":"application","dbup":"application","db-export":"application","db-import":"application","dbdown":"application","configure-app":"application","create-library":"library","remove-library":"library","sync-library":"library","library-status":"library","install-library":"library","start-registry":"localRegistry","reset-registry":"localRegistry","smoke-registry":"localRegistry","version":"package","create-package":"package","remove-package":"package","sync-package":"package","build-package":"package","verify-dist-package":"package","verify-akan-publish-packages":"package","create-module":"module","remove-module":"module","create-service":"module","create-view":"module","create-unit":"module","create-template":"module","create-crud-page":"page","context":"context","doctor":"context","mcp-install":"context","mcp":"context","mcp-call":"context","login":"cloud","logout":"cloud","deploy-akan":"cloud","test-platforms":"cloud","update":"cloud","download-env":"cloud","upload-env":"cloud","subspace":"subspace","guideline":"guideline","create-scalar":"scalar","remove-scalar":"scalar","create-ui":"primitive","add-field":"primitive","add-enum-field":"primitive","quality":"quality","repair":"repair","workflow":"workflow","tunnel":"tunnel"}}
@@ -2,25 +2,25 @@
2
2
  import {
3
3
  Workspace,
4
4
  command
5
- } from "./index-ycy302an.js";
5
+ } from "./index-qdgzsnhg.js";
6
6
  import"./index-q0y2jq9j.js";
7
- import"./index-bwxpk2cj.js";
7
+ import"./index-crmeqnmf.js";
8
8
  import"./index-6wwzs1bc.js";
9
9
  import"./index-by5gpp8x.js";
10
- import"./index-yw6g3bbv.js";
11
- import"./index-rpgxs245.js";
12
- import"./index-cjw1sj1x.js";
13
- import"./index-erfc1x40.js";
10
+ import"./index-2446k7b4.js";
11
+ import"./index-18zybgkc.js";
12
+ import"./index-3jrp517k.js";
13
+ import"./index-vqx8bdxz.js";
14
14
  import"./index-s5rhm04y.js";
15
- import"./index-ef228gzf.js";
16
- import"./index-zmj143x7.js";
17
- import"./index-mt2154s2.js";
18
- import"./index-pn8mhpps.js";
19
- import"./index-d9fjz06h.js";
20
- import"./index-q9c3c0hy.js";
15
+ import"./index-53176s7j.js";
16
+ import"./index-txr7dj2g.js";
17
+ import"./index-22xtgmhn.js";
18
+ import"./index-esk82rvk.js";
19
+ import"./index-zqgj2rt2.js";
20
+ import"./index-4m929vvn.js";
21
21
  import {
22
22
  ContextScript
23
- } from "./index-dw943k93.js";
23
+ } from "./index-10dkrrww.js";
24
24
 
25
25
  // pkgs/@akanjs/cli/context/context.command.ts
26
26
  class ContextCommand extends command("context", [ContextScript], ({ public: target }) => ({
@@ -0,0 +1,22 @@
1
+ // @bun
2
+ import {
3
+ ContextRunner2
4
+ } from "./index-3jrp517k.js";
5
+ import"./index-53176s7j.js";
6
+ import"./index-txr7dj2g.js";
7
+ import"./index-4m929vvn.js";
8
+ import"./index-zqgj2rt2.js";
9
+ import"./index-esk82rvk.js";
10
+ import"./index-22xtgmhn.js";
11
+ import"./index-18zybgkc.js";
12
+ import"./index-2446k7b4.js";
13
+ import"./index-s5rhm04y.js";
14
+ import"./index-vqx8bdxz.js";
15
+ import"./index-qdgzsnhg.js";
16
+ import"./index-crmeqnmf.js";
17
+ import"./index-by5gpp8x.js";
18
+ import"./index-6wwzs1bc.js";
19
+ import"./index-q0y2jq9j.js";
20
+ export {
21
+ ContextRunner2 as ContextRunner
22
+ };