Skip to content

feat: place library files on folder paths - #52

Merged
bencode merged 2 commits into
mainfrom
feat/file-paths
Oct 1, 2026
Merged

bencode merged 2 commits into
mainfrom
feat/file-paths

Conversation

@bencode

@bencode bencode commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Why

Reading source code needs its directory structure. This is step one: the library learns paths. Importing a whole folder builds on it in a follow-up.

What changes

  • StoredFileMetadata.name → path (relative, /-separated, unique ignoring case). Folders exist only through their files; there are no empty folders.
  • Path rules: isWorkspacePath rejects empty, ./.. segments, a leading /, \ and control characters. A path cannot be both a file and a folder (path-conflict).
  • Migration to IndexedDB v7 rewrites every record in a single cursor pass (name → path, plus the earlier v1/v6 fixes merged in so two cursors no longer overwrite each other) and moves saved export versions to path.
  • The file panel is a tree: folders start collapsed, and the active file's folders open automatically.
  • Tabs show the base name, and add the parent folder when open files share a name.
  • Addresses are /files/<seg>/<seg>. Root files keep their old URLs.
  • Folder export recreates the folders on disk. Conflict checks walk the path.
  • The agent contract uses path throughout (list filter, results, reader state, attachment metadata). write accepts docs/notes.md.
  • Conversation attachments stay snapshots with a display name (no migration of saved conversations).

Tests

New tests cover:

  • nested import, numbering a kept duplicate inside a folder, path conflicts and invalid paths
  • the v6 → v7 migration
  • export into nested folders and its conflict detection
  • agent writes into folders
  • the nested route opening a file and revealing it in the tree
  • folder expand and collapse

pnpm check passes.

Files are now identified by a relative path instead of a flat name. Folders
follow from the paths and the file panel shows them as a tree. Existing
libraries migrate in place (database version 7), folder export recreates the
folders on disk, addresses carry the path segment by segment, and the agent
sees and writes paths such as docs/notes.md.
Backslashes and control characters are legal in file names on disk, so the
library accepts them again; only paths the agent writes still exclude them.
Tabs that share a file name now show the whole folder path, and the PDF skill
cites file paths like the rest of the prompt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant