Commit Graph

12 Commits

Author SHA1 Message Date
Henner M. Kruse 9f39a898c4 Fix setup.md: version-discovery fragility and unused argument-hint
Observed live: a stale plugin-cache version dir (1.0.0) coexisted with
the active one (1.1.0). setup.md's 'try the hardcoded version path
first' advice picked the stale one, its --install-raw-git-hook flag
failed silently, and Claude went on an unscripted forensic dig (chained
test&&echo, --help probing, grep/cat across both version dirs, cat'ing
plugin.json, stat'ing .in_use mtimes) to figure out which version was
actually active.

Fix, in both plugins' commands/setup.md:
- Never hardcode a version number. Always do one bounded
  find -maxdepth 1 -type d first; disambiguate multiple hits via the
  .in_use marker Claude Code itself writes, falling back to highest
  plugin.json version. Explicitly rule out the exploration that
  happened here (stat/mtime, --help, reading source, diffing versions)
  since setup.sh has no --help and unrecognized flags just error.
- Wire up the declared but previously-unused argument-hint
  ([repo-name] [repo-path] / [vault-path] [mode]): if the user already
  supplied it on the command line, skip asking the question that would
  just re-collect the same info.
2026-08-05 18:17:09 +00:00
Henner M. Kruse 06bd74d64f Close the 3 real remaining coverage gaps
- vault_index.sh: grep fallback for frontmatter tag extraction when rg
  is unavailable (had this for vault_search.sh/vault_backlinks.sh, not
  vault_index.sh).
- git_cmd.bats: registered repo path that's a file, not a directory
  (had the obsidian equivalent, not git-manager's).
- git_cmd.bats: missing python3 in resolve_repo_path (previously only
  tested via setup.sh/vault_index.sh, not git_cmd.sh's own _lib.sh).

76 tests now (was 73). kcov: 87.84% (260/296 lines), up from 86.15% --
both target files (vault_index.sh, git-manager _lib.sh) now at 100%.
Remaining gap is entirely kcov's inability to trace multi-line
python3/awk/jq blocks and bash 'case pattern) ;;' no-op branches,
confirmed by checking hit counts on the surrounding lines -- not
further closeable by adding tests.
2026-08-05 04:31:06 +00:00
Henner M. Kruse dc4a5c5b5e Close bats coverage gaps, add hide_command helper, wire up kcov
- tests/helpers/common.bash: hide_command hides python3/jq/rg via a
  per-directory-batched PATH shim (not per-file — that took minutes),
  making the fail-open/grep-fallback branches testable.
- 20 new tests across all 7 .bats files: unknown flags, invalid
  --settings-scope, missing python3/jq, grep fallback when rg is
  unavailable, empty/multi-vault config edge cases, a vault path that
  stops existing or isn't a directory, and the previously-untested
  tool_name != Bash branch of force-ask-on-raw-git.sh. 53 -> 73 tests.
- hooks.bats: deploy the hooks once in setup_file() (BATS_FILE_TMPDIR)
  instead of per-test (BATS_TEST_TMPDIR) -- faster, and gives kcov one
  stable path per hook to aggregate coverage against instead of a
  fragmented copy per test.
- .gitignore (first in this repo) + tests/README.md Coverage section
  documenting the kcov invocation and why --include-pattern needs three
  entries, not two.

Real, tool-measured coverage via kcov: 86.15% (255/296 lines) across
all 10 wrapper/setup/hook scripts in both plugins, replacing an earlier
manual ~68% branch-coverage estimate.
2026-08-04 21:09:07 +00:00
Henner M. Kruse 2d25e69632 Add bats test suite for git-manager and obsidian-vault-kb
Isolated per-test $HOME sandboxing via tests/helpers/common.bash.
Covers both plugins' wrapper scripts, their setup.sh, and
git-manager's two PreToolUse hooks (53 tests). Verified the suite
catches regressions by temporarily reintroducing the recently-fixed
vault_search.sh -g/-- ordering bug and confirming it fails.
2026-08-04 19:34:51 +00:00
Henner M. Kruse 20cdf74b58 Fix vault_search.sh: move rg -g glob filters before --
Placing -g after -- made ripgrep treat the filters as literal
positional paths instead of options, so the .obsidian/.git/*.md
exclusions were silently inert (confirmed: matched inside a .pdf).
2026-08-04 15:30:44 +00:00
Henner M. Kruse 7cbf3276e1 Add CLAUDE.md documenting repo architecture and conventions 2026-08-04 14:24:21 +00:00
Henner M. Kruse d481d4f2a4 Bump git-manager plugin to 1.1.0
Backward-compatible feature addition (raw-git nudge hook, tag subcommand,
repo-ambiguity guidance in SKILL.md). Bumping per ARCHITECTURE.md's
documented convention, and because the plugin cache path is version-keyed
(~/.claude/plugins/cache/skill-repo/git-manager/<version>/), so a bump is
also what makes /plugin marketplace update reliably pick up the change.
2026-08-04 14:05:28 +00:00
Henner M. Kruse 1d0b66df2e Add opt-in raw-git nudge hook, independent of anti-chaining hook
Forces a normal confirmation prompt (never a silent block, never a silent
allow) when Bash runs raw git instead of git_cmd.sh, worded more
insistently when the subcommand is one the wrapper already supports.
Raw git stays a valid fallback for unsupported subcommands and
unregistered repos - a hard deny would remove that fallback entirely.

Also documents in SKILL.md that repo ambiguity (which registered repo is
meant, or none at all) must be resolved by asking the user rather than
guessing - a hook only sees the literal command string, not the
conversation, so that judgment can't live in the hook itself.
2026-08-04 13:58:30 +00:00
Henner M. Kruse 47595ff160 Allow tag in git-manager's subcommand allowlist
Tagging a commit doesn't rewrite or discard history/working-tree state,
unlike stash/merge/rebase/reset which stay excluded as a deliberate
guardrail.
2026-08-04 13:35:11 +00:00
Henner M. Kruse 6c6fc35a1f Fixed setups 2026-08-04 14:28:10 +02:00
Henner M. Kruse e485d33f00 Added git-manager, updated READMEs 2026-08-04 10:45:25 +02:00
Henner M. Kruse c774df7ad7 Initial commit 2026-08-04 00:18:16 +02:00