The version check was comparing "4.0.8" (no prefix) with "v4.0.8"
(with prefix), causing it to always think an update was available.
Now both versions are normalized to have the "v" prefix before
comparison, so "Already up to date!" works correctly.
Now `nupst update` checks current version against latest release before
downloading anything.
Behavior:
- Fetches latest version from Gitea API
- Compares with current version
- Shows "Already up to date!" if versions match
- Only downloads/installs if newer version available
Example output when up to date:
Checking for updates...
Current version: v4.0.8
Latest version: v4.0.8
✓ Already up to date!
The update command was still using v3 logic (git pull, setup.sh) which
doesn't work for v4 binary distribution.
Now it simply:
1. Downloads install.sh from main branch
2. Runs it (handles download, stop, replace, restart automatically)
This is much simpler and matches how v4 is distributed. No more git,
no more setup.sh, just download the latest binary.
Comprehensive type safety improvements across all CLI handlers and daemon:
**Error handling type fixes:**
- Add 'error instanceof Error' checks before accessing error.message throughout
- Fix all error/retryError/stdError/upsError type assertions
- Replace direct error.message with proper type guards
**Switch case improvements:**
- Wrap case block declarations in braces to satisfy deno-lint
- Fix no-case-declarations warnings in CLI command handlers
**Null/undefined safety:**
- Add checks for config.snmp and config.thresholds before access
- Fix IUpsStatus lastStatusChange to handle undefined with default value
- Add proper null checks in legacy configuration paths
**Type annotations:**
- Add explicit type annotations to lambda parameters (groupId, updateAvailable, etc.)
- Add TUpsModel type cast for 'cyberpower' default
- Import and use INupstConfig type where needed
**Parameter type fixes:**
- Fix implicit 'any' type errors in array callbacks
- Add type annotations to filter/find/map parameters
Files modified:
- ts/cli.ts: config.snmp/thresholds null checks, unused error variable fixes
- ts/cli/group-handler.ts: 4 error.message fixes + 2 parameter type annotations
- ts/cli/service-handler.ts: 3 error.message fixes
- ts/cli/ups-handler.ts: 5 error.message fixes + config checks + TUpsModel import
- ts/daemon.ts: 8 error.message fixes + IUpsStatus lastStatusChange fix + updateAvailable type
- ts/nupst.ts: 1 error.message fix
- ts/systemd.ts: 5 error.message fixes + parameter type annotation
All tests passing (3/3 SNMP tests + 10/10 logger tests)
Type check: ✓ No errors
- Created deno.json configuration
- Updated all imports to use npm:net-snmp@3.20.0
- Changed all Node.js built-in imports to node: specifiers
- Updated all .js extensions to .ts in imports
- Created mod.ts as Deno entry point
- Ready for Phase 3: CLI simplification