File tree Expand file tree Collapse file tree
packages/agents/src/two-branch/tools/universal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -259,7 +259,22 @@ async function runSpectralOnFile(
259259
260260 try {
261261 // Build spectral command
262- const rulesetArgs = config . rulesets ?. map ( r => `--ruleset ${ r } ` ) . join ( ' ' ) || '' ;
262+ // SESSION 92 FIX: Use default spectral:oas ruleset if no custom rulesets provided
263+ // Without a ruleset, Spectral fails with "No ruleset has been found"
264+ let rulesetArgs = '' ;
265+ if ( config . rulesets && config . rulesets . length > 0 ) {
266+ rulesetArgs = config . rulesets . map ( r => `--ruleset ${ r } ` ) . join ( ' ' ) ;
267+ } else {
268+ // Create a temporary ruleset file that extends the built-in OAS rules
269+ const tempRulesetPath = path . join ( path . dirname ( filePath ) , '.spectral-temp.yml' ) ;
270+ const tempRulesetContent = 'extends: spectral:oas\n' ;
271+ fs . writeFileSync ( tempRulesetPath , tempRulesetContent ) ;
272+ rulesetArgs = `--ruleset "${ tempRulesetPath } "` ;
273+ // Clean up temp file after use (in finally block would be better but keeping it simple)
274+ setTimeout ( ( ) => {
275+ try { fs . unlinkSync ( tempRulesetPath ) ; } catch { /* ignore */ }
276+ } , 5000 ) ;
277+ }
263278 const cmd = `spectral lint "${ filePath } " --format json ${ rulesetArgs } ` ;
264279
265280 const { stdout, stderr } = await execAsync ( cmd , {
You can’t perform that action at this time.
0 commit comments