@fluid-app/fluid-cli 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@fluid-app/fluid-cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Core CLI for Fluid Commerce — auth, config, and plugin system",
5
5
  "bin": {
6
6
  "fluid": "./dist/bin/fluid.mjs"
7
7
  },
8
8
  "files": [
9
9
  "dist",
10
- "README.md"
10
+ "README.md",
11
+ "template-skills"
11
12
  ],
12
13
  "type": "module",
13
14
  "main": "./dist/index.mjs",
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: fluid-widget-authoring
3
+ description: Use when creating, modifying, reviewing, validating, building, or publishing Fluid widgets in generated portal projects or standalone widget projects, including manifest metadata, property schemas, runtime CSS, widget previews, validation, build, and publish workflows.
4
+ ---
5
+
6
+ # Fluid Widget Authoring
7
+
8
+ Use this skill when creating, modifying, reviewing, validating, building, or publishing Fluid widgets.
9
+
10
+ This skill supports two generated-project contexts:
11
+
12
+ - **Generated portal projects:** use `pnpm widget:create <name>` or `pnpm exec fluid portal widget create <name>` for company-owned portal widgets. The scaffold writes widget source under `src/widgets/<name>/` and registers manifests through the portal config/tooling.
13
+ - **Generated standalone widget projects:** use the widget CLI project structure and publish flow for droplet-owned or independently versioned widget packages.
14
+
15
+ ## Boundaries
16
+
17
+ - Widget code belongs under `src/widgets/` in both generated portal-widget scaffolds and standalone widget projects.
18
+ - In generated portal projects, keep portal definition work in `portal/` and widget work in `src/widgets/`.
19
+ - In standalone widget projects, do not add a portal app, droplet scaffold, backend, Rails code, or Next.js structure.
20
+ - In standalone widget projects, package metadata lives in root `manifest.ts`, CLI ownership config lives in `fluid.widget.config.ts`, and runtime registration lives in `src/index.ts`.
21
+ - Keep runtime CSS in `styles.css` or files imported by `manifest.ts`, widget manifests, or widget modules so build tooling discovers CSS artifacts.
22
+
23
+ ## Manifest checklist
24
+
25
+ Use `defineWidget()` and `defineWidgetPackage()` from `@fluid-app/portal-sdk`.
26
+
27
+ For each widget:
28
+
29
+ - `name`: stable URL-safe name. Changing it changes the generated widget type.
30
+ - `component`: host-safe React component.
31
+ - `displayName`, `description`, `icon`, `category`: builder palette metadata.
32
+ - `defaultProps`: JSON-serializable defaults only.
33
+ - `propertySchema`: builder fields, also JSON-serializable.
34
+ - `container`: `block`, `card`, `inline`, or `fullscreen`.
35
+ - `resizable`: omit/false, true, `horizontal`, `vertical`, `both`, or an object with axis flags and optional min sizes.
36
+
37
+ For the package:
38
+
39
+ - Keep `packageType` as `droplet`.
40
+ - Keep `remoteEntryUrl` as `widget.js` unless the publish flow changes.
41
+ - Keep `version` as SemVer without build metadata.
42
+ - Keep at least one widget in `widgets`.
43
+ - Do not manually set `packageStableId` in this generated droplet template; the CLI injects the linked droplet key.
44
+
45
+ ## Property schema quick reference
46
+
47
+ Top-level keys:
48
+
49
+ - `tabsConfig`: optional tabs with `id` and `label`.
50
+ - `fields`: editable controls.
51
+ - `dataSourceTargetProps`: prop keys that data sources may populate.
52
+ - `itemConfigSchema`: optional per-item fields for custom data-source item settings.
53
+ - Avoid `validate` in standalone published metadata because metadata must be serializable.
54
+
55
+ Base field keys:
56
+
57
+ - `key`, `label`, and `type` are required.
58
+ - Optional: `description`, `defaultValue`, `tab`, `group`, `advanced`, `requiresKeyValue`.
59
+ - `advanced: true` is for lower-frequency theme/style overrides.
60
+ - `requiresKeyValue` can be one condition or an array of AND conditions.
61
+
62
+ Supported field types:
63
+
64
+ - `text`: single-line string; supports `placeholder`, `maxLength`, `tokenSuggestions`.
65
+ - `textarea`: multi-line string; supports `placeholder`, `rows`, `maxLength`.
66
+ - `number`: numeric input; supports `min`, `max`, `step`.
67
+ - `boolean`: toggle.
68
+ - `select`: dropdown; requires `options` with `label` and `value`.
69
+ - `color`: basic color value.
70
+ - `range`: slider; requires `min`, `max`; optional `step`.
71
+ - `dataSource`: data-source configuration.
72
+ - `resource`: resource picker; optional `allowedTypes`.
73
+ - `image`: media picker; optional `accept` as `image`, `video`, or `any`.
74
+ - `alignment`: alignment picker; requires vertical/horizontal enabled flags.
75
+ - `slider`: numeric slider; supports `min`, `max`, `step`, `unit`.
76
+ - `colorPicker`: color picker; supports `swatches`.
77
+ - `sectionHeader`: visual header; supports `subtitle`.
78
+ - `separator`: visual divider.
79
+ - `buttonGroup`: segmented control; requires options with `value` and optional labels/icons.
80
+ - `colorSelect`: semantic theme color selector; supports `excludeColors`.
81
+ - `sectionLayoutSelect`: visual layout selector.
82
+ - `background`: combined background resource/color control.
83
+ - `contentPosition`: 3-by-3 position picker.
84
+ - `textSizeSelect`: theme text size selector.
85
+ - `cssUnit`: number plus unit; supports unit allowlist/default and per-unit min/max/step maps.
86
+ - `fontPicker`: Google font picker; supports `placeholder`.
87
+ - `stringArray`: editable list of strings; supports `placeholder`.
88
+ - `borderRadius`: four-corner radius editor; requires `keys.topLeft`, `keys.topRight`, `keys.bottomLeft`, `keys.bottomRight`.
89
+ - `screenPicker`: portal screen picker; supports `includeSystemItems`.
90
+
91
+ ## Data-source-ready props
92
+
93
+ - Add bindable prop names to `dataSourceTargetProps`.
94
+ - Make components resilient to missing, empty, or partial prop data.
95
+ - Render empty states for empty arrays and invalid items.
96
+ - Keep defaults in `defaultProps` so manual use works before a data source is connected.
97
+ - Use `itemConfigSchema` for per-selected-item settings.
98
+ - Do not fetch directly when props/data sources can provide data.
99
+
100
+ ## Component quality and accessibility
101
+
102
+ - Use typed props and defaults.
103
+ - Guard unsafe array/object access.
104
+ - Keep render deterministic and side-effect free.
105
+ - Clean up effects.
106
+ - Keep bundles small and avoid unnecessary large dependencies.
107
+ - Never put secrets or tenant credentials in widget source, props, or defaults.
108
+ - Use semantic HTML.
109
+ - Ensure keyboard access and visible focus states.
110
+ - Add labels or accessible names to controls.
111
+ - Add alt text for meaningful media.
112
+ - Keep heading order logical.
113
+ - Respect reduced motion.
114
+ - Use theme foreground/background pairs for contrast.
115
+
116
+ ## Theme and CSS
117
+
118
+ Prefer Fluid semantic CSS variables:
119
+
120
+ - Surface and text: `--background`, `--foreground`, `--card`, `--card-foreground`, `--popover`, `--popover-foreground`.
121
+ - Brand/actions: `--primary`, `--primary-foreground`.
122
+ - Supporting UI: `--secondary`, `--secondary-foreground`, `--muted`, `--muted-foreground`, `--accent`, `--accent-foreground`.
123
+ - Status/chrome: `--destructive`, `--destructive-foreground`, `--border`, `--input`, `--ring`.
124
+ - Charts: `--chart-1` through `--chart-5`.
125
+ - Radius: `--radius`, `--radius-sm`, `--radius-md`, `--radius-lg`, `--radius-xl`.
126
+ - Fonts and sizes may be available as `--font-header`, `--font-body`, and `--font-size-*` theme aliases.
127
+
128
+ Tailwind equivalents, when Tailwind is available, are semantic utilities such as `bg-background`, `text-foreground`, `bg-card`, `text-card-foreground`, `bg-primary`, `text-primary-foreground`, `border-border`, `ring-ring`, and `rounded-lg`. Plain CSS is the most portable runtime default for this template.
129
+
130
+ Light/dark mode is controlled by host theme variables and may use `data-theme-mode="dark"`. Prefer tokens so light and dark work automatically. If a mode-specific rule is necessary, scope it to the dark-mode attribute and still use tokens.
131
+
132
+ CSS must be imported by `manifest.ts` or a widget module. Prefix selectors with the widget name and do not rely on global body styles for published runtime output.
133
+
134
+ ## Preflight
135
+
136
+ Run before marking widget work complete:
137
+
138
+ ```bash
139
+ pnpm typecheck
140
+ pnpm validate
141
+ pnpm build
142
+ ```
143
+
144
+ For publish readiness, also run:
145
+
146
+ ```bash
147
+ pnpm run widget:publish -- --dry-run
148
+ ```
149
+
150
+ Common failures:
151
+
152
+ - Missing droplet UUID: run `pnpm run widget:link` or pass a droplet option.
153
+ - No source package found: ensure `fluid.widget.config.ts` exports the package from `manifest.ts`.
154
+ - Invalid package type: keep `packageType: "droplet"`.
155
+ - Invalid name/key/version: use URL-safe identifiers and SemVer without build metadata.
156
+ - Non-serializable metadata: remove functions, undefined, Dates, NaN, Infinity, Maps, Sets, and class instances.
157
+ - Missing published CSS: import CSS from the build graph.
158
+ - Preview-only success: remove local-only URLs and guard browser APIs.