diffusers-workflow / ui
CLAUDE.md19 starsChanged 3 days agoApache-2.0View on GitHub
Guidance for the web UI single-page app. Build and dev setup are in ui/README.md; the look is in the header comment of src/app.css; the rules the UI shares with the engine - its response contract among them - are rows in docs/ARCHITECTURE.md. Checks, from ui/: npm run check, npm run lint, npm test, and npx playwright test (after npm run build; its own server; never dw.serve on its port), whose e2e/performance.spec.ts budgets are raised only with Don. A test mocks…
In this repository4 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- dw_mcp/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- model-family-onboardingSkill
The file
Files
ui
Guidance for the web UI single-page app. Build and dev setup are in ui/README.md; the look is in the header comment of src/app.css; the rules the UI shares with the engine - its response contract among them - are rows in docs/ARCHITECTURE.md.
Checks, from ui/: npm run check, npm run lint, npm test, and npx playwright test (after npm run build; its own server; never dw.serve on its port), whose e2e/performance.spec.ts budgets are raised only with Don. A test mocks api with src/lib/test/apiMock.ts, never an object of its own. Server response types come from src/lib/generated/ - python scripts/dump_openapi.py then npm run gen:api - never written by hand.
Rules for new UI
- A workspace's views are
#/ws/<name>/<section>, listed inWS_SECTIONS(src/lib/routes.ts), routed insrc/App.svelteand named insrc/lib/Sidebar.svelte: overview, workflows, jobs, requests, gallery, compare, assets and edit. A new section goes in all three. requests is the workspace's requests ledger:requests/<id>is one request, edited only through intents (src/lib/request/intents.ts) thatplanStore.svelte.tsapplies to the plan as last read when it writes - a plan read earlier is never sent again; what a row shows and what needs the person is derived insrc/lib/request/itemState.ts, which the server'sneeds=truemirrors, not in a component (ARCHITECTURE, Requests in the UI). - Show the proof, one way: a file is an
OutputTile, opened inMediaViewer(the page'sopenhash), and what made it is aRecipePanel(raw_mediaholds the rest at 1); a file or reference to fill in is aReferenceField. Page data is aresource(load, { watch } | { live })(src/lib/resource.svelte.ts) rendered through<LoadState>(only it importsEmpty), whose quiet reloads keep edits, focus and selection; every mutating button is anaction()(unwatched_readsandunguarded_mutationsmeasure.svelte.tsstores too, where a read or write kept outside them is named with its reason inSTORE_EXCEPTIONS,scripts/arch-metrics.mjs); a destructive one asks or undoes throughsrc/lib/destructive.ts(docs/ARCHITECTURE.md, Destructive actions); a failure toast or load failure isdescribeError's copy (notify.failure,<LoadState>), inline,ErrorLine, nevere.message; the server's state isconnection, fed by every response (sendinsrc/lib/apiRequest.ts), never a page's. Repeating timers arepoll's (ESLint banssetIntervalelsewhere); a one-shot delay may be asetTimeoutits owner clears. An elapsed time against a server stamp usesserverNow().resourceis the only subscriber (ESLint), andsrc/lib/freshness.test.tsholds every page's declaration, resolving a helper one level; a page's own write isresource().adoptso it is never marked; everyapikey is classified read or not (READ_ALIASES/NOT_READSinscripts/arch-metrics.mjs,arch-metrics.test.ts); an open document watches withDocumentEditor.watchRemote. - Colour is carried only by the tokens
src/app.css's header lists, each with one meaning:--livemachine state,--selectthe user's place (focus, the open workspace, the active section),--good/--badan outcome,--warnattention (cancelled, stalled, unsaved, required),--finding-warn/--finding-infoan assessment finding's severity, and a workspace's own dot (wsColor()) its identity.scripts/design-rules.test.tsholds which files may usevar(--live)andvar(--select)- per file, so within a listed file the meaning is review's to keep - that no other token takes--live's value in any theme block, and that--warnand--livepass WCAG AA on--paneland--panel-2. Other token pairs should pass AA in both themes too, but no test holds them. - A document editor is a
DocumentEditor(src/lib/editorShell.svelte.ts): its fields sit inside the editor'sroot, whose focused field a flush blurs to commit, or register a flush; saves go throughsaveDocument(src/lib/documentSave.ts), nothing else writing a workflow, prompt or upload; its place in the route (which file is open, the load, the URL after a save) is aDocumentRoute(src/lib/documentRoute.svelte.ts); leaving while dirty is the router's leave guard (addLeaveGuard,src/lib/router.svelte.ts), never a per-link handler; a dialog issrc/lib/confirm.svelte.ts's. A page's head isPageHeader; copy followsGLOSSARY.md, whose banned termsscripts/copy-rules.test.tsholds at 0, and its Before you write markup table names the piece for each concept. - Imports point down:
src/lib/ui/and the top-levelsrc/lib/*modules import no feature folder; a feature folder importsui, the top-level modules and only whatLAYER_ALLOWS(scripts/arch-metrics.mjs) lists - job → gallery → request, job → workflow → editor;pages/import anything. A new folder undersrc/libis declared there first (layering_violations, held at 0; ARCHITECTURE, UI layering).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

