s9n-devops-agent 2.0.18-dev.7 → 2.0.18-dev.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/agent-chat.js +43 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s9n-devops-agent",
3
- "version": "2.0.18-dev.7",
3
+ "version": "2.0.18-dev.8",
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
- if (!fs.existsSync(contractsDir)) {
368
- return JSON.stringify({ exists: false, message: "Contracts folder not found." });
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 files = fs.readdirSync(contractsDir).filter(f => f.endsWith('.md') || f.endsWith('.json'));
372
- return JSON.stringify({
373
- exists: true,
374
- files: files,
375
- location: contractsDir
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