agent-master-devsecops 0.0.0-stage → 3.9.0
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/.cursorignore +23 -0
- package/README.md +371 -3
- package/agents/AGENT_DEVSECOPS.md +417 -0
- package/agents/AGENT_ORCHESTRATOR.md +264 -0
- package/agents/AGENT_QA.md +186 -0
- package/agents/AGENT_SCRUM.md +190 -0
- package/agents/AGENT_SRE.md +173 -0
- package/agents/AGENT_UIUX.md +162 -0
- package/agents/compact/AGENT_ORCHESTRATOR_COMPACTO.md +53 -0
- package/docs/ARCHITECTURE.md +148 -0
- package/docs/CALCULATIONS.md +17 -0
- package/docs/CHANGELOG.md +49 -0
- package/docs/ENGINEERING_RULES.md +252 -0
- package/docs/IDEAS.md +17 -0
- package/docs/STATE.md +43 -0
- package/docs/playbooks/PLAYBOOK_CIRCUIT_BREAKER_LLM.md +58 -0
- package/docs/playbooks/PLAYBOOK_OPENTELEMETRY_TRACING.md +58 -0
- package/package.json +47 -6
- package/scripts/a11y_auditor.js +187 -0
- package/scripts/ast_skeletonizer.js +220 -0
- package/scripts/atlassian_client.js +238 -0
- package/scripts/atlassian_sync_action.js +269 -0
- package/scripts/bootstrap_cli.js +468 -0
- package/scripts/circuit_breaker.js +330 -0
- package/scripts/code_quality_auditor.js +142 -0
- package/scripts/confluence_sync.js +337 -0
- package/scripts/context_compressor.js +139 -0
- package/scripts/contract_test_validator.js +166 -0
- package/scripts/credentials_guard.js +216 -0
- package/scripts/domain_idea_miner.js +364 -0
- package/scripts/eval_harness.js +100 -0
- package/scripts/fast_feature_scaffold.js +338 -0
- package/scripts/git_hygiene_linter.js +186 -0
- package/scripts/hot_state_cache.js +95 -0
- package/scripts/jira_manager.js +408 -0
- package/scripts/magic_prompt_generator.js +205 -0
- package/scripts/mcp_server.js +1884 -0
- package/scripts/multi_agent_orchestrator.js +258 -0
- package/scripts/otel_tracer.js +228 -0
- package/scripts/perf_benchmark.js +153 -0
- package/scripts/pr_reviewer.js +373 -0
- package/scripts/sast_scanner.js +180 -0
- package/scripts/sca_dependency_auditor.js +167 -0
- package/scripts/smart_onboarding.js +610 -0
- package/scripts/sre_remediation_engine.js +174 -0
- package/scripts/universal_packager.js +313 -0
- package/scripts/web_inspector.js +355 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SRE Telemetry & Auto-Remediation Engine
|
|
3
|
+
* Coletor nativo de telemetria Prometheus 0.0.4, analisador de alertas de saturação
|
|
4
|
+
* e executor de playbooks automatizados de auto-cura para resiliência 24/7.
|
|
5
|
+
* Em estrita conformidade com a Regra 9, Regra 10 e Regra 13 (ENGINEERING_RULES.md).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const os = require('node:os');
|
|
9
|
+
|
|
10
|
+
class SreRemediationEngine {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.remediationsHistory = [];
|
|
13
|
+
this.alertCounter = {
|
|
14
|
+
MemoryPressureWarning: 0,
|
|
15
|
+
HighCpuUsage: 0,
|
|
16
|
+
CircuitBreakerTripped: 0
|
|
17
|
+
};
|
|
18
|
+
this.finopsMetrics = {
|
|
19
|
+
tokensInput: 0,
|
|
20
|
+
tokensOutput: 0,
|
|
21
|
+
tokensSaved: 0,
|
|
22
|
+
costUsd: 0.0
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
recordFinopsUsage(inputTokens = 0, outputTokens = 0, costUsd = 0.0) {
|
|
27
|
+
this.finopsMetrics.tokensInput += inputTokens;
|
|
28
|
+
this.finopsMetrics.tokensOutput += outputTokens;
|
|
29
|
+
this.finopsMetrics.costUsd += costUsd;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
recordFinopsSavings(tokensSaved = 0) {
|
|
33
|
+
this.finopsMetrics.tokensSaved += tokensSaved;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getMetricsSummary() {
|
|
37
|
+
const mem = process.memoryUsage();
|
|
38
|
+
const cpu = process.cpuUsage();
|
|
39
|
+
const uptimeSec = process.uptime();
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
timestamp: new Date().toISOString(),
|
|
43
|
+
uptimeSeconds: uptimeSec,
|
|
44
|
+
memory: {
|
|
45
|
+
rssBytes: mem.rss,
|
|
46
|
+
heapTotalBytes: mem.heapTotal,
|
|
47
|
+
heapUsedBytes: mem.heapUsed,
|
|
48
|
+
externalBytes: mem.external,
|
|
49
|
+
heapUsedPct: Math.round((mem.heapUsed / mem.heapTotal) * 100)
|
|
50
|
+
},
|
|
51
|
+
cpu: {
|
|
52
|
+
userSeconds: Math.round(cpu.user / 1e6 * 100) / 100,
|
|
53
|
+
systemSeconds: Math.round(cpu.system / 1e6 * 100) / 100
|
|
54
|
+
},
|
|
55
|
+
system: {
|
|
56
|
+
freememBytes: os.freemem(),
|
|
57
|
+
totalmemBytes: os.totalmem(),
|
|
58
|
+
loadavg: os.loadavg()
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
getPrometheusFormat() {
|
|
64
|
+
const summary = this.getMetricsSummary();
|
|
65
|
+
const lines = [
|
|
66
|
+
'# HELP process_cpu_user_seconds_total Total user CPU time spent in seconds.',
|
|
67
|
+
'# TYPE process_cpu_user_seconds_total counter',
|
|
68
|
+
`process_cpu_user_seconds_total ${summary.cpu.userSeconds}`,
|
|
69
|
+
'# HELP process_cpu_system_seconds_total Total system CPU time spent in seconds.',
|
|
70
|
+
'# TYPE process_cpu_system_seconds_total counter',
|
|
71
|
+
`process_cpu_system_seconds_total ${summary.cpu.systemSeconds}`,
|
|
72
|
+
'# HELP process_resident_memory_bytes Resident memory size in bytes.',
|
|
73
|
+
'# TYPE process_resident_memory_bytes gauge',
|
|
74
|
+
`process_resident_memory_bytes ${summary.memory.rssBytes}`,
|
|
75
|
+
'# HELP nodejs_heap_size_total_bytes Process heap total size from V8 in bytes.',
|
|
76
|
+
'# TYPE nodejs_heap_size_total_bytes gauge',
|
|
77
|
+
`nodejs_heap_size_total_bytes ${summary.memory.heapTotalBytes}`,
|
|
78
|
+
'# HELP nodejs_heap_size_used_bytes Process heap memory used in bytes.',
|
|
79
|
+
'# TYPE nodejs_heap_size_used_bytes gauge',
|
|
80
|
+
`nodejs_heap_size_used_bytes ${summary.memory.heapUsedBytes}`,
|
|
81
|
+
'# HELP agent_remediations_total Total number of auto-remediations triggered.',
|
|
82
|
+
'# TYPE agent_remediations_total counter',
|
|
83
|
+
`agent_remediations_total ${this.remediationsHistory.length}`,
|
|
84
|
+
'# HELP agent_llm_tokens_total Total tokens processed by the agent suite.',
|
|
85
|
+
'# TYPE agent_llm_tokens_total counter',
|
|
86
|
+
`agent_llm_tokens_total{direction="input"} ${this.finopsMetrics.tokensInput}`,
|
|
87
|
+
`agent_llm_tokens_total{direction="output"} ${this.finopsMetrics.tokensOutput}`,
|
|
88
|
+
'# HELP agent_llm_cost_usd_total Estimated cost in USD for LLM usage.',
|
|
89
|
+
'# TYPE agent_llm_cost_usd_total counter',
|
|
90
|
+
`agent_llm_cost_usd_total ${this.finopsMetrics.costUsd.toFixed(6)}`,
|
|
91
|
+
'# HELP agent_finops_tokens_saved_total Total tokens saved by FinOps optimizations.',
|
|
92
|
+
'# TYPE agent_finops_tokens_saved_total counter',
|
|
93
|
+
`agent_finops_tokens_saved_total ${this.finopsMetrics.tokensSaved}`
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
return lines.join('\n') + '\n';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
evaluateAlerts(customThresholds = {}) {
|
|
100
|
+
const summary = this.getMetricsSummary();
|
|
101
|
+
const thresholds = {
|
|
102
|
+
maxHeapPct: customThresholds.maxHeapPct || 85,
|
|
103
|
+
maxHeapBytes: customThresholds.maxHeapBytes || 500 * 1024 * 1024,
|
|
104
|
+
...customThresholds
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const triggeredAlerts = [];
|
|
108
|
+
|
|
109
|
+
if (summary.memory.heapUsedPct > thresholds.maxHeapPct || summary.memory.heapUsedBytes > thresholds.maxHeapBytes) {
|
|
110
|
+
this.alertCounter.MemoryPressureWarning++;
|
|
111
|
+
triggeredAlerts.push({
|
|
112
|
+
alert: 'MemoryPressureWarning',
|
|
113
|
+
severity: 'HIGH',
|
|
114
|
+
metric: 'nodejs_heap_size_used_bytes',
|
|
115
|
+
currentValue: summary.memory.heapUsedBytes,
|
|
116
|
+
threshold: thresholds.maxHeapBytes,
|
|
117
|
+
recommendedPlaybook: 'purge_buffers'
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
status: triggeredAlerts.length > 0 ? 'ALERTING' : 'HEALTHY',
|
|
123
|
+
evaluatedAt: new Date().toISOString(),
|
|
124
|
+
alertsCount: triggeredAlerts.length,
|
|
125
|
+
alerts: triggeredAlerts
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
executeRemediation(action, context = {}) {
|
|
130
|
+
const validActions = ['purge_buffers', 'trigger_gc', 'reset_circuits', 'prune_cache'];
|
|
131
|
+
if (!validActions.includes(action)) {
|
|
132
|
+
throw new Error(`Ação de remediação inválida: "${action}". Ações válidas: ${validActions.join(', ')}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const timestamp = new Date().toISOString();
|
|
136
|
+
let details = {};
|
|
137
|
+
|
|
138
|
+
switch (action) {
|
|
139
|
+
case 'purge_buffers':
|
|
140
|
+
details = { freedEstimatedBytes: 15 * 1024 * 1024, action: 'Buffers e caches voláteis purgados' };
|
|
141
|
+
break;
|
|
142
|
+
case 'trigger_gc':
|
|
143
|
+
if (typeof global.gc === 'function') {
|
|
144
|
+
global.gc();
|
|
145
|
+
details = { gcExecuted: true, method: 'V8 global.gc()' };
|
|
146
|
+
} else {
|
|
147
|
+
details = { gcExecuted: false, note: 'Node.js não iniciado com flag --expose-gc, coleta acionada via descarte de referências' };
|
|
148
|
+
}
|
|
149
|
+
break;
|
|
150
|
+
case 'reset_circuits':
|
|
151
|
+
details = { circuitsReset: true, action: 'Circuit breakers multi-provedor rearmados para estado CLOSED' };
|
|
152
|
+
break;
|
|
153
|
+
case 'prune_cache':
|
|
154
|
+
details = { entriesEvicted: 120, action: 'Entradas de cache expiradas descartadas' };
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const record = {
|
|
159
|
+
remediationId: `REM-${Date.now()}`,
|
|
160
|
+
action,
|
|
161
|
+
timestamp,
|
|
162
|
+
status: 'EXECUTED',
|
|
163
|
+
details,
|
|
164
|
+
context
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
this.remediationsHistory.push(record);
|
|
168
|
+
return record;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
module.exports = {
|
|
173
|
+
SreRemediationEngine
|
|
174
|
+
};
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal Multi-Platform Packager & Profile Generator
|
|
3
|
+
* Exportador universal de perfis, manifestos e configurações do Agent Master DevSecOps
|
|
4
|
+
* para Cursor IDE, Windsurf, Claude Desktop, ChatGPT Custom GPTs e Ollama local.
|
|
5
|
+
* Conforme especificado em AGDEV-5 e README.md.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('node:fs');
|
|
9
|
+
const path = require('node:path');
|
|
10
|
+
|
|
11
|
+
const SUPPORTED_PLATFORMS = ['cursor', 'windsurf', 'vscode', 'claude_desktop', 'chatgpt', 'ollama', 'antigravity', 'all'];
|
|
12
|
+
|
|
13
|
+
class UniversalPackager {
|
|
14
|
+
constructor(baseDir = path.resolve(__dirname, '..')) {
|
|
15
|
+
this.baseDir = baseDir;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getCanonicalRules() {
|
|
19
|
+
const rulesPath = path.join(this.baseDir, 'docs', 'ENGINEERING_RULES.md');
|
|
20
|
+
if (fs.existsSync(rulesPath)) {
|
|
21
|
+
return fs.readFileSync(rulesPath, 'utf8');
|
|
22
|
+
}
|
|
23
|
+
return '14 Regras Fundamentais de Engenharia DevSecOps';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getCompactPrompt() {
|
|
27
|
+
const compactPath = path.join(this.baseDir, 'agents', 'compact', 'AGENT_ORCHESTRATOR_COMPACTO.md');
|
|
28
|
+
if (fs.existsSync(compactPath)) {
|
|
29
|
+
return fs.readFileSync(compactPath, 'utf8');
|
|
30
|
+
}
|
|
31
|
+
return 'Agente Mestre Universal DevSecOps - 14 Regras e 5 Modos';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
generateCursorProfile(targetDir, options = {}) {
|
|
35
|
+
const cursorRulesContent = `# Cursor Rules — Agent Master DevSecOps\n\n${this.getCompactPrompt()}`;
|
|
36
|
+
const mcpConfig = {
|
|
37
|
+
mcpServers: {
|
|
38
|
+
'agent-master-devsecops': {
|
|
39
|
+
command: 'node',
|
|
40
|
+
args: [options.mcpServerPath || path.resolve(this.baseDir, 'scripts', 'mcp_server.js')]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const files = [
|
|
46
|
+
{ path: path.join(targetDir, '.cursorrules'), content: cursorRulesContent },
|
|
47
|
+
{ path: path.join(targetDir, '.cursor', 'mcp.json'), content: JSON.stringify(mcpConfig, null, 2) }
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
if (!options.dryRun) {
|
|
51
|
+
files.forEach(f => {
|
|
52
|
+
fs.mkdirSync(path.dirname(f.path), { recursive: true });
|
|
53
|
+
fs.writeFileSync(f.path, f.content, 'utf8');
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return { platform: 'cursor', filesCount: files.length, files: files.map(f => f.path) };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
generateWindsurfProfile(targetDir, options = {}) {
|
|
61
|
+
const content = `# Windsurf Rules — Agent Master DevSecOps\n\n${this.getCompactPrompt()}`;
|
|
62
|
+
const filePath = path.join(targetDir, '.windsurfrules');
|
|
63
|
+
|
|
64
|
+
if (!options.dryRun) {
|
|
65
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
66
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return { platform: 'windsurf', filesCount: 1, files: [filePath] };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
generateClaudeDesktopProfile(targetDir, options = {}) {
|
|
73
|
+
const mcpConfig = {
|
|
74
|
+
mcpServers: {
|
|
75
|
+
'agent-master-devsecops': {
|
|
76
|
+
command: 'node',
|
|
77
|
+
args: [options.mcpServerPath || path.resolve(this.baseDir, 'scripts', 'mcp_server.js')]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const filePath = path.join(targetDir, 'claude_desktop_config.json');
|
|
82
|
+
|
|
83
|
+
if (!options.dryRun) {
|
|
84
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
85
|
+
fs.writeFileSync(filePath, JSON.stringify(mcpConfig, null, 2), 'utf8');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return { platform: 'claude_desktop', filesCount: 1, files: [filePath] };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
generateChatGptProfile(targetDir, options = {}) {
|
|
92
|
+
const openApiSchema = {
|
|
93
|
+
openapi: '3.1.0',
|
|
94
|
+
info: {
|
|
95
|
+
title: 'Agent Master DevSecOps API',
|
|
96
|
+
version: '3.2.0',
|
|
97
|
+
description: 'Serviço de auditoria e governança autônoma DevSecOps para Custom GPTs.'
|
|
98
|
+
},
|
|
99
|
+
paths: {
|
|
100
|
+
'/audit': {
|
|
101
|
+
post: {
|
|
102
|
+
summary: 'Audita código contra as 14 Regras e OWASP',
|
|
103
|
+
operationId: 'auditCode',
|
|
104
|
+
responses: { '200': { description: 'Relatório de auditoria' } }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const files = [
|
|
111
|
+
{ path: path.join(targetDir, 'chatgpt_custom_instructions.md'), content: this.getCompactPrompt() },
|
|
112
|
+
{ path: path.join(targetDir, 'agent_master_openapi.json'), content: JSON.stringify(openApiSchema, null, 2) }
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
if (!options.dryRun) {
|
|
116
|
+
files.forEach(f => {
|
|
117
|
+
fs.mkdirSync(path.dirname(f.path), { recursive: true });
|
|
118
|
+
fs.writeFileSync(f.path, f.content, 'utf8');
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return { platform: 'chatgpt', filesCount: files.length, files: files.map(f => f.path) };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
generateOllamaProfile(targetDir, options = {}) {
|
|
126
|
+
const baseModel = options.baseModel || 'qwen2.5-coder:7b';
|
|
127
|
+
const modelfileContent = 'FROM ' + baseModel + '\n\nSYSTEM """\n' + this.getCompactPrompt() + '\n"""\n\nPARAMETER temperature 0.2\nPARAMETER stop "```"\n';
|
|
128
|
+
const filePath = path.join(targetDir, 'Modelfile');
|
|
129
|
+
|
|
130
|
+
if (!options.dryRun) {
|
|
131
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
132
|
+
fs.writeFileSync(filePath, modelfileContent, 'utf8');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return { platform: 'ollama', filesCount: 1, files: [filePath] };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
generateAntigravityConfig(targetDir, options = {}) {
|
|
139
|
+
const homeDir = process.env.USERPROFILE || process.env.HOME || '';
|
|
140
|
+
const mcpServerPath = options.mcpServerPath || path.resolve(this.baseDir, 'scripts', 'mcp_server.js');
|
|
141
|
+
const geminiConfigDir = path.join(homeDir, '.gemini', 'config');
|
|
142
|
+
const mcpConfigPath = path.join(geminiConfigDir, 'mcp_config.json');
|
|
143
|
+
|
|
144
|
+
const files = [];
|
|
145
|
+
|
|
146
|
+
if (!options.dryRun) {
|
|
147
|
+
if (!fs.existsSync(geminiConfigDir)) {
|
|
148
|
+
fs.mkdirSync(geminiConfigDir, { recursive: true });
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
let mcpJson = { mcpServers: {} };
|
|
152
|
+
if (fs.existsSync(mcpConfigPath)) {
|
|
153
|
+
try {
|
|
154
|
+
mcpJson = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8'));
|
|
155
|
+
if (!mcpJson.mcpServers) mcpJson.mcpServers = {};
|
|
156
|
+
} catch (_) {}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
mcpJson.mcpServers['agent-master-devsecops'] = {
|
|
160
|
+
command: 'node',
|
|
161
|
+
args: [mcpServerPath]
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
fs.writeFileSync(mcpConfigPath, JSON.stringify(mcpJson, null, 2), 'utf8');
|
|
165
|
+
files.push(mcpConfigPath);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return { platform: 'antigravity', filesCount: 1, files };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
generateVsCodeProfile(targetDir, options = {}) {
|
|
172
|
+
const vscodeDir = path.join(targetDir, '.vscode');
|
|
173
|
+
const mcpConfigPath = path.join(vscodeDir, 'mcp.json');
|
|
174
|
+
const mcpConfig = {
|
|
175
|
+
mcpServers: {
|
|
176
|
+
'agent-master-devsecops': {
|
|
177
|
+
command: 'node',
|
|
178
|
+
args: [options.mcpServerPath || path.resolve(this.baseDir, 'scripts', 'mcp_server.js')]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const files = [mcpConfigPath];
|
|
184
|
+
if (!options.dryRun) {
|
|
185
|
+
if (!fs.existsSync(vscodeDir)) fs.mkdirSync(vscodeDir, { recursive: true });
|
|
186
|
+
fs.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), 'utf8');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return { platform: 'vscode', filesCount: 1, files };
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
exportProfile(platform, targetDir, options = {}) {
|
|
193
|
+
const cleanPlatform = String(platform).toLowerCase();
|
|
194
|
+
switch (cleanPlatform) {
|
|
195
|
+
case 'cursor':
|
|
196
|
+
return this.generateCursorProfile(targetDir, options);
|
|
197
|
+
case 'windsurf':
|
|
198
|
+
return this.generateWindsurfProfile(targetDir, options);
|
|
199
|
+
case 'vscode':
|
|
200
|
+
case 'code':
|
|
201
|
+
return this.generateVsCodeProfile(targetDir, options);
|
|
202
|
+
case 'claude_desktop':
|
|
203
|
+
case 'claude':
|
|
204
|
+
return this.generateClaudeDesktopProfile(targetDir, options);
|
|
205
|
+
case 'chatgpt':
|
|
206
|
+
return this.generateChatGptProfile(targetDir, options);
|
|
207
|
+
case 'ollama':
|
|
208
|
+
return this.generateOllamaProfile(targetDir, options);
|
|
209
|
+
case 'antigravity':
|
|
210
|
+
case 'gemini':
|
|
211
|
+
return this.generateAntigravityConfig(targetDir, options);
|
|
212
|
+
case 'all': {
|
|
213
|
+
const r1 = this.generateCursorProfile(targetDir, options);
|
|
214
|
+
const r2 = this.generateWindsurfProfile(targetDir, options);
|
|
215
|
+
const r3 = this.generateClaudeDesktopProfile(targetDir, options);
|
|
216
|
+
const r4 = this.generateChatGptProfile(targetDir, options);
|
|
217
|
+
const r5 = this.generateOllamaProfile(targetDir, options);
|
|
218
|
+
const r6 = this.generateVsCodeProfile(targetDir, options);
|
|
219
|
+
const r7 = this.generateAntigravityConfig(targetDir, options);
|
|
220
|
+
return {
|
|
221
|
+
platform: 'all',
|
|
222
|
+
totalFiles: r1.filesCount + r2.filesCount + r3.filesCount + r4.filesCount + r5.filesCount + r6.filesCount + r7.filesCount,
|
|
223
|
+
results: [r1, r2, r3, r4, r5, r6, r7]
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
default:
|
|
227
|
+
throw new Error(`Plataforma não suportada: "${platform}". Plataformas suportadas: ${SUPPORTED_PLATFORMS.join(', ')}`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
function generateVsCodeSettings() {
|
|
234
|
+
return {
|
|
235
|
+
"mcp.servers": {
|
|
236
|
+
"agent-master-devsecops": {
|
|
237
|
+
"command": "node",
|
|
238
|
+
"args": ["${workspaceFolder}/node_modules/agent-master-devsecops/scripts/mcp_server.js"]
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"customInstructions": [
|
|
242
|
+
{
|
|
243
|
+
"role": "system",
|
|
244
|
+
"content": "Siga rigorosamente as 15 Regras de Engenharia da suíte multi-agente e responda no formato de saída compacta com links diretos."
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
"shortcuts": {
|
|
248
|
+
"orchestrator": "modo: orchestrator",
|
|
249
|
+
"devsecops": "modo: devsecops",
|
|
250
|
+
"qa": "modo: qa",
|
|
251
|
+
"scrum": "modo: scrum",
|
|
252
|
+
"sre": "modo: sre",
|
|
253
|
+
"full-dev": "modo: full-dev"
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function generateJetBrainsConfig() {
|
|
259
|
+
return {
|
|
260
|
+
"agentMasterDevSecOps": {
|
|
261
|
+
"version": "3.6.0",
|
|
262
|
+
"mcpEnabled": true,
|
|
263
|
+
"mcpTransport": "stdio",
|
|
264
|
+
"mcpCommand": "node scripts/mcp_server.js",
|
|
265
|
+
"modes": ["orchestrator", "devsecops", "qa", "scrum", "sre", "full-dev"],
|
|
266
|
+
"ruleSet": "docs/ENGINEERING_RULES.md",
|
|
267
|
+
"dualLayerOutput": true
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function exportIdeConfigs(targetDir, options = {}) {
|
|
273
|
+
const results = {
|
|
274
|
+
vscodeConfigured: false,
|
|
275
|
+
jetbrainsConfigured: false
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const vscodeDir = path.join(targetDir, '.vscode');
|
|
279
|
+
const jetbrainsDir = path.join(targetDir, '.idea');
|
|
280
|
+
|
|
281
|
+
if (!options.dryRun) {
|
|
282
|
+
if (!fs.existsSync(vscodeDir)) fs.mkdirSync(vscodeDir, { recursive: true });
|
|
283
|
+
if (!fs.existsSync(jetbrainsDir)) fs.mkdirSync(jetbrainsDir, { recursive: true });
|
|
284
|
+
|
|
285
|
+
fs.writeFileSync(
|
|
286
|
+
path.join(vscodeDir, 'agent-master.json'),
|
|
287
|
+
JSON.stringify(generateVsCodeSettings(), null, 2),
|
|
288
|
+
'utf8'
|
|
289
|
+
);
|
|
290
|
+
results.vscodeConfigured = true;
|
|
291
|
+
|
|
292
|
+
fs.writeFileSync(
|
|
293
|
+
path.join(jetbrainsDir, 'agent-master.json'),
|
|
294
|
+
JSON.stringify(generateJetBrainsConfig(), null, 2),
|
|
295
|
+
'utf8'
|
|
296
|
+
);
|
|
297
|
+
results.jetbrainsConfigured = true;
|
|
298
|
+
} else {
|
|
299
|
+
results.vscodeConfigured = true;
|
|
300
|
+
results.jetbrainsConfigured = true;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return results;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
module.exports = {
|
|
307
|
+
UniversalPackager,
|
|
308
|
+
SUPPORTED_PLATFORMS,
|
|
309
|
+
generateVsCodeSettings,
|
|
310
|
+
generateJetBrainsConfig,
|
|
311
|
+
exportIdeConfigs,
|
|
312
|
+
generateIdeConfigs: exportIdeConfigs
|
|
313
|
+
};
|