{"record":{"id":"8c79030128575f6e","repo":"affaan-m/ECC","slug":"readme-md-project-tree-is-missing-the-agents-count","errorCode":null,"errorMessage":"README.md project tree is missing the agents count","messagePattern":"README\\.md project tree is missing the agents count","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/ci/catalog.js","lineNumber":106,"sourceCode":"function parseReadmeExpectations(readmeContent) {\n  const expectations = [];\n\n  const quickStartMatch = readmeContent.match(\n    /access to\\s+(\\d+)\\s+agents,\\s+(\\d+)\\s+skills,\\s+and\\s+(\\d+)\\s+(?:commands|legacy command shims?)/i\n  );\n  if (!quickStartMatch) {\n    throw new Error('README.md is missing the quick-start catalog summary');\n  }\n\n  expectations.push(\n    { category: 'agents', mode: 'exact', expected: Number(quickStartMatch[1]), source: 'README.md quick-start summary' },\n    { category: 'skills', mode: 'exact', expected: Number(quickStartMatch[2]), source: 'README.md quick-start summary' },\n    { category: 'commands', mode: 'exact', expected: Number(quickStartMatch[3]), source: 'README.md quick-start summary' }\n  );\n\n  const projectTreeAgentsMatch = readmeContent.match(/^\\|\\s*--\\s*agents\\/\\s*#\\s*(\\d+)\\s+specialized subagents for delegation\\s*$/im);\n  if (!projectTreeAgentsMatch) {\n    throw new Error('README.md project tree is missing the agents count');\n  }\n\n  expectations.push({\n    category: 'agents',\n    mode: 'exact',\n    expected: Number(projectTreeAgentsMatch[1]),\n    source: 'README.md project tree (agents)'\n  });\n\n  const tablePatterns = [\n    { category: 'agents', regex: /\\|\\s*(?:\\*\\*)?Agents(?:\\*\\*)?\\s*\\|\\s*(?:(?:PASS:|\\u2705)\\s*)?(\\d+)\\s+agents\\s*\\|/i, source: 'README.md comparison table' },\n    { category: 'commands', regex: /\\|\\s*(?:\\*\\*)?Commands(?:\\*\\*)?\\s*\\|\\s*(?:(?:PASS:|\\u2705)\\s*)?(\\d+)\\s+commands(?:\\s*\\([^)]*\\))?\\s*\\|/i, source: 'README.md comparison table' },\n    { category: 'skills', regex: /\\|\\s*(?:\\*\\*)?Skills(?:\\*\\*)?\\s*\\|\\s*(?:(?:PASS:|\\u2705)\\s*)?(\\d+)\\s+skills\\s*\\|/i, source: 'README.md comparison table' }\n  ];\n\n  for (const pattern of tablePatterns) {\n    const match = readmeContent.match(pattern.regex);\n    if (!match) {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/ci/catalog.js#L88-L124","documentation":"The catalog CI script parses README.md to extract the documented agents/skills/commands counts and compares them against the actual filesystem catalog. This specific throw fires when the regex `/^\\|\\s*--\\s*agents\\/\\s*#\\s*(\\d+)\\s+specialized subagents for delegation\\s*$/im` fails to match a line in the README project tree section. The expected line format is `| -- agents/ # 68 specialized subagents for delegation`. It runs during the default catalog check or when you invoke `node scripts/ci/catalog.js`.","triggerScenarios":"Running `node scripts/ci/catalog.js` (or `npm run catalog:check`) after the project tree section of README.md was edited. Fires when the line starting with `| -- agents/` is missing, has a different dash style (e.g. `—` em-dash or `- ` instead of `--`), is missing the `#` separator, omits the trailing `specialized subagents for delegation` phrase, or the count is non-numeric.","commonSituations":"A contributor rewrites the README project structure tree and reformats the agents line. Someone adds/removes agents but forgets to update the count annotation. A documentation linter or formatter collapses the `--` into an em-dash or rewraps the line. A translation pass or merge accidentally drops the line.","solutions":["Open README.md and find the project structure tree section; ensure a line exactly matching `| -- agents/ # N specialized subagents for delegation` exists, where N equals the number of files in agents/.","Run `npm run catalog:write` (or `node scripts/ci/catalog.js --write`) to auto-rewrite the documented counts from the live filesystem catalog.","Verify the line uses a hyphen-minus `--` (U+002D), not an en-dash or em-dash, and a literal `#` before the digit.","Count the files with `ls agents/*.md | wc -l` and confirm the digit matches before committing."],"exampleFix":"// before (README.md, broken — missing '# ' or wrong dash)\n| — agents/ 68 specialized subagents for delegation\n\n// after\n| -- agents/ # 68 specialized subagents for delegation","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst readme = fs.readFileSync('README.md', 'utf8');\nconst re = /^\\|\\s*--\\s*agents\\/\\s*#\\s*(\\d+)\\s+specialized subagents for delegation\\s*$/im;\nif (!re.test(readme)) {\n  console.error('README.md project tree agents line missing or malformed');\n  console.error('Expected a line like: | -- agents/ # 68 specialized subagents for delegation');\n  process.exit(1);\n}\nconst documented = Number(readme.match(re)[1]);\nconst actual = fs.readdirSync('agents').filter(f => f.endsWith('.md')).length;\nif (documented !== actual) {\n  console.error(`agents count mismatch: README says ${documented}, actual ${actual}`);\n  process.exit(1);\n}","typeGuard":"// Guard the line shape before relying on the count\nfunction hasValidProjectTreeAgentsLine(readmeContent) {\n  const m = readmeContent.match(/^\\|\\s*--\\s*agents\\/\\s*#\\s*(\\d+)\\s+specialized subagents for delegation\\s*$/im);\n  return m !== null && Number.isInteger(Number(m[1]));\n}","tryCatchPattern":"try {\n  runCatalogCheck();\n} catch (error) {\n  if (/project tree is missing the agents count/i.test(error.message)) {\n    console.error('README.md project-tree agents line is missing. Restore: | -- agents/ # N specialized subagents for delegation');\n    console.error('Or run: node scripts/ci/catalog.js --write');\n  }\n  throw error;\n}","preventionTips":["Run `node scripts/ci/catalog.js --write` after any change to agents/, skills/, or commands/ rather than editing counts by hand.","Add the catalog check as a pre-commit hook so documentation drift is caught before push.","Treat the project-tree line format (dash style, '#' separator, exact suffix) as a contract — do not reformat it.","When translating or rewriting README.md, run the check immediately to catch regex-breaking wording changes."],"tags":["catalog","ci","regex","readme","documentation-drift"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}