Skip to content

Commit 11ba381

Browse files
authored
Restructure Portal code to be inside Editor (Stirling-Tools#6857)
# Description of Changes We don't have any strong reasons to keep the Portal as a separate Vite app, and it needs access to so many things from the Editor that it no longer makes sense to keep them separate. This PR moves the Portal code to have direct access to the Editor code and gets rid of the shared folder.
1 parent 675afe9 commit 11ba381

689 files changed

Lines changed: 4509 additions & 4783 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ node_modules/
2727
**/node_modules/
2828
frontend/node_modules/
2929
frontend/editor/dist/
30-
frontend/dist-portal/
3130
frontend/editor/playwright-report/
3231
.npm/
3332
.yarn/

.gitleaksignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ testing/compose/validate-mcp-test.sh:curl-auth-header:92
1515
testing/compose/validate-mcp-test.sh:curl-auth-header:116
1616

1717
# Storybook example showing curl with a fake Bearer token placeholder (sk_live_a3f8...).
18-
frontend/shared/components/CodeBlock.stories.tsx:curl-auth-header:4
18+
frontend/editor/src/proprietary/ui/CodeBlock.stories.tsx:curl-auth-header:5
1919

2020
# Truncated placeholder API key in portal docs example (sk_live_8f2c...e10) - not a real secret.
21-
frontend/portal/src/components/docs/GettingStartedSection.tsx:generic-api-key:31
21+
frontend/editor/src/portal/components/docs/GettingStartedSection.tsx:generic-api-key:30
2222

2323
# False positive: generic-api-key matches the Java type name "X509Certificate"
2424
# in a method signature (CreateSignatureBase.resolveSignatureAlgorithm) - not a secret.

.taskfiles/frontend.yml

Lines changed: 5 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -128,37 +128,6 @@ tasks:
128128
- task: dev:_run
129129
vars: { MODE: prototypes, PORT: '{{.PORT}}', BACKEND_URL: '{{.BACKEND_URL}}', OPEN: '{{.OPEN}}' }
130130

131-
dev:portal:
132-
desc: "Start developer portal dev server"
133-
ignore_error: true
134-
deps: [install]
135-
vars:
136-
PORT: '{{.PORT | default "5173"}}'
137-
BACKEND_URL: '{{.BACKEND_URL | default "http://localhost:8080"}}'
138-
EDITOR_URL: '{{.EDITOR_URL | default ""}}'
139-
OPEN: '{{.OPEN | default ""}}'
140-
SUBPATH: '{{.SUBPATH | default ""}}'
141-
MOCKS: '{{.MOCKS | default ""}}'
142-
env:
143-
BACKEND_URL: '{{.BACKEND_URL}}'
144-
cmds:
145-
- '{{if .SUBPATH}}RUN_SUBPATH={{.SUBPATH}} {{end}}{{if .MOCKS}}VITE_PORTAL_MOCKS={{.MOCKS}} {{end}}{{if .EDITOR_URL}}VITE_EDITOR_URL={{.EDITOR_URL}} {{end}}npx vite portal --port {{.PORT}}{{if .OPEN}} --open{{end}}'
146-
147-
dev:portal:proxy:serve:
148-
internal: true
149-
vars:
150-
PORT: '{{.PORT | default "3000"}}'
151-
BACKEND_URL: '{{.BACKEND_URL | default "http://localhost:8080"}}'
152-
EDITOR_DEV_URL: '{{.EDITOR_DEV_URL | default ""}}'
153-
PORTAL_DEV_URL: '{{.PORTAL_DEV_URL | default ""}}'
154-
env:
155-
PORT: '{{.PORT}}'
156-
BACKEND_URL: '{{.BACKEND_URL}}'
157-
EDITOR_DEV_URL: '{{.EDITOR_DEV_URL}}'
158-
PORTAL_DEV_URL: '{{.PORTAL_DEV_URL}}'
159-
cmds:
160-
- npx tsx scripts/dev-origin-proxy.ts
161-
162131
# ============================================================
163132
# Build
164133
# ============================================================
@@ -205,29 +174,6 @@ tasks:
205174
cmds:
206175
- npx vite build editor --mode prototypes
207176

208-
build:portal:
209-
desc: "Build developer portal"
210-
deps: [install]
211-
vars:
212-
SUBPATH: '{{.SUBPATH | default ""}}'
213-
cmds:
214-
- '{{if .SUBPATH}}RUN_SUBPATH={{.SUBPATH}} {{end}}npx vite build portal'
215-
216-
preview:portal:proxy:
217-
desc: "Build + serve editor + portal behind one origin (prod-like auth testing)"
218-
deps: [prepare]
219-
vars:
220-
PORT: '{{.PORT | default "3000"}}'
221-
BACKEND_URL: '{{.BACKEND_URL | default "http://localhost:8080"}}'
222-
env:
223-
PORT: '{{.PORT}}'
224-
BACKEND_URL: '{{.BACKEND_URL}}'
225-
cmds:
226-
- task: build:proprietary
227-
vars: { PREVIEW: '1' }
228-
- task: build:portal
229-
vars: { SUBPATH: portal }
230-
- npx tsx scripts/dev-origin-proxy.ts
231177

232178
storybook:
233179
desc: "Start Storybook dev server"
@@ -263,8 +209,8 @@ tasks:
263209
deps: [install]
264210
cmds:
265211
# Globs so dpdm walks the whole tree. dpdm expands the braces itself, so this is
266-
# shell-agnostic. Covers editor, portal, and the shared design system.
267-
- npx dpdm "editor/src/**/*.{ts,tsx}" "portal/src/**/*.{ts,tsx}" "shared/**/*.{ts,tsx}" --circular --no-warning --no-tree --exit-code circular:1
212+
# shell-agnostic. Covers the whole editor tree, including the portal layer.
213+
- npx dpdm "editor/src/**/*.{ts,tsx}" --circular --no-warning --no-tree --exit-code circular:1
268214

269215
lint:fix:
270216
desc: "Auto-fix lint issues"
@@ -345,8 +291,6 @@ tasks:
345291
desc: "Typecheck scripts"
346292
deps: [prepare]
347293
cmds:
348-
- task: typecheck:_run
349-
vars: { PROJECT: scripts/tsconfig.json }
350294
- task: typecheck:_run
351295
vars: { PROJECT: editor/scripts/tsconfig.json }
352296

@@ -362,14 +306,7 @@ tasks:
362306
deps: [install]
363307
cmds:
364308
- task: typecheck:_run
365-
vars: { PROJECT: portal/tsconfig.json }
366-
367-
typecheck:shared:
368-
desc: "Typecheck the shared design system"
369-
deps: [install]
370-
cmds:
371-
- task: typecheck:_run
372-
vars: { PROJECT: shared/tsconfig.json }
309+
vars: { PROJECT: editor/src/portal/tsconfig.json }
373310

374311
typecheck:all:
375312
desc: "Typecheck all build variants"
@@ -382,7 +319,6 @@ tasks:
382319
- task: typecheck:scripts
383320
- task: typecheck:prototypes
384321
- task: typecheck:portal
385-
- task: typecheck:shared
386322

387323
# ============================================================
388324
# Quality Gate
@@ -411,7 +347,6 @@ tasks:
411347
- task: lint
412348
- task: format:check
413349
- task: build
414-
- task: build:portal
415350
- task: test
416351
- task: storybook:build
417352

@@ -423,20 +358,13 @@ tasks:
423358
desc: "Run tests"
424359
cmds:
425360
- task: test:editor
426-
- task: test:portal
427361

428362
test:editor:
429363
desc: "Run editor tests"
430364
deps: [prepare]
431365
cmds:
432366
- npx vitest run --root editor
433367

434-
test:portal:
435-
desc: "Run portal tests"
436-
deps: [prepare]
437-
cmds:
438-
- npx vitest run --root portal
439-
440368
test:watch:
441369
desc: "Run tests in watch mode"
442370
deps: [prepare]
@@ -481,7 +409,7 @@ tasks:
481409
clean:
482410
desc: "Clean build artifacts and caches"
483411
cmds:
484-
- cmd: powershell rm -Recurse -Force -ErrorAction SilentlyContinue node_modules/.vite, editor/dist, dist, dist-portal
412+
- cmd: powershell rm -Recurse -Force -ErrorAction SilentlyContinue node_modules/.vite, editor/dist, dist
485413
platforms: [windows]
486-
- cmd: rm -rf node_modules/.vite editor/dist dist dist-portal
414+
- cmd: rm -rf node_modules/.vite editor/dist dist
487415
platforms: [linux, darwin]

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ The project structure is defined in `engine/pyproject.toml`. Any new dependencie
139139

140140
#### Environment Variables
141141
- All `VITE_*` variables must be declared in the appropriate committed env file:
142-
- `frontend/editor/.env` — core, proprietary, and shared vars
142+
- `frontend/editor/.env` — core and shared vars (base, loaded in every mode)
143+
- `frontend/editor/.env.proprietary` — proprietary-only vars, e.g. the admin portal's SaaS/account-link keys (layered on top of `.env` in proprietary mode)
143144
- `frontend/editor/.env.saas` — SaaS-only vars (layered on top of `.env` in SaaS mode)
144145
- `frontend/editor/.env.desktop` — desktop (Tauri)-only vars (layered on top of `.env` in desktop mode)
145146
- These files are committed to Git and must not contain private keys

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ if that directory exists, is licensed under the license defined in "frontend/edi
2020
if that directory exists, is licensed under the license defined in "frontend/editor/src/cloud/LICENSE".
2121
* All content that resides under the "frontend/editor/src/prototypes/" directory of this repository,
2222
if that directory exists, is licensed under the license defined in "frontend/editor/src/prototypes/LICENSE".
23-
* All content that resides under the "frontend/portal/" directory of this repository,
24-
if that directory exists, is licensed under the license defined in "frontend/portal/LICENSE".
23+
* All content that resides under the "frontend/editor/src/portal/" directory of this repository,
24+
if that directory exists, is licensed under the license defined in "frontend/editor/src/portal/LICENSE".
2525
* Content outside of the above mentioned directories or restrictions above is
2626
available under the MIT License as defined below.
2727

Taskfile.yml

Lines changed: 3 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -79,86 +79,12 @@ tasks:
7979
OPEN: "true"
8080

8181
dev:portal:
82-
desc: "Start backend + developer portal concurrently on free ports"
82+
desc: "Start backend + editor; the portal is an admin route at /portal"
8383
vars:
8484
PORTS:
8585
sh: '{{if eq OS "windows"}}{{.FIND_FREE_PORT_PS}} 8080 5173{{else}}{{.FIND_FREE_PORT_SH}} 8080 5173{{end}}'
8686
BACKEND_PORT: '{{index (splitList "\n" .PORTS) 0}}'
87-
PORTAL_PORT: '{{index (splitList "\n" .PORTS) 1}}'
88-
deps:
89-
- task: backend:dev
90-
vars:
91-
PORT: '{{.BACKEND_PORT}}'
92-
SECURITY_ENABLELOGIN: "true"
93-
POLICIES_ENABLED: "true"
94-
- task: frontend:dev:portal
95-
vars:
96-
PORT: '{{.PORTAL_PORT}}'
97-
BACKEND_URL: 'http://localhost:{{.BACKEND_PORT}}'
98-
MOCKS: 'false'
99-
OPEN: "true"
100-
101-
dev:portal:all:
102-
desc: "Start backend + developer portal + editor concurrently on free ports"
103-
vars:
104-
PORTS:
105-
sh: '{{if eq OS "windows"}}{{.FIND_FREE_PORT_PS}} 8080 5173 5174{{else}}{{.FIND_FREE_PORT_SH}} 8080 5173 5174{{end}}'
106-
BACKEND_PORT: '{{index (splitList "\n" .PORTS) 0}}'
107-
PORTAL_PORT: '{{index (splitList "\n" .PORTS) 1}}'
108-
EDITOR_PORT: '{{index (splitList "\n" .PORTS) 2}}'
109-
deps:
110-
- task: backend:dev
111-
vars:
112-
PORT: '{{.BACKEND_PORT}}'
113-
SECURITY_ENABLELOGIN: "true"
114-
POLICIES_ENABLED: "true"
115-
- task: frontend:dev:portal
116-
vars:
117-
PORT: '{{.PORTAL_PORT}}'
118-
BACKEND_URL: 'http://localhost:{{.BACKEND_PORT}}'
119-
# Point the portal's "Editor" app switcher at the editor we spawn here.
120-
EDITOR_URL: 'http://localhost:{{.EDITOR_PORT}}/'
121-
MOCKS: 'false'
122-
OPEN: "true"
123-
- task: frontend:dev
124-
vars:
125-
PORT: '{{.EDITOR_PORT}}'
126-
BACKEND_URL: 'http://localhost:{{.BACKEND_PORT}}'
127-
128-
dev:portal:all:saas:
129-
desc: "Start SaaS backend + developer portal + editor concurrently on free ports"
130-
vars:
131-
PORTS:
132-
sh: '{{if eq OS "windows"}}{{.FIND_FREE_PORT_PS}} 8080 5173 5174{{else}}{{.FIND_FREE_PORT_SH}} 8080 5173 5174{{end}}'
133-
BACKEND_PORT: '{{index (splitList "\n" .PORTS) 0}}'
134-
PORTAL_PORT: '{{index (splitList "\n" .PORTS) 1}}'
135-
EDITOR_PORT: '{{index (splitList "\n" .PORTS) 2}}'
136-
deps:
137-
- task: backend:dev:saas
138-
vars:
139-
PORT: '{{.BACKEND_PORT}}'
140-
POLICIES_ENABLED: "true"
141-
- task: frontend:dev:portal
142-
vars:
143-
PORT: '{{.PORTAL_PORT}}'
144-
BACKEND_URL: 'http://localhost:{{.BACKEND_PORT}}'
145-
EDITOR_URL: 'http://localhost:{{.EDITOR_PORT}}/'
146-
MOCKS: 'false'
147-
OPEN: "true"
148-
- task: frontend:dev
149-
vars:
150-
PORT: '{{.EDITOR_PORT}}'
151-
BACKEND_URL: 'http://localhost:{{.BACKEND_PORT}}'
152-
153-
dev:portal:proxy:
154-
desc: "Editor + portal on ONE origin + backend via live dev servers (shared-token login)"
155-
vars:
156-
PORTS:
157-
sh: '{{if eq OS "windows"}}{{.FIND_FREE_PORT_PS}} 8080 3000 5173 5174{{else}}{{.FIND_FREE_PORT_SH}} 8080 3000 5173 5174{{end}}'
158-
BACKEND_PORT: '{{index (splitList "\n" .PORTS) 0}}'
159-
PROXY_PORT: '{{index (splitList "\n" .PORTS) 1}}'
160-
EDITOR_PORT: '{{index (splitList "\n" .PORTS) 2}}'
161-
PORTAL_PORT: '{{index (splitList "\n" .PORTS) 3}}'
87+
EDITOR_PORT: '{{index (splitList "\n" .PORTS) 1}}'
16288
deps:
16389
- task: backend:dev
16490
vars:
@@ -169,18 +95,7 @@ tasks:
16995
vars:
17096
PORT: '{{.EDITOR_PORT}}'
17197
BACKEND_URL: 'http://localhost:{{.BACKEND_PORT}}'
172-
- task: frontend:dev:portal
173-
vars:
174-
PORT: '{{.PORTAL_PORT}}'
175-
BACKEND_URL: 'http://localhost:{{.BACKEND_PORT}}'
176-
SUBPATH: portal
177-
MOCKS: 'false'
178-
- task: frontend:dev:portal:proxy:serve
179-
vars:
180-
PORT: '{{.PROXY_PORT}}'
181-
BACKEND_URL: 'http://localhost:{{.BACKEND_PORT}}'
182-
EDITOR_DEV_URL: 'http://localhost:{{.EDITOR_PORT}}'
183-
PORTAL_DEV_URL: 'http://localhost:{{.PORTAL_PORT}}'
98+
OPEN: "true"
18499

185100
dev:saas:
186101
desc: "Start SaaS backend + frontend concurrently on free ports"
@@ -228,24 +143,6 @@ tasks:
228143
- task: backend:build
229144
- task: frontend:build
230145

231-
preview:portal:proxy:
232-
desc: "Build + serve editor + portal on ONE origin + backend (prod-like auth test)"
233-
vars:
234-
PORTS:
235-
sh: '{{if eq OS "windows"}}{{.FIND_FREE_PORT_PS}} 8080 3000{{else}}{{.FIND_FREE_PORT_SH}} 8080 3000{{end}}'
236-
BACKEND_PORT: '{{index (splitList "\n" .PORTS) 0}}'
237-
PROXY_PORT: '{{index (splitList "\n" .PORTS) 1}}'
238-
deps:
239-
- task: backend:dev
240-
vars:
241-
PORT: '{{.BACKEND_PORT}}'
242-
SECURITY_ENABLELOGIN: "true"
243-
POLICIES_ENABLED: "true"
244-
- task: frontend:preview:portal:proxy
245-
vars:
246-
PORT: '{{.PROXY_PORT}}'
247-
BACKEND_URL: 'http://localhost:{{.BACKEND_PORT}}'
248-
249146
# ============================================================
250147
# Test
251148
# ============================================================

app/proprietary/src/main/java/stirling/software/proprietary/access/model/ResourceType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
/** Types of resources whose access can be gated by {@link ResourceGrant}. */
44
public enum ResourceType {
5-
// The admin portal / processor (frontend/portal). Singleton resource (empty resourceId).
5+
// The admin portal / processor (frontend/editor/src/portal). Singleton resource (empty
6+
// resourceId).
67
PORTAL,
78
// A stored S3/MCP/API integration configuration.
89
INTEGRATION_CONFIG

frontend/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# production
1212
/build
1313
/dist
14-
/dist-portal
1514
/storybook-static
1615

1716
/editor/build
@@ -27,8 +26,8 @@
2726
# Root .gitignore ignores all .env* - whitelist only our committed ones, anchored
2827
# to their app so a stray top-level frontend/.env stays ignored (Storybook's SaaS
2928
# mock env is injected via .storybook/main.ts, not a file).
30-
!/portal/.env
3129
!/editor/.env
30+
!/editor/.env.proprietary
3231
!/editor/.env.desktop
3332
!/editor/.env.saas
3433

frontend/.prettierignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
dist/
2-
dist-portal/
32
editor/dist/
43
# Tauri/Cargo build output (binary assets named *.js etc. confuse Prettier).
54
# Match nested target/ dirs too - provisioner/ and thumbnail-handler/ each
@@ -9,7 +8,7 @@ editor/src-tauri/gen/
98
node_modules/
109
editor/public/vendor/
1110
# Auto-generated by MSW (`msw init`); regenerated verbatim, not hand-formatted.
12-
portal/public/mockServiceWorker.js
11+
editor/public/mockServiceWorker.js
1312
# Auto-generated OG/social-preview metadata (scripts/generate-og-metadata.mjs); regenerated verbatim.
1413
editor/public/og-metadata.json
1514
editor/src/core/data/ogImageMap.json

0 commit comments

Comments
 (0)