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.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/AGENTS.md +22 -0
- data/CHANGELOG.md +12 -0
- data/CLAUDE.md +206 -51
- data/README.md +144 -11
- data/bin/archive_project.rb +249 -0
- data/bin/configuration.rb +21 -1
- data/bin/generate_manifest.rb +357 -0
- data/bin/sync_from_ssd.rb +236 -0
- data/bin/vat +623 -0
- data/docs/README.md +169 -0
- data/docs/configuration/.env.example +19 -0
- data/docs/configuration/README.md +394 -0
- data/docs/configuration/channels.example.json +26 -0
- data/docs/configuration/settings.example.json +6 -0
- data/docs/development/CODEX-recommendations.md +123 -0
- data/docs/development/README.md +100 -0
- data/docs/development/cli-architecture-patterns.md +1604 -0
- data/docs/development/pattern-comparison.md +284 -0
- data/docs/prd-unified-brands-configuration.md +792 -0
- data/docs/project-brand-systems-analysis.md +934 -0
- data/docs/vat/dam-vision.md +123 -0
- data/docs/vat/session-summary-2025-11-09.md +297 -0
- data/docs/vat/usage.md +508 -0
- data/docs/vat/vat-testing-plan.md +801 -0
- data/lib/appydave/tools/configuration/models/brands_config.rb +238 -0
- data/lib/appydave/tools/configuration/models/config_base.rb +7 -0
- data/lib/appydave/tools/configuration/models/settings_config.rb +4 -0
- data/lib/appydave/tools/vat/config.rb +153 -0
- data/lib/appydave/tools/vat/config_loader.rb +91 -0
- data/lib/appydave/tools/vat/manifest_generator.rb +239 -0
- data/lib/appydave/tools/vat/project_listing.rb +198 -0
- data/lib/appydave/tools/vat/project_resolver.rb +132 -0
- data/lib/appydave/tools/vat/s3_operations.rb +560 -0
- data/lib/appydave/tools/version.rb +1 -1
- data/lib/appydave/tools.rb +9 -1
- data/package.json +1 -1
- metadata +57 -3
- data/docs/dam/overview.md +0 -28
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# CODEX Recommendations
|
|
2
|
+
|
|
3
|
+
> Last updated: 2025-11-09 13:36:08 UTC
|
|
4
|
+
> Maintenance note: whenever files outside this document change, review them and reflect any new patterns/risks here so the recommendations stay authoritative.
|
|
5
|
+
|
|
6
|
+
Guide created by Codex (GPT-5) to capture near-term cleanups and deeper refactors that will make `appydave-tools` easier to extend and test.
|
|
7
|
+
|
|
8
|
+
## Snapshot
|
|
9
|
+
|
|
10
|
+
- **Primary friction**: global configuration access makes VAT objects hard to test, forcing `allow_any_instance_of` overrides in specs such as `spec/appydave/tools/vat/config_spec.rb:6`.
|
|
11
|
+
- **Secondary friction**: command classes mix terminal IO with core logic (see `lib/appydave/tools/vat/project_resolver.rb:19-50`), which complicates automation and reuse.
|
|
12
|
+
- **Tooling debt**: RuboCop is configured (`.rubocop.yml`) but not enforced; the current run emits 108 offenses (93 auto-correctable per Claude logs) and engineers silence cops instead of resolving root causes.
|
|
13
|
+
|
|
14
|
+
## Priority Map
|
|
15
|
+
|
|
16
|
+
| Order | Theme | Why it matters |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| P0 | Make configuration/services injectable | Unlocks clean tests, eliminates global stubs, and keeps future CLIs composable. |
|
|
19
|
+
| P1 | Re-enable effective lint/test automation | 93 auto-fixes are “free”; the remaining 15 surface real architecture problems that deserve explicit debt tracking. |
|
|
20
|
+
| P2 | Separate IO from business logic in CLI helpers | Enables automation agents (Claude) and humans to reuse services without TTY prompts. |
|
|
21
|
+
| P3 | Standardize filesystem fixtures | Reduces the bespoke `Dir.mktmpdir` + `FileUtils` boilerplate sprinkled through VAT specs; faster, safer tests. |
|
|
22
|
+
|
|
23
|
+
## Detailed Recommendations
|
|
24
|
+
|
|
25
|
+
### 1. Introduce configuration adapters
|
|
26
|
+
|
|
27
|
+
- **Problem**: `Appydave::Tools::Vat::Config.projects_root` reaches directly into `Configuration::Config.settings` (`lib/appydave/tools/vat/config.rb:13-21`), so specs must stub *every* `SettingsConfig` instance (`spec/appydave/tools/vat/config_spec.rb:14`).
|
|
28
|
+
- **Action**:
|
|
29
|
+
1. Create a lightweight `SettingsProvider` (duck-typed or interface module) that exposes `video_projects_root`.
|
|
30
|
+
2. Update VAT entry points to accept `settings:` or `config:` keyword args defaulting to the singleton, e.g. `def projects_root(settings: default_settings)`.
|
|
31
|
+
3. Provide a `Config.with_settings(temp_settings) { ... }` helper for specs and CLI overrides.
|
|
32
|
+
- **Impact**: RSpec can inject fakes without `allow_any_instance_of`; RuboCop warning disappears with no cop disable required.
|
|
33
|
+
|
|
34
|
+
### 2. Capture the remaining RuboCop debt deliberately
|
|
35
|
+
|
|
36
|
+
- **Problem**: Engineers currently choose between “ignore 108 offenses” or “disable cops,” which erodes lint value. `.rubocop.yml` already sets generous limits (200-char lines, spec exclusions), so remaining issues are meaningful.
|
|
37
|
+
- **Action plan**:
|
|
38
|
+
1. Run `bundle exec rubocop --auto-correct` and commit format-only fixes (expect ~93 files touched).
|
|
39
|
+
2. For the 15 blocking offenses, open a short-lived spreadsheet (or GH issue tracker) that records *cop → file → fix owner*. This keeps the queue visible without blocking merges.
|
|
40
|
+
3. Add a CI step (GitHub Action or Circle job) that executes `bundle exec rubocop` plus `bundle exec rake spec`, failing PRs that reintroduce offenses.
|
|
41
|
+
- **Fallback**: If any `allow_any_instance_of` remains after Step 1, convert it to the adapter pattern described above; avoid new `rubocop:disable` directives unless there’s a written justification beside them.
|
|
42
|
+
|
|
43
|
+
### 3. Decouple terminal IO from VAT services
|
|
44
|
+
|
|
45
|
+
- **Problem**: `ProjectResolver.resolve` blends filesystem globbing with interactive prompts (`puts`/`$stdin.gets`, `lib/appydave/tools/vat/project_resolver.rb:41-48`). These prompts block automation agents, and the logic cannot be reused inside other CLIs or tests without stubbing global IO.
|
|
46
|
+
- **Action**:
|
|
47
|
+
1. Extract the pure resolution logic so it always returns a result set (possibly multi-match) and never prints.
|
|
48
|
+
2. Create an `InteractiveResolver` (or CLI layer) that takes `io_in:`/`io_out:` and handles messaging/selection.
|
|
49
|
+
3. Update `bin/vat` commands to use the interactive wrapper; specs can cover both the pure resolver and the IO adapter with deterministic streams.
|
|
50
|
+
- **Bonus**: While refactoring, move the repeated `Dir.glob` filtering into a shared helper (e.g., `Projects::Scanner`) so CLAUDE/Code agents can reuse it for listing commands.
|
|
51
|
+
|
|
52
|
+
### 4. Standardize filesystem fixtures
|
|
53
|
+
|
|
54
|
+
- **Observation**: VAT specs repeatedly open temp dirs, `mkdir_p` brand/project skeletons, and remember to clean up (see blocks at `spec/appydave/tools/vat/config_spec.rb:22-178` and `spec/appydave/tools/vat/project_resolver_spec.rb:9-70`). Minor mistakes (missing cleanup, duplicated brand shortcuts) cause flaky tests locally.
|
|
55
|
+
- **Action**:
|
|
56
|
+
1. Add `spec/support/filesystem_helpers.rb` with helpers like `with_projects_root(brands: %w[appydave]) { |root| ... }`.
|
|
57
|
+
2. Include the helper in `spec/spec_helper.rb`, then convert VAT specs to the helper to remove boilerplate and centralize cleanup.
|
|
58
|
+
3. Consider shipping seeded sample trees under `spec/samples/video-projects` for regression-style tests that need deeper structures.
|
|
59
|
+
|
|
60
|
+
### 5. Harden `Configuration::Config`
|
|
61
|
+
|
|
62
|
+
- **Problem**: `Configuration::Config` uses `method_missing` to expose registered configs (`lib/appydave/tools/configuration/config.rb:31-39`), which hides failures until runtime and complicates auto-complete.
|
|
63
|
+
- **Action**:
|
|
64
|
+
1. Replace `method_missing` with explicit reader methods or `Forwardable`, or at minimum raise descriptive errors that list the registered keys (`configurations.keys`).
|
|
65
|
+
2. Expose a `fetch(:settings)` API that returns nil-friendly values for easier dependency injection.
|
|
66
|
+
3. Document the registration flow in `docs/development/cli-architecture-patterns.md` so new tools follow the same adapter approach.
|
|
67
|
+
|
|
68
|
+
### 6. Bake the plan into docs & automation
|
|
69
|
+
|
|
70
|
+
- Add a **Claude Impact** note whenever a CLI behavior changes (per `AGENTS.md`), and link back to this file so the agent knows why tests may require new prompts.
|
|
71
|
+
- Create a short checklist in `docs/development/README.md` (“Before merging VAT changes: run rubocop, run VAT specs, update configuration adapters”) to keep the recommendations visible.
|
|
72
|
+
|
|
73
|
+
## Architecture-Wide Opportunities
|
|
74
|
+
|
|
75
|
+
### CLI boundaries & shared ergonomics
|
|
76
|
+
|
|
77
|
+
- `bin/gpt_context.rb:15-88` hand-rolls its `OptionParser` setup even though `lib/appydave/tools/cli_actions/base_action.rb:8-44` already codifies a reusable CLI contract. Promote `BaseAction` to the default entrypoint for every CLI (gpt_context, prompt_tools, subtitle_processor, Ito/AI-TLDR helpers) so options, `-h`, and validation logic stay consistent.
|
|
78
|
+
- Extract a `Cli::Runner` that discovers actions via naming (`Appydave::Tools::<Tool>::Cli::<Command>`) and wire it into each `bin/*` – this keeps future tools (Hey Ito, BMAD, etc.) aligned without duplicating boilerplate.
|
|
79
|
+
- Add smoke specs that exercise each executable via `CLIHelpers.run('bin/gpt_context.rb --help')` to catch option regressions and ensure Guard/Claude can rely on deterministic output.
|
|
80
|
+
|
|
81
|
+
### GptContext as a reusable service
|
|
82
|
+
|
|
83
|
+
- `lib/appydave/tools/gpt_context/file_collector.rb:12-77` mutates global process state with `FileUtils.cd` and prints the working directory from inside the constructor. Replace this with `Dir.chdir(working_dir) { … }` blocks and pass a logger so the class can run quietly when invoked programmatically.
|
|
84
|
+
- The collector silently reads every match into memory; for large worktrees (Ito + AppyDave), the CLI will thrash. Consider yielding per-file chunks to a stream-aware `OutputHandler` so future AI agents can request incremental context.
|
|
85
|
+
- Normalize include/exclude matching by compiling glob patterns once (e.g., using `File::FNM_EXTGLOB`) to avoid repeated `Dir.glob` passes, and consider exposing a dry-run mode that returns candidate file lists for Claude prompt generation.
|
|
86
|
+
|
|
87
|
+
### Subtitle pipeline robustness
|
|
88
|
+
|
|
89
|
+
- `lib/appydave/tools/subtitle_processor/clean.rb:9-95` combines parsing, normalization, and IO side-effects. Break this into (1) a pure parser that operates on enumerables, (2) a formatter that emits SRT or VTT, and (3) a CLI wrapper for file IO. Doing so makes it easier to add BMAD-specific filters (emoji stripping, custom timelines) without forking the entire class.
|
|
90
|
+
- Add quick fuzz tests that feed malformed SRT snippets to ensure the parser fails fast instead of silently swallowing lines.
|
|
91
|
+
- Document the workflow in `docs/tools/subtitle_processor.md` (currently absent) so collaborators understand how to integrate Hey Ito or AI-TLDR narration scripts.
|
|
92
|
+
|
|
93
|
+
### YouTube automation hardening
|
|
94
|
+
|
|
95
|
+
- `lib/appydave/tools/youtube_manager/youtube_base.rb:8-17` constructs a Google API client on every command invocation. Cache the service in a memoized factory or inject it so tests can supply a fake client.
|
|
96
|
+
- `lib/appydave/tools/youtube_manager/authorization.rb:9-54` shells out a WEBrick server and prints instructions; wrap this interaction in a strategy object so Claude can be told “launch headless auth” versus “prompt operator David Cruwys.”
|
|
97
|
+
- Build retries and quota awareness around `@service.update_video` (`lib/appydave/tools/youtube_manager/update_video.rb:31-43`) so Ito/BMAD batch jobs can recover from `Google::Apis::RateLimitError` instead of crashing half-way through.
|
|
98
|
+
|
|
99
|
+
### Configuration & type safety
|
|
100
|
+
|
|
101
|
+
- `lib/appydave/tools/types/base_model.rb` + siblings provide a mini ActiveModel alternative but many tools now depend directly on `ActiveModel` (see `appydave-tools.gemspec:28-34`). Decide whether to lean fully into ActiveModel validations (Ruby 3-ready) or keep the custom types. If the latter, add coercion specs to lock down behavior for indifferent hashes (useful for AI ingestion).
|
|
102
|
+
- Expose typed settings objects per feature (`VatSettings`, `YoutubeSettings`) that wrap `SettingsConfig` so each CLI only sees the keys it needs. This makes future schema evolution (e.g., extra Ito endpoints) less risky.
|
|
103
|
+
|
|
104
|
+
### Testing & observability
|
|
105
|
+
|
|
106
|
+
- `spec/spec_helper.rb:5-41` always bootstraps SimpleCov/WebMock, which slows down iterative TDD. Guard these with ENV flags (`COVERAGE=true`, `ALLOW_NET=true`) so developers can opt into faster loops when needed.
|
|
107
|
+
- Add contract tests for each CLI that ensure stdout/stderr remain machine-readable—critical for Claude pipelines documented in `CLAUDE.md`. Snapshot testing (via `rspec-snapshot`) works well for command help text.
|
|
108
|
+
- Extend logging: `k_log` is only used inside configuration; wire it into VAT, GPT Context, and YouTube workflows so all tools share the same structured logging style. Include context like `brand=appydave` or `persona=Hey Ito` to help when multiple personas (Ito, AI-TLDR, AppyDave, BMAD) run jobs concurrently.
|
|
109
|
+
|
|
110
|
+
### Platform & dependency strategy
|
|
111
|
+
|
|
112
|
+
- `appydave-tools.gemspec:11-37` still declares `required_ruby_version >= 2.7`, but dependencies such as `activemodel ~> 8` and `google-api-client` are already Ruby 3-first. Move the baseline to Ruby 3.2 (or 3.3) so pattern matching, numbered parameters, and improved GC become available.
|
|
113
|
+
- Once on Ruby 3.2+, enable YJIT in local scripts (document via `docs/development/README.md`) to speed up large jobs like GPT context scans.
|
|
114
|
+
- Create a `Dependabot` (or Renovate) config so gem bumps don’t surprise automation—Ito and Hey Ito will benefit from predictable upgrade cadences. Pair this with a changelog checklist entry reminding you to note **Claude Impact** when APIs change.
|
|
115
|
+
|
|
116
|
+
## Suggested Next Steps
|
|
117
|
+
|
|
118
|
+
1. **Week 1**: Implement the configuration adapter + filesystem helper, convert VAT specs, and remove the `RSpec/AnyInstance` disable comment.
|
|
119
|
+
2. **Week 2**: Run RuboCop auto-correct, triage the residual offenses, and wire RuboCop/spec runs into CI.
|
|
120
|
+
3. **Week 3**: Refactor `ProjectResolver` IO separation and document the new contract for CLI callers.
|
|
121
|
+
4. **Week 4**: Revisit other CLIs (`youtube_manager`, `subtitle_processor`) and apply the same adapter/IO patterns once VAT proves the approach.
|
|
122
|
+
|
|
123
|
+
Ping Codex if you’d like guidance on scoping or sequencing—happy to help break these down into actionable tickets.
|
|
@@ -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
|