diff --git a/CHANGELOG.md b/CHANGELOG.md index d9d27742..02d92d7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Full release notes with details on each version: [GitHub Releases](https://githu ## 0.9.44 (unreleased) +- Fix: `graphify install` (Claude always-on) now writes the CLAUDE.md registration into `$CLAUDE_CONFIG_DIR` when that env var relocates the Claude profile, instead of always mutating the default `~/.claude/CLAUDE.md` (part of #2694, thanks @AromalBiju1). - Fix: a JS/TS inline or nested function expression — including a generator function expression (`function*(k){…}`) — no longer fabricates an INFERRED `indirect_call` when one of its parameters/locals shares a name with an unrelated callable; the expression's own bindings now shadow the name (#2752, thanks @imagineers-tyler), completing the shadow family alongside catch/arrow/loop/external-import (#2757). - Fix: a git-tracked file that also matches a `.gitignore` pattern (a committed file later added to `.gitignore`, or a force-added one) is no longer dropped from the corpus, matching git's own behavior of never un-tracking such a file; `.graphifyignore`/`--exclude` stay authoritative and a non-git corpus is unaffected (#2759, thanks @NithishKumar04). The `git ls-files` probe is skipped entirely when no `.gitignore` is in play, so ordinary corpora pay nothing for it. diff --git a/tests/test_install.py b/tests/test_install.py index 8cea17b4..7e74487c 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -40,6 +40,52 @@ def test_install_default_claude(tmp_path): assert (tmp_path / ".claude" / "skills" / "graphify" / "SKILL.md").exists() +def test_install_claude_md_honors_claude_config_dir(tmp_path, monkeypatch): + """#2694: with CLAUDE_CONFIG_DIR set, the always-on registration lands in + $CLAUDE_CONFIG_DIR/CLAUDE.md — not the default ~/.claude/CLAUDE.md, which the + old code mutated regardless of the relocated profile.""" + from graphify.__main__ import install + + home = tmp_path / "home" + home.mkdir() + config = tmp_path / "cfg" + config.mkdir() + monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(config)) + old = os.getcwd() + try: + os.chdir(tmp_path) + with patch("graphify.__main__.Path.home", return_value=home): + install(platform="claude") + finally: + os.chdir(old) + + cfg_md = config / "CLAUDE.md" + assert cfg_md.exists(), "registration did not land in $CLAUDE_CONFIG_DIR" + text = cfg_md.read_text() + assert "# graphify" in text + assert str(config) in text, "skill reference does not point into the config dir" + assert not (home / ".claude" / "CLAUDE.md").exists(), "default profile was mutated" + + +def test_install_claude_md_defaults_to_home_when_config_dir_unset(tmp_path, monkeypatch): + """Env unset: behavior is unchanged — the block lands in ~/.claude/CLAUDE.md + with the tilde skill reference.""" + from graphify.__main__ import install + + monkeypatch.delenv("CLAUDE_CONFIG_DIR", raising=False) + old = os.getcwd() + try: + os.chdir(tmp_path) + with patch("graphify.__main__.Path.home", return_value=tmp_path): + install(platform="claude") + finally: + os.chdir(old) + + md = tmp_path / ".claude" / "CLAUDE.md" + assert md.exists() + assert "~/.claude/skills/graphify/SKILL.md" in md.read_text() + + def test_install_codebuddy(tmp_path): _install(tmp_path, "codebuddy") assert (tmp_path / ".codebuddy" / "skills" / "graphify" / "SKILL.md").exists()