@akanjs/cli 3.2.0-rc.1 → 3.2.0-rc.11

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 (99) hide show
  1. package/.build-stamp +2 -1
  2. package/{CodeAgent-vmd9k4ak.js → CodeAgent-fk66n37w.js} +3 -3
  3. package/{CodeTui-zka44v52.js → CodeTui-4rf1mqmv.js} +1 -1
  4. package/README.ko.md +26 -1
  5. package/README.md +26 -1
  6. package/TunnelShare-44er4e29.js +15 -0
  7. package/{agent.command-2f657613.js → agent.command-7g9czkkd.js} +20 -19
  8. package/akanCode.js +3 -3
  9. package/{application.command-q6skd3am.js → application.command-00spg55s.js} +31 -24
  10. package/{applicationBuildRunner-sctcmkyx.js → applicationBuildRunner-f4yf0qyc.js} +9 -7
  11. package/buildBatch.proc.js +7 -6
  12. package/{cloud.command-7642pks6.js → cloud.command-ab704p0g.js} +24 -25
  13. package/cloud.script-4p4y0s7e.js +31 -0
  14. package/{code.command-7s4ndq2k.js → code.command-m6c9xk56.js} +7 -6
  15. package/{context.command-569z0rqf.js → context.command-hgcgxtdk.js} +20 -19
  16. package/context.runner-w071gmc3.js +30 -0
  17. package/{devTui-w38ch13a.js → devTui-h77zrjv5.js} +1 -1
  18. package/{guideline.command-gnv3e8p8.js → guideline.command-6yz6d4hf.js} +3 -2
  19. package/guidelines/agentRule/agentRule.instruction.md +4 -3
  20. package/guidelines/akanApi/akanApi.instruction.md +2 -0
  21. package/guidelines/conventions/core.md +1 -1
  22. package/guidelines/conventions/rules/app.md +3 -0
  23. package/guidelines/conventions/rules/page.md +5 -0
  24. package/guidelines/errorCodes/errorCodes.instruction.md +140 -0
  25. package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
  26. package/guidelines/mcpRule/mcpRule.instruction.md +72 -2
  27. package/guidelines/pageRule/pageRule.instruction.md +5 -0
  28. package/guidelines/runtimeRule/runtimeRule.instruction.md +5 -1
  29. package/guidelines/transportRule/transportRule.instruction.md +5 -0
  30. package/incrementalBuilder.proc.js +8 -7
  31. package/{index-vkzfk7qt.js → index-097bjwvm.js} +40 -30
  32. package/{index-93ewzmp6.js → index-23d8gw08.js} +165 -102
  33. package/{index-p6hjwt2d.js → index-41mfhgq0.js} +72 -26
  34. package/{index-ktb3wcqz.js → index-4k9nv4m3.js} +71 -81
  35. package/{index-vr68mxj5.js → index-5jwx4bf2.js} +69 -33
  36. package/{index-5w9my9qe.js → index-6eptmk8z.js} +30 -20
  37. package/{index-d4n1wmrz.js → index-6fnrhpn1.js} +8 -4
  38. package/{index-kpdv34rq.js → index-6qtxs86x.js} +10 -7
  39. package/{index-ed6ea0qp.js → index-6z57w95f.js} +1 -1
  40. package/{index-drz9e84d.js → index-7ky4brfy.js} +2 -2
  41. package/{index-8g7tdsk4.js → index-849qvd7t.js} +58 -29
  42. package/{index-1q1cjn8s.js → index-9xh4zvw3.js} +94 -53
  43. package/{index-48d5qsj3.js → index-adj7qmz9.js} +23 -15
  44. package/{index-fjr4d6yd.js → index-apcr1qgk.js} +458 -304
  45. package/{index-8ts9774g.js → index-aybfcx58.js} +9 -4
  46. package/{index-8kczhnmv.js → index-b3pr4ee6.js} +1 -1
  47. package/{index-23860fej.js → index-b4qq3rq0.js} +23 -8
  48. package/{index-thckcabc.js → index-bper31wr.js} +24 -6
  49. package/{index-a8a9ede9.js → index-bxkx0x03.js} +14 -7
  50. package/{index-0fb3cpbt.js → index-c3r23w24.js} +9 -7
  51. package/{index-8pb9yvp8.js → index-dfsa009c.js} +148 -31
  52. package/{index-zpv14wpy.js → index-dsg50er9.js} +3 -3
  53. package/{index-hqrkqxx2.js → index-e5f6czck.js} +46 -7
  54. package/{index-sy481q2x.js → index-frvjq1rd.js} +1 -1
  55. package/{index-abgh0jve.js → index-grt0e6kk.js} +1 -1
  56. package/{index-e3vmjtph.js → index-hf9nvwam.js} +7 -2
  57. package/{index-v4p1zye8.js → index-hhagjhkh.js} +7 -7
  58. package/index-j4yvgfhr.js +70 -0
  59. package/{index-s2grpzef.js → index-k2r3hmbz.js} +6 -4
  60. package/{index-7y5yghjg.js → index-nd39rssn.js} +1162 -435
  61. package/{index-6wpaq392.js → index-p4htjyvk.js} +44 -5
  62. package/{index-aj3ehkcx.js → index-p54s83sz.js} +1 -1
  63. package/{index-7xdpww43.js → index-rdx8cyv2.js} +342 -134
  64. package/{index-sr5da35e.js → index-sq9d0jhj.js} +21 -18
  65. package/{index-eajbmk10.js → index-t4d0ckde.js} +2 -2
  66. package/{index-mqntfzv5.js → index-t8h09yjs.js} +7 -2
  67. package/index-va90m8nd.js +25 -0
  68. package/{index-rc5fvqj2.js → index-xfv2p7b5.js} +95 -58
  69. package/{index-w639tvkd.js → index-xgqz3kak.js} +29 -8
  70. package/{index-9tbgb4d8.js → index-xy70tcv4.js} +1 -1
  71. package/{index-mmym5xmb.js → index-z43wddce.js} +5 -3
  72. package/index.js +24 -23
  73. package/{library.command-1gp5qe3r.js → library.command-kc1zahcg.js} +5 -4
  74. package/{localRegistry.command-x7jptkd3.js → localRegistry.command-bz2df40m.js} +19 -18
  75. package/{module.command-4xz9he6h.js → module.command-cchwzz9r.js} +12 -7
  76. package/{package.command-s7qpnn1g.js → package.command-qcjajpv8.js} +8 -7
  77. package/package.json +2 -2
  78. package/{page.command-fan34c49.js → page.command-1t86dx8a.js} +4 -3
  79. package/{pipeline.command-ph4fnn9w.js → pipeline.command-2xx9z3d0.js} +3 -2
  80. package/{primitive.command-3fqh8emf.js → primitive.command-mc0x8txr.js} +8 -7
  81. package/{projectTypecheck-vkb40hjc.js → projectTypecheck-tz497yx7.js} +2 -1
  82. package/{quality.command-ecj6exsh.js → quality.command-11rayf5c.js} +7 -6
  83. package/{repair.command-fe9jw719.js → repair.command-8w41vy78.js} +7 -6
  84. package/{scalar.command-cnvfhk0n.js → scalar.command-rvwh98ny.js} +7 -6
  85. package/skills/akan-debug/SKILL.md +7 -3
  86. package/skills/akan-err/SKILL.md +7 -0
  87. package/skills/akan-mcp/SKILL.md +10 -1
  88. package/skills/akan-scaffold/SKILL.md +3 -2
  89. package/skills/akan-transport/SKILL.md +2 -0
  90. package/skills/akan-validate/SKILL.md +1 -0
  91. package/{subspace.command-qw5ddd6y.js → subspace.command-0970n7kd.js} +9 -8
  92. package/{tunnel.command-ggj38mqf.js → tunnel.command-bcy0rtmh.js} +8 -7
  93. package/typecheck.proc.js +5 -2
  94. package/{verify.command-w9ttxkdz.js → verify.command-ynaztxr2.js} +18 -16
  95. package/{workflow.command-ss8devj0.js → workflow.command-yp9ajthb.js} +45 -16
  96. package/{workspace.command-6z2rh8ze.js → workspace.command-e4wfxm86.js} +39 -34
  97. package/TunnelShare-k3ja4w9x.js +0 -14
  98. package/cloud.script-1sfseznn.js +0 -30
  99. package/context.runner-ms8v1rxy.js +0 -29
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  JsonFormatter
4
- } from "./index-sr5da35e.js";
4
+ } from "./index-sq9d0jhj.js";
5
5
 
6
6
  // pkgs/@akanjs/devkit/maintainabilityBaseline.ts
7
7
  class MaintainabilityBaseline {
@@ -19,8 +19,12 @@ class MaintainabilityBaseline {
19
19
  "akan.store.root-write-chain",
20
20
  "akan.component.write-chain",
21
21
  "akan.write.placement",
22
- "akan.service.call-in-loop"
22
+ "akan.service.call-in-loop",
23
+ "akan.error.bare-error"
23
24
  ];
25
+ static lateRules = new Set(["akan.error.bare-error"]);
26
+ static totalRules = new Set(["akan.error.bare-error"]);
27
+ static totalKey = "(total)";
24
28
  static reasonedRules = new Set([
25
29
  "akan.size.file",
26
30
  "akan.size.component",
@@ -40,6 +44,8 @@ class MaintainabilityBaseline {
40
44
  return violation.writeCount;
41
45
  if (violation.kind === "writePlacement")
42
46
  return violation.writes.length;
47
+ if (violation.kind === "bareError")
48
+ return violation.lines.length;
43
49
  return violation.calls.length;
44
50
  }
45
51
  static isDebtRule(name) {
@@ -97,6 +103,21 @@ class MaintainabilityBaseline {
97
103
  const recorded = this.recordedOf(violation);
98
104
  return recorded !== undefined && MaintainabilityBaseline.countOf(violation) <= recorded;
99
105
  }
106
+ unallowed(violations) {
107
+ const measured = MaintainabilityBaseline.of(violations);
108
+ return violations.filter((violation) => !(MaintainabilityBaseline.totalRules.has(violation.rule) && measured.totalOf(violation.rule) <= this.totalOf(violation.rule)) && !this.allows(violation));
109
+ }
110
+ staleTotals(violations) {
111
+ const measured = MaintainabilityBaseline.of(violations);
112
+ return [...MaintainabilityBaseline.totalRules].flatMap((rule) => {
113
+ const count = measured.totalOf(rule);
114
+ const recorded = this.totalOf(rule);
115
+ return count < recorded ? [{ rule, count, recorded }] : [];
116
+ });
117
+ }
118
+ totalOf(rule) {
119
+ return [...this.sections.get(rule)?.values() ?? []].reduce((sum, count) => sum + count, 0);
120
+ }
100
121
  recordedOf(violation) {
101
122
  return this.sections.get(violation.rule)?.get(violation.key);
102
123
  }
@@ -114,19 +135,37 @@ class MaintainabilityBaseline {
114
135
  }))
115
136
  ]));
116
137
  }
138
+ rulesOutside(other) {
139
+ return [...this.sections].filter(([rule, counts]) => counts.size && (other === null || MaintainabilityBaseline.lateRules.has(rule) && !other.sections.has(rule))).map(([rule]) => rule);
140
+ }
141
+ withSectionsOf(other, rules) {
142
+ if (!other)
143
+ return this;
144
+ const sections = new Map(this.sections);
145
+ for (const rule of rules)
146
+ sections.set(rule, other.sections.get(rule) ?? new Map);
147
+ return new MaintainabilityBaseline(sections, this.reasons);
148
+ }
117
149
  tightenedBy(violations) {
118
150
  const current = MaintainabilityBaseline.of(violations);
119
- const sections = new Map([...this.sections].map(([rule, counts]) => [
120
- rule,
121
- MaintainabilityBaseline.#lowered(counts, current.sections.get(rule) ?? new Map)
122
- ]));
151
+ const sections = new Map([...this.sections].map(([rule, counts]) => {
152
+ const measured = current.sections.get(rule) ?? new Map;
153
+ if (!MaintainabilityBaseline.totalRules.has(rule))
154
+ return [rule, MaintainabilityBaseline.#lowered(counts, measured)];
155
+ return [rule, current.totalOf(rule) > this.totalOf(rule) ? counts : measured];
156
+ }));
123
157
  return new MaintainabilityBaseline(sections).#withReasonsOf(this.reasons);
124
158
  }
125
159
  #withReasonsOf(reasons) {
126
160
  return new MaintainabilityBaseline(this.sections, new Map([...reasons].filter(([key]) => this.#holdsReasoned(key))));
127
161
  }
128
162
  grownFrom(committed) {
129
- return [...this.sections].flatMap(([rule, counts]) => MaintainabilityBaseline.#raised(counts, committed.sections.get(rule) ?? new Map).filter(([key]) => !(MaintainabilityBaseline.reasonedRules.has(rule) && this.reasonOf(key))).map(([key, count, recorded]) => ({ rule, key, count, committed: recorded })));
163
+ return [...this.sections].flatMap(([rule, counts]) => MaintainabilityBaseline.totalRules.has(rule) ? this.#totalGrownFrom(committed, rule) : MaintainabilityBaseline.#raised(counts, committed.sections.get(rule) ?? new Map).filter(([key]) => !(MaintainabilityBaseline.reasonedRules.has(rule) && this.reasonOf(key))).map(([key, count, recorded]) => ({ rule, key, count, committed: recorded })));
164
+ }
165
+ #totalGrownFrom(committed, rule) {
166
+ const count = this.totalOf(rule);
167
+ const recorded = committed.sections.has(rule) ? committed.totalOf(rule) : undefined;
168
+ return count > (recorded ?? 0) ? [{ rule, key: MaintainabilityBaseline.totalKey, count, committed: recorded }] : [];
130
169
  }
131
170
  stringify() {
132
171
  const sections = MaintainabilityBaseline.debtRules.flatMap((rule) => {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  AppInfo
4
- } from "./index-sr5da35e.js";
4
+ } from "./index-sq9d0jhj.js";
5
5
 
6
6
  // pkgs/@akanjs/devkit/slicePlanner.ts
7
7
  class SlicePlanner {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  FrameworkMapBuilder,
4
4
  FrameworkMapDoc
5
- } from "./index-7y5yghjg.js";
5
+ } from "./index-nd39rssn.js";
6
6
 
7
7
  // pkgs/@akanjs/devkit/frameworkGraph.ts
8
8
  import { readdir, readFile, realpath, stat } from "fs/promises";
@@ -2,15 +2,18 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-93ewzmp6.js";
5
+ } from "./index-23d8gw08.js";
6
6
  import {
7
7
  generatedFilesForSync,
8
8
  createPassedPrimitiveReport,
9
9
  scalarChangedFiles
10
- } from "./index-8pb9yvp8.js";
10
+ } from "./index-dfsa009c.js";
11
11
  import {
12
12
  pluralizeName
13
13
  } from "./index-nz8prx9g.js";
14
+ import {
15
+ assertPlainName
16
+ } from "./index-va90m8nd.js";
14
17
 
15
18
  // pkgs/@akanjs/cli/scalar/scalar.runner.ts
16
19
  class ScalarRunner extends runner("scalar") {
@@ -37,6 +40,7 @@ class ScalarRunner extends runner("scalar") {
37
40
  // pkgs/@akanjs/cli/scalar/scalar.script.ts
38
41
  class ScalarScript extends script("scalar", [ScalarRunner]) {
39
42
  async createScalar(sys, scalarName) {
43
+ assertPlainName("scalar", scalarName);
40
44
  const files = await this.scalarRunner.applyScalarTemplate(sys, scalarName);
41
45
  return createPassedPrimitiveReport({
42
46
  command: "create-scalar",
@@ -46,6 +50,7 @@ class ScalarScript extends script("scalar", [ScalarRunner]) {
46
50
  });
47
51
  }
48
52
  async removeScalar(sys, scalarName) {
53
+ assertPlainName("scalar", scalarName);
49
54
  await sys.removeDir(`lib/__scalar/${scalarName}`);
50
55
  }
51
56
  }
@@ -4,27 +4,27 @@ import {
4
4
  CloudApi,
5
5
  CloudUpdates,
6
6
  PipelineSecrets
7
- } from "./index-drz9e84d.js";
7
+ } from "./index-7ky4brfy.js";
8
8
  import {
9
9
  PkgExecutor
10
- } from "./index-sr5da35e.js";
10
+ } from "./index-sq9d0jhj.js";
11
11
  import {
12
12
  UpdatePackFolder,
13
13
  NativePublicEnv,
14
14
  NativeApp
15
- } from "./index-zpv14wpy.js";
15
+ } from "./index-dsg50er9.js";
16
16
  import {
17
17
  script
18
- } from "./index-93ewzmp6.js";
18
+ } from "./index-23d8gw08.js";
19
19
  import {
20
20
  ApplicationScript
21
- } from "./index-vr68mxj5.js";
21
+ } from "./index-5jwx4bf2.js";
22
22
  import {
23
23
  PackageScript
24
- } from "./index-d4n1wmrz.js";
24
+ } from "./index-6fnrhpn1.js";
25
25
  import {
26
26
  CloudRunner
27
- } from "./index-6wpaq392.js";
27
+ } from "./index-p4htjyvk.js";
28
28
 
29
29
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
30
30
  import { Logger } from "akanjs/common";
@@ -0,0 +1,70 @@
1
+ // @bun
2
+ // pkgs/@akanjs/devkit/commandDecorators/cliError.ts
3
+ import { AkanError } from "akanjs/base";
4
+
5
+ class CliError extends AkanError {
6
+ static exitCodes = {
7
+ failed: 1,
8
+ usage: 2,
9
+ unknownTarget: 2,
10
+ refused: 2,
11
+ checkFailed: 3,
12
+ interrupted: 130
13
+ };
14
+ static usageCodes = ["usage", "unknownTarget"];
15
+ exitCode;
16
+ constructor(code, message, { exitCode, cause } = {}) {
17
+ super(code, message, { cause });
18
+ this.exitCode = exitCode ?? CliError.#exitCodeOfCode(code) ?? 1;
19
+ }
20
+ static failureCodeOf(error) {
21
+ if (AkanError.is(error))
22
+ return error.code;
23
+ return CliError.#isPromptExit(error) ? "interrupted" : "failed";
24
+ }
25
+ static exitCodeOf(error) {
26
+ if (error instanceof CliError)
27
+ return error.exitCode;
28
+ const code = CliError.failureCodeOf(error);
29
+ return code === "failed" ? null : CliError.#exitCodeOfCode(code);
30
+ }
31
+ static messageOf(error) {
32
+ if (error instanceof Error)
33
+ return error.message || error.name;
34
+ if (typeof error === "string")
35
+ return error.trim() || "Unknown error";
36
+ if (error === null || error === undefined)
37
+ return "Unknown error";
38
+ try {
39
+ const json = JSON.stringify(error);
40
+ if (json)
41
+ return json;
42
+ } catch {
43
+ return String(error);
44
+ }
45
+ return String(error) || "Unknown error";
46
+ }
47
+ static failureOf(error) {
48
+ return { ok: false, error: CliError.messageOf(error), code: CliError.failureCodeOf(error) };
49
+ }
50
+ static #exitCodeOfCode(code) {
51
+ return Object.hasOwn(CliError.exitCodes, code) ? CliError.exitCodes[code] : null;
52
+ }
53
+ static #isPromptExit(error) {
54
+ return error instanceof Error && error.name === "ExitPromptError";
55
+ }
56
+ }
57
+
58
+ // pkgs/@akanjs/devkit/typecheck/typecheckFailure.ts
59
+ class TypecheckFailure extends CliError {
60
+ records;
61
+ static workerExitCode = 3;
62
+ constructor(records) {
63
+ super("checkFailed", records.slice(0, 20).map((record) => `${record.file ?? "-"}:${record.line}:${record.col} ${record.code} ${record.message}`).join(`
64
+ `) || "Typecheck failed");
65
+ this.records = records;
66
+ this.name = "TypecheckFailure";
67
+ }
68
+ }
69
+
70
+ export { CliError, TypecheckFailure };
@@ -1,20 +1,22 @@
1
1
  // @bun
2
2
  import {
3
3
  ApplicationBuildReporter
4
- } from "./index-p6hjwt2d.js";
4
+ } from "./index-41mfhgq0.js";
5
5
  import {
6
6
  parseBiomeReport,
7
7
  Linter,
8
- TypecheckFailure,
9
8
  ProjectTypecheck2,
10
9
  AppExecutor,
11
10
  LibExecutor,
12
11
  PkgExecutor
13
- } from "./index-sr5da35e.js";
12
+ } from "./index-sq9d0jhj.js";
13
+ import {
14
+ TypecheckFailure
15
+ } from "./index-j4yvgfhr.js";
14
16
  import {
15
17
  WorkspaceRunner,
16
18
  AkanQualityScanner
17
- } from "./index-fjr4d6yd.js";
19
+ } from "./index-apcr1qgk.js";
18
20
 
19
21
  // pkgs/@akanjs/cli/verify/verifyComments.ts
20
22
  import { existsSync } from "fs";