mirror of
https://github.com/Ar9av/obsidian-wiki.git
synced 2026-09-14 20:36:34 +08:00
f087b16778
All skills now follow the shared Config Resolution Protocol defined in llm-wiki/SKILL.md: walk up CWD for .env → ~/.obsidian-wiki/config → prompt setup. Eliminates the drift between skills that read only .env, only global config, or inconsistent combinations. - llm-wiki: add canonical Config Resolution Protocol + vault-scoped state algorithm; document all env vars - 14 skills updated to reference the protocol instead of hard-coding their own config loading logic - daily-update: state files are now vault-scoped under ~/.obsidian-wiki/state/<vault-id>/ — multi-vault setups get independent state, not a single global .last_update - daily-update setup mode: terminal notification is now optional, shell-aware (zsh/bash/fish), and skipped for headless/VPS envs - scripts/daily-update.sh: implement CWD-walk config resolution in bash - scripts/wiki-notify.sh: iterate all vault state dirs; shows stale vaults by name; handles multi-vault setups
43 lines
1.5 KiB
Bash
43 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
# Source this from your shell rc file to get wiki freshness reminders on terminal open.
|
|
#
|
|
# Setup (shell-specific):
|
|
# zsh/bash: source /path/to/obsidian-wiki/scripts/wiki-notify.sh
|
|
# fish: bass source /path/to/obsidian-wiki/scripts/wiki-notify.sh
|
|
# (or copy _wiki_notify logic natively using fish syntax)
|
|
#
|
|
# State is vault-scoped under ~/.obsidian-wiki/state/<vault-id>/
|
|
# Multiple vaults are supported — all stale vaults are shown.
|
|
|
|
_wiki_notify() {
|
|
local state_base="$HOME/.obsidian-wiki/state"
|
|
[[ -d "$state_base" ]] || return
|
|
|
|
local now age_s age_h stale last vault_path shown=0
|
|
|
|
now=$(date +%s)
|
|
|
|
# Iterate over all vault state dirs
|
|
for state_dir in "$state_base"/*/; do
|
|
[[ -f "$state_dir/.last_update" ]] || continue
|
|
|
|
last=$(cat "$state_dir/.last_update" 2>/dev/null || echo 0)
|
|
age_s=$(( now - last ))
|
|
|
|
# Only show if >20 hours stale
|
|
(( age_s > 72000 )) || continue
|
|
|
|
age_h=$(( age_s / 3600 ))
|
|
stale=$(cat "$state_dir/.pending_delta" 2>/dev/null || echo 0)
|
|
vault_path=$(cat "$state_dir/.vault_path" 2>/dev/null || echo "unknown vault")
|
|
|
|
echo "┌─ wiki: last synced ${age_h}h ago · ${vault_path##*/}$([ "$stale" -gt 0 ] && echo " · ${stale} source(s) have new content" || echo "")"
|
|
echo "│ /wiki-history-ingest claude sync Claude sessions"
|
|
echo "│ /wiki-status see full delta"
|
|
echo "└─ /memory-bridge diff compare tool memories"
|
|
shown=$(( shown + 1 ))
|
|
done
|
|
}
|
|
|
|
_wiki_notify
|