|
| 1 | +# Agent Instructions for Stream Deck iCal Plugin |
| 2 | + |
| 3 | +This document provides guidance for AI agents working on this codebase. |
| 4 | + |
| 5 | +## Project Context |
| 6 | + |
| 7 | +This is a Stream Deck plugin that displays iCal calendar events. See `.github/copilot-instructions.md` for detailed SDK patterns, common issues, and project-specific guidance. |
| 8 | + |
| 9 | +## Key Files |
| 10 | + |
| 11 | +| File | Purpose | |
| 12 | +|------|---------| |
| 13 | +| `.github/copilot-instructions.md` | SDK patterns, common issues, release process | |
| 14 | +| `src/actions/base-action.ts` | Base class with per-button state management | |
| 15 | +| `src/services/calendar-manager.ts` | Multi-calendar support with reference counting | |
| 16 | +| `src/services/recurrence-expander.ts` | RRULE expansion and RECURRENCE-ID handling | |
| 17 | +| `tests/` | Vitest test files | |
| 18 | +| `__fixtures__/` | Test fixtures organized by provider | |
| 19 | + |
| 20 | +## Testing Requirements |
| 21 | + |
| 22 | +Every code change MUST include corresponding tests: |
| 23 | +- **New features**: Unit tests for happy path and edge cases |
| 24 | +- **Bug fixes**: Regression tests that would have caught the bug |
| 25 | +- **Refactoring**: Ensure existing tests pass |
| 26 | + |
| 27 | +Always run `npm test` before completing work. |
| 28 | + |
| 29 | +## Template Collaboration Protocol |
| 30 | + |
| 31 | +This plugin is part of the **stream-deck-template** knowledge-sharing ecosystem. |
| 32 | +All Stream Deck plugins share the same SDK, hardware constraints, and pitfalls. |
| 33 | +Learnings discovered here benefit every other plugin. |
| 34 | + |
| 35 | +- **Template repo**: https://github.com/pedrofuentes/stream-deck-template |
| 36 | +- **This plugin's contributions**: `contributions/ical.md` in the template repo |
| 37 | +- **Consolidated knowledge**: `LEARNINGS.md` in the template repo |
| 38 | + |
| 39 | +### Reading Knowledge From the Template |
| 40 | + |
| 41 | +Before starting major work on a new feature, refactor, or release, fetch and read |
| 42 | +the latest `LEARNINGS.md` from the template: |
| 43 | + |
| 44 | +``` |
| 45 | +https://raw.githubusercontent.com/pedrofuentes/stream-deck-template/main/LEARNINGS.md |
| 46 | +``` |
| 47 | + |
| 48 | +This contains detailed, code-level patterns for: |
| 49 | +- SVG rendering compatibility and OLED-tested color palettes |
| 50 | +- Property Inspector patterns (popup windows, dropdown hydration, FilterableSelect, settings race conditions) |
| 51 | +- Architecture patterns (global settings pub/sub, service layer isolation, PollingCoordinator, resource managers) |
| 52 | +- Adaptive polling, rate limit handling, key-press cycling, short/long press detection |
| 53 | +- Marquee animations, compact number formatting, accent bar layout, viewport-aware dropdowns |
| 54 | +- Testing patterns (singleton store resets, fixture organization, SVG assertion helpers) |
| 55 | +- Build pipeline, validate:consistency script, release checklist, PI verification gate |
| 56 | +- Common mistakes table with 23+ entries |
| 57 | + |
| 58 | +### Contributing Knowledge Back |
| 59 | + |
| 60 | +After completing significant work, **proactively offer** to contribute new learnings |
| 61 | +to the template. This is expected — not optional. |
| 62 | + |
| 63 | +**How:** |
| 64 | +1. Fetch the template's contribution file for this plugin: |
| 65 | + `https://raw.githubusercontent.com/pedrofuentes/stream-deck-template/main/contributions/ical.md` |
| 66 | +2. Read it to understand what has already been contributed |
| 67 | +3. Write new findings using the format below |
| 68 | +4. Push to the template repo (clone it, or ask the user to switch workspaces) |
| 69 | +5. Commit with: `docs(ical): add learnings about <topic>` |
| 70 | + |
| 71 | +**Contribution format:** |
| 72 | +```markdown |
| 73 | +## [Category] — [Short Title] |
| 74 | + |
| 75 | +**Discovered in**: ical |
| 76 | +**Date**: <date> |
| 77 | +**Severity**: critical | important | nice-to-know |
| 78 | + |
| 79 | +**Problem**: What went wrong or what was unclear |
| 80 | +**Solution**: What fixed it |
| 81 | +**Code example** (if applicable) |
| 82 | +**Prevention**: How to avoid this in the future |
| 83 | +``` |
| 84 | + |
| 85 | +**When to offer a contribution:** |
| 86 | +- After solving a non-obvious bug or hardware quirk |
| 87 | +- After implementing a reusable pattern (polling, caching, UI component) |
| 88 | +- After discovering a manifest or SDK constraint |
| 89 | +- After a release (summarize what was learned) |
| 90 | +- After refactoring something that other plugins also have |
| 91 | +- When the session is wrapping up and the user asks "anything else?" |
| 92 | + |
| 93 | +**When NOT to contribute:** |
| 94 | +- Plugin-specific business logic (API response parsing unique to this plugin) |
| 95 | +- Trivial fixes that don't generalize |
| 96 | +- Things already covered in `LEARNINGS.md` |
| 97 | + |
| 98 | +### Checking for Updates From Other Plugins |
| 99 | + |
| 100 | +Other plugins may have discovered patterns that help this one. Before a release |
| 101 | +or when troubleshooting, check if `LEARNINGS.md` has new entries by fetching and |
| 102 | +scanning the sections relevant to the current task. |
| 103 | + |
| 104 | +### Template Companion Guides |
| 105 | + |
| 106 | +The template also maintains merged guides that this plugin may benefit from: |
| 107 | + |
| 108 | +| Guide | URL | |
| 109 | +|-------|-----| |
| 110 | +| Testing Protocol | `https://raw.githubusercontent.com/pedrofuentes/stream-deck-template/main/scaffold/.github/TESTING-PROTOCOL.md` | |
| 111 | +| UI/UX Design Guide | `https://raw.githubusercontent.com/pedrofuentes/stream-deck-template/main/scaffold/.github/UI-DESIGN-GUIDE.md` | |
| 112 | + |
| 113 | +Read these before writing tests or making UI changes — they contain hardware-tested |
| 114 | +patterns and failure logs from multiple plugins. |
0 commit comments