@every-env/compound-plugin 0.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.
Files changed (226) hide show
  1. package/.claude-plugin/marketplace.json +37 -0
  2. package/.github/workflows/deploy-docs.yml +39 -0
  3. package/AGENTS.md +48 -0
  4. package/CLAUDE.md +380 -0
  5. package/LICENSE +21 -0
  6. package/README.md +65 -0
  7. package/bun.lock +30 -0
  8. package/docs/css/docs.css +675 -0
  9. package/docs/css/style.css +2886 -0
  10. package/docs/index.html +1046 -0
  11. package/docs/js/main.js +225 -0
  12. package/docs/pages/agents.html +649 -0
  13. package/docs/pages/changelog.html +495 -0
  14. package/docs/pages/commands.html +523 -0
  15. package/docs/pages/getting-started.html +582 -0
  16. package/docs/pages/mcp-servers.html +409 -0
  17. package/docs/pages/skills.html +611 -0
  18. package/docs/solutions/plugin-versioning-requirements.md +77 -0
  19. package/docs/specs/claude-code.md +67 -0
  20. package/docs/specs/codex.md +59 -0
  21. package/docs/specs/opencode.md +57 -0
  22. package/package.json +26 -0
  23. package/plans/grow-your-own-garden-plugin-architecture.md +102 -0
  24. package/plans/landing-page-launchkit-refresh.md +279 -0
  25. package/plugins/coding-tutor/.claude-plugin/plugin.json +9 -0
  26. package/plugins/coding-tutor/README.md +37 -0
  27. package/plugins/coding-tutor/commands/quiz-me.md +1 -0
  28. package/plugins/coding-tutor/commands/sync-tutorials.md +25 -0
  29. package/plugins/coding-tutor/commands/teach-me.md +1 -0
  30. package/plugins/coding-tutor/skills/coding-tutor/SKILL.md +214 -0
  31. package/plugins/coding-tutor/skills/coding-tutor/scripts/create_tutorial.py +207 -0
  32. package/plugins/coding-tutor/skills/coding-tutor/scripts/index_tutorials.py +193 -0
  33. package/plugins/coding-tutor/skills/coding-tutor/scripts/quiz_priority.py +190 -0
  34. package/plugins/coding-tutor/skills/coding-tutor/scripts/setup_tutorials.py +118 -0
  35. package/plugins/compound-engineering/.claude-plugin/plugin.json +33 -0
  36. package/plugins/compound-engineering/CHANGELOG.md +393 -0
  37. package/plugins/compound-engineering/CLAUDE.md +90 -0
  38. package/plugins/compound-engineering/LICENSE +21 -0
  39. package/plugins/compound-engineering/README.md +219 -0
  40. package/plugins/compound-engineering/agents/design/design-implementation-reviewer.md +94 -0
  41. package/plugins/compound-engineering/agents/design/design-iterator.md +197 -0
  42. package/plugins/compound-engineering/agents/design/figma-design-sync.md +172 -0
  43. package/plugins/compound-engineering/agents/docs/ankane-readme-writer.md +50 -0
  44. package/plugins/compound-engineering/agents/research/best-practices-researcher.md +100 -0
  45. package/plugins/compound-engineering/agents/research/framework-docs-researcher.md +83 -0
  46. package/plugins/compound-engineering/agents/research/git-history-analyzer.md +42 -0
  47. package/plugins/compound-engineering/agents/research/repo-research-analyst.md +113 -0
  48. package/plugins/compound-engineering/agents/review/agent-native-reviewer.md +246 -0
  49. package/plugins/compound-engineering/agents/review/architecture-strategist.md +52 -0
  50. package/plugins/compound-engineering/agents/review/code-simplicity-reviewer.md +85 -0
  51. package/plugins/compound-engineering/agents/review/data-integrity-guardian.md +70 -0
  52. package/plugins/compound-engineering/agents/review/data-migration-expert.md +97 -0
  53. package/plugins/compound-engineering/agents/review/deployment-verification-agent.md +159 -0
  54. package/plugins/compound-engineering/agents/review/dhh-rails-reviewer.md +45 -0
  55. package/plugins/compound-engineering/agents/review/julik-frontend-races-reviewer.md +222 -0
  56. package/plugins/compound-engineering/agents/review/kieran-python-reviewer.md +104 -0
  57. package/plugins/compound-engineering/agents/review/kieran-rails-reviewer.md +86 -0
  58. package/plugins/compound-engineering/agents/review/kieran-typescript-reviewer.md +95 -0
  59. package/plugins/compound-engineering/agents/review/pattern-recognition-specialist.md +57 -0
  60. package/plugins/compound-engineering/agents/review/performance-oracle.md +110 -0
  61. package/plugins/compound-engineering/agents/review/security-sentinel.md +93 -0
  62. package/plugins/compound-engineering/agents/workflow/bug-reproduction-validator.md +67 -0
  63. package/plugins/compound-engineering/agents/workflow/every-style-editor.md +64 -0
  64. package/plugins/compound-engineering/agents/workflow/lint.md +16 -0
  65. package/plugins/compound-engineering/agents/workflow/pr-comment-resolver.md +69 -0
  66. package/plugins/compound-engineering/agents/workflow/spec-flow-analyzer.md +113 -0
  67. package/plugins/compound-engineering/commands/agent-native-audit.md +277 -0
  68. package/plugins/compound-engineering/commands/changelog.md +137 -0
  69. package/plugins/compound-engineering/commands/create-agent-skill.md +8 -0
  70. package/plugins/compound-engineering/commands/deepen-plan.md +546 -0
  71. package/plugins/compound-engineering/commands/deploy-docs.md +112 -0
  72. package/plugins/compound-engineering/commands/feature-video.md +342 -0
  73. package/plugins/compound-engineering/commands/generate_command.md +162 -0
  74. package/plugins/compound-engineering/commands/heal-skill.md +142 -0
  75. package/plugins/compound-engineering/commands/lfg.md +19 -0
  76. package/plugins/compound-engineering/commands/plan_review.md +7 -0
  77. package/plugins/compound-engineering/commands/release-docs.md +211 -0
  78. package/plugins/compound-engineering/commands/report-bug.md +150 -0
  79. package/plugins/compound-engineering/commands/reproduce-bug.md +99 -0
  80. package/plugins/compound-engineering/commands/resolve_parallel.md +34 -0
  81. package/plugins/compound-engineering/commands/resolve_pr_parallel.md +49 -0
  82. package/plugins/compound-engineering/commands/resolve_todo_parallel.md +35 -0
  83. package/plugins/compound-engineering/commands/test-browser.md +339 -0
  84. package/plugins/compound-engineering/commands/triage.md +310 -0
  85. package/plugins/compound-engineering/commands/workflows/compound.md +202 -0
  86. package/plugins/compound-engineering/commands/workflows/plan.md +466 -0
  87. package/plugins/compound-engineering/commands/workflows/review.md +514 -0
  88. package/plugins/compound-engineering/commands/workflows/work.md +363 -0
  89. package/plugins/compound-engineering/commands/xcode-test.md +331 -0
  90. package/plugins/compound-engineering/skills/agent-browser/SKILL.md +223 -0
  91. package/plugins/compound-engineering/skills/agent-native-architecture/SKILL.md +435 -0
  92. package/plugins/compound-engineering/skills/agent-native-architecture/references/action-parity-discipline.md +409 -0
  93. package/plugins/compound-engineering/skills/agent-native-architecture/references/agent-execution-patterns.md +467 -0
  94. package/plugins/compound-engineering/skills/agent-native-architecture/references/agent-native-testing.md +582 -0
  95. package/plugins/compound-engineering/skills/agent-native-architecture/references/architecture-patterns.md +478 -0
  96. package/plugins/compound-engineering/skills/agent-native-architecture/references/dynamic-context-injection.md +338 -0
  97. package/plugins/compound-engineering/skills/agent-native-architecture/references/files-universal-interface.md +301 -0
  98. package/plugins/compound-engineering/skills/agent-native-architecture/references/from-primitives-to-domain-tools.md +359 -0
  99. package/plugins/compound-engineering/skills/agent-native-architecture/references/mcp-tool-design.md +506 -0
  100. package/plugins/compound-engineering/skills/agent-native-architecture/references/mobile-patterns.md +871 -0
  101. package/plugins/compound-engineering/skills/agent-native-architecture/references/product-implications.md +443 -0
  102. package/plugins/compound-engineering/skills/agent-native-architecture/references/refactoring-to-prompt-native.md +317 -0
  103. package/plugins/compound-engineering/skills/agent-native-architecture/references/self-modification.md +269 -0
  104. package/plugins/compound-engineering/skills/agent-native-architecture/references/shared-workspace-architecture.md +680 -0
  105. package/plugins/compound-engineering/skills/agent-native-architecture/references/system-prompt-design.md +250 -0
  106. package/plugins/compound-engineering/skills/andrew-kane-gem-writer/SKILL.md +184 -0
  107. package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/database-adapters.md +231 -0
  108. package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/module-organization.md +121 -0
  109. package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/rails-integration.md +183 -0
  110. package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/resources.md +119 -0
  111. package/plugins/compound-engineering/skills/andrew-kane-gem-writer/references/testing-patterns.md +261 -0
  112. package/plugins/compound-engineering/skills/compound-docs/SKILL.md +510 -0
  113. package/plugins/compound-engineering/skills/compound-docs/assets/critical-pattern-template.md +34 -0
  114. package/plugins/compound-engineering/skills/compound-docs/assets/resolution-template.md +93 -0
  115. package/plugins/compound-engineering/skills/compound-docs/references/yaml-schema.md +65 -0
  116. package/plugins/compound-engineering/skills/compound-docs/schema.yaml +176 -0
  117. package/plugins/compound-engineering/skills/create-agent-skills/SKILL.md +299 -0
  118. package/plugins/compound-engineering/skills/create-agent-skills/references/api-security.md +226 -0
  119. package/plugins/compound-engineering/skills/create-agent-skills/references/be-clear-and-direct.md +531 -0
  120. package/plugins/compound-engineering/skills/create-agent-skills/references/best-practices.md +404 -0
  121. package/plugins/compound-engineering/skills/create-agent-skills/references/common-patterns.md +595 -0
  122. package/plugins/compound-engineering/skills/create-agent-skills/references/core-principles.md +437 -0
  123. package/plugins/compound-engineering/skills/create-agent-skills/references/executable-code.md +175 -0
  124. package/plugins/compound-engineering/skills/create-agent-skills/references/iteration-and-testing.md +474 -0
  125. package/plugins/compound-engineering/skills/create-agent-skills/references/official-spec.md +185 -0
  126. package/plugins/compound-engineering/skills/create-agent-skills/references/recommended-structure.md +168 -0
  127. package/plugins/compound-engineering/skills/create-agent-skills/references/skill-structure.md +372 -0
  128. package/plugins/compound-engineering/skills/create-agent-skills/references/using-scripts.md +113 -0
  129. package/plugins/compound-engineering/skills/create-agent-skills/references/using-templates.md +112 -0
  130. package/plugins/compound-engineering/skills/create-agent-skills/references/workflows-and-validation.md +510 -0
  131. package/plugins/compound-engineering/skills/create-agent-skills/templates/router-skill.md +73 -0
  132. package/plugins/compound-engineering/skills/create-agent-skills/templates/simple-skill.md +33 -0
  133. package/plugins/compound-engineering/skills/create-agent-skills/workflows/add-reference.md +96 -0
  134. package/plugins/compound-engineering/skills/create-agent-skills/workflows/add-script.md +93 -0
  135. package/plugins/compound-engineering/skills/create-agent-skills/workflows/add-template.md +74 -0
  136. package/plugins/compound-engineering/skills/create-agent-skills/workflows/add-workflow.md +120 -0
  137. package/plugins/compound-engineering/skills/create-agent-skills/workflows/audit-skill.md +138 -0
  138. package/plugins/compound-engineering/skills/create-agent-skills/workflows/create-domain-expertise-skill.md +605 -0
  139. package/plugins/compound-engineering/skills/create-agent-skills/workflows/create-new-skill.md +191 -0
  140. package/plugins/compound-engineering/skills/create-agent-skills/workflows/get-guidance.md +121 -0
  141. package/plugins/compound-engineering/skills/create-agent-skills/workflows/upgrade-to-router.md +161 -0
  142. package/plugins/compound-engineering/skills/create-agent-skills/workflows/verify-skill.md +204 -0
  143. package/plugins/compound-engineering/skills/dhh-rails-style/SKILL.md +185 -0
  144. package/plugins/compound-engineering/skills/dhh-rails-style/references/architecture.md +653 -0
  145. package/plugins/compound-engineering/skills/dhh-rails-style/references/controllers.md +303 -0
  146. package/plugins/compound-engineering/skills/dhh-rails-style/references/frontend.md +510 -0
  147. package/plugins/compound-engineering/skills/dhh-rails-style/references/gems.md +266 -0
  148. package/plugins/compound-engineering/skills/dhh-rails-style/references/models.md +359 -0
  149. package/plugins/compound-engineering/skills/dhh-rails-style/references/testing.md +338 -0
  150. package/plugins/compound-engineering/skills/dspy-ruby/SKILL.md +594 -0
  151. package/plugins/compound-engineering/skills/dspy-ruby/assets/config-template.rb +359 -0
  152. package/plugins/compound-engineering/skills/dspy-ruby/assets/module-template.rb +326 -0
  153. package/plugins/compound-engineering/skills/dspy-ruby/assets/signature-template.rb +143 -0
  154. package/plugins/compound-engineering/skills/dspy-ruby/references/core-concepts.md +265 -0
  155. package/plugins/compound-engineering/skills/dspy-ruby/references/optimization.md +623 -0
  156. package/plugins/compound-engineering/skills/dspy-ruby/references/providers.md +338 -0
  157. package/plugins/compound-engineering/skills/every-style-editor/SKILL.md +134 -0
  158. package/plugins/compound-engineering/skills/every-style-editor/references/EVERY_WRITE_STYLE.md +529 -0
  159. package/plugins/compound-engineering/skills/file-todos/SKILL.md +251 -0
  160. package/plugins/compound-engineering/skills/file-todos/assets/todo-template.md +155 -0
  161. package/plugins/compound-engineering/skills/frontend-design/SKILL.md +42 -0
  162. package/plugins/compound-engineering/skills/gemini-imagegen/SKILL.md +237 -0
  163. package/plugins/compound-engineering/skills/gemini-imagegen/requirements.txt +2 -0
  164. package/plugins/compound-engineering/skills/gemini-imagegen/scripts/compose_images.py +157 -0
  165. package/plugins/compound-engineering/skills/gemini-imagegen/scripts/edit_image.py +144 -0
  166. package/plugins/compound-engineering/skills/gemini-imagegen/scripts/gemini_images.py +263 -0
  167. package/plugins/compound-engineering/skills/gemini-imagegen/scripts/generate_image.py +133 -0
  168. package/plugins/compound-engineering/skills/gemini-imagegen/scripts/multi_turn_chat.py +216 -0
  169. package/plugins/compound-engineering/skills/git-worktree/SKILL.md +302 -0
  170. package/plugins/compound-engineering/skills/git-worktree/scripts/worktree-manager.sh +345 -0
  171. package/plugins/compound-engineering/skills/rclone/SKILL.md +150 -0
  172. package/plugins/compound-engineering/skills/rclone/scripts/check_setup.sh +60 -0
  173. package/plugins/compound-engineering/skills/skill-creator/SKILL.md +209 -0
  174. package/plugins/compound-engineering/skills/skill-creator/scripts/init_skill.py +303 -0
  175. package/plugins/compound-engineering/skills/skill-creator/scripts/package_skill.py +110 -0
  176. package/plugins/compound-engineering/skills/skill-creator/scripts/quick_validate.py +65 -0
  177. package/src/commands/convert.ts +156 -0
  178. package/src/commands/install.ts +221 -0
  179. package/src/commands/list.ts +37 -0
  180. package/src/converters/claude-to-codex.ts +124 -0
  181. package/src/converters/claude-to-opencode.ts +392 -0
  182. package/src/index.ts +20 -0
  183. package/src/parsers/claude.ts +248 -0
  184. package/src/targets/codex.ts +91 -0
  185. package/src/targets/index.ts +29 -0
  186. package/src/targets/opencode.ts +48 -0
  187. package/src/types/claude.ts +88 -0
  188. package/src/types/codex.ts +23 -0
  189. package/src/types/opencode.ts +54 -0
  190. package/src/utils/codex-agents.ts +64 -0
  191. package/src/utils/files.ts +64 -0
  192. package/src/utils/frontmatter.ts +65 -0
  193. package/tests/claude-parser.test.ts +89 -0
  194. package/tests/cli.test.ts +289 -0
  195. package/tests/codex-agents.test.ts +62 -0
  196. package/tests/codex-converter.test.ts +121 -0
  197. package/tests/codex-writer.test.ts +76 -0
  198. package/tests/converter.test.ts +171 -0
  199. package/tests/fixtures/custom-paths/.claude-plugin/plugin.json +8 -0
  200. package/tests/fixtures/custom-paths/agents/default-agent.md +5 -0
  201. package/tests/fixtures/custom-paths/commands/default-command.md +5 -0
  202. package/tests/fixtures/custom-paths/custom-agents/custom-agent.md +5 -0
  203. package/tests/fixtures/custom-paths/custom-commands/custom-command.md +5 -0
  204. package/tests/fixtures/custom-paths/custom-hooks/hooks.json +7 -0
  205. package/tests/fixtures/custom-paths/custom-skills/custom-skill/SKILL.md +5 -0
  206. package/tests/fixtures/custom-paths/hooks/hooks.json +7 -0
  207. package/tests/fixtures/custom-paths/skills/default-skill/SKILL.md +5 -0
  208. package/tests/fixtures/invalid-command-path/.claude-plugin/plugin.json +5 -0
  209. package/tests/fixtures/invalid-hooks-path/.claude-plugin/plugin.json +5 -0
  210. package/tests/fixtures/invalid-mcp-path/.claude-plugin/plugin.json +5 -0
  211. package/tests/fixtures/mcp-file/.claude-plugin/plugin.json +5 -0
  212. package/tests/fixtures/mcp-file/.mcp.json +6 -0
  213. package/tests/fixtures/sample-plugin/.claude-plugin/plugin.json +30 -0
  214. package/tests/fixtures/sample-plugin/agents/agent-one.md +10 -0
  215. package/tests/fixtures/sample-plugin/agents/security-reviewer.md +7 -0
  216. package/tests/fixtures/sample-plugin/commands/command-one.md +7 -0
  217. package/tests/fixtures/sample-plugin/commands/model-command.md +8 -0
  218. package/tests/fixtures/sample-plugin/commands/nested/command-two.md +9 -0
  219. package/tests/fixtures/sample-plugin/commands/pattern-command.md +7 -0
  220. package/tests/fixtures/sample-plugin/commands/skill-command.md +7 -0
  221. package/tests/fixtures/sample-plugin/commands/todo-command.md +7 -0
  222. package/tests/fixtures/sample-plugin/hooks/hooks.json +156 -0
  223. package/tests/fixtures/sample-plugin/skills/skill-one/SKILL.md +6 -0
  224. package/tests/frontmatter.test.ts +20 -0
  225. package/tests/opencode-writer.test.ts +62 -0
  226. package/tsconfig.json +14 -0
@@ -0,0 +1,345 @@
1
+ #!/bin/bash
2
+
3
+ # Git Worktree Manager
4
+ # Handles creating, listing, switching, and cleaning up Git worktrees
5
+ # KISS principle: Simple, interactive, opinionated
6
+
7
+ set -e
8
+
9
+ # Colors for output
10
+ RED='\033[0;31m'
11
+ GREEN='\033[0;32m'
12
+ YELLOW='\033[1;33m'
13
+ BLUE='\033[0;34m'
14
+ NC='\033[0m' # No Color
15
+
16
+ # Get repo root
17
+ GIT_ROOT=$(git rev-parse --show-toplevel)
18
+ WORKTREE_DIR="$GIT_ROOT/.worktrees"
19
+
20
+ # Ensure .worktrees is in .gitignore
21
+ ensure_gitignore() {
22
+ if ! grep -q "^\.worktrees$" "$GIT_ROOT/.gitignore" 2>/dev/null; then
23
+ echo ".worktrees" >> "$GIT_ROOT/.gitignore"
24
+ fi
25
+ }
26
+
27
+ # Copy .env files from main repo to worktree
28
+ copy_env_files() {
29
+ local worktree_path="$1"
30
+
31
+ echo -e "${BLUE}Copying environment files...${NC}"
32
+
33
+ # Find all .env* files in root (excluding .env.example which should be in git)
34
+ local env_files=()
35
+ for f in "$GIT_ROOT"/.env*; do
36
+ if [[ -f "$f" ]]; then
37
+ local basename=$(basename "$f")
38
+ # Skip .env.example (that's typically committed to git)
39
+ if [[ "$basename" != ".env.example" ]]; then
40
+ env_files+=("$basename")
41
+ fi
42
+ fi
43
+ done
44
+
45
+ if [[ ${#env_files[@]} -eq 0 ]]; then
46
+ echo -e " ${YELLOW}ℹ️ No .env files found in main repository${NC}"
47
+ return
48
+ fi
49
+
50
+ local copied=0
51
+ for env_file in "${env_files[@]}"; do
52
+ local source="$GIT_ROOT/$env_file"
53
+ local dest="$worktree_path/$env_file"
54
+
55
+ if [[ -f "$dest" ]]; then
56
+ echo -e " ${YELLOW}⚠️ $env_file already exists, backing up to ${env_file}.backup${NC}"
57
+ cp "$dest" "${dest}.backup"
58
+ fi
59
+
60
+ cp "$source" "$dest"
61
+ echo -e " ${GREEN}✓ Copied $env_file${NC}"
62
+ copied=$((copied + 1))
63
+ done
64
+
65
+ echo -e " ${GREEN}✓ Copied $copied environment file(s)${NC}"
66
+ }
67
+
68
+ # Create a new worktree
69
+ create_worktree() {
70
+ local branch_name="$1"
71
+ local from_branch="${2:-main}"
72
+
73
+ if [[ -z "$branch_name" ]]; then
74
+ echo -e "${RED}Error: Branch name required${NC}"
75
+ exit 1
76
+ fi
77
+
78
+ local worktree_path="$WORKTREE_DIR/$branch_name"
79
+
80
+ # Check if worktree already exists
81
+ if [[ -d "$worktree_path" ]]; then
82
+ echo -e "${YELLOW}Worktree already exists at: $worktree_path${NC}"
83
+ echo -e "Switch to it instead? (y/n)"
84
+ read -r response
85
+ if [[ "$response" == "y" ]]; then
86
+ switch_worktree "$branch_name"
87
+ fi
88
+ return
89
+ fi
90
+
91
+ echo -e "${BLUE}Creating worktree: $branch_name${NC}"
92
+ echo " From: $from_branch"
93
+ echo " Path: $worktree_path"
94
+ echo ""
95
+ echo "Proceed? (y/n)"
96
+ read -r response
97
+
98
+ if [[ "$response" != "y" ]]; then
99
+ echo -e "${YELLOW}Cancelled${NC}"
100
+ return
101
+ fi
102
+
103
+ # Update main branch
104
+ echo -e "${BLUE}Updating $from_branch...${NC}"
105
+ git checkout "$from_branch"
106
+ git pull origin "$from_branch" || true
107
+
108
+ # Create worktree
109
+ mkdir -p "$WORKTREE_DIR"
110
+ ensure_gitignore
111
+
112
+ echo -e "${BLUE}Creating worktree...${NC}"
113
+ git worktree add -b "$branch_name" "$worktree_path" "$from_branch"
114
+
115
+ # Copy environment files
116
+ copy_env_files "$worktree_path"
117
+
118
+ echo -e "${GREEN}✓ Worktree created successfully!${NC}"
119
+ echo ""
120
+ echo "To switch to this worktree:"
121
+ echo -e "${BLUE}cd $worktree_path${NC}"
122
+ echo ""
123
+ }
124
+
125
+ # List all worktrees
126
+ list_worktrees() {
127
+ echo -e "${BLUE}Available worktrees:${NC}"
128
+ echo ""
129
+
130
+ if [[ ! -d "$WORKTREE_DIR" ]]; then
131
+ echo -e "${YELLOW}No worktrees found${NC}"
132
+ return
133
+ fi
134
+
135
+ local count=0
136
+ for worktree_path in "$WORKTREE_DIR"/*; do
137
+ if [[ -d "$worktree_path" && -d "$worktree_path/.git" ]]; then
138
+ count=$((count + 1))
139
+ local worktree_name=$(basename "$worktree_path")
140
+ local branch=$(git -C "$worktree_path" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
141
+
142
+ if [[ "$PWD" == "$worktree_path" ]]; then
143
+ echo -e "${GREEN}✓ $worktree_name${NC} (current) → branch: $branch"
144
+ else
145
+ echo -e " $worktree_name → branch: $branch"
146
+ fi
147
+ fi
148
+ done
149
+
150
+ if [[ $count -eq 0 ]]; then
151
+ echo -e "${YELLOW}No worktrees found${NC}"
152
+ else
153
+ echo ""
154
+ echo -e "${BLUE}Total: $count worktree(s)${NC}"
155
+ fi
156
+
157
+ echo ""
158
+ echo -e "${BLUE}Main repository:${NC}"
159
+ local main_branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
160
+ echo " Branch: $main_branch"
161
+ echo " Path: $GIT_ROOT"
162
+ }
163
+
164
+ # Switch to a worktree
165
+ switch_worktree() {
166
+ local worktree_name="$1"
167
+
168
+ if [[ -z "$worktree_name" ]]; then
169
+ list_worktrees
170
+ echo -e "${BLUE}Switch to which worktree? (enter name)${NC}"
171
+ read -r worktree_name
172
+ fi
173
+
174
+ local worktree_path="$WORKTREE_DIR/$worktree_name"
175
+
176
+ if [[ ! -d "$worktree_path" ]]; then
177
+ echo -e "${RED}Error: Worktree not found: $worktree_name${NC}"
178
+ echo ""
179
+ list_worktrees
180
+ exit 1
181
+ fi
182
+
183
+ echo -e "${GREEN}Switching to worktree: $worktree_name${NC}"
184
+ cd "$worktree_path"
185
+ echo -e "${BLUE}Now in: $(pwd)${NC}"
186
+ }
187
+
188
+ # Copy env files to an existing worktree (or current directory if in a worktree)
189
+ copy_env_to_worktree() {
190
+ local worktree_name="$1"
191
+ local worktree_path
192
+
193
+ if [[ -z "$worktree_name" ]]; then
194
+ # Check if we're currently in a worktree
195
+ local current_dir=$(pwd)
196
+ if [[ "$current_dir" == "$WORKTREE_DIR"/* ]]; then
197
+ worktree_path="$current_dir"
198
+ worktree_name=$(basename "$worktree_path")
199
+ echo -e "${BLUE}Detected current worktree: $worktree_name${NC}"
200
+ else
201
+ echo -e "${YELLOW}Usage: worktree-manager.sh copy-env [worktree-name]${NC}"
202
+ echo "Or run from within a worktree to copy to current directory"
203
+ list_worktrees
204
+ return 1
205
+ fi
206
+ else
207
+ worktree_path="$WORKTREE_DIR/$worktree_name"
208
+
209
+ if [[ ! -d "$worktree_path" ]]; then
210
+ echo -e "${RED}Error: Worktree not found: $worktree_name${NC}"
211
+ list_worktrees
212
+ return 1
213
+ fi
214
+ fi
215
+
216
+ copy_env_files "$worktree_path"
217
+ echo ""
218
+ }
219
+
220
+ # Clean up completed worktrees
221
+ cleanup_worktrees() {
222
+ if [[ ! -d "$WORKTREE_DIR" ]]; then
223
+ echo -e "${YELLOW}No worktrees to clean up${NC}"
224
+ return
225
+ fi
226
+
227
+ echo -e "${BLUE}Checking for completed worktrees...${NC}"
228
+ echo ""
229
+
230
+ local found=0
231
+ local to_remove=()
232
+
233
+ for worktree_path in "$WORKTREE_DIR"/*; do
234
+ if [[ -d "$worktree_path" && -d "$worktree_path/.git" ]]; then
235
+ local worktree_name=$(basename "$worktree_path")
236
+
237
+ # Skip if current worktree
238
+ if [[ "$PWD" == "$worktree_path" ]]; then
239
+ echo -e "${YELLOW}(skip) $worktree_name - currently active${NC}"
240
+ continue
241
+ fi
242
+
243
+ found=$((found + 1))
244
+ to_remove+=("$worktree_path")
245
+ echo -e "${YELLOW}• $worktree_name${NC}"
246
+ fi
247
+ done
248
+
249
+ if [[ $found -eq 0 ]]; then
250
+ echo -e "${GREEN}No inactive worktrees to clean up${NC}"
251
+ return
252
+ fi
253
+
254
+ echo ""
255
+ echo -e "Remove $found worktree(s)? (y/n)"
256
+ read -r response
257
+
258
+ if [[ "$response" != "y" ]]; then
259
+ echo -e "${YELLOW}Cleanup cancelled${NC}"
260
+ return
261
+ fi
262
+
263
+ echo -e "${BLUE}Cleaning up worktrees...${NC}"
264
+ for worktree_path in "${to_remove[@]}"; do
265
+ local worktree_name=$(basename "$worktree_path")
266
+ git worktree remove "$worktree_path" --force 2>/dev/null || true
267
+ echo -e "${GREEN}✓ Removed: $worktree_name${NC}"
268
+ done
269
+
270
+ # Clean up empty directory if nothing left
271
+ if [[ -z "$(ls -A "$WORKTREE_DIR" 2>/dev/null)" ]]; then
272
+ rmdir "$WORKTREE_DIR" 2>/dev/null || true
273
+ fi
274
+
275
+ echo -e "${GREEN}Cleanup complete!${NC}"
276
+ }
277
+
278
+ # Main command handler
279
+ main() {
280
+ local command="${1:-list}"
281
+
282
+ case "$command" in
283
+ create)
284
+ create_worktree "$2" "$3"
285
+ ;;
286
+ list|ls)
287
+ list_worktrees
288
+ ;;
289
+ switch|go)
290
+ switch_worktree "$2"
291
+ ;;
292
+ copy-env|env)
293
+ copy_env_to_worktree "$2"
294
+ ;;
295
+ cleanup|clean)
296
+ cleanup_worktrees
297
+ ;;
298
+ help)
299
+ show_help
300
+ ;;
301
+ *)
302
+ echo -e "${RED}Unknown command: $command${NC}"
303
+ echo ""
304
+ show_help
305
+ exit 1
306
+ ;;
307
+ esac
308
+ }
309
+
310
+ show_help() {
311
+ cat << EOF
312
+ Git Worktree Manager
313
+
314
+ Usage: worktree-manager.sh <command> [options]
315
+
316
+ Commands:
317
+ create <branch-name> [from-branch] Create new worktree (copies .env files automatically)
318
+ (from-branch defaults to main)
319
+ list | ls List all worktrees
320
+ switch | go [name] Switch to worktree
321
+ copy-env | env [name] Copy .env files from main repo to worktree
322
+ (if name omitted, uses current worktree)
323
+ cleanup | clean Clean up inactive worktrees
324
+ help Show this help message
325
+
326
+ Environment Files:
327
+ - Automatically copies .env, .env.local, .env.test, etc. on create
328
+ - Skips .env.example (should be in git)
329
+ - Creates .backup files if destination already exists
330
+ - Use 'copy-env' to refresh env files after main repo changes
331
+
332
+ Examples:
333
+ worktree-manager.sh create feature-login
334
+ worktree-manager.sh create feature-auth develop
335
+ worktree-manager.sh switch feature-login
336
+ worktree-manager.sh copy-env feature-login
337
+ worktree-manager.sh copy-env # copies to current worktree
338
+ worktree-manager.sh cleanup
339
+ worktree-manager.sh list
340
+
341
+ EOF
342
+ }
343
+
344
+ # Run
345
+ main "$@"
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: rclone
3
+ description: Upload, sync, and manage files across cloud storage providers using rclone. Use when uploading files (images, videos, documents) to S3, Cloudflare R2, Backblaze B2, Google Drive, Dropbox, or any S3-compatible storage. Triggers on "upload to S3", "sync to cloud", "rclone", "backup files", "upload video/image to bucket", or requests to transfer files to remote storage.
4
+ ---
5
+
6
+ # rclone File Transfer Skill
7
+
8
+ ## Setup Check (Always Run First)
9
+
10
+ Before any rclone operation, verify installation and configuration:
11
+
12
+ ```bash
13
+ # Check if rclone is installed
14
+ command -v rclone >/dev/null 2>&1 && echo "rclone installed: $(rclone version | head -1)" || echo "NOT INSTALLED"
15
+
16
+ # List configured remotes
17
+ rclone listremotes 2>/dev/null || echo "NO REMOTES CONFIGURED"
18
+ ```
19
+
20
+ ### If rclone is NOT installed
21
+
22
+ Guide the user to install:
23
+
24
+ ```bash
25
+ # macOS
26
+ brew install rclone
27
+
28
+ # Linux (script install)
29
+ curl https://rclone.org/install.sh | sudo bash
30
+
31
+ # Or via package manager
32
+ sudo apt install rclone # Debian/Ubuntu
33
+ sudo dnf install rclone # Fedora
34
+ ```
35
+
36
+ ### If NO remotes are configured
37
+
38
+ Walk the user through interactive configuration:
39
+
40
+ ```bash
41
+ rclone config
42
+ ```
43
+
44
+ **Common provider setup quick reference:**
45
+
46
+ | Provider | Type | Key Settings |
47
+ |----------|------|--------------|
48
+ | AWS S3 | `s3` | access_key_id, secret_access_key, region |
49
+ | Cloudflare R2 | `s3` | access_key_id, secret_access_key, endpoint (account_id.r2.cloudflarestorage.com) |
50
+ | Backblaze B2 | `b2` | account (keyID), key (applicationKey) |
51
+ | DigitalOcean Spaces | `s3` | access_key_id, secret_access_key, endpoint (region.digitaloceanspaces.com) |
52
+ | Google Drive | `drive` | OAuth flow (opens browser) |
53
+ | Dropbox | `dropbox` | OAuth flow (opens browser) |
54
+
55
+ **Example: Configure Cloudflare R2**
56
+ ```bash
57
+ rclone config create r2 s3 \
58
+ provider=Cloudflare \
59
+ access_key_id=YOUR_ACCESS_KEY \
60
+ secret_access_key=YOUR_SECRET_KEY \
61
+ endpoint=ACCOUNT_ID.r2.cloudflarestorage.com \
62
+ acl=private
63
+ ```
64
+
65
+ **Example: Configure AWS S3**
66
+ ```bash
67
+ rclone config create aws s3 \
68
+ provider=AWS \
69
+ access_key_id=YOUR_ACCESS_KEY \
70
+ secret_access_key=YOUR_SECRET_KEY \
71
+ region=us-east-1
72
+ ```
73
+
74
+ ## Common Operations
75
+
76
+ ### Upload single file
77
+ ```bash
78
+ rclone copy /path/to/file.mp4 remote:bucket/path/ --progress
79
+ ```
80
+
81
+ ### Upload directory
82
+ ```bash
83
+ rclone copy /path/to/folder remote:bucket/folder/ --progress
84
+ ```
85
+
86
+ ### Sync directory (mirror, deletes removed files)
87
+ ```bash
88
+ rclone sync /local/path remote:bucket/path/ --progress
89
+ ```
90
+
91
+ ### List remote contents
92
+ ```bash
93
+ rclone ls remote:bucket/
94
+ rclone lsd remote:bucket/ # directories only
95
+ ```
96
+
97
+ ### Check what would be transferred (dry run)
98
+ ```bash
99
+ rclone copy /path remote:bucket/ --dry-run
100
+ ```
101
+
102
+ ## Useful Flags
103
+
104
+ | Flag | Purpose |
105
+ |------|---------|
106
+ | `--progress` | Show transfer progress |
107
+ | `--dry-run` | Preview without transferring |
108
+ | `-v` | Verbose output |
109
+ | `--transfers=N` | Parallel transfers (default 4) |
110
+ | `--bwlimit=RATE` | Bandwidth limit (e.g., `10M`) |
111
+ | `--checksum` | Compare by checksum, not size/time |
112
+ | `--exclude="*.tmp"` | Exclude patterns |
113
+ | `--include="*.mp4"` | Include only matching |
114
+ | `--min-size=SIZE` | Skip files smaller than SIZE |
115
+ | `--max-size=SIZE` | Skip files larger than SIZE |
116
+
117
+ ## Large File Uploads
118
+
119
+ For videos and large files, use chunked uploads:
120
+
121
+ ```bash
122
+ # S3 multipart upload (automatic for >200MB)
123
+ rclone copy large_video.mp4 remote:bucket/ --s3-chunk-size=64M --progress
124
+
125
+ # Resume interrupted transfers
126
+ rclone copy /path remote:bucket/ --progress --retries=5
127
+ ```
128
+
129
+ ## Verify Upload
130
+
131
+ ```bash
132
+ # Check file exists and matches
133
+ rclone check /local/file remote:bucket/file
134
+
135
+ # Get file info
136
+ rclone lsl remote:bucket/path/to/file
137
+ ```
138
+
139
+ ## Troubleshooting
140
+
141
+ ```bash
142
+ # Test connection
143
+ rclone lsd remote:
144
+
145
+ # Debug connection issues
146
+ rclone lsd remote: -vv
147
+
148
+ # Check config
149
+ rclone config show remote
150
+ ```
@@ -0,0 +1,60 @@
1
+ #!/bin/bash
2
+ # rclone setup checker - verifies installation and configuration
3
+
4
+ set -e
5
+
6
+ echo "=== rclone Setup Check ==="
7
+ echo
8
+
9
+ # Check if rclone is installed
10
+ if command -v rclone >/dev/null 2>&1; then
11
+ echo "✓ rclone installed"
12
+ rclone version | head -1
13
+ echo
14
+ else
15
+ echo "✗ rclone NOT INSTALLED"
16
+ echo
17
+ echo "Install with:"
18
+ echo " macOS: brew install rclone"
19
+ echo " Linux: curl https://rclone.org/install.sh | sudo bash"
20
+ echo " or: sudo apt install rclone"
21
+ exit 1
22
+ fi
23
+
24
+ # Check for configured remotes
25
+ REMOTES=$(rclone listremotes 2>/dev/null || true)
26
+
27
+ if [ -z "$REMOTES" ]; then
28
+ echo "✗ No remotes configured"
29
+ echo
30
+ echo "Run 'rclone config' to set up a remote, or use:"
31
+ echo
32
+ echo " # Cloudflare R2"
33
+ echo " rclone config create r2 s3 provider=Cloudflare \\"
34
+ echo " access_key_id=KEY secret_access_key=SECRET \\"
35
+ echo " endpoint=ACCOUNT_ID.r2.cloudflarestorage.com"
36
+ echo
37
+ echo " # AWS S3"
38
+ echo " rclone config create aws s3 provider=AWS \\"
39
+ echo " access_key_id=KEY secret_access_key=SECRET region=us-east-1"
40
+ echo
41
+ exit 1
42
+ else
43
+ echo "✓ Configured remotes:"
44
+ echo "$REMOTES" | sed 's/^/ /'
45
+ echo
46
+ fi
47
+
48
+ # Test connectivity for each remote
49
+ echo "Testing remote connectivity..."
50
+ for remote in $REMOTES; do
51
+ remote_name="${remote%:}"
52
+ if rclone lsd "$remote" >/dev/null 2>&1; then
53
+ echo " ✓ $remote_name - connected"
54
+ else
55
+ echo " ✗ $remote_name - connection failed (check credentials)"
56
+ fi
57
+ done
58
+
59
+ echo
60
+ echo "=== Setup Complete ==="