Skip to content

Persistence#960

Open
sinelaw wants to merge 26 commits intomasterfrom
persistence
Open

Persistence#960
sinelaw wants to merge 26 commits intomasterfrom
persistence

Conversation

@sinelaw
Copy link
Copy Markdown
Owner

@sinelaw sinelaw commented Feb 5, 2026

No description provided.

sinelaw and others added 26 commits February 6, 2026 01:44
When --wait (-w) is specified, the client blocks until all opened
files are closed in the editor. This enables using fresh as $EDITOR
for git commit, git rebase -i, crontab -e, etc.

Protocol changes:
- OpenFiles message now has a `wait` boolean field
- Server sends BufferClosed messages when buffers are closed
- Client waits for all BufferClosed messages before exiting

Also refactors CLI parsing to use ParsedCommand struct instead of
a large tuple for better readability.

Usage:
  fresh --cmd session open-file --wait main COMMIT_EDITMSG

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update CLI help text and session-persistence docs to cover:
- The --wait flag for blocking until buffer closes
- Using Fresh as $EDITOR/$VISUAL for git, crontab, etc.
- Exit code 2 when a new session is started

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace fixed timeouts with semantic waiting loops that wait for
expected output. This follows the testing guidelines and prevents
flaky failures on slow CI systems.

- Wait for ANSI sequences instead of sleeping after handshake
- Wait for typed character in output instead of fixed delay
- Add missing `wait` field in protocol test

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- test_second_client_gets_full_screen: replace fixed sleeps with
  semantic waiting loops that wait for expected output
- line_wrap_scroll_bugs tests: load content from temp file instead
  of typing 2000+ characters one-by-one (was timing out at 90s)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use log_dirs::log_dir() instead of current directory to store the
client debug log file in the standard XDG log location.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update log_dirs to use LOCALAPPDATA on Windows
- Add server_log_path() for server process logs
- Server writes to fresh-server-{PID}.log in log_dir
- Windows daemon no longer handles logging (server does it)
- Remove stderr fallback - always log to file

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Server integration tests were not checking the target condition
after Ok(0) or WouldBlock on Windows, causing infinite loops.

Fixed by checking the condition after EVERY read attempt, whether
data was received or not. Tests now properly exit when condition
is met, and will timeout externally (via nextest) if never met.

No artificial iteration limits - true semantic waiting.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add "Reinstall" button for installed packages that uninstalls and
reinstalls from the original source URL to get the latest version.

Features:
- Shows "Reinstall" button next to "Uninstall" for packages with source
- Prompts user for confirmation before reinstalling
- Performs clean reinstall (uninstall + fresh install)
- Useful for getting latest changes without git conflicts

Implementation:
- Added reinstallPackage() function
- Modified getActionButtons() to show Reinstall button
- Packages already track installation source from git remote URL
- Handles button click in pkg_activate command

The button label is "Reinstall" rather than "Upgrade" to clearly
distinguish from "Update" (git pull) vs "Reinstall" (uninstall + install).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
After installing a package, update the selection to point to the newly
installed package in the INSTALLED section. Previously, the selection
stayed on the old position in the AVAILABLE section, making it appear
as if the package wasn't installed.

Changes:
- Find the newly installed package in the rebuilt list
- Update selectedIndex to point to it
- Reset focus to list view
- If package is filtered out, reset to first item

This matches the behavior of the Uninstall action which also updates
the selection after removing a package.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Check .fresh-source.json in addition to .git/config for source URLs
- Update reinstallPackage to use installPackage instead of installFromRepo
- Add debug/warning logging to reinstall flow for better error visibility
- Fix type error: convert null manifest to undefined

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add eprintln! logs around connection handshakes to identify where
the e2e tests hang on Windows when reconnecting after detach or
connecting a second client.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add default HTML language configuration
- Configure Prettier as default formatter for .html and .htm files
- Enables 'Format Buffer' command for HTML files
- Matches JavaScript/TypeScript Prettier configuration

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds editor.getPluginDir() method that returns the directory containing
the currently executing plugin file. This allows plugins to access
resources (scripts, config files, etc.) in their own directory without
relying on undocumented global variables.

Changes:
- Add plugin_paths map to QuickJsBackend to track plugin file paths
- Add plugin_path field to JsEditorApi
- Store plugin path when loading modules
- Implement getPluginDir() that returns the plugin's parent directory
- Update TypeScript definitions

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When a package is selected, Tab now cycles only between the list and
action buttons (Reinstall, Uninstall, etc.) instead of cycling through
all UI elements. This provides focused navigation within the selected
package context.

Behavior:
- Tab from list → first action button
- Tab from action button → next action button
- Tab from last action button → back to list
- Shift-Tab reverses this cycle
- When no package selected, Tab cycles through all UI elements as before

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When pressing Enter on a list item, execute the primary action instead
of just moving focus to the action button. This makes the UI more
intuitive and efficient.

Behavior:
- Enter on uninstalled package → Install
- Enter on package with update → Update
- Enter on package with source → Reinstall
- Enter on package without source → Uninstall

Users can still Tab to other actions if needed.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Tab navigation now:
- List → First action (Reinstall) → Next action (Uninstall) → Other UI
- After other UI elements, wraps back to List (not search)
- Creates natural cycle: List → Actions → Other UI → List

Shift-Tab reverses this flow.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add explicit setEditorMode call after buffer creation to ensure
pkg-manager mode is active and Tab/keybindings work properly.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add debug logging to see if pkg_next_button is being called when Tab
is pressed. This will help diagnose why Tab might not be working.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Revert behavior where Enter on list executed the primary action.
Now Enter on list just moves focus to the first action button,
requiring a second Enter to execute it. This gives users a chance
to review the action before executing.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add yes/no confirmation prompt before uninstalling a package,
matching the behavior of reinstall. This prevents accidental
uninstallation.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
After closing the package manager, reset the editor mode to "normal"
to allow typing in the restored buffer. Without this, the pkg-manager
read-only mode stays active and blocks all input.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add skipConfirmation parameter to removePackage so that reinstall
doesn't show double confirmations. Reinstall already confirms the
action, so it skips the uninstall confirmation when removing the
old package.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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