versacommerce-cli 0.2.3 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: dc48bd66e513f0e6526ab288844e78457e58ea91
4
- data.tar.gz: 66d12de31dd7a2a4330f810c1c1d3c658e0f9bbc
2
+ SHA256:
3
+ metadata.gz: ce6e6eb254839dc2b0430f8c38d723e66d1e48b6b19ed9c80fe4c1de6a78db29
4
+ data.tar.gz: adb69f5b440ff0f018207f852c5b58c9500070d1b49844decfad159238021ce9
5
5
  SHA512:
6
- metadata.gz: e2a905a388313e5897fef9dfa98951a3abd652997a86a91b170b22180d0edde5401041d265bc16928ad0275a9ae9f2558637fabda799bcf9b78ecf075a24a397
7
- data.tar.gz: 2dc4b4592a839c4cce6a4f3163ca734fe0e90f49384ae13704f49fc5768ea958514bcf34c759bbb0abe15e9923fdcdbc98b0b9a45e64006da103e509892bf5eb
6
+ metadata.gz: f2e909f28e56fd257a3dd47ca595b46b5900203c60381e4ca6c2f1f578d78da1346f3db52e050c2bfa45f7abdcc720db88e48a21b50dcf34a4e902bad6ab130a
7
+ data.tar.gz: 6e06f2cf2048def28ab240226fa430d09cc3c7b8acfe9bc76810f8ebbe4e3ba6f984f2a2612f73e13c6cf2d80c575c45bda31d3b9e0f327dd0b725ea321bec99
data/.DS_Store ADDED
Binary file
data/.claude/.DS_Store ADDED
Binary file
@@ -0,0 +1,18 @@
1
+ # Bump version
2
+
3
+ This command bump version, changes CHANGELOG.md if exists, commit and push changes.
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ /bump-version
9
+ ```
10
+
11
+ ## Process
12
+
13
+ 1. Find current app version in config/version.rb or in CHANGELOG.md
14
+ 2. Bump the app version number - new features should increase the minor version number, bug fixes should increase the patch version number. Breaking changes should increase the major version number. Follow [Semantic Versioning](https://semver.org/).
15
+ 3. Update config/version.rb if exists
16
+ 4. Update CHANGELOG.md if exists, ask user which changes that in not released section should be included in new version.
17
+ 5. commit the changes with a short, but descriptive message
18
+ 6. Ask user approval to push the changes to the remote repository
@@ -0,0 +1,56 @@
1
+ # Comprehensive Code Quality Review
2
+
3
+ Perform comprehensive code quality review
4
+
5
+ ## Instructions
6
+
7
+ Follow these steps to conduct a thorough code review:
8
+
9
+ 1. **Repository Analysis**
10
+ - Examine the repository structure and identify the primary language/framework
11
+ - Check for configuration files (package.json, requirements.txt, Cargo.toml, etc.)
12
+ - Review README and documentation for context
13
+
14
+ 2. **Code Quality Assessment**
15
+ - Scan for code smells, anti-patterns, and potential bugs
16
+ - Check for consistent coding style and naming conventions
17
+ - Identify unused imports, variables, or dead code
18
+ - Review error handling and logging practices
19
+
20
+ 3. **Security Review**
21
+ - Look for common security vulnerabilities (SQL injection, XSS, etc.)
22
+ - Check for hardcoded secrets, API keys, or passwords
23
+ - Review authentication and authorization logic
24
+ - Examine input validation and sanitization
25
+
26
+ 4. **Performance Analysis**
27
+ - Identify potential performance bottlenecks
28
+ - Check for inefficient algorithms or database queries
29
+ - Review memory usage patterns and potential leaks
30
+ - Analyze bundle size and optimization opportunities
31
+
32
+ 5. **Architecture & Design**
33
+ - Evaluate code organization and separation of concerns
34
+ - Check for proper abstraction and modularity
35
+ - Review dependency management and coupling
36
+ - Assess scalability and maintainability
37
+
38
+ 6. **Testing Coverage**
39
+ - Check existing test coverage and quality
40
+ - Identify areas lacking proper testing
41
+ - Review test structure and organization
42
+ - Suggest additional test scenarios
43
+
44
+ 7. **Documentation Review**
45
+ - Evaluate code comments and inline documentation
46
+ - Check API documentation completeness
47
+ - Review README and setup instructions
48
+ - Identify areas needing better documentation
49
+
50
+ 8. **Recommendations**
51
+ - Prioritize issues by severity (critical, high, medium, low)
52
+ - Provide specific, actionable recommendations
53
+ - Suggest tools and practices for improvement
54
+ - Create a summary report with next steps
55
+
56
+ Remember to be constructive and provide specific examples with file paths and line numbers where applicable.
@@ -0,0 +1,27 @@
1
+ # Onboard
2
+ You are given the following context:
3
+ SARGUMENTS
4
+
5
+ ## Instructions
6
+ "Al models are geniuses who start from scratch on every task." - Noam Brown
7
+
8
+ Your job is to "onboard" yourself to the current task.
9
+ Do this by:
10
+ - Using ultrathink
11
+ - Exploring the codebase
12
+ - Asking me questions if needed
13
+
14
+ The goal is to get you fully prepared to start working on the task.
15
+ Take as long as you need to get yourself ready. Overdoing it is better than underdoing it.
16
+
17
+ Record everything in a .claude/tasks/[TASK_ID]/onboarding.md file. Save this file as soon as you have enough information to start working on the task. Save updates to this file as you go along.
18
+ This file will be used to onboard you to the task in a new session if needed, so make sure it's comprehensive.
19
+
20
+ Important:
21
+ - The solution should generate as little code as possible
22
+ - The solution should adhere to the existing patterns of the application
23
+ - Implementation should be professional and lean: not everything that is possible, but only what is necessary
24
+
25
+ Always add testing instructions for any new features or changes made. Beweise, dass deine durchgeführten Tests Real und Fehlerfrei sind.
26
+
27
+ IMPORTANT: Create your todos AFTER creation of the comprehensive onboarding document.
@@ -0,0 +1,5 @@
1
+ 1. Analyze the changes made in this version
2
+ 2. bump the app version number (config/version.rb) - new features should increase the minor version number, bug fixes should increase the patch version number. breaking changes should increase the major version number.
3
+ 3. update a changelog file (CHANGELOG.md) with a short message to reflect the changes made in this version
4
+ 4. commit the changes with a short, but descriptive message, include version number
5
+ 5. push the changes to the remote repository
@@ -0,0 +1,350 @@
1
+ # Ruby 2.6.9 to 3.3 Upgrade - Onboarding Document
2
+
3
+ ## Task Overview
4
+ Upgrade the versacommerce-cli Ruby gem from Ruby 2.6.9 to Ruby 3.3, ensuring all dependencies are compatible and code follows Ruby 3.3 best practices.
5
+
6
+ ## Current State Analysis
7
+
8
+ ### Project Information
9
+ - **Gem Name**: versacommerce-cli
10
+ - **Current Version**: 0.2.3
11
+ - **Type**: Ruby CLI tool for VersaCommerce Theme API
12
+ - **Main Executable**: `vc-theme`
13
+ - **Current Ruby Requirement**: >= 2.0.0 (very permissive)
14
+ - **LOC**: ~220 lines of Ruby code across 4 files
15
+
16
+ ### System Ruby Version
17
+ - Currently running: Ruby 3.1.3p185
18
+ - Target: Ruby 3.3.x
19
+
20
+ ### Core Functionality
21
+ 1. **download** - Downloads theme from API to local directory
22
+ 2. **watch** - Monitors file changes and syncs to API in real-time
23
+ 3. **upload** - Uploads directory tree to API
24
+
25
+ ## Critical Issues Identified
26
+
27
+ ### 🚨 SECURITY VULNERABILITY: YAML.load_file
28
+ **File**: `lib/versacommerce/cli/theme.rb`
29
+ **Lines**: 160, 166, 173
30
+
31
+ ```ruby
32
+ # Current (INSECURE):
33
+ YAML.load_file(config)
34
+
35
+ # Required (SECURE):
36
+ YAML.load_file(config, permitted_classes: [Symbol])
37
+ ```
38
+
39
+ **Why Critical**:
40
+ - Deprecated in Ruby 3.1+
41
+ - Arbitrary code execution vulnerability
42
+ - Will be removed in future Ruby versions
43
+
44
+ ### 🔴 OUTDATED DEPENDENCIES (10 years old!)
45
+
46
+ #### Runtime Dependencies
47
+ | Gem | Current | Age | Target | Risk Level |
48
+ |-----|---------|-----|--------|------------|
49
+ | thor | 0.19.1 (exact) | 2015 | ~> 1.3 | HIGH |
50
+ | listen | ~> 2.10 | 2015 | ~> 3.9 | HIGH |
51
+ | colorize | 0.7.5 (exact) | 2015 | ~> 1.1 | LOW |
52
+ | versacommerce-theme_api_client | 0.1.3 (exact) | Unknown | TBD | **UNKNOWN** |
53
+
54
+ #### Development Dependencies
55
+ | Gem | Current | Target | Risk Level |
56
+ |-----|---------|--------|------------|
57
+ | bundler | ~> 1.8 | >= 1.8 | MEDIUM |
58
+ | rake | ~> 10.4 | ~> 13.0 | LOW |
59
+ | pry | 0.10.1 (exact) | ~> 0.14 | LOW |
60
+ | pry-stack_explorer | 0.4.9.2 (exact) | ~> 0.6 | LOW |
61
+
62
+ **Key Problem**: Exact version pins (0.19.1, 0.7.5) prevent security updates!
63
+
64
+ ### ⚠️ POTENTIAL BLOCKER: versacommerce-theme_api_client
65
+
66
+ **Status**: UNKNOWN Ruby 3.3 compatibility
67
+ **Risk**: Could be complete blocker if incompatible
68
+ **Action Required**: Must investigate this dependency before proceeding
69
+
70
+ ## Code Compatibility Analysis
71
+
72
+ ### ✅ Already Compatible
73
+ - **Keyword arguments**: Correct Ruby 3.0+ syntax already in use
74
+ - **Hash syntax**: Modern syntax (`key: value`)
75
+ - **File operations**: Using Pathname and FileUtils properly
76
+ - **No deprecated Ruby 2.x patterns found**
77
+
78
+ ### 🔧 Needs Fixing
79
+ 1. **YAML.load_file** (3 instances) - Security + deprecation
80
+ 2. **Gemspec dependency versions** (all outdated)
81
+ 3. **Documentation** (README.md mentions Ruby 2.0.0)
82
+
83
+ ### 💡 Optional Improvements
84
+ - String formatting: `'[%s] -- %s' % [time, message]` → `"[#{time}] -- #{message}"`
85
+ - Add `.ruby-version` file for consistency
86
+ - Add basic tests (currently NO tests exist)
87
+
88
+ ## Files Requiring Changes
89
+
90
+ ### Must Modify:
91
+ 1. `versacommerce-cli.gemspec` (lines 21, 23-31)
92
+ - Update required_ruby_version
93
+ - Update all dependencies
94
+
95
+ 2. `lib/versacommerce/cli/theme.rb` (lines 160, 166, 173)
96
+ - Fix YAML.load_file security issue
97
+
98
+ 3. `README.md` (line 9)
99
+ - Update Ruby version requirement
100
+
101
+ ### Should Create:
102
+ 4. `.ruby-version` (optional but recommended)
103
+ - Ensures consistent Ruby version across environments
104
+
105
+ ## Ruby 2.6.9 → 3.3 Breaking Changes Impact
106
+
107
+ | Change | Impact | Action Required |
108
+ |--------|--------|-----------------|
109
+ | Keyword arguments separation | ✅ None | Already using correct syntax |
110
+ | YAML.load deprecation | 🚨 High | Must fix 3 instances |
111
+ | Hash behavior changes | ✅ None | Using modern syntax |
112
+ | String/Symbol handling | ✅ None | No issues found |
113
+ | Integer division | ✅ None | Not used in code |
114
+ | Pattern matching | ✅ None | Not used |
115
+
116
+ ## Testing Strategy
117
+
118
+ ### Current Test Coverage: **0%**
119
+ - No `/test` directory
120
+ - No `/spec` directory
121
+ - No CI/CD configuration
122
+ - **Risk**: No automated validation of changes
123
+
124
+ ### Manual Testing Required:
125
+ 1. **Install dependencies**: `bundle install` with new Gemfile.lock
126
+ 2. **CLI help commands**: Test all `--help` outputs
127
+ 3. **Config loading**: Test all 5 authorization methods
128
+ 4. **File operations**: Test download/upload/watch if possible
129
+
130
+ ### Testing Commands:
131
+ ```bash
132
+ # Basic functionality
133
+ bundle exec vc-theme --help
134
+ bundle exec vc-theme download --help
135
+ bundle exec vc-theme watch --help
136
+ bundle exec vc-theme upload --help
137
+
138
+ # Config file loading (all 5 auth methods)
139
+ bundle exec vc-theme download --authorization=TEST_AUTH
140
+ bundle exec vc-theme download --config=/tmp/test-config.yml
141
+ cd /tmp && echo "authorization: TEST" > config.yml && bundle exec vc-theme download
142
+ THEME_AUTHORIZATION=TEST bundle exec vc-theme download
143
+ mkdir -p ~/.config/versacommerce/cli && echo "authorization: TEST" > ~/.config/versacommerce/cli/config.yml
144
+
145
+ # Check for warnings
146
+ ruby -w exe/vc-theme --help
147
+ ```
148
+
149
+ ## Known Risks & Blockers
150
+
151
+ ### HIGH RISK:
152
+ 1. **versacommerce-theme_api_client dependency** - Unknown compatibility (POTENTIAL BLOCKER)
153
+ 2. **No test coverage** - Manual testing only, risk of regression
154
+ 3. **Thor 0.19.1 → 1.3** - Major version jump, API may have changed
155
+
156
+ ### MEDIUM RISK:
157
+ 1. **Listen 2.10 → 3.9** - File watching behavior may differ
158
+ 2. **YAML permitted_classes** - May break if configs use unexpected classes
159
+ 3. **Bundler constraints** - Need to allow both 1.x and 2.x
160
+
161
+ ### LOW RISK:
162
+ 1. **Colorize, Rake, Pry updates** - Should be backward compatible
163
+ 2. **Documentation updates** - Simple text changes
164
+
165
+ ## Dependency Investigation Needed
166
+
167
+ ### versacommerce-theme_api_client
168
+ **Action**: Must verify Ruby 3.3 compatibility before proceeding
169
+
170
+ ```bash
171
+ # Check gem metadata
172
+ gem fetch versacommerce-theme_api_client -v 0.1.3
173
+ tar -xzf versacommerce-theme_api_client-0.1.3.gem
174
+ tar -xzf data.tar.gz
175
+ cat versacommerce-theme_api_client.gemspec | grep required_ruby_version
176
+
177
+ # Or check online
178
+ gem info versacommerce-theme_api_client --remote
179
+ ```
180
+
181
+ **If incompatible**: This becomes a blocker and requires either:
182
+ - Upgrading that gem first (if we control it)
183
+ - Finding alternative API client
184
+ - Staying on Ruby 2.6/2.7 until fixed
185
+
186
+ ## Implementation Approach
187
+
188
+ ### Phase 1: Investigation ✓
189
+ - [x] Analyze current codebase
190
+ - [x] Identify dependencies
191
+ - [x] Find breaking changes
192
+ - [ ] **Verify versacommerce-theme_api_client compatibility**
193
+
194
+ ### Phase 2: Core Updates
195
+ 1. Update gemspec Ruby requirement
196
+ 2. Update all dependency versions
197
+ 3. Fix YAML security issues
198
+ 4. Update README
199
+
200
+ ### Phase 3: Testing
201
+ 1. Remove Gemfile.lock
202
+ 2. Run bundle install
203
+ 3. Execute manual test suite
204
+ 4. Check for Ruby warnings
205
+
206
+ ### Phase 4: Documentation
207
+ 1. Update README.md
208
+ 2. Add .ruby-version (optional)
209
+ 3. Update CLAUDE.md
210
+ 4. Document any behavior changes
211
+
212
+ ## Testing Instructions
213
+
214
+ After implementation, perform these tests:
215
+
216
+ ### 1. Dependency Installation
217
+ ```bash
218
+ rm -f Gemfile.lock
219
+ bundle install
220
+ # Should complete without errors
221
+ ```
222
+
223
+ ### 2. Basic CLI Functionality
224
+ ```bash
225
+ bundle exec vc-theme --help
226
+ # Should show help without errors or warnings
227
+
228
+ bundle exec vc-theme download --help
229
+ bundle exec vc-theme watch --help
230
+ bundle exec vc-theme upload --help
231
+ # All should display help text
232
+ ```
233
+
234
+ ### 3. Config File Loading (5 methods)
235
+ ```bash
236
+ # Method 1: Direct authorization flag
237
+ bundle exec vc-theme download --authorization=dummy_auth --path=/tmp/test1
238
+ # Should fail with API error (not config error)
239
+
240
+ # Method 2: Explicit config file
241
+ echo "authorization: test_auth" > /tmp/test-config.yml
242
+ bundle exec vc-theme download --config=/tmp/test-config.yml --path=/tmp/test2
243
+ # Should attempt to connect to API
244
+
245
+ # Method 3: Implicit pwd config
246
+ cd /tmp/test-dir
247
+ echo "authorization: test_auth" > config.yml
248
+ bundle exec vc-theme download --path=/tmp/test3
249
+ # Should load from ./config.yml
250
+
251
+ # Method 4: Environment variable
252
+ THEME_AUTHORIZATION=test_auth bundle exec vc-theme download --path=/tmp/test4
253
+ # Should use env var
254
+
255
+ # Method 5: Global config
256
+ mkdir -p ~/.config/versacommerce/cli
257
+ echo "authorization: test_auth" > ~/.config/versacommerce/cli/config.yml
258
+ bundle exec vc-theme download --path=/tmp/test5
259
+ # Should load from global config
260
+ ```
261
+
262
+ ### 4. YAML Security Test
263
+ ```bash
264
+ # Create a config with Symbol keys
265
+ echo ":authorization: test_value" > /tmp/symbol-config.yml
266
+ bundle exec vc-theme download --config=/tmp/symbol-config.yml
267
+ # Should work without errors (permitted_classes: [Symbol])
268
+ ```
269
+
270
+ ### 5. Ruby Warnings Check
271
+ ```bash
272
+ ruby -w exe/vc-theme --help 2>&1 | grep -i warning
273
+ # Should not show YAML.load_file warnings
274
+ ```
275
+
276
+ ### 6. Build & Install Test
277
+ ```bash
278
+ rake build
279
+ gem install pkg/versacommerce-cli-0.2.3.gem
280
+ vc-theme --help
281
+ # Should work as standalone gem
282
+ ```
283
+
284
+ ## Success Criteria
285
+
286
+ - [ ] All dependencies install successfully with Ruby 3.3
287
+ - [ ] versacommerce-theme_api_client is compatible or updated
288
+ - [ ] No YAML.load_file deprecation warnings
289
+ - [ ] All CLI commands show help correctly
290
+ - [ ] Config loading works for all 5 methods
291
+ - [ ] No Ruby warnings when running with -w flag
292
+ - [ ] Gem builds successfully
293
+ - [ ] README reflects Ruby 3.3 requirement
294
+
295
+ ## Open Questions
296
+
297
+ 1. **Backward Compatibility**: Should we maintain Ruby 2.x support or hard require 3.3+?
298
+ 2. **Version Pinning**: Use exact versions (~> 1.3) or ranges (>= 1.3, < 2.0)?
299
+ 3. **versacommerce-theme_api_client**: Can we test/verify compatibility? Do we control this gem?
300
+ 4. **.ruby-version file**: Should we add this for developer consistency?
301
+ 5. **Test Suite**: Should basic tests be added as part of this upgrade?
302
+ 6. **Version Bump**: Should gem version be bumped (0.2.3 → 0.3.0) due to Ruby requirement change?
303
+
304
+ ## Existing Patterns to Follow
305
+
306
+ ### Logging Pattern
307
+ ```ruby
308
+ logger.info('Message')
309
+ logger.debug('Debug message') # Only shown with --verbose
310
+ logger.success('Success message') # Green color
311
+ logger.error('Error message') # Red color
312
+ ```
313
+
314
+ ### Thor CLI Pattern
315
+ ```ruby
316
+ class_option :option_name, aliases: :o, type: :boolean
317
+ option :command_option, default: value
318
+ def command_name
319
+ # Implementation
320
+ end
321
+ ```
322
+
323
+ ### Error Handling Pattern
324
+ ```ruby
325
+ unless condition
326
+ logger.error('Error message')
327
+ exit 1
328
+ end
329
+ ```
330
+
331
+ ### File Operations Pattern
332
+ ```ruby
333
+ path = Pathname.new(options[:path]).expand_path
334
+ FileUtils.mkdir_p(path)
335
+ File.open(path, 'wb') { |f| f.write(content) }
336
+ ```
337
+
338
+ ## Additional Context
339
+
340
+ - User is running Ruby 3.1.3 currently
341
+ - No test infrastructure exists
342
+ - Gem is actively maintained (last commit: version bump to 0.2.3)
343
+ - CLI is customer-facing tool (breaking changes impact users)
344
+ - Git repository is clean (no uncommitted changes)
345
+
346
+ ---
347
+
348
+ **Document Created**: 2025-10-29
349
+ **Last Updated**: 2025-10-29
350
+ **Task Status**: Planning phase
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.3
data/CLAUDE.md ADDED
@@ -0,0 +1,111 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ versacommerce-cli is a Ruby gem providing a Command Line Interface tool for interacting with VersaCommerce Theme API services. The primary executable is `vc-theme`, which provides theme management capabilities (download, watch, upload).
8
+
9
+ **Ruby Version:** Requires Ruby >= 3.1.0 (upgraded from Ruby >= 2.0.0 in version 0.3.0)
10
+
11
+ ## Development Commands
12
+
13
+ ### Setup
14
+ ```sh
15
+ bin/setup
16
+ ```
17
+ Runs `bundle install` and any additional automated setup.
18
+
19
+ ### Interactive Console
20
+ ```sh
21
+ bin/console
22
+ ```
23
+ Opens an interactive prompt for experimentation.
24
+
25
+ ### Build & Release
26
+ ```sh
27
+ rake build # Build the gem
28
+ rake install # Install gem locally
29
+ rake release # Create git tag and push gem to RubyGems
30
+ ```
31
+
32
+ ### Testing the CLI Locally
33
+ ```sh
34
+ bundle exec exe/vc-theme <command>
35
+ ```
36
+ Run the CLI directly from source without installing the gem.
37
+
38
+ ### Running Tests
39
+ ```sh
40
+ ruby test/smoke_test.rb
41
+ ```
42
+ Runs basic smoke tests to verify CLI functionality.
43
+
44
+ ## Code Architecture
45
+
46
+ ### Entry Point
47
+ - `exe/vc-theme` - Executable entry point that loads and starts `Versacommerce::CLI::Theme`
48
+
49
+ ### Core Structure
50
+ The gem follows a simple modular architecture:
51
+
52
+ - `lib/versacommerce/cli.rb` - Root module definition
53
+ - `lib/versacommerce/cli/version.rb` - Version constant (update this when releasing)
54
+ - `lib/versacommerce/cli/theme.rb` - Main Thor-based CLI class with all command logic
55
+ - `lib/versacommerce/cli/simple_logger.rb` - Colorized logging utility
56
+
57
+ ### Theme Commands Architecture (lib/versacommerce/cli/theme.rb)
58
+
59
+ The `Theme` class inherits from Thor and implements three main commands:
60
+
61
+ 1. **download** - Downloads complete theme from Theme API to local directory
62
+ 2. **watch** - Uses Listen gem to monitor file changes and sync to Theme API in real-time
63
+ 3. **upload** - Recursively uploads directory tree to Theme API (delete then add for each file)
64
+
65
+ #### Authorization Resolution Chain
66
+ The CLI checks for authorization in this priority order:
67
+ 1. `--authorization` command line option
68
+ 2. `--config` explicit config file path
69
+ 3. `config.yml` in current working directory
70
+ 4. `THEME_AUTHORIZATION` environment variable
71
+ 5. `~/.config/versacommerce/cli/config.yml` (implicit global config)
72
+
73
+ This is implemented in the `authorization` method on lib/versacommerce/cli/theme.rb:156.
74
+
75
+ #### File Operations Pattern
76
+ All commands follow a pattern:
77
+ 1. Ensure authorization exists (`ensure_authorization!`)
78
+ 2. Save config if `--save-config` flag present
79
+ 3. Validate path is a directory
80
+ 4. Perform operation using `versacommerce-theme_api_client` gem
81
+
82
+ The watch command uses `Listen.to()` with a block that handles modified/added/removed file arrays.
83
+
84
+ ### Dependencies
85
+ - **thor** (~> 1.3) - CLI framework for building command-line interfaces (upgraded from 0.19.1)
86
+ - **listen** (~> 3.9) - File system change monitoring for watch command (upgraded from ~> 2.10)
87
+ - **colorize** (~> 1.1) - Terminal color output for logger (upgraded from 0.7.5)
88
+ - **versacommerce-theme_api_client** (~> 0.1.3) - API client for VersaCommerce Theme API
89
+
90
+ **Note:** For local development, the Gemfile references the local versacommerce-theme_api_client gem to use the Ruby 3.1+ compatible version.
91
+
92
+ ## Version Bumping
93
+ Update `lib/versacommerce/cli/version.rb` with new version number before releasing.
94
+
95
+ **Current version:** 0.3.0 (Ruby 3.1+ support, dependency updates, security fixes)
96
+
97
+ ## Recent Changes (v0.3.0)
98
+
99
+ ### Ruby 3.1+ Upgrade
100
+ - Updated Ruby requirement from >= 2.0.0 to >= 3.1.0
101
+ - Fixed YAML.load_file security vulnerabilities (3 instances in theme.rb)
102
+ - Now uses `YAML.load_file(path, permitted_classes: [Symbol])` for safe loading
103
+ - Modernized string interpolation from % formatting to #{} syntax
104
+ - Fixed Thor 1.x compatibility issues:
105
+ - Changed Pathname default values to strings
106
+ - Added `exit_on_failure?` method
107
+ - Updated all dependencies to Ruby 3.1+ compatible versions
108
+
109
+ ### Testing
110
+ - Added basic smoke tests in `test/smoke_test.rb`
111
+ - Tests verify CLI loading, help commands, and YAML config loading
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 VersaCommerce
3
+ Copyright (c) 2025 VersaCommerce
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -6,7 +6,7 @@ Versacommerce::CLI is a Command Line Interface tool that interacts with several
6
6
 
7
7
  ## Requirements
8
8
 
9
- Ruby ≥ 2.0.0
9
+ Ruby ≥ 3.1.0
10
10
 
11
11
  ## Installation
12
12
 
@@ -33,7 +33,7 @@ module Versacommerce
33
33
  time = Time.now.strftime('%F %R')
34
34
 
35
35
  messages.each do |message|
36
- puts '[%s] -- %s' % [time, message]
36
+ puts "[#{time}] -- #{message}"
37
37
  end
38
38
  end
39
39
  end
@@ -11,22 +11,26 @@ require 'versacommerce/theme_api_client'
11
11
  module Versacommerce
12
12
  module CLI
13
13
  class Theme < Thor
14
+ def self.exit_on_failure?
15
+ true
16
+ end
17
+
14
18
  class_option :authorization, aliases: :a
15
19
  class_option :config, banner: 'CONFIG_PATH', aliases: :c
16
20
  class_option :verbose, type: :boolean, aliases: :v
17
21
  class_option :save_config, banner: 'CONFIG_PATH', aliases: :s
18
22
 
19
23
  desc 'download', 'Downloads a complete Theme from the Theme API.'
20
- option :path, default: Pathname.pwd.join('theme')
24
+ option :path, default: './theme'
21
25
  def download
22
26
  ensure_authorization!
23
27
  save_config
24
28
 
25
29
  path = Pathname.new(options[:path]).expand_path
26
- logger.info('Downloading Theme to %s' % path)
30
+ logger.info("Downloading Theme to #{path}")
27
31
 
28
32
  client.files(recursive: true).each do |file|
29
- logger.debug('Downloading %s' % file.path)
33
+ logger.debug("Downloading #{file.path}")
30
34
  file.reload_content
31
35
  file_path = path.join(file.path)
32
36
  FileUtils.mkdir_p(file_path.parent)
@@ -37,7 +41,7 @@ module Versacommerce
37
41
  end
38
42
 
39
43
  desc 'watch', 'Watches a directory and pushes file changes to the Theme API.'
40
- option :path, default: Pathname.pwd
44
+ option :path, default: '.'
41
45
  def watch
42
46
  ensure_authorization!
43
47
  save_config
@@ -45,7 +49,7 @@ module Versacommerce
45
49
  theme_path = Pathname.new(options[:path]).expand_path
46
50
  validate_path!(theme_path)
47
51
 
48
- logger.info 'Watching %s' % theme_path
52
+ logger.info "Watching #{theme_path}"
49
53
 
50
54
  listener = Listen.to(theme_path) do |modified, added, removed|
51
55
  removed.each { |absolute_path| delete_file(theme_path, absolute_path) }
@@ -66,7 +70,7 @@ module Versacommerce
66
70
  end
67
71
 
68
72
  desc 'upload', 'Uploads a directory and its descendants to the Theme API.'
69
- option :path, default: Pathname.pwd
73
+ option :path, default: '.'
70
74
  def upload
71
75
  ensure_authorization!
72
76
  save_config
@@ -74,9 +78,9 @@ module Versacommerce
74
78
  theme_path = Pathname.new(options[:path]).expand_path
75
79
  validate_path!(theme_path)
76
80
 
77
- logger.info 'Uploading %s' % theme_path
81
+ logger.info "Uploading #{theme_path}"
78
82
  add_directory(theme_path, theme_path)
79
- logger.success('Uploaded %s' % theme_path)
83
+ logger.success("Uploaded #{theme_path}")
80
84
  end
81
85
 
82
86
  private
@@ -86,17 +90,17 @@ module Versacommerce
86
90
  file = client.files.build(path: relative_path, content: File.read(absolute_path))
87
91
 
88
92
  if file.valid?
89
- logger.debug('Trying to add %s' % relative_path)
93
+ logger.debug("Trying to add #{relative_path}")
90
94
 
91
95
  if file.save
92
- logger.success('Added %s' % relative_path)
96
+ logger.success("Added #{relative_path}")
93
97
  else
94
- logger.error('Could not add %s:' % relative_path)
95
- file.errors.full_messages.each { |msg| logger.error(' %s' % msg) }
98
+ logger.error("Could not add #{relative_path}:")
99
+ file.errors.full_messages.each { |msg| logger.error(" #{msg}") }
96
100
  end
97
101
  else
98
- logger.error('Could not add %s:' % relative_path)
99
- file.errors.full_messages.each { |msg| logger.error(' %s' % msg) }
102
+ logger.error("Could not add #{relative_path}:")
103
+ file.errors.full_messages.each { |msg| logger.error(" #{msg}") }
100
104
  end
101
105
  end
102
106
 
@@ -134,7 +138,7 @@ module Versacommerce
134
138
  validate_path!(path)
135
139
  yaml = {'authorization' => authorization}.to_yaml
136
140
  File.write(path.join('config.yml'), yaml)
137
- logger.debug('Saved config.yml to %s' % path)
141
+ logger.debug("Saved config.yml to #{path}")
138
142
  end
139
143
  end
140
144
 
@@ -147,7 +151,7 @@ module Versacommerce
147
151
 
148
152
  def validate_path!(path)
149
153
  unless path.directory?
150
- logger.error('%s is not a directory.' % path)
154
+ logger.error("#{path} is not a directory.")
151
155
  exit 1
152
156
  end
153
157
  end
@@ -157,20 +161,20 @@ module Versacommerce
157
161
  end
158
162
 
159
163
  def explicit_config
160
- @explicit_config ||= options[:config] ? YAML.load_file(options[:config]) : {}
164
+ @explicit_config ||= options[:config] ? YAML.load_file(options[:config], permitted_classes: [Symbol]) : {}
161
165
  end
162
166
 
163
167
  def implicit_pwd_config
164
168
  @implicit_pwd_config ||= begin
165
169
  config = Pathname.pwd.join('config.yml').expand_path
166
- config.file? ? YAML.load_file(config) : {}
170
+ config.file? ? YAML.load_file(config, permitted_classes: [Symbol]) : {}
167
171
  end
168
172
  end
169
173
 
170
174
  def implicit_config
171
175
  @implicit_config ||= begin
172
176
  config = Pathname.new('~/.config/versacommerce/cli/config.yml').expand_path
173
- config.file? ? YAML.load_file(config) : {}
177
+ config.file? ? YAML.load_file(config, permitted_classes: [Symbol]) : {}
174
178
  end
175
179
  end
176
180
 
@@ -1,5 +1,5 @@
1
1
  module Versacommerce
2
2
  module CLI
3
- VERSION = Gem::Version.new('0.2.3')
3
+ VERSION = Gem::Version.new('1.0.1')
4
4
  end
5
5
  end
@@ -5,9 +5,7 @@ require 'versacommerce/cli/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'versacommerce-cli'
7
7
  spec.version = Versacommerce::CLI::VERSION
8
- spec.authors = ['Tobias Bühlmann']
9
- spec.email = ['buehlmann@versacommerce.de']
10
-
8
+ spec.authors = ['VersaCommerce GmbH']
11
9
  spec.summary = 'CLI tool for interacting with several VersaCommerce services.'
12
10
  spec.description = 'Versacommerce::CLI is a Command Line Interface tool that interacts with several VersaCommerce-related services.'
13
11
  spec.homepage = 'https://github.com/versacommerce/versacommerce-cli'
@@ -18,15 +16,15 @@ Gem::Specification.new do |spec|
18
16
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
17
  spec.require_paths = ['lib']
20
18
 
21
- spec.required_ruby_version = '>= 2.0.0'
19
+ spec.required_ruby_version = '>= 3.1.0'
22
20
 
23
- spec.add_runtime_dependency 'thor', '0.19.1'
24
- spec.add_runtime_dependency 'listen', '~> 2.10'
25
- spec.add_runtime_dependency 'colorize', '0.7.5'
26
- spec.add_runtime_dependency 'versacommerce-theme_api_client', '0.1.3'
21
+ spec.add_runtime_dependency 'thor', '~> 1.3'
22
+ spec.add_runtime_dependency 'listen', '~> 3.9'
23
+ spec.add_runtime_dependency 'colorize', '~> 1.1'
24
+ spec.add_runtime_dependency 'versacommerce-theme_api_client', '~> 1.0.1'
27
25
 
28
- spec.add_development_dependency 'bundler', '~> 1.8'
29
- spec.add_development_dependency 'rake', '~> 10.4'
30
- spec.add_development_dependency 'pry', '0.10.1'
31
- spec.add_development_dependency 'pry-stack_explorer', '0.4.9.2'
26
+ spec.add_development_dependency 'bundler', '>= 1.8'
27
+ spec.add_development_dependency 'rake', '~> 13.0'
28
+ spec.add_development_dependency 'pry', '~> 0.14'
29
+ spec.add_development_dependency 'pry-stack_explorer', '~> 0.6'
32
30
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: versacommerce-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Tobias Bühlmann
8
- autorequire:
7
+ - VersaCommerce GmbH
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-18 00:00:00.000000000 Z
11
+ date: 2025-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.19.1
19
+ version: '1.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.19.1
26
+ version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: listen
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.10'
33
+ version: '3.9'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.10'
40
+ version: '3.9'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.7.5
47
+ version: '1.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.7.5
54
+ version: '1.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: versacommerce-theme_api_client
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.3
61
+ version: 1.0.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '='
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.1.3
68
+ version: 1.0.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.8'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.8'
83
83
  - !ruby/object:Gem::Dependency
@@ -86,52 +86,60 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '10.4'
89
+ version: '13.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '10.4'
96
+ version: '13.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '='
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.10.1
103
+ version: '0.14'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '='
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.10.1
110
+ version: '0.14'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry-stack_explorer
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '='
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.4.9.2
117
+ version: '0.6'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '='
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.4.9.2
124
+ version: '0.6'
125
125
  description: Versacommerce::CLI is a Command Line Interface tool that interacts with
126
126
  several VersaCommerce-related services.
127
127
  email:
128
- - buehlmann@versacommerce.de
129
128
  executables:
130
129
  - vc-theme
131
130
  extensions: []
132
131
  extra_rdoc_files: []
133
132
  files:
133
+ - ".DS_Store"
134
+ - ".claude/.DS_Store"
135
+ - ".claude/commands/bump-version.md"
136
+ - ".claude/commands/code-review.md"
137
+ - ".claude/commands/new-task.md"
138
+ - ".claude/commands/verco.md"
139
+ - ".claude/tasks/ruby-3.3-upgrade/onboarding.md"
134
140
  - ".gitignore"
141
+ - ".ruby-version"
142
+ - CLAUDE.md
135
143
  - Gemfile
136
144
  - LICENSE.txt
137
145
  - README.md
@@ -148,7 +156,7 @@ homepage: https://github.com/versacommerce/versacommerce-cli
148
156
  licenses:
149
157
  - MIT
150
158
  metadata: {}
151
- post_install_message:
159
+ post_install_message:
152
160
  rdoc_options: []
153
161
  require_paths:
154
162
  - lib
@@ -156,16 +164,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
164
  requirements:
157
165
  - - ">="
158
166
  - !ruby/object:Gem::Version
159
- version: 2.0.0
167
+ version: 3.1.0
160
168
  required_rubygems_version: !ruby/object:Gem::Requirement
161
169
  requirements:
162
170
  - - ">="
163
171
  - !ruby/object:Gem::Version
164
172
  version: '0'
165
173
  requirements: []
166
- rubyforge_project:
167
- rubygems_version: 2.4.5
168
- signing_key:
174
+ rubygems_version: 3.3.26
175
+ signing_key:
169
176
  specification_version: 4
170
177
  summary: CLI tool for interacting with several VersaCommerce services.
171
178
  test_files: []