appydave-tools 0.76.6 → 0.76.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4172ac86ad4f32c89534b2129ffed582137abc47e21fe1fb2e1d18c5a56608e
4
- data.tar.gz: ed067098e65634fce56abf446313a7f58657dbc7fc45499915cb34d6a9ae5afe
3
+ metadata.gz: 51ac1542f215f90d518a24c96b5185cf954b9db2beab4bbb93c8d43f3b106fb7
4
+ data.tar.gz: 11acb6d8817125846945e4f7ba3bfb77b305155093f507f346a21477c4102cdb
5
5
  SHA512:
6
- metadata.gz: 79f3caf203405a2cf7337da3129595433515c04e6b4f9f1203b70b5ef89e07caa07ac212d6e9bb85244185f5d5d3b8e20f175e01e7587fb1fe1920630dadf8e1
7
- data.tar.gz: e42dfc787b1331d7fdfbd32c731f13e03f946bf5e2fa9d89f948f9cb59dc393a80e054b075b650d51d72eb7070f846f0253beef5e011cf3c632b8181b5b30f7f
6
+ metadata.gz: 02a5b3623de62bbb09d343101c1edc48b711fc8682d9396689043afcdd134276c887de57d802e8a717db9adaeb34b48eb14dd6a199e085d64430a0525300cf1e
7
+ data.tar.gz: ce60ac62a7753a206768335c7cc51c8d4765223efd9dd34d4a490fc250f8af63aca11fd532f9918f15ac075be8e7698bd7613704040a16f66777a0455ca54c25
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.76.6](https://github.com/appydave/appydave-tools/compare/v0.76.5...v0.76.6) (2026-03-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * extract S3ScanCommand class from VatCLI; add smoke-test spec ([cd03606](https://github.com/appydave/appydave-tools/commit/cd03606e3307665c7f69391d6c160f50df1773ba))
7
+ * remove redundant rubocop disable directives from S3ScanCommand (CI rubocop 1.85.1) ([4c9deb4](https://github.com/appydave/appydave-tools/commit/4c9deb4298d4577a99d0e82e7b72918a26275d40))
8
+
1
9
  ## [0.76.5](https://github.com/appydave/appydave-tools/compare/v0.76.4...v0.76.5) (2026-03-19)
2
10
 
3
11
 
data/bin/dam CHANGED
@@ -154,7 +154,7 @@ class VatCLI
154
154
 
155
155
  # S3 Upload
156
156
  def s3_up_command(args)
157
- options = parse_s3_args(args, 's3-up')
157
+ options = Appydave::Tools::Dam::S3ArgParser.parse_s3(args, 's3-up')
158
158
  s3_ops = Appydave::Tools::Dam::S3Operations.new(options[:brand], options[:project])
159
159
  s3_ops.upload(dry_run: options[:dry_run])
160
160
  rescue StandardError => e
@@ -164,7 +164,7 @@ class VatCLI
164
164
 
165
165
  # S3 Download
166
166
  def s3_down_command(args)
167
- options = parse_s3_args(args, 's3-down')
167
+ options = Appydave::Tools::Dam::S3ArgParser.parse_s3(args, 's3-down')
168
168
  s3_ops = Appydave::Tools::Dam::S3Operations.new(options[:brand], options[:project])
169
169
  s3_ops.download(dry_run: options[:dry_run])
170
170
  rescue StandardError => e
@@ -174,7 +174,7 @@ class VatCLI
174
174
 
175
175
  # S3 Status
176
176
  def s3_status_command(args)
177
- options = parse_s3_args(args, 's3-status')
177
+ options = Appydave::Tools::Dam::S3ArgParser.parse_s3(args, 's3-status')
178
178
  s3_ops = Appydave::Tools::Dam::S3Operations.new(options[:brand], options[:project])
179
179
  s3_ops.status
180
180
  rescue StandardError => e
@@ -184,7 +184,7 @@ class VatCLI
184
184
 
185
185
  # S3 Cleanup Remote
186
186
  def s3_cleanup_remote_command(args)
187
- options = parse_s3_args(args, 's3-cleanup-remote')
187
+ options = Appydave::Tools::Dam::S3ArgParser.parse_s3(args, 's3-cleanup-remote')
188
188
  s3_ops = Appydave::Tools::Dam::S3Operations.new(options[:brand], options[:project])
189
189
  s3_ops.cleanup(force: options[:force], dry_run: options[:dry_run])
190
190
  rescue StandardError => e
@@ -194,7 +194,7 @@ class VatCLI
194
194
 
195
195
  # S3 Cleanup Local
196
196
  def s3_cleanup_local_command(args)
197
- options = parse_s3_args(args, 's3-cleanup-local')
197
+ options = Appydave::Tools::Dam::S3ArgParser.parse_s3(args, 's3-cleanup-local')
198
198
  s3_ops = Appydave::Tools::Dam::S3Operations.new(options[:brand], options[:project])
199
199
  s3_ops.cleanup_local(force: options[:force], dry_run: options[:dry_run])
200
200
  rescue StandardError => e
@@ -204,7 +204,7 @@ class VatCLI
204
204
 
205
205
  # Share file via pre-signed URL
206
206
  def s3_share_command(args)
207
- options = parse_share_args(args)
207
+ options = Appydave::Tools::Dam::S3ArgParser.parse_share(args)
208
208
 
209
209
  share_ops = Appydave::Tools::Dam::ShareOperations.new(options[:brand], options[:project])
210
210
  share_ops.generate_links(files: options[:file], expires: options[:expires], download: options[:download])
@@ -215,7 +215,7 @@ class VatCLI
215
215
 
216
216
  # Discover files in S3 for a project
217
217
  def s3_discover_command(args)
218
- options = parse_discover_args(args)
218
+ options = Appydave::Tools::Dam::S3ArgParser.parse_discover(args)
219
219
  files = fetch_s3_files(options[:brand_key], options[:project_id])
220
220
 
221
221
  return if handle_empty_files?(files, options[:brand_key], options[:project_id])
@@ -228,7 +228,7 @@ class VatCLI
228
228
 
229
229
  # Archive project to SSD
230
230
  def archive_command(args)
231
- options = parse_s3_args(args, 'archive')
231
+ options = Appydave::Tools::Dam::S3ArgParser.parse_s3(args, 'archive')
232
232
  s3_ops = Appydave::Tools::Dam::S3Operations.new(options[:brand], options[:project])
233
233
  s3_ops.archive(force: options[:force], dry_run: options[:dry_run])
234
234
  rescue StandardError => e
@@ -461,132 +461,6 @@ class VatCLI
461
461
  exit 1
462
462
  end
463
463
 
464
- # Parse S3 command arguments
465
- # rubocop:disable Metrics/MethodLength
466
- def parse_s3_args(args, command)
467
- dry_run = args.include?('--dry-run')
468
- force = args.include?('--force')
469
- args = args.reject { |arg| arg.start_with?('--') }
470
-
471
- brand_arg = args[0]
472
- project_arg = args[1]
473
-
474
- if brand_arg.nil?
475
- # Auto-detect from PWD
476
- brand, project_id = Appydave::Tools::Dam::ProjectResolver.detect_from_pwd
477
- if brand.nil? || project_id.nil?
478
- puts '❌ Could not auto-detect brand/project from current directory'
479
- puts "Usage: dam #{command} <brand> <project> [--dry-run]"
480
- exit 1
481
- end
482
- brand_key = brand # Already detected, use as-is
483
- else
484
- # Validate brand exists before trying to resolve project
485
- unless valid_brand?(brand_arg)
486
- puts "❌ Invalid brand: '#{brand_arg}'"
487
- puts ''
488
- puts 'Valid brands:'
489
- puts ' appydave → v-appydave (AppyDave brand)'
490
- puts ' voz → v-voz (VOZ client)'
491
- puts ' aitldr → v-aitldr (AITLDR brand)'
492
- puts ' kiros → v-kiros (Kiros client)'
493
- puts ' joy → v-beauty-and-joy (Beauty & Joy)'
494
- puts ' ss → v-supportsignal (SupportSignal)'
495
- puts ''
496
- puts "Usage: dam #{command} <brand> <project> [--dry-run]"
497
- exit 1
498
- end
499
-
500
- brand_key = brand_arg # Use the shortcut/key (e.g., 'appydave')
501
- brand = Appydave::Tools::Dam::Config.expand_brand(brand_arg) # Expand for path resolution
502
- project_id = Appydave::Tools::Dam::ProjectResolver.resolve(brand_arg, project_arg)
503
- end
504
-
505
- # Set ENV for compatibility with ConfigLoader
506
- ENV['BRAND_PATH'] = Appydave::Tools::Dam::Config.brand_path(brand)
507
-
508
- { brand: brand_key, project: project_id, dry_run: dry_run, force: force }
509
- end
510
- # rubocop:enable Metrics/MethodLength
511
-
512
- def valid_brand?(brand_key)
513
- Appydave::Tools::Configuration::Config.configure
514
- brands = Appydave::Tools::Configuration::Config.brands
515
- brands.key?(brand_key) || brands.shortcut?(brand_key)
516
- end
517
-
518
- def parse_share_args(args)
519
- # Extract --expires flag
520
- expires = '7d' # default
521
- if (expires_index = args.index('--expires'))
522
- expires = args[expires_index + 1]
523
- args.delete_at(expires_index + 1)
524
- args.delete_at(expires_index)
525
- end
526
-
527
- # Extract --download flag
528
- download = args.include?('--download')
529
-
530
- # Remove other flags
531
- args = args.reject { |arg| arg.start_with?('--') }
532
-
533
- brand_arg = args[0]
534
- project_arg = args[1]
535
- file_arg = args[2]
536
-
537
- show_share_usage_and_exit if brand_arg.nil? || project_arg.nil? || file_arg.nil?
538
-
539
- brand_key = brand_arg
540
- brand = Appydave::Tools::Dam::Config.expand_brand(brand_arg)
541
- project_id = Appydave::Tools::Dam::ProjectResolver.resolve(brand_arg, project_arg)
542
-
543
- # Set ENV for compatibility with ConfigLoader
544
- ENV['BRAND_PATH'] = Appydave::Tools::Dam::Config.brand_path(brand)
545
-
546
- { brand: brand_key, project: project_id, file: file_arg, expires: expires, download: download }
547
- end
548
-
549
- def show_share_usage_and_exit
550
- puts 'Usage: dam s3-share <brand> <project> <file> [--expires 7d] [--download]'
551
- puts ''
552
- puts 'Options:'
553
- puts ' --expires TIME Expiry time (default: 7d)'
554
- puts ' --download Force download instead of viewing in browser'
555
- puts ''
556
- puts 'Examples:'
557
- puts ' dam s3-share appydave b70 video.mp4'
558
- puts ' dam s3-share appydave b70 video.mp4 --expires 24h'
559
- puts ' dam s3-share appydave b70 video.mp4 --download'
560
- puts ' dam s3-share voz boy-baker final-edit.mov --expires 3d --download'
561
- exit 1
562
- end
563
-
564
- def parse_discover_args(args)
565
- shareable = args.include?('--shareable')
566
- args = args.reject { |arg| arg.start_with?('--') }
567
-
568
- brand_arg = args[0]
569
- project_arg = args[1]
570
-
571
- if brand_arg.nil? || project_arg.nil?
572
- puts 'Usage: dam s3-discover <brand> <project> [--shareable]'
573
- puts ''
574
- puts 'Examples:'
575
- puts ' dam s3-discover appydave b70 # List files'
576
- puts ' dam s3-discover appydave b70 --shareable # Generate share commands'
577
- exit 1
578
- end
579
-
580
- brand_key = brand_arg
581
- brand = Appydave::Tools::Dam::Config.expand_brand(brand_arg)
582
- project_id = Appydave::Tools::Dam::ProjectResolver.resolve(brand_arg, project_arg)
583
-
584
- # Set ENV for compatibility with ConfigLoader
585
- ENV['BRAND_PATH'] = Appydave::Tools::Dam::Config.brand_path(brand)
586
-
587
- { brand_key: brand_key, project_id: project_id, shareable: shareable }
588
- end
589
-
590
464
  def fetch_s3_files(brand_key, project_id)
591
465
  s3_ops = Appydave::Tools::Dam::S3Operations.new(brand_key, project_id)
592
466
  s3_ops.list_s3_files
@@ -10,8 +10,8 @@
10
10
  ## Pending
11
11
  - [x] extract-format-bytes — Replaced 4 callers (plan said 3; orphaned-projects loop in display_s3_scan_table was a 4th). format_bytes deleted. rubocop 0 offenses. Commit: 3cd362f.
12
12
  - [x] extract-local-sync-status — LocalSyncStatus module created, 7 specs added (838 total), both methods gone from VatCLI. Side-fix: restored youtube_automation_config require incorrectly removed in prior commit. v0.76.5.
13
- - [~] extract-s3-scan-command — Extract `scan_single_brand_s3` + `scan_all_brands_s3` + `display_s3_scan_table` new `S3ScanCommand` class; add spec; **depends on extract-local-sync-status completing first**
14
- - [ ] extract-s3-arg-parser — Extract `parse_s3_args` + `valid_brand?` + `parse_share_args` + `show_share_usage_and_exit` + `parse_discover_args` → new `S3ArgParser` class; add spec
13
+ - [x] extract-s3-scan-command — S3ScanCommand created, 2 smoke tests added (840 total), 3 methods gone from VatCLI. Note: rubocop-disable directives became redundant once methods left God class — needed 2nd kfix to remove them. v0.76.6.
14
+ - [~] extract-s3-arg-parser — Extract `parse_s3_args` + `valid_brand?` + `parse_share_args` + `show_share_usage_and_exit` + `parse_discover_args` → new `S3ArgParser` class; add spec
15
15
 
16
16
  ## In Progress
17
17
 
@@ -0,0 +1,136 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appydave
4
+ module Tools
5
+ module Dam
6
+ # Parses and validates CLI arguments for S3-related dam commands
7
+ # Handles brand resolution, project lookup, flag extraction, and ENV setup
8
+ module S3ArgParser
9
+ module_function
10
+
11
+ def parse_s3(args, command)
12
+ dry_run = args.include?('--dry-run')
13
+ force = args.include?('--force')
14
+ args = args.reject { |arg| arg.start_with?('--') }
15
+
16
+ brand_arg = args[0]
17
+ project_arg = args[1]
18
+
19
+ if brand_arg.nil?
20
+ # Auto-detect from PWD
21
+ brand, project_id = Appydave::Tools::Dam::ProjectResolver.detect_from_pwd
22
+ if brand.nil? || project_id.nil?
23
+ puts '❌ Could not auto-detect brand/project from current directory'
24
+ puts "Usage: dam #{command} <brand> <project> [--dry-run]"
25
+ exit 1
26
+ end
27
+ brand_key = brand # Already detected, use as-is
28
+ else
29
+ # Validate brand exists before trying to resolve project
30
+ unless valid_brand?(brand_arg)
31
+ puts "❌ Invalid brand: '#{brand_arg}'"
32
+ puts ''
33
+ puts 'Valid brands:'
34
+ puts ' appydave → v-appydave (AppyDave brand)'
35
+ puts ' voz → v-voz (VOZ client)'
36
+ puts ' aitldr → v-aitldr (AITLDR brand)'
37
+ puts ' kiros → v-kiros (Kiros client)'
38
+ puts ' joy → v-beauty-and-joy (Beauty & Joy)'
39
+ puts ' ss → v-supportsignal (SupportSignal)'
40
+ puts ''
41
+ puts "Usage: dam #{command} <brand> <project> [--dry-run]"
42
+ exit 1
43
+ end
44
+
45
+ brand_key = brand_arg # Use the shortcut/key (e.g., 'appydave')
46
+ brand = Appydave::Tools::Dam::Config.expand_brand(brand_arg) # Expand for path resolution
47
+ project_id = Appydave::Tools::Dam::ProjectResolver.resolve(brand_arg, project_arg)
48
+ end
49
+
50
+ # Set ENV for compatibility with ConfigLoader
51
+ ENV['BRAND_PATH'] = Appydave::Tools::Dam::Config.brand_path(brand)
52
+
53
+ { brand: brand_key, project: project_id, dry_run: dry_run, force: force }
54
+ end
55
+
56
+ def parse_share(args)
57
+ # Extract --expires flag
58
+ expires = '7d' # default
59
+ if (expires_index = args.index('--expires'))
60
+ expires = args[expires_index + 1]
61
+ args.delete_at(expires_index + 1)
62
+ args.delete_at(expires_index)
63
+ end
64
+
65
+ # Extract --download flag
66
+ download = args.include?('--download')
67
+
68
+ # Remove other flags
69
+ args = args.reject { |arg| arg.start_with?('--') }
70
+
71
+ brand_arg = args[0]
72
+ project_arg = args[1]
73
+ file_arg = args[2]
74
+
75
+ show_share_usage_and_exit if brand_arg.nil? || project_arg.nil? || file_arg.nil?
76
+
77
+ brand_key = brand_arg
78
+ brand = Appydave::Tools::Dam::Config.expand_brand(brand_arg)
79
+ project_id = Appydave::Tools::Dam::ProjectResolver.resolve(brand_arg, project_arg)
80
+
81
+ # Set ENV for compatibility with ConfigLoader
82
+ ENV['BRAND_PATH'] = Appydave::Tools::Dam::Config.brand_path(brand)
83
+
84
+ { brand: brand_key, project: project_id, file: file_arg, expires: expires, download: download }
85
+ end
86
+
87
+ def parse_discover(args)
88
+ shareable = args.include?('--shareable')
89
+ args = args.reject { |arg| arg.start_with?('--') }
90
+
91
+ brand_arg = args[0]
92
+ project_arg = args[1]
93
+
94
+ if brand_arg.nil? || project_arg.nil?
95
+ puts 'Usage: dam s3-discover <brand> <project> [--shareable]'
96
+ puts ''
97
+ puts 'Examples:'
98
+ puts ' dam s3-discover appydave b70 # List files'
99
+ puts ' dam s3-discover appydave b70 --shareable # Generate share commands'
100
+ exit 1
101
+ end
102
+
103
+ brand_key = brand_arg
104
+ brand = Appydave::Tools::Dam::Config.expand_brand(brand_arg)
105
+ project_id = Appydave::Tools::Dam::ProjectResolver.resolve(brand_arg, project_arg)
106
+
107
+ # Set ENV for compatibility with ConfigLoader
108
+ ENV['BRAND_PATH'] = Appydave::Tools::Dam::Config.brand_path(brand)
109
+
110
+ { brand_key: brand_key, project_id: project_id, shareable: shareable }
111
+ end
112
+
113
+ def valid_brand?(brand_key)
114
+ Appydave::Tools::Configuration::Config.configure
115
+ brands = Appydave::Tools::Configuration::Config.brands
116
+ brands.key?(brand_key) || brands.shortcut?(brand_key)
117
+ end
118
+
119
+ def show_share_usage_and_exit
120
+ puts 'Usage: dam s3-share <brand> <project> <file> [--expires 7d] [--download]'
121
+ puts ''
122
+ puts 'Options:'
123
+ puts ' --expires TIME Expiry time (default: 7d)'
124
+ puts ' --download Force download instead of viewing in browser'
125
+ puts ''
126
+ puts 'Examples:'
127
+ puts ' dam s3-share appydave b70 video.mp4'
128
+ puts ' dam s3-share appydave b70 video.mp4 --expires 24h'
129
+ puts ' dam s3-share appydave b70 video.mp4 --download'
130
+ puts ' dam s3-share voz boy-baker final-edit.mov --expires 3d --download'
131
+ exit 1
132
+ end
133
+ end
134
+ end
135
+ end
136
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Appydave
4
4
  module Tools
5
- VERSION = '0.76.6'
5
+ VERSION = '0.76.7'
6
6
  end
7
7
  end
@@ -80,6 +80,7 @@ require 'appydave/tools/dam/repo_sync'
80
80
  require 'appydave/tools/dam/repo_push'
81
81
  require 'appydave/tools/dam/local_sync_status'
82
82
  require 'appydave/tools/dam/s3_scan_command'
83
+ require 'appydave/tools/dam/s3_arg_parser'
83
84
 
84
85
  require 'appydave/tools/jump/path_validator'
85
86
  require 'appydave/tools/jump/location'
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.76.6",
3
+ "version": "0.76.7",
4
4
  "description": "AppyDave YouTube Automation Tools",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appydave-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.76.6
4
+ version: 0.76.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -361,6 +361,7 @@ files:
361
361
  - lib/appydave/tools/dam/repo_push.rb
362
362
  - lib/appydave/tools/dam/repo_status.rb
363
363
  - lib/appydave/tools/dam/repo_sync.rb
364
+ - lib/appydave/tools/dam/s3_arg_parser.rb
364
365
  - lib/appydave/tools/dam/s3_operations.rb
365
366
  - lib/appydave/tools/dam/s3_scan_command.rb
366
367
  - lib/appydave/tools/dam/s3_scanner.rb