-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
151 lines (135 loc) · 6.7 KB
/
Copy pathinstall.ps1
File metadata and controls
151 lines (135 loc) · 6.7 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# ==============================================================================
# DevMemory AI v1.1.0 — Automated one-click Installer (Windows PowerShell)
# ==============================================================================
$ErrorActionPreference = "Stop"
function Update-SessionPath {
$userPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
$machinePath = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
$env:Path = "$userPath;$machinePath"
# Add standard Windows installation paths if missing from session
$standardPaths = @(
"$HOME\.bun\bin",
"$env:ProgramFiles\Git\cmd",
"$env:ProgramFiles\Git\bin",
"$env:LocalAppData\Programs\Git\cmd",
"$env:LocalAppData\Programs\Ollama",
"$env:ProgramFiles\Ollama"
)
foreach ($p in $standardPaths) {
if ((Test-Path $p) -and (-not ($env:Path -split ';' -contains $p))) {
$env:Path += ";$p"
}
}
}
# Initial PATH Sync
Update-SessionPath
Write-Host ""
Write-Host "========================================================" -ForegroundColor Cyan
Write-Host " DevMemory AI v1.1.0 Installation " -ForegroundColor Cyan
Write-Host " Automated Setup for Windows (Git, Bun, Ollama) " -ForegroundColor Cyan
Write-Host "========================================================" -ForegroundColor Cyan
Write-Host ""
# 1. Detect and Install Git
if (Get-Command git -ErrorAction SilentlyContinue) {
Write-Host "[SUCCESS] Git is already installed." -ForegroundColor Green
} else {
Write-Host "[INFO] Git not found. Attempting automatic installation via winget..." -ForegroundColor Yellow
if (Get-Command winget -ErrorAction SilentlyContinue) {
try {
winget install --id Git.Git -e --source winget --accept-source-agreements --accept-package-agreements
} catch {
Write-Host "[WARN] Winget install for Git completed or reported notice." -ForegroundColor Yellow
}
Update-SessionPath
} else {
Write-Host "[ERROR] Winget is not available. Please install Git manually from https://git-scm.com" -ForegroundColor Red
exit 1
}
}
# Verify Git binary availability
Update-SessionPath
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
Write-Host "[ERROR] Git was installed but could not be located in shell PATH. Please restart PowerShell and re-run this script." -ForegroundColor Red
exit 1
}
# 2. Detect and Install Bun Runtime
if (Get-Command bun -ErrorAction SilentlyContinue) {
Write-Host "[SUCCESS] Bun runtime is already installed." -ForegroundColor Green
} else {
Write-Host "[INFO] Bun runtime not found. Installing official Bun for Windows..." -ForegroundColor Yellow
powershell -Command "irm bun.sh/install.ps1 | iex"
Update-SessionPath
}
# Verify Bun binary availability
Update-SessionPath
if (-not (Get-Command bun -ErrorAction SilentlyContinue)) {
Write-Host "[WARN] Bun binary path added to session: $HOME\.bun\bin" -ForegroundColor Yellow
$env:Path += ";$HOME\.bun\bin"
}
# 3. Detect and Install Ollama Engine
if (Get-Command ollama -ErrorAction SilentlyContinue) {
Write-Host "[SUCCESS] Ollama Local LLM Engine is already installed." -ForegroundColor Green
} else {
Write-Host "[INFO] Ollama not found. Attempting automatic installation via winget..." -ForegroundColor Yellow
if (Get-Command winget -ErrorAction SilentlyContinue) {
try {
winget install --id Ollama.Ollama -e --source winget --accept-source-agreements --accept-package-agreements
} catch {
Write-Host "[WARN] Winget install for Ollama encountered an issue. Please install Ollama from https://ollama.com" -ForegroundColor Yellow
}
Update-SessionPath
} else {
Write-Host "[WARN] Please download and install Ollama for Windows from https://ollama.com" -ForegroundColor Yellow
}
}
# 4. Workspace Detection / Clone and Link DevMemory AI
Update-SessionPath
if ((Test-Path ".\package.json") -and (Select-String -Path ".\package.json" -Pattern '"name": "devmemoryai"' -Quiet)) {
Write-Host "[INFO] Running inside active DevMemory AI workspace: $PWD" -ForegroundColor Cyan
} else {
$InstallDir = "$HOME\.devmemory-ai"
if (Test-Path $InstallDir) {
Write-Host "[INFO] Updating existing DevMemory AI repository at $InstallDir..." -ForegroundColor Cyan
Set-Location $InstallDir
git pull origin main
} else {
Write-Host "[INFO] Cloning DevMemory AI v1.1.0 repository into $InstallDir..." -ForegroundColor Cyan
git clone https://github.com/DevMemory-AI/devmemoryai.git "$InstallDir"
Set-Location $InstallDir
}
}
Write-Host "[INFO] Installing npm/bun dependencies..." -ForegroundColor Cyan
bun install
Write-Host "[INFO] Linking dmai CLI executable binary into global PATH..." -ForegroundColor Cyan
bun link
# 5. Pre-warm Ollama Service and Default Model
Update-SessionPath
if (Get-Command ollama -ErrorAction SilentlyContinue) {
Write-Host "[INFO] Verifying Ollama local service status..." -ForegroundColor Cyan
try {
$response = Invoke-WebRequest -Uri "http://localhost:11434/api/tags" -UseBasicParsing -TimeoutSec 2 -ErrorAction SilentlyContinue
} catch {
Write-Host "[INFO] Launching Ollama background service..." -ForegroundColor Cyan
Start-Process "ollama" -ArgumentList "serve" -WindowStyle Hidden
Start-Sleep -Seconds 2
}
Write-Host "[INFO] Pre-warming default Ollama model (gpt-oss:120b-cloud)..." -ForegroundColor Cyan
Start-Process "ollama" -ArgumentList "pull gpt-oss:120b-cloud" -WindowStyle Hidden
}
Write-Host ""
Write-Host "========================================================" -ForegroundColor Green
Write-Host " DevMemory AI v1.1.0 Successfully Installed! " -ForegroundColor Green
Write-Host "========================================================" -ForegroundColor Green
Write-Host ""
Write-Host "You can now initialize DevMemory AI in any software repository:"
Write-Host " cd \path\to\your\project" -ForegroundColor Cyan
Write-Host " dmai init" -ForegroundColor Cyan
Write-Host ""
Write-Host "Useful CLI Commands:"
Write-Host " dmai status - Check watcher, database, and repository status" -ForegroundColor Cyan
Write-Host " dmai ask '...' - Query engineering context" -ForegroundColor Cyan
Write-Host " dmai dashboard - Launch local interactive UI" -ForegroundColor Cyan
Write-Host " dmai projects - List all active registered projects on system" -ForegroundColor Cyan
Write-Host " dmai disable - Safely disable project and purge .devmemory/ folder" -ForegroundColor Cyan
Write-Host " dmai doctor - Verify system health and AI provider readiness" -ForegroundColor Cyan
Write-Host ""