unbound-cli 1.16.14 → 1.16.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unbound-cli",
3
- "version": "1.16.14",
3
+ "version": "1.16.16",
4
4
  "description": "CLI tool for Unbound - AI Gateway management",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -346,6 +346,9 @@ Examples:
346
346
  output.error(
347
347
  'The status command only supports macOS (reads launchctl state).\n' +
348
348
  ' Linux: systemctl --user status unbound-scheduled.timer\n' +
349
+ // WSL2, containers, and headless boxes have no systemd user session,
350
+ // so the installer falls back to a crontab entry instead.
351
+ " (crontab fallback: crontab -l | grep 'ai.getunbound.scheduled')\n" +
349
352
  ' Windows: Get-ScheduledTask -TaskName "ai.getunbound.scheduled"'
350
353
  );
351
354
  process.exitCode = 1;
@@ -0,0 +1,37 @@
1
+ const { test } = require('node:test');
2
+ const assert = require('node:assert/strict');
3
+ const { Command } = require('commander');
4
+ const { register } = require('../src/commands/discover');
5
+ const output = require('../src/output');
6
+
7
+ // `discover status` only reads macOS launchctl state; on other platforms it
8
+ // prints guidance pointing at the native scheduler. The installer uses a systemd
9
+ // user timer where one exists but falls back to a crontab entry on WSL2,
10
+ // containers, and headless boxes — so the guidance must mention both.
11
+ function guidanceOnPlatform(plat) {
12
+ const origPlatform = Object.getOwnPropertyDescriptor(process, 'platform');
13
+ const origError = output.error;
14
+ let captured = '';
15
+ output.error = (msg) => { captured += String(msg); };
16
+ Object.defineProperty(process, 'platform', { value: plat, configurable: true });
17
+ try {
18
+ const program = new Command();
19
+ register(program);
20
+ program.parse(['node', 'unbound', 'discover', 'status']);
21
+ return captured;
22
+ } finally {
23
+ Object.defineProperty(process, 'platform', origPlatform);
24
+ output.error = origError;
25
+ process.exitCode = 0;
26
+ }
27
+ }
28
+
29
+ test('discover status guidance on Linux offers the systemd timer check', () => {
30
+ const msg = guidanceOnPlatform('linux');
31
+ assert.match(msg, /systemctl --user status unbound-scheduled\.timer/);
32
+ });
33
+
34
+ test('discover status guidance on Linux also offers the crontab fallback', () => {
35
+ const msg = guidanceOnPlatform('linux');
36
+ assert.match(msg, /crontab -l \| grep 'ai\.getunbound\.scheduled'/);
37
+ });