@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,453 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# profile-project.sh
|
|
3
|
+
# Detect project characteristics and emit key=value pairs on stdout.
|
|
4
|
+
#
|
|
5
|
+
# Usage: profile-project.sh [path]
|
|
6
|
+
# path Optional directory to profile (defaults to $PWD).
|
|
7
|
+
#
|
|
8
|
+
# Output: one key=value per line, machine-readable, no shell quoting.
|
|
9
|
+
# Python detection needs Python 3.11+ (tomllib); shell entrypoint is Bash 3.2-compatible.
|
|
10
|
+
# Requires python3 3.11+ for every stack. Errors stay visible on stderr.
|
|
11
|
+
# Exit codes: 0 = success, 1 = argument error (bad/missing path).
|
|
12
|
+
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
|
|
15
|
+
# ---------------------------------------------------------------------------
|
|
16
|
+
# Python 3.11+ guard: runs before any profiling so an unsupported interpreter
|
|
17
|
+
# aborts with a readable message and no partial key=value output.
|
|
18
|
+
# ---------------------------------------------------------------------------
|
|
19
|
+
_pp_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
20
|
+
_SHARED_SEG="/_shared/scripts"; _SHARED_SEG_FLAT="/shared/scripts"; _SHARED_SEG_AGENTS="/ycc-shared/scripts"
|
|
21
|
+
_pp_shared=""
|
|
22
|
+
for _pp_cand in "${_pp_script_dir}/../..${_SHARED_SEG}" \
|
|
23
|
+
"${_pp_script_dir}/../../..${_SHARED_SEG_FLAT}" \
|
|
24
|
+
"${_pp_script_dir}/../../..${_SHARED_SEG_AGENTS}"; do
|
|
25
|
+
if [[ -f "${_pp_cand}/require-python.sh" ]]; then
|
|
26
|
+
_pp_shared="$_pp_cand"
|
|
27
|
+
break
|
|
28
|
+
fi
|
|
29
|
+
done
|
|
30
|
+
if [[ -z "$_pp_shared" ]]; then
|
|
31
|
+
echo "[profile-project] ERROR: shared require-python.sh not found (broken ycc install)" >&2
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
# shellcheck source=/dev/null
|
|
35
|
+
. "${_pp_shared}/require-python.sh"
|
|
36
|
+
|
|
37
|
+
# ---------------------------------------------------------------------------
|
|
38
|
+
# Argument handling
|
|
39
|
+
# ---------------------------------------------------------------------------
|
|
40
|
+
if [[ $# -gt 1 ]]; then
|
|
41
|
+
echo "[profile-project] ERROR: too many arguments. Usage: profile-project.sh [path]" >&2
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
target="${1:-$PWD}"
|
|
46
|
+
|
|
47
|
+
if [[ ! -d "$target" ]]; then
|
|
48
|
+
echo "[profile-project] ERROR: directory not found: ${target}" >&2
|
|
49
|
+
exit 1
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Resolve to absolute path without relying on realpath (POSIX-friendly)
|
|
53
|
+
project_root="$(cd "$target" && pwd)"
|
|
54
|
+
if [[ "$project_root" == *$'\n'* || "$project_root" == *$'\r'* ]]; then
|
|
55
|
+
echo "[profile-project] ERROR: newline in repository path cannot be represented in key=value output" >&2
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# ---------------------------------------------------------------------------
|
|
60
|
+
# Helpers
|
|
61
|
+
# ---------------------------------------------------------------------------
|
|
62
|
+
file_exists() { [[ -f "${project_root}/${1}" ]]; }
|
|
63
|
+
dir_exists() { [[ -d "${project_root}/${1}" ]]; }
|
|
64
|
+
|
|
65
|
+
# Check for glob match at project root (non-recursive, one level)
|
|
66
|
+
glob_exists_root() {
|
|
67
|
+
local pattern="$1"
|
|
68
|
+
local match
|
|
69
|
+
match=$(find "$project_root" -maxdepth 1 -name "$pattern" -type f 2>/dev/null | head -n 1)
|
|
70
|
+
[[ -n "$match" ]]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# ---------------------------------------------------------------------------
|
|
74
|
+
# is_empty detection
|
|
75
|
+
# ---------------------------------------------------------------------------
|
|
76
|
+
# True iff no tracked source files AND no lockfile/manifest is present.
|
|
77
|
+
# We check non-dotfile entries and then git tracked file count.
|
|
78
|
+
is_empty=false
|
|
79
|
+
|
|
80
|
+
# Count non-dot entries at the root
|
|
81
|
+
non_dot_count=$(find "$project_root" -maxdepth 1 -not -name ".*" -not -path "$project_root" 2>/dev/null | wc -l | tr -d ' ')
|
|
82
|
+
|
|
83
|
+
if [[ "$non_dot_count" -eq 0 ]]; then
|
|
84
|
+
is_empty=true
|
|
85
|
+
else
|
|
86
|
+
# If git is present, check tracked file count; otherwise fall through.
|
|
87
|
+
if dir_exists ".git" || git -C "$project_root" rev-parse --git-dir >/dev/null 2>&1; then
|
|
88
|
+
tracked=$(git -C "$project_root" ls-files 2>/dev/null | wc -l | tr -d ' ')
|
|
89
|
+
# No tracked files AND no manifest means empty
|
|
90
|
+
has_manifest=false
|
|
91
|
+
for m in Cargo.toml go.mod package.json pyproject.toml requirements.txt; do
|
|
92
|
+
file_exists "$m" && { has_manifest=true; break; }
|
|
93
|
+
done
|
|
94
|
+
glob_exists_root "*.tf" && has_manifest=true
|
|
95
|
+
if [[ "$tracked" -eq 0 && "$has_manifest" == "false" ]]; then
|
|
96
|
+
is_empty=true
|
|
97
|
+
fi
|
|
98
|
+
fi
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# ---------------------------------------------------------------------------
|
|
102
|
+
# has_git
|
|
103
|
+
# ---------------------------------------------------------------------------
|
|
104
|
+
has_git=false
|
|
105
|
+
if dir_exists ".git" || git -C "$project_root" rev-parse --git-dir >/dev/null 2>&1; then
|
|
106
|
+
has_git=true
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
# ---------------------------------------------------------------------------
|
|
110
|
+
# Language + package manager detection
|
|
111
|
+
# ---------------------------------------------------------------------------
|
|
112
|
+
primary_language=unknown
|
|
113
|
+
secondary_languages=none
|
|
114
|
+
package_manager=unknown
|
|
115
|
+
test_cmd=unknown
|
|
116
|
+
lint_cmd=unknown
|
|
117
|
+
build_cmd=unknown
|
|
118
|
+
|
|
119
|
+
# Track multiple detected stacks for mixed-language handling
|
|
120
|
+
detected_langs=()
|
|
121
|
+
detected_pms=()
|
|
122
|
+
|
|
123
|
+
# --- Rust ---
|
|
124
|
+
if file_exists "Cargo.toml"; then
|
|
125
|
+
detected_langs+=(rust)
|
|
126
|
+
detected_pms+=(cargo)
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
# --- Go ---
|
|
130
|
+
if file_exists "go.mod"; then
|
|
131
|
+
detected_langs+=(go)
|
|
132
|
+
detected_pms+=(go)
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
# --- Node / TypeScript / JavaScript ---
|
|
136
|
+
if file_exists "package.json"; then
|
|
137
|
+
# Determine package manager from lockfile priority
|
|
138
|
+
node_pm=npm
|
|
139
|
+
if file_exists "pnpm-lock.yaml"; then
|
|
140
|
+
node_pm=pnpm
|
|
141
|
+
elif file_exists "bun.lock" || file_exists "bun.lockb"; then
|
|
142
|
+
node_pm=bun
|
|
143
|
+
elif file_exists "yarn.lock"; then
|
|
144
|
+
node_pm=yarn
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
if file_exists "tsconfig.json"; then
|
|
148
|
+
detected_langs+=(typescript)
|
|
149
|
+
else
|
|
150
|
+
detected_langs+=(javascript)
|
|
151
|
+
fi
|
|
152
|
+
detected_pms+=("$node_pm")
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
# --- Python (pyproject.toml) ---
|
|
156
|
+
if file_exists "pyproject.toml"; then
|
|
157
|
+
detected_langs+=(python)
|
|
158
|
+
py_pm=pip
|
|
159
|
+
if file_exists "uv.lock"; then
|
|
160
|
+
py_pm=uv
|
|
161
|
+
elif file_exists "poetry.lock"; then
|
|
162
|
+
py_pm=poetry
|
|
163
|
+
elif grep -q '\[tool\.hatch\]' "${project_root}/pyproject.toml" 2>/dev/null; then
|
|
164
|
+
py_pm=hatch
|
|
165
|
+
fi
|
|
166
|
+
detected_pms+=("$py_pm")
|
|
167
|
+
elif file_exists "requirements.txt"; then
|
|
168
|
+
# Only if pyproject.toml is absent
|
|
169
|
+
detected_langs+=(python)
|
|
170
|
+
detected_pms+=(pip)
|
|
171
|
+
fi
|
|
172
|
+
|
|
173
|
+
# --- Terraform ---
|
|
174
|
+
if glob_exists_root "*.tf"; then
|
|
175
|
+
detected_langs+=(terraform)
|
|
176
|
+
detected_pms+=(terraform)
|
|
177
|
+
fi
|
|
178
|
+
|
|
179
|
+
# ---------------------------------------------------------------------------
|
|
180
|
+
# Resolve primary vs secondary
|
|
181
|
+
# ---------------------------------------------------------------------------
|
|
182
|
+
lang_count="${#detected_langs[@]}"
|
|
183
|
+
|
|
184
|
+
if [[ "$lang_count" -eq 0 ]]; then
|
|
185
|
+
primary_language=unknown
|
|
186
|
+
secondary_languages=none
|
|
187
|
+
package_manager=unknown
|
|
188
|
+
elif [[ "$lang_count" -eq 1 ]]; then
|
|
189
|
+
primary_language="${detected_langs[0]}"
|
|
190
|
+
secondary_languages=none
|
|
191
|
+
package_manager="${detected_pms[0]}"
|
|
192
|
+
else
|
|
193
|
+
primary_language=mixed
|
|
194
|
+
# First detected becomes primary stack reference; list all in secondary
|
|
195
|
+
package_manager="${detected_pms[0]}"
|
|
196
|
+
secondary_languages=$(IFS=,; echo "${detected_langs[*]}")
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
# ---------------------------------------------------------------------------
|
|
200
|
+
# Resolve test / lint / build commands based on primary stack
|
|
201
|
+
# (for mixed, use the first detected stack)
|
|
202
|
+
# ---------------------------------------------------------------------------
|
|
203
|
+
primary_stack="${detected_langs[0]:-unknown}"
|
|
204
|
+
primary_pm="${detected_pms[0]:-unknown}"
|
|
205
|
+
|
|
206
|
+
# Helper: resolve node pm commands
|
|
207
|
+
node_pm_cmd() {
|
|
208
|
+
local pm="$1"
|
|
209
|
+
local subcmd="$2"
|
|
210
|
+
case "$pm" in
|
|
211
|
+
pnpm) echo "pnpm $subcmd" ;;
|
|
212
|
+
bun) echo "bun $subcmd" ;;
|
|
213
|
+
yarn) echo "yarn $subcmd" ;;
|
|
214
|
+
*) echo "npm $subcmd" ;;
|
|
215
|
+
esac
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
case "$primary_stack" in
|
|
219
|
+
rust)
|
|
220
|
+
test_cmd="cargo test"
|
|
221
|
+
lint_cmd="cargo clippy --all-targets"
|
|
222
|
+
build_cmd="cargo build"
|
|
223
|
+
;;
|
|
224
|
+
go)
|
|
225
|
+
test_cmd="go test ./..."
|
|
226
|
+
lint_cmd="go vet ./..."
|
|
227
|
+
for cfg in .golangci.yml .golangci.yaml .golangci.toml .golangci.json; do
|
|
228
|
+
file_exists "$cfg" && { lint_cmd="golangci-lint run"; break; }
|
|
229
|
+
done
|
|
230
|
+
build_cmd="go build ./..."
|
|
231
|
+
;;
|
|
232
|
+
typescript|javascript)
|
|
233
|
+
# Only stamp commands backed by actual package.json scripts (read-only check).
|
|
234
|
+
if ! command -v jq >/dev/null 2>&1; then
|
|
235
|
+
echo "[profile-project] WARN: jq is unavailable; JS/TS commands cannot be detected" >&2
|
|
236
|
+
fi
|
|
237
|
+
if jq -e '.scripts.test | type == "string" and length > 0' "${project_root}/package.json" >/dev/null 2>&1; then
|
|
238
|
+
test_cmd="$(node_pm_cmd "$primary_pm" "test")"
|
|
239
|
+
fi
|
|
240
|
+
if jq -e '.scripts | (has("lint") or has("lint:check"))' "${project_root}/package.json" >/dev/null 2>&1; then
|
|
241
|
+
for key in lint lint:check; do
|
|
242
|
+
if jq -e --arg k "$key" '.scripts[$k] | type == "string" and length > 0' "${project_root}/package.json" >/dev/null 2>&1; then
|
|
243
|
+
lint_cmd="$(node_pm_cmd "$primary_pm" "run $key")"
|
|
244
|
+
break
|
|
245
|
+
fi
|
|
246
|
+
done
|
|
247
|
+
fi
|
|
248
|
+
if jq -e '.scripts.build | type == "string" and length > 0' "${project_root}/package.json" >/dev/null 2>&1; then
|
|
249
|
+
build_cmd="$(node_pm_cmd "$primary_pm" "run build")"
|
|
250
|
+
fi
|
|
251
|
+
;;
|
|
252
|
+
python)
|
|
253
|
+
# Parse manifest/requirements without matching comments or unrelated words;
|
|
254
|
+
# a bare tests/ directory may be unittest, so check for pytest config/conftest.
|
|
255
|
+
py_runner=""
|
|
256
|
+
case "$primary_pm" in
|
|
257
|
+
uv|poetry) py_runner="$primary_pm run " ;;
|
|
258
|
+
esac
|
|
259
|
+
read -r has_pytest has_ruff has_build < <(python3 - "$project_root" <<'PYEOF'
|
|
260
|
+
import re
|
|
261
|
+
import sys
|
|
262
|
+
import tomllib
|
|
263
|
+
from pathlib import Path
|
|
264
|
+
|
|
265
|
+
root = Path(sys.argv[1])
|
|
266
|
+
manifest = root / "pyproject.toml"
|
|
267
|
+
try:
|
|
268
|
+
data = tomllib.loads(manifest.read_bytes().decode("utf-8-sig")) if manifest.exists() else {}
|
|
269
|
+
except (ValueError, OSError) as exc:
|
|
270
|
+
print(f"[profile-project] WARN: cannot parse pyproject.toml: {exc}", file=sys.stderr)
|
|
271
|
+
data = {}
|
|
272
|
+
project = data.get("project", {})
|
|
273
|
+
deps = list(project.get("dependencies", []))
|
|
274
|
+
for group in project.get("optional-dependencies", {}).values():
|
|
275
|
+
deps.extend(group)
|
|
276
|
+
for group in data.get("dependency-groups", {}).values():
|
|
277
|
+
deps.extend(item for item in group if isinstance(item, str))
|
|
278
|
+
poetry = data.get("tool", {}).get("poetry", {})
|
|
279
|
+
deps.extend(poetry.get("dependencies", {}).keys())
|
|
280
|
+
for group in poetry.get("group", {}).values():
|
|
281
|
+
deps.extend(group.get("dependencies", {}).keys())
|
|
282
|
+
for name in ("requirements.txt", "requirements-dev.txt", "requirements-test.txt"):
|
|
283
|
+
path = root / name
|
|
284
|
+
if path.is_file():
|
|
285
|
+
deps.extend(line.split("#", 1)[0].strip() for line in path.read_bytes().decode("utf-8-sig").splitlines())
|
|
286
|
+
|
|
287
|
+
def has_dep(pkg: str) -> bool:
|
|
288
|
+
return any(re.match(r"^" + re.escape(pkg) + r"(?:$|[\[\s><=!~;])", item, re.I)
|
|
289
|
+
for item in deps if isinstance(item, str))
|
|
290
|
+
|
|
291
|
+
tools = data.get("tool", {})
|
|
292
|
+
pytest_ok = (
|
|
293
|
+
has_dep("pytest") or "pytest" in tools
|
|
294
|
+
or any((root / n).is_file() for n in ("pytest.ini", ".pytest.ini", "conftest.py", "tests/conftest.py"))
|
|
295
|
+
)
|
|
296
|
+
ruff_ok = (
|
|
297
|
+
has_dep("ruff") or "ruff" in tools
|
|
298
|
+
or any((root / n).is_file() for n in ("ruff.toml", ".ruff.toml"))
|
|
299
|
+
)
|
|
300
|
+
build_ok = "build-system" in data
|
|
301
|
+
print(int(pytest_ok), int(ruff_ok), int(build_ok))
|
|
302
|
+
PYEOF
|
|
303
|
+
)
|
|
304
|
+
[[ "$has_pytest" == "1" ]] && test_cmd="${py_runner}pytest"
|
|
305
|
+
[[ "$has_ruff" == "1" ]] && lint_cmd="${py_runner}ruff check ."
|
|
306
|
+
if [[ "$has_build" == "1" ]]; then
|
|
307
|
+
case "$primary_pm" in
|
|
308
|
+
uv|poetry|hatch) build_cmd="$primary_pm build" ;;
|
|
309
|
+
*) build_cmd="python -m build" ;;
|
|
310
|
+
esac
|
|
311
|
+
fi
|
|
312
|
+
;;
|
|
313
|
+
terraform)
|
|
314
|
+
test_cmd="terraform validate"
|
|
315
|
+
lint_cmd="terraform fmt -check"
|
|
316
|
+
build_cmd="terraform plan"
|
|
317
|
+
;;
|
|
318
|
+
*)
|
|
319
|
+
test_cmd=unknown
|
|
320
|
+
lint_cmd=unknown
|
|
321
|
+
build_cmd=unknown
|
|
322
|
+
;;
|
|
323
|
+
esac
|
|
324
|
+
|
|
325
|
+
# ---------------------------------------------------------------------------
|
|
326
|
+
# Contextual checks
|
|
327
|
+
# ---------------------------------------------------------------------------
|
|
328
|
+
has_github_dir=false
|
|
329
|
+
dir_exists ".github" && has_github_dir=true
|
|
330
|
+
|
|
331
|
+
has_cursor_rules=false
|
|
332
|
+
if dir_exists ".cursor/rules" || file_exists ".cursorrules"; then
|
|
333
|
+
has_cursor_rules=true
|
|
334
|
+
fi
|
|
335
|
+
|
|
336
|
+
has_legacy_cursorrules=false
|
|
337
|
+
file_exists ".cursorrules" && has_legacy_cursorrules=true
|
|
338
|
+
|
|
339
|
+
has_modern_cursor_rules=false
|
|
340
|
+
dir_exists ".cursor/rules" && has_modern_cursor_rules=true
|
|
341
|
+
|
|
342
|
+
has_claude_md=false
|
|
343
|
+
file_exists "CLAUDE.md" && has_claude_md=true
|
|
344
|
+
|
|
345
|
+
has_agents_md=false
|
|
346
|
+
file_exists "AGENTS.md" && has_agents_md=true
|
|
347
|
+
|
|
348
|
+
# Query the shared canonical parser before emitting any profile output.
|
|
349
|
+
# Capture its status directly (not through a pipeline) so read errors abort.
|
|
350
|
+
rules_profile="$("${_pp_shared}/rules-pointer.sh" profile --repo "$project_root")"
|
|
351
|
+
agents_md_is_pointer=false
|
|
352
|
+
claude_md_imports_agents=false
|
|
353
|
+
while IFS='=' read -r key value; do
|
|
354
|
+
case "$key" in
|
|
355
|
+
agents_md_is_pointer) agents_md_is_pointer="$value" ;;
|
|
356
|
+
claude_md_imports_agents) claude_md_imports_agents="$value" ;;
|
|
357
|
+
esac
|
|
358
|
+
done <<<"$rules_profile"
|
|
359
|
+
|
|
360
|
+
has_issue_templates=false
|
|
361
|
+
if dir_exists ".github/ISSUE_TEMPLATE"; then
|
|
362
|
+
tmpl_count=$(find "${project_root}/.github/ISSUE_TEMPLATE" -maxdepth 1 \( -name "*.yml" -o -name "*.yaml" -o -name "*.md" \) 2>/dev/null | wc -l | tr -d ' ')
|
|
363
|
+
[[ "$tmpl_count" -gt 0 ]] && has_issue_templates=true
|
|
364
|
+
fi
|
|
365
|
+
|
|
366
|
+
has_pr_template=false
|
|
367
|
+
if file_exists ".github/pull_request_template.md" || file_exists "pull_request_template.md" || file_exists "docs/pull_request_template.md"; then
|
|
368
|
+
has_pr_template=true
|
|
369
|
+
fi
|
|
370
|
+
|
|
371
|
+
has_gitmessage=false
|
|
372
|
+
file_exists ".gitmessage" && has_gitmessage=true
|
|
373
|
+
|
|
374
|
+
has_gitignore=false
|
|
375
|
+
file_exists ".gitignore" && has_gitignore=true
|
|
376
|
+
|
|
377
|
+
has_commitlint_config=false
|
|
378
|
+
for f in commitlint.config.cjs commitlint.config.js commitlint.config.mjs commitlint.config.ts .commitlintrc .commitlintrc.json .commitlintrc.yml; do
|
|
379
|
+
if file_exists "$f"; then
|
|
380
|
+
has_commitlint_config=true
|
|
381
|
+
break
|
|
382
|
+
fi
|
|
383
|
+
done
|
|
384
|
+
|
|
385
|
+
has_lefthook_config=false
|
|
386
|
+
for f in lefthook.yml lefthook.yaml .lefthook.yml .lefthook.yaml; do
|
|
387
|
+
if file_exists "$f"; then
|
|
388
|
+
has_lefthook_config=true
|
|
389
|
+
break
|
|
390
|
+
fi
|
|
391
|
+
done
|
|
392
|
+
if [[ "$has_lefthook_config" == "false" ]] && dir_exists ".lefthook"; then
|
|
393
|
+
has_lefthook_config=true
|
|
394
|
+
fi
|
|
395
|
+
|
|
396
|
+
# A repo-root RELEASING.md means the project already follows a ycc release
|
|
397
|
+
# model; init then skips the ycc:release-model offer.
|
|
398
|
+
has_releasing_md=false
|
|
399
|
+
file_exists "RELEASING.md" && has_releasing_md=true
|
|
400
|
+
|
|
401
|
+
# ---------------------------------------------------------------------------
|
|
402
|
+
# CI provider detection
|
|
403
|
+
# ---------------------------------------------------------------------------
|
|
404
|
+
ci_provider=none
|
|
405
|
+
|
|
406
|
+
if dir_exists ".github/workflows"; then
|
|
407
|
+
# Confirm there is at least one yaml file
|
|
408
|
+
yml_count=$(find "${project_root}/.github/workflows" -maxdepth 1 \( -name "*.yml" -o -name "*.yaml" \) 2>/dev/null | wc -l | tr -d ' ')
|
|
409
|
+
[[ "$yml_count" -gt 0 ]] && ci_provider=github-actions
|
|
410
|
+
fi
|
|
411
|
+
|
|
412
|
+
if [[ "$ci_provider" == "none" ]] && file_exists ".gitlab-ci.yml"; then
|
|
413
|
+
ci_provider=gitlab-ci
|
|
414
|
+
fi
|
|
415
|
+
|
|
416
|
+
if [[ "$ci_provider" == "none" ]] && file_exists ".circleci/config.yml"; then
|
|
417
|
+
ci_provider=circleci
|
|
418
|
+
fi
|
|
419
|
+
|
|
420
|
+
# ---------------------------------------------------------------------------
|
|
421
|
+
# project_name
|
|
422
|
+
# ---------------------------------------------------------------------------
|
|
423
|
+
project_name=$(basename "$project_root")
|
|
424
|
+
|
|
425
|
+
# ---------------------------------------------------------------------------
|
|
426
|
+
# Emit output
|
|
427
|
+
# ---------------------------------------------------------------------------
|
|
428
|
+
echo "project_root=${project_root}"
|
|
429
|
+
echo "is_empty=${is_empty}"
|
|
430
|
+
echo "has_git=${has_git}"
|
|
431
|
+
echo "primary_language=${primary_language}"
|
|
432
|
+
echo "secondary_languages=${secondary_languages}"
|
|
433
|
+
echo "package_manager=${package_manager}"
|
|
434
|
+
echo "test_cmd=${test_cmd}"
|
|
435
|
+
echo "lint_cmd=${lint_cmd}"
|
|
436
|
+
echo "build_cmd=${build_cmd}"
|
|
437
|
+
echo "has_github_dir=${has_github_dir}"
|
|
438
|
+
echo "has_cursor_rules=${has_cursor_rules}"
|
|
439
|
+
echo "has_legacy_cursorrules=${has_legacy_cursorrules}"
|
|
440
|
+
echo "has_modern_cursor_rules=${has_modern_cursor_rules}"
|
|
441
|
+
echo "has_claude_md=${has_claude_md}"
|
|
442
|
+
echo "has_agents_md=${has_agents_md}"
|
|
443
|
+
echo "agents_md_is_pointer=${agents_md_is_pointer}"
|
|
444
|
+
echo "claude_md_imports_agents=${claude_md_imports_agents}"
|
|
445
|
+
echo "has_issue_templates=${has_issue_templates}"
|
|
446
|
+
echo "has_pr_template=${has_pr_template}"
|
|
447
|
+
echo "has_gitmessage=${has_gitmessage}"
|
|
448
|
+
echo "has_gitignore=${has_gitignore}"
|
|
449
|
+
echo "has_commitlint_config=${has_commitlint_config}"
|
|
450
|
+
echo "has_lefthook_config=${has_lefthook_config}"
|
|
451
|
+
echo "has_releasing_md=${has_releasing_md}"
|
|
452
|
+
echo "ci_provider=${ci_provider}"
|
|
453
|
+
echo "project_name=${project_name}"
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Render a bundled /ycc:init template to stdout. Never writes files.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
render-template.py --template <bundled-relative-or-absolute> [--profile FILE|-]
|
|
6
|
+
[--set KEY=VALUE]... [--keep BLOCK]...
|
|
7
|
+
|
|
8
|
+
* --template must resolve (after symlink resolution) inside the bundled
|
|
9
|
+
templates directory next to this script (../templates). Anything else is
|
|
10
|
+
rejected.
|
|
11
|
+
* --profile is key=value output from profile-project.sh; "-" or piped stdin
|
|
12
|
+
reads it from stdin. Regular files, FIFOs and /dev/fd paths are accepted.
|
|
13
|
+
* --set KEY=VALUE overrides the profile. --keep BLOCK keeps a block that is
|
|
14
|
+
not computed automatically (IF_RELEASE_MODEL, IF_LABELS, IF_CONTRIBUTING,
|
|
15
|
+
IF_CLAUDE_ONLY).
|
|
16
|
+
|
|
17
|
+
Blocks:
|
|
18
|
+
{{#NAME}} ... {{/NAME}} markers must be alone on their line. Blocks nest,
|
|
19
|
+
and a closer must match the innermost opener or rendering fails.
|
|
20
|
+
Computed automatically:
|
|
21
|
+
IF_RUST / IF_TS / IF_GO / IF_PYTHON / IF_TERRAFORM - language blocks.
|
|
22
|
+
Single-language profile: that language only. Mixed profile: every
|
|
23
|
+
component language in secondary_languages. gitignore.tmpl always keeps
|
|
24
|
+
primary + secondary languages.
|
|
25
|
+
IF_TEST_CMD / IF_LINT_CMD / IF_BUILD_CMD - kept only when that command was
|
|
26
|
+
detected (value other than "unknown").
|
|
27
|
+
IF_NO_TEST_CMD / IF_NO_LINT_CMD / IF_NO_BUILD_CMD - the inverse.
|
|
28
|
+
|
|
29
|
+
Undetected commands render as "# not detected" (safe in fenced shell blocks).
|
|
30
|
+
A rendered line of the form `run: # ...` fails the render: templates that put
|
|
31
|
+
a command into YAML must guard it with IF_*_CMD blocks.
|
|
32
|
+
|
|
33
|
+
Requires Python 3.11+. Exit codes: 0 ok, 1 usage or render error.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
from __future__ import annotations
|
|
37
|
+
|
|
38
|
+
import argparse
|
|
39
|
+
import os
|
|
40
|
+
import re
|
|
41
|
+
import stat
|
|
42
|
+
import sys
|
|
43
|
+
from pathlib import Path
|
|
44
|
+
|
|
45
|
+
if sys.version_info < (3, 11): # noqa: UP036 - runtime guard for older python3
|
|
46
|
+
print(f"render-template: python3 3.11+ required, found {sys.version.split()[0]}", file=sys.stderr)
|
|
47
|
+
raise SystemExit(1)
|
|
48
|
+
|
|
49
|
+
NOT_DETECTED = "# not detected"
|
|
50
|
+
LANG_BLOCKS = {
|
|
51
|
+
"rust": "IF_RUST",
|
|
52
|
+
"typescript": "IF_TS",
|
|
53
|
+
"javascript": "IF_TS",
|
|
54
|
+
"go": "IF_GO",
|
|
55
|
+
"python": "IF_PYTHON",
|
|
56
|
+
"terraform": "IF_TERRAFORM",
|
|
57
|
+
}
|
|
58
|
+
OPEN_RE = re.compile(r"^\{\{#([A-Z0-9_]+)\}\}\s*$")
|
|
59
|
+
CLOSE_RE = re.compile(r"^\{\{/([A-Z0-9_]+)\}\}\s*$")
|
|
60
|
+
PLACEHOLDER_RE = re.compile(r"\{\{([A-Z0-9_]+)\}\}")
|
|
61
|
+
KEY_RE = re.compile(r"^[a-z_][a-z0-9_]*$")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def fail(msg: str) -> None:
|
|
65
|
+
print(f"render-template: {msg}", file=sys.stderr)
|
|
66
|
+
sys.exit(1)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def bundled_templates_dir() -> Path:
|
|
70
|
+
return (Path(__file__).resolve().parent.parent / "templates").resolve()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def resolve_template(arg: str) -> Path:
|
|
74
|
+
root = bundled_templates_dir()
|
|
75
|
+
candidate = Path(arg)
|
|
76
|
+
if not candidate.is_absolute():
|
|
77
|
+
cwd_candidate = candidate.resolve()
|
|
78
|
+
try:
|
|
79
|
+
cwd_candidate.relative_to(root)
|
|
80
|
+
candidate = cwd_candidate
|
|
81
|
+
except ValueError:
|
|
82
|
+
candidate = root / candidate
|
|
83
|
+
resolved = candidate.resolve()
|
|
84
|
+
try:
|
|
85
|
+
resolved.relative_to(root)
|
|
86
|
+
except ValueError:
|
|
87
|
+
fail(f"template must live under the bundled templates dir ({root}): {arg}")
|
|
88
|
+
if not resolved.is_file():
|
|
89
|
+
fail(f"template not found: {arg}")
|
|
90
|
+
return resolved
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def read_profile(arg: str | None) -> dict[str, str]:
|
|
94
|
+
if arg is None:
|
|
95
|
+
if sys.stdin.isatty():
|
|
96
|
+
return {}
|
|
97
|
+
arg = "-"
|
|
98
|
+
if arg == "-":
|
|
99
|
+
raw = sys.stdin.buffer.read().decode("utf-8-sig", errors="replace")
|
|
100
|
+
else:
|
|
101
|
+
p = Path(arg)
|
|
102
|
+
try:
|
|
103
|
+
mode = p.stat().st_mode
|
|
104
|
+
except OSError:
|
|
105
|
+
fail(f"profile not found: {arg}")
|
|
106
|
+
if stat.S_ISDIR(mode) or not os.access(p, os.R_OK):
|
|
107
|
+
fail(f"profile is not a readable file: {arg}")
|
|
108
|
+
raw = p.read_bytes().decode("utf-8-sig", errors="replace")
|
|
109
|
+
prof: dict[str, str] = {}
|
|
110
|
+
for line in raw.replace("\r", "").split("\n"):
|
|
111
|
+
if not line or line.startswith("#") or "=" not in line:
|
|
112
|
+
continue
|
|
113
|
+
key, _, value = line.partition("=")
|
|
114
|
+
if KEY_RE.match(key):
|
|
115
|
+
prof[key] = value
|
|
116
|
+
return prof
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def language_blocks(prof: dict[str, str], template: Path, overrides: dict[str, str]) -> set[str]:
|
|
120
|
+
primary = overrides.get("PRIMARY_LANG", prof.get("primary_language", "unknown"))
|
|
121
|
+
secondary = [s for s in prof.get("secondary_languages", "").split(",") if s and s != "none"]
|
|
122
|
+
langs: set[str] = set()
|
|
123
|
+
if primary == "mixed" or template.name == "gitignore.tmpl":
|
|
124
|
+
langs.update(secondary)
|
|
125
|
+
if primary != "mixed":
|
|
126
|
+
langs.add(primary)
|
|
127
|
+
return {LANG_BLOCKS[language] for language in langs if language in LANG_BLOCKS}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def main() -> int:
|
|
131
|
+
ap = argparse.ArgumentParser(add_help=True)
|
|
132
|
+
ap.add_argument("--template", required=True)
|
|
133
|
+
ap.add_argument("--profile")
|
|
134
|
+
ap.add_argument("--set", dest="sets", action="append", default=[])
|
|
135
|
+
ap.add_argument("--keep", action="append", default=[])
|
|
136
|
+
args = ap.parse_args()
|
|
137
|
+
|
|
138
|
+
template = resolve_template(args.template)
|
|
139
|
+
prof = read_profile(args.profile)
|
|
140
|
+
overrides: dict[str, str] = {}
|
|
141
|
+
for item in args.sets:
|
|
142
|
+
if "=" not in item:
|
|
143
|
+
fail("--set needs KEY=VALUE")
|
|
144
|
+
k, _, v = item.partition("=")
|
|
145
|
+
overrides[k] = v
|
|
146
|
+
|
|
147
|
+
def command(name: str, key: str) -> tuple[str, bool]:
|
|
148
|
+
value = overrides.get(name, prof.get(key, ""))
|
|
149
|
+
if not value or value == "unknown":
|
|
150
|
+
return NOT_DETECTED, False
|
|
151
|
+
return value, True
|
|
152
|
+
|
|
153
|
+
test_cmd, has_test = command("TEST_CMD", "test_cmd")
|
|
154
|
+
lint_cmd, has_lint = command("LINT_CMD", "lint_cmd")
|
|
155
|
+
build_cmd, has_build = command("BUILD_CMD", "build_cmd")
|
|
156
|
+
|
|
157
|
+
values = {
|
|
158
|
+
"PROJECT_NAME": prof.get("project_name", ""),
|
|
159
|
+
"PROJECT_PURPOSE": prof.get("project_purpose", ""),
|
|
160
|
+
"PROJECT_CONVENTIONS": prof.get("project_conventions", "")
|
|
161
|
+
or "No additional project-specific conventions detected.",
|
|
162
|
+
"PRIMARY_LANG": prof.get("primary_language", "unknown"),
|
|
163
|
+
"SECONDARY_LANGS": prof.get("secondary_languages", "none"),
|
|
164
|
+
"PACKAGE_MANAGER": prof.get("package_manager", "unknown"),
|
|
165
|
+
"TEST_CMD": test_cmd,
|
|
166
|
+
"LINT_CMD": lint_cmd,
|
|
167
|
+
"BUILD_CMD": build_cmd,
|
|
168
|
+
}
|
|
169
|
+
values.update(overrides)
|
|
170
|
+
if template.name == "CLAUDE.md.tmpl":
|
|
171
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
172
|
+
from rules_file_lib import CLAUDE_SHIM_LINE
|
|
173
|
+
|
|
174
|
+
values["CLAUDE_MD_SHIM"] = CLAUDE_SHIM_LINE
|
|
175
|
+
# Command overrides are normalised too, never raw 'unknown' in YAML.
|
|
176
|
+
values.update(TEST_CMD=test_cmd, LINT_CMD=lint_cmd, BUILD_CMD=build_cmd)
|
|
177
|
+
|
|
178
|
+
keep = set(args.keep) | language_blocks(prof, template, overrides)
|
|
179
|
+
for flag, name in ((has_test, "TEST_CMD"), (has_lint, "LINT_CMD"), (has_build, "BUILD_CMD")):
|
|
180
|
+
keep.add(f"IF_{name}" if flag else f"IF_NO_{name}")
|
|
181
|
+
|
|
182
|
+
out: list[str] = []
|
|
183
|
+
stack: list[tuple[str, bool]] = [] # (name, parent_active_and_kept)
|
|
184
|
+
|
|
185
|
+
def active() -> bool:
|
|
186
|
+
return all(kept for _, kept in stack)
|
|
187
|
+
|
|
188
|
+
for line in template.read_bytes().decode("utf-8-sig").split("\n"):
|
|
189
|
+
m_open = OPEN_RE.match(line)
|
|
190
|
+
if m_open:
|
|
191
|
+
stack.append((m_open.group(1), m_open.group(1) in keep))
|
|
192
|
+
continue
|
|
193
|
+
m_close = CLOSE_RE.match(line)
|
|
194
|
+
if m_close:
|
|
195
|
+
if not stack:
|
|
196
|
+
fail(f"closer {{{{/{m_close.group(1)}}}}} without opener in {template.name}")
|
|
197
|
+
if stack[-1][0] != m_close.group(1):
|
|
198
|
+
fail(
|
|
199
|
+
f"mismatched closer {{{{/{m_close.group(1)}}}}} for opener "
|
|
200
|
+
f"{{{{#{stack[-1][0]}}}}} in {template.name}"
|
|
201
|
+
)
|
|
202
|
+
stack.pop()
|
|
203
|
+
continue
|
|
204
|
+
if not active():
|
|
205
|
+
continue
|
|
206
|
+
out.append(PLACEHOLDER_RE.sub(lambda m: values.get(m.group(1), m.group(0)), line))
|
|
207
|
+
if stack:
|
|
208
|
+
fail(f"unterminated block {{{{#{stack[-1][0]}}}}} in {template.name}")
|
|
209
|
+
|
|
210
|
+
# Drop the trailing empty element created by the final newline split.
|
|
211
|
+
if out and out[-1] == "":
|
|
212
|
+
out.pop()
|
|
213
|
+
rendered = "\n".join(out) + "\n"
|
|
214
|
+
|
|
215
|
+
leftover = sorted(set(PLACEHOLDER_RE.findall(rendered)))
|
|
216
|
+
if leftover:
|
|
217
|
+
fail("unresolved placeholders: " + " ".join("{{" + n + "}}" for n in leftover))
|
|
218
|
+
for line in rendered.split("\n"):
|
|
219
|
+
if re.match(r"^\s*run:\s*#", line):
|
|
220
|
+
fail("rendered an invalid YAML `run:` from an undetected command; guard it with IF_*_CMD blocks")
|
|
221
|
+
sys.stdout.write(rendered)
|
|
222
|
+
return 0
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
if __name__ == "__main__":
|
|
226
|
+
sys.exit(main())
|