# Changelog ## 2025-03-28 - 3.1.2 - fix(cli/ups-handler) Improve UPS device listing table formatting for better column alignment - Adjusted header spacing for the Host column and overall table alignment in the UPS handler output. ## 2025-03-28 - 3.1.1 - fix(cli) Improve table header formatting in group and UPS listings - Adjusted column padding in group listing for proper alignment - Fixed UPS table header spacing for consistent CLI output ## 2025-03-28 - 3.1.0 - feat(cli) Refactor CLI commands to use dedicated handlers for UPS, group, and service management - Extracted UPS-related CLI logic into a new UpsHandler - Introduced GroupHandler to manage UPS groups commands - Added ServiceHandler for systemd service operations - Updated CLI routing in cli.ts to delegate commands to the new handlers - Exposed getters for the new handlers in the Nupst class ## 2025-03-28 - 3.0.1 - fix(cli) Simplify UPS ID generation by removing the redundant promptForUniqueUpsId function in the CLI module and replacing it with the shortId helper. - Deleted the unused promptForUniqueUpsId method from ts/cli.ts. - Updated UPS configuration to generate a unique ID directly using helpers.shortId(). - Improved code clarity by removing unnecessary interactive prompts for UPS IDs. ## 2025-03-28 - 3.0.0 - BREAKING CHANGE(core) Add multi-UPS support and group management; update CLI, configuration and documentation to support multiple UPS devices with group modes - Implemented multi-UPS configuration with an array of UPS devices and groups in the configuration file - Added group management commands (group add, edit, delete, list) with redundant and non-redundant modes - Revamped CLI command parsing for UPS management (add, edit, delete, list, setup) and group subcommands - Updated readme and documentation to reflect new configuration structure and features - Enhanced logging and status display for multiple UPS devices ## 2025-03-26 - 2.6.17 - fix(logger) Preserve logbox width after logBoxEnd so that subsequent logBoxLine calls continue using the set width. - Removed the reset of currentBoxWidth in logBoxEnd to allow persistent width across logbox calls. - Ensures that logBoxLine uses the previously set width when no new width is provided. ## 2025-03-26 - 2.6.16 - fix(cli) Improve CLI logging consistency by replacing direct console output with unified logger calls. - Replaced console.log and console.error with logger.log and logger.error in CLI commands - Standardized debug, error, and status messages using logger's logbox utilities - Enhanced consistency of log output throughout the ts/cli.ts file ## 2025-03-26 - 2.6.15 - fix(logger) Replace direct console logging with unified logger interface for consistent formatting - Substitute console.log, console.error, and related calls with logger methods in cli, daemon, systemd, nupst, and index modules - Integrate logBox formatting for structured output and consistent log presentation - Update test expectations in test.logger.ts to check for standardized error messages - Refactor logging calls throughout the codebase for improved clarity and maintainability ## 2025-03-26 - 2.6.14 - fix(systemd) Shorten closing log divider in systemd service installation output for consistent formatting. - Replaced the overly long footer with a shorter one in ts/systemd.ts. - This change improves log readability without affecting functionality. ## 2025-03-26 - 2.6.13 - fix(cli) Fix CLI update output box formatting - Adjusted the closing box line in the update process log messages for consistent visual formatting ## 2025-03-26 - 2.6.12 - fix(systemd) Adjust logging border in systemd service installation output - Updated the closing border line for consistent output formatting in ts/systemd.ts ## 2025-03-26 - 2.6.11 - fix(cli, systemd) Adjust log formatting for consistent output in CLI and systemd commands - Fixed spacing issues in service installation and status log messages in the systemd module. - Revised output formatting in the CLI to improve message clarity. ## 2025-03-26 - 2.6.10 - fix(daemon) Adjust console log box formatting for consistent output in daemon status messages - Updated closing box borders to align properly in configuration error, periodic updates, and UPS status logs - Improved visual consistency in log messages ## 2025-03-26 - 2.6.9 - fix(cli) Improve console output formatting for status banners and logging messages - Standardize banner messages in daemon status updates - Refine version information banner in nupst logging - Update UPS connection and status banners in systemd ## 2025-03-26 - 2.6.8 - fix(cli) Improve CLI formatting, refine debug option filtering, and remove unused dgram import in SNMP manager - Standardize whitespace and formatting in ts/cli.ts for consistency - Refine argument filtering for debug mode and prompt messages - Remove unused 'dgram' import from ts/snmp/manager.ts ## 2025-03-26 - 2.6.7 - fix(setup.sh) Clarify net-snmp dependency installation message in setup.sh - Updated echo statement to indicate installation of net-snmp along with 2 subdependencies - Improves clarity on dependency installation during setup ## 2025-03-26 - 2.6.6 - fix(setup.sh) Improve setup script to detect and execute npm-cli.js directly using the Node.js binary - Replace use of the npm binary with direct execution of npm-cli.js - Add fallback logic to locate npm-cli.js when not found at the expected path - Simplify cleanup by removing unnecessary PATH modifications ## 2025-03-26 - 2.6.5 - fix(daemon, setup) Improve shutdown command detection and fallback logic; update setup script to use absolute Node/npm paths - Use execFileAsync to execute shutdown commands reliably - Add multiple fallback alternatives for shutdown and emergency shutdown handling - Update setup.sh to log the Node and NPM versions using absolute paths without modifying PATH ## 2025-03-26 - 2.6.4 - fix(setup) Improve installation process in setup script by cleaning up package files and ensuring a minimal net-snmp dependency installation. - Remove existing package-lock.json along with node_modules to prevent stale artifacts. - Back up the original package.json before modifying it. - Create a minimal package.json with only the net-snmp dependency based on the backed-up version. - Use a clean install to guarantee that only net-snmp is installed. - Restore the original package.json if the installation fails. ## 2025-03-26 - 2.6.3 - fix(setup) Update setup script to install only net-snmp dependency and create a minimal package-lock.json for better dependency control. - Removed full production dependency install in favor of installing only net-snmp@3.20.0 - Added verification step to confirm net-snmp installation - Generate a minimal package-lock.json if one does not exist ## 2025-03-26 - 2.6.2 - fix(setup/readme) Improve force update instructions and dependency installation process in setup.sh and readme.md - Clarify force update commands with explicit paths in readme.md - Remove existing node_modules before installing dependencies in setup.sh - Switch from 'npm ci --only=production' to 'npm install --omit=dev' with updated error instructions ## 2025-03-26 - 2.6.1 - fix(setup) Update setup.sh to temporarily add vendor Node.js binary to PATH for dependency installation, log Node and npm versions, and restore the original PATH afterwards. - Temporarily prepend vendor Node.js binary directory to PATH to ensure proper npm execution. - Log Node.js and npm versions for debugging purposes. - Restore the original PATH after installing dependencies. ## 2025-03-26 - 2.6.0 - feat(setup) Add --force update flag to setup script and update installation instructions - Implemented --force option in setup.sh to force-update Node.js binary and dependencies - Updated readme.md to document the --force flag and revised update steps - Modified ts/cli.ts update command to pass the --force flag to setup.sh ## 2025-03-26 - 2.5.2 - fix(installer) Improve Node.js binary detection, dependency management, and SNMPv3 fallback logic - Enhanced bin/nupst to detect OS and architecture (Linux and Darwin) and fall back to system Node.js for unsupported platforms - Moved net-snmp from devDependencies to dependencies in package.json - Updated setup.sh to install production dependencies and handle installation errors gracefully - Refined SNMPv3 user configuration and fallback mechanism in ts/snmp/manager.ts - Revised README to clarify minimal runtime dependencies and secure SNMP features ## 2025-03-25 - 2.5.1 - fix(snmp) Fix Eaton UPS support by updating power status OID and adjusting battery runtime conversion. - Updated Eaton UPS power status OID to '1.3.6.1.4.1.534.1.4.4.0' to correctly detect online/battery status. - Added conversion for Eaton UPS battery runtime from seconds to minutes in SNMP manager. ## 2025-03-25 - 2.5.0 - feat(cli) Automatically restart running NUPST service after configuration changes in interactive setup - Added restartServiceIfRunning() to check and restart the service if it's active. - Invoked the restart function post-setup to apply configuration changes immediately. ## 2025-03-25 - 2.4.8 - fix(installer) Improve Git dependency handling and repository cloning in install.sh - Add explicit check for git installation and prompt the user interactively if git is missing. - Auto-install git when '-y' flag is provided in non-interactive mode. - Ensure proper cloning of the repository when running the installer outside the repo. ## 2025-03-25 - 2.4.7 - fix(readme) Update installation instructions to combine download and execution into a single command for clarity - Method 1 now uses a unified one-line command to download and run the install script ## 2025-03-25 - 2.4.6 - fix(installer) Improve installation instructions for interactive and non-interactive setups - Changed install.sh to require explicit download of the install script and updated error messages for non-interactive modes - Updated readme.md to include three distinct installation methods with clear command examples ## 2025-03-25 - 2.4.5 - fix(install) Improve interactive terminal detection and update installation instructions - Enhanced install.sh to better detect non-interactive environments and provide clearer guidance for both interactive and non-interactive installations - Updated README.md quick install instructions to recommend process substitution and clarify auto-yes usage ## 2025-03-25 - 2.4.4 - fix(install) Improve interactive mode detection and non-interactive installation handling in install.sh - Detect and warn when running without a controlling terminal - Attempt to use /dev/tty for user input when possible - Update prompts and error messages for auto-installation of dependencies - Clarify installation instructions in readme for interactive and non-interactive modes ## 2025-03-25 - 2.4.3 - fix(readme) Update Quick Install command syntax in readme for auto-yes installation - Changed installation command to use: curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash -c "bash -s -- -y" ## 2025-03-25 - 2.4.2 - fix(daemon) Refactor shutdown initiation logic in daemon by moving the initiateShutdown and monitorDuringShutdown methods from the SNMP manager to the daemon, and update calls accordingly - Moved initiateShutdown and monitorDuringShutdown to the daemon class for improved cohesion - Updated references in the daemon to call its own shutdown method instead of the SNMP manager - Removed redundant initiateShutdown method from the SNMP manager ## 2025-03-25 - 2.4.1 - fix(docs) Update readme with detailed legal and trademark guidance - Clarified legal section by adding trademark and company information - Ensured users understand that licensing terms do not imply endorsement by the company ## 2025-03-25 - 2.4.0 - feat(installer) Add auto-yes flag to installer and update installation documentation - Enhance install.sh to parse -y/--yes and -h/--help options, automating git installation when auto-yes is provided - Improve user prompts for dependency installation and provide clearer instructions - Update readme.md to document new installer options and enhanced file system and service changes details ## 2025-03-25 - 2.3.0 - feat(installer/cli) Add OS detection and git auto-installation support to install.sh and improve service setup prompt in CLI - Implemented helper functions in install.sh to detect OS type and automatically install git if missing - Prompt user for git installation if not present before cloning the repository - Enhanced CLI service setup flow to offer starting the NUPST service immediately after installation ## 2025-03-25 - 2.2.0 - feat(cli) Add 'config' command to display current configuration and update CLI help - Introduce new 'config' command to show SNMP settings, thresholds, and configuration file location - Update help text to include details for 'nupst config' command ## 2025-03-25 - 2.1.0 - feat(cli) Add uninstall command to CLI and update shutdown delay for graceful VM shutdown - Implement uninstall command in ts/cli.ts that locates and executes uninstall.sh with user prompts - Update uninstall.sh to support environment variables for configuration and repository removal - Increase shutdown delay in ts/snmp/manager.ts from 1 minute to 5 minutes to allow VMs more time to shut down ## 2025-03-25 - 2.0.1 - fix(cli/systemd) Fix status command to pass debug flag and improve systemd status logging output - ts/cli.ts: Now extracts debug options from process arguments and passes debug mode to getStatus. - ts/systemd.ts: Updated getStatus to accept a debugMode parameter, enabling detailed SNMP debug logging, explicitly reloading configuration, and printing connection details. ## 2025-03-25 - 2.0.0 - BREAKING CHANGE(snmp) refactor: update SNMP type definitions and interface names for consistency - Renamed SnmpConfig to ISnmpConfig, OIDSet to IOidSet, UpsStatus to IUpsStatus, and UpsModel to TUpsModel in ts/snmp/types.ts. - Updated internal references in ts/daemon.ts, ts/snmp/index.ts, ts/snmp/manager.ts, ts/snmp/oid-sets.ts, ts/snmp/packet-creator.ts, and ts/snmp/packet-parser.ts to use the new interface names. ## 2025-03-25 - 1.10.1 - fix(systemd/readme) Improve README documentation and fix UPS status retrieval in systemd service - Updated README features and installation instructions to clarify SNMP version support, UPS models, and configuration - Modified default SNMP host to '192.168.1.100' and added 'upsModel' property in configuration examples - Enhanced instructions for real-time log viewing and update process in README - Fixed systemd.ts to use a test configuration with an appropriate timeout when fetching UPS status ## 2025-03-25 - 1.10.0 - feat(core) Add update checking and version logging across startup components - In daemon.ts, log version info on startup and check for updates in the background using npm registry response - In nupst.ts, implement getVersion, checkForUpdates, getUpdateStatus, and compareVersions functions with update notifications - Establish bidirectional reference between Nupst and NupstSnmp to support version logging - Update systemd service status output to include version information ## 2025-03-25 - 1.9.0 - feat(cli) Add update command to CLI to update NUPST from repository and refresh the systemd service - Integrate 'update' subcommand in CLI command parser - Update documentation and help output to include new command - Implement update process that fetches changes from git, runs install.sh/setup.sh, and refreshes systemd service if installed ## 2025-03-25 - 1.8.2 - fix(cli) Refactor logs command to use child_process spawn for real-time log tailing - Replaced execSync call with spawn to properly follow logs - Forward SIGINT to the spawned process for graceful termination - Await the child process exit to ensure clean shutdown of the CLI log command ## 2025-03-25 - 1.8.1 - fix(systemd) Update ExecStart in systemd service template to use /opt/nupst/bin/nupst for daemon startup - Changed ExecStart from '/usr/bin/nupst daemon-start' to '/opt/nupst/bin/nupst daemon-start' in the systemd service file - Ensures the service uses the correct binary installation path ## 2025-03-25 - 1.8.0 - feat(core) Enhance SNMP module and interactive CLI setup for UPS shutdown - Refactored SNMP packet parsing and encoding utilities for clearer error handling and debugging - Improved systemd service management with detailed logging during installation and control - Enhanced interactive CLI setup process for configuring SNMP settings and UPS models - Expanded test coverage with simulated SNMP responses for various response types ## 2025-03-25 - 1.7.6 - fix(core) Refactor SNMP, systemd, and CLI modules to improve error handling, logging, and code clarity - Removed unused dependency 'net-snmp' from package.json - Extracted helper functions for SNMP packet creation and parsing (using SnmpEncoder, SnmpPacketCreator and SnmpPacketParser) - Improved debug logging and added detailed documentation comments across SNMP, systemd, CLI and daemon modules - Refactored systemd service management to extract status display and service disabling logic - Updated test suite to use proper modular methods from the new SNMP utilities ## 2025-03-25 - 1.7.5 - fix(cli) Enable SNMP debug mode in CLI commands and update debug flag handling in daemon-start and test; bump version to 1.7.4 - Call enableDebug() on SNMP client earlier in command parsing - Pass debug flag to 'daemon-start' and 'test' commands for consistent debug output - Update package version from 1.7.3 to 1.7.4 ## 2025-03-25 - 1.7.3 - fix(SNMP) Refine SNMP packet creation and response parsing for more reliable UPS status monitoring - Improve error handling and fallback logic when parsing SNMP responses - Optimize TimeTicks conversion for CyberPower UPS devices - Enhance test coverage for various UPS scenarios ## 2025-03-25 - 1.7.2 - fix(core) Refactor internal SNMP response parsing and enhance daemon logging for improved error reporting and clarity. - Improved fallback and error handling in SNMP response parsing - Enhanced logging messages in daemon and systemd service management - Minor refactoring for better maintainability without functional changes ## 2025-03-25 - 1.7.1 - fix(snmp-cli) Improve SNMP response parsing and CLI UPS connection timeout handling - Expand parsing loop in SNMP responses to capture Gauge32 and Timeticks values - Add detailed debug logging for both SNMP v1/v2 and v3 responses - Configure CLI test commands to use a shortened timeout for UPS connection tests ## 2025-03-25 - 1.7.0 - feat(SNMP/UPS) Add UPS model selection and custom OIDs support to handle different UPS brands - Introduce distinct OID sets for CyberPower, APC, Eaton, TrippLite, Liebert, and a custom option - Update interactive setup to prompt for UPS model selection and custom OID entry when needed - Refactor SNMP status retrieval to dynamically select the appropriate OIDs based on the configured UPS model - Extend default configuration with an upsModel property for consistent behavior ## 2025-03-25 - 1.6.0 - feat(cli,snmp) Enhance debug logging and add debug mode support in CLI and SNMP modules - Enable debug flags (--debug, -d) in CLI to trigger detailed SNMP logging - Pass debug mode options to daemonStart and test commands for improved diagnostics - Add enableDebug method to the SNMP module for on-demand debug logging - Improve timeout and discovery logging details for streamlined troubleshooting ## 2025-03-25 - 1.5.0 - feat(cli) Enhance CLI output: display SNMPv3 auth/priv details and support timeout customization during setup - Display authentication and privacy protocol details when SNMP version is 3 - Show timeout value in the configuration test output - Clear out unused authentication or privacy settings based on selected security level - Allow users to customize SNMP timeout during interactive setup ## 2025-03-25 - 1.4.1 - fix(version) Bump patch version for consistency with commit info ## 2025-03-25 - 1.4.0 - feat(snmp) Implement native SNMPv3 support with simulated encryption and enhanced authentication handling. - Add fully native SNMPv3 GET request implementation replacing the snmpwalk fallback - Simulate encryption for authPriv using AES and DES protocols - Enhance SNMP response parser to properly handle SNMPv3 responses - Introduce detailed security parameter management for SNMPv3 ## 2025-03-25 - 1.3.1 - fix(cli) Remove redundant SNMP tools checks in CLI and Systemd modules - Eliminate unnecessary snmpwalk dependency checks in the test command and interactive setup flow. - Adjust systemd configuration file check to avoid external dependency verification. ## 2025-03-25 - 1.3.0 - feat(cli) add test command to verify UPS SNMP configuration and connectivity - Introduce a new 'test' command in the CLI to check the SNMP configuration and UPS connection. - Validate installation of SNMP tools and configuration file before testing. - Output UPS status details and compare against defined shutdown thresholds. ## 2025-03-25 - 1.2.6 - fix(cli) Refactor interactive setup to use dynamic import for readline and ensure proper cleanup - Replaced synchronous require() with async import for ESM compatibility - Wrapped interactive setup in try/finally to guarantee readline interface closure - Enhanced error logging by outputting error.message ## 2025-03-25 - 1.2.5 - fix(error-handling) Improve error handling in CLI, daemon, and systemd lifecycle management with enhanced logging for configuration issues - Wrap daemon and service start commands in try-catch blocks to properly handle and log errors - Throw explicit errors when configuration file is missing instead of silently defaulting - Enhance log messages for service installation, startup, and status retrieval for clearer debugging ## 2025-03-25 - 1.2.4 - fix(cli/daemon) Improve logging and user feedback in interactive setup and UPS monitoring - Refactor configuration summary output in the interactive setup for clearer display - Enhance logging in the daemon to show detailed SNMP settings and UPS status changes - Improve error messages and user guidance during configuration and monitoring ## 2025-03-24 - 1.2.3 - fix(nupst) No changes ## 2025-03-24 - 1.2.2 - fix(bin/nupst) Improve symlink resolution in launcher script to correctly determine project root based on execution path. - Replace directory determination with readlink for accurate symlink resolution - Set project root to '/opt/nupst' when script is run via symlink from /usr/local/bin - Add debugging comments to assist with path resolution ## 2025-03-24 - 1.2.1 - fix(bin) Simplify Node.js binary detection in installation script - Directly set Node binary path to vendor/node-linux-x64/bin/node - Remove redundant architecture-specific detection logic - Fallback to system Node if vendor binary is not found ## 2025-03-24 - 1.2.0 - feat(installer) Improve Node.js binary detection and dynamic LTS version retrieval in setup scripts - Enhanced bin/nupst to search multiple possible locations for the Node.js binary and fallback to system node if necessary - Updated setup.sh to fetch the latest LTS Node.js version from nodejs.org and use a fallback version when the request fails ## 2025-03-24 - 1.1.2 - fix(setup.sh) Improve error handling in setup.sh: exit immediately when the downloaded npm package lacks the dist_ts directory, removing the fallback build-from-source mechanism. - Removed BUILD_FROM_SOURCE logic that attempted to build from source on missing dist_ts directory - Updated error messages to clearly indicate failure in downloading a valid package - Ensured installation halts if essential files are missing ## 2025-03-24 - 1.1.1 - fix(package.json) Remove unused prepublishOnly script and update files field in package.json - Removed prepublishOnly build trigger - Updated files list to accurately include intended directories and files ## 2025-03-24 - 1.1.0 - feat(installer-setup) Enhance installer and setup scripts for improved global installation and artifact management - Detect piped installation in install.sh, clone repository automatically, and clean up previous installations - Update readme.md with correct repository URL and clearer installation instructions - Improve setup.sh to remove existing dist_ts, download build artifacts from the npm registry, and simplify dependency installation ## 2025-03-24 - 1.0.1 - fix(version) Bump version to 1.0.1 - Updated commitinfo data to reflect the new patch version. - Synchronized version information between commitinfo file and package metadata. ## 2025-03-24 - 1.0.1 - fix(build) Update build script to use 'tsbuild tsfolders --allowimplicitany' and adjust distribution paths in .gitignore - Replaced 'tsc' with 'tsbuild tsfolders --allowimplicitany' in package.json - Updated .gitignore to reflect new compiled distribution folder pattern - Updated changelog to document build improvements and regenerated type definitions ## 2025-03-24 - 1.0.1 - fix(build) Update build script to use 'tsbuild tsfolders --allowimplicitany' and regenerate distribution type definitions for CLI, daemon, index, nupst, snmp, and systemd modules - Replaced 'tsc' command with tsbuild in package.json - Updated .gitignore to reflect new compiled distribution folder pattern - Added new dist_ts files including .d.ts type definitions and compiled JavaScript for multiple modules ## 2025-03-24 - 1.0.1 - fix(build) Update build script to use 'tsbuild tsfolders --allowimplicitany' and regenerate distribution type definitions for CLI, daemon, nupst, snmp, and systemd modules. - Replaced the 'tsc' command with 'tsbuild tsfolders --allowimplicitany' in package.json. - Added new dist_ts files including type definitions (d.ts) and compiled JavaScript for CLI, daemon, index, nupst, snmp, and systemd. - Improved the generated CLI declarations and overall distribution build. ## 2025-03-23 - 1.0.0 - initial setup This range covers the early commits that mainly established the repository structure. - Initial repository commit with basic project initialization.