Skip to content

Commit 35ca3d8

Browse files
committed
better make file to run dev mode
1 parent 4275a2a commit 35ca3d8

3 files changed

Lines changed: 54 additions & 4 deletions

File tree

CLAUDE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ cp dev.env.example dev.env
9292
| `make use` | check out those refs across all submodules |
9393
| `make dev` / `make dev-web` | run the **local submodule source** (`--reload`) — follows the checked-out branch |
9494
| `make server` | (re)install the **Electron desktop server** from `API_REF`/`AGENT_REF` |
95+
| `make server-local` | install Electron desktop server **from local uncommitted source** (no push needed) |
9596
| `make app` | run the Electron desktop app (auto-update disabled so it can't revert your branch) |
97+
| `make app-local` | run the Electron desktop app **against local uncommitted source** (runs `server-local` first) |
98+
| `make pack-local` | build macOS `.app` from local uncommitted source, iCloud-safe (no DMG, `/tmp` build) |
99+
| `make watch` | live reload — Electron app + Python `--reload` (alias for `make dev`) |
96100
| `make baseline` | snap every submodule back to the superproject's pinned commits |
97101
| `make pin` | record the submodules' current commits as the superproject pins (a deliberate commit) |
98102

@@ -104,6 +108,15 @@ cp dev.env.example dev.env
104108
> migration applied by one must exist in the other (else the app crashes on startup
105109
> with `Can't locate revision …`). `make flush` resets when they drift.
106110
111+
> **Developing with uncommitted changes in the Electron app**: `make dev`/`dev-web`
112+
> already pick up uncommitted source changes on-the-fly. For the Electron desktop path,
113+
> `make app-local` installs cowork-server directly from `backend/core_api/` (no commit
114+
> needed) and then launches the app. `COWORK_SERVER_DISABLE_AUTOUPDATE=1` is set
115+
> automatically so the installer won't re-download from git. To also develop `core_agent`
116+
> without committing: update `[tool.uv.sources] anton-agent` in
117+
> `backend/core_api/pyproject.toml` to `{ path = "../../core_agent" }`, then re-run
118+
> `make app-local`. (Restore the git source before pushing.)
119+
107120
**4. Bumping pins is deliberate.** Because submodules are ignored, the *only* way a
108121
pin changes is `make pin` (after a submodule PR merges and you push the submodule).
109122
Pushing from inside the submodule first still applies — `make pin` just records the

Makefile

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export ANTON_REF := $(AGENT_REF)
3131
# Only inject a non-default anton override (uv rejects a redundant --with).
3232
_ANTON_WITH := $(if $(filter-out main,$(AGENT_REF)),--with "anton-agent @ git+https://github.com/mindsdb/anton.git@$(AGENT_REF)",)
3333

34-
.PHONY: help setup dev dev-web build dist-mac dist-win docker-build docker-up docker-down flush use pin baseline server app refs
34+
.PHONY: help setup dev dev-web build dist-mac dist-win docker-build docker-up docker-down flush use pin baseline server server-local app app-local pack-local watch refs
3535

3636
.DEFAULT_GOAL := help
3737

@@ -149,5 +149,38 @@ server: ## (re)install the Electron desktop server from the configured API_REF/A
149149
--force --reinstall --python '>=3.12,<3.14'
150150
@echo "✓ desktop server installed from core_api@$(API_REF)."
151151

152+
server-local: ## install Electron desktop server from LOCAL uncommitted source (no push needed)
153+
UV_PYTHON_PREFERENCE=only-managed uv tool install \
154+
"$(CURDIR)/$(API)" \
155+
--force --reinstall --python '>=3.12,<3.14'
156+
@echo "✓ desktop server installed from local source: $(CURDIR)/$(API)"
157+
@echo " anton resolved from core_api/pyproject.toml [tool.uv.sources]"
158+
@echo " To also use local core_agent, set:"
159+
@echo " [tool.uv.sources] anton-agent = { path = \"../../core_agent\" }"
160+
@echo " in backend/core_api/pyproject.toml, then re-run server-local."
161+
152162
app: $(_NPM_STAMP) ## run the Electron desktop app against the configured branch (no auto-update)
153163
cd $(FRONTEND) && COWORK_SERVER_DISABLE_AUTOUPDATE=1 npm run dev
164+
165+
app-local: $(_NPM_STAMP) ## run the Electron desktop app using LOCAL source (implies server-local)
166+
$(MAKE) server-local
167+
cd $(FRONTEND) && COWORK_SERVER_DISABLE_AUTOUPDATE=1 \
168+
COWORK_SERVER_PACKAGE="$(CURDIR)/$(API)" npm run dev
169+
170+
pack-local: $(_NPM_STAMP) ## build macOS .app from LOCAL uncommitted source, iCloud-safe (no DMG)
171+
$(MAKE) server-local
172+
cd $(FRONTEND) && PATH="/opt/homebrew/opt/node@20/bin:$$PATH" \
173+
npm run build && \
174+
npx electron-builder --mac --arm64 --dir \
175+
--config.directories.output=/tmp/minds-build
176+
rm -rf $(FRONTEND)/release/mac-arm64
177+
cp -R /tmp/minds-build/mac-arm64 $(FRONTEND)/release/
178+
@echo "✓ Built: $(FRONTEND)/release/mac-arm64/MindsHub Cowork.app"
179+
@echo " Launch: COWORK_SERVER_DISABLE_AUTOUPDATE=1 '$(CURDIR)/$(FRONTEND)/release/mac-arm64/MindsHub Cowork.app/Contents/MacOS/MindsHub Cowork' &"
180+
181+
watch: $(_NPM_STAMP) $(_API_STAMP) $(_AGENT_STAMP) ## live reload — Electron app + Python hot-reload (alias for dev)
182+
@trap 'kill 0' SIGINT SIGTERM EXIT; \
183+
uv run --directory $(API) uvicorn cowork.server:app --reload \
184+
--reload-dir $(CURDIR)/$(API)/cowork \
185+
--reload-dir $(CURDIR)/$(AGENT)/anton & \
186+
npm --prefix $(FRONTEND) run dev

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ make setup
7070

7171
| Mode | Command |
7272
|---|---|
73-
| Desktop app (Electron) with hot reload | `make dev` |
73+
| Desktop app (Electron) with hot reload | `make dev` or `make watch` |
7474
| Web app in browser with hot reload | `make dev-web` |
7575
| Production build | `make build` |
7676
| Package for macOS | `make dist-mac` |
7777
| Package for Windows | `make dist-win` |
78+
| Build macOS `.app` from local uncommitted source | `make pack-local` |
7879
| Wipe all local installs + data (fresh start) | `make flush` |
7980

8081
> **Reset to a clean slate:** `make flush` uninstalls the local runtime (the `cowork-server` uv tool and the `backend/*/.venv`s) **and** deletes app state in `~/.anton` (provider keys) and `~/.cowork` (database, hermes, projects). Use it to test the from-scratch install flow or recover from a broken install. ⚠️ This deletes your conversations and saved keys. It prompts for confirmation; pass `FORCE=1` to skip it. The next `make setup` or app launch reinstalls everything.
@@ -93,8 +94,11 @@ cp dev.env.example dev.env # then set REF=feat/my-thing (or per-module API_
9394
| Command | What it does |
9495
|---|---|
9596
| `make use` | check out your `dev.env` refs across all submodules |
96-
| `make dev` / `make dev-web` | run the local module source on those branches (hot reload) |
97-
| `make server` + `make app` | run the desktop app against your branch's server |
97+
| `make dev` / `make watch` | run the Electron app with live reload against local source |
98+
| `make dev-web` | run the web SPA with live reload against local source |
99+
| `make server` + `make app` | (re)install the desktop server from the configured branch, then launch |
100+
| `make server-local` + `make app-local` | install the desktop server from **local uncommitted source**, then launch |
101+
| `make pack-local` | build the macOS `.app` from local uncommitted source (no push needed) |
98102
| `make refs` | show which refs the next run will use |
99103
| `make baseline` | reset submodules to the pinned commits |
100104
| `make pin` | record the current submodule commits as the superproject's pins (one deliberate commit) |

0 commit comments

Comments
 (0)