Skip to content

Commit d34cfd6

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/types/react-19.2.17
2 parents 947ff77 + f58c53a commit d34cfd6

72 files changed

Lines changed: 4125 additions & 3408 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/WORKFLOWS.md

Lines changed: 36 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,21 @@ All workflows have been enhanced with:
2525

2626
**Jobs:**
2727

28-
- **Build and Test** (Matrix: Node.js 18.x, 20.x):
28+
- **Build and Test** (Matrix: Node.js 20.x, 22.x)*skipped for Dependabot*:
2929
- ✅ Install dependencies with npm ci
3030
- ✅ TypeScript type checking via `npm run typecheck`
3131
-**Run Vitest tests** with `npm run test:run`
3232
- ✅ Frontend build verification (Vite)
3333
- ✅ C++ server compilation with Make
3434
- ✅ Binary verification
35-
- ✅ Upload build artifacts (dist/ and omnigrid_server)
36-
- **Code Quality Check**:
35+
- ✅ Upload build artifacts (dist/ and omnigrid_server) for Node 20.x
36+
- **Dependabot Smoke** (Node 20 only) — *only for Dependabot PRs*:
37+
- ✅ Typecheck + unit tests (lightweight gate; no matrix / C++ / coverage)
38+
- **Code Quality Check** (always runs, including Dependabot — **Prettier gate**):
3739
-**ESLint** validation with `npm run lint`
38-
-**Prettier** format checking with `npm run format:check`
39-
- ✅ Console.log detection (fails build if found in source)
40+
-**Prettier** format checking with `npm run format:check` (fails CI on drift)
4041
- ✅ TODO/FIXME comment detection (warning only)
41-
- **Test Coverage**:
42+
- **Test Coverage***skipped for Dependabot*:
4243
- ✅ Run tests with coverage reporting
4344
- ✅ Upload coverage artifacts
4445
-**Post coverage report as PR comment**
@@ -188,7 +189,7 @@ All workflows have been enhanced with:
188189

189190
**Schedule:** Weekly on Monday at 09:00 UTC
190191

191-
**Purpose:** Automated dependency updates
192+
**Purpose:** Automated dependency updates with grouped PRs to reduce noise
192193

193194
**Ecosystems:**
194195

@@ -199,25 +200,43 @@ All workflows have been enhanced with:
199200

200201
- Automatic PR creation for updates
201202
- Weekly schedule to minimize noise
202-
- Labels: `dependencies`, `automated`
203+
- Labels: `dependencies`, `npm` / `github-actions`, `automated`
203204
- Auto-reviewers assigned
205+
- **Grouped updates** (noise reduction):
206+
- `production-dependencies` — minor/patch production deps
207+
- `development-dependencies` — minor/patch dev deps
208+
- `eslint-stack` — eslint, @eslint/*, @typescript-eslint/*
209+
- `vitest-stack` — vitest, @vitest/*
210+
- `testing-library`@testing-library/*
211+
- `github-actions` — all Actions minor/patch bumps
212+
- Major updates still open as individual PRs for review
204213

205214
---
206215

207216
### Auto-merge Dependabot (`auto-merge-dependabot.yml`)
208217

209218
**Triggers:** Pull Request events from Dependabot
210219

211-
**Purpose:** Automatically merge safe dependency updates
220+
**Purpose:** Automatically merge safe dependency updates and apply metadata labels
212221

213222
**Jobs:**
214223

215224
- **Auto-merge**:
216-
- ✅ Fetch Dependabot metadata
225+
- ✅ Fetch Dependabot metadata (`dependabot/fetch-metadata@v2`)
226+
-**Ensure metadata labels exist** (`semver-major`, `semver-minor`, `semver-patch`, `production`, `development`, `npm`, `github-actions`)
227+
-**Apply metadata labels** based on update-type, dependency-type, and package-ecosystem
217228
- ✅ Check update type (major/minor/patch)
218229
- ✅ Auto-approve minor and patch updates
219230
- ✅ Enable auto-merge for safe updates
220-
- ✅ Comment on major updates requiring manual review
231+
- ✅ Comment on major updates requiring manual review (with `semver-major` label)
232+
233+
**Metadata labels applied:**
234+
235+
| Label | Source |
236+
|-------|--------|
237+
| `semver-major` / `semver-minor` / `semver-patch` | `update-type` |
238+
| `production` / `development` | `dependency-type` |
239+
| `npm` / `github-actions` | `package-ecosystem` |
221240

222241
**Safety:** Only auto-merges minor and patch updates
223242

@@ -430,7 +449,7 @@ File: `.github/labeler.yml`
430449

431450
**Automatic Labels:**
432451

433-
- `documentation`: Changes to docs/\*_ or _.md files
452+
- `documentation`: Changes to docs/\*_ or \*.md files
434453
- `frontend`: Changes to components/, widgets/, \*.tsx files
435454
- `backend`: Changes to server/ or C++ files
436455
- `services`: Changes to services/
@@ -444,71 +463,14 @@ File: `.github/labeler.yml`
444463
- `size/S`: 10-49 lines changed
445464
- `size/M`: 50-199 lines changed
446465
- `size/L`: 200-499 lines changed
447-
- `size/XL`: 500+ lines changed
448-
449-
---
450-
451-
## 🛠️ Development Commands
452-
453-
### New Scripts Added
454-
455-
```bash
456-
# Testing
457-
npm test # Run tests in watch mode
458-
npm run test:run # Run tests once
459-
npm run test:ui # Run tests with UI
460-
npm run test:coverage # Run tests with coverage report
461-
462-
# Linting & Formatting
463-
npm run lint # Run ESLint
464-
npm run lint:fix # Fix ESLint issues
465-
npm run format # Format all files with Prettier
466-
npm run format:check # Check formatting without changing files
467-
468-
# Type Checking
469-
npm run typecheck # Run TypeScript type checking
470-
471-
# Building
472-
npm run build # Build frontend
473-
npm run build:server # Build C++ server
474-
npm run build:all # Build both frontend and server
475-
npm run assets:generate # Generate screenshot asset manifest locally
476-
npm run artifacts:generate # Generate build artifact manifest locally (requires prior `npm run build`)
477-
```
466+
- `size/XL`: ≥ 500 lines changed
478467

479468
---
480469

481-
## 🎯 Best Practices
482-
483-
### For Contributors
484-
485-
1. ✅ Run `npm run lint` and `npm run format:check` before committing
486-
2. ✅ Run `npm run test:run` to ensure all tests pass
487-
3. ✅ Keep PRs focused and reasonably sized (< 500 lines when possible)
488-
4. ✅ Update documentation for new features
489-
5. ✅ Add tests for bug fixes and new features
490-
6. ✅ Follow the PR template guidelines
491-
7. ✅ Ensure all CI checks pass before requesting review
492-
493-
### For Maintainers
494-
495-
1. ✅ Review security alerts from CodeQL and Dependabot promptly
496-
2. ✅ Monitor workflow performance reports
497-
3. ✅ Keep dependencies up to date
498-
4. ✅ Review and merge Dependabot PRs regularly
499-
5. ✅ Use workflow badges in README to communicate project health
500-
6. ✅ Check test coverage trends
501-
502-
---
503-
504-
## 🔧 Maintenance
505-
506-
### Regular Tasks
470+
## 🔄 Maintenance Schedule
507471

508-
- **Daily**: Automated dependency audits and stale issue checks
509-
- **Weekly**:
510-
- Review Dependabot PRs
511-
- Check CodeQL security scan results
472+
- **Daily**: Stale bot, dependency audit (scheduled)
473+
- **Weekly**: Dependabot version updates (Monday 09:00 UTC), CodeQL
512474
- **Monthly**: Review stale issues and PRs manually
513475
- **Quarterly**:
514476
- Review and update workflow configurations
@@ -537,5 +499,5 @@ npm run artifacts:generate # Generate build artifact manifest locally (requires
537499

538500
---
539501

540-
_Last Updated: 2026-05-28_
502+
_Last Updated: 2026-08-20_
541503
_For questions or issues with workflows, please open an issue with the `ci-cd` label._

.github/copilot-instructions.md

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
# Copilot Instructions for Omni-Grid 2.0
2+
3+
## Project Overview
4+
5+
Omni-Grid is a privacy-centric, local-first "Super App" built with **React 19 + TypeScript (strict) + Vite 8**. It replaces browser tabs with a unified, widget-based grid dashboard. State is managed with **Zustand 5** (persisted via `zustand/middleware`); the UI follows a **Cyberpunk/High-Density** aesthetic using Tailwind utility classes on a `slate-950` dark background with vivid accents (`cyan`, `emerald`, `fuchsia`, `amber`). Icons come exclusively from `lucide-react`.
6+
7+
---
8+
9+
## Repository Layout
10+
11+
```
12+
/
13+
├── App.tsx # App root (theme application, layout shell)
14+
├── index.tsx # Entry point
15+
├── store.ts # Global Zustand store (all state slices)
16+
├── types.ts # Shared TypeScript types (WidgetType enum, interfaces)
17+
├── utils.ts # Shared utility functions
18+
├── components/ # Core UI shells
19+
│ ├── GridContainer.tsx # Renders all widgets; MUST be updated for new widgets
20+
│ ├── WidgetLauncher.tsx # WIDGET_REGISTRY; MUST be updated for new widgets
21+
│ ├── WidgetShell.tsx # Per-widget resize/title chrome
22+
│ ├── CommandPalette.tsx
23+
│ ├── MatrixRain.tsx
24+
│ └── SettingsPanel/
25+
├── widgets/ # Individual widget implementations (PascalCase.tsx)
26+
│ ├── marketplaceCatalog.ts # Static catalog; MUST be updated for new widgets
27+
│ └── ...
28+
├── services/ # AI providers, sandbox, plugin API, PWA
29+
│ ├── aiProviders.ts
30+
│ ├── geminiService.ts
31+
│ ├── e2bSandbox.ts
32+
│ ├── gridIntelligence.ts
33+
│ ├── multiAgentOrchestrator.ts
34+
│ ├── pluginApiV2.ts
35+
│ ├── promptEngine.ts
36+
│ └── pwaService.ts
37+
├── test/ # Vitest + React Testing Library (one file per widget)
38+
│ └── setup.ts
39+
├── types/ # Additional TypeScript declaration files
40+
├── themes/ # Theme definitions
41+
├── docs/ # Extended documentation
42+
└── server/ # Optional C++ server component (built via Makefile)
43+
```
44+
45+
---
46+
47+
## Setup
48+
49+
```bash
50+
# Node.js >= 20.0.0 is required (see .nvmrc)
51+
npm install
52+
```
53+
54+
For AI and sandboxed-execution features, create a `.env` file (see `.env.example`):
55+
56+
```env
57+
GEMINI_API_KEY=your_google_gemini_api_key_here
58+
E2B_API_KEY=your_e2b_api_key_here
59+
```
60+
61+
`GEMINI_API_KEY` is the canonical name used in `.env`. The store's key resolver also accepts `VITE_API_KEY` via `import.meta.env` (useful for Vite-prefixed secrets in some deployment environments), but `GEMINI_API_KEY` is preferred.
62+
63+
---
64+
65+
## Key Commands — Run Before Every PR
66+
67+
```bash
68+
npm run typecheck # tsc --noEmit, strict mode — MUST pass
69+
npm run lint # eslint . --ext .ts,.tsx — MUST pass
70+
npm run test:run # vitest run (all tests once) — MUST pass
71+
npm run build # production Vite build — MUST pass
72+
```
73+
74+
Other useful commands:
75+
76+
```bash
77+
npm run dev # Vite dev server (port 3000)
78+
npm run lint:fix # eslint --fix
79+
npm run format # prettier --write .
80+
npm run format:check # prettier --check .
81+
npm run test:coverage # vitest run --coverage
82+
npm run build:server # optional C++ server (make server)
83+
```
84+
85+
---
86+
87+
## Naming Conventions
88+
89+
| Item | Convention | Example |
90+
| ----------------- | ------------------------- | ------------------------ |
91+
| Widget files | PascalCase | `MyWidget.tsx` |
92+
| WidgetType values | SCREAMING_SNAKE_CASE | `MY_WIDGET` |
93+
| Store slices | camelCase | `myWidgetData` |
94+
| Test files | camelCase matching widget | `test/myWidget.test.tsx` |
95+
| Catalog ID | Must match WidgetType | `'MY_WIDGET'` |
96+
97+
---
98+
99+
## Adding a New Widget — 7 Required File Changes
100+
101+
Every new widget requires coordinated edits across these files (in order):
102+
103+
1. **`widgets/MyWidget.tsx`** — The component. Export a named React function component; use `useAppStore` only for cross-widget or persisted state.
104+
105+
2. **`types.ts`** — Add the new `WidgetType` literal to the union type and any new interfaces or enums.
106+
107+
3. **`components/GridContainer.tsx`** — Import the component and add a `case 'MY_WIDGET':` branch in the widget renderer switch.
108+
109+
4. **`components/WidgetLauncher.tsx`** — Add an entry to `WIDGET_REGISTRY` with `id`, `name`, `icon` (lucide-react), `color`, `bg`, `border`.
110+
111+
5. **`widgets/marketplaceCatalog.ts`** — Append a `MarketplaceEntry` to `MARKETPLACE_CATALOG`. Use `isCore: false` for community widgets, `isCore: true` for platform widgets. The `id` field **must** match the `WidgetType` string exactly.
112+
113+
6. **`store.ts`** — If the widget needs persisted state, add a state slice (interface, initial values, and actions). All store state is persisted via `zustand/middleware` `persist`.
114+
115+
7. **`test/myWidget.test.tsx`** — Required for all widgets. Include at minimum: a render test (`render(<MyWidget />)` does not throw) and one key interaction test.
116+
117+
---
118+
119+
## Widget Guidelines
120+
121+
- **Self-contained:** Widgets communicate with others only via the global Zustand store or Cross-Talk, never by importing each other's internals.
122+
- **Responsive:** Use `flex` and `min-h-0` patterns so scroll areas work correctly within grid items.
123+
- **Error handling:** All external/API calls must gracefully handle missing API keys and network failures without crashing.
124+
- **Performance:** Use `useMemo`/`useCallback` for expensive computations; move CPU-intensive work to Web Workers.
125+
- **Styling:** Tailwind utility classes only. No inline styles or CSS modules. Vivid accent colors for data; `slate-950` backgrounds.
126+
127+
---
128+
129+
## Testing Patterns
130+
131+
Test stack: **Vitest + `@testing-library/react` + `@testing-library/jest-dom` + `@testing-library/user-event`**
132+
133+
Every test file must mock the Zustand store using only the slices the widget under test actually uses:
134+
135+
```tsx
136+
import { describe, it, expect, vi } from 'vitest';
137+
import { render, screen, fireEvent } from '@testing-library/react';
138+
import { MyWidget } from '../widgets/MyWidget';
139+
140+
vi.mock('../store', () => ({
141+
useAppStore: () => ({
142+
// include only the slices MyWidget uses
143+
mySlice: 'value',
144+
setMySlice: vi.fn(),
145+
}),
146+
}));
147+
148+
describe('MyWidget', () => {
149+
it('renders without crashing', () => {
150+
render(<MyWidget />);
151+
expect(screen.getByText(/expected text/i)).toBeTruthy();
152+
});
153+
154+
it('handles a key interaction', () => {
155+
render(<MyWidget />);
156+
fireEvent.click(screen.getByRole('button', { name: /action/i }));
157+
expect(screen.getByText(/result/i)).toBeTruthy();
158+
});
159+
});
160+
```
161+
162+
Reference tests: `test/gitPulse.test.tsx`, `test/projectTracker.test.tsx`, `test/promptEngine.test.ts`.
163+
164+
---
165+
166+
## State Management
167+
168+
`store.ts` exports a single `useAppStore` Zustand hook with persisted state. Slices include:
169+
170+
- **Layout:** `layouts`, `visibleWidgets`, `updateLayout`, `toggleWidget`
171+
- **Settings:** `settings` (geminiApiKey, e2bApiKey, scanlines, sound, startupBehavior)
172+
- **UI State:** `ghostWidget`, `isLayoutLocked`, `isCompact`, `isCmdPaletteOpen`, `isSettingsPanelOpen`
173+
- **Per-widget slices:** one slice per widget that needs persisted state (e.g., `gitToken`, `promptTemplates`, `calendarEvents`)
174+
175+
`store.ts` automatically syncs `GEMINI_API_KEY`/`E2B_API_KEY` to `process.env` and `window.process.env` at runtime for libraries that read them.
176+
177+
---
178+
179+
## AI Features
180+
181+
The project uses `@google/genai` for AI features. All AI-backed features must:
182+
183+
- Check for the API key before making calls; show a helpful prompt when missing.
184+
- Show visual feedback (spinners/loaders) during API calls.
185+
- Display error messages on failure without crashing.
186+
- Be tested both with and without API keys configured.
187+
188+
The Gemini key is read from `VITE_API_KEY` or `GEMINI_API_KEY` environment variables and stored in the Zustand `settings` slice. Services access it via `useAppStore.getState().settings.geminiApiKey`.
189+
190+
---
191+
192+
## Commit and PR Conventions
193+
194+
- Use **Conventional Commits**: `feat: ...`, `fix: ...`, `docs: ...`, `test: ...`, `refactor: ...`, `chore: ...`.
195+
- PRs must: pass all tests, pass TypeScript strict typecheck, pass lint, and (for new widgets) include tests and a marketplace catalog entry.
196+
- Use the PR template at `.github/PULL_REQUEST_TEMPLATE.md`.
197+
198+
---
199+
200+
## Common Errors and Workarounds
201+
202+
### TypeScript strict errors with implicit `any`
203+
204+
All function parameters and return types must be explicitly typed. If upgrading a JS file, add types rather than using `// @ts-ignore`.
205+
206+
### `process.env` not defined in browser
207+
208+
The Vite config defines `process.env.API_KEY` and `process.env.GEMINI_API_KEY` at build time. For runtime key updates (user sets key in Settings), `store.ts` syncs to `window.process.env`. Services should read keys via `useAppStore.getState().settings.geminiApiKey` instead of accessing `process.env` directly at module load time.
209+
210+
### `react-grid-layout` CSS not loading in tests
211+
212+
CSS imports are ignored in the Vitest jsdom environment by default — this is expected. The `vite.config.ts` `test.css: true` option handles this in the test runner without any workaround needed.
213+
214+
### Widget not rendering in the grid
215+
216+
Check that all 7 required files have been updated (see "Adding a New Widget" above). The most commonly missed file is `components/GridContainer.tsx` — the `case 'MY_WIDGET':` branch in the widget switch statement.
217+
218+
### `lucide-react` icon not found
219+
220+
Check the exact icon name at https://lucide.dev/icons/ — names are CamelCase in import but may differ from the icon page slug. Always import from `lucide-react`.

0 commit comments

Comments
 (0)