Repository navigation
Node wizards: guided creation for ADRs, requirements and other governance elements - #109
Merged
Merged
Conversation
A node type can carry a `wizard`: steps of fields, relations to link, or a built-in editor (EARS quick entry), plus prefilled values. Being plain metamodel data, custom metamodels can define wizards too. The governance preset gets wizards for ADR, fitness function, requirement, scenario and mockup. Helpers in metamodel/wizard.ts resolve each step's visible fields, the nodes a relation step may link, missing required fields and the links a node already has. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The canvas (palette drop, double-click), the table view and the wiki now create nodes through `requestCreateNode`, which opens the type's wizard instead when it has one. The node and its links are created when the wizard finishes, as one undo step; cancelling creates nothing. AI tools and imports keep calling `addNode` and never open a wizard. The wiki's "Add child" passes the hierarchy relation as a link, so the wizard shows it pre-checked instead of adding a duplicate afterwards. "Fill in with wizard…" in the properties panel reopens it for an existing node (only changed values are written; links are added and removed to match). "Wizard on create" in the app menu turns the automatic wizard off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Creating an ADR used to mean dropping it on the canvas and then filling in a wall of fields in the properties panel, with the relations that give it meaning (what it constrains, what it supersedes) left for later or forgotten. Node types can now carry a wizard: a step-by-step form with guidance per step that ends with those relations.
What the user sees
constrains, and its "Supersedes" step offers other ADRs.EarsQuickEntry).How it's built
Metamodel data.
NodeTypeDef.wizardinpackages/common/src/metamodel/types.tshastrigger: 'create' | 'manual',prefill(supports{{today}}) andsteps. A step is one of:fields(property keys pluslabel/description);relations(relation type + direction);custom(a built-in editor; onlyears-quick-entryso far).Custom metamodels can define wizards, and they round-trip through every format that stores the metamodel. Documents on the built-in governance preset get the wizards with no migration, because the preset is rebuilt from code on load.
Helpers. Pure functions in
packages/common/src/metamodel/wizard.ts: visible fields per step (honoursvisibleWhen), relation candidates, missing required fields, a node's existing links.One entry point in the store (
packages/ui/src/store/diagramStore.ts):requestCreateNode(node, { links, onCreated, skipWizard }): opens a wizard session if the type has a create-time wizard, otherwise creates the node and its links at once. The metamodel's placement and cardinality checks run before the wizard opens, not after the user has filled it in.finishNodeWizard,cancelNodeWizard,openNodeWizard.addNodeis unchanged, so AI tools, Hub import and internal operations never open a wizard.Wiki "Add child" now passes the hierarchy relation (
derives) as a link instead of anonCreatedcallback. The wizard shows it pre-checked, and the store skips duplicate relations.Mounting.
NodeWizardis mounted once in Studio'sApp.tsx, which covers the web build and the VS Code webview. The Hub viewer is read-only and unaffected.Tests
common:packages/common/tests/nodeWizard.test.ts, 11 tests. Covers the helpers, plus a check that every preset wizard refers to properties and relation types that exist.ui:packages/ui/tests/nodeWizard.test.ts, 11 tests. Covers:apps/e2e/tests/studio/wizard.spec.ts:npm test,npm run typecheckand the full e2e suite pass locally (e2e: 54 passed; the 4known-issuestests aretest.failas before). Checked by hand in the web build: the ADR and requirement wizards in the dark and light themes, and "Fill in with wizard…". Not tried in the desktop app.Still open
Listed in
docs/IMPROVEMENTS.mdunder "Node wizards", among them:supersedesdoesn't mark the older ADR as superseded.🤖 Generated with Claude Code