Commit Graph

12 Commits

Author SHA1 Message Date
fb4d776bdd fix(migration): properly transform v3 flat structure to v4 nested snmp config
All checks were successful
CI / Type Check & Lint (push) Successful in 6s
CI / Build Test (Current Platform) (push) Successful in 8s
Release / build-and-release (push) Successful in 48s
CI / Build All Platforms (push) Successful in 51s
The v3→v4 migration was only renaming upsList to upsDevices without
transforming the device structure. V3 had a flat structure with SNMP
fields directly on the device object, while v4 expects a nested 'snmp'
object.

This commit fixes the migration to:
- Move host, port, community, version, etc. into nested snmp object
- Convert version from string to number
- Add default timeout (5000ms)
- Create thresholds object with defaults
- Preserve all SNMPv1, v2c, and v3 authentication fields

Also includes install.sh fix for better non-interactive handling.
2025-10-19 21:32:55 +00:00
016681b77b feat(migrations): add migration system for v3→v4 config format
- Create abstract BaseMigration class with order, shouldRun(), migrate()
- Add MigrationRunner to execute migrations in order
- Add Migration v1→v2 (snmp → upsDevices)
- Add Migration v3→v4 (upsList → upsDevices)
- Update INupstConfig with version field
- Update loadConfig() to run migrations automatically
- Update saveConfig() to ensure version field and remove legacy fields
- Update Docker test scripts to use real UPS data from .nogit/env.json
- Remove colors.bright (not available in @std/fmt/colors)

Config migrations allow users to jump versions (e.g., v1→v4) with all
intermediate migrations running automatically. Version field tracks
config format for future migrations.
2025-10-19 20:41:09 +00:00
f8269a1cb7 feat(cli): add beautiful colored output and fix daemon exit bug
Some checks failed
CI / Type Check & Lint (push) Failing after 6s
CI / Build Test (Current Platform) (push) Successful in 6s
Release / build-and-release (push) Successful in 44s
CI / Build All Platforms (push) Successful in 50s
CI / Type Check & Lint (pull_request) Failing after 5s
CI / Build Test (Current Platform) (pull_request) Successful in 5s
CI / Build All Platforms (pull_request) Successful in 49s
Major improvements:
- Created color theme system (ts/colors.ts) with ANSI colors
- Enhanced logger with colors, table formatting, and styled boxes
- Fixed daemon exit bug - now stays running when no UPS configured
- Added config hot-reload with file watcher for live updates
- Beautified CLI help output with color-coded commands
- Added showcase test demonstrating all output features
- Fixed ANSI code handling for perfect table/box alignment

Features:
- Color-coded messages (success=green, error=red, warning=yellow, info=cyan)
- Status symbols (●○◐◯ for running/stopped/starting/unknown)
- Battery level colors (green>60%, yellow 30-60%, red<30%)
- Table formatting with auto-sizing and column alignment
- Styled boxes (success, error, warning, info styles)
- Hot-reload: daemon watches config file and reloads automatically
- Idle mode: daemon stays alive when no devices, checks periodically

Daemon improvements:
- No longer exits when no UPS devices configured
- Enters idle monitoring loop waiting for config
- File watcher detects config changes in real-time
- Auto-reloads and starts monitoring when devices added
- Logs warnings instead of errors for missing devices

Technical fixes:
- Strip ANSI codes when calculating text width for alignment
- Use visible length for padding calculations in tables and boxes
- Properly handle colored text in table cells and box lines

Breaking changes: None (backward compatible)
2025-10-19 15:08:30 +00:00
a63ec16d63 fix(version): make version programmatic by reading from deno.json
All checks were successful
CI / Type Check & Lint (push) Successful in 6s
CI / Build Test (Current Platform) (push) Successful in 8s
CI / Build All Platforms (push) Successful in 48s
Release / build-and-release (push) Successful in 37s
- Replace hardcoded version in 00_commitinfo_data.ts
- Now dynamically imports deno.json and reads version
- Version will auto-update when deno.json is changed
- Fixes version showing 3.1.2 instead of 4.0.0

test: add Docker test scripts for v3→v4 migration
- 01-setup-v3-container.sh: Creates systemd container with v3
- 02-test-v3-to-v4-migration.sh: Tests migration (now fixed)
- 03-cleanup.sh: Removes test container
- README.md: Complete documentation

Tested: Version now correctly shows 4.0.0
2025-10-19 14:26:53 +00:00
071ded9c41 style: configure deno fmt to use single quotes
All checks were successful
CI / Build All Platforms (Tag/Main only) (push) Has been skipped
CI / Type Check & Lint (push) Successful in 6s
CI / Build Test (Current Platform) (push) Successful in 6s
- Add singleQuote: true to deno.json fmt configuration
- Reformat all files with single quotes using deno fmt
2025-10-19 13:14:18 +00:00
1705ffe2be test: switch to Deno native testing framework
- Remove tapbundle and @git.zone/tstest dependency
- Use Deno.test() and @std/assert for all tests
- Update test imports to use jsr:@std/assert
- All 10 logger tests passing with native Deno test runner
- Simplified test configuration in deno.json
- Tests are now completely dependency-free (only standard library)
2025-10-18 16:01:38 +00:00
968cbbd8fc test: update tests for Deno with @git.zone/tstest/tapbundle
- Update tapbundle imports from @push.rocks to @git.zone/tstest
- Change all test file imports from .js to .ts extensions
- Tests verified working with Deno runtime
- All 10 logger tests passing
- SNMP tests ready for Deno execution
2025-10-18 15:58:20 +00:00
0e55f22dad BREAKING CHANGE(core): Add multi-UPS support and group management; update CLI, configuration and documentation to support multiple UPS devices with group modes 2025-03-28 16:19:43 +00:00
f3de3f0618 fix(logger): Replace direct console logging with unified logger interface for consistent formatting 2025-03-26 22:28:38 +00:00
03056d279d update 2025-03-26 22:19:24 +00:00
5a13e49803 update to use net-snmp 2025-03-26 13:13:01 +00:00
1e74fbe367 initial 2025-03-25 09:06:23 +00:00