Expand AGENTS.md with current repo and reporting rules
This commit is contained in:
248
.agent/skills/communication-reporting/SKILL.md
Normal file
248
.agent/skills/communication-reporting/SKILL.md
Normal file
@@ -0,0 +1,248 @@
|
||||
# Skill: Communication Reporting
|
||||
|
||||
## Когда использовать
|
||||
|
||||
Используй этот skill в каждом ответе пользователю после анализа, правки кода, ревью, аудита, планирования рефакторинга или подготовки PR. Особенно если задача затрагивает несколько файлов, backend/frontend boundary, security, Windows services или UI.
|
||||
|
||||
## Цель
|
||||
|
||||
Писать так, чтобы человек с опытом разработки быстро понял суть без чтения технической простыни. Не упрощать до детского сада, но объяснять по-человечески: что поменялось, где, зачем, как проверить, где риск.
|
||||
|
||||
Пользователь не обязан продираться через внутренний монолог агента и каталог аббревиатур. У него есть жизнь, возможно даже вне репозитория, страшно представить.
|
||||
|
||||
## Базовый формат ответа
|
||||
|
||||
Для нетривиальных изменений используй такую структуру:
|
||||
|
||||
```text
|
||||
Коротко
|
||||
- 2-4 пункта: главный результат, важный риск, что проверить.
|
||||
|
||||
Что изменилось по файлам
|
||||
| Файл | Что изменилось | Зачем |
|
||||
|---|---|---|
|
||||
| src/... | Кратко | Человеческая причина |
|
||||
|
||||
Важные места
|
||||
- 3-6 конкретных мест: файл + функция/секция + смысл.
|
||||
|
||||
Как проверить
|
||||
- Команды или ручные шаги.
|
||||
|
||||
Что не проверено
|
||||
- Честно и коротко.
|
||||
|
||||
Риски
|
||||
- Только реальные риски, не философия.
|
||||
```
|
||||
|
||||
Если изменение маленькое, можно сократить до:
|
||||
|
||||
```text
|
||||
Коротко: ...
|
||||
|
||||
Файлы:
|
||||
- `path`: что и зачем.
|
||||
|
||||
Проверка: ...
|
||||
```
|
||||
|
||||
## Правила ясности
|
||||
|
||||
- Сначала вывод, потом детали.
|
||||
- Не писать длиннее, чем нужно для решения задачи.
|
||||
- Не перечислять каждую строку diff. Указывать только смысловые изменения.
|
||||
- Всегда называть конкретные файлы.
|
||||
- Для сложных мест указывать функцию, модуль или секцию, если это помогает найти код.
|
||||
- Если используешь термин, рядом дать короткое человеческое объяснение.
|
||||
- Не использовать аббревиатуры без расшифровки при первом упоминании, кроме очевидных: UI, JSON, URL, API.
|
||||
- Не писать «улучшена архитектура» без объяснения, что именно стало проще или безопаснее.
|
||||
- Не писать «всё готово», если часть проверок не запускалась.
|
||||
- Не скрывать ошибки окружения. Если `cargo` или Windows недоступны, так и сказать.
|
||||
|
||||
## Как объяснять технические изменения
|
||||
|
||||
Плохо:
|
||||
|
||||
```text
|
||||
Refactored orchestration layer and extracted imperative use-case side effects into composable boundaries.
|
||||
```
|
||||
|
||||
Хорошо:
|
||||
|
||||
```text
|
||||
Вынес запуск service-команд из большого `commands.rs` в отдельный модуль. Теперь Tauri command только принимает запрос и возвращает ошибку, а вся Windows-логика лежит отдельно. Так проще тестировать и меньше шанс сломать соседние команды.
|
||||
```
|
||||
|
||||
Плохо:
|
||||
|
||||
```text
|
||||
Added CSP hardening.
|
||||
```
|
||||
|
||||
Хорошо:
|
||||
|
||||
```text
|
||||
Включил CSP в `src-tauri/tauri.conf.json`. Это ограничивает, какие скрипты/ресурсы может загрузить webview, и снижает ущерб, если в UI когда-нибудь появится XSS.
|
||||
```
|
||||
|
||||
## Уровни детализации
|
||||
|
||||
По умолчанию — средний уровень:
|
||||
|
||||
- достаточно конкретно, чтобы разработчик понял diff;
|
||||
- без пересказа каждой строки;
|
||||
- без внутренних рассуждений агента;
|
||||
- без длинной теории.
|
||||
|
||||
Если пользователь просит глубже, добавь раздел:
|
||||
|
||||
```text
|
||||
Детальнее
|
||||
- ...
|
||||
```
|
||||
|
||||
Если пользователь просит совсем кратко, оставь только:
|
||||
|
||||
```text
|
||||
Коротко
|
||||
Файлы
|
||||
Проверка
|
||||
```
|
||||
|
||||
## Таблица файлов
|
||||
|
||||
Для 2+ файлов почти всегда используй таблицу:
|
||||
|
||||
| Файл | Тип изменения | Смысл |
|
||||
|---|---|---|
|
||||
| `src/api/tauriCommands.ts` | API boundary | Добавлен typed wrapper для новой Tauri command |
|
||||
| `src-tauri/src/commands.rs` | Backend | Добавлена команда, которая вызывает уже существующую service-логику |
|
||||
|
||||
Правила:
|
||||
|
||||
- Не вставлять огромные таблицы на 30 строк. Группировать мелкие файлы.
|
||||
- В колонке `Смысл` писать человеческую причину, не только «обновлено».
|
||||
- Если файл опасный, отметить это: `security-sensitive`, `Windows/elevation`, `storage`, `routing`.
|
||||
|
||||
## Как писать про риски
|
||||
|
||||
Риск должен быть конкретным:
|
||||
|
||||
Плохо:
|
||||
|
||||
```text
|
||||
Есть некоторые риски.
|
||||
```
|
||||
|
||||
Хорошо:
|
||||
|
||||
```text
|
||||
Риск: я не запускал real Windows service flow, поэтому install/start/stop надо проверить на Windows 10/11 с UAC.
|
||||
```
|
||||
|
||||
Плохо:
|
||||
|
||||
```text
|
||||
Может быть несовместимость.
|
||||
```
|
||||
|
||||
Хорошо:
|
||||
|
||||
```text
|
||||
Риск: если у пользователя уже стоит чужая служба с похожим именем ProxiFyre, fuzzy detection может показать ее кандидатом. Управлять ей нельзя без проверки `PathName`.
|
||||
```
|
||||
|
||||
## Как писать про проверки
|
||||
|
||||
Разделяй выполненное и невыполненное:
|
||||
|
||||
```text
|
||||
Проверено
|
||||
- `npm run build` — прошел.
|
||||
- Markdown-файлы открываются, битых путей не нашел.
|
||||
|
||||
Не проверено
|
||||
- `cargo test` — не запускал, в среде нет Rust toolchain.
|
||||
- Windows service flow — не проверял, нужна Windows-машина с UAC.
|
||||
```
|
||||
|
||||
Не объединять это в мутное «тесты частично пройдены». Машины и люди заслуживают хотя бы грамм конкретики.
|
||||
|
||||
## Запрещенный стиль
|
||||
|
||||
Не писать:
|
||||
|
||||
- огромные абзацы без заголовков;
|
||||
- «магия», «оптимизировано», «улучшено» без конкретики;
|
||||
- внутренний дневник действий агента;
|
||||
- цепочки мыслей;
|
||||
- список всех строк diff;
|
||||
- рекламный тон;
|
||||
- уверенные заявления о непроверенных Windows/elevation сценариях;
|
||||
- «как вы и просили, я с радостью...» — репозиторий от этого лучше не станет.
|
||||
|
||||
## Мини-шаблоны
|
||||
|
||||
### Для bugfix
|
||||
|
||||
```text
|
||||
Коротко
|
||||
- Исправил ...
|
||||
- Основной риск был ...
|
||||
- Проверка: ...
|
||||
|
||||
Что изменилось по файлам
|
||||
| Файл | Что изменилось | Зачем |
|
||||
|---|---|---|
|
||||
|
||||
Важные места
|
||||
- `file`: ...
|
||||
|
||||
Проверено
|
||||
- ...
|
||||
|
||||
Не проверено
|
||||
- ...
|
||||
```
|
||||
|
||||
### Для ревью без правок
|
||||
|
||||
```text
|
||||
Коротко
|
||||
- Самая важная проблема: ...
|
||||
- Второй приоритет: ...
|
||||
- Быстрый выигрыш: ...
|
||||
|
||||
Что я смотрел
|
||||
- ...
|
||||
|
||||
Проблемы по важности
|
||||
1. Critical/High: ...
|
||||
2. Medium: ...
|
||||
3. Low: ...
|
||||
|
||||
Что бы я сделал первым
|
||||
- ...
|
||||
```
|
||||
|
||||
### Для плана изменений
|
||||
|
||||
```text
|
||||
Коротко
|
||||
- Цель: ...
|
||||
- Затронет: ...
|
||||
- Не трогаем: ...
|
||||
|
||||
План по файлам
|
||||
| Файл/зона | Что сделать | Почему |
|
||||
|---|---|---|
|
||||
|
||||
Порядок работ
|
||||
1. ...
|
||||
2. ...
|
||||
3. ...
|
||||
|
||||
Проверка
|
||||
- ...
|
||||
```
|
||||
93
.agent/skills/react-typescript-ui/SKILL.md
Normal file
93
.agent/skills/react-typescript-ui/SKILL.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# Skill: React / TypeScript UI
|
||||
|
||||
## Когда использовать
|
||||
|
||||
Используй этот skill при изменениях в `src`, UI, state management, typed Tauri wrappers, readiness logic, route visualization, forms, logs, buttons, popovers, service panels.
|
||||
|
||||
## Главная цель
|
||||
|
||||
UI должен ясно объяснять, что будет сделано с сетью пользователя, не прятать опасные действия и не превращаться в панель управления космической станцией ради одной прокси-кнопки.
|
||||
|
||||
## Инварианты
|
||||
|
||||
- `src/api/tauriCommands.ts` — единственное место для `invoke(...)`.
|
||||
- `src/domain/types.ts` должен отражать backend DTO.
|
||||
- Apply-readiness logic живет в `src/app/readiness.ts`.
|
||||
- Presentational UI должен переиспользовать `src/ui/*`.
|
||||
- Summary panel read-only.
|
||||
- Install/start/stop/uninstall/apply actions must be explicit.
|
||||
- Secrets must be redacted.
|
||||
|
||||
## App.tsx rule
|
||||
|
||||
`src/app/App.tsx` уже слишком большой. Новую логику не добавлять туда, если можно вынести:
|
||||
|
||||
```text
|
||||
src/app/hooks/useStartupSnapshot.ts
|
||||
src/app/hooks/useApplyFlow.ts
|
||||
src/app/hooks/useServiceControl.ts
|
||||
src/app/hooks/useSubscription.ts
|
||||
src/app/lib/parseProxy.ts
|
||||
src/app/lib/snapshots.ts
|
||||
src/app/components/RouteChain.tsx
|
||||
src/app/components/ChangesDock.tsx
|
||||
src/app/components/ProxyPanel.tsx
|
||||
src/app/components/SingBoxWorkspace.tsx
|
||||
```
|
||||
|
||||
Если изменение маленькое и локальное, допустимо править `App.tsx`, но не расширять его архитектурную роль.
|
||||
|
||||
## UI behavior rules
|
||||
|
||||
- Disabled button must explain why.
|
||||
- Loading/busy state must prevent double submit.
|
||||
- Errors must be human-readable and actionable.
|
||||
- Long paths, service names and tags must not break layout.
|
||||
- Do not use native `title` as main tooltip UX. Use existing popover/tooltip pattern.
|
||||
- Use `aria-*` for tabs, toggle buttons, popovers, service controls.
|
||||
- Honor reduced motion where relevant.
|
||||
|
||||
## Proxy/routing UI
|
||||
|
||||
When editing route UI:
|
||||
|
||||
- External SOCKS5 mode must not require sing-box.
|
||||
- Local sing-box mode must require selected server and sing-box readiness.
|
||||
- App list must clearly distinguish process, folder, exe/path if those are different target kinds.
|
||||
- Route chain should reflect actual backend target/profile state.
|
||||
- Pending changes should be visible before apply.
|
||||
|
||||
## Tests/checks
|
||||
|
||||
Minimum:
|
||||
|
||||
```powershell
|
||||
npm run build
|
||||
```
|
||||
|
||||
Recommended for extracted pure logic:
|
||||
|
||||
- Unit tests for proxy parsing.
|
||||
- Unit tests for readiness states.
|
||||
- Unit tests for snapshot diff/change dock model.
|
||||
- UI smoke checks for desktop and narrow layout.
|
||||
|
||||
## Do not
|
||||
|
||||
- Do not call backend commands from random components.
|
||||
- Do not store secrets in React state longer than needed if display value can be redacted.
|
||||
- Do not duplicate Rust validation as the only validation. Frontend validation is UX, backend validation is authority.
|
||||
- Do not add a visual state that implies a service is running unless backend confirmed it.
|
||||
|
||||
## Как отчитываться
|
||||
|
||||
Перед финальным ответом применить `.agent/skills/communication-reporting/SKILL.md` и `.agent/checklists/communication.md`.
|
||||
|
||||
Минимум для нетривиальной задачи:
|
||||
|
||||
- короткая сводка;
|
||||
- таблица файлов `Файл / Что изменилось / Зачем`;
|
||||
- важные места без пересказа каждой строки;
|
||||
- что проверено;
|
||||
- что не проверено;
|
||||
- конкретные риски.
|
||||
78
.agent/skills/repository-orientation/SKILL.md
Normal file
78
.agent/skills/repository-orientation/SKILL.md
Normal file
@@ -0,0 +1,78 @@
|
||||
# Skill: Repository Orientation
|
||||
|
||||
## Когда использовать
|
||||
|
||||
Используй этот skill в начале любой нетривиальной задачи по ProxyWarden: аудит, рефакторинг, bugfix, изменение UI, изменение Windows service flow, изменение subscription/routing.
|
||||
|
||||
## Цель
|
||||
|
||||
Быстро понять, где находится нужная логика, какие инварианты нельзя нарушать и какие проверки нужны перед финальным ответом.
|
||||
|
||||
## Карта проекта
|
||||
|
||||
```text
|
||||
src/api/tauriCommands.ts typed frontend API boundary
|
||||
src/domain/types.ts TypeScript DTO/domain mirror
|
||||
src/app/App.tsx current UI orchestration, large file
|
||||
src/app/readiness.ts apply readiness/gating
|
||||
src/app/viewModel.ts view helpers
|
||||
src/ui/* reusable UI components
|
||||
src/styles/app.css global/component CSS
|
||||
|
||||
src-tauri/src/models.rs Rust domain models
|
||||
src-tauri/src/validation.rs input normalization/validation
|
||||
src-tauri/src/storage.rs JSON config/state storage
|
||||
src-tauri/src/activity.rs activity log
|
||||
src-tauri/src/subscription.rs subscription fetch/parse
|
||||
src-tauri/src/component_detection.rs component status detection
|
||||
src-tauri/src/adapters/* ProxiFyre/sing-box/proxy router adapters
|
||||
src-tauri/src/commands.rs Tauri command layer, currently too large
|
||||
src-tauri/tests/* Rust tests
|
||||
scripts/*.ps1 Windows install/control scripts
|
||||
```
|
||||
|
||||
## Source of truth
|
||||
|
||||
- Persistent app config/state: `C:\ProgramData\ProxyWarden\config` and `state`.
|
||||
- Generated artifacts: `C:\ProgramData\ProxyWarden\generated`.
|
||||
- Frontend state is not source of truth. It should represent backend state and pending UI edits.
|
||||
- Component detection/runtime status should come from backend, not guessed in UI.
|
||||
|
||||
## First-pass procedure
|
||||
|
||||
1. Identify whether the task is backend, UI, security, Windows service, subscription/routing, or testing/release.
|
||||
2. Read the matching skill file.
|
||||
3. Inspect the relevant source files listed above.
|
||||
4. Determine whether the change crosses the Tauri boundary. If yes, update both Rust DTO/command and TypeScript wrapper/types.
|
||||
5. Determine whether the change touches secrets, service control, generated configs, process execution, filesystem deletion, or network fetch. If yes, apply security checklist.
|
||||
6. Prefer small, isolated changes over broad rewrites.
|
||||
|
||||
## Do not
|
||||
|
||||
- Do not treat `App.tsx` or `commands.rs` as the correct permanent architecture just because they currently contain lots of logic.
|
||||
- Do not introduce a second storage system.
|
||||
- Do not move service/install logic into frontend.
|
||||
- Do not claim Windows service/elevation behavior is verified unless it was actually tested on Windows.
|
||||
|
||||
## Output expectations
|
||||
|
||||
For code changes, final report should include:
|
||||
|
||||
- Changed files.
|
||||
- User-visible behavior changes.
|
||||
- Internal behavior changes.
|
||||
- Tests/checks run.
|
||||
- Known unverified areas.
|
||||
|
||||
## Как отчитываться
|
||||
|
||||
Перед финальным ответом применить `.agent/skills/communication-reporting/SKILL.md` и `.agent/checklists/communication.md`.
|
||||
|
||||
Минимум для нетривиальной задачи:
|
||||
|
||||
- короткая сводка;
|
||||
- таблица файлов `Файл / Что изменилось / Зачем`;
|
||||
- важные места без пересказа каждой строки;
|
||||
- что проверено;
|
||||
- что не проверено;
|
||||
- конкретные риски.
|
||||
106
.agent/skills/rust-tauri-backend/SKILL.md
Normal file
106
.agent/skills/rust-tauri-backend/SKILL.md
Normal file
@@ -0,0 +1,106 @@
|
||||
# Skill: Rust / Tauri Backend
|
||||
|
||||
## Когда использовать
|
||||
|
||||
Используй этот skill при изменениях в `src-tauri`, Tauri commands, Rust models, validation, storage, adapters, component detection, subscription fetching, config generation или service orchestration.
|
||||
|
||||
## Главная цель
|
||||
|
||||
Держать backend надежным, типизированным и безопасным. Backend управляет системой пользователя, поэтому «ну вроде работает» здесь примерно как инструкция по посадке самолета, написанная на салфетке.
|
||||
|
||||
## Инварианты
|
||||
|
||||
- Tauri command layer должен быть thin boundary, а не склад всей бизнес-логики.
|
||||
- Долгие/blocking операции не должны выполняться на async runtime thread.
|
||||
- Все ошибки, которые видит UI, должны быть structured and actionable.
|
||||
- Validation должна происходить на backend даже если UI уже проверяет input.
|
||||
- Generated config writes должны быть atomic where practical.
|
||||
- Secrets never logged or fully displayed.
|
||||
|
||||
## Preferred command pattern
|
||||
|
||||
Для тяжелых операций:
|
||||
|
||||
```rust
|
||||
#[tauri::command]
|
||||
pub async fn some_command(input: SomeInput) -> Result<SomeOutput, CommandError> {
|
||||
tauri::async_runtime::spawn_blocking(move || some_command_impl(input))
|
||||
.await
|
||||
.map_err(background_task_error)?
|
||||
}
|
||||
```
|
||||
|
||||
Implementation function должна быть тестируемой без Tauri runtime, если возможно.
|
||||
|
||||
## DTO boundary
|
||||
|
||||
При добавлении или изменении command:
|
||||
|
||||
1. Rust input/output DTO.
|
||||
2. TypeScript DTO in `src/domain/types.ts`.
|
||||
3. Wrapper in `src/api/tauriCommands.ts`.
|
||||
4. UI usage.
|
||||
5. Tests for pure logic.
|
||||
|
||||
Не использовать `serde_json::Value` как permanent API, если структура известна.
|
||||
|
||||
## Error handling
|
||||
|
||||
- Не использовать `unwrap()`/`expect()` в production path.
|
||||
- Возвращать `CommandError { code, message, details }`.
|
||||
- Для validation использовать список проблем, а не первую попавшуюся ошибку.
|
||||
- Internal error text не должен раскрывать secrets.
|
||||
- Если операция partial, вернуть partial state/result where possible.
|
||||
|
||||
## Storage
|
||||
|
||||
При изменении `storage.rs`:
|
||||
|
||||
- Keep tmp + bak write pattern.
|
||||
- Не превращать invalid JSON в default молча. Prefer corruption backup/restore path.
|
||||
- Для critical writes использовать same-directory temp file and rename.
|
||||
- Не хранить derived artifacts как source of truth.
|
||||
- Не хранить raw subscription/proxy secrets в activity log.
|
||||
|
||||
## Refactoring guidance
|
||||
|
||||
`src-tauri/src/commands.rs` слишком большой. Новую логику по возможности выносить:
|
||||
|
||||
```text
|
||||
commands/dto.rs
|
||||
commands/status.rs
|
||||
commands/profiles.rs
|
||||
commands/targets.rs
|
||||
commands/components.rs
|
||||
commands/subscription.rs
|
||||
commands/proxifyre.rs
|
||||
commands/singbox.rs
|
||||
services/elevated.rs
|
||||
services/powershell.rs
|
||||
services/proxifyre_service.rs
|
||||
services/singbox_service.rs
|
||||
```
|
||||
|
||||
При рефакторинге сохранять external command names, чтобы UI не ломался без причины.
|
||||
|
||||
## Validation checklist
|
||||
|
||||
- `cargo fmt --all -- --check`
|
||||
- `cargo clippy --all-targets --all-features -- -D warnings`
|
||||
- `cargo test --all-targets`
|
||||
- Relevant Windows/manual check if touching service/install/elevation.
|
||||
|
||||
Если `cargo` недоступен в среде, честно написать, что backend проверен только статически. Не изображать компилятор, у него и так тяжелая жизнь.
|
||||
|
||||
## Как отчитываться
|
||||
|
||||
Перед финальным ответом применить `.agent/skills/communication-reporting/SKILL.md` и `.agent/checklists/communication.md`.
|
||||
|
||||
Минимум для нетривиальной задачи:
|
||||
|
||||
- короткая сводка;
|
||||
- таблица файлов `Файл / Что изменилось / Зачем`;
|
||||
- важные места без пересказа каждой строки;
|
||||
- что проверено;
|
||||
- что не проверено;
|
||||
- конкретные риски.
|
||||
138
.agent/skills/security-hardening/SKILL.md
Normal file
138
.agent/skills/security-hardening/SKILL.md
Normal file
@@ -0,0 +1,138 @@
|
||||
# Skill: Security Hardening
|
||||
|
||||
## Когда использовать
|
||||
|
||||
Используй этот skill при изменениях, связанных с Tauri security, CSP, secrets, subscription fetching, process execution, PowerShell, temporary files, install/uninstall, file writes, generated configs, service control, logs, diagnostics.
|
||||
|
||||
## Threat model
|
||||
|
||||
ProxyWarden — desktop app that can influence network routing and run elevated Windows operations. Главные риски:
|
||||
|
||||
- leaking proxy/subscription credentials;
|
||||
- unsafe local/network fetches;
|
||||
- unsafe generated elevated PowerShell scripts;
|
||||
- unscoped process execution;
|
||||
- corrupting generated/service configs;
|
||||
- deleting wrong directories;
|
||||
- stale component status causing wrong actions;
|
||||
- XSS/webview compromise amplified by privileged backend commands.
|
||||
|
||||
## Non-negotiables
|
||||
|
||||
- `tauri.conf.json` must not use `"csp": null` as final state.
|
||||
- Do not add broad Tauri shell permissions.
|
||||
- Do not execute user-controlled strings as commands.
|
||||
- Do not log full subscription URLs, proxy passwords, userinfo, access tokens, or outbound configs with credentials.
|
||||
- Do not recursively delete directories based only on fuzzy name matching.
|
||||
- Do not treat fuzzy-detected services as managed without verification.
|
||||
|
||||
## CSP guidance
|
||||
|
||||
Prefer a restrictive CSP such as:
|
||||
|
||||
```json
|
||||
"security": {
|
||||
"csp": "default-src 'self'; img-src 'self' asset: data:; style-src 'self' 'unsafe-inline'; script-src 'self'"
|
||||
}
|
||||
```
|
||||
|
||||
Tighten further when possible. If inline styles are removed, remove `'unsafe-inline'`.
|
||||
|
||||
## Secret redaction
|
||||
|
||||
For URLs use a parser, not string splitting. Redacted display should include only:
|
||||
|
||||
- scheme;
|
||||
- host;
|
||||
- port if useful;
|
||||
- generic path marker if necessary.
|
||||
|
||||
Never show:
|
||||
|
||||
- username;
|
||||
- password;
|
||||
- query string;
|
||||
- fragment;
|
||||
- subscription token path;
|
||||
- full proxy credentials.
|
||||
|
||||
Bad:
|
||||
|
||||
```text
|
||||
https://user:password@example.com/...
|
||||
```
|
||||
|
||||
Good:
|
||||
|
||||
```text
|
||||
https://example.com/...
|
||||
```
|
||||
|
||||
## Subscription fetch hardening
|
||||
|
||||
- Add connect/read timeout.
|
||||
- Accept only `http` and `https` unless explicitly designed otherwise.
|
||||
- Consider blocking loopback/private/link-local/multicast/metadata addresses by default.
|
||||
- Add explicit allow-local option only if needed.
|
||||
- Do not follow redirects into blocked address ranges without re-check.
|
||||
- Avoid storing remote body in logs.
|
||||
|
||||
## Temp/elevated script hardening
|
||||
|
||||
Runtime-generated elevated scripts must:
|
||||
|
||||
- use unpredictable names, preferably UUID/random;
|
||||
- be written to a safe controlled directory where possible;
|
||||
- set restrictive ACL when practical;
|
||||
- be generated from static templates with escaped parameters;
|
||||
- avoid including secrets in command line args;
|
||||
- be cleaned up best-effort;
|
||||
- fail closed if path validation fails.
|
||||
|
||||
Timestamp-only temp names are not enough.
|
||||
|
||||
## Atomic writes
|
||||
|
||||
For config files used by services:
|
||||
|
||||
1. Write to temp file in same directory.
|
||||
2. Validate temp file if validator exists.
|
||||
3. Backup current file.
|
||||
4. Rename temp to final.
|
||||
5. On failure, preserve backup and return actionable error.
|
||||
|
||||
## Safe delete checklist
|
||||
|
||||
Before recursive delete:
|
||||
|
||||
- Is path absolute?
|
||||
- Is it under expected managed root?
|
||||
- Does it contain ProxyWarden marker metadata?
|
||||
- Does service PathName point inside this directory?
|
||||
- Is it not drive root, user profile root, Desktop, ProgramData root, Windows directory, temp root?
|
||||
- Is user action explicit?
|
||||
|
||||
If answer is unclear, do not delete.
|
||||
|
||||
## Final report expectations
|
||||
|
||||
When touching security-sensitive code, report:
|
||||
|
||||
- what threat was addressed;
|
||||
- what was hardened;
|
||||
- what remains unverified;
|
||||
- whether any secrets could appear in logs/UI;
|
||||
- whether Windows elevated path was tested.
|
||||
|
||||
## Как отчитываться
|
||||
|
||||
Перед финальным ответом применить `.agent/skills/communication-reporting/SKILL.md` и `.agent/checklists/communication.md`.
|
||||
|
||||
Минимум для нетривиальной задачи:
|
||||
|
||||
- короткая сводка;
|
||||
- таблица файлов `Файл / Что изменилось / Зачем`;
|
||||
- важные места без пересказа каждой строки;
|
||||
- что проверено;
|
||||
- что не проверено;
|
||||
- конкретные риски.
|
||||
87
.agent/skills/subscriptions-routing/SKILL.md
Normal file
87
.agent/skills/subscriptions-routing/SKILL.md
Normal file
@@ -0,0 +1,87 @@
|
||||
# Skill: Subscriptions and Routing
|
||||
|
||||
## Когда использовать
|
||||
|
||||
Используй этот skill при изменениях в external SOCKS5 flow, Local sing-box flow, subscription fetching/parsing, server selection, ping/check route, ProxiFyre config generation или sing-box config generation.
|
||||
|
||||
## Mental model
|
||||
|
||||
Supported route shapes:
|
||||
|
||||
```text
|
||||
selected Windows apps -> ProxiFyre -> external SOCKS5 proxy
|
||||
```
|
||||
|
||||
```text
|
||||
selected Windows apps -> ProxiFyre -> 127.0.0.1:1080 Local sing-box -> selected subscription server
|
||||
```
|
||||
|
||||
ProxiFyre is the per-app router. Sing-box is optional local outbound runtime.
|
||||
|
||||
## Invariants
|
||||
|
||||
- External SOCKS5 must work without Local sing-box.
|
||||
- Local sing-box route requires installed/configured/running sing-box and selected server.
|
||||
- UI route chain must match generated backend config.
|
||||
- Subscription URL is secret.
|
||||
- Server identity should not rely only on non-unique human tag forever.
|
||||
- Generated config should be validated before apply/start where possible.
|
||||
|
||||
## Subscription rules
|
||||
|
||||
When changing subscription parsing:
|
||||
|
||||
- Preserve JSON outbound support.
|
||||
- Do not claim support for link formats that parser does not implement.
|
||||
- If adding VMess/Trojan/Shadowsocks link parsing, add tests for each.
|
||||
- Keep unsupported outbound types visible as unsupported, not silently dropped if this affects user expectation.
|
||||
- Redact subscription URL and outbound secrets in logs/UI.
|
||||
|
||||
## Ping/check rules
|
||||
|
||||
- Network checks should have timeout.
|
||||
- Checks should be cancel-safe where possible.
|
||||
- Do not make route check mutate config/service state.
|
||||
- Do not store external IP probe result as secret, but avoid over-logging.
|
||||
- Make it clear if check verifies local sing-box only, external proxy only, or full route.
|
||||
|
||||
## Config generation
|
||||
|
||||
For ProxiFyre:
|
||||
|
||||
- Respect selected app targets.
|
||||
- Deduplicate carefully, preferably case-insensitive where Windows semantics apply.
|
||||
- Validate target kind semantics: process name vs exe path vs folder.
|
||||
- Write config atomically.
|
||||
|
||||
For sing-box:
|
||||
|
||||
- Validate selected server/outbound exists.
|
||||
- Avoid duplicate tag ambiguity by introducing stable id if needed.
|
||||
- Run `sing-box check` when binary is available.
|
||||
- Avoid writing secrets to temp files outside safe app directories.
|
||||
|
||||
## Tests to add for changes
|
||||
|
||||
- External route without sing-box.
|
||||
- Local route with selected server.
|
||||
- Missing ProxiFyre blocks apply.
|
||||
- Missing sing-box blocks local route apply.
|
||||
- Duplicate server tags.
|
||||
- Redacted subscription display.
|
||||
- Unsupported subscription formats.
|
||||
- Timeout/fetch failure.
|
||||
- Config generation produces expected route chain.
|
||||
|
||||
## Как отчитываться
|
||||
|
||||
Перед финальным ответом применить `.agent/skills/communication-reporting/SKILL.md` и `.agent/checklists/communication.md`.
|
||||
|
||||
Минимум для нетривиальной задачи:
|
||||
|
||||
- короткая сводка;
|
||||
- таблица файлов `Файл / Что изменилось / Зачем`;
|
||||
- важные места без пересказа каждой строки;
|
||||
- что проверено;
|
||||
- что не проверено;
|
||||
- конкретные риски.
|
||||
104
.agent/skills/testing-ci-release/SKILL.md
Normal file
104
.agent/skills/testing-ci-release/SKILL.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# Skill: Testing, CI and Release
|
||||
|
||||
## Когда использовать
|
||||
|
||||
Используй этот skill при добавлении CI, release scripts, build fixes, test changes, dependency updates, packaging changes или перед финальным отчетом по крупной задаче.
|
||||
|
||||
## Minimal local checks
|
||||
|
||||
Frontend:
|
||||
|
||||
```powershell
|
||||
npm ci
|
||||
npm run build
|
||||
```
|
||||
|
||||
Rust:
|
||||
|
||||
```powershell
|
||||
cd src-tauri
|
||||
cargo fmt --all -- --check
|
||||
cargo clippy --all-targets --all-features -- -D warnings
|
||||
cargo test --all-targets
|
||||
```
|
||||
|
||||
Tauri:
|
||||
|
||||
```powershell
|
||||
npm run tauri -- info
|
||||
npm run tauri -- build
|
||||
```
|
||||
|
||||
PowerShell plan-only:
|
||||
|
||||
```powershell
|
||||
& .\scripts\install-control-app.ps1 -PlanOnly
|
||||
& .\scripts\install-proxyfier.ps1 -PlanOnly
|
||||
& .\scripts\install-singbox.ps1 -PlanOnly
|
||||
```
|
||||
|
||||
## CI recommendation
|
||||
|
||||
Add GitHub Actions with at least:
|
||||
|
||||
- frontend build on Windows and Ubuntu if practical;
|
||||
- Rust fmt/clippy/test;
|
||||
- PowerShell syntax/plan-only smoke on Windows;
|
||||
- Tauri build on Windows for release branches/tags;
|
||||
- artifact upload only for trusted release workflow.
|
||||
|
||||
## Dependency updates
|
||||
|
||||
When changing dependencies:
|
||||
|
||||
- Update lockfiles.
|
||||
- Check Tauri v2 compatibility.
|
||||
- Avoid adding large UI/runtime dependencies for tiny tasks.
|
||||
- Avoid adding shell/process libraries that bypass existing backend boundaries.
|
||||
- Note why dependency is needed.
|
||||
|
||||
## Release hygiene
|
||||
|
||||
Before release:
|
||||
|
||||
- Verify app version in `package.json` and Tauri config if applicable.
|
||||
- Verify icons/assets size.
|
||||
- Verify CSP and capabilities.
|
||||
- Verify no raw secrets/test URLs in repo.
|
||||
- Verify installer scripts with `-PlanOnly`.
|
||||
- Verify clean install on Windows VM.
|
||||
- Verify external SOCKS5 flow.
|
||||
- Verify local sing-box subscription flow.
|
||||
- Verify uninstall/safe cleanup behavior.
|
||||
|
||||
## Final report format
|
||||
|
||||
```text
|
||||
Changed:
|
||||
- ...
|
||||
|
||||
Verified:
|
||||
- npm run build
|
||||
- cargo test
|
||||
|
||||
Not verified:
|
||||
- Windows elevated install/uninstall, because ...
|
||||
|
||||
Risks:
|
||||
- ...
|
||||
```
|
||||
|
||||
Do not write “all tests pass” unless all listed relevant tests actually ran. Humanity has enough fictional dashboards.
|
||||
|
||||
## Как отчитываться
|
||||
|
||||
Перед финальным ответом применить `.agent/skills/communication-reporting/SKILL.md` и `.agent/checklists/communication.md`.
|
||||
|
||||
Минимум для нетривиальной задачи:
|
||||
|
||||
- короткая сводка;
|
||||
- таблица файлов `Файл / Что изменилось / Зачем`;
|
||||
- важные места без пересказа каждой строки;
|
||||
- что проверено;
|
||||
- что не проверено;
|
||||
- конкретные риски.
|
||||
94
.agent/skills/windows-services-powershell/SKILL.md
Normal file
94
.agent/skills/windows-services-powershell/SKILL.md
Normal file
@@ -0,0 +1,94 @@
|
||||
# Skill: Windows Services / PowerShell / Elevation
|
||||
|
||||
## Когда использовать
|
||||
|
||||
Используй этот skill при изменениях в `scripts/*.ps1`, ProxiFyre install/start/stop/uninstall, sing-box service control, UAC/admin checks, helper/elevation boundary, component detection.
|
||||
|
||||
## Цель
|
||||
|
||||
Сохранять service/install operations явными, безопасными и проверяемыми. Пользователь должен понимать, что приложение собирается менять в системе. Компьютер пользователя — не песочница для творческих экспериментов агента, как ни печально.
|
||||
|
||||
## Инварианты
|
||||
|
||||
- Install/start/stop/uninstall are explicit user actions.
|
||||
- `apply` must not silently install/uninstall/start/stop components unless that behavior is clearly designed and surfaced.
|
||||
- `-PlanOnly` scripts must be side-effect-free.
|
||||
- PowerShell output intended for UI/backend must be structured JSON.
|
||||
- Service detection must distinguish managed service from fuzzy candidate.
|
||||
- Never relax safe-path checks to make uninstall easier.
|
||||
|
||||
## Script rules
|
||||
|
||||
PowerShell scripts should:
|
||||
|
||||
- use `Set-StrictMode -Version Latest` where practical;
|
||||
- set `$ErrorActionPreference = 'Stop'`;
|
||||
- return structured JSON for plan/status paths;
|
||||
- avoid localized text parsing for control flow;
|
||||
- avoid writing secrets to host output;
|
||||
- have clear exit codes;
|
||||
- support `-PlanOnly` for dry-run/status checks;
|
||||
- avoid downloading/executing arbitrary remote scripts.
|
||||
|
||||
## Elevation rules
|
||||
|
||||
When launching elevated PowerShell:
|
||||
|
||||
- keep command fixed and parameters escaped;
|
||||
- avoid user-controlled script text;
|
||||
- avoid predictable temp script names;
|
||||
- do not pass secrets via command line;
|
||||
- verify script path before launch;
|
||||
- clean up temp artifacts best-effort;
|
||||
- return clear error if user cancels UAC.
|
||||
|
||||
## Service detection
|
||||
|
||||
Preferred approach:
|
||||
|
||||
1. Search known managed service names first.
|
||||
2. Read service `PathName` through WMI/CIM.
|
||||
3. Verify binary path and managed install metadata.
|
||||
4. Only then mark as managed/controllable.
|
||||
5. Fuzzy matches should be shown as candidates, not automatically controlled.
|
||||
|
||||
## Testing
|
||||
|
||||
Pure logic can be tested cross-platform with mocks.
|
||||
|
||||
Real verification requires Windows:
|
||||
|
||||
```powershell
|
||||
& .\scripts\install-control-app.ps1 -PlanOnly
|
||||
& .\scripts\install-proxyfier.ps1 -PlanOnly
|
||||
& .\scripts\install-singbox.ps1 -PlanOnly
|
||||
npm run tauri -- dev
|
||||
```
|
||||
|
||||
For real service tests:
|
||||
|
||||
- Windows 10/11.
|
||||
- Admin/UAC path.
|
||||
- Fresh machine or VM snapshot.
|
||||
- Existing ProxiFyre/sing-box absent.
|
||||
- Existing fuzzy ProxiFyre-like service present, if testing safety.
|
||||
|
||||
## Do not
|
||||
|
||||
- Do not claim actual service operations were tested unless they were run on Windows.
|
||||
- Do not parse human-localized `sc.exe` output if structured WMI/CIM data is available.
|
||||
- Do not delete paths from fuzzy discovery alone.
|
||||
- Do not make scripts silently modify firewall/proxy/system settings outside their stated purpose.
|
||||
|
||||
## Как отчитываться
|
||||
|
||||
Перед финальным ответом применить `.agent/skills/communication-reporting/SKILL.md` и `.agent/checklists/communication.md`.
|
||||
|
||||
Минимум для нетривиальной задачи:
|
||||
|
||||
- короткая сводка;
|
||||
- таблица файлов `Файл / Что изменилось / Зачем`;
|
||||
- важные места без пересказа каждой строки;
|
||||
- что проверено;
|
||||
- что не проверено;
|
||||
- конкретные риски.
|
||||
Reference in New Issue
Block a user