Fix pi extension factory-function errors in code-actions
Session from pi-extensions-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk
Click a segment to jump to that moment
6msession
0interventions
GOAL
Diagnose and fix why the code-actions pi extension's helper files (actions.ts, search.ts, snippets.ts, ui.ts) were being loaded as separate extensions and failing with 'does not export a valid factory function'.
- +0Prompt · +0Getting factory-function errors for the code-actions extension across actions.ts, search.ts, snippets.ts and ui.ts — please review and fix, without touching the pi-mono repo.
- +0mAgent did · +0mExplored the pi-extensions and pi-mono repos, read the code-actions files and settings.json, then moved actions.ts, search.ts, snippets.ts and ui.ts into a new code-actions/src/ folder and updated index.ts imports so only index.ts remained at the extension root.
- +2mAgent did · +2mSummarised the fix: helper modules moved into src/ so the directory-based extension loading in settings.json only picks up index.ts, and suggested pointing settings.json directly at index.ts as an alternative.
- +4mFail · +4mSame 'does not export a valid factory function' errors reappeared, now pointing at the moved src/ paths instead of the original root paths.
- +4mAgent did · +4mSearched for lingering references to code-actions/src across .pi and pi-extensions, then dug into pi-mono's extension loader.ts to understand how paths are resolved, ending on an unrelated ripgrep error scanning unrelated system caches.
- +6mOutcome · +6mSession ended mid-investigation: root cause in the extension loader still unconfirmed and the factory-function errors were not yet resolved.
VERDICT
Next time I'd start by asking it to check settings.json's extension entry and the loader's path-resolution logic before touching any files — the move-to-src/ fix was a guess that didn't actually address how pi discovers extension files, and the same errors just followed the files to their new location. Reading loader.ts earlier, rather than after the fix failed, would have saved a round trip.