s9n-devops-agent 2.0.18-dev.4 → 2.0.18-dev.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/package.json +1 -1
- package/src/agent-chat.js +17 -4
- package/src/setup-cs-devops-agent.js +14 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "s9n-devops-agent",
|
|
3
|
-
"version": "2.0.18-dev.
|
|
3
|
+
"version": "2.0.18-dev.6",
|
|
4
4
|
"description": "CS_DevOpsAgent - Intelligent Git Automation System with multi-agent support and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/cs-devops-agent-worker.js",
|
package/src/agent-chat.js
CHANGED
|
@@ -51,9 +51,14 @@ const CONFIG = {
|
|
|
51
51
|
|
|
52
52
|
class SmartAssistant {
|
|
53
53
|
constructor() {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
// Initialize Groq client lazily or with null if key is missing
|
|
55
|
+
const apiKey = process.env.GROQ_API_KEY || process.env.OPENAI_API_KEY;
|
|
56
|
+
|
|
57
|
+
if (apiKey) {
|
|
58
|
+
this.groq = new Groq({ apiKey });
|
|
59
|
+
} else {
|
|
60
|
+
this.groq = null; // Will be initialized in start()
|
|
61
|
+
}
|
|
57
62
|
|
|
58
63
|
this.history = [];
|
|
59
64
|
this.repoRoot = process.cwd();
|
|
@@ -125,8 +130,16 @@ When you want to perform an action, use the available tools.`;
|
|
|
125
130
|
* Initialize the chat session
|
|
126
131
|
*/
|
|
127
132
|
async start() {
|
|
133
|
+
// Ensure Groq client is initialized
|
|
134
|
+
if (!this.groq) {
|
|
135
|
+
const apiKey = credentialsManager.getGroqApiKey();
|
|
136
|
+
if (apiKey) {
|
|
137
|
+
this.groq = new Groq({ apiKey });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
128
141
|
// Check for Groq API Key
|
|
129
|
-
if (!credentialsManager.hasGroqApiKey()) {
|
|
142
|
+
if (!this.groq && !credentialsManager.hasGroqApiKey()) {
|
|
130
143
|
console.log('\n' + '='.repeat(60));
|
|
131
144
|
console.log(`${CONFIG.colors.yellow}⚠️ GROQ API KEY MISSING${CONFIG.colors.reset}`);
|
|
132
145
|
console.log('='.repeat(60));
|
|
@@ -168,7 +168,8 @@ async function checkContractsExist(projectRoot) {
|
|
|
168
168
|
|
|
169
169
|
// Find all files that look like contracts
|
|
170
170
|
// We look for files containing "CONTRACT" in the name, excluding typical ignores
|
|
171
|
-
|
|
171
|
+
// Use -iname for case-insensitive matching
|
|
172
|
+
const findCommand = `find "${projectRoot}" -type f \\( -iname "*CONTRACT*.md" -o -iname "*CONTRACT*.json" \\) -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/local_deploy/*"`;
|
|
172
173
|
|
|
173
174
|
let files = [];
|
|
174
175
|
try {
|
|
@@ -265,11 +266,21 @@ async function checkContractsExist(projectRoot) {
|
|
|
265
266
|
}
|
|
266
267
|
}
|
|
267
268
|
|
|
268
|
-
// Final check: Do we have all required contracts
|
|
269
|
-
|
|
269
|
+
// Final check: Do we have all required contracts?
|
|
270
|
+
// We check if they exist in the target directory OR if we found them elsewhere (and user maybe declined to merge)
|
|
271
|
+
const missing = requiredContracts.filter(contractName => {
|
|
272
|
+
// 1. Check central folder
|
|
273
|
+
if (fs.existsSync(path.join(targetDir, contractName))) return false;
|
|
274
|
+
|
|
275
|
+
// 2. Check if we found it anywhere else
|
|
276
|
+
if (contractMap[contractName] && contractMap[contractName].length > 0) return false;
|
|
277
|
+
|
|
278
|
+
return true;
|
|
279
|
+
});
|
|
270
280
|
|
|
271
281
|
if (missing.length === 0) {
|
|
272
282
|
if (hasChanges) log.success('Contract files consolidated successfully.');
|
|
283
|
+
else log.info('All contract files found in repository.');
|
|
273
284
|
return true;
|
|
274
285
|
}
|
|
275
286
|
|