@akanjs/cli 3.0.0-beta.16 → 3.0.0-beta.18

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 (134) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-zgccwajm.js → CodeAgent-0035exh3.js} +2 -2
  3. package/{CodeTui-993tx7gf.js → CodeTui-eweg1hep.js} +384 -28
  4. package/{agent.command-n664dtcv.js → agent.command-65zqfkg0.js} +6 -6
  5. package/akanCode.js +11 -9
  6. package/{application.command-t5542jte.js → application.command-2wcj5da3.js} +18 -11
  7. package/{applicationBuildRunner-x4gbfn7y.js → applicationBuildRunner-m0hhgwsx.js} +6 -5
  8. package/{applicationReleasePackager-z61ep017.js → applicationReleasePackager-vykfzgx3.js} +1 -1
  9. package/buildBatch.proc.js +2 -2
  10. package/{capacitorApp-shv3ajh5.js → capacitorApp-2daqhb5h.js} +2 -2
  11. package/{cloud.command-4x35k1z6.js → cloud.command-960bgbf4.js} +8 -8
  12. package/{cloud.script-3k8nbbpn.js → cloud.script-qhcnqt1n.js} +8 -8
  13. package/{code.command-mrfb7a1g.js → code.command-4feh3ef7.js} +7 -7
  14. package/{context.command-pqsm5jrk.js → context.command-kzehkx48.js} +14 -14
  15. package/context.runner-z0rrcz7b.js +22 -0
  16. package/{devTui-gy6mendg.js → devTui-ffjsarqa.js} +3 -3
  17. package/{devTuiView-y1548wy6.js → devTuiView-1q1mdgrv.js} +1 -1
  18. package/{guideline.command-rpc2emw8.js → guideline.command-3w2g20x4.js} +8 -13
  19. package/guidelines/conventions/conventions.instruction.md +37 -22
  20. package/guidelines/queryRule/queryRule.instruction.md +1 -1
  21. package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
  22. package/guidelines/transportRule/transportRule.instruction.md +10 -8
  23. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +4 -3
  24. package/incrementalBuilder.proc.js +1 -1
  25. package/{index-sxg87a8f.js → index-14zrtgfa.js} +164 -98
  26. package/{index-57p9p179.js → index-3hpxeys1.js} +6 -5
  27. package/{index-sn7dnzq4.js → index-4r42ext5.js} +1 -1
  28. package/{index-3mg4h788.js → index-6q589y9t.js} +2 -2
  29. package/index-9dp031by.js +12 -0
  30. package/{index-p4p9t45x.js → index-bwxpk2cj.js} +4 -18
  31. package/{index-g9zghs4h.js → index-cjw1sj1x.js} +12 -12
  32. package/{index-te0y1c0m.js → index-d9fjz06h.js} +12 -7
  33. package/{index-4n4821gp.js → index-dw943k93.js} +4 -4
  34. package/{index-4cvpzkq6.js → index-ef228gzf.js} +3 -3
  35. package/{index-3cymrzsb.js → index-erfc1x40.js} +17 -3
  36. package/{index-ns128c4q.js → index-h94faz96.js} +13 -20
  37. package/index-jd01kj5r.js +656 -0
  38. package/{index-5405kc0x.js → index-jwexzh42.js} +363 -247
  39. package/{index-wfwknnje.js → index-jwrpsrg3.js} +8 -6
  40. package/{index-kvzjda3v.js → index-m41ptvat.js} +5 -5
  41. package/{index-qh7brn20.js → index-mt2154s2.js} +6 -2
  42. package/{index-xjc7gg65.js → index-pn8mhpps.js} +23 -33
  43. package/{index-vpx68e4x.js → index-q9c3c0hy.js} +2 -2
  44. package/{index-v17gj504.js → index-rpgxs245.js} +2 -2
  45. package/{index-twq9p2sp.js → index-s5rhm04y.js} +0 -6
  46. package/{index-018dszb3.js → index-sbfk9daf.js} +10 -3
  47. package/{index-zg0v1zte.js → index-wcg582a8.js} +5 -5
  48. package/{index-6na0sd2b.js → index-ycy302an.js} +5 -2
  49. package/{index-qhtj9y6j.js → index-yw6g3bbv.js} +74 -21
  50. package/{index-2pm1j01n.js → index-zmj143x7.js} +4 -4
  51. package/{index-zn8qgeqx.js → index-zq0mr3hh.js} +1 -1
  52. package/index.js +21 -21
  53. package/{library.command-m8p2r1dh.js → library.command-fp0nhr62.js} +3 -3
  54. package/{localRegistry.command-tt00nwwg.js → localRegistry.command-8y0ecxb9.js} +7 -7
  55. package/{module.command-mfzvqt0n.js → module.command-kqkn48t2.js} +5 -5
  56. package/{package.command-8sy6jjwy.js → package.command-qverjh22.js} +4 -4
  57. package/package.json +8 -6
  58. package/{page.command-taenb02b.js → page.command-94bwhd0g.js} +3 -3
  59. package/{primitive.command-7kpncmkk.js → primitive.command-2ydvtah2.js} +6 -6
  60. package/{prompter-9mn3kp36.js → prompter-1f8d9pcc.js} +1 -1
  61. package/{quality.command-1ar94hrw.js → quality.command-fa0gth4p.js} +3 -4
  62. package/{repair.command-n08t6j8p.js → repair.command-4qng2hpm.js} +5 -5
  63. package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
  64. package/{scalar.command-mq8qfp4t.js → scalar.command-pb2y95sh.js} +4 -4
  65. package/skills/akan-code/SKILL.md +122 -0
  66. package/skills/akan-module/SKILL.md +2 -2
  67. package/skills/akan-store/SKILL.md +6 -2
  68. package/{subspace.command-x9897gj4.js → subspace.command-vkxmwp74.js} +4 -4
  69. package/templates/__scalar/__model__/__model__.abstract.md.template +8 -0
  70. package/templates/appSample/lib/__scalar/workHistory/workHistory.abstract.ts +8 -39
  71. package/templates/appSample/lib/_noti/noti.abstract.ts +6 -29
  72. package/templates/appSample/lib/task/task.abstract.ts +12 -32
  73. package/templates/appSample/lib/task/task.signal.spec.ts +15 -18
  74. package/templates/appSample/lib/task/task.signal.test.ts +14 -0
  75. package/templates/appSample/lib/task/task.signal.ts +1 -1
  76. package/templates/appSample/srvkit/AuthGuard.ts +4 -1
  77. package/templates/appSample/srvkit/SessionInternalArg.ts +3 -1
  78. package/templates/crudPages/[__model__Id]/edit/page.tsx +2 -1
  79. package/templates/crudPages/[__model__Id]/page.tsx +2 -1
  80. package/templates/crudPages/new/page.tsx +2 -1
  81. package/templates/crudPages/page.tsx +2 -1
  82. package/templates/crudSinglePage/page.tsx +2 -1
  83. package/templates/module/__model__.signal.ts +12 -4
  84. package/templates/pkgRoot/tsconfig.json.template +2 -7
  85. package/templates/service/__model__.abstract.md.template +8 -0
  86. package/{tunnel.command-ht2es78c.js → tunnel.command-02cvp9nf.js} +2 -2
  87. package/{workflow.command-tvz4nm9n.js → workflow.command-132txnrh.js} +9 -9
  88. package/{workspace.command-ayqa1rgt.js → workspace.command-d5wkswek.js} +21 -21
  89. package/context.runner-bys6ykcp.js +0 -22
  90. package/guidelines/agentRule/agentRule.generate.json +0 -31
  91. package/guidelines/componentRule/componentRule.generate.json +0 -31
  92. package/guidelines/conventions/conventions.generate.json +0 -25
  93. package/guidelines/cssRule/cssRule.generate.json +0 -31
  94. package/guidelines/docPageRule/docPageRule.generate.json +0 -31
  95. package/guidelines/docPageRule/docPageRule.instruction.md +0 -25
  96. package/guidelines/docSyncRule/docSyncRule.generate.json +0 -31
  97. package/guidelines/docSyncRule/docSyncRule.instruction.md +0 -25
  98. package/guidelines/enumConstant/enumConstant.generate.json +0 -31
  99. package/guidelines/enumConstant/enumConstant.instruction.md +0 -28
  100. package/guidelines/fieldRule/fieldRule.generate.json +0 -31
  101. package/guidelines/framework/framework.generate.json +0 -32
  102. package/guidelines/mcpRule/mcpRule.generate.json +0 -35
  103. package/guidelines/modelConstant/modelConstant.generate.json +0 -32
  104. package/guidelines/modelDictionary/modelDictionary.generate.json +0 -32
  105. package/guidelines/modelDocument/modelDocument.generate.json +0 -31
  106. package/guidelines/modelService/modelService.generate.json +0 -31
  107. package/guidelines/modelSignal/modelSignal.generate.json +0 -31
  108. package/guidelines/modelStore/modelStore.generate.json +0 -31
  109. package/guidelines/modelTemplate/modelTemplate.generate.json +0 -31
  110. package/guidelines/modelUnit/modelUnit.generate.json +0 -31
  111. package/guidelines/modelUtil/modelUtil.generate.json +0 -31
  112. package/guidelines/modelView/modelView.generate.json +0 -31
  113. package/guidelines/modelZone/modelZone.generate.json +0 -31
  114. package/guidelines/moduleCodegen/moduleCodegen.generate.json +0 -31
  115. package/guidelines/moduleCodegen/moduleCodegen.instruction.md +0 -28
  116. package/guidelines/moduleOverview/moduleOverview.generate.json +0 -31
  117. package/guidelines/queryRule/queryRule.generate.json +0 -31
  118. package/guidelines/recipeRule/recipeRule.generate.json +0 -31
  119. package/guidelines/runtimeRule/runtimeRule.generate.json +0 -25
  120. package/guidelines/scalarConstant/scalarConstant.generate.json +0 -32
  121. package/guidelines/scalarDictionary/scalarDictionary.generate.json +0 -32
  122. package/guidelines/scalarModule/scalarModule.generate.json +0 -31
  123. package/guidelines/sharedUiUsage/sharedUiUsage.generate.json +0 -31
  124. package/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -25
  125. package/guidelines/ssrRule/ssrRule.generate.json +0 -31
  126. package/guidelines/transportRule/transportRule.generate.json +0 -31
  127. package/guidelines/utilUiUsage/utilUiUsage.generate.json +0 -31
  128. package/guidelines/utilUiUsage/utilUiUsage.instruction.md +0 -25
  129. package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +0 -24
  130. package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +0 -34
  131. package/index-jgrnpt6y.js +0 -121
  132. package/templates/__scalar/__model__/__model__.abstract.md +0 -28
  133. package/templates/module/__model__.abstract.md +0 -28
  134. package/templates/service/__model__.abstract.md +0 -28
@@ -9,19 +9,19 @@ var correctInputs = (model) => {
9
9
  return model;
10
10
  return { ...model, input: [...model.input, "image"] };
11
11
  };
12
- var akanCodeModel2 = async (registry, ref) => {
12
+ var akanCodeModel2 = async (runtime, ref) => {
13
13
  if (ref) {
14
- const requested = registry.find(ref.provider, ref.id);
14
+ const requested = runtime.getModel(ref.provider, ref.id);
15
15
  if (!requested)
16
16
  throw new Error(`Unknown model: ${ref.provider}/${ref.id}`);
17
- if (!registry.hasConfiguredAuth(requested))
17
+ if (!runtime.hasConfiguredAuth(ref.provider))
18
18
  throw new Error(`No API key configured for ${ref.provider}. Set ${ref.provider.toUpperCase()}_API_KEY.`);
19
19
  return correctInputs(requested);
20
20
  }
21
- const fallback = registry.find(akanCodeDefaultModel2.provider, akanCodeDefaultModel2.id);
22
- if (fallback && registry.hasConfiguredAuth(fallback))
21
+ const fallback = runtime.getModel(akanCodeDefaultModel2.provider, akanCodeDefaultModel2.id);
22
+ if (fallback && runtime.hasConfiguredAuth(fallback.provider))
23
23
  return correctInputs(fallback);
24
- return correctInputs(registry.getAvailable()[0]);
24
+ return correctInputs((await runtime.getAvailable())[0]);
25
25
  };
26
26
  var akanCodeModelSupportsImages2 = (model) => !!model?.input.includes("image");
27
27
  var akanCodeModelWarnings2 = (model, compactionFloor) => {
@@ -78,6 +78,8 @@ class CodeAgentStreamPrinter2 {
78
78
  case "queue":
79
79
  case "context":
80
80
  return;
81
+ case "subagent":
82
+ return;
81
83
  case "question":
82
84
  return this.#line(chalk.yellow(`? ${event.question.prompt}`));
83
85
  case "approval":
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-6na0sd2b.js";
5
+ } from "./index-ycy302an.js";
6
6
  import {
7
7
  AGENT_BLOCK_START,
8
8
  AGENT_BLOCK_END,
@@ -13,17 +13,17 @@ import {
13
13
  CLAUDE_COMMENT_RULE,
14
14
  AppExecutor,
15
15
  LibExecutor
16
- } from "./index-p4p9t45x.js";
16
+ } from "./index-bwxpk2cj.js";
17
17
  import {
18
18
  collectRecipeSources2,
19
19
  scanRecipes2
20
20
  } from "./index-by5gpp8x.js";
21
21
  import {
22
22
  AkanContextAnalyzer
23
- } from "./index-v17gj504.js";
23
+ } from "./index-rpgxs245.js";
24
24
  import {
25
25
  Prompter2
26
- } from "./index-twq9p2sp.js";
26
+ } from "./index-s5rhm04y.js";
27
27
 
28
28
  // pkgs/@akanjs/cli/agent/agent.script.ts
29
29
  import { Logger as Logger2 } from "akanjs/common";
@@ -148,7 +148,7 @@ If generated output is stale or broken, update the owning source file and run \`
148
148
  ${recipeIndex}## MCP Workflow Policy
149
149
 
150
150
  - **Prefer an Akan workflow to a direct source edit.** A direct edit is denied when an allowlisted workflow or repair tool can make the change.
151
- - Inspect with \`akan mcp --mode plan\` (\`list_workflows\`, \`explain_workflow\`, \`plan_workflow\`); apply with \`akan mcp --mode apply\`, which allowlists \`apply_workflow\`, \`run_validation\`, and the repair tools.
151
+ - Inspect with \`akan mcp --mode plan\` (\`list_workflows\`, \`explain_workflow\`, \`plan_workflow\`); apply with \`akan mcp --mode apply\`, which allowlists \`apply_workflow\`, \`run_validation\`, and three of the five repair tools \u2014 \`repair_generated\`, \`repair_imports\` and \`repair_module_shape\`. \`akan repair format\` and \`akan repair dictionary\` are CLI-only.
152
152
  - If \`plan_workflow\` returns \`planPath\` or \`next.tool=apply_workflow\`, call \`apply_workflow({ planPath })\` before editing source. Then run \`run_validation\` with \`validationTarget\` when present, otherwise \`applyReportPath\`.
153
153
  - Split a compound request into workflows and apply each \`planPath\` in order, such as \`create-module\` followed by \`add-field\`.
154
154
  - When no workflow exists, or apply reports unsupported/no-op/failed diagnostics needing manual action, keep edits scoped to owning source files and never patch generated files directly.
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-6na0sd2b.js";
5
+ } from "./index-ycy302an.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/page/page.runner.ts
8
8
  class PageRunner extends runner("page") {
@@ -10,7 +10,11 @@ class PageRunner extends runner("page") {
10
10
  await app.applyTemplate({
11
11
  basePath: basePath ?? `page/(${app.name})/(public)/${module.name}`,
12
12
  template: single ? "crudSinglePage" : "crudPages",
13
- dict: { model: module.name, appName: module.sys.name }
13
+ dict: {
14
+ model: module.name,
15
+ appName: module.sys.name,
16
+ clientPath: `@${module.sys.type}s/${module.sys.name}/client`
17
+ }
14
18
  });
15
19
  }
16
20
  }
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-6na0sd2b.js";
5
+ } from "./index-ycy302an.js";
6
6
  import {
7
7
  ModuleExecutor
8
- } from "./index-p4p9t45x.js";
8
+ } from "./index-bwxpk2cj.js";
9
9
  import {
10
10
  sourceFile,
11
11
  moduleSourcePaths,
@@ -13,10 +13,10 @@ import {
13
13
  createPassedPrimitiveReport,
14
14
  bilingualLabelForField,
15
15
  bilingualDescriptionForField
16
- } from "./index-qhtj9y6j.js";
16
+ } from "./index-yw6g3bbv.js";
17
17
  import {
18
18
  PageScript
19
- } from "./index-qh7brn20.js";
19
+ } from "./index-mt2154s2.js";
20
20
  import {
21
21
  pluralizeName
22
22
  } from "./index-nz8prx9g.js";
@@ -31,37 +31,17 @@ var purposeByModule = {
31
31
  project: "Project represents a project workspace or business initiative managed by the app.",
32
32
  task: "Task represents work items that move through the app workflow."
33
33
  };
34
- var moduleAbstractContent = (moduleName) => {
34
+ var moduleAbstractContent = (moduleName, sharedGuards) => {
35
35
  const title = capitalize(moduleName);
36
- const label = bilingualLabelForField(moduleName);
37
- const purpose = purposeByModule[moduleName] ?? `${title} represents ${label.en.toLowerCase()} records managed by the app.`;
38
- return `# ${title} Module Abstract
39
-
40
- ## Purpose
41
-
36
+ const noun = bilingualLabelForField(moduleName).en.toLowerCase();
37
+ const purpose = purposeByModule[moduleName] ?? `${title} represents ${noun} records managed by the app.`;
38
+ const writeRule = sharedGuards ? `Anyone may read a ${noun}; only an admin creates, updates or removes one.` : `Anyone may read a ${noun}; nobody creates, updates or removes one until the slice names a guard.`;
39
+ return `# ${moduleName} Abstract
42
40
  ${purpose}
43
41
 
44
- ## Domain Rules
45
-
46
- - Keep ${label.en.toLowerCase()} data consistent with user-facing dictionary labels.
47
-
48
- ## Data Meaning
49
-
50
- ${label.en} (${label.ko}) is the primary business concept for this module.
51
-
52
- ## Workflows
53
-
54
- No lifecycle workflow yet.
55
-
56
- ## Agent Notes
57
-
58
- - Read this abstract before changing the module.
59
- - Update this file when business invariants, workflows, or public behavior change.
60
- - Do not update this file for formatting-only, import-only, or style-only changes.
61
-
62
- ## Related Modules
63
-
64
- - None yet.
42
+ ## Rules
43
+ - ${writeRule}
44
+ - Removal is soft: a removed ${noun} keeps its row with \`removedAt\` set.
65
45
  `;
66
46
  };
67
47
  var localModuleFilename = (moduleName, pathKey) => moduleSourcePaths(moduleName)[pathKey].replace(`lib/${moduleName}/`, "");
@@ -92,6 +72,14 @@ class ModuleRunner extends runner("module") {
92
72
  async removeModule(module) {
93
73
  await module.sys.removeDir(`lib/${module.name}`);
94
74
  }
75
+ async#hasSharedGuards(module) {
76
+ const { sys } = module;
77
+ if (sys.type === "lib" && sys.name === "shared")
78
+ return true;
79
+ if (!await sys.exists("lib/srv.ts"))
80
+ return false;
81
+ return (await sys.readFile("lib/srv.ts")).includes('"@libs/shared/lib/srv"');
82
+ }
95
83
  async createComponentTemplate(module, type) {
96
84
  await module.sys.applyTemplate({
97
85
  basePath: `./lib/${module.name}`,
@@ -122,9 +110,11 @@ class ModuleRunner extends runner("module") {
122
110
  zone: localModuleFilename(module.name, "zone"),
123
111
  util: localModuleFilename(module.name, "util")
124
112
  };
113
+ const sharedGuards = await this.#hasSharedGuards(module);
125
114
  await module.applyTemplate({
126
115
  basePath: `.`,
127
116
  template: "module",
117
+ options: { sharedGuards },
128
118
  dict: {
129
119
  model: module.name,
130
120
  models: names,
@@ -136,7 +126,7 @@ class ModuleRunner extends runner("module") {
136
126
  modelDescKo: modelDescription.ko
137
127
  }
138
128
  });
139
- await module.writeFile(filenames.abstract, moduleAbstractContent(module.name));
129
+ await module.writeFile(filenames.abstract, moduleAbstractContent(module.name, sharedGuards));
140
130
  const [
141
131
  abstractContent,
142
132
  constantContent,
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-6na0sd2b.js";
5
+ } from "./index-ycy302an.js";
6
6
  import {
7
7
  generatedFilesForSync,
8
8
  createPassedPrimitiveReport,
9
9
  scalarChangedFiles
10
- } from "./index-qhtj9y6j.js";
10
+ } from "./index-yw6g3bbv.js";
11
11
  import {
12
12
  pluralizeName
13
13
  } from "./index-nz8prx9g.js";
@@ -7,7 +7,7 @@ import {
7
7
  isScannedRootEntry,
8
8
  AppExecutor,
9
9
  LibExecutor
10
- } from "./index-p4p9t45x.js";
10
+ } from "./index-bwxpk2cj.js";
11
11
  import {
12
12
  FileSys
13
13
  } from "./index-q0y2jq9j.js";
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  workflowRunArtifactPath,
21
21
  workflowSyncDir
22
- } from "./index-qhtj9y6j.js";
22
+ } from "./index-yw6g3bbv.js";
23
23
 
24
24
  // pkgs/@akanjs/devkit/akanContext.ts
25
25
  import { readdir } from "fs/promises";
@@ -29,12 +29,6 @@ class Prompter2 {
29
29
  const guidelineRoot = await Prompter2.#getGuidelineRoot();
30
30
  return (await fsPromise.readdir(guidelineRoot)).filter((name) => !name.startsWith("_")).sort();
31
31
  }
32
- static async getGuideJson(guideName) {
33
- const guidelineRoot = await Prompter2.#getGuidelineRoot();
34
- const filePath = `${guidelineRoot}/${guideName}/${guideName}.generate.json`;
35
- const guideJson = await fsPromise.readFile(filePath, "utf-8");
36
- return JSON.parse(guideJson);
37
- }
38
32
  static async getInstruction(guideName) {
39
33
  const guideNames = await Prompter2.listGuidelines();
40
34
  if (!guideNames.includes(guideName))
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-6na0sd2b.js";
5
+ } from "./index-ycy302an.js";
6
6
  import {
7
7
  FileSys
8
8
  } from "./index-q0y2jq9j.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-p4p9t45x.js";
11
+ } from "./index-bwxpk2cj.js";
12
12
  import {
13
13
  TypeScriptDependencyScanner2
14
14
  } from "./index-kcxmv48c.js";
@@ -136,7 +136,12 @@ class PackageRunner extends runner("package") {
136
136
  throw new Error(`[package] failed to locate akanjs package.json from ${path2.dirname(Bun.main)}`);
137
137
  }
138
138
  async createPackage(workspace, pkgName) {
139
- await workspace.applyTemplate({ basePath: `pkgs/${pkgName}`, template: "pkgRoot", dict: { pkgName } });
139
+ const workspaceRootPath = ["pkgs", ...pkgName.split("/")].map(() => "..").join("/");
140
+ await workspace.applyTemplate({
141
+ basePath: `pkgs/${pkgName}`,
142
+ template: "pkgRoot",
143
+ dict: { pkgName, workspaceRootPath }
144
+ });
140
145
  await workspace.setPkgTsPaths(pkgName);
141
146
  }
142
147
  async removePackage(pkg) {
@@ -155,8 +160,10 @@ class PackageRunner extends runner("package") {
155
160
  const packageRuntimeDependencies = {
156
161
  "@akanjs/devkit": [
157
162
  "tailwind-scrollbar",
163
+ "@earendil-works/chord",
158
164
  "@earendil-works/pi-agent-core",
159
165
  "@earendil-works/pi-ai",
166
+ "@earendil-works/pi-telemetry",
160
167
  "@earendil-works/pi-tui"
161
168
  ]
162
169
  };
@@ -5,19 +5,19 @@ import {
5
5
  } from "./index-myj01w9r.js";
6
6
  import {
7
7
  script
8
- } from "./index-6na0sd2b.js";
8
+ } from "./index-ycy302an.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-p4p9t45x.js";
11
+ } from "./index-bwxpk2cj.js";
12
12
  import {
13
13
  ApplicationScript
14
- } from "./index-ns128c4q.js";
14
+ } from "./index-h94faz96.js";
15
15
  import {
16
16
  PackageScript
17
- } from "./index-018dszb3.js";
17
+ } from "./index-sbfk9daf.js";
18
18
  import {
19
19
  CloudRunner
20
- } from "./index-57p9p179.js";
20
+ } from "./index-3hpxeys1.js";
21
21
 
22
22
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
23
23
  import { Logger } from "akanjs/common";
@@ -9,7 +9,7 @@ import {
9
9
  LibExecutor,
10
10
  PkgExecutor,
11
11
  ModuleExecutor
12
- } from "./index-p4p9t45x.js";
12
+ } from "./index-bwxpk2cj.js";
13
13
  import {
14
14
  getDirname2
15
15
  } from "./index-6wwzs1bc.js";
@@ -327,7 +327,8 @@ var formatCommandHelp = (command, key) => {
327
327
  const opt = arg.argsOption;
328
328
  const flag = opt.flag ? `-${opt.flag}, ` : "";
329
329
  const kebabName = camelToKebabCase2(arg.name);
330
- const optName = `${flag}--${kebabName}`;
330
+ const negation = opt.type === "boolean" && opt.default === true ? `, --no-${kebabName}` : "";
331
+ const optName = `${flag}--${kebabName}${negation}`;
331
332
  const optDesc = opt.desc ?? "";
332
333
  const defaultVal = opt.default !== undefined ? chalk.gray(` [default: ${String(opt.default)}]`) : "";
333
334
  const choices = opt.enum ? chalk.gray(typeof opt.enum === "function" ? " ([dynamic choices])" : ` (${opt.enum.map(formatChoice).join(", ")})`) : "";
@@ -384,6 +385,8 @@ var handleOption = (programCommand, argMeta) => {
384
385
  const kebabName = camelToKebabCase3(argMeta.name);
385
386
  const choices = enumChoices && typeof enumChoices !== "function" ? normalizeEnumChoices(enumChoices) : null;
386
387
  programCommand.option(`-${flag}, --${kebabName}${type === "boolean" ? " [boolean]" : ` <${kebabName}>`}`, `${desc}${ask ? ` (${ask})` : ""}${example ? ` (example: ${example})` : ""}${choices ? ` (choices: ${choices.map((choice) => choice.name).join(", ")})` : ""}`);
388
+ if (type === "boolean" && argMeta.argsOption.default === true)
389
+ programCommand.option(`--no-${kebabName}`, `turn off --${kebabName}`);
387
390
  return programCommand;
388
391
  };
389
392
  var handleArgument = (programCommand, argMeta) => {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AppExecutor,
4
4
  LibExecutor
5
- } from "./index-p4p9t45x.js";
5
+ } from "./index-bwxpk2cj.js";
6
6
 
7
7
  // pkgs/@akanjs/devkit/workflow/utils.ts
8
8
  var jsonText = (value, { trailingNewline = true } = {}) => `${JSON.stringify(value, null, 2)}${trailingNewline ? `
@@ -416,6 +416,7 @@ var renderPrimitiveWriteReport = (report) => [
416
416
  `);
417
417
  var renderPrimitiveReport = (report, format = "markdown") => format === "json" ? jsonText(report) : renderPrimitiveWriteReport(report);
418
418
  // pkgs/@akanjs/devkit/workflow/executor.ts
419
+ import { capitalize } from "akanjs/common";
419
420
  import ts3 from "typescript";
420
421
 
421
422
  // pkgs/@akanjs/devkit/workflow/moduleIndex.ts
@@ -531,20 +532,24 @@ var normalizeFieldType = (typeName) => {
531
532
  };
532
533
  return normalizedTypes[typeName.toLowerCase()] ?? typeName;
533
534
  };
534
- var ensureBaseTypeImport = (content, typeName) => {
535
- if (typeName !== "Int" && typeName !== "Float")
536
- return content;
537
- const source = sourceFileFor("constant.ts", content);
538
- const baseImport = findNamedImport(source, "akanjs/base");
539
- if (baseImport) {
540
- if (baseImport.names.includes(typeName))
535
+ var ensureNamedImport = (content, moduleSpecifier, name) => {
536
+ const source = sourceFileFor("source.ts", content);
537
+ const namedImport = findNamedImport(source, moduleSpecifier);
538
+ if (namedImport) {
539
+ if (namedImport.names.includes(name))
541
540
  return content;
542
- const nextNames = [...baseImport.names, typeName].sort();
543
- return spliceText(content, baseImport.namedBindingsStart, baseImport.namedBindingsEnd, `{ ${nextNames.join(", ")} }`);
541
+ const nextNames = [...namedImport.names, name].sort();
542
+ return spliceText(content, namedImport.namedBindingsStart, namedImport.namedBindingsEnd, `{ ${nextNames.join(", ")} }`);
544
543
  }
545
- return `import { ${typeName} } from "akanjs/base";
544
+ return `import { ${name} } from "${moduleSpecifier}";
546
545
  ${content}`;
547
546
  };
547
+ var ensureBaseImport = (content, name) => ensureNamedImport(content, "akanjs/base", name);
548
+ var ensureBaseTypeImport = (content, typeName) => {
549
+ if (typeName !== "Int" && typeName !== "Float")
550
+ return content;
551
+ return ensureBaseImport(content, typeName);
552
+ };
548
553
  var numericDefault = (typeName, rawDefault) => {
549
554
  if (typeof rawDefault === "number") {
550
555
  if (!Number.isFinite(rawDefault))
@@ -572,16 +577,16 @@ var booleanDefault = (rawDefault) => {
572
577
  };
573
578
  var dateDefault = (rawDefault) => {
574
579
  if (typeof rawDefault === "number" && Number.isFinite(rawDefault))
575
- return `new Date(${rawDefault})`;
580
+ return `() => dayjs(${rawDefault})`;
576
581
  if (typeof rawDefault !== "string")
577
582
  return null;
578
583
  const trimmed = rawDefault.trim();
579
584
  if (!trimmed)
580
585
  return null;
581
586
  if (trimmed === "now")
582
- return "new Date()";
587
+ return "() => dayjs()";
583
588
  if (!Number.isNaN(Date.parse(trimmed)))
584
- return `new Date(${JSON.stringify(trimmed)})`;
589
+ return `() => dayjs(${JSON.stringify(trimmed)})`;
585
590
  return null;
586
591
  };
587
592
  var coerceFieldDefault = (typeName, defaultValue, options = {}) => {
@@ -1941,6 +1946,52 @@ var addFieldUiSurfaceInspection = (plan) => {
1941
1946
  ]
1942
1947
  };
1943
1948
  };
1949
+ var addMutationActionSurfaceInspection = (plan) => {
1950
+ const module = workflowStringInput(plan.inputs.module) ?? "<module>";
1951
+ const mutation = workflowStringInput(plan.inputs.mutation) ?? "<mutation>";
1952
+ const moduleClassName = moduleComponentName(module);
1953
+ return {
1954
+ recommendations: [
1955
+ {
1956
+ code: "add-mutation-action-surface-review",
1957
+ kind: "manual-action",
1958
+ target: `*/${moduleSourcePaths(module).store}`,
1959
+ action: `Name the endpoint's guards and add its dictionary .endpoint() entry with a .desc(). After sync, fetch.${mutation} exists; write a store action only for a toast, an optimistic update, or a multi-field write, and put the control that calls it in ${moduleClassName}.Util.tsx.`,
1960
+ confidence: "medium",
1961
+ message: `Workflow apply does not write store or UI code for ${module}.${mutation}; review whether a screen should call it.`
1962
+ }
1963
+ ],
1964
+ nextActions: [
1965
+ {
1966
+ command: `akan workflow explain ${plan.workflow}`,
1967
+ reason: "Review action surface guidance before manually editing store or UI files."
1968
+ }
1969
+ ]
1970
+ };
1971
+ };
1972
+ var addSliceViewSurfaceInspection = (plan) => {
1973
+ const module = workflowStringInput(plan.inputs.module) ?? "<module>";
1974
+ const slice = workflowStringInput(plan.inputs.slice) ?? "<slice>";
1975
+ const moduleClassName = moduleComponentName(module);
1976
+ return {
1977
+ recommendations: [
1978
+ {
1979
+ code: "add-slice-view-surface-review",
1980
+ kind: "manual-action",
1981
+ target: `*/${moduleSourcePaths(module).zone}`,
1982
+ action: `Fill in the service query stub and add the dictionary .slice() entry. After sync, load fetch.init${moduleClassName}${capitalize(slice)}() in the page and pass the result to a ${moduleClassName}.Zone as an init prop.`,
1983
+ confidence: "medium",
1984
+ message: `Workflow apply does not write page or Zone code for ${module}.${slice}; review where the list should render.`
1985
+ }
1986
+ ],
1987
+ nextActions: [
1988
+ {
1989
+ command: `akan workflow explain ${plan.workflow}`,
1990
+ reason: "Review view surface guidance before manually editing Zone or page files."
1991
+ }
1992
+ ]
1993
+ };
1994
+ };
1944
1995
  var createWorkflowStepRegistry = ({
1945
1996
  workspace,
1946
1997
  createModule,
@@ -2032,12 +2083,14 @@ var createWorkflowStepRegistry = ({
2032
2083
  mutation: workflowStringInput(plan.inputs.mutation)
2033
2084
  })),
2034
2085
  [workflowStepKey("add-mutation", "update-signal")]: inspect,
2086
+ [workflowStepKey("add-mutation", "update-action-surfaces")]: async (_step, plan) => addMutationActionSurfaceInspection(plan),
2035
2087
  [workflowStepKey("add-slice", "update-service-query")]: async (_step, plan) => primitiveReportToWorkflowStepResult(await addSlice({
2036
2088
  app: workflowStringInput(plan.inputs.app),
2037
2089
  module: workflowStringInput(plan.inputs.module),
2038
2090
  slice: workflowStringInput(plan.inputs.slice)
2039
2091
  })),
2040
- [workflowStepKey("add-slice", "update-signal-slice")]: inspect
2092
+ [workflowStepKey("add-slice", "update-signal-slice")]: inspect,
2093
+ [workflowStepKey("add-slice", "connect-view-surfaces")]: async (_step, plan) => addSliceViewSurfaceInspection(plan)
2041
2094
  };
2042
2095
  };
2043
2096
  class WorkflowExecutor {
@@ -2126,7 +2179,7 @@ class WorkflowExecutor {
2126
2179
  }
2127
2180
  }
2128
2181
  // pkgs/@akanjs/devkit/workflow/plan.ts
2129
- import { capitalize } from "akanjs/common";
2182
+ import { capitalize as capitalize2 } from "akanjs/common";
2130
2183
  var surfaceModes = new Set(["infer", "include", "skip"]);
2131
2184
  var parseStringList = (value) => {
2132
2185
  if (Array.isArray(value)) {
@@ -2269,7 +2322,7 @@ var createAddFieldRecommendations = (inputs) => {
2269
2322
  kind: "placement",
2270
2323
  target: paths.constant,
2271
2324
  confidence: "high",
2272
- message: `Insert ${field}: field(${normalizedType}) in ${capitalize(module)}Input.`
2325
+ message: `Insert ${field}: field(${normalizedType}) in ${capitalize2(module)}Input.`
2273
2326
  },
2274
2327
  {
2275
2328
  code: "add-field-placement-dictionary",
@@ -2301,7 +2354,7 @@ var createAddFieldRecommendations = (inputs) => {
2301
2354
  code: "add-field-light-projection-choice",
2302
2355
  kind: "manual-action",
2303
2356
  target: paths.constant,
2304
- action: `Pass includeInLight=true when users should see ${field} in list/card data. Without it, the field can exist on ${capitalize(module)}Input but stay absent from Light${capitalize(module)} projections.`,
2357
+ action: `Pass includeInLight=true when users should see ${field} in list/card data. Without it, the field can exist on ${capitalize2(module)}Input but stay absent from Light${capitalize2(module)} projections.`,
2305
2358
  confidence: "medium",
2306
2359
  message: `${module}.${field} is not selected for list/card projection data.`
2307
2360
  }
@@ -2312,7 +2365,7 @@ var createAddFieldRecommendations = (inputs) => {
2312
2365
  kind: "placement",
2313
2366
  target: paths.constant,
2314
2367
  confidence: "high",
2315
- message: `Add ${field} to Light${capitalize(module)} projection fields.`
2368
+ message: `Add ${field} to Light${capitalize2(module)} projection fields.`
2316
2369
  }
2317
2370
  ] : [],
2318
2371
  ...surfaces && !templateRequested ? [
@@ -2329,7 +2382,7 @@ var createAddFieldRecommendations = (inputs) => {
2329
2382
  code: "add-field-ui-manual-review",
2330
2383
  kind: "manual-action",
2331
2384
  target: paths.template,
2332
- action: `After apply, verify what users can see: Template form auto-edit only runs when a generated ${module}Form hook and Layout.Template field list are present. Unit/View cards are not auto-edited, so ${field} may be stored on ${capitalize(module)} but not shown in list/card UI until you place it in the local card layout.`,
2385
+ action: `After apply, verify what users can see: Template form auto-edit only runs when a generated ${module}Form hook and Layout.Template field list are present. Unit/View cards are not auto-edited, so ${field} may be stored on ${capitalize2(module)} but not shown in list/card UI until you place it in the local card layout.`,
2333
2386
  confidence: "medium",
2334
2387
  message: `${app}:${module}.${field} may need UI review for user-visible Template, Unit, and View behavior.`
2335
2388
  },
@@ -2774,4 +2827,4 @@ for (const candidate of toolingRolloutCandidates) {
2774
2827
  if (isRestrictedCandidate(candidate))
2775
2828
  restrictedCandidates.set(candidate.packageName, candidate);
2776
2829
  }
2777
- export { jsonText, compactDiagnostics, workflowPlanApproval, createWorkflowApplyReport, workflowCommandsForPlan, workflowRunArtifactPath, writeWorkflowRunArtifact, workflowSyncDir, generatedFilePathsForTarget, writeGeneratedSyncState, readWorkflowRunArtifact, createWorkflowBaselineSummary, createWorkflowValidationRunReport, createDryRunWorkflowApplyReport, createRepairReport, createPrimitiveWriteReport, renderPrimitiveReport, sourceFile, moduleComponentName, moduleSourcePaths, generatedFilesForSync, validationCommandsForTarget, nextActionsForTarget, createPassedPrimitiveReport, scalarChangedFiles, lowerlize, bilingualLabelForField, bilingualDescriptionForField, normalizeFieldType, ensureBaseTypeImport, coerceFieldDefault, fieldExpression, viaBuilderParameterName, insertIntoObject, insertLightProjectionField, insertTemplateField, ensureEnumImport, insertEnumClass, insertDictionaryModelField, hasConstantInputField, hasDictionaryModelField, ensureConstantTypeImport, insertDictionaryEnum, parseValues, hasSourceParseErrors, hasClassMethod, insertClassMethod, hasSignalFactoryEntry, insertSignalFactoryEntry, buildAkanModuleContextIndex, addFieldUiPolicyForType, createWorkflowStepRegistry, WorkflowExecutor, listWorkflowSpecs, getWorkflowSpec, compactWorkflowInputs, createWorkflowPlan, renderWorkflowList, renderWorkflowExplain, renderWorkflowPlan, renderWorkflowApply, renderWorkflowValidation, renderRepairReport, renderWorkflowRunArtifact, toolingRolloutGate };
2830
+ export { jsonText, compactDiagnostics, workflowPlanApproval, createWorkflowApplyReport, workflowCommandsForPlan, workflowRunArtifactPath, writeWorkflowRunArtifact, workflowSyncDir, generatedFilePathsForTarget, writeGeneratedSyncState, readWorkflowRunArtifact, createWorkflowBaselineSummary, createWorkflowValidationRunReport, createDryRunWorkflowApplyReport, createRepairReport, createPrimitiveWriteReport, renderPrimitiveReport, sourceFile, moduleComponentName, moduleSourcePaths, generatedFilesForSync, validationCommandsForTarget, nextActionsForTarget, createPassedPrimitiveReport, scalarChangedFiles, lowerlize, bilingualLabelForField, bilingualDescriptionForField, normalizeFieldType, ensureNamedImport, ensureBaseImport, ensureBaseTypeImport, coerceFieldDefault, fieldExpression, viaBuilderParameterName, insertIntoObject, insertLightProjectionField, insertTemplateField, ensureEnumImport, insertEnumClass, insertDictionaryModelField, hasConstantInputField, hasDictionaryModelField, ensureConstantTypeImport, insertDictionaryEnum, parseValues, hasSourceParseErrors, hasClassMethod, insertClassMethod, hasSignalFactoryEntry, insertSignalFactoryEntry, buildAkanModuleContextIndex, addFieldUiPolicyForType, createWorkflowStepRegistry, WorkflowExecutor, listWorkflowSpecs, getWorkflowSpec, compactWorkflowInputs, createWorkflowPlan, renderWorkflowList, renderWorkflowExplain, renderWorkflowPlan, renderWorkflowApply, renderWorkflowValidation, renderRepairReport, renderWorkflowRunArtifact, toolingRolloutGate };
@@ -20,13 +20,13 @@ import {
20
20
  renderWorkflowApply,
21
21
  renderWorkflowValidation,
22
22
  renderWorkflowRunArtifact
23
- } from "./index-qhtj9y6j.js";
23
+ } from "./index-yw6g3bbv.js";
24
24
  import {
25
25
  AkanContextAnalyzer
26
- } from "./index-v17gj504.js";
26
+ } from "./index-rpgxs245.js";
27
27
  import {
28
28
  runner
29
- } from "./index-6na0sd2b.js";
29
+ } from "./index-ycy302an.js";
30
30
 
31
31
  // pkgs/@akanjs/cli/workflow/workflow.runner.ts
32
32
  import { mkdir, readFile, writeFile } from "fs/promises";
@@ -146,7 +146,7 @@ var addFieldWorkflowSpec = {
146
146
  values: { type: "string-list", description: "Comma-separated enum values when type is enum." },
147
147
  default: {
148
148
  type: "string",
149
- description: "Optional default value. plan/apply coerce by field type: Int/Float to numeric literals, Boolean to true/false, Date to new Date(...), String/scalar to string literals, and enum only when the value is in values."
149
+ description: "Optional default value. plan/apply coerce by field type: Int/Float to numeric literals, Boolean to true/false, Date (now, a timestamp, or a date string) to a () => dayjs(...) thunk, String/scalar to string literals, and enum only when the value is in values."
150
150
  },
151
151
  surfaces: {
152
152
  type: "string-list",
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AsyncDefaultExportDetector,
4
4
  resolveSsrPageEntriesForApp
5
- } from "./index-p4p9t45x.js";
5
+ } from "./index-bwxpk2cj.js";
6
6
  import {
7
7
  BarrelAnalyzer,
8
8
  createBarrelImportsPlugin,
package/index.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  getTargetMetas,
5
5
  getTargetCommandNames,
6
6
  runCommands
7
- } from "./index-6na0sd2b.js";
7
+ } from "./index-ycy302an.js";
8
8
  import"./index-q0y2jq9j.js";
9
- import"./index-p4p9t45x.js";
9
+ import"./index-bwxpk2cj.js";
10
10
  import"./index-6wwzs1bc.js";
11
11
 
12
12
  // pkgs/@akanjs/cli/commandManifest.ts
@@ -14,25 +14,25 @@ import path from "path";
14
14
 
15
15
  // pkgs/@akanjs/cli/commandModules.ts
16
16
  var commandModules = {
17
- workspace: async () => (await import("./workspace.command-ayqa1rgt.js")).WorkspaceCommand,
18
- agent: async () => (await import("./agent.command-n664dtcv.js")).AgentCommand,
19
- code: async () => (await import("./code.command-mrfb7a1g.js")).CodeCommand,
20
- application: async () => (await import("./application.command-t5542jte.js")).ApplicationCommand,
21
- library: async () => (await import("./library.command-m8p2r1dh.js")).LibraryCommand,
22
- localRegistry: async () => (await import("./localRegistry.command-tt00nwwg.js")).LocalRegistryCommand,
23
- package: async () => (await import("./package.command-8sy6jjwy.js")).PackageCommand,
24
- module: async () => (await import("./module.command-mfzvqt0n.js")).ModuleCommand,
25
- page: async () => (await import("./page.command-taenb02b.js")).PageCommand,
26
- context: async () => (await import("./context.command-pqsm5jrk.js")).ContextCommand,
27
- cloud: async () => (await import("./cloud.command-4x35k1z6.js")).CloudCommand,
28
- subspace: async () => (await import("./subspace.command-x9897gj4.js")).SubspaceCommand,
29
- guideline: async () => (await import("./guideline.command-rpc2emw8.js")).GuidelineCommand,
30
- scalar: async () => (await import("./scalar.command-mq8qfp4t.js")).ScalarCommand,
31
- primitive: async () => (await import("./primitive.command-7kpncmkk.js")).PrimitiveCommand,
32
- quality: async () => (await import("./quality.command-1ar94hrw.js")).QualityCommand,
33
- repair: async () => (await import("./repair.command-n08t6j8p.js")).RepairCommand,
34
- workflow: async () => (await import("./workflow.command-tvz4nm9n.js")).WorkflowCommand,
35
- tunnel: async () => (await import("./tunnel.command-ht2es78c.js")).TunnelCommand
17
+ workspace: async () => (await import("./workspace.command-d5wkswek.js")).WorkspaceCommand,
18
+ agent: async () => (await import("./agent.command-65zqfkg0.js")).AgentCommand,
19
+ code: async () => (await import("./code.command-4feh3ef7.js")).CodeCommand,
20
+ application: async () => (await import("./application.command-2wcj5da3.js")).ApplicationCommand,
21
+ library: async () => (await import("./library.command-fp0nhr62.js")).LibraryCommand,
22
+ localRegistry: async () => (await import("./localRegistry.command-8y0ecxb9.js")).LocalRegistryCommand,
23
+ package: async () => (await import("./package.command-qverjh22.js")).PackageCommand,
24
+ module: async () => (await import("./module.command-kqkn48t2.js")).ModuleCommand,
25
+ page: async () => (await import("./page.command-94bwhd0g.js")).PageCommand,
26
+ context: async () => (await import("./context.command-kzehkx48.js")).ContextCommand,
27
+ cloud: async () => (await import("./cloud.command-960bgbf4.js")).CloudCommand,
28
+ subspace: async () => (await import("./subspace.command-vkxmwp74.js")).SubspaceCommand,
29
+ guideline: async () => (await import("./guideline.command-3w2g20x4.js")).GuidelineCommand,
30
+ scalar: async () => (await import("./scalar.command-pb2y95sh.js")).ScalarCommand,
31
+ primitive: async () => (await import("./primitive.command-2ydvtah2.js")).PrimitiveCommand,
32
+ quality: async () => (await import("./quality.command-fa0gth4p.js")).QualityCommand,
33
+ repair: async () => (await import("./repair.command-4qng2hpm.js")).RepairCommand,
34
+ workflow: async () => (await import("./workflow.command-132txnrh.js")).WorkflowCommand,
35
+ tunnel: async () => (await import("./tunnel.command-02cvp9nf.js")).TunnelCommand
36
36
  };
37
37
  var commandModuleIds = Object.keys(commandModules);
38
38