Merge lane-c: keep the lane's reviewed work

Combines lane-c's Templates gallery and detail view with the chat and omni-search work already on main (lane-t2). The three files both lanes touched keep both intents: AppViewModel.kt keeps refreshTemplates/createFromTemplate alongside the search/chat flows, PipelinesApp.kt keeps both the Templates and Chat destinations, and graph/Artifacts.kt adopts the shared galleryGrid fitting while keeping the tile-gallery refactor.

Doc check before committing: nothing needs updating. This is an android/-only merge. The app's topic doc (android/README.md) already documents the Templates destination (lane-c) and the Chat/omni-search work (lane-t2). The root README and docs/ describe the server CLI/TUI (whose :templates catalog is a separate surface) and are unchanged. The packaged authoring skill references (internal/author/skill/references/) mention the Android client only for APK-delivery mechanics, which this change does not alter, and the packaged templates are server-side and untouched.
This commit is contained in:
2026-10-17 01:42:51 +01:00
13 changed files with 1176 additions and 132 deletions
+88
View File
@@ -104,6 +104,22 @@ stops it.
- Pipeline list (search/refresh, empty/error/loading states), pipeline details
(version list, content hash, source) and the workflow graph.
- A **Templates** destination (its own top-level pill between Pipelines and Runs,
with its own gallery glyph rather than the Pipelines workflow tree): a measured
gallery of cards, one per server template, each showing the template's name, its
short description and its stage count — `stage count unavailable` when the source
does not parse, never a claimed zero — with a single column on a narrow window
and as many equal-width cards as fit on a wide one, from the shared
`galleryGrid` fitting (the same rule the artifacts gallery uses) at the
`WIDE_RAIL_WIDTH_DP`/`SPACING_S` tokens, so the gallery widens by adding columns
instead of stretching cards. Tapping a card opens a detail pane that reuses the
pipeline detail's Summary / Graph / Source tabs (the stage list, the
`WorkflowGraph` and the shared `PipelineSourceView`), so the shape is readable
before choosing it; a source the server could not parse is still fully viewable
as raw markdown. A "create from this template" action submits the source as a
create-only draft pipeline (the app's equivalent of `pipelines new --template
KEY`) and never starts a run. Empty, loading and error states reuse the shared
state components.
- Workflow graph composable: content-sized stage nodes laid out in one row in
declaration order, with `#failure`/`#success` terminals sharing a lower row and
arrows entering their top borders (an `error -> #failure` route leaves its
@@ -5133,3 +5149,75 @@ Not verified in this pass: the on-device narrow/wide renders (a section opening
over the stage and returning, and the wide panel beside the stage pane) and any
screenshot of the former inline case — the brief keeps implementation
verification to the build and the unit tests, and visual review owns the device.
## Templates: a gallery and a detail view (17 Oct 2026)
The server's template catalog (`list_templates`, which `pipelines templates` and
`pipelines template <key> --source` already print) is now a first-class surface in
the app; before this change the app showed nothing for it. `android/` only:
nothing in the Pipelines server, its Go source, the Docker/compose files or the
installer was touched, no dependency was added (the destination glyph is the
already-declared material-icons-extended `Widgets`) and no run is started from the
app.
- **The destination.** `PipelinesApp`'s destination list gains a `Templates`
entry between `Pipelines` and `Runs` (`TemplatesIcon`, `Icons.Filled.Widgets`,
deliberately not the Pipelines workflow tree), and `TemplatesDestination` uses
the same shared `SlidingPaneStack` the other destinations use: pane 0 the
gallery, pane 1 the selected template's detail, with the selected key in
`rememberSaveable` so the open template survives rotation and process death.
- **The gallery.** `TemplateGalleryScreen` shows one card per template from
`vm.templates` (loaded by a new `AppViewModel.refreshTemplates`, backed by
`PipelinesRepository.listTemplates`): the name, the short description and the
stage count, with the card's own leading glyph. `templateGridColumns` decides
the layout — a single column on a narrow window, and on a wide one as many
`WIDE_RAIL_WIDTH_DP`-shaped cards as fit `SPACING_S` apart via the shared
`galleryGrid` fitting — so no new geometry constant is introduced.
- **Stage counts come from a parsed source, not a guess.** `list_templates`
carries only the source, so `refreshTemplates` parses each template's source on
the server (`validateSource`, the `validate` command) once and caches the graph
per key+source. A template whose source does not parse keeps a null graph: its
card reads `stage count unavailable` (never `0 stages`), its Graph tab says the
source could not be parsed, and its Source tab shows the raw markdown — the
template stays fully viewable.
- **The detail view reuses the pipeline-detail idiom.** `TemplateDetailScreen`
uses the same `DetailTabs` (`pipelineDetailTabs`: Summary / Graph / Source) and
the same tab body/width handling as `PipelineDetailScreen`: Summary lists the
stages, Graph renders the `WorkflowGraph` (with an explicit note when the source
did not parse), and Source renders the definition through the shared
`PipelineSourceView`.
- **One rendered-definition view, not two.** `PipelineSourceTab` moved out of
`PipelineDetailScreen` into `ui/graph/SourceView.kt` as `PipelineSourceView`, so
the pipeline detail and the template detail render a definition through exactly
one composable (per-stage collapsible sections, the Raw toggle, the copy action).
- **One gallery fitting, not two.** The artifact gallery's private
`ArtifactGrid`/`artifactGrid` fitting moved to the shared
`ui/components/GalleryGrid.kt` (`GalleryGrid`/`galleryGrid`), so the templates
gallery and the artifacts gallery share one measured-column rule and the
artefact gallery tests now exercise the shared function.
- **Create from a template.** A top-bar action on the detail opens a dialog that
submits the template's source as a create-only draft pipeline
(`AppViewModel.createFromTemplate` → `PipelinesRepository.createPipeline`, the
`submit` command with `create_only`): the app's equivalent of the CLI's
`pipelines new --template KEY` (that path writes a local draft file; the app has
no filesystem, so it stores the draft on the server, where it appears in the
Pipelines list). An existing name is never overwritten and no run is started.
- **States.** Empty, loading and error states reuse the shared `StateCrossfade`
state components; a covered pane shows only its compact identity.
Verification (this run's review stage, macOS, cached Gradle, `--no-daemon`): the
offline build and unit tests pass at **35 suites / 309 tests / 0 failures / 0
errors**, including the new `TemplatesTest` (the card/stage-count mapping, the
`stage count unavailable` label for an unparsed source, and the narrow-column /
wide-grid decision) and the relocated artifact-gallery cases now running against
the shared `galleryGrid`. The app's create path was checked against the repo's own
Go test for the server submit-with-`create_only` behaviour.
Visual review (this run, operator's Pixel 9 Pro XL, adb `47241FDAS00DLK`, built
from this tree and installed over the existing package) confirmed the gallery
renders 5 cards — a single column at the phone's ~448dp width and a 4-column
measured grid at `wm size 2000x2244` — and that each card opens a Summary / Graph
/ Source detail with the create dialog, consistent with the app's Material 3
language. The empty, loading, error and unparseable-source states were built from
the app's shared state components but could not be produced live without mutating
the operator's server.