@akanjs/cli 3.1.2-rc.3 → 3.2.0-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 (130) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-n2tkg59z.js → CodeAgent-h6g8dg3a.js} +2 -2
  3. package/{CodeTui-9wsdx7ap.js → CodeTui-n9gacepn.js} +1 -1
  4. package/README.ko.md +9 -0
  5. package/README.md +9 -0
  6. package/TunnelShare-k3ja4w9x.js +14 -0
  7. package/{agent.command-tffz6wdn.js → agent.command-2f657613.js} +19 -17
  8. package/akanCode.js +2 -2
  9. package/{application.command-7bkxbrsp.js → application.command-yb8v177e.js} +45 -22
  10. package/{applicationBuildRunner-s13x3zqb.js → applicationBuildRunner-sctcmkyx.js} +57 -17
  11. package/buildBatch.proc.js +7 -7
  12. package/{cloud.command-a792bc10.js → cloud.command-et06ja22.js} +35 -18
  13. package/cloud.script-s6rbrwer.js +30 -0
  14. package/{code.command-ma8dtzww.js → code.command-7m67c7zc.js} +6 -6
  15. package/commandManifest.json +1 -1
  16. package/{context.command-80a1qhps.js → context.command-569z0rqf.js} +20 -19
  17. package/context.runner-ms8v1rxy.js +29 -0
  18. package/{guideline.command-195g0h9a.js → guideline.command-gnv3e8p8.js} +2 -2
  19. package/guidelines/akanApi/akanApi.instruction.md +317 -0
  20. package/guidelines/conventions/rules/app.md +5 -5
  21. package/guidelines/conventions/rules/config.md +1 -1
  22. package/guidelines/conventions/rules/gates.md +10 -5
  23. package/guidelines/conventions/rules/page.md +4 -2
  24. package/guidelines/conventions/rules/server.md +2 -0
  25. package/guidelines/conventions/rules/style.md +3 -1
  26. package/guidelines/conventions/rules/ts.md +2 -1
  27. package/guidelines/cssRule/cssRule.instruction.md +3 -1
  28. package/guidelines/pageRule/pageRule.instruction.md +3 -0
  29. package/incrementalBuilder.proc.js +70 -14
  30. package/{index-tns543wd.js → index-0fb3cpbt.js} +3 -3
  31. package/{index-zbrwnmf1.js → index-1q1cjn8s.js} +21 -11
  32. package/{index-wrmq92vk.js → index-3wjbhj2n.js} +1 -1
  33. package/{index-361ex3rb.js → index-48d5qsj3.js} +4 -4
  34. package/{index-aayg4dqf.js → index-5w9my9qe.js} +8 -8
  35. package/{index-1h2jc0x3.js → index-6wpaq392.js} +61 -15
  36. package/{index-tp56652m.js → index-7xdpww43.js} +69 -12
  37. package/index-7y5yghjg.js +2969 -0
  38. package/{index-zttm13c3.js → index-8g7tdsk4.js} +249 -696
  39. package/{index-m02tdq8a.js → index-8pb9yvp8.js} +63 -21
  40. package/{index-gbp1q1b5.js → index-8ts9774g.js} +4 -4
  41. package/{index-9zy8479y.js → index-93ewzmp6.js} +43 -14
  42. package/{index-zdpte1pj.js → index-9tbgb4d8.js} +1 -1
  43. package/index-abgh0jve.js +126 -0
  44. package/{index-khk05tsf.js → index-aj3ehkcx.js} +1 -1
  45. package/{index-84h43kg6.js → index-d4n1wmrz.js} +37 -4
  46. package/{index-gr9thy79.js → index-drz9e84d.js} +22 -8
  47. package/{index-hapx5myy.js → index-e3vmjtph.js} +2 -2
  48. package/{index-k64mhwbw.js → index-eajbmk10.js} +2 -1
  49. package/{index-0j1t1h2b.js → index-ed6ea0qp.js} +1 -1
  50. package/{index-sjabnf7j.js → index-fjr4d6yd.js} +444 -368
  51. package/index-hqrkqxx2.js +176 -0
  52. package/{index-z7kbxdqg.js → index-jdamtr7e.js} +3 -3
  53. package/{index-scck6h6d.js → index-kpdv34rq.js} +4 -4
  54. package/{index-ppvqy5bc.js → index-ktb3wcqz.js} +73 -34
  55. package/{index-sveq36gh.js → index-mmym5xmb.js} +4 -2
  56. package/{index-y4kcmbt2.js → index-mqntfzv5.js} +2 -2
  57. package/{index-4am4dvmf.js → index-ny2k80mv.js} +15 -3
  58. package/index-p6hjwt2d.js +1668 -0
  59. package/{index-wwe9rsrx.js → index-r0a604h4.js} +12 -2
  60. package/{index-jb2sreps.js → index-rc5fvqj2.js} +18 -18
  61. package/{index-db2nqrad.js → index-ryrm5z2c.js} +71 -19
  62. package/{index-eft5c2mp.js → index-s2grpzef.js} +331 -27
  63. package/{index-g500c5j9.js → index-sr5da35e.js} +33 -10
  64. package/{index-defp4gmb.js → index-sy481q2x.js} +1 -1
  65. package/{index-j9d3mjx1.js → index-thckcabc.js} +2 -2
  66. package/{index-9z3egsmg.js → index-vkzfk7qt.js} +25 -23
  67. package/index-w639tvkd.js +166 -0
  68. package/index-ygdbn9jn.js +122 -0
  69. package/{index-sp0qsr7a.js → index-zpv14wpy.js} +3 -3
  70. package/{index-sx91nf4z.js → index-zxsygkda.js} +18 -9
  71. package/index.js +24 -23
  72. package/{library.command-63hgt9te.js → library.command-1gp5qe3r.js} +3 -3
  73. package/{localRegistry.command-343ksmn9.js → localRegistry.command-v3g21rex.js} +25 -16
  74. package/{module.command-2hce9m6k.js → module.command-4xz9he6h.js} +6 -6
  75. package/{package.command-96eheyvd.js → package.command-s7qpnn1g.js} +12 -3
  76. package/package.json +2 -2
  77. package/{page.command-gs6d841d.js → page.command-fan34c49.js} +3 -3
  78. package/{pipeline.command-wdfvdbfj.js → pipeline.command-ph4fnn9w.js} +2 -2
  79. package/{primitive.command-7tdj12wn.js → primitive.command-3fqh8emf.js} +7 -7
  80. package/{projectTypecheck-kqj1t6hb.js → projectTypecheck-vkb40hjc.js} +1 -1
  81. package/{quality.command-29bgarh1.js → quality.command-ecj6exsh.js} +15 -10
  82. package/{repair.command-yng4rf5d.js → repair.command-fe9jw719.js} +6 -6
  83. package/{scalar.command-1nk4329t.js → scalar.command-cnvfhk0n.js} +5 -5
  84. package/skills/akan-debug/SKILL.md +2 -1
  85. package/skills/akan-page/SKILL.md +30 -2
  86. package/skills/akan-service/SKILL.md +77 -1
  87. package/{subspace.command-5cehmcdd.js → subspace.command-yxtt3v3e.js} +8 -8
  88. package/templates/app/lib/___appName__/__appName__.abstract.md.template +6 -0
  89. package/templates/app/page/_index.tsx +4 -284
  90. package/templates/app/page/_layout.tsx +1 -26
  91. package/templates/app/page/styles.css.template +58 -318
  92. package/templates/appSample/page/_index.tsx +281 -0
  93. package/templates/appSample/page/_layout.tsx +55 -0
  94. package/templates/appSample/page/styles.css.template +327 -0
  95. package/templates/libRoot/lib/___libName__/__libName__.abstract.md.template +6 -0
  96. package/templates/workspaceRoot/package.json.template +1 -12
  97. package/{tunnel.command-yrd4atqy.js → tunnel.command-ggj38mqf.js} +7 -7
  98. package/{typeChecker-j2jdnqsr.js → typeChecker-s640r6c0.js} +1 -1
  99. package/typecheck.proc.js +1 -1
  100. package/{verify.command-kbq0fcg8.js → verify.command-w9ttxkdz.js} +16 -14
  101. package/{workflow.command-274qfa8z.js → workflow.command-ss8devj0.js} +12 -12
  102. package/{workspace.command-r6hgmawy.js → workspace.command-rw1p0xeq.js} +50 -38
  103. package/TunnelShare-6d7z36sr.js +0 -14
  104. package/cloud.script-t2n13gv6.js +0 -27
  105. package/context.runner-wxqb3qcy.js +0 -28
  106. package/index-j2dgmzbj.js +0 -1259
  107. package/index-p6x5b7hr.js +0 -839
  108. package/index-vzpnr12w.js +0 -65
  109. package/templates/workspaceRoot/patches/zod@3.25.76.patch.template +0 -22
  110. package/templates/workspaceRoot/patches/zod@4.4.3.patch.template +0 -11
  111. /package/templates/{app → appSample}/page/_overrides.tsx +0 -0
  112. /package/templates/{app → appSample}/public/fonts/Pretendard-Black.woff2 +0 -0
  113. /package/templates/{app → appSample}/public/fonts/Pretendard-Bold.woff2 +0 -0
  114. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
  115. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
  116. /package/templates/{app → appSample}/public/fonts/Pretendard-Light.woff2 +0 -0
  117. /package/templates/{app → appSample}/public/fonts/Pretendard-Medium.woff2 +0 -0
  118. /package/templates/{app → appSample}/public/fonts/Pretendard-Regular.woff2 +0 -0
  119. /package/templates/{app → appSample}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
  120. /package/templates/{app → appSample}/public/fonts/Pretendard-Thin.woff2 +0 -0
  121. /package/templates/{app → appSample}/public/jelly/cloud.webp +0 -0
  122. /package/templates/{app → appSample}/public/jelly/comet.webp +0 -0
  123. /package/templates/{app → appSample}/public/jelly/moon.webp +0 -0
  124. /package/templates/{app → appSample}/public/jelly/planet.webp +0 -0
  125. /package/templates/{app → appSample}/public/jelly/rocket.webp +0 -0
  126. /package/templates/{app → appSample}/public/jelly/star.webp +0 -0
  127. /package/templates/{app → appSample}/public/jelly/sugar.webp +0 -0
  128. /package/templates/{app → appSample}/public/logo.png +0 -0
  129. /package/templates/{app → appSample}/ui/Recipe/index.ts +0 -0
  130. /package/templates/{app → appSample}/ui/Recipe/jellyButton.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  WorkspaceExecutor
4
- } from "./index-g500c5j9.js";
4
+ } from "./index-sr5da35e.js";
5
5
  import {
6
6
  jsonText,
7
7
  workflowPlanApproval,
@@ -19,6 +19,7 @@ import {
19
19
  getWorkflowSpec,
20
20
  compactWorkflowInputs,
21
21
  createWorkflowPlan,
22
+ workflowTargetDiagnostics,
22
23
  inspectWorkflowPlan,
23
24
  renderWorkflowList,
24
25
  renderWorkflowExplain,
@@ -26,30 +27,30 @@ import {
26
27
  renderWorkflowApply,
27
28
  renderWorkflowValidation,
28
29
  renderWorkflowRunArtifact
29
- } from "./index-m02tdq8a.js";
30
+ } from "./index-8pb9yvp8.js";
30
31
  import {
31
32
  AkanContextAnalyzer
32
- } from "./index-j9d3mjx1.js";
33
+ } from "./index-thckcabc.js";
33
34
  import {
34
35
  CommandContainer,
35
36
  runner
36
- } from "./index-9zy8479y.js";
37
+ } from "./index-93ewzmp6.js";
37
38
  import {
38
39
  ModuleScript
39
- } from "./index-gbp1q1b5.js";
40
+ } from "./index-8ts9774g.js";
40
41
  import {
41
42
  PrimitiveScript
42
- } from "./index-361ex3rb.js";
43
+ } from "./index-48d5qsj3.js";
43
44
  import {
44
45
  spawnAkan,
45
46
  isWorkspaceTarget
46
- } from "./index-tns543wd.js";
47
+ } from "./index-0fb3cpbt.js";
47
48
  import {
48
49
  ScalarScript
49
- } from "./index-hapx5myy.js";
50
+ } from "./index-e3vmjtph.js";
50
51
  import {
51
52
  workflowSpecs
52
- } from "./index-k64mhwbw.js";
53
+ } from "./index-eajbmk10.js";
53
54
 
54
55
  // pkgs/@akanjs/cli/workflow/workflow.runner.ts
55
56
  import { mkdir, readFile, writeFile } from "fs/promises";
@@ -85,19 +86,17 @@ var failedPlan = (workflow, diagnostics) => ({
85
86
  requiresApproval: true,
86
87
  approval: workflowPlanApproval
87
88
  });
88
- var failedApplyReport = (workflow, code, message, plan) => {
89
- const diagnostics = [{ severity: "error", code, message }];
90
- return createWorkflowApplyReport({
91
- workflow,
92
- mode: "apply",
93
- changedFiles: [],
94
- generatedFiles: [],
95
- commands: [],
96
- diagnostics,
97
- nextActions: [],
98
- plan: plan ?? failedPlan(workflow, diagnostics)
99
- });
100
- };
89
+ var refusedApplyReport = (workflow, diagnostics, { plan, mode = "apply" } = {}) => createWorkflowApplyReport({
90
+ workflow,
91
+ mode,
92
+ changedFiles: [],
93
+ generatedFiles: [],
94
+ commands: [],
95
+ diagnostics,
96
+ nextActions: [],
97
+ plan: plan ?? failedPlan(workflow, diagnostics)
98
+ });
99
+ var failedApplyReport = (workflow, code, message, plan) => refusedApplyReport(workflow, [{ severity: "error", code, message }], { plan });
101
100
  var inferValidationKind = (command) => {
102
101
  if (command.kind)
103
102
  return command.kind;
@@ -280,7 +279,7 @@ class WorkflowRunner extends runner("workflow") {
280
279
  const spec = getWorkflowSpec(workflowSpecs, workflow);
281
280
  if (!spec)
282
281
  throw new Error(`Unknown workflow: ${workflow}. Run \`akan workflow list\` to see available workflows.`);
283
- const plan = await inspectWorkflowPlan(workspace ?? WorkspaceExecutor.fromRoot(), createWorkflowPlan(spec, compactWorkflowInputs(inputs)));
282
+ const plan = await inspectWorkflowPlan(workspace ?? WorkspaceExecutor.fromRoot(), spec, createWorkflowPlan(spec, compactWorkflowInputs(inputs)));
284
283
  if (out) {
285
284
  const outPath = resolvePath(out);
286
285
  await mkdir(path.dirname(outPath), { recursive: true });
@@ -320,6 +319,9 @@ class WorkflowRunner extends runner("workflow") {
320
319
  const message = inputErrors.map((diagnostic) => diagnostic.message).join(" ");
321
320
  return await renderApplyReport(failedApplyReport(plan.workflow, "workflow-plan-inputs-invalid", message, plan));
322
321
  }
322
+ const targetErrors = await workflowTargetDiagnostics(workspace ?? WorkspaceExecutor.fromRoot(), spec, plan.inputs);
323
+ if (targetErrors.length)
324
+ return await renderApplyReport(refusedApplyReport(plan.workflow, targetErrors, { plan, mode: dryRun ? "dry-run" : "apply" }));
323
325
  plan = { ...plan, steps: spec.steps, validation: spec.validation };
324
326
  if (dryRun)
325
327
  return await renderApplyReport(createDryRunWorkflowApplyReport(plan));
@@ -0,0 +1,166 @@
1
+ // @bun
2
+ import {
3
+ AkanGraphDiff,
4
+ AkanIndex
5
+ } from "./index-7y5yghjg.js";
6
+ import {
7
+ GitRevision
8
+ } from "./index-ygdbn9jn.js";
9
+
10
+ // pkgs/@akanjs/devkit/workspaceGraph.ts
11
+ import { readFile } from "fs/promises";
12
+ import path from "path";
13
+ import ts from "typescript";
14
+ var indexedPath = /^(apps|libs)\/(?!(?:.*\/)?(?:node_modules|dist|\.akan|env)\/).*\.tsx?$/;
15
+ var hiddenPath = /(?:^|\/)(?:node_modules|dist|\.akan|env)\//;
16
+ var unscopedNodeLimit = 600;
17
+ var pageKinds = new Set(["route", "layout"]);
18
+ var cachedBaseLimit = 4;
19
+ var slashed = (fileName) => fileName.replace(/\\/g, "/");
20
+
21
+ class WorkspaceGraph {
22
+ static #bases = new Map;
23
+ static async build(workspace, { digests = false } = {}) {
24
+ const root = workspace.workspaceRoot;
25
+ const files = (await workspace.getAllFiles("{apps,libs}/**/*.{ts,tsx}")).map(slashed).filter((file) => indexedPath.test(file));
26
+ return WorkspaceGraph.#graphOf(root, await WorkspaceGraph.#textsOf(root, files), digests);
27
+ }
28
+ static async#textsOf(root, files) {
29
+ const read = await Promise.all(files.map(async (file) => [file, await readFile(path.join(root, file), "utf8").catch(() => null)]));
30
+ return new Map(read.filter((entry) => entry[1] !== null));
31
+ }
32
+ static async changes(workspace, since) {
33
+ const forkPoint = await new GitRevision(workspace.workspaceRoot).forkPointOf(since);
34
+ if (forkPoint.error !== undefined)
35
+ return { error: forkPoint.error };
36
+ return await WorkspaceGraph.changesAt(workspace, forkPoint.sha);
37
+ }
38
+ static async changesAt(workspace, sha) {
39
+ const root = workspace.workspaceRoot;
40
+ const git = new GitRevision(root);
41
+ const [before, after, files] = await Promise.all([
42
+ WorkspaceGraph.#baseAt(root, sha),
43
+ git.workingFiles().then((working) => WorkspaceGraph.#textsOf(root, working.filter((file) => indexedPath.test(file)))).then((texts) => WorkspaceGraph.#graphOf(root, texts, true)),
44
+ git.changedFilesSince(sha)
45
+ ]);
46
+ const changes = AkanGraphDiff.between(before, after);
47
+ const mapped = new Set([
48
+ ...changes.nodes.filter((node) => node.change).flatMap((node) => [
49
+ node.at?.file,
50
+ ...(node.fields ?? []).filter((field) => field.change).map(({ at }) => at.file)
51
+ ]),
52
+ ...changes.edges.filter((edge) => edge.change).map((edge) => edge.at?.file)
53
+ ]);
54
+ const unmapped = files.filter(({ file }) => !mapped.has(file) && !hiddenPath.test(file));
55
+ return { ...changes, since: sha.slice(0, 12), unmapped };
56
+ }
57
+ static #baseAt(root, sha) {
58
+ const key = `${root}
59
+ ${sha}`;
60
+ const cached = WorkspaceGraph.#bases.get(key);
61
+ if (cached)
62
+ return cached;
63
+ const graph = new GitRevision(root).filesAt(sha, (file) => indexedPath.test(file)).then((texts) => WorkspaceGraph.#graphOf(root, texts, true));
64
+ graph.catch(() => WorkspaceGraph.#bases.delete(key));
65
+ WorkspaceGraph.#bases.set(key, graph);
66
+ for (const old of [...WorkspaceGraph.#bases.keys()].slice(0, -cachedBaseLimit))
67
+ WorkspaceGraph.#bases.delete(old);
68
+ return graph;
69
+ }
70
+ static #graphOf(root, texts, digests) {
71
+ const index = new AkanIndex({ ts, root });
72
+ const byFileName = new Map;
73
+ for (const [file, text] of texts) {
74
+ const fileName = slashed(path.join(root, file));
75
+ byFileName.set(fileName, text);
76
+ index.setFile(fileName, text);
77
+ }
78
+ return index.graph((fileName) => byFileName.get(fileName), { digests });
79
+ }
80
+ static scope(graph, { app, module }) {
81
+ if (!app && !module)
82
+ return graph;
83
+ const owners = app ? new Set([`apps/${app}`, `libs/${app}`]) : null;
84
+ const seeds = new Set(graph.nodes.filter((node) => (!owners || owners.has(node.owner ?? "")) && (!module || node.module === module)).map((node) => node.id));
85
+ const guards = new Set(graph.nodes.filter((node) => node.kind === "guard").map((node) => node.id));
86
+ const reaches = (id) => seeds.has(id) && !guards.has(id);
87
+ const edges = graph.edges.filter((edge) => reaches(edge.from) || reaches(edge.to));
88
+ const ids = new Set([...seeds, ...edges.flatMap((edge) => [edge.from, edge.to])]);
89
+ return { version: 1, nodes: graph.nodes.filter((node) => ids.has(node.id)), edges };
90
+ }
91
+ static #withoutPages(graph) {
92
+ const changed = new Set(graph.nodes.filter((node) => node.change).map((node) => node.id));
93
+ const touching = new Set(graph.edges.filter((edge) => edge.kind !== "wraps" && (changed.has(edge.from) || changed.has(edge.to))).flatMap((edge) => [edge.from, edge.to]));
94
+ const dropped = new Set(graph.nodes.filter((node) => pageKinds.has(node.kind) && !node.change && !touching.has(node.id)).map((node) => node.id));
95
+ const edges = graph.edges.filter((edge) => !dropped.has(edge.from) && !dropped.has(edge.to));
96
+ const linked = new Set(edges.flatMap((edge) => [edge.from, edge.to]));
97
+ const isRouteOnly = (node) => node.kind === "guard" && node.detail.includes("route") && !node.change && !linked.has(node.id);
98
+ const nodes = graph.nodes.filter((node) => !dropped.has(node.id) && !isRouteOnly(node));
99
+ return { version: 1, nodes, edges };
100
+ }
101
+ static visibleTo(graph, app) {
102
+ const appOwner = `apps/${app}`;
103
+ const isVisible = ({ owner }) => !owner || owner === appOwner || owner.startsWith("libs/");
104
+ const nodes = graph.nodes.filter(isVisible);
105
+ const ids = new Set(nodes.map((node) => node.id));
106
+ return { version: 1, nodes, edges: graph.edges.filter((edge) => ids.has(edge.from) && ids.has(edge.to)) };
107
+ }
108
+ static changesVisibleTo(changes, app) {
109
+ const visible = WorkspaceGraph.visibleTo(changes, app);
110
+ const linked = new Set(visible.edges.flatMap((edge) => [edge.from, edge.to]));
111
+ const nodes = visible.nodes.filter((node) => node.change || linked.has(node.id));
112
+ const appPath = `apps/${app}/`;
113
+ return {
114
+ ...changes,
115
+ nodes,
116
+ edges: visible.edges,
117
+ summary: WorkspaceGraph.#summaryOf(nodes),
118
+ unmapped: changes.unmapped.filter(({ file }) => file.startsWith(appPath) || file.startsWith("libs/"))
119
+ };
120
+ }
121
+ static #summaryOf(nodes) {
122
+ const summary = { added: 0, removed: 0, changed: 0 };
123
+ for (const { change } of nodes)
124
+ if (change)
125
+ summary[change] += 1;
126
+ return summary;
127
+ }
128
+ static answerChanges(changes, scope) {
129
+ if ("error" in changes)
130
+ return {
131
+ diagnostics: [{ severity: "error", code: "graph-since-unknown", message: changes.error, input: "since" }]
132
+ };
133
+ const answer = WorkspaceGraph.answer(changes, scope, changes.nodes.filter((node) => node.change));
134
+ if ("diagnostics" in answer)
135
+ return { since: changes.since, summary: changes.summary, ...answer };
136
+ const summary = WorkspaceGraph.#summaryOf(answer.nodes);
137
+ const owners = scope.app ? [`apps/${scope.app}/`, `libs/${scope.app}/`] : null;
138
+ const modules = scope.module ? [`/lib/${scope.module}/`, `/lib/_${scope.module}/`] : null;
139
+ const unmapped = changes.unmapped.filter(({ file }) => (!owners || owners.some((owner) => file.startsWith(owner))) && (!modules || modules.some((segment) => file.includes(segment))));
140
+ return { since: changes.since, summary, ...answer, unmapped };
141
+ }
142
+ static answer(graph, scope, counted = graph.nodes) {
143
+ if (scope.app || scope.module || graph.nodes.length <= unscopedNodeLimit)
144
+ return WorkspaceGraph.scope(graph, scope);
145
+ const unscoped = WorkspaceGraph.#withoutPages(graph);
146
+ if (unscoped.nodes.length <= unscopedNodeLimit)
147
+ return unscoped;
148
+ const owners = new Map;
149
+ for (const node of counted)
150
+ if (node.owner && !pageKinds.has(node.kind))
151
+ owners.set(node.owner, (owners.get(node.owner) ?? 0) + 1);
152
+ return {
153
+ diagnostics: [
154
+ {
155
+ severity: "error",
156
+ code: "graph-scope-required",
157
+ message: `The graph has ${unscoped.nodes.length} nodes besides its pages. Pass app, module or both to scope it.`,
158
+ input: "app"
159
+ }
160
+ ],
161
+ owners: Object.fromEntries([...owners].sort(([a], [b]) => a < b ? -1 : 1))
162
+ };
163
+ }
164
+ }
165
+
166
+ export { WorkspaceGraph };
@@ -0,0 +1,122 @@
1
+ // @bun
2
+ // pkgs/@akanjs/devkit/gitRevision.ts
3
+ var systemPaths = ["apps", "libs"];
4
+ var changeOfStatus = { A: "added", D: "removed" };
5
+
6
+ class GitRevision {
7
+ static #defaultBranches = ["upstream/HEAD", "upstream/main", "origin/HEAD", "origin/main", "main", "master"];
8
+ static #env = { ...process.env, GIT_OPTIONAL_LOCKS: "0" };
9
+ #root;
10
+ constructor(root) {
11
+ this.#root = root;
12
+ }
13
+ async forkPointOf(since) {
14
+ if ((await this.#git(["rev-parse", "--is-inside-work-tree"]))?.trim() !== "true")
15
+ return { error: "The Change Map compares with git history, and this workspace is not in a git repository." };
16
+ if (since !== null) {
17
+ const sha = /^[^-\s][^\s]*$/.test(since) ? (await this.#git(["rev-parse", "--verify", "--quiet", `${since}^{commit}`]))?.trim() : undefined;
18
+ if (!sha)
19
+ return { error: `${since} is not a commit in this repository.` };
20
+ return await this.#mergeBase(since, sha);
21
+ }
22
+ for (const branch of GitRevision.#defaultBranches)
23
+ if (await this.#git(["rev-parse", "--verify", "--quiet", `${branch}^{commit}`]) !== null)
24
+ return await this.#mergeBase(branch, branch);
25
+ const head = (await this.#git(["rev-parse", "--verify", "--quiet", "HEAD^{commit}"]))?.trim();
26
+ return head ? { sha: head } : { error: "The repository has no commit to compare with yet." };
27
+ }
28
+ async#mergeBase(name, revision) {
29
+ const sha = (await this.#git(["merge-base", "HEAD", revision]))?.trim();
30
+ if (sha)
31
+ return { sha };
32
+ return {
33
+ error: `HEAD shares no commit with ${name} here. In a shallow clone, \`git fetch --unshallow\` brings the history in.`
34
+ };
35
+ }
36
+ async filesAt(sha, isWanted, paths = systemPaths) {
37
+ const listed = await this.#git(["ls-tree", "-r", "-z", "--name-only", sha, "--", ...paths]);
38
+ if (listed === null)
39
+ throw new Error(`git ls-tree failed for ${sha}`);
40
+ const files = listed.split("\x00").filter((file) => file && isWanted(file));
41
+ const texts = new Map;
42
+ if (!files.length)
43
+ return texts;
44
+ const proc = Bun.spawn(["git", "cat-file", "--batch"], {
45
+ cwd: this.#root,
46
+ env: GitRevision.#env,
47
+ stdin: "pipe",
48
+ stdout: "pipe",
49
+ stderr: "ignore"
50
+ });
51
+ const output = new Response(proc.stdout).arrayBuffer();
52
+ proc.stdin.write(files.map((file) => `${sha}:./${file}
53
+ `).join(""));
54
+ await proc.stdin.end();
55
+ const bytes = new Uint8Array(await output);
56
+ if (await proc.exited !== 0)
57
+ throw new Error(`git cat-file failed for ${sha}`);
58
+ const decoder = new TextDecoder;
59
+ let offset = 0;
60
+ for (const file of files) {
61
+ const lineEnd = bytes.indexOf(10, offset);
62
+ if (lineEnd < 0)
63
+ throw new Error(`git cat-file ended before ${file} at ${sha}`);
64
+ const header = decoder.decode(bytes.subarray(offset, lineEnd));
65
+ offset = lineEnd + 1;
66
+ if (header.endsWith(" missing"))
67
+ continue;
68
+ const [, type, size] = header.split(" ");
69
+ const length = Number(size);
70
+ if (type === "blob")
71
+ texts.set(file, decoder.decode(bytes.subarray(offset, offset + length)));
72
+ offset += length + 1;
73
+ }
74
+ return texts;
75
+ }
76
+ async changedFilesSince(sha) {
77
+ const [tracked, untracked] = await Promise.all([
78
+ this.#git(["diff", "--name-status", "--no-renames", "--relative", "-z", sha, "--", ...systemPaths]),
79
+ this.#git(["ls-files", "-z", "--others", "--exclude-standard", "--", ...systemPaths])
80
+ ]);
81
+ if (tracked === null || untracked === null)
82
+ throw new Error(`git could not list the changes since ${sha}`);
83
+ const changes = new Map;
84
+ const fields = tracked.split("\x00");
85
+ for (let idx = 0;idx + 1 < fields.length; idx += 2)
86
+ changes.set(fields[idx + 1], changeOfStatus[fields[idx]] ?? "changed");
87
+ for (const file of untracked.split("\x00"))
88
+ if (file)
89
+ changes.set(file, "added");
90
+ return [...changes].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([file, change]) => ({ file, change }));
91
+ }
92
+ async workingFiles() {
93
+ const listed = await this.#git([
94
+ "ls-files",
95
+ "-z",
96
+ "--cached",
97
+ "--others",
98
+ "--exclude-standard",
99
+ "--",
100
+ ...systemPaths
101
+ ]);
102
+ if (listed === null)
103
+ throw new Error("git ls-files failed");
104
+ return [...new Set(listed.split("\x00").filter(Boolean))];
105
+ }
106
+ async#git(args) {
107
+ try {
108
+ const proc = Bun.spawn(["git", ...args], {
109
+ cwd: this.#root,
110
+ env: GitRevision.#env,
111
+ stdout: "pipe",
112
+ stderr: "ignore"
113
+ });
114
+ const [text, exitCode] = await Promise.all([new Response(proc.stdout).text(), proc.exited]);
115
+ return exitCode === 0 ? text : null;
116
+ } catch {
117
+ return null;
118
+ }
119
+ }
120
+ }
121
+
122
+ export { GitRevision };
@@ -5,17 +5,17 @@ import {
5
5
  AkanAppConfig,
6
6
  Executor,
7
7
  WorkspaceExecutor
8
- } from "./index-g500c5j9.js";
8
+ } from "./index-sr5da35e.js";
9
9
  import {
10
10
  resolveAppId,
11
11
  targetHtmlFilename
12
12
  } from "./index-m9jj544v.js";
13
13
  import {
14
14
  CsrArtifactBuilder
15
- } from "./index-sveq36gh.js";
15
+ } from "./index-mmym5xmb.js";
16
16
  import {
17
17
  ExitCodeError
18
- } from "./index-9zy8479y.js";
18
+ } from "./index-93ewzmp6.js";
19
19
 
20
20
  // pkgs/@akanjs/devkit/mobile/desktopBin.ts
21
21
  import { chmod, mkdir, rename, rm, writeFile } from "fs/promises";
@@ -4,27 +4,27 @@ import {
4
4
  CloudApi,
5
5
  CloudUpdates,
6
6
  PipelineSecrets
7
- } from "./index-gr9thy79.js";
7
+ } from "./index-drz9e84d.js";
8
8
  import {
9
9
  PkgExecutor
10
- } from "./index-g500c5j9.js";
10
+ } from "./index-sr5da35e.js";
11
11
  import {
12
12
  UpdatePackFolder,
13
13
  NativePublicEnv,
14
14
  NativeApp
15
- } from "./index-sp0qsr7a.js";
15
+ } from "./index-zpv14wpy.js";
16
16
  import {
17
17
  script
18
- } from "./index-9zy8479y.js";
18
+ } from "./index-93ewzmp6.js";
19
19
  import {
20
20
  ApplicationScript
21
- } from "./index-db2nqrad.js";
21
+ } from "./index-ryrm5z2c.js";
22
22
  import {
23
23
  PackageScript
24
- } from "./index-84h43kg6.js";
24
+ } from "./index-d4n1wmrz.js";
25
25
  import {
26
26
  CloudRunner
27
- } from "./index-1h2jc0x3.js";
27
+ } from "./index-6wpaq392.js";
28
28
 
29
29
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
30
30
  import { Logger } from "akanjs/common";
@@ -213,7 +213,10 @@ class CloudScript2 extends script("cloud", [CloudRunner, ApplicationScript, Pack
213
213
  async deployAkan(workspace, {
214
214
  test = true,
215
215
  registryUrl,
216
- platforms = []
216
+ platforms = [],
217
+ prerelease = null,
218
+ yes = false,
219
+ packTo = null
217
220
  } = {}) {
218
221
  const akanPkgs = await this.cloudRunner.getAkanPkgs(workspace);
219
222
  await this.packageScript.updateWorskpaceRootPackageJson(workspace);
@@ -239,7 +242,13 @@ class CloudScript2 extends script("cloud", [CloudRunner, ApplicationScript, Pack
239
242
  for (const pkg of pkgs)
240
243
  await this.packageScript.buildPackage(pkg);
241
244
  await this.packageScript.verifyAkanPublishPackages(workspace);
242
- await this.cloudRunner.deployAkan(workspace, akanPkgs, { registryUrl });
245
+ await this.cloudRunner.deployAkan(workspace, akanPkgs, {
246
+ registryUrl,
247
+ prerelease,
248
+ packTo,
249
+ confirmPublish: !yes,
250
+ npmLogin: !yes
251
+ });
243
252
  }
244
253
  async testPlatforms(workspace, { platforms, pkgs }) {
245
254
  if (!platforms.length)
package/index.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  getTargetMetas,
5
5
  getTargetCommandNames,
6
6
  runCommands
7
- } from "./index-9zy8479y.js";
7
+ } from "./index-93ewzmp6.js";
8
8
  import"./index-bns3wcpc.js";
9
- import"./index-g500c5j9.js";
9
+ import"./index-sr5da35e.js";
10
10
 
11
11
  // pkgs/@akanjs/cli/bunVersionGuard.ts
12
12
  class BunVersionGuard {
@@ -22,27 +22,27 @@ import path from "path";
22
22
 
23
23
  // pkgs/@akanjs/cli/commandModules.ts
24
24
  var commandModules = {
25
- workspace: async () => (await import("./workspace.command-r6hgmawy.js")).WorkspaceCommand,
26
- agent: async () => (await import("./agent.command-tffz6wdn.js")).AgentCommand,
27
- code: async () => (await import("./code.command-ma8dtzww.js")).CodeCommand,
28
- application: async () => (await import("./application.command-7bkxbrsp.js")).ApplicationCommand,
29
- library: async () => (await import("./library.command-63hgt9te.js")).LibraryCommand,
30
- localRegistry: async () => (await import("./localRegistry.command-343ksmn9.js")).LocalRegistryCommand,
31
- package: async () => (await import("./package.command-96eheyvd.js")).PackageCommand,
32
- module: async () => (await import("./module.command-2hce9m6k.js")).ModuleCommand,
33
- page: async () => (await import("./page.command-gs6d841d.js")).PageCommand,
34
- context: async () => (await import("./context.command-80a1qhps.js")).ContextCommand,
35
- cloud: async () => (await import("./cloud.command-a792bc10.js")).CloudCommand,
36
- subspace: async () => (await import("./subspace.command-5cehmcdd.js")).SubspaceCommand,
37
- guideline: async () => (await import("./guideline.command-195g0h9a.js")).GuidelineCommand,
38
- scalar: async () => (await import("./scalar.command-1nk4329t.js")).ScalarCommand,
39
- primitive: async () => (await import("./primitive.command-7tdj12wn.js")).PrimitiveCommand,
40
- quality: async () => (await import("./quality.command-29bgarh1.js")).QualityCommand,
41
- verify: async () => (await import("./verify.command-kbq0fcg8.js")).VerifyCommand,
42
- repair: async () => (await import("./repair.command-yng4rf5d.js")).RepairCommand,
43
- workflow: async () => (await import("./workflow.command-274qfa8z.js")).WorkflowCommand,
44
- pipeline: async () => (await import("./pipeline.command-wdfvdbfj.js")).PipelineCommand,
45
- tunnel: async () => (await import("./tunnel.command-yrd4atqy.js")).TunnelCommand
25
+ workspace: async () => (await import("./workspace.command-rw1p0xeq.js")).WorkspaceCommand,
26
+ agent: async () => (await import("./agent.command-2f657613.js")).AgentCommand,
27
+ code: async () => (await import("./code.command-7m67c7zc.js")).CodeCommand,
28
+ application: async () => (await import("./application.command-yb8v177e.js")).ApplicationCommand,
29
+ library: async () => (await import("./library.command-1gp5qe3r.js")).LibraryCommand,
30
+ localRegistry: async () => (await import("./localRegistry.command-v3g21rex.js")).LocalRegistryCommand,
31
+ package: async () => (await import("./package.command-s7qpnn1g.js")).PackageCommand,
32
+ module: async () => (await import("./module.command-4xz9he6h.js")).ModuleCommand,
33
+ page: async () => (await import("./page.command-fan34c49.js")).PageCommand,
34
+ context: async () => (await import("./context.command-569z0rqf.js")).ContextCommand,
35
+ cloud: async () => (await import("./cloud.command-et06ja22.js")).CloudCommand,
36
+ subspace: async () => (await import("./subspace.command-yxtt3v3e.js")).SubspaceCommand,
37
+ guideline: async () => (await import("./guideline.command-gnv3e8p8.js")).GuidelineCommand,
38
+ scalar: async () => (await import("./scalar.command-cnvfhk0n.js")).ScalarCommand,
39
+ primitive: async () => (await import("./primitive.command-3fqh8emf.js")).PrimitiveCommand,
40
+ quality: async () => (await import("./quality.command-ecj6exsh.js")).QualityCommand,
41
+ verify: async () => (await import("./verify.command-w9ttxkdz.js")).VerifyCommand,
42
+ repair: async () => (await import("./repair.command-fe9jw719.js")).RepairCommand,
43
+ workflow: async () => (await import("./workflow.command-ss8devj0.js")).WorkflowCommand,
44
+ pipeline: async () => (await import("./pipeline.command-ph4fnn9w.js")).PipelineCommand,
45
+ tunnel: async () => (await import("./tunnel.command-ggj38mqf.js")).TunnelCommand
46
46
  };
47
47
  var commandModuleIds = Object.keys(commandModules);
48
48
 
@@ -87,6 +87,7 @@ if (bunRefusal) {
87
87
  console.error(bunRefusal);
88
88
  process.exit(1);
89
89
  }
90
+ delete process.env.AKAN_CLI_FORCE_BUILD;
90
91
  var ids = CommandManifest.resolve(await CommandManifest.read(), process.argv) ?? commandModuleIds;
91
92
  var commands = await Promise.all(ids.map(async (id) => await commandModules[id]()));
92
93
  await runCommands(...commands);
@@ -3,12 +3,12 @@ import {
3
3
  Lib,
4
4
  Workspace,
5
5
  command
6
- } from "./index-9zy8479y.js";
6
+ } from "./index-93ewzmp6.js";
7
7
  import"./index-bns3wcpc.js";
8
- import"./index-g500c5j9.js";
8
+ import"./index-sr5da35e.js";
9
9
  import {
10
10
  LibraryScript
11
- } from "./index-y4kcmbt2.js";
11
+ } from "./index-mqntfzv5.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/library/library.command.ts
14
14
  class LibraryCommand extends command("library", [LibraryScript], ({ public: target }) => ({
@@ -4,37 +4,41 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-9zy8479y.js";
7
+ } from "./index-93ewzmp6.js";
8
8
  import"./index-bns3wcpc.js";
9
9
  import {
10
+ parseEnvFile,
10
11
  PkgExecutor
11
- } from "./index-g500c5j9.js";
12
+ } from "./index-sr5da35e.js";
12
13
  import {
13
14
  npmRegistryFromEnv,
14
15
  warnIgnoredNpmRegistry,
15
16
  getNpmRegistryUrl
16
- } from "./index-4am4dvmf.js";
17
- import"./index-p6x5b7hr.js";
18
- import"./index-sp0qsr7a.js";
19
- import"./index-0j1t1h2b.js";
17
+ } from "./index-ny2k80mv.js";
18
+ import"./index-p6hjwt2d.js";
19
+ import"./index-zpv14wpy.js";
20
+ import"./index-ed6ea0qp.js";
20
21
  import"./index-m9jj544v.js";
21
- import"./index-zbrwnmf1.js";
22
- import"./index-sveq36gh.js";
23
- import"./index-y4kcmbt2.js";
24
- import"./index-ppvqy5bc.js";
22
+ import"./index-1q1cjn8s.js";
23
+ import"./index-mmym5xmb.js";
24
+ import"./index-mqntfzv5.js";
25
+ import"./index-ktb3wcqz.js";
25
26
  import {
26
27
  ApplicationScript
27
- } from "./index-db2nqrad.js";
28
+ } from "./index-ryrm5z2c.js";
28
29
  import"./index-tenw3mah.js";
29
- import"./index-gr9thy79.js";
30
+ import"./index-drz9e84d.js";
30
31
  import {
31
32
  CloudRunner
32
- } from "./index-1h2jc0x3.js";
33
+ } from "./index-6wpaq392.js";
33
34
  import"./index-qd7xn2bk.js";
35
+ import"./index-7y5yghjg.js";
36
+ import"./index-abgh0jve.js";
37
+ import"./index-hqrkqxx2.js";
34
38
  import {
35
39
  PackageScript
36
- } from "./index-84h43kg6.js";
37
- import"./index-defp4gmb.js";
40
+ } from "./index-d4n1wmrz.js";
41
+ import"./index-sy481q2x.js";
38
42
  import"./index-9bv479q5.js";
39
43
 
40
44
  // pkgs/@akanjs/cli/localRegistry/localRegistry.runner.ts
@@ -104,7 +108,12 @@ class LocalRegistryRunner extends runner("localRegistry") {
104
108
  const registry = this.getRegistryUrl(registryUrl);
105
109
  const smokeRoot = path.join(workspace.workspaceRoot, ".akan/e2e");
106
110
  await rm(path.join(smokeRoot, smokeRepoName), { recursive: true, force: true });
107
- const env = { ...process.env, AKAN_NPM_REGISTRY: registry, NPM_CONFIG_REGISTRY: registry };
111
+ const repoDotenv = parseEnvFile(path.join(workspace.workspaceRoot, ".env"));
112
+ const env = {
113
+ ...Object.fromEntries(Object.entries(process.env).filter(([key]) => !(key in repoDotenv))),
114
+ AKAN_NPM_REGISTRY: registry,
115
+ NPM_CONFIG_REGISTRY: registry
116
+ };
108
117
  await workspace.spawn(process.execPath, [
109
118
  "dist/pkgs/create-akan-workspace/index.js",
110
119
  smokeRepoName,
@@ -3,17 +3,17 @@ import {
3
3
  Sys,
4
4
  Module,
5
5
  command
6
- } from "./index-9zy8479y.js";
6
+ } from "./index-93ewzmp6.js";
7
7
  import"./index-bns3wcpc.js";
8
- import"./index-g500c5j9.js";
8
+ import"./index-sr5da35e.js";
9
9
  import {
10
10
  renderPrimitiveReport
11
- } from "./index-m02tdq8a.js";
12
- import"./index-j2dgmzbj.js";
13
- import"./index-khk05tsf.js";
11
+ } from "./index-8pb9yvp8.js";
12
+ import"./index-7y5yghjg.js";
13
+ import"./index-aj3ehkcx.js";
14
14
  import {
15
15
  ModuleScript
16
- } from "./index-gbp1q1b5.js";
16
+ } from "./index-8ts9774g.js";
17
17
 
18
18
  // pkgs/@akanjs/cli/module/module.command.ts
19
19
  import { Logger, lowerlize } from "akanjs/common";