Compare commits

...

14 Commits

Author SHA1 Message Date
60eadaf6a1 5.1.10
Some checks failed
CI / Type Check & Lint (push) Successful in 5s
CI / Build Test (Current Platform) (push) Successful in 5s
Publish to npm / npm-publish (push) Failing after 20s
CI / Build All Platforms (push) Successful in 57s
Release / build-and-release (push) Successful in 54s
2025-10-23 18:25:52 +00:00
bd52ba4cb2 fix(config): Synchronize deno.json version with package.json, tidy formatting, and add local tooling settings 2025-10-23 18:25:52 +00:00
a3d6a8b75d 5.1.9
Some checks failed
CI / Type Check & Lint (push) Successful in 6s
CI / Build Test (Current Platform) (push) Successful in 6s
Publish to npm / npm-publish (push) Failing after 5s
Release / build-and-release (push) Failing after 3s
CI / Build All Platforms (push) Successful in 48s
2025-10-23 18:19:51 +00:00
fbd71b1f3b fix(dev): new gitzone cli 2025-10-23 18:19:51 +00:00
6481572981 fix(version): read current version from deno.json and latest version from Gitea API
Some checks failed
CI / Type Check & Lint (push) Successful in 5s
CI / Build Test (Current Platform) (push) Successful in 5s
Publish to npm / npm-publish (push) Failing after 27s
Release / build-and-release (push) Successful in 54s
CI / Build All Platforms (push) Successful in 1m8s
- Replace static commitinfo with dynamic deno.json import
- Change version check from npm registry to Gitea releases API
- Delete obsolete ts/00_commitinfo_data.ts
- Ensures version consistency across updates
2025-10-23 16:17:30 +00:00
0dc14a6ea1 5.1.7
Some checks failed
CI / Type Check & Lint (push) Successful in 6s
CI / Build Test (Current Platform) (push) Successful in 5s
Publish to npm / npm-publish (push) Failing after 20s
Release / build-and-release (push) Successful in 51s
CI / Build All Platforms (push) Successful in 57s
2025-10-23 13:25:32 +00:00
dea344e6ba feat(status): display power metrics in service status output
Some checks failed
CI / Type Check & Lint (push) Successful in 7s
CI / Build Test (Current Platform) (push) Successful in 5s
CI / Build All Platforms (push) Has been cancelled
2025-10-23 13:24:55 +00:00
f81f5957ab 5.1.6
Some checks failed
CI / Type Check & Lint (push) Successful in 5s
CI / Build Test (Current Platform) (push) Successful in 6s
CI / Build All Platforms (push) Successful in 53s
Publish to npm / npm-publish (push) Failing after 53s
Release / build-and-release (push) Successful in 1m7s
2025-10-23 13:18:22 +00:00
281d3fbbeb fix(ci): correct setup-deno action version to install Deno 2.x
Some checks failed
CI / Type Check & Lint (push) Successful in 9s
CI / Build Test (Current Platform) (push) Successful in 8s
CI / Build All Platforms (push) Has been cancelled
2025-10-23 13:17:56 +00:00
c1cb136a7d 5.1.5
Some checks failed
CI / Type Check & Lint (push) Failing after 4s
CI / Build Test (Current Platform) (push) Failing after 3s
CI / Build All Platforms (push) Failing after 3s
Release / build-and-release (push) Failing after 4s
2025-10-23 13:15:44 +00:00
b80275a594 5.1.3
Some checks failed
CI / Type Check & Lint (push) Failing after 4s
CI / Build Test (Current Platform) (push) Failing after 4s
CI / Build All Platforms (push) Failing after 4s
Release / build-and-release (push) Failing after 4s
2025-10-23 13:03:35 +00:00
b64a515c94 set deno version 2025-10-23 13:03:29 +00:00
68c4eb6480 5.1.2
Some checks failed
CI / Type Check & Lint (push) Failing after 3s
CI / Build Test (Current Platform) (push) Failing after 3s
CI / Build All Platforms (push) Failing after 3s
Release / build-and-release (push) Failing after 3s
2025-10-23 13:00:24 +00:00
6c8f6ac33f fix(scripts): Add build script to package.json and include local dev tool settings 2025-10-23 13:00:24 +00:00
12 changed files with 211 additions and 201 deletions

View File

@@ -0,0 +1,31 @@
## NUPST {{VERSION}}
Pre-compiled binaries for multiple platforms.
### Installation
#### Option 1: Via npm (recommended)
```bash
npm install -g @serve.zone/nupst
```
#### Option 2: Via installer script
```bash
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash
```
#### Option 3: Direct binary download
Download the appropriate binary for your platform from the assets below and make it executable.
### Supported Platforms
- Linux x86_64 (x64)
- Linux ARM64 (aarch64)
- macOS x86_64 (Intel)
- macOS ARM64 (Apple Silicon)
- Windows x86_64
### Checksums
SHA256 checksums are provided in `SHA256SUMS.txt` for binary verification.
### npm Package
The npm package includes automatic binary detection and installation for your platform.

View File

@@ -21,7 +21,7 @@ jobs:
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: v2.x
- name: Check TypeScript types
run: deno check mod.ts
@@ -45,7 +45,7 @@ jobs:
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: v2.x
- name: Compile for current platform
run: |
@@ -71,7 +71,7 @@ jobs:
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: v2.x
- name: Compile all platform binaries
run: bash scripts/compile-all.sh

View File

@@ -0,0 +1,129 @@
name: Publish to npm
on:
push:
tags:
- 'v*'
jobs:
npm-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v2.x
- name: Setup Node.js for npm publishing
uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org/'
- name: Get version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT
echo "Publishing version: $VERSION"
- name: Verify deno.json version matches tag
run: |
DENO_VERSION=$(grep -o '"version": "[^"]*"' deno.json | cut -d'"' -f4)
TAG_VERSION="${{ steps.version.outputs.version_number }}"
echo "deno.json version: $DENO_VERSION"
echo "Tag version: $TAG_VERSION"
if [ "$DENO_VERSION" != "$TAG_VERSION" ]; then
echo "ERROR: Version mismatch!"
echo "deno.json has version $DENO_VERSION but tag is $TAG_VERSION"
exit 1
fi
- name: Compile binaries for npm package
run: |
echo "Compiling binaries for npm package..."
deno task compile
echo ""
echo "Binary sizes:"
ls -lh dist/binaries/
- name: Generate SHA256 checksums
run: |
cd dist/binaries
sha256sum * > SHA256SUMS
cat SHA256SUMS
cd ../..
- name: Sync package.json version
run: |
VERSION="${{ steps.version.outputs.version_number }}"
echo "Syncing package.json to version ${VERSION}..."
npm version ${VERSION} --no-git-tag-version --allow-same-version
echo "package.json version: $(grep '"version"' package.json | head -1)"
- name: Create npm package
run: |
echo "Creating npm package..."
npm pack
echo ""
echo "Package created:"
ls -lh *.tgz
- name: Test local installation
run: |
echo "Testing local package installation..."
PACKAGE_FILE=$(ls *.tgz)
npm install -g ${PACKAGE_FILE}
echo ""
echo "Testing nupst command:"
nupst --version || echo "Note: Binary execution may fail in CI environment"
echo ""
echo "Checking installed files:"
npm ls -g @serve.zone/nupst || true
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "Publishing to npm registry..."
npm publish --access public
echo ""
echo "✅ Successfully published @serve.zone/nupst to npm!"
echo ""
echo "Package info:"
npm view @serve.zone/nupst
- name: Verify npm package
run: |
echo "Waiting for npm propagation..."
sleep 30
echo ""
echo "Verifying published package..."
npm view @serve.zone/nupst
echo ""
echo "Testing installation from npm:"
npm install -g @serve.zone/nupst
echo ""
echo "Package installed successfully!"
which nupst || echo "Binary location check skipped"
- name: Publish Summary
run: |
echo "================================================"
echo " npm Publish Complete!"
echo "================================================"
echo ""
echo "✅ Package: @serve.zone/nupst"
echo "✅ Version: ${{ steps.version.outputs.version }}"
echo ""
echo "Installation:"
echo " npm install -g @serve.zone/nupst"
echo ""
echo "Registry:"
echo " https://www.npmjs.com/package/@serve.zone/nupst"
echo ""

View File

@@ -18,7 +18,7 @@ jobs:
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: v2.x
- name: Get version from tag
id: version

View File

@@ -1,183 +0,0 @@
name: Publish to npm
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 5.0.6)'
required: true
type: string
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v4
# Setup Deno
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
# Setup Node.js for npm publishing
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org/'
# Compile binaries for all platforms
- name: Compile binaries
run: |
echo "Compiling binaries for all platforms..."
deno task compile
echo ""
echo "Binary sizes:"
ls -lh dist/binaries/
# Update version in package.json if triggered manually
- name: Update version in package.json
if: github.event_name == 'workflow_dispatch'
run: |
VERSION=${{ github.event.inputs.version }}
echo "Updating package.json to version ${VERSION}"
npm version ${VERSION} --no-git-tag-version
# Extract version from tag if triggered by tag push
- name: Extract version from tag
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "Extracted version: ${VERSION}"
# Ensure versions are synchronized
- name: Sync versions
run: |
if [ -n "${VERSION}" ]; then
echo "Syncing version ${VERSION} across files..."
# Update deno.json
sed -i "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/" deno.json
# Update package.json
npm version ${VERSION} --no-git-tag-version --allow-same-version
echo "Updated versions:"
echo "deno.json: $(grep '"version"' deno.json)"
echo "package.json: $(grep '"version"' package.json | head -1)"
fi
# Generate SHA256 checksums for binaries
- name: Generate checksums
run: |
cd dist/binaries
sha256sum * > SHA256SUMS
echo "Checksums generated:"
cat SHA256SUMS
cd ../..
# Create npm package
- name: Create npm package
run: |
echo "Creating npm package..."
npm pack
echo ""
echo "Package created:"
ls -lh *.tgz
# Test package installation locally
- name: Test local installation
run: |
echo "Testing local package installation..."
PACKAGE_FILE=$(ls *.tgz)
npm install -g ${PACKAGE_FILE}
echo ""
echo "Testing nupst command:"
nupst --version || echo "Note: Binary execution may fail in CI environment"
echo ""
echo "Checking installed files:"
npm ls -g @serve.zone/nupst
# Publish to npm (only on tag push or manual trigger)
- name: Publish to npm
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "Publishing to npm registry..."
npm publish --access public
echo ""
echo "✅ Successfully published @serve.zone/nupst to npm!"
echo ""
echo "Package info:"
npm view @serve.zone/nupst
# Create GitHub Release (only on tag push)
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
dist/binaries/nupst-*
dist/binaries/SHA256SUMS
*.tgz
generate_release_notes: true
body: |
## NUPST ${{ env.VERSION }}
### Installation
#### Via npm (recommended)
```bash
npm install -g @serve.zone/nupst
```
#### Direct download
Download the appropriate binary for your platform from the assets below.
### Platform Support
- Linux x64 / ARM64
- macOS x64 / ARM64 (Apple Silicon)
- Windows x64
### Checksums
SHA256 checksums are available in `SHA256SUMS` file.
# Verify the published package
verify:
needs: build-and-publish
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Wait for npm propagation
run: sleep 30
- name: Verify npm package
run: |
echo "Verifying published package..."
npm view @serve.zone/nupst
echo ""
echo "Testing installation from npm:"
npm install -g @serve.zone/nupst
echo ""
echo "Package installed successfully!"
which nupst || echo "Binary location check skipped"

View File

@@ -1,5 +1,26 @@
# Changelog
## 2025-10-23 - 5.1.10 - fix(config)
Synchronize deno.json version with package.json, tidy formatting, and add local tooling settings
- Bumped deno.json version to 5.1.9 to match package.json/commitinfo
- Reformatted deno.json arrays (lint, fmt, compilerOptions) for readability
- Added .claude/settings.local.json for local development/tooling permissions (no runtime behaviour changes)
## 2025-10-23 - 5.1.9 - fix(dev)
Add local assistant permissions/settings file (.claude/settings.local.json)
- Added .claude/settings.local.json containing local assistant permission configuration used for development tasks (deno check, deno lint/format, npm/pack, running packaged binaries, etc.)
- This is a development/local configuration file and does not change runtime behavior or product code paths
- Patch version bump recommended
## 2025-10-23 - 5.1.2 - fix(scripts)
Add build script to package.json and include local dev tool settings
- Add a 'build' script to package.json (no-op placeholder) to provide an explicit build step
- Minor scripts section formatting tidy in package.json
- Add a hidden local settings file for development tooling permissions to the repository (local-only configuration)
## 2025-10-23 - 5.1.1 - fix(tooling)
Add .claude/settings.local.json with local automation permissions

View File

@@ -1,6 +1,6 @@
{
"name": "@serve.zone/nupst",
"version": "5.0.5",
"version": "5.1.10",
"exports": "./mod.ts",
"nodeModulesDir": "auto",
"tasks": {
@@ -15,7 +15,9 @@
},
"lint": {
"rules": {
"tags": ["recommended"]
"tags": [
"recommended"
]
}
},
"fmt": {
@@ -26,7 +28,9 @@
"singleQuote": true
},
"compilerOptions": {
"lib": ["deno.window"],
"lib": [
"deno.window"
],
"strict": true
},
"imports": {

View File

@@ -249,7 +249,7 @@ echo ""
# Restart service if it was running before update
if [ $SERVICE_WAS_RUNNING -eq 1 ]; then
echo "Restarting NUPST service..."
systemctl start nupst
systemctl restart nupst
echo "Service restarted successfully."
echo ""
fi

View File

@@ -1,6 +1,6 @@
{
"name": "@serve.zone/nupst",
"version": "5.1.1",
"version": "5.1.10",
"description": "Network UPS Shutdown Tool - Monitor SNMP-enabled UPS devices and orchestrate graceful system shutdowns during power emergencies",
"keywords": [
"ups",
@@ -34,7 +34,8 @@
"scripts": {
"postinstall": "node scripts/install-binary.js",
"prepublishOnly": "echo 'Publishing NUPST binaries to npm...'",
"test": "echo 'Tests are run with Deno: deno task test'"
"test": "echo 'Tests are run with Deno: deno task test'",
"build": "echo 'no build needed'"
},
"files": [
"bin/",

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/nupst',
version: '5.1.1',
version: '5.1.10',
description: 'Network UPS Shutdown Tool - Monitor SNMP-enabled UPS devices and orchestrate graceful system shutdowns during power emergencies'
}

View File

@@ -1,7 +1,7 @@
import { NupstSnmp } from './snmp/manager.ts';
import { NupstDaemon } from './daemon.ts';
import { NupstSystemd } from './systemd.ts';
import { commitinfo } from './00_commitinfo_data.ts';
import denoConfig from '../deno.json' with { type: 'json' };
import { logger } from './logger.ts';
import { UpsHandler } from './cli/ups-handler.ts';
import { GroupHandler } from './cli/group-handler.ts';
@@ -105,7 +105,7 @@ export class Nupst {
* @returns The current version string
*/
public getVersion(): string {
return commitinfo.version;
return denoConfig.version;
}
/**
@@ -153,8 +153,8 @@ export class Nupst {
private getLatestVersion(): Promise<string> {
return new Promise<string>((resolve, reject) => {
const options = {
hostname: 'registry.npmjs.org',
path: '/@serve.zone/nupst',
hostname: 'code.foss.global',
path: '/api/v1/repos/serve.zone/nupst/releases/latest',
method: 'GET',
headers: {
'Accept': 'application/json',
@@ -172,10 +172,14 @@ export class Nupst {
res.on('end', () => {
try {
const response = JSON.parse(data);
if (response['dist-tags'] && response['dist-tags'].latest) {
resolve(response['dist-tags'].latest);
if (response.tag_name) {
// Strip 'v' prefix from tag name (e.g., "v5.1.7" -> "5.1.7")
const version = response.tag_name.startsWith('v')
? response.tag_name.substring(1)
: response.tag_name;
resolve(version);
} else {
reject(new Error('Failed to parse version from npm registry response'));
reject(new Error('Failed to parse version from Gitea API response'));
}
} catch (error) {
reject(error);

View File

@@ -355,6 +355,9 @@ WantedBy=multi-user.target
logger.log(` Battery: ${batteryColor(status.batteryCapacity + '%')} ${batterySymbol} Runtime: ${getRuntimeColor(status.batteryRuntime)(status.batteryRuntime + ' min')}`);
// Display power metrics
logger.log(` Load: ${theme.highlight(status.outputLoad + '%')} Power: ${theme.highlight(status.outputPower + 'W')} Voltage: ${theme.highlight(status.outputVoltage + 'V')} Current: ${theme.highlight(status.outputCurrent + 'A')}`);
// Display host info
logger.log(` ${theme.dim(`Host: ${ups.snmp.host}:${ups.snmp.port}`)}`);