stigmergy 1.2.6 → 1.2.10
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 +69 -20
- package/STIGMERGY.md +26 -7
- package/docs/MULTI_USER_WIKI_COLLABORATION_SYSTEM.md +523 -0
- package/docs/PROMPT_BASED_SKILLS_SYSTEM_DESIGN.md +458 -0
- package/docs/SKILL_IMPLEMENTATION_CONSTRAINTS_AND_ALIGNMENT.md +423 -0
- package/docs/TECHNICAL_FEASIBILITY_ANALYSIS.md +308 -0
- package/examples/multilingual-hook-demo.js +125 -0
- package/package.json +30 -19
- package/scripts/dependency-analyzer.js +101 -0
- package/scripts/generate-cli-docs.js +64 -0
- package/scripts/postuninstall.js +46 -0
- package/scripts/preuninstall.js +85 -0
- package/scripts/run-layered-tests.js +3 -3
- package/src/adapters/claude/install_claude_integration.js +37 -37
- package/src/adapters/codebuddy/install_codebuddy_integration.js +66 -63
- package/src/adapters/codex/install_codex_integration.js +54 -55
- package/src/adapters/copilot/install_copilot_integration.js +46 -46
- package/src/adapters/gemini/install_gemini_integration.js +68 -68
- package/src/adapters/iflow/install_iflow_integration.js +77 -77
- package/src/adapters/qoder/install_qoder_integration.js +76 -76
- package/src/adapters/qwen/install_qwen_integration.js +23 -23
- package/src/cli/router.js +713 -163
- package/src/commands/skill-bridge.js +39 -0
- package/src/commands/skill-handler.js +150 -0
- package/src/commands/skill.js +127 -0
- package/src/core/cache_cleaner.js +767 -767
- package/src/core/cli_help_analyzer.js +680 -680
- package/src/core/cli_parameter_handler.js +132 -132
- package/src/core/cli_path_detector.js +573 -0
- package/src/core/cli_tools.js +160 -89
- package/src/core/coordination/index.js +16 -16
- package/src/core/coordination/nodejs/AdapterManager.js +130 -102
- package/src/core/coordination/nodejs/CLCommunication.js +132 -132
- package/src/core/coordination/nodejs/CLIIntegrationManager.js +272 -272
- package/src/core/coordination/nodejs/HealthChecker.js +76 -76
- package/src/core/coordination/nodejs/HookDeploymentManager.js +463 -274
- package/src/core/coordination/nodejs/StatisticsCollector.js +71 -71
- package/src/core/coordination/nodejs/index.js +90 -90
- package/src/core/coordination/nodejs/utils/Logger.js +29 -29
- package/src/core/directory_permission_manager.js +568 -0
- package/src/core/enhanced_cli_installer.js +609 -0
- package/src/core/error_handler.js +406 -406
- package/src/core/installer.js +263 -119
- package/src/core/memory_manager.js +83 -83
- package/src/core/multilingual/language-pattern-manager.js +200 -0
- package/src/core/persistent_shell_configurator.js +468 -0
- package/src/core/rest_client.js +160 -160
- package/src/core/skills/StigmergySkillManager.js +357 -0
- package/src/core/skills/__tests__/SkillInstaller.test.js +275 -0
- package/src/core/skills/__tests__/SkillParser.test.js +202 -0
- package/src/core/skills/__tests__/SkillReader.test.js +189 -0
- package/src/core/skills/cli-command-test.js +201 -0
- package/src/core/skills/comprehensive-e2e-test.js +473 -0
- package/src/core/skills/e2e-test.js +267 -0
- package/src/core/skills/embedded-openskills/SkillInstaller.js +438 -0
- package/src/core/skills/embedded-openskills/SkillParser.js +123 -0
- package/src/core/skills/embedded-openskills/SkillReader.js +143 -0
- package/src/core/skills/integration-test.js +248 -0
- package/src/core/skills/package.json +6 -0
- package/src/core/skills/regression-test.js +285 -0
- package/src/core/skills/run-all-tests.js +129 -0
- package/src/core/skills/sync-test.js +210 -0
- package/src/core/skills/test-runner.js +242 -0
- package/src/core/smart_router.js +261 -249
- package/src/core/upgrade_manager.js +48 -20
- package/src/index.js +30 -30
- package/src/test/cli-availability-checker.js +194 -194
- package/src/test/test-environment.js +289 -289
- package/src/utils/helpers.js +18 -35
- package/src/utils.js +921 -921
- package/src/weatherProcessor.js +228 -228
- package/test/multilingual/hook-deployment.test.js +91 -0
- package/test/multilingual/language-pattern-manager.test.js +140 -0
- package/test/multilingual/system-test.js +85 -0
- package/src/auth.js +0 -173
- package/src/auth_command.js +0 -208
- package/src/calculator.js +0 -313
- package/src/core/enhanced_installer.js +0 -479
- package/src/core/enhanced_uninstaller.js +0 -638
- package/src/data_encryption.js +0 -143
- package/src/data_structures.js +0 -440
- package/src/deploy.js +0 -55
package/src/core/cli_tools.js
CHANGED
|
@@ -1,89 +1,160 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const os = require('os');
|
|
3
|
-
const { errorHandler, ERROR_TYPES } = require('./error_handler');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*
|
|
68
|
-
* @
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const { errorHandler, ERROR_TYPES } = require('./error_handler');
|
|
4
|
+
const CLIPathDetector = require('./cli_path_detector');
|
|
5
|
+
|
|
6
|
+
// AI CLI Tools Configuration
|
|
7
|
+
const CLI_TOOLS = {
|
|
8
|
+
claude: {
|
|
9
|
+
name: 'Claude CLI',
|
|
10
|
+
version: 'claude --version',
|
|
11
|
+
install: 'npm install -g @anthropic-ai/claude-code',
|
|
12
|
+
hooksDir: path.join(os.homedir(), '.claude', 'hooks'),
|
|
13
|
+
config: path.join(os.homedir(), '.claude', 'config.json'),
|
|
14
|
+
},
|
|
15
|
+
gemini: {
|
|
16
|
+
name: 'Gemini CLI',
|
|
17
|
+
version: 'gemini --version',
|
|
18
|
+
install: 'npm install -g @google/gemini-cli',
|
|
19
|
+
hooksDir: path.join(os.homedir(), '.gemini', 'extensions'),
|
|
20
|
+
config: path.join(os.homedir(), '.gemini', 'config.json'),
|
|
21
|
+
},
|
|
22
|
+
qwen: {
|
|
23
|
+
name: 'Qwen CLI',
|
|
24
|
+
version: 'qwen --version',
|
|
25
|
+
install: 'npm install -g @qwen-code/qwen-code',
|
|
26
|
+
hooksDir: path.join(os.homedir(), '.qwen', 'hooks'),
|
|
27
|
+
config: path.join(os.homedir(), '.qwen', 'config.json'),
|
|
28
|
+
},
|
|
29
|
+
iflow: {
|
|
30
|
+
name: 'iFlow CLI',
|
|
31
|
+
version: 'iflow --version',
|
|
32
|
+
install: 'npm install -g @iflow-ai/iflow-cli',
|
|
33
|
+
hooksDir: path.join(os.homedir(), '.iflow', 'hooks'),
|
|
34
|
+
config: path.join(os.homedir(), '.iflow', 'config.json'),
|
|
35
|
+
},
|
|
36
|
+
qodercli: {
|
|
37
|
+
name: 'Qoder CLI',
|
|
38
|
+
version: 'qodercli --version',
|
|
39
|
+
install: 'npm install -g @qoder-ai/qodercli',
|
|
40
|
+
hooksDir: path.join(os.homedir(), '.qoder', 'hooks'),
|
|
41
|
+
config: path.join(os.homedir(), '.qoder', 'config.json'),
|
|
42
|
+
},
|
|
43
|
+
codebuddy: {
|
|
44
|
+
name: 'CodeBuddy CLI',
|
|
45
|
+
version: 'codebuddy --version',
|
|
46
|
+
install: 'npm install -g @tencent-ai/codebuddy-code',
|
|
47
|
+
hooksDir: path.join(os.homedir(), '.codebuddy', 'hooks'),
|
|
48
|
+
config: path.join(os.homedir(), '.codebuddy', 'config.json'),
|
|
49
|
+
},
|
|
50
|
+
copilot: {
|
|
51
|
+
name: 'GitHub Copilot CLI',
|
|
52
|
+
version: 'copilot --version',
|
|
53
|
+
install: 'npm install -g @github/copilot',
|
|
54
|
+
hooksDir: path.join(os.homedir(), '.copilot', 'mcp'),
|
|
55
|
+
config: path.join(os.homedir(), '.copilot', 'config.json'),
|
|
56
|
+
},
|
|
57
|
+
codex: {
|
|
58
|
+
name: 'OpenAI Codex CLI',
|
|
59
|
+
version: 'codex --version',
|
|
60
|
+
install: 'npm install -g @openai/codex',
|
|
61
|
+
hooksDir: path.join(os.homedir(), '.config', 'codex', 'slash_commands'),
|
|
62
|
+
config: path.join(os.homedir(), '.codex', 'config.json'),
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Validate CLI tool configuration
|
|
68
|
+
* @param {string} toolName - Name of the tool to validate
|
|
69
|
+
* @throws {StigmergyError} If validation fails
|
|
70
|
+
*/
|
|
71
|
+
function validateCLITool(toolName) {
|
|
72
|
+
if (!CLI_TOOLS[toolName]) {
|
|
73
|
+
throw errorHandler.createError(
|
|
74
|
+
`CLI tool '${toolName}' is not configured`,
|
|
75
|
+
ERROR_TYPES.CONFIGURATION,
|
|
76
|
+
'INVALID_CLI_TOOL',
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const tool = CLI_TOOLS[toolName];
|
|
81
|
+
if (!tool.name || !tool.version || !tool.install) {
|
|
82
|
+
throw errorHandler.createError(
|
|
83
|
+
`CLI tool '${toolName}' has invalid configuration`,
|
|
84
|
+
ERROR_TYPES.CONFIGURATION,
|
|
85
|
+
'INCOMPLETE_CLI_CONFIG',
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Create global path detector instance (lazy initialization)
|
|
92
|
+
*/
|
|
93
|
+
let pathDetector = null;
|
|
94
|
+
|
|
95
|
+
function getPathDetector() {
|
|
96
|
+
if (!pathDetector) {
|
|
97
|
+
pathDetector = new CLIPathDetector();
|
|
98
|
+
}
|
|
99
|
+
return pathDetector;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Initialize path detection and load cached paths
|
|
104
|
+
*/
|
|
105
|
+
async function initializePathDetection() {
|
|
106
|
+
const detector = getPathDetector();
|
|
107
|
+
await detector.loadDetectedPaths();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Get CLI tool path with automatic detection fallback
|
|
112
|
+
*/
|
|
113
|
+
async function getCLIPath(toolName) {
|
|
114
|
+
const detector = getPathDetector();
|
|
115
|
+
|
|
116
|
+
// Check cached paths first
|
|
117
|
+
let toolPath = detector.getDetectedPath(toolName);
|
|
118
|
+
if (toolPath) {
|
|
119
|
+
return toolPath;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// If not cached, detect and update
|
|
123
|
+
console.log(`[PATH] Detecting path for ${toolName}...`);
|
|
124
|
+
toolPath = await detector.detectCLIPath(toolName);
|
|
125
|
+
|
|
126
|
+
return toolPath;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Update PATH configuration and run path detection
|
|
131
|
+
*/
|
|
132
|
+
async function setupCLIPaths() {
|
|
133
|
+
console.log('[PATH] Setting up CLI paths configuration...');
|
|
134
|
+
|
|
135
|
+
const detector = getPathDetector();
|
|
136
|
+
|
|
137
|
+
// 1. Load existing cached paths
|
|
138
|
+
await detector.loadDetectedPaths();
|
|
139
|
+
|
|
140
|
+
// 2. Detect all CLI paths
|
|
141
|
+
const detectedPaths = await detector.detectAllCLIPaths();
|
|
142
|
+
|
|
143
|
+
// 3. Check and update PATH if needed
|
|
144
|
+
const pathStatus = await detector.updatePATHIfMissing();
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
detectedPaths,
|
|
148
|
+
pathStatus,
|
|
149
|
+
report: detector.getPathStatusReport()
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
module.exports = {
|
|
154
|
+
CLI_TOOLS,
|
|
155
|
+
validateCLITool,
|
|
156
|
+
initializePathDetection,
|
|
157
|
+
getCLIPath,
|
|
158
|
+
setupCLIPaths,
|
|
159
|
+
CLIPathDetector
|
|
160
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
// Update main coordination layer to include Node.js components
|
|
2
|
-
// src/core/coordination/index.js
|
|
3
|
-
|
|
4
|
-
// Existing content would be here...
|
|
5
|
-
|
|
6
|
-
// Add Node.js coordination layer exports
|
|
7
|
-
const NodeJsCoordinationLayer = require('./nodejs');
|
|
8
|
-
const HookDeploymentManager = require('./nodejs/HookDeploymentManager');
|
|
9
|
-
const CLIIntegrationManager = require('./nodejs/CLIIntegrationManager');
|
|
10
|
-
|
|
11
|
-
module.exports = {
|
|
12
|
-
// Existing exports...
|
|
13
|
-
NodeJsCoordinationLayer,
|
|
14
|
-
HookDeploymentManager,
|
|
15
|
-
CLIIntegrationManager,
|
|
16
|
-
};
|
|
1
|
+
// Update main coordination layer to include Node.js components
|
|
2
|
+
// src/core/coordination/index.js
|
|
3
|
+
|
|
4
|
+
// Existing content would be here...
|
|
5
|
+
|
|
6
|
+
// Add Node.js coordination layer exports
|
|
7
|
+
const NodeJsCoordinationLayer = require('./nodejs');
|
|
8
|
+
const HookDeploymentManager = require('./nodejs/HookDeploymentManager');
|
|
9
|
+
const CLIIntegrationManager = require('./nodejs/CLIIntegrationManager');
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
// Existing exports...
|
|
13
|
+
NodeJsCoordinationLayer,
|
|
14
|
+
HookDeploymentManager,
|
|
15
|
+
CLIIntegrationManager,
|
|
16
|
+
};
|
|
@@ -1,102 +1,130 @@
|
|
|
1
|
-
// src/core/coordination/nodejs/AdapterManager.js
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const os = require('os');
|
|
5
|
-
|
|
6
|
-
class AdapterManager {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.adapters = new Map();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
console.
|
|
74
|
-
`[ADAPTER_MANAGER]
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
// src/core/coordination/nodejs/AdapterManager.js
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
|
|
6
|
+
class AdapterManager {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.adapters = new Map();
|
|
9
|
+
// Try multiple approaches for the adapters path to handle different installation scenarios
|
|
10
|
+
const primaryAdapterPath = this.findAdaptersPath();
|
|
11
|
+
this.discoveryPaths = [
|
|
12
|
+
primaryAdapterPath,
|
|
13
|
+
path.join(os.homedir(), '.stigmergy', 'adapters'),
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Find the adapters path using multiple approaches to handle different installation scenarios
|
|
19
|
+
*/
|
|
20
|
+
findAdaptersPath() {
|
|
21
|
+
const possiblePaths = [
|
|
22
|
+
// Standard path: src/core/coordination/nodejs/../../../adapters => src/adapters
|
|
23
|
+
path.join(__dirname, '..', '..', '..', 'adapters'),
|
|
24
|
+
// Fallback path in case of different module resolution
|
|
25
|
+
path.resolve(__dirname, '..', '..', '..', 'adapters'),
|
|
26
|
+
// Alternative approach: go to project root and then to adapters
|
|
27
|
+
path.join(__dirname, '..', '..', '..', '..', 'adapters')
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
for (const possiblePath of possiblePaths) {
|
|
31
|
+
if (fs.existsSync(possiblePath)) {
|
|
32
|
+
console.log(`[DEBUG] AdapterManager found adapters at: ${possiblePath}`);
|
|
33
|
+
return possiblePath;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// If none of the paths work, use the standard path as fallback (might not exist)
|
|
38
|
+
const fallbackPath = path.join(__dirname, '..', '..', '..', 'adapters');
|
|
39
|
+
console.log(`[DEBUG] AdapterManager using fallback adapters path (may not exist): ${fallbackPath}`);
|
|
40
|
+
return fallbackPath;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async initialize() {
|
|
44
|
+
console.log('[ADAPTER_MANAGER] Initializing adapter manager...');
|
|
45
|
+
await this.discoverAdapters();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async discoverAdapters() {
|
|
49
|
+
console.log('[ADAPTER_MANAGER] Discovering adapters...');
|
|
50
|
+
|
|
51
|
+
for (const basePath of this.discoveryPaths) {
|
|
52
|
+
if (fs.existsSync(basePath)) {
|
|
53
|
+
try {
|
|
54
|
+
const adapterDirs = fs
|
|
55
|
+
.readdirSync(basePath, { withFileTypes: true })
|
|
56
|
+
.filter((dirent) => dirent.isDirectory())
|
|
57
|
+
.map((dirent) => dirent.name);
|
|
58
|
+
|
|
59
|
+
console.log(
|
|
60
|
+
`[ADAPTER_MANAGER] Found ${adapterDirs.length} adapter directories in ${basePath}`,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
for (const dir of adapterDirs) {
|
|
64
|
+
await this.loadAdapter(dir, basePath);
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.warn(
|
|
68
|
+
`[ADAPTER_MANAGER] Failed to read adapter directory ${basePath}:`,
|
|
69
|
+
error.message,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
console.log(
|
|
74
|
+
`[ADAPTER_MANAGER] Adapter path does not exist: ${basePath}`,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async loadAdapter(adapterName, basePath) {
|
|
81
|
+
const adapterPath = path.join(basePath, adapterName, 'index.js');
|
|
82
|
+
|
|
83
|
+
if (fs.existsSync(adapterPath)) {
|
|
84
|
+
try {
|
|
85
|
+
// Create a simple adapter wrapper for Node.js
|
|
86
|
+
const adapter = {
|
|
87
|
+
name: adapterName,
|
|
88
|
+
path: adapterPath,
|
|
89
|
+
available: true,
|
|
90
|
+
version: '1.0.0-nodejs',
|
|
91
|
+
isAvailable: async () => true,
|
|
92
|
+
executeTask: async (task, context) => {
|
|
93
|
+
// Simple task execution simulation
|
|
94
|
+
return `[${adapterName.toUpperCase()} NODE.JS ADAPTER] Executed: ${task}`;
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
this.adapters.set(adapterName, adapter);
|
|
99
|
+
console.log(`[ADAPTER_MANAGER] Loaded Node.js adapter: ${adapterName}`);
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.warn(
|
|
102
|
+
`[ADAPTER_MANAGER] Failed to load adapter from ${adapterPath}:`,
|
|
103
|
+
error.message,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
console.log(
|
|
108
|
+
`[ADAPTER_MANAGER] Adapter index.js not found for: ${adapterName}`,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
getAdapter(cliName) {
|
|
114
|
+
return this.adapters.get(cliName.toLowerCase());
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async listAdapters() {
|
|
118
|
+
const adapterList = [];
|
|
119
|
+
for (const [name, adapter] of this.adapters) {
|
|
120
|
+
adapterList.push({
|
|
121
|
+
name,
|
|
122
|
+
available: await adapter.isAvailable(),
|
|
123
|
+
version: adapter.version || 'unknown',
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return adapterList;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
module.exports = AdapterManager;
|