agentleFS
Thank-you-LinusThank-you-Linus/Linus-Dashboard/.aidriven/AGENTS.md

Linus-Dashboard

AGENTS.md214 starsChanged 31 days agoMITView on GitHub

Contribution rules, including the frontend build, which is never committed, are in the root AGENTS.md. It wins over this file.

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository10 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

47 rules. About 0 are common, 29 are distinctive, and 18 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈29

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 18

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test embedded dashboards (if configured)

    line 79
  2. Distinctive:

    Check version compatibility warning

    line 80
  3. Distinctive:

    Always clear browser cache after updates (cache issues are common)

    line 86
  4. Very specific:

    Use async/await for asynchronous operations

    line 105
  5. Distinctive:

    No blocking operations in dashboard generation

    line 107
  6. Distinctive:

    Use path aliases when configured

    line 110
  7. Distinctive:

    Use type aliases for unions

    line 117
  8. Very specific:

    Avoid any (use unknown if necessary)

    line 118
  9. Distinctive:

    Always await async calls

    line 133
  10. Very specific:

    Use asyncio.gather() for parallel operations

    line 134
  11. Very specific:

    Use aiohttp not requests

    line 135
  12. Very specific:

    Use async_setup and async_setup_entry

    line 144
  13. Very specific:

    Check integration is loaded: grep "Setting up Linus Dashboard" /config/home-assistant.log

    line 166
  14. Distinctive:

    Check panel registration: Look for "Registered WebSocket command"

    line 167
  15. Distinctive:

    Check resources are loaded: Browser DevTools → Network tab

    line 168
  16. Distinctive:

    Check browser console for errors

    line 171
  17. Distinctive:

    Verify Mushroom and other cards are loaded

    line 172
  18. Distinctive:

    Check entity IDs are valid

    line 173
  19. Distinctive:

    Always clear cache after updates (Ctrl+Shift+R)

    line 177
  20. Distinctive:

    Check version query parameter is appended to resources

    line 178
  21. Distinctive:

    Check manifest version matches bundle version

    line 179
  22. Very specific:

    Run npm run type-check to find issues

    line 182
  23. Distinctive:

    Check imports are correct

    line 183
  24. Distinctive:

    Verify types match Home Assistant data structures

    line 184
  25. Very specific:

    Check manifest.json is valid JSON

    line 188
  26. Very specific:

    Check requirements are satisfied

    line 189
  27. Distinctive:

    Check Python syntax errors

    line 190
  28. Distinctive:

    Check logs for stack traces

    line 191
  29. Very specific:

    Check files exist in www/ directory

    line 194
  30. Distinctive:

    Check static path registration succeeded

    line 195
  31. Distinctive:

    Check resource registration logs

    line 196
  32. Distinctive:

    Verify version query parameter

    line 197
  33. Very specific:

    Check command is registered in async_setup

    line 200
  34. Distinctive:

    Verify command decorator syntax

    line 201
  35. Distinctive:

    Check response format matches expected schema

    line 202
  36. Distinctive:

    When releasing a new version, update ALL of these files:

    line 207
  37. Very specific:

    Create src/views/XxxView.ts extending AbstractView

    line 228
  38. Very specific:

    Add icon to src/variables.ts → VIEWS_ICONS

    line 231
  39. Distinctive:

    Test card generation and navigation

    line 232
  40. Very specific:

    Use in relevant view's getCards() method

    line 237
  41. Distinctive:

    Test rendering with sample entities

    line 238
  42. Very specific:

    Add constant to custom_components/linus_dashboard/const.py

    line 241
  43. Very specific:

    Update config_flow.py to include in options flow

    line 242
  44. Very specific:

    Update websocket_get_entities in __init__.py to include in response

    line 243
  45. Very specific:

    Add translations to translations/en.json and translations/fr.json

    line 245
  46. Distinctive:

    Debouncing: Avoid regenerating dashboard on every state change

    line 259
  47. Distinctive:

    Large Installs: Test with 500+ entities to ensure performance

    line 261

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Agent Guidelines for Linus Dashboard

Contribution rules, including the frontend build, which is never committed, are in the root AGENTS.md. It wins over this file.

Build/Lint/Test Commands

Frontend (TypeScript)

  • Build production: npm run build or make build
  • Build development: npm run build:dev or make build-watch (watch mode)
  • Type check: npm run type-check
  • Lint: npm run lint or make lint
  • Lint check: npm run lint:check

Backend (Python)

  • Format: python3 -m ruff format .
  • Lint: python3 -m ruff check .

Home Assistant

  • Start HA: ./ha-env/bin/hass -c /config or make dev
  • Check config: ./ha-env/bin/hass -c /config --script check_config
  • Stop HA: pkill -f "hass -c /config"

Testing on Home Assistant

Starting Home Assistant

# From workspace root
cd /workspaces/Linus-Dashboard

# Start HA (normal mode)
./ha-env/bin/hass -c /config

# Start in debug mode
./ha-env/bin/hass -c /config --debug

Access

  • Web UI: http://localhost:8123
  • Config directory: /config/
  • Custom component: /config/custom_components/linus_dashboard/
  • Frontend bundles: /config/custom_components/linus_dashboard/www/
  • Logs: /config/home-assistant.log

Useful Commands

# Stop HA
pkill -f "hass -c /config"

# Watch logs (filter for Linus Dashboard)
tail -f /config/home-assistant.log | grep linus_dashboard

# Watch logs (all)
tail -f /config/home-assistant.log

# Check integration is loaded
grep "Setting up Linus Dashboard" /config/home-assistant.log

# Clear browser cache after updates
# Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)

Testing Workflow

  1. Make changes to TypeScript files in src/
  2. Build the frontend:
    npm run build  # or npm run build:dev for watch mode
  3. Verify output in custom_components/linus_dashboard/www/linus-strategy.js
  4. Restart Home Assistant:
    pkill -f hass && ./ha-env/bin/hass -c /config
  5. Clear browser cache (Ctrl+Shift+R)
  6. Open Linus Dashboard (bow-tie icon in sidebar)
  7. Check browser console (F12) for errors
  8. Test features:
    • Navigate to different views (areas, domains)
    • Test embedded dashboards (if configured)
    • Check version compatibility warning
    • Verify card rendering

Important Notes

  • Custom component is in /config/custom_components/linus_dashboard/
  • Frontend bundles MUST be rebuilt after TypeScript changes
  • Always clear browser cache after updates (cache issues are common)
  • Version in manifest.json must match version in package.json and src/linus-strategy.ts
  • Resources are cache-busted with ?v=X.X.X query parameter

Code Style Guidelines

TypeScript (Frontend)

  • Naming:
    • Classes: PascalCase (e.g., LinusStrategy, AreaView)
    • Functions/methods: camelCase (e.g., getCards, generateDashboard)
    • Constants: UPPER_SNAKE_CASE (e.g., AGGREGATE_DOMAINS, DOMAIN)
    • Private methods: _camelCase (e.g., _processView)
  • Functions:
    • Max 50 lines
    • Type all parameters and return values
    • JSDoc comments for public methods
    • Single responsibility principle
    • Early returns for guard clauses
  • Async:
    • Use async/await for asynchronous operations
    • Handle errors with try/catch
    • No blocking operations in dashboard generation
  • Imports:
    • Group imports: External → Home Assistant types → Local
    • Use path aliases when configured
  • Error handling:
    • Log errors to console with [Linus Dashboard] prefix
    • Provide fallbacks for non-critical failures
    • Throw errors for critical failures (breaks dashboard)
  • Types:
    • Define interfaces for complex objects
    • Use type aliases for unions
    • Avoid any (use unknown if necessary)

Python (Backend)

  • Naming:
    • snake_case for functions/variables
    • PascalCase for classes
    • UPPER_SNAKE_CASE for constants
    • _private for private methods
  • Functions:
    • Max 50 lines
    • Type hints required
    • Docstrings for public functions
    • Single responsibility
    • Early returns
  • Async:
    • Always await async calls
    • Use asyncio.gather() for parallel operations
    • Use aiohttp not requests
    • Handle CancelledError
  • Imports:
    • Standard lib → Third-party → Home Assistant → Local
  • Error handling:
    • Specific exceptions
    • Appropriate logging levels
    • HomeAssistantError for user-facing errors
  • HA patterns:
    • Use async_setup and async_setup_entry
    • Store data in hass.data[DOMAIN][entry_id]
    • Cleanup in async_unload_entry
    • Register resources with cache-busting

Build Configuration

  • Rspack:
    • Production config: rspack.config.cjs (minified)
    • Development config: rspack.dev.config.cjs (source maps, watch)
    • Output to custom_components/linus_dashboard/www/
  • Babel:
    • Transpile for browser compatibility
    • Target modern browsers (ES2020)
  • TypeScript:
    • Strict mode enabled
    • No implicit any
    • Check all files

Debugging Tips

Frontend Issues

  1. Dashboard not appearing:
    • Check integration is loaded: grep "Setting up Linus Dashboard" /config/home-assistant.log
    • Check panel registration: Look for "Registered WebSocket command"
    • Check resources are loaded: Browser DevTools → Network tab
  2. Cards not rendering:
    • Check browser console for errors
    • Verify Mushroom and other cards are loaded
    • Check entity IDs are valid
    • Verify area assignments
  3. Cache issues:
    • Always clear cache after updates (Ctrl+Shift+R)
    • Check version query parameter is appended to resources
    • Check manifest version matches bundle version
  4. TypeScript errors:
    • Run npm run type-check to find issues
    • Check imports are correct
    • Verify types match Home Assistant data structures

Backend Issues

  1. Integration not loading:
    • Check manifest.json is valid JSON
    • Check requirements are satisfied
    • Check Python syntax errors
    • Check logs for stack traces
  2. Resources not loading:
    • Check files exist in www/ directory
    • Check static path registration succeeded
    • Check resource registration logs
    • Verify version query parameter
  3. WebSocket errors:
    • Check command is registered in async_setup
    • Verify command decorator syntax
    • Check response format matches expected schema

Version Management

Updating Version

When releasing a new version, update ALL of these files:

  1. package.json → "version": "X.X.X"
  2. custom_components/linus_dashboard/manifest.json → "version": "X.X.X"
  3. custom_components/linus_dashboard/const.py → VERSION = "X.X.X"
  4. src/linus-strategy.ts → Update version comment if present
  5. README.md → Update badge if present

Use version-bump-prompt:

npm run bump:release  # Automatically updates all files

Cache-Busting

  • Resources are loaded with ?v=X.X.X query parameter
  • This forces browsers to fetch new version after updates
  • Version is read from manifest.json via get_version() function
  • Critical for avoiding "red error" issues after updates

Common Patterns

Adding a New View

  1. Create src/views/XxxView.ts extending AbstractView
  2. Implement getCards() method
  3. Register in src/linus-strategy.ts → createDomainSubviews()
  4. Add icon to src/variables.ts → VIEWS_ICONS
  5. Test card generation and navigation

Adding a New Card Type

  1. Create src/cards/XxxCard.ts extending AbstractCard
  2. Implement getCard(entity, options) method
  3. Use in relevant view's getCards() method
  4. Test rendering with sample entities

Adding a New Configuration Option

  1. Add constant to custom_components/linus_dashboard/const.py
  2. Update config_flow.py to include in options flow
  3. Update websocket_get_entities in __init__.py to include in response
  4. Access in TypeScript via Helper.strategyOptions.xxx
  5. Add translations to translations/en.json and translations/fr.json

Embedded Dashboard Support

  1. User configures embedded dashboard in integration options
  2. Frontend receives list via WebSocket
  3. embedLovelace.ts → loadEmbeddedDashboard() fetches dashboard config
  4. processEmbeddedViews() extracts cards and metadata
  5. Views are injected into Linus Dashboard with proper styling

Performance Considerations

  • Lazy Loading: Views are generated on-demand, not all at once
  • Entity Filtering: Filter entities early in the pipeline
  • Caching: Helper singleton caches hass state
  • Debouncing: Avoid regenerating dashboard on every state change
  • Bundle Size: Watch the size reported by npm run build
  • Large Installs: Test with 500+ entities to ensure performance

Testing Checklist

Before releasing:

  • TypeScript compiles without errors (npm run type-check)
  • ESLint passes (npm run lint:check)
  • Production build succeeds (npm run build)
  • Bundle size is reasonable (reported by npm run build)
  • Home Assistant loads integration without errors
  • Dashboard appears in sidebar with bow-tie icon
  • All views render correctly (areas, domains, home)
  • Cards interact correctly (click, toggle, etc.)
  • Embedded dashboards work (if configured)
  • Version check works (test with mismatched versions)
  • Translations are complete (English and French)
  • Cache-busting works (test by updating version)
  • Works on mobile devices (responsive design)
  • No console errors in browser
  • No errors in Home Assistant logs

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.