Commit Graph

24 Commits

Author SHA1 Message Date
gsxdsm
06ec0e606e FN-7866: add auto-save toggle for the workspace file editor (default on)
Adds a shared, persisted auto-save preference for workspace text-file editing, defaulted to on, surfaced as a toolbar toggle in both the Files modal and right-dock Files view.

- Add useAutoSavePreference hook: persists the fn-file-editor-auto-save localStorage preference, broadcasts same-window changes via a custom event (storage events only reach other documents), and defaults to true.
- Extend useWorkspaceFileEditor with an autoSave flag that debounces (800ms) and triggers save() for a loaded, editable file with real pending changes, keyed by workspace+file+content to avoid re-firing on failed writes.
- Add an Auto-save toggle button to FileEditor's toolbar (autoSaveEnabled/onToggleAutoSave/canToggleAutoSave props), hidden for read-only/preview/binary files.
- Wire the shared preference into FileBrowserModal and DockFilesView, disabling auto-save for binary files in the modal.
- Add fileEditor.autoSave / fileEditor.toggleAutoSave i18n strings and document the new default behavior in docs/dashboard-guide.md.
- Add/extend tests covering the new hook, debounced auto-save behavior, and toolbar toggle wiring across FileEditor, FileBrowserModal, and DockFilesView.

Files changed:
 docs/dashboard-guide.md                            |   3 +
 .../dashboard/app/components/DockFilesView.tsx     |   6 +-
 .../dashboard/app/components/FileBrowserModal.tsx  |  20 ++--
 packages/dashboard/app/components/FileEditor.tsx   |  17 +++-
 .../components/__tests__/DockFilesView.test.tsx    |  37 ++++++-
 .../components/__tests__/FileBrowserModal.test.tsx |  86 +++++++++++++---
 .../app/components/__tests__/FileEditor.test.tsx   |  56 +++++++++++
 .../hooks/__tests__/useAutoSavePreference.test.ts  |  66 +++++++++++++
 .../hooks/__tests__/useWorkspaceFileEditor.test.ts | 108 +++++++++++++++++++++
 .../dashboard/app/hooks/useAutoSavePreference.ts   |  79 +++++++++++++++
 .../dashboard/app/hooks/useWorkspaceFileEditor.ts  |  47 ++++++++-
 packages/i18n/locales/en/app.json                  |   2 +
 12 files changed, 500 insertions(+), 27 deletions(-)

Fusion-Task-Id: FN-7866

Fusion-Task-Lineage: 0604de18-666d-4872-abce-2a3886c9ea55

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-12 12:49:37 -07:00
gsxdsm
c530b238b4 FN-7810: fix stale-echo detection to preserve trailing newline edits in FileEditor
Replace the FileEditor's bounded self-echo Set with monotonic edit versions so trailing-newline edits (e.g. after a markdown header or at end-of-file) are never dropped when an older content prop races the live CodeMirror document.

- Track a monotonic localEditVersionRef and a contentEditVersionsRef map (content -> version) instead of a size-capped Set of echoed strings, avoiding eviction of stale values during long editing sessions.
- Compare a stale prop's known edit version against the live document's version and the last accepted prop version to decide if it is a stale self-echo, at any session length.
- Update FNXC:FileViewer comment to document the FN-7810 rationale for switching from bounded-Set self-echo detection to edit-version comparison.
- Add regression tests covering trailing markdown-header and plain-text newline edits across markdown/non-markdown file paths, and a long-session (20+ edit) case that previously could evict the self-echo tracking.

Files changed:
 packages/dashboard/app/components/FileEditor.tsx                | 32 +++++++----
 .../app/components/__tests__/FileEditor.test.tsx                 | 64 +++++++++++++++++++++-
 2 files changed, 83 insertions(+), 13 deletions(-)

Fusion-Task-Id: FN-7810
Fusion-Task-Lineage: 9dd68746-e772-4fa3-b648-6f3138d1e36e
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-10 23:57:59 -07:00
gsxdsm
378e225d35 FN-7808: fix stale-echo overwrite dropping newlines in FileEditor
Prevent the controlled FileEditor from clobbering fast local typing (including newlines) with a stale content prop echoed back from an async parent update loop.

- Track the last emitted content and a small rolling set of recently emitted self-echoes in FileEditor.
- Skip re-syncing the CodeMirror document when the incoming content prop matches a known self-echo instead of a genuinely external change.
- Clamp the previous selection into the new document length when an external content change is applied, so the caret stays valid.
- Add regression tests covering stale self-echo renders (markdown and non-markdown files) and external content changes with clamped caret preservation.

Files changed:
 packages/dashboard/app/components/FileEditor.tsx   | 34 +++++++++++++--
 .../app/components/__tests__/FileEditor.test.tsx   | 49 ++++++++++++++++++++++
 2 files changed, 80 insertions(+), 3 deletions(-)

Fusion-Task-Id: FN-7808

Fusion-Task-Lineage: 08d4f826-f637-428c-8b67-dacdb878bf4a

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-10 22:25:21 -07:00
gsxdsm
a1cac3a6a3 fix(dashboard): replace quick chat with modal chat 2026-06-22 15:23:43 -07:00
gsxdsm
4bfb6b46ad FN-6528: add selection comments for new tasks
Adds a text-selection comment flow that opens New Task with source context.

- Add a reusable selection comment hook and popover for editor/document text selections.
- Thread selected-file and line-range context into the New Task modal.
- Enable comment-on-selection entry points in file editor, browser, documents, and memory surfaces.
- Cover the selection flow with focused component and hook tests, plus docs and copy updates.

Files changed:
 docs/dashboard-guide.md                            |   6 +-
 packages/dashboard/app/App.tsx                     |   7 +-
 packages/dashboard/app/components/AppModals.tsx    |   2 +
 .../dashboard/app/components/DocumentsView.tsx     |  25 ++-
 .../dashboard/app/components/FileBrowserModal.tsx  |   3 +
 packages/dashboard/app/components/FileEditor.tsx   |  35 +++-
 packages/dashboard/app/components/MemoryView.tsx   |   5 +-
 packages/dashboard/app/components/NewTaskModal.tsx |  15 +-
 .../app/components/SelectionCommentPopover.css     |  73 +++++++++
 .../app/components/SelectionCommentPopover.tsx     | 181 +++++++++++++++++++++
 .../components/__tests__/DocumentsView.test.tsx    |  59 +++++++
 .../components/__tests__/FileBrowserModal.test.tsx |  79 +++++++++
 .../app/components/__tests__/FileEditor.test.tsx   |  60 +++++++
 .../app/components/__tests__/MemoryView.test.tsx   |  48 +++++-
 .../app/components/__tests__/NewTaskModal.test.tsx |  17 ++
 .../__tests__/SelectionCommentPopover.test.tsx     |  75 +++++++++
 .../app/hooks/__tests__/useModalManager.test.ts    |  29 ++++
 .../hooks/__tests__/useSelectionComment.test.ts    | 140 ++++++++++++++++
 packages/dashboard/app/hooks/useModalManager.ts    |  19 ++-
 .../dashboard/app/hooks/useSelectionComment.ts     |  95 +++++++++++
 packages/i18n/locales/en/app.json                  |  11 ++
 21 files changed, 973 insertions(+), 11 deletions(-)

Fusion-Task-Id: FN-6528

Fusion-Task-Lineage: ef79e450-e69f-497b-97cd-f82d3c832fdf
2026-06-17 03:29:39 -07:00
gsxdsm
448ac6ab52 FN-6533: persist markdown preview preference
Remember the file viewer markdown Edit/Preview selection across editable mounts and browser sessions.

- Add localStorage-backed boolean preference helpers for the markdown preview toggle.
- Initialize editable markdown files from the stored preference while preserving the default edit mode.
- Cover persistence, read-only preview behavior, non-markdown files, and unavailable storage with FileEditor tests.

Files changed:
 packages/dashboard/app/components/FileEditor.tsx   | 32 +++++++-
 .../app/components/__tests__/FileEditor.test.tsx   | 90 +++++++++++++++++++++-
 2 files changed, 120 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-6533

Fusion-Task-Lineage: 54cfa3fa-56a3-4db8-85a2-5545e0fa16aa
2026-06-17 01:51:11 -07:00
gsxdsm
1e49494bac feat(i18n): full-sweep string migration — 5,930 keys across 5 locales (#1352)
Migration (multi-agent sweep over 216 files, 60 batches):
- Every user-visible dashboard + TUI string moved to t() with the exact
  English inline default (en rendering byte-identical)
- Catalogs merged from per-batch fragments: en/zh-CN/zh-TW/fr/es now
  carry ~5,930 keys each across common/app/errors/cli namespaces;
  CLI bundles regenerated (6 locales incl. ko)

Integration fixes:
- 18 type errors: reserved {{count}} interpolations renamed, malformed
  plural call, hand-rolled t-param types replaced with TFunction<"app">
- 23 lint errors: superseded label constants/helpers removed
- ExecutorStatusBar hook-order violation (keyboard-open early return
  moved below hooks)
- TUI tests wrapped in I18nextProvider (uninitialized fallback renders
  literal {{placeholders}}); dashboard vitest.setup boots a minimal en
  i18next instance for the same reason

Known WIP (next commits): ~457 residual strings across 50 batches,
Korean drafts for swept keys, and a dashboard test-suite pass that is
still being stabilized (~283 failures under investigation — fake-timer
waitFor interaction, likely stale node_modules vs merged lockfile).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 19:06:53 -07:00
gsxdsm
76a5337833 FN-5861: preserve FileEditor instance across content updates
Keep the memory/file editor stable while controlled content updates flow through CodeMirror.

- stop recreating the editor view when content and editor options change
- reconfigure line numbers, word wrap, read-only state, and language in place via compartments
- add regression tests for editor instance preservation and caret stability during controlled edits

Files changed:
 packages/dashboard/app/components/FileEditor.tsx         | 34 +++++++++++++++-
 packages/dashboard/app/components/__tests__/FileEditor.test.tsx | 47 +++++++++++++++++++++-
 2 files changed, 79 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-5861

Fusion-Task-Lineage: a8c5c4b0-ff5f-4f25-9e65-ed3f31c2b893
2026-06-02 00:23:05 -07:00
gsxdsm
fe83291eb8 Move FileEditor disclosure toggle into FileBrowserModal toolbar row 2026-05-15 01:05:09 -07:00
Fusion
f49802eb2b feat(FN-4560): complete Step 4 — unify toolbar disclosure and sizing
Fusion-Task-Id: FN-4560
Fusion-Task-Lineage: 90f0af13-2ec7-4ea5-9ebc-af3941465975
2026-05-14 23:05:29 -07:00
Fusion
537657055a feat(FN-4560): complete Step 1 — restructure file editor toolbar layout
Fusion-Task-Id: FN-4560
Fusion-Task-Lineage: 90f0af13-2ec7-4ea5-9ebc-af3941465975
2026-05-14 23:05:29 -07:00
Fusion
d3391658c9 fix(FN-4553): apply syntax highlighting in light mode and react to theme changes
Fusion-Task-Id: FN-4553
Fusion-Task-Lineage: 67774ee2-9fb4-4432-b5cb-3c01c083b0fd
2026-05-14 22:16:44 -07:00
Fusion
43dc598984 feat(FN-4479): complete Step 1 — remove textarea pane
Fusion-Task-Id: FN-4479
Fusion-Task-Lineage: 5dfad520-13eb-4a31-a45c-2daf767a3dff
2026-05-14 09:14:50 -07:00
Fusion
0a6a16cfae fix(FN-4394): restore file editor compatibility for dashboard tests
Fusion-Task-Id: FN-4394
Fusion-Task-Lineage: 1e7ad660-2cd2-40ba-b7b8-7ef552c6fa13
2026-05-14 03:23:43 -07:00
Fusion
91931bd5db feat(FN-4394): complete Step 5 — add dashboard scope discipline controls
Fusion-Task-Id: FN-4394
Fusion-Task-Lineage: 1e7ad660-2cd2-40ba-b7b8-7ef552c6fa13
2026-05-14 03:23:43 -07:00
Fusion
52216568b4 fix(FN-4411): stabilize CodeMirror mount lifecycle
Fusion-Task-Id: FN-4411
Fusion-Task-Lineage: d90785f2-b828-4fa0-b330-ede7f3c14349
2026-05-14 02:23:45 -07:00
Fusion
873f4ac2fd feat(FN-4411): complete Step 3 — replace textarea with CodeMirror
Fusion-Task-Id: FN-4411
Fusion-Task-Lineage: d90785f2-b828-4fa0-b330-ede7f3c14349
2026-05-14 02:23:45 -07:00
Fusion
2ed7ea2f86 feat(FN-4418): complete Step 4 — collapsible file editor toolbar actions
Fusion-Task-Id: FN-4418
Fusion-Task-Lineage: 088af204-a608-46e1-9ca6-4e021c6d751b
2026-05-13 21:01:40 -07:00
Fusion
d6f1f52b5a feat(FN-4125): align mobile editor toolbar toggles and add line number togg
Completes the FileEditor mobile toolbar refactor (FN-4125) by wiring up the line-number toggle with mobile-responsive styling and adding tests for both the toggle and the FileBrowserModal changes.

Fusion-Task-Id: FN-4125
2026-05-12 09:26:04 -07:00
Fusion
44eec7d428 feat(FN-3528): add line-number gutter toggle to FileEditor and Files modal
This merge adds a line-number toggle to the Files modal with persisted preference, introduces an AgentAvatar component with server-side avatar storage routes, and adds documentation for both the toggle and avatar storage. It also includes a regression test for runtime plugin alias behavior and updat

Fusion-Task-Id: FN-3528
2026-05-05 20:47:37 -07:00
gsxdsm
8d8ccef302 feat(KB-264): add word wrap toggle and fix markdown preview scrolling
- Add word wrap toggle button with WrapText icon to FileEditor

- Fix markdown preview scrolling with height: 100% CSS

- Add comprehensive tests for word wrap toggle and scrollability
2026-03-30 23:39:40 -07:00
gsxdsm
6c360959c8 feat(KB-226): add markdown preview to FileEditor
- Add markdown preview toggle to FileEditor with live preview pane
- Implement syntax-highlighted code blocks and responsive layout
- Add comprehensive tests for preview toggle and content rendering
- Update dashboard README with FileEditor usage documentation
- Add changeset for markdown preview feature
- Clean up obsolete changeset files
2026-03-30 18:41:12 -07:00
gsxdsm
810de4ca63 fix(KB-057): restore dashboard client stability 2026-03-29 21:24:55 -07:00
gsxdsm
4b83c13ff7 feat(KB-029): add file browser for viewing and editing task files
- Add server-side file service with list, read, and write operations
- Add REST API endpoints for file operations with tests
- Add client-side API functions and React hooks for file browsing
- Create FileBrowser, FileEditor, and FileBrowserModal components
- Add CodeMirror 6 for syntax-highlighted file editing
- Integrate Files tab into TaskDetailModal
- Add comprehensive file browser styles and responsive design
2026-03-29 21:18:21 -07:00