feat: chart subcommands, remove global FlagState, and drop --scale from root#129
Merged
Conversation
Add independent chart subcommands (bar, line, pie, heatmap, radar) that each expose only the flags valid for that chart. bar/line carry --scale and --rotate; pie/heatmap/radar omit them by struct composition, so the restriction is enforced at compile time rather than via a runtime exclusion map. Architecture (Approach C): - Delete the global shared.FlagState. Parsers become pure functions of (input, parser.Config): ParseFunc gains a parser.Config arg and GroupAxes/GroupBenchmarkName/ShouldIncludeBenchmark take config. - New cmd/cli package: a self-registration registry, composable option groups (CommonOptions -> LinearOptions -> ChartOptions), and one shared RunLinear pipeline. Output/progress helpers move here too. - Chart subcommands live in cmd/charts/<type> and self-register via init(), mirroring how pkg/parser parsers register; root blank-imports them. A future non-linear chart type plugs in the same way. - Root keeps multi-chart --charts and the --chart per-chart override (no breaking change). ui and merge are de-globalized to local options. Tests: refactor-touched test files converted to testify/suite; SetupTest builds parser.Config / resets state, removing the previous order fragility. Docs add a consolidated chart-subcommands page.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
fahimfaisaal
added a commit
that referenced
this pull request
Jun 16, 2026
Resolves structural divergence introduced by PR #129 (squashed into ccdac51 on main). The 3f60897 sync commit pre-merged only the --scale flag removal, CommonOptions field reorder, and 3D bevel/line cosmetic tweaks. The deeper refactors from #129 (LinearDefaults, ChartSelection, ParseChartSpecs, DatasetSettings{Charts,Axes,ChartSettings,Sort,Scale,ShowLabels}) are superseded by settings-architecture's per-chart Config registry (config/charts/{bar,line,pie,heatmap,radar}/Materialise). All 20 unmerged files resolved in favour of the new architecture per design spec docs/superpowers/specs/2026-06-16-settings-architecture-design.md: cmd/charts/{bar,heatmap,line,pie,radar}/{name,_test}.go (10 files) cmd/cli/{options_test,pipeline,pipeline_test}.go (3 files) cmd/{root,root_test,ui,ui_test}.go (4 files) pkg/template/vizb-ui.gen.go (1 file) shared/{chart_spec,chart_spec_test}.go (2 files) Audit: test counts match 1:1 across branches; the two architectures are mutually exclusive at the type/function signature level, so no test cases from main port over. go build ./... and go test -count=1 ./... pass.
fahimfaisaal
added a commit
that referenced
this pull request
Jun 17, 2026
…stry panel (#130) - **Wire format**: `Dataset.Settings` is now `[]config_charts.ChartConfig` (typed per-chart: bar/line/pie/heatmap/radar). v0.12.0 files are auto-migrated in-memory on read via `shared.MigrateDataset`. See CHANGELOG 0.13.0. - **Per-chart config registry** (`config/charts/`): `ChartConfig` interface + `Register`/`New`/`Decode`/`Registered`/`Factory`. Each chart subdir (`bar`, `line`, …) self-registers via `init()`. `Materialise(flags, *Config)` is the typed build entry point. - **CLI refactor**: replaces `shared.FlagState` with `cli.CommonOptions` → `LinearOptions` → per-chart options; `vizb bar|line|pie|heatmap|radar` subcommands self-register via `init()`. The per-chart subcommand `Run` calls `Materialise` and passes the typed `*Config` to a new `cli.RunSingleChart(cmd, args, common, configs)`. `assembleDataset` / `applySelections` now set `dataSet.Settings = configs` directly. Re-introduces the `cli.ValidateScale` call that the previous per-chart-subcommand refactor had dropped. - **UI panel**: schema-less `SettingsPanel` walks a `fieldRegistry` (`appliesTo: ChartType[]` + `appliesOn: Dimension[]` per field) and renders the registered control for each known key. Adding a field is one registry entry + one Vue file; new chart types ride along automatically. `autoRotate` declares `appliesOn: ['3D']` and is hidden for 2D data. - **Chart-type picker** auto-switches from a tabs row to an icon+name combobox when the active dataset exposes more than 3 chart types (constant `CHART_PICKER_TAB_THRESHOLD = 3`). - **Bug fixes**: `setScale`/`setAutoRotate` no longer silently no-op on freshly migrated configs (the `'X' in cfg` guard was removed); `useDataPoint` keeps settings reactive by only `markRaw`-ing the rows (the data field), not the whole DataSet; the swap handler now calls `useDataPoint.setArrangement` + group/color reset (matching the old `AxisSwapper` behavior). - **Sample data**: `ui/src/data/sample.json` migrated to the new `ChartConfig[]` shape; all 6 datasets preserved, including the Worker Pool Benchmarks "no charts" entry. - **Dead code removed**: `AxisSwapper.vue`, `ChartSettings.vue`, `AutoRotateToggle.vue`, `ScaleSelector.vue`, `shared/chart_config.go`, `cmd/flag_validation_rules.go`, `LinearDefaults`/`applyDefaults`/`selectionSettings`/`ChartSelection`/`SelectionsFromCharts`, the `axisKeyConcat` helper, and the v0.12.0 `DatasetSettings`/`ChartSettings`/`Defaults` structs. - **Sync with main (#129)**: removes `--scale` from root and syncs the 3D bar/line bevel/width values that were squashed into #129.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
shared.FlagStatewith typed per-command option structs (CommonOptions,LinearOptions,ChartOptions) passed explicitly through the pipelinevizb bar|line|pie|heatmap|radarsubcommands, each self-registering viainit()into a CLI registry — users can now target a single chart type directly without--charts--scaleflag from the root command; scale is now per-chart only (-Sonbar/line, or--chart bar:scale=logfor overrides) since pie/heatmap/radar don't support itparser.Configinstead of reading from global state