Skip to content

Latest commit

 

History

History
59 lines (51 loc) · 3.46 KB

AGENTS.md

File metadata and controls

59 lines (51 loc) · 3.46 KB

Project basis

WXT + SolidJS + DaisyUI

Current project is a browser extension to translate text on web pages. Adapt to major translation platforms and LLMs, including Google Translate, Bing, DeepL, ChatGPT, Claude, Gemini, etc.

Unlike the traditional translation implementation, the extension will append the translated text to the original text, allowing users to see both versions side by side.

Structure

  • .output/: All build artifacts will go here
  • .wxt/: Generated by WXT, it contains TS config
  • assets/: Contains all CSS, images, and other assets that should be processed by WXT
  • components/: Contains UI components
  • entrypoints/: Contains all the entrypoints that get bundled into your extension
  • hooks/: Contains source code for your project's hooks for React and Solid
  • modules/: Contains local WXT Modules for your project
  • public/: Contains any files you want to copy into the output folder as-is, without being processed by WXT
  • utils/: Contains generic utilities used throughout your project
  • .env: Contains Environment Variables
  • .env.publish: Contains Environment Variables for publishing
  • app.config.ts: Contains Runtime Config
  • package.json: The standard file used by your package manager
  • tsconfig.json: Config telling TypeScript how to behave
  • web-ext.config.ts: Configure Browser Startup
  • wxt.config.ts: The main config file for WXT projects

Development & Build

  • bun run dev - Start development server with hot reload
  • bun run dev:firefox - Start development server for Firefox
  • bun run build - Build the extension for Chrome
  • bun run build:firefox - Build the extension for Firefox
  • bun run zip - Package extension into zip file
  • bun run zip:firefox - Package Firefox extension
  • bun run compile - Run TypeScript type checking (no emit)
  • bun run lint - Run Biome linter to check code style
  • bun run lint:fix - Run Biome linter to fix code style
  • bun run lint:fix:unsafe - Run Biome linter to fix code style (with unsafe fix)

Notes

  1. Always use context7 when code generation is needed, setup or configuration steps, or library/API documentation. This means you should automatically use the Context7 MCP tools to resolve library id and get library docs without me having to explicitly ask.
  2. Keep reactivity in SolidJS by avoiding direct destructuring of props or store/signal values. For example, avoid:
export default (props: Props) => {
  const { name } = props; // ❌: breaks reactivity and will not update when the prop value changes
  const name = props.name; // ❌: another example of breaking reactivity
  const name = () => props.name; // ✓: by wrapping `props.name` into a function, `name()` always retrieves its current value
  // Same for `createStore` and `createSignal`.
}
  1. When implementing new features including text content, first add a placeholder key in locales/en.toml, then use the key by:
import { t } from '~/utils/i18n';
export default () => {
  return <div>{t('your_placeholder_key')}</div>;
};
  1. If user is asking for "add missing i18n keys", you can run bun run ./scripts/diff-locales.ts to get the missing keys compared to locales/en.toml.