Skip to content

Conversation

@adcondev
Copy link
Owner

@adcondev adcondev commented Jan 19, 2026

📝 Description

This pull request introduces significant improvements to the release automation, CLI usability, and code quality configuration for the Poster project. The most notable changes include robust fixes to the release workflow to prevent version/tag errors and infinite loops, enhanced printer listing and auto-detection features in the CLI (especially for Windows users), and a clearer, more maintainable linter configuration. Several minor bugs and documentation issues have also been addressed.

Release Workflow and Automation Improvements

  • Added checks in .github/workflows/release.yml to prevent infinite release loops by ignoring commits with "chore(release)" or "[skip ci]" in the message, fixed regex for detecting breaking changes, and added error handling for the release process to avoid "vnull" tags and ensure proper version extraction and tag pushing. Also improved handling of empty release notes and streamlined Go module publication steps. [1] [2] [3] [4]
  • Updated .versionrc.js to restore the 'v' prefix in release tags, ensure both package.json and package-lock.json are updated, and removed Go-specific scripts to prevent Node.js environment crashes. [1] [2]

CLI and Printer Detection Enhancements

  • Expanded CLI options in cmd/poster/main.go to allow listing all, thermal, or physical printers on Windows, with optional JSON output. Improved the printer listing implementation to use the new connection layer, including filtering and detailed output. Updated help and examples accordingly. [1] [2] [3] [4] [5]
  • Enhanced printer auto-detection in cmd/poster/printing.go to prefer default thermal printers, fall back to common name patterns, and finally use the default physical printer if available. Now utilizes the new printer listing/filtering functions for accuracy and maintainability. [1] [2]

Code Quality and Documentation

  • Refactored .golangci.yml for clarity and maintainability, grouping linters by theme, improving documentation, and ensuring the config is suitable for CI environments.
  • Removed outdated or inaccurate changelog entries and improved the changelog header for consistency.

Other Minor Updates

  • Updated the CLI version constant to 4.4.0 in cmd/poster/main.go.
  • Added missing import (os) for JSON output functionality in the CLI.

These changes collectively improve the reliability of releases, enhance the user experience for Windows printer management, and ensure code quality standards are easier to maintain.

🎯 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation only
  • 🔧 Configuration/DevOps
  • ♻️ Code refactoring
  • 📦 Dependency update
  • ⚡ Performance improvement
  • 🧪 Test addition/modification

🎯 Component(s) Affected

  • composer - ESC/POS protocol composer
  • connection - Printer connections
  • commands - ESC/POS command implementations
  • builder - Document builder
  • executor - Document processing
  • graphics - Image processing
  • tables - Table formatting and layout
  • emulator - Visual emulator
  • profile - Printer profiles
  • service - High-level printer service
  • github - GitHub related files and workflows

🧪 How Has This Been Tested?

  • Unit tests pass locally
  • Integration tests pass
  • Manual testing with physical printer
  • Examples built and run successfully
  • Benchmarks show no regression (or improvement)
  • N/A (documentation/configuration only)

Test Configuration

  • Go Version:
  • OS:
  • Printer Model (if applicable):

🤖 Automated Checks

The following automated workflows will run on this PR:

  • 📋 PR Validation - Validates commit message format
  • 🧪 Tests - Runs on Ubuntu, Windows, macOS
  • ⚡ Benchmarks - Compares performance with base branch
  • 🔒 Security Scan - Trivy vulnerability scanner
  • 🔍 Linting - golangci-lint with custom config
  • 🔐 CodeQL - Advanced security analysis

💡 Tip: You can view detailed results in the "Checks" tab above or in the job summary after completion.

✅ Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • My PR title follows Conventional Commits format

📸 Screenshots/Examples

Click to expand
// Example code here

💥 Breaking Changes

  • What breaks:
  • Migration path for users:
  • Why this breaking change is necessary:

🔗 Related Issues

  • Closes #
  • Relates to #
  • Depends on #

📝 Additional Notes


📚 Resources:

…ability

- Replace byte slice initialization with make and append for better clarity
- Update buffer sizes for command construction to enhance performance
- Clean up comments for improved understanding of the code
- Add options to list all, thermal, and physical printers
- Implement error handling for printer enumeration
- Update command-line flags for improved usability
@github-actions
Copy link
Contributor

👋 Thanks for opening this PR, @adcondev!

Here's what will happen next:

  • 🤖 Automated checks will run
  • 🏷️ Labels will be added automatically
  • 👀 A maintainer will review your changes

Please make sure:

  • ✅ All tests pass
  • 📝 The PR title follows conventional commits
  • 📋 The PR template is filled out completely

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enhances printer listing functionality for Windows, improves command buffer allocation efficiency, and modernizes the linting configuration. The changes primarily focus on Windows printer detection and enumeration capabilities while also optimizing memory allocation patterns throughout the codebase.

Changes:

  • Added comprehensive printer listing commands (--list, --list-thermal, --list-physical, --json) with detailed printer information display
  • Refactored printer detection logic to use new enumeration and filtering capabilities
  • Optimized buffer allocation using pre-allocated capacities in command construction and tests
  • Updated linting configuration with detailed comments and modern Go best practices

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 20 comments.

Show a summary per file
File Description
cmd/poster/main.go Added printer listing functionality with JSON output support and new CLI flags
cmd/poster/printing.go Refactored detectPrinter() to use new enumeration functions with thermal printer prioritization
cmd/poster/printing_stub.go Added stub for non-Windows platforms
pkg/connection/windows_enum.go Added error handling and nolint directives for Windows API calls
pkg/connection/windows_connector.go Translated error messages from Spanish to English
pkg/connection/printer_info.go Added documentation comments for PrinterState constants
pkg/commands/*/**.go Optimized buffer allocation using make with capacity
pkg/commands/*/**_test.go Updated test buffer initialization with appropriate capacities
.golangci.yml Modernized configuration with detailed comments and categorized linters

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 19, 2026

⚡ Benchmark Results

📈 Performance Comparison

📊 Click to expand detailed results

Current Branch Results

BenchmarkNewDocument-4    	1000000000	         0.3118 ns/op	       0 B/op	       0 allocs/op
BenchmarkBuildSimple-4    	 3537009	       336.7 ns/op	     240 B/op	       4 allocs/op
BenchmarkBuildComplex-4   	  432735	      2726 ns/op	    1809 B/op	      25 allocs/op
BenchmarkToJSON-4         	  546231	      2114 ns/op	     592 B/op	       3 allocs/op
BenchmarkParseDocument_Minimal-4    	  480549	      2442 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Receipt-4    	   88183	     13760 ns/op	    2392 B/op	      34 allocs/op
BenchmarkCommandUnmarshal_Text-4    	  386734	      2926 ns/op	     568 B/op	      19 allocs/op
BenchmarkCommandUnmarshal_Table-4   	  270788	      4340 ns/op	     944 B/op	      21 allocs/op
BenchmarkTextCommandParsing-4       	  487113	      2344 ns/op	     544 B/op	      16 allocs/op
BenchmarkTableCommandParsing-4      	  236650	      5047 ns/op	    1000 B/op	      29 allocs/op
BenchmarkParseHexString-4           	 8495851	       140.4 ns/op	      48 B/op	       2 allocs/op
BenchmarkCleanHexString-4           	 7425259	       158.8 ns/op	      64 B/op	       2 allocs/op
BenchmarkContainsSequence-4         	370728085	         3.201 ns/op	       0 B/op	       0 allocs/op
BenchmarkCheckCriticalCommands-4    	36325100	        39.32 ns/op	       0 B/op	       0 allocs/op
BenchmarkDocument_Validate-4       	14127766	        85.57 ns/op	       0 B/op	       0 allocs/op
BenchmarkParseDocument_Simple-4    	  484008	      2431 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Complex-4   	  137950	      8567 ns/op	    1352 B/op	      26 allocs/op
BenchmarkPrintImage_Small-4             	     612	   1970734 ns/op	 3469938 B/op	      24 allocs/op
BenchmarkPrintImage_Medium-4            	     327	   3660716 ns/op	 5481086 B/op	      24 allocs/op
BenchmarkPrintImage_ThermalPreview-4    	     139	   8635649 ns/op	 5235278 B/op	  230723 allocs/op

Base Branch Results

BenchmarkNewDocument-4    	1000000000	         0.3215 ns/op	       0 B/op	       0 allocs/op
BenchmarkBuildSimple-4    	 3458590	       327.3 ns/op	     240 B/op	       4 allocs/op
BenchmarkBuildComplex-4   	  392991	      2718 ns/op	    1809 B/op	      25 allocs/op
BenchmarkToJSON-4         	  543312	      2119 ns/op	     592 B/op	       3 allocs/op
BenchmarkParseDocument_Minimal-4    	  482984	      2431 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Receipt-4    	   86986	     13493 ns/op	    2392 B/op	      34 allocs/op
BenchmarkCommandUnmarshal_Text-4    	  391300	      2922 ns/op	     568 B/op	      19 allocs/op
BenchmarkCommandUnmarshal_Table-4   	  239181	      4377 ns/op	     944 B/op	      21 allocs/op
BenchmarkTextCommandParsing-4       	  495489	      2308 ns/op	     544 B/op	      16 allocs/op
BenchmarkTableCommandParsing-4      	  231674	      5020 ns/op	    1000 B/op	      29 allocs/op
BenchmarkParseHexString-4           	 7797360	       157.5 ns/op	      48 B/op	       2 allocs/op
BenchmarkCleanHexString-4           	 7181925	       166.8 ns/op	      64 B/op	       2 allocs/op
BenchmarkContainsSequence-4         	279848709	         4.182 ns/op	       0 B/op	       0 allocs/op
BenchmarkCheckCriticalCommands-4    	32550690	        35.61 ns/op	       0 B/op	       0 allocs/op
BenchmarkDocument_Validate-4       	14174386	        85.38 ns/op	       0 B/op	       0 allocs/op
BenchmarkParseDocument_Simple-4    	  489382	      2425 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Complex-4   	  138763	      8755 ns/op	    1352 B/op	      26 allocs/op
BenchmarkPrintImage_Small-4             	     616	   1996125 ns/op	 3469935 B/op	      24 allocs/op
BenchmarkPrintImage_Medium-4            	     326	   3710162 ns/op	 5481082 B/op	      24 allocs/op
BenchmarkPrintImage_ThermalPreview-4    	     136	   8603230 ns/op	 5235277 B/op	  230723 allocs/op

💡 Note: Use benchstat for statistical comparison

🎯 Summary

  • Total Benchmarks: 32
  • Average Speed: 2655310 ns/op
  • Average Memory: 2396605 B/op
  • Average Allocations: 41093 allocs/op

…lysis

- Updated the golangci-lint configuration to disable all linters by default and enable specific ones.
- Enhanced comments for clarity on each linter's purpose and importance.
- Adjusted settings for gocyclo, goconst, and gosec to improve code quality checks.
- Added configurations for errorlint to enforce better error handling practices.

Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 20, 2026
@adcondev adcondev moved this to In progress in POS RED2000 Jan 20, 2026
Repository owner deleted a comment from Copilot AI Jan 20, 2026
Repository owner deleted a comment from Copilot AI Jan 20, 2026
- Restore 'v' prefix logic in release commit message format
- Update bump files to include both package.json and package-lock.json
- Remove Go-specific scripts that crash the Node.js environment
- Enhance regex for detecting breaking changes in release analysis
- Implement error handling for standard-version execution

Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
@adcondev adcondev merged commit 48118b8 into master Jan 20, 2026
17 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in POS RED2000 Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants