appydave-tools 0.15.0 → 0.16.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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/CLAUDE.md +113 -29
  4. data/README.md +262 -86
  5. data/bin/subtitle_manager.rb +18 -12
  6. data/bin/subtitle_processor.rb +158 -0
  7. data/docs/archive/codebase-audit-2025-01.md +424 -0
  8. data/docs/archive/documentation-framework-proposal.md +808 -0
  9. data/docs/archive/purpose-and-philosophy.md +110 -0
  10. data/docs/archive/test-coverage-quick-wins.md +342 -0
  11. data/docs/archive/tool-discovery.md +199 -0
  12. data/docs/archive/tool-documentation-analysis.md +592 -0
  13. data/docs/tools/bank-reconciliation.md +269 -0
  14. data/docs/tools/cli-actions.md +444 -0
  15. data/docs/tools/configuration.md +329 -0
  16. data/docs/{usage → tools}/gpt-context.md +118 -7
  17. data/docs/tools/index.md +324 -0
  18. data/docs/tools/move-images.md +295 -0
  19. data/docs/tools/name-manager.md +322 -0
  20. data/docs/tools/prompt-tools.md +209 -0
  21. data/docs/tools/subtitle-processor.md +242 -0
  22. data/docs/tools/youtube-automation.md +258 -0
  23. data/docs/tools/youtube-manager.md +248 -0
  24. data/lib/appydave/tools/{subtitle_manager → subtitle_processor}/clean.rb +1 -1
  25. data/lib/appydave/tools/{subtitle_manager → subtitle_processor}/join.rb +5 -2
  26. data/lib/appydave/tools/version.rb +1 -1
  27. data/lib/appydave/tools.rb +2 -4
  28. data/package.json +1 -1
  29. metadata +29 -12
  30. data/lib/mj-paste-test/main.rb +0 -35
  31. data/lib/mj-paste-test/prompts.txt +0 -18
  32. data/lib/mj-paste-test/readme-leonardo.md +0 -0
  33. /data/lib/appydave/tools/{subtitle_manager → subtitle_processor}/_doc-clean.md +0 -0
  34. /data/lib/appydave/tools/{subtitle_manager → subtitle_processor}/_doc-join.md +0 -0
  35. /data/lib/appydave/tools/{subtitle_manager → subtitle_processor}/_doc-todo.md +0 -0
@@ -0,0 +1,322 @@
1
+ # Name Manager
2
+
3
+ Parse and generate project names following AppyDave naming conventions and channel codes.
4
+
5
+ ## What It Does
6
+
7
+ **Name Manager** handles project naming and parsing:
8
+
9
+ - Parses project names following AppyDave conventions
10
+ - Generates standardized project names
11
+ - Extracts sequence numbers, channel codes, and project descriptors
12
+ - Validates names against configured channels
13
+ - Enforces naming consistency across projects
14
+
15
+ ## Naming Convention
16
+
17
+ AppyDave project names follow this pattern:
18
+
19
+ ```
20
+ {sequence}-{channel-code}-{project-name}
21
+ ```
22
+
23
+ **Examples**:
24
+ - `b60-appydave-intro-to-system-design`
25
+ - Sequence: `b60`
26
+ - Channel: `appydave`
27
+ - Project: `intro-to-system-design`
28
+
29
+ - `b61-aitldr-ai-graphics-basics`
30
+ - Sequence: `b61`
31
+ - Channel: `aitldr`
32
+ - Project: `ai-graphics-basics`
33
+
34
+ - `50-quick-tip`
35
+ - Sequence: `50`
36
+ - Channel: (none - uses default)
37
+ - Project: `quick-tip`
38
+
39
+ ## How to Use
40
+
41
+ ### Parse Project Name
42
+
43
+ ```ruby
44
+ require 'appydave/tools'
45
+
46
+ # Parse a project filename
47
+ project = Appydave::Tools::NameManager::ProjectName.new('b60-appydave-intro-to-coding.md')
48
+
49
+ project.sequence # => "b60"
50
+ project.channel_code # => "appydave"
51
+ project.project_name # => "intro-to-coding"
52
+ project.generate_name # => "b60-appydave-intro-to-coding"
53
+ ```
54
+
55
+ ### Generate Project Name
56
+
57
+ ```ruby
58
+ require 'appydave/tools'
59
+
60
+ project = Appydave::Tools::NameManager::ProjectName.new('b60-appydave-intro-to-coding.md')
61
+
62
+ # Set new values
63
+ project.sequence = 'b75'
64
+ project.project_name = 'advanced-system-design'
65
+
66
+ # Generate updated name
67
+ new_name = project.generate_name
68
+ # => "b75-appydave-advanced-system-design"
69
+ ```
70
+
71
+ ### Set Channel Code
72
+
73
+ ```ruby
74
+ require 'appydave/tools'
75
+
76
+ project = Appydave::Tools::NameManager::ProjectName.new('b60-intro-to-coding.md')
77
+
78
+ # Set channel code (validates against configured channels)
79
+ project.channel_code = 'appydave'
80
+
81
+ project.generate_name
82
+ # => "b60-appydave-intro-to-coding"
83
+ ```
84
+
85
+ ## Use Cases for AI Agents
86
+
87
+ ### 1. Project Inventory Generation
88
+ ```ruby
89
+ # AI parses all project files
90
+ projects = Dir.glob('**/*.md').map do |file|
91
+ Appydave::Tools::NameManager::ProjectName.new(file)
92
+ end
93
+
94
+ # Generates inventory with sequence, channel, project name
95
+ projects.each do |p|
96
+ puts "#{p.sequence} (#{p.channel_code}): #{p.project_name}"
97
+ end
98
+ ```
99
+ **AI discovers**: Project structure, naming patterns, distribution across channels. Can generate comprehensive inventory.
100
+
101
+ ### 2. Channel Migration
102
+ ```ruby
103
+ # AI renames projects when moving between channels
104
+ # From appydave to aitldr
105
+ project = Appydave::Tools::NameManager::ProjectName.new('b60-appydave-old-project.md')
106
+ project.channel_code = 'aitldr'
107
+ new_name = project.generate_name
108
+ # => "b60-aitldr-old-project"
109
+ ```
110
+ **AI discovers**: Channel organization. Can systematically rename projects during migrations.
111
+
112
+ ### 3. Sequence Number Management
113
+ ```ruby
114
+ # AI analyzes sequence numbers
115
+ # Identifies gaps, next available number
116
+ projects = Dir.glob('b*.md').map { |f| ProjectName.new(f) }
117
+ sequences = projects.map(&:sequence).sort
118
+
119
+ # Find next sequence number
120
+ last_sequence = sequences.last # "b75"
121
+ next_sequence = "b#{last_sequence.sub(/^b/, '').to_i + 1}"
122
+ # => "b76"
123
+ ```
124
+ **AI discovers**: Sequence patterns, gaps. Can manage project numbering scheme.
125
+
126
+ ### 4. Naming Validation
127
+ ```ruby
128
+ # AI validates all projects follow naming convention
129
+ Dir.glob('**/*').each do |file|
130
+ project = ProjectName.new(file)
131
+ if project.sequence.nil? || project.project_name.nil?
132
+ puts "Invalid name: #{file}"
133
+ end
134
+ end
135
+ ```
136
+ **AI discovers**: Naming compliance. Can identify and fix naming violations.
137
+
138
+ ### 5. Multi-Channel Reporting
139
+ ```ruby
140
+ # AI generates reports by channel
141
+ channels = {}
142
+ Dir.glob('**/*.md').each do |file|
143
+ project = ProjectName.new(file)
144
+ channels[project.channel_code] ||= []
145
+ channels[project.channel_code] << project
146
+ end
147
+
148
+ channels.each do |channel, projects|
149
+ puts "#{channel}: #{projects.length} projects"
150
+ end
151
+ ```
152
+ **AI discovers**: Projects per channel. Can generate channel-specific reports.
153
+
154
+ ### 6. Bulk Renaming
155
+ ```ruby
156
+ # AI orchestrates renaming operation
157
+ # When naming convention changes
158
+ Dir.glob('**/*.md').each do |old_file|
159
+ project = ProjectName.new(old_file)
160
+ # Apply new naming rules
161
+ new_name = "#{project.sequence}-#{project.channel_code}-#{project.project_name.upcase}.md"
162
+ File.rename(old_file, new_name) if old_file != new_name
163
+ end
164
+ ```
165
+ **AI discovers**: Current naming scheme. Can apply new conventions systematically.
166
+
167
+ ### 7. Project Organization
168
+ ```ruby
169
+ # AI organizes projects by channel
170
+ Dir.glob('**/*.md').each do |file|
171
+ project = ProjectName.new(file)
172
+ channel_dir = "projects/#{project.channel_code}"
173
+ FileUtils.mkdir_p(channel_dir)
174
+ FileUtils.mv(file, "#{channel_dir}/#{project.generate_name}.md")
175
+ end
176
+ ```
177
+ **AI discovers**: Naming patterns. Can reorganize by channel using names.
178
+
179
+ ### 8. Name Conflict Detection
180
+ ```ruby
181
+ # AI identifies duplicate project names
182
+ names = Dir.glob('**/*').map { |f| ProjectName.new(f).generate_name }
183
+ duplicates = names.group_by { |n| n }.select { |_, v| v.length > 1 }
184
+
185
+ duplicates.each do |name, count|
186
+ puts "Duplicate: #{name} (#{count} files)"
187
+ end
188
+ ```
189
+ **AI discovers**: Naming collisions. Can identify and help resolve duplicates.
190
+
191
+ ### 9. Sequence Gap Analysis
192
+ ```ruby
193
+ # AI analyzes sequence number coverage
194
+ projects = Dir.glob('b*.md').map { |f| ProjectName.new(f) }
195
+ sequences = projects.map { |p| p.sequence.sub(/^b/, '').to_i }.sort
196
+
197
+ gaps = []
198
+ (sequences.first..sequences.last).each do |n|
199
+ gaps << n unless sequences.include?(n)
200
+ end
201
+
202
+ puts "Gaps in sequence: #{gaps.inspect}"
203
+ ```
204
+ **AI discovers**: Sequence coverage. Can identify missing numbers for reuse or filling.
205
+
206
+ ### 10. Naming Standardization
207
+ ```ruby
208
+ # AI ensures all names follow convention
209
+ # lowercase, hyphenated, valid channels
210
+ Dir.glob('**/*').each do |file|
211
+ project = ProjectName.new(file)
212
+ standardized_name = project.generate_name.downcase.gsub(/\s+/, '-')
213
+ new_path = "#{File.dirname(file)}/#{standardized_name}#{File.extname(file)}"
214
+ File.rename(file, new_path) if file != new_path
215
+ end
216
+ ```
217
+ **AI discovers**: Naming inconsistencies. Can standardize all names.
218
+
219
+ ## Class Reference
220
+
221
+ ### ProjectName
222
+
223
+ ```ruby
224
+ class ProjectName
225
+ # Parse project filename
226
+ def initialize(file_name)
227
+ end
228
+
229
+ # Get/set attributes
230
+ attr_accessor :sequence
231
+ attr_accessor :project_name
232
+ attr_reader :channel_code
233
+
234
+ # Generate standardized name
235
+ def generate_name
236
+ end
237
+
238
+ # Set and validate channel code
239
+ def channel_code=(code)
240
+ end
241
+ end
242
+ ```
243
+
244
+ **Attributes**:
245
+ - `sequence` - Project sequence (e.g., "b60", "50")
246
+ - `channel_code` - Channel code (e.g., "appydave", "aitldr")
247
+ - `project_name` - Project descriptor (e.g., "intro-to-coding")
248
+
249
+ **Methods**:
250
+ - `generate_name()` - Returns "{sequence}-{channel}-{project_name}" (lowercase, hyphenated)
251
+ - `channel_code=(code)` - Validates and sets channel code against configured channels
252
+
253
+ ## Configuration
254
+
255
+ Names are validated against configured channels in:
256
+ ```
257
+ ~/.config/appydave/channels.json
258
+ ```
259
+
260
+ Valid channels must be defined in configuration. Invalid channels are rejected.
261
+
262
+ ## Naming Rules
263
+
264
+ 1. **Sequence**: Alphanumeric identifier (e.g., `b60`, `50`)
265
+ 2. **Channel** (optional): Valid configured channel code (e.g., `appydave`, `aitldr`)
266
+ 3. **Project Name**: Hyphenated, lowercase (e.g., `intro-to-coding`)
267
+
268
+ **Generated Format**:
269
+ - With channel: `{seq}-{channel}-{project}` (all lowercase)
270
+ - Without channel: `{seq}-{project}` (all lowercase)
271
+
272
+ ## Examples
273
+
274
+ ### Parse & Regenerate
275
+ ```ruby
276
+ project = ProjectName.new('B60-APPYDAVE-Intro-To-Coding')
277
+ project.generate_name
278
+ # => "b60-appydave-intro-to-coding" (normalized)
279
+ ```
280
+
281
+ ### Create New Project Name
282
+ ```ruby
283
+ project = ProjectName.new('b60-test')
284
+ project.channel_code = 'appydave'
285
+ project.project_name = 'full-course-series'
286
+ project.generate_name
287
+ # => "b60-appydave-full-course-series"
288
+ ```
289
+
290
+ ### Extract Parts
291
+ ```ruby
292
+ project = ProjectName.new('b60-appydave-advanced-python.md')
293
+ puts "Sequence: #{project.sequence}" # "b60"
294
+ puts "Channel: #{project.channel_code}" # "appydave"
295
+ puts "Project: #{project.project_name}" # "advanced-python"
296
+ ```
297
+
298
+ ## Troubleshooting
299
+
300
+ | Issue | Solution |
301
+ |-------|----------|
302
+ | "Invalid channel code" | Channel must be configured in ~/.config/appydave/channels.json |
303
+ | "Parse error" | Ensure filename follows {seq}-{channel?}-{project} format |
304
+ | "Missing sequence" | Sequence (first part) is required |
305
+ | "Invalid characters" | Project names should use hyphens, no spaces or underscores |
306
+
307
+ ## Tips & Tricks
308
+
309
+ 1. **Use sequence prefix**: `b` for big videos, `s` for shorts, helps with sorting
310
+ 2. **Valid channel first**: Set correct channel before generating names
311
+ 3. **Lowercase output**: `generate_name()` always returns lowercase
312
+ 4. **Batch processing**: Use in loops to rename/validate entire projects
313
+ 5. **Configuration required**: Set up channels.json before using
314
+
315
+ ---
316
+
317
+ **Related Tools**:
318
+ - `configuration` - Manage channel definitions
319
+ - `youtube_manager` - Uses project names for organization
320
+ - Video production tools - Reference projects by names
321
+
322
+ **Pattern**: Part of AppyDave project organization system
@@ -0,0 +1,209 @@
1
+ # Prompt Tools
2
+
3
+ ⚠️ **DEPRECATED**: Uses legacy OpenAI Completion API (discontinued). See "Use Cases" for alternatives.
4
+
5
+ Generate text completions using OpenAI's API for prompts and content generation.
6
+
7
+ ## What It Does (Deprecated)
8
+
9
+ **Prompt Tools** provides command-line access to OpenAI text generation:
10
+
11
+ - Send prompts to OpenAI API
12
+ - Get text completions
13
+ - Configure model and parameters
14
+ - Handle streaming responses
15
+ - Process batch prompts
16
+
17
+ ⚠️ **Status**: Uses deprecated OpenAI Completion API (`davinci-003`). OpenAI discontinued this in January 2024.
18
+
19
+ ## How to Use
20
+
21
+ ### Basic Completion
22
+
23
+ ```bash
24
+ prompt_tools completion -p "Write a haiku about programming"
25
+
26
+ prompt_tools completion -p "Explain recursion" -m "text-davinci-003"
27
+ ```
28
+
29
+ ### Configuration
30
+
31
+ Set OpenAI API key in config:
32
+
33
+ ```bash
34
+ # Interactive setup
35
+ prompt_tools config
36
+
37
+ # Or set environment variable
38
+ export OPENAI_API_KEY="sk-..."
39
+ ```
40
+
41
+ ### Options
42
+
43
+ ```bash
44
+ -p, --prompt TEXT Text prompt to complete
45
+ -m, --model MODEL Model name (default: text-davinci-003)
46
+ -t, --temperature NUM Randomness 0-2 (default: 1.0)
47
+ -l, --max-tokens NUM Maximum response length
48
+ -h, --help Show help
49
+ ```
50
+
51
+ ## Why It's Deprecated
52
+
53
+ OpenAI discontinued the Completion API in January 2024. The tool still works with archived models but should not be used for new work.
54
+
55
+ ### Migration Path
56
+
57
+ **Instead of Completion API:**
58
+
59
+ Use the **Chat Completion API** which is the current standard:
60
+
61
+ ```bash
62
+ # Using gpt_context with aider (better approach)
63
+ gpt_context -i 'lib/**/*.rb' -p "Explain this code" -o clipboard
64
+
65
+ # Then paste into Claude, ChatGPT, or Copilot directly
66
+ # Or use aider CLI tool with gpt_context output
67
+ ```
68
+
69
+ ## Use Cases for AI Agents
70
+
71
+ ### 1. Legacy Workflow Compatibility
72
+ ```bash
73
+ # If you have existing scripts using this tool
74
+ # They will continue to work with archived models
75
+ # But consider migrating to Chat API
76
+ ```
77
+ **AI discovers**: Legacy integration points. Can identify and update deprecated API usage.
78
+
79
+ ### 2. Batch Prompt Processing (Outdated)
80
+ ```bash
81
+ # Old approach: Use prompt_tools in loop
82
+ # Better approach: Use aider with gpt_context
83
+ # Or call Claude/ChatGPT API directly
84
+ ```
85
+ **AI discovers**: Where deprecated tools are used. Can plan migration strategy.
86
+
87
+ ### 3. Content Generation (Better Alternatives)
88
+ ```bash
89
+ # Old: prompt_tools completion -p "Write blog post..."
90
+ # New: Use Claude API (claude-3-sonnet-20240229)
91
+ # Or: gpt_context + aider for code-aware generation
92
+ ```
93
+ **AI discovers**: Content generation workflows. Can recommend better solutions.
94
+
95
+ ### 4. Completion for Coding (Much Better Alternatives)
96
+ ```bash
97
+ # Old: prompt_tools to suggest code completions
98
+ # Better: Use Copilot, Cursor, or Claude Code
99
+ # These understand context and code style
100
+ ```
101
+ **AI discovers**: Code generation needs. Can recommend modern tools.
102
+
103
+ ### 5. Migrating Legacy Prompts
104
+ ```bash
105
+ # Convert old completion-style prompts to Chat format
106
+ # Old: "Write a story about..."
107
+ # New: ChatMessage with role="user", content="Write a story about..."
108
+ ```
109
+ **AI discovers**: Legacy prompt format. Can adapt to modern APIs.
110
+
111
+ ### 6. Archive Historical Data
112
+ ```bash
113
+ # If you have saved outputs from this tool
114
+ # Convert to structured format for analysis
115
+ # Keep for historical reference if needed
116
+ ```
117
+ **AI discovers**: What was generated with this tool. Can preserve and archive.
118
+
119
+ ### 7. Identify Integration Points
120
+ ```bash
121
+ # Find all scripts using prompt_tools
122
+ # Document current usage
123
+ # Plan migration to modern APIs
124
+ grep -r "prompt_tools" . --include="*.rb" --include="*.sh"
125
+ ```
126
+ **AI discovers**: Tool dependencies, integration surface area. Can plan systematic migration.
127
+
128
+ ### 8. API Cost Optimization
129
+ ```bash
130
+ # Old models (davinci-003) are expensive
131
+ # New models (gpt-3.5-turbo, gpt-4) are cheaper and better
132
+ # Migrate to save on API costs
133
+ ```
134
+ **AI discovers**: Cost structure. Can calculate migration savings.
135
+
136
+ ### 9. Functionality Assessment
137
+ ```bash
138
+ # Determine what this tool was used for
139
+ # Evaluate modern alternatives:
140
+ # - Code: GitHub Copilot, Claude Code, Cursor
141
+ # - Writing: ChatGPT, Claude, Gemini
142
+ # - Data: Claude API, GPT-4 API, specialized models
143
+ ```
144
+ **AI discovers**: Use cases. Can recommend best modern solution for each.
145
+
146
+ ### 10. Retirement Planning
147
+ ```bash
148
+ # Schedule deprecation of prompt_tools
149
+ # Replace with modern API calls
150
+ # Remove from codebase once all usages migrated
151
+ ```
152
+ **AI discovers**: Deprecation timeline. Can plan orderly sunset of legacy tool.
153
+
154
+ ## Modern Alternatives
155
+
156
+ | Use Case | Modern Solution | Notes |
157
+ |----------|-----------------|-------|
158
+ | Interactive coding | Claude Code, Copilot, Cursor | IDE integration recommended |
159
+ | Batch code analysis | gpt_context + Claude API | Better context awareness |
160
+ | Writing generation | ChatGPT API, Claude API | Chat format is more flexible |
161
+ | Content creation | Dedicated content tools | Like Copy.ai, WriterAccess |
162
+ | Completion in code | Model-specific APIs | Call modern APIs directly |
163
+
164
+ ## Troubleshooting (Legacy)
165
+
166
+ | Issue | Solution |
167
+ |-------|----------|
168
+ | "Model not found" | Archived models are no longer available; migrate to Chat API |
169
+ | "API key error" | Check `~/.config/appydave` for OPENAI_API_KEY |
170
+ | "Rate limited" | Reduce batch size or wait; consider modern API quotas |
171
+
172
+ ## Migration Guide
173
+
174
+ ### Step 1: Identify Usage
175
+ ```bash
176
+ # Find all prompt_tools invocations
177
+ grep -r "prompt_tools" . --include="*.rb"
178
+ ```
179
+
180
+ ### Step 2: Understand Intent
181
+ For each usage:
182
+ - What is it trying to do?
183
+ - What would be the best modern tool?
184
+
185
+ ### Step 3: Implement Alternative
186
+ - For code: Use Claude Code, Copilot
187
+ - For writing: Use ChatGPT API or Claude API
188
+ - For batch: Use modern API with proper batching
189
+
190
+ ### Step 4: Test & Validate
191
+ - Verify new solution works
192
+ - Compare output quality
193
+ - Measure cost difference
194
+
195
+ ### Step 5: Remove Legacy
196
+ - Delete `prompt_tools` invocations
197
+ - Update documentation
198
+ - Remove from dependencies if no longer needed
199
+
200
+ ---
201
+
202
+ **Status**: ⚠️ Deprecated - Migrate to modern APIs
203
+ **Recommendation**: Replace with Claude API, OpenAI Chat API, or IDE-integrated tools
204
+ **Timeline**: Plan migration within 6 months
205
+ **Related Tools**:
206
+ - `gpt_context` - For context gathering (works with modern APIs)
207
+ - `youtube_automation` - Uses newer API patterns
208
+
209
+ **OpenAI Migration**: [Completion → Chat Completions](https://platform.openai.com/docs/guides/gpt/completions-api)