Initial import of NLProg
This commit is contained in:
+65
@@ -0,0 +1,65 @@
|
||||
param(
|
||||
[switch]$InstallOpencode
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Test-Command($Name) {
|
||||
return $null -ne (Get-Command $Name -ErrorAction SilentlyContinue)
|
||||
}
|
||||
|
||||
function Install-OpencodeIfRequested {
|
||||
if (-not $InstallOpencode) {
|
||||
Write-Host "Skipping opencode install. Use -InstallOpencode to install it."
|
||||
return
|
||||
}
|
||||
|
||||
if (Test-Command "opencode") {
|
||||
Write-Host "opencode is already installed."
|
||||
opencode --version
|
||||
return
|
||||
}
|
||||
|
||||
if (Test-Command "scoop") {
|
||||
Write-Host "Installing opencode with Scoop..."
|
||||
scoop install opencode
|
||||
}
|
||||
elseif (Test-Command "npm") {
|
||||
Write-Host "Installing opencode with npm..."
|
||||
npm install -g opencode-ai
|
||||
}
|
||||
else {
|
||||
Write-Host "Could not find Scoop or npm."
|
||||
Write-Host "Install one of them, then run:"
|
||||
Write-Host " scoop install opencode"
|
||||
Write-Host "or:"
|
||||
Write-Host " npm install -g opencode-ai"
|
||||
return
|
||||
}
|
||||
|
||||
if (Test-Command "opencode") {
|
||||
Write-Host "opencode installed."
|
||||
opencode --version
|
||||
python -m nlprog config use-opencode
|
||||
}
|
||||
else {
|
||||
Write-Host "opencode install command finished, but opencode is not on PATH yet."
|
||||
Write-Host "Open a new terminal and run: opencode --version"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Installing NLProg..."
|
||||
|
||||
python --version
|
||||
python -m pip install -e .
|
||||
|
||||
python -m nlprog init
|
||||
python -m nlprog init-project --show
|
||||
|
||||
Install-OpencodeIfRequested
|
||||
|
||||
python -m nlprog doctor
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "NLProg is ready."
|
||||
Write-Host "Try: python -m nlprog agent `"帮我检查这个项目`""
|
||||
Reference in New Issue
Block a user