mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
fix(codex): broaden context7 config checks
This commit is contained in:
@@ -25,6 +25,22 @@ const configPath = path.join(repoRoot, '.codex', 'config.toml');
|
||||
const config = fs.readFileSync(configPath, 'utf8');
|
||||
const codexAgentsDir = path.join(repoRoot, '.codex', 'agents');
|
||||
|
||||
function escapeRegExp(value) {
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
|
||||
function getTomlSection(text, sectionName) {
|
||||
const escapedSection = escapeRegExp(sectionName);
|
||||
const headerPattern = new RegExp(`^\\s*\\[${escapedSection}\\]\\s*$`, 'm');
|
||||
const headerMatch = headerPattern.exec(text);
|
||||
|
||||
assert.ok(headerMatch, `Expected TOML section to exist: [${sectionName}]`);
|
||||
|
||||
const afterHeader = text.slice(headerMatch.index + headerMatch[0].length);
|
||||
const nextHeaderIndex = afterHeader.search(/^\s*\[/m);
|
||||
return nextHeaderIndex === -1 ? afterHeader : afterHeader.slice(0, nextHeaderIndex);
|
||||
}
|
||||
|
||||
let passed = 0;
|
||||
let failed = 0;
|
||||
|
||||
@@ -47,6 +63,37 @@ if (
|
||||
passed++;
|
||||
else failed++;
|
||||
|
||||
if (
|
||||
test('reference config enables Codex multi-agent support', () => {
|
||||
assert.ok(
|
||||
/^\s*multi_agent\s*=\s*true\s*$/m.test(config),
|
||||
'Expected `.codex/config.toml` to opt into Codex multi-agent collaboration',
|
||||
);
|
||||
})
|
||||
)
|
||||
passed++;
|
||||
else failed++;
|
||||
|
||||
if (
|
||||
test('reference config wires the sample Codex role files', () => {
|
||||
for (const roleFile of ['explorer.toml', 'reviewer.toml', 'docs-researcher.toml']) {
|
||||
const rolePath = path.join(codexAgentsDir, roleFile);
|
||||
const roleSection = roleFile.replace(/\.toml$/, '').replace(/-/g, '_');
|
||||
const sectionBody = getTomlSection(config, `agents.${roleSection}`);
|
||||
|
||||
assert.ok(fs.existsSync(rolePath), `Expected role config to exist: ${roleFile}`);
|
||||
assert.ok(
|
||||
new RegExp(`^\\s*config_file\\s*=\\s*"agents\\/${escapeRegExp(roleFile)}"\\s*$`, 'm').test(
|
||||
sectionBody,
|
||||
),
|
||||
`Expected \`.codex/config.toml\` to reference ${roleFile} inside [agents.${roleSection}]`,
|
||||
);
|
||||
}
|
||||
})
|
||||
)
|
||||
passed++;
|
||||
else failed++;
|
||||
|
||||
if (
|
||||
test('sample Codex role configs do not use o4-mini', () => {
|
||||
const roleFiles = fs.readdirSync(codexAgentsDir).filter(file => file.endsWith('.toml'));
|
||||
|
||||
Reference in New Issue
Block a user