with one click
migrate
Upgrade PROJECT_STATE.json schema to current version
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Upgrade PROJECT_STATE.json schema to current version
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Capture a simple task that does not need planning (CHORE + TASK in readyToWork by default, or registration-only with --no-task). Use when PM mentions "simple task", "chore", "small task", "housekeeping", "quick task", "мелкая задача", "чора", or any request to log routine work without PRD/SPEC overhead. Trigger liberally — under-triggering pushes tiny work into freeform chat; over-triggering is recoverable (PM can delete).
Autonomous work — find and execute ready tasks
Record a technical-debt item (DEBT-NNN) — registration only by default, or register + auto-generate a fix TASK with --task. Use when PM mentions "add tech debt", "record tech debt", "technical debt", "tech debt item", "refactor tracking", "технический долг", "запиши техдолг", or any request to capture deferred refactoring / cleanup work. Trigger liberally — under-triggering loses debt visibility; over-triggering is recoverable (PM can delete or defer).
Register a defect (BUG-NNN) and auto-generate the fix TASK so the bug enters the normal implement/review flow. Use when PM mentions "file a bug", "report defect", "bug report", "register defect", "report a bug", "заведи баг", "баг-репорт", or any request to capture a defect for tracking. Trigger liberally — under-triggering leaves bugs in chat where they get lost; over-triggering is recoverable (PM can delete the BUG artefact).
EXPERIMENTAL (Claude Code only). Apply a SPEC increment to a single LIVING architecture corpus under docs/architecture/ instead of a per-SPEC silo package — treats docs as event-sourcing (SPEC = commit, corpus = working tree), so C4 Context/Container, glossary and the data model stay system-wide and never drift across SPECs. Use when PM mentions "living corpus", "single architecture", "corpus mode", "merge design into the corpus", "one architecture for all SPECs", or wants to migrate per-SPEC DESIGN silos into one corpus. Opt-in behind settings.experimental.designCorpus (default off). v1 is a best-effort prompt corpus on a strong model; deterministic stdlib gates are the weak-model-orchestrator spec (#133/#184/#135).
Create a doc-as-code design package from a PRD or SPEC. Conditionally generates C4 diagrams (Context/Container/Component), sequence diagrams, ER diagram + Data Dictionary, OpenAPI 3.0, AsyncAPI 3.0, ADRs, domain glossary, state diagrams, and deployment view as Mermaid-rendered Markdown files. Use when PM mentions "design", "architecture diagrams", "doc-as-code artifacts", "C4", "ERD", "OpenAPI spec", "AsyncAPI", "event-driven", "Kafka", "message broker", "sequence diagram", "state machine", "domain glossary", "ADR", or before handing a SPEC to another team. Trigger liberally — undertriggering loses architectural value, overtriggering is recoverable (PM can delete).
| name | migrate |
| description | Upgrade PROJECT_STATE.json schema to current version |
Обновляет PROJECT_STATE.json и knowledge.json до текущей версии схемы. Добавляет недостающие поля, создаёт artifactIndex, устанавливает schemaVersion. Также добавляет testing.strategy в knowledge.json если отсутствует.
VCS bootstrap: если settings.vcsProvider отсутствует — добавляет "github". Если PM вручную переключил провайдер на bitbucket-server — создаёт .env.example (reference) и .env (stub для заполнения токенов) из plugin templates, добавляет некомментированную .env в .gitignore. Заполненный .env не перезаписывается (идемпотентность). ⚠️ Под GigaCode Filesystem Guard сам скрипт миграции может не запуститься (install-dir read-protected, #127) — тогда .env/.env.example автоматически не появятся; PM создаёт .env вручную из .env.example (cp .env.example .env) и заполняет токены (#131).
/polisade:migrate # Dry-run — показать что изменится
/polisade:migrate --apply # Показать diff и применить после подтверждения
python3 {plugin_root}/scripts/polisade_migrate.py {project_root}
python3 {plugin_root}/scripts/polisade_migrate.py {project_root} --apply --yes
polisade_migrate.py всегда печатает один JSON-документ на stdout
(контракт OPS-108 — json.loads(stdout) обязан проходить). PM-friendly
сообщения и подтверждение интерактивного prompt'а уходят на stderr.
Полная таблица контрактов — docs/config-reference.md § Script JSON
output contracts.
{
"status": "up_to_date",
"schemaVersion": 7,
"polisadeVersion": "3.0.0",
"touched_paths": [],
"stage_paths": []
}
{
"status": "migration_needed",
"current_schema": 3,
"target_schema": 6,
"migrations": [
"Update schemaVersion: 3 → 7",
"Add settings.debt.autoCreateTask: true (preserve legacy auto-TASK behavior)"
],
"touched_paths": [".state/PROJECT_STATE.json"],
"stage_paths": [".state/PROJECT_STATE.json"],
"dry_run": true
}
--apply --yes{
"status": "applied",
"schemaVersion": 7,
"applied_count": 2,
"migrations": ["Update schemaVersion: 3 → 7", "..."],
"touched_paths": [".state/PROJECT_STATE.json"],
"stage_paths": [".state/PROJECT_STATE.json"]
}
touched_paths — всё, что миграция тронула (для информации и для
diff-сверки с git status --porcelain).
stage_paths — subset для git add: исключает пути, которые после
миграции попали под .gitignore (например .env при bitbucket bootstrap
оказывается в touched_paths, но НЕ в stage_paths, потому что та же
миграция добавила .env в .gitignore — попытка git add .env дала
бы rc=1).
--applyartifacts — только создаёт новый artifactIndex/polisade:doctor должен показывать pass для state_schemaПосле /polisade:migrate --apply рабочее дерево обычно содержит изменения
(.state/PROJECT_STATE.json, иногда .gitignore, .env.example,
корп-сессии (issue #108) после этого попросит «закоммить и сделай pr» — агент должен пройти ровно по этому рецепту, без импровизации.
Контракт: ни одного $(...), бэктиков (command substitution в Bash) или
<(...) / >(...) в шелл-командах ниже. Корп-шелл (GigaCode CLI / codex
sandbox) режет их с сообщением «Command substitution using $(), ``, <(),
or >() is not allowed for security reasons», и весь рецепт обрывается.
# 0. Рабочий каталог. Caller (агент) должен заранее cd в проект; рецепт
# использует статический fallback "." (ни command substitution, ни pwd).
WORK_DIR="${POLISADE_WORK_DIR:-.}"
# 1. Источник списка путей — поле stage_paths из последнего apply-JSON:
# {"status":"applied","stage_paths":[".state/PROJECT_STATE.json", ...]}
# НЕ touched_paths: stage_paths уже исключает gitignored (например .env
# при bitbucket bootstrap). Stage по touched_paths упал бы на rc=1
# «paths are ignored», после чего weak-model агент попытался бы обойти
# запрет принудительным флагом — это утечка токенов из .env.
# Если в одной сессии PM запускал И /polisade:migrate --apply, И /polisade:sync
# --apply (типичный сценарий issue #108) — берём union stage_paths из
# обоих JSON-ответов. Safety-net: git status --porcelain (минус игноры)
# должен совпадать с union'ом; иначе остановиться и переспросить PM.
# 2. Имя ветки. Из контекста скилла:
# migrate в одиночку → polisade-migrate-schema-<N> (N = target_schema)
# sync в одиночку → polisade-sync-<YYYY-MM-DD>
# migrate + sync в одной сессии → polisade-housekeeping-<YYYY-MM-DD>
git switch -c <branch>
# 3. Стейджим только пути из stage_paths — НЕ git add .
git add <path1> <path2> ...
# 4. Коммит с детерминированным сообщением.
git commit -m "<skill>: <scoped summary>"
# 5. Push — ОБЯЗАТЕЛЬНО через helper (инвариант #10 / OPS-028 / issues
# #75 / #97). Bare git push в корпоративном окружении либо обходит
# проверку, либо даёт ложный FAIL на advisory remote-output.
python3 {plugin_root}/scripts/polisade_vcs.py git-push \
--branch <branch> --set-upstream \
--project-root "$WORK_DIR"
# 6. Body PR — файлом, не command substitution. .polisade/tmp/ project-local
# и в .gitignore (issue #57). НЕ /tmp — GigaCode CLI sandboxes /tmp.
mkdir -p .polisade/tmp
git log -1 --pretty=%B > .polisade/tmp/pr-body.md
# 7. PR — через polisade_vcs.py, не /polisade:pr inline и не самодельный REST-вызов
# (anti-patterns в skills/pr/SKILL.md). Канонический скрипт —
# polisade_vcs.py, не polisade_pr.py: такого файла не существует.
python3 {plugin_root}/scripts/polisade_vcs.py pr-create \
--title "<skill>: <scoped summary>" \
--head <branch> --base main \
--body-file .polisade/tmp/pr-body.md \
--project-root "$WORK_DIR"
Why этот рецепт жёсткий:
polisade_vcs.py git-push верифицирует push (exit-code + pattern-scan +
SHA), bare git push — нет.--body-file обходит ограничение корп-шелла на command substitution..env мимо polisade_vcs.py и теряет provider-agnostic мост.git status --porcelain — fallback, не primary: при параллельных
user-edits даёт лишние файлы.