一键导入
sync
Rebuild PROJECT_STATE derived fields from artifact files
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Rebuild PROJECT_STATE derived fields from artifact files
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
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 | sync |
| description | Rebuild PROJECT_STATE derived fields from artifact files |
Сканирует файлы артефактов, пересобирает derived-поля в PROJECT_STATE.json (readyToWork, inProgress, blocked, waitingForPM, inReview, artifactIndex).
/polisade:sync # Показать diff (dry-run по умолчанию)
/polisade:sync --apply # Показать diff и записать после подтверждения
python3 {plugin_root}/scripts/polisade_sync.py {project_root}
python3 {plugin_root}/scripts/polisade_sync.py {project_root} --apply --yes
Для неинтерактивного использования (CI, pipe):
python3 {plugin_root}/scripts/polisade_sync.py {project_root} --apply --yes
polisade_sync.py всегда печатает один JSON-документ на stdout
(контракт OPS-108 — json.loads(stdout) обязан проходить). PM-friendly
сообщения и подтверждение интерактивного prompt'а уходят на stderr.
Полная таблица контрактов — docs/config-reference.md § Script JSON
output contracts.
{
"status": "in_sync",
"artifacts_scanned": 12,
"touched_paths": [],
"stage_paths": []
}
{
"status": "drift_detected",
"artifacts_scanned": 12,
"changes": [
{"field": "readyToWork", "added": ["TASK-005"], "removed": ["TASK-003"]},
{"field": "inProgress", "added": ["TASK-003"]},
{"field": "artifactIndex", "added": ["TASK-005"], "changed": ["TASK-003"]}
],
"touched_paths": [".state/PROJECT_STATE.json", ".state/counters.json"],
"stage_paths": [".state/PROJECT_STATE.json", ".state/counters.json"],
"dry_run": true
}
--apply --yes{
"status": "applied",
"artifacts_scanned": 12,
"changes": [{"field": "readyToWork", "added": ["TASK-005"]}],
"touched_paths": [".state/PROJECT_STATE.json", ".state/counters.json"],
"stage_paths": [".state/PROJECT_STATE.json", ".state/counters.json"]
}
touched_paths — всё, что sync тронул (для информации и для diff-сверки
с git status --porcelain).
stage_paths — subset для git add: исключает пути, которые попадают
под .gitignore. Для sync разница обычно нулевая, но контракт един с
polisade_migrate.py, где .env при bitbucket bootstrap оказывается в
touched_paths без stage_paths.
{
"status": "migration_required",
"current_schema": 5,
"required_schema": 6,
"legacy_version_key": true,
"reason": "schemaVersion 5 < 7; legacy `pdlcVersion` key present",
"action": "run /polisade:migrate --apply before this command"
}
sync отказывается реконсилить state, который ещё не прошёл
/polisade:migrate после переименования pdlc→polisade (legacy-ключ
pdlcVersion или schemaVersion < 7) — иначе он переписал бы derived-поля,
оставив legacy-ключи на месте (ADR-0001 / issue #171). При этом статусе
не коммить и не повторяй sync: сначала прогони /polisade:migrate --apply, затем снова /polisade:sync. State при аборте не тронут.
--apply--apply показывает diff и спрашивает подтверждение--apply --yes пропускает подтверждение (для CI/pipe)readyToWork, inProgress, blocked, waitingForPM, inReviewartifactIndex — безопасный индекс всех артефактовartifacts если в нём структурированные данные (только flat index)/polisade:doctorПосле /polisade:sync --apply рабочее дерево обычно содержит изменения
(.state/PROJECT_STATE.json, иногда .state/counters.json,
tasks/TASK-*.md если PM правил статусы вручную, и т. п.). PM в
корп-сессии (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. Имя ветки. Из контекста скилла:
# sync в одиночку → polisade-sync-<YYYY-MM-DD>
# migrate в одиночку → polisade-migrate-schema-<N> (N = target_schema)
# 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 даёт лишние файлы.