s9n-devops-agent 2.0.18-dev.1 → 2.0.18-dev.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s9n-devops-agent",
3
- "version": "2.0.18-dev.1",
3
+ "version": "2.0.18-dev.2",
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",
@@ -150,19 +150,51 @@ This structure is compatible with the DevOps Agent's automation tools.
150
150
  }
151
151
 
152
152
  function checkContractsExist(projectRoot) {
153
- const contractsDir = path.join(projectRoot, 'House_Rules_Contracts');
154
- if (!fs.existsSync(contractsDir)) return false;
155
-
156
- const requiredContracts = [
157
- 'FEATURES_CONTRACT.md',
158
- 'API_CONTRACT.md',
159
- 'DATABASE_SCHEMA_CONTRACT.md',
160
- 'SQL_CONTRACT.json',
161
- 'THIRD_PARTY_INTEGRATIONS.md',
162
- 'INFRA_CONTRACT.md'
163
- ];
164
-
165
- return requiredContracts.every(file => fs.existsSync(path.join(contractsDir, file)));
153
+ // Search recursively for contract folders
154
+ try {
155
+ // Find all directories named 'House_Rules_Contracts' or 'contracts'
156
+ // Ignoring node_modules and .git
157
+ const findCommand = `find "${projectRoot}" -type d \\( -name "House_Rules_Contracts" -o -name "contracts" \\) -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/local_deploy/*"`;
158
+
159
+ const output = execSync(findCommand, { encoding: 'utf8' }).trim();
160
+ const locations = output.split('\n').filter(Boolean);
161
+
162
+ let contractsDir = null;
163
+ if (locations.length > 0) {
164
+ // Prefer House_Rules_Contracts if available
165
+ contractsDir = locations.find(l => l.endsWith('House_Rules_Contracts')) || locations[0];
166
+ log.info(`Found contracts directory at: ${contractsDir}`);
167
+ }
168
+
169
+ if (!contractsDir) return false;
170
+
171
+ const requiredContracts = [
172
+ 'FEATURES_CONTRACT.md',
173
+ 'API_CONTRACT.md',
174
+ 'DATABASE_SCHEMA_CONTRACT.md',
175
+ 'SQL_CONTRACT.json',
176
+ 'THIRD_PARTY_INTEGRATIONS.md',
177
+ 'INFRA_CONTRACT.md'
178
+ ];
179
+
180
+ // Check if we have multiple similar contracts that might need merging
181
+ const files = fs.readdirSync(contractsDir);
182
+ const potentialDuplicates = files.filter(f =>
183
+ (f.includes('FEATURE') && f !== 'FEATURES_CONTRACT.md') ||
184
+ (f.includes('API') && f !== 'API_CONTRACT.md')
185
+ );
186
+
187
+ if (potentialDuplicates.length > 0) {
188
+ log.info(`Found potential split contract files in ${contractsDir}:`);
189
+ potentialDuplicates.forEach(f => console.log(` - ${f}`));
190
+ console.log('You may want to merge these into single contract files per type.');
191
+ }
192
+
193
+ return requiredContracts.every(file => fs.existsSync(path.join(contractsDir, file)));
194
+ } catch (error) {
195
+ log.warn(`Error searching for contracts: ${error.message}`);
196
+ return false;
197
+ }
166
198
  }
167
199
 
168
200
  async function generateContracts(projectRoot) {