@akanjs/cli 3.1.1-rc.15 → 3.1.1-rc.16

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 (71) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-gtwn7tmb.js → CodeAgent-23ewzxqa.js} +2 -2
  3. package/{CodeTui-v941fqdh.js → CodeTui-kc99fk78.js} +1 -1
  4. package/TunnelShare-dk2gw78d.js +14 -0
  5. package/{agent.command-h82gepwn.js → agent.command-knp5j7bq.js} +5 -5
  6. package/akanCode.js +2 -2
  7. package/{application.command-j1reb9p1.js → application.command-bvfd1680.js} +9 -9
  8. package/{applicationBuildRunner-w20x63mz.js → applicationBuildRunner-4ajaesk1.js} +6 -5
  9. package/buildBatch.proc.js +5 -5
  10. package/{cloud.command-zd2mfkm0.js → cloud.command-f2w40fyy.js} +13 -13
  11. package/cloud.script-2r82sv0f.js +24 -0
  12. package/{code.command-dyet4xn6.js → code.command-dbhhnahn.js} +6 -6
  13. package/{context.command-79gxczm4.js → context.command-yswjwv6y.js} +17 -16
  14. package/context.runner-c3wsh2jw.js +26 -0
  15. package/{guideline.command-xwkskvky.js → guideline.command-ztx6dkpk.js} +2 -2
  16. package/guidelines/conventions/conventions.instruction.md +56 -10
  17. package/incrementalBuilder.proc.js +3 -3
  18. package/{index-yknrmkmt.js → index-005dqc83.js} +2 -2
  19. package/{index-qmeh0s05.js → index-00ke4phc.js} +2 -2
  20. package/{index-hdzjaq7s.js → index-2epb3wgh.js} +2 -2
  21. package/{index-rshwdv9w.js → index-2p1brf5e.js} +2 -2
  22. package/{index-wvvwdzfw.js → index-4332q6yj.js} +3 -3
  23. package/{index-6pzt55w3.js → index-4t4qb8jg.js} +3 -3
  24. package/{index-7ktk2hnz.js → index-76jwsm3g.js} +2 -2
  25. package/{index-tzzs52h0.js → index-7ndgffg4.js} +9 -9
  26. package/{index-1e2955yd.js → index-921cxqrd.js} +3 -1
  27. package/{index-8jb5ep2e.js → index-97fsvy66.js} +2 -2
  28. package/{index-pc9ps0hx.js → index-9sa6abze.js} +8 -8
  29. package/{index-jjd97ya6.js → index-deeskxjh.js} +1 -1
  30. package/{index-cz9g85xh.js → index-er16p89s.js} +1 -1
  31. package/{index-ygy8c12j.js → index-gxj80jz7.js} +1 -1
  32. package/index-hvg3esm0.js +1844 -0
  33. package/{index-41d3zx66.js → index-k9k18vq9.js} +3 -3
  34. package/{index-nmy1rana.js → index-m54n0v29.js} +4 -4
  35. package/index-m5n3ka0p.js +18 -0
  36. package/{index-brpk7gd8.js → index-m6qgr1rx.js} +7 -7
  37. package/{index-553xyb55.js → index-m93qg20j.js} +1 -1
  38. package/{index-4rwfh2de.js → index-mk391h0z.js} +3 -3
  39. package/{index-ch1sv7ke.js → index-nzfgyw3b.js} +9 -21
  40. package/{index-2qzzp0c9.js → index-p2pahmsa.js} +3 -3
  41. package/{index-kbbyzs6j.js → index-qx4r4cj2.js} +2 -2
  42. package/index-rxse80x6.js +408 -0
  43. package/{index-kr62ph5a.js → index-s4c2y5gs.js} +2 -2
  44. package/{index-jtydvvq7.js → index-saj9cx3a.js} +4 -4
  45. package/index-vgt25eh1.js +615 -0
  46. package/{index-8rvwgd1r.js → index-vq77g679.js} +1 -1
  47. package/{index-xeh7m2j5.js → index-xfp4dcnx.js} +1 -1
  48. package/{index-pqdz7rat.js → index-xjwcp91m.js} +910 -36
  49. package/{index-7abjzny1.js → index-ysyt782g.js} +33 -37
  50. package/index.js +22 -22
  51. package/{library.command-td8t85kb.js → library.command-hmbkcwzw.js} +3 -3
  52. package/{localRegistry.command-jx9zkmxf.js → localRegistry.command-sq5p4c9x.js} +15 -13
  53. package/{module.command-j70mqgpp.js → module.command-n4z29zcv.js} +5 -5
  54. package/{package.command-1b1v6k5v.js → package.command-20025dy3.js} +3 -3
  55. package/package.json +2 -2
  56. package/{page.command-m31w2tsz.js → page.command-q8fvpjer.js} +3 -3
  57. package/{pipeline.command-q7b8wy55.js → pipeline.command-8j97fq88.js} +2 -2
  58. package/{primitive.command-4zrbhkb9.js → primitive.command-e5y6dqp1.js} +6 -6
  59. package/{projectTypecheck-synx6qff.js → projectTypecheck-tbdye9k3.js} +1 -1
  60. package/{quality.command-cy0pgqjz.js → quality.command-168pt5vm.js} +621 -311
  61. package/{repair.command-98n6zxg7.js → repair.command-dq1gckth.js} +5 -5
  62. package/{scalar.command-rak5pjk3.js → scalar.command-5vwf152w.js} +4 -4
  63. package/{subspace.command-ej0rk116.js → subspace.command-182be8vj.js} +8 -8
  64. package/{tunnel.command-kdx3amrc.js → tunnel.command-bfzj7xkb.js} +7 -7
  65. package/{workflow.command-gffk9nj9.js → workflow.command-3g53242s.js} +37 -13
  66. package/workspace.command-h7399jwv.js +260 -0
  67. package/TunnelShare-26ty9skr.js +0 -14
  68. package/cloud.script-vdj8ymch.js +0 -24
  69. package/context.runner-ejag7mhr.js +0 -25
  70. package/index-y5m4j2w6.js +0 -856
  71. package/workspace.command-097hv6n1.js +0 -521
@@ -3,15 +3,15 @@ import {
3
3
  Workspace,
4
4
  script,
5
5
  command
6
- } from "./index-qmeh0s05.js";
6
+ } from "./index-00ke4phc.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-1e2955yd.js";
8
+ import"./index-921cxqrd.js";
9
9
  import"./index-hj6w4ka1.js";
10
- import"./index-pqdz7rat.js";
11
- import"./index-kr62ph5a.js";
10
+ import"./index-xjwcp91m.js";
11
+ import"./index-s4c2y5gs.js";
12
12
  import {
13
13
  RepairRunner
14
- } from "./index-wvvwdzfw.js";
14
+ } from "./index-4332q6yj.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/repair/repair.script.ts
17
17
  import { Logger } from "akanjs/common";
@@ -2,15 +2,15 @@
2
2
  import {
3
3
  Sys,
4
4
  command
5
- } from "./index-qmeh0s05.js";
5
+ } from "./index-00ke4phc.js";
6
6
  import"./index-52w0fvh8.js";
7
- import"./index-1e2955yd.js";
7
+ import"./index-921cxqrd.js";
8
8
  import {
9
9
  renderPrimitiveReport
10
- } from "./index-pqdz7rat.js";
10
+ } from "./index-xjwcp91m.js";
11
11
  import {
12
12
  ScalarScript
13
- } from "./index-kbbyzs6j.js";
13
+ } from "./index-qx4r4cj2.js";
14
14
 
15
15
  // pkgs/@akanjs/cli/scalar/scalar.command.ts
16
16
  import { Logger, lowerlize } from "akanjs/common";
@@ -5,7 +5,7 @@ import {
5
5
  runner,
6
6
  script,
7
7
  command
8
- } from "./index-qmeh0s05.js";
8
+ } from "./index-00ke4phc.js";
9
9
  import {
10
10
  FileSys2
11
11
  } from "./index-52w0fvh8.js";
@@ -14,20 +14,20 @@ import {
14
14
  Executor,
15
15
  WorkspaceExecutor,
16
16
  AppExecutor
17
- } from "./index-1e2955yd.js";
17
+ } from "./index-921cxqrd.js";
18
18
  import {
19
19
  GlobalConfig
20
- } from "./index-7ktk2hnz.js";
20
+ } from "./index-76jwsm3g.js";
21
21
  import"./index-m9jj544v.js";
22
- import"./index-2qzzp0c9.js";
23
- import"./index-yknrmkmt.js";
24
- import"./index-cz9g85xh.js";
22
+ import"./index-p2pahmsa.js";
23
+ import"./index-005dqc83.js";
24
+ import"./index-er16p89s.js";
25
25
  import {
26
26
  SubspaceConfig
27
27
  } from "./index-4pf8g7ff.js";
28
28
  import {
29
29
  SlicePlanner
30
- } from "./index-553xyb55.js";
30
+ } from "./index-m93qg20j.js";
31
31
 
32
32
  // pkgs/@akanjs/devkit/subspace.ts
33
33
  import { mkdir as mkdir2 } from "fs/promises";
@@ -816,7 +816,7 @@ class SubspaceRunner extends runner("subspace") {
816
816
  if (!asked)
817
817
  return { name: subspace.name, workspaceId, host, apps, libs: [], outcome: "cancelled", files: [] };
818
818
  const { libs } = await subspace.slice();
819
- const { CloudScript } = await import("./cloud.script-vdj8ymch.js");
819
+ const { CloudScript } = await import("./cloud.script-2r82sv0f.js");
820
820
  const { files } = await CommandContainer.get(CloudScript).uploadEnv(workspace, {
821
821
  host,
822
822
  workspaceId,
@@ -4,22 +4,22 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-qmeh0s05.js";
7
+ } from "./index-00ke4phc.js";
8
8
  import"./index-52w0fvh8.js";
9
9
  import {
10
10
  AppExecutor
11
- } from "./index-1e2955yd.js";
11
+ } from "./index-921cxqrd.js";
12
12
  import {
13
13
  GlobalConfig,
14
14
  CloudApi
15
- } from "./index-7ktk2hnz.js";
15
+ } from "./index-76jwsm3g.js";
16
16
  import"./index-m9jj544v.js";
17
- import"./index-2qzzp0c9.js";
18
- import"./index-yknrmkmt.js";
19
- import"./index-cz9g85xh.js";
17
+ import"./index-p2pahmsa.js";
18
+ import"./index-005dqc83.js";
19
+ import"./index-er16p89s.js";
20
20
  import {
21
21
  TunnelShare2
22
- } from "./index-xeh7m2j5.js";
22
+ } from "./index-xfp4dcnx.js";
23
23
  import {
24
24
  writeClipboard
25
25
  } from "./index-p6pbz9n5.js";
@@ -3,20 +3,21 @@ import {
3
3
  Workspace,
4
4
  script,
5
5
  command
6
- } from "./index-qmeh0s05.js";
6
+ } from "./index-00ke4phc.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-1e2955yd.js";
8
+ import"./index-921cxqrd.js";
9
9
  import"./index-hj6w4ka1.js";
10
- import"./index-pqdz7rat.js";
11
- import"./index-kr62ph5a.js";
12
- import"./index-ygy8c12j.js";
13
- import"./index-nmy1rana.js";
14
- import"./index-7abjzny1.js";
15
- import"./index-wvvwdzfw.js";
16
- import"./index-kbbyzs6j.js";
10
+ import"./index-xjwcp91m.js";
11
+ import"./index-s4c2y5gs.js";
12
+ import"./index-gxj80jz7.js";
13
+ import"./index-m54n0v29.js";
14
+ import"./index-ysyt782g.js";
15
+ import"./index-4332q6yj.js";
16
+ import"./index-qx4r4cj2.js";
17
+ import"./index-vgt25eh1.js";
17
18
  import {
18
19
  WorkflowRunner
19
- } from "./index-y5m4j2w6.js";
20
+ } from "./index-rxse80x6.js";
20
21
 
21
22
  // pkgs/@akanjs/cli/workflow/workflow.script.ts
22
23
  import { Logger } from "akanjs/common";
@@ -38,7 +39,7 @@ class WorkflowScript extends script("workflow", [WorkflowRunner]) {
38
39
  return;
39
40
  }
40
41
  if (action === "plan") {
41
- Logger.rawLog(await this.workflowRunner.plan(workflow, inputs, { format, out }));
42
+ Logger.rawLog(await this.workflowRunner.plan(workflow, inputs, { format, out, workspace }));
42
43
  return;
43
44
  }
44
45
  if (action === "apply") {
@@ -69,8 +70,31 @@ class WorkflowCommand extends command("workflow", [WorkflowScript], ({ public: t
69
70
  workflow: target({ desc: "List, explain, plan, apply, validate, or report Akan workflows" }).arg("action", String, {
70
71
  desc: "list, explain, plan, apply, validate, or report",
71
72
  enum: ["list", "explain", "plan", "apply", "validate", "report"]
72
- }).arg("workflow", String, { desc: "workflow name, plan path, or run id", nullable: true }).with(Workspace).option("format", String, { desc: "output format", flag: "o", default: "markdown", enum: ["markdown", "json"] }).option("out", String, { flag: "w", desc: "write workflow plan JSON to this path", nullable: true }).option("dryRun", Boolean, { flag: "r", desc: "show predicted apply report without writing files", default: false }).option("app", String, { desc: "target app or library name", nullable: true }).option("module", String, { desc: "target module name", nullable: true }).option("field", String, { desc: "field name", nullable: true }).option("type", String, { desc: "field type or scalar name", nullable: true }).option("values", String, { flag: "l", desc: "comma-separated values", nullable: true }).option("default", String, { desc: "default value", nullable: true }).option("scalar", String, { flag: "c", desc: "scalar name", nullable: true }).option("surface", String, { flag: "u", desc: "UI surface name", nullable: true }).option("mutation", String, { flag: "n", desc: "mutation name", nullable: true }).option("slice", String, { flag: "i", desc: "slice name", nullable: true }).exec(async function(action, workflow, workspace, format, out, dryRun, app, module, field, typeName, values, defaultValue, scalar, surface, mutation, slice) {
73
- await this.workflowScript.workflow(action, workflow, { app, module, field, type: typeName, values, default: defaultValue, scalar, surface, mutation, slice }, { format, out, dryRun, workspace });
73
+ }).arg("workflow", String, { desc: "workflow name, plan path, or run id", nullable: true }).with(Workspace).option("format", String, { desc: "output format", flag: "o", default: "markdown", enum: ["markdown", "json"] }).option("out", String, { flag: "w", desc: "write workflow plan JSON to this path", nullable: true }).option("dryRun", Boolean, { flag: "r", desc: "show predicted apply report without writing files", default: false }).option("app", String, { desc: "target app or library name", nullable: true }).option("module", String, { desc: "target module name", nullable: true }).option("field", String, { desc: "field name", nullable: true }).option("type", String, { desc: "field type or scalar name", nullable: true }).option("values", String, { flag: "l", desc: "comma-separated values", nullable: true }).option("default", String, { desc: "default value", nullable: true }).option("scalar", String, { flag: "c", desc: "scalar name", nullable: true }).option("surface", String, { flag: "u", desc: "UI surface name", nullable: true }).option("mutation", String, { flag: "n", desc: "mutation name", nullable: true }).option("slice", String, { flag: "i", desc: "slice name", nullable: true }).option("guard", String, { flag: "g", desc: "comma-separated guard class names", nullable: true }).option("with", String, {
74
+ flag: "b",
75
+ desc: "comma-separated <serviceRef>.<method> writes committed with the mutation",
76
+ nullable: true
77
+ }).option("after", String, {
78
+ flag: "e",
79
+ desc: "comma-separated <serviceRef>.<method> side effects run after the commit",
80
+ nullable: true
81
+ }).option("interaction", String, { flag: "k", desc: "interaction name", nullable: true }).exec(async function(action, workflow, workspace, format, out, dryRun, app, module, field, typeName, values, defaultValue, scalar, surface, mutation, slice, guard, withCalls, after, interaction) {
82
+ await this.workflowScript.workflow(action, workflow, {
83
+ app,
84
+ module,
85
+ field,
86
+ type: typeName,
87
+ values,
88
+ default: defaultValue,
89
+ scalar,
90
+ surface,
91
+ mutation,
92
+ slice,
93
+ guard,
94
+ with: withCalls,
95
+ after,
96
+ interaction
97
+ }, { format, out, dryRun, workspace });
74
98
  })
75
99
  })) {
76
100
  }
@@ -0,0 +1,260 @@
1
+ // @bun
2
+ import {
3
+ Exec,
4
+ Workspace,
5
+ script,
6
+ command
7
+ } from "./index-00ke4phc.js";
8
+ import"./index-52w0fvh8.js";
9
+ import {
10
+ AppExecutor,
11
+ LibExecutor,
12
+ PkgExecutor
13
+ } from "./index-921cxqrd.js";
14
+ import"./index-62md4dwy.js";
15
+ import {
16
+ defaultMaxDiagnostics,
17
+ WorkspaceRunner
18
+ } from "./index-hvg3esm0.js";
19
+ import"./index-hj6w4ka1.js";
20
+ import"./index-vgt25eh1.js";
21
+ import"./index-xjwcp91m.js";
22
+ import"./index-s4c2y5gs.js";
23
+ import"./index-zzvvc845.js";
24
+ import {
25
+ AgentScript
26
+ } from "./index-4t4qb8jg.js";
27
+ import"./index-5nd1wtkv.js";
28
+ import"./index-p2pahmsa.js";
29
+ import"./index-vq77g679.js";
30
+ import"./index-m9jj544v.js";
31
+ import"./index-005dqc83.js";
32
+ import"./index-er16p89s.js";
33
+ import {
34
+ LibraryScript
35
+ } from "./index-2p1brf5e.js";
36
+ import {
37
+ ApplicationScript
38
+ } from "./index-7ndgffg4.js";
39
+ import"./index-7md2g9vw.js";
40
+ import"./index-76jwsm3g.js";
41
+ import"./index-tvehn2sp.js";
42
+ import {
43
+ PackageScript
44
+ } from "./index-2epb3wgh.js";
45
+ import"./index-nzfgyw3b.js";
46
+ import {
47
+ CloudScript2
48
+ } from "./index-m6qgr1rx.js";
49
+ import"./index-9sa6abze.js";
50
+ import"./index-4332q6yj.js";
51
+ import"./index-gxj80jz7.js";
52
+ import"./index-m54n0v29.js";
53
+ import"./index-ysyt782g.js";
54
+ import"./index-qx4r4cj2.js";
55
+ import"./index-rxse80x6.js";
56
+ import {
57
+ ContextScript
58
+ } from "./index-saj9cx3a.js";
59
+ import"./index-m93qg20j.js";
60
+
61
+ // pkgs/@akanjs/cli/workspace/workspace.script.ts
62
+ import { Logger } from "akanjs/common";
63
+ class WorkspaceScript extends script("workspace", [
64
+ WorkspaceRunner,
65
+ ApplicationScript,
66
+ LibraryScript,
67
+ PackageScript,
68
+ CloudScript2,
69
+ ContextScript,
70
+ AgentScript
71
+ ]) {
72
+ async createWorkspace(repoName, appName, {
73
+ dirname = ".",
74
+ installLibs = false,
75
+ init = true,
76
+ registryUrl,
77
+ owner,
78
+ mcpInstall = true,
79
+ agentInstall = true
80
+ }) {
81
+ const akanVersion = await this.packageScript.version(null, { log: false });
82
+ const workspace = await this.workspaceRunner.createWorkspace(repoName, appName, {
83
+ dirname,
84
+ init,
85
+ akanVersion,
86
+ ...registryUrl ? { registryUrl } : {},
87
+ ...owner ? { owner } : {}
88
+ });
89
+ if (installLibs) {
90
+ await this.libraryScript.installLibrary(workspace, "util");
91
+ await this.libraryScript.installLibrary(workspace, "shared");
92
+ }
93
+ await this.applicationScript.createApplication(appName, workspace, {
94
+ libs: installLibs ? ["util", "shared"] : [],
95
+ sample: true
96
+ });
97
+ await workspace.applyTemplate({
98
+ basePath: `apps/${appName}`,
99
+ template: "appSample",
100
+ dict: { appName },
101
+ options: { libs: installLibs ? ["util", "shared"] : [] }
102
+ });
103
+ if (agentInstall)
104
+ await this.agentScript.agent(workspace, "install", "all", { force: true });
105
+ if (mcpInstall)
106
+ await this.contextScript.mcpInstall(workspace, "all", { force: true });
107
+ const gitSpinner = workspace.spinning("Initializing git repository and commit...");
108
+ try {
109
+ await workspace.commit("Initial commit", { init: true });
110
+ gitSpinner.succeed("Git repository initialized and committed");
111
+ } catch (_) {
112
+ gitSpinner.fail("Git repository initialization failed. It's not fatal, you can commit manually");
113
+ }
114
+ Logger.rawLog(`
115
+ \uD83C\uDF89 Welcome aboard! Workspace created in ${workspace.workspaceRoot}`);
116
+ Logger.rawLog(`\uD83D\uDE80 Run \`cd ${workspace.workspaceRoot} && akan start ${appName}\` to start the development server.`);
117
+ Logger.rawLog(`
118
+ \uD83D\uDC4B Happy coding!`);
119
+ }
120
+ async generateAgentRules(workspace, { overwrite = false, cursorRules = true } = {}) {
121
+ const spinner = workspace.spinning("Generating agent rules...");
122
+ const files = await this.workspaceRunner.generateAgentRules(workspace, { overwrite, cursorRules });
123
+ if (files.some((file) => file.filePath.endsWith("AGENTS.md")))
124
+ await this.agentScript.agent(workspace, "install", "agents-md", { force: overwrite });
125
+ spinner.succeed(`Agent rules ready (${files.length} file${files.length === 1 ? "" : "s"})`);
126
+ }
127
+ async machineKeygen(workspace, out) {
128
+ const { file, publicKey } = await this.workspaceRunner.machineKeygen(workspace, out);
129
+ const access = process.platform === "win32" ? "; Windows gives it the permissions of its folder, so keep it in one only you can read" : " (mode 600)";
130
+ Logger.rawLog(`Wrote the private key to ${file}${access}. Set it as AKAN_MACHINE_PRIVATE_KEY on the server that issues machine tokens; nothing else needs it.`);
131
+ Logger.rawLog(`A server that only verifies them takes the public key:
132
+ AKAN_MACHINE_PUBLIC_KEY=${publicKey}`);
133
+ }
134
+ async lint(exec, workspace, { fix = true, maxDiagnostics } = {}) {
135
+ if (exec instanceof AppExecutor)
136
+ await this.applicationScript.sync(exec);
137
+ else if (exec instanceof LibExecutor)
138
+ await this.libraryScript.syncLibrary(exec);
139
+ const spinner = workspace.spinning(`Linting${fix ? " with fix" : ""}...`);
140
+ try {
141
+ await this.workspaceRunner.lint(exec, workspace, { fix, maxDiagnostics });
142
+ spinner.succeed("Lint completed with no errors");
143
+ } catch (error) {
144
+ spinner.fail("Lint failed with errors");
145
+ throw error;
146
+ }
147
+ }
148
+ async lintAll(workspace, { fix = true, maxDiagnostics } = {}) {
149
+ const [appNames, libNames, pkgNames] = await workspace.getExecs();
150
+ const options = { fix, maxDiagnostics };
151
+ await Promise.all(appNames.map((appName) => this.applicationScript.sync(AppExecutor.from(workspace, appName))));
152
+ await Promise.all(libNames.map((libName) => this.libraryScript.syncLibrary(LibExecutor.from(workspace, libName))));
153
+ await Promise.all([
154
+ ...appNames.map((appName) => this.workspaceRunner.lint(AppExecutor.from(workspace, appName), workspace, options)),
155
+ ...libNames.map((libName) => this.workspaceRunner.lint(LibExecutor.from(workspace, libName), workspace, options)),
156
+ ...pkgNames.filter((pkgName) => pkgName !== "contract").map((pkgName) => this.workspaceRunner.lint(PkgExecutor.from(workspace, pkgName), workspace, options))
157
+ ]);
158
+ }
159
+ async syncAll(workspace) {
160
+ const [appNames, libNames] = await workspace.getExecs();
161
+ for (const libName of libNames)
162
+ await this.libraryScript.syncLibrary(LibExecutor.from(workspace, libName));
163
+ for (const appName of appNames)
164
+ await this.applicationScript.sync(AppExecutor.from(workspace, appName));
165
+ }
166
+ async init(devProjectId, workspace, { host } = {}) {
167
+ const [bunfigExists, packageJsonExists, tsconfigExists] = await Promise.all([
168
+ workspace.exists("bunfig.toml"),
169
+ workspace.exists("package.json"),
170
+ workspace.exists("tsconfig.json")
171
+ ]);
172
+ const isRoot = bunfigExists && packageJsonExists && tsconfigExists;
173
+ if (!isRoot)
174
+ throw new Error("Current directory is not a root workspace");
175
+ const spinner = workspace.spinning("Initializing workspace...");
176
+ try {
177
+ await this.workspaceRunner.writeTopLevelEnv(workspace, devProjectId);
178
+ await this.cloudScript.downloadEnv(workspace, devProjectId, { host });
179
+ spinner.succeed("Workspace initialized");
180
+ } catch (error) {
181
+ spinner.fail("Workspace initialization failed");
182
+ throw error;
183
+ }
184
+ }
185
+ }
186
+
187
+ // pkgs/@akanjs/cli/workspace/workspace.command.ts
188
+ var maxDiagnosticsOption = {
189
+ desc: "How many diagnostics Biome prints before truncating (0 for no limit)",
190
+ default: defaultMaxDiagnostics
191
+ };
192
+
193
+ class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public: target }) => ({
194
+ createWorkspace: target({ desc: "Create a new Akan.js workspace", runsOnWorkspaceRoot: false }).arg("workspaceName", String, { desc: "what is the name of your organization?" }).option("app", String, { desc: "what is the codename of your first application? (e.g. myapp)" }).option("dir", String, {
195
+ desc: "directory of workspace",
196
+ default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "."
197
+ }).option("libs", Boolean, {
198
+ desc: "Do you want to install shared and util libraries? (admin, user file, etc.)",
199
+ enum: [
200
+ { label: "No, I want to start with empty workspace (Recommended)", value: false },
201
+ {
202
+ label: "Yes, I want to accelerate development by installing shared and util libraries (for akanjs experts)",
203
+ value: true
204
+ }
205
+ ],
206
+ default: false
207
+ }).option("init", Boolean, { desc: "Do you want to initialize the workspace? (Recommended)", default: true }).option("registry", String, {
208
+ desc: "npm registry URL for installing Akan packages",
209
+ default: process.env.AKAN_NPM_REGISTRY ?? "https://registry.npmjs.org"
210
+ }).option("owner", String, { desc: "owner of the workspace", default: process.env.GITHUB_OWNER, nullable: true }).option("mcpInstall", Boolean, {
211
+ desc: "Install the Akan MCP server config for Cursor, Claude Code, and Codex? (Recommended)",
212
+ default: true
213
+ }).option("agentInstall", Boolean, {
214
+ flag: "A",
215
+ desc: "Install Akan agent rules (AGENTS.md, CLAUDE.md, Cursor)? (Recommended)",
216
+ default: true
217
+ }).exec(async function(workspaceName, app, dir, libs, init, registry, owner, mcpInstall, agentInstall) {
218
+ const appName = app || "app";
219
+ await this.workspaceScript.createWorkspace(workspaceName.toLowerCase().replace(/ /g, "-"), appName.toLowerCase().replace(/ /g, "-"), {
220
+ dirname: dir,
221
+ installLibs: libs,
222
+ init,
223
+ owner,
224
+ mcpInstall,
225
+ agentInstall,
226
+ ...registry ? { registryUrl: registry } : {}
227
+ });
228
+ }),
229
+ generateAgentRules: target({
230
+ desc: "Generate AGENTS.md, CLAUDE.md, and optional Cursor rules for Akan coding agents"
231
+ }).option("overwrite", Boolean, { desc: "Overwrite existing agent rule files", default: false }).option("cursorRules", Boolean, { desc: "Generate .cursor/rules/akan.mdc", default: true }).with(Workspace).exec(async function(overwrite, cursorRules, workspace) {
232
+ await this.workspaceScript.generateAgentRules(workspace, { overwrite, cursorRules });
233
+ }),
234
+ lint: target({ desc: "Lint and fix code in a specific app/lib/pkg" }).with(Exec).option("fix", Boolean, { default: true }).option("maxDiagnostics", Number, maxDiagnosticsOption).with(Workspace).exec(async function(exec, fix, maxDiagnostics, workspace) {
235
+ await this.workspaceScript.lint(exec, workspace, { fix, maxDiagnostics });
236
+ }),
237
+ lintAll: target({ desc: "Lint and fix code in all apps and libraries" }).option("fix", Boolean, { default: true }).option("maxDiagnostics", Number, maxDiagnosticsOption).with(Workspace).exec(async function(fix, maxDiagnostics, workspace) {
238
+ await this.workspaceScript.lintAll(workspace, { fix, maxDiagnostics });
239
+ }),
240
+ machineKeygen: target({
241
+ desc: "Make an Ed25519 key for machine tokens: write the private key to a file, print the public key"
242
+ }).arg("out", String, {
243
+ desc: "file the private key is written to (mode 600; on Windows, its folder's permissions); an existing one is refused"
244
+ }).with(Workspace).exec(async function(out, workspace) {
245
+ await this.workspaceScript.machineKeygen(workspace, out);
246
+ }),
247
+ syncAll: target({ desc: "Sync dependencies and configuration for all apps and libraries" }).with(Workspace).exec(async function(workspace) {
248
+ await this.workspaceScript.syncAll(workspace);
249
+ }),
250
+ init: target({ desc: "Initialize the workspace", runsOnWorkspaceRoot: false }).arg("devProjectId", String, { desc: "the ID of the workspace" }).option("host", String, {
251
+ desc: "host of the cloud to target (default: cloud.host of the root akan.config.ts, else Akan Cloud)",
252
+ nullable: true
253
+ }).with(Workspace).exec(async function(devProjectId, host, workspace) {
254
+ await this.workspaceScript.init(devProjectId, workspace, { host });
255
+ })
256
+ })) {
257
+ }
258
+ export {
259
+ WorkspaceCommand
260
+ };
@@ -1,14 +0,0 @@
1
- // @bun
2
- import {
3
- TunnelShare2
4
- } from "./index-xeh7m2j5.js";
5
- import"./index-7ktk2hnz.js";
6
- import"./index-2qzzp0c9.js";
7
- import"./index-m9jj544v.js";
8
- import"./index-yknrmkmt.js";
9
- import"./index-cz9g85xh.js";
10
- import"./index-1e2955yd.js";
11
- import"./index-52w0fvh8.js";
12
- export {
13
- TunnelShare2 as TunnelShare
14
- };
@@ -1,24 +0,0 @@
1
- // @bun
2
- import {
3
- CloudScript2
4
- } from "./index-brpk7gd8.js";
5
- import"./index-ch1sv7ke.js";
6
- import"./index-tzzs52h0.js";
7
- import"./index-553xyb55.js";
8
- import"./index-rshwdv9w.js";
9
- import"./index-hdzjaq7s.js";
10
- import"./index-8rvwgd1r.js";
11
- import"./index-7ktk2hnz.js";
12
- import"./index-2qzzp0c9.js";
13
- import"./index-m9jj544v.js";
14
- import"./index-qmeh0s05.js";
15
- import"./index-7md2g9vw.js";
16
- import"./index-yknrmkmt.js";
17
- import"./index-5nd1wtkv.js";
18
- import"./index-cz9g85xh.js";
19
- import"./index-1e2955yd.js";
20
- import"./index-tvehn2sp.js";
21
- import"./index-52w0fvh8.js";
22
- export {
23
- CloudScript2 as CloudScript
24
- };
@@ -1,25 +0,0 @@
1
- // @bun
2
- import {
3
- ContextRunner2
4
- } from "./index-pc9ps0hx.js";
5
- import"./index-y5m4j2w6.js";
6
- import"./index-kbbyzs6j.js";
7
- import"./index-7abjzny1.js";
8
- import"./index-wvvwdzfw.js";
9
- import"./index-nmy1rana.js";
10
- import"./index-ygy8c12j.js";
11
- import"./index-8rvwgd1r.js";
12
- import"./index-2qzzp0c9.js";
13
- import"./index-m9jj544v.js";
14
- import"./index-kr62ph5a.js";
15
- import"./index-pqdz7rat.js";
16
- import"./index-zzvvc845.js";
17
- import"./index-qmeh0s05.js";
18
- import"./index-yknrmkmt.js";
19
- import"./index-cz9g85xh.js";
20
- import"./index-1e2955yd.js";
21
- import"./index-hj6w4ka1.js";
22
- import"./index-52w0fvh8.js";
23
- export {
24
- ContextRunner2 as ContextRunner
25
- };