Commit 8f62d59
authored
feat(appkit): /ui visual variant picker (#476)
* feat(ui-variants): visual variant picker with dev-only recorder
Build a piece of app UI in several variants, pick one live in the running app,
then finalize the chosen variant into source.
- `<Variants>`/`<Variant>` (appkit-ui): inline switcher — hover-revealed
controls, tick confirm, `accent` and `layout` props — that degrades to a
plain viewer when the recorder is absent. The block identifier prop is
`blockId` (a semantic key, not a DOM id).
- `uiVariants()` recorder plugin (appkit): POST /api/ui-variants/confirm,
dev-gated (403), keyed upsert into
node_modules/.databricks/appkit/.appkit-ui-choices.jsonl via a swappable
ChoiceSink (default FileChoiceSink). Register conditionally so it never
mounts in production.
- ast-grep lint rule flagging any <Variants> left in source before deploy.
- dev-playground demo route + nav.
- `/ui` command + guidance reference driving the author → pick → finalize loop.
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* docs(ui-variants): regenerate API docs for blockId rename
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* feat: add devOnly manifest flag to gate plugin registration
Introduce a declarative `devOnly` field on the plugin manifest. When set,
createApp registers the plugin only when NODE_ENV === "development"; in any
other environment it is skipped before resource collection (not constructed,
no routes, resources not validated). This moves the dev-only guarantee from
an app-author-written NODE_ENV ternary into the framework itself.
Mark the ui-variants plugin devOnly and simplify the dev-playground
registration to a plain uiVariants() call. The in-handler NODE_ENV 403 is
retained as fail-safe defense against mount-anyway paths.
Adds the field to the Zod schema (source of truth) and PluginManifest type,
regenerates the published JSON schema, documents it in the manifest guide,
and covers development/production/test/unset in bootstrap tests.
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* docs: regenerate API docs for devOnly manifest field
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* refactor(appkit-ui): rename variants dir to ui-variants
Match the appkit plugin dir name for cross-package consistency. Files and the
public API are unchanged; only the internal directory moves.
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* feat: ship /ui skill and add `appkit skills install` command
Consolidate the /ui command and its variants guidance into a single
self-contained skill shipped inside @databricks/appkit (skills/ui.md),
and add an `appkit skills install` CLI command that symlinks shipped
skills into a consuming project's .claude/commands/ (--copy for
git/deploy portability, --dir, --force). `appkit setup --write` now
auto-installs skills, and the dist tarball ships the skills/ dir.
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* refactor: rename /ui skill to /ui-variants
Align the shipped skill's command name with the ui-variants naming used
across the branch (plugin, dir, route). The install command derives the
slash-command name from the filename, so this makes it install as
/ui-variants.
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* docs(ui-variants): drop conditional-registration guidance from skill
createApp now skips devOnly plugins automatically, so the skill just says to
add uiVariants() to the plugin list.
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* refactor(ui-variants): rename shipped skill to appkit-ui-variants
Installs as the /appkit-ui-variants slash command (name derived from the file).
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* feat(ui-variants): register the dev-only recorder automatically
createApp now injects the ui-variants recorder before the dev-only
filter runs, so it is always alive in development and always stripped
in production through the same guard as any devOnly plugin. Neither the
app author nor their coding agent needs to register it by hand.
Also drops the unused ChoiceSink abstraction (folded into an internal
FileChoiceStore) and removes uiVariants and the sink types from the
public API surface, since manual registration is no longer a path.
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* feat(appkit-ui): render only the first variant in production builds
If a <Variants> block ever ships without being finalized, users saw the
dev-only picker chrome. In a production build the component now drops the
chrome and renders the first variant as plain content — a cosmetic safety
net on top of the no-variants-in-prod lint; the recorder is already
server-gated. Guard sits below the hooks and uses import.meta.env.DEV to
match use-query-hmr.
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* refactor(appkit-ui): drop the prod-fallback guard comment
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* refactor(cli): remove appkit skills install command
Remove the `appkit skills install` CLI command and its invocation during
`appkit setup --write`. Skill installation is now delegated to the external
`npx skills add` tool (vercel-labs/skills).
The shipped skill is kept and restructured to the SKILL.md convention
(skills/appkit-ui-variants/SKILL.md with a `name` frontmatter field) so it is
discoverable and installable by that tool.
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* chore(shared): update postinstall message for skills install flow
The postinstall notice referenced the removed `appkit skills install` command
and claimed `setup --write` installs skills. Point users at the external
`npx skills add ./node_modules/@databricks/appkit` flow instead.
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
* chore(shared): drop skills install hint from postinstall message
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>
---------
Signed-off-by: Galymzhan <zhangazy2004@gmail.com>1 parent 92cb8bb commit 8f62d59
23 files changed
Lines changed: 1568 additions & 2 deletions
File tree
- apps/dev-playground/client/src
- lib
- routes
- docs
- docs
- api/appkit
- plugins
- static
- appkit-ui
- schemas
- packages
- appkit-ui/src/react
- ui-variants
- appkit
- skills/appkit-ui-variants
- src
- core
- tests
- plugins/ui-variants
- tools
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
165 | 173 | | |
166 | 174 | | |
167 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
| |||
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
| 146 | + | |
140 | 147 | | |
141 | 148 | | |
142 | 149 | | |
| |||
157 | 164 | | |
158 | 165 | | |
159 | 166 | | |
| 167 | + | |
160 | 168 | | |
161 | 169 | | |
162 | 170 | | |
| |||
178 | 186 | | |
179 | 187 | | |
180 | 188 | | |
| 189 | + | |
181 | 190 | | |
182 | 191 | | |
183 | 192 | | |
| |||
200 | 209 | | |
201 | 210 | | |
202 | 211 | | |
| 212 | + | |
203 | 213 | | |
204 | 214 | | |
205 | 215 | | |
| |||
220 | 230 | | |
221 | 231 | | |
222 | 232 | | |
| 233 | + | |
223 | 234 | | |
224 | 235 | | |
225 | 236 | | |
| |||
240 | 251 | | |
241 | 252 | | |
242 | 253 | | |
| 254 | + | |
243 | 255 | | |
244 | 256 | | |
245 | 257 | | |
| |||
261 | 273 | | |
262 | 274 | | |
263 | 275 | | |
| 276 | + | |
264 | 277 | | |
265 | 278 | | |
266 | 279 | | |
| |||
273 | 286 | | |
274 | 287 | | |
275 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
276 | 296 | | |
277 | 297 | | |
278 | 298 | | |
| |||
413 | 433 | | |
414 | 434 | | |
415 | 435 | | |
| 436 | + | |
416 | 437 | | |
417 | 438 | | |
418 | 439 | | |
| |||
Lines changed: 260 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
0 commit comments