Skip to content

Commit 4badaf6

Browse files
fix: bootstrap.ps1 false pip failure (PowerShell stdout trap)
pip stdout was captured as exit code; triggered git clone fallback. Skip when already installed. v4.5.5. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d00f54f commit 4badaf6

5 files changed

Lines changed: 67 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to GraphStack are documented here.
44

55
---
66

7+
## [v4.5.5] — 2026-06-11
8+
9+
### Fixed
10+
- **bootstrap.ps1** — PowerShell captured pip stdout as the function return value, so every install looked like a failure and triggered slow `git clone` fallback. Use `Out-Host`; skip pip when CLI + project rules already exist.
11+
12+
---
13+
714
## [v4.5.4] — 2026-06-11
815

916
### Fixed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "MertCapkin_GraphStack"
7-
version = "4.5.4"
7+
version = "4.5.5"
88
description = "Graph-first AI development workflow — board, gate, graph queries, one-shot init"
99
readme = "README.md"
1010
license = { text = "MIT" }

scripts/bootstrap.ps1

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
$Pkg = 'MertCapkin_GraphStack[graphify]'
88
$GitSpec = 'MertCapkin_GraphStack[graphify] @ git+https://github.com/MertCapkin/GraphStack.git'
99

10-
# Do not use Stop — pip/graphify write to stderr and Cursor marks the terminal failed.
1110
$ErrorActionPreference = 'Continue'
1211

1312
function Resolve-Python {
@@ -23,38 +22,64 @@ function Resolve-Python {
2322
}
2423

2524
function Invoke-GraphstackPython {
26-
param([string[]]$CodeArgs)
27-
& $python.Exe @($python.PreArgs) @CodeArgs
28-
return $LASTEXITCODE
25+
param(
26+
[string[]]$CodeArgs,
27+
[switch]$Quiet
28+
)
29+
if ($Quiet) {
30+
& $python.Exe @($python.PreArgs) @CodeArgs *>$null
31+
} else {
32+
# Out-Host prevents pip stdout from polluting the function return value ($rc = ...).
33+
& $python.Exe @($python.PreArgs) @CodeArgs | Out-Host
34+
}
35+
if ($null -eq $LASTEXITCODE) { return 0 }
36+
return [int]$LASTEXITCODE
2937
}
3038

3139
function Test-WheelAssets {
32-
$rc = Invoke-GraphstackPython @(
40+
$rc = Invoke-GraphstackPython -Quiet @(
3341
'-c',
3442
"from graphstack.installer import install_source_root; p=install_source_root()/'.cursor'/'rules'/'graphstack.mdc'; import sys; sys.exit(0 if p.is_file() else 1)"
3543
)
3644
return $rc -eq 0
3745
}
3846

47+
function Test-GraphstackCli {
48+
$rc = Invoke-GraphstackPython -Quiet @('-m', 'graphstack', '--version')
49+
return $rc -eq 0
50+
}
51+
3952
function Install-GraphstackPackage {
40-
Write-Host "Step 1/2: Installing MertCapkin_GraphStack + graphify from PyPI..."
41-
$rc = Invoke-GraphstackPython @('-m', 'pip', 'install', '--upgrade', '--force-reinstall', $Pkg)
53+
if ((Test-GraphstackCli) -and (Test-WheelAssets)) {
54+
$ver = (& $python.Exe @($python.PreArgs) -m graphstack --version 2>$null)
55+
Write-Host "Step 1/2: GraphStack already installed ($ver) — skipping pip."
56+
return
57+
}
58+
59+
Write-Host 'Step 1/2: Installing MertCapkin_GraphStack + graphify from PyPI...'
60+
$rc = Invoke-GraphstackPython @('-m', 'pip', 'install', '--upgrade', $Pkg)
4261
if ($rc -ne 0) {
4362
Write-Host 'PyPI install failed — trying GitHub source...' -ForegroundColor Yellow
44-
$rc = Invoke-GraphstackPython @('-m', 'pip', 'install', '--upgrade', '--force-reinstall', $GitSpec)
63+
$rc = Invoke-GraphstackPython @('-m', 'pip', 'install', '--upgrade', $GitSpec)
4564
if ($rc -ne 0) {
4665
Write-Error 'Could not install graphstack. Check network and Python pip.'
4766
exit 1
4867
}
4968
}
69+
5070
if (-not (Test-WheelAssets)) {
51-
Write-Host 'PyPI wheel missing .cursor assets — installing from GitHub...' -ForegroundColor Yellow
52-
$rc = Invoke-GraphstackPython @('-m', 'pip', 'install', '--upgrade', '--force-reinstall', $GitSpec)
71+
Write-Host 'PyPI wheel missing .cursor assets — reinstalling from PyPI...' -ForegroundColor Yellow
72+
$rc = Invoke-GraphstackPython @('-m', 'pip', 'install', '--upgrade', '--force-reinstall', $Pkg)
5373
if ($rc -ne 0 -or -not (Test-WheelAssets)) {
54-
Write-Error 'Installed package is missing Cursor workflow files. Open an issue on GitHub.'
55-
exit 1
74+
Write-Host 'Trying GitHub source...' -ForegroundColor Yellow
75+
$rc = Invoke-GraphstackPython @('-m', 'pip', 'install', '--upgrade', '--force-reinstall', $GitSpec)
76+
if ($rc -ne 0 -or -not (Test-WheelAssets)) {
77+
Write-Error 'Installed package is missing Cursor workflow files. Open an issue on GitHub.'
78+
exit 1
79+
}
5680
}
5781
}
82+
5883
$ver = (& $python.Exe @($python.PreArgs) -m graphstack --version 2>$null)
5984
Write-Host " Installed: $ver"
6085
}
@@ -70,19 +95,26 @@ Write-Host 'GraphStack bootstrap' -ForegroundColor Cyan
7095
Write-Host '===================='
7196
Write-Host ''
7297

73-
$null = Invoke-GraphstackPython @('-m', 'pip', 'install', '--upgrade', 'pip', '--quiet')
98+
$null = Invoke-GraphstackPython -Quiet @('-m', 'pip', 'install', '--upgrade', 'pip')
99+
100+
$ruleFile = Join-Path (Get-Location) '.cursor\rules\graphstack.mdc'
101+
if ((Test-GraphstackCli) -and (Test-WheelAssets) -and (Test-Path -LiteralPath $ruleFile)) {
102+
Write-Host 'GraphStack is already set up in this project.' -ForegroundColor Green
103+
Write-Host " Rules: $ruleFile"
104+
Write-Host ' Health: py -3 -m graphstack doctor'
105+
exit 0
106+
}
74107

75108
Install-GraphstackPackage
76109

77110
Write-Host ''
78111
Write-Host 'Step 2/2: Initializing GraphStack in this project...'
79112
$initRc = Invoke-GraphstackPython @('-m', 'graphstack', 'init', '.', '-y', '--install-deps')
80113

81-
$ruleFile = Join-Path (Get-Location) '.cursor\rules\graphstack.mdc'
82114
if (-not (Test-Path -LiteralPath $ruleFile)) {
83115
Write-Host ''
84116
Write-Host 'Bootstrap failed: .cursor/rules/graphstack.mdc was not created.' -ForegroundColor Red
85-
Write-Host 'Run: py -3 -m pip install -U --force-reinstall ''MertCapkin_GraphStack[graphify]'''
117+
Write-Host 'Run: py -3 -m pip install -U ''MertCapkin_GraphStack[graphify]'''
86118
Write-Host 'Then: py -3 -m graphstack init . -y --install-deps'
87119
exit 1
88120
}
@@ -91,7 +123,6 @@ if ($initRc -ne 0) {
91123
Write-Host ''
92124
Write-Host "Init reported issues (exit $initRc) but core files are present." -ForegroundColor Yellow
93125
Write-Host 'Run: py -3 -m graphstack doctor'
94-
exit 0
95126
}
96127

97128
Write-Host ''

scripts/bootstrap.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,21 @@ assets_ok() {
3838
$PY -c "from graphstack.installer import install_source_root; p=install_source_root()/'.cursor'/'rules'/'graphstack.mdc'; import sys; sys.exit(0 if p.is_file() else 1)"
3939
}
4040

41+
if $PY -m graphstack --version >/dev/null 2>&1 && assets_ok && [ -f .cursor/rules/graphstack.mdc ]; then
42+
echo "GraphStack is already set up in this project."
43+
echo " Health: $PY -m graphstack doctor"
44+
exit 0
45+
fi
46+
4147
echo "Step 1/2: Installing MertCapkin_GraphStack + graphify from PyPI..."
42-
if ! $PY -m pip install --upgrade --force-reinstall "MertCapkin_GraphStack[graphify]"; then
48+
if ! $PY -m pip install --upgrade "MertCapkin_GraphStack[graphify]"; then
4349
echo "PyPI install failed — trying GitHub source..." >&2
44-
$PY -m pip install --upgrade --force-reinstall "MertCapkin_GraphStack[graphify] @ git+https://github.com/MertCapkin/GraphStack.git"
50+
$PY -m pip install --upgrade "MertCapkin_GraphStack[graphify] @ git+https://github.com/MertCapkin/GraphStack.git"
4551
fi
4652
if ! assets_ok; then
47-
echo "PyPI wheel missing .cursor assets — installing from GitHub..." >&2
48-
$PY -m pip install --upgrade --force-reinstall "MertCapkin_GraphStack[graphify] @ git+https://github.com/MertCapkin/GraphStack.git"
53+
echo "PyPI wheel missing .cursor assets — force reinstall..." >&2
54+
$PY -m pip install --upgrade --force-reinstall "MertCapkin_GraphStack[graphify]" || \
55+
$PY -m pip install --upgrade --force-reinstall "MertCapkin_GraphStack[graphify] @ git+https://github.com/MertCapkin/GraphStack.git"
4956
fi
5057
if ! assets_ok; then
5158
echo "GraphStack bootstrap: installed package missing Cursor workflow files." >&2

scripts/graphstack/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
``gate``, ``state``, ``graph``
99
"""
1010

11-
__version__ = "4.5.4"
11+
__version__ = "4.5.5"
1212
__all__ = ["__version__"]

0 commit comments

Comments
 (0)