test
Prompt
# MASTER DEVELOPMENT PROMPT # CHATGPT ACCOUNT MANAGER β STANDALONE WINDOWS DESKTOP APP ## ROLE AND MISSION Act as an expert Electron/TypeScript architect, Windows developer, UI/UX designer, QA and security engineer. Build **ChatGPT Account Manager (CAM)** from scratch as a complete Windows 10/11 x64 app using Electron + React + TypeScript + Vite. **No source ZIP, starter project, template, Telegram project, or initial file will be provided. Do not ask for one or depend on one.** Create all source, assets, configs, tests, scripts, and docs. Deliver a working application, not a plan or scaffold. Use compatible maintained dependencies, strict TS, and a lockfile. CAM organizes multiple independent ChatGPT website accounts with persistent isolated browser sessions/profiles. Users sign in manually at `https://chatgpt.com/`. This is not an API client, scraper, or automation tool. ## FINAL DELIVERY CONTRACT Deliver one complete source ZIP: `ChatGPT-Account-Manager-1.0.0-Source.zip`, smaller than **134,217,728 bytes (128 MiB)**; target below 110 MiB. Include essential source/tests/docs/config/scripts/assets and `package-lock.json`; clean extraction must support `npm ci`, development, testing, and local builds. Exclude `.exe`, installers, portable builds, `.dll`, `node_modules`, downloaded Electron/browser binaries, caches, temporary files, development profiles, cookies, credentials, tokens, passwords, MFA codes, and live sessions. Never remove essential source to reduce size. Before delivery measure actual bytes; scan/list contents for forbidden files/secrets/profiles/caches/sessions/dependencies; extract to a fresh folder; verify required files; run feasible checks there. Remove only generated/redundant content if oversized. Never claim an unrun check passed; report PASSED/FAILED/BLOCKED/NOT RUN. ## IDENTITY AND BOUNDARIES Name `ChatGPT Account Manager`; short name `CAM`; package `chatgpt-account-manager`; app ID `com.chatgpt.accountmanager`; URL `https://chatgpt.com/`. Apply branding to title, tray, About, metadata, logs, build config, and docs. Create lightweight original icons. No Telegram references/features. Scope: account metadata, isolated sessions/profiles/windows, dashboard, search/filter, favorites, archive, settings, tray, data backup/export, diagnostics, tests. Never use API keys/API ID/Hash, unofficial auth endpoints, password/code collection, token/cookie extraction, private data scraping, automated actions/messages, CAPTCHA/MFA/Cloudflare bypass, fingerprint spoofing, TLS interception, script injection, or weakened security. Never infer login/plan via private site state. Email/plan labels are user notes only. ## ARCHITECTURE Create `src/main/` (lifecycle, account/session/window/storage/security/permissions/tray/logger/native launcher/IPC); `src/preload/` (minimal typed bridge); `src/shared/` (types, schemas, validation, IPC contracts); `src/renderer/` (React pages/components/hooks/services/styles/localization); `tests/unit`, `integration`, `isolation`, `e2e`; plus useful `scripts/` and lightweight `build/` assets. Use one account service and one window manager. Keep business logic out of React. Validate runtime inputs (Zod or equivalent), use strict TS and typed IPC. No empty placeholders or fake modules. Suggested files include `main.ts`, `appController.ts`, `accountService.ts`, `sessionManager.ts`, `windowManager.ts`, `storageManager.ts`, `permissionManager.ts`, `security.ts`, `tray.ts`, `logger.ts`. ## ACCOUNT MODEL AND STORAGE Each account has a strong local UUID and fields such as name, optional email/description/notes/tags/category/user-entered plan, favorite/archive flags, browser mode, partition, timestamps, and window bounds. `browserMode`: `electron` or `native`. Main process alone generates UUID/partition/profile. Reject duplicate IDs/partitions; metadata edits never change session identity. Store metadata under Electron `app.getPath('userData')`; separate JSON, backup, logs, and native `BrowserProfiles/<UUID>/`. Resolve paths only inside app-owned roots. Metadata never contains cookies, passwords, tokens, auth headers, or codes. Implement schema versioning, validation, migrations, atomic writes, backup-before-mutation, serialized writes, safe shutdown, and corruption recovery. Preserve backup on corruption; never overwrite a newer schema. Export/import/backup metadata only. Version and validate imports; reject paths, partitions, executables, invalid fields; never silently merge/overwrite; report ID conflicts. ## SESSIONS, WINDOWS, AUTHENTICATION **Electron:** In main process create one stable persistent session per account with `session.fromPartition('persist:chatgpt-<uuid>')`. UUID always maps to the same unique partition; never use default session or share partitions. Cookies, Local Storage, IndexedDB, Cache Storage, service workers, and Chromium data remain isolated and survive window close/restart. Archive/edit/close never clears data; clear/delete affects only the selected account. Use one UUID-keyed `BrowserWindow` map. Reopen focuses the existing window. Each window uses only its account session. Support refresh/back/forward/minimize/maximize/restore and saved bounds clamped to display. Dispose listeners/references on destruction. Track `closed/opening/loading/open/error/archived`; open does not mean signed in. Handle offline, timeout, redirects, and load errors with a retry/open-in-browser error page, never fake login. Remote windows: `nodeIntegration:false`, `contextIsolation:true`, `sandbox:true`, `webSecurity:true`, `allowRunningInsecureContent:false`, `webviewTag:false`; no privileged preload. Start at `https://chatgpt.com/`. Use a narrow HTTPS allowlist for official site and specific legitimate auth redirects; no wildcards. Validate navigation/popups/protocols/external links; reject arbitrary `file:`, custom, or untrusted URLs. Dashboard preload remains separate. Never inject site scripts. Users authenticate manually. Never request/store passwords, email/MFA/recovery codes; never extract cookies/tokens/auth headers or automate login/messages. Support official sign-in methods only as browser permits. Do not bypass provider blocks or spoof browsers. If embedded auth fails, explain and offer native mode. Never invent endpoints; mark unverified flows for manual checks. **Native:** Launch installed Chrome/Edge with a unique `--user-data-dir` under `BrowserProfiles/<UUID>/`; safely detect installation or use trusted file picker. Never use default/shared profiles or inspect/copy profile credentials/cookies. Electron/native cookies are not shared. Track only CAM-launched processes; never kill unrelated browsers or delete a live profile. Native mode can launch/focus/close but cannot reliably inspect login or control internal navigation. Document as fallback, not embedded parity; handle paths with spaces, missing browser, locks, and launch errors. Test with local fixtures and disposable profiles, never real credentials. ## ACCOUNT MANAGEMENT Add Account dialog: required name; optional email label, description, category, user-entered plan, notes, tags, favorite, icon/color, browser mode. Validate; main process creates UUID/partition. Optional auto-open; explain record creation is not login. Support edit/rename without UUID/session change, favorite, archive/restore (session preserved), copy label, clear one session, and delete. Permanent delete requires typing exact name; close only its CAM-owned window/process, clear only its session/profile after closure, remove metadata, update UI, and log redacted event. Report partial cleanup and offer retry; never claim full deletion. Search name/email/tags/category; filter favorite/plan/category/active/archived/browser mode; sort and multi-select. Implement Open/Close Selected and Open/Close All with stagger, concurrency limit, progress, per-account errors, and large-batch warning. Cards show initials, name, email, category, manual plan, favorite, browser mode, true window/process state, last-opened time. Wire open/focus, close, edit, archive, favorite, clear, copy, browser settings, delete. No dead buttons. ## DASHBOARD, UI, SETTINGS Polished desktop UI: dark default, charcoal/black surfaces, restrained purple accent, readable typography, contrast, spacing, subtle borders. Avoid neon/clutter/fake status. Sidebar: Dashboard, All Accounts, Favorites, Archived, Settings, About. Statistics use local data only: total/active/archived/open/favorites and manual plan/category counts. Include search/filter, empty/loading/error states, confirmations, keyboard access, responsive cards/dialogs. Support English/Persian with correct LTR/RTL (sidebar, forms, dialogs, icons, tables, mixed email text); persist language and use localization dictionaries. Every visible control works; no placeholder pages, fake toggles, dead nav, or fake stats. Persist settings: language/theme; Windows startup via supported API; tray/close behavior; restore only last-open windows; start minimized; auto-open after creation; batch delay/concurrency; default bounds/browser mode; show archived; destructive confirmations; compact/sidebar; clear sessions; open data/log dirs; metadata export/import/backup/restore. Clear all requires typing `CLEAR-ALL` plus second confirmation. Explain sign-out; never clear live native profile. Use trusted dialogs; renderer cannot supply paths. ## SECURITY, IPC, PERMISSIONS, LOGS Treat renderer/remote content as untrusted. Dashboard: context isolation, no Node integration, sandbox, strict CSP, minimal preload. Expose only typed named bridge methods, never raw `ipcRenderer`, `fs`, `shell`, `session`, `BrowserWindow`, or generic IPC. Remote windows get no Node/privileged preload. Every IPC handler validates sender/frame, schema, UUID, lengths, enums, unexpected properties, account, and operation. Main process alone chooses paths, partitions, executable args. Block traversal, arbitrary partition selection, command execution, arbitrary URLs. Keep HTTPS/web security enabled. Deny unnecessary permissions. Handle mic/camera/notifications/clipboard/geolocation/screen capture explicitly; request consent as needed and scope by account where supported. Never silently grant sensitive access. Use bounded rotating structured logs; redact and never log passwords, codes, cookies, tokens, auth headers, private responses, or sensitive queries. ## TRAY, LIFECYCLE, RESOURCES, ERRORS Tray: Show Dashboard, Favorites, Open Selected, Open All, Close All, Settings, Exit. Minimize follows settings; closing dashboard never clears sessions. Exit stops work, closes CAM-owned windows/processes, flushes sessions, atomically saves metadata, disposes listeners/tray, quits. OS shutdown is best effort. Restore only last-open accounts if enabled, respecting limits/delay; do not open all by default. Warn Chromium uses RAM/CPU. Avoid polling, duplicates, stale references, listener leaks. Handle offline/site failures, timeout, bad redirects, session/profile failure/lock, missing browser, permissions, invalid import, corrupt metadata, duplicate IDs/windows, disk errors, cleanup failure, unexpected exit. Give actionable errors/retry and preserve data. Open window/manual plan is not proof of authentication/subscription. Diagnostics shows app/Electron/Chromium/Node versions and data/log paths, never profile contents. ## TESTING β REQUIRED Use local fixtures, synthetic data, disposable profiles; no real credentials. Tests must exercise real behavior. Unit: UUID/schema; account CRUD/archive/favorite; search/filter/sort; partition derivation; settings; atomic storage/backup/restore/migrations/corruption/newer-schema; IPC; URL/permission policy; log redaction; failures. Isolation: two partitions verify distinct cookies, Local Storage, IndexedDB, Cache Storage; close/reopen and app-restart persistence where feasible; clearing/deleting A leaves B; archive preserves storage; duplicate open reuses one window. Test native path uniqueness without inspecting credentials. E2E: startup/dashboard; add/edit/rename; search/filter; favorite; archive/restore; delete confirmation; settings; tray where supported; clear confirmation; window states. Never automate real login. Optional online smoke only opens `https://chatgpt.com/` without sign-in. Implement real scripts: typecheck, lint, test, test:isolation, test:e2e, build, package:win, verify. No no-op green scripts. Run feasible checks; report PASSED/FAILED/BLOCKED/NOT RUN. No GUI pass without GUI. ## BUILD AND DOCUMENTATION Use supported Node.js LTS and document exact version. Include package/lock files, tsconfig, Vite/Electron Builder, lint/test config, scripts, assets, source. `npm ci` must work; do not bundle dependencies/runtime binaries. Support `npm ci`, `npm run dev`, `npm run typecheck`, `npm test`, `npm run build`, `npm run package:win`. Packaging may create EXE/installer locally only when explicitly run; never include in ZIP. Document real output paths. Write accurate `README.md`, `README-fa.md`, `CHANGELOG.md`. Cover purpose/limits, Windows/Node, exact CMD commands, install/run/build/test, account operations, manual login, isolation, Electron/native limits, archive/restore/delete, clear sessions, metadata backup/export, storage, security/permissions, troubleshooting, diagnostics. Explain email/plan are user labels, metadata excludes sessions, native profiles do not share cookies. Commands must match app. Persian guide must be natural and CMD-copyable. ## EXECUTION AND ACCEPTANCE Assume no starter project. Create app from scratch: types/schemas/IPC/storage; account/session/window/auth/security; UI/features/settings/tray; tests/docs; ZIP. Run `npm ci` and checks; fix real errors without deleting tests or weakening security. Review IPC, allowlists, paths, cleanup, permissions, and redaction. Measure/scan/extract/verify ZIP. Do not ask for files or pause for routine choices. If an API cannot support a feature, implement a safe alternative, document it, continue, and report blockers. Acceptance: functional standalone Windows app; dashboard/accounts/favorites/archive/settings/About/tray; UUID-based persistent isolated sessions; restart persistence; duplicate-window prevention; concurrent accounts; account-specific clear/delete; manual official login; no credential extraction; secure Electron/IPC/navigation/permissions; atomic versioned metadata/recovery; staggered opening; implemented English/Persian LTR/RTL; meaningful tests/honest results; reproducible docs/scripts; verified ZIP below 134,217,728 bytes, with essential source/tests/docs/assets/lockfile and no executables/installers/DLL/dependencies/browser binaries/caches/secrets/sessions. Clean extraction required. ## FINAL DELIVERY REPORT Report features, architecture, session/auth/security limits, test statuses, build path, ZIP name and measured size, archive scan/extraction, and excluded files. Link the actual ZIP; state untested items. Never claim unverified completion. List caveats.
Response not available
Response not available