@@ -1277,6 +1277,36 @@ describe('detectAllHooks', () => {
12771277 }
12781278 } ) ;
12791279
1280+ test ( 'Codex: parses config section headers with inline comments' , ( ) => {
1281+ const tmpBase = join ( tmpdir ( ) , `doctor-codex-${ Date . now ( ) } ` ) ;
1282+ const homeDir = join ( tmpBase , 'home' ) ;
1283+ const projectDir = join ( tmpBase , 'project' ) ;
1284+ const codexHome = join ( homeDir , '.codex' ) ;
1285+ mkdirSync ( projectDir , { recursive : true } ) ;
1286+ mkdirSync ( codexHome , { recursive : true } ) ;
1287+ _createCodexPluginVersion ( codexHome ) ;
1288+ writeFileSync (
1289+ join ( codexHome , 'config.toml' ) ,
1290+ `[features] # required for plugin hooks
1291+ plugin_hooks = true
1292+
1293+ [plugins."safety-net@cc-marketplace"] # installed from marketplace
1294+ enabled = true
1295+ ` ,
1296+ ) ;
1297+
1298+ try {
1299+ const hooks = detectAllHooks ( projectDir , { homeDir } ) ;
1300+ const codex = hooks . find ( ( hook ) => hook . platform === 'codex' ) ;
1301+
1302+ expect ( codex ?. status ) . toBe ( 'configured' ) ;
1303+ expect ( codex ?. method ) . toBe ( 'plugin cache' ) ;
1304+ expect ( codex ?. errors ) . toBeUndefined ( ) ;
1305+ } finally {
1306+ rmSync ( tmpBase , { recursive : true , force : true } ) ;
1307+ }
1308+ } ) ;
1309+
12801310 test ( 'Codex: uses CODEX_HOME when set' , ( ) => {
12811311 const tmpBase = join ( tmpdir ( ) , `doctor-codex-${ Date . now ( ) } ` ) ;
12821312 const homeDir = join ( tmpBase , 'home' ) ;
0 commit comments