@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.
- package/AGENTS.md +38 -0
- package/LICENSE +21 -0
- package/README.md +41 -2
- package/agents/ansible-automation-expert.md +115 -0
- package/agents/api-docs-expert.md +146 -0
- package/agents/api-documenter.md +105 -0
- package/agents/architect.md +264 -0
- package/agents/architecture-analyst.md +99 -0
- package/agents/backport-conflict-resolver.md +134 -0
- package/agents/cloudflare-architect.md +85 -0
- package/agents/cloudflare-developer.md +196 -0
- package/agents/code-architect.md +101 -0
- package/agents/code-documenter.md +114 -0
- package/agents/code-explorer.md +99 -0
- package/agents/code-finder.md +83 -0
- package/agents/code-researcher.md +102 -0
- package/agents/code-reviewer.md +268 -0
- package/agents/code-simplifier.md +77 -0
- package/agents/codebase-advisor.md +130 -0
- package/agents/db-modifier.md +235 -0
- package/agents/docs-git-committer.md +220 -0
- package/agents/documentation-writer.md +92 -0
- package/agents/feature-researcher.md +121 -0
- package/agents/feature-writer.md +89 -0
- package/agents/frontend-ui-developer.md +98 -0
- package/agents/git-cleanup.md +173 -0
- package/agents/go-api-architect.md +172 -0
- package/agents/go-expert-architect.md +147 -0
- package/agents/implementor.md +167 -0
- package/agents/library-docs-writer.md +128 -0
- package/agents/nextjs-ux-ui-expert.md +127 -0
- package/agents/nodejs-backend-architect.md +112 -0
- package/agents/nodejs-backend-developer.md +184 -0
- package/agents/planner.md +257 -0
- package/agents/pr-comment-fixer.md +284 -0
- package/agents/practices-researcher.md +80 -0
- package/agents/project-file-cleaner.md +140 -0
- package/agents/prp-researcher.md +231 -0
- package/agents/python-developer.md +171 -0
- package/agents/python-expert-architect.md +188 -0
- package/agents/readme-generator.md +100 -0
- package/agents/release-fix-applier.md +194 -0
- package/agents/releaser.md +147 -0
- package/agents/research-specialist.md +106 -0
- package/agents/reverse-proxy-architect.md +131 -0
- package/agents/review-fixer.md +264 -0
- package/agents/root-cause-analyzer.md +105 -0
- package/agents/rust-build-resolver.md +183 -0
- package/agents/rust-expert-architect.md +149 -0
- package/agents/rust-reviewer.md +126 -0
- package/agents/sql-database-developer.md +195 -0
- package/agents/systems-engineering-expert.md +203 -0
- package/agents/terraform-architect.md +109 -0
- package/agents/terraform-developer.md +229 -0
- package/agents/test-strategy-planner.md +126 -0
- package/agents/turso-database-architect.md +139 -0
- package/agents/typescript-developer.md +170 -0
- package/agents/typescript-expert-architect.md +167 -0
- package/index.js +260 -0
- package/package.json +35 -4
- package/registration.json +4384 -0
- package/shared/references/agent-native-setup.md +121 -0
- package/shared/references/branch-prep.md +31 -0
- package/shared/references/branching-model.md +162 -0
- package/shared/references/ci-monitoring.md +445 -0
- package/shared/references/forge-detection.md +162 -0
- package/shared/references/goal-pairing.md +53 -0
- package/shared/references/pr-base-and-backport.md +143 -0
- package/shared/references/review-artifact-format.md +141 -0
- package/shared/references/review-checklist.md +161 -0
- package/shared/references/review-dispatch.md +71 -0
- package/shared/references/session-state.md +159 -0
- package/shared/references/standalone-dispatch.md +298 -0
- package/shared/references/target-capability-matrix.md +325 -0
- package/shared/references/visual-mode.md +155 -0
- package/shared/references/worktree-strategy.md +310 -0
- package/shared/scripts/backport-audit.sh +283 -0
- package/shared/scripts/ci-monitor.sh +637 -0
- package/shared/scripts/lib/backport-lib.sh +47 -0
- package/shared/scripts/lib/ci-classify.sh +103 -0
- package/shared/scripts/lib/forge.sh +264 -0
- package/shared/scripts/lib/release-state-lib.sh +300 -0
- package/shared/scripts/list-worktrees.sh +178 -0
- package/shared/scripts/merge-children.sh +82 -0
- package/shared/scripts/move-plan-to-worktree.sh +231 -0
- package/shared/scripts/pr-guard.sh +283 -0
- package/shared/scripts/prepare-feature-branch.sh +326 -0
- package/shared/scripts/release-ci-monitor.sh +671 -0
- package/shared/scripts/release-state-update.sh +216 -0
- package/shared/scripts/release-state.sh +178 -0
- package/shared/scripts/report-bundle-drift.sh +343 -0
- package/shared/scripts/require-python.sh +17 -0
- package/shared/scripts/resolve-plans-dir.sh +262 -0
- package/shared/scripts/rules-pointer.sh +20 -0
- package/shared/scripts/rules_pointer.py +267 -0
- package/shared/scripts/setup-worktree.sh +288 -0
- package/shared/scripts/validate-file-paths.sh +249 -0
- package/shared/scripts/visual-egress-guard.sh +303 -0
- package/shared/scripts/visual-recap-collect.sh +247 -0
- package/shared/scripts/worktree-paths.sh +86 -0
- package/skills/backport/SKILL.md +291 -0
- package/skills/backport/scripts/cherry-pick-pr.sh +232 -0
- package/skills/backport/scripts/find-pending.sh +199 -0
- package/skills/blueprint/SKILL.md +410 -0
- package/skills/blueprint/references/bootstrap-mapping.md +87 -0
- package/skills/bundle-author/SKILL.md +119 -0
- package/skills/bundle-author/references/surface-map.md +128 -0
- package/skills/bundle-author/references/templates/agent-template.md +21 -0
- package/skills/bundle-author/references/templates/skill-template.md +36 -0
- package/skills/bundle-author/references/when-not-to-scaffold.md +85 -0
- package/skills/bundle-author/scripts/scaffold-skill.sh +156 -0
- package/skills/bundle-release/SKILL.md +188 -0
- package/skills/bundle-release/references/release-checklist.md +196 -0
- package/skills/bundle-release/references/release-notes-template.md +48 -0
- package/skills/bundle-release/references/version-policy.md +150 -0
- package/skills/bundle-release/scripts/bump-version.sh +97 -0
- package/skills/bundle-release/scripts/draft-notes.sh +222 -0
- package/skills/bundle-release/scripts/preflight.sh +164 -0
- package/skills/bundle-release/scripts/release_versions.py +361 -0
- package/skills/clean/SKILL.md +107 -0
- package/skills/clean/references/agent-prompts.md +199 -0
- package/skills/clean/references/safety-config.md +125 -0
- package/skills/clean/scripts/detect-project-type.sh +423 -0
- package/skills/clean/scripts/generate-report.sh +245 -0
- package/skills/clean/scripts/validate-safety.sh +401 -0
- package/skills/code-report/SKILL.md +375 -0
- package/skills/code-report/scripts/check-prerequisites.sh +65 -0
- package/skills/code-report/templates/report-structure.md +202 -0
- package/skills/code-review/SKILL.md +153 -0
- package/skills/code-review/references/pr-procedure.md +311 -0
- package/skills/compatibility-audit/SKILL.md +226 -0
- package/skills/compatibility-audit/references/reading-the-report.md +159 -0
- package/skills/compatibility-audit/scripts/audit-install-assumptions.sh +372 -0
- package/skills/compatibility-audit/scripts/audit-target-features.sh +558 -0
- package/skills/deep-research/SKILL.md +251 -0
- package/skills/deep-research/references/analysis-prompts.md +702 -0
- package/skills/deep-research/references/completion-summary-template.md +66 -0
- package/skills/deep-research/references/persona-analogical.md +159 -0
- package/skills/deep-research/references/persona-archaeological.md +69 -0
- package/skills/deep-research/references/persona-contrarian.md +155 -0
- package/skills/deep-research/references/persona-futurist.md +70 -0
- package/skills/deep-research/references/persona-historical.md +142 -0
- package/skills/deep-research/references/persona-journalistic.md +69 -0
- package/skills/deep-research/references/persona-negative-space.md +70 -0
- package/skills/deep-research/references/persona-systems.md +69 -0
- package/skills/deep-research/references/synthesis-template.md +569 -0
- package/skills/deep-research/references/verification-log-template.md +32 -0
- package/skills/deep-research/scripts/check-prerequisites.sh +153 -0
- package/skills/deep-research/scripts/validate-research.sh +244 -0
- package/skills/feature-research/SKILL.md +292 -0
- package/skills/feature-research/scripts/validate-research.sh +159 -0
- package/skills/feature-research/scripts/validate-spec.sh +270 -0
- package/skills/feature-research/templates/research-agents.md +569 -0
- package/skills/feature-research/templates/spec-structure.md +437 -0
- package/skills/formatters/SKILL.md +207 -0
- package/skills/formatters/references/best-practices.md +78 -0
- package/skills/formatters/references/flag-reference.md +178 -0
- package/skills/formatters/references/stack-detection.md +119 -0
- package/skills/formatters/references/templates/husky-pre-commit.tmpl +13 -0
- package/skills/formatters/references/templates/justfile-snippet.just.tmpl +31 -0
- package/skills/formatters/references/templates/lefthook.yml.tmpl +22 -0
- package/skills/formatters/references/templates/lint-autofix.yml.tmpl +94 -0
- package/skills/formatters/references/templates/lint.yml.tmpl +85 -0
- package/skills/formatters/references/templates/makefile-snippet.mk.tmpl +34 -0
- package/skills/formatters/references/templates/package-json-scripts.json.tmpl +14 -0
- package/skills/formatters/references/templates/readme-section.md.tmpl +118 -0
- package/skills/formatters/scripts/apply-aliases.sh +245 -0
- package/skills/formatters/scripts/apply-ci.sh +136 -0
- package/skills/formatters/scripts/apply-docs.sh +187 -0
- package/skills/formatters/scripts/apply-hooks.sh +261 -0
- package/skills/formatters/scripts/bundle/format.sh +15 -0
- package/skills/formatters/scripts/bundle/go-tools.sh +119 -0
- package/skills/formatters/scripts/bundle/init-formatters.sh +517 -0
- package/skills/formatters/scripts/bundle/install-shellcheck.sh +85 -0
- package/skills/formatters/scripts/bundle/lib/excludes.sh +179 -0
- package/skills/formatters/scripts/bundle/lib/modified-files.sh +222 -0
- package/skills/formatters/scripts/bundle/lib/shellcheck-resolve.sh +81 -0
- package/skills/formatters/scripts/bundle/lib/shellcheck-version.sh +5 -0
- package/skills/formatters/scripts/bundle/lint.sh +15 -0
- package/skills/formatters/scripts/bundle/style.sh +1410 -0
- package/skills/formatters/scripts/bundle/templates/biome.json +81 -0
- package/skills/formatters/scripts/bundle/templates/clippy.toml +2 -0
- package/skills/formatters/scripts/bundle/templates/markdownlint.json +14 -0
- package/skills/formatters/scripts/bundle/templates/markdownlintignore +38 -0
- package/skills/formatters/scripts/bundle/templates/prettierignore +45 -0
- package/skills/formatters/scripts/bundle/templates/prettierrc.json +11 -0
- package/skills/formatters/scripts/bundle/templates/python-pyproject.toml +80 -0
- package/skills/formatters/scripts/bundle/templates/rustfmt.toml +41 -0
- package/skills/formatters/scripts/bundle/templates/tsconfig.json +21 -0
- package/skills/formatters/scripts/profile-style.sh +264 -0
- package/skills/frontend-design/SKILL.md +151 -0
- package/skills/frontend-patterns/SKILL.md +66 -0
- package/skills/frontend-patterns/references/animation.md +21 -0
- package/skills/frontend-patterns/references/components-and-state.md +40 -0
- package/skills/frontend-patterns/references/data-and-performance.md +34 -0
- package/skills/frontend-patterns/references/forms-errors-a11y.md +35 -0
- package/skills/git-cleanup/SKILL.md +286 -0
- package/skills/git-cleanup/references/active-code-rules.md +318 -0
- package/skills/git-cleanup/references/host-detection.md +217 -0
- package/skills/git-workflow/SKILL.md +130 -0
- package/skills/git-workflow/references/ci-monitoring-phase.md +130 -0
- package/skills/git-workflow/references/commit-phases.md +247 -0
- package/skills/git-workflow/references/examples-and-troubleshooting.md +47 -0
- package/skills/git-workflow/references/goal-pairing.md +23 -0
- package/skills/git-workflow/references/pr-creation.md +269 -0
- package/skills/git-workflow/scripts/analyze-changes.sh +266 -0
- package/skills/git-workflow/scripts/create-pr.sh +464 -0
- package/skills/git-workflow/scripts/validate-commit.sh +235 -0
- package/skills/git-workflow/templates/agent-prompts.md +518 -0
- package/skills/git-workflow/templates/commit-types.md +504 -0
- package/skills/git-workflow/templates/documentation-decision.md +509 -0
- package/skills/git-workflow/templates/pr-template.md +772 -0
- package/skills/go-patterns/SKILL.md +89 -0
- package/skills/go-patterns/references/design-and-tooling.md +336 -0
- package/skills/go-patterns/references/errors-and-concurrency.md +292 -0
- package/skills/go-testing/SKILL.md +133 -0
- package/skills/go-testing/references/advanced-testing.md +349 -0
- package/skills/go-testing/references/test-structure.md +277 -0
- package/skills/hooks-workflow/SKILL.md +232 -0
- package/skills/hooks-workflow/references/support-notes.md +134 -0
- package/skills/hooks-workflow/references/templates/claude-settings.json.tmpl +13 -0
- package/skills/hooks-workflow/references/templates/codex-config-fragment.toml.tmpl +9 -0
- package/skills/hooks-workflow/references/templates/cursor-rule-fragment.mdc.tmpl +16 -0
- package/skills/hooks-workflow/scripts/build-hook-config.sh +487 -0
- package/skills/hooks-workflow/scripts/verify-hooks.sh +257 -0
- package/skills/implement-plan/SKILL.md +221 -0
- package/skills/implement-plan/references/agent-task-prompt.md +214 -0
- package/skills/implement-plan/references/output-formats.md +150 -0
- package/skills/implement-plan/references/plan-inputs.md +126 -0
- package/skills/implement-plan/scripts/check-prerequisites.sh +78 -0
- package/skills/implement-plan/scripts/parse-dependencies.sh +206 -0
- package/skills/init/SKILL.md +272 -0
- package/skills/init/references/conventional-commits.md +114 -0
- package/skills/init/references/flag-reference.md +236 -0
- package/skills/init/references/label-taxonomy.md +115 -0
- package/skills/init/references/project-profile-heuristics.md +156 -0
- package/skills/init/references/template-library.md +129 -0
- package/skills/init/scripts/count-source-files.sh +60 -0
- package/skills/init/scripts/generate-agent-catalog.sh +193 -0
- package/skills/init/scripts/generate-mcp-catalog.sh +214 -0
- package/skills/init/scripts/migrate-rules.py +459 -0
- package/skills/init/scripts/migrate-rules.sh +26 -0
- package/skills/init/scripts/profile-project.sh +453 -0
- package/skills/init/scripts/render-template.py +226 -0
- package/skills/init/scripts/render-template.sh +25 -0
- package/skills/init/scripts/rules-report.sh +31 -0
- package/skills/init/scripts/rules_file_lib.py +41 -0
- package/skills/init/templates/AGENTS.md.tmpl +38 -0
- package/skills/init/templates/CLAUDE.md.tmpl +7 -0
- package/skills/init/templates/ai-rule.md.tmpl +3 -0
- package/skills/init/templates/cursor-rule.mdc.tmpl +7 -0
- package/skills/init/templates/git/commitlint.config.cjs.tmpl +40 -0
- package/skills/init/templates/git/gitignore.tmpl +120 -0
- package/skills/init/templates/git/gitmessage.tmpl +27 -0
- package/skills/init/templates/git/install-lefthook.sh.tmpl +131 -0
- package/skills/init/templates/git/lefthook-usage.md.tmpl +101 -0
- package/skills/init/templates/git/lefthook.yml.tmpl +64 -0
- package/skills/init/templates/github/bug_report.yml.tmpl +78 -0
- package/skills/init/templates/github/config.yml.tmpl +5 -0
- package/skills/init/templates/github/copilot-instructions.md.tmpl +24 -0
- package/skills/init/templates/github/docs_request.yml.tmpl +41 -0
- package/skills/init/templates/github/feature_request.yml.tmpl +59 -0
- package/skills/init/templates/github/labels.md.tmpl +75 -0
- package/skills/init/templates/github/pull_request_template.md.tmpl +66 -0
- package/skills/init/templates/github/workflows/pr-title-autofix.yml.tmpl +101 -0
- package/skills/init/templates/github/workflows/pr-title.yml.tmpl +55 -0
- package/skills/init/templates/workspace-report.md +83 -0
- package/skills/orchestrate/SKILL.md +165 -0
- package/skills/orchestrate/references/agent-catalog.md +601 -0
- package/skills/orchestrate/references/agent-prompts.md +495 -0
- package/skills/orchestrate/references/dispatch-playbook.md +333 -0
- package/skills/orchestrate/references/task-breakdown.md +410 -0
- package/skills/orchestrate/scripts/analyze-task.sh +139 -0
- package/skills/orchestrate/scripts/summarize-results.sh +160 -0
- package/skills/orchestrate/scripts/validate-agents.sh +92 -0
- package/skills/parallel-plan/SKILL.md +124 -0
- package/skills/plan/SKILL.md +134 -0
- package/skills/plan/references/enhanced-personas.md +131 -0
- package/skills/plan/references/personas-and-merge.md +77 -0
- package/skills/plan/references/plan-validation.md +65 -0
- package/skills/plan/references/planner-prompts.md +68 -0
- package/skills/plan/references/planning-tracks.md +73 -0
- package/skills/plan-workflow/SKILL.md +406 -0
- package/skills/plan-workflow/references/checkpoint-messages.md +370 -0
- package/skills/plan-workflow/references/plan-structure.md +238 -0
- package/skills/plan-workflow/references/planning-agents.md +511 -0
- package/skills/plan-workflow/references/research-agents-optimized.md +348 -0
- package/skills/plan-workflow/references/research-agents.md +436 -0
- package/skills/plan-workflow/references/shared-structure.md +152 -0
- package/skills/plan-workflow/references/validation-agents.md +363 -0
- package/skills/plan-workflow/scripts/check-prerequisites.sh +65 -0
- package/skills/plan-workflow/scripts/check-state.sh +190 -0
- package/skills/plan-workflow/scripts/persist-or-fail.sh +135 -0
- package/skills/plan-workflow/scripts/validate-analysis-artifacts.sh +216 -0
- package/skills/plan-workflow/scripts/validate-research-artifacts.sh +225 -0
- package/skills/plan-workflow/scripts/validate-shared.sh +229 -0
- package/skills/plan-workflow/scripts/validate-workflow-plan.sh +256 -0
- package/skills/pr-autofix/SKILL.md +307 -0
- package/skills/pr-autofix/references/ci-loop.md +64 -0
- package/skills/pr-autofix/references/comment-sources.md +197 -0
- package/skills/pr-autofix/references/data-shapes.md +87 -0
- package/skills/pr-autofix/references/goal-example.md +30 -0
- package/skills/pr-autofix/references/output-templates.md +162 -0
- package/skills/pr-autofix/references/prompt-injection-safety.md +165 -0
- package/skills/pr-autofix/references/related-skills.md +11 -0
- package/skills/pr-autofix/references/severity-mapping.md +146 -0
- package/skills/pr-autofix/scripts/fetch-pr-comments.sh +364 -0
- package/skills/pr-autofix/scripts/post-summary.sh +226 -0
- package/skills/pr-autofix/scripts/resolve-thread.sh +251 -0
- package/skills/prp-commit/SKILL.md +128 -0
- package/skills/prp-implement/SKILL.md +177 -0
- package/skills/prp-implement/references/agent-task-prompt.md +36 -0
- package/skills/prp-implement/references/detection.md +49 -0
- package/skills/prp-implement/references/dry-run.md +0 -0
- package/skills/prp-implement/references/report-output.md +204 -0
- package/skills/prp-implement/references/validation-and-failures.md +118 -0
- package/skills/prp-plan/SKILL.md +323 -0
- package/skills/prp-plan/references/enhanced-researchers.md +425 -0
- package/skills/prp-plan/references/parallel-additions.md +56 -0
- package/skills/prp-plan/references/plan-template.md +264 -0
- package/skills/prp-plan/references/synthesis-map.md +25 -0
- package/skills/prp-plan/scripts/preflight-enhanced-agents.sh +111 -0
- package/skills/prp-plan/scripts/validate-prp-plan.sh +368 -0
- package/skills/prp-pr/SKILL.md +402 -0
- package/skills/prp-prd/SKILL.md +442 -0
- package/skills/prp-spec/SKILL.md +274 -0
- package/skills/python-patterns/SKILL.md +103 -0
- package/skills/python-patterns/references/core-idioms.md +304 -0
- package/skills/python-patterns/references/design-and-tooling.md +407 -0
- package/skills/python-testing/SKILL.md +114 -0
- package/skills/python-testing/references/mocking-and-integration.md +395 -0
- package/skills/python-testing/references/pytest-core.md +366 -0
- package/skills/quick-fix/SKILL.md +246 -0
- package/skills/quick-review/SKILL.md +304 -0
- package/skills/release-model/SKILL.md +231 -0
- package/skills/release-model/references/pointer-and-labels.md +83 -0
- package/skills/release-model/references/signals-and-proposal.md +68 -0
- package/skills/release-model/references/template-placeholders.md +42 -0
- package/skills/release-model/references/upgrade-and-audit.md +131 -0
- package/skills/release-model/scripts/collect-signals.sh +459 -0
- package/skills/release-model/scripts/pointer-targets.sh +29 -0
- package/skills/release-model/templates/RELEASING.md.tmpl +151 -0
- package/skills/releaser/SKILL.md +251 -0
- package/skills/releaser/references/ci-optimization-checklist.md +149 -0
- package/skills/releaser/references/ci-templates/docker-release.yml +88 -0
- package/skills/releaser/references/ci-templates/generic-release.yml +69 -0
- package/skills/releaser/references/ci-templates/go-release.yml +50 -0
- package/skills/releaser/references/ci-templates/node-release.yml +126 -0
- package/skills/releaser/references/ci-templates/python-release.yml +95 -0
- package/skills/releaser/references/ci-templates/rust-release.yml +128 -0
- package/skills/releaser/references/ci-workflow-modes.md +42 -0
- package/skills/releaser/references/goal-pairing.md +37 -0
- package/skills/releaser/references/output-templates.md +143 -0
- package/skills/releaser/references/project-type-matrix.md +144 -0
- package/skills/releaser/references/release-branches.md +138 -0
- package/skills/releaser/references/release-ci-loop.md +249 -0
- package/skills/releaser/references/release-notes-template.md +42 -0
- package/skills/releaser/references/release-preparation.md +210 -0
- package/skills/releaser/scripts/check-release-branch.sh +235 -0
- package/skills/releaser/scripts/detect-project.sh +234 -0
- package/skills/releaser/scripts/draft-changelog.sh +387 -0
- package/skills/releaser/scripts/publish-release.sh +302 -0
- package/skills/research-to-issues/SKILL.md +285 -0
- package/skills/research-to-issues/references/label-taxonomy.md +48 -0
- package/skills/research-to-issues/references/parse-deep-research.md +86 -0
- package/skills/research-to-issues/references/parse-feature-spec.md +143 -0
- package/skills/research-to-issues/references/parse-parallel-plan.md +124 -0
- package/skills/research-to-issues/references/parse-prd.md +184 -0
- package/skills/research-to-issues/references/parse-prp-plan.md +237 -0
- package/skills/research-to-issues/references/plan-display-format.md +136 -0
- package/skills/research-to-issues/scripts/validate-prerequisites.sh +312 -0
- package/skills/research-to-issues/templates/feature-issue.md +131 -0
- package/skills/research-to-issues/templates/task-issue.md +104 -0
- package/skills/research-to-issues/templates/tracking-issue.md +126 -0
- package/skills/resume-session/SKILL.md +152 -0
- package/skills/review-fix/SKILL.md +229 -0
- package/skills/review-fix/references/fix-report.md +121 -0
- package/skills/review-fix/references/fixer-dispatch.md +79 -0
- package/skills/review-fix/references/plan.md +119 -0
- package/skills/rust-patterns/SKILL.md +85 -0
- package/skills/rust-patterns/references/concurrency-unsafe-modules.md +243 -0
- package/skills/rust-patterns/references/ownership-errors-types.md +262 -0
- package/skills/rust-testing/SKILL.md +99 -0
- package/skills/rust-testing/references/advanced-testing.md +247 -0
- package/skills/rust-testing/references/unit-and-integration.md +193 -0
- package/skills/save-session/SKILL.md +159 -0
- package/skills/shared-context/SKILL.md +101 -0
- package/skills/ts-patterns/SKILL.md +159 -0
- package/skills/ts-patterns/references/async-runtimes-tooling.md +375 -0
- package/skills/ts-patterns/references/types-errors-modules.md +336 -0
- package/skills/ts-testing/SKILL.md +151 -0
- package/skills/ts-testing/references/advanced-testing.md +350 -0
- package/skills/ts-testing/references/vitest-core.md +318 -0
- package/skills/visual-plan/SKILL.md +221 -0
- package/skills/visual-plan/references/canvas.md +132 -0
- package/skills/visual-plan/references/document-quality.md +178 -0
- package/skills/visual-plan/references/exemplar.md +120 -0
- package/skills/visual-plan/references/wireframe.md +212 -0
- package/skills/visual-plan/scripts/derive-visual-dir.sh +77 -0
- package/skills/visual-recap/SKILL.md +238 -0
- package/skills/visual-recap/references/wireframe.md +237 -0
- package/skills/write-docs/SKILL.md +354 -0
- package/skills/write-docs/scripts/audit-documentation.sh +190 -0
- package/skills/write-docs/scripts/generate-doc-index.sh +125 -0
- package/skills/write-docs/scripts/verify-links.sh +81 -0
- package/skills/write-docs/templates/docs-readme.md +34 -0
- package/skills/write-docs/templates/documentation-strategy.md +91 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# pr-guard.sh — PR base selection, sync-merge guard and backport prompt for the
|
|
3
|
+
# ycc release model. Shared by git-workflow and prp-pr; runs in the current
|
|
4
|
+
# repository.
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# pr-guard.sh base [--base BRANCH] [--head REF]
|
|
8
|
+
# pr-guard.sh sync-check [--base BRANCH] [--head REF] [--head-branch NAME]
|
|
9
|
+
# pr-guard.sh backport-label [--base BRANCH] [--head REF] [--title TITLE]
|
|
10
|
+
# [--labels L1,L2,...]
|
|
11
|
+
#
|
|
12
|
+
# Subcommands:
|
|
13
|
+
# base print the PR base branch: --base when given, else
|
|
14
|
+
# `release-state.sh base --head REF` when RELEASING.md exists,
|
|
15
|
+
# else the forge default branch (origin/HEAD, then "main").
|
|
16
|
+
# sync-check refuse a PR that would sync one long-lived branch into
|
|
17
|
+
# another. Prints result=ok|skipped|refused plus reason= lines.
|
|
18
|
+
# Needs origin/<base> fetched. Skipped without RELEASING.md.
|
|
19
|
+
# backport-label decide whether to offer a backport. Prints backport=0 with
|
|
20
|
+
# reason=, or backport=1 with branch= and label=.
|
|
21
|
+
#
|
|
22
|
+
# Options:
|
|
23
|
+
# --base BRANCH PR base (default: the `base` subcommand's answer)
|
|
24
|
+
# --head REF the PR's head commit (default HEAD)
|
|
25
|
+
# --head-branch NAME the PR's head branch name (default: the current branch
|
|
26
|
+
# when --head is HEAD, else REF without "origin/")
|
|
27
|
+
# --title TITLE PR title, checked for fix: / fix(scope):
|
|
28
|
+
# --labels LIST comma-separated PR labels, checked for type:bug
|
|
29
|
+
#
|
|
30
|
+
# Exit codes:
|
|
31
|
+
# 0 success (sync-check: ok or skipped)
|
|
32
|
+
# 1 usage error, or a git ref needed for the check is missing
|
|
33
|
+
# 2 RELEASING.md exists but its state block is malformed
|
|
34
|
+
# 3 sync-check refused the PR
|
|
35
|
+
#
|
|
36
|
+
# Rules and definitions:
|
|
37
|
+
# ${SCRIPT_DIR}/../../shared/references/pr-base-and-backport.md
|
|
38
|
+
# ${SCRIPT_DIR}/../../shared/references/branching-model.md#rules
|
|
39
|
+
|
|
40
|
+
set -euo pipefail
|
|
41
|
+
|
|
42
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
43
|
+
RELEASE_STATE_SH="${SCRIPT_DIR}/release-state.sh"
|
|
44
|
+
# shellcheck source=lib/release-state-lib.sh
|
|
45
|
+
source "${SCRIPT_DIR}/lib/release-state-lib.sh"
|
|
46
|
+
# shellcheck source=lib/forge.sh
|
|
47
|
+
source "${SCRIPT_DIR}/lib/forge.sh"
|
|
48
|
+
# shellcheck source=lib/backport-lib.sh
|
|
49
|
+
source "${SCRIPT_DIR}/lib/backport-lib.sh"
|
|
50
|
+
|
|
51
|
+
RULES_REF='_shared/references/branching-model.md#rules'
|
|
52
|
+
|
|
53
|
+
usage() {
|
|
54
|
+
sed -n '2,37p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//' >&2
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
_error() {
|
|
58
|
+
echo "pr-guard: $*" >&2
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
SUBCOMMAND=""
|
|
62
|
+
BASE=""
|
|
63
|
+
HEAD_REF="HEAD"
|
|
64
|
+
HEAD_BRANCH=""
|
|
65
|
+
TITLE=""
|
|
66
|
+
LABELS=""
|
|
67
|
+
|
|
68
|
+
need_value() {
|
|
69
|
+
[[ $# -ge 2 ]] || { _error "$1 requires a value"; exit 1; }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
while [[ $# -gt 0 ]]; do
|
|
73
|
+
case "$1" in
|
|
74
|
+
base | sync-check | backport-label)
|
|
75
|
+
[[ -n "$SUBCOMMAND" ]] && { _error "only one subcommand allowed"; exit 1; }
|
|
76
|
+
SUBCOMMAND="$1"
|
|
77
|
+
shift
|
|
78
|
+
;;
|
|
79
|
+
--base) need_value "$@"; BASE="$2"; shift 2 ;;
|
|
80
|
+
--head) need_value "$@"; HEAD_REF="$2"; shift 2 ;;
|
|
81
|
+
--head-branch) need_value "$@"; HEAD_BRANCH="$2"; shift 2 ;;
|
|
82
|
+
--title) need_value "$@"; TITLE="$2"; shift 2 ;;
|
|
83
|
+
--labels) need_value "$@"; LABELS="$2"; shift 2 ;;
|
|
84
|
+
-h | --help) usage; exit 0 ;;
|
|
85
|
+
*) _error "unknown argument: $1"; usage; exit 1 ;;
|
|
86
|
+
esac
|
|
87
|
+
done
|
|
88
|
+
|
|
89
|
+
if [[ -z "$SUBCOMMAND" ]]; then
|
|
90
|
+
_error "a subcommand is required"
|
|
91
|
+
usage
|
|
92
|
+
exit 1
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
|
96
|
+
_error "not inside a git repository"
|
|
97
|
+
exit 1
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# ---------------------------------------------------------------------------
|
|
101
|
+
# Release state
|
|
102
|
+
# ---------------------------------------------------------------------------
|
|
103
|
+
|
|
104
|
+
STATE_PRESENT=0
|
|
105
|
+
STATE_MODEL=""
|
|
106
|
+
STATE_TRUNK=""
|
|
107
|
+
STATE_MAINTENANCE=""
|
|
108
|
+
STATE_LATEST=""
|
|
109
|
+
STATE_LABEL_TEMPLATE=""
|
|
110
|
+
|
|
111
|
+
# kv_get <key=value lines> <key> — print the value for key.
|
|
112
|
+
kv_get() {
|
|
113
|
+
sed -n "s/^$2=//p" <<<"$1"
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
# load_state — read release-state.sh get; exit with its code on failure
|
|
117
|
+
# (2 = malformed block, message already names /release-model --audit).
|
|
118
|
+
load_state() {
|
|
119
|
+
local out rc=0
|
|
120
|
+
out="$(bash "$RELEASE_STATE_SH" get 2>&1)" || rc=$?
|
|
121
|
+
if [[ "$rc" -ne 0 ]]; then
|
|
122
|
+
printf '%s\n' "$out" >&2
|
|
123
|
+
exit "$rc"
|
|
124
|
+
fi
|
|
125
|
+
STATE_PRESENT="$(kv_get "$out" present)"
|
|
126
|
+
[[ "$STATE_PRESENT" == "1" ]] || return 0
|
|
127
|
+
STATE_MODEL="$(kv_get "$out" model)"
|
|
128
|
+
STATE_TRUNK="$(kv_get "$out" trunk)"
|
|
129
|
+
STATE_MAINTENANCE="$(kv_get "$out" maintenance)"
|
|
130
|
+
STATE_LATEST="$(kv_get "$out" latest_maintenance)"
|
|
131
|
+
STATE_LABEL_TEMPLATE="$(kv_get "$out" backport_label)"
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
ref_exists() {
|
|
135
|
+
git rev-parse --verify --quiet "$1^{commit}" >/dev/null 2>&1
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
# resolve_base — BASE from --base, the state, or the forge default branch.
|
|
139
|
+
resolve_base() {
|
|
140
|
+
[[ -n "$BASE" ]] && return 0
|
|
141
|
+
if [[ "$STATE_PRESENT" == "1" ]]; then
|
|
142
|
+
BASE="$(bash "$RELEASE_STATE_SH" base --head "$HEAD_REF")"
|
|
143
|
+
else
|
|
144
|
+
BASE="$(forge_default_branch "$(forge_detect_provider origin)")"
|
|
145
|
+
fi
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
# resolve_head_branch — HEAD_BRANCH from --head-branch or the head ref.
|
|
149
|
+
resolve_head_branch() {
|
|
150
|
+
[[ -n "$HEAD_BRANCH" ]] && return 0
|
|
151
|
+
if [[ "$HEAD_REF" == "HEAD" ]]; then
|
|
152
|
+
HEAD_BRANCH="$(git symbolic-ref --quiet --short HEAD 2>/dev/null || true)"
|
|
153
|
+
else
|
|
154
|
+
HEAD_BRANCH="${HEAD_REF#origin/}"
|
|
155
|
+
fi
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
# is_long_lived <branch> — the state trunk or any release/* branch.
|
|
159
|
+
is_long_lived() {
|
|
160
|
+
[[ "$1" == "$STATE_TRUNK" || "$1" == release/* ]]
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
# long_lived_tips — origin/<trunk> and every origin/release/* ref.
|
|
164
|
+
long_lived_tips() {
|
|
165
|
+
if ref_exists "origin/${STATE_TRUNK}"; then
|
|
166
|
+
echo "origin/${STATE_TRUNK}"
|
|
167
|
+
fi
|
|
168
|
+
git for-each-ref --format='%(refname:short)' 'refs/remotes/origin/release/*'
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
# ---------------------------------------------------------------------------
|
|
172
|
+
# Subcommands
|
|
173
|
+
# ---------------------------------------------------------------------------
|
|
174
|
+
|
|
175
|
+
cmd_base() {
|
|
176
|
+
resolve_base
|
|
177
|
+
echo "$BASE"
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
refuse() {
|
|
181
|
+
echo "result=refused"
|
|
182
|
+
echo "reason=$1"
|
|
183
|
+
echo "rule=${RULES_REF} (rule 3: never merge one long-lived branch into another)"
|
|
184
|
+
exit 3
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
cmd_sync_check() {
|
|
188
|
+
local merge second tip base_ref
|
|
189
|
+
if [[ "$STATE_PRESENT" != "1" ]]; then
|
|
190
|
+
echo "result=skipped"
|
|
191
|
+
echo "reason=no RELEASING.md"
|
|
192
|
+
return 0
|
|
193
|
+
fi
|
|
194
|
+
resolve_base
|
|
195
|
+
resolve_head_branch
|
|
196
|
+
|
|
197
|
+
if [[ -n "$HEAD_BRANCH" && "$HEAD_BRANCH" != "$BASE" ]] &&
|
|
198
|
+
is_long_lived "$HEAD_BRANCH" && is_long_lived "$BASE"; then
|
|
199
|
+
# Single quotes around /backport: generated bundles rewrite it to a
|
|
200
|
+
# $-prefixed name that bash would expand inside double quotes.
|
|
201
|
+
refuse "head '${HEAD_BRANCH}' and base '${BASE}' are both long-lived branches; move fixes by cherry-pick"' (/backport), not by a sync PR'
|
|
202
|
+
fi
|
|
203
|
+
|
|
204
|
+
base_ref="origin/${BASE}"
|
|
205
|
+
if ! ref_exists "$base_ref"; then
|
|
206
|
+
_error "${base_ref} not found; run 'git fetch origin ${BASE}' first"
|
|
207
|
+
exit 1
|
|
208
|
+
fi
|
|
209
|
+
if ! ref_exists "$HEAD_REF"; then
|
|
210
|
+
_error "head ref '${HEAD_REF}' not found"
|
|
211
|
+
exit 1
|
|
212
|
+
fi
|
|
213
|
+
|
|
214
|
+
while IFS= read -r merge; do
|
|
215
|
+
[[ -z "$merge" ]] && continue
|
|
216
|
+
second="$(git rev-parse "${merge}^2")"
|
|
217
|
+
git merge-base --is-ancestor "$second" "$base_ref" && continue
|
|
218
|
+
while IFS= read -r tip; do
|
|
219
|
+
[[ -z "$tip" || "$tip" == "$base_ref" ]] && continue
|
|
220
|
+
if git merge-base --is-ancestor "$second" "$tip"; then
|
|
221
|
+
refuse "merge commit $(git rev-parse --short "$merge") brings ${tip} into a PR for '${BASE}'; rebase onto ${base_ref} and cherry-pick instead"
|
|
222
|
+
fi
|
|
223
|
+
done < <(long_lived_tips)
|
|
224
|
+
done < <(git rev-list --merges "${base_ref}..${HEAD_REF}")
|
|
225
|
+
|
|
226
|
+
echo "result=ok"
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
# is_fix — the title, a commit subject in origin/<base>..HEAD, or a
|
|
230
|
+
# type:bug label marks the change as a fix.
|
|
231
|
+
is_fix() {
|
|
232
|
+
local label
|
|
233
|
+
[[ "$TITLE" =~ $BP_FIX_TITLE_RE ]] && return 0
|
|
234
|
+
while IFS= read -r label; do
|
|
235
|
+
[[ "$(rs_trim "$label")" == "type:bug" ]] && return 0
|
|
236
|
+
done < <(tr ',' '\n' <<<"$LABELS")
|
|
237
|
+
if ref_exists "origin/${BASE}" && ref_exists "$HEAD_REF"; then
|
|
238
|
+
git log --format=%s "origin/${BASE}..${HEAD_REF}" | grep -E "$BP_FIX_TITLE_RE" >/dev/null && return 0
|
|
239
|
+
fi
|
|
240
|
+
return 1
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
no_backport() {
|
|
244
|
+
echo "backport=0"
|
|
245
|
+
echo "reason=$1"
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
cmd_backport_label() {
|
|
249
|
+
if [[ "$STATE_PRESENT" != "1" ]]; then
|
|
250
|
+
no_backport "no RELEASING.md"
|
|
251
|
+
return 0
|
|
252
|
+
fi
|
|
253
|
+
if [[ "$STATE_MODEL" != "release-branches" ]]; then
|
|
254
|
+
no_backport "model is ${STATE_MODEL}"
|
|
255
|
+
return 0
|
|
256
|
+
fi
|
|
257
|
+
if [[ -z "$STATE_MAINTENANCE" ]]; then
|
|
258
|
+
no_backport "no maintenance branches"
|
|
259
|
+
return 0
|
|
260
|
+
fi
|
|
261
|
+
resolve_base
|
|
262
|
+
if [[ "$BASE" != "$STATE_TRUNK" ]]; then
|
|
263
|
+
no_backport "PR targets '${BASE}', not the trunk '${STATE_TRUNK}'"
|
|
264
|
+
return 0
|
|
265
|
+
fi
|
|
266
|
+
if ! is_fix; then
|
|
267
|
+
no_backport "not a fix"
|
|
268
|
+
return 0
|
|
269
|
+
fi
|
|
270
|
+
RS_BACKPORT_LABEL="$STATE_LABEL_TEMPLATE"
|
|
271
|
+
export RS_BACKPORT_LABEL
|
|
272
|
+
echo "backport=1"
|
|
273
|
+
echo "branch=${STATE_LATEST}"
|
|
274
|
+
echo "label=$(rs_label_for "$STATE_LATEST")"
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
load_state
|
|
278
|
+
|
|
279
|
+
case "$SUBCOMMAND" in
|
|
280
|
+
base) cmd_base ;;
|
|
281
|
+
sync-check) cmd_sync_check ;;
|
|
282
|
+
backport-label) cmd_backport_label ;;
|
|
283
|
+
esac
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# prepare-feature-branch.sh — ensure the current checkout is on the feature
|
|
3
|
+
# branch before dispatching implementor agents in --no-worktree mode.
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# prepare-feature-branch.sh <feature-slug> [--allow-existing-feature-branch]
|
|
7
|
+
# [--allow-release-branch]
|
|
8
|
+
#
|
|
9
|
+
# Behavior:
|
|
10
|
+
# - Rejects an unrelated dirty checkout (only plan-artifact paths allowed:
|
|
11
|
+
# docs/plans/<slug>/*, docs/orchestration/<slug>*,
|
|
12
|
+
# docs/prps/{plans,specs,prds}/<slug>*).
|
|
13
|
+
# - On feat/<slug>: idempotent no-op.
|
|
14
|
+
# - On trunk (main/master/trunk/develop, plus the RELEASING.md trunk) and
|
|
15
|
+
# feat/<slug> exists: switch to it.
|
|
16
|
+
# - On trunk and feat/<slug> missing: create it. With a RELEASING.md state
|
|
17
|
+
# block, fetch origin/<state-trunk> first and create the branch from it;
|
|
18
|
+
# if the fetch or that checkout fails, warn and create it from HEAD.
|
|
19
|
+
# - On release/* with a RELEASING.md state block: exit 2 (is this a
|
|
20
|
+
# release-only fix?) unless --allow-release-branch, which treats the
|
|
21
|
+
# release branch as the base: switch to an existing feat/<slug>, else
|
|
22
|
+
# create it from HEAD (no fetch).
|
|
23
|
+
# - On another non-trunk branch + --allow-existing-feature-branch: keep it.
|
|
24
|
+
# - On another non-trunk branch without the flag: exit 2 (caller asks user).
|
|
25
|
+
# - Without RELEASING.md, behavior is exactly as before the release model.
|
|
26
|
+
#
|
|
27
|
+
# Release state is read with the sibling release-state.sh; the model is
|
|
28
|
+
# described in _shared/references/branching-model.md.
|
|
29
|
+
#
|
|
30
|
+
# Mirrors setup-worktree.sh stdout/stderr discipline:
|
|
31
|
+
# - Branch name on stdout (one line).
|
|
32
|
+
# - All git output and status messages on stderr.
|
|
33
|
+
#
|
|
34
|
+
# Exit codes:
|
|
35
|
+
# 0 branch is prepared (name on stdout)
|
|
36
|
+
# 1 hard failure (dirty unrelated tree, git error, missing slug, malformed
|
|
37
|
+
# RELEASING.md state block, ...)
|
|
38
|
+
# 2 on a different non-trunk branch and --allow-existing-feature-branch not
|
|
39
|
+
# set, or on release/* and --allow-release-branch not set
|
|
40
|
+
|
|
41
|
+
set -euo pipefail
|
|
42
|
+
|
|
43
|
+
# ---------------------------------------------------------------------------
|
|
44
|
+
# Usage
|
|
45
|
+
# ---------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
usage() {
|
|
48
|
+
cat >&2 <<'EOF'
|
|
49
|
+
Usage:
|
|
50
|
+
prepare-feature-branch.sh <feature-slug> [--allow-existing-feature-branch]
|
|
51
|
+
[--allow-release-branch]
|
|
52
|
+
|
|
53
|
+
Arguments:
|
|
54
|
+
feature-slug Kebab-case feature identifier (e.g. "add-widget")
|
|
55
|
+
--allow-existing-feature-branch Reuse the current non-trunk branch
|
|
56
|
+
--allow-release-branch On release/* (RELEASING.md present), branch
|
|
57
|
+
feat/<slug> from it for a release-only fix
|
|
58
|
+
EOF
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
_error() {
|
|
62
|
+
echo "prepare-feature-branch.sh: error: $*" >&2
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_info() {
|
|
66
|
+
echo "prepare-feature-branch.sh: $*" >&2
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# ---------------------------------------------------------------------------
|
|
70
|
+
# Argument parsing
|
|
71
|
+
# ---------------------------------------------------------------------------
|
|
72
|
+
|
|
73
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
74
|
+
RELEASE_STATE_SH="${SCRIPT_DIR}/release-state.sh"
|
|
75
|
+
|
|
76
|
+
FEATURE_SLUG=""
|
|
77
|
+
ALLOW_EXISTING_FEATURE_BRANCH=false
|
|
78
|
+
ALLOW_RELEASE_BRANCH=false
|
|
79
|
+
|
|
80
|
+
set_feature_slug() {
|
|
81
|
+
if [[ -z "$FEATURE_SLUG" ]]; then
|
|
82
|
+
FEATURE_SLUG="$1"
|
|
83
|
+
else
|
|
84
|
+
_error "unexpected positional argument: $1"
|
|
85
|
+
usage
|
|
86
|
+
exit 1
|
|
87
|
+
fi
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
while [[ $# -gt 0 ]]; do
|
|
91
|
+
case "$1" in
|
|
92
|
+
--allow-existing-feature-branch)
|
|
93
|
+
ALLOW_EXISTING_FEATURE_BRANCH=true
|
|
94
|
+
shift
|
|
95
|
+
;;
|
|
96
|
+
--allow-release-branch)
|
|
97
|
+
ALLOW_RELEASE_BRANCH=true
|
|
98
|
+
shift
|
|
99
|
+
;;
|
|
100
|
+
-h|--help)
|
|
101
|
+
usage
|
|
102
|
+
exit 0
|
|
103
|
+
;;
|
|
104
|
+
--)
|
|
105
|
+
shift
|
|
106
|
+
while [[ $# -gt 0 ]]; do
|
|
107
|
+
set_feature_slug "$1"
|
|
108
|
+
shift
|
|
109
|
+
done
|
|
110
|
+
break
|
|
111
|
+
;;
|
|
112
|
+
-*)
|
|
113
|
+
_error "unknown flag: $1"
|
|
114
|
+
usage
|
|
115
|
+
exit 1
|
|
116
|
+
;;
|
|
117
|
+
*)
|
|
118
|
+
set_feature_slug "$1"
|
|
119
|
+
shift
|
|
120
|
+
;;
|
|
121
|
+
esac
|
|
122
|
+
done
|
|
123
|
+
|
|
124
|
+
if [[ -z "$FEATURE_SLUG" ]]; then
|
|
125
|
+
_error "feature-slug is required"
|
|
126
|
+
usage
|
|
127
|
+
exit 1
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
if [[ ! "$FEATURE_SLUG" =~ ^[a-z0-9][a-z0-9-]*$ ]]; then
|
|
131
|
+
_error "feature-slug must be kebab-case matching [a-z0-9][a-z0-9-]*"
|
|
132
|
+
usage
|
|
133
|
+
exit 1
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
# ---------------------------------------------------------------------------
|
|
137
|
+
# Git context
|
|
138
|
+
# ---------------------------------------------------------------------------
|
|
139
|
+
|
|
140
|
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
|
141
|
+
_error "not inside a git repository"
|
|
142
|
+
exit 1
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
CURRENT_BRANCH="$(git branch --show-current)"
|
|
146
|
+
if [[ -z "$CURRENT_BRANCH" ]]; then
|
|
147
|
+
_error "detached HEAD is not supported; check out a branch first"
|
|
148
|
+
exit 1
|
|
149
|
+
fi
|
|
150
|
+
|
|
151
|
+
FEATURE_BRANCH="feat/${FEATURE_SLUG}"
|
|
152
|
+
|
|
153
|
+
if [[ "$CURRENT_BRANCH" == "$FEATURE_BRANCH" ]]; then
|
|
154
|
+
_info "already on ${FEATURE_BRANCH}"
|
|
155
|
+
echo "$FEATURE_BRANCH"
|
|
156
|
+
exit 0
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
# ---------------------------------------------------------------------------
|
|
160
|
+
# Dirty-tree guard
|
|
161
|
+
# ---------------------------------------------------------------------------
|
|
162
|
+
#
|
|
163
|
+
# Allow plan-artifact paths; reject anything else.
|
|
164
|
+
|
|
165
|
+
is_plan_artifact() {
|
|
166
|
+
local path="$1"
|
|
167
|
+
case "$path" in
|
|
168
|
+
docs/plans/"${FEATURE_SLUG}"/*) return 0 ;;
|
|
169
|
+
docs/orchestration/"${FEATURE_SLUG}"*) return 0 ;;
|
|
170
|
+
docs/prps/plans/"${FEATURE_SLUG}"*) return 0 ;;
|
|
171
|
+
docs/prps/specs/"${FEATURE_SLUG}"*) return 0 ;;
|
|
172
|
+
docs/prps/prds/"${FEATURE_SLUG}"*) return 0 ;;
|
|
173
|
+
*) return 1 ;;
|
|
174
|
+
esac
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
UNRELATED_DIRTY=()
|
|
178
|
+
collect_dirty() {
|
|
179
|
+
# Untracked files (file-level — avoids `?? dir/` collapsed entries from
|
|
180
|
+
# `git status --porcelain` and `--untracked-files=all`'s memory cost).
|
|
181
|
+
git ls-files --others --exclude-standard
|
|
182
|
+
# Modified-but-unstaged tracked files.
|
|
183
|
+
git diff --name-only
|
|
184
|
+
# Staged tracked files (added/modified/renamed/deleted).
|
|
185
|
+
git diff --name-only --cached
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
while IFS= read -r path; do
|
|
189
|
+
[[ -z "$path" ]] && continue
|
|
190
|
+
if ! is_plan_artifact "$path"; then
|
|
191
|
+
UNRELATED_DIRTY+=("$path")
|
|
192
|
+
fi
|
|
193
|
+
done < <(collect_dirty | sort -u)
|
|
194
|
+
|
|
195
|
+
if (( ${#UNRELATED_DIRTY[@]} > 0 )); then
|
|
196
|
+
_error "working tree has unrelated changes; stash or commit them first:"
|
|
197
|
+
printf ' %s\n' "${UNRELATED_DIRTY[@]}" >&2
|
|
198
|
+
exit 1
|
|
199
|
+
fi
|
|
200
|
+
|
|
201
|
+
# ---------------------------------------------------------------------------
|
|
202
|
+
# Branch state machine
|
|
203
|
+
# ---------------------------------------------------------------------------
|
|
204
|
+
|
|
205
|
+
branch_exists() {
|
|
206
|
+
git show-ref --verify --quiet "refs/heads/$1"
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
remote_branch_exists() {
|
|
210
|
+
git show-ref --verify --quiet "refs/remotes/origin/$1"
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
# ---------------------------------------------------------------------------
|
|
214
|
+
# Release state (RELEASING.md)
|
|
215
|
+
# ---------------------------------------------------------------------------
|
|
216
|
+
#
|
|
217
|
+
# STATE_TRUNK stays empty when the repo has no RELEASING.md, which keeps every
|
|
218
|
+
# branch below on its pre-release-model path.
|
|
219
|
+
|
|
220
|
+
STATE_TRUNK=""
|
|
221
|
+
|
|
222
|
+
load_release_state() {
|
|
223
|
+
local out rc=0
|
|
224
|
+
if [[ ! -f "$RELEASE_STATE_SH" ]]; then
|
|
225
|
+
_error "missing helper: ${RELEASE_STATE_SH}"
|
|
226
|
+
exit 1
|
|
227
|
+
fi
|
|
228
|
+
out="$(bash "$RELEASE_STATE_SH" get 2>&1)" || rc=$?
|
|
229
|
+
if [[ "$rc" -ne 0 ]]; then
|
|
230
|
+
_error "could not read the RELEASING.md state block:"
|
|
231
|
+
printf ' %s\n' "$out" >&2
|
|
232
|
+
exit 1
|
|
233
|
+
fi
|
|
234
|
+
if [[ "$(sed -n 's/^present=//p' <<<"$out")" == "1" ]]; then
|
|
235
|
+
STATE_TRUNK="$(sed -n 's/^trunk=//p' <<<"$out")"
|
|
236
|
+
fi
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
load_release_state
|
|
240
|
+
|
|
241
|
+
is_trunk_branch() {
|
|
242
|
+
if [[ -n "$STATE_TRUNK" && "$1" == "$STATE_TRUNK" ]]; then
|
|
243
|
+
return 0
|
|
244
|
+
fi
|
|
245
|
+
case "$1" in
|
|
246
|
+
main|master|trunk|develop) return 0 ;;
|
|
247
|
+
*) return 1 ;;
|
|
248
|
+
esac
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
is_release_branch() {
|
|
252
|
+
[[ -n "$STATE_TRUNK" && "$1" == release/* ]]
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
# create_feature_branch — create FEATURE_BRANCH. With release state, start
|
|
256
|
+
# from a freshly fetched origin/<state-trunk>; on any failure fall back to
|
|
257
|
+
# HEAD (the pre-release-model behavior) with a warning.
|
|
258
|
+
create_feature_branch() {
|
|
259
|
+
local start="origin/${STATE_TRUNK}" out
|
|
260
|
+
if [[ -z "$STATE_TRUNK" ]]; then
|
|
261
|
+
_info "creating ${FEATURE_BRANCH} from ${CURRENT_BRANCH}"
|
|
262
|
+
git checkout -b "$FEATURE_BRANCH" >&2
|
|
263
|
+
return 0
|
|
264
|
+
fi
|
|
265
|
+
if ! out="$(git fetch --quiet origin "+refs/heads/${STATE_TRUNK}:refs/remotes/${start}" 2>&1)"; then
|
|
266
|
+
_info "warning: could not fetch ${STATE_TRUNK} from origin; creating ${FEATURE_BRANCH} from ${CURRENT_BRANCH} instead"
|
|
267
|
+
[[ -n "$out" ]] && printf ' %s\n' "$out" >&2
|
|
268
|
+
git checkout -b "$FEATURE_BRANCH" >&2
|
|
269
|
+
return 0
|
|
270
|
+
fi
|
|
271
|
+
if out="$(git checkout --no-track -b "$FEATURE_BRANCH" "$start" 2>&1)"; then
|
|
272
|
+
[[ -n "$out" ]] && printf '%s\n' "$out" >&2
|
|
273
|
+
_info "created ${FEATURE_BRANCH} from ${start} (RELEASING.md trunk)"
|
|
274
|
+
return 0
|
|
275
|
+
fi
|
|
276
|
+
_info "warning: could not create ${FEATURE_BRANCH} from ${start} with the current working tree; creating it from ${CURRENT_BRANCH} instead"
|
|
277
|
+
printf ' %s\n' "$out" >&2
|
|
278
|
+
git checkout -b "$FEATURE_BRANCH" >&2
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if is_trunk_branch "$CURRENT_BRANCH"; then
|
|
282
|
+
if branch_exists "$FEATURE_BRANCH"; then
|
|
283
|
+
_info "switching from ${CURRENT_BRANCH} to existing ${FEATURE_BRANCH}"
|
|
284
|
+
git checkout "$FEATURE_BRANCH" >&2
|
|
285
|
+
if ! git merge-base --is-ancestor "$CURRENT_BRANCH" "$FEATURE_BRANCH"; then
|
|
286
|
+
_info "warning: ${FEATURE_BRANCH} is not based on current ${CURRENT_BRANCH}; consider rebasing before dispatch"
|
|
287
|
+
fi
|
|
288
|
+
elif remote_branch_exists "$FEATURE_BRANCH"; then
|
|
289
|
+
_info "switching from ${CURRENT_BRANCH} to existing origin/${FEATURE_BRANCH}"
|
|
290
|
+
git checkout --track "origin/${FEATURE_BRANCH}" >&2
|
|
291
|
+
else
|
|
292
|
+
create_feature_branch
|
|
293
|
+
fi
|
|
294
|
+
echo "$FEATURE_BRANCH"
|
|
295
|
+
exit 0
|
|
296
|
+
fi
|
|
297
|
+
|
|
298
|
+
# A maintenance branch under the release model: work normally lands on the
|
|
299
|
+
# trunk first and is backported, so ask before branching from here.
|
|
300
|
+
if is_release_branch "$CURRENT_BRANCH"; then
|
|
301
|
+
if [[ "$ALLOW_RELEASE_BRANCH" != true ]]; then
|
|
302
|
+
_error "on maintenance branch '${CURRENT_BRANCH}'; fixes normally land on '${STATE_TRUNK}' first and are backported"
|
|
303
|
+
_error "if this is a release-only fix, re-run with --allow-release-branch; otherwise check out '${STATE_TRUNK}' first"
|
|
304
|
+
exit 2
|
|
305
|
+
fi
|
|
306
|
+
if branch_exists "$FEATURE_BRANCH"; then
|
|
307
|
+
_info "switching from ${CURRENT_BRANCH} to existing ${FEATURE_BRANCH} (--allow-release-branch)"
|
|
308
|
+
git checkout "$FEATURE_BRANCH" >&2
|
|
309
|
+
else
|
|
310
|
+
_info "creating ${FEATURE_BRANCH} from ${CURRENT_BRANCH} (--allow-release-branch)"
|
|
311
|
+
git checkout -b "$FEATURE_BRANCH" >&2
|
|
312
|
+
fi
|
|
313
|
+
echo "$FEATURE_BRANCH"
|
|
314
|
+
exit 0
|
|
315
|
+
fi
|
|
316
|
+
|
|
317
|
+
# Some other branch — already a non-trunk branch, not feat/<slug>.
|
|
318
|
+
if [[ "$ALLOW_EXISTING_FEATURE_BRANCH" == true ]]; then
|
|
319
|
+
_info "using current branch ${CURRENT_BRANCH} (--allow-existing-feature-branch)"
|
|
320
|
+
echo "$CURRENT_BRANCH"
|
|
321
|
+
exit 0
|
|
322
|
+
fi
|
|
323
|
+
|
|
324
|
+
_error "on branch '${CURRENT_BRANCH}', expected '${FEATURE_BRANCH}' or a trunk branch"
|
|
325
|
+
_error "pass --allow-existing-feature-branch to reuse the current branch, or check out a trunk branch first"
|
|
326
|
+
exit 2
|