opencode-voice-dictation/AGENTS.md
Sergey 186403c2d5
chore(repo): bump version to 1.0.4 and add AGENTS.md (#45)
## Что сделано

- Создан `AGENTS.md` в корне репо — проект-specific правила для агентов
(дистилляция memory-файла): version bump (CRITICAL), `@connect`,
dist-деплой, `@icon`, селекторы композера, стек, команды, структура
`src/`, тесты.
- Version bump 1.0.3 → 1.0.4 синхронно в двух файлах: `vite.config.ts`
(`userscript.version`) + `package.json` (`version`).

## Почему

PR #43 смержен с фичами (custom endpoint, temperature, short prompt)
**без** version bump — Tampermonkey/Violentmonkey не видят
автообновление, юзеры не получат новую версию. В репо отсутствовал
`AGENTS.md` — subagent'ы работали вслепую без проект-specific правил,
что и привело к пропущенному bump'у. `AGENTS.md` фиксирует критичные
инварианты для будущих PR-агентов.

## Watch out

- `AGENTS.md` дополняет глобальный `~/.config/opencode/AGENTS.md`, НЕ
заменяет его — opencode грузит оба файла вместе.
- Version bump — patch increment (semver-совместимый). Без bump
`@version` userscript-менеджеры не триггерят автообновление.
- Файлы `src/`, `tests/`, `@connect`, селекторы композера — НЕ тронуты
(вне scope).
- `dist` ветка обновится автоматически через `deploy.yml` после merge в
`main`.

## Pending

- Авто-деплой в `dist` после merge (deploy.yml,
peaceiris/actions-gh-pages@v4).

Closes #44

Closes #44

---------

Co-authored-by: opencode-agent <agent@opencode.local>
2026-08-04 12:49:01 +03:00

3.1 KiB
Raw Permalink Blame History

opencode-voice-dictation

Project-specific rules for agents. This file complements the global ~/.config/opencode/AGENTS.md (orchestrator model, pipeline, code style) — it does NOT replace it. Both are loaded together by opencode.

Version bump (CRITICAL)

Bump version in both files synchronously on every PR touching src/, vite.config.ts, or tests/:

  • vite.config.tsuserscript.version (vite-plugin-monkey reads @version from here, NOT from package.json)
  • package.jsonversion (for npm/semver tooling only)

Desync (bumping only one file) = userscript managers (Tampermonkey/Violentmonkey) do not see the auto-update even though npm sees the new version. Without a bump at all, auto-update never triggers.

@connect

vite.config.ts userscript.connect generates the @connect metablock. Currently * (user-configurable endpoint — the domain is not known ahead of time). Do NOT narrow it back to api.groq.com — that breaks custom STT proxies (Groq IP-block workarounds via user nginx proxy_pass).

Dist deploy

The dist branch is the only distribution channel for the userscript. Deploy happens via deploy.yml (peaceiris/actions-gh-pages@v4) on push to main. GitHub Releases were removed (PR#37, ADR-0005). @updateURL/@downloadURL point to raw files on the dist branch — bumping @version + deploying to dist is sufficient for auto-update.

@icon

vite.config.ts userscript.iconmain/assets/icon.png (128×128 PNG RGBA). Do NOT delete assets/icon.png and do NOT change the path without editing both the file location and the icon URL in sync.

Composer selectors (brief)

COMPOSER_SELECTORS in src/ui.ts — order = detection priority (primary → fallback). Current order: prompt-input-v2session-prompt-docksession-new-composersession-composer. Do NOT change the order without an ADR. session-prompt-dock is a wrapper for three conditionally-rendered blocks; the guard checks for a real composer (prompt-input/prompt-input-v2) inside the dock. See ADR 00010004 in docs/decisions/.

Stack

Vite 6 + vite-plugin-monkey 5 + TypeScript 5.7 (strict) + Biome 1.9.4 (2-space, 100 width, double quotes, semicolons, trailing commas, noExplicitAny: error) + Vitest 3 + Knip 6.24. Node 22 (.nvmrc), engines: node >=20.

Commands

  • npm run lint (biome check)
  • npm run typecheck (tsc --noEmit)
  • npm run test (vitest run)
  • npm run knip (dead-code)

Coverage thresholds: 60%.

src/ structure

  • index.ts — entry, polling init
  • audio.tsMediaRecorder (webm/opus)
  • transcribe.tsGM_xmlhttpRequest to config.endpoint
  • config.tsGM_getValue/GM_setValue, 7 menu commands
  • insert.ts — DOM manipulation, contenteditable
  • ui.ts — mic button inject, MutationObserver
  • keyboard.ts — Ctrl+Space
  • types.tsAppConfig

Tests

Vitest + happy-dom. The $ module (vite-plugin-monkey's GM_* alias) is mocked at tests/__mocks__/$/index.ts via vitest resolve.alias. Coverage excludes index.ts, ui.ts, audio.ts, types.ts.