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
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
// src/core/memory_manager.js
|
|
2
|
-
|
|
3
|
-
const fs = require('fs/promises');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const os = require('os');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Memory Manager - Handles global memory and context sharing between CLI tools
|
|
9
|
-
*/
|
|
10
|
-
class MemoryManager {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.globalMemoryFile = path.join(
|
|
13
|
-
os.homedir(),
|
|
14
|
-
'.stigmergy',
|
|
15
|
-
'memory.json',
|
|
16
|
-
);
|
|
17
|
-
this.projectMemoryFile = path.join(process.cwd(), 'STIGMERGY.md');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Get global memory data
|
|
22
|
-
* @returns {Promise<Object>} Memory data
|
|
23
|
-
*/
|
|
24
|
-
async getGlobalMemory() {
|
|
25
|
-
try {
|
|
26
|
-
const data = await fs.readFile(this.globalMemoryFile, 'utf8');
|
|
27
|
-
return JSON.parse(data);
|
|
28
|
-
} catch (error) {
|
|
29
|
-
// Return default memory structure if file doesn't exist or is invalid
|
|
30
|
-
return {
|
|
31
|
-
version: '1.0.0',
|
|
32
|
-
lastUpdated: new Date().toISOString(),
|
|
33
|
-
interactions: [],
|
|
34
|
-
collaborations: [],
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Update global memory data
|
|
41
|
-
* @param {Function} updateFn - Function that takes current memory and returns updated memory
|
|
42
|
-
* @returns {Promise<Object>} Updated memory data
|
|
43
|
-
*/
|
|
44
|
-
async updateGlobalMemory(updateFn) {
|
|
45
|
-
const memory = await this.getGlobalMemory();
|
|
46
|
-
const updatedMemory = updateFn(memory);
|
|
47
|
-
updatedMemory.lastUpdated = new Date().toISOString();
|
|
48
|
-
|
|
49
|
-
// Ensure directory exists
|
|
50
|
-
const dir = path.dirname(this.globalMemoryFile);
|
|
51
|
-
await fs.mkdir(dir, { recursive: true });
|
|
52
|
-
|
|
53
|
-
// Write updated memory
|
|
54
|
-
await fs.writeFile(
|
|
55
|
-
this.globalMemoryFile,
|
|
56
|
-
JSON.stringify(updatedMemory, null, 2),
|
|
57
|
-
);
|
|
58
|
-
return updatedMemory;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Add an interaction record to memory
|
|
63
|
-
* @param {string} tool - CLI tool name
|
|
64
|
-
* @param {string} prompt - User prompt
|
|
65
|
-
* @param {string} response - Tool response
|
|
66
|
-
* @param {number} duration - Execution duration in milliseconds
|
|
67
|
-
* @returns {Promise<void>}
|
|
68
|
-
*/
|
|
69
|
-
async addInteraction(tool, prompt, response, duration = 0) {
|
|
70
|
-
await this.updateGlobalMemory((memory) => {
|
|
71
|
-
memory.interactions.push({
|
|
72
|
-
timestamp: new Date().toISOString(),
|
|
73
|
-
tool,
|
|
74
|
-
prompt,
|
|
75
|
-
response,
|
|
76
|
-
duration,
|
|
77
|
-
});
|
|
78
|
-
return memory;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
module.exports = MemoryManager;
|
|
1
|
+
// src/core/memory_manager.js
|
|
2
|
+
|
|
3
|
+
const fs = require('fs/promises');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Memory Manager - Handles global memory and context sharing between CLI tools
|
|
9
|
+
*/
|
|
10
|
+
class MemoryManager {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.globalMemoryFile = path.join(
|
|
13
|
+
os.homedir(),
|
|
14
|
+
'.stigmergy',
|
|
15
|
+
'memory.json',
|
|
16
|
+
);
|
|
17
|
+
this.projectMemoryFile = path.join(process.cwd(), 'STIGMERGY.md');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get global memory data
|
|
22
|
+
* @returns {Promise<Object>} Memory data
|
|
23
|
+
*/
|
|
24
|
+
async getGlobalMemory() {
|
|
25
|
+
try {
|
|
26
|
+
const data = await fs.readFile(this.globalMemoryFile, 'utf8');
|
|
27
|
+
return JSON.parse(data);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
// Return default memory structure if file doesn't exist or is invalid
|
|
30
|
+
return {
|
|
31
|
+
version: '1.0.0',
|
|
32
|
+
lastUpdated: new Date().toISOString(),
|
|
33
|
+
interactions: [],
|
|
34
|
+
collaborations: [],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Update global memory data
|
|
41
|
+
* @param {Function} updateFn - Function that takes current memory and returns updated memory
|
|
42
|
+
* @returns {Promise<Object>} Updated memory data
|
|
43
|
+
*/
|
|
44
|
+
async updateGlobalMemory(updateFn) {
|
|
45
|
+
const memory = await this.getGlobalMemory();
|
|
46
|
+
const updatedMemory = updateFn(memory);
|
|
47
|
+
updatedMemory.lastUpdated = new Date().toISOString();
|
|
48
|
+
|
|
49
|
+
// Ensure directory exists
|
|
50
|
+
const dir = path.dirname(this.globalMemoryFile);
|
|
51
|
+
await fs.mkdir(dir, { recursive: true });
|
|
52
|
+
|
|
53
|
+
// Write updated memory
|
|
54
|
+
await fs.writeFile(
|
|
55
|
+
this.globalMemoryFile,
|
|
56
|
+
JSON.stringify(updatedMemory, null, 2),
|
|
57
|
+
);
|
|
58
|
+
return updatedMemory;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Add an interaction record to memory
|
|
63
|
+
* @param {string} tool - CLI tool name
|
|
64
|
+
* @param {string} prompt - User prompt
|
|
65
|
+
* @param {string} response - Tool response
|
|
66
|
+
* @param {number} duration - Execution duration in milliseconds
|
|
67
|
+
* @returns {Promise<void>}
|
|
68
|
+
*/
|
|
69
|
+
async addInteraction(tool, prompt, response, duration = 0) {
|
|
70
|
+
await this.updateGlobalMemory((memory) => {
|
|
71
|
+
memory.interactions.push({
|
|
72
|
+
timestamp: new Date().toISOString(),
|
|
73
|
+
tool,
|
|
74
|
+
prompt,
|
|
75
|
+
response,
|
|
76
|
+
duration,
|
|
77
|
+
});
|
|
78
|
+
return memory;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
module.exports = MemoryManager;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// src/core/multilingual/language-pattern-manager.js
|
|
2
|
+
|
|
3
|
+
class LanguagePatternManager {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.supportedLanguages = {
|
|
6
|
+
en: { name: 'English', direction: 'ltr' },
|
|
7
|
+
zh: { name: 'Chinese', direction: 'ltr' },
|
|
8
|
+
ja: { name: 'Japanese', direction: 'ltr' },
|
|
9
|
+
ko: { name: 'Korean', direction: 'ltr' },
|
|
10
|
+
de: { name: 'German', direction: 'ltr' },
|
|
11
|
+
fr: { name: 'French', direction: 'ltr' },
|
|
12
|
+
es: { name: 'Spanish', direction: 'ltr' },
|
|
13
|
+
it: { name: 'Italian', direction: 'ltr' },
|
|
14
|
+
pt: { name: 'Portuguese', direction: 'ltr' },
|
|
15
|
+
ru: { name: 'Russian', direction: 'ltr' },
|
|
16
|
+
ar: { name: 'Arabic', direction: 'rtl' },
|
|
17
|
+
tr: { name: 'Turkish', direction: 'ltr' }
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Define language patterns directly, same as in HookDeploymentManager.js
|
|
21
|
+
this.languagePatterns = {
|
|
22
|
+
// English patterns
|
|
23
|
+
en: [
|
|
24
|
+
{ name: 'use_tool_for_task', regex: /(?:use|call|ask)\s+(\w+)\s+(?:to|for)\s+(.+)$/i },
|
|
25
|
+
{ name: 'please_use_tool', regex: /(?:please\s+)?(?:use|call|ask)\s+(\w+)\s+(.+)$/i },
|
|
26
|
+
{ name: 'tool_please_help', regex: /(\w+)[,\s]+(?:please\s+)?(?:help\s+me\s+)?(.+)$/i }
|
|
27
|
+
],
|
|
28
|
+
// Chinese patterns
|
|
29
|
+
zh: [
|
|
30
|
+
{ name: 'qing_yong_gongneng_bang_wo', regex: /请用(\w+)\s*帮我(.+)$/i },
|
|
31
|
+
{ name: 'diaoyong_lai', regex: /调用(\w+)\s*来(.+)$/i },
|
|
32
|
+
{ name: 'yong_gongneng_bang_wo', regex: /用(\w+)\s*帮我(.+)$/i },
|
|
33
|
+
{ name: 'tool_comma_task', regex: /(\w+),(.+)$/i },
|
|
34
|
+
{ name: 'rang_gongneng', regex: /让(\w+)\s*(.+)$/i }
|
|
35
|
+
],
|
|
36
|
+
// German patterns
|
|
37
|
+
de: [
|
|
38
|
+
{ name: 'benutze_tool_um', regex: /benutze\s+(\w+)\s+um\s+(.+)$/i },
|
|
39
|
+
{ name: 'verwende_tool_fur', regex: /verwende\s+(\w+)\s+für\s+(.+)$/i },
|
|
40
|
+
{ name: 'rufe_tool_fur_an', regex: /rufe\s+(\w+)\s+für\s+(.+)\s+an$/i }
|
|
41
|
+
],
|
|
42
|
+
// French patterns
|
|
43
|
+
fr: [
|
|
44
|
+
{ name: 'utilise_tool_pour', regex: /utilise\s+(\w+)\s+pour\s+(.+)$/i },
|
|
45
|
+
{ name: 'emploie_tool_avec', regex: /emploie\s+(\w+)\s+avec\s+(.+)$/i },
|
|
46
|
+
{ name: 'appelle_tool_pour', regex: /appelle\s+(\w+)\s+pour\s+(.+)$/i }
|
|
47
|
+
],
|
|
48
|
+
// Spanish patterns
|
|
49
|
+
es: [
|
|
50
|
+
{ name: 'usa_tool_para', regex: /usa\s+(\w+)\s+para\s+(.+)$/i },
|
|
51
|
+
{ name: 'utiliza_tool_para', regex: /utiliza\s+(\w+)\s+para\s+(.+)$/i },
|
|
52
|
+
{ name: 'llama_tool_para', regex: /llama\s+(\w+)\s+para\s+(.+)$/i }
|
|
53
|
+
],
|
|
54
|
+
// Italian patterns
|
|
55
|
+
it: [
|
|
56
|
+
{ name: 'usa_tool_per', regex: /usa\s+(\w+)\s+per\s+(.+)$/i },
|
|
57
|
+
{ name: 'utilizza_tool_per', regex: /utilizza\s+(\w+)\s+per\s+(.+)$/i },
|
|
58
|
+
{ name: 'chiedi_tool_per', regex: /chiedi\s+(\w+)\s+per\s+(.+)$/i }
|
|
59
|
+
],
|
|
60
|
+
// Portuguese patterns
|
|
61
|
+
pt: [
|
|
62
|
+
{ name: 'usa_tool_para_pt', regex: /usa\s+(\w+)\s+para\s+(.+)$/i },
|
|
63
|
+
{ name: 'utiliza_tool_para_pt', regex: /utiliza\s+(\w+)\s+para\s+(.+)$/i },
|
|
64
|
+
{ name: 'chama_tool_para', regex: /chama\s+(\w+)\s+para\s+(.+)$/i }
|
|
65
|
+
],
|
|
66
|
+
// Russian patterns
|
|
67
|
+
ru: [
|
|
68
|
+
{ name: 'ispolzuy_tool_chtoby', regex: /используй\s+(\w+)\s+чтобы\s+(.+)$/i },
|
|
69
|
+
{ name: 'primeni_tool_dlya', regex: /примени\s+(\w+)\s+для\s+(.+)$/i },
|
|
70
|
+
{ name: 'vysovyi_tool_dlya', regex: /вызови\s+(\w+)\s+для\s+(.+)$/i }
|
|
71
|
+
],
|
|
72
|
+
// Arabic patterns
|
|
73
|
+
ar: [
|
|
74
|
+
{ name: 'ista5dam_tool_liktabat', regex: /استخدم\s+(\w+)\s+ل(?:كتابة|عمل)\s+(.+)$/i },
|
|
75
|
+
{ name: 'atssil_b_tool', regex: /اتصل\s+ب\s+(\w+)\s+(.+)$/i },
|
|
76
|
+
{ name: 'ast5raj_tool', regex: /استخرج\s+(\w+)\s+(.+)$/i }
|
|
77
|
+
],
|
|
78
|
+
// Japanese patterns
|
|
79
|
+
ja: [
|
|
80
|
+
{ name: 'tool_o_tsukatte', regex: /(\w+)\s*を使って\s*(.+)$/i },
|
|
81
|
+
{ name: 'tool_wo_yatte', regex: /(\w+)\s*を\s*やって\s*(.+)$/i },
|
|
82
|
+
{ name: 'tool_ni_onegaishimasu', regex: /(\w+)、\s*(.+)$/i }
|
|
83
|
+
],
|
|
84
|
+
// Korean patterns
|
|
85
|
+
ko: [
|
|
86
|
+
{ name: 'tool_sayonghae', regex: /(\w+)\s*를\s*사용해\s*(.+)$/i },
|
|
87
|
+
{ name: 'tool_sayonghayeyo', regex: /(\w+)\s*를\s*사용하여\s*(.+)$/i },
|
|
88
|
+
{ name: 'tool_irae', regex: /(\w+)\s*을\s*이용해\s*(.+)$/i },
|
|
89
|
+
{ name: 'tool_ggumyeon', regex: /(\w+)\s*하고\s*(.+)$/i }
|
|
90
|
+
],
|
|
91
|
+
// Turkish patterns
|
|
92
|
+
tr: [
|
|
93
|
+
{ name: 'tool_icin_kullan', regex: /(\w+)'?u\s*(.+)\s+için\s+kullan/i },
|
|
94
|
+
{ name: 'tool_kullan_icin', regex: /(\w+)\s*kullan\s+için\s*(.+)$/i },
|
|
95
|
+
{ name: 'tool_ile_yap', regex: /(\w+)\s*ile\s*(.+)$/i }
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
getPatterns(languageCode) {
|
|
101
|
+
return this.languagePatterns[languageCode] || [];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
getAllPatterns() {
|
|
105
|
+
return this.languagePatterns;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
detectLanguage() {
|
|
109
|
+
// Try to detect language from environment variables
|
|
110
|
+
const envLang = process.env.LANG || process.env.LANGUAGE || process.env.LC_ALL || process.env.LC_MESSAGES;
|
|
111
|
+
|
|
112
|
+
if (envLang) {
|
|
113
|
+
// Extract language code (e.g., en_US.UTF-8 -> en)
|
|
114
|
+
const langCode = envLang.split('.')[0].split('_')[0].split('-')[0].toLowerCase();
|
|
115
|
+
if (this.supportedLanguages[langCode]) {
|
|
116
|
+
return langCode;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Try to detect language using Intl API
|
|
121
|
+
try {
|
|
122
|
+
if (typeof Intl !== 'undefined' && Intl.DateTimeFormat) {
|
|
123
|
+
const locale = Intl.DateTimeFormat().resolvedOptions().locale;
|
|
124
|
+
if (locale) {
|
|
125
|
+
const langCode = locale.split('-')[0].toLowerCase();
|
|
126
|
+
if (this.supportedLanguages[langCode]) {
|
|
127
|
+
return langCode;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
} catch (error) {
|
|
132
|
+
// Intl API not available or failed
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Default to English
|
|
136
|
+
return 'en';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
detectCrossCLIRequest(input, preferredLanguage = null) {
|
|
140
|
+
// If preferred language is specified, try that first
|
|
141
|
+
if (preferredLanguage && this.languagePatterns[preferredLanguage]) {
|
|
142
|
+
const result = this.matchPatterns(input, preferredLanguage);
|
|
143
|
+
if (result) return result;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Try user's detected language
|
|
147
|
+
const detectedLanguage = this.detectLanguage();
|
|
148
|
+
if (detectedLanguage !== preferredLanguage) {
|
|
149
|
+
const result = this.matchPatterns(input, detectedLanguage);
|
|
150
|
+
if (result) return result;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Fall back to English
|
|
154
|
+
if (detectedLanguage !== 'en') {
|
|
155
|
+
const result = this.matchPatterns(input, 'en');
|
|
156
|
+
if (result) return result;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Try all languages as last resort
|
|
160
|
+
for (const languageCode in this.languagePatterns) {
|
|
161
|
+
if (languageCode !== detectedLanguage && languageCode !== 'en') {
|
|
162
|
+
const result = this.matchPatterns(input, languageCode);
|
|
163
|
+
if (result) return result;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
matchPatterns(input, languageCode) {
|
|
171
|
+
const patterns = this.languagePatterns[languageCode];
|
|
172
|
+
if (!patterns) return null;
|
|
173
|
+
|
|
174
|
+
for (const pattern of patterns) {
|
|
175
|
+
const match = input.match(pattern.regex);
|
|
176
|
+
if (match && match.length >= 3) {
|
|
177
|
+
const targetCLI = match[1].toLowerCase();
|
|
178
|
+
const task = match[2];
|
|
179
|
+
|
|
180
|
+
// Validate that the target CLI is supported
|
|
181
|
+
const supportedCLIs = [
|
|
182
|
+
'claude', 'gemini', 'qwen', 'iflow', 'qodercli', 'codebuddy', 'codex', 'copilot'
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
if (supportedCLIs.includes(targetCLI)) {
|
|
186
|
+
return {
|
|
187
|
+
targetCLI: targetCLI,
|
|
188
|
+
task: task,
|
|
189
|
+
language: languageCode,
|
|
190
|
+
patternName: pattern.name
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
module.exports = LanguagePatternManager;
|