@lousy-agents/cli 2.9.0 → 2.10.0

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/dist/index.js CHANGED
@@ -33041,6 +33041,17 @@ function defaultExec(command, args, options) {
33041
33041
  */ function createScriptDiscoveryGateway() {
33042
33042
  return new FileSystemScriptDiscoveryGateway();
33043
33043
  }
33044
+ /**
33045
+ * Creates a FeedbackLoopCommandsGateway that discovers mandatory commands from package.json scripts.
33046
+ */ function createFeedbackLoopCommandsGateway(scriptGateway) {
33047
+ const gateway = scriptGateway ?? createScriptDiscoveryGateway();
33048
+ return {
33049
+ async getMandatoryCommands (targetDir) {
33050
+ const scripts = await gateway.discoverScripts(targetDir);
33051
+ return scripts.filter((s)=>s.isMandatory).map((s)=>s.name);
33052
+ }
33053
+ };
33054
+ }
33044
33055
 
33045
33056
  ;// CONCATENATED MODULE: ./src/gateways/skill-file-gateway.ts
33046
33057
  /**
@@ -55168,24 +55179,43 @@ const remark = unified().use(remarkParse).use(remarkStringify).freeze()
55168
55179
  overallQualityScore: 0,
55169
55180
  suggestions: [
55170
55181
  "No agent instruction files found. Supported formats: .github/copilot-instructions.md, .github/instructions/*.md, .github/agents/*.md, AGENTS.md, CLAUDE.md"
55171
- ]
55182
+ ],
55183
+ parsingErrors: []
55172
55184
  },
55173
55185
  diagnostics: []
55174
55186
  };
55175
55187
  }
55176
55188
  // Analyze each file
55177
55189
  const fileStructures = new Map();
55190
+ const parsingErrors = [];
55178
55191
  for (const file of discoveredFiles){
55179
55192
  try {
55180
55193
  const structure = await this.astGateway.parseFile(file.filePath);
55181
55194
  fileStructures.set(file.filePath, structure);
55182
- } catch {
55183
- // Skip files that can't be parsed
55195
+ } catch (error) {
55196
+ const errorMessage = error instanceof Error ? error.message : "Unknown parsing error";
55197
+ parsingErrors.push({
55198
+ filePath: file.filePath,
55199
+ error: errorMessage
55200
+ });
55184
55201
  }
55185
55202
  }
55203
+ // Sort parsing errors for deterministic output
55204
+ parsingErrors.sort((a, b)=>a.filePath.localeCompare(b.filePath));
55186
55205
  // Score each mandatory command across all files
55187
55206
  const commandScores = [];
55188
55207
  const diagnostics = [];
55208
+ // Emit diagnostics for parsing errors
55209
+ for (const pe of parsingErrors){
55210
+ diagnostics.push({
55211
+ filePath: pe.filePath,
55212
+ line: 1,
55213
+ severity: "warning",
55214
+ message: `Failed to parse file: ${pe.error}`,
55215
+ ruleId: "instruction/parse-error",
55216
+ target: "instruction"
55217
+ });
55218
+ }
55189
55219
  for (const command of mandatoryCommands){
55190
55220
  const bestAnalysis = this.findBestScore(command, discoveredFiles, fileStructures, headingPatterns, proximityWindow, diagnostics);
55191
55221
  if (bestAnalysis) {
@@ -55213,12 +55243,17 @@ const remark = unified().use(remarkParse).use(remarkStringify).freeze()
55213
55243
  const overallQualityScore = commandScores.length > 0 ? Math.round(commandScores.reduce((sum, s)=>sum + s.compositeScore, 0) / commandScores.length * 100) : 0;
55214
55244
  // Generate suggestions
55215
55245
  const suggestions = this.generateSuggestions(commandScores);
55246
+ if (parsingErrors.length > 0) {
55247
+ const skippedFiles = parsingErrors.map((pe)=>pe.filePath).join(", ");
55248
+ suggestions.push(`${parsingErrors.length} file(s) could not be parsed and were skipped: ${skippedFiles}. Analysis may be incomplete.`);
55249
+ }
55216
55250
  return {
55217
55251
  result: {
55218
55252
  discoveredFiles,
55219
55253
  commandScores,
55220
55254
  overallQualityScore,
55221
- suggestions
55255
+ suggestions,
55256
+ parsingErrors
55222
55257
  },
55223
55258
  diagnostics
55224
55259
  };
@@ -55861,13 +55896,7 @@ const remark = unified().use(remarkParse).use(remarkStringify).freeze()
55861
55896
  */ async function lintInstructions(targetDir) {
55862
55897
  const discoveryGateway = createInstructionFileDiscoveryGateway();
55863
55898
  const astGateway = createMarkdownAstGateway();
55864
- const scriptGateway = createScriptDiscoveryGateway();
55865
- const commandsGateway = {
55866
- async getMandatoryCommands (dir) {
55867
- const scripts = await scriptGateway.discoverScripts(dir);
55868
- return scripts.filter((s)=>s.isMandatory).map((s)=>s.name);
55869
- }
55870
- };
55899
+ const commandsGateway = createFeedbackLoopCommandsGateway();
55871
55900
  const useCase = new AnalyzeInstructionQualityUseCase(discoveryGateway, astGateway, commandsGateway);
55872
55901
  const output = await useCase.execute({
55873
55902
  targetDir
@@ -55991,7 +56020,11 @@ const remark = unified().use(remarkParse).use(remarkStringify).freeze()
55991
56020
  }
55992
56021
  }
55993
56022
  if (totalErrors > 0) {
55994
- throw new Error(`lint failed: ${totalErrors} error(s), ${totalWarnings} warning(s)`);
56023
+ process.exitCode = 1;
56024
+ if (format === "human") {
56025
+ consola.error(`lint failed: ${totalErrors} error(s), ${totalWarnings} warning(s)`);
56026
+ }
56027
+ return;
55995
56028
  }
55996
56029
  if (format === "human") {
55997
56030
  if (totalWarnings > 0) {