@akanjs/cli 3.2.0-rc.2 → 3.2.0-rc.20

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 (132) hide show
  1. package/.build-stamp +2 -1
  2. package/CodeAgent-faqv7t4g.js +11 -0
  3. package/{CodeTui-zyc7zaq6.js → CodeTui-vqck9tet.js} +822 -666
  4. package/README.ko.md +26 -1
  5. package/README.md +26 -1
  6. package/TunnelShare-bwe3ddv7.js +18 -0
  7. package/agent.command-p75jvgrd.js +56 -0
  8. package/akanCode.js +12 -12
  9. package/appExecutor-020cyesq.js +11 -0
  10. package/{application.command-vb278qnq.js → application.command-ta2knqxm.js} +72 -34
  11. package/{applicationBuildRunner-bqbyeg84.js → applicationBuildRunner-gkh82j2b.js} +18 -13
  12. package/buildBatch.proc.js +26 -11
  13. package/{cloud.command-ca777ee2.js → cloud.command-v3jhfvm5.js} +31 -28
  14. package/cloud.script-be9s1432.js +35 -0
  15. package/{code.command-j08txqcd.js → code.command-mh7dh1st.js} +14 -9
  16. package/{context.command-2fa6egp9.js → context.command-1ycfjkdd.js} +28 -23
  17. package/context.runner-333jkz86.js +34 -0
  18. package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
  19. package/{devTui-w38ch13a.js → devTui-rf374y2w.js} +1 -1
  20. package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
  21. package/{guideline.command-w6yqpdec.js → guideline.command-w1grfwh7.js} +9 -4
  22. package/guidelines/agentRule/agentRule.instruction.md +17 -5
  23. package/guidelines/akanApi/akanApi.instruction.md +3 -1
  24. package/guidelines/conventions/core.md +23 -5
  25. package/guidelines/conventions/rules/app.md +4 -1
  26. package/guidelines/conventions/rules/page.md +5 -0
  27. package/guidelines/errorCodes/errorCodes.instruction.md +158 -0
  28. package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
  29. package/guidelines/mcpRule/mcpRule.instruction.md +74 -2
  30. package/guidelines/pageRule/pageRule.instruction.md +11 -1
  31. package/guidelines/runtimeRule/runtimeRule.instruction.md +7 -2
  32. package/guidelines/transportRule/transportRule.instruction.md +8 -1
  33. package/incrementalBuilder.proc.js +574 -410
  34. package/{index-c5ymqb05.js → index-013n6z7m.js} +12 -12
  35. package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
  36. package/{index-8nbx607g.js → index-0hj82f9w.js} +136 -48
  37. package/{index-ebwkh7bt.js → index-1c0mjc2b.js} +25 -7
  38. package/{index-6h775rv3.js → index-1jk52ffq.js} +53 -12
  39. package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
  40. package/{index-ygrdw6jw.js → index-1pjwsh2g.js} +65 -8
  41. package/{index-cbcwxp5v.js → index-22g3jq43.js} +9 -7
  42. package/{index-466z5931.js → index-2d9nm03s.js} +580 -364
  43. package/{index-0fj9ra3q.js → index-2k6mve6a.js} +18 -11
  44. package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
  45. package/{index-j7p0jgaq.js → index-52w4jb87.js} +6 -6
  46. package/{index-e22zedc2.js → index-5h888r6j.js} +3 -3
  47. package/{index-7kmbqp0b.js → index-6pxmcaq8.js} +1 -1
  48. package/{index-xa0289eg.js → index-6zb17wcm.js} +16 -9
  49. package/{index-qgazn58x.js → index-7a07tdap.js} +50 -38
  50. package/{index-m5sg5spm.js → index-7ehdht84.js} +565 -187
  51. package/{index-y725zb1a.js → index-7v7tvgt7.js} +196 -168
  52. package/{index-pq5rjkch.js → index-88s746ns.js} +7 -2
  53. package/{index-r0a604h4.js → index-99kjwyma.js} +1 -1
  54. package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
  55. package/{index-386canwe.js → index-9rv2zt48.js} +186 -121
  56. package/{index-wr9magsr.js → index-9zswcze5.js} +3 -3
  57. package/{index-xq97me1h.js → index-a41vv4cy.js} +811 -697
  58. package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
  59. package/{index-bdmgqzb5.js → index-bket1068.js} +58 -29
  60. package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
  61. package/{index-1cb9apzn.js → index-czf94w8c.js} +2 -2
  62. package/{index-65b6ms4c.js → index-d3178asw.js} +15 -11
  63. package/index-dss3ds74.js +127 -0
  64. package/{index-annxfpgz.js → index-eyfty8kk.js} +9 -9
  65. package/{index-ny2k80mv.js → index-ffa52fwf.js} +1 -1
  66. package/{index-8jpc5fqv.js → index-g7jgd4xs.js} +2 -2
  67. package/{index-abfbf01s.js → index-gwsesvqc.js} +2 -2
  68. package/{index-kcpk2d20.js → index-h1w4wqgd.js} +1474 -1139
  69. package/{index-j1hjb477.js → index-hp2c7xc2.js} +1 -1
  70. package/index-j4yvgfhr.js +70 -0
  71. package/{index-84c2pgak.js → index-jx2jcw1r.js} +89 -78
  72. package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
  73. package/{index-2gees180.js → index-mpp4aas6.js} +62 -33
  74. package/index-na8r4a27.js +30 -0
  75. package/{index-0mqga3h9.js → index-nmxszh6x.js} +525 -440
  76. package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
  77. package/{index-20wvskt8.js → index-pt0agdck.js} +1 -1
  78. package/{index-htxck0pn.js → index-q444k260.js} +15 -10
  79. package/{index-wfmpxke3.js → index-qssq2d41.js} +2775 -3677
  80. package/{index-23860fej.js → index-rwgqba9p.js} +24 -9
  81. package/{index-v50xjbbe.js → index-t4d0ckde.js} +1 -1
  82. package/index-va90m8nd.js +25 -0
  83. package/index-vjbne22r.js +80 -0
  84. package/{index-djc5nxpy.js → index-w23tf30e.js} +6 -6
  85. package/{index-mvwvxgtd.js → index-wa01phm9.js} +289 -210
  86. package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
  87. package/{index-vbhx60x5.js → index-xwe7y0gf.js} +2140 -2165
  88. package/index-ze48c0vd.js +788 -0
  89. package/{index-dk4g0x0d.js → index-zttyg7tg.js} +27 -16
  90. package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
  91. package/index.js +29 -24
  92. package/libExecutor-tq994592.js +10 -0
  93. package/{library.command-8d03a0pq.js → library.command-x219mhcx.js} +9 -4
  94. package/{localRegistry.command-vyv5k6t0.js → localRegistry.command-4p17wa9t.js} +30 -24
  95. package/{module.command-vy3kg965.js → module.command-tjthnvvr.js} +17 -8
  96. package/{package.command-qjh13rs9.js → package.command-c6df2hxx.js} +13 -8
  97. package/package.json +2 -2
  98. package/{page.command-t0nx1jat.js → page.command-gf06paq2.js} +9 -4
  99. package/{pipeline.command-2yjeas7m.js → pipeline.command-y07dgj9b.js} +14 -8
  100. package/pkgExecutor-stde3yc3.js +10 -0
  101. package/{primitive.command-8vm49279.js → primitive.command-0enfygxn.js} +13 -8
  102. package/{projectTypecheck-s9hhe5sa.js → projectTypecheck-mk8wefvd.js} +2 -1
  103. package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
  104. package/{quality.command-v76fev72.js → quality.command-dkbdztad.js} +23 -16
  105. package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
  106. package/{repair.command-fp4m3w03.js → repair.command-g5vd95ax.js} +13 -8
  107. package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
  108. package/{scalar.command-hxe6try8.js → scalar.command-7909pg0d.js} +11 -6
  109. package/skills/akan-debug/SKILL.md +10 -3
  110. package/skills/akan-err/SKILL.md +7 -0
  111. package/skills/akan-mcp/SKILL.md +10 -1
  112. package/skills/akan-scaffold/SKILL.md +2 -2
  113. package/skills/akan-transport/SKILL.md +2 -0
  114. package/skills/akan-validate/SKILL.md +1 -0
  115. package/{subspace.command-q42n1844.js → subspace.command-at4jt1fb.js} +29 -23
  116. package/templates/biomeForm.ts +1 -1
  117. package/templates/env/_env.server.type.ts +1 -1
  118. package/templates/facetIndex/index.ts +2 -37
  119. package/templates/lib/sig.ts +0 -4
  120. package/templates/lib/useClient.ts +1 -1
  121. package/templates/workspaceRoot/AGENTS.md.template +2 -1
  122. package/{tunnel.command-22g11n0x.js → tunnel.command-91h92dwr.js} +17 -12
  123. package/{typeChecker-s640r6c0.js → typeChecker-bfrd1n9n.js} +1 -1
  124. package/typecheck.proc.js +6 -3
  125. package/{verify.command-rx43bha1.js → verify.command-pzky05ts.js} +26 -20
  126. package/{workflow.command-yg0d8mmq.js → workflow.command-mqqe4n12.js} +37 -19
  127. package/{workspace.command-fcfztvn5.js → workspace.command-y4rznvhx.js} +64 -53
  128. package/CodeAgent-6cpjtj25.js +0 -11
  129. package/TunnelShare-zkfkrw8w.js +0 -14
  130. package/agent.command-kf1g3nh4.js +0 -51
  131. package/cloud.script-agpxzq6j.js +0 -30
  132. package/context.runner-ftv8373t.js +0 -29
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AkanCodeEnv,
4
4
  akanCodePaths2
5
- } from "./index-35j83zkd.js";
5
+ } from "./index-p5zh7pmc.js";
6
6
  import {
7
7
  akanCodeDefaultModel2,
8
8
  akanCodeModel2,
@@ -10,16 +10,16 @@ import {
10
10
  akanCodeModelWarnings2,
11
11
  McpServerConfig,
12
12
  WorkspaceTrust
13
- } from "./index-w15mg3km.js";
13
+ } from "./index-0dm25wvf.js";
14
14
  import {
15
15
  PreviewView2,
16
16
  stripAnsi
17
- } from "./index-23860fej.js";
17
+ } from "./index-rwgqba9p.js";
18
18
  import {
19
19
  SubagentPool2,
20
20
  McpSignIn,
21
21
  AkanCodeCompaction2
22
- } from "./index-abfbf01s.js";
22
+ } from "./index-gwsesvqc.js";
23
23
  import {
24
24
  codeAgentIsLoopback,
25
25
  codeAgentHostListed,
@@ -171,7 +171,7 @@ var akanSystemPrompt2 = (profile) => {
171
171
  lines.push(`- Some tool calls need the user's approval (policy: ${profile.approval}). A refusal is an answer; do not retry it a different way.`);
172
172
  if (profile.network.askOutside)
173
173
  lines.push("- `web_fetch` to a host outside a short list of documentation sites, and a shell command that reaches the network (`curl`, `wget`, `ssh`, \u2026), wait for the user's approval. A refusal is an answer; do not retry it a different way.");
174
- lines.push("- Secrets are refused at the tool boundary. If you need a value from `.env`, ask the user for it rather than looking for another way to read the file.", "", "## How to answer", "", "- Answer in as few words as carry the answer. A short question gets one sentence with no heading.", "- Do not open with what you are about to do, and do not close with a summary of what you did. The tool calls are already on the user's screen.", "- Skip headings, bold labels and bullet lists unless the answer is genuinely a list. Prose is shorter.", "- State a file as `path:line`. Do not paste a file back that the user can open.", "- Say what you could not do, and why, in one line. Do not offer alternatives nobody asked for.");
174
+ lines.push("- Secrets are refused at the tool boundary. If you need a value from `.env`, ask the user for it rather than looking for another way to read the file.", "", "## How to answer", "", "- Answer in as few words as carry the answer. A short question gets one sentence with no heading.", "- Do not open with what you are about to do, and do not retell the tool calls at the end; they are already on the user's screen. A turn that changed files closes with those files and what `akan_verify` said.", "- Skip headings, bold labels and bullet lists unless the answer is genuinely a list. Prose is shorter.", "- State a file as `path:line`. Do not paste a file back that the user can open.", "- Say what you could not do, and why, in one line. Do not offer alternatives nobody asked for.");
175
175
  return lines.join(`
176
176
  `);
177
177
  };
@@ -659,7 +659,7 @@ class AkanToolPack2 {
659
659
  return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
660
660
  }
661
661
  async names() {
662
- const { ContextRunner } = await import("./context.runner-ftv8373t.js");
662
+ const { ContextRunner } = await import("./context.runner-333jkz86.js");
663
663
  return [
664
664
  ...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
665
665
  AkanToolPack2.verifyToolName
@@ -667,7 +667,7 @@ class AkanToolPack2 {
667
667
  }
668
668
  static verifyToolName = "akan_verify";
669
669
  async#register(pi) {
670
- const { ContextRunner } = await import("./context.runner-ftv8373t.js");
670
+ const { ContextRunner } = await import("./context.runner-333jkz86.js");
671
671
  const runner = new ContextRunner;
672
672
  const guidelineNames = await AkanToolPack2.#guidelineNames();
673
673
  for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
@@ -705,7 +705,7 @@ class AkanToolPack2 {
705
705
  }
706
706
  static async#guidelineNames() {
707
707
  try {
708
- const { Prompter } = await import("./prompter-qrwx1p17.js");
708
+ const { Prompter } = await import("./prompter-qyggfhqd.js");
709
709
  return await Prompter.listGuidelines();
710
710
  } catch {
711
711
  return [];
@@ -854,6 +854,7 @@ import {
854
854
  import { Type as Type4 } from "typebox";
855
855
 
856
856
  // pkgs/@akanjs/devkit/codeAgent/tools/McpClient.ts
857
+ import { FailureCode, MCP_FAILURE_META } from "akanjs/common";
857
858
  var protocolVersion = "2025-06-18";
858
859
 
859
860
  class McpUnauthorized2 extends Error {
@@ -909,8 +910,14 @@ class McpClient2 {
909
910
  async callTool(name, args) {
910
911
  const response = await this.#call("tools/call", { name, arguments: args });
911
912
  if (response.error)
912
- return { text: response.error.message, isError: true };
913
- return { text: McpClient2.#renderContent(response.result?.content), isError: !!response.result?.isError };
913
+ return { text: response.error.message, isError: true, ...McpClient2.#coded(response.error.data) };
914
+ const isError = !!response.result?.isError;
915
+ const failure = isError ? response.result?._meta?.[MCP_FAILURE_META] : undefined;
916
+ return { text: McpClient2.#renderContent(response.result?.content), isError, ...McpClient2.#coded(failure) };
917
+ }
918
+ static #coded(carrier) {
919
+ const code = carrier && typeof carrier === "object" ? carrier.code : undefined;
920
+ return FailureCode.is(code) ? { code } : {};
914
921
  }
915
922
  close() {
916
923
  this.#proc?.kill();
@@ -1098,7 +1105,7 @@ class McpToolPack2 {
1098
1105
  const result = await this.#call(server, tool.name, params ?? {});
1099
1106
  return {
1100
1107
  content: [{ type: "text", text: codeAgentClip(result.text, codeAgentOutputChars) }],
1101
- details: undefined,
1108
+ details: result.code === undefined ? undefined : { code: result.code },
1102
1109
  isError: result.isError
1103
1110
  };
1104
1111
  }
@@ -1,9 +1,9 @@
1
1
  // @bun
2
2
  import {
3
3
  FileSys2
4
- } from "./index-bns3wcpc.js";
4
+ } from "./index-by2tvsq6.js";
5
5
 
6
- // pkgs/@akanjs/devkit/dependencyScanner.ts
6
+ // pkgs/@akanjs/devkit/workspace/dependencyScanner.ts
7
7
  import { builtinModules } from "module";
8
8
  import * as path from "path";
9
9
  import ignore from "ignore";
@@ -1,16 +1,16 @@
1
1
  // @bun
2
2
  import {
3
- akanMcpInstallTargets
4
- } from "./index-0mqga3h9.js";
3
+ script
4
+ } from "./index-9rv2zt48.js";
5
5
  import {
6
6
  jsonText
7
- } from "./index-xq97me1h.js";
7
+ } from "./index-a41vv4cy.js";
8
8
  import {
9
- script
10
- } from "./index-386canwe.js";
9
+ akanMcpInstallTargets
10
+ } from "./index-nmxszh6x.js";
11
11
  import {
12
12
  ContextRunner2
13
- } from "./index-mvwvxgtd.js";
13
+ } from "./index-wa01phm9.js";
14
14
 
15
15
  // pkgs/@akanjs/cli/context/context.script.ts
16
16
  import { Logger } from "akanjs/common";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  FileSys2
4
- } from "./index-bns3wcpc.js";
4
+ } from "./index-by2tvsq6.js";
5
5
  import {
6
6
  resolveMobileTargets
7
7
  } from "./index-m9jj544v.js";
@@ -9,10 +9,10 @@ import {
9
9
  UpdatePackFolder,
10
10
  NativePublicEnv,
11
11
  NativeApp
12
- } from "./index-djc5nxpy.js";
12
+ } from "./index-w23tf30e.js";
13
13
  import {
14
14
  ExitCodeError
15
- } from "./index-386canwe.js";
15
+ } from "./index-9rv2zt48.js";
16
16
  import {
17
17
  ConfigLock
18
18
  } from "./index-bqbf654f.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-386canwe.js";
5
+ } from "./index-9rv2zt48.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/page/page.runner.ts
8
8
  class PageRunner extends runner("page") {
@@ -2,18 +2,23 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-386canwe.js";
5
+ } from "./index-9rv2zt48.js";
6
6
  import {
7
- LibSource,
8
- formatLibStatuses,
9
7
  CommandExecutionError,
10
- LibExecutor
11
- } from "./index-wfmpxke3.js";
8
+ LibSource,
9
+ formatLibStatuses
10
+ } from "./index-qssq2d41.js";
11
+ import {
12
+ LibExecutor2
13
+ } from "./index-na8r4a27.js";
14
+ import {
15
+ assertPlainName
16
+ } from "./index-va90m8nd.js";
12
17
 
13
18
  // pkgs/@akanjs/cli/library/library.script.ts
14
19
  import { Logger } from "akanjs/common";
15
20
 
16
- // pkgs/@akanjs/devkit/semver.ts
21
+ // pkgs/@akanjs/devkit/util/semver.ts
17
22
  var stripRangeOperator = (version) => version.replace(/^[\s^~>=<v]+/, "").trim();
18
23
  var parseVersion = (version) => version.replace(/^[^\d]*/, "").split(/[.-]/).map((part) => Number.parseInt(part, 10)).map((part) => Number.isFinite(part) ? part : 0);
19
24
  var compareNumeric = (a, b) => {
@@ -43,7 +48,7 @@ class LibraryRunner extends runner("library") {
43
48
  async createLibrary(libName, workspace) {
44
49
  await workspace.mkdir(`libs/${libName}`);
45
50
  await workspace.applyTemplate({ basePath: `libs/${libName}`, template: "libRoot", dict: { libName } });
46
- return LibExecutor.from(workspace, libName);
51
+ return LibExecutor2.from(workspace, libName);
47
52
  }
48
53
  async removeLibrary(lib) {
49
54
  await lib.workspace.removeDir(`libs/${lib.name}`);
@@ -99,7 +104,7 @@ class LibraryRunner extends runner("library") {
99
104
  const testingEnv = `libs/${libName}/env/env.server.testing.ts`;
100
105
  if (!await workspace.exists(testingEnv))
101
106
  await workspace.cp(`libs/${libName}/env/env.server.example.ts`, testingEnv);
102
- const lib = LibExecutor.from(workspace, libName);
107
+ const lib = LibExecutor2.from(workspace, libName);
103
108
  const stamp = await new LibSource(lib).write(source);
104
109
  if (await workspace.hasChanges())
105
110
  await workspace.commit(`Install ${libName} library from ${stamp.origin}`);
@@ -107,7 +112,7 @@ class LibraryRunner extends runner("library") {
107
112
  }
108
113
  async libraryStatuses(workspace) {
109
114
  const libNames = await workspace.getLibs();
110
- return await Promise.all(libNames.map((libName) => new LibSource(LibExecutor.from(workspace, libName)).status()));
115
+ return await Promise.all(libNames.map((libName) => new LibSource(LibExecutor2.from(workspace, libName)).status()));
111
116
  }
112
117
  async mergeLibraryDependencies(lib) {
113
118
  const [libPackageJson, rootPackageJson] = await Promise.all([lib.getPackageJson(), lib.workspace.getPackageJson()]);
@@ -148,6 +153,7 @@ class LibraryScript extends script("library", [LibraryRunner]) {
148
153
  return scanInfo;
149
154
  }
150
155
  async createLibrary(libName, workspace) {
156
+ assertPlainName("lib", libName);
151
157
  const spinner = workspace.spinning(`Creating ${libName} library`);
152
158
  const lib = await this.libraryRunner.createLibrary(libName, workspace);
153
159
  spinner.succeed(`${libName} library (libs/${libName}) is created`);
@@ -166,6 +172,7 @@ class LibraryScript extends script("library", [LibraryRunner]) {
166
172
  Logger.rawLog(format === "json" ? JSON.stringify(statuses, null, 2) : formatLibStatuses(statuses));
167
173
  }
168
174
  async installLibrary(workspace, libName) {
175
+ assertPlainName("lib", libName);
169
176
  const installSpinner = workspace.spinning(`Installing ${libName} library`);
170
177
  const lib = await this.libraryRunner.installLibrary(workspace, libName);
171
178
  installSpinner.succeed(`${libName} library (libs/${libName}) is installed`);
@@ -1,54 +1,61 @@
1
1
  // @bun
2
2
  import {
3
3
  script
4
- } from "./index-386canwe.js";
4
+ } from "./index-9rv2zt48.js";
5
5
  import {
6
- AppExecutor,
7
- LibExecutor,
8
- ModuleExecutor
9
- } from "./index-wfmpxke3.js";
6
+ AppExecutor2
7
+ } from "./index-ze48c0vd.js";
8
+ import {
9
+ LibExecutor2
10
+ } from "./index-na8r4a27.js";
10
11
  import {
11
12
  InteractionScaffold,
12
13
  workflowStatus,
13
14
  compactDiagnostics,
14
15
  generatedFilePathsForTarget,
15
- sourceFile,
16
- moduleComponentName,
17
- moduleSourcePaths,
18
- generatedFilesForSync,
19
- validationCommandsForTarget,
20
- nextActionsForTarget,
21
- createPrimitiveWriteReport,
22
- normalizeFieldType,
16
+ hasSourceParseErrors,
23
17
  ensureNamedImport,
24
18
  ensureBaseImport,
25
- ensureBaseTypeImport,
26
- coerceFieldDefault,
27
- fieldExpression,
19
+ ensureEnumImport,
20
+ ensureConstantTypeImport,
28
21
  viaBuilderParameterName,
29
22
  insertIntoObject,
30
23
  insertLightProjectionField,
31
- insertTemplateField,
32
- ensureEnumImport,
33
24
  insertEnumClass,
34
- insertDictionaryModelField,
35
25
  hasConstantInputField,
26
+ insertDictionaryModelField,
36
27
  hasDictionaryModelField,
37
- ensureConstantTypeImport,
38
28
  insertDictionaryEnum,
29
+ normalizeFieldType,
30
+ coerceFieldDefault,
31
+ fieldExpression,
39
32
  parseValues,
40
- hasSourceParseErrors,
33
+ moduleComponentName,
34
+ moduleSourcePaths,
35
+ addFieldUiPolicyForType,
36
+ withFieldTypeImport,
37
+ KeyRename,
41
38
  hasClassMethod,
42
39
  insertClassMethod,
43
40
  hasSignalFactoryEntry,
44
41
  insertSignalFactoryEntry,
45
- addFieldUiPolicyForType,
46
- KeyRename,
47
- MutationScaffold
48
- } from "./index-xq97me1h.js";
42
+ MutationScaffold,
43
+ sourceFile,
44
+ generatedFilesForSync,
45
+ validationCommandsForTarget,
46
+ nextActionsForTarget,
47
+ createPrimitiveWriteReport,
48
+ insertTemplateField
49
+ } from "./index-a41vv4cy.js";
49
50
  import {
50
51
  ModuleScript
51
- } from "./index-htxck0pn.js";
52
+ } from "./index-q444k260.js";
53
+ import {
54
+ plainNameProblem
55
+ } from "./index-va90m8nd.js";
56
+ import {
57
+ ModuleExecutor
58
+ } from "./index-vjbne22r.js";
52
59
 
53
60
  // pkgs/@akanjs/cli/primitive/primitive.script.ts
54
61
  import { capitalize, lowerlize } from "akanjs/common";
@@ -58,18 +65,16 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
58
65
  return null;
59
66
  const [apps, libs] = await workspace.getSyss();
60
67
  if (apps.includes(target))
61
- return AppExecutor.from(workspace, target);
68
+ return AppExecutor2.from(workspace, target);
62
69
  if (libs.includes(target))
63
- return LibExecutor.from(workspace, target);
70
+ return LibExecutor2.from(workspace, target);
64
71
  return null;
65
72
  }
66
73
  async createUi(workspace, input) {
67
74
  const sys = await this.resolveSys(workspace, input.app);
68
- if (!sys || !input.module)
69
- return PrimitiveScript.#refuse("create-ui", compactDiagnostics([
70
- !sys && PrimitiveScript.#targetMissing(),
71
- !input.module && PrimitiveScript.#inputMissing("module")
72
- ]));
75
+ const moduleProblem = PrimitiveScript.#moduleProblem(input.module);
76
+ if (!sys || !input.module || moduleProblem)
77
+ return PrimitiveScript.#refuse("create-ui", compactDiagnostics([!sys && PrimitiveScript.#targetMissing(), moduleProblem]));
73
78
  const mod = ModuleExecutor.from(sys, input.module);
74
79
  if (input.surface === "view")
75
80
  return await this.moduleScript.createView(mod);
@@ -91,7 +96,7 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
91
96
  const normalizedType = input.type ? normalizeFieldType(input.type) : null;
92
97
  const diagnostics = compactDiagnostics([
93
98
  !sys && PrimitiveScript.#targetMissing(),
94
- !input.module && PrimitiveScript.#inputMissing("module"),
99
+ PrimitiveScript.#moduleProblem(input.module),
95
100
  !input.field && PrimitiveScript.#inputMissing("field"),
96
101
  !input.type && PrimitiveScript.#inputMissing("type"),
97
102
  enumValues?.length === 0 && PrimitiveScript.#inputMissing("values", "Enum values are required."),
@@ -157,7 +162,7 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
157
162
  const defaultCoercion = coerceFieldDefault(input.type, input.defaultValue);
158
163
  if (defaultCoercion.diagnostic)
159
164
  diagnostics.push(defaultCoercion.diagnostic);
160
- constantContent = ensureBaseTypeImport(constantContent, input.type);
165
+ constantContent = await withFieldTypeImport(sys, input.module, input.type, constantContent, diagnostics);
161
166
  if (input.type === "Date" && defaultCoercion.expression)
162
167
  constantContent = ensureBaseImport(constantContent, "dayjs");
163
168
  }
@@ -451,13 +456,14 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
451
456
  });
452
457
  }
453
458
  static #report(command, sys, changedFiles, diagnostics) {
459
+ const failed = workflowStatus(diagnostics) === "failed";
454
460
  return createPrimitiveWriteReport({
455
461
  command,
456
462
  changedFiles,
457
- generatedFiles: generatedFilesForSync(sys),
458
- validationCommands: validationCommandsForTarget(sys.name),
463
+ generatedFiles: failed ? [] : generatedFilesForSync(sys),
464
+ validationCommands: failed ? [] : validationCommandsForTarget(sys.name),
459
465
  diagnostics,
460
- nextActions: nextActionsForTarget(sys.name)
466
+ nextActions: failed ? [] : nextActionsForTarget(sys.name)
461
467
  });
462
468
  }
463
469
  static #targetMissing() {
@@ -466,6 +472,12 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
466
472
  static #inputMissing(input, message = `${capitalize(input)} is required.`) {
467
473
  return { severity: "error", code: "primitive-input-missing", message, input };
468
474
  }
475
+ static #moduleProblem(module) {
476
+ if (!module)
477
+ return PrimitiveScript.#inputMissing("module");
478
+ const message = plainNameProblem("module", module);
479
+ return message ? { severity: "error", code: "primitive-input-invalid", message, input: "module" } : null;
480
+ }
469
481
  static #sourceMissing(kind, path) {
470
482
  return {
471
483
  severity: "error",