appydave-tools 0.16.0 → 0.17.1

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 +27 -0
  5. data/CLAUDE.md +206 -51
  6. data/README.md +153 -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 +230 -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 +478 -0
  25. data/docs/vat/usage.md +574 -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,230 @@
1
+ # CODEX Recommendations - Review & Status
2
+
3
+ > Last updated: 2025-11-10
4
+ > Original recommendations provided by Codex (GPT-5) on 2025-11-09
5
+
6
+ This document captures Codex's architectural recommendations with implementation status and verdicts after engineering review.
7
+
8
+ ## Executive Summary
9
+
10
+ **Overall Assessment:** Mixed recommendations - some valuable, some outdated, some architecturally inappropriate.
11
+
12
+ **Implemented:** ✅ P3 (Filesystem fixtures)
13
+ **Rejected:** ❌ P0 (Configuration DI), P1 (RuboCop - already clean), P4 (method_missing removal)
14
+ **Deferred:** ⚠️ P2 (IO separation - CLI tool doesn't need it)
15
+ **Future Work:** 🔍 VAT Manifest bugs (valid technical debt)
16
+
17
+ ---
18
+
19
+ ## Priority Recommendations
20
+
21
+ ### ✅ P3: Standardize Filesystem Fixtures (IMPLEMENTED)
22
+
23
+ **Recommendation:** Extract `Dir.mktmpdir + FileUtils.mkdir_p` boilerplate into shared RSpec context.
24
+
25
+ **Status:** ✅ **Implemented** (2025-11-10)
26
+
27
+ **What was done:**
28
+ - Created `spec/support/vat_filesystem_helpers.rb` with shared contexts
29
+ - `include_context 'vat filesystem'` - provides temp_folder, projects_root, auto-cleanup
30
+ - `include_context 'vat filesystem with brands', brands: %w[appydave voz]` - adds brand path helpers
31
+ - Refactored 3 VAT specs: config_spec, project_resolver_spec, config_loader_spec
32
+ - All tests passing (149 examples, 0 failures)
33
+
34
+ **Benefits delivered:**
35
+ - Reduced duplication across VAT specs
36
+ - Centralized cleanup logic (safer tests)
37
+ - Easier to maintain and extend
38
+
39
+ ---
40
+
41
+ ### ❌ P1: RuboCop Cleanup (ALREADY COMPLETE)
42
+
43
+ **Recommendation:** Run `rubocop --auto-correct` to fix 93 offenses, track 15 manual fixes.
44
+
45
+ **Status:** ❌ **Obsolete** - RuboCop already clean
46
+
47
+ **Current state:**
48
+ ```bash
49
+ bundle exec rubocop
50
+ # => 103 files inspected, no offenses detected
51
+ ```
52
+
53
+ **Verdict:** The recommendations document was based on outdated codebase state. No action needed.
54
+
55
+ ---
56
+
57
+ ### ❌ P0: Configuration Dependency Injection (REJECTED)
58
+
59
+ **Recommendation:** Replace `allow_any_instance_of(SettingsConfig)` with dependency injection pattern:
60
+ ```ruby
61
+ # Proposed:
62
+ Config.projects_root(settings: custom_settings)
63
+ ```
64
+
65
+ **Status:** ❌ **Rejected** - Architecturally inappropriate
66
+
67
+ **Why rejected:**
68
+ 1. **Singleton pattern is correct for configuration** - Global config state is intentional
69
+ 2. **Breaking API change** - Would require threading `settings:` through entire call chain:
70
+ - `bin/vat` → `ProjectResolver` → `Config.brand_path` → `Config.projects_root`
71
+ - Every method needs new parameter (massive churn)
72
+ 3. **Tests work correctly** - `allow_any_instance_of` is intentionally allowed in `.rubocop.yml`
73
+ 4. **No real benefit** - Adds complexity without solving actual problems
74
+
75
+ **Codex's concern:** "Tests must stub *every* SettingsConfig instance"
76
+
77
+ **Reality:** This is fine. Configuration is a singleton. Testing strategy is appropriate.
78
+
79
+ **Lesson for Codex:** Dependency injection is not always superior to singleton patterns. Context matters. CLI tools with global configuration state don't benefit from DI complexity.
80
+
81
+ ---
82
+
83
+ ### ❌ P4: Remove method_missing from Configuration::Config (REJECTED)
84
+
85
+ **Recommendation:** Replace `method_missing` with explicit reader methods or `Forwardable`.
86
+
87
+ **Status:** ❌ **Rejected** - This is a design pattern, not a code smell
88
+
89
+ **Why rejected:**
90
+ 1. **Registry pattern** - `method_missing` enables dynamic configuration registration:
91
+ ```ruby
92
+ Config.register(:settings, SettingsConfig)
93
+ Config.register(:channels, ChannelsConfig)
94
+ Config.settings # Dynamic dispatch via method_missing
95
+ ```
96
+ 2. **Proper implementation** - Has `respond_to_missing?` (Ruby best practice ✅)
97
+ 3. **Good error handling** - Clear messages listing available configs
98
+ 4. **Plugin architecture** - Can add new configs without modifying `Config` class
99
+
100
+ **Codex's concern:** "Hides failures until runtime and complicates auto-complete"
101
+
102
+ **Reality:** This is a common Ruby pattern (Rails uses it extensively). The implementation is correct.
103
+
104
+ **Lesson for Codex:** `method_missing` is not inherently bad. When properly implemented with `respond_to_missing?` and clear errors, it enables powerful metaprogramming patterns. Don't dogmatically avoid it.
105
+
106
+ ---
107
+
108
+ ### ⚠️ P2: Decouple Terminal IO from VAT Services (DEFERRED)
109
+
110
+ **Recommendation:** Extract interactive prompts from `ProjectResolver.resolve` business logic.
111
+
112
+ **Codex's concern:** Interactive `puts`/`$stdin.gets` blocks automation agents.
113
+
114
+ **Status:** ⚠️ **Low priority** - Not needed for current use case
115
+
116
+ **Why deferred:**
117
+ 1. **CLI-only tool** - VAT is a command-line interface, not a library
118
+ 2. **Intentional UX** - Interactive prompts provide good user experience for ambiguous cases
119
+ 3. **No automation use cases** - Agents use exact project names, don't trigger prompts
120
+ 4. **Current code location:** `lib/appydave/tools/vat/project_resolver.rb:41-49`
121
+
122
+ **When to revisit:** If VAT needs programmatic API for automation tools, add non-interactive mode:
123
+ ```ruby
124
+ def resolve(brand, project_hint, interactive: true)
125
+ # Return all matches if !interactive (for automation)
126
+ end
127
+ ```
128
+
129
+ **Lesson for Codex:** Not all code needs maximum abstraction. CLI tools can have terminal IO in business logic if that's their primary use case.
130
+
131
+ ---
132
+
133
+ ## Architecture-Wide Observations
134
+
135
+ ### ✅ Valid Technical Debt: VAT Manifest Generator
136
+
137
+ **Issues identified (lines 116-125 in original doc):**
138
+
139
+ 1. **Archived projects silently dropped** - `collect_project_ids` rejects archived folder entirely
140
+ 2. **SSD paths lose grouping context** - Stores only `project_id`, not `range/project_id`
141
+ 3. **Heavy file detection shallow** - Only checks top-level, misses nested videos
142
+ 4. **Quadratic disk scanning** - Walks every file twice per project
143
+ 5. **Code duplication** - Standalone `bin/generate_manifest.rb` diverged from lib class
144
+
145
+ **Status:** 🔍 **Acknowledged as real bugs** - Worth investigating
146
+
147
+ **Note:** These are legitimate technical debt items, not style preferences. Recommend creating GitHub issues for tracking.
148
+
149
+ ---
150
+
151
+ ### ⚠️ CLI Standardization (Worth Auditing)
152
+
153
+ **Observation:** Not all bin scripts use `BaseAction` pattern consistently.
154
+
155
+ **Example:** `bin/gpt_context.rb` hand-rolls `OptionParser` instead of using `lib/appydave/tools/cli_actions/base_action.rb`.
156
+
157
+ **Status:** ⚠️ **Worth reviewing** for consistency
158
+
159
+ **Action:** Audit which CLI scripts follow standard patterns vs. custom implementations.
160
+
161
+ ---
162
+
163
+ ## Lessons Learned (for future Codex reviews)
164
+
165
+ ### What Codex got right:
166
+ 1. ✅ **Filesystem fixtures** - Practical refactoring with clear benefits
167
+ 2. ✅ **Manifest bugs** - Identified real logic issues worth fixing
168
+ 3. ✅ **CLI consistency** - Valid observation about pattern divergence
169
+
170
+ ### Where Codex was dogmatic:
171
+ 1. ❌ **Dependency injection everywhere** - Not all singletons need DI
172
+ 2. ❌ **Avoid method_missing** - Valid Ruby pattern when done correctly
173
+ 3. ❌ **Separate all IO** - CLI tools can mix IO with logic appropriately
174
+
175
+ ### What Codex missed:
176
+ 1. **Current state validation** - Recommended RuboCop fixes already applied
177
+ 2. **Cost/benefit analysis** - P0 config adapter would break entire API for minimal gain
178
+ 3. **Context awareness** - CLI tools have different constraints than libraries
179
+
180
+ ---
181
+
182
+ ## Conclusion
183
+
184
+ **Codex recommendations score: 4/10**
185
+
186
+ **Good advice:**
187
+ - Filesystem fixture extraction (implemented ✅)
188
+ - Manifest generator bugs (valid technical debt 🔍)
189
+ - CLI standardization audit (worth reviewing ⚠️)
190
+
191
+ **Bad advice:**
192
+ - Configuration dependency injection (wrong pattern for this use case ❌)
193
+ - Remove method_missing (misunderstands design pattern ❌)
194
+ - Outdated RuboCop recommendations (already fixed ❌)
195
+
196
+ **Key takeaway:** Mix pragmatic refactoring suggestions with dogmatic "purity" recommendations. Cherry-pick the valuable insights, reject the inappropriate ones.
197
+
198
+ ---
199
+
200
+ ## Implementation Notes
201
+
202
+ ### P3 Filesystem Fixtures - Details
203
+
204
+ **Files created:**
205
+ - `spec/support/vat_filesystem_helpers.rb`
206
+
207
+ **Shared contexts:**
208
+ ```ruby
209
+ # Basic fixture
210
+ include_context 'vat filesystem'
211
+ # => Provides: temp_folder, projects_root, auto-cleanup, config mocking
212
+
213
+ # With brand directories
214
+ include_context 'vat filesystem with brands', brands: %w[appydave voz]
215
+ # => Also provides: appydave_path, voz_path (auto-created)
216
+ ```
217
+
218
+ **Files refactored:**
219
+ - `spec/appydave/tools/vat/config_spec.rb` (removed 11 lines boilerplate)
220
+ - `spec/appydave/tools/vat/project_resolver_spec.rb` (removed 18 lines boilerplate)
221
+ - `spec/appydave/tools/vat/config_loader_spec.rb` (removed 9 lines boilerplate)
222
+
223
+ **Test results:**
224
+ - 149 VAT spec examples, 0 failures
225
+ - Coverage: 76.38% (2131/2790 lines)
226
+
227
+ ---
228
+
229
+ **Document maintained by:** AppyDave engineering team
230
+ **Next review:** After addressing VAT manifest bugs
@@ -0,0 +1,100 @@
1
+ # Development Documentation
2
+
3
+ This directory contains comprehensive guides for developing and extending appydave-tools.
4
+
5
+ ## Quick Links
6
+
7
+ ### Architecture Guides
8
+ - [CLI Architecture Patterns](./cli-architecture-patterns.md) - **START HERE** when creating new tools
9
+
10
+ ## Quick Pattern Selection
11
+
12
+ When creating a new CLI tool, use this quick reference:
13
+
14
+ ### Single Operation Tool → Pattern 1
15
+ **Use when:** Tool performs ONE operation with various options
16
+
17
+ **Examples:** `gpt_context`, `move_images`
18
+
19
+ **Key files:**
20
+ ```
21
+ bin/tool_name.rb # CLI executable
22
+ lib/appydave/tools/tool_name/
23
+ ├── options.rb # Options struct
24
+ └── main_logic.rb # Business logic
25
+ ```
26
+
27
+ **Read:** [Pattern 1 Details](./cli-architecture-patterns.md#pattern-1-single-command-tools)
28
+
29
+ ---
30
+
31
+ ### 2-5 Commands → Pattern 2
32
+ **Use when:** Tool has 2-5 related commands with simple routing
33
+
34
+ **Examples:** `subtitle_processor`, `configuration`
35
+
36
+ **Key files:**
37
+ ```
38
+ bin/tool_name.rb # CLI with inline routing
39
+ lib/appydave/tools/tool_name/
40
+ ├── command_one.rb # Command implementation
41
+ └── command_two.rb # Command implementation
42
+ ```
43
+
44
+ **Read:** [Pattern 2 Details](./cli-architecture-patterns.md#pattern-2-multi-command-with-inline-routing)
45
+
46
+ ---
47
+
48
+ ### 6+ Commands or Shared Patterns → Pattern 3
49
+ **Use when:** Tool has many commands OR commands share validation/execution patterns
50
+
51
+ **Examples:** `youtube_manager`
52
+
53
+ **Key files:**
54
+ ```
55
+ bin/tool_name.rb # CLI with BaseAction routing
56
+ lib/appydave/tools/
57
+ ├── cli_actions/
58
+ │ ├── base_action.rb # Shared base (already exists)
59
+ │ ├── tool_cmd_one_action.rb # Command as Action class
60
+ │ └── tool_cmd_two_action.rb
61
+ └── tool_name/
62
+ └── service.rb # Business logic
63
+ ```
64
+
65
+ **Read:** [Pattern 3 Details](./cli-architecture-patterns.md#pattern-3-multi-command-with-baseaction)
66
+
67
+ ---
68
+
69
+ ## Common Tasks
70
+
71
+ ### Adding a New Tool
72
+ 1. Choose pattern using [Decision Tree](./cli-architecture-patterns.md#decision-tree)
73
+ 2. Follow [Migration Guide](./cli-architecture-patterns.md#migration-guide)
74
+ 3. Register in `appydave-tools.gemspec`
75
+ 4. Document in `CLAUDE.md`
76
+
77
+ ### Understanding Existing Code
78
+ - See [Directory Structure](./cli-architecture-patterns.md#directory-structure)
79
+ - Review [Best Practices](./cli-architecture-patterns.md#best-practices)
80
+
81
+ ### Writing Tests
82
+ - Read [Testing Approach](./cli-architecture-patterns.md#testing-approach)
83
+ - No `require` statements in specs (handled by `spec_helper`)
84
+ - Test business logic, not CLI executables
85
+
86
+ ---
87
+
88
+ ## Philosophy
89
+
90
+ AppyDave Tools follows a **consolidated toolkit philosophy**:
91
+ - Multiple independent tools in one repository
92
+ - Each tool solves one specific problem
93
+ - Clear separation between CLI and business logic
94
+ - Business logic can be used programmatically (no CLI dependencies in `lib/`)
95
+
96
+ **Full Philosophy:** [Purpose and Philosophy](../purpose-and-philosophy.md)
97
+
98
+ ---
99
+
100
+ **Last updated:** 2025-11-08