Stackpress Studio: Proposal #72
cblanquera
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Proposal for adding a
stackpress-studiopackage that provides a modern single-page GUI for authoring Stackpress idea files. Studio should makeschema.ideaand imported idea files easier to inspect, edit, validate, and organize while preserving the idea source file as the canonical artifact.1. Summary
Stackpress Studio should be a first-party package named
stackpress-studio.The package should serve a browser-based single-page application that opens a configured idea file, resolves
useimports, parses the resulting schema, and presents the schema as editable models, fieldsets, enums, and source files.The design should borrow the productive parts of Cradle's historical schema builder:
Stackpress Studio should modernize that workflow as an SPA instead of page reloads and popup-heavy dialogs. Dialogs can still be used for destructive confirmations or focused create flows, but routine editing should happen in persistent panels and inspectors.
2. Goals
Studio should make it possible to:
schema.ideafrom a Stackpress project.use.usestatement to the main idea file when the user explicitly links an imported file.model.type.enum.specs/api/idea-reference.mdbehavior.packages/stackpress-schema/src/config/attributes.tsas the source of truth for built-in resource, column, assertion, field component, and view component definitions.3. Non-Goals
The first version should not try to:
stackpress generate.4. Package Shape
Add a new workspace package:
packages/stackpress-studio/ LICENSE README.md package.json bin.ts src/ index.ts plugin.ts config.ts types.ts events/ index.ts serve.ts scripts/ index.ts studio.ts studio/ idea-files.ts idea-imports.ts idea-parse.ts idea-reference.ts idea-write.ts studio-schema.ts studio-models.ts studio-fieldsets.ts studio-enums.ts studio-fields.ts studio-presets.ts workspace-paths.ts pages/ app.ts api/ files.ts schema.ts models.ts fieldsets.ts enums.ts parse.ts save.ts presets.ts views/ app.tsx components/ StudioApp.tsx StudioShell.tsx WorkspaceExplorer.tsx SchemaNavigator.tsx ModelIndex.tsx ModelEditor.tsx FieldsetIndex.tsx FieldsetEditor.tsx EnumIndex.tsx EnumEditor.tsx FieldTable.tsx FieldInspector.tsx RelationPanel.tsx SourceEditor.tsx DiagnosticsPanel.tsx public/ styles/ studio.cssThe package should follow existing Stackpress package conventions:
cjsandesm./plugin,./events,./scripts,./types, and.routelifecyclesrc/types.tsSuggested root script:
{ "scripts": { "studio": "yarn --cwd packages/stackpress-studio" } }5. CLI Surface
Studio should provide a command that starts a Stackpress server and opens the SPA.
Suggested commands:
If Studio is later aggregated into
stackpress, the command can become:The separate package and binary should come first so the package can be proven without changing the main Stackpress CLI surface.
6. Config Shape
Add a
studioconfig namespace.Example:
The default idea path should resolve in this order:
--ideastudio.ideacli.idea<cwd>/schema.ideaThe default workspace should resolve in this order:
studio.workspaceserver.cwdAll reads and writes must stay inside the resolved workspace.
7. Runtime Model
Studio should use the normal Stackpress server runtime.
Startup flow:
studio.openis true, Studio opens the browser to/studio.The server owns:
The SPA owns:
8. SPA Information Architecture
Studio should render one server route:
The SPA should own internal navigation states:
The app should not depend on real server routes for each internal section. This keeps navigation fast and avoids reproducing Cradle's page-per-operation workflow.
8.1. Primary Layout
Use a workbench layout:
The interface should be dense, quiet, and optimized for repeated schema editing.
Cradle's editable schema flow should inform the interaction pattern more than the visual style:
The Studio SPA should still avoid Cradle's page-per-operation and popup-heavy feel. Drawers, stacked panes, and inline editors should provide the same fast editing rhythm while keeping the current resource context visible.
8.2. Primary Sections
The left rail should include:
Later sections can include:
Models, fieldsets, and enums should be available in the first complete version.
9. Idea Files And Imports
Idea files can import other idea files with
use.Studio should treat the configured idea file as the main file and imported files as part of the editable workspace graph.
For each file, Studio should track:
Creating a new idea file should be explicit:
studio.imports.defaultDirectory.use "..."statement to the main file.Studio should not silently edit the main idea file just because a new file was created.
10. Source Canonical Model
The idea file source must remain canonical.
Structured editing should produce source patches, not a separate schema database. This matters because idea files can contain comments, ordering, imports, plugin-specific syntax, and future syntax that Studio may not fully understand.
Studio should support two modes:
When a file contains syntax Studio cannot safely transform visually, Studio should still allow source editing and show a diagnostic explaining which visual actions are unavailable.
11. Schema Resource Model
The parser exposes schema resources under the current
SchemaConfigshape:modeltypeenumproppluginStudio should prioritize:
Props and plugins can be visible in source/reference views before full visual editing is added.
12. Attribute Definitions Source Of Truth
Studio should not hard-code possible model, fieldset, and column attributes from prose docs alone.
The source of truth for built-in attribute definitions is:
That file exports:
schemafor resource-level attributes used by models and schema-like resourcescolumnfor column/field attributesassertfor validation/assertion attributesfieldfor field component attributesviewfor view component attributeslistderived fromviewwithview.names rewritten tolist.filterderived fromfieldwithfield.names rewritten tofilter.spanderived fromfieldwithfield.names rewritten tospan.Studio's reference service should load these dictionaries directly when possible. If browser payload size or package-boundary constraints require a copied reference map, the copied map must be generated or checked against
attributes.ts.The current
specs/api/idea-reference.mdshould remain useful for human explanation, butattributes.tsshould decide which controls Studio shows, what arguments each control accepts, and which attributes are flags, methods, assertions, or components.12.1. Resource-Level Attribute Definitions
These definitions come from the exported
schemadictionary inattributes.ts.@display(...)template: string@icon(...)icon: string@labels(...)singular: string,plural: string@query(...)...selectors: string[]Studio controls derived from this dictionary:
type12.2. Column Attribute Definitions
These definitions come from the exported
columndictionary inattributes.ts.@active@default(...)@description(...)description: string@examples(...)@encrypted@generated@hashed@id@searchable@sortable@label(...)label: string@min(...)value: number@max(...)value: number@step(...)value: number@relation(...){ local: string, foreign: string, name?: string }@timestamp@uniqueStudio should derive the default column attribute picker from this table and the actual exported dictionary.
Model-only scope is a Studio authoring rule based on current model/store behavior and the user's fieldset requirement. If the parser accepts one of these attributes syntactically on a fieldset column, Studio should still avoid presenting it as a normal fieldset control unless Stackpress later gives it fieldset semantics.
12.3. Assertion Attribute Definitions
These definitions come from the exported
assertdictionary inattributes.ts.Assertions available to Studio:
Studio should show assertion controls from the dictionary metadata:
typedecides whether an assertion can be a flag, method, or bothargsdrives the argument editordata.namedrives the generated assertion namedata.messagedrives the default diagnostic/help textThe alias definitions in
attributes.tsmust also be available:notemptynepatternregexgtegeltelecgtecgeclteclewgtewgewltewle12.4. Field Component Definitions
These definitions come from the exported
fielddictionary inattributes.ts.Field components available to Studio:
Studio should use each field component definition for:
12.5. View, List, Filter, And Span Definitions
These definitions come from the exported
view,list,filter, andspandictionaries inattributes.ts.View components available to Studio:
Derived dictionaries:
listuses the same definitions asview, with names rewritten fromview.*tolist.*.filteruses the same definitions asfield, with names rewritten fromfield.*tofilter.*.spanuses the same definitions asfield, with names rewritten fromfield.*tospan.*.Studio should not maintain separate hand-authored catalogs for these derived families. It should reproduce the same mapping rule as
attributes.tsor import the derived exports directly.13. Models
Models correspond to
modelin idea files.ModelextendsFieldsetin the current schema package and adds store behavior. Studio should reflect that relationship by reusing most field editing controls while exposing model-only database and admin concepts.Model editor sections:
Identity controls:
@labels(...)@labels(...)@icon(...)@display(...)@query(...)Field table columns:
Model-only behavior:
@id@active@searchable@sortableModels should use Cradle's table-first editing pattern, but the modern UI should avoid popup-heavy routine edits. Selecting a field should open a persistent inspector.
14. Fieldsets
Fieldsets correspond to
typein idea files.Fieldsets are reusable structured types. They should be edited separately from models because they do not represent database-backed resources.
Fieldset editor sections:
Fieldset controls:
Fieldsets should not expose:
The shared field editor should still allow column behavior that applies to both models and fieldsets, such as:
15. Enums
Enums correspond to
enumin idea files.Enums should be first-class resources in Studio because the schema package stores them separately on
Schema.enums, and column types can reference them.Enum editor sections:
Option table columns:
Expected behavior:
Enum-backed field behavior:
16. Shared Field Editing
Models and fieldsets should share a
FieldTableandFieldInspector.The shared field inspector should include:
Identity:
@label(...)Type:
Attributes:
@default(...)@description(...)@examples(...)@generated@encrypted@hashedModel-only attributes:
@id@active@searchable@sortableAssertions:
idea-reference.mdComponents:
The inspector should use persistent panels and inline repeatable rows instead of Cradle-style modal stacks.
17. Presets
Studio should provide presets for common patterns.
Fieldset-safe presets:
Model presets:
Preset output should be source snippets that are easy to inspect before saving.
18. Diagnostics
Studio diagnostics should combine parser errors with Studio-level checks.
Parser diagnostics:
File diagnostics:
Schema diagnostics:
Diagnostics should include:
19. API Routes
Studio should expose JSON APIs under
/studio/api.Suggested routes:
GET /studio/api/schemashould return the parsed workspace state:POST /studio/api/saveshould accept source changes and structured patches only when they can be applied safely:The first implementation can support source saves first, then structured patches for known operations.
20. Source Patching Strategy
Structured editing should start with conservative source operations.
Safe V1 operations:
usestatementHigher-risk operations should require stronger parser location support:
If the parser does not expose enough location data, Studio can still support these operations by switching the user to Source mode with a generated snippet.
21. Visual Design Direction
Studio should feel like a modern schema workbench.
Design principles:
The Cradle screenshots provide useful structural patterns, but Studio should avoid copying the old visual style directly.
22. Milestones
Milestone 1: Read-Only Studio
Deliver:
Verification:
Milestone 2: Source Editing
Deliver:
Verification:
schema.ideaMilestone 3: Visual Create Flows
Deliver:
Verification:
Milestone 4: Field Inspector
Deliver:
Verification:
Milestone 5: Structured Updates
Deliver:
Verification:
23. Testing Strategy
Add focused tests for the service layer before broad browser tests.
Test areas:
Browser tests can come after Milestone 1 or 2 and should verify:
24. Open Questions
The following should be settled during implementation:
propandpluginshould be visually editable in the first release.stackpresspackage after the standalone package is proven.25. Recommended First Version
The recommended first useful version is:
stackpress-studiopackage/studioThis version would already be useful for understanding and editing idea files while keeping risk low. Richer in-place structured editing can be added once source patching is reliable.
Beta Was this translation helpful? Give feedback.
All reactions