Skip to content

Latest commit

 

History

History
142 lines (103 loc) · 7.41 KB

AGENTS.md

File metadata and controls

142 lines (103 loc) · 7.41 KB

Agent Instructions

This repo uses Astro, Tailwind CSS v4, and bun.

Package Manager

  • Always use bun instead of npm or yarn.
  • Always use bunx instead of npx.

Tailwind CSS

  • Always prefer the current Tailwind v4 canonical utility names.
  • Do not introduce deprecated utility aliases when editing templates or styles.
  • Example: prefer bg-linear-to-r over bg-gradient-to-r.

Tailwind Migration Command

  • When old Tailwind utility names need to be migrated, use the official upgrader:
bunx @tailwindcss/upgrade --force
  • Use that command to fix deprecated class syntax across the repo instead of doing large manual replacements.

Social Meta Images

  • Do not switch Open Graph or Twitter/X social meta images to webp; use png or jpg/jpeg for those assets and tags.

Plugin Count Copy

  • Never hardcode the number of Capgo plugins in text, marketing copy, docs, or UI.
  • Use the real registry-derived count from apps/web/src/config/plugins.ts (pluginCount or pluginCountLabel) anywhere code can import it.
  • In Markdown or static content that cannot import the registry value, avoid stating a plugin count and link to the live plugin directory instead.

Adding A Plugin To The Website

  • Add the plugin registry entry in apps/web/src/config/plugins.ts inside actionDefinitionRows with the package name, title, short description, and GitHub URL.
  • Add the plugin docs in apps/docs/src/content/docs/docs/plugins/<docs-slug>/index.mdx and apps/docs/src/content/docs/docs/plugins/<docs-slug>/getting-started.mdx.
  • Add the English tutorial in apps/web/src/content/plugins-tutorials/en/<tutorial-slug>.md.
  • The tutorial slug must match the GitHub URL slug used by item.href on the plugin entry because /plugins/[slug] resolves from that repo slug. Examples: https://github.com/Cap-go/capacitor-live-activities/ -> apps/web/src/content/plugins-tutorials/en/capacitor-live-activities.md https://github.com/Cap-go/electron-updater/ -> apps/web/src/content/plugins-tutorials/en/electron-updater.md
  • Register documented plugins in apps/docs/src/config/sidebar.mjs so they appear in the Starlight plugin sidebar.
  • Register documented plugins in apps/docs/src/config/llmsCustomSets.ts so they appear in the docs search and LLM sets.
  • Refresh metadata after adding a plugin with bun run fetch:stars and bun run fetch:downloads.
  • Validate the change with bunx prettier --write <touched-files> and NODE_OPTIONS=--max-old-space-size=16384 bunx astro check in both apps/web and apps/docs, or bun run check from the repo root.

Blog And Page Slugs

  • Never change an existing public URL slug (blog posts, pages, docs) once it has been published and indexed.
  • If a slug must change, add redirects for the old path in the same change: prefer apps/shared/legacyPathRedirects.ts (web + translation workers) and docs worker code for /docs/*. Use apps/web/public/_redirects only for a small set of static exact-path rules — never re-add bulk blog renames or splat/* rules there (Cloudflare caps dynamic _redirects at 100, and any splat makes later rules count as dynamic).
  • Preserve locale prefixes (/de/, /fr/, etc.) so each language keeps working backlinks.
  • Prefer permanent (301) redirects so earned backlinks are not lost.

Outrank Imported Posts (HARD RULE)

  • An Outrank-imported post is any blog file added or updated by a chore: import Outrank articles commit (Outrank also pushes updates to existing posts). Check on a full (non-shallow) clone with git log --follow --format=%s -- <file> | grep -Fx 'chore: import Outrank articles'.
  • Never remove or change outbound links in these posts. They are backlink exchanges we must keep, including during SEO rewrites. Rewrite the prose around a link if needed, but keep the link URL and anchor text.
  • Never prune, redirect, or delete an Outrank-imported post without asking Martin first.

Visual Diff For PRs

Use the visual diff tool whenever a PR changes page layout, styling, components, or marketing copy that affects rendered HTML.

When To Run

  • Before starting visual work: capture a before baseline from main (or the PR base branch).
  • Before opening the PR: capture after, compare, and paste the report into the PR description.
  • After each new push to the PR when the author or reviewer asked for visual verification: rebuild, re-capture after, re-compare, and post an updated report as a new PR comment.

Setup (once per machine)

bun install
bun run visual-diff:setup

Requires ImageMagick (compare CLI) for pixel diffs.

Workflow

# 1. Baseline (on main or base branch, before your changes)
bun run build
bun run visual-diff:capture:before

# 2. After your visual changes
bun run build
bun run visual-diff:capture:after

# 3. Compare + PR markdown
bun run visual-diff:compare
bun run visual-diff:report

Paste the ## Visual diff section from bun run visual-diff:report into the PR description. On follow-up pushes with visual changes, run steps 2–3 again and post the updated markdown in a new comment.

Focused captures

Default routes live in visual-diff.config.json. Override for a targeted PR:

bun run visual-diff:capture:before -- --suite web --routes /,/pricing/
bun run visual-diff:capture:after -- --suite web --routes /,/pricing/

Agent checklist

  1. Confirm the PR includes visual/UI changes (or the user explicitly requested visual verification).
  2. Run the workflow above before marking the PR ready.
  3. Include the visual diff markdown in the PR body.
  4. After subsequent pushes that change visuals, re-run capture:after, compare, and report; post the fresh results.
  5. Do not commit .visual-diff/ artifacts — they are gitignored.

AI model freshness (HARD RULE)

Applies to every AI feature in this repo (workers such as apps/translation-worker, scripts, CI) and to services it calls.

  • Never ship or keep a model whose release is more than 5 months old.
  • Treat a model more than 3 months old as already old: when you touch an AI feature, move it to the newest good model.
  • Check the age and planned deprecation against the provider's live catalog, never from memory. For Workers AI:
    • GET https://api.cloudflare.com/client/v4/accounts/<account>/ai/models/search?task=Text%20Generation&per_page=200 (use created_at and properties.planned_deprecation_date).
    • GET https://api.cloudflare.com/client/v4/accounts/<account>/ai/models/schema?model=<id> for the inputs the model supports (reasoning_effort, chat_template_kwargs, response_format, ...).
  • Never pick a model that has a planned deprecation date.
  • Reasoning models used for short structured output must turn thinking off (chat_template_kwargs: { enable_thinking: false } or reasoning_effort: 'none', whichever the model schema supports), or they burn the token budget and return empty content. Confirm with one real call that thinking is actually off: some models ignore the flag (GLM-5.3 still reasoned with enable_thinking: false). In the translation worker, add the model family to THINKING_MODEL_PREFIXES.
  • Keep the model overridable by env var (for example TRANSLATION_MODEL, TRANSLATION_REVIEW_MODEL), and note the catalog created_at next to the default.
  • A model swap can trigger mass regeneration (for example bumping TRANSLATION_MEMORY_VERSION re-translates the whole site): decide it deliberately and state the impact in the PR.