atabey 0.0.7 → 0.0.9
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/README.md +1 -1
- package/dist/framework-mcp/src/resources/index.js +2 -2
- package/dist/framework-mcp/src/resources/index.js.map +1 -1
- package/dist/framework-mcp/src/utils/errors.d.ts +46 -0
- package/dist/framework-mcp/src/utils/errors.js +69 -0
- package/dist/framework-mcp/src/utils/errors.js.map +1 -0
- package/dist/framework-mcp/src/utils/memory.d.ts +3 -0
- package/dist/framework-mcp/src/utils/memory.js +75 -0
- package/dist/framework-mcp/src/utils/memory.js.map +1 -0
- package/dist/framework-mcp/src/utils/storage.d.ts +60 -0
- package/dist/framework-mcp/src/utils/storage.js +208 -0
- package/dist/framework-mcp/src/utils/storage.js.map +1 -0
- package/dist/framework-mcp/src/utils/types.d.ts +19 -0
- package/dist/framework-mcp/src/utils/types.js +13 -0
- package/dist/framework-mcp/src/utils/types.js.map +1 -0
- package/dist/src/cli/adapters/core.js +12 -19
- package/dist/src/cli/adapters/core.js.map +1 -1
- package/dist/src/shared/constants.d.ts +1 -0
- package/dist/src/shared/constants.js +1 -0
- package/dist/src/shared/constants.js.map +1 -1
- package/dist/tests/adapter.test.js +3 -2
- package/dist/tests/adapter.test.js.map +1 -1
- package/framework-mcp/dist/constants.js +64 -0
- package/framework-mcp/dist/framework-mcp/src/constants.js +64 -0
- package/framework-mcp/dist/framework-mcp/src/index.js +144 -0
- package/framework-mcp/dist/framework-mcp/src/resources/index.js +58 -0
- package/framework-mcp/dist/framework-mcp/src/tools/control_plane/locking.js +82 -0
- package/framework-mcp/dist/framework-mcp/src/tools/control_plane/registry.js +35 -0
- package/framework-mcp/dist/framework-mcp/src/tools/definitions.js +322 -0
- package/framework-mcp/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js +64 -0
- package/framework-mcp/dist/framework-mcp/src/tools/file_system/patch_file.js +34 -0
- package/framework-mcp/dist/framework-mcp/src/tools/file_system/read_file.js +51 -0
- package/framework-mcp/dist/framework-mcp/src/tools/file_system/replace_text.js +50 -0
- package/framework-mcp/dist/framework-mcp/src/tools/file_system/write_file.js +43 -0
- package/framework-mcp/dist/framework-mcp/src/tools/framework/audit_deps.js +41 -0
- package/framework-mcp/dist/framework-mcp/src/tools/framework/get_status.js +5 -0
- package/framework-mcp/dist/framework-mcp/src/tools/framework/orchestrate.js +5 -0
- package/framework-mcp/dist/framework-mcp/src/tools/framework/run_tests.js +27 -0
- package/framework-mcp/dist/framework-mcp/src/tools/framework/submit_plan.js +13 -0
- package/framework-mcp/dist/framework-mcp/src/tools/framework/update_contract_hash.js +5 -0
- package/framework-mcp/dist/framework-mcp/src/tools/framework/update_memory.js +8 -0
- package/framework-mcp/dist/framework-mcp/src/tools/index.js +62 -0
- package/framework-mcp/dist/framework-mcp/src/tools/memory/get_insights.js +34 -0
- package/framework-mcp/dist/framework-mcp/src/tools/memory/read_memory.js +28 -0
- package/framework-mcp/dist/framework-mcp/src/tools/messaging/log_action.js +22 -0
- package/framework-mcp/dist/framework-mcp/src/tools/messaging/send_message.js +94 -0
- package/framework-mcp/dist/framework-mcp/src/tools/observability/check_ports.js +26 -0
- package/framework-mcp/dist/framework-mcp/src/tools/observability/get_health.js +19 -0
- package/framework-mcp/dist/framework-mcp/src/tools/quality/check_lint.js +30 -0
- package/framework-mcp/dist/framework-mcp/src/tools/search/get_gaps.js +48 -0
- package/framework-mcp/dist/framework-mcp/src/tools/search/get_map.js +43 -0
- package/framework-mcp/dist/framework-mcp/src/tools/search/grep_search.js +75 -0
- package/framework-mcp/dist/framework-mcp/src/tools/search/list_dir.js +28 -0
- package/framework-mcp/dist/framework-mcp/src/tools/shell/run_command.js +56 -0
- package/framework-mcp/dist/framework-mcp/src/tools/types.js +1 -0
- package/framework-mcp/dist/framework-mcp/src/utils/cli.js +59 -0
- package/framework-mcp/dist/framework-mcp/src/utils/compliance.js +231 -0
- package/framework-mcp/dist/framework-mcp/src/utils/errors.js +68 -0
- package/framework-mcp/dist/framework-mcp/src/utils/fs.js +44 -0
- package/framework-mcp/dist/framework-mcp/src/utils/memory.js +74 -0
- package/framework-mcp/dist/framework-mcp/src/utils/metrics.js +56 -0
- package/framework-mcp/dist/framework-mcp/src/utils/permissions.js +71 -0
- package/framework-mcp/dist/framework-mcp/src/utils/security.js +60 -0
- package/framework-mcp/dist/framework-mcp/src/utils/storage.js +207 -0
- package/framework-mcp/dist/framework-mcp/src/utils/types.js +12 -0
- package/framework-mcp/dist/index.js +144 -0
- package/framework-mcp/dist/resources/index.js +58 -0
- package/framework-mcp/dist/src/cli/adapters/core.js +71 -0
- package/framework-mcp/dist/src/cli/adapters/index.js +5 -0
- package/framework-mcp/dist/src/cli/adapters/paths.js +101 -0
- package/framework-mcp/dist/src/cli/adapters/scaffold.js +71 -0
- package/framework-mcp/dist/src/cli/adapters/utils.js +75 -0
- package/framework-mcp/dist/src/cli/commands/approve.js +63 -0
- package/framework-mcp/dist/src/cli/commands/check.js +181 -0
- package/framework-mcp/dist/src/cli/commands/compliance.js +50 -0
- package/framework-mcp/dist/src/cli/commands/contract.js +50 -0
- package/framework-mcp/dist/src/cli/commands/dashboard.js +123 -0
- package/framework-mcp/dist/src/cli/commands/explorer.js +42 -0
- package/framework-mcp/dist/src/cli/commands/git.js +40 -0
- package/framework-mcp/dist/src/cli/commands/init/create-agent.js +58 -0
- package/framework-mcp/dist/src/cli/commands/init/scaffold-core.js +112 -0
- package/framework-mcp/dist/src/cli/commands/init/scaffold-docs.js +34 -0
- package/framework-mcp/dist/src/cli/commands/init/scaffold-ops.js +80 -0
- package/framework-mcp/dist/src/cli/commands/init/scaffold-standards.js +67 -0
- package/framework-mcp/dist/src/cli/commands/init.js +167 -0
- package/framework-mcp/dist/src/cli/commands/knowledge.js +42 -0
- package/framework-mcp/dist/src/cli/commands/lint.js +22 -0
- package/framework-mcp/dist/src/cli/commands/log.js +10 -0
- package/framework-mcp/dist/src/cli/commands/memory.js +4 -0
- package/framework-mcp/dist/src/cli/commands/orchestrate.js +159 -0
- package/framework-mcp/dist/src/cli/commands/plan.js +117 -0
- package/framework-mcp/dist/src/cli/commands/script.js +19 -0
- package/framework-mcp/dist/src/cli/commands/security.js +36 -0
- package/framework-mcp/dist/src/cli/commands/status.js +97 -0
- package/framework-mcp/dist/src/cli/commands/trace.js +109 -0
- package/framework-mcp/dist/src/cli/index.js +338 -0
- package/framework-mcp/dist/src/cli/shims.js +66 -0
- package/framework-mcp/dist/src/cli/utils/claude.js +56 -0
- package/framework-mcp/dist/src/cli/utils/compliance.js +173 -0
- package/framework-mcp/dist/src/cli/utils/config-schema.js +42 -0
- package/framework-mcp/dist/src/cli/utils/fs.js +137 -0
- package/framework-mcp/dist/src/cli/utils/i18n.js +30 -0
- package/framework-mcp/dist/src/cli/utils/memory.js +276 -0
- package/framework-mcp/dist/src/cli/utils/pkg.js +282 -0
- package/framework-mcp/dist/src/cli/utils/schemas.js +19 -0
- package/framework-mcp/dist/src/cli/utils/string.js +49 -0
- package/framework-mcp/dist/src/cli/utils/time.js +27 -0
- package/framework-mcp/dist/src/cli/utils/ui.js +58 -0
- package/framework-mcp/dist/src/contracts/index.js +1 -0
- package/framework-mcp/dist/src/contracts/tasks.js +20 -0
- package/framework-mcp/dist/src/dashboard/vite.config.js +15 -0
- package/framework-mcp/dist/src/modules/adapters/definitions.js +140 -0
- package/framework-mcp/dist/src/modules/adapters/registry.js +18 -0
- package/framework-mcp/dist/src/modules/adapters/shared.js +104 -0
- package/framework-mcp/dist/src/modules/adapters/types.js +1 -0
- package/framework-mcp/dist/src/modules/agents/definitions.js +457 -0
- package/framework-mcp/dist/src/modules/agents/registry/analyst.js +39 -0
- package/framework-mcp/dist/src/modules/agents/registry/architect.js +42 -0
- package/framework-mcp/dist/src/modules/agents/registry/backend.js +49 -0
- package/framework-mcp/dist/src/modules/agents/registry/database.js +45 -0
- package/framework-mcp/dist/src/modules/agents/registry/devops.js +45 -0
- package/framework-mcp/dist/src/modules/agents/registry/explorer.js +36 -0
- package/framework-mcp/dist/src/modules/agents/registry/frontend.js +51 -0
- package/framework-mcp/dist/src/modules/agents/registry/git.js +36 -0
- package/framework-mcp/dist/src/modules/agents/registry/manager.js +53 -0
- package/framework-mcp/dist/src/modules/agents/registry/mobile.js +39 -0
- package/framework-mcp/dist/src/modules/agents/registry/native.js +39 -0
- package/framework-mcp/dist/src/modules/agents/registry/quality.js +41 -0
- package/framework-mcp/dist/src/modules/agents/registry/security.js +43 -0
- package/framework-mcp/dist/src/modules/agents/types.js +1 -0
- package/framework-mcp/dist/src/modules/engines/evaluation-engine.js +102 -0
- package/framework-mcp/dist/src/modules/engines/health-engine.js +49 -0
- package/framework-mcp/dist/src/modules/engines/planning-engine.js +78 -0
- package/framework-mcp/dist/src/modules/engines/risk-engine.js +105 -0
- package/framework-mcp/dist/src/modules/engines/routing-engine.js +73 -0
- package/framework-mcp/dist/src/modules/engines/types.js +1 -0
- package/framework-mcp/dist/src/modules/skills/definitions.js +70 -0
- package/framework-mcp/dist/src/shared/constants.js +187 -0
- package/framework-mcp/dist/src/shared/errors.js +68 -0
- package/framework-mcp/dist/src/shared/fs.js +51 -0
- package/framework-mcp/dist/src/shared/logger.js +116 -0
- package/framework-mcp/dist/src/shared/storage.js +207 -0
- package/framework-mcp/dist/src/shared/types.js +12 -0
- package/framework-mcp/dist/tools/control_plane/locking.js +82 -0
- package/framework-mcp/dist/tools/control_plane/registry.js +35 -0
- package/framework-mcp/dist/tools/definitions.js +322 -0
- package/framework-mcp/dist/tools/file_system/batch_surgical_edit.js +64 -0
- package/framework-mcp/dist/tools/file_system/patch_file.js +34 -0
- package/framework-mcp/dist/tools/file_system/read_file.js +51 -0
- package/framework-mcp/dist/tools/file_system/replace_text.js +50 -0
- package/framework-mcp/dist/tools/file_system/write_file.js +43 -0
- package/framework-mcp/dist/tools/framework/audit_deps.js +41 -0
- package/framework-mcp/dist/tools/framework/get_status.js +5 -0
- package/framework-mcp/dist/tools/framework/orchestrate.js +5 -0
- package/framework-mcp/dist/tools/framework/run_tests.js +27 -0
- package/framework-mcp/dist/tools/framework/submit_plan.js +13 -0
- package/framework-mcp/dist/tools/framework/update_contract_hash.js +5 -0
- package/framework-mcp/dist/tools/framework/update_memory.js +8 -0
- package/framework-mcp/dist/tools/index.js +62 -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/log_action.js +22 -0
- package/framework-mcp/dist/tools/messaging/send_message.js +94 -0
- 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/quality/check_lint.js +30 -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 +75 -0
- package/framework-mcp/dist/tools/search/list_dir.js +28 -0
- package/framework-mcp/dist/tools/shell/run_command.js +56 -0
- package/framework-mcp/dist/tools/types.js +1 -0
- package/framework-mcp/dist/utils/cli.js +59 -0
- package/framework-mcp/dist/utils/compliance.js +231 -0
- package/framework-mcp/dist/utils/fs.js +44 -0
- package/framework-mcp/dist/utils/metrics.js +56 -0
- package/framework-mcp/dist/utils/permissions.js +71 -0
- package/framework-mcp/dist/utils/security.js +60 -0
- package/framework-mcp/package.json +37 -0
- package/mcp.json +1 -1
- package/package.json +10 -5
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { UI } from "../../utils/ui.js";
|
|
4
|
+
import { writeTextFile } from "../../../shared/fs.js";
|
|
5
|
+
/**
|
|
6
|
+
* Plugin SDK: Creates a new custom agent template.
|
|
7
|
+
*/
|
|
8
|
+
export async function createAgentCommand(name) {
|
|
9
|
+
const projectRoot = process.cwd();
|
|
10
|
+
const agentsDir = path.join(projectRoot, "src/modules/agents/registry");
|
|
11
|
+
if (!fs.existsSync(agentsDir)) {
|
|
12
|
+
UI.error("Ajan kayıt dizini bulunamadı. Lütfen Atabey geliştirme ortamında olduğunuzdan emin olun.");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const filePath = path.join(agentsDir, `${name}.ts`);
|
|
16
|
+
if (fs.existsSync(filePath)) {
|
|
17
|
+
UI.error(`Ajan '${name}' zaten mevcut.`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const template = `import { AgentDefinition } from "../types.js";
|
|
21
|
+
|
|
22
|
+
const STATE_MACHINE = "../schema/agent-lifecycle-schema.json" as const;
|
|
23
|
+
|
|
24
|
+
export const ${name}: AgentDefinition = {
|
|
25
|
+
name: "${name}",
|
|
26
|
+
displayName: "${name.charAt(0).toUpperCase() + name.slice(1)} Specialist",
|
|
27
|
+
role: "Custom Specialty",
|
|
28
|
+
description: "Automatically generated custom agent for specific project needs.",
|
|
29
|
+
capability: 7,
|
|
30
|
+
tier: "core",
|
|
31
|
+
tags: ["custom"],
|
|
32
|
+
stateMachine: STATE_MACHINE,
|
|
33
|
+
tools: [
|
|
34
|
+
"read_file",
|
|
35
|
+
"write_file",
|
|
36
|
+
"replace_text",
|
|
37
|
+
"grep_search",
|
|
38
|
+
"send_agent_message",
|
|
39
|
+
],
|
|
40
|
+
instructions: {
|
|
41
|
+
identity: "${name.toUpperCase()} Domain Expert",
|
|
42
|
+
mission: "Execute tasks related to ${name} with high precision and following Atabey standards.",
|
|
43
|
+
chainOfThought: "1. Analyze Task\\n2. Plan Steps\\n3. Execute\\n4. Verify",
|
|
44
|
+
rules: [
|
|
45
|
+
"Always maintain type safety.",
|
|
46
|
+
"Log all critical actions.",
|
|
47
|
+
],
|
|
48
|
+
knowledgeFiles: [],
|
|
49
|
+
},
|
|
50
|
+
specialties: {
|
|
51
|
+
${name}: 10,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
`;
|
|
55
|
+
writeTextFile(filePath, template);
|
|
56
|
+
UI.success(`[OK] New agent '${name}' created at src/modules/agents/registry/${name}.ts`);
|
|
57
|
+
UI.warning("[INFO] Don't forget to register the agent in src/modules/agents/definitions.ts");
|
|
58
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { remapFrameworkContent, ADAPTERS } from "../../adapters/index.js";
|
|
4
|
+
import { SHIM_TEMPLATES } from "../../shims.js";
|
|
5
|
+
import { writeJsonFile, writeTextFile } from "../../utils/fs.js";
|
|
6
|
+
import { getPackageRoot, getPackageVersion } from "../../utils/pkg.js";
|
|
7
|
+
import { ALL_AGENTS } from "../../../modules/agents/definitions.js";
|
|
8
|
+
import { TRANSLATIONS } from "../../utils/i18n.js";
|
|
9
|
+
const FRAMEWORK_NAME = "Agent Atabey";
|
|
10
|
+
const COLOR_PALETTES = {
|
|
11
|
+
"Modern Blue": { primary: "#0ea5e9", secondary: "#64748b", accent: "#f43f5e" },
|
|
12
|
+
"Enterprise Slate": { primary: "#334155", secondary: "#94a3b8", accent: "#10b981" },
|
|
13
|
+
"Deep Purple": { primary: "#8b5cf6", secondary: "#d8b4fe", accent: "#f59e0b" }
|
|
14
|
+
};
|
|
15
|
+
export function scaffoldConstitution(targetDir, frameworkDir, adapterId, dryRun, language = "tr") {
|
|
16
|
+
if (dryRun)
|
|
17
|
+
return;
|
|
18
|
+
const t = TRANSLATIONS[language];
|
|
19
|
+
let content = `# [ATABEY] ${t.constitution_title}\n\nDiscipline and Order.`;
|
|
20
|
+
let readSuccess = false;
|
|
21
|
+
try {
|
|
22
|
+
const templatePath = path.join(getPackageRoot(), "ATABEY.md");
|
|
23
|
+
if (fs.existsSync(templatePath)) {
|
|
24
|
+
content = fs.readFileSync(templatePath, "utf8");
|
|
25
|
+
readSuccess = true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
console.warn(`[WARN] Failed to read global constitution template: ${e}`);
|
|
30
|
+
}
|
|
31
|
+
content = remapFrameworkContent(content, frameworkDir, adapterId);
|
|
32
|
+
const destPath = path.join(targetDir, frameworkDir, "ATABEY.md");
|
|
33
|
+
writeTextFile(destPath, content);
|
|
34
|
+
console.warn(`[OK] Constitution file created inside: ${frameworkDir}/ATABEY.md${readSuccess ? "" : " (default template)"}`);
|
|
35
|
+
}
|
|
36
|
+
export function scaffoldFrameworkConfigs(targetDir, fDir, adapter, dryRun, selectedPalette, options) {
|
|
37
|
+
if (dryRun)
|
|
38
|
+
return;
|
|
39
|
+
const frameworkDir = path.join(targetDir, fDir);
|
|
40
|
+
const palette = COLOR_PALETTES[selectedPalette] || COLOR_PALETTES["Modern Blue"];
|
|
41
|
+
const language = options?.language || "tr";
|
|
42
|
+
const t = TRANSLATIONS[language];
|
|
43
|
+
const config = {
|
|
44
|
+
name: FRAMEWORK_NAME,
|
|
45
|
+
version: getPackageVersion(),
|
|
46
|
+
unified: options?.unified || false,
|
|
47
|
+
adapters: options?.adapters || [adapter.id],
|
|
48
|
+
backendLanguage: options?.backendLanguage || "Node.js (TypeScript)",
|
|
49
|
+
frontendFramework: options?.frontendFramework || "Vite (React)",
|
|
50
|
+
language: language,
|
|
51
|
+
theme: {
|
|
52
|
+
palette: selectedPalette,
|
|
53
|
+
colors: palette
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
writeJsonFile(path.join(frameworkDir, "config.json"), config, dryRun);
|
|
57
|
+
// Scaffold shared-facts.json in memory-graph
|
|
58
|
+
const graphDir = path.join(frameworkDir, "memory-graph");
|
|
59
|
+
if (!fs.existsSync(graphDir))
|
|
60
|
+
fs.mkdirSync(graphDir, { recursive: true });
|
|
61
|
+
const sharedFactsPath = path.join(graphDir, "shared-facts.json");
|
|
62
|
+
if (!fs.existsSync(sharedFactsPath)) {
|
|
63
|
+
writeJsonFile(sharedFactsPath, {
|
|
64
|
+
project: FRAMEWORK_NAME,
|
|
65
|
+
initializedAt: new Date().toISOString(),
|
|
66
|
+
stack: [
|
|
67
|
+
options?.backendLanguage || "Node.js (TypeScript)",
|
|
68
|
+
options?.frontendFramework || "Vite (React)"
|
|
69
|
+
],
|
|
70
|
+
language: language,
|
|
71
|
+
policies: []
|
|
72
|
+
}, dryRun);
|
|
73
|
+
}
|
|
74
|
+
let statusContent = `# [ATABEY] ${t.status_title}\n\n| Agent | State | Active Task | Last Updated | Notes | Extra | Backup |\n|---|---|---|---|---|---|---|\n`;
|
|
75
|
+
const activeAgents = ALL_AGENTS;
|
|
76
|
+
const initialStatusJson = {};
|
|
77
|
+
const now = new Date().toISOString();
|
|
78
|
+
for (const ag of activeAgents) {
|
|
79
|
+
statusContent += "| @" + ag.name + " | " + t.agent_ready + " | Idle | - | - | - | - |\n";
|
|
80
|
+
initialStatusJson[ag.name] = { state: "READY", task: "Idle", lastUpdated: now };
|
|
81
|
+
}
|
|
82
|
+
writeTextFile(path.join(frameworkDir, "STATUS.md"), statusContent);
|
|
83
|
+
// Populate initial status.json
|
|
84
|
+
const statusJsonPath = path.join(frameworkDir, "memory", "status.json");
|
|
85
|
+
if (!fs.existsSync(path.join(frameworkDir, "memory")))
|
|
86
|
+
fs.mkdirSync(path.join(frameworkDir, "memory"), { recursive: true });
|
|
87
|
+
writeJsonFile(statusJsonPath, initialStatusJson, dryRun);
|
|
88
|
+
}
|
|
89
|
+
export function scaffoldShims(projectRoot, coreDir, adapterId, adapter, dryRun, unified = false) {
|
|
90
|
+
for (const [name, content] of Object.entries(SHIM_TEMPLATES)) {
|
|
91
|
+
// Normalize: "antigravity-cli" template key needs exact match or prefix match
|
|
92
|
+
const isSelectedAdapter = name === adapterId ||
|
|
93
|
+
name.toLowerCase() === adapterId.split("-")[0].toLowerCase();
|
|
94
|
+
if (unified || isSelectedAdapter) {
|
|
95
|
+
const shimContent = remapFrameworkContent(content, coreDir, adapterId);
|
|
96
|
+
// In unified mode, each adapter writes its OWN shimFile name.
|
|
97
|
+
// In single-adapter mode, use selected adapter's shimFile.
|
|
98
|
+
const shimAdapter = ADAPTERS[name] || adapter;
|
|
99
|
+
const shimFileName = (unified && !isSelectedAdapter)
|
|
100
|
+
? (shimAdapter.shimFile || `${name.toUpperCase()}.md`) // each adapter's own file
|
|
101
|
+
: (adapter.shimFile || `${name.toUpperCase()}.md`); // selected adapter's file
|
|
102
|
+
if (!dryRun)
|
|
103
|
+
writeTextFile(path.join(projectRoot, shimFileName), shimContent);
|
|
104
|
+
if (isSelectedAdapter) {
|
|
105
|
+
console.warn(`[OK] Platform shim created: ${shimFileName}`);
|
|
106
|
+
}
|
|
107
|
+
else if (unified) {
|
|
108
|
+
console.warn(`[OK] Unified platform shim added: ${shimFileName}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { writeTextFile } from "../../utils/fs.js";
|
|
4
|
+
import { getPackageRoot } from "../../utils/pkg.js";
|
|
5
|
+
import { logger } from "../../../shared/logger.js";
|
|
6
|
+
export function scaffoldProjectDocs(projectRoot, options, dryRun) {
|
|
7
|
+
if (dryRun)
|
|
8
|
+
return;
|
|
9
|
+
const docsDir = path.join(projectRoot, "docs");
|
|
10
|
+
if (!fs.existsSync(docsDir))
|
|
11
|
+
fs.mkdirSync(docsDir, { recursive: true });
|
|
12
|
+
// Scaffold tech-stack.md with dynamic content
|
|
13
|
+
const techStackPath = path.join(docsDir, "tech-stack.md");
|
|
14
|
+
let techStackContent = "";
|
|
15
|
+
try {
|
|
16
|
+
const templatePath = path.join(getPackageRoot(), "docs/tech-stack.md");
|
|
17
|
+
if (fs.existsSync(templatePath)) {
|
|
18
|
+
techStackContent = fs.readFileSync(templatePath, "utf8");
|
|
19
|
+
// Replace the backend language in the template
|
|
20
|
+
const lang = options.backendLanguage;
|
|
21
|
+
const frontend = options.frontendFramework || "Vite (React)";
|
|
22
|
+
techStackContent = techStackContent.replace(/\| \*\*Geliştirme Ortamı\*\* \| .* \|/, `| **Geliştirme Ortamı** | ${lang} |`);
|
|
23
|
+
techStackContent = techStackContent.replace(/\| \*\*Frontend Altyapısı\*\* \| .* \|/, `| **Frontend Altyapısı** | ${frontend} |`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
logger.debug("Failed to read tech-stack.md template", e);
|
|
28
|
+
}
|
|
29
|
+
if (!techStackContent) {
|
|
30
|
+
techStackContent = `# 🛠️ Project Tech Stack\n\n- **Backend Language:** ${options.backendLanguage}\n- **Frontend Framework:** ${options.frontendFramework || "Vite (React)"}\n`;
|
|
31
|
+
}
|
|
32
|
+
writeTextFile(techStackPath, techStackContent);
|
|
33
|
+
console.warn(`[OK] Project documentation updated: docs/tech-stack.md (Backend: ${options.backendLanguage}, Frontend: ${options.frontendFramework || "Vite (React)"})`);
|
|
34
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
export function scaffoldOps(frameworkDir, dryRun) {
|
|
7
|
+
if (dryRun)
|
|
8
|
+
return;
|
|
9
|
+
// Scaffold Prompt Recipes
|
|
10
|
+
const promptsPath = path.join(frameworkDir, "prompts");
|
|
11
|
+
if (!fs.existsSync(promptsPath))
|
|
12
|
+
fs.mkdirSync(promptsPath, { recursive: true });
|
|
13
|
+
const recipes = [
|
|
14
|
+
{ file: "refactoring-recipe.md", template: "templates/prompts/refactoring-recipe.md" },
|
|
15
|
+
{ file: "bug-fix-recipe.md", template: "templates/prompts/bug-fix-recipe.md" },
|
|
16
|
+
{ file: "new-feature-recipe.md", template: "templates/prompts/new-feature-recipe.md" },
|
|
17
|
+
{ file: "security-audit-recipe.md", template: "templates/prompts/security-audit-recipe.md" },
|
|
18
|
+
{ file: "db-management-recipe.md", template: "templates/prompts/db-management-recipe.md" },
|
|
19
|
+
{ file: "performance-optimization-recipe.md", template: "templates/prompts/performance-optimization-recipe.md" },
|
|
20
|
+
{ file: "deployment-recipe.md", template: "templates/prompts/deployment-recipe.md" },
|
|
21
|
+
{ file: "contract-design-recipe.md", template: "templates/prompts/contract-design-recipe.md" }
|
|
22
|
+
];
|
|
23
|
+
for (const recipe of recipes) {
|
|
24
|
+
try {
|
|
25
|
+
const fullTemplatePath = path.join(getPackageRoot(), recipe.template);
|
|
26
|
+
if (fs.existsSync(fullTemplatePath)) {
|
|
27
|
+
const content = fs.readFileSync(fullTemplatePath, "utf8");
|
|
28
|
+
writeTextFile(path.join(promptsPath, recipe.file), content);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
logger.debug(`Failed to scaffold prompt recipe: ${recipe.file}`, e);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Scaffold cli-commands.json
|
|
36
|
+
const cliCommands = {
|
|
37
|
+
commands: {
|
|
38
|
+
init: { agent: "manager", description: "Initialize Agent Atabey structure and AI configuration." },
|
|
39
|
+
check: { agent: "quality", description: "Verify framework files and code quality discipline." },
|
|
40
|
+
status: { agent: "manager", description: "Show the current status of the active project phase." },
|
|
41
|
+
"trace:new": { agent: "manager", description: "Generate a new Trace ID to start a task sequence." },
|
|
42
|
+
orchestrate: { agent: "manager", description: "Execute the Hermes message broker loop." },
|
|
43
|
+
"verify-contract": { agent: "architect", description: "Validate type contracts between backend and frontend." },
|
|
44
|
+
"update-contract": { agent: "architect", description: "Update the contract signature hash." }
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
writeJsonFile(path.join(frameworkDir, "cli-commands.json"), cliCommands, dryRun);
|
|
48
|
+
// Scaffold router/routing_rules.md
|
|
49
|
+
const routerDir = path.join(frameworkDir, "router");
|
|
50
|
+
if (!fs.existsSync(routerDir))
|
|
51
|
+
fs.mkdirSync(routerDir, { recursive: true });
|
|
52
|
+
writeTextFile(path.join(routerDir, "routing_rules.md"), "# [SIGNAL] Agent Atabey — Natural Language & Event Router\n\nRouting engine protocols defined here.");
|
|
53
|
+
// Scaffold registry/agent_registry.md
|
|
54
|
+
const registryDir = path.join(frameworkDir, "registry");
|
|
55
|
+
if (!fs.existsSync(registryDir))
|
|
56
|
+
fs.mkdirSync(registryDir, { recursive: true });
|
|
57
|
+
writeTextFile(path.join(registryDir, "agent_registry.md"), "# [ATABEY] Agent Atabey — Army Registry\n\nList of active agents.");
|
|
58
|
+
// Scaffold observability files
|
|
59
|
+
const obsDir = path.join(frameworkDir, "observability");
|
|
60
|
+
if (!fs.existsSync(obsDir))
|
|
61
|
+
fs.mkdirSync(obsDir, { recursive: true });
|
|
62
|
+
writeTextFile(path.join(obsDir, "audit_log.md"), "# [ATABEY] Agent Atabey — Audit Log\n\n| Timestamp | Agent | Action | Trace ID | Status |\n|---|---|---|---|---|\n");
|
|
63
|
+
writeJsonFile(path.join(obsDir, "metrics.json"), []);
|
|
64
|
+
// Scaffold .env.example
|
|
65
|
+
const envExamplePath = path.join(process.cwd(), ".env.example");
|
|
66
|
+
if (!fs.existsSync(envExamplePath)) {
|
|
67
|
+
writeTextFile(envExamplePath, "# Agent Atabey - 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");
|
|
68
|
+
}
|
|
69
|
+
// Scaffold rules
|
|
70
|
+
const rulesDir = path.join(frameworkDir, "rules");
|
|
71
|
+
if (!fs.existsSync(rulesDir))
|
|
72
|
+
fs.mkdirSync(rulesDir, { recursive: true });
|
|
73
|
+
writeTextFile(path.join(rulesDir, "global_rules.mdc"), `---
|
|
74
|
+
description: Global Rules for Agent Atabey Army
|
|
75
|
+
globs: **/*
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
# [ATABEY] Agent Atabey — Global Army Rules
|
|
79
|
+
`);
|
|
80
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
const FRAMEWORK_NAME = "Agent Atabey";
|
|
7
|
+
export function scaffoldSkills(skillsBaseDir, dryRun) {
|
|
8
|
+
if (dryRun)
|
|
9
|
+
return;
|
|
10
|
+
ensureDir(skillsBaseDir, dryRun);
|
|
11
|
+
for (const [key, skill] of Object.entries(CORE_SKILLS)) {
|
|
12
|
+
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## [SECURITY] Core Mandates\n${skill.mandates.join("\n")}\n`;
|
|
13
|
+
writeTextFile(path.join(skillsBaseDir, `${key.toLowerCase()}.md`), mdContent);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function scaffoldStandards(frameworkDir, dryRun) {
|
|
17
|
+
if (dryRun)
|
|
18
|
+
return;
|
|
19
|
+
const knowledgePath = path.join(frameworkDir, "knowledge");
|
|
20
|
+
if (!fs.existsSync(knowledgePath))
|
|
21
|
+
fs.mkdirSync(knowledgePath, { recursive: true });
|
|
22
|
+
const eslintStandardsContent = `# [ATABEY] Agent Atabey — ESLint Standards
|
|
23
|
+
|
|
24
|
+
This document outlines the strict ESLint coding standards for Agent Atabey projects.
|
|
25
|
+
|
|
26
|
+
## 📏 Core Rules
|
|
27
|
+
- **Indentation:** 4 spaces (strict).
|
|
28
|
+
- **Quotes:** Double quotes (\`"\`) for strings.
|
|
29
|
+
- **Semicolons:** Always terminate statements with a semicolon (\`;\`).
|
|
30
|
+
- **No Explicit Any:** Avoid using \`any\`. Use strongly typed interfaces, generics, or \`unknown\` with type assertions.
|
|
31
|
+
- **Unused Variables:** Warning on unused variables unless prefixed with an underscore (\`_\`).
|
|
32
|
+
`;
|
|
33
|
+
writeTextFile(path.join(knowledgePath, "eslint-standards.md"), eslintStandardsContent);
|
|
34
|
+
const standards = [
|
|
35
|
+
// ── Supreme Governance (required by @manager, @security, @architect) ──────
|
|
36
|
+
{ file: "governance-standards.md", template: "templates/standards/governance-standards.md", default: "# [ATABEY] Agent Atabey — Governance & Nizam Standards" },
|
|
37
|
+
// ── Core Engineering Standards ────────────────────────────────────────────
|
|
38
|
+
{ file: "crud-governance.md", template: "templates/standards/crud-governance.md", default: "# [GOV] Corporate CRUD and Governance Standards" },
|
|
39
|
+
{ file: "architecture-standards.md", template: "templates/standards/architecture-standards.md", default: "# 📐 Corporate Architecture Standards" },
|
|
40
|
+
{ file: "frontend-standards.md", template: "templates/standards/frontend-standards.md", default: "# 🎨 Corporate Frontend Standards" },
|
|
41
|
+
{ file: "vite-standards.md", template: "templates/standards/vite-standards.md", default: "# ⚡ Corporate Vite Standards" },
|
|
42
|
+
{ file: "nextjs-standards.md", template: "templates/standards/nextjs-standards.md", default: "# ⚛️ Corporate Next.js Standards" },
|
|
43
|
+
{ file: "tailwind-standards.md", template: "templates/standards/tailwind-standards.md", default: "# 🌊 Corporate Tailwind Standards" },
|
|
44
|
+
{ file: "mobile-standards.md", template: "templates/standards/mobile-standards.md", default: "# 📱 Corporate Mobile Standards" },
|
|
45
|
+
{ file: "security-standards.md", template: "templates/standards/security-standards.md", default: "# [SECURITY] Corporate Security Standards" },
|
|
46
|
+
{ file: "quality-standards.md", template: "templates/standards/quality-standards.md", default: "# ⚖️ Corporate Code Quality Standards" },
|
|
47
|
+
{ file: "logging-and-secrets.md", template: "templates/standards/logging-and-secrets.md", default: "# 🪵 Corporate Logging Standards" },
|
|
48
|
+
{ file: "testing-standards.md", template: "templates/standards/testing-standards.md", default: "# [SKILL] Corporate Testing Standards" },
|
|
49
|
+
{ file: "i18n-standards.md", template: "templates/standards/i18n-standards.md", default: "# 🌐 Corporate i18n Standards" },
|
|
50
|
+
{ file: "llm-governance.md", template: "templates/standards/llm-governance.md", default: "# [AI] LLM Governance Standards" },
|
|
51
|
+
{ file: "observability-standards.md", template: "templates/standards/observability-standards.md", default: "# 📈 Corporate Observability Standards" },
|
|
52
|
+
{ file: "deployment-standards.md", template: "templates/standards/deployment-standards.md", default: "# [START] Corporate Deployment Standards" },
|
|
53
|
+
{ file: "performance-standards.md", template: "templates/standards/performance-standards.md", default: "# ⚡ Corporate Performance Standards" },
|
|
54
|
+
{ file: "security-audit-standards.md", template: "templates/standards/security-audit-standards.md", default: "# 🔍 Corporate Security Audit Standards" }
|
|
55
|
+
];
|
|
56
|
+
for (const std of standards) {
|
|
57
|
+
let content = std.default;
|
|
58
|
+
try {
|
|
59
|
+
const fullTemplatePath = path.join(getPackageRoot(), std.template);
|
|
60
|
+
if (fs.existsSync(fullTemplatePath)) {
|
|
61
|
+
content = fs.readFileSync(fullTemplatePath, "utf8");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch { /* fallback to default */ }
|
|
65
|
+
writeTextFile(path.join(knowledgePath, std.file), content);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import readline from "readline";
|
|
3
|
+
import { resolveAdapter, runAdapterPostInit, scaffoldAgents, resolveAgentsDir, mirrorUnifiedAgentsToNative, ADAPTER_IDS, } from "../adapters/index.js";
|
|
4
|
+
import { ensureDir } from "../utils/fs.js";
|
|
5
|
+
import { initializeMemory, getConfiguredPaths } from "../utils/memory.js";
|
|
6
|
+
import { getPackageVersion, getPackageRoot, mergePackageJson } from "../utils/pkg.js";
|
|
7
|
+
import { UI } from "../utils/ui.js";
|
|
8
|
+
import { ALL_AGENTS } from "../../modules/agents/definitions.js";
|
|
9
|
+
import { scaffoldConstitution, scaffoldFrameworkConfigs, scaffoldShims } from "./init/scaffold-core.js";
|
|
10
|
+
import { scaffoldSkills, scaffoldStandards } from "./init/scaffold-standards.js";
|
|
11
|
+
import { scaffoldOps } from "./init/scaffold-ops.js";
|
|
12
|
+
import { scaffoldProjectDocs } from "./init/scaffold-docs.js";
|
|
13
|
+
import { TRANSLATIONS } from "../utils/i18n.js";
|
|
14
|
+
const FRAMEWORK_NAME = "Agent Atabey";
|
|
15
|
+
const FRAMEWORK_SUBDIRS = [
|
|
16
|
+
"agents",
|
|
17
|
+
"skills",
|
|
18
|
+
"knowledge",
|
|
19
|
+
"prompts",
|
|
20
|
+
"memory",
|
|
21
|
+
"router",
|
|
22
|
+
"registry",
|
|
23
|
+
"observability",
|
|
24
|
+
"rules",
|
|
25
|
+
];
|
|
26
|
+
async function runInteractiveInit() {
|
|
27
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
28
|
+
const question = (query) => new Promise((resolve) => rl.question(query, resolve));
|
|
29
|
+
try {
|
|
30
|
+
console.warn("\n🌐 Select Framework Language / Dil Seçimi:");
|
|
31
|
+
console.warn("1. Türkçe");
|
|
32
|
+
console.warn("2. English");
|
|
33
|
+
const langInput = await question("\nSelect (1-2) or Enter for 'tr': ");
|
|
34
|
+
const language = langInput.trim() === "2" ? "en" : "tr";
|
|
35
|
+
const t = TRANSLATIONS[language];
|
|
36
|
+
console.warn(`\n[START] ${t.welcome}`);
|
|
37
|
+
console.warn(`\n${t.select_backend}:`);
|
|
38
|
+
const languages = ["Node.js (TypeScript)", "Go", "Java (Spring Boot)", "Python (FastAPI)", ".NET"];
|
|
39
|
+
languages.forEach((l, i) => console.warn(`${i + 1}. ${l}`));
|
|
40
|
+
const bLangInput = await question("\nSelect (1-5) or Enter for \"Node.js\": ");
|
|
41
|
+
const backendLanguage = languages[parseInt(bLangInput.trim()) - 1] || "Node.js (TypeScript)";
|
|
42
|
+
console.warn(`\n${t.select_frontend}:`);
|
|
43
|
+
const frontendFrameworks = ["Vite (React)", "Next.js (App Router)", "Vanilla HTML/JS"];
|
|
44
|
+
frontendFrameworks.forEach((f, i) => console.warn(`${i + 1}. ${f}`));
|
|
45
|
+
const fFrameInput = await question("\nSelect (1-3) or Enter for \"Vite (React)\": ");
|
|
46
|
+
const frontendFramework = frontendFrameworks[parseInt(fFrameInput.trim()) - 1] || "Vite (React)";
|
|
47
|
+
console.warn("\nAvailable Framework Directories:");
|
|
48
|
+
FRAMEWORK_SUBDIRS.forEach((d, i) => console.warn(`${i + 1}. ${d}`));
|
|
49
|
+
const dirInput = await question(`\n${t.select_dirs} `);
|
|
50
|
+
const selectedDirs = dirInput ? dirInput.split(",").map(n => FRAMEWORK_SUBDIRS[parseInt(n.trim()) - 1]).filter(Boolean) : [...FRAMEWORK_SUBDIRS];
|
|
51
|
+
console.warn("\nAvailable Core Agents:");
|
|
52
|
+
ALL_AGENTS.forEach((a, i) => console.warn(`${i + 1}. ${a.name}`));
|
|
53
|
+
const agentInput = await question(`\n${t.select_agents} `);
|
|
54
|
+
const selectedAgents = agentInput ? agentInput.split(",").map(n => ALL_AGENTS[parseInt(n.trim()) - 1].name).filter(Boolean) : ALL_AGENTS.map(a => a.name);
|
|
55
|
+
console.warn("\nAvailable Color Palettes:");
|
|
56
|
+
const palettes = ["Modern Blue", "Enterprise Slate", "Deep Purple"];
|
|
57
|
+
palettes.forEach((p, i) => console.warn(`${i + 1}. ${p}`));
|
|
58
|
+
const palInput = await question(`\n${t.select_palette} `);
|
|
59
|
+
const selectedPalette = palettes[parseInt(palInput.trim()) - 1] || "Modern Blue";
|
|
60
|
+
return { selectedDirs, selectedAgents, selectedPalette, backendLanguage, frontendFramework, language };
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
rl.close();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export async function initCommand(adapterName, options) {
|
|
67
|
+
const adapterId = (adapterName || "gemini");
|
|
68
|
+
const adapter = resolveAdapter(adapterId);
|
|
69
|
+
if (!adapter) {
|
|
70
|
+
UI.error(`Unknown adapter: ${adapterId}`);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
const projectRoot = process.cwd();
|
|
74
|
+
const isUnified = options.unified || false;
|
|
75
|
+
// STRICT ISOLATION STRATEGY
|
|
76
|
+
const coreDir = ".atabey"; // Pure Memory & Knowledge
|
|
77
|
+
const aiToolDir = isUnified ? ".agents" : adapter.frameworkDir; // Pure Agents & Skills
|
|
78
|
+
const dryRun = options.dryRun || false;
|
|
79
|
+
const forceYes = options.yes || false;
|
|
80
|
+
UI.intent("Atabey Initialization", `Bootstrapping ${FRAMEWORK_NAME} (v${getPackageVersion()}) with ${adapterId} adapter...`);
|
|
81
|
+
let selectedDirs;
|
|
82
|
+
let selectedAgents;
|
|
83
|
+
let selectedPalette;
|
|
84
|
+
let backendLanguage;
|
|
85
|
+
let frontendFramework;
|
|
86
|
+
let language;
|
|
87
|
+
if (forceYes) {
|
|
88
|
+
selectedDirs = ["knowledge", "prompts", "memory", "router", "registry", "observability", "rules"];
|
|
89
|
+
selectedAgents = ALL_AGENTS.map(a => a.name);
|
|
90
|
+
selectedPalette = "Modern Blue";
|
|
91
|
+
backendLanguage = "Node.js (TypeScript)";
|
|
92
|
+
frontendFramework = "Vite (React)";
|
|
93
|
+
language = "tr";
|
|
94
|
+
UI.success("Non-interactive mode: Using default configurations (Language: tr, Backend: Node.js, Frontend: Vite).");
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
const result = await runInteractiveInit();
|
|
98
|
+
selectedDirs = result.selectedDirs.filter(d => d !== "agents" && d !== "skills");
|
|
99
|
+
selectedAgents = result.selectedAgents;
|
|
100
|
+
selectedPalette = result.selectedPalette;
|
|
101
|
+
backendLanguage = result.backendLanguage;
|
|
102
|
+
frontendFramework = result.frontendFramework;
|
|
103
|
+
language = result.language;
|
|
104
|
+
}
|
|
105
|
+
const t = TRANSLATIONS[language];
|
|
106
|
+
ensureDir(path.join(projectRoot, coreDir), dryRun);
|
|
107
|
+
selectedDirs.forEach(dir => {
|
|
108
|
+
ensureDir(path.join(projectRoot, coreDir, dir), dryRun);
|
|
109
|
+
});
|
|
110
|
+
ensureDir(path.join(projectRoot, aiToolDir), dryRun);
|
|
111
|
+
if (adapter.nestedDirs) {
|
|
112
|
+
adapter.nestedDirs.forEach(dir => ensureDir(path.join(projectRoot, aiToolDir, dir), dryRun));
|
|
113
|
+
}
|
|
114
|
+
scaffoldConstitution(projectRoot, coreDir, adapterId, dryRun, language);
|
|
115
|
+
scaffoldFrameworkConfigs(projectRoot, coreDir, adapter, dryRun, selectedPalette, {
|
|
116
|
+
unified: isUnified,
|
|
117
|
+
adapters: isUnified ? [...ADAPTER_IDS] : [adapterId],
|
|
118
|
+
backendLanguage,
|
|
119
|
+
frontendFramework,
|
|
120
|
+
language
|
|
121
|
+
});
|
|
122
|
+
scaffoldStandards(path.join(projectRoot, coreDir), dryRun);
|
|
123
|
+
const pathsMap = getConfiguredPaths();
|
|
124
|
+
if (isUnified) {
|
|
125
|
+
// Scaffold ALL agents for ALL adapters under unified hub
|
|
126
|
+
for (const id of ADAPTER_IDS) {
|
|
127
|
+
const adapterId = id;
|
|
128
|
+
const dest = resolveAgentsDir(adapterId, true, aiToolDir);
|
|
129
|
+
scaffoldAgents(projectRoot, adapterId, dryRun, selectedAgents, dest.agentsDir, dest.agentsExt, pathsMap, backendLanguage, language);
|
|
130
|
+
if (!dryRun)
|
|
131
|
+
mirrorUnifiedAgentsToNative(projectRoot, adapterId);
|
|
132
|
+
}
|
|
133
|
+
UI.success(`[OK] Scaffolding complete for all adapters under ${aiToolDir}/ with native mirrors.`);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
// Standard single-adapter scaffold
|
|
137
|
+
const dest = resolveAgentsDir(adapterId, false);
|
|
138
|
+
scaffoldAgents(projectRoot, adapterId, dryRun, selectedAgents, dest.agentsDir, dest.agentsExt, pathsMap, backendLanguage, language);
|
|
139
|
+
UI.success(`[OK] Generated agent definitions under ${dest.agentsDir}/`);
|
|
140
|
+
}
|
|
141
|
+
const skillsBaseDir = path.join(projectRoot, aiToolDir, "skills");
|
|
142
|
+
scaffoldSkills(skillsBaseDir, dryRun);
|
|
143
|
+
scaffoldOps(path.join(projectRoot, coreDir), dryRun);
|
|
144
|
+
scaffoldProjectDocs(projectRoot, { backendLanguage, frontendFramework }, dryRun);
|
|
145
|
+
scaffoldShims(projectRoot, coreDir, adapterId, adapter, dryRun, isUnified);
|
|
146
|
+
// Initialize runtime directories
|
|
147
|
+
if (!dryRun) {
|
|
148
|
+
ensureDir(path.join(projectRoot, coreDir, "messages"));
|
|
149
|
+
ensureDir(path.join(projectRoot, coreDir, "logs"));
|
|
150
|
+
ensureDir(path.join(projectRoot, coreDir, "memory-graph"));
|
|
151
|
+
}
|
|
152
|
+
initializeMemory(path.join(projectRoot, coreDir), dryRun);
|
|
153
|
+
// Scaffolding package.json
|
|
154
|
+
if (!dryRun) {
|
|
155
|
+
const pkgJsonPath = path.join(projectRoot, "package.json");
|
|
156
|
+
const sourcePkgPath = path.join(getPackageRoot(), "package.json");
|
|
157
|
+
mergePackageJson(pkgJsonPath, sourcePkgPath);
|
|
158
|
+
}
|
|
159
|
+
runAdapterPostInit(adapter, projectRoot);
|
|
160
|
+
UI.success(`\n[START] ${FRAMEWORK_NAME} (v${getPackageVersion()}) ${t.init_success}`);
|
|
161
|
+
console.warn(`\n- Brain & Memory Hub (Protected): ${coreDir}/`);
|
|
162
|
+
console.warn(`- AI Agent Commands (Active): ${aiToolDir}/`);
|
|
163
|
+
console.warn(`\n${t.next_steps}`);
|
|
164
|
+
console.warn(" 1. Run 'npm install' (or pnpm/yarn) to install dependencies.");
|
|
165
|
+
console.warn(" 2. Run 'atabey status' to verify the environment.");
|
|
166
|
+
console.warn(` 3. Open ${adapterId === "claude" ? "Claude Desktop" : "your AI Assistant"} and start commanding the Army.`);
|
|
167
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { getFrameworkDir } from "../utils/memory.js";
|
|
4
|
+
import { writeTextFile } from "../utils/fs.js";
|
|
5
|
+
export async function updateKnowledgeBaseCommand(topic, content) {
|
|
6
|
+
if (!topic || !content) {
|
|
7
|
+
console.error("[ERROR] Usage: atabey update_knowledge_base <topic> <content>");
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const frameworkDir = getFrameworkDir();
|
|
11
|
+
const kbDir = path.join(frameworkDir, "knowledge");
|
|
12
|
+
if (!fs.existsSync(kbDir))
|
|
13
|
+
fs.mkdirSync(kbDir, { recursive: true });
|
|
14
|
+
const fileName = topic.replace(/[^a-z0-9]/gi, "_").toLowerCase() + ".md";
|
|
15
|
+
writeTextFile(path.join(kbDir, fileName), content);
|
|
16
|
+
console.warn(`[OK] Knowledge base updated: ${topic}`);
|
|
17
|
+
}
|
|
18
|
+
export async function searchKnowledgeBaseCommand(query) {
|
|
19
|
+
if (!query) {
|
|
20
|
+
console.error("[ERROR] Usage: atabey search_knowledge_base <query>");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const frameworkDir = getFrameworkDir();
|
|
24
|
+
const kbDir = path.join(frameworkDir, "knowledge");
|
|
25
|
+
if (!fs.existsSync(kbDir)) {
|
|
26
|
+
console.warn("ℹ️ Knowledge base is empty.");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const files = fs.readdirSync(kbDir).filter(f => f.endsWith(".md"));
|
|
30
|
+
let found = false;
|
|
31
|
+
for (const file of files) {
|
|
32
|
+
const content = fs.readFileSync(path.join(kbDir, file), "utf-8");
|
|
33
|
+
if (content.toLowerCase().includes(query.toLowerCase()) || file.toLowerCase().includes(query.toLowerCase())) {
|
|
34
|
+
console.warn(`
|
|
35
|
+
### ${file.replace(".md", "")}
|
|
36
|
+
${content.slice(0, 300)}...`);
|
|
37
|
+
found = true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!found)
|
|
41
|
+
console.warn("ℹ️ No matching entries found.");
|
|
42
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
import { getPackageVersion } from "../utils/pkg.js";
|
|
3
|
+
/**
|
|
4
|
+
* Run ESLint for the project (same as npm run lint).
|
|
5
|
+
*/
|
|
6
|
+
export async function lintCommand() {
|
|
7
|
+
console.warn(`🔍 Running ESLint (v${getPackageVersion()})...`);
|
|
8
|
+
const projectRoot = process.cwd();
|
|
9
|
+
try {
|
|
10
|
+
execSync("npm run lint", {
|
|
11
|
+
cwd: projectRoot,
|
|
12
|
+
stdio: "inherit",
|
|
13
|
+
env: process.env,
|
|
14
|
+
});
|
|
15
|
+
console.warn("\n[OK] ESLint passed with no errors.");
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
console.warn("\n[ERROR] ESLint reported errors. Fix violations before committing.");
|
|
19
|
+
console.warn(" Tip: npm run lint -- --fix");
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { normalizeAgentName } from "../utils/string.js";
|
|
2
|
+
import { Storage } from "../../shared/storage.js";
|
|
3
|
+
export async function logAgentActionCommand(data) {
|
|
4
|
+
const agent = normalizeAgentName(data.agent);
|
|
5
|
+
const db = Storage.getDB();
|
|
6
|
+
db.prepare(`
|
|
7
|
+
INSERT INTO logs (agent, action, trace_id, status, summary, findings)
|
|
8
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
9
|
+
`).run(agent, data.action, data.traceId || null, data.status || "SUCCESS", data.summary || "", data.details ? JSON.stringify(data.details) : null);
|
|
10
|
+
}
|