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
@@ -0,0 +1,43 @@
1
+ import http from "http";
2
+ import { parseProjectMemory, readManagerLogs, listAgents } from "./data-service.js";
3
+ import { HTML_CONTENT } from "./html-template.js";
4
+
5
+ export function startDashboardServer(port: number = 5858) {
6
+ const server = http.createServer((req, res) => {
7
+ // API: Status
8
+ if (req.url === "/api/status") {
9
+ const mem = parseProjectMemory();
10
+ const logs = readManagerLogs();
11
+ res.writeHead(200, { "Content-Type": "application/json" });
12
+ res.end(JSON.stringify({ ...mem, logs }));
13
+ return;
14
+ }
15
+
16
+ // API: Agents list
17
+ if (req.url === "/api/agents") {
18
+ const list = listAgents();
19
+ res.writeHead(200, { "Content-Type": "application/json" });
20
+ res.end(JSON.stringify(list));
21
+ return;
22
+ }
23
+
24
+ // Static HTML Serve
25
+ if (req.url === "/" || req.url === "/index.html") {
26
+ res.writeHead(200, { "Content-Type": "text/html; charset=UTF-8" });
27
+ res.end(HTML_CONTENT);
28
+ return;
29
+ }
30
+
31
+ // Fallback 404
32
+ res.writeHead(404, { "Content-Type": "text/plain" });
33
+ res.end("Not Found");
34
+ });
35
+
36
+ server.listen(port, () => {
37
+ process.stdout.write("================================================================================\n");
38
+ process.stdout.write(`๐Ÿ–ฅ๏ธ AGENT ENDERUN LIVE MONITOR SERVED AT: http://localhost:${port}\n`);
39
+ process.stdout.write("================================================================================\n");
40
+ });
41
+
42
+ return server;
43
+ }
@@ -0,0 +1,11 @@
1
+ import { startDashboardServer } from "./dashboard/server.js";
2
+
3
+ /**
4
+ * Launch the Agent Enderun Visual Monitor.
5
+ */
6
+ export async function dashboardCommand(args: string[]) {
7
+ const portArg = args.find(a => a.startsWith("--port="));
8
+ const port = portArg ? parseInt(portArg.split("=")[1]) : 5858;
9
+
10
+ startDashboardServer(port);
11
+ }
@@ -5,7 +5,7 @@ import { collectFiles } from "../utils/fs.js";
5
5
 
6
6
  const targetDir = process.cwd();
7
7
 
8
- export function explorerGraphCommand(targetPath: string) {
8
+ export async function explorerGraphCommand(targetPath: string) {
9
9
  console.warn(`๐Ÿ—บ๏ธ Generating Dependency Graph for: ${targetPath}...`);
10
10
  const files = collectFiles(path.join(targetDir, targetPath), [".ts", ".tsx"]);
11
11
  const edges: string[] = [];
@@ -27,7 +27,7 @@ export function explorerGraphCommand(targetPath: string) {
27
27
  }
28
28
  }
29
29
 
30
- export function explorerAuditCommand(targetPath: string) {
30
+ export async function explorerAuditCommand(targetPath: string) {
31
31
  console.warn(`๐Ÿง  Codebase Intelligence Scan: ${targetPath}...`);
32
32
  const files = collectFiles(path.join(targetDir, targetPath), [".ts", ".tsx"]);
33
33
  const complexity: string[] = [];
@@ -2,7 +2,7 @@ import cp from "child_process";
2
2
  import path from "path";
3
3
  import { getConfiguredPaths } from "../utils/memory.js";
4
4
 
5
- export function gitCommitCommand(traceId: string) {
5
+ export async function gitCommitCommand(traceId: string) {
6
6
  try {
7
7
  const diff = cp.execSync("git diff --staged", { encoding: "utf8" });
8
8
  if (!diff) {
@@ -28,7 +28,7 @@ export function gitCommitCommand(traceId: string) {
28
28
  }
29
29
  }
30
30
 
31
- export function gitSyncCommand() {
31
+ export async function gitSyncCommand() {
32
32
  console.warn("๐Ÿ”„ Syncing with remote repository...");
33
33
  try {
34
34
  cp.execSync("git pull origin main --rebase", { stdio: "inherit" });
@@ -0,0 +1,71 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import {
4
+ remapFrameworkContent,
5
+ type AdapterConfig,
6
+ type AdapterId
7
+ } from "../../adapters/index.js";
8
+ import { SHIM_TEMPLATES } from "../../shims.js";
9
+ import { writeJsonFile, writeTextFile } from "../../utils/fs.js";
10
+ import { getPackageRoot, getPackageVersion } from "../../utils/pkg.js";
11
+ import { ALL_AGENTS } from "../../../modules/agents/definitions.js";
12
+
13
+ const FRAMEWORK_NAME = "Agent Enderun";
14
+
15
+ const COLOR_PALETTES = {
16
+ "Modern Blue": { primary: "#0ea5e9", secondary: "#64748b", accent: "#f43f5e" },
17
+ "Enterprise Slate": { primary: "#334155", secondary: "#94a3b8", accent: "#10b981" },
18
+ "Deep Purple": { primary: "#8b5cf6", secondary: "#d8b4fe", accent: "#f59e0b" }
19
+ };
20
+
21
+ export function scaffoldConstitution(targetDir: string, frameworkDir: string, adapterId: AdapterId, dryRun: boolean) {
22
+ if (dryRun) return;
23
+ let content = `# ๐ŸŽ–๏ธ ${FRAMEWORK_NAME} โ€” Constitution (v${getPackageVersion()})\n\nDiscipline and Order.`;
24
+ let readSuccess = false;
25
+ try {
26
+ const templatePath = path.join(getPackageRoot(), "ENDERUN.md");
27
+ if (fs.existsSync(templatePath)) {
28
+ content = fs.readFileSync(templatePath, "utf8");
29
+ readSuccess = true;
30
+ }
31
+ } catch (e) {
32
+ console.warn(`โš ๏ธ Failed to read global constitution template: ${e}`);
33
+ }
34
+ content = remapFrameworkContent(content, frameworkDir, adapterId);
35
+ const destPath = path.join(targetDir, frameworkDir, "ENDERUN.md");
36
+ writeTextFile(destPath, content);
37
+
38
+ console.warn(`โœ… Constitution file created inside: ${frameworkDir}/ENDERUN.md${readSuccess ? "" : " (default template)"}`);
39
+ }
40
+
41
+ export function scaffoldFrameworkConfigs(targetDir: string, fDir: string, adapter: AdapterConfig, dryRun: boolean, selectedPalette: string) {
42
+ if (dryRun) return;
43
+ const frameworkDir = path.join(targetDir, fDir);
44
+ const palette = COLOR_PALETTES[selectedPalette as keyof typeof COLOR_PALETTES] || COLOR_PALETTES["Modern Blue"];
45
+
46
+ const config = {
47
+ name: FRAMEWORK_NAME,
48
+ version: getPackageVersion(),
49
+ theme: {
50
+ palette: selectedPalette,
51
+ colors: palette
52
+ }
53
+ };
54
+ writeJsonFile(path.join(frameworkDir, "config.json"), config, dryRun);
55
+ let statusContent = "# ๐ŸŽ–๏ธ Status\n\n| Agent | State | Active Task | Last Updated | Notes | Extra | Backup |\n|---|---|---|---|---|---|---|\n";
56
+ for (const ag of ALL_AGENTS) {
57
+ statusContent += "| @" + ag.name + " | READY | Idle | - | - | - | - |\n";
58
+ }
59
+ writeTextFile(path.join(frameworkDir, "STATUS.md"), statusContent);
60
+ }
61
+
62
+ export function scaffoldShims(projectRoot: string, coreDir: string, adapterId: AdapterId, adapter: AdapterConfig, dryRun: boolean) {
63
+ for (const [name, content] of Object.entries(SHIM_TEMPLATES)) {
64
+ if (name.toLowerCase() === adapterId.split("-")[0] || name === adapterId) {
65
+ const shimContent = remapFrameworkContent(content, coreDir, adapterId);
66
+ const shimFileName = adapter.shimFile || `${name.toUpperCase()}.md`;
67
+ if (!dryRun) writeTextFile(path.join(projectRoot, shimFileName), shimContent);
68
+ console.warn(`โœ… Platform shim created: ${shimFileName}`);
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,86 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { writeJsonFile, writeTextFile } from "../../utils/fs.js";
4
+ import { getPackageRoot } from "../../utils/pkg.js";
5
+ import { logger } from "../../../shared/logger.js";
6
+
7
+ export function scaffoldOps(frameworkDir: string, dryRun: boolean) {
8
+ if (dryRun) return;
9
+
10
+ // Scaffold Prompt Recipes
11
+ const promptsPath = path.join(frameworkDir, "prompts");
12
+ if (!fs.existsSync(promptsPath)) fs.mkdirSync(promptsPath, { recursive: true });
13
+
14
+ const recipes = [
15
+ { file: "refactoring-recipe.md", template: "templates/prompts/refactoring-recipe.md" },
16
+ { file: "bug-fix-recipe.md", template: "templates/prompts/bug-fix-recipe.md" },
17
+ { file: "new-feature-recipe.md", template: "templates/prompts/new-feature-recipe.md" },
18
+ { file: "security-audit-recipe.md", template: "templates/prompts/security-audit-recipe.md" },
19
+ { file: "db-management-recipe.md", template: "templates/prompts/db-management-recipe.md" },
20
+ { file: "performance-optimization-recipe.md", template: "templates/prompts/performance-optimization-recipe.md" },
21
+ { file: "deployment-recipe.md", template: "templates/prompts/deployment-recipe.md" },
22
+ { file: "contract-design-recipe.md", template: "templates/prompts/contract-design-recipe.md" }
23
+ ];
24
+
25
+ for (const recipe of recipes) {
26
+ try {
27
+ const fullTemplatePath = path.join(getPackageRoot(), recipe.template);
28
+ if (fs.existsSync(fullTemplatePath)) {
29
+ const content = fs.readFileSync(fullTemplatePath, "utf8");
30
+ writeTextFile(path.join(promptsPath, recipe.file), content);
31
+ }
32
+ } catch (e) {
33
+ logger.debug(`Failed to scaffold prompt recipe: ${recipe.file}`, e);
34
+ }
35
+ }
36
+
37
+ // Scaffold cli-commands.json
38
+ const cliCommands = {
39
+ commands: {
40
+ init: { agent: "manager", description: "Initialize Agent Enderun structure and AI configuration." },
41
+ check: { agent: "quality", description: "Verify framework files and code quality discipline." },
42
+ status: { agent: "manager", description: "Show the current status of the active project phase." },
43
+ "trace:new": { agent: "manager", description: "Generate a new Trace ID to start a task sequence." },
44
+ orchestrate: { agent: "manager", description: "Execute the Hermes message broker loop." },
45
+ "verify-contract": { agent: "architect", description: "Validate type contracts between backend and frontend." },
46
+ "update-contract": { agent: "architect", description: "Update the contract signature hash." }
47
+ }
48
+ };
49
+ writeJsonFile(path.join(frameworkDir, "cli-commands.json"), cliCommands, dryRun);
50
+
51
+ // Scaffold BRAIN_DASHBOARD.md
52
+ writeTextFile(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");
53
+
54
+ // Scaffold router/routing_rules.md
55
+ const routerDir = path.join(frameworkDir, "router");
56
+ if (!fs.existsSync(routerDir)) fs.mkdirSync(routerDir, { recursive: true });
57
+ writeTextFile(path.join(routerDir, "routing_rules.md"), "# ๐Ÿ“ก Agent Enderun โ€” Natural Language & Event Router\n\nRouting engine protocols defined here.");
58
+
59
+ // Scaffold registry/agent_registry.md
60
+ const registryDir = path.join(frameworkDir, "registry");
61
+ if (!fs.existsSync(registryDir)) fs.mkdirSync(registryDir, { recursive: true });
62
+ writeTextFile(path.join(registryDir, "agent_registry.md"), "# ๐ŸŽ–๏ธ Agent Enderun โ€” Army Registry\n\nList of active agents.");
63
+
64
+ // Scaffold observability files
65
+ const obsDir = path.join(frameworkDir, "observability");
66
+ if (!fs.existsSync(obsDir)) fs.mkdirSync(obsDir, { recursive: true });
67
+ writeTextFile(path.join(obsDir, "audit_log.md"), "# ๐ŸŽ–๏ธ Agent Enderun โ€” Audit Log\n\n| Timestamp | Agent | Action | Trace ID | Status |\n|---|---|---|---|---|\n");
68
+ writeJsonFile(path.join(obsDir, "metrics.json"), []);
69
+
70
+ // Scaffold .env.example
71
+ const envExamplePath = path.join(process.cwd(), ".env.example");
72
+ if (!fs.existsSync(envExamplePath)) {
73
+ writeTextFile(envExamplePath, "# Agent Enderun - Environment Variables\n\n# Core Settings\nPORT=5858\nNODE_ENV=development\n\n# AI Platform Keys (Fill these in your local .env)\nGEMINI_API_KEY=\nCLAUDE_API_KEY=\nGROK_API_KEY=\n");
74
+ }
75
+
76
+ // Scaffold rules
77
+ const rulesDir = path.join(frameworkDir, "rules");
78
+ if (!fs.existsSync(rulesDir)) fs.mkdirSync(rulesDir, { recursive: true });
79
+ writeTextFile(path.join(rulesDir, "global_rules.mdc"), `---
80
+ description: Global Rules for Agent Enderun Army
81
+ globs: **/*
82
+ ---
83
+
84
+ # ๐ŸŽ–๏ธ Agent Enderun โ€” Global Army Rules
85
+ `);
86
+ }
@@ -0,0 +1,59 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { ensureDir, writeTextFile } from "../../utils/fs.js";
4
+ import { getPackageRoot } from "../../utils/pkg.js";
5
+ import { CORE_SKILLS } from "../../../modules/skills/definitions.js";
6
+
7
+ const FRAMEWORK_NAME = "Agent Enderun";
8
+
9
+ export function scaffoldSkills(skillsBaseDir: string, dryRun: boolean) {
10
+ if (dryRun) return;
11
+ ensureDir(skillsBaseDir, dryRun);
12
+ for (const [key, skill] of Object.entries(CORE_SKILLS)) {
13
+ const mdContent = `# ๐Ÿ› ๏ธ ${FRAMEWORK_NAME} Skill โ€” ${skill.name}\n\n${skill.description}\n\n## ๐Ÿ”Œ Associated Tools\n${skill.tools.map(t => `- \`${t}\``).join("\n")}\n\n## ๐Ÿ›ก๏ธ Core Mandates\n${skill.mandates.join("\n")}\n`;
14
+ writeTextFile(path.join(skillsBaseDir, `${key.toLowerCase()}.md`), mdContent);
15
+ }
16
+ }
17
+
18
+ export function scaffoldStandards(frameworkDir: string, dryRun: boolean) {
19
+ if (dryRun) return;
20
+ const knowledgePath = path.join(frameworkDir, "knowledge");
21
+ if (!fs.existsSync(knowledgePath)) fs.mkdirSync(knowledgePath, { recursive: true });
22
+
23
+ const eslintStandardsContent = `# ๐ŸŽ–๏ธ Agent Enderun โ€” ESLint Standards
24
+
25
+ This document outlines the strict ESLint coding standards for Agent Enderun projects.
26
+
27
+ ## ๐Ÿ“ Core Rules
28
+ - **Indentation:** 4 spaces (strict).
29
+ - **Quotes:** Double quotes (\`"\`) for strings.
30
+ - **Semicolons:** Always terminate statements with a semicolon (\`;\`).
31
+ - **No Explicit Any:** Avoid using \`any\`. Use strongly typed interfaces, generics, or \`unknown\` with type assertions.
32
+ - **Unused Variables:** Warning on unused variables unless prefixed with an underscore (\`_\`).
33
+ `;
34
+ writeTextFile(path.join(knowledgePath, "eslint-standards.md"), eslintStandardsContent);
35
+
36
+ const standards = [
37
+ { file: "crud-governance.md", template: "templates/standards/crud-governance.md", default: "# ๐Ÿ›๏ธ Corporate CRUD and Governance Standards" },
38
+ { file: "architecture-standards.md", template: "templates/standards/architecture-standards.md", default: "# ๐Ÿ“ Corporate Architecture Standards" },
39
+ { file: "frontend-standards.md", template: "templates/standards/frontend-standards.md", default: "# ๐ŸŽจ Corporate Frontend Standards" },
40
+ { file: "tailwind-standards.md", template: "templates/standards/tailwind-standards.md", default: "# ๐ŸŒŠ Corporate Tailwind Standards" },
41
+ { file: "mobile-standards.md", template: "templates/standards/mobile-standards.md", default: "# ๐Ÿ“ฑ Corporate Mobile Standards" },
42
+ { file: "security-standards.md", template: "templates/standards/security-standards.md", default: "# ๐Ÿ›ก๏ธ Corporate Security Standards" },
43
+ { file: "quality-standards.md", template: "templates/standards/quality-standards.md", default: "# โš–๏ธ Corporate Code Quality Standards" },
44
+ { file: "logging-and-secrets.md", template: "templates/standards/logging-and-secrets.md", default: "# ๐Ÿชต Corporate Logging Standards" },
45
+ { file: "testing-standards.md", template: "templates/standards/testing-standards.md", default: "# ๐Ÿงช Corporate Testing Standards" },
46
+ { file: "i18n-standards.md", template: "templates/standards/i18n-standards.md", default: "# ๐ŸŒ Corporate i18n Standards" }
47
+ ];
48
+
49
+ for (const std of standards) {
50
+ let content = std.default;
51
+ try {
52
+ const fullTemplatePath = path.join(getPackageRoot(), std.template);
53
+ if (fs.existsSync(fullTemplatePath)) {
54
+ content = fs.readFileSync(fullTemplatePath, "utf8");
55
+ }
56
+ } catch { /* fallback to default */ }
57
+ writeTextFile(path.join(knowledgePath, std.file), content);
58
+ }
59
+ }