@fluid-app/fluid-cli-portal 0.1.32 → 0.1.33
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/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +50 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/templates/base/.gitignore.template +27 -0
- package/templates/base/AGENTS.md +36 -0
- package/templates/base/skills/fluid-portal-authoring/SKILL.md +153 -0
- package/templates/base/src/main.tsx +2 -2
- package/templates/base/src/portal.config.ts +8 -34
- package/templates/starter/README.md.template +122 -181
- package/templates/base/src/navigation.config.ts +0 -26
- package/templates/base/src/screens/Dashboard.tsx +0 -133
- package/templates/base/src/screens/ExampleForm.tsx +0 -177
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-app/fluid-cli-portal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
4
4
|
"description": "Fluid CLI plugin for building portal applications",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"p-limit": "^7.3.0",
|
|
33
33
|
"prompts": "^2.4.2",
|
|
34
34
|
"tsx": "^4.21.0",
|
|
35
|
-
"@fluid-app/fluid-cli": "0.1.
|
|
35
|
+
"@fluid-app/fluid-cli": "0.1.12"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@swc/core": "^1.15.18",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Build output
|
|
5
|
+
dist/
|
|
6
|
+
|
|
7
|
+
# Environment files
|
|
8
|
+
.env
|
|
9
|
+
.env.local
|
|
10
|
+
.env.*.local
|
|
11
|
+
|
|
12
|
+
# Editor directories
|
|
13
|
+
.idea/
|
|
14
|
+
.vscode/
|
|
15
|
+
*.swp
|
|
16
|
+
*.swo
|
|
17
|
+
|
|
18
|
+
# OS files
|
|
19
|
+
.DS_Store
|
|
20
|
+
Thumbs.db
|
|
21
|
+
|
|
22
|
+
# Portal sync metadata (generated by fluid portal pull/push)
|
|
23
|
+
.portal-sync/
|
|
24
|
+
|
|
25
|
+
# Logs
|
|
26
|
+
*.log
|
|
27
|
+
pnpm-debug.log*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Guidance for AI coding tools working in this generated Fluid portal project.
|
|
4
|
+
|
|
5
|
+
This project is primarily authored through the Fluid OS portal definition sync workflow. Author portal structure, routes, and content through pulled Fluid OS JSON under `portal/` unless a human explicitly asks for a different architecture.
|
|
6
|
+
|
|
7
|
+
## Source of truth
|
|
8
|
+
|
|
9
|
+
- Use `.agents/skills/fluid-portal-authoring/SKILL.md` for portal definition work.
|
|
10
|
+
- Use `.agents/skills/fluid-widget-authoring/SKILL.md` for company widget creation with `pnpm widget:create`, widget manifests, property schemas, runtime CSS, validation, build, and publish work.
|
|
11
|
+
- `.claude/skills/...` contains the same generated skills for Claude-compatible tools.
|
|
12
|
+
|
|
13
|
+
## Portal workflow
|
|
14
|
+
|
|
15
|
+
1. Run `pnpm pull` to sync the remote Fluid OS definition into `portal/`.
|
|
16
|
+
2. Edit the pulled JSON under `portal/`.
|
|
17
|
+
3. Validate locally with `pnpm typecheck`, `pnpm lint`, and `pnpm build` when applicable.
|
|
18
|
+
4. Run `pnpm push` to sync local `portal/` JSON back to the remote working/draft definition.
|
|
19
|
+
5. Run `pnpm exec fluid portal version create --activate` only when the pushed definition should become live.
|
|
20
|
+
|
|
21
|
+
Do not edit `.portal-sync/` by hand. It is generated sync metadata.
|
|
22
|
+
|
|
23
|
+
## Command boundaries
|
|
24
|
+
|
|
25
|
+
- `pnpm pull` / `fluid portal pull`: downloads the portal definition into `portal/`.
|
|
26
|
+
- `pnpm push` / `fluid portal push`: updates the remote working/draft definition from local JSON.
|
|
27
|
+
- `fluid portal version create --activate`: publishes the remote working/draft definition as the live version.
|
|
28
|
+
- `pnpm build`: builds the hosted portal shell assets into `dist/`.
|
|
29
|
+
- `fluid portal deploy`: publishes company-owned widget runtime artifacts, not portal JSON and not shell assets.
|
|
30
|
+
|
|
31
|
+
## Quality bar
|
|
32
|
+
|
|
33
|
+
- Keep portal JSON valid and references consistent.
|
|
34
|
+
- Preserve stable IDs and slugs unless the change intentionally renames them.
|
|
35
|
+
- Keep the portal shell thin; do not fork SDK internals into this app.
|
|
36
|
+
- For widget changes, use `pnpm widget:create <name>` / `fluid portal widget create <name>` and follow the copied `fluid-widget-authoring` skill before editing manifests or schemas.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fluid-portal-authoring
|
|
3
|
+
description: Use when modifying this generated Fluid portal project through the supported pull/edit/push/version workflow, including portal/ JSON, themes, navigations, screens, profiles, local validation, and distinguishing portal definition sync from widget artifact deployment.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Fluid Portal Authoring
|
|
7
|
+
|
|
8
|
+
Use this skill before changing a generated Fluid portal project.
|
|
9
|
+
|
|
10
|
+
## Supported authoring model
|
|
11
|
+
|
|
12
|
+
This template is a Fluid portal shell plus a local copy of the Fluid OS portal definition.
|
|
13
|
+
The supported workflow is:
|
|
14
|
+
|
|
15
|
+
1. Pull the remote portal definition into `portal/`.
|
|
16
|
+
2. Edit the pulled JSON files locally.
|
|
17
|
+
3. Validate and preview locally.
|
|
18
|
+
4. Push the JSON changes back to the remote working/draft definition.
|
|
19
|
+
5. Create and activate a version when the pushed definition should go live.
|
|
20
|
+
|
|
21
|
+
In generated portal projects, routes, portal structure, screens, themes, profiles, and definition metadata are owned by Fluid OS JSON under `portal/` after pull.
|
|
22
|
+
|
|
23
|
+
## Important files and directories
|
|
24
|
+
|
|
25
|
+
- `src/main.tsx`: portal shell bootstrap. Keep this small.
|
|
26
|
+
- `src/portal.config.ts`: portal SDK integration and widget/package exports when present.
|
|
27
|
+
- `src/index.css`: app-level CSS imports and global styles.
|
|
28
|
+
- `portal/`: pulled Fluid OS definition JSON. This is the primary editing surface for portal content.
|
|
29
|
+
- `.portal-sync/`: generated sync metadata used by pull/push diffing. Do not edit by hand.
|
|
30
|
+
- `.fluidrc`: generated CLI profile binding for this portal project.
|
|
31
|
+
- `.agents/skills/fluid-widget-authoring/SKILL.md`: widget authoring guidance when this portal owns widget packages or widget manifests.
|
|
32
|
+
|
|
33
|
+
## Pull before editing
|
|
34
|
+
|
|
35
|
+
Run:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm pull
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Expected result:
|
|
42
|
+
|
|
43
|
+
- `portal/` contains local JSON for Fluid OS resources such as screens, themes, navigations, profiles, and definition metadata.
|
|
44
|
+
- `.portal-sync/` contains sync state used to compute future diffs.
|
|
45
|
+
- `.fluidrc` pins the CLI profile when the project was created with a profile.
|
|
46
|
+
|
|
47
|
+
Pull before making changes unless you intentionally want to overwrite local work. If local JSON and remote state may both have changed, inspect the diff before pushing.
|
|
48
|
+
|
|
49
|
+
## Edit pulled portal JSON
|
|
50
|
+
|
|
51
|
+
Work inside `portal/` for portal definition changes.
|
|
52
|
+
|
|
53
|
+
Guidelines:
|
|
54
|
+
|
|
55
|
+
- Keep JSON valid and deterministic.
|
|
56
|
+
- Preserve stable IDs, slugs, and cross-resource references unless intentionally changing them.
|
|
57
|
+
- Update references together. If a navigation item points to a screen/theme/profile slug or ID, make sure the target exists in `portal/`.
|
|
58
|
+
- Prefer small, reviewable edits. One portal content change per PR is easier to validate.
|
|
59
|
+
- Do not hand-edit `.portal-sync/`; it is sync metadata, not source content.
|
|
60
|
+
- Do not invent unsupported fields. Match the shapes produced by `pnpm pull`.
|
|
61
|
+
|
|
62
|
+
## Validate locally
|
|
63
|
+
|
|
64
|
+
Run the checks that match the change:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pnpm typecheck
|
|
68
|
+
pnpm lint
|
|
69
|
+
pnpm build
|
|
70
|
+
```
|
|
71
|
+
|
|
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.
|
|
73
|
+
|
|
74
|
+
Use local preview for visual/content changes:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pnpm dev
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Expected result: the portal shell starts and can load the local pulled portal definition for preview where supported by the SDK/tooling.
|
|
81
|
+
|
|
82
|
+
## Push definition changes
|
|
83
|
+
|
|
84
|
+
Run:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pnpm push
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
What push does:
|
|
91
|
+
|
|
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.
|
|
96
|
+
|
|
97
|
+
What push does not do:
|
|
98
|
+
|
|
99
|
+
- It does not create a live Fluid OS version by itself.
|
|
100
|
+
- It does not upload hosted portal shell assets from `dist/`.
|
|
101
|
+
- It does not publish widget runtime artifacts.
|
|
102
|
+
|
|
103
|
+
After a successful push, inspect the remote portal definition if possible and run the app locally or against the target environment.
|
|
104
|
+
|
|
105
|
+
## Publish a live portal version
|
|
106
|
+
|
|
107
|
+
After pushing and verifying the working/draft definition, create and activate a version when the change should become live:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pnpm exec fluid portal version create --activate
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Use this only when the pushed definition is ready for users. If activation should be coordinated with a release or content review, stop and ask the project owner before running it.
|
|
114
|
+
|
|
115
|
+
## Distinguish the three deploy/sync paths
|
|
116
|
+
|
|
117
|
+
Do not mix these up:
|
|
118
|
+
|
|
119
|
+
- `pnpm push` / `fluid portal push`: syncs `portal/` JSON to the remote working/draft Fluid OS definition.
|
|
120
|
+
- `fluid portal version create --activate`: snapshots the remote working/draft definition and makes it live.
|
|
121
|
+
- GitHub Actions or hosting deployment: uploads the built portal shell assets from `dist/`.
|
|
122
|
+
- `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
|
+
|
|
124
|
+
## Widget work inside a portal project
|
|
125
|
+
|
|
126
|
+
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.
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pnpm widget:create my-widget
|
|
130
|
+
# or
|
|
131
|
+
pnpm exec fluid portal widget create my-widget
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Short version:
|
|
135
|
+
|
|
136
|
+
- Keep widget code under the scaffolded `src/widgets/<name>/` directory.
|
|
137
|
+
- Keep widget metadata serializable.
|
|
138
|
+
- Keep `defaultProps` aligned with property schema defaults.
|
|
139
|
+
- Use semantic theme tokens.
|
|
140
|
+
- Import runtime CSS from the widget build graph.
|
|
141
|
+
- Validate/build widget artifacts before publishing them.
|
|
142
|
+
|
|
143
|
+
## Preflight checklist
|
|
144
|
+
|
|
145
|
+
Before considering portal work complete:
|
|
146
|
+
|
|
147
|
+
- [ ] Pulled the latest remote definition or intentionally worked from current local JSON.
|
|
148
|
+
- [ ] Edited only supported files for the change.
|
|
149
|
+
- [ ] Preserved JSON validity and cross-resource references.
|
|
150
|
+
- [ ] Kept portal structure, routes, and content changes in pulled Fluid OS JSON under `portal/`.
|
|
151
|
+
- [ ] Ran typecheck/lint/build or the closest available checks.
|
|
152
|
+
- [ ] Ran push only when the local `portal/` diff was understood.
|
|
153
|
+
- [ ] Created/activated a version only when the definition should go live.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPortal } from "@fluid-app/portal-sdk";
|
|
2
|
-
import {
|
|
2
|
+
import { customWidgets } from "./portal.config";
|
|
3
3
|
import "./index.css";
|
|
4
4
|
|
|
5
|
-
createPortal({
|
|
5
|
+
createPortal({ customWidgets });
|
|
@@ -1,40 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Portal Configuration
|
|
3
|
-
*
|
|
4
|
-
* Register custom page components and widget plugins here.
|
|
5
|
-
*
|
|
6
|
-
* - customPages: rendered by AppShell when a navigation slug matches
|
|
7
|
-
* - customWidgets: registered as plugin widgets in the builder and SDK
|
|
8
|
-
*
|
|
9
|
-
* Navigation structure is defined in navigation.config.ts and synced
|
|
10
|
-
* to the Fluid OS API on `fluid deploy`.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type { ComponentType } from "react";
|
|
14
1
|
import type { WidgetManifest } from "@fluid-app/portal-sdk";
|
|
15
|
-
import { DashboardScreen } from "./screens/Dashboard";
|
|
16
2
|
|
|
17
3
|
/**
|
|
18
|
-
*
|
|
4
|
+
* Portal SDK integration point.
|
|
19
5
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
export const customPages: Record<string, ComponentType> = {
|
|
25
|
-
dashboard: DashboardScreen,
|
|
26
|
-
// Add more custom screens here:
|
|
27
|
-
// "example-form": ExampleFormScreen,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Custom widget plugins.
|
|
6
|
+
* Portal screens, themes, navigations, and profiles are authored through
|
|
7
|
+
* the Fluid OS definition sync workflow: `pnpm pull`, edit `portal/`,
|
|
8
|
+
* then `pnpm push`. Keep portal structure, routes, and content in the
|
|
9
|
+
* pulled Fluid OS JSON files.
|
|
32
10
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* with `fluid widget create <name>`.
|
|
11
|
+
* Keep this file for widget manifests or source widget packages that need
|
|
12
|
+
* to be available to the SDK preview/runtime.
|
|
36
13
|
*/
|
|
37
|
-
export const customWidgets: WidgetManifest[] = [
|
|
38
|
-
// Import and add widget manifests here:
|
|
39
|
-
// stockTicker,
|
|
40
|
-
];
|
|
14
|
+
export const customWidgets: WidgetManifest[] = [];
|
|
@@ -1,243 +1,184 @@
|
|
|
1
1
|
# {{projectName}}
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A Fluid portal shell built with `@fluid-app/portal-sdk` and the Fluid portal CLI.
|
|
4
4
|
|
|
5
|
-
This is the
|
|
5
|
+
This starter is designed for the Fluid OS definition workflow: pull the portal definition into local JSON, edit `portal/`, push the working/draft definition back to Fluid OS, then create and activate a version when it should go live.
|
|
6
6
|
|
|
7
|
-
## What's
|
|
7
|
+
## What's included
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
9
|
+
- **Portal shell** — Vite builds the hosted SDK shell assets.
|
|
10
|
+
- **Portal definition sync** — `pnpm pull` and `pnpm push` manage local Fluid OS JSON under `portal/`.
|
|
11
|
+
- **Deployment workflow** — GitHub Actions can build and upload the hosted shell assets in `dist/`.
|
|
12
|
+
- **Widget authoring support** — `pnpm widget:create <name>` scaffolds company-owned portal widgets.
|
|
13
|
+
- **AI authoring kit** — generated `AGENTS.md`, `CLAUDE.md`, `.agents/skills/...`, and `.claude/skills/...` files explain the supported portal and widget workflows.
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
- **Dashboard** - Overview screen demonstrating:
|
|
15
|
-
- TextWidget - Welcome message and tips
|
|
16
|
-
- ToDoWidget - Task list (uses `useTodos` hook)
|
|
17
|
-
- RecentActivityWidget - Activity feed (uses `useActivities` hook)
|
|
18
|
-
- ChartWidget - Performance visualization
|
|
19
|
-
- CalendarWidget - Event calendar (uses `useCalendarEvents` hook)
|
|
20
|
-
|
|
21
|
-
## Getting Started
|
|
22
|
-
|
|
23
|
-
### Development
|
|
24
|
-
|
|
25
|
-
Start the development server:
|
|
15
|
+
## Quick start
|
|
26
16
|
|
|
27
17
|
```bash
|
|
18
|
+
pnpm install
|
|
19
|
+
pnpm pull
|
|
28
20
|
pnpm dev
|
|
29
21
|
```
|
|
30
22
|
|
|
31
|
-
Open [http://localhost:5173](http://localhost:5173)
|
|
32
|
-
|
|
33
|
-
### Building for Production
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
pnpm build
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
The output will be in the `dist/` folder.
|
|
23
|
+
Open the local URL printed by Vite, usually [http://localhost:5173](http://localhost:5173).
|
|
40
24
|
|
|
41
|
-
|
|
25
|
+
Useful commands:
|
|
42
26
|
|
|
43
27
|
```bash
|
|
44
|
-
pnpm
|
|
28
|
+
pnpm dev # Start Vite
|
|
29
|
+
pnpm build # TypeScript build plus production bundle
|
|
30
|
+
pnpm preview # Preview dist locally
|
|
31
|
+
pnpm typecheck # TypeScript checks
|
|
32
|
+
pnpm lint # OxLint
|
|
33
|
+
pnpm pull # fluid portal pull
|
|
34
|
+
pnpm push # fluid portal push
|
|
35
|
+
pnpm widget:create <name> # scaffold a company-owned portal widget
|
|
45
36
|
```
|
|
46
37
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
├──
|
|
54
|
-
├──
|
|
55
|
-
├── portal
|
|
56
|
-
├──
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
38
|
+
Set `VITE_API_URL` in `.env` if you need to point the SDK at a non-default Fluid API host.
|
|
39
|
+
|
|
40
|
+
## Project structure
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
.
|
|
44
|
+
├── AGENTS.md # AI-agent guidance
|
|
45
|
+
├── CLAUDE.md # Bridge to AGENTS.md
|
|
46
|
+
├── .agents/skills/fluid-portal-authoring/ # Portal sync workflow skill
|
|
47
|
+
├── .agents/skills/fluid-widget-authoring/ # Widget authoring skill
|
|
48
|
+
├── .claude/skills/fluid-portal-authoring/ # Claude-compatible copy
|
|
49
|
+
├── .claude/skills/fluid-widget-authoring/ # Claude-compatible copy
|
|
50
|
+
├── .github/workflows/deploy.yml # Hosted shell asset deployment
|
|
51
|
+
├── src/
|
|
52
|
+
│ ├── main.tsx # createPortal bootstrap
|
|
53
|
+
│ ├── index.css # Tailwind and SDK globals
|
|
54
|
+
│ ├── portal.config.ts # SDK/widget package integration
|
|
55
|
+
│ ├── preview-entry.tsx # Builder/widget preview entry
|
|
56
|
+
│ └── widgets/ # Created by pnpm widget:create
|
|
57
|
+
├── portal/ # Created/refreshed by fluid portal pull
|
|
58
|
+
└── .portal-sync/ # Generated sync metadata
|
|
60
59
|
```
|
|
61
60
|
|
|
62
|
-
##
|
|
61
|
+
## Supported portal authoring workflow
|
|
63
62
|
|
|
64
|
-
|
|
63
|
+
### 1. Pull remote Fluid OS definitions
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
```bash
|
|
66
|
+
pnpm pull
|
|
67
|
+
```
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
2. **Build** — runs `pnpm build`, producing stable filenames (`portal.js`, `portal.css`)
|
|
70
|
-
3. **Upload** — syncs `dist/` to `gs://portals-cdn/{{projectName}}/assets/` via `gcloud storage rsync`
|
|
71
|
-
4. **Invalidate** — clears the CDN cache for your tenant's asset prefix
|
|
69
|
+
This runs `fluid portal pull` and writes `portal/` plus `.portal-sync/`.
|
|
72
70
|
|
|
73
|
-
|
|
71
|
+
- `portal/` contains local JSON for Fluid OS resources such as screens, themes, navigations, profiles, and definition metadata.
|
|
72
|
+
- `.portal-sync/` contains generated sync state for future diffs. Do not edit it by hand.
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
2. Add the service account JSON key as a GitHub Actions secret named `GCP_SA_JSON`
|
|
77
|
-
3. Set `CDN_HOSTNAME` in `.github/workflows/deploy.yml` to your Cloud CDN load balancer's frontend domain
|
|
78
|
-
4. Update `GCP_PROJECT` and `CDN_URL_MAP` if your project differs from the defaults
|
|
74
|
+
Pull before editing unless you intentionally want to work from the current local JSON.
|
|
79
75
|
|
|
80
|
-
###
|
|
76
|
+
### 2. Edit `portal/` JSON
|
|
81
77
|
|
|
82
|
-
|
|
83
|
-
|----------|-------|---------|
|
|
84
|
-
| `GCP_SA_JSON` | GitHub secret | GCP service account credentials |
|
|
85
|
-
| `GCP_PROJECT` | Workflow env | Google Cloud project ID |
|
|
86
|
-
| `CDN_URL_MAP` | Workflow env | Cloud CDN URL map name for cache invalidation |
|
|
87
|
-
| `CDN_HOSTNAME` | Workflow env | CDN frontend domain (load balancer hostname) |
|
|
88
|
-
| `VITE_ASSET_BASE` | Build env | Derived from `CDN_HOSTNAME` (set automatically) |
|
|
78
|
+
Make portal definition changes inside `portal/`.
|
|
89
79
|
|
|
90
|
-
|
|
80
|
+
Guidelines:
|
|
91
81
|
|
|
92
|
-
|
|
82
|
+
- Keep JSON valid and deterministic.
|
|
83
|
+
- Preserve stable IDs, slugs, and cross-resource references unless intentionally changing them.
|
|
84
|
+
- Update related files together when a resource reference changes.
|
|
85
|
+
- Do not invent unsupported fields. Match the shapes produced by `pnpm pull`.
|
|
86
|
+
- Keep changes small enough to review.
|
|
93
87
|
|
|
94
|
-
|
|
88
|
+
### 3. Validate locally
|
|
95
89
|
|
|
96
|
-
|
|
97
|
-
navigation: [
|
|
98
|
-
// Your custom screens
|
|
99
|
-
{ id: "dashboard", label: "Dashboard", icon: "LayoutDashboard", screen: "custom:dashboard" },
|
|
90
|
+
Run checks that match the change:
|
|
100
91
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
92
|
+
```bash
|
|
93
|
+
pnpm typecheck
|
|
94
|
+
pnpm lint
|
|
95
|
+
pnpm build
|
|
105
96
|
```
|
|
106
97
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
1. Create a screen component in `src/screens/`:
|
|
98
|
+
For visual/content changes, use local preview:
|
|
110
99
|
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
import { TableWidget, TextWidget } from "@fluid-app/portal-sdk";
|
|
114
|
-
|
|
115
|
-
export function OrdersScreen() {
|
|
116
|
-
return (
|
|
117
|
-
<div className="space-y-6">
|
|
118
|
-
<TextWidget title="Orders" titleEnabled padding={4} borderRadius="lg" />
|
|
119
|
-
{/* Add more widgets */}
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
}
|
|
100
|
+
```bash
|
|
101
|
+
pnpm dev
|
|
123
102
|
```
|
|
124
103
|
|
|
125
|
-
|
|
104
|
+
Expected result: the portal shell starts and can load the local pulled portal definition where supported by the SDK/tooling.
|
|
126
105
|
|
|
127
|
-
|
|
128
|
-
import { OrdersScreen } from "./screens/Orders";
|
|
106
|
+
### 4. Push local definition changes
|
|
129
107
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
orders: OrdersScreen, // Add here
|
|
133
|
-
},
|
|
108
|
+
```bash
|
|
109
|
+
pnpm push
|
|
134
110
|
```
|
|
135
111
|
|
|
136
|
-
|
|
112
|
+
This runs `fluid portal push`, compares local `portal/` JSON against sync state, and updates the remote working/draft definition.
|
|
137
113
|
|
|
138
|
-
|
|
139
|
-
{ id: "orders", label: "Orders", icon: "ShoppingCart", screen: "custom:orders" },
|
|
140
|
-
```
|
|
114
|
+
Push does **not** publish changes live by itself.
|
|
141
115
|
|
|
142
|
-
###
|
|
116
|
+
### 5. Publish a live Fluid OS version
|
|
143
117
|
|
|
144
|
-
|
|
118
|
+
When the pushed working/draft definition is ready for users:
|
|
145
119
|
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
baseUrl: import.meta.env.VITE_API_URL ?? "https://api.fluid.app",
|
|
149
|
-
getAuthToken: () => getStoredToken() ?? null,
|
|
150
|
-
};
|
|
120
|
+
```bash
|
|
121
|
+
pnpm exec fluid portal version create --activate
|
|
151
122
|
```
|
|
152
123
|
|
|
153
|
-
|
|
124
|
+
Only run this when activation is intended. If publishing needs content, design, or release approval, stop and ask first.
|
|
154
125
|
|
|
155
|
-
|
|
126
|
+
## Command boundaries
|
|
156
127
|
|
|
157
|
-
|
|
158
|
-
|--------|-------------|
|
|
159
|
-
| `TextWidget` | Text content with optional title |
|
|
160
|
-
| `ChartWidget` | Bar, line, area, pie charts |
|
|
161
|
-
| `TableWidget` | Data tables with columns |
|
|
162
|
-
| `ListWidget` | Lists with icons and actions |
|
|
163
|
-
| `ToDoWidget` | Task list (uses `useTodos`) |
|
|
164
|
-
| `RecentActivityWidget` | Activity feed (uses `useActivities`) |
|
|
165
|
-
| `CalendarWidget` | Calendar view (uses `useCalendarEvents`) |
|
|
166
|
-
| `CatchUpWidget` | Catch-up items |
|
|
167
|
-
| `AlertWidget` | Info, warning, error alerts |
|
|
168
|
-
| `ImageWidget` | Images with sizing options |
|
|
169
|
-
| `VideoWidget` | Embedded video players |
|
|
170
|
-
| `CarouselWidget` | Image/content carousel |
|
|
171
|
-
| `ContainerWidget` | Layout containers |
|
|
172
|
-
| `SpacerWidget` | Vertical spacing |
|
|
128
|
+
Do not mix these up:
|
|
173
129
|
|
|
174
|
-
|
|
130
|
+
- `fluid portal pull` downloads the remote portal definition into `portal/`.
|
|
131
|
+
- `fluid portal push` syncs local `portal/` JSON to the remote working/draft definition.
|
|
132
|
+
- `fluid portal version create --activate` makes the remote working/draft definition live.
|
|
133
|
+
- `pnpm build` creates hosted shell assets in `dist/`.
|
|
134
|
+
- GitHub Actions deploys hosted shell assets from `dist/`.
|
|
135
|
+
- `fluid portal deploy` publishes company-owned widget runtime artifacts. It does not push portal JSON and does not upload hosted shell assets.
|
|
175
136
|
|
|
176
|
-
|
|
137
|
+
## Widget work
|
|
177
138
|
|
|
178
|
-
|
|
139
|
+
Company-owned portal widgets are supported through the portal widget scaffold:
|
|
179
140
|
|
|
180
141
|
```bash
|
|
181
|
-
pnpm
|
|
142
|
+
pnpm widget:create stock-ticker
|
|
143
|
+
# or
|
|
144
|
+
pnpm exec fluid portal widget create stock-ticker
|
|
182
145
|
```
|
|
183
146
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
type FormData = z.infer<typeof schema>;
|
|
196
|
-
|
|
197
|
-
export function MyFormScreen() {
|
|
198
|
-
const {
|
|
199
|
-
register,
|
|
200
|
-
handleSubmit,
|
|
201
|
-
formState: { errors, isSubmitting },
|
|
202
|
-
} = useZodForm<FormData>(schema);
|
|
203
|
-
|
|
204
|
-
const onSubmit = async (data: FormData) => {
|
|
205
|
-
// Call your API here
|
|
206
|
-
console.log(data);
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
<form onSubmit={handleSubmit(onSubmit)}>
|
|
211
|
-
<input {...register("name")} placeholder="Name" />
|
|
212
|
-
{errors.name && <p>{errors.name.message}</p>}
|
|
213
|
-
|
|
214
|
-
<input {...register("email")} placeholder="Email" />
|
|
215
|
-
{errors.email && <p>{errors.email.message}</p>}
|
|
216
|
-
|
|
217
|
-
<button type="submit" disabled={isSubmitting}>
|
|
218
|
-
{isSubmitting ? "Submitting..." : "Submit"}
|
|
219
|
-
</button>
|
|
220
|
-
</form>
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
```
|
|
147
|
+
The scaffold writes widget source under `src/widgets/<name>/` and wires the widget manifest for portal tooling. Then use the generated widget authoring skill:
|
|
148
|
+
|
|
149
|
+
- `.agents/skills/fluid-widget-authoring/SKILL.md`
|
|
150
|
+
- `.claude/skills/fluid-widget-authoring/SKILL.md`
|
|
151
|
+
|
|
152
|
+
That skill covers widget manifests, property schemas, theme variables, runtime CSS, validation, build, and publish workflows.
|
|
153
|
+
|
|
154
|
+
## Hosted shell deployment
|
|
155
|
+
|
|
156
|
+
The included GitHub Actions workflow builds the portal and uploads `dist/` to Google Cloud Storage plus Cloud CDN.
|
|
224
157
|
|
|
225
|
-
|
|
158
|
+
1. Push to `main` or run the workflow manually.
|
|
159
|
+
2. The workflow runs `pnpm build`.
|
|
160
|
+
3. It syncs `dist/` to `gs://portals-cdn/{{projectName}}/assets/`.
|
|
161
|
+
4. It invalidates the CDN cache for this portal's asset prefix.
|
|
226
162
|
|
|
227
|
-
|
|
163
|
+
Setup:
|
|
228
164
|
|
|
229
|
-
1.
|
|
230
|
-
2.
|
|
165
|
+
1. Create a GCP service account with Storage Object Admin and Compute Load Balancer Admin roles.
|
|
166
|
+
2. Add the service account JSON key as a GitHub Actions secret named `GCP_SA_JSON`.
|
|
167
|
+
3. Set `CDN_HOSTNAME` in `.github/workflows/deploy.yml` to your Cloud CDN load balancer domain.
|
|
168
|
+
4. Update `GCP_PROJECT` and `CDN_URL_MAP` if your project differs from the defaults.
|
|
231
169
|
|
|
232
|
-
##
|
|
170
|
+
## AI authoring kit
|
|
233
171
|
|
|
234
|
-
|
|
172
|
+
Generated projects include portable guidance for AI coding tools:
|
|
235
173
|
|
|
236
|
-
|
|
174
|
+
- `AGENTS.md` — canonical project instructions.
|
|
175
|
+
- `CLAUDE.md` — plain-file bridge to `AGENTS.md`.
|
|
176
|
+
- `.agents/skills/fluid-portal-authoring/SKILL.md` — portal pull/edit/push/version workflow.
|
|
177
|
+
- `.agents/skills/fluid-widget-authoring/SKILL.md` — widget authoring and validation workflow.
|
|
178
|
+
- `.claude/skills/...` — Claude-compatible copies generated from the same template skill files.
|
|
237
179
|
|
|
238
|
-
## Learn
|
|
180
|
+
## Learn more
|
|
239
181
|
|
|
240
|
-
-
|
|
241
|
-
-
|
|
242
|
-
-
|
|
243
|
-
- [React Documentation](https://react.dev)
|
|
182
|
+
- Fluid Commerce Documentation: https://docs.fluidcommerce.com
|
|
183
|
+
- Vite Documentation: https://vite.dev
|
|
184
|
+
- React Documentation: https://react.dev
|