diff --git a/.github/GITHUB_AUTH_SETUP.md b/.github/GITHUB_AUTH_SETUP.md new file mode 100644 index 0000000..19d6946 --- /dev/null +++ b/.github/GITHUB_AUTH_SETUP.md @@ -0,0 +1,171 @@ +# GitHub Authentication Setup Guide + +This guide helps you set up authentication for GitHub CLI and the mcp_github tools. + +## Current Status ✅ + +Your system is already configured with: +- **GitHub CLI**: v2.52.0 installed +- **Primary Account**: `ericthayer` (Active & Authenticated) +- **Token Scopes**: gist, read:org, repo, workflow +- **Protocol**: HTTPS +- **Storage**: Keyring (secure credential storage) + +## Option 1: Use GitHub CLI for PR Creation (Recommended) + +### Create PR with `gh` CLI + +Use your terminal to create the PR directly: + +```bash +cd /Users/thayere/Documents/_DEV/devlog + +# Create PR using the pr-template-commits.md file +gh pr create \ + --title "perf: Restructure project, add AI guidance system, and testing infrastructure" \ + --body "$(cat .github/pr-template-commits.md)" \ + --base main \ + --head feat/update-logic +``` + +**Or interactively:** + +```bash +gh pr create --base main --head feat/update-logic +``` + +The interactive mode will prompt you for: +- Title (auto-fill from commit suggested) +- Body (open editor) +- Additional options + +### Verify PR Creation + +```bash +# List your open PRs +gh pr list --state open + +# View specific PR +gh pr view +``` + +## Option 2: Configure GitHub Token for mcp_github Tools + +The mcp_github tools require a GitHub personal access token (PAT) via environment variable. + +### Step 1: Generate a Personal Access Token + +1. Go to: https://github.com/settings/tokens/new +2. Fill in: + - **Token name**: `devlog-mcp` + - **Expiration**: 90 days (or your preference) + - **Scopes**: Select these: + - ✅ `repo` (full control of private repositories) + - ✅ `workflow` (manage GitHub Actions workflows) + - ✅ `read:org` (read access to organization) + - ✅ `gist` (create and manage gists) + +3. Click **Generate token** +4. Copy the token (starts with `ghp_` or `gho_`) + +### Step 2: Configure Environment Variable + +Add the token to your `.env` file: + +```bash +# In /Users/thayere/Documents/_DEV/devlog/.env +GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxx +``` + +Or set it in your shell: + +```bash +# Bash/Zsh +export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxx + +# Add to ~/.zshrc for persistence +echo 'export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxx' >> ~/.zshrc +source ~/.zshrc +``` + +### Step 3: Verify Token + +```bash +# Test with curl +curl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/user +``` + +Should return your GitHub user information. + +## Option 3: Re-authenticate if Needed + +If your token expires or you need to update: + +```bash +# Re-authenticate with GitHub CLI +gh auth login -h github.com + +# You'll be prompted to choose: +# - Protocol: HTTPS +# - Authentication: Paste your token +# - Set as default account: Yes + +# Verify new authentication +gh auth status +``` + +## Troubleshooting + +### "404 Not Found" Error +- **Cause**: Repository doesn't exist at specified owner/repo +- **Fix**: Verify you're using the correct owner (`ericthayer`) and repo (`devlog`) + +### "403 Unauthorized" Error +- **Cause**: Token lacks required scopes or is invalid +- **Fix**: Generate new PAT with `repo`, `workflow`, `read:org` scopes + +### Token Not Found +- **Cause**: `GITHUB_TOKEN` environment variable not set +- **Fix**: Add token to `.env` or shell profile + +### Multiple Accounts +You have multiple accounts configured. To use specific account: + +```bash +# Switch active account +gh auth select +# or +gh auth switch -u ericthayer +``` + +## Security Best Practices + +1. **Never commit tokens** - `.env` is in `.gitignore` +2. **Use keyring storage** - GitHub CLI stores tokens securely +3. **Set expiration** - PATs should expire in 30-90 days +4. **Rotate regularly** - Delete old tokens from Settings +5. **Minimal scopes** - Only grant required permissions + +## Files Created + +- `.github/pr-template-commits.md` - PR description template (can be copied to GitHub) +- `.github/GITHUB_AUTH_SETUP.md` - This authentication guide + +## Quick Reference + +| Task | Command | +|------|---------| +| Check auth status | `gh auth status` | +| Create PR | `gh pr create --base main --head feat/update-logic` | +| List PRs | `gh pr list --state open` | +| View PR | `gh pr view ` | +| Re-auth | `gh auth login -h github.com` | +| Export token | `echo $GITHUB_TOKEN` | + +## Next Steps + +1. ✅ GitHub CLI already authenticated as `ericthayer` +2. 🔄 Option A: Create PR with `gh pr create` (easiest) +3. 🔄 Option B: Generate PAT and set `GITHUB_TOKEN` for mcp_github tools + +Both options will work - choose based on your preference! diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 0000000..a84a792 --- /dev/null +++ b/.github/README.md @@ -0,0 +1,328 @@ +# DevLog AI Guidance System + +This directory contains a comprehensive framework for AI-assisted development, ensuring consistency, quality, and adherence to best practices across the project. + +## 📁 Directory Structure + +``` +.github/ +├── README.md # This file +├── copilot-instructions.md # Main AI architecture guide +├── GITHUB_AUTH_SETUP.md # GitHub authentication setup +├── pr-template-commits.md # PR description template +├── instructions/ # Scope-specific guidelines +│ ├── development-standards.instructions.md +│ ├── web-interface-guidelines.instructions.md +│ ├── github-issue.instructions.md +│ ├── github-release-notes.instructions.md +│ └── storybook.instructions.md +├── rules/ # Architectural principles +│ ├── accessibility.md +│ ├── component-architecture.md +│ ├── react-19-compiler.md +│ ├── spec-driven-development.md +│ ├── supabase.md +│ ├── tailwind-v4.md +│ ├── three-js-react.md +│ └── web-performance.md +├── skills/ # Executable workflows +│ ├── accessibility_audit/ +│ ├── scaffold_component/ +│ ├── vercel-react-best-practices/ +│ └── workflows/ +└── prompts/ # Agent prompt templates + └── create-pr.prompt.md +``` + +## 🎯 Three-Layer Framework + +### Layer 1: Instructions (Scope-Specific) + +Files in `instructions/` apply to specific file types or contexts using frontmatter: + +```yaml +--- +applyTo: '**/*.tsx' +--- +``` + +**When these apply:** +- Automatically loaded by AI when working with matching files +- Referenced in code reviews for specific file types +- Used to enforce patterns on particular scopes + +**Key files:** +- `development-standards.instructions.md` - TypeScript/React standards, Airbnb style, APCA contrast +- `web-interface-guidelines.instructions.md` - MUST/SHOULD/NEVER UI rules, accessibility (24px targets, keyboard) +- `github-issue.instructions.md` - Issue template and format +- `github-release-notes.instructions.md` - Release notes structure +- `storybook.instructions.md` - Storybook usage patterns + +### Layer 2: Rules (Architectural Principles) + +Files in `rules/` define non-negotiable architectural patterns: + +**When to reference:** +- Making architectural decisions +- Designing new features +- Reviewing code structure +- Setting up infrastructure + +**Key files:** +- `component-architecture.md` - Folder-per-component with named exports +- `spec-driven-development.md` - Create SPEC.md before coding ("Zero Vibe Rule") +- `supabase.md` - Database, auth, RLS, storage best practices +- `accessibility.md` - WCAG compliance requirements +- `react-19-compiler.md` - React 19 optimization patterns +- `web-performance.md` - Performance optimization guidelines + +### Layer 3: Skills (Executable Workflows) + +Files in `skills/` provide step-by-step workflows: + +**When to use:** +- Creating new components +- Running audits +- Following complex procedures +- Applying best practice patterns + +**Key skills:** + +#### `scaffold_component/` +Component creation workflow with SDD: +1. Create SPEC.md with requirements +2. Generate component structure +3. Implement with tests +4. Document in Storybook + +#### `accessibility_audit/` +Comprehensive accessibility testing: +- Keyboard navigation check +- Screen reader compatibility +- Color contrast validation +- ARIA attributes review + +#### `vercel-react-best-practices/` +45 performance rules across 8 categories: +- **Async** (7 rules) - API routes, dependencies, parallel fetching, suspense +- **Bundle** (6 rules) - Dynamic imports, barrel imports, tree shaking +- **Client** (4 rules) - Event listeners, localStorage, SWR dedup +- **JS** (11 rules) - Caching, batching, early exits +- **Rendering** (8 rules) - SVG, hydration, transitions +- **Re-render** (10 rules) - Memo, derived state, lazy init +- **Server** (7 rules) - Auth, caching, serialization + +## 🚀 How to Use This System + +### For Developers + +#### Starting a New Feature + +1. **Check Instructions** + - Read relevant `instructions/` files for your file types + - Example: Building a component? Read `web-interface-guidelines.instructions.md` + +2. **Review Rules** + - Understand architectural constraints + - Example: New component? Follow `component-architecture.md` folder structure + +3. **Follow Skills** + - Use workflow templates + - Example: Run `scaffold_component/` to create proper structure + +4. **Reference in PRs** + - Cite specific rules when reviewing + - Link to guidance files in comments + +#### Making Changes + +```bash +# Before coding a component +cat .github/rules/component-architecture.md +cat .github/instructions/web-interface-guidelines.instructions.md + +# During development +# Follow patterns in .github/skills/scaffold_component/ + +# Before PR +cat .github/pr-template-commits.md +``` + +### For AI Assistants + +The guidance system is automatically integrated into AI tools: + +**GitHub Copilot:** +- Reads `copilot-instructions.md` for architecture +- Applies `instructions/` files based on `applyTo` patterns +- References `rules/` for decision-making + +**Creating Features:** +1. Read relevant `instructions/` and `rules/` +2. Generate code following patterns +3. Reference `skills/` for workflows +4. Use `prompts/` for common tasks + +### Common Workflows + +#### Creating a New Component + +```bash +# 1. Review guidance +cat .github/rules/component-architecture.md +cat .github/rules/spec-driven-development.md + +# 2. Create SPEC.md first (SDD) +# Document requirements, props, behavior + +# 3. Scaffold component following folder pattern +mkdir src/components/MyComponent +touch src/components/MyComponent/{MyComponent.tsx,index.ts,SPEC.md} + +# 4. Implement with accessibility in mind +cat .github/instructions/web-interface-guidelines.instructions.md +``` + +#### Running an Accessibility Audit + +```bash +# Follow the checklist +cat .github/skills/accessibility_audit/SKILL.md + +# Check key requirements: +# - 24px × 24px minimum hit targets +# - APCA contrast ≥60 (normal) / ≥45 (large) +# - Keyboard navigation functional +# - Screen reader labels present +``` + +#### Optimizing Performance + +```bash +# Review best practices +cat .github/skills/vercel-react-best-practices/SKILL.md + +# Check specific patterns +cat .github/skills/vercel-react-best-practices/rules/rerender-memo.md +cat .github/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +``` + +## 📖 Key Concepts + +### Spec-Driven Development (SDD) + +From `rules/spec-driven-development.md`: + +> Create SPEC.md BEFORE writing code. No exceptions. + +**The "Zero Vibe Rule":** If you're coding based on vibes, stop and write the spec. + +**Template:** +```markdown +# Component/Feature Name + +## Purpose +[Why this exists] + +## Requirements +- [ ] Requirement 1 +- [ ] Requirement 2 + +## API/Props +[Interface definition] + +## Behavior +[How it works] + +## Changelog +[Track changes to spec during implementation] +``` + +### Folder-per-Component + +From `rules/component-architecture.md`: + +``` +src/components/MyComponent/ +├── MyComponent.tsx # Implementation +├── MyComponent.test.tsx # Tests +├── index.ts # export { MyComponent } from './MyComponent' +└── SPEC.md # Specification +``` + +**Why:** Encapsulation, discoverability, and maintainability. + +### Accessibility First + +From `instructions/web-interface-guidelines.instructions.md`: + +**MUST:** +- Hit targets ≥24px × 24px +- APCA contrast ≥60 (normal text) +- Full keyboard navigation +- Proper ARIA labels + +**SHOULD:** +- Focus indicators visible +- Skip links for navigation +- Semantic HTML + +## 🔄 Updating the Guidance System + +### When to Update + +- **New patterns emerge** → Add to `rules/` +- **Common mistakes** → Add to `instructions/` +- **Repeated workflows** → Create in `skills/` +- **File type standards** → Update `instructions/` `applyTo` patterns + +### How to Update + +1. **Create/edit file** in appropriate directory +2. **Test with AI** to verify it's followed correctly +3. **Document in this README** if structural change +4. **Update `copilot-instructions.md`** if architecture changes +5. **Commit with `docs:` prefix** + +### File Naming + +- **Instructions:** `topic.instructions.md` +- **Rules:** `topic.md` +- **Skills:** `skill-name/SKILL.md` +- **Prompts:** `action-name.prompt.md` + +## 🛠️ Utilities + +### GitHub Authentication +See [GITHUB_AUTH_SETUP.md](GITHUB_AUTH_SETUP.md) for: +- GitHub CLI setup +- Personal access token generation +- mcp_github tools configuration + +### PR Templates +Use [pr-template-commits.md](pr-template-commits.md) for consistent PR descriptions. + +### Prompts +Reusable AI prompts in `prompts/`: +- `create-pr.prompt.md` - Automated PR creation from commits + +## 📚 Additional Resources + +- **[copilot-instructions.md](copilot-instructions.md)** - Complete architecture guide for AI +- **[CONTRIBUTING.md](../CONTRIBUTING.md)** - Developer contribution guide +- **[AGENTS.md](../AGENTS.md)** - AI agent-specific guidelines +- **[README.md](../README.md)** - Project overview + +## 💡 Philosophy + +This guidance system embodies: + +1. **Explicit over Implicit** - Written standards beat tribal knowledge +2. **Automation over Documentation** - Executable workflows beat manuals +3. **Consistency over Cleverness** - Predictable patterns beat one-off solutions +4. **Accessibility First** - Inclusive design is not optional +5. **Performance by Default** - Optimization patterns built-in + +--- + +**Questions?** See [CONTRIBUTING.md](../CONTRIBUTING.md) or open a discussion. diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..20a1344 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,200 @@ +# Copilot Instructions - DevLog (Brutalist Case Study Engine) + +## Project Overview +A React + TypeScript app for generating UX/FE case studies from design artifacts using Gemini AI. Brutalist UI aesthetic with yellow/black theme. Now includes role-based authentication (publisher/reader). + +**IMPORTANT!** Before you start a task, or make a new change, follow these _rules_: + +- DO NOT change the visual design, theme styling, or composition of the UI once a `checkpoint`, and/or a component or pattern has been established. + +- DO NOT revert any "styling" (CSS/Layout) or "scripting" (TS/JSX) change intentionally made by me. + +- DO NOT make changes outside the scope of the requested feature, i.e., don't modify the main navigation when asked to build a data table. + +- ALWAYS break out code into reusable components ready for export via ES module + +## Development Guidelines - Standards and Best Practices +Refer to the `.github/instructions/development-standards.instructions.md` file for detailed coding standards and best practices. + +## Agent Instructions +When contributing to the DevLog application with AI chat agents, please adhere to the following guidelines: `./AGENTS.md` + +## Architecture & Data Flow + +### Authentication & Authorization +- **Roles**: `publisher` (full CRUD) and `reader` (read-only published content) +- **Sign-up Flow**: New users default to `reader` role; can request publisher access +- **Publisher Requests**: Tracked in `user_roles.publisher_requested` column for admin approval +- **OAuth Support**: Google and GitHub providers enabled via Supabase Auth +- **Auth Pattern**: App checks `user` from context, shows [LoginView](src/components/LoginView.tsx) if not authenticated +- **Permission Checks**: Pass `canEdit` (bool) down to components based on `user.role === 'publisher'` + +### Three-Layer Data System +1. **Supabase (Primary)**: PostgreSQL database + Storage bucket for production data +2. **LocalStorage (Secondary)**: Browser persistence fallback (`devsigner_data_v3` key) +3. **Demo Data**: Default content in `src/utils/demoData.ts` if no data exists + +**Critical Pattern**: [App.tsx](src/App.tsx#L52-L88) loads Supabase first, then overlays localStorage synchronously (they race). DB write operations in `src/services/dbService.ts` handle BOTH database records AND storage uploads. + +### Authentication & Authorization +- **AuthContext**: [contexts/AuthContext.tsx](src/contexts/AuthContext.tsx) manages auth state with Supabase Auth +- **Roles**: `publisher` (full CRUD) and `reader` (read-only published content) +- **User Roles Table**: Links `auth.users` to roles in `user_roles` table +- **RLS Policies**: Database-level permissions enforce role-based access (see [supabase/migrations/001_auth_and_rls.sql](supabase/migrations/001_auth_and_rls.sql)) + +**Auth Pattern**: App checks `user` from context, shows [LoginView](src/components/LoginView.tsx) if not authenticated. Pass `canEdit` (bool) down to components based on `user.role === 'publisher'`. + +### Database Schema Mapping +**Frontend (camelCase) ↔ Database (snake_case)**: +- `nextSteps` ↔ `next_steps` +- `seoMetadata` ↔ `seo_metadata` +- `originalName` ↔ `original_name` +- `aiName` ↔ `ai_name` +- `date` ↔ `created_at` + +Assets use `case_study_id` foreign key. Always map in both directions (see [App.tsx](src/App.tsx#L56-L73) and [dbService.ts](src/services/dbService.ts#L99-L101)). + +## AI-Powered Workflows + +### Asset Analysis +Files uploaded trigger two-phase AI analysis via [geminiService.ts](src/services/geminiService.ts): +1. **analyzeAsset**: Extracts metadata for naming convention `[topic]-[type]-[context]-[variant]-[version].[ext]` +2. **generateCaseStudy**: Synthesizes all assets into structured case study + +**Models Used**: +- `gemini-2.5-flash`: With thinking mode (set `thinkingBudget` + `maxOutputTokens` together) +- `gemini-2.0-flash`: Faster, no thinking mode + +All Gemini calls use typed JSON schemas via `responseSchema` parameter. + +### Storage Upload Pattern +[dbService.ts](src/services/dbService.ts#L54-L78) converts blob URLs to Supabase Storage: +```typescript +if (assetUrl.startsWith('blob:')) { + const blob = await fetch(assetUrl).then(r => r.blob()); + await supabase.storage.from('assets').upload(`${newId}/${asset.aiName}`, blob, { upsert: true }); + assetUrl = supabase.storage.from('assets').getPublicUrl(filePath).data.publicUrl; +} +``` + +## Error Handling Patterns + +### Toast Notifications +[Toast](src/components/Toast.tsx) component displays error messages. Usage pattern in [App.tsx](src/App.tsx): +```typescript +const [errorMessage, setErrorMessage] = useState(null); + +// Show error +setErrorMessage(`Failed to save: ${error.message}`); + +// Toast auto-dismisses or user closes +{errorMessage && setErrorMessage(null)} type="error" />} +``` + +### Try-Catch Patterns +- **AI Operations**: Catch and retry without thinking mode if thinking fails ([geminiService.ts](src/services/geminiService.ts#L64-L68)) +- **Database Operations**: Catch, log, show toast, but don't block UI ([App.tsx](src/App.tsx#L284-L290)) +- **File Processing**: Return `null` for failed files, continue processing others ([App.tsx](src/App.tsx#L164-L167)) + +### Optimistic Updates +Save operations update UI immediately, then sync to database. If DB fails, show error but keep optimistic UI state ([App.tsx](src/App.tsx#L337-L345)). + +## Environment Variables +Required in `.env`: +- `VITE_API_KEY`: Google Gemini API key +- `VITE_SUPABASE_URL`: Supabase project URL +- `VITE_SUPABASE_ANON_KEY`: Public anon key (client-side safe) + +## Development Commands +- `npm run dev`: Vite dev server on port 3000 +- `npm run build`: TypeScript compile + Vite build +- `npm test`: Run Vitest tests +- `npm run test:ui`: Interactive test UI +- `npm run test:coverage`: Test coverage report + +## Testing Strategy + +### Test Files Location +Tests in `src/tests/` directory. Name tests `*.test.tsx` or `*.test.ts`. + +### Testing Libraries +- **Vitest**: Test runner (Jest-compatible API) +- **React Testing Library**: Component testing +- **@testing-library/jest-dom**: Custom matchers + +### Running Tests +```bash +npm test # Watch mode +npm run test:ui # Interactive UI +npm run test:coverage # Coverage report +``` + +### Example Test Pattern +See [src/tests/BrutalistButton.test.tsx](src/tests/BrutalistButton.test.tsx) for component testing and [src/tests/geminiService.test.ts](src/tests/geminiService.test.ts) for service mocking. + +## Key Conventions + +### File Uploads +- ZIP files auto-extract (filters by `SUPPORTED_UNPACK_EXTENSIONS` in [App.tsx](src/App.tsx#L27)) +- Files >30MB skip blob URL creation to prevent browser memory issues +- Auto-rename controlled by `preferences.autoRename` (calls Gemini on every file) + +### Component Structure +- **Views**: Full-screen pages (TimelineView, EditorView, ArticleView, SettingsView, LoginView) +- **Modal Components**: ProcessingModal, ManualAssetModal, Toast +- **Contexts**: AuthContext for authentication state +- All use `lucide-react` icons, Tailwind + brutalist yellow/black theme + +### State Management +Single root state in [App.tsx](src/App.tsx) - no Redux/Context except AuthContext. Pass callbacks down for mutations. + +### Permission Checks +Check `canEdit` (derived from `user.role === 'publisher'`) before showing create/edit/delete UI. Readers can only view published case studies. + +## Supabase Configuration + +### Authentication Setup +1. Enable email auth + OAuth (Google, GitHub) in Supabase Dashboard +2. Run migration: [supabase/migrations/001_auth_and_rls.sql](supabase/migrations/001_auth_and_rls.sql) +3. Creates `user_roles` table with publisher/reader roles + `publisher_requested` flag +4. Sets up RLS policies for role-based access + +### OAuth Provider Setup +1. Enable Google/GitHub in Supabase Dashboard → Authentication → Providers +2. Add OAuth credentials from Google Cloud Console / GitHub Developer Settings +3. Set redirect URLs to your deployment URL +4. Users signing in via OAuth default to reader role + +### Publisher Role Approval Workflow +New users can request publisher access during sign-up. Admin approval required: +1. Query: `SELECT * FROM user_roles WHERE publisher_requested = true` +2. Approve: `UPDATE user_roles SET role = 'publisher', publisher_requested = false WHERE user_id = '...'` +3. User must re-login to see updated permissions + +### Storage Bucket Policies +The `assets` bucket needs RLS policies for authenticated access: +```sql +-- Insert policy (publishers only) +CREATE POLICY "Publishers can upload" ON storage.objects FOR INSERT TO authenticated +WITH CHECK (bucket_id = 'assets' AND EXISTS (SELECT 1 FROM user_roles WHERE user_id = auth.uid() AND role = 'publisher')); + +-- Read policy (all authenticated users) +CREATE POLICY "Authenticated users can view assets" ON storage.objects FOR SELECT TO authenticated +USING (bucket_id = 'assets'); +``` + +### Common Issues +- **Authorization errors**: Check RLS policies and user role in `user_roles` table +- **UUID mismatch**: [dbService.ts](src/services/dbService.ts#L5-L7) checks if `id` is UUID before upserting; temp IDs ignored +- **Asset deletion**: On save, old assets for case study are deleted then re-inserted ([dbService.ts](src/services/dbService.ts#L47)) +- **Storage upload fails**: Ensure user is authenticated and has publisher role + +## Styling Notes +- Tailwind + custom brutalist theme in [constants.tsx](src/constants.tsx) +- Yellow (`#fcd34d`) as primary, black borders `border-4 border-black` +- No smooth animations - hard state transitions match brutalist aesthetic +- Error states use red (`#dc2626`), success uses green (`#16a34a`) + +## Deployment +See [DEPLOYMENT.md](DEPLOYMENT.md) for complete deployment guide covering Vercel, Netlify, and Supabase configuration. + diff --git a/.github/instructions/development-standards.instructions.md b/.github/instructions/development-standards.instructions.md new file mode 100644 index 0000000..61a9bf0 --- /dev/null +++ b/.github/instructions/development-standards.instructions.md @@ -0,0 +1,47 @@ +--- +applyTo: '**' +--- +# Development Standards and Best Practices + +This document outlines the standards and best practices for DevLog Application Development which uses React, TypeScript, Material UI, and follows the [Airbnb style guide](https://airbnb.io/javascript/) page. + +## Web Interface Guidelines - Development Standards and Guidelines +ALWAYS refer to the `.github/instructions/web-interface-guidelines.instructions.md` file for detailed explicit guidelines to follow when building _any_ web interface. + +## React + +- **Components**: + - Use PascalCase for filenames. E.g., ReservationCard.jsx. + - Use .tsx extension for React components. + - Use the filename as the component name. + - Only include one React component per file. However, multiple Stateless, or Pure, Components are allowed per file. + - Prefer functional components and use React Hooks for state and side effects. + +- **Props**: + - Always use camelCase for prop names. + - Define prop types using TypeScript interfaces. + - Always define explicit defaultProps for all non-required props. + - Consider using the Context API when passing props more than 2-3 component levels. + - Use spread props sparingly. + +- **JSX/TSX**: + - Keep JSX/TSX readable and concise. + - Extract complex parts into separate functions or components. + - Proper JSX/TSX alignment follows the `react/jsx-closing-bracket-location` and `react/jsx-closing-tag-location` linting rules. + +## TypeScript + +- **Types**: Always specify types. Avoid using `any`. +- **Interfaces**: Use interfaces to define object shapes, especially for component props. +- **Enums**: Use enums for sets of related constants. +- **Variables**: Use `const` and `let` over `var`. +- **Functions**: Use named function expressions instead of function declarations +- **Semicolons**: Use them + +## APCA + +- Use the [APCA](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html) standard for color contrast calculations instead of the older WCAG 2.0 method. +- Aim for an APCA contrast value of at least 60 for normal text and 45 for large text. +- Use tools like the [APCA Contrast Checker](https://toolness.github.io/apca/) to verify color contrast compliance. +- Ensure that interactive elements have sufficient contrast in all states (default, hover, active, focus, disabled). +- Document any exceptions to the APCA contrast requirements with a clear rationale. \ No newline at end of file diff --git a/.github/instructions/github-issue.instructions.md b/.github/instructions/github-issue.instructions.md new file mode 100644 index 0000000..b212497 --- /dev/null +++ b/.github/instructions/github-issue.instructions.md @@ -0,0 +1,324 @@ +--- +applyTo: '**/*.md, **/*.mdx' +--- + +# GitHub Issue Creation Instructions + +Use these instructions to create well-structured, comprehensive GitHub issues for the DevLog application. + +## Issue Structure Template + +Every GitHub issue should follow this standardized structure: + +```markdown +# [Clear, Descriptive Title - No Emojis] + +## Problem Description + +[2-3 paragraph overview of the issue, providing context and impact] + +## Current Behavior ❌ + +[Describe what's currently happening] + +### [Subsection 1] +- **Issue point**: Description +- **Issue point**: Description + +### [Subsection 2] +- Bullet points describing specific problems +- Include technical details and symptoms + +## Expected Behavior ✅ + +[Describe the desired outcome] + +### [Subsection 1] +- **Expected point**: Description +- **Expected point**: Description + +## Technical Context + +[Provide implementation details and technical background] + +### Current Implementation Issues + +1. **[Issue Category]**: +```typescript +// Code example showing current problematic implementation +// Include file path and line numbers as comments +``` + +2. **[Another Issue]**: +```typescript +// More code examples +``` + +## Proposed Solution + +[Detailed explanation of how to fix the issue] + +### 1. [Solution Step 1] +```typescript +// Code example showing proposed solution +// Include comments explaining changes +``` + +### 2. [Solution Step 2] +```typescript +// More solution code +``` + +## Testing Requirements + +### Manual Testing +- [ ] Test case 1 +- [ ] Test case 2 +- [ ] Test case 3 + +### Visual Regression Testing +- [ ] Update Playwright snapshots +- [ ] Test in light mode +- [ ] Test in dark mode + +### Accessibility Testing +- [ ] WCAG compliance check +- [ ] Screen reader testing +- [ ] Keyboard navigation + +## Acceptance Criteria + +- [ ] **Criterion 1**: Description +- [ ] **Criterion 2**: Description +- [ ] **Criterion 3**: Description +- [ ] **Documentation**: Updated examples and best practices + +## Priority + +**[High/Medium/Low]** - [Brief justification] + +## Labels + +`label1`, `label2`, `label3`, `component-name`, `priority-level` + +## Related Issues + +- Issue/PR #123 +- Related feature work +- Migration tasks + +## Additional Notes + +[Any additional context, considerations, or future work] + +--- + +**Environment:** +- MUI v7 with colorSchemes API +- React 18.3+ +- TypeScript 5+ +- [Other relevant tools/versions] + +**Related Files:** +- `path/to/file.ts` (lines X-Y) - Description +- `path/to/another/file.tsx` - Description +``` + +## Formatting Guidelines + +### Headings +- **H1 (`#`)**: Issue title only - NO EMOJIS +- **H2 (`##`)**: Major sections (Problem Description, Current Behavior, etc.) +- **H3 (`###`)**: Subsections within major sections + +### Emojis Usage +- **Section headers**: Use ❌ for "Current Behavior" and ✅ for "Expected Behavior" only +- **Bullet lists**: Optional emojis for emphasis (⚡, 🚀, 💾, 🎯, 🛠️, etc.) +- **Title**: NEVER use emojis in the H1 title + +### Code Blocks +- Always specify language: ```typescript```, ```tsx```, ```bash``` +- Include file paths in comments: `// src/components/MyComponent.tsx` +- Include line numbers when referencing existing code: `// Line 45-60` +- Add explanatory comments: `// ❌ Wrong` or `// ✅ Correct` + +### Lists and Checkboxes +- Use `- [ ]` for unchecked items in testing and acceptance criteria +- Use `- [x]` for completed items (if updating existing issue) +- Use bullet lists (`-`) for descriptions and problem statements +- Use numbered lists (`1.`) for sequential steps + +### Emphasis +- **Bold** for key terms, component names, and important points +- `Inline code` for file paths, function names, props, and code references +- _Italic_ sparingly for slight emphasis + +## Content Guidelines + +### Problem Description +- Provide context: What component/feature is affected? +- Explain impact: How does this affect users or developers? +- Keep it concise: 2-3 paragraphs maximum + +### Current Behavior +- Be specific about symptoms +- Include visual descriptions for UI issues +- Group related issues under subsections +- Use bullet points for clarity + +### Expected Behavior +- Describe the ideal state +- Match structure to Current Behavior for easy comparison +- Include user experience improvements + +### Technical Context +- Show current implementation code +- Reference specific files and line numbers +- Explain why current approach is problematic +- Include links to MUI documentation when relevant + +### Proposed Solution +- Provide concrete code examples +- Break down into numbered steps +- Show complete implementations, not fragments +- Include comments explaining changes + +### Testing Requirements +- Cover manual testing scenarios +- Include visual regression testing needs +- Address accessibility testing +- Add integration or performance testing if relevant + +### Acceptance Criteria +- Make criteria specific and measurable +- Use checkboxes for tracking +- Include non-functional requirements (performance, accessibility) +- Always include documentation requirement + +## Issue Types + +### Bug Report +Focus on: +- What's broken +- Steps to reproduce +- Current vs expected behavior +- Impact on users + +### Enhancement Request +Focus on: +- Current limitations +- Benefits of enhancement +- Performance improvements +- Developer experience improvements + +### Refactor/Technical Debt +Focus on: +- Why current implementation is problematic +- Technical benefits of refactor +- Migration strategy +- Breaking changes + +## Priority Levels + +### High Priority +- Breaks core functionality +- Security issues +- Significant user experience problems +- Blocks other development work + +### Medium Priority +- Visual inconsistencies +- Performance improvements +- Developer experience issues +- Non-critical bugs + +### Low Priority +- Nice-to-have features +- Minor optimizations +- Documentation improvements +- Cosmetic issues + +## Label Categories + +### Type Labels +- `bug` - Something isn't working +- `enhancement` - New feature or improvement +- `documentation` - Documentation updates +- `refactor` - Code restructuring + +### Component Labels +- Component name (e.g., `CbAppHeader`, `CbButton`, `CbAlert`) +- System area (e.g., `theme-system`, `storybook`, `build-process`) + +### Priority Labels +- `high-priority` - Needs immediate attention +- `medium-priority` - Should be addressed soon +- `low-priority` - Can be deferred + +### Status Labels +- `breaking-change` - Will require version bump +- `needs-testing` - Requires additional testing +- `accessibility` - Related to a11y + +## Best Practices + +1. **Be specific**: Use concrete examples and code snippets +2. **Reference files**: Always include file paths and line numbers +3. **Show, don't tell**: Use code examples to illustrate problems and solutions +4. **Think about testing**: Include comprehensive testing requirements +5. **Consider impact**: Explain how changes affect users and developers +6. **Link resources**: Include MUI docs, related issues, or external references +7. **Use checkboxes**: Make acceptance criteria actionable and trackable +8. **Be consistent**: Follow the template structure for all issues +9. **Update environment**: Keep technology versions current +10. **Think future**: Consider migration paths and breaking changes + +## Example Prompts for Creating Issues + +### Bug Report Prompt +``` +Create a GitHub issue for a bug in [Component Name]. The problem is [brief description]. +Include: +- Current behavior with code examples from [file path] +- Expected behavior +- Technical context showing the implementation issue +- Proposed solution with code +- Testing requirements for manual, visual regression, and accessibility +- Acceptance criteria +``` + +### Enhancement Prompt +``` +Create a GitHub issue for enhancing [Feature/Component]. We need to [brief description]. +Include: +- Current limitations +- Benefits of enhancement +- Technical approach with code examples +- Migration strategy if breaking changes +- Testing and acceptance criteria +``` + +### Refactor Prompt +``` +Create a GitHub issue for refactoring [System/Component] to [new approach]. +Include: +- Problems with current implementation +- Proposed new architecture with code examples +- Migration plan +- Performance/DX benefits +- Comprehensive testing strategy +``` + +## Validation Checklist + +Before submitting an issue, verify: +- [ ] Title is clear and descriptive (no emojis) +- [ ] All required sections are present +- [ ] Code examples include file paths +- [ ] Testing requirements are comprehensive +- [ ] Acceptance criteria are specific and measurable +- [ ] Priority level is justified +- [ ] Labels are appropriate +- [ ] Related issues/PRs are linked +- [ ] Environment details are current +- [ ] Formatting is consistent (emojis only in section headers) \ No newline at end of file diff --git a/.github/instructions/github-release-notes.instructions.md b/.github/instructions/github-release-notes.instructions.md new file mode 100644 index 0000000..325aac7 --- /dev/null +++ b/.github/instructions/github-release-notes.instructions.md @@ -0,0 +1,888 @@ +--- +applyTo: '**/*.md, **/*.mdx' +--- + +# GitHub Release Notes Instructions + +This document provides comprehensive instructions for creating professional, well-structured GitHub release notes for the DevLog application. Release notes are published in two formats: a **detailed version** and a **summary version**. + +## File Naming and Location + +### Detailed Release Notes + +- **Filename:** `release-vX.X.X.md` +- **Location:** `docs/published/` +- **Purpose:** Comprehensive documentation of all changes with code examples, technical details, and migration guidance + +### Summary Release Notes + +- **Filename:** `release-vX.X.X.summary.md` +- **Location:** `docs/published/` +- **Purpose:** Condensed version highlighting key changes for quick review + +## Release Type Determination + +Determine the release type based on semantic versioning and commit messages: + +### Patch Release (x.x.X) + +- Bug fixes (`fix:`) +- Documentation updates (`docs:`) +- Minor code quality improvements +- Non-breaking changes +- **Example:** v18.31.1, v18.31.3 + +### Minor Release (x.X.0) + +- New features (`feat:`) +- Enhancements to existing features +- New components or utilities +- Non-breaking additions +- **Example:** v18.29.0, v18.31.0 + +### Major Release (X.0.0) + +- Breaking changes (`BREAKING CHANGE:`) +- API changes requiring migration +- Major architectural changes +- **Example:** v19.0.0 + +--- + +## Detailed Release Notes Structure + +### Required Sections + +#### 1. Title and Metadata + +```markdown +# Release Notes: vX.X.X + +**Release Date:** Month DD, YYYY +``` + +**Rules:** +- Use H1 heading for title +- Include version number with `v` prefix +- Release date in bold, format: "Month DD, YYYY" +- No emojis in the H1 title + +--- + +#### 2. Overview (## 🎉 Overview) + +**Purpose:** Provide high-level summary of the release focus and impact + +**Structure:** +- 2-3 paragraphs +- First sentence states release type and primary focus +- Explain what changed and why +- Describe overall impact + +**Template:** + +```markdown +## 🎉 Overview + +This [patch/minor/major] release [primary focus/goal]. [Additional context about the changes]. + +[Impact statement and benefits overview]. +``` + +**Example:** + +```markdown +## 🎉 Overview + +This patch release fixes utility export issues and improves code consistency by consolidating exports and updating function syntax. The primary change resolves missing utility exports from the main library entry point, ensuring all utilities introduced in v18.31.0 are properly accessible to consumers. +``` + +--- + +#### 3. Main Content Sections + +Organize changes by category with appropriate emoji headers: + +**For Features (✨):** + +```markdown +## ✨ New Features + +### Feature Name + +Description of the feature and its purpose. + +#### **Key Aspects** + +Detailed explanation with sub-sections as needed. + +**Code Example:** + +```tsx +// Usage example +``` + +**Benefits:** + +- ✅ Benefit one +- ✅ Benefit two +- ✅ Benefit three +``` + +**For Bug Fixes (🐛):** + +```markdown +## 🐛 Bug Fixes + +### Issue Name + +Description of the problem that was fixed. + +#### **Root Cause Analysis** + +Explanation of why the issue occurred. + +**Before (vX.X.X):** + +```tsx +// Problematic code +``` + +**After (vX.X.X):** + +```tsx +// Fixed code +``` + +**Impact:** + +- ✅ What is now fixed +- ✅ What users can now do +``` + +**For Enhancements (🔧):** + +```markdown +## 🔧 Code Quality Improvements + +### Improvement Name + +Description of what was improved and why. + +**Before:** + +```tsx +// Old approach +``` + +**After:** + +```tsx +// Improved approach +``` + +**Benefits:** + +- 📦 Bundle size impact +- ⚡ Performance improvement +- 🔍 Developer experience enhancement +``` + +**For Documentation (📚):** + +```markdown +## 📚 Documentation + +### Documentation Updates + +Description of documentation changes. + +**New Documentation:** +- Document name and purpose +- Location/link + +**Updated Documentation:** +- What was updated +- Why it was updated +``` + +**For Testing (🧪):** + +```markdown +## 🧪 Testing Updates + +### Test Changes + +Description of test updates. + +**New Tests:** +- Test description +- Coverage area + +**Updated Tests:** +- What was updated +- Why it was updated +``` + +--- + +#### 4. Technical Details (## 🔧 Technical Details) + +**Purpose:** Provide in-depth technical information for developers + +**Include:** +- API changes with TypeScript interfaces +- Component structure changes +- Implementation details +- Code examples showing internal changes + +**Template:** + +```markdown +## 🔧 Technical Details + +### Component API Changes + +**Updated Interface:** + +```typescript +interface ComponentProps { + existingProp: string; + newProp?: boolean; // NEW +} +``` + +### Component Structure + +Explanation of structural changes with code examples. +``` + +--- + +#### 5. Files Changed (## 📊 Files Changed) + +**Purpose:** Show what files were modified and the scope of changes + +**Format:** Use a table with columns: File | Changes | Description + +```markdown +## 📊 Files Changed + +| File | Changes | Description | +|------|---------|-------------| +| `src/components/Component.tsx` | 87 +/- | Component implementation | +| `src/utils/utility.ts` | 24 +/- | Utility function | +| `docs/GUIDE.md` | 175 + | New documentation | + +**Total:** X files changed, X insertions(+), X deletions(-) +``` + +**Rules:** +- Use inline code for file paths +- Show +/- for modifications, + for new files, - for deletions +- Include total summary +- Order by significance (main changes first) + +--- + +#### 6. Migration Guide (## 🔄 Migration Guide) + +**Purpose:** Help users upgrade from previous version + +**Structure:** + +```markdown +## 🔄 Migration Guide + +### For Existing Users + +**Breaking Changes:** + +[If none:] +✅ **No breaking changes** - Backward compatible + +[If yes:] +⚠️ **Breaking Changes:** + +- Change description +- Required action + +**To Upgrade:** + +```typescript +// Before +oldCode(); + +// After +newCode(); +``` + +### For New Users + +- Getting started guidance +- Key features to know +- Important notes +``` + +--- + +#### 7. Benefits Summary (## 🎯 Benefits Summary) + +**Purpose:** Highlight improvements across different concerns + +**Required Subsections:** + +```markdown +## 🎯 Benefits Summary + +### Developer Experience + +- ✅ Benefit related to development workflow +- ✅ Benefit related to API usage +- ✅ Benefit related to documentation + +### User Experience + +- ✅ Benefit for end users +- ✅ Benefit for interaction +- ✅ Benefit for visual design + +### Code Quality + +- ✅ Benefit for maintainability +- ✅ Benefit for performance +- ✅ Benefit for best practices +``` + +**Rules:** +- Always use checkmarks (✅) +- 3-5 bullets per subsection +- Be specific and measurable when possible +- Use blank lines around each subsection + +--- + +#### 8. Installation (## 📦 Installation) + +```markdown +## 📦 Installation + +```bash +npm install @cobank-acb/shd-agrikit-ui-lib@X.X.X +``` +``` + +--- + +#### 9. Resources (## 📚 Resources) + +```markdown +## 📚 Resources + +- [Full Changelog](https://github.com/cobank-acb/shd-agrikit-ui-lib/compare/vPREV...vCURRENT) +- [Component Documentation](link-if-applicable) +- [Related Documentation](link-if-applicable) +- [GitHub Repository](https://github.com/cobank-acb/shd-agrikit-ui-lib) +``` + +--- + +#### 10. Footer Metadata + +```markdown +--- + +**Version:** X.X.X +**Release Date:** Month DD, YYYY +**Previous Version:** X.X.X +**Type:** Patch/Minor/Major Release +``` + +--- + +## Summary Release Notes Structure + +### Key Differences from Detailed Version + +1. **Shorter sections** - 1-2 paragraphs vs 3-5 +2. **Fewer code examples** - Only essential ones +3. **Condensed tables** - Simplified information +4. **No deep technical details** - High-level only +5. **Bottom Line section** - Single sentence summary at end + +### Required Sections + +#### 1. Title and Metadata + +```markdown +# Release Summary: vX.X.X + +**Release Date:** Month DD, YYYY +``` + +--- + +#### 2. Overview + +```markdown +## Overview + +Single paragraph summarizing the release. [One sentence about the main change or focus]. +``` + +--- + +#### 3. Key Changes + +```markdown +## Key Changes / Key Feature + +### Change/Feature Name + +Brief description (1-2 paragraphs). + +**Essential Code Example:** + +```tsx +// Minimal example showing the change +``` + +**Key Points:** + +- Important point 1 +- Important point 2 +``` + +--- + +#### 4. Benefits (Condensed) + +```markdown +## Benefits + +- ✅ Key benefit 1 +- ✅ Key benefit 2 +- ✅ Key benefit 3 +- ✅ Key benefit 4 +``` + +--- + +#### 5. Files Changed (Condensed) + +```markdown +## Files Changed + +X files changed, X insertions(+), X deletions(-) + +- `file1.tsx` - Brief description +- `file2.ts` - Brief description +- `docs/FILE.md` - **New** documentation +``` + +--- + +#### 6. Migration (Brief) + +```markdown +## Migration + +✅ **No breaking changes** - Backward compatible + +[Or if changes needed:] + +**To upgrade:** + +```typescript +// Quick example +``` +``` + +--- + +#### 7. Resources + +```markdown +## Resources + +- [GitHub Comparison](https://github.com/cobank-acb/shd-agrikit-ui-lib/compare/vPREV...vCURRENT) +- [Documentation](link-if-applicable) +- Commit: `hash` +``` + +--- + +#### 8. Bottom Line + +```markdown +--- + +**Bottom Line:** [One sentence summary of what this release achieves and why it matters]. +``` + +--- + +## Formatting Rules + +### Markdown Linting Compliance + +**Critical Rules:** + +1. **MD032** - Lists must have blank lines before and after +2. **MD031** - Code fences must have blank lines before and after +3. **MD022** - Headings must have blank lines before and after +4. **MD026** - No trailing punctuation in headings (colons allowed in sub-headings only) +5. **MD009** - No trailing spaces + +**Correct:** + +```markdown +Description text. + +**Label:** + +- List item 1 +- List item 2 + +Next section. +``` + +**Incorrect:** + +```markdown +Description text. +**Label:** +- List item 1 +- List item 2 +Next section. +``` + +--- + +### Code Blocks + +**Requirements:** +- Always specify language: ```tsx```, ```typescript```, ```bash``` +- Use blank lines before and after +- Include comments for clarity +- Use single quotes in code examples +- Show file paths in comments when relevant + +**Example:** + +```markdown +Description text. + +```tsx +// src/components/Component.tsx +import Component from '@mui/material/Component'; + +export const MyComponent = () => { + return ; +}; +``` + +Next section. +``` + +--- + +### Tables + +**Requirements:** +- Proper alignment with pipes +- Header row with separators +- Consistent spacing +- Use inline code for technical terms + +**Example:** + +```markdown +| Column 1 | Column 2 | Column 3 | +|----------|----------|----------| +| `code` | Value | Description | +| `code2` | Value2 | Description2 | +``` + +--- + +### Emoji Usage + +**Standard Emojis:** +- 🎉 Overview +- ✨ New Features +- 🐛 Bug Fixes +- 🔧 Enhancements/Technical Details/Code Quality +- 📚 Documentation +- 🧪 Testing +- 📊 Files Changed +- 🔄 Migration Guide +- 🎯 Benefits Summary +- 📦 Installation +- 💡 Use Cases +- 🎨 Visual Impact + +**In Lists:** +- ✅ Positive benefits/features +- ❌ Anti-patterns/what not to do +- ⚠️ Warnings/breaking changes +- 📦 Bundle size +- ⚡ Performance +- 🔍 Developer experience + +--- + +### Text Formatting + +**Bold (`**text**`):** +- Important terms +- Section labels (Before:, After:, Benefits:) +- Emphasized points + +**Inline Code (`` `text` ``):** +- File paths +- Function names +- Variable names +- Property names +- npm commands +- Short code snippets + +**Headings:** +- Use proper hierarchy (don't skip levels) +- Title case for main headings +- Sentence case for descriptive headings +- No emojis in H1 titles +- Emojis in H2 section headers + +--- + +## Content Guidelines + +### What to Include + +**Always Include:** +- Version number and release date +- Overview of changes +- Code examples (before/after when applicable) +- Benefits and impact +- Migration guidance +- Files changed +- Resources and links + +**Include When Applicable:** +- Breaking changes +- New components or utilities +- API changes +- Performance improvements +- Visual changes +- Test coverage updates + +### What to Avoid + +**Don't Include:** +- Internal implementation details unless relevant +- Overly technical jargon without explanation +- Incomplete code examples +- Vague benefits ("better performance" without context) +- Personal opinions or subjective statements + +### Writing Style + +**Tone:** +- Professional and clear +- Factual and specific +- Helpful and educational +- Positive but honest + +**Voice:** +- Use active voice +- Be direct and concise +- Explain "why" not just "what" +- Provide context for decisions + +--- + +## Comparison Tables + +Use comparison tables to show: +- Before/After values +- Old/New API +- Different approaches +- Feature comparisons + +**Template:** + +```markdown +| Previous | New | Impact | +|----------|-----|--------| +| Old value | New value | What this means | +``` + +--- + +## Code Example Patterns + +### Before/After Pattern + +```markdown +**Before (vX.X.X):** + +```tsx +// Old implementation +const old = 'approach'; +``` + +**After (vX.X.X):** + +```tsx +// New implementation +const new = 'approach'; +``` +``` + +### Usage Example Pattern + +```markdown +**Usage:** + +```tsx +import { utility } from '@cobank-acb/shd-agrikit-ui-lib'; + +// Example usage +const result = utility(input); +``` +``` + +### Problem/Solution Pattern + +```markdown +**Problem:** + +```tsx +// Code showing the issue +``` + +**Solution:** + +```tsx +// Code showing the fix +``` +``` + +--- + +## Version References + +**In Text:** +- Always use `v` prefix: v18.31.3 +- Reference previous version in comparisons +- Include version in code comments when showing changes + +**In Links:** +- GitHub comparison: `vPREV...vCURRENT` +- Use full version numbers +- Link to specific commits when relevant + +--- + +## Validation Checklist + +Before publishing, verify: + +### Detailed Release Notes + +- [ ] Title follows format: "# Release Notes: vX.X.X" +- [ ] Release date included and formatted correctly +- [ ] Overview section (2-3 paragraphs) +- [ ] All changes categorized appropriately +- [ ] Code examples include language specification +- [ ] Before/After examples where applicable +- [ ] Benefits listed with checkmarks +- [ ] Files changed table included +- [ ] Migration guide included +- [ ] Benefits summary with 3 subsections +- [ ] Installation section +- [ ] Resources section with links +- [ ] Footer metadata +- [ ] No markdown linting errors +- [ ] All blank lines properly placed +- [ ] Consistent emoji usage + +### Summary Release Notes + +- [ ] Title follows format: "# Release Summary: vX.X.X" +- [ ] Overview is single paragraph +- [ ] Key changes highlighted +- [ ] Essential code examples only +- [ ] Benefits condensed to single list +- [ ] Files changed condensed +- [ ] Migration brief +- [ ] Bottom Line section at end +- [ ] No markdown linting errors + +--- + +## Example Patterns by Release Type + +### Patch Release Example + +**Focus:** Bug fixes, minor improvements, documentation + +**Key Sections:** +- Bug Fixes (primary) +- Code Quality Improvements +- Documentation (if applicable) +- Migration (emphasize no breaking changes) + +### Minor Release Example + +**Focus:** New features, enhancements + +**Key Sections:** +- New Features (primary) +- Enhancements +- Documentation +- Testing +- Use Cases/Examples +- Migration (new capabilities) + +### Major Release Example + +**Focus:** Breaking changes, major features + +**Key Sections:** +- Breaking Changes (highlight at top) +- New Features +- Migration Guide (comprehensive) +- Benefits Summary (emphasize value of upgrade) + +--- + +## Cross-References + +**Link to:** +- Related GitHub issues +- Related pull requests +- Component documentation +- External documentation (MUI, etc.) +- Previous release notes +- Migration guides + +**Format:** + +```markdown +- [Issue #123](url) - Description +- [PR #456](url) - Description +- [Component Docs](url) +``` + +--- + +## Final Notes + +- **Consistency is key** - Follow the established patterns +- **Be thorough** - Include all relevant information +- **Be clear** - Write for developers of all skill levels +- **Be helpful** - Provide migration guidance and examples +- **Validate** - Check markdown linting before committing +- **Review examples** - Reference existing release notes in `docs/published/` diff --git a/.github/instructions/storybook.instructions.md b/.github/instructions/storybook.instructions.md new file mode 100644 index 0000000..886242d --- /dev/null +++ b/.github/instructions/storybook.instructions.md @@ -0,0 +1,57 @@ +--- +applyTo: '**/*.stories.@(js|jsx|ts|tsx)' +--- +Provide project context and coding guidelines that AI should follow when generating code, answering questions, or reviewing changes. + +# /build.storybook - Scaffold Storybook Story + +Generate a Storybook story file following the DevLog application patterns. + +## Usage +- `/build.storybook ComponentName` - Creates basic story with Primary/Secondary variants +- `/build.storybook ComponentName --visual` - Includes visual regression testing tag +- `/build.storybook ComponentName --variants variant1,variant2` - Custom story variants + +## Story Template Structure + +Based on `src/examples/StarterComponent/CbStarter.stories.tsx`: + +```tsx +import type { Meta, StoryObj } from '@storybook/react-vite'; +import Stack from '@mui/material/Stack'; +import { ComponentName } from './ComponentName'; + +const meta: Meta = { + title: 'Category/Subcategory/ComponentName', + component: ComponentName, + argTypes: { + // Define component prop controls + }, + parameters: { + layout: 'fullscreen', + }, + decorators: [(Story) => ], + tags: ['!visual:check'], // Use 'visual:check' for visual regression testing +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Primary = { + args: { + // Primary story args + }, + render: (args) => { + return ( + + ); + }, +} satisfies Story; +``` + +## Requirements +Don't assume, always ask for the following inputs before generating code: +- Use proper Storybook title categorization matching file structure +- Add `'visual:check'` tag only when component is ready for visual regression testing +- Define argTypes for interactive controls in Storybook +- Use `satisfies` for type safety with Meta and Story types \ No newline at end of file diff --git a/.github/instructions/web-interface-guidelines.instructions.md b/.github/instructions/web-interface-guidelines.instructions.md new file mode 100644 index 0000000..f10be51 --- /dev/null +++ b/.github/instructions/web-interface-guidelines.instructions.md @@ -0,0 +1,331 @@ +--- +description: Review UI code for Web Interface Guidelines compliance +applyTo: +--- + +# Web Interface Guidelines + +Concise rules for building accessible, fast, delightful UIs. Use MUST/SHOULD/NEVER to guide decisions. + +## Interactions + +### Keyboard + +- MUST: Full keyboard support per [WAI-ARIA APG](https://www.w3.org/WAI/ARIA/apg/patterns/) +- MUST: Visible focus rings (`:focus-visible`; group with `:focus-within`) +- MUST: Manage focus (trap, move, return) per APG patterns +- NEVER: `outline: none` without visible focus replacement + +### Targets & Input + +- MUST: Hit target ≥24px (mobile ≥44px); if visual <24px, expand hit area +- MUST: Mobile `` font-size ≥16px to prevent iOS zoom +- NEVER: Disable browser zoom (`user-scalable=no`, `maximum-scale=1`) +- MUST: `touch-action: manipulation` to prevent double-tap zoom +- SHOULD: Set `-webkit-tap-highlight-color` to match design + +### Forms + +- MUST: Hydration-safe inputs (no lost focus/value) +- NEVER: Block paste in ``/`