-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.ps1
More file actions
78 lines (69 loc) · 2.79 KB
/
install.ps1
File metadata and controls
78 lines (69 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Install the Knowledge Graph plugin for Claude Code (Windows)
#
# Run: powershell -ExecutionPolicy Bypass -File install.ps1
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$ClaudeDir = Join-Path $env:USERPROFILE ".claude"
$PluginsDir = Join-Path $ClaudeDir "plugins"
$PluginLink = Join-Path $PluginsDir "knowledge-graph"
$VenvDir = Join-Path $ScriptDir "venv"
Write-Host "=== Knowledge Graph Plugin Installer (Windows) ==="
Write-Host ""
# 1. Check Python
Write-Host "[1/4] Checking Python..."
try {
$pyVersion = python --version 2>&1
Write-Host " Found $pyVersion"
} catch {
Write-Host " ERROR: Python not found. Install Python 3.10+ and try again."
exit 1
}
# 2. Create venv and install deps
Write-Host "[2/4] Setting up virtual environment..."
if (-not (Test-Path $VenvDir)) {
python -m venv "$VenvDir"
Write-Host " Created venv at $VenvDir"
}
$pipExe = Join-Path $VenvDir "Scripts\pip.exe"
& $pipExe install -r (Join-Path $ScriptDir "requirements.txt") --quiet
Write-Host " Dependencies installed (fastembed, sqlite-vec)"
# 3. Create knowledge-graph directory
Write-Host "[3/4] Creating data directory..."
$DataDir = Join-Path $env:USERPROFILE ".claude\knowledge-graph"
if (-not (Test-Path $DataDir)) {
New-Item -ItemType Directory -Path $DataDir -Force | Out-Null
}
Write-Host " Data dir: $DataDir"
# 4. Register plugin
Write-Host "[4/4] Registering Claude Code plugin..."
if (-not (Test-Path $PluginsDir)) {
New-Item -ItemType Directory -Path $PluginsDir -Force | Out-Null
}
if (Test-Path $PluginLink) {
Remove-Item $PluginLink -Recurse -Force
}
cmd /c mklink /J "$PluginLink" "$ScriptDir" | Out-Null
Write-Host " Plugin linked at $PluginLink"
# Create global hook runner (workaround: ${CLAUDE_PLUGIN_ROOT} not set in SessionStart)
$HookRunner = Join-Path $DataDir "run_hook.sh"
@"
#!/usr/bin/env bash
exec "$($ScriptDir -replace '\\', '/')/hooks/run_hook.sh" "`$@"
"@ | Set-Content -Path $HookRunner -Encoding UTF8 -NoNewline
Write-Host " Hook runner: $HookRunner"
Write-Host ""
Write-Host "=== Installation Complete ==="
Write-Host ""
Write-Host "The MCP server starts automatically when Claude Code launches."
Write-Host "Hooks are active immediately."
Write-Host ""
Write-Host "LLM extraction uses 'claude -p' subprocess (your existing login)."
Write-Host "No API key needed."
Write-Host ""
Write-Host "Optional config (environment variables):"
Write-Host " KNOWLEDGE_GRAPH_DB = $DataDir\kg.db"
Write-Host " KNOWLEDGE_GRAPH_EXTRACT_INTERVAL = 20 (prompts between extractions)"
Write-Host " KNOWLEDGE_GRAPH_LLM_PROVIDER = auto (claude | anthropic | openai-compatible)"
Write-Host " KNOWLEDGE_GRAPH_LLM_BASE_URL = (for local models)"
Write-Host " KNOWLEDGE_GRAPH_LLM_MODEL = claude-haiku-4-5-20251001"
Write-Host ""