Skip to content

chore: share result helpers and save_path copy, drop unused exports - #105

Merged
iamnbutler merged 1 commit into
mainfrom
chore/cleanup
Oct 17, 2026
Merged

iamnbutler merged 1 commit into
mainfrom
chore/cleanup

Conversation

@iamnbutler

Copy link
Copy Markdown
Contributor

A cleanup pass over src/ with no behavior change: shared helpers replace copies made across recent PRs, and internal symbols nothing uses are no longer exported.

Changes

  • New src/results.ts:

    • Json, parseResult(result) and errorMessage(error) (an error's message, capped at 2000 characters).
    • These replace the identical private copies in wait.ts and notifications.ts, the Json alias in cell.ts, and the same message expression written inline nine times in client.ts and cell.ts.
    • client.ts and cell.ts also use parseResult where they parsed a result's text by hand.
  • save_path rules (feat: save a screen or window capture as a full-resolution PNG, optionally one region #81 captures and feat: save the clipboard image's original bytes with desktop_clipboard_read save_path #96 clipboard images), in capture-file.ts:

    • The exclusive-unless-overwrite copy is now one place() helper.
    • The extension check is now one extensionOf() helper.
    • Validation was already shared through validateSave.
  • Poll loops: wait.ts's poll() is already the only one; desktop_wait, expect and notifications all go through it or through single reads. Nothing to merge.

  • Dead code: removed the unused TableError import in cell.ts. tsc --noUnusedLocals --noUnusedParameters is now clean.

  • Unused exports: export is removed from internal symbols used only in their own module:

    • app.sign;
    • availability's WindowAvailability, WindowFacts and SessionFacts;
    • capture-file's CaptureSave, SavedCapture and SavedClipboardImage;
    • cell.CellIO;
    • notifications' NOTIFICATION_CENTER and NotificationEntry;
    • table's TABLE_ROLES, TableRow and Table;
    • wait's validateWait and ExpectedAction.

    The public entry points (client, protocol, tools) are untouched.

Error messages, limits and argument checks are unchanged. I left the inline per-argument checks in client.ts as they are, because merging them would change their error text.

Checks

  • npm run -s check, npm test: 55 pass, including the new test/results.test.mjs
  • tsc --noEmit --noUnusedLocals: clean

@iamnbutler
iamnbutler merged commit 6f05459 into main Oct 17, 2026
2 checks passed
@iamnbutler
iamnbutler deleted the chore/cleanup branch October 17, 2026 08:41
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