stigmergy 1.1.6 → 1.2.6
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/LICENSE +18 -18
- package/README.md +28 -223
- package/STIGMERGY.md +61 -61
- package/docs/PROJECT_CONSTITUTION.md +433 -433
- package/docs/PROJECT_STRUCTURE_CURRENT.md +80 -80
- package/examples/calculator-example.js +72 -72
- package/examples/cline_usage_examples.md +364 -364
- package/examples/encryption-example.js +67 -67
- package/examples/json-parser-example.js +120 -120
- package/examples/json-validation-example.js +64 -64
- package/examples/rest-client-example.js +52 -52
- package/examples/rest_client_example.js +54 -54
- package/package.json +15 -7
- package/scripts/build.js +74 -74
- package/scripts/post-deployment-config.js +296 -296
- package/scripts/preinstall-check.js +173 -111
- package/scripts/publish.js +58 -268
- package/scripts/run-layered-tests.js +247 -0
- package/scripts/safe-install.js +139 -139
- package/scripts/simple-publish.js +57 -59
- package/src/adapters/claude/install_claude_integration.js +292 -0
- package/src/adapters/codebuddy/install_codebuddy_integration.js +349 -0
- package/src/adapters/codex/install_codex_integration.js +395 -0
- package/src/adapters/copilot/install_copilot_integration.js +716 -0
- package/src/adapters/gemini/install_gemini_integration.js +304 -0
- package/src/adapters/iflow/install_iflow_integration.js +304 -0
- package/src/adapters/qoder/install_qoder_integration.js +1090 -0
- package/src/adapters/qwen/install_qwen_integration.js +285 -0
- package/src/auth.js +173 -173
- package/src/auth_command.js +208 -208
- package/src/calculator.js +313 -313
- package/src/cli/router.js +792 -67
- package/src/core/cache_cleaner.js +767 -0
- package/src/core/cli_help_analyzer.js +680 -674
- package/src/core/cli_parameter_handler.js +132 -127
- package/src/core/cli_tools.js +89 -89
- package/src/core/coordination/index.js +16 -16
- package/src/core/coordination/nodejs/AdapterManager.js +102 -89
- package/src/core/coordination/nodejs/CLCommunication.js +132 -124
- package/src/core/coordination/nodejs/CLIIntegrationManager.js +272 -236
- package/src/core/coordination/nodejs/HealthChecker.js +76 -77
- package/src/core/coordination/nodejs/HookDeploymentManager.js +263 -190
- package/src/core/coordination/nodejs/StatisticsCollector.js +71 -71
- package/src/core/coordination/nodejs/index.js +90 -72
- package/src/core/coordination/nodejs/utils/Logger.js +29 -29
- package/src/core/enhanced_installer.js +479 -0
- package/src/core/enhanced_uninstaller.js +638 -0
- package/src/core/error_handler.js +406 -406
- package/src/core/installer.js +816 -294
- package/src/core/memory_manager.js +83 -83
- package/src/core/rest_client.js +160 -160
- package/src/core/smart_router.js +249 -146
- package/src/core/upgrade_manager.js +420 -0
- package/src/data_encryption.js +143 -143
- package/src/data_structures.js +440 -440
- package/src/deploy.js +55 -55
- package/src/index.js +30 -30
- package/src/test/cli-availability-checker.js +194 -0
- package/src/test/test-environment.js +289 -0
- package/src/utils/helpers.js +35 -35
- package/src/utils.js +921 -915
- package/src/weatherProcessor.js +228 -228
- package/test/calculator.test.js +0 -215
- package/test/collision-test.js +0 -26
- package/test/comprehensive-execution-test.js +0 -428
- package/test/conflict-prevention-test.js +0 -95
- package/test/cross-cli-detection-test.js +0 -33
- package/test/csv-processing-test.js +0 -36
- package/test/deploy-hooks-test.js +0 -250
- package/test/e2e/claude-cli-test.js +0 -128
- package/test/e2e/collaboration-test.js +0 -75
- package/test/e2e/comprehensive-test.js +0 -431
- package/test/e2e/error-handling-test.js +0 -90
- package/test/e2e/individual-tool-test.js +0 -143
- package/test/e2e/other-cli-test.js +0 -130
- package/test/e2e/qoder-cli-test.js +0 -128
- package/test/e2e/run-e2e-tests.js +0 -73
- package/test/e2e/test-data.js +0 -88
- package/test/e2e/test-utils.js +0 -222
- package/test/encryption-simple-test.js +0 -110
- package/test/encryption.test.js +0 -129
- package/test/enhanced-main-alignment.test.js +0 -298
- package/test/error-handling-test.js +0 -341
- package/test/fibonacci.test.js +0 -178
- package/test/final-deploy-test.js +0 -221
- package/test/final-install-test.js +0 -226
- package/test/hash-table-demo.js +0 -33
- package/test/hash-table-test.js +0 -26
- package/test/hash_table_test.js +0 -114
- package/test/hook-system-integration-test.js +0 -307
- package/test/iflow-integration-test.js +0 -292
- package/test/improved-install-test.js +0 -362
- package/test/install-command-test.js +0 -370
- package/test/json-parser-test.js +0 -161
- package/test/json-validation-test.js +0 -164
- package/test/natural-language-skills-test.js +0 -320
- package/test/nl-integration-test.js +0 -179
- package/test/parameter-parsing-test.js +0 -143
- package/test/plugin-deployment-test.js +0 -316
- package/test/postinstall-test.js +0 -269
- package/test/python-plugins-test.js +0 -259
- package/test/real-test.js +0 -435
- package/test/remaining-adapters-test.js +0 -256
- package/test/rest-client-test.js +0 -56
- package/test/rest_client.test.js +0 -85
- package/test/simple-iflow-hook-test.js +0 -137
- package/test/system-compatibility-test.js +0 -467
- package/test/tdd-deploy-fix-test.js +0 -324
- package/test/tdd-fixes-test.js +0 -211
- package/test/third-party-skills-test.js +0 -321
- package/test/tool-selection-integration-test.js +0 -158
- package/test/unit/calculator-full.test.js +0 -191
- package/test/unit/calculator-simple.test.js +0 -96
- package/test/unit/calculator.test.js +0 -97
- package/test/unit/cli-scanner.test.js +0 -291
- package/test/unit/cli_parameter_handler.test.js +0 -116
- package/test/unit/cross-cli-executor.test.js +0 -399
- package/test/weather-processor.test.js +0 -104
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
// src/core/coordination/nodejs/StatisticsCollector.js
|
|
2
|
-
class StatisticsCollector {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.counters = {};
|
|
5
|
-
this.timings = {};
|
|
6
|
-
this.startTime = Date.now();
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
initialize() {
|
|
10
|
-
console.log('[STATISTICS_COLLECTOR] Initializing statistics collector...');
|
|
11
|
-
this.reset();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
reset() {
|
|
15
|
-
this.counters = {
|
|
16
|
-
cross_cli_calls: 0,
|
|
17
|
-
successful_calls: 0,
|
|
18
|
-
failed_calls: 0,
|
|
19
|
-
adapter_loads: 0
|
|
20
|
-
};
|
|
21
|
-
this.timings = {
|
|
22
|
-
execution_times: [],
|
|
23
|
-
last_reset: Date.now()
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
incrementCounter(name) {
|
|
28
|
-
this.counters[name] = (this.counters[name] || 0) + 1;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
recordExecutionTime(timeMs) {
|
|
32
|
-
this.timings.execution_times.push(timeMs);
|
|
33
|
-
// Keep only last 1000 timings to prevent memory bloat
|
|
34
|
-
if (this.timings.execution_times.length > 1000) {
|
|
35
|
-
this.timings.execution_times.shift();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getAdapterStats(cliName) {
|
|
40
|
-
return {
|
|
41
|
-
calls: this.counters.cross_cli_calls,
|
|
42
|
-
successRate: this.calculateSuccessRate(),
|
|
43
|
-
averageExecutionTime: this.calculateAverageExecutionTime(),
|
|
44
|
-
uptime: Date.now() - this.startTime
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
getAllStats() {
|
|
49
|
-
return {
|
|
50
|
-
counters: this.counters,
|
|
51
|
-
timings: {
|
|
52
|
-
...this.timings,
|
|
53
|
-
averageExecutionTime: this.calculateAverageExecutionTime()
|
|
54
|
-
},
|
|
55
|
-
uptime: Date.now() - this.startTime
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
calculateSuccessRate() {
|
|
60
|
-
if (this.counters.cross_cli_calls === 0) return 1.0;
|
|
61
|
-
return this.counters.successful_calls / this.counters.cross_cli_calls;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
calculateAverageExecutionTime() {
|
|
65
|
-
if (this.timings.execution_times.length === 0) return 0;
|
|
66
|
-
const sum = this.timings.execution_times.reduce((a, b) => a + b, 0);
|
|
67
|
-
return sum / this.timings.execution_times.length;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
module.exports = StatisticsCollector;
|
|
1
|
+
// src/core/coordination/nodejs/StatisticsCollector.js
|
|
2
|
+
class StatisticsCollector {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.counters = {};
|
|
5
|
+
this.timings = {};
|
|
6
|
+
this.startTime = Date.now();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
initialize() {
|
|
10
|
+
console.log('[STATISTICS_COLLECTOR] Initializing statistics collector...');
|
|
11
|
+
this.reset();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
reset() {
|
|
15
|
+
this.counters = {
|
|
16
|
+
cross_cli_calls: 0,
|
|
17
|
+
successful_calls: 0,
|
|
18
|
+
failed_calls: 0,
|
|
19
|
+
adapter_loads: 0,
|
|
20
|
+
};
|
|
21
|
+
this.timings = {
|
|
22
|
+
execution_times: [],
|
|
23
|
+
last_reset: Date.now(),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
incrementCounter(name) {
|
|
28
|
+
this.counters[name] = (this.counters[name] || 0) + 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
recordExecutionTime(timeMs) {
|
|
32
|
+
this.timings.execution_times.push(timeMs);
|
|
33
|
+
// Keep only last 1000 timings to prevent memory bloat
|
|
34
|
+
if (this.timings.execution_times.length > 1000) {
|
|
35
|
+
this.timings.execution_times.shift();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getAdapterStats(cliName) {
|
|
40
|
+
return {
|
|
41
|
+
calls: this.counters.cross_cli_calls,
|
|
42
|
+
successRate: this.calculateSuccessRate(),
|
|
43
|
+
averageExecutionTime: this.calculateAverageExecutionTime(),
|
|
44
|
+
uptime: Date.now() - this.startTime,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getAllStats() {
|
|
49
|
+
return {
|
|
50
|
+
counters: this.counters,
|
|
51
|
+
timings: {
|
|
52
|
+
...this.timings,
|
|
53
|
+
averageExecutionTime: this.calculateAverageExecutionTime(),
|
|
54
|
+
},
|
|
55
|
+
uptime: Date.now() - this.startTime,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
calculateSuccessRate() {
|
|
60
|
+
if (this.counters.cross_cli_calls === 0) return 1.0;
|
|
61
|
+
return this.counters.successful_calls / this.counters.cross_cli_calls;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
calculateAverageExecutionTime() {
|
|
65
|
+
if (this.timings.execution_times.length === 0) return 0;
|
|
66
|
+
const sum = this.timings.execution_times.reduce((a, b) => a + b, 0);
|
|
67
|
+
return sum / this.timings.execution_times.length;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
module.exports = StatisticsCollector;
|
|
@@ -1,72 +1,90 @@
|
|
|
1
|
-
// src/core/coordination/nodejs/index.js
|
|
2
|
-
const AdapterManager = require('./AdapterManager');
|
|
3
|
-
const CLCommunication = require('./CLCommunication');
|
|
4
|
-
const StatisticsCollector = require('./StatisticsCollector');
|
|
5
|
-
const HealthChecker = require('./HealthChecker');
|
|
6
|
-
|
|
7
|
-
class NodeJsCoordinationLayer {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.adapterManager = new AdapterManager();
|
|
10
|
-
this.communication = new CLCommunication();
|
|
11
|
-
this.statistics = new StatisticsCollector();
|
|
12
|
-
this.healthChecker = new HealthChecker();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async initialize(options = {}) {
|
|
16
|
-
try {
|
|
17
|
-
console.log(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.
|
|
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
|
-
|
|
1
|
+
// src/core/coordination/nodejs/index.js
|
|
2
|
+
const AdapterManager = require('./AdapterManager');
|
|
3
|
+
const CLCommunication = require('./CLCommunication');
|
|
4
|
+
const StatisticsCollector = require('./StatisticsCollector');
|
|
5
|
+
const HealthChecker = require('./HealthChecker');
|
|
6
|
+
|
|
7
|
+
class NodeJsCoordinationLayer {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.adapterManager = new AdapterManager();
|
|
10
|
+
this.communication = new CLCommunication();
|
|
11
|
+
this.statistics = new StatisticsCollector();
|
|
12
|
+
this.healthChecker = new HealthChecker();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async initialize(options = {}) {
|
|
16
|
+
try {
|
|
17
|
+
console.log(
|
|
18
|
+
'[NODEJS_COORDINATION] Initializing Node.js coordination layer...',
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
// Initialize components
|
|
22
|
+
await this.adapterManager.initialize();
|
|
23
|
+
await this.communication.initialize();
|
|
24
|
+
this.statistics.initialize();
|
|
25
|
+
|
|
26
|
+
// Perform health check
|
|
27
|
+
const health = await this.healthChecker.checkHealth();
|
|
28
|
+
if (!health.healthy) {
|
|
29
|
+
console.warn(
|
|
30
|
+
'[NODEJS_COORDINATION] Health check issues detected:',
|
|
31
|
+
health,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
console.log(
|
|
36
|
+
'[NODEJS_COORDINATION] Node.js coordination layer initialized successfully',
|
|
37
|
+
);
|
|
38
|
+
return true;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error(
|
|
41
|
+
'[NODEJS_COORDINATION] Failed to initialize Node.js coordination layer:',
|
|
42
|
+
error,
|
|
43
|
+
);
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async executeCrossCLITask(sourceCLI, targetCLI, task, context = {}) {
|
|
49
|
+
this.statistics.incrementCounter('cross_cli_calls');
|
|
50
|
+
const startTime = Date.now();
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
const result = await this.communication.executeTask(
|
|
54
|
+
sourceCLI,
|
|
55
|
+
targetCLI,
|
|
56
|
+
task,
|
|
57
|
+
context,
|
|
58
|
+
);
|
|
59
|
+
this.statistics.recordExecutionTime(Date.now() - startTime);
|
|
60
|
+
this.statistics.incrementCounter('successful_calls');
|
|
61
|
+
return result;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
this.statistics.incrementCounter('failed_calls');
|
|
64
|
+
console.error(
|
|
65
|
+
'[NODEJS_COORDINATION] Cross-CLI task execution failed:',
|
|
66
|
+
error,
|
|
67
|
+
);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async getAdapterStatistics(cliName) {
|
|
73
|
+
return this.statistics.getAdapterStats(cliName);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async getSystemStatus() {
|
|
77
|
+
return {
|
|
78
|
+
implementation: 'nodejs',
|
|
79
|
+
health: await this.healthChecker.checkHealth(),
|
|
80
|
+
statistics: this.statistics.getAllStats(),
|
|
81
|
+
adapters: await this.adapterManager.listAdapters(),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async healthCheck() {
|
|
86
|
+
return await this.healthChecker.checkHealth();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
module.exports = NodeJsCoordinationLayer;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
// src/core/coordination/nodejs/utils/Logger.js
|
|
2
|
-
class Logger {
|
|
3
|
-
constructor(component) {
|
|
4
|
-
this.component = component;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
info(message) {
|
|
8
|
-
this.log('INFO', message);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
warn(message) {
|
|
12
|
-
this.log('WARN', message);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
error(message) {
|
|
16
|
-
this.log('ERROR', message);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
debug(message) {
|
|
20
|
-
this.log('DEBUG', message);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
log(level, message) {
|
|
24
|
-
const timestamp = new Date().toISOString();
|
|
25
|
-
console.log(`[${timestamp}] [${level}] [${this.component}] ${message}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
module.exports = Logger;
|
|
1
|
+
// src/core/coordination/nodejs/utils/Logger.js
|
|
2
|
+
class Logger {
|
|
3
|
+
constructor(component) {
|
|
4
|
+
this.component = component;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
info(message) {
|
|
8
|
+
this.log('INFO', message);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
warn(message) {
|
|
12
|
+
this.log('WARN', message);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
error(message) {
|
|
16
|
+
this.log('ERROR', message);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
debug(message) {
|
|
20
|
+
this.log('DEBUG', message);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
log(level, message) {
|
|
24
|
+
const timestamp = new Date().toISOString();
|
|
25
|
+
console.log(`[${timestamp}] [${level}] [${this.component}] ${message}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = Logger;
|