|
560 | 560 | echo "OK 8c: Claude Code MCP (.claude/.mcp.json)" |
561 | 561 |
|
562 | 562 | # 8d: Claude Code hooks |
563 | | -if ! python3 -c " |
| 563 | +if ! cat "$FAKE_HOME/.claude/settings.json" 2>/dev/null | python3 -c " |
564 | 564 | import json, sys |
565 | | -d = json.load(open('$FAKE_HOME/.claude/settings.json')) |
| 565 | +d = json.load(sys.stdin) |
566 | 566 | hooks = d.get('hooks', {}).get('PreToolUse', []) |
567 | 567 | found = any('Grep' in str(h.get('matcher', '')) for h in hooks) |
568 | 568 | sys.exit(0 if found else 1) |
@@ -612,9 +612,9 @@ if [ "$EXISTING" != "True" ]; then |
612 | 612 | fi |
613 | 613 | echo "OK 8j-k: Gemini MCP (correct command + preserved existing)" |
614 | 614 |
|
615 | | -if ! python3 -c " |
| 615 | +if ! cat "$FAKE_HOME/.gemini/settings.json" 2>/dev/null | python3 -c " |
616 | 616 | import json, sys |
617 | | -d = json.load(open('$FAKE_HOME/.gemini/settings.json')) |
| 617 | +d = json.load(sys.stdin) |
618 | 618 | hooks = d.get('hooks', {}).get('BeforeTool', []) |
619 | 619 | sys.exit(0 if len(hooks) > 0 else 1) |
620 | 620 | " 2>/dev/null; then |
@@ -735,9 +735,9 @@ echo "=== Phase 9: agent config uninstall E2E ===" |
735 | 735 | HOME="$FAKE_HOME" PATH="$FAKE_HOME/.local/bin:$PATH" "$BINARY" uninstall -y -n 2>&1 || true |
736 | 736 |
|
737 | 737 | # 9a-b: Claude Code MCP removed but existing keys preserved |
738 | | -if python3 -c " |
| 738 | +if cat "$FAKE_HOME/.claude.json" 2>/dev/null | python3 -c " |
739 | 739 | import json, sys |
740 | | -d = json.load(open('$FAKE_HOME/.claude.json')) |
| 740 | +d = json.load(sys.stdin) |
741 | 741 | if 'codebase-memory-mcp' in d.get('mcpServers', {}): |
742 | 742 | sys.exit(1) |
743 | 743 | if not d.get('existingKey', False): |
|
751 | 751 | fi |
752 | 752 |
|
753 | 753 | # 9c: Legacy MCP removed |
754 | | -if python3 -c " |
| 754 | +if cat "$FAKE_HOME/.claude/.mcp.json" 2>/dev/null | python3 -c " |
755 | 755 | import json, sys |
756 | | -d = json.load(open('$FAKE_HOME/.claude/.mcp.json')) |
| 756 | +d = json.load(sys.stdin) |
757 | 757 | sys.exit(1 if 'codebase-memory-mcp' in d.get('mcpServers', {}) else 0) |
758 | 758 | " 2>/dev/null; then |
759 | 759 | echo "OK 9c: legacy .mcp.json cleaned" |
|
763 | 763 | fi |
764 | 764 |
|
765 | 765 | # 9d: Hooks removed |
766 | | -if python3 -c " |
| 766 | +if cat "$FAKE_HOME/.claude/settings.json" 2>/dev/null | python3 -c " |
767 | 767 | import json, sys |
768 | | -d = json.load(open('$FAKE_HOME/.claude/settings.json')) |
| 768 | +d = json.load(sys.stdin) |
769 | 769 | hooks = d.get('hooks', {}).get('PreToolUse', []) |
770 | 770 | found = any('cbm-code-discovery-gate' in str(h) for h in hooks) |
771 | 771 | sys.exit(1 if found else 0) |
|
788 | 788 | echo "OK 9e-f: Codex TOML cleaned, existing preserved" |
789 | 789 |
|
790 | 790 | # 9g-i: Gemini MCP removed, existing preserved, hooks removed |
791 | | -if python3 -c " |
| 791 | +if cat "$FAKE_HOME/.gemini/settings.json" 2>/dev/null | python3 -c " |
792 | 792 | import json, sys |
793 | | -d = json.load(open('$FAKE_HOME/.gemini/settings.json')) |
| 793 | +d = json.load(sys.stdin) |
794 | 794 | has_mcp = 'codebase-memory-mcp' in d.get('mcpServers', {}) |
795 | 795 | has_existing = d.get('existingKey', False) |
796 | 796 | hooks = d.get('hooks', {}).get('BeforeTool', []) |
|
804 | 804 | fi |
805 | 805 |
|
806 | 806 | # 9j: VS Code |
807 | | -if python3 -c " |
| 807 | +if cat "$VSCODE_CFG" 2>/dev/null | python3 -c " |
808 | 808 | import json, sys |
809 | | -d = json.load(open('$VSCODE_CFG')) |
| 809 | +d = json.load(sys.stdin) |
810 | 810 | sys.exit(1 if 'codebase-memory-mcp' in d.get('servers', {}) else 0) |
811 | 811 | " 2>/dev/null; then |
812 | 812 | echo "OK 9j: VS Code MCP removed" |
|
816 | 816 | fi |
817 | 817 |
|
818 | 818 | # 9k: OpenClaw |
819 | | -if python3 -c " |
| 819 | +if cat "$FAKE_HOME/.openclaw/openclaw.json" 2>/dev/null | python3 -c " |
820 | 820 | import json, sys |
821 | | -d = json.load(open('$FAKE_HOME/.openclaw/openclaw.json')) |
| 821 | +d = json.load(sys.stdin) |
822 | 822 | sys.exit(1 if 'codebase-memory-mcp' in d.get('mcpServers', {}) else 0) |
823 | 823 | " 2>/dev/null; then |
824 | 824 | echo "OK 9k: OpenClaw MCP removed" |
@@ -858,9 +858,9 @@ cp "$BINARY" "$IDEM_HOME/.local/bin/codebase-memory-mcp" |
858 | 858 | HOME="$IDEM_HOME" "$BINARY" install -y 2>&1 > /dev/null || true |
859 | 859 | HOME="$IDEM_HOME" "$BINARY" install -y 2>&1 > /dev/null || true |
860 | 860 | # Count MCP entries — should be exactly 1 |
861 | | -COUNT=$(python3 -c " |
862 | | -import json |
863 | | -d = json.load(open('$IDEM_HOME/.claude.json')) |
| 861 | +COUNT=$(cat "$IDEM_HOME/.claude.json" 2>/dev/null | python3 -c " |
| 862 | +import json, sys |
| 863 | +d = json.load(sys.stdin) |
864 | 864 | print(list(d.get('mcpServers',{}).keys()).count('codebase-memory-mcp')) |
865 | 865 | " 2>/dev/null || echo "0") |
866 | 866 | if [ "$COUNT" != "1" ]; then |
@@ -1078,11 +1078,9 @@ if [ -n "${SMOKE_DOWNLOAD_URL:-}" ]; then |
1078 | 1078 | echo "OK 14e: binary removed by uninstall" |
1079 | 1079 |
|
1080 | 1080 | # 14f: Verify agent config cleaned |
1081 | | - if python3 -c " |
1082 | | -import json, sys, os |
1083 | | -f = '$UPDATE_HOME/.claude.json' |
1084 | | -if not os.path.isfile(f): sys.exit(0) |
1085 | | -d = json.load(open(f)) |
| 1081 | + if cat "$UPDATE_HOME/.claude.json" 2>/dev/null | python3 -c " |
| 1082 | +import json, sys |
| 1083 | +d = json.load(sys.stdin) |
1086 | 1084 | if 'codebase-memory-mcp' in d.get('mcpServers', {}): sys.exit(1) |
1087 | 1085 | sys.exit(0) |
1088 | 1086 | " 2>/dev/null; then |
|
0 commit comments