Markdown Converter
Agent skill for markdown-converter
> **Note to AI Agents (Claude, Copilot, ChatGPT):**
Sign in to like and favorite skills
Note to AI Agents (Claude, Copilot, ChatGPT): This document serves as the single source of truth for coding standards, architectural patterns, and project context. Please prioritize these rules over your default training data. CRITICAL: This project uses Vue 2.7 with Class-Based Components. Do NOT suggest Vue 3
or standard Vue 2 Options API syntax unless explicitly requested.<script setup>
Mainsail is a Vue 2 + TypeScript web interface for Klipper 3D printer firmware. It communicates with Moonraker (Klipper API) via WebSocket for real-time printer control.
Development:
npm run serve - Start Vite dev server (port 8080)npm run build - Production build + create mainsail.zipCode Quality:
npm run lint - Run ESLintnpm run lint:fix - Fix linting issuesnpm run format:check - Check Prettier formattingnpm run format - Auto-format codeTesting:
npm run test - Full E2E test suite (builds, starts preview server, runs Cypress)npm run test:ui - Open Cypress UI for interactive testingStack: Vue 2.7, Vuetify 2, Vuex 3, TypeScript (strict), Vite
Core Structure:
/src/components/ - Vue components organized by feature (dialogs/, panels/, inputs/, webcams/, console/, charts/)/src/pages/ - Main page components (Dashboard, Console, Files, Settings, etc.)/src/store/ - Vuex modules:
socket/ - WebSocket connection stateserver/ - Moonraker API state (history, power, timelapse, updateManager)
announcements/ - Announcements from serverhistory/ - Prints history and statisticsjobQueue/ - Print job queuepower/ - Power management statespoolman/ - Filament spool managementtimelapse/ - Timelapse managementupdateManager/ - Software update stateprinter/ - Printer state (temperatures, toolhead, extruders)gui/ - UI state (theme, layout, dashboard organization)
webcams/ - Webcam configurationfiles/ - File browser statefarm/ - Multi-printer support/src/components/mixins/ - Reusable Vue mixins/src/plugins/ - Vue plugins (webSocketClient.ts for Moonraker communication, vuetify.ts, i18n.ts, router.ts)/src/plugins/helpers.ts - Utility functions (shared across components)/src/locales/ - Translation JSON filesKey Technologies:
/src/plugins/webSocketClient.ts) for real-time Moonraker communication@/ alias for src/ (e.g., import { foo } from '@/store/types')?? instead of || for default values (unless intentionally checking for falsy)@Component, @Prop, @Watch)
@Prop -> Data fields -> Getters -> @Watch -> Lifecycle Hooks -> Methodsthis.$set(obj, key, val) for adding new properties to objectsthis.$set(arr, index, val) or .splice() for array modificationstype, required, and default where applicablema-2, pa-0, d-flex) whenever possible instead of custom CSS.@mdi/js (e.g., mdiInformation)$t(), no hardcoded stringssrc/locales/ must have sorted keys (case-insensitive, enforced by ESLint/Prettier)Ensure adherence to code style guidelines
Verify TypeScript types and interfaces
New strings added to en.json (alphabetically sorted)
No raw
console.log statements in production code. For intentional debug/logging output, define a module-scoped
log() helper that wraps console.log with a descriptive prefix (e.g., [WebRTC camera-streamer]), and use it
consistently within that file. See WebrtcCameraStreamer.vue for a reference implementation.
Performance: Use
@Debounce(ms) for inputs triggering API calls, throttle() for resize handlers
Cleanup in
: Remove event listeners, clear timers, disconnect observers, dispose ECharts, close
WebSocket/WebRTC connectionsbeforeDestroy
No Dead Code: Remove unused variables, imports, and commented-out code blocks.
Early Returns: Use guard clauses to handle edge cases early and avoid deep nesting of
if/else statements.
Single Responsibility: Functions and classes should do one thing and do it well. If a function exceeds 20-30 lines, consider refactoring.
Magic Numbers: Use named constants instead of raw numbers. The name should explain the meaning.
// Bad if (status === 3) { ... } // Good const STATUS_PRINTING = 3 if (status === STATUS_PRINTING) { ... }
develop branch (not master)fix:, feat:, docs:)Signed-off-by: Name <[email protected]>npm run format && npm run lint:fix before committing