From 769580af75431e570342b7ee9670cfbb56369ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Tue, 26 May 2026 22:47:13 -0300 Subject: [PATCH] chore(scripts): add test-personal-wiki.sh + NUWIKI_DEV_NO_SEED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test-personal-wiki.sh wraps start-vim.sh to open the user's real wiki at ~/.vimwiki/personal_wiki (override with NUWIKI_PERSONAL_WIKI) — used when reproducing user-reported bugs against actual content instead of the seeded smoke-test wiki. Also adds a NUWIKI_DEV_NO_SEED env var to start-vim.sh so seed_wiki doesn't drop a scratch Notes.wiki into the user's real notes when we point WIKI_DIR at an already-populated wiki. Co-Authored-By: Claude Sonnet 4.6 --- start-vim.sh | 5 +++++ test-personal-wiki.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 test-personal-wiki.sh diff --git a/start-vim.sh b/start-vim.sh index dd59973..af21f20 100755 --- a/start-vim.sh +++ b/start-vim.sh @@ -12,6 +12,7 @@ # ./start-vim.sh path/to/note.wiki # open a specific file # NUWIKI_DEV_WIKI=/tmp/foo ./start-vim.sh # NUWIKI_DEV_NO_LSP=1 ./start-vim.sh # skip vim-lsp setup +# NUWIKI_DEV_NO_SEED=1 ./start-vim.sh # use WIKI_DIR as-is (no scratch seeding) # NUWIKI_DEV_SKIP_BUILD=1 ./start-vim.sh # reuse the cached binary # # The release binary is rebuilt on every launch so source changes @@ -77,6 +78,10 @@ ensure_vim_lsp() { } seed_wiki() { + if [[ "${NUWIKI_DEV_NO_SEED:-0}" == "1" ]]; then + log "NUWIKI_DEV_NO_SEED=1 — skipping wiki seed (using $WIKI_DIR as-is)" + return + fi mkdir -p "$WIKI_DIR" "$WIKI_DIR/diary" if [[ ! -f "$WIKI_DIR/index.wiki" ]]; then cat > "$WIKI_DIR/index.wiki" <<'EOF' diff --git a/test-personal-wiki.sh b/test-personal-wiki.sh new file mode 100755 index 0000000..ca006a2 --- /dev/null +++ b/test-personal-wiki.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# +# test-personal-wiki.sh — open the user's real personal wiki via start-vim.sh. +# +# Reuses start-vim.sh's plumbing (binary build, vim-lsp clone, viminfo +# under the dev cache) but points the wiki root at ~/.vimwiki/personal_wiki +# and disables seed_wiki so we don't drop a scratch `Notes.wiki` into your +# real notes. +# +# Useful when reproducing a user-reported bug against actual content rather +# than the seeded smoke-test wiki. State (viminfo/sessions) still lives +# under $XDG_CACHE_HOME/nuwiki-dev/ so your real Vim install stays untouched. +# +# Usage: +# ./test-personal-wiki.sh # open index.wiki +# ./test-personal-wiki.sh path/to/note.wiki # open a specific file +# NUWIKI_PERSONAL_WIKI=/other/path ./test-personal-wiki.sh +# NUWIKI_DEV_SKIP_BUILD=1 ./test-personal-wiki.sh # reuse the cached binary + +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +WIKI_DIR="${NUWIKI_PERSONAL_WIKI:-$HOME/.vimwiki/personal_wiki}" + +if [[ ! -d "$WIKI_DIR" ]]; then + echo "test-personal-wiki: $WIKI_DIR does not exist" >&2 + echo "set NUWIKI_PERSONAL_WIKI to point at your wiki, or create the default path" >&2 + exit 1 +fi + +export NUWIKI_DEV_WIKI="$WIKI_DIR" +export NUWIKI_DEV_NO_SEED=1 + +exec "$REPO_ROOT/start-vim.sh" "$@"