Skip to content
PidebugCLI & tooling2 files · +152 −117

Fix path-detection bug in a Pi /code snippet extension (TypeScript)

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

49msession
1interventions
GOAL

Investigate why /code wasn't picking up commands with only one slash (like ~/file.html), fix the filtering logic, and clean up the extension's code and docs.

  1. Prompt · +0
    Last command isn't picked up by /code. Might be a single-slash issue — can we rethink the filtering rule?
  2. Agent did · +0m
    Located code-actions extension, found minSlashCount:2 rule rejecting single-slash paths like ~/file.html; edited snippets.ts to recognize ~/, ./ and file-extension paths as valid.
  3. Prompt · +9m
    Do we want ../ though?
  4. Agent did · +9m
    Excluded ../ from the strong-match rule since it usually appears in import statements rather than actionable file paths; re-ran node test cases confirming all pass.
  5. Agent did · +16m
    Refactored snippets.ts: replaced INLINE_FILTER object with named constants, extracted looksLikePath() helper, removed duplicate slash counting; all 11 test cases passed.
  6. Prompt · +21m
    This TUI table output is getting captured as a code block and I'm not sure why.
  7. Agent did · +21m
    Proposed and implemented a box-drawing character heuristic to reject decorative TUI output from being captured as code blocks.
  8. Intervention · +22m
    Developer said 'No no no it's fine, keep it as it was' and had the agent revert the TUI-block filter entirely.
    Why: That filter was solving a problem I didn't actually want solved — I'd rather see all code blocks unfiltered than risk losing real content to a heuristic.
  9. Agent did · +22m
    Reverted the box-drawing filter, kept the ~/ path fix, then did a further cleanup pass hoisting constants and removing a regex-state bug from hoisted /g regexes; re-verified all tests pass.
  10. Outcome · +49m
    Two commits pushed (fix + docs update) to code-actions/snippets.ts and README.md; confirmed no other docs needed changes.
VERDICT

I'd start by pointing straight at the file and the exact failing input rather than describing the symptom abstractly — that got us to the root cause (minSlashCount: 2) fast anyway. The one correction that mattered was killing the TUI box-drawing filter the agent invented on its own initiative; it solved a problem I hadn't asked it to solve and I'd rather keep the simpler behavior. Everything else — refactors, doc updates — went smoothly without intervention.

I tried this · 0

Discussion · 0

How Builds work