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

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 (120) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-gtwn7tmb.js → CodeAgent-fbcq8vks.js} +2 -2
  3. package/{CodeTui-v941fqdh.js → CodeTui-0626gxqd.js} +1 -1
  4. package/TunnelShare-2p24xxza.js +14 -0
  5. package/agent.command-hpza0pg9.js +46 -0
  6. package/akanCode.js +5 -3
  7. package/{application.command-j1reb9p1.js → application.command-3a7q1hs2.js} +11 -10
  8. package/{applicationBuildRunner-w20x63mz.js → applicationBuildRunner-s7yt71j4.js} +6 -5
  9. package/buildBatch.proc.js +6 -6
  10. package/{cloud.command-zd2mfkm0.js → cloud.command-4vg0pcea.js} +15 -14
  11. package/cloud.script-nkmeyhet.js +25 -0
  12. package/{code.command-dyet4xn6.js → code.command-fbntb67p.js} +6 -6
  13. package/commandManifest.json +1 -1
  14. package/{context.command-79gxczm4.js → context.command-31rm54v0.js} +18 -17
  15. package/context.runner-w01a32ph.js +26 -0
  16. package/{guideline.command-xwkskvky.js → guideline.command-cv3by2ng.js} +3 -3
  17. package/guidelines/conventions/core.md +104 -0
  18. package/guidelines/conventions/rules/app.md +83 -0
  19. package/guidelines/conventions/rules/auth.md +45 -0
  20. package/guidelines/conventions/rules/config.md +56 -0
  21. package/guidelines/conventions/rules/constant.md +24 -0
  22. package/guidelines/conventions/rules/gates.md +31 -0
  23. package/guidelines/conventions/rules/layer.md +25 -0
  24. package/guidelines/conventions/rules/migration.md +27 -0
  25. package/guidelines/conventions/rules/module.md +90 -0
  26. package/guidelines/conventions/rules/page.md +56 -0
  27. package/guidelines/conventions/rules/sensitive.md +16 -0
  28. package/guidelines/conventions/rules/server.md +86 -0
  29. package/guidelines/conventions/rules/ssr.md +47 -0
  30. package/guidelines/conventions/rules/style.md +43 -0
  31. package/guidelines/conventions/rules/test.md +34 -0
  32. package/guidelines/conventions/rules/ts.md +95 -0
  33. package/guidelines/conventions/rules/tsx.md +75 -0
  34. package/guidelines/mcpRule/mcpRule.instruction.md +1 -1
  35. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +3 -3
  36. package/incrementalBuilder.proc.js +6 -6
  37. package/{index-pqdz7rat.js → index-05nxx4m5.js} +952 -47
  38. package/{index-41d3zx66.js → index-0ht91675.js} +37 -59
  39. package/{index-cz9g85xh.js → index-0zwznvv1.js} +1 -1
  40. package/{index-7ktk2hnz.js → index-0zyatd10.js} +2 -2
  41. package/{index-8jb5ep2e.js → index-12kzwak1.js} +3 -3
  42. package/{index-yknrmkmt.js → index-1dhf8ymv.js} +2 -2
  43. package/{index-qmeh0s05.js → index-3gccwenr.js} +2 -2
  44. package/{index-hdzjaq7s.js → index-3txrjt6n.js} +2 -2
  45. package/{index-tzzs52h0.js → index-57q1ayd2.js} +18 -1240
  46. package/index-5kh9scvs.js +514 -0
  47. package/index-5n5hds19.js +1246 -0
  48. package/{index-pc9ps0hx.js → index-6269mf2s.js} +10 -9
  49. package/{index-1e2955yd.js → index-64g9fsjy.js} +43 -12
  50. package/index-7zeb5r1p.js +653 -0
  51. package/{index-kr62ph5a.js → index-8s8b4eba.js} +45 -4
  52. package/{index-wvvwdzfw.js → index-922k2zwq.js} +3 -3
  53. package/{index-brpk7gd8.js → index-9ndw5d8j.js} +7 -7
  54. package/{index-xeh7m2j5.js → index-et6ce601.js} +1 -1
  55. package/{index-jtydvvq7.js → index-f5adsa58.js} +4 -4
  56. package/index-fbewhg4g.js +590 -0
  57. package/{index-7abjzny1.js → index-hm7x0c11.js} +33 -37
  58. package/{index-rshwdv9w.js → index-hvv5rnaq.js} +2 -2
  59. package/index-jje9qzyq.js +27 -0
  60. package/index-js1gj6f6.js +410 -0
  61. package/{index-2qzzp0c9.js → index-kjrvwzav.js} +3 -3
  62. package/index-m5n3ka0p.js +18 -0
  63. package/index-m6r88hhr.js +3582 -0
  64. package/{index-4rwfh2de.js → index-mt0wa941.js} +4 -4
  65. package/{index-553xyb55.js → index-mwj9q2ya.js} +1 -1
  66. package/{index-5nd1wtkv.js → index-p6x5b7hr.js} +1 -1
  67. package/index-r2wedvqn.js +138 -0
  68. package/{index-ygy8c12j.js → index-rvynj5gz.js} +1 -1
  69. package/{index-nmy1rana.js → index-tdv66eah.js} +4 -4
  70. package/{index-8rvwgd1r.js → index-w134p86k.js} +1 -1
  71. package/{index-jjd97ya6.js → index-wfczhj1z.js} +14 -36
  72. package/{index-dy0jx9ay.js → index-wwe9rsrx.js} +14 -0
  73. package/{index-kbbyzs6j.js → index-x5ecanqh.js} +2 -2
  74. package/{index-ch1sv7ke.js → index-zre4m2ce.js} +9 -21
  75. package/index.js +23 -22
  76. package/{library.command-td8t85kb.js → library.command-sh70fyvy.js} +3 -3
  77. package/{localRegistry.command-jx9zkmxf.js → localRegistry.command-2nbyy84d.js} +17 -14
  78. package/{module.command-j70mqgpp.js → module.command-n0bmtzwy.js} +5 -5
  79. package/{package.command-1b1v6k5v.js → package.command-7h9r51bz.js} +3 -3
  80. package/package.json +2 -2
  81. package/{page.command-m31w2tsz.js → page.command-vjtpfbb1.js} +3 -3
  82. package/{pipeline.command-q7b8wy55.js → pipeline.command-c93se3ar.js} +2 -2
  83. package/{primitive.command-4zrbhkb9.js → primitive.command-a3075qp2.js} +6 -6
  84. package/{projectTypecheck-synx6qff.js → projectTypecheck-sf9xwaga.js} +1 -1
  85. package/{prompter-76k56b37.js → prompter-hgcta8pb.js} +1 -1
  86. package/quality.command-dw1y9hmy.js +76 -0
  87. package/{repair.command-98n6zxg7.js → repair.command-tg57d8yt.js} +5 -5
  88. package/{scalar.command-rak5pjk3.js → scalar.command-cwzge353.js} +4 -4
  89. package/skills/akan-agent/SKILL.md +36 -0
  90. package/skills/akan-debug/SKILL.md +3 -3
  91. package/skills/akan-deps/SKILL.md +1 -2
  92. package/skills/akan-mcp/SKILL.md +40 -0
  93. package/skills/akan-page/SKILL.md +44 -0
  94. package/skills/akan-query/SKILL.md +38 -0
  95. package/skills/akan-runtime/SKILL.md +40 -0
  96. package/skills/akan-scaffold/SKILL.md +16 -6
  97. package/skills/akan-transport/SKILL.md +40 -0
  98. package/skills/akan-validate/SKILL.md +13 -11
  99. package/{subspace.command-ej0rk116.js → subspace.command-3h03c7kc.js} +8 -8
  100. package/templates/workspaceRoot/.gitignore.template +3 -0
  101. package/templates/workspaceRoot/AGENTS.md.template +4 -10
  102. package/{tunnel.command-kdx3amrc.js → tunnel.command-czaz6ys4.js} +7 -7
  103. package/{typeChecker-px49mezc.js → typeChecker-j2jdnqsr.js} +1 -1
  104. package/typecheck.proc.js +6 -1
  105. package/verify.command-nzwhtz71.js +91 -0
  106. package/{workflow.command-gffk9nj9.js → workflow.command-srhky88x.js} +47 -13
  107. package/workspace.command-9stchcd2.js +262 -0
  108. package/TunnelShare-26ty9skr.js +0 -14
  109. package/agent.command-h82gepwn.js +0 -25
  110. package/cloud.script-vdj8ymch.js +0 -24
  111. package/context.runner-ejag7mhr.js +0 -25
  112. package/guidelines/conventions/conventions.instruction.md +0 -617
  113. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +0 -291
  114. package/index-6pzt55w3.js +0 -279
  115. package/index-y5m4j2w6.js +0 -856
  116. package/index-zzvvc845.js +0 -74
  117. package/quality.command-cy0pgqjz.js +0 -1478
  118. package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +0 -69
  119. package/templates/workspaceRoot/docs/GENERATED.md.template +0 -55
  120. package/workspace.command-097hv6n1.js +0 -521
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  TypeChecker2
4
- } from "./index-dy0jx9ay.js";
4
+ } from "./index-wwe9rsrx.js";
5
5
  export {
6
6
  TypeChecker2 as TypeChecker
7
7
  };
package/typecheck.proc.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  TypeChecker2
4
- } from "./index-dy0jx9ay.js";
4
+ } from "./index-wwe9rsrx.js";
5
5
 
6
6
  // pkgs/@akanjs/devkit/typecheck/typecheck.proc.ts
7
7
  import { Logger } from "akanjs/common";
@@ -26,6 +26,11 @@ try {
26
26
  if (!configPath)
27
27
  throw new Error("AKAN_TYPECHECK_TSCONFIG is required");
28
28
  const result = TypeChecker2.checkProject(configPath);
29
+ if (process.env.AKAN_TYPECHECK_FORMAT === "json") {
30
+ const root = process.env.AKAN_TYPECHECK_ROOT ?? process.cwd();
31
+ process.stdout.write(JSON.stringify(TypeChecker2.toRecords(result.errors, root)));
32
+ process.exit(result.errors.length > 0 ? 1 : 0);
33
+ }
29
34
  if (result.errors.length > 0) {
30
35
  console.error(result.message);
31
36
  process.exit(1);
@@ -0,0 +1,91 @@
1
+ // @bun
2
+ import {
3
+ Workspace,
4
+ script,
5
+ ExitCodeError,
6
+ markCliErrorPrinted,
7
+ command
8
+ } from "./index-3gccwenr.js";
9
+ import"./index-52w0fvh8.js";
10
+ import"./index-64g9fsjy.js";
11
+ import {
12
+ ApplicationRunner
13
+ } from "./index-57q1ayd2.js";
14
+ import"./index-p6x5b7hr.js";
15
+ import"./index-kjrvwzav.js";
16
+ import"./index-w134p86k.js";
17
+ import"./index-m9jj544v.js";
18
+ import"./index-1dhf8ymv.js";
19
+ import"./index-0zwznvv1.js";
20
+ import"./index-62md4dwy.js";
21
+ import {
22
+ WorkspaceRunner
23
+ } from "./index-m6r88hhr.js";
24
+ import"./index-hj6w4ka1.js";
25
+ import"./index-fbewhg4g.js";
26
+ import {
27
+ VerifyPipeline,
28
+ VerifyReport,
29
+ VerifyScope
30
+ } from "./index-5kh9scvs.js";
31
+ import"./index-mwj9q2ya.js";
32
+
33
+ // pkgs/@akanjs/cli/verify/verify.script.ts
34
+ import path from "path";
35
+ import { Logger } from "akanjs/common";
36
+ class VerifyScript extends script("verify", [WorkspaceRunner, ApplicationRunner]) {
37
+ async verify(workspace, requested, options = {}) {
38
+ const [apps, libs, pkgs] = await workspace.getExecs();
39
+ const names = { apps, libs, pkgs };
40
+ const changes = options.files?.length ? options.files.map((file) => ({ code: " M", file: VerifyScript.#relative(workspace, file) })) : await VerifyScope.changesIn(workspace.workspaceRoot) ?? [];
41
+ const scope = VerifyScope.resolve(changes, names, requested);
42
+ const consoleOutput = Logger.consoleOutput;
43
+ Logger.consoleOutput = false;
44
+ const result = await new VerifyPipeline(workspace, this.workspaceRunner, this.applicationRunner).run(scope, { lintOnly: options.lintOnly, build: options.build }).finally(() => {
45
+ Logger.consoleOutput = consoleOutput;
46
+ });
47
+ Logger.rawLog(options.format === "json" ? VerifyReport.json(result) : VerifyReport.text(result, { max: options.max }));
48
+ if (result.ok)
49
+ return;
50
+ const failure = new ExitCodeError("verify failed", 1);
51
+ markCliErrorPrinted(failure);
52
+ throw failure;
53
+ }
54
+ static #relative(workspace, file) {
55
+ const absolute = path.isAbsolute(file) ? file : path.resolve(workspace.workspaceRoot, file);
56
+ return path.relative(workspace.workspaceRoot, absolute).split(path.sep).join("/");
57
+ }
58
+ }
59
+
60
+ // pkgs/@akanjs/cli/verify/verify.command.ts
61
+ var listOf = (value) => (value ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
62
+
63
+ class VerifyCommand extends command("verify", [VerifyScript], ({ public: target }) => ({
64
+ verify: target({
65
+ desc: "Sync, lint, typecheck and build what changed, in one run, and print only what failed",
66
+ stdio: true
67
+ }).arg("targets", String, {
68
+ desc: "apps, libraries or packages to verify, comma-separated (default: whatever git reports as changed)",
69
+ nullable: true
70
+ }).option("files", String, {
71
+ flag: "F",
72
+ desc: "verify these files only, comma-separated, instead of the git changes",
73
+ nullable: true
74
+ }).option("lintOnly", Boolean, {
75
+ flag: "l",
76
+ desc: "lint only: skip sync, typecheck, build and the SSR check",
77
+ default: false
78
+ }).option("build", Boolean, { flag: "b", desc: "build the changed apps once lint and typecheck pass", default: true }).option("max", Number, { flag: "m", desc: "diagnostic lines to print, 0 for all", default: 20 }).option("format", String, { flag: "f", desc: "output format", default: "text", enum: ["text", "json"] }).with(Workspace).exec(async function(targets, files, lintOnly, build, max, format, workspace) {
79
+ await this.verifyScript.verify(workspace, listOf(targets), {
80
+ files: listOf(files),
81
+ lintOnly,
82
+ build,
83
+ max,
84
+ format: format === "json" ? "json" : "text"
85
+ });
86
+ })
87
+ })) {
88
+ }
89
+ export {
90
+ VerifyCommand
91
+ };
@@ -3,20 +3,21 @@ import {
3
3
  Workspace,
4
4
  script,
5
5
  command
6
- } from "./index-qmeh0s05.js";
6
+ } from "./index-3gccwenr.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-1e2955yd.js";
8
+ import"./index-64g9fsjy.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-05nxx4m5.js";
11
+ import"./index-8s8b4eba.js";
12
+ import"./index-rvynj5gz.js";
13
+ import"./index-tdv66eah.js";
14
+ import"./index-hm7x0c11.js";
15
+ import"./index-922k2zwq.js";
16
+ import"./index-x5ecanqh.js";
17
+ import"./index-fbewhg4g.js";
17
18
  import {
18
19
  WorkflowRunner
19
- } from "./index-y5m4j2w6.js";
20
+ } from "./index-js1gj6f6.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,41 @@ 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("surfaces", String, {
74
+ flag: "s",
75
+ desc: "comma-separated UI surfaces add-field updates (template, unit, view)",
76
+ nullable: true
77
+ }).option("includeInLight", Boolean, {
78
+ flag: "p",
79
+ desc: "add the field to the Light<Model> projection used by lists and cards",
80
+ nullable: true
81
+ }).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, {
82
+ flag: "b",
83
+ desc: "comma-separated <serviceRef>.<method> writes committed with the mutation",
84
+ nullable: true
85
+ }).option("after", String, {
86
+ flag: "e",
87
+ desc: "comma-separated <serviceRef>.<method> side effects run after the commit",
88
+ nullable: true
89
+ }).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, surfaces, includeInLight, mutation, slice, guard, withCalls, after, interaction) {
90
+ await this.workflowScript.workflow(action, workflow, {
91
+ app,
92
+ module,
93
+ field,
94
+ type: typeName,
95
+ values,
96
+ default: defaultValue,
97
+ scalar,
98
+ surface,
99
+ surfaces,
100
+ includeInLight: includeInLight === null ? null : String(includeInLight),
101
+ mutation,
102
+ slice,
103
+ guard,
104
+ with: withCalls,
105
+ after,
106
+ interaction
107
+ }, { format, out, dryRun, workspace });
74
108
  })
75
109
  })) {
76
110
  }
@@ -0,0 +1,262 @@
1
+ // @bun
2
+ import {
3
+ Exec,
4
+ Workspace,
5
+ script,
6
+ command
7
+ } from "./index-3gccwenr.js";
8
+ import"./index-52w0fvh8.js";
9
+ import {
10
+ AppExecutor,
11
+ LibExecutor,
12
+ PkgExecutor
13
+ } from "./index-64g9fsjy.js";
14
+ import"./index-62md4dwy.js";
15
+ import {
16
+ defaultMaxDiagnostics,
17
+ WorkspaceRunner
18
+ } from "./index-m6r88hhr.js";
19
+ import"./index-hj6w4ka1.js";
20
+ import"./index-fbewhg4g.js";
21
+ import"./index-r2wedvqn.js";
22
+ import"./index-05nxx4m5.js";
23
+ import"./index-8s8b4eba.js";
24
+ import"./index-57q1ayd2.js";
25
+ import"./index-p6x5b7hr.js";
26
+ import"./index-kjrvwzav.js";
27
+ import"./index-w134p86k.js";
28
+ import"./index-m9jj544v.js";
29
+ import"./index-1dhf8ymv.js";
30
+ import"./index-0zwznvv1.js";
31
+ import {
32
+ AgentScript
33
+ } from "./index-7zeb5r1p.js";
34
+ import {
35
+ LibraryScript
36
+ } from "./index-hvv5rnaq.js";
37
+ import {
38
+ ApplicationScript
39
+ } from "./index-5n5hds19.js";
40
+ import"./index-7md2g9vw.js";
41
+ import"./index-0zyatd10.js";
42
+ import"./index-tvehn2sp.js";
43
+ import {
44
+ PackageScript
45
+ } from "./index-3txrjt6n.js";
46
+ import"./index-zre4m2ce.js";
47
+ import {
48
+ CloudScript2
49
+ } from "./index-9ndw5d8j.js";
50
+ import"./index-6269mf2s.js";
51
+ import"./index-922k2zwq.js";
52
+ import"./index-rvynj5gz.js";
53
+ import"./index-tdv66eah.js";
54
+ import"./index-hm7x0c11.js";
55
+ import"./index-x5ecanqh.js";
56
+ import"./index-js1gj6f6.js";
57
+ import {
58
+ ContextScript
59
+ } from "./index-f5adsa58.js";
60
+ import"./index-5kh9scvs.js";
61
+ import"./index-mwj9q2ya.js";
62
+
63
+ // pkgs/@akanjs/cli/workspace/workspace.script.ts
64
+ import { Logger } from "akanjs/common";
65
+ class WorkspaceScript extends script("workspace", [
66
+ WorkspaceRunner,
67
+ ApplicationScript,
68
+ LibraryScript,
69
+ PackageScript,
70
+ CloudScript2,
71
+ ContextScript,
72
+ AgentScript
73
+ ]) {
74
+ async createWorkspace(repoName, appName, {
75
+ dirname = ".",
76
+ installLibs = false,
77
+ init = true,
78
+ registryUrl,
79
+ owner,
80
+ mcpInstall = true,
81
+ agentInstall = true
82
+ }) {
83
+ const akanVersion = await this.packageScript.version(null, { log: false });
84
+ const workspace = await this.workspaceRunner.createWorkspace(repoName, appName, {
85
+ dirname,
86
+ init,
87
+ akanVersion,
88
+ ...registryUrl ? { registryUrl } : {},
89
+ ...owner ? { owner } : {}
90
+ });
91
+ if (installLibs) {
92
+ await this.libraryScript.installLibrary(workspace, "util");
93
+ await this.libraryScript.installLibrary(workspace, "shared");
94
+ }
95
+ await this.applicationScript.createApplication(appName, workspace, {
96
+ libs: installLibs ? ["util", "shared"] : [],
97
+ sample: true
98
+ });
99
+ await workspace.applyTemplate({
100
+ basePath: `apps/${appName}`,
101
+ template: "appSample",
102
+ dict: { appName },
103
+ options: { libs: installLibs ? ["util", "shared"] : [] }
104
+ });
105
+ if (agentInstall)
106
+ await this.agentScript.agent(workspace, "install", "all", { force: true });
107
+ if (mcpInstall)
108
+ await this.contextScript.mcpInstall(workspace, "all", { force: true });
109
+ const gitSpinner = workspace.spinning("Initializing git repository and commit...");
110
+ try {
111
+ await workspace.commit("Initial commit", { init: true });
112
+ gitSpinner.succeed("Git repository initialized and committed");
113
+ } catch (_) {
114
+ gitSpinner.fail("Git repository initialization failed. It's not fatal, you can commit manually");
115
+ }
116
+ Logger.rawLog(`
117
+ \uD83C\uDF89 Welcome aboard! Workspace created in ${workspace.workspaceRoot}`);
118
+ Logger.rawLog(`\uD83D\uDE80 Run \`cd ${workspace.workspaceRoot} && akan start ${appName}\` to start the development server.`);
119
+ Logger.rawLog(`
120
+ \uD83D\uDC4B Happy coding!`);
121
+ }
122
+ async generateAgentRules(workspace, { overwrite = false, cursorRules = true } = {}) {
123
+ const spinner = workspace.spinning("Generating agent rules...");
124
+ const files = await this.workspaceRunner.generateAgentRules(workspace, { overwrite, cursorRules });
125
+ if (files.some((file) => file.filePath.endsWith("AGENTS.md")))
126
+ await this.agentScript.agent(workspace, "install", "agents-md", { force: overwrite });
127
+ spinner.succeed(`Agent rules ready (${files.length} file${files.length === 1 ? "" : "s"})`);
128
+ }
129
+ async machineKeygen(workspace, out) {
130
+ const { file, publicKey } = await this.workspaceRunner.machineKeygen(workspace, out);
131
+ const access = process.platform === "win32" ? "; Windows gives it the permissions of its folder, so keep it in one only you can read" : " (mode 600)";
132
+ 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.`);
133
+ Logger.rawLog(`A server that only verifies them takes the public key:
134
+ AKAN_MACHINE_PUBLIC_KEY=${publicKey}`);
135
+ }
136
+ async lint(exec, workspace, { fix = true, maxDiagnostics } = {}) {
137
+ if (exec instanceof AppExecutor)
138
+ await this.applicationScript.sync(exec);
139
+ else if (exec instanceof LibExecutor)
140
+ await this.libraryScript.syncLibrary(exec);
141
+ const spinner = workspace.spinning(`Linting${fix ? " with fix" : ""}...`);
142
+ try {
143
+ await this.workspaceRunner.lint(exec, workspace, { fix, maxDiagnostics });
144
+ spinner.succeed("Lint completed with no errors");
145
+ } catch (error) {
146
+ spinner.fail("Lint failed with errors");
147
+ throw error;
148
+ }
149
+ }
150
+ async lintAll(workspace, { fix = true, maxDiagnostics } = {}) {
151
+ const [appNames, libNames, pkgNames] = await workspace.getExecs();
152
+ const options = { fix, maxDiagnostics };
153
+ await Promise.all(appNames.map((appName) => this.applicationScript.sync(AppExecutor.from(workspace, appName))));
154
+ await Promise.all(libNames.map((libName) => this.libraryScript.syncLibrary(LibExecutor.from(workspace, libName))));
155
+ await Promise.all([
156
+ ...appNames.map((appName) => this.workspaceRunner.lint(AppExecutor.from(workspace, appName), workspace, options)),
157
+ ...libNames.map((libName) => this.workspaceRunner.lint(LibExecutor.from(workspace, libName), workspace, options)),
158
+ ...pkgNames.filter((pkgName) => pkgName !== "contract").map((pkgName) => this.workspaceRunner.lint(PkgExecutor.from(workspace, pkgName), workspace, options))
159
+ ]);
160
+ }
161
+ async syncAll(workspace) {
162
+ const [appNames, libNames] = await workspace.getExecs();
163
+ for (const libName of libNames)
164
+ await this.libraryScript.syncLibrary(LibExecutor.from(workspace, libName));
165
+ for (const appName of appNames)
166
+ await this.applicationScript.sync(AppExecutor.from(workspace, appName));
167
+ }
168
+ async init(devProjectId, workspace, { host } = {}) {
169
+ const [bunfigExists, packageJsonExists, tsconfigExists] = await Promise.all([
170
+ workspace.exists("bunfig.toml"),
171
+ workspace.exists("package.json"),
172
+ workspace.exists("tsconfig.json")
173
+ ]);
174
+ const isRoot = bunfigExists && packageJsonExists && tsconfigExists;
175
+ if (!isRoot)
176
+ throw new Error("Current directory is not a root workspace");
177
+ const spinner = workspace.spinning("Initializing workspace...");
178
+ try {
179
+ await this.workspaceRunner.writeTopLevelEnv(workspace, devProjectId);
180
+ await this.cloudScript.downloadEnv(workspace, devProjectId, { host });
181
+ spinner.succeed("Workspace initialized");
182
+ } catch (error) {
183
+ spinner.fail("Workspace initialization failed");
184
+ throw error;
185
+ }
186
+ }
187
+ }
188
+
189
+ // pkgs/@akanjs/cli/workspace/workspace.command.ts
190
+ var maxDiagnosticsOption = {
191
+ desc: "How many diagnostics Biome prints before truncating (0 for no limit)",
192
+ default: defaultMaxDiagnostics
193
+ };
194
+
195
+ class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public: target }) => ({
196
+ 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, {
197
+ desc: "directory of workspace",
198
+ default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "."
199
+ }).option("libs", Boolean, {
200
+ desc: "Do you want to install shared and util libraries? (admin, user file, etc.)",
201
+ enum: [
202
+ { label: "No, I want to start with empty workspace (Recommended)", value: false },
203
+ {
204
+ label: "Yes, I want to accelerate development by installing shared and util libraries (for akanjs experts)",
205
+ value: true
206
+ }
207
+ ],
208
+ default: false
209
+ }).option("init", Boolean, { desc: "Do you want to initialize the workspace? (Recommended)", default: true }).option("registry", String, {
210
+ desc: "npm registry URL for installing Akan packages",
211
+ default: process.env.AKAN_NPM_REGISTRY ?? "https://registry.npmjs.org"
212
+ }).option("owner", String, { desc: "owner of the workspace", default: process.env.GITHUB_OWNER, nullable: true }).option("mcpInstall", Boolean, {
213
+ desc: "Install the Akan MCP server config for Cursor, Claude Code, and Codex? (Recommended)",
214
+ default: true
215
+ }).option("agentInstall", Boolean, {
216
+ flag: "A",
217
+ desc: "Install Akan agent rules (AGENTS.md, CLAUDE.md, Cursor)? (Recommended)",
218
+ default: true
219
+ }).exec(async function(workspaceName, app, dir, libs, init, registry, owner, mcpInstall, agentInstall) {
220
+ const appName = app || "app";
221
+ await this.workspaceScript.createWorkspace(workspaceName.toLowerCase().replace(/ /g, "-"), appName.toLowerCase().replace(/ /g, "-"), {
222
+ dirname: dir,
223
+ installLibs: libs,
224
+ init,
225
+ owner,
226
+ mcpInstall,
227
+ agentInstall,
228
+ ...registry ? { registryUrl: registry } : {}
229
+ });
230
+ }),
231
+ generateAgentRules: target({
232
+ desc: "Generate AGENTS.md, CLAUDE.md, and optional Cursor rules for Akan coding agents"
233
+ }).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) {
234
+ await this.workspaceScript.generateAgentRules(workspace, { overwrite, cursorRules });
235
+ }),
236
+ 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) {
237
+ await this.workspaceScript.lint(exec, workspace, { fix, maxDiagnostics });
238
+ }),
239
+ 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) {
240
+ await this.workspaceScript.lintAll(workspace, { fix, maxDiagnostics });
241
+ }),
242
+ machineKeygen: target({
243
+ desc: "Make an Ed25519 key for machine tokens: write the private key to a file, print the public key"
244
+ }).arg("out", String, {
245
+ desc: "file the private key is written to (mode 600; on Windows, its folder's permissions); an existing one is refused"
246
+ }).with(Workspace).exec(async function(out, workspace) {
247
+ await this.workspaceScript.machineKeygen(workspace, out);
248
+ }),
249
+ syncAll: target({ desc: "Sync dependencies and configuration for all apps and libraries" }).with(Workspace).exec(async function(workspace) {
250
+ await this.workspaceScript.syncAll(workspace);
251
+ }),
252
+ init: target({ desc: "Initialize the workspace", runsOnWorkspaceRoot: false }).arg("devProjectId", String, { desc: "the ID of the workspace" }).option("host", String, {
253
+ desc: "host of the cloud to target (default: cloud.host of the root akan.config.ts, else Akan Cloud)",
254
+ nullable: true
255
+ }).with(Workspace).exec(async function(devProjectId, host, workspace) {
256
+ await this.workspaceScript.init(devProjectId, workspace, { host });
257
+ })
258
+ })) {
259
+ }
260
+ export {
261
+ WorkspaceCommand
262
+ };
@@ -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,25 +0,0 @@
1
- // @bun
2
- import {
3
- Workspace,
4
- command
5
- } from "./index-qmeh0s05.js";
6
- import"./index-52w0fvh8.js";
7
- import"./index-1e2955yd.js";
8
- import"./index-hj6w4ka1.js";
9
- import"./index-pqdz7rat.js";
10
- import"./index-kr62ph5a.js";
11
- import"./index-zzvvc845.js";
12
- import {
13
- AgentScript
14
- } from "./index-6pzt55w3.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
- };
@@ -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
- };