agent-enderun 1.1.10 → 1.10.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 (254) hide show
  1. package/README.md +294 -19
  2. package/bin/cli.js +7 -0
  3. package/bin/enderun-dashboard.js +16 -857
  4. package/bin/validate-agent-army.js +12 -12
  5. package/dist/framework-mcp/src/index.js +14 -2
  6. package/dist/framework-mcp/src/index.js.map +1 -1
  7. package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js +2 -1
  8. package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js.map +1 -1
  9. package/dist/framework-mcp/src/tools/file_system/replace_text.js +2 -1
  10. package/dist/framework-mcp/src/tools/file_system/replace_text.js.map +1 -1
  11. package/dist/framework-mcp/src/tools/file_system/write_file.js +3 -3
  12. package/dist/framework-mcp/src/tools/file_system/write_file.js.map +1 -1
  13. package/dist/framework-mcp/src/utils/fs.d.ts +16 -0
  14. package/dist/framework-mcp/src/utils/fs.js +45 -0
  15. package/dist/framework-mcp/src/utils/fs.js.map +1 -0
  16. package/dist/framework-mcp/src/utils/metrics.js.map +1 -1
  17. package/dist/src/cli/adapters/core.js.map +1 -1
  18. package/dist/src/cli/adapters/scaffold.js +4 -3
  19. package/dist/src/cli/adapters/scaffold.js.map +1 -1
  20. package/dist/src/cli/commands/app.js +20 -5
  21. package/dist/src/cli/commands/app.js.map +1 -1
  22. package/dist/src/cli/commands/approve.d.ts +1 -1
  23. package/dist/src/cli/commands/approve.js +7 -7
  24. package/dist/src/cli/commands/approve.js.map +1 -1
  25. package/dist/src/cli/commands/check.d.ts +1 -1
  26. package/dist/src/cli/commands/check.js +35 -4
  27. package/dist/src/cli/commands/check.js.map +1 -1
  28. package/dist/src/cli/commands/compliance.d.ts +1 -1
  29. package/dist/src/cli/commands/compliance.js +1 -1
  30. package/dist/src/cli/commands/compliance.js.map +1 -1
  31. package/dist/src/cli/commands/contract.d.ts +2 -2
  32. package/dist/src/cli/commands/contract.js +8 -14
  33. package/dist/src/cli/commands/contract.js.map +1 -1
  34. package/dist/src/cli/commands/dashboard/data-service.d.ts +33 -0
  35. package/dist/src/cli/commands/dashboard/data-service.js +120 -0
  36. package/dist/src/cli/commands/dashboard/data-service.js.map +1 -0
  37. package/dist/src/cli/commands/dashboard/html-template.d.ts +4 -0
  38. package/dist/src/cli/commands/dashboard/html-template.js +697 -0
  39. package/dist/src/cli/commands/dashboard/html-template.js.map +1 -0
  40. package/dist/src/cli/commands/dashboard/server.d.ts +2 -0
  41. package/dist/src/cli/commands/dashboard/server.js +38 -0
  42. package/dist/src/cli/commands/dashboard/server.js.map +1 -0
  43. package/dist/src/cli/commands/dashboard.d.ts +4 -0
  44. package/dist/src/cli/commands/dashboard.js +10 -0
  45. package/dist/src/cli/commands/dashboard.js.map +1 -0
  46. package/dist/src/cli/commands/explorer.d.ts +2 -2
  47. package/dist/src/cli/commands/explorer.js +2 -2
  48. package/dist/src/cli/commands/explorer.js.map +1 -1
  49. package/dist/src/cli/commands/git.d.ts +2 -2
  50. package/dist/src/cli/commands/git.js +2 -2
  51. package/dist/src/cli/commands/git.js.map +1 -1
  52. package/dist/src/cli/commands/init/scaffold-core.d.ts +4 -0
  53. package/dist/src/cli/commands/init/scaffold-core.js +65 -0
  54. package/dist/src/cli/commands/init/scaffold-core.js.map +1 -0
  55. package/dist/src/cli/commands/init/scaffold-ops.d.ts +1 -0
  56. package/dist/src/cli/commands/init/scaffold-ops.js +83 -0
  57. package/dist/src/cli/commands/init/scaffold-ops.js.map +1 -0
  58. package/dist/src/cli/commands/init/scaffold-standards.d.ts +2 -0
  59. package/dist/src/cli/commands/init/scaffold-standards.js +58 -0
  60. package/dist/src/cli/commands/init/scaffold-standards.js.map +1 -0
  61. package/dist/src/cli/commands/init.js +14 -275
  62. package/dist/src/cli/commands/init.js.map +1 -1
  63. package/dist/src/cli/commands/knowledge.d.ts +2 -2
  64. package/dist/src/cli/commands/knowledge.js +4 -3
  65. package/dist/src/cli/commands/knowledge.js.map +1 -1
  66. package/dist/src/cli/commands/lint.d.ts +1 -1
  67. package/dist/src/cli/commands/lint.js +2 -3
  68. package/dist/src/cli/commands/lint.js.map +1 -1
  69. package/dist/src/cli/commands/log.d.ts +1 -1
  70. package/dist/src/cli/commands/log.js +3 -2
  71. package/dist/src/cli/commands/log.js.map +1 -1
  72. package/dist/src/cli/commands/memory.d.ts +1 -1
  73. package/dist/src/cli/commands/memory.js +1 -1
  74. package/dist/src/cli/commands/memory.js.map +1 -1
  75. package/dist/src/cli/commands/orchestrate.js +169 -140
  76. package/dist/src/cli/commands/orchestrate.js.map +1 -1
  77. package/dist/src/cli/commands/plan.d.ts +1 -1
  78. package/dist/src/cli/commands/plan.js +1 -1
  79. package/dist/src/cli/commands/plan.js.map +1 -1
  80. package/dist/src/cli/commands/script.d.ts +1 -1
  81. package/dist/src/cli/commands/script.js +1 -1
  82. package/dist/src/cli/commands/script.js.map +1 -1
  83. package/dist/src/cli/commands/security.d.ts +1 -1
  84. package/dist/src/cli/commands/security.js +1 -1
  85. package/dist/src/cli/commands/security.js.map +1 -1
  86. package/dist/src/cli/commands/status.d.ts +1 -1
  87. package/dist/src/cli/commands/status.js +1 -1
  88. package/dist/src/cli/commands/status.js.map +1 -1
  89. package/dist/src/cli/commands/trace.d.ts +1 -1
  90. package/dist/src/cli/commands/trace.js +1 -1
  91. package/dist/src/cli/commands/trace.js.map +1 -1
  92. package/dist/src/cli/index.js +36 -21
  93. package/dist/src/cli/index.js.map +1 -1
  94. package/dist/src/cli/shims.js +6 -6
  95. package/dist/src/cli/utils/app-backend.js +7 -0
  96. package/dist/src/cli/utils/app-backend.js.map +1 -1
  97. package/dist/src/cli/utils/app-docs.js +23 -5
  98. package/dist/src/cli/utils/app-docs.js.map +1 -1
  99. package/dist/src/cli/utils/app-frontend.js +5 -0
  100. package/dist/src/cli/utils/app-frontend.js.map +1 -1
  101. package/dist/src/cli/utils/app-inferrer.d.ts +1 -0
  102. package/dist/src/cli/utils/app-inferrer.js +12 -1
  103. package/dist/src/cli/utils/app-inferrer.js.map +1 -1
  104. package/dist/src/cli/utils/app-mobile.d.ts +2 -0
  105. package/dist/src/cli/utils/app-mobile.js +106 -0
  106. package/dist/src/cli/utils/app-mobile.js.map +1 -0
  107. package/dist/src/cli/utils/app-types.js +8 -4
  108. package/dist/src/cli/utils/app-types.js.map +1 -1
  109. package/dist/src/cli/utils/app.d.ts +1 -0
  110. package/dist/src/cli/utils/app.js +1 -0
  111. package/dist/src/cli/utils/app.js.map +1 -1
  112. package/dist/src/cli/utils/claude.js +2 -1
  113. package/dist/src/cli/utils/claude.js.map +1 -1
  114. package/dist/src/cli/utils/compliance.js +37 -6
  115. package/dist/src/cli/utils/compliance.js.map +1 -1
  116. package/dist/src/cli/utils/config-schema.d.ts +3 -3
  117. package/dist/src/cli/utils/config-schema.js +3 -3
  118. package/dist/src/cli/utils/config-schema.js.map +1 -1
  119. package/dist/src/cli/utils/fs.d.ts +2 -2
  120. package/dist/src/cli/utils/fs.js +9 -13
  121. package/dist/src/cli/utils/fs.js.map +1 -1
  122. package/dist/src/cli/utils/memory.d.ts +9 -2
  123. package/dist/src/cli/utils/memory.js +87 -16
  124. package/dist/src/cli/utils/memory.js.map +1 -1
  125. package/dist/src/cli/utils/pkg.js +14 -13
  126. package/dist/src/cli/utils/pkg.js.map +1 -1
  127. package/dist/src/cli/utils/string.js +1 -1
  128. package/dist/src/cli/utils/string.js.map +1 -1
  129. package/dist/src/cli/utils/ui.d.ts +1 -1
  130. package/dist/src/cli/utils/ui.js +1 -1
  131. package/dist/src/modules/adapters/shared.js +7 -7
  132. package/dist/src/modules/adapters/shared.js.map +1 -1
  133. package/dist/src/modules/agents/definitions.d.ts +3 -34
  134. package/dist/src/modules/agents/definitions.js +35 -511
  135. package/dist/src/modules/agents/definitions.js.map +1 -1
  136. package/dist/src/modules/agents/registry/analyst.d.ts +2 -0
  137. package/dist/src/modules/agents/registry/analyst.js +36 -0
  138. package/dist/src/modules/agents/registry/analyst.js.map +1 -0
  139. package/dist/src/modules/agents/registry/architect.d.ts +2 -0
  140. package/dist/src/modules/agents/registry/architect.js +42 -0
  141. package/dist/src/modules/agents/registry/architect.js.map +1 -0
  142. package/dist/src/modules/agents/registry/backend.d.ts +2 -0
  143. package/dist/src/modules/agents/registry/backend.js +43 -0
  144. package/dist/src/modules/agents/registry/backend.js.map +1 -0
  145. package/dist/src/modules/agents/registry/database.d.ts +2 -0
  146. package/dist/src/modules/agents/registry/database.js +38 -0
  147. package/dist/src/modules/agents/registry/database.js.map +1 -0
  148. package/dist/src/modules/agents/registry/devops.d.ts +2 -0
  149. package/dist/src/modules/agents/registry/devops.js +38 -0
  150. package/dist/src/modules/agents/registry/devops.js.map +1 -0
  151. package/dist/src/modules/agents/registry/explorer.d.ts +2 -0
  152. package/dist/src/modules/agents/registry/explorer.js +36 -0
  153. package/dist/src/modules/agents/registry/explorer.js.map +1 -0
  154. package/dist/src/modules/agents/registry/frontend.d.ts +2 -0
  155. package/dist/src/modules/agents/registry/frontend.js +44 -0
  156. package/dist/src/modules/agents/registry/frontend.js.map +1 -0
  157. package/dist/src/modules/agents/registry/git.d.ts +2 -0
  158. package/dist/src/modules/agents/registry/git.js +35 -0
  159. package/dist/src/modules/agents/registry/git.js.map +1 -0
  160. package/dist/src/modules/agents/registry/manager.d.ts +2 -0
  161. package/dist/src/modules/agents/registry/manager.js +49 -0
  162. package/dist/src/modules/agents/registry/manager.js.map +1 -0
  163. package/dist/src/modules/agents/registry/mobile.d.ts +2 -0
  164. package/dist/src/modules/agents/registry/mobile.js +40 -0
  165. package/dist/src/modules/agents/registry/mobile.js.map +1 -0
  166. package/dist/src/modules/agents/registry/native.d.ts +2 -0
  167. package/dist/src/modules/agents/registry/native.js +36 -0
  168. package/dist/src/modules/agents/registry/native.js.map +1 -0
  169. package/dist/src/modules/agents/registry/quality.d.ts +2 -0
  170. package/dist/src/modules/agents/registry/quality.js +41 -0
  171. package/dist/src/modules/agents/registry/quality.js.map +1 -0
  172. package/dist/src/modules/agents/registry/security.d.ts +2 -0
  173. package/dist/src/modules/agents/registry/security.js +37 -0
  174. package/dist/src/modules/agents/registry/security.js.map +1 -0
  175. package/dist/src/modules/agents/types.d.ts +31 -0
  176. package/dist/src/modules/agents/types.js +2 -0
  177. package/dist/src/modules/agents/types.js.map +1 -0
  178. package/dist/src/modules/skills/definitions.d.ts +1 -1
  179. package/dist/src/modules/skills/definitions.js +1 -1
  180. package/dist/src/shared/errors.d.ts +8 -6
  181. package/dist/src/shared/errors.js +13 -10
  182. package/dist/src/shared/errors.js.map +1 -1
  183. package/dist/src/shared/fs.d.ts +4 -0
  184. package/dist/src/shared/fs.js +17 -2
  185. package/dist/src/shared/fs.js.map +1 -1
  186. package/dist/src/shared/types.d.ts +19 -0
  187. package/dist/src/shared/types.js +13 -0
  188. package/dist/src/shared/types.js.map +1 -0
  189. package/package.json +3 -5
  190. package/src/cli/adapters/core.ts +0 -1
  191. package/src/cli/adapters/scaffold.ts +4 -3
  192. package/src/cli/commands/app.ts +23 -5
  193. package/src/cli/commands/approve.ts +15 -7
  194. package/src/cli/commands/check.ts +38 -5
  195. package/src/cli/commands/compliance.ts +1 -1
  196. package/src/cli/commands/contract.ts +20 -14
  197. package/src/cli/commands/dashboard/data-service.ts +119 -0
  198. package/src/cli/commands/dashboard/html-template.ts +696 -0
  199. package/src/cli/commands/dashboard/server.ts +43 -0
  200. package/src/cli/commands/dashboard.ts +11 -0
  201. package/src/cli/commands/explorer.ts +2 -2
  202. package/src/cli/commands/git.ts +2 -2
  203. package/src/cli/commands/init/scaffold-core.ts +71 -0
  204. package/src/cli/commands/init/scaffold-ops.ts +86 -0
  205. package/src/cli/commands/init/scaffold-standards.ts +59 -0
  206. package/src/cli/commands/init.ts +21 -292
  207. package/src/cli/commands/knowledge.ts +5 -3
  208. package/src/cli/commands/lint.ts +2 -4
  209. package/src/cli/commands/log.ts +4 -2
  210. package/src/cli/commands/memory.ts +1 -1
  211. package/src/cli/commands/orchestrate.ts +177 -142
  212. package/src/cli/commands/plan.ts +1 -1
  213. package/src/cli/commands/script.ts +1 -1
  214. package/src/cli/commands/security.ts +1 -1
  215. package/src/cli/commands/status.ts +1 -1
  216. package/src/cli/commands/trace.ts +1 -1
  217. package/src/cli/index.ts +37 -21
  218. package/src/cli/shims.ts +6 -6
  219. package/src/cli/utils/app-backend.ts +8 -0
  220. package/src/cli/utils/app-docs.ts +23 -5
  221. package/src/cli/utils/app-frontend.ts +6 -0
  222. package/src/cli/utils/app-inferrer.ts +11 -1
  223. package/src/cli/utils/app-mobile.ts +113 -0
  224. package/src/cli/utils/app-types.ts +9 -4
  225. package/src/cli/utils/app.ts +1 -0
  226. package/src/cli/utils/claude.ts +2 -1
  227. package/src/cli/utils/compliance.ts +38 -7
  228. package/src/cli/utils/config-schema.ts +4 -4
  229. package/src/cli/utils/fs.ts +9 -14
  230. package/src/cli/utils/memory.ts +103 -20
  231. package/src/cli/utils/pkg.ts +14 -13
  232. package/src/cli/utils/string.ts +1 -1
  233. package/src/cli/utils/ui.ts +1 -1
  234. package/src/modules/adapters/shared.ts +7 -7
  235. package/src/modules/agents/definitions.ts +39 -598
  236. package/src/modules/agents/registry/analyst.ts +40 -0
  237. package/src/modules/agents/registry/architect.ts +46 -0
  238. package/src/modules/agents/registry/backend.ts +47 -0
  239. package/src/modules/agents/registry/database.ts +42 -0
  240. package/src/modules/agents/registry/devops.ts +42 -0
  241. package/src/modules/agents/registry/explorer.ts +40 -0
  242. package/src/modules/agents/registry/frontend.ts +48 -0
  243. package/src/modules/agents/registry/git.ts +39 -0
  244. package/src/modules/agents/registry/manager.ts +53 -0
  245. package/src/modules/agents/registry/mobile.ts +44 -0
  246. package/src/modules/agents/registry/native.ts +40 -0
  247. package/src/modules/agents/registry/quality.ts +45 -0
  248. package/src/modules/agents/registry/security.ts +41 -0
  249. package/src/modules/agents/types.ts +37 -0
  250. package/src/modules/skills/definitions.ts +1 -1
  251. package/src/shared/errors.ts +13 -10
  252. package/src/shared/fs.ts +17 -2
  253. package/src/shared/types.ts +20 -0
  254. package/bin/utils/docgen.ts +0 -24
@@ -1,28 +1,30 @@
1
- import fs from "fs";
2
1
  import path from "path";
3
2
  import readline from "readline";
4
3
 
5
- import { logger } from "../../shared/logger.js";
6
4
  import {
7
- remapFrameworkContent,
8
5
  resolveAdapter,
9
6
  runAdapterPostInit,
10
7
  scaffoldAgents,
11
- type AdapterConfig,
12
8
  type AdapterId,
13
9
  } from "../adapters/index.js";
14
- import { SHIM_TEMPLATES } from "../shims.js";
15
- import { ensureDir, writeJsonFile } from "../utils/fs.js";
10
+ import { ensureDir } from "../utils/fs.js";
16
11
  import { initializeMemory } from "../utils/memory.js";
17
- import { getPackageRoot, getPackageVersion } from "../utils/pkg.js";
12
+ import { getPackageVersion } from "../utils/pkg.js";
18
13
  import { UI } from "../utils/ui.js";
19
14
 
20
15
  import { ALL_AGENTS } from "../../modules/agents/definitions.js";
21
- import { CORE_SKILLS } from "../../modules/skills/definitions.js";
22
-
23
-
24
- const FRAMEWORK_NAME = "Enderun Core";
25
- const FRAMEWORK_VERSION = getPackageVersion();
16
+ import {
17
+ scaffoldConstitution,
18
+ scaffoldFrameworkConfigs,
19
+ scaffoldShims
20
+ } from "./init/scaffold-core.js";
21
+ import {
22
+ scaffoldSkills,
23
+ scaffoldStandards
24
+ } from "./init/scaffold-standards.js";
25
+ import { scaffoldOps } from "./init/scaffold-ops.js";
26
+
27
+ const FRAMEWORK_NAME = "Agent Enderun";
26
28
 
27
29
  const FRAMEWORK_SUBDIRS = [
28
30
  "agents",
@@ -36,13 +38,6 @@ const FRAMEWORK_SUBDIRS = [
36
38
  "rules",
37
39
  ];
38
40
 
39
-
40
- const COLOR_PALETTES = {
41
- "Modern Blue": { primary: "#0ea5e9", secondary: "#64748b", accent: "#f43f5e" },
42
- "Enterprise Slate": { primary: "#334155", secondary: "#94a3b8", accent: "#10b981" },
43
- "Deep Purple": { primary: "#8b5cf6", secondary: "#d8b4fe", accent: "#f59e0b" }
44
- };
45
-
46
41
  async function runInteractiveInit(): Promise<{ selectedDirs: string[], selectedAgents: string[], selectedPalette: string }> {
47
42
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
48
43
  const question = (query: string): Promise<string> => new Promise((resolve) => rl.question(query, resolve));
@@ -60,7 +55,7 @@ async function runInteractiveInit(): Promise<{ selectedDirs: string[], selectedA
60
55
  const selectedAgents = agentInput ? agentInput.split(",").map(n => ALL_AGENTS[parseInt(n.trim()) - 1].name).filter(Boolean) : ALL_AGENTS.map(a => a.name);
61
56
 
62
57
  console.warn("\nAvailable Color Palettes:");
63
- const palettes = Object.keys(COLOR_PALETTES);
58
+ const palettes = ["Modern Blue", "Enterprise Slate", "Deep Purple"];
64
59
  palettes.forEach((p, i) => console.warn(`${i + 1}. ${p}`));
65
60
  const palInput = await question("\nSelect palette (1-3) or Enter for 'Modern Blue': ");
66
61
  const selectedPalette = palettes[parseInt(palInput.trim()) - 1] || "Modern Blue";
@@ -69,266 +64,6 @@ async function runInteractiveInit(): Promise<{ selectedDirs: string[], selectedA
69
64
  } finally { rl.close(); }
70
65
  }
71
66
 
72
- function scaffoldConstitution(targetDir: string, frameworkDir: string, adapterId: AdapterId, dryRun: boolean) {
73
- if (dryRun) return;
74
- let content = `# šŸŽ–ļø ${FRAMEWORK_NAME} — Constitution (v${FRAMEWORK_VERSION})\n\nDiscipline and Order.`;
75
- let readSuccess = false;
76
- try {
77
- const templatePath = path.join(getPackageRoot(), "ENDERUN.md");
78
- if (fs.existsSync(templatePath)) {
79
- content = fs.readFileSync(templatePath, "utf8");
80
- readSuccess = true;
81
- }
82
- } catch (e) {
83
- console.warn(`āš ļø Failed to read global constitution template: ${e}`);
84
- }
85
- content = remapFrameworkContent(content, frameworkDir, adapterId);
86
-
87
- // Write ONLY to the framework directory (e.g. .gemini/ENDERUN.md)
88
- const destPath = path.join(targetDir, frameworkDir, "ENDERUN.md");
89
- fs.writeFileSync(destPath, content);
90
- console.warn(`āœ… Constitution file created inside: ${frameworkDir}/ENDERUN.md${readSuccess ? "" : " (default template)"}`);
91
- }
92
-
93
- function scaffoldSkills(skillsBaseDir: string, dryRun: boolean) {
94
- if (dryRun) return;
95
- ensureDir(skillsBaseDir, dryRun);
96
- for (const [key, skill] of Object.entries(CORE_SKILLS)) {
97
- const mdContent = `# šŸ› ļø ${FRAMEWORK_NAME} Skill — ${skill.name}
98
-
99
- ${skill.description}
100
-
101
- ## šŸ”Œ Associated Tools
102
- ${skill.tools.map(t => `- \`${t}\``).join("\n")}
103
-
104
- ## šŸ›”ļø Core Mandates
105
- ${skill.mandates.join("\n")}
106
- `;
107
- fs.writeFileSync(path.join(skillsBaseDir, `${key.toLowerCase()}.md`), mdContent);
108
- }
109
- }
110
-
111
- function scaffoldFrameworkConfigs(targetDir: string, fDir: string, adapter: AdapterConfig, dryRun: boolean, selectedPalette: string) {
112
- if (dryRun) return;
113
- const frameworkDir = path.join(targetDir, fDir);
114
- const palette = COLOR_PALETTES[selectedPalette as keyof typeof COLOR_PALETTES] || COLOR_PALETTES["Modern Blue"];
115
-
116
- const config = {
117
- name: FRAMEWORK_NAME,
118
- version: FRAMEWORK_VERSION,
119
- theme: {
120
- palette: selectedPalette,
121
- colors: palette
122
- }
123
- };
124
- writeJsonFile(path.join(frameworkDir, "config.json"), config, dryRun);
125
- let statusContent = "# šŸŽ–ļø Status\n\n| Agent | State | Active Task | Last Updated | Notes | Extra | Backup |\n|---|---|---|---|---|---|---|\n";
126
- for (const ag of ALL_AGENTS) {
127
- statusContent += "| @" + ag.name + " | READY | Idle | - | - | - | - |\n";
128
- }
129
- fs.writeFileSync(path.join(frameworkDir, "STATUS.md"), statusContent);
130
-
131
- // Scaffold eslint-standards.md
132
- let knowledgeDir = "knowledge";
133
- if (fDir === ".github") knowledgeDir = "instructions";
134
- const eslintStandardsContent = `# šŸŽ–ļø Agent Enderun — ESLint Standards
135
-
136
- This document outlines the strict ESLint coding standards for Agent Enderun projects.
137
-
138
- ## šŸ“ Core Rules
139
- - **Indentation:** 4 spaces (strict).
140
- - **Quotes:** Double quotes (\`"\`) for strings.
141
- - **Semicolons:** Always terminate statements with a semicolon (\`;\`).
142
- - **No Explicit Any:** Avoid using \`any\`. Use strongly typed interfaces, generics, or \`unknown\` with type assertions.
143
- - **Unused Variables:** Warning on unused variables unless prefixed with an underscore (\`_\`).
144
- `;
145
- const knowledgePath = path.join(frameworkDir, knowledgeDir);
146
- if (!fs.existsSync(knowledgePath)) fs.mkdirSync(knowledgePath, { recursive: true });
147
- fs.writeFileSync(path.join(knowledgePath, "eslint-standards.md"), eslintStandardsContent);
148
-
149
- // Scaffold Corporate Standards (CRUD & Architecture)
150
- const standards = [
151
- {
152
- file: "crud-governance.md",
153
- template: "templates/standards/crud-governance.md",
154
- default: "# šŸ›ļø Corporate CRUD and Governance Standards\n\n1. **High-Risk Operations:** Requires @manager approval.\n2. **Branded Types:** Mandatory.\n3. **Kysely:** Raw SQL is forbidden."
155
- },
156
- {
157
- file: "architecture-standards.md",
158
- template: "templates/standards/architecture-standards.md",
159
- default: "# šŸ“ Corporate Architecture Standards\n\n1. **Layered Architecture:** Route -> Service -> Repository.\n2. **Zero Mock:** Use of real data/contracts is mandatory.\n3. **any Forbidden:** TypeScript discipline."
160
- },
161
- {
162
- file: "frontend-standards.md",
163
- template: "templates/standards/frontend-standards.md",
164
- default: "# šŸŽØ Corporate Frontend Standards\n\n1. **Style Discipline:** Type-safe or utility-first systems preferred.\n2. **Responsive-First:** Mobile-first design is mandatory.\n3. **WCAG AA:** Accessibility is standard."
165
- },
166
- {
167
- file: "tailwind-standards.md",
168
- template: "templates/standards/tailwind-standards.md",
169
- default: "# 🌊 Corporate Tailwind Standards\n\n1. **No Arbitrary Values:** h-[10px] is forbidden.\n2. **Mobile-First:** sm:, md: usage is mandatory.\n3. **Prettier:** Tailwind plugin usage recommended."
170
- },
171
- {
172
- file: "mobile-standards.md",
173
- template: "templates/standards/mobile-standards.md",
174
- default: "# šŸ“± Corporate Mobile Standards\n\n1. **Expo/React Native:** Standard platform.\n2. **Dynamic Scaling:** useWindowDimensions usage is mandatory.\n3. **FlashList:** Shopify FlashList used for large lists."
175
- },
176
- {
177
- file: "security-standards.md",
178
- template: "templates/standards/security-standards.md",
179
- default: "# šŸ›”ļø Corporate Security Standards\n\n1. **No Raw SQL:** Kysely mandatory.\n2. **RLS:** Row Level Security must be applied.\n3. **Secrets:** .env discipline."
180
- },
181
- {
182
- file: "quality-standards.md",
183
- template: "templates/standards/quality-standards.md",
184
- default: "# āš–ļø Corporate Code Quality Standards\n\n1. **Zero any:** TypeScript discipline.\n2. **Zero Warnings:** ESLint clean.\n3. **4 Spaces:** Indentation rule."
185
- },
186
- {
187
- file: "logging-and-secrets.md",
188
- template: "templates/standards/logging-and-secrets.md",
189
- default: "# 🪵 Corporate Logging Standards\n\n1. **Zero Console:** console.log is forbidden.\n2. **Logger:** Corporate logger used.\n3. **Secrets:** .env discipline mandatory."
190
- },
191
- {
192
- file: "testing-standards.md",
193
- template: "templates/standards/testing-standards.md",
194
- default: "# 🧪 Corporate Testing Standards\n\n1. **Framework:** Vitest used.\n2. **Naming:** .test.ts format.\n3. **Zero Mock:** Internal services not mocked."
195
- },
196
- {
197
- file: "i18n-standards.md",
198
- template: "templates/standards/i18n-standards.md",
199
- default: "# 🌐 Corporate i18n Standards\n\n1. **No Hardcoded:** Text kept in JSON.\n2. **i18next:** Standard library.\n3. **Centralized:** Locales directory mandatory."
200
- }
201
- ];
202
-
203
- for (const std of standards) {
204
- let content = std.default;
205
- try {
206
- const fullTemplatePath = path.join(getPackageRoot(), std.template);
207
- if (fs.existsSync(fullTemplatePath)) {
208
- content = fs.readFileSync(fullTemplatePath, "utf8");
209
- }
210
- } catch {
211
- // Intentional: if the template file is unreadable, fall back to the inline default.
212
- // No logging needed — the default value is a valid fallback, not an error condition.
213
- }
214
- fs.writeFileSync(path.join(knowledgePath, std.file), content);
215
- }
216
-
217
- // Scaffold Prompt Recipes
218
- const promptsPath = path.join(frameworkDir, "prompts");
219
- if (!fs.existsSync(promptsPath)) fs.mkdirSync(promptsPath, { recursive: true });
220
-
221
- const recipes = [
222
- { file: "refactoring-recipe.md", template: "templates/prompts/refactoring-recipe.md" },
223
- { file: "bug-fix-recipe.md", template: "templates/prompts/bug-fix-recipe.md" },
224
- { file: "new-feature-recipe.md", template: "templates/prompts/new-feature-recipe.md" }
225
- ];
226
-
227
- for (const recipe of recipes) {
228
- try {
229
- const fullTemplatePath = path.join(getPackageRoot(), recipe.template);
230
- if (fs.existsSync(fullTemplatePath)) {
231
- const content = fs.readFileSync(fullTemplatePath, "utf8");
232
- fs.writeFileSync(path.join(promptsPath, recipe.file), content);
233
- }
234
- } catch (e) {
235
- logger.debug(`Failed to scaffold prompt recipe: ${recipe.file}`, e);
236
- }
237
- }
238
-
239
- // Scaffold cli-commands.json
240
- const cliCommands = {
241
- commands: {
242
- init: { agent: "manager", description: "Initialize Enderun Core structure and AI configuration." },
243
- check: { agent: "quality", description: "Verify framework files and code quality discipline." },
244
- status: { agent: "manager", description: "Show the current status of the active project phase." },
245
- "trace:new": { agent: "manager", description: "Generate a new Trace ID to start a task sequence." },
246
- orchestrate: { agent: "manager", description: "Execute the Hermes message broker loop." },
247
- "verify-contract": { agent: "architect", description: "Validate type contracts between backend and frontend." },
248
- "update-contract": { agent: "architect", description: "Update the contract signature hash." }
249
- }
250
- };
251
- writeJsonFile(path.join(frameworkDir, "cli-commands.json"), cliCommands, dryRun);
252
-
253
- // Scaffold BRAIN_DASHBOARD.md
254
- fs.writeFileSync(path.join(frameworkDir, "BRAIN_DASHBOARD.md"), "# 🧠 Brain Dashboard\n\nActive Trace: T-000\nActive Phase: PHASE_0 (Genesis)\n\n## Agent Statuses\n- @manager: READY\n- @architect: READY\n- @backend: READY\n- @frontend: READY\n- @quality: READY\n");
255
-
256
- // Scaffold router/routing_rules.md
257
- const routerDir = path.join(frameworkDir, "router");
258
- if (!fs.existsSync(routerDir)) fs.mkdirSync(routerDir, { recursive: true });
259
- fs.writeFileSync(
260
- path.join(routerDir, "routing_rules.md"),
261
- `# šŸ“” Agent Enderun — Natural Language & Event Router
262
-
263
- This configuration governs how user inputs and event messages are routed across the 12 expert agents.
264
-
265
- ## 🧭 Routing Engine Protocols
266
- - **User Input Routing:** By default, all un-targeted natural language prompts are routed to the \`@manager\` agent for analysis and decomposition into a Directed Acyclic Graph (DAG) task list.
267
- - **Targeted Input Routing:** Prompts beginning with \`@<agent_name>\` (e.g., \`@backend\`) bypass the general manager routing and are directly appended to the target agent's Hermes mailbox.
268
- - **Hermes Event Loops:** Agents publish status changes and handoffs which the message broker routes dynamically according to active dependencies.
269
- `
270
- );
271
-
272
- // Scaffold registry/agent_registry.md
273
- const registryDir = path.join(frameworkDir, "registry");
274
- if (!fs.existsSync(registryDir)) fs.mkdirSync(registryDir, { recursive: true });
275
- fs.writeFileSync(
276
- path.join(registryDir, "agent_registry.md"),
277
- `# šŸŽ–ļø Agent Enderun — Army Registry
278
-
279
- List of active agents, their roles, capacities, and matching directory patterns.
280
-
281
- | Agent Name | Role | Scope / Globs | Action Compliance |
282
- |---|---|---|---|
283
- | \`@manager\` | Orchestrator & Controller | \`*\` | Rules Verification |
284
- | \`@quality\` | Quality & Test Enforcer | \`*\` | AST Security Scans |
285
- | \`@database\` | Database Optimizer | \`apps/backend/src/database/**/*\` | Schema & Migrations |
286
- | \`@backend\` | Core Domain Developer | \`apps/backend/**/*\` | Branded Types & APIs |
287
- | \`@frontend\` | UI/UX Developer | \`apps/web/**/*\` | Panda CSS, Fluid UI |
288
- | \`@mobile\` | Mobile App Specialist | \`apps/mobile/**/*\` | Expo/React Native |
289
- | \`@native\` | Desktop / Native Integrator | \`apps/native/**/*\` | Electron/Tauri |
290
- | \`@devops\` | Deployment & CI/CD | CI/CD YAML & Deployment files | Native Rollbacks |
291
- | \`@explorer\` | Codebase Discovery | All source directories | Onboarding & Audit |
292
- | \`@git\` | Version Control System | \`.git/\` & Commit traces | Trace ID commits |
293
- | \`@security\` | Security Officer | All source directories | RLS & Secrets Scan |
294
- | \`@analyst\` | Contract Validator | Contract and API schema definitions | SHA-256 validation |
295
- `
296
- );
297
-
298
- // Scaffold observability files
299
- const obsDir = path.join(frameworkDir, "observability");
300
- if (!fs.existsSync(obsDir)) fs.mkdirSync(obsDir, { recursive: true });
301
-
302
- // Add audit log
303
- const auditLogPath = path.join(obsDir, "audit_log.md");
304
- if (!fs.existsSync(auditLogPath)) {
305
- fs.writeFileSync(auditLogPath, "# šŸŽ–ļø Agent Enderun — Audit Log\n\n| Timestamp | Agent | Action | Trace ID | Status |\n|---|---|---|---|---|\n");
306
- }
307
-
308
- // Add metrics.json
309
- const metricsPath = path.join(obsDir, "metrics.json");
310
- if (!fs.existsSync(metricsPath)) {
311
- fs.writeFileSync(metricsPath, "[]");
312
- }
313
-
314
- // Scaffold rules
315
- const rulesDir = path.join(frameworkDir, "rules");
316
- if (!fs.existsSync(rulesDir)) fs.mkdirSync(rulesDir, { recursive: true });
317
- fs.writeFileSync(path.join(rulesDir, "global_rules.mdc"), `---
318
- description: Global Rules for Agent Enderun Army
319
- globs: **/*
320
- ---
321
-
322
- # šŸŽ–ļø Agent Enderun — Global Army Rules
323
-
324
- - **Traceability:** Prefix every commit and log with the active Trace ID.
325
- - **Surgical Edits:** Use \`replace_text\` or \`patch_file\` tools. Overwriting entire files is forbidden.
326
- - **Contract-First:** Verify types before implementation.
327
- - **Zero Mock:** Use real data contracts.
328
- - **any Forbidden:** Strictly use TypeScript types.
329
- `);
330
- }
331
-
332
67
  export async function initCommand(adapterName: string, options: { unified?: boolean, dryRun?: boolean, yes?: boolean }) {
333
68
  const adapterId = (adapterName || "gemini") as AdapterId;
334
69
  const adapter = resolveAdapter(adapterId);
@@ -348,7 +83,7 @@ export async function initCommand(adapterName: string, options: { unified?: bool
348
83
  const dryRun = options.dryRun || false;
349
84
  const forceYes = options.yes || false;
350
85
 
351
- UI.intent("Enderun Initialization", `Bootstrapping ${FRAMEWORK_NAME} (v${FRAMEWORK_VERSION}) with ${adapterId} adapter...`);
86
+ UI.intent("Enderun Initialization", `Bootstrapping ${FRAMEWORK_NAME} (v${getPackageVersion()}) with ${adapterId} adapter...`);
352
87
 
353
88
  let selectedDirs: string[];
354
89
  let selectedAgents: string[];
@@ -383,21 +118,15 @@ export async function initCommand(adapterName: string, options: { unified?: bool
383
118
  const skillsBaseDir = path.join(projectRoot, aiToolDir, "skills");
384
119
  scaffoldSkills(skillsBaseDir, dryRun);
385
120
 
386
- initializeMemory(projectRoot, dryRun);
121
+ initializeMemory(path.join(projectRoot, coreDir), dryRun);
387
122
  scaffoldFrameworkConfigs(projectRoot, coreDir, adapter, dryRun, selectedPalette);
388
-
389
- for (const [name, content] of Object.entries(SHIM_TEMPLATES)) {
390
- if (name.toLowerCase() === adapterId.split("-")[0] || name === adapterId) {
391
- const shimContent = remapFrameworkContent(content, coreDir, adapterId);
392
- const shimFileName = adapter.shimFile || `${name.toUpperCase()}.md`;
393
- if (!dryRun) fs.writeFileSync(path.join(projectRoot, shimFileName), shimContent);
394
- console.warn(`āœ… Platform shim created: ${shimFileName}`);
395
- }
396
- }
123
+ scaffoldStandards(path.join(projectRoot, coreDir), dryRun);
124
+ scaffoldOps(path.join(projectRoot, coreDir), dryRun);
125
+ scaffoldShims(projectRoot, coreDir, adapterId, adapter, dryRun);
397
126
 
398
127
  runAdapterPostInit(adapter, projectRoot);
399
128
 
400
- UI.success(`\nšŸš€ ${FRAMEWORK_NAME} initialized successfully!`);
129
+ UI.success(`\nšŸš€ ${FRAMEWORK_NAME} (v${getPackageVersion()}) initialized successfully!`);
401
130
  console.warn(`\n- Brain & Memory Hub (Protected): ${coreDir}/`);
402
131
  console.warn(`- AI Agent Commands (Active): ${aiToolDir}/`);
403
132
  console.warn("\nNext Steps:");
@@ -3,7 +3,9 @@ import path from "path";
3
3
 
4
4
  import { getFrameworkDir } from "../utils/memory.js";
5
5
 
6
- export function updateKnowledgeBaseCommand(topic: string, content: string) {
6
+ import { writeTextFile } from "../utils/fs.js";
7
+
8
+ export async function updateKnowledgeBaseCommand(topic: string, content: string) {
7
9
  if (!topic || !content) {
8
10
  console.error("āŒ Usage: agent-enderun update_knowledge_base <topic> <content>");
9
11
  return;
@@ -12,11 +14,11 @@ export function updateKnowledgeBaseCommand(topic: string, content: string) {
12
14
  const kbDir = path.join(frameworkDir, "knowledge");
13
15
  if (!fs.existsSync(kbDir)) fs.mkdirSync(kbDir, { recursive: true });
14
16
  const fileName = topic.replace(/[^a-z0-9]/gi, "_").toLowerCase() + ".md";
15
- fs.writeFileSync(path.join(kbDir, fileName), content);
17
+ writeTextFile(path.join(kbDir, fileName), content);
16
18
  console.warn(`āœ… Knowledge base updated: ${topic}`);
17
19
  }
18
20
 
19
- export function searchKnowledgeBaseCommand(query: string) {
21
+ export async function searchKnowledgeBaseCommand(query: string) {
20
22
  if (!query) {
21
23
  console.error("āŒ Usage: agent-enderun search_knowledge_base <query>");
22
24
  return;
@@ -2,13 +2,11 @@ import { execSync } from "child_process";
2
2
 
3
3
  import { getPackageVersion } from "../utils/pkg.js";
4
4
 
5
- const FRAMEWORK_VERSION = getPackageVersion();
6
-
7
5
  /**
8
6
  * Run ESLint for the project (same as npm run lint).
9
7
  */
10
- export function lintCommand(): void {
11
- console.warn(`šŸ” Running ESLint (v${FRAMEWORK_VERSION})...`);
8
+ export async function lintCommand(): Promise<void> {
9
+ console.warn(`šŸ” Running ESLint (v${getPackageVersion()})...`);
12
10
  const projectRoot = process.cwd();
13
11
  try {
14
12
  execSync("npm run lint", {
@@ -4,7 +4,9 @@ import path from "path";
4
4
  import { getFrameworkDir } from "../utils/memory.js";
5
5
  import { normalizeAgentName } from "../utils/string.js";
6
6
 
7
- export function logAgentActionCommand(data: { agent?: unknown; action?: string; requestId?: string; traceId?: string; status?: string; summary?: string; files?: string[]; details?: Record<string, unknown> }) {
7
+ import { writeJsonFile } from "../utils/fs.js";
8
+
9
+ export async function logAgentActionCommand(data: { agent?: unknown; action?: string; requestId?: string; traceId?: string; status?: string; summary?: string; files?: string[]; details?: Record<string, unknown> }) {
8
10
  const frameworkDir = getFrameworkDir();
9
11
  const logsDir = path.join(frameworkDir, "logs");
10
12
  if (!fs.existsSync(logsDir)) {
@@ -30,6 +32,6 @@ export function logAgentActionCommand(data: { agent?: unknown; action?: string;
30
32
  };
31
33
 
32
34
  logs.push(newEntry);
33
- fs.writeFileSync(logPath, JSON.stringify(logs, null, 2));
35
+ writeJsonFile(logPath, logs);
34
36
  console.warn(`āœ… Logged action to ${frameworkDir}/logs/${agent}.json`);
35
37
  }
@@ -1,6 +1,6 @@
1
1
  import { updateProjectMemory } from "../utils/memory.js";
2
2
 
3
- export function updateProjectMemoryCommand(section: string, content: string) {
3
+ export async function updateProjectMemoryCommand(section: string, content: string) {
4
4
  updateProjectMemory(section, content);
5
5
  }
6
6