agent-enderun 1.1.6 → 1.1.8
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.
- package/ENDERUN.md +12 -9
- package/README.md +12 -29
- package/bin/run-multi-test.js +77 -0
- package/dist/framework-mcp/src/tools/dashboard/start_dashboard.d.ts +5 -0
- package/dist/framework-mcp/src/tools/dashboard/start_dashboard.js +30 -0
- package/dist/framework-mcp/src/tools/dashboard/start_dashboard.js.map +1 -0
- package/dist/framework-mcp/src/tools/definitions.js +118 -0
- package/dist/framework-mcp/src/tools/definitions.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.d.ts +5 -0
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js +51 -0
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js.map +1 -0
- package/dist/framework-mcp/src/tools/file_system/replace_text.js +8 -4
- package/dist/framework-mcp/src/tools/file_system/replace_text.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/write_file.js +3 -0
- package/dist/framework-mcp/src/tools/file_system/write_file.js.map +1 -1
- package/dist/framework-mcp/src/tools/framework/audit_deps.d.ts +6 -0
- package/dist/framework-mcp/src/tools/framework/audit_deps.js +42 -0
- package/dist/framework-mcp/src/tools/framework/audit_deps.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/run_tests.d.ts +5 -0
- package/dist/framework-mcp/src/tools/framework/run_tests.js +26 -0
- package/dist/framework-mcp/src/tools/framework/run_tests.js.map +1 -0
- package/dist/framework-mcp/src/tools/index.js +24 -0
- package/dist/framework-mcp/src/tools/index.js.map +1 -1
- package/dist/framework-mcp/src/tools/memory/get_insights.d.ts +6 -0
- package/dist/framework-mcp/src/tools/memory/get_insights.js +35 -0
- package/dist/framework-mcp/src/tools/memory/get_insights.js.map +1 -0
- package/dist/framework-mcp/src/tools/memory/read_memory.d.ts +6 -0
- package/dist/framework-mcp/src/tools/memory/read_memory.js +29 -0
- package/dist/framework-mcp/src/tools/memory/read_memory.js.map +1 -0
- package/dist/framework-mcp/src/tools/messaging/send_message.js +1 -1
- package/dist/framework-mcp/src/tools/messaging/send_message.js.map +1 -1
- package/dist/framework-mcp/src/tools/observability/check_ports.d.ts +5 -0
- package/dist/framework-mcp/src/tools/observability/check_ports.js +27 -0
- package/dist/framework-mcp/src/tools/observability/check_ports.js.map +1 -0
- package/dist/framework-mcp/src/tools/observability/get_health.d.ts +5 -0
- package/dist/framework-mcp/src/tools/observability/get_health.js +20 -0
- package/dist/framework-mcp/src/tools/observability/get_health.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/get_gaps.d.ts +6 -0
- package/dist/framework-mcp/src/tools/search/get_gaps.js +49 -0
- package/dist/framework-mcp/src/tools/search/get_gaps.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/get_map.d.ts +6 -0
- package/dist/framework-mcp/src/tools/search/get_map.js +44 -0
- package/dist/framework-mcp/src/tools/search/get_map.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/grep_search.d.ts +5 -0
- package/dist/framework-mcp/src/tools/search/grep_search.js +60 -0
- package/dist/framework-mcp/src/tools/search/grep_search.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/list_dir.d.ts +5 -0
- package/dist/framework-mcp/src/tools/search/list_dir.js +29 -0
- package/dist/framework-mcp/src/tools/search/list_dir.js.map +1 -0
- package/dist/framework-mcp/src/tools/types.d.ts +10 -5
- package/dist/framework-mcp/src/utils/compliance.d.ts +5 -0
- package/dist/framework-mcp/src/utils/compliance.js +30 -0
- package/dist/framework-mcp/src/utils/compliance.js.map +1 -0
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js +5 -5
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js.map +1 -1
- package/dist/src/cli/adapters/types.d.ts +2 -2
- package/dist/src/cli/adapters.d.ts +3 -3
- package/dist/src/cli/adapters.js +53 -79
- package/dist/src/cli/adapters.js.map +1 -1
- package/dist/src/cli/commands/check.js +52 -6
- package/dist/src/cli/commands/check.js.map +1 -1
- package/dist/src/cli/commands/init.d.ts +5 -1
- package/dist/src/cli/commands/init.js +186 -172
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/orchestrate.d.ts +3 -3
- package/dist/src/cli/commands/orchestrate.js +14 -8
- package/dist/src/cli/commands/orchestrate.js.map +1 -1
- package/dist/src/cli/commands/status.js +3 -2
- package/dist/src/cli/commands/status.js.map +1 -1
- package/dist/src/cli/index.js +4 -3
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/shims.js +6 -6
- package/dist/src/cli/utils/app-backend.d.ts +2 -0
- package/dist/src/cli/utils/app-backend.js +236 -0
- package/dist/src/cli/utils/app-backend.js.map +1 -0
- package/dist/src/cli/utils/app-docs.d.ts +3 -0
- package/dist/src/cli/utils/app-docs.js +59 -0
- package/dist/src/cli/utils/app-docs.js.map +1 -0
- package/dist/src/cli/utils/app-frontend.d.ts +2 -0
- package/dist/src/cli/utils/app-frontend.js +248 -0
- package/dist/src/cli/utils/app-frontend.js.map +1 -0
- package/dist/src/cli/utils/app-inferrer.d.ts +14 -0
- package/dist/src/cli/utils/app-inferrer.js +39 -0
- package/dist/src/cli/utils/app-inferrer.js.map +1 -0
- package/dist/src/cli/utils/app-types.d.ts +3 -0
- package/dist/src/cli/utils/app-types.js +233 -0
- package/dist/src/cli/utils/app-types.js.map +1 -0
- package/dist/src/cli/utils/app.d.ts +5 -32
- package/dist/src/cli/utils/app.js +5 -794
- package/dist/src/cli/utils/app.js.map +1 -1
- package/dist/src/cli/utils/memory.js +8 -4
- package/dist/src/cli/utils/memory.js.map +1 -1
- package/dist/src/modules/adapters/antigravity-cli.js +3 -3
- package/dist/src/modules/adapters/antigravity-cli.js.map +1 -1
- package/dist/src/modules/adapters/claude.js +1 -1
- package/dist/src/modules/adapters/claude.js.map +1 -1
- package/dist/src/modules/adapters/codex.js +2 -2
- package/dist/src/modules/adapters/codex.js.map +1 -1
- package/dist/src/modules/adapters/cursor.js +1 -1
- package/dist/src/modules/adapters/cursor.js.map +1 -1
- package/dist/src/modules/adapters/definitions.d.ts +9 -0
- package/dist/src/modules/adapters/definitions.js +124 -0
- package/dist/src/modules/adapters/definitions.js.map +1 -0
- package/dist/src/modules/adapters/gemini.js +2 -2
- package/dist/src/modules/adapters/gemini.js.map +1 -1
- package/dist/src/modules/adapters/grok.js +1 -1
- package/dist/src/modules/adapters/grok.js.map +1 -1
- package/dist/src/modules/agents/definitions.js +26 -27
- package/dist/src/modules/agents/definitions.js.map +1 -1
- package/dist/src/shared/config.d.ts +3 -3
- package/dist/src/shared/logger.js +8 -5
- package/dist/src/shared/logger.js.map +1 -1
- package/dist/tests/adapter.test.d.ts +1 -0
- package/dist/tests/adapter.test.js +128 -0
- package/dist/tests/adapter.test.js.map +1 -0
- package/dist/tests/agents-definitions.test.d.ts +1 -0
- package/dist/tests/agents-definitions.test.js +54 -0
- package/dist/tests/agents-definitions.test.js.map +1 -0
- package/dist/tests/approve.test.d.ts +1 -0
- package/dist/tests/approve.test.js +88 -0
- package/dist/tests/approve.test.js.map +1 -0
- package/dist/tests/config.test.d.ts +1 -0
- package/dist/tests/config.test.js +58 -0
- package/dist/tests/config.test.js.map +1 -0
- package/dist/tests/container.runner.d.ts +1 -0
- package/dist/tests/container.runner.js +68 -0
- package/dist/tests/container.runner.js.map +1 -0
- package/dist/tests/container.test.d.ts +1 -0
- package/dist/tests/container.test.js +73 -0
- package/dist/tests/container.test.js.map +1 -0
- package/dist/tests/errors.test.d.ts +1 -0
- package/dist/tests/errors.test.js +64 -0
- package/dist/tests/errors.test.js.map +1 -0
- package/dist/tests/fs-utils.test.d.ts +1 -0
- package/dist/tests/fs-utils.test.js +101 -0
- package/dist/tests/fs-utils.test.js.map +1 -0
- package/dist/tests/logger.test.d.ts +1 -0
- package/dist/tests/logger.test.js +81 -0
- package/dist/tests/logger.test.js.map +1 -0
- package/dist/tests/memory-utils.test.d.ts +1 -0
- package/dist/tests/memory-utils.test.js +173 -0
- package/dist/tests/memory-utils.test.js.map +1 -0
- package/dist/tests/orchestrate.test.d.ts +1 -0
- package/dist/tests/orchestrate.test.js +131 -0
- package/dist/tests/orchestrate.test.js.map +1 -0
- package/dist/tests/skills-definitions.test.d.ts +1 -0
- package/dist/tests/skills-definitions.test.js +34 -0
- package/dist/tests/skills-definitions.test.js.map +1 -0
- package/dist/tests/status.test.d.ts +1 -0
- package/dist/tests/status.test.js +105 -0
- package/dist/tests/status.test.js.map +1 -0
- package/dist/tests/string.test.d.ts +1 -0
- package/dist/tests/string.test.js +89 -0
- package/dist/tests/string.test.js.map +1 -0
- package/dist/tests/time.test.d.ts +1 -0
- package/dist/tests/time.test.js +48 -0
- package/dist/tests/time.test.js.map +1 -0
- package/dist/tests/trace.test.d.ts +1 -0
- package/dist/tests/trace.test.js +61 -0
- package/dist/tests/trace.test.js.map +1 -0
- package/dist/vitest.config.js +1 -0
- package/dist/vitest.config.js.map +1 -1
- package/docs/getting-started.md +4 -0
- package/docs/user/corporate-governance.md +25 -0
- package/eslint.config.js +25 -3
- package/framework-mcp/dist/tools/dashboard/start_dashboard.js +29 -0
- package/framework-mcp/dist/tools/definitions.js +118 -0
- package/framework-mcp/dist/tools/file_system/batch_surgical_edit.js +50 -0
- package/framework-mcp/dist/tools/file_system/replace_text.js +8 -4
- package/framework-mcp/dist/tools/file_system/write_file.js +3 -0
- package/framework-mcp/dist/tools/framework/audit_deps.js +41 -0
- package/framework-mcp/dist/tools/framework/run_tests.js +25 -0
- package/framework-mcp/dist/tools/index.js +24 -0
- package/framework-mcp/dist/tools/memory/get_insights.js +34 -0
- package/framework-mcp/dist/tools/memory/read_memory.js +28 -0
- package/framework-mcp/dist/tools/messaging/send_message.js +1 -1
- package/framework-mcp/dist/tools/observability/check_ports.js +26 -0
- package/framework-mcp/dist/tools/observability/get_health.js +19 -0
- package/framework-mcp/dist/tools/search/get_gaps.js +48 -0
- package/framework-mcp/dist/tools/search/get_map.js +43 -0
- package/framework-mcp/dist/tools/search/grep_search.js +59 -0
- package/framework-mcp/dist/tools/search/list_dir.js +28 -0
- package/framework-mcp/dist/utils/compliance.js +29 -0
- package/framework-mcp/package.json +2 -2
- package/framework-mcp/src/tools/dashboard/start_dashboard.ts +33 -0
- package/framework-mcp/src/tools/definitions.ts +118 -0
- package/framework-mcp/src/tools/file_system/batch_surgical_edit.ts +70 -0
- package/framework-mcp/src/tools/file_system/replace_text.ts +10 -4
- package/framework-mcp/src/tools/file_system/write_file.ts +5 -0
- package/framework-mcp/src/tools/framework/audit_deps.ts +49 -0
- package/framework-mcp/src/tools/framework/run_tests.ts +28 -0
- package/framework-mcp/src/tools/index.ts +24 -0
- package/framework-mcp/src/tools/memory/get_insights.ts +41 -0
- package/framework-mcp/src/tools/memory/read_memory.ts +31 -0
- package/framework-mcp/src/tools/messaging/send_message.ts +1 -1
- package/framework-mcp/src/tools/observability/check_ports.ts +30 -0
- package/framework-mcp/src/tools/observability/get_health.ts +24 -0
- package/framework-mcp/src/tools/search/get_gaps.ts +54 -0
- package/framework-mcp/src/tools/search/get_map.ts +48 -0
- package/framework-mcp/src/tools/search/grep_search.ts +65 -0
- package/framework-mcp/src/tools/search/list_dir.ts +34 -0
- package/framework-mcp/src/tools/types.ts +11 -1
- package/framework-mcp/src/utils/compliance.ts +37 -0
- package/framework-mcp/tests/tools/messaging/send_message.test.ts +5 -5
- package/package.json +3 -3
- package/src/cli/adapters/types.ts +2 -2
- package/src/cli/adapters.ts +57 -86
- package/src/cli/commands/check.ts +52 -6
- package/src/cli/commands/init.ts +202 -193
- package/src/cli/commands/orchestrate.ts +14 -8
- package/src/cli/commands/status.ts +3 -2
- package/src/cli/index.ts +4 -3
- package/src/cli/shims.ts +6 -6
- package/src/cli/utils/app-backend.ts +249 -0
- package/src/cli/utils/app-docs.ts +65 -0
- package/src/cli/utils/app-frontend.ts +257 -0
- package/src/cli/utils/app-inferrer.ts +53 -0
- package/src/cli/utils/app-types.ts +243 -0
- package/src/cli/utils/app.ts +5 -849
- package/src/cli/utils/memory.ts +8 -4
- package/src/modules/adapters/definitions.ts +125 -0
- package/src/modules/agents/definitions.ts +26 -27
- package/src/shared/logger.ts +8 -5
- package/templates/prompts/bug-fix-recipe.md +20 -0
- package/templates/prompts/new-feature-recipe.md +19 -0
- package/templates/prompts/refactoring-recipe.md +21 -0
- package/templates/standards/architecture-standards.md +23 -0
- package/templates/standards/crud-governance.md +21 -0
- package/templates/standards/frontend-standards.md +38 -0
- package/templates/standards/i18n-standards.md +17 -0
- package/templates/standards/logging-and-secrets.md +29 -0
- package/templates/standards/mobile-standards.md +24 -0
- package/templates/standards/quality-standards.md +31 -0
- package/templates/standards/security-standards.md +21 -0
- package/templates/standards/tailwind-standards.md +20 -0
- package/templates/standards/testing-standards.md +31 -0
- package/src/modules/adapters/antigravity-cli.ts +0 -25
- package/src/modules/adapters/claude.ts +0 -36
- package/src/modules/adapters/codex.ts +0 -22
- package/src/modules/adapters/cursor.ts +0 -22
- package/src/modules/adapters/gemini.ts +0 -27
- package/src/modules/adapters/grok.ts +0 -20
- package/templates/architecture/agents-manifest.md +0 -79
- package/templates/architecture/approval-flows.md +0 -61
- package/templates/architecture/enterprise-architecture.md +0 -69
- package/templates/architecture/standards/crud-governance.md +0 -46
- package/templates/architecture/standards/data-fetching-patterns.md +0 -13
- package/templates/architecture/standards/design-system.md +0 -31
- package/templates/architecture/standards/documentation-ownership.md +0 -21
- package/templates/architecture/standards/logging.md +0 -7
- package/templates/architecture/standards/mobile-standards.md +0 -48
- package/templates/architecture/standards/tech-stack.md +0 -9
- package/templates/backend/error-handling.md +0 -74
- package/templates/frontend/component-patterns.md +0 -91
|
@@ -5,6 +5,7 @@ import { execSync } from "child_process";
|
|
|
5
5
|
import { getFrameworkDir, getMemoryPath, getConfiguredPaths } from "../utils/memory.js";
|
|
6
6
|
import { getPackageVersion, getValidatorPath } from "../utils/pkg.js";
|
|
7
7
|
import { UI } from "../utils/ui.js";
|
|
8
|
+
import { logger } from "../../shared/logger.js";
|
|
8
9
|
|
|
9
10
|
const FRAMEWORK_VERSION = getPackageVersion();
|
|
10
11
|
|
|
@@ -40,8 +41,8 @@ export function checkCommand() {
|
|
|
40
41
|
isFrameworkDevelopment = true;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
} catch {
|
|
44
|
-
|
|
44
|
+
} catch (err) {
|
|
45
|
+
logger.debug("Failed to read package.json in checkCommand", err);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
const checks = [
|
|
@@ -53,6 +54,17 @@ export function checkCommand() {
|
|
|
53
54
|
{ name: "MCP Config (mcp.json)", path: "mcp.json" },
|
|
54
55
|
{ name: "ESLint Config (eslint.config.js)", path: "eslint.config.js", optional: !isFrameworkDevelopment },
|
|
55
56
|
{ name: "ESLint Standards", path: path.join(frameworkDir, `${knowledgeDir}/eslint-standards.md`) },
|
|
57
|
+
{ name: "CRUD Governance Standards", path: path.join(frameworkDir, `${knowledgeDir}/crud-governance.md`) },
|
|
58
|
+
{ name: "Architecture Standards", path: path.join(frameworkDir, `${knowledgeDir}/architecture-standards.md`) },
|
|
59
|
+
{ name: "Frontend Standards", path: path.join(frameworkDir, `${knowledgeDir}/frontend-standards.md`) },
|
|
60
|
+
{ name: "Tailwind Standards", path: path.join(frameworkDir, `${knowledgeDir}/tailwind-standards.md`), optional: true },
|
|
61
|
+
{ name: "Mobile Standards", path: path.join(frameworkDir, `${knowledgeDir}/mobile-standards.md`) },
|
|
62
|
+
{ name: "Security Standards", path: path.join(frameworkDir, `${knowledgeDir}/security-standards.md`) },
|
|
63
|
+
{ name: "Quality & Discipline Standards", path: path.join(frameworkDir, `${knowledgeDir}/quality-standards.md`) },
|
|
64
|
+
{ name: "Logging & Secrets Standards", path: path.join(frameworkDir, `${knowledgeDir}/logging-and-secrets.md`) },
|
|
65
|
+
{ name: "Testing Standards", path: path.join(frameworkDir, `${knowledgeDir}/testing-standards.md`) },
|
|
66
|
+
{ name: "i18n Standards", path: path.join(frameworkDir, `${knowledgeDir}/i18n-standards.md`) },
|
|
67
|
+
{ name: ".env.example", path: ".env.example" },
|
|
56
68
|
...(isFrameworkDevelopment ? [{ name: "MCP Server", path: "framework-mcp/package.json" }] : []),
|
|
57
69
|
{ name: "Panda CSS Config", path: appPandaPath, optional: true },
|
|
58
70
|
{ name: "Brain Dashboard", path: path.join(frameworkDir, "BRAIN_DASHBOARD.md") },
|
|
@@ -95,6 +107,14 @@ export function checkCommand() {
|
|
|
95
107
|
UI.success("No forbidden 'console.log' detected.");
|
|
96
108
|
}
|
|
97
109
|
|
|
110
|
+
const anyUsageIssues = checkAnyUsage();
|
|
111
|
+
if (anyUsageIssues.length > 0) {
|
|
112
|
+
UI.error(`Forbidden 'any' type usage found in ${anyUsageIssues.length} locations.`);
|
|
113
|
+
issues++;
|
|
114
|
+
} else {
|
|
115
|
+
UI.success("No forbidden 'any' type usage detected.");
|
|
116
|
+
}
|
|
117
|
+
|
|
98
118
|
const rootTestFiles = checkRootTestFiles();
|
|
99
119
|
if (rootTestFiles.length > 0) {
|
|
100
120
|
UI.warning(`Test files found in the root directory: ${rootTestFiles.join(", ")}. It is recommended to place all test files under the 'tests/' folder or application-specific directories.`);
|
|
@@ -103,8 +123,9 @@ export function checkCommand() {
|
|
|
103
123
|
try {
|
|
104
124
|
execSync("npx tsc --noEmit", { stdio: "pipe" });
|
|
105
125
|
UI.success("TypeScript type check PASSED.");
|
|
106
|
-
} catch {
|
|
126
|
+
} catch (err) {
|
|
107
127
|
UI.error("TypeScript type check FAILED.");
|
|
128
|
+
logger.debug("npx tsc --noEmit check failed", err);
|
|
108
129
|
issues++;
|
|
109
130
|
}
|
|
110
131
|
|
|
@@ -146,8 +167,9 @@ export function checkCommand() {
|
|
|
146
167
|
} else {
|
|
147
168
|
console.warn("\n📊 Token Consumption Report: No token usage logged yet.");
|
|
148
169
|
}
|
|
149
|
-
} catch {
|
|
170
|
+
} catch (err) {
|
|
150
171
|
console.warn("\n📊 Token Consumption Report: Could not read or parse metrics file.");
|
|
172
|
+
logger.debug("Failed to read or parse metrics.json in checkCommand", err);
|
|
151
173
|
}
|
|
152
174
|
} else {
|
|
153
175
|
console.warn("\n📊 Token Consumption Report: No token usage logged yet.");
|
|
@@ -184,6 +206,30 @@ function checkConsoleLogs(): string[] {
|
|
|
184
206
|
return issues;
|
|
185
207
|
}
|
|
186
208
|
|
|
209
|
+
function checkAnyUsage(): string[] {
|
|
210
|
+
const issues: string[] = [];
|
|
211
|
+
const srcDir = path.join(process.cwd(), "src");
|
|
212
|
+
if (!fs.existsSync(srcDir)) return [];
|
|
213
|
+
|
|
214
|
+
const walk = (dir: string) => {
|
|
215
|
+
const files = fs.readdirSync(dir);
|
|
216
|
+
for (const file of files) {
|
|
217
|
+
const fullPath = path.join(dir, file);
|
|
218
|
+
if (fs.statSync(fullPath).isDirectory()) walk(fullPath);
|
|
219
|
+
else if (file.endsWith(".ts") && !file.includes(".test.")) {
|
|
220
|
+
const content = fs.readFileSync(fullPath, "utf8");
|
|
221
|
+
// Match ": any", "<any>", "as any" but try to avoid false positives in comments if possible
|
|
222
|
+
const anyRegex = /[:<]\s*any\b|\bas\s+any\b/g;
|
|
223
|
+
if (anyRegex.test(content) && !fullPath.includes("check.ts") && !fullPath.includes("definitions.ts")) {
|
|
224
|
+
issues.push(fullPath);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
walk(srcDir);
|
|
230
|
+
return issues;
|
|
231
|
+
}
|
|
232
|
+
|
|
187
233
|
function checkRootTestFiles(): string[] {
|
|
188
234
|
const rootDir = process.cwd();
|
|
189
235
|
if (!fs.existsSync(rootDir)) return [];
|
|
@@ -197,8 +243,8 @@ function checkRootTestFiles(): string[] {
|
|
|
197
243
|
testFiles.push(file);
|
|
198
244
|
}
|
|
199
245
|
}
|
|
200
|
-
} catch {
|
|
201
|
-
|
|
246
|
+
} catch (err) {
|
|
247
|
+
logger.debug(`Failed to stat file ${fullPath} in checkRootTestFiles`, err);
|
|
202
248
|
}
|
|
203
249
|
}
|
|
204
250
|
return testFiles;
|
package/src/cli/commands/init.ts
CHANGED
|
@@ -2,20 +2,23 @@ import fs from "fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import readline from "readline";
|
|
4
4
|
|
|
5
|
+
import { logger } from "../../shared/logger.js";
|
|
5
6
|
import {
|
|
7
|
+
remapFrameworkContent,
|
|
6
8
|
resolveAdapter,
|
|
7
9
|
runAdapterPostInit,
|
|
8
|
-
|
|
10
|
+
scaffoldAgents,
|
|
9
11
|
type AdapterConfig,
|
|
10
12
|
type AdapterId,
|
|
11
13
|
} from "../adapters.js";
|
|
12
|
-
import { getPackageRoot, getPackageVersion } from "../utils/pkg.js";
|
|
13
|
-
import { ensureDir, writeJsonFile } from "../utils/fs.js";
|
|
14
|
-
import { initializeMemory, getConfiguredPaths } from "../utils/memory.js";
|
|
15
14
|
import { SHIM_TEMPLATES } from "../shims.js";
|
|
15
|
+
import { ensureDir, writeJsonFile } from "../utils/fs.js";
|
|
16
|
+
import { initializeMemory } from "../utils/memory.js";
|
|
17
|
+
import { getPackageRoot, getPackageVersion } from "../utils/pkg.js";
|
|
18
|
+
import { UI } from "../utils/ui.js";
|
|
16
19
|
|
|
17
20
|
// Import Modular Definitions
|
|
18
|
-
import { ALL_AGENTS
|
|
21
|
+
import { ALL_AGENTS } from "../../modules/agents/definitions.js";
|
|
19
22
|
import { CORE_SKILLS } from "../../modules/skills/definitions.js";
|
|
20
23
|
|
|
21
24
|
|
|
@@ -26,6 +29,7 @@ const FRAMEWORK_SUBDIRS = [
|
|
|
26
29
|
"agents",
|
|
27
30
|
"skills",
|
|
28
31
|
"knowledge",
|
|
32
|
+
"prompts",
|
|
29
33
|
"memory",
|
|
30
34
|
"router",
|
|
31
35
|
"registry",
|
|
@@ -80,54 +84,11 @@ function scaffoldConstitution(targetDir: string, frameworkDir: string, adapterId
|
|
|
80
84
|
console.warn(`⚠️ Failed to read global constitution template: ${e}`);
|
|
81
85
|
}
|
|
82
86
|
content = remapFrameworkContent(content, frameworkDir, adapterId);
|
|
83
|
-
fs.writeFileSync(path.join(targetDir, "ENDERUN.md"), content);
|
|
84
|
-
console.warn(`✅ Constitution file created: ENDERUN.md${readSuccess ? "" : " (default template)"}`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function scaffoldCoreAgents(agentsToScaffold: string[], agentsBaseDir: string, adapterId: string, dryRun: boolean) {
|
|
88
|
-
if (dryRun) return;
|
|
89
|
-
ensureDir(agentsBaseDir, dryRun);
|
|
90
|
-
|
|
91
|
-
for (const name of agentsToScaffold) {
|
|
92
|
-
const ag = ALL_AGENTS.find(a => a.name === name);
|
|
93
|
-
if (!ag) continue;
|
|
94
|
-
|
|
95
|
-
// AGY standard requires nested folders: agents/{name}/agent.md (or .json)
|
|
96
|
-
const isNestedAdapter = adapterId === "antigravity-cli";
|
|
97
|
-
const agentDir = isNestedAdapter ? path.join(agentsBaseDir, name) : agentsBaseDir;
|
|
98
|
-
const agentFileName = isNestedAdapter ? "agent.md" : `${ag.name}.md`;
|
|
99
|
-
|
|
100
|
-
if (isNestedAdapter) ensureDir(agentDir, dryRun);
|
|
101
|
-
|
|
102
|
-
if (isNestedAdapter) {
|
|
103
|
-
if (!dryRun) {
|
|
104
|
-
const jsonContent = buildAgentJson(ag);
|
|
105
|
-
fs.writeFileSync(path.join(agentDir, "agent.json"), jsonContent);
|
|
106
|
-
}
|
|
107
|
-
} else {
|
|
108
|
-
const mdContent = `---
|
|
109
|
-
name: "${ag.name}"
|
|
110
|
-
description: "${ag.description}"
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
<!-- capability: ${ag.capability} -->
|
|
114
|
-
<!-- tags: [${ag.tags.map(t => `"${t}"`).join(", ")}] -->
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
# 🎖️ ${FRAMEWORK_NAME} — @${ag.name} (${ag.displayName})
|
|
118
|
-
|
|
119
|
-
## 🤖 Talimatlar (Instructions)
|
|
120
|
-
${ag.instructions}
|
|
121
87
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (!dryRun) {
|
|
127
|
-
fs.writeFileSync(path.join(agentDir, agentFileName), mdContent);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
88
|
+
// Write ONLY to the framework directory (e.g. .gemini/ENDERUN.md)
|
|
89
|
+
const destPath = path.join(targetDir, frameworkDir, "ENDERUN.md");
|
|
90
|
+
fs.writeFileSync(destPath, content);
|
|
91
|
+
console.warn(`✅ Constitution file created inside: ${frameworkDir}/ENDERUN.md${readSuccess ? "" : " (default template)"}`);
|
|
131
92
|
}
|
|
132
93
|
|
|
133
94
|
function scaffoldSkills(skillsBaseDir: string, dryRun: boolean) {
|
|
@@ -185,7 +146,97 @@ This document outlines the strict ESLint coding standards for Agent Enderun proj
|
|
|
185
146
|
const knowledgePath = path.join(frameworkDir, knowledgeDir);
|
|
186
147
|
if (!fs.existsSync(knowledgePath)) fs.mkdirSync(knowledgePath, { recursive: true });
|
|
187
148
|
fs.writeFileSync(path.join(knowledgePath, "eslint-standards.md"), eslintStandardsContent);
|
|
188
|
-
|
|
149
|
+
|
|
150
|
+
// Scaffold Corporate Standards (CRUD & Architecture)
|
|
151
|
+
const standards = [
|
|
152
|
+
{
|
|
153
|
+
file: "crud-governance.md",
|
|
154
|
+
template: "templates/standards/crud-governance.md",
|
|
155
|
+
default: "# 🏛️ Kurumsal CRUD ve Yönetişim Standartları\n\n1. **Yüksek Riskli İşlemler:** @manager onayı gerektirir.\n2. **Branded Types:** Zorunludur.\n3. **Kysely:** Ham SQL yasaktır."
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
file: "architecture-standards.md",
|
|
159
|
+
template: "templates/standards/architecture-standards.md",
|
|
160
|
+
default: "# 📐 Kurumsal Mimari Standartları\n\n1. **Layered Architecture:** Route -> Service -> Repository.\n2. **Zero Mock:** Gerçek veri/kontrat kullanımı zorunludur.\n3. **any Forbidden:** TypeScript disiplini."
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
file: "frontend-standards.md",
|
|
164
|
+
template: "templates/standards/frontend-standards.md",
|
|
165
|
+
default: "# 🎨 Kurumsal Frontend Standartları\n\n1. **Style Discipline:** Tip güvenli veya utility-first sistemler tercih edilir.\n2. **Responsive-First:** Mobil-ilk tasarım zorunludur.\n3. **WCAG AA:** Erişilebilirlik standarttır."
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
file: "tailwind-standards.md",
|
|
169
|
+
template: "templates/standards/tailwind-standards.md",
|
|
170
|
+
default: "# 🌊 Kurumsal Tailwind Standartları\n\n1. **No Arbitrary Values:** h-[10px] yasaktır.\n2. **Mobile-First:** sm:, md: kullanımı zorunludur.\n3. **Prettier:** Tailwind plugin kullanımı önerilir."
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
file: "mobile-standards.md",
|
|
174
|
+
template: "templates/standards/mobile-standards.md",
|
|
175
|
+
default: "# 📱 Kurumsal Mobil Standartları\n\n1. **Expo/React Native:** Standart platformdur.\n2. **Dynamic Scaling:** useWindowDimensions kullanımı zorunludur.\n3. **FlashList:** Büyük listeler için Shopify FlashList kullanılır."
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
file: "security-standards.md",
|
|
179
|
+
template: "templates/standards/security-standards.md",
|
|
180
|
+
default: "# 🛡️ Kurumsal Güvenlik Standartları\n\n1. **No Ham SQL:** Kysely zorunluluğu.\n2. **RLS:** Row Level Security uygulanmalıdır.\n3. **Secrets:** .env disiplini."
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
file: "quality-standards.md",
|
|
184
|
+
template: "templates/standards/quality-standards.md",
|
|
185
|
+
default: "# ⚖️ Kurumsal Kod Kalitesi Standartları\n\n1. **Zero any:** TypeScript disiplini.\n2. **Zero Warnings:** ESLint temizliği.\n3. **4 Spaces:** Girintileme kuralı."
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
file: "logging-and-secrets.md",
|
|
189
|
+
template: "templates/standards/logging-and-secrets.md",
|
|
190
|
+
default: "# 🪵 Kurumsal Loglama Standartları\n\n1. **Zero Console:** console.log yasaktır.\n2. **Logger:** Kurumsal logger kullanılır.\n3. **Secrets:** .env disiplini zorunludur."
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
file: "testing-standards.md",
|
|
194
|
+
template: "templates/standards/testing-standards.md",
|
|
195
|
+
default: "# 🧪 Kurumsal Test Standartları\n\n1. **Framework:** Vitest kullanılır.\n2. **Naming:** .test.ts formatı.\n3. **Zero Mock:** İç servisler mocklanmaz."
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
file: "i18n-standards.md",
|
|
199
|
+
template: "templates/standards/i18n-standards.md",
|
|
200
|
+
default: "# 🌐 Kurumsal i18n Standartları\n\n1. **No Hardcoded:** Metinler JSON'da tutulur.\n2. **i18next:** Standart kütüphanedir.\n3. **Centralized:** Locales dizini zorunludur."
|
|
201
|
+
}
|
|
202
|
+
];
|
|
203
|
+
|
|
204
|
+
for (const std of standards) {
|
|
205
|
+
let content = std.default;
|
|
206
|
+
try {
|
|
207
|
+
const fullTemplatePath = path.join(getPackageRoot(), std.template);
|
|
208
|
+
if (fs.existsSync(fullTemplatePath)) {
|
|
209
|
+
content = fs.readFileSync(fullTemplatePath, "utf8");
|
|
210
|
+
}
|
|
211
|
+
} catch {
|
|
212
|
+
// Intentional: if the template file is unreadable, fall back to the inline default.
|
|
213
|
+
// No logging needed — the default value is a valid fallback, not an error condition.
|
|
214
|
+
}
|
|
215
|
+
fs.writeFileSync(path.join(knowledgePath, std.file), content);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Scaffold Prompt Recipes
|
|
219
|
+
const promptsPath = path.join(frameworkDir, "prompts");
|
|
220
|
+
if (!fs.existsSync(promptsPath)) fs.mkdirSync(promptsPath, { recursive: true });
|
|
221
|
+
|
|
222
|
+
const recipes = [
|
|
223
|
+
{ file: "refactoring-recipe.md", template: "templates/prompts/refactoring-recipe.md" },
|
|
224
|
+
{ file: "bug-fix-recipe.md", template: "templates/prompts/bug-fix-recipe.md" },
|
|
225
|
+
{ file: "new-feature-recipe.md", template: "templates/prompts/new-feature-recipe.md" }
|
|
226
|
+
];
|
|
227
|
+
|
|
228
|
+
for (const recipe of recipes) {
|
|
229
|
+
try {
|
|
230
|
+
const fullTemplatePath = path.join(getPackageRoot(), recipe.template);
|
|
231
|
+
if (fs.existsSync(fullTemplatePath)) {
|
|
232
|
+
const content = fs.readFileSync(fullTemplatePath, "utf8");
|
|
233
|
+
fs.writeFileSync(path.join(promptsPath, recipe.file), content);
|
|
234
|
+
}
|
|
235
|
+
} catch (e) {
|
|
236
|
+
logger.debug(`Failed to scaffold prompt recipe: ${recipe.file}`, e);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
189
240
|
// Scaffold cli-commands.json
|
|
190
241
|
const cliCommands = {
|
|
191
242
|
commands: {
|
|
@@ -248,159 +299,117 @@ List of active agents, their roles, capacities, and matching directory patterns.
|
|
|
248
299
|
// Scaffold observability files
|
|
249
300
|
const obsDir = path.join(frameworkDir, "observability");
|
|
250
301
|
if (!fs.existsSync(obsDir)) fs.mkdirSync(obsDir, { recursive: true });
|
|
251
|
-
fs.writeFileSync(
|
|
252
|
-
path.join(obsDir, "audit_log.md"),
|
|
253
|
-
`# 🕵️ Agent Enderun — Audit Log
|
|
254
302
|
|
|
255
|
-
|
|
303
|
+
// Add audit log
|
|
304
|
+
const auditLogPath = path.join(obsDir, "audit_log.md");
|
|
305
|
+
if (!fs.existsSync(auditLogPath)) {
|
|
306
|
+
fs.writeFileSync(auditLogPath, "# 🎖️ Agent Enderun — Audit Log\n\n| Timestamp | Agent | Action | Trace ID | Status |\n|---|---|---|---|---|\n");
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Add metrics.json
|
|
310
|
+
const metricsPath = path.join(obsDir, "metrics.json");
|
|
311
|
+
if (!fs.existsSync(metricsPath)) {
|
|
312
|
+
fs.writeFileSync(metricsPath, "[]");
|
|
313
|
+
}
|
|
256
314
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
);
|
|
260
|
-
fs.writeFileSync(
|
|
261
|
-
|
|
262
|
-
|
|
315
|
+
// Scaffold rules
|
|
316
|
+
const rulesDir = path.join(frameworkDir, "rules");
|
|
317
|
+
if (!fs.existsSync(rulesDir)) fs.mkdirSync(rulesDir, { recursive: true });
|
|
318
|
+
fs.writeFileSync(path.join(rulesDir, "global_rules.mdc"), `---
|
|
319
|
+
description: Global Rules for Agent Enderun Army
|
|
320
|
+
globs: **/*
|
|
321
|
+
---
|
|
263
322
|
|
|
264
|
-
|
|
265
|
-
- **Memory File:** \`${fDir}/memory/PROJECT_MEMORY.md\` (SSOT)
|
|
266
|
-
- **Pruning Trigger:** Active history entries are pruned and archived under \`${fDir}/memory-graph/archive/\` once the log exceeds 10 records.
|
|
267
|
-
- **Audit Logs:** Agent interactions are saved locally inside \`observability/audit_log.md\` to keep API usage transparent and track performance bottlenecks.
|
|
268
|
-
`
|
|
269
|
-
);
|
|
323
|
+
# 🎖️ Agent Enderun — Global Army Rules
|
|
270
324
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
fs.writeFileSync(destShimPath, shimContent);
|
|
279
|
-
console.warn(`✅ Strategy shim created: ${entryFileName}`);
|
|
280
|
-
}
|
|
325
|
+
- **Traceability:** Prefix every commit and log with the active Trace ID.
|
|
326
|
+
- **Surgical Edits:** Use \`replace_text\` or \`patch_file\` tools. Overwriting entire files is forbidden.
|
|
327
|
+
- **Contract-First:** Verify types before implementation.
|
|
328
|
+
- **Zero Mock:** Use real data contracts.
|
|
329
|
+
- **any Forbidden:** Strictly use TypeScript types.
|
|
330
|
+
`);
|
|
281
331
|
}
|
|
282
332
|
|
|
283
|
-
function
|
|
284
|
-
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
if (fDir === ".github") knowledgeDirName = "instructions";
|
|
291
|
-
const destKnowledgeDir = path.join(frameworkDir, knowledgeDirName);
|
|
292
|
-
|
|
293
|
-
if (!fs.existsSync(destKnowledgeDir)) {
|
|
294
|
-
fs.mkdirSync(destKnowledgeDir, { recursive: true });
|
|
333
|
+
export async function initCommand(adapterName: string, options: { unified?: boolean, dryRun?: boolean, yes?: boolean }) {
|
|
334
|
+
const adapterId = (adapterName || "gemini") as AdapterId;
|
|
335
|
+
const adapter = resolveAdapter(adapterId);
|
|
336
|
+
|
|
337
|
+
if (!adapter) {
|
|
338
|
+
UI.error(`Unknown adapter: ${adapterId}`);
|
|
339
|
+
process.exit(1);
|
|
295
340
|
}
|
|
296
341
|
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
{ src: "architecture/standards/design-system.md", dest: "design-system.md" },
|
|
300
|
-
{ src: "architecture/standards/logging.md", dest: "logging.md" },
|
|
301
|
-
{ src: "architecture/standards/tech-stack.md", dest: "tech-stack.md" },
|
|
302
|
-
{ src: "architecture/standards/documentation-ownership.md", dest: "documentation_ownership.md" },
|
|
303
|
-
{ src: "architecture/standards/mobile-standards.md", dest: "mobile_standards.md" },
|
|
304
|
-
{ src: "architecture/standards/crud-governance.md", dest: "crud-governance.md" },
|
|
305
|
-
{ src: "backend/error-handling.md", dest: "error-handling.md" },
|
|
306
|
-
{ src: "frontend/component-patterns.md", dest: "component-patterns.md" },
|
|
307
|
-
{ src: "architecture/enterprise-architecture.md", dest: "enterprise-architecture.md" },
|
|
308
|
-
{ src: "architecture/approval-flows.md", dest: "approval-flows.md" },
|
|
309
|
-
{ src: "architecture/agents-manifest.md", dest: "agents-manifest.md" }
|
|
310
|
-
];
|
|
342
|
+
const projectRoot = process.cwd();
|
|
343
|
+
const isUnified = options.unified || false;
|
|
311
344
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
try {
|
|
316
|
-
if (fs.existsSync(srcPath)) {
|
|
317
|
-
let content = fs.readFileSync(srcPath, "utf8");
|
|
318
|
-
content = remapFrameworkContent(content, fDir, fDir === ".github" ? "codex" : "gemini");
|
|
319
|
-
fs.writeFileSync(destPath, content);
|
|
320
|
-
console.warn(`✅ Copied document: ${item.dest} to ${fDir}/${knowledgeDirName}/`);
|
|
321
|
-
}
|
|
322
|
-
} catch (e) {
|
|
323
|
-
console.warn(`⚠️ Failed to copy ${item.src} to ${destPath}: ${e}`);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
345
|
+
// STRICT ISOLATION STRATEGY
|
|
346
|
+
const coreDir = ".enderun"; // Pure Memory & Knowledge
|
|
347
|
+
const aiToolDir = isUnified ? ".agents" : adapter.frameworkDir; // Pure Agents & Skills
|
|
327
348
|
|
|
328
|
-
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
runAdapterPostInit(adapter, targetDir);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
scaffoldConstitution(targetDir, adapter.frameworkDir, adapter.id, dryRun);
|
|
352
|
-
ensureDir(path.join(targetDir, "apps"), dryRun);
|
|
353
|
-
|
|
354
|
-
// Scaffold target project docs/ folder
|
|
355
|
-
const targetDocsDir = path.join(targetDir, "docs");
|
|
356
|
-
ensureDir(targetDocsDir, dryRun);
|
|
357
|
-
if (!dryRun) {
|
|
358
|
-
const readmePath = path.join(targetDocsDir, "README.md");
|
|
359
|
-
if (!fs.existsSync(readmePath)) {
|
|
360
|
-
fs.writeFileSync(readmePath, "# 📝 Project Documentation\n\nWelcome to your new project scaffolded with Agent Enderun.\n\n## Project Overview\nWrite your project description, goals, and target audience here. The AI agents will read this file to understand the scope.\n");
|
|
361
|
-
}
|
|
362
|
-
const gettingStartedPath = path.join(targetDocsDir, "getting-started.md");
|
|
363
|
-
if (!fs.existsSync(gettingStartedPath)) {
|
|
364
|
-
fs.writeFileSync(gettingStartedPath, "# 🚀 Getting Started\n\n## Project Requirements\nWrite the core requirements and features of your application here.\n");
|
|
365
|
-
}
|
|
366
|
-
console.warn("✅ Project docs folder initialized with placeholders.");
|
|
349
|
+
const dryRun = options.dryRun || false;
|
|
350
|
+
const forceYes = options.yes || false;
|
|
351
|
+
|
|
352
|
+
UI.intent("Enderun Initialization", `Bootstrapping ${FRAMEWORK_NAME} (v${FRAMEWORK_VERSION}) with ${adapterId} adapter...`);
|
|
353
|
+
|
|
354
|
+
let selectedDirs: string[];
|
|
355
|
+
let selectedAgents: string[];
|
|
356
|
+
let selectedPalette: string;
|
|
357
|
+
|
|
358
|
+
if (forceYes) {
|
|
359
|
+
selectedDirs = ["knowledge", "prompts", "memory", "router", "registry", "observability", "rules"];
|
|
360
|
+
selectedAgents = ALL_AGENTS.map(a => a.name);
|
|
361
|
+
selectedPalette = "Modern Blue";
|
|
362
|
+
UI.success("Non-interactive mode: Using default configurations.");
|
|
363
|
+
} else {
|
|
364
|
+
const result = await runInteractiveInit();
|
|
365
|
+
selectedDirs = result.selectedDirs.filter(d => d !== "agents" && d !== "skills");
|
|
366
|
+
selectedAgents = result.selectedAgents;
|
|
367
|
+
selectedPalette = result.selectedPalette;
|
|
367
368
|
}
|
|
368
369
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
370
|
+
// 1. Create Core Framework Structure (.enderun) - EXCLUSIVELY FOR DATA
|
|
371
|
+
ensureDir(path.join(projectRoot, coreDir), dryRun);
|
|
372
|
+
selectedDirs.forEach(dir => {
|
|
373
|
+
ensureDir(path.join(projectRoot, coreDir, dir), dryRun);
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
// 2. Create AI Tool Specific Structure (.agents, .claude, etc.) - EXCLUSIVELY FOR AGENTS/SKILLS
|
|
377
|
+
ensureDir(path.join(projectRoot, aiToolDir), dryRun);
|
|
378
|
+
if (adapter.nestedDirs) {
|
|
379
|
+
adapter.nestedDirs.forEach(dir => ensureDir(path.join(projectRoot, aiToolDir, dir), dryRun));
|
|
373
380
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
381
|
+
|
|
382
|
+
// 3. Scaffold Constitution (Inside .enderun)
|
|
383
|
+
scaffoldConstitution(projectRoot, coreDir, adapterId, dryRun);
|
|
384
|
+
|
|
385
|
+
// 4. Scaffold Core Agents (Inside AI Tool Dir ONLY - Centralized)
|
|
386
|
+
scaffoldAgents(projectRoot, adapterId, dryRun, selectedAgents);
|
|
387
|
+
|
|
388
|
+
// 5. Scaffold Skills (Inside AI Tool Dir ONLY)
|
|
389
|
+
const skillsBaseDir = path.join(projectRoot, aiToolDir, "skills");
|
|
390
|
+
scaffoldSkills(skillsBaseDir, dryRun);
|
|
391
|
+
|
|
392
|
+
// 6. Scaffold Memory & Knowledge (Inside .enderun ONLY)
|
|
393
|
+
initializeMemory(projectRoot, coreDir, dryRun);
|
|
394
|
+
scaffoldFrameworkConfigs(projectRoot, coreDir, adapter, dryRun, selectedPalette);
|
|
395
|
+
|
|
396
|
+
// 7. Platform Specific Shims (At project root)
|
|
397
|
+
for (const [name, content] of Object.entries(SHIM_TEMPLATES)) {
|
|
398
|
+
if (name.toLowerCase() === adapterId.split("-")[0] || name === adapterId) {
|
|
399
|
+
const shimContent = remapFrameworkContent(content, coreDir, adapterId);
|
|
400
|
+
const shimFileName = adapter.shimFile || `${name.toUpperCase()}.md`;
|
|
401
|
+
if (!dryRun) fs.writeFileSync(path.join(projectRoot, shimFileName), shimContent);
|
|
402
|
+
console.warn(`✅ Platform shim created: ${shimFileName}`);
|
|
382
403
|
}
|
|
383
404
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
fs.writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2));
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
const paths = getConfiguredPaths();
|
|
398
|
-
const frontendDir = path.join(targetDir, paths.frontend);
|
|
399
|
-
ensureDir(frontendDir, dryRun);
|
|
400
|
-
|
|
401
|
-
const pandaTemplate = `import { defineConfig } from "@pandacss/dev";\nexport default defineConfig({ theme: { extend: { tokens: { colors: { primary: { value: "${COLOR_PALETTES[selections.selectedPalette as keyof typeof COLOR_PALETTES]?.primary || "#0ea5e9"}" } } } } } });`;
|
|
402
|
-
if (!dryRun) {
|
|
403
|
-
fs.writeFileSync(path.join(frontendDir, "panda.config.ts"), pandaTemplate);
|
|
404
|
-
}
|
|
405
|
-
console.warn(`\n✨ ${FRAMEWORK_NAME} scaffolded! (v${FRAMEWORK_VERSION})`);
|
|
405
|
+
|
|
406
|
+
// 8. Run Adapter Post-Init
|
|
407
|
+
runAdapterPostInit(adapter, projectRoot);
|
|
408
|
+
|
|
409
|
+
UI.success(`\n🚀 ${FRAMEWORK_NAME} initialized successfully!`);
|
|
410
|
+
console.warn(`\n- Brain & Memory Hub (Protected): ${coreDir}/`);
|
|
411
|
+
console.warn(`- AI Agent Commands (Active): ${aiToolDir}/`);
|
|
412
|
+
console.warn("\nNext Steps:");
|
|
413
|
+
console.warn(" 1. Run 'agent-enderun status' to verify the environment.");
|
|
414
|
+
console.warn(` 2. Open ${adapterId === "claude" ? "Claude Desktop" : "your AI Assistant"} and start commanding the Army.`);
|
|
406
415
|
}
|
|
@@ -4,6 +4,7 @@ import chalk from "chalk";
|
|
|
4
4
|
import { getFrameworkDir } from "../utils/memory.js";
|
|
5
5
|
import { UI } from "../utils/ui.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
+
import { logger } from "../../shared/logger.js";
|
|
7
8
|
|
|
8
9
|
export const HermesMessageSchema = z.object({
|
|
9
10
|
timestamp: z.string(),
|
|
@@ -62,8 +63,9 @@ export async function orchestrateCommand() {
|
|
|
62
63
|
if (updatedStatus) {
|
|
63
64
|
fs.writeFileSync(statusPath, newLines.join("\n"));
|
|
64
65
|
}
|
|
65
|
-
} catch {
|
|
66
|
+
} catch (err) {
|
|
66
67
|
UI.error("Ajan zaman aşımı kontrolü sırasında hata oluştu.");
|
|
68
|
+
logger.debug("Agent timeout check failed", err);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
|
|
@@ -97,8 +99,9 @@ export async function orchestrateCommand() {
|
|
|
97
99
|
}
|
|
98
100
|
});
|
|
99
101
|
fileMessagesMap[file] = allMsgs;
|
|
100
|
-
} catch {
|
|
102
|
+
} catch (err) {
|
|
101
103
|
UI.error(`${file} mesajı okunurken hata oluştu.`);
|
|
104
|
+
logger.debug(`Failed to read message file ${file}`, err);
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
|
|
@@ -181,8 +184,9 @@ export async function orchestrateCommand() {
|
|
|
181
184
|
fs.appendFileSync(archivePath, archiveContent, "utf8");
|
|
182
185
|
UI.success(`Archived ${processedMsgs.length} messages for @${agentName}`);
|
|
183
186
|
}
|
|
184
|
-
} catch {
|
|
187
|
+
} catch (err) {
|
|
185
188
|
UI.error(`${file} mesaj dosyası güncellenirken ve arşivlenirken hata oluştu.`);
|
|
189
|
+
logger.debug(`Failed to update and archive message file ${file}`, err);
|
|
186
190
|
}
|
|
187
191
|
}
|
|
188
192
|
}
|
|
@@ -203,7 +207,7 @@ export async function sendMessage(args: {
|
|
|
203
207
|
const messagesDir = path.join(frameworkDir, "messages");
|
|
204
208
|
const agentName = args.to.replace("@", "");
|
|
205
209
|
const messagePath = path.join(messagesDir, `${agentName}.json`);
|
|
206
|
-
const lockPath = path.join(messagesDir,
|
|
210
|
+
const lockPath = path.join(messagesDir, `${agentName}.lock`);
|
|
207
211
|
|
|
208
212
|
let retries = 3;
|
|
209
213
|
let acquired = false;
|
|
@@ -215,8 +219,8 @@ export async function sendMessage(args: {
|
|
|
215
219
|
if (Date.now() - stats.mtimeMs > 5000) {
|
|
216
220
|
fs.unlinkSync(lockPath);
|
|
217
221
|
}
|
|
218
|
-
} catch {
|
|
219
|
-
|
|
222
|
+
} catch (err) {
|
|
223
|
+
logger.debug(`Failed to unlink stale Hermes lock for ${agentName} concurrently`, err);
|
|
220
224
|
}
|
|
221
225
|
}
|
|
222
226
|
if (!fs.existsSync(messagesDir)) {
|
|
@@ -263,8 +267,9 @@ export async function sendMessage(args: {
|
|
|
263
267
|
}
|
|
264
268
|
|
|
265
269
|
return message;
|
|
266
|
-
} catch {
|
|
270
|
+
} catch (err) {
|
|
267
271
|
UI.error(`Mesaj iletilemedi: ${args.from} -> ${args.to}`);
|
|
272
|
+
logger.debug(`Hermes sendMessage failed (${args.from} -> ${args.to})`, err);
|
|
268
273
|
} finally {
|
|
269
274
|
if (acquired && fs.existsSync(lockPath)) {
|
|
270
275
|
try {
|
|
@@ -297,7 +302,8 @@ function transitionAgentState(agent: string, state: string, task: string) {
|
|
|
297
302
|
return line;
|
|
298
303
|
});
|
|
299
304
|
fs.writeFileSync(statusPath, newLines.join("\n"));
|
|
300
|
-
} catch {
|
|
305
|
+
} catch (err) {
|
|
301
306
|
UI.error("STATUS.md güncellenemedi.");
|
|
307
|
+
logger.debug(`Failed to transition agent state for ${agent}`, err);
|
|
302
308
|
}
|
|
303
309
|
}
|