Skip to content
Pi · claude-opus-4-5debugCLI & tooling1 file · +5 −5

Fix pi extension factory-function errors in code-actions

Session from pi-extensions-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk

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'.

  1. Prompt · +0
    Getting 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.
  2. Agent did · +0m
    Explored 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.
  3. Agent did · +2m
    Summarised 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.
  4. Fail · +4m
    Same 'does not export a valid factory function' errors reappeared, now pointing at the moved src/ paths instead of the original root paths.
  5. Agent did · +4m
    Searched 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.
  6. Outcome · +6m
    Session 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.

I tried this · 0

Discussion · 0

How Builds work