@fluid-app/fluid-cli-portal 0.1.39 → 0.1.41

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-app/fluid-cli-portal",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "description": "Fluid CLI plugin for building portal applications",
5
5
  "files": [
6
6
  "dist",
@@ -59,6 +59,32 @@ Guidelines:
59
59
  - Do not hand-edit `.portal-sync/`; it is sync metadata, not source content.
60
60
  - Do not invent unsupported fields. Match the shapes produced by `pnpm pull`.
61
61
 
62
+ ## Add a new page and put it in the menu
63
+
64
+ A page = a **screen** (a `component_tree` of widgets) + a **navigation item** that points at it. A screen with no nav item is unreachable; a nav item whose screen reference doesn't resolve is silently dropped in local preview and refused at push. Both live in `portal/`.
65
+
66
+ 1. Create `portal/screens/<slug>.json`: `{ "name": "Rewards", "component_tree": [ ... ] }`. Give every node an `id` and a widget `type` from the catalog below. Match the shape `pnpm pull` produced.
67
+ 2. Add a navigation item to each profile that should see it: `{ "label": "Rewards", "slug": "rewards", "screen_id": <id> }` (mirror how sibling items in that navigation reference their screens — by `screen_id` or `slug`). Use `children[]` for a nested group. Add to `mobile_navigation` too for mobile.
68
+ 3. Link to it with a `ButtonWidget`/`LinkWidget` (or a carousel slide `buttonLink`) using the path `/rewards`.
69
+ 4. Preview on the profile local dev serves (default/first), then push and activate a version to go live.
70
+
71
+ ## Choosing a widget (recommend built-ins before custom code)
72
+
73
+ Use the `type` value in a `component_tree` node. Reach for what already exists:
74
+
75
+ - Layout: `ContainerWidget`, `LayoutWidget` (columns/grid), `NestedWidget`, `SpacerWidget`, `SeparatorWidget`
76
+ - Hero/media: `CarouselWidget` (rotating hero slides w/ CTA), `ImageWidget`, `VideoWidget`
77
+ - Content: `TextWidget`, `BulletListWidget`, `CardWidget`, `AlertWidget`, `TableWidget`, `ChartWidget`, `CalendarWidget`
78
+ - Commerce/member: `ShopWidget`, `PointsWidget` (rewards balance), `RecentActivityWidget`, `ToDoWidget`
79
+ - Links/sharing: `LinkWidget`, `ButtonWidget`, `QuickLinksWidget`, `QuickShareWidget`, `ListWidget`
80
+ - Platform: `EmbedWidget` (drops a Mist app into a screen), `MySiteWidget`, `CatchUpWidget`
81
+
82
+ An unregistered `type` renders nothing. Data-driven UI a built-in can't express (a member-specific dashboard) needs a custom widget package — a separate concern from this definition-editing workflow; note it to the user rather than hand-rolling code here.
83
+
84
+ ## System screens and how to reach them
85
+
86
+ The portal ships built-in screens addressed by nav slug: `profile` (alias `account`), `orders`, `subscriptions`, `messaging`, `contacts`, `shop`, `customers`, `my-site`, `share/*`, `app-download`. To expose one, add a navigation item with that slug to the profile — `messaging` and `contacts` only appear when a nav item includes them, and `messages`/`my-site` are rep-only (a non-rep member sees the fallback). These are core surfaces the admin builder keeps; author your own pages alongside them in `portal/` and let the definition stay the source of truth so drag-and-drop editing keeps working.
87
+
62
88
  ## Validate locally
63
89
 
64
90
  Run the checks that match the change:
@@ -69,7 +95,10 @@ pnpm lint
69
95
  pnpm build
70
96
  ```
71
97
 
72
- For portal JSON changes, also run a push dry run or validation command if available in your CLI version. If a command reports broken cross-references, fix the JSON references before pushing.
98
+ For portal JSON changes, know that validation is asymmetric:
99
+
100
+ - **Local preview is lenient.** The dev server builds its manifest from `portal/` and silently skips malformed JSON files and silently drops navigation items whose `screen` reference does not resolve. A screen that "just vanished" from the preview with no error usually means broken JSON or a broken reference in the file you last edited.
101
+ - **Push is strict.** `pnpm push` validates cross-references (navigation → screen, profile → navigation/theme) before writing anything and refuses the entire push if any reference is broken.
73
102
 
74
103
  Use local preview for visual/content changes:
75
104
 
@@ -77,7 +106,12 @@ Use local preview for visual/content changes:
77
106
  pnpm dev
78
107
  ```
79
108
 
80
- Expected result: the portal shell starts and can load the local pulled portal definition for preview where supported by the SDK/tooling.
109
+ Expected result: the portal shell starts and loads the local pulled portal definition for preview.
110
+
111
+ Two local-preview rules that read as bugs if you do not know them:
112
+
113
+ - The local manifest always serves the profile with `default: true` (or the first profile file if none is default). Profile `permissions` are **not** evaluated locally — edits to any other profile will never appear in the local preview. Permission matching only happens on the deployed portal against the real logged-in member.
114
+ - The logged-in session is still real: rep-only screens (`messages`, `my-site`) render the customer fallback when the member is not rep-eligible.
81
115
 
82
116
  ## Push definition changes
83
117
 
@@ -87,12 +121,12 @@ Run:
87
121
  pnpm push
88
122
  ```
89
123
 
90
- What push does:
124
+ What push does, in order (it stops at the first failing gate):
91
125
 
92
- - Reads local `portal/` JSON.
93
- - Compares it against `.portal-sync/` state.
94
- - Shows or applies a diff to the remote working/draft Fluid OS definition.
95
- - Updates the remote draft/working state.
126
+ 1. **Invisible git sync.** Push auto-commits the whole working tree (`git add -A`; `.gitignore` is the only exclusion boundary — keep secrets in `.env`, never in tracked files) and pushes to the portal's Fluid-provisioned git repository. A "Skipped git sync — <reason>" note is non-fatal and the content push continues. A _failed_ git push aborts the whole command with your changes committed locally — reconcile (usually `git pull --rebase`) and rerun.
127
+ 2. **Snapshot diff.** Compares `portal/` against `.portal-sync/` state. "Nothing to push" means no local edits since the last pull/push.
128
+ 3. **Cross-reference validation.** Refuses the entire push, before any write, if a navigation item references a missing screen or a profile references a missing navigation/theme.
129
+ 4. **Phased write.** Screens and themes first, then navigations, then profiles. A failed phase skips later phases, and only successfully pushed files advance the snapshot — fix the error and rerun to push the remainder. "No mapping found for <type> slug" means the resource was never pulled/created remotely; re-pull.
96
130
 
97
131
  What push does not do:
98
132
 
@@ -121,6 +155,30 @@ Do not mix these up:
121
155
  - GitHub Actions or hosting deployment: uploads the built portal shell assets from `dist/`.
122
156
  - `fluid portal deploy`: publishes company-owned widget runtime artifacts. It is not the portal JSON push command and it is not the hosted shell asset deployment.
123
157
 
158
+ ## Work on this portal from another machine
159
+
160
+ The project's source lives in a Fluid-provisioned git repository (kept in sync by push). To continue work elsewhere:
161
+
162
+ ```bash
163
+ fluid login
164
+ fluid portal clone <app-name>
165
+ cd <app-name>
166
+ fluid portal pull
167
+ ```
168
+
169
+ Clone mints its own short-lived git credentials — do not hand out raw repository URLs or tokens.
170
+
171
+ ## Debug order when something looks wrong
172
+
173
+ Work these in order and report which one failed:
174
+
175
+ 1. Logged in? Auth errors say `Run fluid login first`.
176
+ 2. Right directory? Push errors about missing `portal/` or `.portal-sync/` mean you are not in the pulled project (or never pulled).
177
+ 3. Local preview showing stale/missing content? Check for malformed JSON or broken references in the file you last edited (local preview drops them silently), and confirm you edited the profile the local preview serves (`default: true`).
178
+ 4. Push refused? Read the cross-reference validation errors — they name the file and the missing slug.
179
+ 5. Push partially failed? Fix the reported phase error and rerun; the snapshot only advanced for files that succeeded.
180
+ 6. Users do not see the change? Push updates the draft only — create/activate a version.
181
+
124
182
  ## Widget work inside a portal project
125
183
 
126
184
  Company-owned portal widgets are still supported. Use the widget scaffold command, then follow the copied `fluid-widget-authoring` skill for detailed manifest, property schema, theme token, validation, build, and publish rules.