Move development scripts into development/, leaving scripts/ plugin-only
CI / cargo fmt --check (push) Successful in 32s
CI / cargo clippy (push) Successful in 25s
CI / cargo test (push) Successful in 33s
CI / cargo fmt --check (pull_request) Successful in 30s
CI / cargo clippy (pull_request) Successful in 49s
CI / cargo test (pull_request) Successful in 43s
CI / editor keymaps (push) Successful in 1m49s
CI / editor keymaps (pull_request) Successful in 1m36s

The root scripts/ folder now holds only download_bin.vim, the one script
the plugin itself invokes (via :NuwikiInstall and the vim-plug/Dein build
hooks). All developer tooling — the start-nvim/start-vim launchers,
test-personal-wiki, the keymap harnesses, and syntax-diag — moves to
development/ alongside the developer docs.

REPO_ROOT resolution is unchanged (development/ sits one level under root,
same as scripts/ did); only the explicit cross-references, the CI harness
invocations, the README launcher paths, and the ONBOARDING structure tree
are updated.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-30 14:35:24 -03:00
parent dd92e070d0
commit f32f54e8a8
11 changed files with 44 additions and 32 deletions
+71
View File
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
#
# development/test-keymaps.sh — drive development/test-keymaps.lua under
# headless Neovim and report pass/fail per buffer-local keymap.
#
# The Lua harness needs a real LSP attachment (most keymaps dispatch
# `workspace/executeCommand`), so we:
# 1. ensure `bin/nuwiki-ls` is built (release),
# 2. spin up a scratch wiki under a temp dir,
# 3. invoke `nvim --headless` with a minimal init that loads the
# plugin + calls `setup()`, then sources the harness Lua.
#
# Exit code mirrors the harness: 0 on green, 1 on any failure.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
TMP="$(mktemp -d -t nuwiki-keymap-test-XXXXXX)"
trap 'rm -rf "$TMP"' EXIT
log() { printf '\033[1;34m[keymap-test]\033[0m %s\n' "$*"; }
# Always rebuild the LSP binary so harness runs against current sources.
# A previous version only built when the symlink was missing, which let
# stale binaries pass tests against unrelated code — incremental cargo
# build is fast, so just always run it.
BIN="$REPO_ROOT/bin/nuwiki-ls"
log 'building nuwiki-ls (release, incremental)…'
cargo build --release -p nuwiki-ls --manifest-path "$REPO_ROOT/Cargo.toml" >/dev/null
mkdir -p "$REPO_ROOT/bin"
ln -sf "$REPO_ROOT/target/release/nuwiki-ls" "$BIN"
mkdir -p "$TMP/wiki"
echo "= seed =" > "$TMP/wiki/index.wiki"
INIT="$TMP/init.lua"
cat > "$INIT" <<EOF
-- Keep the harness self-contained; no plugin manager required.
vim.opt.runtimepath:prepend('$REPO_ROOT')
vim.g.nuwiki_binary_path = '$BIN'
-- Enable the opt-in mouse mappings so the harness can assert the full
-- documented mapping surface (doc §6 mouse group).
require('nuwiki').setup({ wiki_root = '$TMP/wiki', mappings = { mouse = true } })
EOF
RESULTS="$TMP/results.txt"
log "running harness…"
# `nvim --headless -u init.lua FILE +luafile …` — the harness's
# `vim.defer_fn` lets the LSP attach before tests fire, then writes
# the results file and exits. Output path is plumbed through env.
# Wrapped in `timeout` so a hung LSP / harness fails fast instead of
# stalling CI runners indefinitely.
NUWIKI_KEYMAP_RESULTS="$RESULTS" \
timeout 60 nvim --clean -u "$INIT" --headless "$TMP/wiki/index.wiki" \
-c "luafile $REPO_ROOT/development/test-keymaps.lua" \
>"$TMP/nvim.log" 2>&1 || true
if [[ ! -f "$RESULTS" ]]; then
echo 'keymap test harness produced no output' >&2
echo '--- nvim log ---' >&2
cat "$TMP/nvim.log" >&2 || true
exit 1
fi
cat "$RESULTS"
if grep -qE '^SUMMARY: [0-9]+ passed, 0 failed' "$RESULTS"; then
exit 0
fi
exit 1