Правила для JsonRpcBundle

Як агенту працювати з ufo-tech/json-rpc-bundle 10.4 — процедури, параметри, результати, помилки, кеш, версії й групи API, події, відомі пастки й перевірка результату.

Встановити через агента — скажіть йому:

Прочитай https://ufo-tech.space/ai/install.md і встанови правило json-rpc-bundle з каталогу UFO Tech у цей проєкт.

Встановлення

Claude Code

У проєкт — docs/ai/json-rpc-bundle.md

macOS, Linux, WSL, Git Bash

mkdir -p "docs/ai"
curl -fsSL https://ufo-tech.space/ai/files/rule/json-rpc-bundle/universal/json-rpc-bundle.md -o "docs/ai/json-rpc-bundle.md"

Windows PowerShell

New-Item -ItemType Directory -Force "docs\ai" | Out-Null
Invoke-WebRequest https://ufo-tech.space/ai/files/rule/json-rpc-bundle/universal/json-rpc-bundle.md -OutFile "docs\ai\json-rpc-bundle.md"

Додайте в CLAUDE.md у корені проєкту рядок:

@docs/ai/json-rpc-bundle.md

Codex

У проєкт — docs/ai/json-rpc-bundle.md

macOS, Linux, WSL, Git Bash

mkdir -p "docs/ai"
curl -fsSL https://ufo-tech.space/ai/files/rule/json-rpc-bundle/universal/json-rpc-bundle.md -o "docs/ai/json-rpc-bundle.md"

Windows PowerShell

New-Item -ItemType Directory -Force "docs\ai" | Out-Null
Invoke-WebRequest https://ufo-tech.space/ai/files/rule/json-rpc-bundle/universal/json-rpc-bundle.md -OutFile "docs\ai\json-rpc-bundle.md"

Додайте в AGENTS.md у корені проєкту рядок:

Follow docs/ai/json-rpc-bundle.md.

Cursor

У проєкт — .cursor/rules/json-rpc-bundle.mdc

macOS, Linux, WSL, Git Bash

mkdir -p ".cursor/rules"
curl -fsSL https://ufo-tech.space/ai/files/rule/json-rpc-bundle/universal/json-rpc-bundle.md -o ".cursor/rules/json-rpc-bundle.mdc"

Windows PowerShell

New-Item -ItemType Directory -Force ".cursor\rules" | Out-Null
Invoke-WebRequest https://ufo-tech.space/ai/files/rule/json-rpc-bundle/universal/json-rpc-bundle.md -OutFile ".cursor\rules\json-rpc-bundle.mdc"

Prepend Cursor frontmatter: description (one line), globs (if the rule targets specific paths), alwaysApply: false.

GitHub Copilot

У проєкт — .github/instructions/json-rpc-bundle.instructions.md

macOS, Linux, WSL, Git Bash

mkdir -p ".github/instructions"
curl -fsSL https://ufo-tech.space/ai/files/rule/json-rpc-bundle/universal/json-rpc-bundle.md -o ".github/instructions/json-rpc-bundle.instructions.md"

Windows PowerShell

New-Item -ItemType Directory -Force ".github\instructions" | Out-Null
Invoke-WebRequest https://ufo-tech.space/ai/files/rule/json-rpc-bundle/universal/json-rpc-bundle.md -OutFile ".github\instructions\json-rpc-bundle.instructions.md"

Prepend frontmatter with applyTo, e.g. applyTo: "src/**".

AGENTS.md

У проєкт — docs/ai/json-rpc-bundle.md

macOS, Linux, WSL, Git Bash

mkdir -p "docs/ai"
curl -fsSL https://ufo-tech.space/ai/files/rule/json-rpc-bundle/universal/json-rpc-bundle.md -o "docs/ai/json-rpc-bundle.md"

Windows PowerShell

New-Item -ItemType Directory -Force "docs\ai" | Out-Null
Invoke-WebRequest https://ufo-tech.space/ai/files/rule/json-rpc-bundle/universal/json-rpc-bundle.md -OutFile "docs\ai\json-rpc-bundle.md"

Додайте в AGENTS.md у корені проєкту рядок:

Follow docs/ai/json-rpc-bundle.md.

Опис

Файл інструкцій для проєктів, що надають API через JsonRpcBundle. Він підключається поруч із вашими правилами й не замінює ваш AGENTS.md чи CLAUDE.md. Написано англійською, бо асистенти стабільніше виконують англомовні інструкції; версія бандла — 10.4.

Що всередині

Як агенту працювати — на початку файлу:

  • джерело правди — встановлений код бандла у vendor/ і описи релізів у vendor/ufo-tech/json-rpc-bundle/releases/, а не пам'ять моделі;
  • перевіряти встановлену версію; не вигадувати класи, атрибути, опції; про суперечність правил і коду — повідомляти;
  • не змінювати публічні RPC-контракти без потреби (несумісні зміни — нова версія API) і не рефакторити поза задачею.

Правила бібліотеки — коротко, з посиланнями на документацію замість пояснень: тонкі процедури, DTO і декларативна валідація, формат результату, помилки, кеш, версії та групи API, події.

Відомі пастки 10.4 — застарілі атрибути й події, #[RPC\DTOCollection] на методі, ttl для #[RPC\Lock], особливості подій для Messenger і помилок HTTP (див. Актуальні помилки).

Перевірка перед завершенням — тести, виклик зміненого методу, схема в GET /rpc.

Чому це не документація

Файл навмисно не пояснює, як працюють механізми, — для цього є документація, на яку він посилається. Так інструкція лишається короткою і не перетворюється на другу копію документації, яка з часом розійдеться з першою.

Разом з цим

<div class="docs-page-votes" data-page-votes hidden data-endpoint="/votes" role="group" aria-label="Оцінка сторінки"> <button class="docs-page-votes__button" type="button" data-vote="1" aria-pressed="false" title="Корисно"> <span aria-hidden="true">👍</span> <span class="visually-hidden">Корисно</span> <span data-vote-count>0</span> </button> <button class="docs-page-votes__button" type="button" data-vote="-1" aria-pressed="false" title="Не корисно"> <span aria-hidden="true">👎</span> <span class="visually-hidden">Не корисно</span> <span data-vote-count>0</span> </button> </div> <p class="docs-page-counters" data-page-counters hidden data-endpoint="/_e/page" data-label-total="Переглянуто: {count} {times}" data-label-now="Зараз переглядають: {count}" data-times="{&quot;one&quot;:&quot;\u0440\u0430\u0437&quot;,&quot;few&quot;:&quot;\u0440\u0430\u0437\u0438&quot;,&quot;many&quot;:&quot;\u0440\u0430\u0437\u0456\u0432&quot;,&quot;other&quot;:&quot;\u0440\u0430\u0437\u0443&quot;}"> <span data-page-counters-total></span> <span aria-hidden="true">·</span> <span data-page-counters-now></span> </p>