forked from agenvoy/Agenvoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
71 lines (57 loc) · 2.74 KB
/
Copy pathmakefile
File metadata and controls
71 lines (57 loc) · 2.74 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
ifneq ($(filter cli run,$(MAKECMDGOALS)),)
cli:
@go run ./cmd/app/ cli $(filter-out $@,$(MAKECMDGOALS))
run:
@go run ./cmd/app/ run $(filter-out $@,$(MAKECMDGOALS))
%:
@:
else
.PHONY: help build app stop update test setup
help:
@echo "How to use:"
@echo " make build Build binary and install to /usr/local/bin/agen"
@echo " make app Attach TUI; spawn server daemon (HTTP + Discord + Telegram) if not running"
@echo " make stop Stop the running server daemon"
@echo " make update Update agen to the latest release (always overwrite)"
@echo " make test Run all unit tests"
@echo " make setup Cross-compile setup binaries to dist/"
@echo " make cli <input...> Run agent (requires tool confirmation)"
@echo " make run <input...> Run agent (allow all tools, no confirmation)"
build:
@git fetch --tags --force 2>/dev/null || true
@ver=$$(git describe --tags --abbrev=0 2>/dev/null || echo dev); \
if [ "$$ver" = "v0.21.2" ]; then ver='(dev)'; fi; \
go build -tags "fts5" -ldflags "-X github.com/pardnchiu/agenvoy/internal/runtime/tui.projectVersion=$$ver" -o agen ./cmd/app/ && sudo mkdir -p /usr/local/bin && sudo mv agen /usr/local/bin/agen
@rm -rf "$$HOME/.config/agenvoy/skills/.system" "$$HOME/.config/agenvoy/tools/.system"
@mkdir -p "$$HOME/.config/agenvoy/skills/.system" "$$HOME/.config/agenvoy/tools/.system"
@[ -d extensions/skills ] && cp -R extensions/skills/. "$$HOME/.config/agenvoy/skills/.system/" || true
@[ -d extensions/scripts ] && cp -R extensions/scripts/. "$$HOME/.config/agenvoy/tools/.system/" || true
@find "$$HOME/.config/agenvoy/skills/.system" "$$HOME/.config/agenvoy/tools/.system" -name __pycache__ -prune -exec rm -rf {} + 2>/dev/null || true
app:
@$(MAKE) stop
@$(MAKE) build
@agen
stop:
go run ./cmd/app/ stop
update:
@go run ./cmd/app/ update
test:
@go test -v -count=1 ./...
setup:
@rm -rf dist && mkdir -p dist
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -o dist/Agenvoy ./cmd/setup/
@$(MAKE) --no-print-directory _app_bundle NAME=Agenvoy-macOS-arm64
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -o dist/Agenvoy ./cmd/setup/
@$(MAKE) --no-print-directory _app_bundle NAME=Agenvoy-macOS-amd64
_app_bundle:
@app="dist/$(NAME).app"; \
mkdir -p "$$app/Contents/MacOS" "$$app/Contents/Resources"; \
cp static/scripts/Info.plist "$$app/Contents/"; \
cp static/scripts/app-launcher.sh "$$app/Contents/MacOS/Agenvoy"; \
chmod +x "$$app/Contents/MacOS/Agenvoy"; \
mv dist/Agenvoy "$$app/Contents/Resources/setup"; \
chmod +x "$$app/Contents/Resources/setup"; \
cp static/AppIcon.icns "$$app/Contents/Resources/"; \
(cd dist && zip -qr "$(NAME).zip" "$(NAME).app"); \
rm -rf "$$app"
endif