ework-aio 0.1.13 → 0.1.15

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.
Files changed (2) hide show
  1. package/bin/install.sh +18 -6
  2. package/package.json +1 -1
package/bin/install.sh CHANGED
@@ -204,7 +204,12 @@ ensure_user_session() {
204
204
  if [[ -z "${XDG_RUNTIME_DIR:-}" && -d "$rundir" ]]; then
205
205
  export XDG_RUNTIME_DIR="$rundir"
206
206
  fi
207
- if [[ -z "${DBUS_SESSION_BUS_ADDRESS:-}" && -S "${XDG_RUNTIME_DIR}/bus" ]]; then
207
+ # ${XDG_RUNTIME_DIR:-} not bare ${XDG_RUNTIME_DIR}: the first if above only
208
+ # exports when /run/user/$uid exists. On hosts without linger / without any
209
+ # login session, /run/user/$uid is absent, XDG_RUNTIME_DIR stays unset, and
210
+ # `set -u` would kill install here before the systemd_reachable() fallback
211
+ # can route to PID-file mode.
212
+ if [[ -z "${DBUS_SESSION_BUS_ADDRESS:-}" && -S "${XDG_RUNTIME_DIR:-}/bus" ]]; then
208
213
  export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
209
214
  fi
210
215
 
@@ -447,19 +452,25 @@ EOF
447
452
  fi
448
453
  }
449
454
 
450
- # ctl wraps `systemctl $SCOPENAME` with two hardenings over the bare command:
455
+ # ctl wraps `systemctl $SCOPENAME` with three hardenings over the bare command:
451
456
  # 1. If output contains "Unit ... not found", retry once after daemon-reload
452
457
  # — fresh user sessions (no linger, post-ssh-reconnect) often have a stale
453
458
  # unit cache and this is the standard fix.
454
- # 2. If output mentions bus connection failure, print an actionable hint
455
- # instead of letting the raw "No medium found" / "Failed to connect to
456
- # bus" message through unchanged.
459
+ # 2. If output mentions any D-Bus / user-bus connection failure, print an
460
+ # actionable hint. The user-bus daemon emits several variants across
461
+ # hosts and bash versions ("Failed to connect to bus", "No medium found",
462
+ # "Failed to get D-Bus connection: Operation not permitted",
463
+ # "Call to org.freedesktop.DBus ... failed"); we match the common stem
464
+ # "bus" / "D-Bus" so a new variant can't slip past.
465
+ # 3. ALWAYS return systemctl's real exit code. Previously the trailing
466
+ # `printf` masked the failure (returning 0) when no pattern matched,
467
+ # which made every caller's `|| fallback` silently not fire.
457
468
  ctl() {
458
469
  local out rc
459
470
  out="$(systemctl "$SCOPENAME" "$@" 2>&1)"
460
471
  rc=$?
461
472
  if [[ $rc -ne 0 ]]; then
462
- if [[ "$out" == *"Failed to connect to bus"* || "$out" == *"No medium found"* ]]; then
473
+ if [[ "$out" == *([Bb]us|D-Bus|No medium found)* ]]; then
463
474
  cat >&2 <<EOF
464
475
  ${c_red}systemctl $SCOPENAME failed to reach the user bus.${c_reset}
465
476
  $out
@@ -485,6 +496,7 @@ EOF
485
496
  fi
486
497
  fi
487
498
  printf '%s\n' "$out"
499
+ return "$rc"
488
500
  }
489
501
 
490
502
  # ─── Config mode: read/change runtime .env keys ─────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-aio",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "All-in-one installer for ework (issue tracker) + ework-daemon (AI bridge) + opencode-ework (plugin). One command: npm i -g ework-aio && ework-aio install.",
5
5
  "type": "module",
6
6
  "license": "MIT",