Skip to content

feat(harness): SourcePicker Add Include context (Phase 3)#294

Merged
eyelock merged 1 commit into
developfrom
feat/source-picker-add-include
May 5, 2026
Merged

feat(harness): SourcePicker Add Include context (Phase 3)#294
eyelock merged 1 commit into
developfrom
feat/source-picker-add-include

Conversation

@eyelock
Copy link
Copy Markdown
Owner

@eyelock eyelock commented May 5, 2026

Summary

Phase 3 of the unified source-picker plan, completing the picker abstraction across the three "add a thing" surfaces:

The bespoke 790-line AddIncludeFlow retires in favour of AddIncludeContext driving the same SourcePicker shell as the other two contexts.

Changes

New files

  • Sources/TermQ/Views/SourcePicker/AddIncludeContext.swiftSourcePickerContext for adding includes. Library tab lists plugins from configured marketplaces with search and "already installed" recognition; picking a fresh plugin enters a Configure stage with the picks tree (IncludePicksSelector) and a command preview. Git URL tab takes URL/ref/path with the same Apply path. Inherits the post-pick Configure stage shape from Add Delegate.
  • Sources/TermQ/Views/SourcePicker/IncludePicksSelector.swift — moved from AddIncludeFlow.swift; reusable view kept for the Configure stage (and the existing Edit Include sheet which already uses it).
  • Sources/TermQ/Marketplace/IncludeMatching.swiftIncludeKey and IncludePluginLookup non-View types moved here from the old flow file. Used by both the new context's already-installed detection and the existing Edit sheet.

Modified

  • Sources/TermQ/Views/HarnessDetailDependencyView.swift — drops the inline AddIncludeSectionView; "+ Add Include…" button now triggers editor.startAddingInclude() which the IncludeEditorOverlay presents as a sheet (mirrors AddDelegateSheetHost).
  • Sources/TermQ/Views/HarnessIncludeEditor.swiftisAddingInclude semantics shift from "show inline panel" to "show sheet"; existing didFinishAddingInclude(harnessName:) flips the flag and reloads detail.
  • Sources/TermQ/Utilities/Strings+Sidebar.swift — adds harnesses.include.add.edit.existing; retires step-title and source-mode strings (no longer needed — picker shell handles tab labels and step dots are dropped).

Deleted

  • Sources/TermQ/Views/AddIncludeFlow.swift (790 lines).

Tests

  • Tests/TermQTests/AddIncludeStoreTests.swift → renamed to AddIncludeContextTests.swift, rewritten against the new context API (15 tests covering library-stage resolution, picks helpers, command-preview behaviour for Library and Git URL paths).

Localization

  • 6 retired strings deleted from all 40 locales (harnesses.include.add.step.*, harnesses.include.add.source.*).
  • 1 new string (harnesses.include.add.edit.existing = "Edit") added across all locales.

UX changes from the prior inline flow

  • Sheet replaces inline expansion. Same step-machine inside; just a different container. Matches Install Harness and Add Delegate.
  • "Already added" detection unchanged — clicking an already-installed plugin row routes to the existing Edit Include sheet via editor.switchToEditing(match). Critical UX preserved.
  • Step dots dropped (Add Delegate has no dots either; consistent now).
  • Sheet size 520×620 to fit the Configure stage cleanly without cutting off the Cancel button.
  • "None" button correctly disables Apply (previously left Apply enabled, which would have resulted in a no-op include with --pick defaulting to all artifacts).
  • Command-preview Apply path emits AddInclude: log lines for diagnostic forensics.

Test plan

  • Open Add Include on an editable harness; Library tab shows plugins from configured marketplaces with search filter.
  • Pick a fresh plugin → Configure stage with picks tree and command preview.
  • Pick a plugin already on the harness → "Edit" button instead of "Pick"; click routes to Edit Include sheet.
  • Apply on the Library path → sheet dismisses; detail view immediately shows the new include with correct picks.
  • Apply with all picks selected → command preview omits --pick.
  • Apply with subset of picks selected → command preview includes --pick.
  • Apply with no picks selected (after using the "None" button) → Apply button is disabled.
  • Lazy-load picks: pick a plugin with skillsState != .eager; spinner shows; picks populate.
  • Git URL tab: URL + ref + path → Apply works; no picks step.
  • Cancel and Esc both dismiss the picker.
  • Install Harness sheet (feat(harness): unified SourcePicker for Install Harness (Phase 1) #262) and Add Delegate sheet (feat(harness): SourcePicker Add Delegate context (Phase 2) #267) still work — no regressions.

🤖 Generated with Claude Code

Migrates the bespoke Add Include flow onto the unified SourcePicker,
completing the picker plan for the three "add a thing" surfaces:
Install Harness (Phase 1), Add Delegate (Phase 2), and now Add Include.

Layout
- Library tab lists plugins from configured marketplaces with search
  and "already installed" recognition. Picking a fresh plugin enters a
  Configure stage with the picks tree (IncludePicksSelector) and a
  command preview; clicking a row matching an existing include routes
  through to the editor's Edit sheet via switchToEditing().
- Git URL tab takes URL + ref + path with command preview (no picks —
  raw URLs aren't introspected; user can narrow with Edit afterwards).
- Apply runs `ynh include add` via IncludeApplier; on success the
  editor's didFinishAddingInclude() dismisses the sheet and reloads
  detail.

Sheet replaces the inline expansion. The "+ Add Include…" button now
toggles editor.isAddingInclude which the IncludeEditorOverlay presents
as a sheet (mirroring AddDelegateSheetHost).

File layout
- New: Sources/TermQ/Views/SourcePicker/AddIncludeContext.swift
- New: Sources/TermQ/Views/SourcePicker/IncludePicksSelector.swift
  (extracted from the old flow file; reusable view)
- New: Sources/TermQ/Marketplace/IncludeMatching.swift
  (IncludeKey + IncludePluginLookup; non-View utilities)
- Deleted: Sources/TermQ/Views/AddIncludeFlow.swift (790 lines)
- HarnessDetailDependencyView: drops AddIncludeSectionView; entry-point
  button stays; sheet host modifier added.

Tests
- AddIncludeStoreTests → AddIncludeContextTests, rewritten against the
  new context API. Covers library-stage resolution, picks helpers, and
  command-preview behaviour for both Library and Git URL paths.

Localization
- Retires step-title and source-mode strings (no longer needed —
  picker shell handles tab labels and step dots are dropped).
- Adds harnesses.include.add.edit.existing.
- All 40 locales synced.
@eyelock eyelock merged commit 5ce3da0 into develop May 5, 2026
7 checks passed
@eyelock eyelock deleted the feat/source-picker-add-include branch May 5, 2026 20:32
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