@rubytech/taskmaster 1.0.80 → 1.0.81

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.80",
3
- "commit": "4b23b81707c4c708452321ea22668367d4337662",
4
- "builtAt": "2026-02-20T21:20:38.650Z"
2
+ "version": "1.0.81",
3
+ "commit": "a402844e35cc24943b6f70f99f815b821447d02e",
4
+ "builtAt": "2026-02-20T21:39:25.223Z"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubytech/taskmaster",
3
- "version": "1.0.80",
3
+ "version": "1.0.81",
4
4
  "description": "AI-powered business assistant for small businesses",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -42,6 +42,16 @@ case "$OS" in
42
42
  esac
43
43
  echo "Platform: $PLATFORM ($OS)"
44
44
 
45
+ # ── Helper: run a command as root (uses sudo if not already root) ────────────
46
+
47
+ as_root() {
48
+ if [ "$(id -u)" = "0" ]; then
49
+ "$@"
50
+ else
51
+ sudo "$@"
52
+ fi
53
+ }
54
+
45
55
  # ── Check Node.js ────────────────────────────────────────────────────────────
46
56
 
47
57
  REQUIRED_NODE_MAJOR=22
@@ -68,8 +78,8 @@ install_node() {
68
78
  echo "Installing Node.js v${REQUIRED_NODE_MAJOR}..."
69
79
  if [ "$PLATFORM" = "linux" ]; then
70
80
  if command -v apt-get >/dev/null 2>&1; then
71
- curl -fsSL "https://deb.nodesource.com/setup_${REQUIRED_NODE_MAJOR}.x" | sudo -E bash -
72
- sudo apt-get install -y nodejs
81
+ curl -fsSL "https://deb.nodesource.com/setup_${REQUIRED_NODE_MAJOR}.x" | as_root bash -
82
+ as_root apt-get install -y nodejs
73
83
  else
74
84
  echo "Unsupported Linux package manager. Install Node.js v${REQUIRED_NODE_MAJOR}+ manually."
75
85
  exit 1
@@ -99,11 +109,7 @@ fi
99
109
 
100
110
  echo ""
101
111
  echo "Installing Taskmaster..."
102
- if [ "$(id -u)" = "0" ]; then
103
- npm install -g @rubytech/taskmaster
104
- else
105
- sudo npm install -g @rubytech/taskmaster
106
- fi
112
+ as_root npm install -g @rubytech/taskmaster
107
113
 
108
114
  # Verify
109
115
  if ! command -v taskmaster >/dev/null 2>&1; then
@@ -114,87 +120,87 @@ fi
114
120
 
115
121
  echo "Taskmaster: $(taskmaster --version 2>/dev/null || echo 'installed')"
116
122
 
117
- # ── Run provision ────────────────────────────────────────────────────────────
123
+ # ── Linux platform setup (hostname, mDNS, linger) ───────────────────────────
118
124
 
119
- echo ""
120
- PROVISION_ARGS=""
121
- if [ -n "$PORT" ]; then
122
- PROVISION_ARGS="--port $PORT"
123
- fi
124
-
125
- REAL_USER="${SUDO_USER:-$(whoami)}"
126
125
  MDNS_PORT="${PORT:-18789}"
127
126
 
128
- if [ "$(id -u)" = "0" ] && [ "$REAL_USER" != "root" ]; then
129
- # ── Running as root via sudo ──
130
- # Platform setup needs root. Provision (config, workspace, daemon) needs
131
- # to run as the real user so paths resolve to their home and systemctl
132
- # --user has a D-Bus session.
133
-
134
- if [ "$PLATFORM" = "linux" ]; then
135
- echo "Platform setup..."
127
+ if [ "$PLATFORM" = "linux" ]; then
128
+ echo ""
129
+ echo "Platform setup..."
136
130
 
137
- # Avahi / mDNS
138
- apt-get install -y avahi-daemon avahi-utils >/dev/null 2>&1 \
139
- && echo " avahi-daemon installed" \
140
- || echo " avahi-daemon install failed (continuing)"
131
+ # Avahi / mDNS
132
+ as_root apt-get install -y avahi-daemon avahi-utils >/dev/null 2>&1 \
133
+ && echo " avahi-daemon installed" \
134
+ || echo " avahi-daemon install failed (continuing)"
141
135
 
142
- # Hostname — include port to avoid conflicts with other instances on the network
143
- if [ "$MDNS_PORT" = "18789" ]; then
144
- TM_HOSTNAME="taskmaster"
136
+ # Hostname — include port to avoid conflicts with other instances on the network
137
+ if [ "$MDNS_PORT" = "18789" ]; then
138
+ TM_HOSTNAME="taskmaster"
139
+ else
140
+ TM_HOSTNAME="taskmaster-${MDNS_PORT}"
141
+ fi
142
+ as_root hostnamectl set-hostname "$TM_HOSTNAME" 2>/dev/null \
143
+ && echo " hostname set to '${TM_HOSTNAME}'" \
144
+ || echo " hostname set failed (continuing)"
145
+
146
+ # Ensure /etc/hosts resolves the new hostname (sudo warns otherwise).
147
+ # Raspberry Pi OS uses 127.0.1.1 for the hostname; other distros may use
148
+ # 127.0.0.1. We update an existing 127.0.1.1 line if present (replacing
149
+ # the old hostname like "raspberrypi"), otherwise append a new entry.
150
+ if ! grep -q "$TM_HOSTNAME" /etc/hosts 2>/dev/null; then
151
+ if grep -q "^127\.0\.1\.1" /etc/hosts 2>/dev/null; then
152
+ as_root sed -i "s/^127\.0\.1\.1.*/127.0.1.1\t$TM_HOSTNAME/" /etc/hosts
145
153
  else
146
- TM_HOSTNAME="taskmaster-${MDNS_PORT}"
147
- fi
148
- hostnamectl set-hostname "$TM_HOSTNAME" 2>/dev/null \
149
- && echo " hostname set to '${TM_HOSTNAME}'" \
150
- || echo " hostname set failed (continuing)"
151
-
152
- # Ensure /etc/hosts resolves the new hostname (sudo warns otherwise).
153
- # Raspberry Pi OS uses 127.0.1.1 for the hostname; other distros may use
154
- # 127.0.0.1. We update an existing 127.0.1.1 line if present (replacing
155
- # the old hostname like "raspberrypi"), otherwise append a new entry.
156
- if ! grep -q "$TM_HOSTNAME" /etc/hosts 2>/dev/null; then
157
- if grep -q "^127\.0\.1\.1" /etc/hosts 2>/dev/null; then
158
- sed -i "s/^127\.0\.1\.1.*/127.0.1.1\t$TM_HOSTNAME/" /etc/hosts
159
- else
160
- echo "127.0.1.1 $TM_HOSTNAME" >> /etc/hosts
161
- fi
154
+ echo "127.0.1.1 $TM_HOSTNAME" | as_root tee -a /etc/hosts >/dev/null
162
155
  fi
156
+ fi
163
157
 
164
- # Remove stale avahi service file from previous installs (conflicts with gateway Bonjour)
165
- rm -f /etc/avahi/services/taskmaster.service
158
+ # Remove stale avahi service file from previous installs (conflicts with gateway Bonjour)
159
+ as_root rm -f /etc/avahi/services/taskmaster.service
166
160
 
167
- # Restart avahi so it picks up the new hostname
168
- systemctl restart avahi-daemon 2>/dev/null || true
169
- echo " mDNS: ${TM_HOSTNAME}.local ready"
161
+ # Restart avahi so it picks up the new hostname
162
+ as_root systemctl restart avahi-daemon 2>/dev/null || true
163
+ echo " mDNS: ${TM_HOSTNAME}.local ready"
170
164
 
171
- # Tailscale (for optional internet access via Funnel)
172
- if ! command -v tailscale >/dev/null 2>&1; then
173
- curl -fsSL https://tailscale.com/install.sh | sh >/dev/null 2>&1 \
174
- && echo " tailscale installed" \
175
- || echo " tailscale install failed (continuing)"
176
- else
177
- echo " tailscale already installed"
178
- fi
165
+ # Tailscale (for optional internet access via Funnel)
166
+ if ! command -v tailscale >/dev/null 2>&1; then
167
+ curl -fsSL https://tailscale.com/install.sh | sh >/dev/null 2>&1 \
168
+ && echo " tailscale installed" \
169
+ || echo " tailscale install failed (continuing)"
170
+ else
171
+ echo " tailscale already installed"
172
+ fi
179
173
 
180
- # Enable user services so systemctl --user works after logout
181
- REAL_UID=$(id -u "$REAL_USER")
182
- loginctl enable-linger "$REAL_USER" 2>/dev/null || true
183
- systemctl start "user@${REAL_UID}.service" 2>/dev/null || true
174
+ # Enable user services so systemctl --user works after logout
175
+ REAL_USER="${SUDO_USER:-$(whoami)}"
176
+ REAL_UID=$(id -u "$REAL_USER")
177
+ as_root loginctl enable-linger "$REAL_USER" 2>/dev/null || true
178
+ as_root systemctl start "user@${REAL_UID}.service" 2>/dev/null || true
179
+
180
+ # Wait for user D-Bus session bus
181
+ for _i in $(seq 1 10); do
182
+ [ -S "/run/user/$REAL_UID/bus" ] && break
183
+ sleep 0.5
184
+ done
185
+ fi
184
186
 
185
- # Wait for user D-Bus session bus
186
- for _i in $(seq 1 10); do
187
- [ -S "/run/user/$REAL_UID/bus" ] && break
188
- sleep 0.5
189
- done
190
- fi
187
+ # ── Run provision ────────────────────────────────────────────────────────────
188
+
189
+ echo ""
190
+ PROVISION_ARGS=""
191
+ if [ -n "$PORT" ]; then
192
+ PROVISION_ARGS="--port $PORT"
193
+ fi
191
194
 
192
- # Resolve real user's home
195
+ REAL_USER="${SUDO_USER:-$(whoami)}"
196
+
197
+ if [ "$(id -u)" = "0" ] && [ "$REAL_USER" != "root" ]; then
198
+ # Running as root via sudo — provision must run as the real user so paths
199
+ # resolve to their home and systemctl --user has a D-Bus session.
193
200
  REAL_HOME=$(getent passwd "$REAL_USER" 2>/dev/null | cut -d: -f6)
194
201
  [ -z "$REAL_HOME" ] && REAL_HOME="/home/$REAL_USER"
195
202
  REAL_UID=$(id -u "$REAL_USER")
196
203
 
197
- # Run provision as the real user
198
204
  # shellcheck disable=SC2086
199
205
  sudo -u "$REAL_USER" \
200
206
  HOME="$REAL_HOME" \