s9n-devops-agent 2.0.18-dev.7 → 2.0.18-dev.9
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 +43 -8
- package/src/session-coordinator.js +29 -1
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.9",
|
|
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
|
@@ -23,7 +23,7 @@ import readline from 'readline';
|
|
|
23
23
|
import Groq from 'groq-sdk';
|
|
24
24
|
import { fileURLToPath } from 'url';
|
|
25
25
|
import { dirname } from 'path';
|
|
26
|
-
import { spawn } from 'child_process';
|
|
26
|
+
import { spawn, execSync } from 'child_process';
|
|
27
27
|
import { credentialsManager } from './credentials-manager.js';
|
|
28
28
|
import HouseRulesManager from './house-rules-manager.js';
|
|
29
29
|
// We'll import SessionCoordinator dynamically to avoid circular deps if any
|
|
@@ -364,15 +364,50 @@ When you want to perform an action, use the available tools.`;
|
|
|
364
364
|
|
|
365
365
|
async listContracts() {
|
|
366
366
|
const contractsDir = path.join(this.repoRoot, 'House_Rules_Contracts');
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
const centralExists = fs.existsSync(contractsDir);
|
|
368
|
+
|
|
369
|
+
// Recursive search for contracts (similar to setup script)
|
|
370
|
+
const findCommand = `find "${this.repoRoot}" -type f \\( -iname "*CONTRACT*.md" -o -iname "*CONTRACT*.json" \\) -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/local_deploy/*"`;
|
|
371
|
+
|
|
372
|
+
let allFiles = [];
|
|
373
|
+
try {
|
|
374
|
+
const output = execSync(findCommand, { encoding: 'utf8' }).trim();
|
|
375
|
+
allFiles = output.split('\n').filter(Boolean);
|
|
376
|
+
} catch (e) {
|
|
377
|
+
// Find failed or no files
|
|
369
378
|
}
|
|
370
379
|
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
380
|
+
const requiredTypes = [
|
|
381
|
+
'FEATURES_CONTRACT.md', 'API_CONTRACT.md', 'DATABASE_SCHEMA_CONTRACT.md',
|
|
382
|
+
'SQL_CONTRACT.json', 'THIRD_PARTY_INTEGRATIONS.md', 'INFRA_CONTRACT.md'
|
|
383
|
+
];
|
|
384
|
+
|
|
385
|
+
const status = {};
|
|
386
|
+
let scatteredCount = 0;
|
|
387
|
+
|
|
388
|
+
requiredTypes.forEach(type => {
|
|
389
|
+
// Check if in central folder
|
|
390
|
+
const isCentral = fs.existsSync(path.join(contractsDir, type));
|
|
391
|
+
|
|
392
|
+
// Check if anywhere in repo
|
|
393
|
+
const found = allFiles.filter(f => path.basename(f).toUpperCase() === type || path.basename(f).toUpperCase().includes(type.split('.')[0]));
|
|
394
|
+
|
|
395
|
+
status[type] = {
|
|
396
|
+
central: isCentral,
|
|
397
|
+
foundCount: found.length,
|
|
398
|
+
locations: found.map(f => path.relative(this.repoRoot, f))
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
if (!isCentral && found.length > 0) scatteredCount++;
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
return JSON.stringify({
|
|
405
|
+
centralFolderExists: centralExists,
|
|
406
|
+
scatteredContractsCount: scatteredCount,
|
|
407
|
+
details: status,
|
|
408
|
+
message: scatteredCount > 0
|
|
409
|
+
? "Contracts found scattered in repository. Recommend running 'npm run setup' to consolidate."
|
|
410
|
+
: (centralExists ? "Contracts found in central folder." : "No contracts found.")
|
|
376
411
|
});
|
|
377
412
|
}
|
|
378
413
|
|
|
@@ -2434,8 +2434,36 @@ async function main() {
|
|
|
2434
2434
|
// Start agent for a session
|
|
2435
2435
|
const sessionId = args[1];
|
|
2436
2436
|
if (!sessionId) {
|
|
2437
|
+
// Ask if user wants Kora assistance
|
|
2438
|
+
const rl = readline.createInterface({
|
|
2439
|
+
input: process.stdin,
|
|
2440
|
+
output: process.stdout
|
|
2441
|
+
});
|
|
2442
|
+
|
|
2443
|
+
console.log(`\n${CONFIG.colors.magenta}🤖 Kora AI Assistant Available${CONFIG.colors.reset}`);
|
|
2444
|
+
const useKora = await new Promise(resolve => {
|
|
2445
|
+
rl.question(`Would you like Kora to guide you? (Y/n): `, answer => {
|
|
2446
|
+
rl.close();
|
|
2447
|
+
resolve(answer.toLowerCase() !== 'n' && answer.toLowerCase() !== 'no');
|
|
2448
|
+
});
|
|
2449
|
+
});
|
|
2450
|
+
|
|
2451
|
+
if (useKora) {
|
|
2452
|
+
console.log(`\n${CONFIG.colors.magenta}Launching Kora...${CONFIG.colors.reset}`);
|
|
2453
|
+
const chatScript = path.join(__dirname, 'agent-chat.js');
|
|
2454
|
+
const child = spawn('node', [chatScript], {
|
|
2455
|
+
stdio: 'inherit',
|
|
2456
|
+
env: process.env
|
|
2457
|
+
});
|
|
2458
|
+
|
|
2459
|
+
child.on('exit', (code) => {
|
|
2460
|
+
process.exit(code);
|
|
2461
|
+
});
|
|
2462
|
+
return; // Hand off to Kora
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2437
2465
|
// No session ID provided - show interactive menu
|
|
2438
|
-
console.log(
|
|
2466
|
+
console.log(`\n${CONFIG.colors.bright}DevOps Agent Session Manager${CONFIG.colors.reset}\n`);
|
|
2439
2467
|
|
|
2440
2468
|
// Show existing sessions first
|
|
2441
2469
|
const locks = fs.existsSync(coordinator.locksPath) ?
|