Fluidd is a Vue 2.7 + TypeScript web interface for Klipper 3D printers that communicates with Moonraker via WebSocket.
Subsystem detail lives in .agents/. Before working in an area below, read its guide — the
rules there are not repeated here.
| Guide | Read before touching |
|---|---|
.agents/moonraker-api.md |
Moonraker methods/notifications, src/typings/moonraker.*, socketActions.ts, suppressError, agents |
.agents/socket.md |
socketClient.ts, src/store/socket/, src/store/auth/, reconnect, login/auth flow |
.agents/charts.md |
src/util/chart-*, src/store/charts/, ThermalChart, DiagnosticsCard, ECharts datasets |
.agents/gcode-preview.md |
parseGcode*, gcode-extrusion-roles.ts, src/store/gcodePreview/, util/gcode-preview.ts |
.agents/monaco.md |
src/monaco/, setupMonaco.ts, Monaco workers |
.agents/html-rendering.md |
v-safe-html, sanitizing, html-helpers.ts, ConsoleItem, AppNamed* controls |
.agents/sandboxed-eval.md |
sandboxedEval, diagnostics collectors, running user JavaScript |
.agents/history.md |
src/store/history/, JobHistory, CSV export |
.agents/i18n.md |
src/plugins/i18n.ts, Vuetify locales, SupportedLocales |
.agents/testing.md |
Specs needing jsdom, location, fetch stubs; vitest.config.ts, tests/unit/setup.ts |
.agents/toolchain.md |
package.json, pnpm-workspace.yaml, Vite/Vitest/TS/oxlint/oxfmt/ESLint config, dependency versions |
.agents/ci.md |
.github/, tools/bundle-size.mjs |
.agents/containers.md |
.devcontainer/, Dockerfile, server/nginx/ |
.agents/docs-site.md |
anything under docs/ |
- Vue 2.7 + Vuetify 2: UI framework with Material Design components
- Vuex Store: namespaced modules mirroring Klipper/Moonraker domains (
printer/,files/,console/,macros/,webcams/,mmu/,spoolman/, etc.) - WebSocket Communication: Real-time JSON-RPC via custom
WebSocketClientinsrc/plugins/socketClient.ts - Component Structure: Class-style components with
vue-property-decorator; mixins-based architecture withStateMixinproviding common printer state access
All components use class-style decorators — no Options API or Composition API:
// Standard component
@Component({ components: { /* ... */ } })
export default class MyComponent extends Vue {
@Prop({ type: String, required: true })
readonly label!: string
@VModel({ type: Boolean })
open?: boolean
}
// Component needing printer state — extend via Mixins()
@Component({ components: { /* ... */ } })
export default class PrinterWidget extends Mixins(StateMixin) {
get klippyReady(): boolean {
return this.$typedGetters['printer/getKlippyReady']
}
}Available mixins (src/mixins/): StateMixin, FilesMixin, ServicesMixin, BrowserMixin, CameraMixin, ToolheadMixin, AfcMixin, MmuMixin
- Store modules in
src/store/— each hasstate.ts,getters.ts,mutations.ts,actions.ts,types.ts - Use
$typedStateand$typedGettersfor type-safe store access (defined insrc/plugins/filters.ts) - Use
Vue.set()for reactive dynamic state properties - Module definition:
export const auth = { namespaced, state, getters, actions, mutations } satisfies Module<AuthState, RootState>
- All printer communication through
SocketActionsinsrc/api/socketActions.ts(not direct HTTP) - Pattern:
baseEmit(method, { dispatch, wait, params })—methodmust be a key ofMoonraker.Methods;paramsand the result type are inferred from it, never passed as a type argument - Use
waitparameter for UI loading states:wait: Waits.onPrintStart - Wait constants defined in
src/globals.ts(Waitsobject) - Real-time updates handled via store mutations from socket events
- Method/notification typings,
suppressError, agents: see.agents/moonraker-api.md. Reconnect, liveness, auth: see.agents/socket.md
- Auto-imported (no manual import needed): components in
src/components/common/,layout/,ui/— viaunplugin-vue-componentswithVuetifyResolver - Manual import required: widget components, view components
- Lazy-loaded:
EChartviaVue.component('EChart', () => import('./vue-echarts-chunk')) - Generated types:
components.d.tsat repo root — auto-generated, do not edit manually
- Node.js 26 + pnpm, both pinned via
devEnginesinpackage.json(no Corepack) - Vite 8, vitest v5,
typescript-native-bridge(tsgo) astypescript - ES2022 lib (inherited from
@vue/tsconfig), matching Vite's defaultbaseline-widely-availablebuild target — no ES2023+ built-ins (toSorted,findLast, …) without polyfills - Details:
.agents/toolchain.md
pnpm run prepare # Install git hooks (runs automatically on `pnpm i`)
pnpm run dev # Start development server (port 8080)
pnpm run build # Production build
pnpm run type-check # TypeScript validation (vue-tsc)
pnpm run lint # oxlint (incl. circular imports), then ESLint (Vue templates only)
pnpm run format # oxfmt (`--check` in CI)
pnpm run test # Vitest unit testssrc/typings/— global.d.ts(Klipper,Moonrakernamespaces);src/types/— UI-only typessrc/components/widgets/<feature>/— feature widgets;src/views/— routed pagessrc/workers/— Web Workers (G-code parsing, MJPEG, sandboxed eval, Monaco providers)
- Hash-based routing (
#/path) - No route-level auth guard —
App.vuepicks main app / Login /SocketDisconnectedfrom socket status; see.agents/socket.md - Key routes:
/,/console,/jobs,/tune,/diagnostics,/timelapse,/history,/system,/configure,/settings,/camera/:cameraId,/preview
- MDI icons via
@mdi/js— mapped insrc/globals.ts(Iconsobject) - Usage:
<v-icon>{{ $globals.Icons.close }}</v-icon> - Vuetify theme with custom dark/light overrides in
src/scss/variables.scss - PWA support with service worker in
src/sw.ts(Workbox, injectManifest strategy)
- File operations through Moonraker's file API (
src/store/files/) - File uploads/downloads are the sole consumer of
axios— direct calls insrc/mixins/files.ts(for upload/download progress, whichfetchcannot report for uploads), authenticated with a oneshot token fetched viaSocketActions.accessOneshotToken(). There is no HTTP client plugin, and the rest of the app usesfetchor the WebSocket
- Cross-component: Vuex store or
EventBus(src/eventBus.ts) - Flash messages:
EventBus.$emit(text, { timeout })— displayed byFlashMessagecomponent
import.meta.glob()used insrc/dynamicImports.tsfor lazy-loading:I18nLocales— locale YAML filesCameraComponents— camera service Vue components
- Views also dynamically imported in
src/router/index.tsvia() => import('@/views/X.vue')
- Unit tests in any
src/**/__tests__/*.spec.ts— not justsrc/util/; e.g.src/workers/__tests__/parseGcode.spec.ts.tsconfig.vitest.jsonincludessrc/**/__tests__/*at any depth, plussrc/typings/*.d.tsso specs can reference theKlipper/Moonrakernamespaces, andtshelpers.d.ts, whichsrc/typingsbuilds on (TSHelpers.SnakeToCamelCase) - Global test functions (
describe,it,expect,vi,afterEach, …) —globals: truein vitest config, typed via/// <reference types="vitest/globals" />inenv.d.ts; specs import no vitest symbols - Time manipulation utility:
timeTravel(date, callback)intests/unit/utils.ts - Parameterized tests:
it.each([...])pattern - Test store actions/mutations independently from UI
- jsdom opt-in,
location,fetchstubs,Float32Arrayprecision: see.agents/testing.md
-
Source must pass linting with zero warnings and zero type errors — run
pnpm run lintandpnpm run type-checkbefore committing -
Formatting is owned by oxfmt (
oxfmt.config.ts) — runpnpm run format, never hand-format against it. The pre-commit hook formats staged files -
.editorconfigrules: 2 spaces, LF line endings, UTF-8, trim trailing whitespace, max line 100 (code) -
camelCase for variables/methods, PascalCase for components
-
src/components/ui/components put a kebab-case class named after the component on their main element (AppInlineChart→app-inline-chart), with BEM__elementclasses for inner parts (app-inline-chart__label). Their scoped styles target these classes, not Vuetify's -
<app-icon :loading>is for standalone icons (list items, menus, cards). Never put it inside a button: use the button's own loading state (<app-btn :loading>) instead -
Any link opening a new tab (
target="_blank") must also setrel="noopener noreferrer"— applies to<a>,<v-btn>/<app-btn>with:href, and any HTML strings rendered viav-safe-html(e.g.src/util/html-helpers.ts) -
Render plain text as plain text:
<span class="text-pre-wrap">{{ value }}</span>, on one line, notv-textorv-safe-html— see.agents/html-rendering.md -
Use
consolafor logging, notconsole.log(configured insrc/setupConsola.ts— warn in prod, verbose in dev) -
Type imports:
import type { ... }for types only (verbatimModuleSyntax: true) -
satisfieskeyword for store module type checking -
decimalRound(value, places)(src/util/decimal-round.ts) is the shared rounding helper — use it instead of ad-hocMath.round(value * 100) / 100 -
Stable
v-forkeys — key by identity, never by index (:key="`component::${component.name}`"). Separators belong inside the loop with their own key (:key="`component:divider:${component.name}`") rather than a trailingv-if="i < items.length - 1"sibling -
No double-cast type assertions (
as unknown as T) — use a proper TypeScript type guard instead (in,typeof,instanceof, or a custom type predicate):// Bad const x = value as unknown as { test: () => void } x?.test?.() // Good if (value && 'test' in value && typeof value.test === 'function') { value.test() }
- Conventional commits required:
feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert,types,i18n - Commit subject max 50 characters — hard-enforced by
.husky/commit-msghook - Signed-off-by line required on all commits (use
git commit -s):Signed-off-by: Your Name <your@email> - PR titles must follow conventional commits — CI-enforced via
amannn/action-semantic-pull-request(scope optional) - PR branches must be off a branch other than
developormaster - Clean develop preferred: squash and rebase feature branches prior to merge
- CHANGELOG visibility: only
feat,fix,perf,refactorappear inCHANGELOG.md(configured in.versionrc.json) - CI pipeline, reusable workflows, bundle-size report: see
.agents/ci.md
- SCSS deprecation warnings silenced:
import,global-builtin,slash-div,if-function @/scss/variablesauto-injected into all SCSS/Sass files via Vite config- Strict Vuex mode enabled only in dev (
strict: import.meta.env.DEV) - SVG files auto-optimized on commit — pre-commit hook runs SVGO on staged
.svg,.vue, andsrc/globals.tsfiles VUE_env prefix required — only env vars prefixedVUE_are exposed to app code viaimport.meta.env(ViteenvPrefix)import.meta.env.VERSIONandimport.meta.env.HASH(short git hash) are injected at build timeserver/config.jsonis the runtime config source (deployed asdist/config.json) — contains theme presets, endpoints, hosted flagnpmandnpxrefuse to run inside this repo —devEngines.packageManagernamespnpmwithonFail: download, which npm reads as a hardEBADDEVENGINESfailure (no flag overrides it,engine-strictincluded). Usepnpm dlxin place ofnpx, and install pnpm itself from outside the clone- Translations managed via Weblate — do not directly edit non-English locale files in
src/locales/
- Be extremely concise in responses
- Sacrifice grammar for brevity
- Focus on essential info only