Skip to content

Shared parameter definitions: resolution groundwork (1/2)#31

Merged
StuartMeeks merged 2 commits into
mainfrom
feat/shared-parameters-core
May 30, 2026
Merged

Shared parameter definitions: resolution groundwork (1/2)#31
StuartMeeks merged 2 commits into
mainfrom
feat/shared-parameters-core

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

Part 1 of the shared parameter definitions feature (task #1) — the Core resolution groundwork. Management UI is part 2.

Design confirmed with you: name-based precedence (Snip-local → CLI → global), no reference objects/IDs; Core-first staging.

What this PR does

  • Model: Cli.Parameters (CLI-scoped) and SnipStoreDocument.GlobalParameters (global), both List<Parameter> defaulting to [].
  • ParameterResolver (Core/Engine): computes a Snip's effective parameter set — local params, plus any template token not defined locally that a CLI/global scope provides (CLI wins over global). Tokens defined in no scope are left out, so the "bare token copies verbatim" behaviour (the feat/phase-6-settings: editable settings + Velopack updater (stacked on #8) #9-era fix) is preserved. Additive: with empty shared collections, behaviour is byte-for-byte the same as before.
  • ParameterFillViewModel now fills from the resolved set; ShellViewModel.CopySnipAsync resolves it (and uses it for the skip-the-flyout check, so an inherited param correctly opens the flyout). IShellInteractions.FillParametersAsync takes the resolved parameters.
  • Schema → v2 (additive). JsonSnipStore stamps v2 on every save, so an older v1-only build refuses the store rather than silently dropping shared definitions. Source-gen already covers Parameter, so no new [JsonSerializable] needed; byte-identical compatibility tests still pass.

Not in this PR (part 2)

The UI to manage shared parameters: CLI-scoped in the CLI editor dialog, and global params in the main UI (not Settings, per your call). Until then, shared params resolve correctly but can only be added by hand-editing the store — so this PR has no user-visible behaviour change on its own.

Tests

  • New ParameterResolverTests (8): local-only, CLI inherit, local-overrides-CLI, CLI-over-global, global fallback, undefined-token-omitted, local-not-in-template retained, ordering.
  • Updated ParameterFillViewModel tests + the fake interaction for the new signature.
  • Full suite: 168 passing. WinUI head builds clean on the agent.

🤖 Generated with Claude Code

StuartMeeks and others added 2 commits May 30, 2026 12:14
Add CLI-scoped (Cli.Parameters) and global (SnipStoreDocument.GlobalParameters)
parameter definitions, resolved by name with precedence local > CLI > global
via a new Core ParameterResolver. ParameterFillViewModel now fills from the
resolved effective set rather than snip.Parameters directly, so a Snip can omit
a parameter and inherit the shared definition; defining it locally overrides.

Resolution is additive — effective set = local params plus any template token
not defined locally that a CLI/global scope provides; tokens defined nowhere
stay un-prompted (bare-token verbatim copy preserved). With empty shared
collections, behaviour is identical to before.

Store schema bumped to v2 (additive); JsonSnipStore stamps v2 on save so an
older build refuses the store rather than silently dropping shared params.
IShellInteractions.FillParametersAsync now takes the resolved parameters.

Management UI (CLI editor + global, in the main UI) lands in part 2.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Editing a CLI (rename or icon change) rebuilt a fresh Cli with only Id/Name/
IconRef, which dropped the new Parameters collection — a rename would wipe
CLI-scoped shared parameters and the snips inheriting them. Carry Parameters
through in CliEditorViewModel.BuildUpdatedCli and both ShellViewModel icon-save
reconstructions.

Found by codex review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@StuartMeeks StuartMeeks merged commit c9c2324 into main May 30, 2026
4 checks passed
@StuartMeeks StuartMeeks deleted the feat/shared-parameters-core branch May 30, 2026 12:26
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