@akanjs/cli 2.4.0-rc.9 → 2.4.1-rc.0

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 (69) hide show
  1. package/agent.command-h4afc69n.js +26 -0
  2. package/application.command-4ctkfdan.js +165 -0
  3. package/applicationBuildRunner-esa1kj7v.js +284 -0
  4. package/applicationReleasePackager-brvth6rs.js +245 -0
  5. package/capacitorApp-y0h6cgft.js +58 -0
  6. package/cloud.command-rpztn4fh.js +94 -0
  7. package/commandManifest.json +1 -0
  8. package/context.command-nqbtak4f.js +82 -0
  9. package/dependencyScanner-m4x5maek.js +9 -0
  10. package/guideline.command-ya0dh44f.js +356 -0
  11. package/incrementalBuilder.proc.js +89 -17394
  12. package/index-1xdrsbry.js +1447 -0
  13. package/index-45aj5ry0.js +990 -0
  14. package/index-5vvwc0cz.js +559 -0
  15. package/index-61keag0s.js +40 -0
  16. package/index-6pz1j0zj.js +62 -0
  17. package/index-73pr2cmy.js +534 -0
  18. package/index-76rn3g2c.js +76 -0
  19. package/index-85msc0wg.js +161 -0
  20. package/index-8pkbzj26.js +840 -0
  21. package/index-8rc0bm04.js +514 -0
  22. package/index-9sp6fsc5.js +1884 -0
  23. package/index-a6sbyy0b.js +2769 -0
  24. package/index-b0brjbp3.js +83 -0
  25. package/index-fgc8r6dj.js +33 -0
  26. package/index-h6ca6qg0.js +2777 -0
  27. package/index-hdqztm58.js +758 -0
  28. package/index-hwzpw9c1.js +202 -0
  29. package/index-pmm9e2jf.js +120 -0
  30. package/index-qaq13qk3.js +80 -0
  31. package/index-qhtr07v8.js +1072 -0
  32. package/index-r24hmh0q.js +4 -0
  33. package/index-ss469dec.js +11 -0
  34. package/index-swf4bmbg.js +25 -0
  35. package/index-w7fyqjrw.js +462 -0
  36. package/index-wnp7hwq7.js +193 -0
  37. package/index-wq8jwx8z.js +224 -0
  38. package/index-x53a5nya.js +301 -0
  39. package/index-xmc2w32q.js +4359 -0
  40. package/index-y3hdhy4p.js +229 -0
  41. package/index.js +54 -23340
  42. package/library.command-r15zdqvp.js +33 -0
  43. package/localRegistry.command-5tcahs3f.js +178 -0
  44. package/module.command-qrj3kmyz.js +54 -0
  45. package/package.command-r8sq5kzp.js +43 -0
  46. package/package.json +2 -2
  47. package/page.command-c6xdx0xm.js +24 -0
  48. package/primitive.command-pv9ssmtf.js +62 -0
  49. package/quality.command-es67wvdp.js +809 -0
  50. package/repair.command-677675vw.js +67 -0
  51. package/routeSourceValidator-wbhmbwpj.js +132 -0
  52. package/scalar.command-kabkd6wd.js +35 -0
  53. package/templates/app/page/_layout.tsx +19 -1
  54. package/templates/app/public/fonts/Pretendard-Black.woff2 +0 -0
  55. package/templates/app/public/fonts/Pretendard-Bold.woff2 +0 -0
  56. package/templates/app/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
  57. package/templates/app/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
  58. package/templates/app/public/fonts/Pretendard-Light.woff2 +0 -0
  59. package/templates/app/public/fonts/Pretendard-Medium.woff2 +0 -0
  60. package/templates/app/public/fonts/Pretendard-Regular.woff2 +0 -0
  61. package/templates/app/public/fonts/Pretendard-SemiBold.woff2 +0 -0
  62. package/templates/app/public/fonts/Pretendard-Thin.woff2 +0 -0
  63. package/templates/facetIndex/index.ts +1 -1
  64. package/typeChecker-kravn7ns.js +8 -0
  65. package/typecheck.proc.js +4 -194
  66. package/workflow.command-64r6cw0w.js +108 -0
  67. package/workspace.command-vrws0rgx.js +435 -0
  68. package/README.ko.md +0 -72
  69. package/README.md +0 -85
@@ -0,0 +1,161 @@
1
+ // @bun
2
+ import {
3
+ AkanContextAnalyzer
4
+ } from "./index-8rc0bm04.js";
5
+ import {
6
+ createRepairReport,
7
+ generatedFilePathsForTarget,
8
+ renderRepairReport,
9
+ writeGeneratedSyncState,
10
+ writeWorkflowRunArtifact
11
+ } from "./index-h6ca6qg0.js";
12
+ import {
13
+ runner
14
+ } from "./index-hdqztm58.js";
15
+
16
+ // pkgs/@akanjs/cli/repair/repair.runner.ts
17
+ var commandForShell = (command) => command.startsWith("akan ") ? `bun run ${command}` : command;
18
+ var defaultExecutor = (workspace) => async (command) => {
19
+ try {
20
+ const stdout = await workspace.spawn("bash", ["-lc", commandForShell(command.command)], {
21
+ cwd: workspace.workspaceRoot
22
+ });
23
+ return {
24
+ command: command.command,
25
+ reason: command.reason,
26
+ status: "passed",
27
+ exitCode: 0,
28
+ stdout
29
+ };
30
+ } catch (error) {
31
+ const commandError = error;
32
+ return {
33
+ command: command.command,
34
+ reason: command.reason,
35
+ status: "failed",
36
+ exitCode: commandError.code ?? 1,
37
+ stdout: commandError.stdout,
38
+ stderr: commandError.stderr ?? commandError.message
39
+ };
40
+ }
41
+ };
42
+ var targetMissing = (input) => ({
43
+ severity: "error",
44
+ code: "repair-input-missing",
45
+ input,
46
+ message: `Repair command requires "${input}".`
47
+ });
48
+ var repairAction = (kind, command, reason, safeToRun) => ({
49
+ kind,
50
+ command,
51
+ reason,
52
+ safeToRun
53
+ });
54
+
55
+ class RepairRunner extends runner("repair") {
56
+ async repair(kind, {
57
+ workspace,
58
+ app = null,
59
+ module = null,
60
+ target = null,
61
+ format = "markdown",
62
+ execute
63
+ }) {
64
+ const executor = execute ?? defaultExecutor(workspace);
65
+ const report = await this.createRepairReport(kind, { workspace, app, module, target, execute: executor });
66
+ const { artifact, runId } = await writeWorkflowRunArtifact(workspace, report);
67
+ const reportWithArtifact = artifact;
68
+ if (kind === "generated" && reportWithArtifact.status === "passed" && reportWithArtifact.target) {
69
+ await writeGeneratedSyncState(workspace, {
70
+ schemaVersion: 1,
71
+ target: reportWithArtifact.target,
72
+ status: "passed",
73
+ syncedAt: reportWithArtifact.syncedAt ?? new Date().toISOString(),
74
+ command: `akan sync ${reportWithArtifact.target}`,
75
+ runId,
76
+ generatedFiles: reportWithArtifact.generatedFiles ?? []
77
+ });
78
+ }
79
+ return renderRepairReport(reportWithArtifact, format);
80
+ }
81
+ async createRepairReport(kind, {
82
+ workspace,
83
+ app = null,
84
+ module = null,
85
+ target = null,
86
+ execute
87
+ }) {
88
+ if (kind === "generated") {
89
+ if (!app) {
90
+ return createRepairReport({ command: "repair generated", kind, diagnostics: [targetMissing("app")] });
91
+ }
92
+ const command = { command: `akan sync ${app}`, reason: "Refresh generated Akan files from source conventions." };
93
+ const result = await execute(command);
94
+ const [apps] = await workspace.getSyss();
95
+ const targetRoot = `${apps.includes(app) ? "apps" : "libs"}/${app}`;
96
+ return createRepairReport({
97
+ command: "repair generated",
98
+ kind,
99
+ target: app,
100
+ repairActions: [repairAction(kind, command.command, command.reason, true)],
101
+ nextActions: [
102
+ { command: `akan doctor --strict --format json`, reason: "Re-run doctor after generated files refresh." }
103
+ ],
104
+ commands: [result],
105
+ generatedFiles: generatedFilePathsForTarget(targetRoot),
106
+ ...result.status === "passed" ? { syncedAt: new Date().toISOString() } : {}
107
+ });
108
+ }
109
+ if (kind === "format" || kind === "imports") {
110
+ if (!target) {
111
+ return createRepairReport({ command: `repair ${kind}`, kind, diagnostics: [targetMissing("target")] });
112
+ }
113
+ const command = { command: `akan lint ${target}`, reason: "Run Biome lint/fix path for formatting and imports." };
114
+ return createRepairReport({
115
+ command: `repair ${kind}`,
116
+ kind,
117
+ target,
118
+ repairActions: [repairAction(kind, command.command, command.reason, true)],
119
+ nextActions: [{ command: `akan doctor --strict --format json`, reason: "Re-run doctor after lint repair." }],
120
+ commands: [await execute(command)]
121
+ });
122
+ }
123
+ if (!app || !module) {
124
+ return createRepairReport({
125
+ command: `repair ${kind}`,
126
+ kind,
127
+ target: app,
128
+ diagnostics: [!app ? targetMissing("app") : targetMissing("module")]
129
+ });
130
+ }
131
+ const doctor = await AkanContextAnalyzer.doctor(workspace, { strict: true });
132
+ const diagnostics = doctor.diagnostics.filter((diagnostic) => {
133
+ if (kind === "dictionary")
134
+ return diagnostic.code === "dictionary-label-missing" && diagnostic.path?.includes(module);
135
+ return (diagnostic.code === "module-shape-invalid" || diagnostic.code === "module-abstract-missing") && diagnostic.path?.includes(module);
136
+ });
137
+ const actionCommand = kind === "dictionary" ? `akan add-field --app ${app} --module ${module} --field <field> --type <type> --format json` : `akan create-module ${module} --app ${app} --format json`;
138
+ return createRepairReport({
139
+ command: `repair ${kind}`,
140
+ kind,
141
+ target: `${app}:${module}`,
142
+ diagnostics: diagnostics.length > 0 ? diagnostics : [
143
+ {
144
+ severity: "warning",
145
+ code: `repair-${kind}-no-automatic-change`,
146
+ message: `No safe automatic ${kind} repair was applied for ${app}:${module}.`
147
+ }
148
+ ],
149
+ repairActions: [
150
+ repairAction(kind, actionCommand, "Use an explicit primitive command for source-safe repair.", false)
151
+ ],
152
+ nextActions: [
153
+ { command: actionCommand, reason: "Run a source-aware primitive if this repair is needed." },
154
+ { command: "akan doctor --strict --format json", reason: "Re-run doctor after manual or primitive repair." }
155
+ ],
156
+ commands: []
157
+ });
158
+ }
159
+ }
160
+
161
+ export { RepairRunner };