{"record":{"id":"258ebbe0b3a21b20","repo":"affaan-m/ECC","slug":"pattern-source-is-missing-the-pattern-categor-258ebb","errorCode":null,"errorMessage":"${pattern.source} is missing the ${pattern.category} entry","messagePattern":"(.+?) is missing the (.+?) entry","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/ci/catalog.js","lineNumber":262,"sourceCode":"    },\n    {\n      category: 'skills',\n      mode: 'minimum',\n      regex: /^\\s*skills\\/\\s*[—–-]\\s*(\\d+)(\\+)?\\s+workflow skills and domain knowledge\\s*$/im,\n      source: 'AGENTS.md project structure'\n    },\n    {\n      category: 'commands',\n      mode: 'exact',\n      regex: /^\\s*commands\\/\\s*[—–-]\\s*(\\d+)\\s+slash commands\\s*$/im,\n      source: 'AGENTS.md project structure'\n    }\n  ];\n\n  for (const pattern of structurePatterns) {\n    const match = agentsContent.match(pattern.regex);\n    if (!match) {\n      throw new Error(`${pattern.source} is missing the ${pattern.category} entry`);\n    }\n\n    expectations.push({\n      category: pattern.category,\n      mode: pattern.mode === 'minimum' && match[2] ? 'minimum' : pattern.mode,\n      expected: Number(match[1]),\n      source: `${pattern.source} (${pattern.category})`\n    });\n  }\n\n  return expectations;\n}\n\nfunction parseZhAgentsDocExpectations(agentsContent) {\n  const summaryMatch = agentsContent.match(/提供\\s+(\\d+)\\s+个专业代理、\\s*(\\d+)(\\+)?\\s*项技能、\\s*(\\d+)\\s+条命令/i);\n  if (!summaryMatch) {\n    throw new Error('docs/zh-CN/AGENTS.md is missing the catalog summary line');\n  }","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/ci/catalog.js#L244-L280","documentation":"After the AGENTS.md summary line, `parseAgentsDocExpectations` scans the project-structure block for three directory entries: `agents/ — N specialized subagents`, `skills/ — N(+) workflow skills and domain knowledge`, and `commands/ — N slash commands`. The regexes accept em-dash, en-dash, or hyphen (`[—–-]`) as the separator. Each missing entry throws with the source `AGENTS.md project structure` and the affected category.","triggerScenarios":"Fires when the project-structure section of AGENTS.md is missing the `agents/`, `skills/`, or `commands/` line, or the descriptive suffix diverges (e.g. `subagents` → `agents`, `slash commands` → `commands`, `workflow skills and domain knowledge` shortened).","commonSituations":"The project structure block is regenerated or reformatted and the descriptive suffixes are abbreviated. A line is deleted when consolidating the structure. The dash separator is changed to a colon. A new top-level dir is added and the others are rewrapped.","solutions":["Restore each line exactly: `agents/ — N specialized subagents`, `skills/ — N+ workflow skills and domain knowledge`, `commands/ — N slash commands` (any of —/–/- as separator).","Run `node scripts/ci/catalog.js --write` — syncEnglishAgents rewrites only the digit (and optional `+`), preserving the suffix.","Keep the exact descriptive suffix per category: `specialized subagents`, `workflow skills and domain knowledge`, `slash commands`.","Re-run the catalog check to confirm all three entries match."],"exampleFix":"// before (AGENTS.md project structure, commands suffix abbreviated)\nagents/          — 68 specialized subagents\nskills/          — 284+ workflow skills and domain knowledge\ncommands/        — 94 commands\n\n// after\nagents/          — 68 specialized subagents\nskills/          — 284+ workflow skills and domain knowledge\ncommands/        — 94 slash commands","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst agents = fs.readFileSync('AGENTS.md', 'utf8');\nconst entries = [\n  { cat: 'agents', re: /^\\s*agents\\/\\s*[—–-]\\s*(\\d+)\\s+specialized subagents\\s*$/im },\n  { cat: 'skills', re: /^\\s*skills\\/\\s*[—–-]\\s*(\\d+)(\\+)?\\s+workflow skills and domain knowledge\\s*$/im },\n  { cat: 'commands', re: /^\\s*commands\\/\\s*[—–-]\\s*(\\d+)\\s+slash commands\\s*$/im },\n];\nfor (const { cat, re } of entries) {\n  if (!re.test(agents)) {\n    console.error(`AGENTS.md project structure missing ${cat} entry (check exact suffix wording).`);\n    process.exit(1);\n  }\n}","typeGuard":"function hasStructureEntry(agentsContent, category) {\n  const map = {\n    agents: /^\\s*agents\\/\\s*[—–-]\\s*(\\d+)\\s+specialized subagents\\s*$/im,\n    skills: /^\\s*skills\\/\\s*[—–-]\\s*(\\d+)(\\+)?\\s+workflow skills and domain knowledge\\s*$/im,\n    commands: /^\\s*commands\\/\\s*[—–-]\\s*(\\d+)\\s+slash commands\\s*$/im,\n  };\n  return map[category].test(agentsContent);\n}","tryCatchPattern":"try {\n  runCatalogCheck();\n} catch (error) {\n  if (/AGENTS\\.md project structure is missing/i.test(error.message)) {\n    console.error('Restore the directory entry with its exact suffix (specialized subagents / workflow skills and domain knowledge / slash commands).');\n  }\n  throw error;\n}","preventionTips":["Preserve each entry's descriptive suffix verbatim.","Any of —, –, or - is accepted as the separator after the dir name.","Run `--write` to sync counts.","Validate after restructuring the project-structure block."],"tags":["catalog","ci","regex","agents-md","project-structure","documentation-drift"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}