From 266f3dbbc89d85d8917f972206e1665bcfabcc31 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 4 Jan 2026 19:40:24 +0000 Subject: [PATCH] docs: add CLAUDE.md for AI assistant guidance Create comprehensive documentation for AI assistants working on the Fluidd codebase, covering project structure, development workflows, code conventions, testing patterns, and common patterns. Signed-off-by: Claude --- CLAUDE.md | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000000..6440f69ca7 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,270 @@ +# CLAUDE.md - AI Assistant Guide for Fluidd + +This document provides essential context for AI assistants working on the Fluidd codebase. + +## Project Overview + +**Fluidd** is a free and open-source web interface for [Klipper](https://www.klipper3d.org/) 3D printer firmware. It communicates with printers through [Moonraker](https://github.com/Arksine/moonraker), Klipper's API server. + +- **Version**: 1.36.2 +- **License**: GPL-3.0 +- **Repository**: https://github.com/fluidd-core/fluidd + +## Technology Stack + +| Category | Technology | +|----------|------------| +| Framework | Vue 2.7 with TypeScript | +| State Management | Vuex 3.6 (27 modules) | +| UI Framework | Vuetify 2.7 (Material Design) | +| Build Tool | Vite 6.4 | +| Testing | Vitest 3.2 with JSDOM | +| Linting | ESLint 9 with neostandard | +| Package Manager | npm (Node 22 or 24) | +| Styling | SCSS with Vuetify utilities | + +### Key Dependencies +- **Vue Class Component** + **Vue Property Decorator** for class-based components +- **Axios** for HTTP requests, custom WebSocket plugin for real-time updates +- **ECharts** for data visualization +- **Monaco Editor** for config file editing +- **Vue i18n** for internationalization (15+ languages) + +## Project Structure + +``` +src/ +├── api/ # HTTP and WebSocket API clients +│ ├── httpClientActions.ts +│ └── socketActions.ts +├── components/ # Vue components (~230 total) +│ ├── common/ # Reusable components +│ ├── layout/ # Header, nav, drawers +│ ├── settings/ # Settings panels +│ ├── ui/ # UI elements +│ └── widgets/ # Dashboard widgets +├── directives/ # Vue directives +├── locales/ # i18n translations (YAML) +├── monaco/ # Monaco editor config +├── plugins/ # Vue plugins (httpClient, socketClient, vuetify, i18n) +├── router/ # Vue Router config +├── scss/ # Global styles +├── store/ # Vuex store modules (27 modules) +├── types/ # TypeScript definitions +├── util/ # Utility functions +├── views/ # Page-level components (15 routes) +├── workers/ # Web workers +├── App.vue # Root component +├── globals.ts # Global constants and MDI icons +├── init.ts # App initialization +└── main.ts # Entry point + +public/ # Static assets +server/ # Nginx configuration +tests/unit/ # Test setup and utilities +docs/ # Jekyll documentation site +tools/ # Build tools (svgo, theme converter) +``` + +## Development Commands + +```bash +# Install dependencies +npm install + +# Start development server (with HMR) +npm run dev + +# Build for production +npm run build + +# Run linting +npm run lint + +# Run unit tests +npm run test:unit + +# Type checking +npm run type-check + +# Check for circular dependencies +npm run circular-check + +# Install git hooks (run after clone) +npm run bootstrap +``` + +## Code Conventions + +### Component Pattern +Components use Vue Class Component with TypeScript decorators: + +```typescript +@Component({ + components: { ChildComponent } +}) +export default class MyComponent extends Vue { + @Prop({ required: true }) readonly data!: DataType + @Prop({ default: false }) readonly disabled!: boolean + + localState = '' + + @Watch('data') + onDataChange(newVal: DataType) { /* ... */ } + + get computedValue() { return this.data.value } + + handleClick() { /* ... */ } +} +``` + +### Vuex Store Structure +Each store module follows this pattern: +``` +store// +├── index.ts # Module registration +├── state.ts # State definition with defaultState() +├── mutations.ts # MutationTree +├── actions.ts # ActionTree (async operations) +├── getters.ts # GetterTree +└── types.ts # TypeScript interfaces +``` + +### Styling +- Use scoped SCSS: `