merve HF Staff commited on
Commit
9f020c3
Β·
verified Β·
1 Parent(s): 675dd28

Use plain hermes commands; export HERMES_HOME in shell rc (drop aliases)

Browse files
Files changed (1) hide show
  1. bootstrap.sh +20 -18
bootstrap.sh CHANGED
@@ -215,8 +215,11 @@ chmod 600 "$SECRETS"
215
  ok "Secrets saved to $SECRETS (mode 600)"
216
 
217
  # ----------------------------------------------------------------------------
218
- # 10. Shell aliases
219
  # ----------------------------------------------------------------------------
 
 
 
220
  SHELL_NAME="${SHELL##*/}"
221
  case "$SHELL_NAME" in
222
  zsh) SHELL_RC="$HOME/.zshrc" ;;
@@ -224,29 +227,25 @@ case "$SHELL_NAME" in
224
  *) SHELL_RC="$HOME/.profile" ;;
225
  esac
226
 
227
- # Rewrite the aliases block if we already added one (keeps users on the
228
- # latest definition β€” old runs used a different layout)
229
- if [ -f "$SHELL_RC" ] && grep -q "# hermes-bucket aliases" "$SHELL_RC"; then
230
  python3 - "$SHELL_RC" <<'PY'
231
- import sys, pathlib
232
  p = pathlib.Path(sys.argv[1])
233
  text = p.read_text()
234
- start = text.find("# hermes-bucket aliases")
235
- if start == -1:
236
- sys.exit(0)
237
- end = text.find("\n\n", start)
238
- end = len(text) if end == -1 else end
239
- p.write_text(text[:start].rstrip() + "\n" + text[end:].lstrip("\n"))
240
  PY
241
  fi
242
 
243
  cat >> "$SHELL_RC" <<EOF
244
 
245
- # hermes-bucket aliases (added by bootstrap.sh β€” safe to remove if you'd rather export HERMES_HOME yourself)
246
- alias hermes-here='HERMES_HOME=\$HOME/.hermes-home hermes'
247
- alias hermes-gateway='HERMES_HOME=\$HOME/.hermes-home hermes gateway start'
248
  EOF
249
- ok "Shell aliases written to $SHELL_RC"
250
 
251
  # ----------------------------------------------------------------------------
252
  # 11. Summary + launch
@@ -260,8 +259,11 @@ ${G}βœ“ Ready.${N}
260
  HERMES_HOME: $HOME_DIR (secrets local; everything else symlinks to mount)
261
  Model: Qwen/Qwen3.6-35B-A3B (HF Inference Providers β†’ deepinfra)
262
 
263
- ${C}hermes-here${N} β€” chat in your terminal
264
- ${C}hermes-gateway${N} β€” start Telegram bot (talk from your phone)
 
 
 
265
 
266
  EOF
267
 
@@ -271,5 +273,5 @@ if [ -t 0 ] && [ -t 1 ]; then
271
  export HERMES_HOME="$HOME_DIR"
272
  exec hermes
273
  else
274
- say "Run ${C}source $SHELL_RC${N} then ${C}hermes-here${N} to start chatting."
275
  fi
 
215
  ok "Secrets saved to $SECRETS (mode 600)"
216
 
217
  # ----------------------------------------------------------------------------
218
+ # 10. Persistent HERMES_HOME export in your shell rc
219
  # ----------------------------------------------------------------------------
220
+ # Aliases were unreliable across shells. Exporting the env var instead means
221
+ # every plain `hermes` / `hermes gateway` / `hermes cron` invocation in any new
222
+ # shell uses the shadow dir automatically β€” no special command names.
223
  SHELL_NAME="${SHELL##*/}"
224
  case "$SHELL_NAME" in
225
  zsh) SHELL_RC="$HOME/.zshrc" ;;
 
227
  *) SHELL_RC="$HOME/.profile" ;;
228
  esac
229
 
230
+ # Remove any prior block we added (old alias-based version or earlier export)
231
+ if [ -f "$SHELL_RC" ] && grep -q "# hermes-bucket" "$SHELL_RC"; then
 
232
  python3 - "$SHELL_RC" <<'PY'
233
+ import sys, pathlib, re
234
  p = pathlib.Path(sys.argv[1])
235
  text = p.read_text()
236
+ # Strip every block we previously injected, identified by the marker comment
237
+ new = re.sub(r"\n*# hermes-bucket[^\n]*\n(?:[^\n]*\n)*?(?=\n|\Z)", "\n", text)
238
+ p.write_text(new)
 
 
 
239
  PY
240
  fi
241
 
242
  cat >> "$SHELL_RC" <<EOF
243
 
244
+ # hermes-bucket: export HERMES_HOME so 'hermes', 'hermes gateway', 'hermes cron'
245
+ # all use the bucket-backed shadow dir. Remove this if you'd rather manage it yourself.
246
+ export HERMES_HOME="\$HOME/.hermes-home"
247
  EOF
248
+ ok "Added 'export HERMES_HOME=$HOME_DIR' to $SHELL_RC"
249
 
250
  # ----------------------------------------------------------------------------
251
  # 11. Summary + launch
 
259
  HERMES_HOME: $HOME_DIR (secrets local; everything else symlinks to mount)
260
  Model: Qwen/Qwen3.6-35B-A3B (HF Inference Providers β†’ deepinfra)
261
 
262
+ ${C}hermes${N} β€” chat in your terminal
263
+ ${C}hermes gateway run${N} β€” start Telegram bot in the foreground (Ctrl-C to stop)
264
+ ${C}hermes gateway install${N} && ${C}hermes gateway start${N} β€” run gateway as a background service
265
+
266
+ Open a new shell (or run ${C}source $SHELL_RC${N}) so HERMES_HOME is picked up automatically.
267
 
268
  EOF
269
 
 
273
  export HERMES_HOME="$HOME_DIR"
274
  exec hermes
275
  else
276
+ say "Run ${C}source $SHELL_RC${N} then ${C}hermes${N} to start chatting."
277
  fi