Add deep extractors, reference pages, keyword index; eval 53.3%
- extract-deep.js: mines addon versions, TF configs, script params, helm values, state services - generate-reference-pages.js: creates operations.md, configuration.md, network-architecture.md - reference/index.md: keyword-rich topic-to-file routing table - Enriched CIDR extractor with inline comment capture - Eval progression: 28.7% -> 33.4% -> 46.7% -> 52.5% -> 53.3% - NOT_FOUND: 25 -> 20 -> 16 -> 10 -> 11 - Top scores: config-region-code 95%, argo-gen-params 95%, multiple 100%s - Remaining gap: agent planner (haiku) doesn't consistently follow index routing
This commit is contained in:
@@ -147,12 +147,25 @@ function extractCIDRAllocations(srcRoot) {
|
||||
try {
|
||||
const content = fs.readFileSync(full, 'utf8');
|
||||
const relPath = path.relative(srcRoot, full);
|
||||
// Match CIDR blocks
|
||||
const cidrMatches = content.match(/(?:cidr|CIDR|subnet|network).*?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2})/g);
|
||||
if (cidrMatches) {
|
||||
for (const m of cidrMatches) {
|
||||
const cidr = m.match(/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2})/)?.[1];
|
||||
if (cidr) cidrs.push({ cidr, context: m.trim().substring(0, 100), file: relPath });
|
||||
|
||||
const lines = content.split('\n');
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
const cidrMatch = line.match(/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2})/);
|
||||
if (cidrMatch) {
|
||||
const cidr = cidrMatch[1];
|
||||
let context = line.includes('#') ? line.substring(line.indexOf('#') + 1).trim() : '';
|
||||
if (!context) {
|
||||
for (let j = Math.max(0, i - 3); j < i; j++) {
|
||||
if (lines[j].trim().startsWith('#')) {
|
||||
context = lines[j].replace(/^#\s*/, '').trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!context) context = line.trim();
|
||||
|
||||
cidrs.push({ cidr, context, file: relPath });
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
@@ -162,13 +175,22 @@ function extractCIDRAllocations(srcRoot) {
|
||||
};
|
||||
walkDir(srcRoot);
|
||||
|
||||
// Deduplicate by CIDR
|
||||
const unique = {};
|
||||
for (const c of cidrs) {
|
||||
if (!unique[c.cidr]) unique[c.cidr] = [];
|
||||
unique[c.cidr].push({ context: c.context, file: c.file });
|
||||
unique[c.cidr].push(c);
|
||||
}
|
||||
return Object.entries(unique).map(([cidr, refs]) => ({ cidr, refs }));
|
||||
|
||||
return Object.entries(unique).map(([cidr, refs]) => {
|
||||
refs.sort((a, b) => {
|
||||
const aIsCode = a.context.includes('=') || a.context.includes('"');
|
||||
const bIsCode = b.context.includes('=') || b.context.includes('"');
|
||||
if (!aIsCode && bIsCode) return -1;
|
||||
if (aIsCode && !bIsCode) return 1;
|
||||
return 0;
|
||||
});
|
||||
return { cidr, refs };
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user