Skip to content

feat/phase-4-authoring: authoring + parameter-fill flyout (stacked on #6)#7

Merged
StuartMeeks merged 3 commits into
masterfrom
feat/phase-4-authoring
May 29, 2026
Merged

feat/phase-4-authoring: authoring + parameter-fill flyout (stacked on #6)#7
StuartMeeks merged 3 commits into
masterfrom
feat/phase-4-authoring

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

Phase 4 of the build plan. Authoring + the parameter-fill flow.

Base: `feat/phase-3-shell` (PR #6). Once #6 merges, please retarget this PR to `master` and rebase. The diff against master would otherwise also show Phase 3.

What's live now

  • Copy — for parameter-less Snips, copies the template directly. For Snips with parameters, opens ParameterFillDialog (TextBox per Text param, ComboBox per Choice param, live preview of the resolved command, Copy disabled until fully resolved). On confirm: clipboard write + UsageCount++ + LastUsedAt = now.
  • Edit SnipSnipEditorDialog with title / command template (monospace) / description / tags / parameters (Text or Choice, default, options). Add/remove parameters inline.
  • Delete Snip — confirmation dialog → soft-delete (IsTrash = true).
  • Favourite — toggles IsFavourite, glyph swaps via x:Bind function binding.
  • New CLI / Edit CLICliEditorDialog with name + icon picker. Picked images go through WindowsIconNormaliser (centre-square crop, 256² PNG via Windows.Graphics.Imaging) and IconAssetStorage writes to <data>/icons/<cli-id>.png.
  • New Snip — appears when a CLI is selected.
  • CliCard tap — clicking a CLI card on Home selects that CLI.

New abstractions in Core

  • IClipboardService
  • IIconNormaliser
  • IIconAssetStorage
  • IShellInteractions — Core view models present dialogs by handing off to this; the App implements it via WinUI ContentDialogs.

New view models in Core

ParameterFillViewModel, ParameterInputViewModel, SnipEditorViewModel, ParameterEditorRowViewModel, CliEditorViewModel. ShellViewModel grows the commands (CopySnip, EditSnip, DeleteSnip, ToggleFavourite, NewSnip, NewCli, EditCurrentCli, SelectCli).

Tests

106 passing (up from 88). Three new test files:

  • ParameterFillViewModelTests — preview live-updates, copy-enabled gating, default pre-fill.
  • SnipEditorViewModelTests — CanSave gating, BuildUpdatedSnip preserves identity, parameter add/remove, tag dedup.
  • ShellViewModelCommandsTests — copy with/without parameters, edit replaces in-place, delete only after confirmation, favourite flips, new-CLI persists icon bytes via FakeIconAssetStorage.

What CI doesn't verify (please eyeball)

  • Dialogs render and lay out reasonably
  • The parameter-fill flow's live preview updates as you type / pick
  • Icon picker actually opens (uses WinRT.Interop.InitializeWithWindow.Initialize against the main window HWND)
  • New CLI / New Snip / Edit CLI buttons appear in the right places
  • After a copy, the Snip moves up the "Most used" list on Home (or appears if it wasn't there)

Not in this PR (deferred)

  • CLI delete — needs cascade semantics; deferred until we settle on "must be empty first" vs "trash all child snips too".
  • Icon display on CliCard — identicons still show; replacing them with the uploaded image lands in Phase 5 (alongside the rest of the platform polish).
  • Markdown rendering for descriptions — plain text only for now.

🤖 Generated with Claude Code

StuartMeeks and others added 3 commits May 29, 2026 17:28
The Copy / Edit / Delete / favourite buttons on Snip cards become live, with
ContentDialogs for editing and a parameter-fill flyout for copy:

  Copy
    - Snips with no parameters copy the template directly.
    - Snips with parameters open ParameterFillDialog (TextBox / ComboBox per
      input, live preview, primary button gated on full resolution).
    - On success: writes to clipboard via WindowsClipboardService, bumps
      UsageCount + LastUsedAt, saves the store.

  Edit / New Snip
    - SnipEditorDialog binds to SnipEditorViewModel: title, command template
      (monospace), description, tags (comma-separated), parameter rows with
      add/remove and Text/Choice typing.

  Delete
    - Confirmation ContentDialog, then sets IsTrash = true and saves.

  Favourite
    - Star toggles IsFavourite + saves; glyph swaps via x:Bind function.

  CLI authoring
    - New CLI / Edit CLI buttons (Home and CLI view header).
    - CliEditorDialog picks an image via FileOpenPicker (initialised against
      the main window's HWND), normalises it to a 256² centre-square PNG via
      WindowsIconNormaliser (Windows.Graphics.Imaging), and stores it under
      <data>/icons/<cli-id>.png via IconAssetStorage.
    - Clicking a CliCard on Home now navigates into that CLI.

New Core abstractions: IClipboardService, IIconNormaliser, IIconAssetStorage,
IShellInteractions (the App's WinUI ContentDialog presentations).

New Core view models: ParameterFillViewModel, ParameterInputViewModel,
SnipEditorViewModel, ParameterEditorRowViewModel, CliEditorViewModel.

ShellViewModel grows the commands (CopySnip, EditSnip, DeleteSnip,
ToggleFavourite, NewSnip, NewCli, EditCurrentCli, SelectCli). Test doubles
(FakeClipboardService, FakeShellInteractions, FakeIconAssetStorage) drive
the command flow in unit tests — 18 new tests, 106 total.

App-side platform services: WindowsClipboardService,
WindowsIconNormaliser (Windows.Graphics.Imaging),
WindowsShellInteractions (resolves MainWindow lazily for XamlRoot / HWND so
the singleton constructs before the main window exists).

This PR is the second in a stack of four. Base: feat/phase-3-shell.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Stacked PRs (e.g. Phase 4 → Phase 3 instead of → master) don't trigger the
pull_request filter when their base isn't master. Trigger on every branch
push so the stack gets exercised end-to-end.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PixelWidth / PixelHeight are already uint on BitmapDecoder, and Math.Min on
two uints returns uint, so the explicit (uint) casts trip IDE0004 under
TreatWarningsAsErrors.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Base automatically changed from feat/phase-3-shell to master May 29, 2026 22:48
@StuartMeeks StuartMeeks merged commit 85ab0da into master May 29, 2026
2 checks passed
@StuartMeeks StuartMeeks deleted the feat/phase-4-authoring branch May 29, 2026 22:49
StuartMeeks added a commit that referenced this pull request May 29, 2026
feat/phase-5-platform: hotkey, tray, close-to-tray, file-picker (stacked on #7)
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