appydave-tools 0.16.0 → 0.17.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +6 -0
  3. data/AGENTS.md +22 -0
  4. data/CHANGELOG.md +12 -0
  5. data/CLAUDE.md +206 -51
  6. data/README.md +144 -11
  7. data/bin/archive_project.rb +249 -0
  8. data/bin/configuration.rb +21 -1
  9. data/bin/generate_manifest.rb +357 -0
  10. data/bin/sync_from_ssd.rb +236 -0
  11. data/bin/vat +623 -0
  12. data/docs/README.md +169 -0
  13. data/docs/configuration/.env.example +19 -0
  14. data/docs/configuration/README.md +394 -0
  15. data/docs/configuration/channels.example.json +26 -0
  16. data/docs/configuration/settings.example.json +6 -0
  17. data/docs/development/CODEX-recommendations.md +123 -0
  18. data/docs/development/README.md +100 -0
  19. data/docs/development/cli-architecture-patterns.md +1604 -0
  20. data/docs/development/pattern-comparison.md +284 -0
  21. data/docs/prd-unified-brands-configuration.md +792 -0
  22. data/docs/project-brand-systems-analysis.md +934 -0
  23. data/docs/vat/dam-vision.md +123 -0
  24. data/docs/vat/session-summary-2025-11-09.md +297 -0
  25. data/docs/vat/usage.md +508 -0
  26. data/docs/vat/vat-testing-plan.md +801 -0
  27. data/lib/appydave/tools/configuration/models/brands_config.rb +238 -0
  28. data/lib/appydave/tools/configuration/models/config_base.rb +7 -0
  29. data/lib/appydave/tools/configuration/models/settings_config.rb +4 -0
  30. data/lib/appydave/tools/vat/config.rb +153 -0
  31. data/lib/appydave/tools/vat/config_loader.rb +91 -0
  32. data/lib/appydave/tools/vat/manifest_generator.rb +239 -0
  33. data/lib/appydave/tools/vat/project_listing.rb +198 -0
  34. data/lib/appydave/tools/vat/project_resolver.rb +132 -0
  35. data/lib/appydave/tools/vat/s3_operations.rb +560 -0
  36. data/lib/appydave/tools/version.rb +1 -1
  37. data/lib/appydave/tools.rb +9 -1
  38. data/package.json +1 -1
  39. metadata +57 -3
  40. data/docs/dam/overview.md +0 -28
@@ -0,0 +1,284 @@
1
+ # CLI Pattern Comparison
2
+
3
+ Quick reference for choosing the right pattern when creating new CLI tools.
4
+
5
+ ## Visual Comparison
6
+
7
+ ```
8
+ ┌─────────────────────────────────────────────────────────────────────┐
9
+ │ PATTERN 1: SINGLE-COMMAND │
10
+ ├─────────────────────────────────────────────────────────────────────┤
11
+ │ │
12
+ │ bin/tool.rb ──────────┐ │
13
+ │ │ │
14
+ │ lib/tools/tool/ ◄─────┘ │
15
+ │ ├── options.rb (Options struct) │
16
+ │ ├── logic.rb (Core business logic) │
17
+ │ └── support.rb (Supporting classes) │
18
+ │ │
19
+ │ Characteristics: │
20
+ │ • One operation, multiple options │
21
+ │ • Linear execution flow │
22
+ │ • Minimal routing logic │
23
+ │ │
24
+ │ Examples: gpt_context, move_images │
25
+ └─────────────────────────────────────────────────────────────────────┘
26
+
27
+ ┌─────────────────────────────────────────────────────────────────────┐
28
+ │ PATTERN 2: MULTI-COMMAND INLINE ROUTING │
29
+ ├─────────────────────────────────────────────────────────────────────┤
30
+ │ │
31
+ │ bin/tool.rb ──────────┬──────────┐ │
32
+ │ (CLI class) │ │ │
33
+ │ • clean_cmd() │ │ │
34
+ │ • join_cmd() │ │ │
35
+ │ │ │ │
36
+ │ lib/tools/tool/ ◄─────┴──────────┘ │
37
+ │ ├── clean.rb (Clean command) │
38
+ │ └── join.rb (Join command) │
39
+ │ │
40
+ │ Characteristics: │
41
+ │ • 2-5 related commands │
42
+ │ • Each command = method in CLI class │
43
+ │ • Dedicated OptionParser per command │
44
+ │ │
45
+ │ Examples: subtitle_processor, configuration │
46
+ └─────────────────────────────────────────────────────────────────────┘
47
+
48
+ ┌─────────────────────────────────────────────────────────────────────┐
49
+ │ PATTERN 3: MULTI-COMMAND BASEACTION │
50
+ ├─────────────────────────────────────────────────────────────────────┤
51
+ │ │
52
+ │ bin/tool.rb ──────────┬──────────┬──────────┐ │
53
+ │ (Routes commands) │ │ │ │
54
+ │ │ │ │ │
55
+ │ lib/cli_actions/ ◄────┴──────────┴──────────┘ │
56
+ │ ├── base_action.rb (Template method) │
57
+ │ ├── get_action.rb (Inherits BaseAction) │
58
+ │ └── update_action.rb (Inherits BaseAction) │
59
+ │ │ │ │ │
60
+ │ lib/tools/tool/ ◄─────┴──────────┴──────────┘ │
61
+ │ ├── service_one.rb (Shared business logic) │
62
+ │ └── service_two.rb │
63
+ │ │
64
+ │ Characteristics: │
65
+ │ • 6+ commands OR shared validation patterns │
66
+ │ • Each command = Action class │
67
+ │ • Template method enforces consistency │
68
+ │ │
69
+ │ Examples: youtube_manager │
70
+ └─────────────────────────────────────────────────────────────────────┘
71
+ ```
72
+
73
+ ## Decision Matrix
74
+
75
+ | Criteria | Pattern 1 | Pattern 2 | Pattern 3 |
76
+ |----------|-----------|-----------|-----------|
77
+ | **Number of commands** | 1 | 2-5 | 6+ |
78
+ | **Complexity** | Low | Medium | High |
79
+ | **Setup time** | Fast | Medium | Slower |
80
+ | **Scalability** | ❌ | ⚠️ | ✅ |
81
+ | **Consistency enforcement** | N/A | ❌ | ✅ |
82
+ | **Easy to understand** | ✅ | ✅ | ⚠️ |
83
+ | **Shared validation** | N/A | ❌ | ✅ |
84
+ | **Commands share logic** | N/A | ⚠️ | ✅ |
85
+
86
+ Legend:
87
+ - ✅ Excellent fit
88
+ - ⚠️ Works but not ideal
89
+ - ❌ Not applicable / Poor fit
90
+
91
+ ## File Count Comparison
92
+
93
+ ### Pattern 1 (gpt_context)
94
+ ```
95
+ bin/gpt_context.rb 1 file
96
+ lib/appydave/tools/gpt_context/
97
+ ├── options.rb 3 files
98
+ ├── file_collector.rb
99
+ └── output_handler.rb
100
+ ────────────────────────────────────────────
101
+ Total: 4 files
102
+ ```
103
+
104
+ ### Pattern 2 (subtitle_processor)
105
+ ```
106
+ bin/subtitle_processor.rb 1 file
107
+ lib/appydave/tools/subtitle_processor/
108
+ ├── clean.rb 2 files
109
+ └── join.rb
110
+ ────────────────────────────────────────────
111
+ Total: 3 files (2 commands)
112
+ ```
113
+
114
+ ### Pattern 3 (youtube_manager)
115
+ ```
116
+ bin/youtube_manager.rb 1 file
117
+ lib/appydave/tools/cli_actions/
118
+ ├── base_action.rb 3 files (shared)
119
+ ├── get_video_action.rb
120
+ └── update_video_action.rb
121
+ lib/appydave/tools/youtube_manager/
122
+ ├── get_video.rb 2+ files
123
+ └── update_video.rb
124
+ ────────────────────────────────────────────
125
+ Total: 6+ files (2 commands)
126
+ ```
127
+
128
+ ## Code Volume Comparison
129
+
130
+ For a tool with **2 commands** (get, update):
131
+
132
+ | Pattern | Lines of Code | Files | Boilerplate |
133
+ |---------|---------------|-------|-------------|
134
+ | Pattern 1 | N/A | N/A | Not applicable |
135
+ | Pattern 2 | ~150 LOC | 3 | Low |
136
+ | Pattern 3 | ~200 LOC | 6 | Medium |
137
+
138
+ **Recommendation:** Use Pattern 2 for 2-5 commands, switch to Pattern 3 at 6+
139
+
140
+ ## When to Refactor Between Patterns
141
+
142
+ ### Pattern 1 → Pattern 2
143
+ **Trigger:** Need to add a second command
144
+
145
+ **Effort:** Medium - Requires restructuring bin/ file
146
+
147
+ ### Pattern 2 → Pattern 3
148
+ **Trigger:**
149
+ - Command count reaches 6+
150
+ - Commands share significant validation logic
151
+ - Need consistent error handling across commands
152
+
153
+ **Effort:** Medium-High - Create BaseAction, convert methods to Action classes
154
+
155
+ ## Real-World Examples
156
+
157
+ ### Pattern 1: gpt_context
158
+ **Purpose:** Gather files for AI context
159
+
160
+ **Commands:** 1 (implicit)
161
+
162
+ **Options:**
163
+ - `-i` include patterns
164
+ - `-e` exclude patterns
165
+ - `-f` format
166
+ - `-o` output target
167
+
168
+ **Why Pattern 1?** Single purpose tool with many options but ONE operation
169
+
170
+ ---
171
+
172
+ ### Pattern 2: subtitle_processor
173
+ **Purpose:** Process SRT subtitle files
174
+
175
+ **Commands:** 2
176
+ - `clean` - Remove tags, normalize
177
+ - `join` - Merge multiple files
178
+
179
+ **Why Pattern 2?**
180
+ - Two distinct operations
181
+ - Each has different options
182
+ - Operations don't share validation logic
183
+
184
+ ---
185
+
186
+ ### Pattern 3: youtube_manager
187
+ **Purpose:** Manage YouTube videos via API
188
+
189
+ **Commands:** 2 (could expand to 6+)
190
+ - `get` - Fetch video details
191
+ - `update` - Update metadata
192
+
193
+ **Why Pattern 3?**
194
+ - Both require video ID validation
195
+ - Both use YouTube API authorization
196
+ - Future commands: `delete`, `upload`, `list`, `analyze`
197
+ - Shared pattern: authorize → validate → execute → report
198
+
199
+ ## Anti-Patterns to Avoid
200
+
201
+ ### ❌ Don't: Mix patterns
202
+ ```ruby
203
+ # bin/tool.rb
204
+ class ToolCLI
205
+ def initialize
206
+ @commands = {
207
+ 'clean' => method(:clean), # Pattern 2 style
208
+ 'join' => JoinAction.new # Pattern 3 style
209
+ }
210
+ end
211
+ end
212
+ ```
213
+
214
+ **Why bad?** Inconsistent command handling makes maintenance difficult
215
+
216
+ **Fix:** Choose one pattern and stick with it
217
+
218
+ ---
219
+
220
+ ### ❌ Don't: Put business logic in bin/
221
+ ```ruby
222
+ # bin/tool.rb (BAD)
223
+ def clean_subtitles(args)
224
+ content = File.read(args[0])
225
+ content.gsub!(/<u>/, '') # Business logic in CLI
226
+ File.write(args[1], content)
227
+ end
228
+ ```
229
+
230
+ **Why bad?** Can't reuse logic programmatically, hard to test
231
+
232
+ **Fix:** Move logic to lib/
233
+ ```ruby
234
+ # bin/tool.rb (GOOD)
235
+ def clean_subtitles(args)
236
+ cleaner = Appydave::Tools::SubtitleProcessor::Clean.new(file_path: args[0])
237
+ cleaner.clean
238
+ cleaner.write(args[1])
239
+ end
240
+
241
+ # lib/appydave/tools/subtitle_processor/clean.rb
242
+ class Clean
243
+ def clean
244
+ @content.gsub(/<u>/, '')
245
+ end
246
+ end
247
+ ```
248
+
249
+ ---
250
+
251
+ ### ❌ Don't: Use BaseAction for 1-2 commands
252
+ ```ruby
253
+ # Overkill for 2 commands
254
+ class GetAction < BaseAction; end
255
+ class UpdateAction < BaseAction; end
256
+ ```
257
+
258
+ **Why bad?** Unnecessary complexity, harder to understand
259
+
260
+ **Fix:** Use Pattern 2 for 2-5 commands
261
+
262
+ ---
263
+
264
+ ## Migration Checklist
265
+
266
+ When migrating an existing tool or creating a new one:
267
+
268
+ - [ ] Choose pattern using decision tree
269
+ - [ ] Create directory structure
270
+ - [ ] Implement executable in `bin/`
271
+ - [ ] Implement business logic in `lib/`
272
+ - [ ] Add `# frozen_string_literal: true`
273
+ - [ ] No `require` statements in `lib/` (except Ruby stdlib)
274
+ - [ ] No CLI code in `lib/` classes
275
+ - [ ] Write RSpec tests for business logic
276
+ - [ ] Register in `appydave-tools.gemspec`
277
+ - [ ] Document in `CLAUDE.md`
278
+ - [ ] Create `_doc.md` in module directory
279
+ - [ ] Test with `rake spec`
280
+ - [ ] Test CLI with `bin/tool.rb --help`
281
+
282
+ ---
283
+
284
+ **Last updated:** 2025-11-08