Skip to content

feat(studio): full IDE-like file management#147

Merged
miguel-heygen merged 9 commits intomainfrom
feat/studio-file-management
Mar 31, 2026
Merged

feat(studio): full IDE-like file management#147
miguel-heygen merged 9 commits intomainfrom
feat/studio-file-management

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen commented Mar 31, 2026

Summary

  • API: POST (create), DELETE (delete), PATCH (rename/move), POST duplicate endpoints with null-byte sanitization
  • FileTree: right-click context menu with New File, New Folder, Rename, Duplicate, Delete
  • Drag-and-drop: move files between folders with visual feedback and subtree guard
  • Inline editing: rename/create inputs with filename validation
  • Header actions: quick New File / New Folder buttons in the FILES header

Stacks on top of feat/studio-code-quality.

Test plan

  • Right-click file → Rename, Delete, Duplicate all work
  • Right-click folder → New File, New Folder, Delete work
  • Drag file from one folder to another
  • Create file with invalid name (../foo, a/b) → rejected client-side
  • Delete currently-edited file → editor clears
  • Studio build succeeds

@miguel-heygen miguel-heygen changed the title feat(studio): full IDE-like file management [WIP] feat(studio): full IDE-like file management Mar 31, 2026
@miguel-heygen miguel-heygen force-pushed the feat/studio-code-quality branch from 9ecd4e6 to 3093cc4 Compare March 31, 2026 01:53
@miguel-heygen miguel-heygen force-pushed the feat/studio-file-management branch from 26529c8 to 4c5d39c Compare March 31, 2026 01:53
Comment thread packages/core/src/studio-api/routes/files.ts Outdated
@miguel-heygen miguel-heygen force-pushed the feat/studio-file-management branch from 4c5d39c to 25e2d4d Compare March 31, 2026 01:55
@miguel-heygen miguel-heygen force-pushed the feat/studio-code-quality branch from 3093cc4 to a1f2631 Compare March 31, 2026 01:58
@miguel-heygen miguel-heygen force-pushed the feat/studio-file-management branch from 25e2d4d to 450da64 Compare March 31, 2026 01:59
@miguel-heygen miguel-heygen force-pushed the feat/studio-code-quality branch 2 times, most recently from c757f91 to 5e8927f Compare March 31, 2026 02:02
@miguel-heygen miguel-heygen force-pushed the feat/studio-file-management branch from 450da64 to 942b7aa Compare March 31, 2026 02:02
@miguel-heygen miguel-heygen changed the base branch from feat/studio-code-quality to graphite-base/147 March 31, 2026 02:21
@miguel-heygen miguel-heygen force-pushed the feat/studio-file-management branch from 942b7aa to 7bdc924 Compare March 31, 2026 02:21
@graphite-app graphite-app bot changed the base branch from graphite-base/147 to main March 31, 2026 02:21
@miguel-heygen miguel-heygen force-pushed the feat/studio-file-management branch from 7bdc924 to 7d8fdcd Compare March 31, 2026 02:22
@miguel-heygen miguel-heygen changed the title [WIP] feat(studio): full IDE-like file management feat(studio): full IDE-like file management Mar 31, 2026
@miguel-heygen miguel-heygen force-pushed the feat/studio-file-management branch from 7d8fdcd to bdee705 Compare March 31, 2026 16:04
miguel-heygen and others added 4 commits March 31, 2026 18:22
…ate, drag-and-drop)

API: Add POST (create), DELETE, PATCH (rename/move), and duplicate-file
endpoints to the studio files route, with path safety checks and
conflict detection.

UI: Rewrite FileTree with right-click context menu (New File, New Folder,
Rename, Duplicate, Delete), inline rename/create inputs, drag-and-drop
file moves between folders, delete confirmation prompt, and a FILES header
bar with quick-action buttons. Wire all operations through App.tsx handlers
that call the new API endpoints and refresh the file tree.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix InlineInput double-fire on Enter+blur with committed ref guard
- Add null byte sanitization via extractFilePath helper in API routes
- Fix stale editingFile closure — use editingPathRef instead
- Add client-side filename validation (reject / \ ..)
- Prevent drag-and-drop folder-into-own-subtree
- Remove trivial handleMoveFile wrapper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restore useMountEffect for the project hash resolution — functionally
identical to useEffect(fn, []) but consistent with codebase conventions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
InlineInput was always showing a generic File icon. Now uses FileIcon
with the current input value so the icon updates live as you type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract shared resolveProjectFile() helper to eliminate repeated
project/path/safety boilerplate. Extract ensureDir() and
generateCopyPath() helpers. Add section headers and spacing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@miguel-heygen miguel-heygen force-pushed the feat/studio-file-management branch from bdee705 to a1a91bc Compare March 31, 2026 16:24
Avoids eslint-disable for no-explicit-any by defining a narrow
interface with just the req/json methods the helper actually uses.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
miguel-heygen and others added 3 commits March 31, 2026 18:47
When a file is renamed, scan all HTML/CSS/JS/JSON files in the project
and replace references to the old path with the new one — similar to
VSCode's Rename Symbol. Updates both full paths (assets/music.mp3) and
bare filenames (music.mp3). Preview also refreshes after rename.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Assets tab now has a right-click context menu with Copy path, Rename,
and Delete options. Rename shows an inline input and updates references
across the project via the existing rename endpoint. Delete removes the
file. Both reuse the existing file management handlers from App.tsx.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- [Critical] updateReferences: remove bare-filename replacement that
  could corrupt unrelated files (only replace full paths now)
- [Security] Add null-byte checks on PATCH newPath and duplicate path
- [Types] Add onCommit/onCancel to InlineInputState, remove 6 casts
- [UX] Add delete confirmation dialog in Assets tab
- [UX] Add error logging on failed file operations
- [Perf] Memoize sortChildren in TreeFolder

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@miguel-heygen miguel-heygen merged commit ecb590d into main Mar 31, 2026
21 checks passed
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.

2 participants