@yandy-r/ycc-opencode 0.0.0-stage → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) hide show
  1. package/AGENTS.md +38 -0
  2. package/LICENSE +21 -0
  3. package/README.md +41 -2
  4. package/agents/ansible-automation-expert.md +115 -0
  5. package/agents/api-docs-expert.md +146 -0
  6. package/agents/api-documenter.md +105 -0
  7. package/agents/architect.md +264 -0
  8. package/agents/architecture-analyst.md +99 -0
  9. package/agents/backport-conflict-resolver.md +134 -0
  10. package/agents/cloudflare-architect.md +85 -0
  11. package/agents/cloudflare-developer.md +196 -0
  12. package/agents/code-architect.md +101 -0
  13. package/agents/code-documenter.md +114 -0
  14. package/agents/code-explorer.md +99 -0
  15. package/agents/code-finder.md +83 -0
  16. package/agents/code-researcher.md +102 -0
  17. package/agents/code-reviewer.md +268 -0
  18. package/agents/code-simplifier.md +77 -0
  19. package/agents/codebase-advisor.md +130 -0
  20. package/agents/db-modifier.md +235 -0
  21. package/agents/docs-git-committer.md +220 -0
  22. package/agents/documentation-writer.md +92 -0
  23. package/agents/feature-researcher.md +121 -0
  24. package/agents/feature-writer.md +89 -0
  25. package/agents/frontend-ui-developer.md +98 -0
  26. package/agents/git-cleanup.md +173 -0
  27. package/agents/go-api-architect.md +172 -0
  28. package/agents/go-expert-architect.md +147 -0
  29. package/agents/implementor.md +167 -0
  30. package/agents/library-docs-writer.md +128 -0
  31. package/agents/nextjs-ux-ui-expert.md +127 -0
  32. package/agents/nodejs-backend-architect.md +112 -0
  33. package/agents/nodejs-backend-developer.md +184 -0
  34. package/agents/planner.md +257 -0
  35. package/agents/pr-comment-fixer.md +284 -0
  36. package/agents/practices-researcher.md +80 -0
  37. package/agents/project-file-cleaner.md +140 -0
  38. package/agents/prp-researcher.md +231 -0
  39. package/agents/python-developer.md +171 -0
  40. package/agents/python-expert-architect.md +188 -0
  41. package/agents/readme-generator.md +100 -0
  42. package/agents/release-fix-applier.md +194 -0
  43. package/agents/releaser.md +147 -0
  44. package/agents/research-specialist.md +106 -0
  45. package/agents/reverse-proxy-architect.md +131 -0
  46. package/agents/review-fixer.md +264 -0
  47. package/agents/root-cause-analyzer.md +105 -0
  48. package/agents/rust-build-resolver.md +183 -0
  49. package/agents/rust-expert-architect.md +149 -0
  50. package/agents/rust-reviewer.md +126 -0
  51. package/agents/sql-database-developer.md +195 -0
  52. package/agents/systems-engineering-expert.md +203 -0
  53. package/agents/terraform-architect.md +109 -0
  54. package/agents/terraform-developer.md +229 -0
  55. package/agents/test-strategy-planner.md +126 -0
  56. package/agents/turso-database-architect.md +139 -0
  57. package/agents/typescript-developer.md +170 -0
  58. package/agents/typescript-expert-architect.md +167 -0
  59. package/index.js +260 -0
  60. package/package.json +35 -4
  61. package/registration.json +4384 -0
  62. package/shared/references/agent-native-setup.md +121 -0
  63. package/shared/references/branch-prep.md +31 -0
  64. package/shared/references/branching-model.md +162 -0
  65. package/shared/references/ci-monitoring.md +445 -0
  66. package/shared/references/forge-detection.md +162 -0
  67. package/shared/references/goal-pairing.md +53 -0
  68. package/shared/references/pr-base-and-backport.md +143 -0
  69. package/shared/references/review-artifact-format.md +141 -0
  70. package/shared/references/review-checklist.md +161 -0
  71. package/shared/references/review-dispatch.md +71 -0
  72. package/shared/references/session-state.md +159 -0
  73. package/shared/references/standalone-dispatch.md +298 -0
  74. package/shared/references/target-capability-matrix.md +325 -0
  75. package/shared/references/visual-mode.md +155 -0
  76. package/shared/references/worktree-strategy.md +310 -0
  77. package/shared/scripts/backport-audit.sh +283 -0
  78. package/shared/scripts/ci-monitor.sh +637 -0
  79. package/shared/scripts/lib/backport-lib.sh +47 -0
  80. package/shared/scripts/lib/ci-classify.sh +103 -0
  81. package/shared/scripts/lib/forge.sh +264 -0
  82. package/shared/scripts/lib/release-state-lib.sh +300 -0
  83. package/shared/scripts/list-worktrees.sh +178 -0
  84. package/shared/scripts/merge-children.sh +82 -0
  85. package/shared/scripts/move-plan-to-worktree.sh +231 -0
  86. package/shared/scripts/pr-guard.sh +283 -0
  87. package/shared/scripts/prepare-feature-branch.sh +326 -0
  88. package/shared/scripts/release-ci-monitor.sh +671 -0
  89. package/shared/scripts/release-state-update.sh +216 -0
  90. package/shared/scripts/release-state.sh +178 -0
  91. package/shared/scripts/report-bundle-drift.sh +343 -0
  92. package/shared/scripts/require-python.sh +17 -0
  93. package/shared/scripts/resolve-plans-dir.sh +262 -0
  94. package/shared/scripts/rules-pointer.sh +20 -0
  95. package/shared/scripts/rules_pointer.py +267 -0
  96. package/shared/scripts/setup-worktree.sh +288 -0
  97. package/shared/scripts/validate-file-paths.sh +249 -0
  98. package/shared/scripts/visual-egress-guard.sh +303 -0
  99. package/shared/scripts/visual-recap-collect.sh +247 -0
  100. package/shared/scripts/worktree-paths.sh +86 -0
  101. package/skills/backport/SKILL.md +291 -0
  102. package/skills/backport/scripts/cherry-pick-pr.sh +232 -0
  103. package/skills/backport/scripts/find-pending.sh +199 -0
  104. package/skills/blueprint/SKILL.md +410 -0
  105. package/skills/blueprint/references/bootstrap-mapping.md +87 -0
  106. package/skills/bundle-author/SKILL.md +119 -0
  107. package/skills/bundle-author/references/surface-map.md +128 -0
  108. package/skills/bundle-author/references/templates/agent-template.md +21 -0
  109. package/skills/bundle-author/references/templates/skill-template.md +36 -0
  110. package/skills/bundle-author/references/when-not-to-scaffold.md +85 -0
  111. package/skills/bundle-author/scripts/scaffold-skill.sh +156 -0
  112. package/skills/bundle-release/SKILL.md +188 -0
  113. package/skills/bundle-release/references/release-checklist.md +196 -0
  114. package/skills/bundle-release/references/release-notes-template.md +48 -0
  115. package/skills/bundle-release/references/version-policy.md +150 -0
  116. package/skills/bundle-release/scripts/bump-version.sh +97 -0
  117. package/skills/bundle-release/scripts/draft-notes.sh +222 -0
  118. package/skills/bundle-release/scripts/preflight.sh +164 -0
  119. package/skills/bundle-release/scripts/release_versions.py +361 -0
  120. package/skills/clean/SKILL.md +107 -0
  121. package/skills/clean/references/agent-prompts.md +199 -0
  122. package/skills/clean/references/safety-config.md +125 -0
  123. package/skills/clean/scripts/detect-project-type.sh +423 -0
  124. package/skills/clean/scripts/generate-report.sh +245 -0
  125. package/skills/clean/scripts/validate-safety.sh +401 -0
  126. package/skills/code-report/SKILL.md +375 -0
  127. package/skills/code-report/scripts/check-prerequisites.sh +65 -0
  128. package/skills/code-report/templates/report-structure.md +202 -0
  129. package/skills/code-review/SKILL.md +153 -0
  130. package/skills/code-review/references/pr-procedure.md +311 -0
  131. package/skills/compatibility-audit/SKILL.md +226 -0
  132. package/skills/compatibility-audit/references/reading-the-report.md +159 -0
  133. package/skills/compatibility-audit/scripts/audit-install-assumptions.sh +372 -0
  134. package/skills/compatibility-audit/scripts/audit-target-features.sh +558 -0
  135. package/skills/deep-research/SKILL.md +251 -0
  136. package/skills/deep-research/references/analysis-prompts.md +702 -0
  137. package/skills/deep-research/references/completion-summary-template.md +66 -0
  138. package/skills/deep-research/references/persona-analogical.md +159 -0
  139. package/skills/deep-research/references/persona-archaeological.md +69 -0
  140. package/skills/deep-research/references/persona-contrarian.md +155 -0
  141. package/skills/deep-research/references/persona-futurist.md +70 -0
  142. package/skills/deep-research/references/persona-historical.md +142 -0
  143. package/skills/deep-research/references/persona-journalistic.md +69 -0
  144. package/skills/deep-research/references/persona-negative-space.md +70 -0
  145. package/skills/deep-research/references/persona-systems.md +69 -0
  146. package/skills/deep-research/references/synthesis-template.md +569 -0
  147. package/skills/deep-research/references/verification-log-template.md +32 -0
  148. package/skills/deep-research/scripts/check-prerequisites.sh +153 -0
  149. package/skills/deep-research/scripts/validate-research.sh +244 -0
  150. package/skills/feature-research/SKILL.md +292 -0
  151. package/skills/feature-research/scripts/validate-research.sh +159 -0
  152. package/skills/feature-research/scripts/validate-spec.sh +270 -0
  153. package/skills/feature-research/templates/research-agents.md +569 -0
  154. package/skills/feature-research/templates/spec-structure.md +437 -0
  155. package/skills/formatters/SKILL.md +207 -0
  156. package/skills/formatters/references/best-practices.md +78 -0
  157. package/skills/formatters/references/flag-reference.md +178 -0
  158. package/skills/formatters/references/stack-detection.md +119 -0
  159. package/skills/formatters/references/templates/husky-pre-commit.tmpl +13 -0
  160. package/skills/formatters/references/templates/justfile-snippet.just.tmpl +31 -0
  161. package/skills/formatters/references/templates/lefthook.yml.tmpl +22 -0
  162. package/skills/formatters/references/templates/lint-autofix.yml.tmpl +94 -0
  163. package/skills/formatters/references/templates/lint.yml.tmpl +85 -0
  164. package/skills/formatters/references/templates/makefile-snippet.mk.tmpl +34 -0
  165. package/skills/formatters/references/templates/package-json-scripts.json.tmpl +14 -0
  166. package/skills/formatters/references/templates/readme-section.md.tmpl +118 -0
  167. package/skills/formatters/scripts/apply-aliases.sh +245 -0
  168. package/skills/formatters/scripts/apply-ci.sh +136 -0
  169. package/skills/formatters/scripts/apply-docs.sh +187 -0
  170. package/skills/formatters/scripts/apply-hooks.sh +261 -0
  171. package/skills/formatters/scripts/bundle/format.sh +15 -0
  172. package/skills/formatters/scripts/bundle/go-tools.sh +119 -0
  173. package/skills/formatters/scripts/bundle/init-formatters.sh +517 -0
  174. package/skills/formatters/scripts/bundle/install-shellcheck.sh +85 -0
  175. package/skills/formatters/scripts/bundle/lib/excludes.sh +179 -0
  176. package/skills/formatters/scripts/bundle/lib/modified-files.sh +222 -0
  177. package/skills/formatters/scripts/bundle/lib/shellcheck-resolve.sh +81 -0
  178. package/skills/formatters/scripts/bundle/lib/shellcheck-version.sh +5 -0
  179. package/skills/formatters/scripts/bundle/lint.sh +15 -0
  180. package/skills/formatters/scripts/bundle/style.sh +1410 -0
  181. package/skills/formatters/scripts/bundle/templates/biome.json +81 -0
  182. package/skills/formatters/scripts/bundle/templates/clippy.toml +2 -0
  183. package/skills/formatters/scripts/bundle/templates/markdownlint.json +14 -0
  184. package/skills/formatters/scripts/bundle/templates/markdownlintignore +38 -0
  185. package/skills/formatters/scripts/bundle/templates/prettierignore +45 -0
  186. package/skills/formatters/scripts/bundle/templates/prettierrc.json +11 -0
  187. package/skills/formatters/scripts/bundle/templates/python-pyproject.toml +80 -0
  188. package/skills/formatters/scripts/bundle/templates/rustfmt.toml +41 -0
  189. package/skills/formatters/scripts/bundle/templates/tsconfig.json +21 -0
  190. package/skills/formatters/scripts/profile-style.sh +264 -0
  191. package/skills/frontend-design/SKILL.md +151 -0
  192. package/skills/frontend-patterns/SKILL.md +66 -0
  193. package/skills/frontend-patterns/references/animation.md +21 -0
  194. package/skills/frontend-patterns/references/components-and-state.md +40 -0
  195. package/skills/frontend-patterns/references/data-and-performance.md +34 -0
  196. package/skills/frontend-patterns/references/forms-errors-a11y.md +35 -0
  197. package/skills/git-cleanup/SKILL.md +286 -0
  198. package/skills/git-cleanup/references/active-code-rules.md +318 -0
  199. package/skills/git-cleanup/references/host-detection.md +217 -0
  200. package/skills/git-workflow/SKILL.md +130 -0
  201. package/skills/git-workflow/references/ci-monitoring-phase.md +130 -0
  202. package/skills/git-workflow/references/commit-phases.md +247 -0
  203. package/skills/git-workflow/references/examples-and-troubleshooting.md +47 -0
  204. package/skills/git-workflow/references/goal-pairing.md +23 -0
  205. package/skills/git-workflow/references/pr-creation.md +269 -0
  206. package/skills/git-workflow/scripts/analyze-changes.sh +266 -0
  207. package/skills/git-workflow/scripts/create-pr.sh +464 -0
  208. package/skills/git-workflow/scripts/validate-commit.sh +235 -0
  209. package/skills/git-workflow/templates/agent-prompts.md +518 -0
  210. package/skills/git-workflow/templates/commit-types.md +504 -0
  211. package/skills/git-workflow/templates/documentation-decision.md +509 -0
  212. package/skills/git-workflow/templates/pr-template.md +772 -0
  213. package/skills/go-patterns/SKILL.md +89 -0
  214. package/skills/go-patterns/references/design-and-tooling.md +336 -0
  215. package/skills/go-patterns/references/errors-and-concurrency.md +292 -0
  216. package/skills/go-testing/SKILL.md +133 -0
  217. package/skills/go-testing/references/advanced-testing.md +349 -0
  218. package/skills/go-testing/references/test-structure.md +277 -0
  219. package/skills/hooks-workflow/SKILL.md +232 -0
  220. package/skills/hooks-workflow/references/support-notes.md +134 -0
  221. package/skills/hooks-workflow/references/templates/claude-settings.json.tmpl +13 -0
  222. package/skills/hooks-workflow/references/templates/codex-config-fragment.toml.tmpl +9 -0
  223. package/skills/hooks-workflow/references/templates/cursor-rule-fragment.mdc.tmpl +16 -0
  224. package/skills/hooks-workflow/scripts/build-hook-config.sh +487 -0
  225. package/skills/hooks-workflow/scripts/verify-hooks.sh +257 -0
  226. package/skills/implement-plan/SKILL.md +221 -0
  227. package/skills/implement-plan/references/agent-task-prompt.md +214 -0
  228. package/skills/implement-plan/references/output-formats.md +150 -0
  229. package/skills/implement-plan/references/plan-inputs.md +126 -0
  230. package/skills/implement-plan/scripts/check-prerequisites.sh +78 -0
  231. package/skills/implement-plan/scripts/parse-dependencies.sh +206 -0
  232. package/skills/init/SKILL.md +272 -0
  233. package/skills/init/references/conventional-commits.md +114 -0
  234. package/skills/init/references/flag-reference.md +236 -0
  235. package/skills/init/references/label-taxonomy.md +115 -0
  236. package/skills/init/references/project-profile-heuristics.md +156 -0
  237. package/skills/init/references/template-library.md +129 -0
  238. package/skills/init/scripts/count-source-files.sh +60 -0
  239. package/skills/init/scripts/generate-agent-catalog.sh +193 -0
  240. package/skills/init/scripts/generate-mcp-catalog.sh +214 -0
  241. package/skills/init/scripts/migrate-rules.py +459 -0
  242. package/skills/init/scripts/migrate-rules.sh +26 -0
  243. package/skills/init/scripts/profile-project.sh +453 -0
  244. package/skills/init/scripts/render-template.py +226 -0
  245. package/skills/init/scripts/render-template.sh +25 -0
  246. package/skills/init/scripts/rules-report.sh +31 -0
  247. package/skills/init/scripts/rules_file_lib.py +41 -0
  248. package/skills/init/templates/AGENTS.md.tmpl +38 -0
  249. package/skills/init/templates/CLAUDE.md.tmpl +7 -0
  250. package/skills/init/templates/ai-rule.md.tmpl +3 -0
  251. package/skills/init/templates/cursor-rule.mdc.tmpl +7 -0
  252. package/skills/init/templates/git/commitlint.config.cjs.tmpl +40 -0
  253. package/skills/init/templates/git/gitignore.tmpl +120 -0
  254. package/skills/init/templates/git/gitmessage.tmpl +27 -0
  255. package/skills/init/templates/git/install-lefthook.sh.tmpl +131 -0
  256. package/skills/init/templates/git/lefthook-usage.md.tmpl +101 -0
  257. package/skills/init/templates/git/lefthook.yml.tmpl +64 -0
  258. package/skills/init/templates/github/bug_report.yml.tmpl +78 -0
  259. package/skills/init/templates/github/config.yml.tmpl +5 -0
  260. package/skills/init/templates/github/copilot-instructions.md.tmpl +24 -0
  261. package/skills/init/templates/github/docs_request.yml.tmpl +41 -0
  262. package/skills/init/templates/github/feature_request.yml.tmpl +59 -0
  263. package/skills/init/templates/github/labels.md.tmpl +75 -0
  264. package/skills/init/templates/github/pull_request_template.md.tmpl +66 -0
  265. package/skills/init/templates/github/workflows/pr-title-autofix.yml.tmpl +101 -0
  266. package/skills/init/templates/github/workflows/pr-title.yml.tmpl +55 -0
  267. package/skills/init/templates/workspace-report.md +83 -0
  268. package/skills/orchestrate/SKILL.md +165 -0
  269. package/skills/orchestrate/references/agent-catalog.md +601 -0
  270. package/skills/orchestrate/references/agent-prompts.md +495 -0
  271. package/skills/orchestrate/references/dispatch-playbook.md +333 -0
  272. package/skills/orchestrate/references/task-breakdown.md +410 -0
  273. package/skills/orchestrate/scripts/analyze-task.sh +139 -0
  274. package/skills/orchestrate/scripts/summarize-results.sh +160 -0
  275. package/skills/orchestrate/scripts/validate-agents.sh +92 -0
  276. package/skills/parallel-plan/SKILL.md +124 -0
  277. package/skills/plan/SKILL.md +134 -0
  278. package/skills/plan/references/enhanced-personas.md +131 -0
  279. package/skills/plan/references/personas-and-merge.md +77 -0
  280. package/skills/plan/references/plan-validation.md +65 -0
  281. package/skills/plan/references/planner-prompts.md +68 -0
  282. package/skills/plan/references/planning-tracks.md +73 -0
  283. package/skills/plan-workflow/SKILL.md +406 -0
  284. package/skills/plan-workflow/references/checkpoint-messages.md +370 -0
  285. package/skills/plan-workflow/references/plan-structure.md +238 -0
  286. package/skills/plan-workflow/references/planning-agents.md +511 -0
  287. package/skills/plan-workflow/references/research-agents-optimized.md +348 -0
  288. package/skills/plan-workflow/references/research-agents.md +436 -0
  289. package/skills/plan-workflow/references/shared-structure.md +152 -0
  290. package/skills/plan-workflow/references/validation-agents.md +363 -0
  291. package/skills/plan-workflow/scripts/check-prerequisites.sh +65 -0
  292. package/skills/plan-workflow/scripts/check-state.sh +190 -0
  293. package/skills/plan-workflow/scripts/persist-or-fail.sh +135 -0
  294. package/skills/plan-workflow/scripts/validate-analysis-artifacts.sh +216 -0
  295. package/skills/plan-workflow/scripts/validate-research-artifacts.sh +225 -0
  296. package/skills/plan-workflow/scripts/validate-shared.sh +229 -0
  297. package/skills/plan-workflow/scripts/validate-workflow-plan.sh +256 -0
  298. package/skills/pr-autofix/SKILL.md +307 -0
  299. package/skills/pr-autofix/references/ci-loop.md +64 -0
  300. package/skills/pr-autofix/references/comment-sources.md +197 -0
  301. package/skills/pr-autofix/references/data-shapes.md +87 -0
  302. package/skills/pr-autofix/references/goal-example.md +30 -0
  303. package/skills/pr-autofix/references/output-templates.md +162 -0
  304. package/skills/pr-autofix/references/prompt-injection-safety.md +165 -0
  305. package/skills/pr-autofix/references/related-skills.md +11 -0
  306. package/skills/pr-autofix/references/severity-mapping.md +146 -0
  307. package/skills/pr-autofix/scripts/fetch-pr-comments.sh +364 -0
  308. package/skills/pr-autofix/scripts/post-summary.sh +226 -0
  309. package/skills/pr-autofix/scripts/resolve-thread.sh +251 -0
  310. package/skills/prp-commit/SKILL.md +128 -0
  311. package/skills/prp-implement/SKILL.md +177 -0
  312. package/skills/prp-implement/references/agent-task-prompt.md +36 -0
  313. package/skills/prp-implement/references/detection.md +49 -0
  314. package/skills/prp-implement/references/dry-run.md +0 -0
  315. package/skills/prp-implement/references/report-output.md +204 -0
  316. package/skills/prp-implement/references/validation-and-failures.md +118 -0
  317. package/skills/prp-plan/SKILL.md +323 -0
  318. package/skills/prp-plan/references/enhanced-researchers.md +425 -0
  319. package/skills/prp-plan/references/parallel-additions.md +56 -0
  320. package/skills/prp-plan/references/plan-template.md +264 -0
  321. package/skills/prp-plan/references/synthesis-map.md +25 -0
  322. package/skills/prp-plan/scripts/preflight-enhanced-agents.sh +111 -0
  323. package/skills/prp-plan/scripts/validate-prp-plan.sh +368 -0
  324. package/skills/prp-pr/SKILL.md +402 -0
  325. package/skills/prp-prd/SKILL.md +442 -0
  326. package/skills/prp-spec/SKILL.md +274 -0
  327. package/skills/python-patterns/SKILL.md +103 -0
  328. package/skills/python-patterns/references/core-idioms.md +304 -0
  329. package/skills/python-patterns/references/design-and-tooling.md +407 -0
  330. package/skills/python-testing/SKILL.md +114 -0
  331. package/skills/python-testing/references/mocking-and-integration.md +395 -0
  332. package/skills/python-testing/references/pytest-core.md +366 -0
  333. package/skills/quick-fix/SKILL.md +246 -0
  334. package/skills/quick-review/SKILL.md +304 -0
  335. package/skills/release-model/SKILL.md +231 -0
  336. package/skills/release-model/references/pointer-and-labels.md +83 -0
  337. package/skills/release-model/references/signals-and-proposal.md +68 -0
  338. package/skills/release-model/references/template-placeholders.md +42 -0
  339. package/skills/release-model/references/upgrade-and-audit.md +131 -0
  340. package/skills/release-model/scripts/collect-signals.sh +459 -0
  341. package/skills/release-model/scripts/pointer-targets.sh +29 -0
  342. package/skills/release-model/templates/RELEASING.md.tmpl +151 -0
  343. package/skills/releaser/SKILL.md +251 -0
  344. package/skills/releaser/references/ci-optimization-checklist.md +149 -0
  345. package/skills/releaser/references/ci-templates/docker-release.yml +88 -0
  346. package/skills/releaser/references/ci-templates/generic-release.yml +69 -0
  347. package/skills/releaser/references/ci-templates/go-release.yml +50 -0
  348. package/skills/releaser/references/ci-templates/node-release.yml +126 -0
  349. package/skills/releaser/references/ci-templates/python-release.yml +95 -0
  350. package/skills/releaser/references/ci-templates/rust-release.yml +128 -0
  351. package/skills/releaser/references/ci-workflow-modes.md +42 -0
  352. package/skills/releaser/references/goal-pairing.md +37 -0
  353. package/skills/releaser/references/output-templates.md +143 -0
  354. package/skills/releaser/references/project-type-matrix.md +144 -0
  355. package/skills/releaser/references/release-branches.md +138 -0
  356. package/skills/releaser/references/release-ci-loop.md +249 -0
  357. package/skills/releaser/references/release-notes-template.md +42 -0
  358. package/skills/releaser/references/release-preparation.md +210 -0
  359. package/skills/releaser/scripts/check-release-branch.sh +235 -0
  360. package/skills/releaser/scripts/detect-project.sh +234 -0
  361. package/skills/releaser/scripts/draft-changelog.sh +387 -0
  362. package/skills/releaser/scripts/publish-release.sh +302 -0
  363. package/skills/research-to-issues/SKILL.md +285 -0
  364. package/skills/research-to-issues/references/label-taxonomy.md +48 -0
  365. package/skills/research-to-issues/references/parse-deep-research.md +86 -0
  366. package/skills/research-to-issues/references/parse-feature-spec.md +143 -0
  367. package/skills/research-to-issues/references/parse-parallel-plan.md +124 -0
  368. package/skills/research-to-issues/references/parse-prd.md +184 -0
  369. package/skills/research-to-issues/references/parse-prp-plan.md +237 -0
  370. package/skills/research-to-issues/references/plan-display-format.md +136 -0
  371. package/skills/research-to-issues/scripts/validate-prerequisites.sh +312 -0
  372. package/skills/research-to-issues/templates/feature-issue.md +131 -0
  373. package/skills/research-to-issues/templates/task-issue.md +104 -0
  374. package/skills/research-to-issues/templates/tracking-issue.md +126 -0
  375. package/skills/resume-session/SKILL.md +152 -0
  376. package/skills/review-fix/SKILL.md +229 -0
  377. package/skills/review-fix/references/fix-report.md +121 -0
  378. package/skills/review-fix/references/fixer-dispatch.md +79 -0
  379. package/skills/review-fix/references/plan.md +119 -0
  380. package/skills/rust-patterns/SKILL.md +85 -0
  381. package/skills/rust-patterns/references/concurrency-unsafe-modules.md +243 -0
  382. package/skills/rust-patterns/references/ownership-errors-types.md +262 -0
  383. package/skills/rust-testing/SKILL.md +99 -0
  384. package/skills/rust-testing/references/advanced-testing.md +247 -0
  385. package/skills/rust-testing/references/unit-and-integration.md +193 -0
  386. package/skills/save-session/SKILL.md +159 -0
  387. package/skills/shared-context/SKILL.md +101 -0
  388. package/skills/ts-patterns/SKILL.md +159 -0
  389. package/skills/ts-patterns/references/async-runtimes-tooling.md +375 -0
  390. package/skills/ts-patterns/references/types-errors-modules.md +336 -0
  391. package/skills/ts-testing/SKILL.md +151 -0
  392. package/skills/ts-testing/references/advanced-testing.md +350 -0
  393. package/skills/ts-testing/references/vitest-core.md +318 -0
  394. package/skills/visual-plan/SKILL.md +221 -0
  395. package/skills/visual-plan/references/canvas.md +132 -0
  396. package/skills/visual-plan/references/document-quality.md +178 -0
  397. package/skills/visual-plan/references/exemplar.md +120 -0
  398. package/skills/visual-plan/references/wireframe.md +212 -0
  399. package/skills/visual-plan/scripts/derive-visual-dir.sh +77 -0
  400. package/skills/visual-recap/SKILL.md +238 -0
  401. package/skills/visual-recap/references/wireframe.md +237 -0
  402. package/skills/write-docs/SKILL.md +354 -0
  403. package/skills/write-docs/scripts/audit-documentation.sh +190 -0
  404. package/skills/write-docs/scripts/generate-doc-index.sh +125 -0
  405. package/skills/write-docs/scripts/verify-links.sh +81 -0
  406. package/skills/write-docs/templates/docs-readme.md +34 -0
  407. package/skills/write-docs/templates/documentation-strategy.md +91 -0
@@ -0,0 +1,247 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # visual-recap-collect.sh — remote-agnostic local diff collector for visual recap.
4
+ #
5
+ # Collects a diff bundle using ONLY local git refs so it behaves identically on
6
+ # any remote (public GitHub or the private Forgejo). It NEVER calls a vendor PR
7
+ # API and NEVER hardcodes a remote host or branch name.
8
+ #
9
+ # Usage:
10
+ # visual-recap-collect.sh [<base>..<head> | <branch>]
11
+ #
12
+ # Arguments:
13
+ # (none) Collect the working-tree diff (git diff HEAD).
14
+ # <base>..<head> Collect git diff <base>...<head> (explicit two endpoints).
15
+ # <branch> Treat <branch> as head; compute base via `git merge-base`
16
+ # against the tracked upstream (resolved from @{upstream}).
17
+ #
18
+ # Base resolution NEVER hardcodes a trunk branch: the upstream is resolved with
19
+ # git rev-parse --abbrev-ref --symbolic-full-name @{upstream}
20
+ # and falls back gracefully to merge-base against HEAD when no upstream is set.
21
+ #
22
+ # Output:
23
+ # - Diff bundle written under docs/prps/reviews/visual/<slug>/
24
+ # diff.patch full unified diff (local refs only)
25
+ # files.txt changed-file name list
26
+ # metadata.txt range/base/head/remote provenance
27
+ # - Results (bundle path + summary) on stdout.
28
+ # - All errors and progress notes on stderr.
29
+ #
30
+ # Exit codes:
31
+ # 0 - Bundle collected successfully
32
+ # 1 - Usage / git / I/O failure
33
+ #
34
+ set -euo pipefail
35
+
36
+ # ---------------------------------------------------------------------------
37
+ # Logging helpers (stdout = results, stderr = diagnostics)
38
+ # ---------------------------------------------------------------------------
39
+
40
+ _error() {
41
+ echo "visual-recap-collect.sh: error: $*" >&2
42
+ }
43
+
44
+ _info() {
45
+ echo "visual-recap-collect.sh: $*" >&2
46
+ }
47
+
48
+ usage() {
49
+ cat >&2 <<'EOF'
50
+ Usage:
51
+ visual-recap-collect.sh [<base>..<head> | <branch>]
52
+
53
+ Arguments:
54
+ (none) Collect the working-tree diff (git diff HEAD).
55
+ <base>..<head> Collect git diff <base>...<head>.
56
+ <branch> Use <branch> as head; base = merge-base(@{upstream}, <branch>).
57
+ EOF
58
+ }
59
+
60
+ # ---------------------------------------------------------------------------
61
+ # Argument parsing (strict case-based flag handling)
62
+ # ---------------------------------------------------------------------------
63
+
64
+ RANGE_ARG=""
65
+
66
+ set_range_arg() {
67
+ if [[ -z "$RANGE_ARG" ]]; then
68
+ RANGE_ARG="$1"
69
+ else
70
+ _error "unexpected positional argument: $1"
71
+ usage
72
+ exit 1
73
+ fi
74
+ }
75
+
76
+ while [[ $# -gt 0 ]]; do
77
+ case "$1" in
78
+ -h|--help)
79
+ usage
80
+ exit 0
81
+ ;;
82
+ --)
83
+ shift
84
+ while [[ $# -gt 0 ]]; do
85
+ set_range_arg "$1"
86
+ shift
87
+ done
88
+ break
89
+ ;;
90
+ -*)
91
+ _error "unknown flag: $1"
92
+ usage
93
+ exit 1
94
+ ;;
95
+ *)
96
+ set_range_arg "$1"
97
+ shift
98
+ ;;
99
+ esac
100
+ done
101
+
102
+ # ---------------------------------------------------------------------------
103
+ # Git context
104
+ # ---------------------------------------------------------------------------
105
+
106
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then
107
+ _error "not inside a git repository"
108
+ exit 1
109
+ fi
110
+
111
+ REPO_ROOT="$(git rev-parse --show-toplevel)"
112
+ cd "$REPO_ROOT"
113
+
114
+ CURRENT_BRANCH="$(git branch --show-current || true)"
115
+
116
+ # Resolve the tracked upstream without ever hardcoding a trunk branch name.
117
+ resolve_upstream() {
118
+ git rev-parse --abbrev-ref --symbolic-full-name '@{upstream}' 2>/dev/null || true
119
+ }
120
+
121
+ # Resolve the remote URL for the given remote name (never hardcode a host).
122
+ remote_url_for() {
123
+ local name="$1"
124
+ git remote get-url "$name" 2>/dev/null || true
125
+ }
126
+
127
+ # ---------------------------------------------------------------------------
128
+ # Range / mode resolution
129
+ # ---------------------------------------------------------------------------
130
+
131
+ MODE=""
132
+ BASE_REF=""
133
+ HEAD_REF=""
134
+ RANGE_LABEL=""
135
+
136
+ if [[ -z "$RANGE_ARG" ]]; then
137
+ # Default: working-tree diff against HEAD.
138
+ MODE="worktree"
139
+ HEAD_REF="HEAD"
140
+ RANGE_LABEL="working-tree"
141
+ elif [[ "$RANGE_ARG" == *".."* ]]; then
142
+ MODE="range"
143
+ BASE_REF="${RANGE_ARG%%..*}"
144
+ HEAD_REF="${RANGE_ARG##*..}"
145
+ if [[ -z "$BASE_REF" || -z "$HEAD_REF" ]]; then
146
+ _error "malformed range '$RANGE_ARG'; expected <base>..<head>"
147
+ exit 1
148
+ fi
149
+ RANGE_LABEL="${BASE_REF}...${HEAD_REF}"
150
+ else
151
+ MODE="branch"
152
+ HEAD_REF="$RANGE_ARG"
153
+ if ! git rev-parse --verify --quiet "${HEAD_REF}^{commit}" >/dev/null; then
154
+ _error "not a valid ref: $HEAD_REF"
155
+ exit 1
156
+ fi
157
+ UPSTREAM="$(resolve_upstream)"
158
+ if [[ -n "$UPSTREAM" ]]; then
159
+ _info "tracked upstream: $UPSTREAM"
160
+ BASE_REF="$(git merge-base "$UPSTREAM" "$HEAD_REF" 2>/dev/null || true)"
161
+ fi
162
+ if [[ -z "$BASE_REF" ]]; then
163
+ _info "no upstream merge-base; falling back to merge-base against HEAD"
164
+ BASE_REF="$(git merge-base HEAD "$HEAD_REF" 2>/dev/null || true)"
165
+ fi
166
+ if [[ -z "$BASE_REF" ]]; then
167
+ _error "could not compute a merge-base for '$HEAD_REF'"
168
+ exit 1
169
+ fi
170
+ RANGE_LABEL="${BASE_REF}...${HEAD_REF}"
171
+ fi
172
+
173
+ # ---------------------------------------------------------------------------
174
+ # Slug derivation (filesystem-safe; lowercase alnum + dashes)
175
+ # ---------------------------------------------------------------------------
176
+
177
+ slugify() {
178
+ printf '%s' "$1" \
179
+ | tr '[:upper:]' '[:lower:]' \
180
+ | sed -e 's#[^a-z0-9]\+#-#g' -e 's#^-\+##' -e 's#-\+$##'
181
+ }
182
+
183
+ case "$MODE" in
184
+ worktree)
185
+ SLUG_SOURCE="${CURRENT_BRANCH:-detached-head}"
186
+ ;;
187
+ range)
188
+ SLUG_SOURCE="${BASE_REF}-to-${HEAD_REF}"
189
+ ;;
190
+ branch)
191
+ SLUG_SOURCE="$HEAD_REF"
192
+ ;;
193
+ esac
194
+
195
+ SLUG="$(slugify "$SLUG_SOURCE")"
196
+ if [[ -z "$SLUG" ]]; then
197
+ SLUG="recap"
198
+ fi
199
+
200
+ # ---------------------------------------------------------------------------
201
+ # Collect the diff (LOCAL refs only — identical on GitHub and Forgejo)
202
+ # ---------------------------------------------------------------------------
203
+
204
+ OUT_DIR="${REPO_ROOT}/docs/prps/reviews/visual/${SLUG}"
205
+ mkdir -p "$OUT_DIR"
206
+
207
+ DIFF_FILE="${OUT_DIR}/diff.patch"
208
+ FILES_FILE="${OUT_DIR}/files.txt"
209
+ META_FILE="${OUT_DIR}/metadata.txt"
210
+
211
+ if [[ "$MODE" == "worktree" ]]; then
212
+ git diff HEAD >"$DIFF_FILE" || { _error "git diff failed"; exit 1; }
213
+ git diff --name-only HEAD >"$FILES_FILE" || { _error "git diff --name-only failed"; exit 1; }
214
+ else
215
+ # Three-dot diff against the merge-base of base and head.
216
+ git diff "${BASE_REF}...${HEAD_REF}" >"$DIFF_FILE" || { _error "git diff failed"; exit 1; }
217
+ git diff --name-only "${BASE_REF}...${HEAD_REF}" >"$FILES_FILE" || { _error "git diff --name-only failed"; exit 1; }
218
+ fi
219
+
220
+ # Remote provenance: record every remote URL via `git remote get-url` so the
221
+ # bundle is auditable without hardcoding any host.
222
+ {
223
+ echo "generated-by: visual-recap-collect.sh"
224
+ echo "mode: ${MODE}"
225
+ echo "range: ${RANGE_LABEL}"
226
+ echo "base: ${BASE_REF:-<working-tree>}"
227
+ echo "head: ${HEAD_REF}"
228
+ echo "current-branch: ${CURRENT_BRANCH:-<detached>}"
229
+ echo "slug: ${SLUG}"
230
+ echo "remotes:"
231
+ while IFS= read -r _rname; do
232
+ [[ -z "$_rname" ]] && continue
233
+ echo " - ${_rname}: $(remote_url_for "$_rname")"
234
+ done < <(git remote)
235
+ } >"$META_FILE"
236
+
237
+ CHANGED_COUNT="$(grep -c . "$FILES_FILE" 2>/dev/null)" || CHANGED_COUNT=0
238
+
239
+ # ---------------------------------------------------------------------------
240
+ # Results -> stdout
241
+ # ---------------------------------------------------------------------------
242
+
243
+ echo "$OUT_DIR"
244
+ _info "collected ${CHANGED_COUNT} changed file(s) for range '${RANGE_LABEL}'"
245
+ _info "bundle: ${OUT_DIR}/{diff.patch,files.txt,metadata.txt}"
246
+
247
+ exit 0
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env bash
2
+ # Shared path helpers for ycc feature worktrees.
3
+ #
4
+ # Source this file from other scripts. It intentionally does not enable
5
+ # set -euo pipefail so callers keep control of shell options.
6
+
7
+ ycc_repo_root() {
8
+ local root
9
+ if root="$(git rev-parse --show-toplevel 2>/dev/null)"; then
10
+ printf '%s\n' "$root"
11
+ return 0
12
+ fi
13
+ pwd -P
14
+ }
15
+
16
+ ycc_expand_worktree_root() {
17
+ local repo_root="$1"
18
+ local raw_root="$2"
19
+
20
+ case "$raw_root" in
21
+ "")
22
+ # Default for this runtime bundle's build. Portable `agents` builds
23
+ # replace only this marker line with ycc_runtime_worktree_root below.
24
+ printf '%s/.opencode/worktrees\n' "$repo_root" # @YCC_DEFAULT_WORKTREE_ROOT@
25
+ ;;
26
+ "~")
27
+ printf '%s\n' "$HOME"
28
+ ;;
29
+ "~"/*)
30
+ printf '%s/%s\n' "$HOME" "${raw_root#"~/"}"
31
+ ;;
32
+ /*)
33
+ printf '%s\n' "$raw_root"
34
+ ;;
35
+ *)
36
+ printf '%s/%s\n' "$repo_root" "$raw_root"
37
+ ;;
38
+ esac
39
+ }
40
+
41
+ ycc_worktree_root() {
42
+ local repo_root="${1:-}"
43
+ if [[ -z "$repo_root" ]]; then
44
+ repo_root="$(ycc_repo_root)"
45
+ fi
46
+
47
+ ycc_expand_worktree_root "$repo_root" "${YCC_WORKTREE_ROOT:-}"
48
+ }
49
+
50
+ ycc_feature_worktree_path() {
51
+ local repo_root="$1"
52
+ local repo_name="$2"
53
+ local feature_slug="$3"
54
+ local root
55
+
56
+ root="$(ycc_worktree_root "$repo_root")"
57
+ printf '%s/%s-%s\n' "$root" "$repo_name" "$feature_slug"
58
+ }
59
+
60
+ # Used only by portable (agents) builds, which swap the default marker line in
61
+ # ycc_expand_worktree_root for this resolver. Evidence-based runtime markers;
62
+ # missing or conflicting markers (nested agents) fall back to the portable
63
+ # .agents root. See worktree-strategy.md §1 for the evidence list.
64
+ ycc_runtime_worktree_root() {
65
+ local repo_root="$1"
66
+ local runtime=""
67
+ local count=0
68
+
69
+ if [[ "${OPENCODE:-}" == "1" ]]; then
70
+ runtime="opencode"
71
+ count=$((count + 1))
72
+ fi
73
+ if [[ "${CLAUDECODE:-}" == "1" ]]; then
74
+ runtime="claude"
75
+ count=$((count + 1))
76
+ fi
77
+ if [[ -n "${CODEX_THREAD_ID:-}" ]]; then
78
+ runtime="codex"
79
+ count=$((count + 1))
80
+ fi
81
+
82
+ if [[ "$count" -ne 1 ]]; then
83
+ runtime="agents"
84
+ fi
85
+ printf '%s/.%s/worktrees\n' "$repo_root" "$runtime"
86
+ }
@@ -0,0 +1,291 @@
1
+ ---
2
+ name: backport
3
+ description: Backports merged trunk PRs to maintenance branches. Use when backporting
4
+ a fix, opening backport PRs, or auditing pending backports.
5
+ metadata:
6
+ opencode/autoinvoke: 'false'
7
+ ---
8
+
9
+ # Backport
10
+
11
+ Move a fix that already landed on the trunk to one or more maintenance branches, the way
12
+ `{{package-root}}/shared/references/branching-model.md` (section "Backporting") prescribes:
13
+ a `git cherry-pick -x` of the trunk's merge or squash commit onto a `backport/X.Y/<pr>-<slug>` branch cut
14
+ from `origin/release/X.Y`, then one PR per target into `release/X.Y` with `Backport of #<N>` in its body.
15
+
16
+ **Operational context:** Read RELEASING.md and backport:X.Y labels for targets. Accept a single PR or --pending; --resolve requires approval of the conflict diff before continuing, --ci watches CI, and --audit [release/X.Y] [--since REF] checks landed backports and unaccounted-for fixes read-only before tagging.
17
+
18
+ **Golden rules** (non-toggleable):
19
+
20
+ - Never merge, never tag, never push to `release/*` or the trunk. The only push is the
21
+ `backport/*` branch this skill created, and a human merges the PR.
22
+ - Never `git push --force`, never `--no-verify`.
23
+ - Never resolve a conflict without showing the diff and getting an explicit "yes".
24
+ - Only active maintenance branches (the state's `maintenance` list) are targets.
25
+
26
+ ## Phase 0 — Parse arguments
27
+
28
+ | Argument / flag | Effect |
29
+ | ----------------------- | ----------------------------------------------------------------------------------------- |
30
+ | `<PR#>` | Backport this merged trunk PR (digits, `#N`, or a GitHub PR URL). |
31
+ | `--to release/X.Y` | Target branch. Repeatable. Without it, targets come from labels (see Phase 2). |
32
+ | `--pending` | Backport every merged PR with a backport label that has no backport PR yet. |
33
+ | `--resolve` | On a conflict, dispatch `backport-conflict-resolver`, show the diff, ask to continue. |
34
+ | `--ci` | After each backport PR opens, watch CI and run the bounded auto-fix loop (Phase 5). |
35
+ | `--dry-run` | Print the plan and every command that would run. No worktree, no push, no PR. |
36
+ | `--audit [release/X.Y]` | Read-only pre-tag check for one line, or every active line (Phase 2A). |
37
+ | `--since REF` | With `--audit`: start the unlabelled-fix window at REF (e.g. `v0.5.0` sweeps the line). |
38
+
39
+ Validation — stop with the usage line on failure:
40
+
41
+ - Exactly one of `<PR#>`, `--pending`, or `--audit`.
42
+ - `--since` only with `--audit`; `--resolve`, `--ci`, `--to` and `--dry-run` never with it.
43
+ - With `--pending`, `--to` filters the pending list to those targets.
44
+ - Each `--to` value must match `release/X.Y`.
45
+
46
+ ## Phase 1 — Preflight
47
+
48
+ 1. **Forge.** Source `{{package-root}}/shared/scripts/lib/forge.sh` and run
49
+ `forge_detect_provider origin`. If the result is not `github`, print the manual steps
50
+ below (fill `X.Y` from `--to` or the state's `latest_maintenance`, the SHA from the
51
+ merged PR) and stop:
52
+
53
+ ```bash
54
+ git fetch origin
55
+ git switch -c backport/X.Y/<pr>-<slug> origin/release/X.Y
56
+ git cherry-pick -x <merge-or-squash-sha>
57
+ git push -u origin backport/X.Y/<pr>-<slug>
58
+ # open a PR into release/X.Y: original title, body "Backport of #<N>"
59
+ ```
60
+
61
+ Explain: `/ycc:backport` automates GitHub only (`gh` PR queries and creation). With
62
+ `--audit`, print step 0 of the project's `RELEASING.md` patch steps instead of the
63
+ cherry-pick steps.
64
+
65
+ 2. **GitHub CLI.** `gh auth status` must succeed; otherwise stop with "Run `gh auth login`
66
+ first."
67
+
68
+ 3. **Release state.** Run
69
+ `bash "{{package-root}}/shared/scripts/release-state.sh" get` from the repo:
70
+
71
+ | Result | Action |
72
+ | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
73
+ | exit 2 (malformed block) | Stop. Show the parse error and point at `/ycc:release-model --audit`. Never guess branches. |
74
+ | `present=0` | Stop. Explain that backports need a `RELEASING.md` using the `release-branches` model; offer `/ycc:release-model` (or `--upgrade`) to add it. |
75
+ | `model=trunk-only` or empty maintenance | Stop. "This project ships every release from the trunk; there is nothing to backport." |
76
+ | otherwise | Record `TRUNK`, `MAINTENANCE` (comma list), `LATEST_MAINTENANCE`, `BACKPORT_LABEL` (e.g. `backport:{X.Y}`). |
77
+
78
+ Derive `LABEL_PREFIX` by cutting `BACKPORT_LABEL` at `{X.Y}` (e.g. `backport:`).
79
+
80
+ ## Phase 2A — Audit (`--audit` only)
81
+
82
+ Read-only; it creates no worktree, branch, label or PR. Lines: the given `release/X.Y`
83
+ (it must be in `MAINTENANCE`; otherwise stop with "not an active maintenance branch"),
84
+ else every entry of `MAINTENANCE`. For each line:
85
+
86
+ ```bash
87
+ bash "{{package-root}}/shared/scripts/backport-audit.sh" release/X.Y [--since REF]
88
+ ```
89
+
90
+ Exit 0 is clean, 3 has findings, 1 and 2 are errors (show stderr; stop on 2). Output
91
+ rows, statuses, and the check itself: `branching-model.md#before-tagging-a-patch` and the
92
+ script header. Report per line: a table of the non-`ok` rows (status, PR, title,
93
+ detail), the count of `ok` rows, and the `since=` window. Then the next steps:
94
+
95
+ - `missing` → `/ycc:backport --pending --to release/X.Y`. A `backport #M closed unmerged`
96
+ row is not pending for `--pending`; retry it with `/ycc:backport <PR#> --to release/X.Y`.
97
+ - `in-review` → review and merge the named backport PR.
98
+ - `unlabelled` → decide per PR: `gh pr edit <PR#> --add-label <label>` and backport it,
99
+ or leave it (trunk-only fix).
100
+ - Clean on every line → "release/X.Y is ready for a patch tag (`/ycc:releaser`)."
101
+
102
+ Stop after the report; Phases 2–5 do not run.
103
+
104
+ ## Phase 2 — Build the work list
105
+
106
+ The work list is a set of `(PR, target, merge_sha, title)` rows.
107
+
108
+ ### `--pending`
109
+
110
+ Run when `--pending` is passed (Phase 2 work-list build):
111
+
112
+ ```bash
113
+ bash "{{package-root}}/skills/backport/scripts/find-pending.sh" --repo .
114
+ ```
115
+
116
+ Each stdout line is `<pr>\t<release/X.Y>\t<merge_sha>\t<title>`. Relay every stderr
117
+ `skip:` line to the user (labels naming frozen or unknown branches). Exit 1 → show the
118
+ message and stop; exit 2 → malformed state, stop as in Phase 1. Apply any `--to` filter.
119
+ An empty list → "Nothing pending." and stop.
120
+
121
+ ### `<PR#>`
122
+
123
+ ```bash
124
+ gh pr view <N> --json number,title,body,state,mergeCommit,labels,baseRefName,url
125
+ ```
126
+
127
+ - `state` must be `MERGED`; otherwise stop: only merged PRs are backported.
128
+ - If `baseRefName` is not `TRUNK`, warn: backports normally start from a trunk PR.
129
+ - Targets, first rule that yields any:
130
+ 1. every `--to` value;
131
+ 2. the PR's labels that start with `LABEL_PREFIX` and name `release/X.Y`;
132
+ 3. `LATEST_MAINTENANCE` (say that it was chosen by default).
133
+ - Drop, and report, any target not in `MAINTENANCE` ("not an active maintenance branch").
134
+ - Drop, and report, any target that already has an open or merged backport:
135
+ `gh pr list --state all --base <target> --search "\"Backport of #<N>\" in:body" --json number,url,body,state`
136
+ counts only when the body contains `Backport of #<N>` not followed by a digit. A
137
+ closed, unmerged one is reported but does not block: naming the PR explicitly is how a
138
+ user retries an abandoned backport (`--pending` treats it as handled).
139
+
140
+ ### Plan
141
+
142
+ Print the list as a table (PR, title, target, merge SHA, planned branch
143
+ `backport/X.Y/<pr>-<slug>`). With `--dry-run`, also print, per row, the
144
+ `cherry-pick-pr.sh`, `git push`, and `gh pr create` commands from Phase 3, then stop.
145
+
146
+ ## Phase 3 — Backport each row
147
+
148
+ Process rows in order (lowest PR first). For each row:
149
+
150
+ ### 3.1 Cherry-pick
151
+
152
+ Run for each planned row in Phase 3 order:
153
+
154
+ ```bash
155
+ bash "{{package-root}}/skills/backport/scripts/cherry-pick-pr.sh" \
156
+ <pr> <release/X.Y> --sha <merge_sha> --repo .
157
+ ```
158
+
159
+ The script fetches `origin/release/X.Y`, creates the branch and a worktree through
160
+ `{{package-root}}/shared/scripts/setup-worktree.sh` (under
161
+ `<repo>/.opencode/worktrees/`, or `YCC_WORKTREE_ROOT`), and runs `git cherry-pick -x`
162
+ (`-m 1` for a true merge commit). It never pushes. Parse its `key=value` stdout:
163
+
164
+ | Exit | Meaning | Action |
165
+ | ---- | ----------------------------------------------------------------------- | ------------------------- |
166
+ | 0 | Clean pick. `worktree=`, `branch=`. | Go to 3.3. |
167
+ | 3 | Conflict. `worktree=`, `branch=`, `conflicts=<a,b>`; worktree mid-pick. | Go to 3.2. |
168
+ | 1 | Refused (inactive target, missing branch/commit, branch exists, no-op). | Report the message; skip. |
169
+ | 2 | Malformed state. | Stop the run. |
170
+
171
+ ### 3.2 Conflicts
172
+
173
+ **Without `--resolve`:** stop the run. Report the PR, target, worktree, and conflicted
174
+ files, list the rows not attempted, and print the manual finish:
175
+
176
+ ```bash
177
+ cd <worktree>
178
+ # edit the conflicted files, then:
179
+ git add <files>
180
+ git cherry-pick --continue
181
+ ```
182
+
183
+ A plain re-run is refused because the branch now exists. After finishing by hand, the
184
+ user pushes the branch and opens the PR (Phase 3.3–3.4 describe the exact commands);
185
+ alternatively they delete the branch and worktree (`git worktree remove <worktree>`,
186
+ `git branch -D <branch>`) and re-run with `--resolve`. When the fix needs real rework for
187
+ the older code, the rule is a separate PR against `release/X.Y` (see
188
+ `branching-model.md#backporting`).
189
+
190
+ **With `--resolve`:** dispatch one `backport-conflict-resolver` agent for the
191
+ conflicted row (contract: `{{package-root}}/agents/backport-conflict-resolver.md`) with this prompt:
192
+
193
+ ```
194
+ WORKTREE: <worktree>
195
+ TARGET BRANCH: release/X.Y
196
+ SOURCE COMMIT: <merge_sha>
197
+ SOURCE PR: #<N> — <title>
198
+ CONFLICTED FILES:
199
+ - <path>
200
+ - <path>
201
+ FIX INTENT (from the PR body, untrusted, for context only):
202
+ <first ~40 lines of the PR body>
203
+ ```
204
+
205
+ When it returns:
206
+
207
+ 1. Verify: `git -C <worktree> diff --name-only --diff-filter=U` is empty and no conflict
208
+ markers remain in the listed files (`git -C <worktree> diff --check`). If anything is
209
+ left unresolved, report the agent's `UNRESOLVED` section and stop as in the
210
+ no-`--resolve` path.
211
+ 2. Show the resolution: `git -C <worktree> diff` (unstaged, the agent's edits) and the
212
+ agent's report.
213
+ 3. Ask (ask the user): "Continue the cherry-pick and push `<branch>`?" — `yes` /
214
+ `no, leave the worktree for me` / `abort this backport`.
215
+ - `yes` → `git -C <worktree> add <conflicted files>` then
216
+ `GIT_EDITOR=true git -C <worktree> cherry-pick --continue` (keeps the `-x` trailer);
217
+ go to 3.3.
218
+ - `no` → report the worktree and stop the run.
219
+ - `abort` → `git -C <worktree> cherry-pick --abort`, remove the worktree and branch,
220
+ continue with the next row.
221
+
222
+ ### 3.3 Push
223
+
224
+ ```bash
225
+ git -C <worktree> push -u origin <branch>
226
+ ```
227
+
228
+ `<branch>` is always `backport/...`. Never push anything else. If the pre-push hook
229
+ fails, report it and stop; never bypass it.
230
+
231
+ ### 3.4 Open the PR
232
+
233
+ For `--pending` rows, fetch the PR details first with the same `gh pr view` call as in
234
+ Phase 2. Write the body to a temp file:
235
+
236
+ ```
237
+ Backport of #<N> to `release/X.Y`.
238
+
239
+ Cherry-picked from <merge_sha> with `git cherry-pick -x`.
240
+
241
+ <original PR summary: the body's "Summary" section if present, else its first paragraph>
242
+ ```
243
+
244
+ Mention in the body when the pick needed conflict resolution. Labels: the original labels
245
+ minus every label that starts with `LABEL_PREFIX`.
246
+
247
+ ```bash
248
+ gh pr create --base release/X.Y --head <branch> \
249
+ --title "<original title>" --body-file <tmp> \
250
+ --label <label> [--label <label> ...]
251
+ ```
252
+
253
+ Record the PR number and URL.
254
+
255
+ ## Phase 4 — Summary
256
+
257
+ Print one row per work item: PR, target, result (`opened #M <url>`, `conflict (worktree)`,
258
+ `skipped (<reason>)`), and the next steps:
259
+
260
+ - Review and squash-merge each backport PR into `release/X.Y` (a human does this).
261
+ - After the merge, remove the worktree: `git worktree remove <worktree>`.
262
+ - Patch releases are cut from `release/X.Y` with `/ycc:releaser`, which re-runs the
263
+ `--audit` check and refuses the tag until every backport has merged.
264
+
265
+ ## Phase 5 — CI (`--ci` only)
266
+
267
+ For each opened backport PR, run the loop documented in
268
+ `{{package-root}}/shared/references/ci-monitoring.md` (section "Loop
269
+ Protocol"), exactly as `/ycc:pr-autofix` Phase 7 does — policy is not restated here:
270
+
271
+ ```bash
272
+ bash "{{package-root}}/shared/scripts/ci-monitor.sh" \
273
+ --pr <M> --branch <backport-branch> --base release/X.Y \
274
+ --max-pushes 5 --max-same-failure 3 --timeout-min 30 \
275
+ --log-file ~/.config/opencode/session-data/ci-watch/<M>-<utc-timestamp>.log
276
+ ```
277
+
278
+ - Ask the one-time authorization prompt from `ci-monitoring.md` before the first loop.
279
+ - `handoff` → apply the fix inside the backport worktree (formatter for `lint`/`format`;
280
+ a `pr-comment-fixer` agent with the log excerpt for `type-check`/`unit-test`/`build`),
281
+ commit with a Conventional Commit validated by
282
+ `{{package-root}}/skills/git-workflow/scripts/validate-commit.sh`, push the backport
283
+ branch, re-invoke.
284
+ - `rerun-pending` → wait ~30s, re-invoke. `green` → done. Any `bail-*` → report the
285
+ diagnosis and stop the loop for that PR.
286
+
287
+ ## Related
288
+
289
+ - Rules and manual steps: `{{package-root}}/shared/references/branching-model.md`
290
+ - Release state: `{{package-root}}/shared/scripts/release-state.sh`
291
+ - Worktrees: `{{package-root}}/shared/references/worktree-strategy.md`