@yandy-r/ycc-opencode 0.0.0-stage → 6.1.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 +39 -0
- package/LICENSE +21 -0
- package/README.md +50 -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 +476 -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 +577 -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 +174 -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 +626 -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 +558 -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 +609 -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 +523 -0
- package/package.json +36 -4
- package/registration.json +7259 -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 +455 -0
- package/shared/references/forge-detection.md +162 -0
- package/shared/references/goal-pairing.md +55 -0
- package/shared/references/pr-base-and-backport.md +143 -0
- package/shared/references/question-policy.md +99 -0
- package/shared/references/review-artifact-format.md +141 -0
- package/shared/references/review-checklist.md +161 -0
- package/shared/references/review-dispatch.md +73 -0
- package/shared/references/session-state.md +159 -0
- package/shared/references/standalone-dispatch.md +300 -0
- package/shared/references/target-capability-matrix.md +516 -0
- package/shared/references/visual-mode.md +155 -0
- package/shared/references/worktree-strategy.md +326 -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 +91 -0
- package/skills/backport/SKILL.md +293 -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 +412 -0
- package/skills/blueprint/references/bootstrap-mapping.md +87 -0
- package/skills/bundle-author/SKILL.md +121 -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 +192 -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 +156 -0
- package/skills/bundle-release/scripts/bump-version.sh +99 -0
- package/skills/bundle-release/scripts/draft-notes.sh +222 -0
- package/skills/bundle-release/scripts/preflight.sh +165 -0
- package/skills/bundle-release/scripts/release_versions.py +375 -0
- package/skills/clean/SKILL.md +109 -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 +377 -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 +155 -0
- package/skills/code-review/references/pr-procedure.md +311 -0
- package/skills/compatibility-audit/SKILL.md +229 -0
- package/skills/compatibility-audit/references/reading-the-report.md +162 -0
- package/skills/compatibility-audit/scripts/audit-install-assumptions.sh +431 -0
- package/skills/compatibility-audit/scripts/audit-target-features.sh +596 -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 +294 -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 +209 -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 +300 -0
- package/skills/git-cleanup/references/active-code-rules.md +323 -0
- package/skills/git-cleanup/references/host-detection.md +217 -0
- package/skills/git-workflow/SKILL.md +132 -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 +223 -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 +274 -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 +121 -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 +136 -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 +409 -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 +309 -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 +179 -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/validate-prp-plan.sh +368 -0
- package/skills/prp-pr/SKILL.md +404 -0
- package/skills/prp-prd/SKILL.md +444 -0
- package/skills/prp-spec/SKILL.md +276 -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 +306 -0
- package/skills/release-model/SKILL.md +233 -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 +253 -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 +287 -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 +154 -0
- package/skills/review-fix/SKILL.md +231 -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 +161 -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
- package/ycc-sensitive-guard/index.js +621 -0
- package/ycc-sensitive-guard/package.json +7 -0
- package/ycc-sensitive-guard/policy.json +40 -0
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# create-pr.sh
|
|
5
|
+
# Analyzes git repository and helps create pull requests
|
|
6
|
+
# Usage: create-pr.sh [--analyze | --create [--draft]] [--base BRANCH]
|
|
7
|
+
#
|
|
8
|
+
# The PR base is --base when given, else the RELEASING.md base
|
|
9
|
+
# (release-state.sh base), else the forge default branch. With RELEASING.md,
|
|
10
|
+
# the sync-merge guard runs first and refuses a sync PR. Both come from
|
|
11
|
+
# _shared/scripts/pr-guard.sh; see _shared/references/pr-base-and-backport.md.
|
|
12
|
+
|
|
13
|
+
# Color codes for output
|
|
14
|
+
readonly RED='\033[0;31m'
|
|
15
|
+
readonly GREEN='\033[0;32m'
|
|
16
|
+
readonly YELLOW='\033[1;33m'
|
|
17
|
+
readonly BLUE='\033[0;34m'
|
|
18
|
+
readonly NC='\033[0m' # No Color
|
|
19
|
+
|
|
20
|
+
# Parse arguments
|
|
21
|
+
MODE="analyze"
|
|
22
|
+
DRAFT=false
|
|
23
|
+
BASE_ARG=""
|
|
24
|
+
|
|
25
|
+
while [[ $# -gt 0 ]]; do
|
|
26
|
+
case $1 in
|
|
27
|
+
--analyze)
|
|
28
|
+
MODE="analyze"
|
|
29
|
+
shift
|
|
30
|
+
;;
|
|
31
|
+
--create)
|
|
32
|
+
MODE="create"
|
|
33
|
+
shift
|
|
34
|
+
;;
|
|
35
|
+
--draft)
|
|
36
|
+
DRAFT=true
|
|
37
|
+
shift
|
|
38
|
+
;;
|
|
39
|
+
--base)
|
|
40
|
+
if [[ $# -lt 2 || -z "$2" ]]; then
|
|
41
|
+
echo -e "${RED}--base requires a branch name${NC}" >&2
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
BASE_ARG="$2"
|
|
45
|
+
shift 2
|
|
46
|
+
;;
|
|
47
|
+
*)
|
|
48
|
+
echo -e "${RED}Unknown option: $1${NC}" >&2
|
|
49
|
+
echo "Usage: $0 [--analyze | --create [--draft]] [--base BRANCH]" >&2
|
|
50
|
+
exit 1
|
|
51
|
+
;;
|
|
52
|
+
esac
|
|
53
|
+
done
|
|
54
|
+
|
|
55
|
+
# Check if we're in a git repository
|
|
56
|
+
if ! git rev-parse --git-dir > /dev/null 2>&1; then
|
|
57
|
+
echo -e "${RED}Error: Not in a git repository${NC}" >&2
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# Detect the forge provider and select the matching CLI (gh / tea / glab).
|
|
62
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
63
|
+
FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
|
|
64
|
+
[[ -f "$FORGE_LIB" ]] || FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
|
|
65
|
+
# shellcheck source=/dev/null
|
|
66
|
+
source "$FORGE_LIB"
|
|
67
|
+
PR_GUARD="${SCRIPT_DIR}/../../../shared/scripts/pr-guard.sh"
|
|
68
|
+
[[ -f "$PR_GUARD" ]] || PR_GUARD="${SCRIPT_DIR}/../../../shared/scripts/pr-guard.sh"
|
|
69
|
+
|
|
70
|
+
PROVIDER="$(forge_detect_provider origin)"
|
|
71
|
+
FORGE_CLI="$(forge_cli "$PROVIDER")"
|
|
72
|
+
|
|
73
|
+
case "$PROVIDER" in
|
|
74
|
+
github|forgejo|gitea) ;; # supported for PR creation
|
|
75
|
+
gitlab)
|
|
76
|
+
echo -e "${RED}Error: GitLab PR creation is not yet supported by this script${NC}" >&2
|
|
77
|
+
echo "Create the merge request with: glab mr create" >&2
|
|
78
|
+
exit 1
|
|
79
|
+
;;
|
|
80
|
+
*)
|
|
81
|
+
echo -e "${RED}Error: Could not determine the forge provider for 'origin'${NC}" >&2
|
|
82
|
+
echo "origin = $(forge_remote_url origin)" >&2
|
|
83
|
+
echo "Supported: GitHub (gh), Forgejo/Gitea (tea)." >&2
|
|
84
|
+
exit 1
|
|
85
|
+
;;
|
|
86
|
+
esac
|
|
87
|
+
|
|
88
|
+
# Check the matching CLI is installed
|
|
89
|
+
if ! command -v "$FORGE_CLI" &> /dev/null; then
|
|
90
|
+
echo -e "${RED}Error: ${FORGE_CLI} CLI (for ${PROVIDER}) is not installed${NC}" >&2
|
|
91
|
+
echo "" >&2
|
|
92
|
+
case "$PROVIDER" in
|
|
93
|
+
github) echo "Install gh: https://github.com/cli/cli#installation" >&2 ;;
|
|
94
|
+
*) echo "Install tea: https://gitea.com/gitea/tea#installation" >&2 ;;
|
|
95
|
+
esac
|
|
96
|
+
exit 1
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
# Check authentication for the detected provider
|
|
100
|
+
if ! forge_auth_ok "$PROVIDER"; then
|
|
101
|
+
echo -e "${RED}Error: Not authenticated with ${FORGE_CLI} (${PROVIDER})${NC}" >&2
|
|
102
|
+
echo "" >&2
|
|
103
|
+
case "$PROVIDER" in
|
|
104
|
+
github) echo "Authenticate with: gh auth login" >&2 ;;
|
|
105
|
+
*) echo "Authenticate with: tea login add" >&2 ;;
|
|
106
|
+
esac
|
|
107
|
+
exit 1
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
echo -e "${BLUE}Forge provider:${NC} ${PROVIDER} (using ${FORGE_CLI})" >&2
|
|
111
|
+
|
|
112
|
+
# Get current branch
|
|
113
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
114
|
+
|
|
115
|
+
if [ "$CURRENT_BRANCH" = "HEAD" ]; then
|
|
116
|
+
echo -e "${RED}Error: Not on a branch (detached HEAD)${NC}" >&2
|
|
117
|
+
exit 1
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
# Resolve the PR base: --base, else RELEASING.md, else the forge default branch.
|
|
121
|
+
if [[ -n "$BASE_ARG" ]]; then
|
|
122
|
+
BASE_CMD=(bash "$PR_GUARD" base --base "$BASE_ARG")
|
|
123
|
+
else
|
|
124
|
+
BASE_CMD=(bash "$PR_GUARD" base)
|
|
125
|
+
fi
|
|
126
|
+
if ! BASE_BRANCH=$("${BASE_CMD[@]}"); then
|
|
127
|
+
echo -e "${RED}Error: could not resolve the PR base (see the RELEASING.md error above)${NC}" >&2
|
|
128
|
+
echo 'Fix the state block with /release-model --audit, or pass --base BRANCH.' >&2
|
|
129
|
+
exit 1
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# Check if branch exists on remote
|
|
133
|
+
if ! git ls-remote --exit-code --heads origin "$CURRENT_BRANCH" &> /dev/null; then
|
|
134
|
+
echo -e "${YELLOW}⚠ Branch not pushed to remote${NC}" >&2
|
|
135
|
+
echo "Push with: git push -u origin $CURRENT_BRANCH" >&2
|
|
136
|
+
exit 1
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
echo -e "${BLUE}=== Pull Request Analysis ===${NC}\n"
|
|
140
|
+
|
|
141
|
+
# Display branch information
|
|
142
|
+
echo -e "${GREEN}Branch Information:${NC}"
|
|
143
|
+
echo " Current branch: $CURRENT_BRANCH"
|
|
144
|
+
echo " Base branch: $BASE_BRANCH"
|
|
145
|
+
echo ""
|
|
146
|
+
|
|
147
|
+
# Sync-merge guard (skipped without RELEASING.md).
|
|
148
|
+
set +e
|
|
149
|
+
GUARD_OUT=$(bash "$PR_GUARD" sync-check --base "$BASE_BRANCH" 2>&1)
|
|
150
|
+
GUARD_RC=$?
|
|
151
|
+
set -e
|
|
152
|
+
if [ "$GUARD_RC" -eq 3 ]; then
|
|
153
|
+
echo -e "${RED}Error: refusing to open this PR into ${BASE_BRANCH} (sync merge)${NC}" >&2
|
|
154
|
+
printf '%s\n' "$GUARD_OUT" | sed 's/^/ /' >&2
|
|
155
|
+
exit 1
|
|
156
|
+
elif [ "$GUARD_RC" -ne 0 ]; then
|
|
157
|
+
echo -e "${RED}Error: the sync-merge guard could not run${NC}" >&2
|
|
158
|
+
printf '%s\n' "$GUARD_OUT" | sed 's/^/ /' >&2
|
|
159
|
+
exit 1
|
|
160
|
+
fi
|
|
161
|
+
|
|
162
|
+
# Get commits since divergence from base
|
|
163
|
+
MERGE_BASE=$(git merge-base HEAD "origin/$BASE_BRANCH" 2>/dev/null || echo "")
|
|
164
|
+
|
|
165
|
+
if [ -z "$MERGE_BASE" ]; then
|
|
166
|
+
echo -e "${RED}Error: Cannot find common ancestor with $BASE_BRANCH${NC}" >&2
|
|
167
|
+
exit 1
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
# Count commits
|
|
171
|
+
COMMIT_COUNT=$(git rev-list --count "$MERGE_BASE..HEAD")
|
|
172
|
+
|
|
173
|
+
echo -e "${GREEN}Commits in this Branch:${NC}"
|
|
174
|
+
echo " Total commits: $COMMIT_COUNT"
|
|
175
|
+
echo ""
|
|
176
|
+
|
|
177
|
+
if [ "$COMMIT_COUNT" -eq 0 ]; then
|
|
178
|
+
echo -e "${YELLOW}No new commits on this branch${NC}"
|
|
179
|
+
echo "Nothing to create PR for."
|
|
180
|
+
exit 0
|
|
181
|
+
fi
|
|
182
|
+
|
|
183
|
+
# Display commit history
|
|
184
|
+
echo -e "${GREEN}Commit History:${NC}"
|
|
185
|
+
git log --oneline --no-merges "$MERGE_BASE..HEAD" | while IFS= read -r line; do
|
|
186
|
+
echo " - $line"
|
|
187
|
+
done
|
|
188
|
+
echo ""
|
|
189
|
+
|
|
190
|
+
# Analyze changed files
|
|
191
|
+
CHANGED_FILES=$(git diff --name-only "$MERGE_BASE..HEAD" | wc -l | tr -d ' ')
|
|
192
|
+
# grep -c exits 1 on zero matches; `|| true` keeps pipefail from aborting.
|
|
193
|
+
SOURCE_FILES=$(git diff --name-only "$MERGE_BASE..HEAD" | grep -cvE '(test|spec|__tests__|\.test\.|\.spec\.|\.md$|^docs/)' || true)
|
|
194
|
+
TEST_FILES=$(git diff --name-only "$MERGE_BASE..HEAD" | grep -cE '(test|spec|__tests__|\.test\.|\.spec\.)' || true)
|
|
195
|
+
DOC_FILES=$(git diff --name-only "$MERGE_BASE..HEAD" | grep -cE '(\.md$|^docs/)' || true)
|
|
196
|
+
|
|
197
|
+
echo -e "${GREEN}Files Changed:${NC}"
|
|
198
|
+
echo " Total files: $CHANGED_FILES"
|
|
199
|
+
echo " Source files: $SOURCE_FILES"
|
|
200
|
+
echo " Test files: $TEST_FILES"
|
|
201
|
+
echo " Doc files: $DOC_FILES"
|
|
202
|
+
echo ""
|
|
203
|
+
|
|
204
|
+
# Get change statistics
|
|
205
|
+
STATS=$(git diff --stat "$MERGE_BASE..HEAD" | tail -n1)
|
|
206
|
+
echo -e "${GREEN}Change Statistics:${NC}"
|
|
207
|
+
echo " $STATS"
|
|
208
|
+
echo ""
|
|
209
|
+
|
|
210
|
+
# Suggest PR title based on commits
|
|
211
|
+
echo -e "${GREEN}Suggested PR Title:${NC}"
|
|
212
|
+
|
|
213
|
+
if [ "$COMMIT_COUNT" -eq 1 ]; then
|
|
214
|
+
# Single commit - use commit message
|
|
215
|
+
SUGGESTED_TITLE=$(git log --format=%s -n1 HEAD)
|
|
216
|
+
echo " $SUGGESTED_TITLE"
|
|
217
|
+
echo " (from single commit)"
|
|
218
|
+
else
|
|
219
|
+
# Multiple commits - analyze for common theme
|
|
220
|
+
# Try to extract type and scope from first commit
|
|
221
|
+
FIRST_COMMIT=$(git log --format=%s -n1 HEAD)
|
|
222
|
+
|
|
223
|
+
if echo "$FIRST_COMMIT" | grep -qE '^[a-z]+(\([a-z0-9-]+\))?:'; then
|
|
224
|
+
TYPE=$(echo "$FIRST_COMMIT" | grep -oE '^[a-z]+')
|
|
225
|
+
SCOPE=$(echo "$FIRST_COMMIT" | grep -oE '\([a-z0-9-]+\)' | tr -d '()' || echo "")
|
|
226
|
+
|
|
227
|
+
if [ -n "$SCOPE" ]; then
|
|
228
|
+
SUGGESTED_TITLE="${TYPE}(${SCOPE}): [describe overall changes]"
|
|
229
|
+
echo " $SUGGESTED_TITLE"
|
|
230
|
+
else
|
|
231
|
+
SUGGESTED_TITLE="${TYPE}: [describe overall changes]"
|
|
232
|
+
echo " $SUGGESTED_TITLE"
|
|
233
|
+
fi
|
|
234
|
+
echo " (based on commit pattern)"
|
|
235
|
+
else
|
|
236
|
+
# No conventional commit pattern detected
|
|
237
|
+
SUGGESTED_TITLE=""
|
|
238
|
+
echo " [type](scope): [describe changes]"
|
|
239
|
+
echo " (no clear pattern detected)"
|
|
240
|
+
fi
|
|
241
|
+
fi
|
|
242
|
+
echo ""
|
|
243
|
+
|
|
244
|
+
# Check for documentation
|
|
245
|
+
echo -e "${GREEN}Documentation Status:${NC}"
|
|
246
|
+
if [ "$DOC_FILES" -gt 0 ]; then
|
|
247
|
+
echo " ✓ Documentation changes detected ($DOC_FILES files)"
|
|
248
|
+
git diff --name-only "$MERGE_BASE..HEAD" | grep -E '(\.md$|^docs/)' | while IFS= read -r file; do
|
|
249
|
+
echo " - $file"
|
|
250
|
+
done
|
|
251
|
+
else
|
|
252
|
+
echo " ⚠ No documentation files changed"
|
|
253
|
+
if [ "$SOURCE_FILES" -ge 3 ]; then
|
|
254
|
+
echo " Consider if documentation is needed for these changes"
|
|
255
|
+
fi
|
|
256
|
+
fi
|
|
257
|
+
echo ""
|
|
258
|
+
|
|
259
|
+
# Check for breaking changes in commits
|
|
260
|
+
echo -e "${GREEN}Breaking Changes:${NC}"
|
|
261
|
+
if git log --format=%B "$MERGE_BASE..HEAD" | grep -qE 'BREAKING CHANGE:|^[a-z]+(\([a-z0-9-]+\))?!:'; then
|
|
262
|
+
echo " ⚠ Breaking changes detected in commits"
|
|
263
|
+
{ git log --format=%s "$MERGE_BASE..HEAD" | grep -E '^[a-z]+(\([a-z0-9-]+\))?!:' || true; } | while IFS= read -r line; do
|
|
264
|
+
echo " - $line"
|
|
265
|
+
done
|
|
266
|
+
{ git log --format=%B "$MERGE_BASE..HEAD" | grep -A2 'BREAKING CHANGE:' || true; } | while IFS= read -r line; do
|
|
267
|
+
if [ -n "$line" ]; then echo " $line"; fi
|
|
268
|
+
done
|
|
269
|
+
else
|
|
270
|
+
echo " ✓ No breaking changes detected"
|
|
271
|
+
fi
|
|
272
|
+
echo ""
|
|
273
|
+
|
|
274
|
+
# Recommend PR type
|
|
275
|
+
echo -e "${YELLOW}Recommended PR Type:${NC}"
|
|
276
|
+
if [ "$TEST_FILES" -eq 0 ] || [ "$SOURCE_FILES" -ge 10 ]; then
|
|
277
|
+
echo " Draft PR (use --draft flag)"
|
|
278
|
+
echo " Reasoning:"
|
|
279
|
+
[ "$TEST_FILES" -eq 0 ] && echo " - No test files changed (tests may be incomplete)"
|
|
280
|
+
[ "$SOURCE_FILES" -ge 10 ] && echo " - Large change ($SOURCE_FILES source files)"
|
|
281
|
+
else
|
|
282
|
+
echo " Regular PR (ready for review)"
|
|
283
|
+
echo " Reasoning:"
|
|
284
|
+
echo " - Tests included ($TEST_FILES test files)"
|
|
285
|
+
echo " - Reasonable size ($SOURCE_FILES source files)"
|
|
286
|
+
fi
|
|
287
|
+
echo ""
|
|
288
|
+
|
|
289
|
+
# If analyze mode, stop here
|
|
290
|
+
if [ "$MODE" = "analyze" ]; then
|
|
291
|
+
echo -e "${BLUE}=== Analysis Complete ===${NC}\n"
|
|
292
|
+
echo "To create PR:"
|
|
293
|
+
if [ "$PROVIDER" = "github" ]; then
|
|
294
|
+
echo " Regular: gh pr create --base $BASE_BRANCH --web"
|
|
295
|
+
echo " Draft: gh pr create --base $BASE_BRANCH --draft --web"
|
|
296
|
+
else
|
|
297
|
+
echo " Regular: tea pull create --head $CURRENT_BRANCH --base $BASE_BRANCH"
|
|
298
|
+
echo " (Forgejo/Gitea: 'tea' has no --draft or --web; open the PR in the web UI to mark it draft)"
|
|
299
|
+
fi
|
|
300
|
+
exit 0
|
|
301
|
+
fi
|
|
302
|
+
|
|
303
|
+
# Create PR mode
|
|
304
|
+
echo -e "${BLUE}=== Creating Pull Request ===${NC}\n"
|
|
305
|
+
|
|
306
|
+
# Check if PR already exists
|
|
307
|
+
if [ "$PROVIDER" = "github" ]; then
|
|
308
|
+
EXISTING_PR=$(gh pr list --head "$CURRENT_BRANCH" --json number --jq '.[0].number' 2>/dev/null || echo "")
|
|
309
|
+
else
|
|
310
|
+
# tea pull list — match the head branch column; best-effort across tea versions
|
|
311
|
+
EXISTING_PR=$(tea pull list --output simple 2>/dev/null | grep -F "$CURRENT_BRANCH" | grep -oE '^#?[0-9]+' | head -n1 | tr -d '#' || echo "")
|
|
312
|
+
fi
|
|
313
|
+
|
|
314
|
+
if [ -n "$EXISTING_PR" ]; then
|
|
315
|
+
echo -e "${YELLOW}⚠ PR already exists for this branch: #$EXISTING_PR${NC}"
|
|
316
|
+
echo ""
|
|
317
|
+
if [ "$PROVIDER" = "github" ]; then
|
|
318
|
+
echo "View PR: gh pr view $EXISTING_PR"
|
|
319
|
+
echo "Edit PR: gh pr edit $EXISTING_PR"
|
|
320
|
+
else
|
|
321
|
+
echo "View PR: tea pull $EXISTING_PR"
|
|
322
|
+
fi
|
|
323
|
+
exit 1
|
|
324
|
+
fi
|
|
325
|
+
|
|
326
|
+
# Generate PR description template
|
|
327
|
+
# Set PR_TITLE with fallback if SUGGESTED_TITLE is empty
|
|
328
|
+
if [ -n "$SUGGESTED_TITLE" ]; then
|
|
329
|
+
PR_TITLE="$SUGGESTED_TITLE"
|
|
330
|
+
else
|
|
331
|
+
# Fall back to most recent commit subject
|
|
332
|
+
PR_TITLE=$(git log -1 --pretty=%s)
|
|
333
|
+
echo -e "${YELLOW}⚠ Using most recent commit message as PR title${NC}"
|
|
334
|
+
echo " Title: $PR_TITLE"
|
|
335
|
+
echo ""
|
|
336
|
+
fi
|
|
337
|
+
|
|
338
|
+
# Create description based on commits
|
|
339
|
+
PR_DESCRIPTION="## Summary
|
|
340
|
+
|
|
341
|
+
[Describe what this PR does and why]
|
|
342
|
+
|
|
343
|
+
## Changes
|
|
344
|
+
|
|
345
|
+
"
|
|
346
|
+
|
|
347
|
+
# Add commits to changes section
|
|
348
|
+
while IFS= read -r line; do
|
|
349
|
+
PR_DESCRIPTION="${PR_DESCRIPTION}${line}\n"
|
|
350
|
+
done < <(git log --format="- %s" --no-merges "$MERGE_BASE..HEAD")
|
|
351
|
+
|
|
352
|
+
PR_DESCRIPTION="${PR_DESCRIPTION}
|
|
353
|
+
## Documentation
|
|
354
|
+
|
|
355
|
+
"
|
|
356
|
+
|
|
357
|
+
if [ "$DOC_FILES" -gt 0 ]; then
|
|
358
|
+
PR_DESCRIPTION="${PR_DESCRIPTION}### Updated
|
|
359
|
+
"
|
|
360
|
+
while IFS= read -r file; do
|
|
361
|
+
PR_DESCRIPTION="${PR_DESCRIPTION}- ${file}\n"
|
|
362
|
+
done < <(git diff --name-only "$MERGE_BASE..HEAD" | grep -E '(\.md$|^docs/)')
|
|
363
|
+
else
|
|
364
|
+
PR_DESCRIPTION="${PR_DESCRIPTION}- No documentation changes
|
|
365
|
+
"
|
|
366
|
+
fi
|
|
367
|
+
|
|
368
|
+
PR_DESCRIPTION="${PR_DESCRIPTION}
|
|
369
|
+
## Testing
|
|
370
|
+
|
|
371
|
+
### How to test:
|
|
372
|
+
1. [Step one]
|
|
373
|
+
2. [Step two]
|
|
374
|
+
3. [Expected result]
|
|
375
|
+
|
|
376
|
+
## Related Issues
|
|
377
|
+
|
|
378
|
+
Closes #
|
|
379
|
+
|
|
380
|
+
## Breaking Changes
|
|
381
|
+
|
|
382
|
+
- No breaking changes
|
|
383
|
+
|
|
384
|
+
## Checklist
|
|
385
|
+
|
|
386
|
+
- [ ] Code follows project style guidelines
|
|
387
|
+
- [ ] Self-review completed
|
|
388
|
+
- [ ] Tests added/updated
|
|
389
|
+
- [ ] Documentation updated
|
|
390
|
+
- [ ] All tests passing
|
|
391
|
+
"
|
|
392
|
+
|
|
393
|
+
# Create the PR
|
|
394
|
+
echo "Creating PR..."
|
|
395
|
+
echo ""
|
|
396
|
+
|
|
397
|
+
if [ "$PROVIDER" = "github" ]; then
|
|
398
|
+
if [ "$DRAFT" = true ]; then
|
|
399
|
+
set +e
|
|
400
|
+
gh pr create \
|
|
401
|
+
--title "$PR_TITLE" \
|
|
402
|
+
--body "$PR_DESCRIPTION" \
|
|
403
|
+
--base "$BASE_BRANCH" \
|
|
404
|
+
--draft \
|
|
405
|
+
--web
|
|
406
|
+
rc=$?
|
|
407
|
+
set -e
|
|
408
|
+
|
|
409
|
+
if [ $rc -eq 0 ]; then
|
|
410
|
+
echo ""
|
|
411
|
+
echo -e "${GREEN}✓ Draft PR created successfully${NC}"
|
|
412
|
+
echo ""
|
|
413
|
+
echo "Mark ready when complete: gh pr ready"
|
|
414
|
+
else
|
|
415
|
+
echo ""
|
|
416
|
+
echo -e "${RED}✗ Failed to create PR${NC}"
|
|
417
|
+
exit 1
|
|
418
|
+
fi
|
|
419
|
+
else
|
|
420
|
+
set +e
|
|
421
|
+
gh pr create \
|
|
422
|
+
--title "$PR_TITLE" \
|
|
423
|
+
--body "$PR_DESCRIPTION" \
|
|
424
|
+
--base "$BASE_BRANCH" \
|
|
425
|
+
--web
|
|
426
|
+
rc=$?
|
|
427
|
+
set -e
|
|
428
|
+
|
|
429
|
+
if [ $rc -eq 0 ]; then
|
|
430
|
+
echo ""
|
|
431
|
+
echo -e "${GREEN}✓ PR created successfully${NC}"
|
|
432
|
+
else
|
|
433
|
+
echo ""
|
|
434
|
+
echo -e "${RED}✗ Failed to create PR${NC}"
|
|
435
|
+
exit 1
|
|
436
|
+
fi
|
|
437
|
+
fi
|
|
438
|
+
else
|
|
439
|
+
# Forgejo / Gitea via tea. No --draft or --web support; create directly.
|
|
440
|
+
if [ "$DRAFT" = true ]; then
|
|
441
|
+
echo -e "${YELLOW}⚠ 'tea' does not support draft PRs; creating a normal PR.${NC}" >&2
|
|
442
|
+
echo " Mark it draft in the ${PROVIDER} web UI if needed." >&2
|
|
443
|
+
echo ""
|
|
444
|
+
fi
|
|
445
|
+
set +e
|
|
446
|
+
tea pull create \
|
|
447
|
+
--title "$PR_TITLE" \
|
|
448
|
+
--description "$PR_DESCRIPTION" \
|
|
449
|
+
--head "$CURRENT_BRANCH" \
|
|
450
|
+
--base "$BASE_BRANCH"
|
|
451
|
+
rc=$?
|
|
452
|
+
set -e
|
|
453
|
+
|
|
454
|
+
if [ $rc -eq 0 ]; then
|
|
455
|
+
echo ""
|
|
456
|
+
echo -e "${GREEN}✓ PR created successfully${NC}"
|
|
457
|
+
else
|
|
458
|
+
echo ""
|
|
459
|
+
echo -e "${RED}✗ Failed to create PR${NC}"
|
|
460
|
+
exit 1
|
|
461
|
+
fi
|
|
462
|
+
fi
|
|
463
|
+
|
|
464
|
+
exit 0
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# validate-commit.sh
|
|
5
|
+
# Validates commit messages against conventional commit format
|
|
6
|
+
# Usage: validate-commit.sh "<commit-message>"
|
|
7
|
+
|
|
8
|
+
# Color codes for output
|
|
9
|
+
readonly RED='\033[0;31m'
|
|
10
|
+
readonly GREEN='\033[0;32m'
|
|
11
|
+
readonly YELLOW='\033[1;33m'
|
|
12
|
+
readonly NC='\033[0m' # No Color
|
|
13
|
+
|
|
14
|
+
# Valid commit types
|
|
15
|
+
readonly VALID_TYPES=(
|
|
16
|
+
"feat"
|
|
17
|
+
"fix"
|
|
18
|
+
"docs"
|
|
19
|
+
"style"
|
|
20
|
+
"refactor"
|
|
21
|
+
"test"
|
|
22
|
+
"chore"
|
|
23
|
+
"perf"
|
|
24
|
+
"ci"
|
|
25
|
+
"build"
|
|
26
|
+
"revert"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Check if commit message is provided
|
|
30
|
+
if [ $# -eq 0 ]; then
|
|
31
|
+
echo -e "${RED}Error: No commit message provided${NC}" >&2
|
|
32
|
+
echo "Usage: $0 \"<commit-message>\"" >&2
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
COMMIT_MSG="$1"
|
|
37
|
+
|
|
38
|
+
# Track validation errors
|
|
39
|
+
ERRORS=0
|
|
40
|
+
WARNINGS=0
|
|
41
|
+
|
|
42
|
+
echo -e "${GREEN}=== Commit Message Validation ===${NC}\n"
|
|
43
|
+
echo "Validating: $COMMIT_MSG"
|
|
44
|
+
echo ""
|
|
45
|
+
|
|
46
|
+
# Extract the subject line (first line)
|
|
47
|
+
SUBJECT=$(echo "$COMMIT_MSG" | head -n1)
|
|
48
|
+
|
|
49
|
+
# Check if message is empty
|
|
50
|
+
if [ -z "$SUBJECT" ]; then
|
|
51
|
+
echo -e "${RED}✗ Error: Commit message is empty${NC}"
|
|
52
|
+
ERRORS=$((ERRORS + 1))
|
|
53
|
+
exit 1
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
# Validate format: <type>(<scope>): <subject> or <type>: <subject>
|
|
57
|
+
if ! echo "$SUBJECT" | grep -qE '^[a-z]+(\([a-z0-9-]+\))?!?: .+'; then
|
|
58
|
+
echo -e "${RED}✗ Error: Subject line doesn't match conventional commit format${NC}"
|
|
59
|
+
echo " Expected: <type>(<scope>): <subject> or <type>: <subject>"
|
|
60
|
+
echo " Got: $SUBJECT"
|
|
61
|
+
ERRORS=$((ERRORS + 1))
|
|
62
|
+
else
|
|
63
|
+
echo -e "${GREEN}✓ Format matches conventional commits${NC}"
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
# Extract type from subject
|
|
67
|
+
TYPE=$(echo "$SUBJECT" | grep -oE '^[a-z]+' || echo "")
|
|
68
|
+
|
|
69
|
+
if [ -n "$TYPE" ]; then
|
|
70
|
+
# Validate type
|
|
71
|
+
VALID_TYPE=false
|
|
72
|
+
for valid in "${VALID_TYPES[@]}"; do
|
|
73
|
+
if [ "$TYPE" = "$valid" ]; then
|
|
74
|
+
VALID_TYPE=true
|
|
75
|
+
break
|
|
76
|
+
fi
|
|
77
|
+
done
|
|
78
|
+
|
|
79
|
+
if [ "$VALID_TYPE" = true ]; then
|
|
80
|
+
echo -e "${GREEN}✓ Type '$TYPE' is valid${NC}"
|
|
81
|
+
else
|
|
82
|
+
echo -e "${RED}✗ Error: Invalid type '$TYPE'${NC}"
|
|
83
|
+
echo " Valid types: ${VALID_TYPES[*]}"
|
|
84
|
+
ERRORS=$((ERRORS + 1))
|
|
85
|
+
fi
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
# Extract scope (if present)
|
|
89
|
+
if echo "$SUBJECT" | grep -qE '\([a-z0-9-]+\)'; then
|
|
90
|
+
SCOPE=$(echo "$SUBJECT" | grep -oE '\([a-z0-9-]+\)' | tr -d '()')
|
|
91
|
+
echo -e "${GREEN}✓ Scope '$SCOPE' is present${NC}"
|
|
92
|
+
|
|
93
|
+
# Check scope format (lowercase, alphanumeric + hyphens)
|
|
94
|
+
if ! echo "$SCOPE" | grep -qE '^[a-z0-9-]+$'; then
|
|
95
|
+
echo -e "${YELLOW}⚠ Warning: Scope should be lowercase alphanumeric with hyphens${NC}"
|
|
96
|
+
WARNINGS=$((WARNINGS + 1))
|
|
97
|
+
fi
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# Check for breaking change indicator (!)
|
|
101
|
+
if echo "$SUBJECT" | grep -qE '!:'; then
|
|
102
|
+
echo -e "${YELLOW}⚠ Breaking change indicator detected (!)${NC}"
|
|
103
|
+
|
|
104
|
+
# Check if BREAKING CHANGE footer is present in full message
|
|
105
|
+
if ! echo "$COMMIT_MSG" | grep -qE 'BREAKING CHANGE:'; then
|
|
106
|
+
echo -e "${YELLOW}⚠ Warning: Breaking change indicator used but no BREAKING CHANGE footer found${NC}"
|
|
107
|
+
echo " Consider adding: BREAKING CHANGE: <description>"
|
|
108
|
+
WARNINGS=$((WARNINGS + 1))
|
|
109
|
+
fi
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# Extract subject (after colon)
|
|
113
|
+
SUBJECT_TEXT=$(echo "$SUBJECT" | sed 's/^[a-z]*(\?[a-z0-9-]*)\?!*: //')
|
|
114
|
+
|
|
115
|
+
if [ -n "$SUBJECT_TEXT" ]; then
|
|
116
|
+
# Check subject length (should be ≤50 chars ideally, ≤72 max)
|
|
117
|
+
SUBJECT_LEN=${#SUBJECT_TEXT}
|
|
118
|
+
|
|
119
|
+
if [ "$SUBJECT_LEN" -le 50 ]; then
|
|
120
|
+
echo -e "${GREEN}✓ Subject length is good ($SUBJECT_LEN chars)${NC}"
|
|
121
|
+
elif [ "$SUBJECT_LEN" -le 72 ]; then
|
|
122
|
+
echo -e "${YELLOW}⚠ Warning: Subject is acceptable but long ($SUBJECT_LEN chars, prefer ≤50)${NC}"
|
|
123
|
+
WARNINGS=$((WARNINGS + 1))
|
|
124
|
+
else
|
|
125
|
+
echo -e "${RED}✗ Error: Subject is too long ($SUBJECT_LEN chars, max 72)${NC}"
|
|
126
|
+
ERRORS=$((ERRORS + 1))
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
# Check if subject starts with uppercase (should be lowercase)
|
|
130
|
+
FIRST_CHAR=$(echo "$SUBJECT_TEXT" | cut -c1)
|
|
131
|
+
if echo "$FIRST_CHAR" | grep -qE '[A-Z]'; then
|
|
132
|
+
# Portable lowercase conversion using bash parameter expansion
|
|
133
|
+
REST="${SUBJECT_TEXT:1}"
|
|
134
|
+
LOWERCASE_FIRST="${FIRST_CHAR,,}"
|
|
135
|
+
PREFERRED="${LOWERCASE_FIRST}${REST}"
|
|
136
|
+
|
|
137
|
+
echo -e "${YELLOW}⚠ Warning: Subject should start with lowercase letter${NC}"
|
|
138
|
+
echo " Got: '$SUBJECT_TEXT'"
|
|
139
|
+
echo " Prefer: '$PREFERRED'"
|
|
140
|
+
WARNINGS=$((WARNINGS + 1))
|
|
141
|
+
else
|
|
142
|
+
echo -e "${GREEN}✓ Subject starts with lowercase${NC}"
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
# Check if subject ends with period (should not)
|
|
146
|
+
if echo "$SUBJECT_TEXT" | grep -qE '\.$'; then
|
|
147
|
+
echo -e "${YELLOW}⚠ Warning: Subject should not end with a period${NC}"
|
|
148
|
+
WARNINGS=$((WARNINGS + 1))
|
|
149
|
+
else
|
|
150
|
+
echo -e "${GREEN}✓ Subject doesn't end with period${NC}"
|
|
151
|
+
fi
|
|
152
|
+
|
|
153
|
+
# Check if imperative mood (basic heuristic - starts with verb)
|
|
154
|
+
FIRST_WORD=$(echo "$SUBJECT_TEXT" | awk '{print $1}')
|
|
155
|
+
|
|
156
|
+
# Common non-imperative patterns
|
|
157
|
+
if echo "$FIRST_WORD" | grep -qE '(added|fixed|updated|changed|removed|deleted)$'; then
|
|
158
|
+
echo -e "${YELLOW}⚠ Warning: Use imperative mood (add, fix, update, not added, fixed, updated)${NC}"
|
|
159
|
+
echo " Got: '$FIRST_WORD'"
|
|
160
|
+
echo " Prefer: '$(echo "$FIRST_WORD" | sed 's/ed$//' | sed 's/d$//')'"
|
|
161
|
+
WARNINGS=$((WARNINGS + 1))
|
|
162
|
+
else
|
|
163
|
+
echo -e "${GREEN}✓ Subject appears to use imperative mood${NC}"
|
|
164
|
+
fi
|
|
165
|
+
fi
|
|
166
|
+
|
|
167
|
+
# Check for body (optional but recommended for complex changes)
|
|
168
|
+
BODY_LINES=$(echo "$COMMIT_MSG" | tail -n +3 | grep -c '[[:alnum:]]' || echo "0")
|
|
169
|
+
|
|
170
|
+
if [ "$BODY_LINES" -gt 0 ]; then
|
|
171
|
+
echo -e "${GREEN}✓ Body is present ($BODY_LINES lines)${NC}"
|
|
172
|
+
|
|
173
|
+
# Check body line length (should wrap at 72 chars)
|
|
174
|
+
LONG_LINES=0
|
|
175
|
+
while IFS= read -r line; do
|
|
176
|
+
if [ ${#line} -gt 72 ] && [ -n "$line" ]; then
|
|
177
|
+
LONG_LINES=$((LONG_LINES + 1))
|
|
178
|
+
fi
|
|
179
|
+
done <<< "$(echo "$COMMIT_MSG" | tail -n +3)"
|
|
180
|
+
|
|
181
|
+
if [ "$LONG_LINES" -gt 0 ]; then
|
|
182
|
+
echo -e "${YELLOW}⚠ Warning: $LONG_LINES line(s) in body exceed 72 characters${NC}"
|
|
183
|
+
echo " Consider wrapping body text at 72 chars"
|
|
184
|
+
WARNINGS=$((WARNINGS + 1))
|
|
185
|
+
fi
|
|
186
|
+
fi
|
|
187
|
+
|
|
188
|
+
# Check for BREAKING CHANGE footer
|
|
189
|
+
if echo "$COMMIT_MSG" | grep -qE 'BREAKING CHANGE:'; then
|
|
190
|
+
echo -e "${YELLOW}⚠ Breaking change footer detected${NC}"
|
|
191
|
+
|
|
192
|
+
# Verify format
|
|
193
|
+
if echo "$COMMIT_MSG" | grep -qE '^BREAKING CHANGE: .+'; then
|
|
194
|
+
echo -e "${GREEN}✓ BREAKING CHANGE footer is properly formatted${NC}"
|
|
195
|
+
else
|
|
196
|
+
echo -e "${RED}✗ Error: BREAKING CHANGE footer format incorrect${NC}"
|
|
197
|
+
echo " Expected: BREAKING CHANGE: <description>"
|
|
198
|
+
ERRORS=$((ERRORS + 1))
|
|
199
|
+
fi
|
|
200
|
+
fi
|
|
201
|
+
|
|
202
|
+
# Check for issue references
|
|
203
|
+
if echo "$COMMIT_MSG" | grep -qE '(Fixes|Closes|Resolves|Related to) #[0-9]+'; then
|
|
204
|
+
echo -e "${GREEN}✓ Issue reference found${NC}"
|
|
205
|
+
fi
|
|
206
|
+
|
|
207
|
+
# Summary
|
|
208
|
+
echo ""
|
|
209
|
+
echo -e "${GREEN}=== Validation Summary ===${NC}\n"
|
|
210
|
+
|
|
211
|
+
if [ "$ERRORS" -eq 0 ] && [ "$WARNINGS" -eq 0 ]; then
|
|
212
|
+
echo -e "${GREEN}✓ Commit message is valid!${NC}"
|
|
213
|
+
echo ""
|
|
214
|
+
exit 0
|
|
215
|
+
elif [ "$ERRORS" -eq 0 ]; then
|
|
216
|
+
echo -e "${YELLOW}⚠ Commit message is acceptable with $WARNINGS warning(s)${NC}"
|
|
217
|
+
echo ""
|
|
218
|
+
echo "Consider addressing the warnings for better commit quality."
|
|
219
|
+
exit 0
|
|
220
|
+
else
|
|
221
|
+
echo -e "${RED}✗ Commit message has $ERRORS error(s) and $WARNINGS warning(s)${NC}"
|
|
222
|
+
echo ""
|
|
223
|
+
echo "Please fix the errors before committing."
|
|
224
|
+
echo ""
|
|
225
|
+
echo "Quick reference:"
|
|
226
|
+
echo " Format: <type>(<scope>): <subject>"
|
|
227
|
+
echo " Types: feat, fix, docs, style, refactor, test, chore, perf, ci, build, revert"
|
|
228
|
+
echo " Subject: Imperative mood, lowercase, no period, ≤50 chars"
|
|
229
|
+
echo ""
|
|
230
|
+
echo "Examples:"
|
|
231
|
+
echo " feat(auth): add JWT authentication"
|
|
232
|
+
echo " fix(api): prevent null pointer in validation"
|
|
233
|
+
echo " docs: update installation guide"
|
|
234
|
+
exit 1
|
|
235
|
+
fi
|