Skip to content

feat(tools): snippets, text you save once and get back by name - #70

Merged
JOhnsonKC201 merged 3 commits into
mainfrom
feat/snippets
Oct 9, 2026
Merged

JOhnsonKC201 merged 3 commits into
mainfrom
feat/snippets

Conversation

@JOhnsonKC201

Copy link
Copy Markdown
Owner

What this does

Text you type again and again, saved once and copied back by name.

Type What happens
save sig Keeps whatever you last copied as ;sig (or replaces it)
;sig Copies it back, ready to paste
; Lists every snippet with a one-line preview
forget sig Deletes it

Thirty at most, 2,000 characters each. A name is one word. In all eight languages, and in the ? list.

How it fits the launcher's rules

  • Saving sends main a name. Main reads the clipboard itself when the row runs, as the text fixers do. The pet never says the text back, and a copy made from a snippet is flagged as ours, so clipboard history does not record it.
  • Snippets are plain text in settings.json, unlike clipboard history, which is memory only. Text in a known key or token format is refused, along with connection strings that carry a password, password: and api_key= lines, and a few more vendor prefixes. This is deliberately narrower than the clipboard-history filter, which would refuse a mixed-case email address and a meeting link. No check recognises every password, and the docs say so.
  • settings:save now ignores the snippets key. See below.

Found in review, fixed in the third commit

  • Settings could wipe or freeze on snippets. The Settings window sends back its whole copy of the config on every save. A stale copy would restore an old snippet list, and thirty full snippets (about 74 KB) pushed every save past the 64 KB limit, so every toggle silently did nothing.
  • Hindi names were rejected, because vowel signs are combining marks. Hindi is a shipped language.
  • forget password produced a dead-end row. It is a web search again.
  • ; showed only eight snippets and is the only place to see them all.

Behaviour changes to know about

  • save followed by one word is now the snippet command, so save file offers to save a snippet named file where it used to offer a web search. Several words after save still search. An accidental save is undone with forget.
  • The ? list holds eight rows. Its unit-conversion row made way for the snippet row, and conversions are now mentioned on the calculator row.
  • Typing ; shows a preview of each snippet's text on screen.

Test plan

  • npm test: 512 pass, 0 fail, 4 skipped (POSIX only)
  • npx eslint . clean
  • The real launcher page driven in a throwaway Electron window, English and Spanish: ?, ;, ;ad, save , save phone, save sig (offers Replace), save a;b, forget sig, ;zzz. Icons, colours and hint rows as intended, no console errors. That run was before the review fixes; the fixes are covered by unit tests only.
  • The live clipboard round trip in the running app (the harness stubs the OS side): copy text, save sig, copy something else, ;sig, paste.
  • Open Settings, save a snippet from the launcher, toggle something in Settings, confirm the snippet is still there.
  • Not run on macOS

The seven non-English locale files were written without a native-speaker review, as before.

Copy an address, a sign-off or a meeting link, type save sig, and
from then on ;sig copies it again. ; lists them, save sig replaces
one, forget sig deletes one. Thirty at most, 2,000 characters each,
a name is one word.

Saving reuses the text fixers' rule: the launcher sends a name, and
main reads the clipboard itself when the row is run. The pet never
says the text back, and a copy made from a snippet is flagged as
ours so clipboard history does not record it.

Snippets live at the top level of the config, like to-dos. Settings
saves the whole tools object from its own copy, so a snippet saved
while Settings was open would have been overwritten there.

They are plain text on disk, so text in a known key or token format
is refused. The check is the pattern list only: the broader guess
used for clipboard history turns away a mixed-case email address
and a meeting link, which are what people save.

Several words after save or forget are left to the web search. The
? list trades its unit conversion row for a snippet row, since it
holds eight; conversions are now named on the calculator row.
…ist all thirty

Found in review, before any release.

- Settings sends back its whole copy of the config on every save.
  A copy from before a snippet was saved put the old list back, and
  thirty full snippets (about 74 KB) pushed every save past the
  64 KB junk limit, so toggles silently did nothing. settings:save
  now drops the snippets key, which Settings has no editor for.
- A name could not contain a combining mark, which ruled out every
  Hindi word with a vowel sign. Marks are allowed after the first
  character, and names are NFKC folded so look-alikes are one name.
- forget followed by a word that is no snippet (forget password) is
  left to the web search again.
- ; showed eight snippets at most, and it is the only place to see
  them all. It lists all thirty; the launcher list scrolls.
- save ;sig is the same as save sig.
- Refuse a few more credential shapes with no vendor prefix: a
  connection string with a password in it, a password: or api_key=
  line, Stripe, GitLab and npm tokens, a Bearer header.
@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pixelcat Ready Ready Preview Oct 9, 2026 4:50am UTC

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

CI for e81642c: all jobs passed

Job Result Log
test passed open
packaged-boot (windows-latest) passed open
packaged-boot (macos-latest) passed open
boot (windows-latest) passed open
boot (macos-latest) passed open

Tests: 516 passed, 0 failed, 0 skipped, 516 total.

This comment updates itself on every push. Full run.

@JOhnsonKC201
JOhnsonKC201 merged commit aad223b into main Oct 9, 2026
9 checks passed
@JOhnsonKC201
JOhnsonKC201 deleted the feat/snippets branch October 9, 2026 04:53

This branch was successfully deployed

1 active deployment
Preview — e81642c3 Deployed Oct 9, 2026 by vercel[bot]
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