burnboard-cli 0.3.0 → 0.3.1

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.
@@ -16,10 +16,80 @@ node -e 'require("fs").writeFileSync(process.argv[1],JSON.stringify({serverUrl:p
16
16
  node - "$HOME/.claude/settings.json" <<'NODE'
17
17
  const fs=require('fs'),file=process.argv[2],current=fs.existsSync(file)?JSON.parse(fs.readFileSync(file,'utf8')):{};current.env=current.env||{};for(const key of ['CLAUDE_CODE_ENABLE_TELEMETRY','OTEL_METRICS_EXPORTER','OTEL_LOGS_EXPORTER','OTEL_EXPORTER_OTLP_METRICS_PROTOCOL','OTEL_EXPORTER_OTLP_METRICS_ENDPOINT','OTEL_EXPORTER_OTLP_METRICS_HEADERS','OTEL_METRIC_EXPORT_INTERVAL','OTEL_METRICS_INCLUDE_SESSION_ID'])delete current.env[key];fs.writeFileSync(file,JSON.stringify(current,null,2)+"\n");
18
18
  NODE
19
- printf '[3/5] Scheduling automatic sync...\n'; (crontab -l 2>/dev/null|grep -Ev 'burnboard/agent.mjs|burnboard-cli@latest update'||true;echo "*/5 * * * * $(command -v node) $INSTALL_DIR/agent.mjs >/dev/null 2>&1";echo "0 4 * * * $(command -v npx) --yes --prefer-online burnboard-cli@latest update >/dev/null 2>&1";echo "@reboot sleep 180 && $(command -v npx) --yes --prefer-online burnboard-cli@latest update >/dev/null 2>&1")|crontab -
19
+ printf '[3/5] Scheduling automatic sync...\n'
20
+ NODE_BIN="$(command -v node)"; NPX_BIN="$(command -v npx)"
21
+ if command -v crontab >/dev/null 2>&1; then
22
+ (crontab -l 2>/dev/null|grep -Ev 'burnboard/agent.mjs|burnboard-cli@latest update'||true;echo "*/5 * * * * $NODE_BIN $INSTALL_DIR/agent.mjs >/dev/null 2>&1";echo "0 4 * * * $NPX_BIN --yes --prefer-online burnboard-cli@latest update >/dev/null 2>&1";echo "@reboot sleep 180 && $NPX_BIN --yes --prefer-online burnboard-cli@latest update >/dev/null 2>&1")|crontab -
23
+ SCHEDULER="cron"
24
+ elif command -v systemctl >/dev/null 2>&1 && systemctl --user show-environment >/dev/null 2>&1; then
25
+ UNIT_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"; mkdir -p "$UNIT_DIR"
26
+ cat >"$UNIT_DIR/burnboard-sync.service" <<EOF
27
+ [Unit]
28
+ Description=BurnBoard token sync
29
+ [Service]
30
+ Type=oneshot
31
+ ExecStart=$NODE_BIN %h/.burnboard/agent.mjs
32
+ EOF
33
+ cat >"$UNIT_DIR/burnboard-sync.timer" <<'EOF'
34
+ [Unit]
35
+ Description=Sync BurnBoard usage every five minutes
36
+ [Timer]
37
+ OnBootSec=2min
38
+ OnUnitActiveSec=5min
39
+ AccuracySec=30s
40
+ Persistent=true
41
+ [Install]
42
+ WantedBy=timers.target
43
+ EOF
44
+ cat >"$UNIT_DIR/burnboard-update.service" <<EOF
45
+ [Unit]
46
+ Description=Update BurnBoard tracker
47
+ [Service]
48
+ Type=oneshot
49
+ ExecStart=$NPX_BIN --yes --prefer-online burnboard-cli@latest update
50
+ EOF
51
+ cat >"$UNIT_DIR/burnboard-update.timer" <<'EOF'
52
+ [Unit]
53
+ Description=Check for BurnBoard updates daily
54
+ [Timer]
55
+ OnBootSec=3min
56
+ OnUnitActiveSec=1d
57
+ AccuracySec=10min
58
+ Persistent=true
59
+ [Install]
60
+ WantedBy=timers.target
61
+ EOF
62
+ systemctl --user daemon-reload
63
+ systemctl --user enable --now burnboard-sync.timer burnboard-update.timer >/dev/null
64
+ SCHEDULER="systemd user timers"
65
+ else
66
+ LOOP="$INSTALL_DIR/run-loop.sh"
67
+ cat >"$LOOP" <<EOF
68
+ #!/usr/bin/env sh
69
+ while :; do
70
+ "$NODE_BIN" "$INSTALL_DIR/agent.mjs" >/dev/null 2>&1
71
+ now=\$(date +%s); last=0; [ -f "$INSTALL_DIR/last-loop-update" ] && last=\$(cat "$INSTALL_DIR/last-loop-update" 2>/dev/null || echo 0)
72
+ if [ \$((now-last)) -ge 86400 ]; then "$NPX_BIN" --yes --prefer-online burnboard-cli@latest update >/dev/null 2>&1 && printf '%s' "\$now" >"$INSTALL_DIR/last-loop-update"; fi
73
+ sleep 300
74
+ done
75
+ EOF
76
+ chmod 700 "$LOOP"
77
+ if [[ -f "$INSTALL_DIR/loop.pid" ]]; then OLD_PID="$(cat "$INSTALL_DIR/loop.pid" 2>/dev/null || true)"; if [[ -n "$OLD_PID" && -r "/proc/$OLD_PID/cmdline" ]] && tr '\0' ' ' <"/proc/$OLD_PID/cmdline" | grep -q 'run-loop.sh'; then kill "$OLD_PID" 2>/dev/null || true; fi; fi
78
+ nohup "$LOOP" </dev/null >"$INSTALL_DIR/loop.log" 2>&1 & echo $! >"$INSTALL_DIR/loop.pid"
79
+ AUTOSTART_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/autostart"; mkdir -p "$AUTOSTART_DIR"
80
+ cat >"$AUTOSTART_DIR/burnboard.desktop" <<EOF
81
+ [Desktop Entry]
82
+ Type=Application
83
+ Name=BurnBoard Sync
84
+ Exec=$LOOP
85
+ Terminal=false
86
+ X-GNOME-Autostart-enabled=true
87
+ EOF
88
+ SCHEDULER="portable background service"
89
+ fi
20
90
  if [[ "$(uname -s)" == "Darwin" ]] && ! pgrep -x Antigravity >/dev/null 2>&1 && [[ -d "/Applications/Antigravity.app" ]]; then open -a Antigravity; sleep 8; fi
21
91
  printf '[4/5] Counting and uploading local history'; OUT="$INSTALL_DIR/setup-sync.out"; ERR="$INSTALL_DIR/setup-sync.err"; node "$INSTALL_DIR/agent.mjs" >"$OUT" 2>"$ERR" & PID=$!
22
92
  while kill -0 "$PID" 2>/dev/null; do printf '.'; sleep 1; done
23
93
  if ! wait "$PID"; then printf '\n'; cat "$ERR" >&2; rm -f "$OUT" "$ERR"; exit 1; fi
24
94
  printf '\n[5/5] Complete\n'; cat "$OUT"; rm -f "$OUT" "$ERR"
25
- echo "Burnboard is connected: $SERVER_URL$PROFILE"; echo "Codex, Claude Code, Cursor, and both supported Antigravity installations sync every 5 minutes. Burnboard checks for updates daily."
95
+ echo "Burnboard is connected: $SERVER_URL$PROFILE"; echo "Codex, Claude Code, Cursor, and both supported Antigravity installations sync every 5 minutes using $SCHEDULER. Burnboard checks for updates daily."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "burnboard-cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Connect local AI coding token usage to BurnBoard",
5
5
  "type": "module",
6
6
  "bin": {