compound-engineering-pi 0.2.3
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/LICENSE +21 -0
- package/README.md +124 -0
- package/bin/compound-engineering-pi +12 -0
- package/bin/compound-plugin +12 -0
- package/compound-engineering-pi +12 -0
- package/compound-plugin +5 -0
- package/docs/pi.md +152 -0
- package/extensions/compound-engineering-compat.ts +452 -0
- package/package.json +84 -0
- package/pi-resources/compound-engineering/mcporter.json +7 -0
- package/plugins/coding-tutor/.claude-plugin/plugin.json +9 -0
- package/plugins/coding-tutor/README.md +37 -0
- package/plugins/coding-tutor/commands/quiz-me.md +1 -0
- package/plugins/coding-tutor/commands/sync-tutorials.md +25 -0
- package/plugins/coding-tutor/commands/teach-me.md +1 -0
- package/plugins/coding-tutor/skills/coding-tutor/SKILL.md +214 -0
- package/plugins/coding-tutor/skills/coding-tutor/scripts/create_tutorial.py +207 -0
- package/plugins/coding-tutor/skills/coding-tutor/scripts/index_tutorials.py +193 -0
- package/plugins/coding-tutor/skills/coding-tutor/scripts/quiz_priority.py +190 -0
- package/plugins/coding-tutor/skills/coding-tutor/scripts/setup_tutorials.py +118 -0
- package/plugins/compound-engineering/.claude-plugin/plugin.json +33 -0
- package/plugins/compound-engineering/CHANGELOG.md +457 -0
- package/plugins/compound-engineering/CLAUDE.md +89 -0
- package/plugins/compound-engineering/LICENSE +21 -0
- package/plugins/compound-engineering/README.md +232 -0
- package/plugins/compound-engineering/agents/design/design-implementation-reviewer.md +109 -0
- package/plugins/compound-engineering/agents/design/design-iterator.md +224 -0
- package/plugins/compound-engineering/agents/design/figma-design-sync.md +190 -0
- package/plugins/compound-engineering/agents/docs/ankane-readme-writer.md +65 -0
- package/plugins/compound-engineering/agents/research/best-practices-researcher.md +126 -0
- package/plugins/compound-engineering/agents/research/framework-docs-researcher.md +106 -0
- package/plugins/compound-engineering/agents/research/git-history-analyzer.md +59 -0
- package/plugins/compound-engineering/agents/research/learnings-researcher.md +264 -0
- package/plugins/compound-engineering/agents/research/repo-research-analyst.md +135 -0
- package/plugins/compound-engineering/agents/review/agent-native-reviewer.md +261 -0
- package/plugins/compound-engineering/agents/review/architecture-strategist.md +67 -0
- package/plugins/compound-engineering/agents/review/code-simplicity-reviewer.md +101 -0
- package/plugins/compound-engineering/agents/review/data-integrity-guardian.md +85 -0
- package/plugins/compound-engineering/agents/review/data-migration-expert.md +112 -0
- package/plugins/compound-engineering/agents/review/deployment-verification-agent.md +174 -0
- package/plugins/compound-engineering/agents/review/dhh-rails-reviewer.md +66 -0
- package/plugins/compound-engineering/agents/review/julik-frontend-races-reviewer.md +221 -0
- package/plugins/compound-engineering/agents/review/kieran-python-reviewer.md +133 -0
- package/plugins/compound-engineering/agents/review/kieran-rails-reviewer.md +115 -0
- package/plugins/compound-engineering/agents/review/kieran-typescript-reviewer.md +124 -0
- package/plugins/compound-engineering/agents/review/pattern-recognition-specialist.md +72 -0
- package/plugins/compound-engineering/agents/review/performance-oracle.md +137 -0
- package/plugins/compound-engineering/agents/review/schema-drift-detector.md +154 -0
- package/plugins/compound-engineering/agents/review/security-sentinel.md +114 -0
- package/plugins/compound-engineering/agents/workflow/bug-reproduction-validator.md +82 -0
- package/plugins/compound-engineering/agents/workflow/every-style-editor.md +64 -0
- package/plugins/compound-engineering/agents/workflow/lint.md +16 -0
- package/plugins/compound-engineering/agents/workflow/pr-comment-resolver.md +84 -0
- package/plugins/compound-engineering/agents/workflow/spec-flow-analyzer.md +134 -0
- package/plugins/compound-engineering/commands/agent-native-audit.md +278 -0
- package/plugins/compound-engineering/commands/changelog.md +138 -0
- package/plugins/compound-engineering/commands/create-agent-skill.md +9 -0
- package/plugins/compound-engineering/commands/deepen-plan.md +546 -0
- package/plugins/compound-engineering/commands/deploy-docs.md +113 -0
- package/plugins/compound-engineering/commands/feature-video.md +342 -0
- package/plugins/compound-engineering/commands/generate_command.md +163 -0
- package/plugins/compound-engineering/commands/heal-skill.md +143 -0
- package/plugins/compound-engineering/commands/lfg.md +20 -0
- package/plugins/compound-engineering/commands/release-docs.md +212 -0
- package/plugins/compound-engineering/commands/report-bug.md +151 -0
- package/plugins/compound-engineering/commands/reproduce-bug.md +100 -0
- package/plugins/compound-engineering/commands/resolve_parallel.md +35 -0
- package/plugins/compound-engineering/commands/resolve_todo_parallel.md +37 -0
- package/plugins/compound-engineering/commands/slfg.md +32 -0
- package/plugins/compound-engineering/commands/technical_review.md +8 -0
- package/plugins/compound-engineering/commands/test-browser.md +339 -0
- package/plugins/compound-engineering/commands/test-xcode.md +332 -0
- package/plugins/compound-engineering/commands/triage.md +311 -0
- package/plugins/compound-engineering/commands/workflows/brainstorm.md +124 -0
- package/plugins/compound-engineering/commands/workflows/compound.md +239 -0
- package/plugins/compound-engineering/commands/workflows/plan.md +551 -0
- package/plugins/compound-engineering/commands/workflows/review.md +526 -0
- package/plugins/compound-engineering/commands/workflows/work.md +433 -0
- package/plugins/compound-engineering/skills/agent-browser/SKILL.md +223 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/SKILL.md +435 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/action-parity-discipline.md +409 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/agent-execution-patterns.md +467 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/agent-native-testing.md +582 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/architecture-patterns.md +478 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/dynamic-context-injection.md +338 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/files-universal-interface.md +301 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/from-primitives-to-domain-tools.md +359 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/mcp-tool-design.md +506 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/mobile-patterns.md +871 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/product-implications.md +443 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/refactoring-to-prompt-native.md +317 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/self-modification.md +269 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/shared-workspace-architecture.md +680 -0
- package/plugins/compound-engineering/skills/agent-native-architecture/references/system-prompt-design.md +250 -0
- package/plugins/compound-engineering/skills/andrew-kane-gem-writer/SKILL.md +184 -0
- package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/database-adapters.md +231 -0
- package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/module-organization.md +121 -0
- package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/rails-integration.md +183 -0
- package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/resources.md +119 -0
- package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/testing-patterns.md +261 -0
- package/plugins/compound-engineering/skills/brainstorming/SKILL.md +190 -0
- package/plugins/compound-engineering/skills/compound-docs/SKILL.md +511 -0
- package/plugins/compound-engineering/skills/compound-docs/assets/critical-pattern-template.md +34 -0
- package/plugins/compound-engineering/skills/compound-docs/assets/resolution-template.md +93 -0
- package/plugins/compound-engineering/skills/compound-docs/references/yaml-schema.md +65 -0
- package/plugins/compound-engineering/skills/compound-docs/schema.yaml +176 -0
- package/plugins/compound-engineering/skills/create-agent-skills/SKILL.md +275 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/api-security.md +226 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/be-clear-and-direct.md +531 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/best-practices.md +404 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/common-patterns.md +595 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/core-principles.md +437 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/executable-code.md +175 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/iteration-and-testing.md +474 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/official-spec.md +134 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/recommended-structure.md +168 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/skill-structure.md +152 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/using-scripts.md +113 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/using-templates.md +112 -0
- package/plugins/compound-engineering/skills/create-agent-skills/references/workflows-and-validation.md +510 -0
- package/plugins/compound-engineering/skills/create-agent-skills/templates/router-skill.md +73 -0
- package/plugins/compound-engineering/skills/create-agent-skills/templates/simple-skill.md +33 -0
- package/plugins/compound-engineering/skills/create-agent-skills/workflows/add-reference.md +96 -0
- package/plugins/compound-engineering/skills/create-agent-skills/workflows/add-script.md +93 -0
- package/plugins/compound-engineering/skills/create-agent-skills/workflows/add-template.md +74 -0
- package/plugins/compound-engineering/skills/create-agent-skills/workflows/add-workflow.md +120 -0
- package/plugins/compound-engineering/skills/create-agent-skills/workflows/audit-skill.md +138 -0
- package/plugins/compound-engineering/skills/create-agent-skills/workflows/create-domain-expertise-skill.md +605 -0
- package/plugins/compound-engineering/skills/create-agent-skills/workflows/create-new-skill.md +191 -0
- package/plugins/compound-engineering/skills/create-agent-skills/workflows/get-guidance.md +121 -0
- package/plugins/compound-engineering/skills/create-agent-skills/workflows/upgrade-to-router.md +161 -0
- package/plugins/compound-engineering/skills/create-agent-skills/workflows/verify-skill.md +204 -0
- package/plugins/compound-engineering/skills/dhh-rails-style/SKILL.md +185 -0
- package/plugins/compound-engineering/skills/dhh-rails-style/references/architecture.md +653 -0
- package/plugins/compound-engineering/skills/dhh-rails-style/references/controllers.md +303 -0
- package/plugins/compound-engineering/skills/dhh-rails-style/references/frontend.md +510 -0
- package/plugins/compound-engineering/skills/dhh-rails-style/references/gems.md +266 -0
- package/plugins/compound-engineering/skills/dhh-rails-style/references/models.md +359 -0
- package/plugins/compound-engineering/skills/dhh-rails-style/references/testing.md +338 -0
- package/plugins/compound-engineering/skills/document-review/SKILL.md +87 -0
- package/plugins/compound-engineering/skills/dspy-ruby/SKILL.md +737 -0
- package/plugins/compound-engineering/skills/dspy-ruby/assets/config-template.rb +187 -0
- package/plugins/compound-engineering/skills/dspy-ruby/assets/module-template.rb +300 -0
- package/plugins/compound-engineering/skills/dspy-ruby/assets/signature-template.rb +221 -0
- package/plugins/compound-engineering/skills/dspy-ruby/references/core-concepts.md +674 -0
- package/plugins/compound-engineering/skills/dspy-ruby/references/observability.md +366 -0
- package/plugins/compound-engineering/skills/dspy-ruby/references/optimization.md +603 -0
- package/plugins/compound-engineering/skills/dspy-ruby/references/providers.md +418 -0
- package/plugins/compound-engineering/skills/dspy-ruby/references/toolsets.md +502 -0
- package/plugins/compound-engineering/skills/every-style-editor/SKILL.md +134 -0
- package/plugins/compound-engineering/skills/every-style-editor/references/EVERY_WRITE_STYLE.md +529 -0
- package/plugins/compound-engineering/skills/file-todos/SKILL.md +252 -0
- package/plugins/compound-engineering/skills/file-todos/assets/todo-template.md +155 -0
- package/plugins/compound-engineering/skills/frontend-design/SKILL.md +42 -0
- package/plugins/compound-engineering/skills/gemini-imagegen/SKILL.md +237 -0
- package/plugins/compound-engineering/skills/gemini-imagegen/requirements.txt +2 -0
- package/plugins/compound-engineering/skills/gemini-imagegen/scripts/compose_images.py +157 -0
- package/plugins/compound-engineering/skills/gemini-imagegen/scripts/edit_image.py +144 -0
- package/plugins/compound-engineering/skills/gemini-imagegen/scripts/gemini_images.py +263 -0
- package/plugins/compound-engineering/skills/gemini-imagegen/scripts/generate_image.py +133 -0
- package/plugins/compound-engineering/skills/gemini-imagegen/scripts/multi_turn_chat.py +216 -0
- package/plugins/compound-engineering/skills/git-worktree/SKILL.md +302 -0
- package/plugins/compound-engineering/skills/git-worktree/scripts/worktree-manager.sh +337 -0
- package/plugins/compound-engineering/skills/orchestrating-swarms/SKILL.md +1718 -0
- package/plugins/compound-engineering/skills/rclone/SKILL.md +150 -0
- package/plugins/compound-engineering/skills/rclone/scripts/check_setup.sh +60 -0
- package/plugins/compound-engineering/skills/resolve-pr-parallel/SKILL.md +89 -0
- package/plugins/compound-engineering/skills/resolve-pr-parallel/scripts/get-pr-comments +68 -0
- package/plugins/compound-engineering/skills/resolve-pr-parallel/scripts/resolve-pr-thread +23 -0
- package/plugins/compound-engineering/skills/skill-creator/SKILL.md +210 -0
- package/plugins/compound-engineering/skills/skill-creator/scripts/init_skill.py +303 -0
- package/plugins/compound-engineering/skills/skill-creator/scripts/package_skill.py +110 -0
- package/plugins/compound-engineering/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/prompts/deepen-plan.md +549 -0
- package/prompts/feature-video.md +341 -0
- package/prompts/resolve_todo_parallel.md +36 -0
- package/prompts/test-browser.md +342 -0
- package/prompts/workflows-brainstorm.md +123 -0
- package/prompts/workflows-compound.md +238 -0
- package/prompts/workflows-plan.md +550 -0
- package/prompts/workflows-review.md +529 -0
- package/prompts/workflows-work.md +432 -0
- package/skills/agent-browser/SKILL.md +223 -0
- package/skills/agent-native-architecture/SKILL.md +435 -0
- package/skills/agent-native-architecture/references/action-parity-discipline.md +409 -0
- package/skills/agent-native-architecture/references/agent-execution-patterns.md +467 -0
- package/skills/agent-native-architecture/references/agent-native-testing.md +582 -0
- package/skills/agent-native-architecture/references/architecture-patterns.md +478 -0
- package/skills/agent-native-architecture/references/dynamic-context-injection.md +338 -0
- package/skills/agent-native-architecture/references/files-universal-interface.md +301 -0
- package/skills/agent-native-architecture/references/from-primitives-to-domain-tools.md +359 -0
- package/skills/agent-native-architecture/references/mcp-tool-design.md +506 -0
- package/skills/agent-native-architecture/references/mobile-patterns.md +871 -0
- package/skills/agent-native-architecture/references/product-implications.md +443 -0
- package/skills/agent-native-architecture/references/refactoring-to-prompt-native.md +317 -0
- package/skills/agent-native-architecture/references/self-modification.md +269 -0
- package/skills/agent-native-architecture/references/shared-workspace-architecture.md +680 -0
- package/skills/agent-native-architecture/references/system-prompt-design.md +250 -0
- package/skills/agent-native-reviewer/SKILL.md +260 -0
- package/skills/andrew-kane-gem-writer/SKILL.md +184 -0
- package/skills/andrew-kane-gem-writer/references/database-adapters.md +231 -0
- package/skills/andrew-kane-gem-writer/references/module-organization.md +121 -0
- package/skills/andrew-kane-gem-writer/references/rails-integration.md +183 -0
- package/skills/andrew-kane-gem-writer/references/resources.md +119 -0
- package/skills/andrew-kane-gem-writer/references/testing-patterns.md +261 -0
- package/skills/ankane-readme-writer/SKILL.md +63 -0
- package/skills/architecture-strategist/SKILL.md +66 -0
- package/skills/best-practices-researcher/SKILL.md +125 -0
- package/skills/brainstorming/SKILL.md +190 -0
- package/skills/bug-reproduction-validator/SKILL.md +81 -0
- package/skills/code-simplicity-reviewer/SKILL.md +100 -0
- package/skills/compound-docs/SKILL.md +511 -0
- package/skills/compound-docs/assets/critical-pattern-template.md +34 -0
- package/skills/compound-docs/assets/resolution-template.md +93 -0
- package/skills/compound-docs/references/yaml-schema.md +65 -0
- package/skills/compound-docs/schema.yaml +176 -0
- package/skills/create-agent-skills/SKILL.md +275 -0
- package/skills/create-agent-skills/references/api-security.md +226 -0
- package/skills/create-agent-skills/references/be-clear-and-direct.md +531 -0
- package/skills/create-agent-skills/references/best-practices.md +404 -0
- package/skills/create-agent-skills/references/common-patterns.md +595 -0
- package/skills/create-agent-skills/references/core-principles.md +437 -0
- package/skills/create-agent-skills/references/executable-code.md +175 -0
- package/skills/create-agent-skills/references/iteration-and-testing.md +474 -0
- package/skills/create-agent-skills/references/official-spec.md +134 -0
- package/skills/create-agent-skills/references/recommended-structure.md +168 -0
- package/skills/create-agent-skills/references/skill-structure.md +152 -0
- package/skills/create-agent-skills/references/using-scripts.md +113 -0
- package/skills/create-agent-skills/references/using-templates.md +112 -0
- package/skills/create-agent-skills/references/workflows-and-validation.md +510 -0
- package/skills/create-agent-skills/templates/router-skill.md +73 -0
- package/skills/create-agent-skills/templates/simple-skill.md +33 -0
- package/skills/create-agent-skills/workflows/add-reference.md +96 -0
- package/skills/create-agent-skills/workflows/add-script.md +93 -0
- package/skills/create-agent-skills/workflows/add-template.md +74 -0
- package/skills/create-agent-skills/workflows/add-workflow.md +120 -0
- package/skills/create-agent-skills/workflows/audit-skill.md +138 -0
- package/skills/create-agent-skills/workflows/create-domain-expertise-skill.md +605 -0
- package/skills/create-agent-skills/workflows/create-new-skill.md +191 -0
- package/skills/create-agent-skills/workflows/get-guidance.md +121 -0
- package/skills/create-agent-skills/workflows/upgrade-to-router.md +161 -0
- package/skills/create-agent-skills/workflows/verify-skill.md +204 -0
- package/skills/data-integrity-guardian/SKILL.md +84 -0
- package/skills/data-migration-expert/SKILL.md +111 -0
- package/skills/deployment-verification-agent/SKILL.md +173 -0
- package/skills/design-implementation-reviewer/SKILL.md +107 -0
- package/skills/design-iterator/SKILL.md +222 -0
- package/skills/dhh-rails-reviewer/SKILL.md +65 -0
- package/skills/dhh-rails-style/SKILL.md +185 -0
- package/skills/dhh-rails-style/references/architecture.md +653 -0
- package/skills/dhh-rails-style/references/controllers.md +303 -0
- package/skills/dhh-rails-style/references/frontend.md +510 -0
- package/skills/dhh-rails-style/references/gems.md +266 -0
- package/skills/dhh-rails-style/references/models.md +359 -0
- package/skills/dhh-rails-style/references/testing.md +338 -0
- package/skills/document-review/SKILL.md +87 -0
- package/skills/dspy-ruby/SKILL.md +737 -0
- package/skills/dspy-ruby/assets/config-template.rb +187 -0
- package/skills/dspy-ruby/assets/module-template.rb +300 -0
- package/skills/dspy-ruby/assets/signature-template.rb +221 -0
- package/skills/dspy-ruby/references/core-concepts.md +674 -0
- package/skills/dspy-ruby/references/observability.md +366 -0
- package/skills/dspy-ruby/references/optimization.md +603 -0
- package/skills/dspy-ruby/references/providers.md +418 -0
- package/skills/dspy-ruby/references/toolsets.md +502 -0
- package/skills/every-style-editor/SKILL.md +134 -0
- package/skills/every-style-editor/references/EVERY_WRITE_STYLE.md +529 -0
- package/skills/every-style-editor-2/SKILL.md +62 -0
- package/skills/figma-design-sync/SKILL.md +188 -0
- package/skills/file-todos/SKILL.md +252 -0
- package/skills/file-todos/assets/todo-template.md +155 -0
- package/skills/framework-docs-researcher/SKILL.md +105 -0
- package/skills/frontend-design/SKILL.md +42 -0
- package/skills/gemini-imagegen/SKILL.md +237 -0
- package/skills/gemini-imagegen/requirements.txt +2 -0
- package/skills/gemini-imagegen/scripts/compose_images.py +157 -0
- package/skills/gemini-imagegen/scripts/edit_image.py +144 -0
- package/skills/gemini-imagegen/scripts/gemini_images.py +263 -0
- package/skills/gemini-imagegen/scripts/generate_image.py +133 -0
- package/skills/gemini-imagegen/scripts/multi_turn_chat.py +216 -0
- package/skills/git-history-analyzer/SKILL.md +58 -0
- package/skills/git-worktree/SKILL.md +302 -0
- package/skills/git-worktree/scripts/worktree-manager.sh +337 -0
- package/skills/julik-frontend-races-reviewer/SKILL.md +220 -0
- package/skills/kieran-python-reviewer/SKILL.md +132 -0
- package/skills/kieran-rails-reviewer/SKILL.md +114 -0
- package/skills/kieran-typescript-reviewer/SKILL.md +123 -0
- package/skills/learnings-researcher/SKILL.md +263 -0
- package/skills/lint/SKILL.md +14 -0
- package/skills/orchestrating-swarms/SKILL.md +1718 -0
- package/skills/pattern-recognition-specialist/SKILL.md +71 -0
- package/skills/performance-oracle/SKILL.md +136 -0
- package/skills/pr-comment-resolver/SKILL.md +82 -0
- package/skills/rclone/SKILL.md +150 -0
- package/skills/rclone/scripts/check_setup.sh +60 -0
- package/skills/repo-research-analyst/SKILL.md +134 -0
- package/skills/resolve_pr_parallel/SKILL.md +89 -0
- package/skills/resolve_pr_parallel/scripts/get-pr-comments +68 -0
- package/skills/resolve_pr_parallel/scripts/resolve-pr-thread +23 -0
- package/skills/schema-drift-detector/SKILL.md +153 -0
- package/skills/security-sentinel/SKILL.md +113 -0
- package/skills/skill-creator/SKILL.md +210 -0
- package/skills/skill-creator/scripts/init_skill.py +303 -0
- package/skills/skill-creator/scripts/package_skill.py +110 -0
- package/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/skills/spec-flow-analyzer/SKILL.md +133 -0
- package/src/commands/convert.ts +183 -0
- package/src/commands/install.ts +273 -0
- package/src/commands/list.ts +37 -0
- package/src/commands/sync.ts +89 -0
- package/src/converters/claude-to-codex.ts +182 -0
- package/src/converters/claude-to-opencode.ts +395 -0
- package/src/converters/claude-to-pi.ts +205 -0
- package/src/index.ts +22 -0
- package/src/parsers/claude-home.ts +65 -0
- package/src/parsers/claude.ts +252 -0
- package/src/sync/codex.ts +92 -0
- package/src/sync/opencode.ts +75 -0
- package/src/sync/pi.ts +88 -0
- package/src/targets/codex.ts +96 -0
- package/src/targets/index.ts +38 -0
- package/src/targets/opencode.ts +57 -0
- package/src/targets/pi.ts +131 -0
- package/src/templates/pi/compat-extension.ts +452 -0
- package/src/types/claude.ts +90 -0
- package/src/types/codex.ts +23 -0
- package/src/types/opencode.ts +54 -0
- package/src/types/pi.ts +40 -0
- package/src/utils/codex-agents.ts +64 -0
- package/src/utils/files.ts +77 -0
- package/src/utils/frontmatter.ts +65 -0
- package/src/utils/symlink.ts +43 -0
package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/module-organization.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Module Organization Patterns
|
|
2
|
+
|
|
3
|
+
## Simple Gem Layout
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
lib/
|
|
7
|
+
├── gemname.rb # Entry point, config, errors
|
|
8
|
+
└── gemname/
|
|
9
|
+
├── helper.rb # Core functionality
|
|
10
|
+
├── engine.rb # Rails engine (if needed)
|
|
11
|
+
└── version.rb # VERSION constant only
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Complex Gem Layout (PgHero pattern)
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
lib/
|
|
18
|
+
├── pghero.rb
|
|
19
|
+
└── pghero/
|
|
20
|
+
├── database.rb # Main class
|
|
21
|
+
├── engine.rb # Rails engine
|
|
22
|
+
└── methods/ # Functional decomposition
|
|
23
|
+
├── basic.rb
|
|
24
|
+
├── connections.rb
|
|
25
|
+
├── indexes.rb
|
|
26
|
+
├── queries.rb
|
|
27
|
+
└── replication.rb
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Method Decomposition Pattern
|
|
31
|
+
|
|
32
|
+
Break large classes into includable modules by feature:
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
# lib/pghero/database.rb
|
|
36
|
+
module PgHero
|
|
37
|
+
class Database
|
|
38
|
+
include Methods::Basic
|
|
39
|
+
include Methods::Connections
|
|
40
|
+
include Methods::Indexes
|
|
41
|
+
include Methods::Queries
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# lib/pghero/methods/indexes.rb
|
|
46
|
+
module PgHero
|
|
47
|
+
module Methods
|
|
48
|
+
module Indexes
|
|
49
|
+
def index_hit_rate
|
|
50
|
+
# implementation
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def unused_indexes
|
|
54
|
+
# implementation
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Version File Pattern
|
|
62
|
+
|
|
63
|
+
Keep version.rb minimal:
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
# lib/gemname/version.rb
|
|
67
|
+
module GemName
|
|
68
|
+
VERSION = "2.0.0"
|
|
69
|
+
end
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Require Order in Entry Point
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
# lib/searchkick.rb
|
|
76
|
+
|
|
77
|
+
# 1. Standard library
|
|
78
|
+
require "forwardable"
|
|
79
|
+
require "json"
|
|
80
|
+
|
|
81
|
+
# 2. External dependencies (minimal)
|
|
82
|
+
require "active_support"
|
|
83
|
+
|
|
84
|
+
# 3. Internal files via require_relative
|
|
85
|
+
require_relative "searchkick/index"
|
|
86
|
+
require_relative "searchkick/model"
|
|
87
|
+
require_relative "searchkick/query"
|
|
88
|
+
require_relative "searchkick/version"
|
|
89
|
+
|
|
90
|
+
# 4. Conditional Rails loading (LAST)
|
|
91
|
+
require_relative "searchkick/railtie" if defined?(Rails)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Autoload vs Require
|
|
95
|
+
|
|
96
|
+
Kane uses explicit `require_relative`, not autoload:
|
|
97
|
+
|
|
98
|
+
```ruby
|
|
99
|
+
# CORRECT
|
|
100
|
+
require_relative "gemname/model"
|
|
101
|
+
require_relative "gemname/query"
|
|
102
|
+
|
|
103
|
+
# AVOID
|
|
104
|
+
autoload :Model, "gemname/model"
|
|
105
|
+
autoload :Query, "gemname/query"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Comments Style
|
|
109
|
+
|
|
110
|
+
Minimal section headers only:
|
|
111
|
+
|
|
112
|
+
```ruby
|
|
113
|
+
# dependencies
|
|
114
|
+
require "active_support"
|
|
115
|
+
|
|
116
|
+
# adapters
|
|
117
|
+
require_relative "adapters/postgresql_adapter"
|
|
118
|
+
|
|
119
|
+
# modules
|
|
120
|
+
require_relative "migration"
|
|
121
|
+
```
|
package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/rails-integration.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Rails Integration Patterns
|
|
2
|
+
|
|
3
|
+
## The Golden Rule
|
|
4
|
+
|
|
5
|
+
**Never require Rails gems directly.** This causes loading order issues.
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
# WRONG - causes premature loading
|
|
9
|
+
require "active_record"
|
|
10
|
+
ActiveRecord::Base.include(MyGem::Model)
|
|
11
|
+
|
|
12
|
+
# CORRECT - lazy loading
|
|
13
|
+
ActiveSupport.on_load(:active_record) do
|
|
14
|
+
extend MyGem::Model
|
|
15
|
+
end
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## ActiveSupport.on_load Hooks
|
|
19
|
+
|
|
20
|
+
Common hooks and their uses:
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
# Models
|
|
24
|
+
ActiveSupport.on_load(:active_record) do
|
|
25
|
+
extend GemName::Model # Add class methods (searchkick, has_encrypted)
|
|
26
|
+
include GemName::Callbacks # Add instance methods
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Controllers
|
|
30
|
+
ActiveSupport.on_load(:action_controller) do
|
|
31
|
+
include Ahoy::Controller
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Jobs
|
|
35
|
+
ActiveSupport.on_load(:active_job) do
|
|
36
|
+
include GemName::JobExtensions
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Mailers
|
|
40
|
+
ActiveSupport.on_load(:action_mailer) do
|
|
41
|
+
include GemName::MailerExtensions
|
|
42
|
+
end
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Prepend for Behavior Modification
|
|
46
|
+
|
|
47
|
+
When overriding existing Rails methods:
|
|
48
|
+
|
|
49
|
+
```ruby
|
|
50
|
+
ActiveSupport.on_load(:active_record) do
|
|
51
|
+
ActiveRecord::Migration.prepend(StrongMigrations::Migration)
|
|
52
|
+
ActiveRecord::Migrator.prepend(StrongMigrations::Migrator)
|
|
53
|
+
end
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Railtie Pattern
|
|
57
|
+
|
|
58
|
+
Minimal Railtie for non-mountable gems:
|
|
59
|
+
|
|
60
|
+
```ruby
|
|
61
|
+
# lib/gemname/railtie.rb
|
|
62
|
+
module GemName
|
|
63
|
+
class Railtie < Rails::Railtie
|
|
64
|
+
initializer "gemname.configure" do
|
|
65
|
+
ActiveSupport.on_load(:active_record) do
|
|
66
|
+
extend GemName::Model
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Optional: Add to controller runtime logging
|
|
71
|
+
initializer "gemname.log_runtime" do
|
|
72
|
+
require_relative "controller_runtime"
|
|
73
|
+
ActiveSupport.on_load(:action_controller) do
|
|
74
|
+
include GemName::ControllerRuntime
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Optional: Rake tasks
|
|
79
|
+
rake_tasks do
|
|
80
|
+
load "tasks/gemname.rake"
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Engine Pattern (Mountable Gems)
|
|
87
|
+
|
|
88
|
+
For gems with web interfaces (PgHero, Blazer, Ahoy):
|
|
89
|
+
|
|
90
|
+
```ruby
|
|
91
|
+
# lib/pghero/engine.rb
|
|
92
|
+
module PgHero
|
|
93
|
+
class Engine < ::Rails::Engine
|
|
94
|
+
isolate_namespace PgHero
|
|
95
|
+
|
|
96
|
+
initializer "pghero.assets", group: :all do |app|
|
|
97
|
+
if app.config.respond_to?(:assets) && defined?(Sprockets)
|
|
98
|
+
app.config.assets.precompile << "pghero/application.js"
|
|
99
|
+
app.config.assets.precompile << "pghero/application.css"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
initializer "pghero.config" do
|
|
104
|
+
PgHero.config = Rails.application.config_for(:pghero) rescue {}
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Routes for Engines
|
|
111
|
+
|
|
112
|
+
```ruby
|
|
113
|
+
# config/routes.rb (in engine)
|
|
114
|
+
PgHero::Engine.routes.draw do
|
|
115
|
+
root to: "home#index"
|
|
116
|
+
resources :databases, only: [:show]
|
|
117
|
+
end
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Mount in app:
|
|
121
|
+
|
|
122
|
+
```ruby
|
|
123
|
+
# config/routes.rb (in app)
|
|
124
|
+
mount PgHero::Engine, at: "pghero"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## YAML Configuration with ERB
|
|
128
|
+
|
|
129
|
+
For complex gems needing config files:
|
|
130
|
+
|
|
131
|
+
```ruby
|
|
132
|
+
def self.settings
|
|
133
|
+
@settings ||= begin
|
|
134
|
+
path = Rails.root.join("config", "blazer.yml")
|
|
135
|
+
if path.exist?
|
|
136
|
+
YAML.safe_load(ERB.new(File.read(path)).result, aliases: true)
|
|
137
|
+
else
|
|
138
|
+
{}
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Generator Pattern
|
|
145
|
+
|
|
146
|
+
```ruby
|
|
147
|
+
# lib/generators/gemname/install_generator.rb
|
|
148
|
+
module GemName
|
|
149
|
+
module Generators
|
|
150
|
+
class InstallGenerator < Rails::Generators::Base
|
|
151
|
+
source_root File.expand_path("templates", __dir__)
|
|
152
|
+
|
|
153
|
+
def copy_initializer
|
|
154
|
+
template "initializer.rb", "config/initializers/gemname.rb"
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def copy_migration
|
|
158
|
+
migration_template "migration.rb", "db/migrate/create_gemname_tables.rb"
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Conditional Feature Detection
|
|
166
|
+
|
|
167
|
+
```ruby
|
|
168
|
+
# Check for specific Rails versions
|
|
169
|
+
if ActiveRecord.version >= Gem::Version.new("7.0")
|
|
170
|
+
# Rails 7+ specific code
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Check for optional dependencies
|
|
174
|
+
def self.client
|
|
175
|
+
@client ||= if defined?(OpenSearch::Client)
|
|
176
|
+
OpenSearch::Client.new
|
|
177
|
+
elsif defined?(Elasticsearch::Client)
|
|
178
|
+
Elasticsearch::Client.new
|
|
179
|
+
else
|
|
180
|
+
raise Error, "Install elasticsearch or opensearch-ruby"
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
```
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Andrew Kane Resources
|
|
2
|
+
|
|
3
|
+
## Primary Documentation
|
|
4
|
+
|
|
5
|
+
- **Gem Patterns Article**: https://ankane.org/gem-patterns
|
|
6
|
+
- Kane's own documentation of patterns used across his gems
|
|
7
|
+
- Covers configuration, Rails integration, error handling
|
|
8
|
+
|
|
9
|
+
## Top Ruby Gems by Stars
|
|
10
|
+
|
|
11
|
+
### Search & Data
|
|
12
|
+
|
|
13
|
+
| Gem | Stars | Description | Source |
|
|
14
|
+
|-----|-------|-------------|--------|
|
|
15
|
+
| **Searchkick** | 6.6k+ | Intelligent search for Rails | https://github.com/ankane/searchkick |
|
|
16
|
+
| **Chartkick** | 6.4k+ | Beautiful charts in Ruby | https://github.com/ankane/chartkick |
|
|
17
|
+
| **Groupdate** | 3.8k+ | Group by day, week, month | https://github.com/ankane/groupdate |
|
|
18
|
+
| **Blazer** | 4.6k+ | SQL dashboard for Rails | https://github.com/ankane/blazer |
|
|
19
|
+
|
|
20
|
+
### Database & Migrations
|
|
21
|
+
|
|
22
|
+
| Gem | Stars | Description | Source |
|
|
23
|
+
|-----|-------|-------------|--------|
|
|
24
|
+
| **PgHero** | 8.2k+ | PostgreSQL insights | https://github.com/ankane/pghero |
|
|
25
|
+
| **Strong Migrations** | 4.1k+ | Safe migration checks | https://github.com/ankane/strong_migrations |
|
|
26
|
+
| **Dexter** | 1.8k+ | Auto index advisor | https://github.com/ankane/dexter |
|
|
27
|
+
| **PgSync** | 1.5k+ | Sync Postgres data | https://github.com/ankane/pgsync |
|
|
28
|
+
|
|
29
|
+
### Security & Encryption
|
|
30
|
+
|
|
31
|
+
| Gem | Stars | Description | Source |
|
|
32
|
+
|-----|-------|-------------|--------|
|
|
33
|
+
| **Lockbox** | 1.5k+ | Application-level encryption | https://github.com/ankane/lockbox |
|
|
34
|
+
| **Blind Index** | 1.0k+ | Encrypted search | https://github.com/ankane/blind_index |
|
|
35
|
+
| **Secure Headers** | — | Contributed patterns | Referenced in gems |
|
|
36
|
+
|
|
37
|
+
### Analytics & ML
|
|
38
|
+
|
|
39
|
+
| Gem | Stars | Description | Source |
|
|
40
|
+
|-----|-------|-------------|--------|
|
|
41
|
+
| **Ahoy** | 4.2k+ | Analytics for Rails | https://github.com/ankane/ahoy |
|
|
42
|
+
| **Neighbor** | 1.1k+ | Vector search for Rails | https://github.com/ankane/neighbor |
|
|
43
|
+
| **Rover** | 700+ | DataFrames for Ruby | https://github.com/ankane/rover |
|
|
44
|
+
| **Tomoto** | 200+ | Topic modeling | https://github.com/ankane/tomoto-ruby |
|
|
45
|
+
|
|
46
|
+
### Utilities
|
|
47
|
+
|
|
48
|
+
| Gem | Stars | Description | Source |
|
|
49
|
+
|-----|-------|-------------|--------|
|
|
50
|
+
| **Pretender** | 2.0k+ | Login as another user | https://github.com/ankane/pretender |
|
|
51
|
+
| **Authtrail** | 900+ | Login activity tracking | https://github.com/ankane/authtrail |
|
|
52
|
+
| **Notable** | 200+ | Track notable requests | https://github.com/ankane/notable |
|
|
53
|
+
| **Logstop** | 200+ | Filter sensitive logs | https://github.com/ankane/logstop |
|
|
54
|
+
|
|
55
|
+
## Key Source Files to Study
|
|
56
|
+
|
|
57
|
+
### Entry Point Patterns
|
|
58
|
+
- https://github.com/ankane/searchkick/blob/master/lib/searchkick.rb
|
|
59
|
+
- https://github.com/ankane/pghero/blob/master/lib/pghero.rb
|
|
60
|
+
- https://github.com/ankane/strong_migrations/blob/master/lib/strong_migrations.rb
|
|
61
|
+
- https://github.com/ankane/lockbox/blob/master/lib/lockbox.rb
|
|
62
|
+
|
|
63
|
+
### Class Macro Implementations
|
|
64
|
+
- https://github.com/ankane/searchkick/blob/master/lib/searchkick/model.rb
|
|
65
|
+
- https://github.com/ankane/lockbox/blob/master/lib/lockbox/model.rb
|
|
66
|
+
- https://github.com/ankane/neighbor/blob/master/lib/neighbor/model.rb
|
|
67
|
+
- https://github.com/ankane/blind_index/blob/master/lib/blind_index/model.rb
|
|
68
|
+
|
|
69
|
+
### Rails Integration (Railtie/Engine)
|
|
70
|
+
- https://github.com/ankane/pghero/blob/master/lib/pghero/engine.rb
|
|
71
|
+
- https://github.com/ankane/searchkick/blob/master/lib/searchkick/railtie.rb
|
|
72
|
+
- https://github.com/ankane/ahoy/blob/master/lib/ahoy/engine.rb
|
|
73
|
+
- https://github.com/ankane/blazer/blob/master/lib/blazer/engine.rb
|
|
74
|
+
|
|
75
|
+
### Database Adapters
|
|
76
|
+
- https://github.com/ankane/strong_migrations/tree/master/lib/strong_migrations/adapters
|
|
77
|
+
- https://github.com/ankane/groupdate/tree/master/lib/groupdate/adapters
|
|
78
|
+
- https://github.com/ankane/neighbor/tree/master/lib/neighbor
|
|
79
|
+
|
|
80
|
+
### Error Messages (Template Pattern)
|
|
81
|
+
- https://github.com/ankane/strong_migrations/blob/master/lib/strong_migrations/error_messages.rb
|
|
82
|
+
|
|
83
|
+
### Gemspec Examples
|
|
84
|
+
- https://github.com/ankane/searchkick/blob/master/searchkick.gemspec
|
|
85
|
+
- https://github.com/ankane/neighbor/blob/master/neighbor.gemspec
|
|
86
|
+
- https://github.com/ankane/ahoy/blob/master/ahoy_matey.gemspec
|
|
87
|
+
|
|
88
|
+
### Test Setups
|
|
89
|
+
- https://github.com/ankane/searchkick/tree/master/test
|
|
90
|
+
- https://github.com/ankane/lockbox/tree/master/test
|
|
91
|
+
- https://github.com/ankane/strong_migrations/tree/master/test
|
|
92
|
+
|
|
93
|
+
## GitHub Profile
|
|
94
|
+
|
|
95
|
+
- **Profile**: https://github.com/ankane
|
|
96
|
+
- **All Ruby Repos**: https://github.com/ankane?tab=repositories&q=&type=&language=ruby&sort=stargazers
|
|
97
|
+
- **RubyGems Profile**: https://rubygems.org/profiles/ankane
|
|
98
|
+
|
|
99
|
+
## Blog Posts & Articles
|
|
100
|
+
|
|
101
|
+
- **ankane.org**: https://ankane.org/
|
|
102
|
+
- **Gem Patterns**: https://ankane.org/gem-patterns (essential reading)
|
|
103
|
+
- **Postgres Performance**: https://ankane.org/introducing-pghero
|
|
104
|
+
- **Search Tips**: https://ankane.org/search-rails
|
|
105
|
+
|
|
106
|
+
## Design Philosophy Summary
|
|
107
|
+
|
|
108
|
+
From studying 100+ gems, Kane's consistent principles:
|
|
109
|
+
|
|
110
|
+
1. **Zero dependencies when possible** - Each dep is a maintenance burden
|
|
111
|
+
2. **ActiveSupport.on_load always** - Never require Rails gems directly
|
|
112
|
+
3. **Class macro DSLs** - Single method configures everything
|
|
113
|
+
4. **Explicit over magic** - No method_missing, define methods directly
|
|
114
|
+
5. **Minitest only** - Simple, sufficient, no RSpec
|
|
115
|
+
6. **Multi-version testing** - Support broad Rails/Ruby versions
|
|
116
|
+
7. **Helpful errors** - Template-based messages with fix suggestions
|
|
117
|
+
8. **Abstract adapters** - Clean multi-database support
|
|
118
|
+
9. **Engine isolation** - isolate_namespace for mountable gems
|
|
119
|
+
10. **Minimal documentation** - Code is self-documenting, README is examples
|
package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/testing-patterns.md
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# Testing Patterns
|
|
2
|
+
|
|
3
|
+
## Minitest Setup
|
|
4
|
+
|
|
5
|
+
Kane exclusively uses Minitest—never RSpec.
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
# test/test_helper.rb
|
|
9
|
+
require "bundler/setup"
|
|
10
|
+
Bundler.require(:default)
|
|
11
|
+
require "minitest/autorun"
|
|
12
|
+
require "minitest/pride"
|
|
13
|
+
|
|
14
|
+
# Load the gem
|
|
15
|
+
require "gemname"
|
|
16
|
+
|
|
17
|
+
# Test database setup (if needed)
|
|
18
|
+
ActiveRecord::Base.establish_connection(
|
|
19
|
+
adapter: "postgresql",
|
|
20
|
+
database: "gemname_test"
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# Base test class
|
|
24
|
+
class Minitest::Test
|
|
25
|
+
def setup
|
|
26
|
+
# Reset state before each test
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Test File Structure
|
|
32
|
+
|
|
33
|
+
```ruby
|
|
34
|
+
# test/model_test.rb
|
|
35
|
+
require_relative "test_helper"
|
|
36
|
+
|
|
37
|
+
class ModelTest < Minitest::Test
|
|
38
|
+
def setup
|
|
39
|
+
User.delete_all
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_basic_functionality
|
|
43
|
+
user = User.create!(email: "test@example.org")
|
|
44
|
+
assert_equal "test@example.org", user.email
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def test_with_invalid_input
|
|
48
|
+
error = assert_raises(ArgumentError) do
|
|
49
|
+
User.create!(email: nil)
|
|
50
|
+
end
|
|
51
|
+
assert_match /email/, error.message
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def test_class_method
|
|
55
|
+
result = User.search("test")
|
|
56
|
+
assert_kind_of Array, result
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Multi-Version Testing
|
|
62
|
+
|
|
63
|
+
Test against multiple Rails/Ruby versions using gemfiles:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
test/
|
|
67
|
+
├── test_helper.rb
|
|
68
|
+
└── gemfiles/
|
|
69
|
+
├── activerecord70.gemfile
|
|
70
|
+
├── activerecord71.gemfile
|
|
71
|
+
└── activerecord72.gemfile
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
# test/gemfiles/activerecord70.gemfile
|
|
76
|
+
source "https://rubygems.org"
|
|
77
|
+
gemspec path: "../../"
|
|
78
|
+
|
|
79
|
+
gem "activerecord", "~> 7.0.0"
|
|
80
|
+
gem "sqlite3"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
# test/gemfiles/activerecord72.gemfile
|
|
85
|
+
source "https://rubygems.org"
|
|
86
|
+
gemspec path: "../../"
|
|
87
|
+
|
|
88
|
+
gem "activerecord", "~> 7.2.0"
|
|
89
|
+
gem "sqlite3"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Run with specific gemfile:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
BUNDLE_GEMFILE=test/gemfiles/activerecord70.gemfile bundle install
|
|
96
|
+
BUNDLE_GEMFILE=test/gemfiles/activerecord70.gemfile bundle exec rake test
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Rakefile
|
|
100
|
+
|
|
101
|
+
```ruby
|
|
102
|
+
# Rakefile
|
|
103
|
+
require "bundler/gem_tasks"
|
|
104
|
+
require "rake/testtask"
|
|
105
|
+
|
|
106
|
+
Rake::TestTask.new(:test) do |t|
|
|
107
|
+
t.libs << "test"
|
|
108
|
+
t.pattern = "test/**/*_test.rb"
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
task default: :test
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## GitHub Actions CI
|
|
115
|
+
|
|
116
|
+
```yaml
|
|
117
|
+
# .github/workflows/build.yml
|
|
118
|
+
name: build
|
|
119
|
+
|
|
120
|
+
on: [push, pull_request]
|
|
121
|
+
|
|
122
|
+
jobs:
|
|
123
|
+
build:
|
|
124
|
+
runs-on: ubuntu-latest
|
|
125
|
+
|
|
126
|
+
strategy:
|
|
127
|
+
fail-fast: false
|
|
128
|
+
matrix:
|
|
129
|
+
include:
|
|
130
|
+
- ruby: "3.2"
|
|
131
|
+
gemfile: activerecord70
|
|
132
|
+
- ruby: "3.3"
|
|
133
|
+
gemfile: activerecord71
|
|
134
|
+
- ruby: "3.3"
|
|
135
|
+
gemfile: activerecord72
|
|
136
|
+
|
|
137
|
+
env:
|
|
138
|
+
BUNDLE_GEMFILE: test/gemfiles/${{ matrix.gemfile }}.gemfile
|
|
139
|
+
|
|
140
|
+
steps:
|
|
141
|
+
- uses: actions/checkout@v4
|
|
142
|
+
|
|
143
|
+
- uses: ruby/setup-ruby@v1
|
|
144
|
+
with:
|
|
145
|
+
ruby-version: ${{ matrix.ruby }}
|
|
146
|
+
bundler-cache: true
|
|
147
|
+
|
|
148
|
+
- run: bundle exec rake test
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Database-Specific Testing
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
# .github/workflows/build.yml (with services)
|
|
155
|
+
services:
|
|
156
|
+
postgres:
|
|
157
|
+
image: postgres:15
|
|
158
|
+
env:
|
|
159
|
+
POSTGRES_USER: postgres
|
|
160
|
+
POSTGRES_PASSWORD: postgres
|
|
161
|
+
ports:
|
|
162
|
+
- 5432:5432
|
|
163
|
+
options: >-
|
|
164
|
+
--health-cmd pg_isready
|
|
165
|
+
--health-interval 10s
|
|
166
|
+
--health-timeout 5s
|
|
167
|
+
--health-retries 5
|
|
168
|
+
|
|
169
|
+
env:
|
|
170
|
+
DATABASE_URL: postgres://postgres:postgres@localhost/gemname_test
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Test Database Setup
|
|
174
|
+
|
|
175
|
+
```ruby
|
|
176
|
+
# test/test_helper.rb
|
|
177
|
+
require "active_record"
|
|
178
|
+
|
|
179
|
+
# Connect to database
|
|
180
|
+
ActiveRecord::Base.establish_connection(
|
|
181
|
+
ENV["DATABASE_URL"] || {
|
|
182
|
+
adapter: "postgresql",
|
|
183
|
+
database: "gemname_test"
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
# Create tables
|
|
188
|
+
ActiveRecord::Schema.define do
|
|
189
|
+
create_table :users, force: true do |t|
|
|
190
|
+
t.string :email
|
|
191
|
+
t.text :encrypted_data
|
|
192
|
+
t.timestamps
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Define models
|
|
197
|
+
class User < ActiveRecord::Base
|
|
198
|
+
gemname_feature :email
|
|
199
|
+
end
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Assertion Patterns
|
|
203
|
+
|
|
204
|
+
```ruby
|
|
205
|
+
# Basic assertions
|
|
206
|
+
assert result
|
|
207
|
+
assert_equal expected, actual
|
|
208
|
+
assert_nil value
|
|
209
|
+
assert_empty array
|
|
210
|
+
|
|
211
|
+
# Exception testing
|
|
212
|
+
assert_raises(ArgumentError) { bad_code }
|
|
213
|
+
|
|
214
|
+
error = assert_raises(GemName::Error) do
|
|
215
|
+
risky_operation
|
|
216
|
+
end
|
|
217
|
+
assert_match /expected message/, error.message
|
|
218
|
+
|
|
219
|
+
# Refutations
|
|
220
|
+
refute condition
|
|
221
|
+
refute_equal unexpected, actual
|
|
222
|
+
refute_nil value
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Test Helpers
|
|
226
|
+
|
|
227
|
+
```ruby
|
|
228
|
+
# test/test_helper.rb
|
|
229
|
+
class Minitest::Test
|
|
230
|
+
def with_options(options)
|
|
231
|
+
original = GemName.options.dup
|
|
232
|
+
GemName.options.merge!(options)
|
|
233
|
+
yield
|
|
234
|
+
ensure
|
|
235
|
+
GemName.options = original
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def assert_queries(expected_count)
|
|
239
|
+
queries = []
|
|
240
|
+
callback = ->(*, payload) { queries << payload[:sql] }
|
|
241
|
+
ActiveSupport::Notifications.subscribe("sql.active_record", callback)
|
|
242
|
+
yield
|
|
243
|
+
assert_equal expected_count, queries.size, "Expected #{expected_count} queries, got #{queries.size}"
|
|
244
|
+
ensure
|
|
245
|
+
ActiveSupport::Notifications.unsubscribe(callback)
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Skipping Tests
|
|
251
|
+
|
|
252
|
+
```ruby
|
|
253
|
+
def test_postgresql_specific
|
|
254
|
+
skip "PostgreSQL only" unless postgresql?
|
|
255
|
+
# test code
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
def postgresql?
|
|
259
|
+
ActiveRecord::Base.connection.adapter_name =~ /postg/i
|
|
260
|
+
end
|
|
261
|
+
```
|