ework-aio 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/bin/install.sh +40 -18
  2. package/package.json +1 -1
package/bin/install.sh CHANGED
@@ -94,14 +94,13 @@ ensure_pkg() {
94
94
  }
95
95
  case "$MODE" in
96
96
  install)
97
- log "Ensuring npm packages are installed..."
98
- ensure_pkg "ework-web"
99
- ensure_pkg "ework-daemon"
100
- # opencode-ework is a library, not a bin; check node_modules
101
- if ! [[ -d "$(npm root -g)/opencode-ework" ]] \
102
- && ! [[ -d "$(npm root -g)/ework-aio/node_modules/opencode-ework" ]]; then
103
- npm install -g opencode-ework || die "npm install -g opencode-ework failed"
104
- fi
97
+ log "Installing/updating npm packages globally..."
98
+ # Install each as a top-level global so bins are linked to PATH.
99
+ # (npm v9 doesn't hoist nested deps' bins from `npm i -g ework-aio`.)
100
+ # Always run `npm install -g` (not gated on presence) so re-runs pick up new versions.
101
+ for pkg in ework-web ework-daemon opencode-ework ework-aio; do
102
+ npm install -g "$pkg@latest" || die "npm install -g $pkg@latest failed"
103
+ done
105
104
  ok "npm packages ready"
106
105
 
107
106
  # Absolute paths to the bin shims (resolved once, baked into systemd units)
@@ -416,17 +415,25 @@ if [[ ! -f "$OPENCODE_CFG" ]]; then
416
415
  cat > "$OPENCODE_CFG" <<'EOF'
417
416
  {
418
417
  "$schema": "https://opencode.ai/config.json",
419
- "plugin": ["opencode-ework"]
418
+ "plugin": ["opencode-ework@latest"]
420
419
  }
421
420
  EOF
422
- elif grep -q '"opencode-ework"' "$OPENCODE_CFG"; then
423
- ok "opencode-ework already in $OPENCODE_CFG"
421
+ elif grep -qE '"opencode-ework(@latest)?"' "$OPENCODE_CFG"; then
422
+ if grep -q '"opencode-ework@latest"' "$OPENCODE_CFG"; then
423
+ ok "opencode-ework@latest already in $OPENCODE_CFG"
424
+ else
425
+ log "Upgrading opencode-ework → opencode-ework@latest in $OPENCODE_CFG"
426
+ cp "$OPENCODE_CFG" "$OPENCODE_CFG.bak.$(date +%s)"
427
+ tmp=$(mktemp)
428
+ jq '(.plugin // []) | map(if . == "opencode-ework" then "opencode-ework@latest" else . end)' \
429
+ "$OPENCODE_CFG" > "$tmp" && mv "$tmp" "$OPENCODE_CFG"
430
+ ok "Plugin upgraded (backup at $OPENCODE_CFG.bak.*)"
431
+ fi
424
432
  else
425
- log "Merging opencode-ework into existing $OPENCODE_CFG"
433
+ log "Merging opencode-ework@latest into existing $OPENCODE_CFG"
426
434
  cp "$OPENCODE_CFG" "$OPENCODE_CFG.bak.$(date +%s)"
427
- # Use jq to append to plugin array (creates array if missing)
428
435
  tmp=$(mktemp)
429
- jq 'if .plugin then .plugin += ["opencode-ework"] else . + {plugin:["opencode-ework"]} end' \
436
+ jq 'if .plugin then .plugin += ["opencode-ework@latest"] else . + {plugin:["opencode-ework@latest"]} end' \
430
437
  "$OPENCODE_CFG" > "$tmp" && mv "$tmp" "$OPENCODE_CFG"
431
438
  ok "Plugin registered (backup at $OPENCODE_CFG.bak.*)"
432
439
  fi
@@ -437,8 +444,23 @@ ok "Install complete."
437
444
  hr
438
445
  printf '\n%s→%s Open %shttp://127.0.0.1:%s/login%s\n' \
439
446
  "$c_bold" "$c_reset" "$c_dim" "$WORK_PORT" "$c_reset"
440
- printf ' Login token: %s%s%s\n' "$c_bold" "$WORK_TOKEN_VAL" "$c_reset"
441
- printf ' Logs: ework-aio logs web | ework-aio logs daemon\n'
442
- printf ' Status: ework-aio status\n'
443
- printf ' Uninstall: ework-aio uninstall\n'
447
+ printf ' Operator login: %s%s%s (auto-promoted admin; derived from $USER at install time)\n' \
448
+ "$c_bold" "$USER" "$c_reset"
449
+ printf ' Login token: %s%s%s\n' "$c_bold" "$WORK_TOKEN_VAL" "$c_reset"
450
+ printf ' Bot user: %s%s%s (auto-created, used by ework-daemon)\n' \
451
+ "$c_bold" "$BOT_NAME" "$c_reset"
452
+ printf ' Data dir: %s%s%s\n' "$c_dim" "$DATA_DIR" "$c_reset"
453
+ printf ' Logs: ework-aio logs web | ework-aio logs daemon\n'
454
+ printf ' Status: ework-aio status\n'
455
+ printf ' Uninstall: ework-aio uninstall\n'
456
+ hr
457
+ printf '\n%sNext steps (optional config)%s\n' "$c_bold" "$c_reset"
458
+ printf ' • 朗读 (TTS): %shttp://127.0.0.1:%s/admin/tts%s — needs an OpenAI-compat /audio/speech endpoint\n' \
459
+ "$c_dim" "$WORK_PORT" "$c_reset"
460
+ printf ' • 翻译: edit %s%s/.env%s, set WORK_TRANSLATE_URL + WORK_TRANSLATE_MODEL\n' \
461
+ "$c_dim" "$WEB_DATA_DIR" "$c_reset"
462
+ printf ' (OpenAI-compat /v1/chat/completions endpoint), then: ework-aio install\n'
463
+ printf ' • Per-project webhook: open %s/<owner>/<repo>/webhooks%s to wire downstream\n' \
464
+ "$c_dim" "$c_reset"
465
+ printf ' consumers (GitHub Actions, etc.). Gitea-compat payload + HMAC-SHA256 sig.\n'
444
466
  hr
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-aio",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
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",