Files
backnotprop__plannotator/apps/hook/commands
Michael Ramos 919f582e0c feat: support folder annotation via plannotator annotate <folder/> (#389)
* feat: add hasMarkdownFiles() and folderPath support for annotate servers

Add hasMarkdownFiles() to resolve-file.ts — a shared validation function
that checks if a directory contains at least one markdown file, skipping
IGNORED_DIRS. Lives alongside the existing walkMarkdownFiles pattern.

Both annotate servers (Bun + Pi) accept an optional folderPath that
overrides projectRoot in the /api/plan response, and a new
"annotate-folder" mode value.

For provenance purposes, this commit was AI assisted.

* feat: support folder annotation via plannotator annotate <folder/>

Wire folder detection through both CLI entry points (Hook + Pi) and
the plan editor UI. When a directory is passed instead of a file:

- CLI validates markdown files exist via hasMarkdownFiles()
- Server starts with empty markdown and mode "annotate-folder"
- UI clears demo content, auto-opens sidebar to Files tab
- Empty state prompts user to select a file from the tree
- Linked doc system handles per-file annotation caching
- Feedback exports with per-file headers via existing infrastructure

Single-file annotation is unchanged.

For provenance purposes, this commit was AI assisted.

* fix: address review findings for folder annotation

- Include .mdx files in file browser globs (reference-handlers.ts)
- Fix imageBaseDir in folder mode — use folder path directly instead of
  stripping last segment, which produced the parent directory
- Guard statSync in Pi extension with try/catch to match hook server pattern

For provenance purposes, this commit was AI assisted.

* fix: align folder validation exclusions with file browser

hasMarkdownFiles() now accepts an excludedDirs parameter. Both CLI
entry points pass FILE_BROWSER_EXCLUDED so the preflight check
matches the file browser — no more empty sidebar after validation.

For provenance purposes, this commit was AI assisted.
2026-03-24 23:37:19 -07:00
..