Repository navigation
0.25.0: Files, an add-on built into every channel - #61
Merged
Merged
Conversation
Every channel is a git repository, so every channel has a Files pane: its files as a tree, open (a .md in the Markdown view; text, an image preview, or name and size with Show in Finder), new file, new folder, upload and drag-and-drop, rename, move, delete (confirmed in the pane) and each file's history from git. Files is declared like any add-on (builtIn: no module, its tools are gild's own code) and listed in Settings. A channel can hide or reorder its panes (.gild/addons.json in its repository), never remove one. Agents get list_files, read_file, write_file, move_file, delete_file and file_history through the same path as every add-on tool: channel access and tool switches apply, every write is one commit by the agent and an Activity entry. Every path is checked before anything is written; gild's own files and names this computer's file system wouldn't tell apart are refused. closes #60
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Files add-on: a default in every channel
gild is file-based under the hood (every channel is a git repository), so every channel now has a Files pane without anyone adding anything. Files is an add-on built into gild: declared like Markdown (
src-tauri/addons/files/gild-addon.json,"builtIn": true), listed in Settings › Add-ons as "Files, by gild, built in", with its tools on the same switches and in the same Activity as every other add-on tool. It has no WebAssembly module: its tools touch the channel's repository, which no sandboxed module may, so they are gild's own code (src-tauri/src/store/files.rs), and a third-party manifest claiming general tools or skipping its module is refused.What changed
src/app/Files.tsx, the shared view kept as it was): a toolbar with New file (a name without an extension becomes.md, and it opens in the Markdown view), New folder (kept in the history by an empty.gitkeep, which the tree hides), Upload (and drag-and-drop onto the pane:dragDropEnabled: falseon the window so the HTML drop carries the files), and for the selected file or folder Rename, Move, Delete (an in-page confirmation,role=alertdialog, never a system dialog) and History. Opening a file hands it to the add-on for its type:.mdis the Markdown view with Edit; otherwise text, an image preview (data: URL, up to 10 MB), or the name and size with Show in Finder (Explorer / file manager). Folders over 200 entries show 200 at a time ("Show 200 more of N")..gild/addons.jsonin the channel's repository (a commit by you, "Panes: Files (hidden), Docs"), so it travels with the folder. No existing per-channel file described panes (view.jsonis the table,acl.jsonis access), so this is the one new file;check_gild_filevalidates it on outside edits. An unknown add-on in the file is dropped, one left out is shown after the listed ones. A hidden pane's files and tools stay.list_files,read_file,write_file,move_file,delete_file,file_history, generated from the manifest likemarkdown_*(channel_id prepended).read_filemoved from the View group to Files (same implementation). Channel ACL (store.require) and per-agent tool switches apply; every write is one commit under the agent's name and an Activity entry (Activity names them: "wrote a file", "moved a file", …).records.rs):commit_changestakes removals too and runs a purecheck_pathon every path before anything is opened or written (relative, no./../empty parts, no.gitin any case, no backslash or control characters), so a bare repository gets the same check as a folder;disk_pathuses it plus the existing no-links walk. A removed file's emptied folders leave the disk, so the folder matches the commit.store/files.rsadds: gild's own files (.gild/,gild.json,.gitignore) can't be changed through Files at all (an agent writing.gild/acl.jsonwould grant itself access); nothing may be written where a file or folder already is, nor at a name this computer's file system wouldn't tell apart (case, Unicode form:folders::identity), nor inside a file; moving a folder into itself, moving onto something, and case-only renames (which the index/disk check would otherwise refuse with a confusing message) are refused with a plain sentence; 50 MB cap per file; the Files grant (*) withdrawn in Settings › Add-ons › Files › Permissions stops every write, for everyone.base64crate added (uploads and image previews cross the window boundary as base64).How to try it
Checklist› Enter:Checklist.mdopens in the Markdown view; Edit, Save.plans; drop a PNG onto the pane (or Upload): it lands in the selected folder and previews.git login~/Gild/<workspace>/channels/<channel>/shows the same commits by you..gild/addons.jsonin the channel's folder has it.write_file/move_file/delete_file(Activity logs each; a read-only agent is refused).Evidence
Run locally on the iMac (rustup 1.100,
CARGO_TARGET_DIRin the clone), logs kept in.tmp/:npm run check→exit=0;npm run build→exit=0(thewebjob).cargo test --locked --lib --manifest-path src-tauri/Cargo.toml→test result: ok. 90 passed; 0 failed; 2 ignored(exit=0). New tests:addons::tests::the_files_add_on_is_built_in_with_general_tools_and_a_pane,store::files::tests::{files_are_written_moved_and_deleted_as_commits_by_the_caller, hostile_paths_are_refused_before_anything_is_written, uploads_previews_and_the_grant, panes_are_per_channel_in_its_history},mcp::tests::agents_manage_files_where_they_may_and_every_write_is_theirs(over real HTTP: tools offered, writes as the agent, hostile paths refused, read access can't write, a switched-off tool gone and refused, every call in Activity).records::statusis asserted empty after every write (folder and index match the commit).cargo clippy --locked --all-targets --manifest-path src-tauri/Cargo.toml -- -D warnings→exit=0; the same foraddons/markdownonwasm32-unknown-unknown→exit=0. No new warnings.appjob, as CI runs it, in a Linux container on this machine (tar … | docker run node:24-bookworm … ci/linux.sh app,COPYFILE_DISABLE=1so macOS tar adds no._*files):files: created, renamed, deleted and uploaded through the pane; panes hidden and shown…ci/linux.sh app: ok,exit=0. The new e2e step creates a file and a folder through the toolbar, renames, deletes behind the in-page confirmation, reads the files back from disk and fromfile_history, uploads a PNG through the pane's command and sees the image preview, hides and shows the Files pane and reads.gild/addons.json.Revert-proofs (guard removed, test run, guard restored;
cargo test … -- <test>):own_filecheck infile_path_ok(gild's.gild/,gild.json)store::files::tests::hostile_paths_are_refused_before_anything_is_writtenfiles.rs:462(.gild/acl.jsonwas written)identity(case / Unicode form) comparison infreefiles.rs:483:readme.mdwritten besideReadme.mdfiles_allowed(the Files*grant)store::files::tests::uploads_previews_and_the_grantfiles.rs:532write_filerequiringAccess::Write(set toRead) inmcp.rsmcp::tests::agents_manage_files_where_they_may_and_every_write_is_theirsmcp.rs:850(the read-only agent wrote)All four pass again with the guards back (
5 passed; 0 failed).Left out
upload_filescommand the e2e exercises, and the Upload button is the same path.Readme.md→readme.md) are refused with a two-step hint rather than done, because on a case-insensitive file system the one-commit remove-and-write can't be told from a save made outside gild.closes #60
-claude