Skip to content

Commit 080cc08

Browse files
release: GraphStack v4.5.0 — one-command bootstrap and PyPI bundle
Adds graphstack graph/init, bootstrap.ps1/sh for Cursor one-liner install, bundled workflow assets for pip wheels, board reopen/list-done, Cursor preToolUse gate, and PyPI publish workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 888c1d6 commit 080cc08

56 files changed

Lines changed: 6129 additions & 720 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/hooks.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
{
22
"version": 1,
33
"hooks": {
4+
"preToolUse": [
5+
{
6+
"command": "powershell -NoProfile -ExecutionPolicy Bypass -File scripts/gate-hook.ps1 cursor",
7+
"matcher": "Write|Shell|Delete|Edit"
8+
}
9+
],
410
"beforeShellExecution": [
511
{ "command": "powershell -NoProfile -ExecutionPolicy Bypass -File scripts/gate-hook.ps1 cursor" }
612
],

.cursor/rules/graphstack.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ lives in `orchestrator/TOKEN_OPTIMIZER.md`. The Orchestrator loads it once at se
4242
activation — follow both that file **and** the abbreviated reminders below:
4343

4444
```
45-
Is the answer in the graph? → Use graph, skip raw file read
45+
Is the answer in the graph? → python -m graphstack graph query "…" (or GRAPH_REPORT once)
4646
Shell/git/test command needed? → python -m graphstack run -- <cmd> (not raw)
4747
Is this tool call speculative? → Cancel it, ask user first
4848
Can reads run in parallel? → Parallelize them

.cursor/skills/architect/ARCHITECT.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ When activated, do this sequence exactly — no skipping:
4343

4444
Before writing any brief, query the graph for:
4545

46+
**Preferred — scoped graph query (Tier 1, free):**
47+
```bash
48+
python -m graphstack graph query "modules near login and session"
49+
python -m graphstack graph query "god nodes in auth cluster"
50+
python -m graphstack graph path <changed-file> <suspected-consumer>
51+
```
52+
4653
**1. God nodes** — high-connectivity modules that the change might touch:
4754
```
4855
From graph.json: nodes with degree > 10 near the change area

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ jobs:
9999
"scripts/graphstack/validate.py",
100100
"scripts/graphstack/gate.py",
101101
"scripts/graphstack/state.py",
102+
"scripts/graphstack/graph.py",
103+
"scripts/graphstack/init_cmd.py",
104+
"scripts/graphstack/bootstrap.py",
105+
"scripts/graphstack/assets/orchestrator/ORCHESTRATOR.md",
106+
"scripts/bootstrap.ps1",
107+
"scripts/bootstrap.sh",
108+
"scripts/sync_assets.py",
102109
"scripts/gate-hook.sh",
103110
"scripts/gate-hook.ps1",
104111
".cursor/hooks.json",

.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
id-token: write
10+
11+
jobs:
12+
publish:
13+
name: Build and publish
14+
runs-on: ubuntu-latest
15+
environment: pypi
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.11"
23+
24+
- name: Sync bundled workflow assets
25+
run: python scripts/sync_assets.py
26+
27+
- name: Install build tools
28+
run: python -m pip install --upgrade pip build twine
29+
30+
- name: Run tests
31+
run: |
32+
python -m pip install --quiet pytest
33+
python -m pip install --quiet -e .
34+
python -m pytest scripts/graphstack/tests -q
35+
36+
- name: Build package
37+
run: python -m build
38+
39+
- name: Publish to PyPI
40+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ __pycache__/
1818
.venv/
1919
venv/
2020
*.egg-info/
21+
dist/
22+
build/
2123

2224
# Node
2325
node_modules/

CHANGELOG.md

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

55
---
66

7+
## [v4.5.0] — 2026-06-11
8+
9+
### Added
10+
- **One-command bootstrap**`scripts/bootstrap.ps1` (Windows) and `scripts/bootstrap.sh` (Unix) for Cursor terminal: pip install + `graphstack init . -y --install-deps`.
11+
- **PyPI packaging** — workflow files bundled in `graphstack/assets/`; `scripts/sync_assets.py`; `.github/workflows/publish.yml`.
12+
- **`graphstack init --install-deps`** — auto `pip install graphifyy` + `graphify cursor install` when missing.
13+
- **`board reopen <id> [--to todo|doing]`** — move completed tasks back to active columns.
14+
- **`board list-done [--limit N]`** — list completed tasks only.
15+
- **`docs/PYPI.md`** — maintainer publish guide.
16+
17+
### Changed
18+
- **Installer** — resolves workflow sources from dev repo or bundled PyPI assets (`install_source_root()`).
19+
- **README** — prominent one-liner install section for Cursor users.
20+
21+
---
22+
23+
## [v4.4.0] — 2026-06-11
24+
25+
### Added
26+
- **`graphstack graph`** — graphify wrappers: `query`, `path`, `explain`, `update` (graph-first reads without manual `graph.json` parsing).
27+
- **`graphstack init`** — one-shot onboarding: install + `graphify update` + `doctor`.
28+
- **Gate v2 (Cursor)**`preToolUse` hook blocks `Write`/`Shell`/`Edit`/`Delete` without a claimed board task (before edit, not just advisory).
29+
- **`GRAPHSTACK_GATE=strict`** — fail-closed on hook internal errors (default remains fail-open).
30+
31+
### Changed
32+
- **Installer** — Cursor `hooks.json` includes `preToolUse` matcher; ships `graph.py` and `init_cmd.py`.
33+
- **TOKEN_OPTIMIZER / ARCHITECT** — mandate `graphstack graph query` as the primary graph access path.
34+
- **validate / doctor**`graph_ok` check for the graph query module.
35+
- **CONTRIBUTING** — updated for Python CLI + pytest workflow.
36+
37+
### Fixed
38+
- **README Process Gate** — platform matrix documents Cursor vs Claude enforcement differences honestly.
39+
40+
---
41+
742
## [v4.3.0] — 2026-06-11
843

944
### Added

CONTRIBUTING.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# Contributing to GraphStack
22

3-
GraphStack is intentionally simple: it's markdown files, a bash script, and a shell installer. The barrier to contribution is low by design.
3+
GraphStack is a **workflow system** backed by a small Python CLI (`scripts/graphstack/`).
4+
Most files are instruction markdown for AI roles; the Python package provides board,
5+
validate, gate, graph query wrappers, and cross-platform install.
46

57
---
68

79
## What GraphStack Is (and Isn't)
810

9-
GraphStack is a **workflow system**, not a code library. Every file in this repo is either:
10-
- An instruction file that an AI reads (`.md`)
11-
- A shell script (`board.sh`, `install.sh`, `post-commit`)
12-
- Documentation
11+
GraphStack combines:
12+
- **Instruction files** an AI reads (`.cursor/skills/`, `orchestrator/`)
13+
- **Handoff files** humans and agents share (`handoff/`)
14+
- **Python CLI**`pip install -e .` then `python -m graphstack …`
1315

14-
There is no build step. No package.json. No dependencies to install to contribute.
16+
There is no Node build step. Python 3.8+ and pytest are required to run tests.
1517

1618
---
1719

@@ -31,11 +33,11 @@ If you think GraphStack is missing a role (e.g., a Security Auditor, a Performan
3133
2. Get feedback before writing the file
3234
3. Once approved: add `.cursor/skills/<rolename>/<ROLENAME>.md`, update `ORCHESTRATOR.md` with the transition rule, add a prompt to `docs/CURSOR_PROMPTS.md`, and register the new path in `scripts/graphstack/installer.py`'s `FILE_COPIES`.
3335

34-
### 3. Improve the board script
36+
### 3. Improve the board / CLI
3537

36-
`scripts/board.sh` is pure bash + python3. If you find a bug or want to add a command (e.g., `board.sh reopen`, `board.sh list-done`), open a PR with:
37-
- The change
38-
- A manual test showing it works (paste the terminal output)
38+
Board logic lives in `scripts/graphstack/board.py` (Python). Shell shims (`board.sh`, `board.ps1`) delegate to it.
39+
40+
For new CLI commands: add a module under `scripts/graphstack/`, register in `cli.py`, copy list in `installer.py`'s `PYTHON_PACKAGE_FILES`, and add tests in `scripts/graphstack/tests/`.
3941

4042
### 4. Add a demo
4143

@@ -74,9 +76,10 @@ Consumer projects keep their handoff history; only this source repo resets.
7476

7577
- **One PR per change.** Don't bundle unrelated edits.
7678
- **Explain the behavior change**, not just what you edited.
77-
- **Test the board script** if you touch `board.sh`: run through `new → claim → complete → status` and paste the output.
79+
- **Test the CLI** if you touch `scripts/graphstack/`: `pytest scripts/graphstack/tests -q`
80+
- **Test the board** if you touch board commands: run `new → claim → complete → status`
7881
- **Keep role files under 300 lines.** If yours is longer, it's doing too much.
79-
- **No new dependencies.** GraphStack requires only bash + python3 + git. Keep it that way.
82+
- **No new runtime dependencies.** The `graphstack` package uses only the Python stdlib. Optional: `graphifyy` for graph commands.
8083

8184
---
8285

README.md

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,37 @@ One prompt starts the entire lifecycle — from blank repo to production.
77

88
[![CI](https://github.com/MertCapkin/graphstack/actions/workflows/ci.yml/badge.svg)](https://github.com/MertCapkin/graphstack/actions)
99
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
10-
[![Version](https://img.shields.io/badge/version-v4.3.0-blue)](CHANGELOG.md)
10+
[![Version](https://img.shields.io/badge/version-v4.5.0-blue)](CHANGELOG.md)
1111
[![Platforms](https://img.shields.io/badge/platforms-Windows%20%7C%20macOS%20%7C%20Linux-success)](#compatibility)
1212
[![Works with Cursor](https://img.shields.io/badge/Works%20with-Cursor-blue)](https://cursor.sh)
1313
[![Works with Claude Code](https://img.shields.io/badge/Works%20with-Claude%20Code-orange)](https://claude.ai/code)
1414

1515
</div>
1616

17-
> **v4.3 highlights:** `graphstack gate` — deterministic handoff enforcement via Cursor + Claude Code hooks (brief + board task required before code changes). Plus v4.2 `graphstack run` (token-safe shell output), v4.1 `validate` / `doctor`. See [CHANGELOG.md](CHANGELOG.md).
17+
> **v4.5 highlights:** One-command bootstrap (`bootstrap.ps1` / `bootstrap.sh`), PyPI-ready packaging, `board reopen` / `list-done`. Plus v4.4 `graph query` + `init`, v4.3 gate. See [CHANGELOG.md](CHANGELOG.md).
18+
19+
---
20+
21+
## One command (Cursor terminal)
22+
23+
Open your **project folder** in Cursor, open the integrated terminal, and run:
24+
25+
**Windows (PowerShell):**
26+
```powershell
27+
irm https://raw.githubusercontent.com/MertCapkin/GraphStack/main/scripts/bootstrap.ps1 | iex
28+
```
29+
30+
**macOS / Linux:**
31+
```bash
32+
curl -fsSL https://raw.githubusercontent.com/MertCapkin/GraphStack/main/scripts/bootstrap.sh | bash
33+
```
34+
35+
**After [PyPI publish](docs/PYPI.md):**
36+
```bash
37+
pip install "graphstack[graphify]" && graphstack init . -y --install-deps
38+
```
39+
40+
This installs GraphStack + Graphify, copies workflow files into **the current project**, refreshes the code graph, and runs `doctor`. Then describe your task in Cursor chat — rules load automatically.
1841

1942
---
2043

@@ -71,6 +94,15 @@ python3 -m graphify --version
7194

7295
GraphStack now works natively on Windows, macOS, and Linux. The installer runs through Python (which you already have for Graphify), so no shell-specific tooling is required.
7396

97+
#### One command (recommended)
98+
99+
```bash
100+
git clone https://github.com/MertCapkin/graphstack /path/to/graphstack
101+
cd /path/to/your-project
102+
/path/to/graphstack/install.ps1 . # Windows
103+
# or: python -m graphstack init . -y # any OS — install + graph refresh + doctor
104+
```
105+
74106
#### macOS / Linux (bash / zsh)
75107

76108
```bash
@@ -306,7 +338,7 @@ GraphStack is a **workflow protocol** (markdown + handoff files), not a runtime
306338

307339
| Topic | Reality |
308340
|-------|---------|
309-
| Role automation | Prompts alone cannot guarantee discipline. v4.3 adds **`graphstack gate`** (hook-enforced) + `state set` + `validate`. Hooks block code commits/edits without a claimed board task; turn-end hooks are advisory only. |
341+
| Role automation | Prompts alone cannot guarantee discipline. v4.3+ **`graphstack gate`** + v4.4 Cursor **`preToolUse`**. Hooks block commits and (on Cursor/Claude) code writes without a claimed task; `afterFileEdit` on Cursor remains advisory-only backup. |
310342
| Token savings | The table above is **estimated**, not guaranteed. Small repos or undisciplined sessions may use **more** tokens than unstructured chat. |
311343
| Knowledge graph | Value appears on **20+ file** codebases with module boundaries. Meta-repos full of markdown produce noisy graphs — use `.graphifyignore` (included in this repo). |
312344
| Setup | Graphify + GraphStack install + `/graphify` + Cursor — four steps, not zero-config. |
@@ -347,24 +379,42 @@ Independent Python implementation (MIT) — inspired by common agent-tooling pat
347379

348380
---
349381

382+
## Graph Queries (`graphstack graph`)
383+
384+
Graph-first rules mean **query the graph before opening raw files**. v4.4 wraps Graphify's CLI so agents use one consistent command:
385+
386+
```bash
387+
python -m graphstack graph query "who calls login"
388+
python -m graphstack graph query "blast radius of crypto.ts" --budget 1500
389+
python -m graphstack graph path src/auth/login.ts src/utils/crypto.ts
390+
python -m graphstack graph explain "login()"
391+
python -m graphstack graph update . # AST-only refresh after code changes
392+
```
393+
394+
Requires `graphify` on PATH (`pip install -r requirements.txt`). Agents should prefer `graph query` over reading full `GRAPH_REPORT.md` or grepping source for structural questions.
395+
396+
---
397+
350398
## Process Gate (`graphstack gate`)
351399

352-
v4.3 adds **mechanical enforcement** so Architect → Builder → Reviewer steps are harder to skip silently.
400+
v4.3+ adds **mechanical enforcement** so Architect → Builder → Reviewer steps are harder to skip silently. v4.4 extends Cursor with `preToolUse` blocking.
353401

354-
| Rule | What it blocks | Platform |
355-
|------|----------------|----------|
356-
| R1 | `git commit` touching code while `handoff/board/doing/` is empty | Cursor + Claude Code |
357-
| R2 | Edit/Write on code paths while `doing/` is empty | Claude Code (`PreToolUse`) |
358-
| R3 | Commit while `BRIEF.md` is still the template and a task is in `doing/` | Both |
359-
| R4 | *(advisory)* `STATE.json` not updated this cycle | Turn-end hooks |
402+
| Rule | What it blocks | Cursor | Claude Code |
403+
|------|----------------|--------|-------------|
404+
| R1 | `git commit` touching code while `doing/` is empty | deny (`beforeShellExecution` + `preToolUse` Shell) | deny (`PreToolUse` Bash) |
405+
| R2 | Edit/Write on code paths while `doing/` is empty | deny (`preToolUse` Write/Edit) | deny (`PreToolUse` Edit/Write) |
406+
| R3 | Commit while `BRIEF.md` is still the template | deny | deny |
407+
| R4 | `STATE.json` not updated this cycle | advisory (`stop`) | advisory (`Stop`) |
408+
|| Edit already applied (legacy hook) | advisory only (`afterFileEdit`) ||
360409

361410
```bash
362411
python -m graphstack gate check # CI / manual — exit 1 on violation
363412
python -m graphstack state set --role builder --task my-feature
364413
GRAPHSTACK_GATE=off # emergency bypass (one session)
414+
GRAPHSTACK_GATE=strict # fail-closed on hook internal errors
365415
```
366416

367-
**Install** writes `.cursor/hooks.json` and `.claude/settings.json` with OS-specific shim commands (`scripts/gate-hook.ps1` on Windows, `scripts/gate-hook.sh` on macOS/Linux). Hooks **fail open** if Python is missing — a crashing gate is worse than no gate.
417+
**Install** writes `.cursor/hooks.json` and `.claude/settings.json` with OS-specific shim commands (`scripts/gate-hook.ps1` on Windows, `scripts/gate-hook.sh` on macOS/Linux). By default hooks **fail open** if Python is missing — use `GRAPHSTACK_GATE=strict` for teams that prefer blocking over availability.
368418

369419
> **Framework repo note:** This GitHub repo ships `handoff/` as **templates** (empty brief, no `done/` tasks). Your installed project fills those files during real work. Before contributing here, reset handoff — see [CONTRIBUTING.md](CONTRIBUTING.md).
370420

docs/PYPI.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Publishing GraphStack to PyPI
2+
3+
## One-time setup (maintainer)
4+
5+
1. Create a [PyPI](https://pypi.org) account and project **`graphstack`** (check name availability first).
6+
2. Enable [Trusted Publishing](https://docs.pypi.org/trusted-publishers/) on PyPI:
7+
- GitHub repo: `MertCapkin/GraphStack`
8+
- Workflow: `publish.yml`
9+
- Environment name: `pypi`
10+
3. In GitHub → Settings → Environments → **pypi** → add protection rules if desired.
11+
12+
## Release flow
13+
14+
1. Bump version in `pyproject.toml` and `scripts/graphstack/__init__.py`.
15+
2. Update `CHANGELOG.md`.
16+
3. Sync bundled assets:
17+
```bash
18+
python scripts/sync_assets.py
19+
```
20+
4. Commit, tag, and push:
21+
```bash
22+
git tag v4.5.0
23+
git push origin v4.5.0
24+
```
25+
5. Create a **GitHub Release** from the tag — this triggers `.github/workflows/publish.yml`.
26+
27+
Or run **Publish to PyPI** workflow manually (`workflow_dispatch`).
28+
29+
## Local dry-run (no upload)
30+
31+
```bash
32+
python scripts/sync_assets.py
33+
python -m pip install build
34+
python -m build
35+
python -m pip install dist/graphstack-*.whl
36+
graphstack --version
37+
graphstack init /tmp/test-project -y --install-deps
38+
```
39+
40+
## User install (after publish)
41+
42+
```bash
43+
pip install "graphstack[graphify]"
44+
cd /path/to/your-project
45+
graphstack init . -y --install-deps
46+
```
47+
48+
Workflow markdown files ship **inside the wheel** under `graphstack/assets/` — no git clone required.

0 commit comments

Comments
 (0)