From 9a92aff074860cc6cc8a9f5456466f4aa66ac441 Mon Sep 17 00:00:00 2001 From: dustin Date: Sat, 6 Dec 2025 22:29:42 -0500 Subject: [PATCH 1/3] Create copilot-instructions.md --- .github/copilot-instructions.md | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..6731ff97 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,56 @@ +# Copilot Instructions for ChatGPT Desktop App + +## Project Overview +- **Architecture:** Cross-platform desktop app using [Tauri](https://tauri.app/) (Rust backend, React/TypeScript frontend). UI logic is in `src/`, backend in `src-tauri/`. +- **Major Components:** + - `src/App.tsx`, `main.tsx`: Entry points, route to views based on Tauri webview label. + - `src/view/`: Main UI views (`Ask.tsx`, `Titlebar.tsx`, `Settings.tsx`). + - `src/components/`: Reusable UI elements (icons, titlebar, etc). + - `src-tauri/src/core/`: Rust backend modules for commands, config, window management. + +## Key Workflows +- **Build/Run:** + - Frontend: `pnpm dev` or `npm run dev` (uses Vite). + - Full app: `pnpm tauri dev` or `npm run tauri` (starts Tauri backend + frontend). + - Build: `pnpm build` (frontend only), `pnpm tauri build` (full desktop app). +- **Debugging:** + - Use Tauri's dev tools for backend; React/Vite for frontend. + - Hotkeys: `Ctrl+Enter`/`Cmd+Enter` to send chat (see `Ask.tsx`). + +## Communication Patterns +- **Frontend <-> Backend:** + - Use Tauri `invoke` API to call Rust commands (see `src-tauri/src/core/cmd.rs`). + - Example: `invoke('ask_send', { message })` triggers backend chat logic. + - Backend commands update config, window state, and trigger frontend JS via webview eval. + +## Project-Specific Conventions +- **View Routing:** + - Main React app renders views based on Tauri webview label (`App.tsx`). +- **Config Management:** + - App config is loaded/amended via Rust (`AppConf` in `src-tauri/src/core/conf.rs`). +- **UI State:** + - State hooks and hotkeys are used for chat input and window controls. +- **Styling:** + - Uses Tailwind CSS (`base.css`, `tailwind.config.js`). + +## Integration Points +- **Tauri Plugins:** + - OS, Shell, Dialog plugins enabled in backend (`main.rs`). +- **External APIs:** + - Chat logic is abstracted; see `cmd.rs` for backend command triggers. + +## Examples +- **Add a new backend command:** + - Implement in `src-tauri/src/core/cmd.rs`, register in `main.rs`. + - Call from frontend via `invoke('your_command', { ... })`. +- **Add a new view:** + - Create in `src/view/`, add to `viewMap` in `App.tsx`. + +## References +- `README.md`: High-level project info. +- `package.json`: Scripts and dependencies. +- `src-tauri/src/core/cmd.rs`: Backend command patterns. +- `src/view/Ask.tsx`, `Titlebar.tsx`: UI logic and Tauri integration. + +--- +_Keep instructions concise and focused on current codebase patterns. Update this file if major workflows or architecture change._ From 978e0c3cac6cf5752201acb8d334d882d2460b56 Mon Sep 17 00:00:00 2001 From: dustin rector Date: Sun, 28 Dec 2025 01:24:02 -0500 Subject: [PATCH 2/3] lencz lencx From 09f72bf8c190862845d88989470a547bbab50267 Mon Sep 17 00:00:00 2001 From: dustin Date: Wed, 31 Dec 2025 12:44:42 -0500 Subject: [PATCH 3/3] Update copilot-instructions.md --- .github/copilot-instructions.md | 64 +++++++++++++++------------------ 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 6731ff97..4738c99a 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,56 +1,50 @@ # Copilot Instructions for ChatGPT Desktop App ## Project Overview -- **Architecture:** Cross-platform desktop app using [Tauri](https://tauri.app/) (Rust backend, React/TypeScript frontend). UI logic is in `src/`, backend in `src-tauri/`. +- **Architecture:** Cross-platform desktop app using [Tauri](https://tauri.app/) v2 (Rust backend, React/TypeScript frontend). Embeds ChatGPT web interface in a webview with custom titlebar and input bar overlays. - **Major Components:** - - `src/App.tsx`, `main.tsx`: Entry points, route to views based on Tauri webview label. - - `src/view/`: Main UI views (`Ask.tsx`, `Titlebar.tsx`, `Settings.tsx`). - - `src/components/`: Reusable UI elements (icons, titlebar, etc). - - `src-tauri/src/core/`: Rust backend modules for commands, config, window management. + - `src/App.tsx`: Routes to views based on Tauri webview label (titlebar, ask, settings). + - `src/view/`: UI views - `Titlebar.tsx` (navigation/controls), `Ask.tsx` (chat input), `Settings.tsx` (placeholder). + - `src-tauri/src/core/`: Rust modules for commands (`cmd.rs`), config (`conf.rs`), window setup (`setup.rs`). + - Webviews: `main` (loads https://chatgpt.com), `titlebar` (custom React), `ask` (input React), `settings` (future). ## Key Workflows - **Build/Run:** - - Frontend: `pnpm dev` or `npm run dev` (uses Vite). - - Full app: `pnpm tauri dev` or `npm run tauri` (starts Tauri backend + frontend). - - Build: `pnpm build` (frontend only), `pnpm tauri build` (full desktop app). + - Frontend: `pnpm dev` (Vite dev server on localhost:1420). + - Full app: `pnpm tauri dev` (starts Tauri with embedded webviews). + - Build: `pnpm build` (frontend dist), `pnpm tauri build` (desktop binaries). - **Debugging:** - - Use Tauri's dev tools for backend; React/Vite for frontend. + - Backend: Tauri's dev tools (Rust logs, webview inspection). + - Frontend: Browser dev tools on webviews; React DevTools not directly available. - Hotkeys: `Ctrl+Enter`/`Cmd+Enter` to send chat (see `Ask.tsx`). ## Communication Patterns -- **Frontend <-> Backend:** - - Use Tauri `invoke` API to call Rust commands (see `src-tauri/src/core/cmd.rs`). - - Example: `invoke('ask_send', { message })` triggers backend chat logic. - - Backend commands update config, window state, and trigger frontend JS via webview eval. +- **Frontend <-> Backend:** Tauri `invoke` calls Rust commands (e.g., `invoke('ask_send')` triggers JS eval in main webview). +- **Data Flow:** Ask view inputs text → `ask_sync` updates main webview textarea via injected `ChatAsk.sync()` → `ask_send` clicks submit button in main webview. +- **Config:** JSON-based (`AppConf` in Rust), amended and saved via commands; loaded on app start. ## Project-Specific Conventions -- **View Routing:** - - Main React app renders views based on Tauri webview label (`App.tsx`). -- **Config Management:** - - App config is loaded/amended via Rust (`AppConf` in `src-tauri/src/core/conf.rs`). -- **UI State:** - - State hooks and hotkeys are used for chat input and window controls. -- **Styling:** - - Uses Tailwind CSS (`base.css`, `tailwind.config.js`). +- **Path Aliases:** `~` for `src/` (e.g., `~view/Titlebar`). +- **View Routing:** Based on webview label; add new views in `viewMap` in `App.tsx`. +- **Styling:** Tailwind CSS; dark/light themes via config. +- **JS Injection:** Custom scripts in `src-tauri/scripts/` loaded as webview init scripts (e.g., `ask.js` for ChatAsk class). +- **Window Layout:** Dynamic resizing via `set_view_ask` command; different logic for macOS vs. others. ## Integration Points -- **Tauri Plugins:** - - OS, Shell, Dialog plugins enabled in backend (`main.rs`). -- **External APIs:** - - Chat logic is abstracted; see `cmd.rs` for backend command triggers. +- **Tauri Plugins:** OS, Shell, Dialog enabled; used for platform detection, file ops. +- **External APIs:** None direct; interacts with ChatGPT via DOM manipulation in embedded webview. +- **Config Storage:** JSON in app config dir (`~/.config/com.nofwl.chatgpt/config.json`). ## Examples -- **Add a new backend command:** - - Implement in `src-tauri/src/core/cmd.rs`, register in `main.rs`. - - Call from frontend via `invoke('your_command', { ... })`. -- **Add a new view:** - - Create in `src/view/`, add to `viewMap` in `App.tsx`. +- **Add Backend Command:** Implement in `cmd.rs`, register in `main.rs`, invoke from frontend. +- **Modify Chat Input:** Update `Ask.tsx` and `ask.js` for sync/submit logic. +- **Add View:** Create in `src/view/`, add to `viewMap` in `App.tsx`, create webview in `setup.rs`. ## References -- `README.md`: High-level project info. -- `package.json`: Scripts and dependencies. -- `src-tauri/src/core/cmd.rs`: Backend command patterns. -- `src/view/Ask.tsx`, `Titlebar.tsx`: UI logic and Tauri integration. +- `src-tauri/src/core/cmd.rs`: Command implementations and webview manipulations. +- `src/view/Ask.tsx`: Input handling and backend invokes. +- `src-tauri/scripts/ask.js`: JS injected for ChatGPT DOM interaction. +- `src-tauri/src/core/setup.rs`: Webview creation and layout. --- -_Keep instructions concise and focused on current codebase patterns. Update this file if major workflows or architecture change._ +_Keep instructions concise and focused on current codebase patterns. Update if architecture changes._