-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (70 loc) · 2.86 KB
/
Makefile
File metadata and controls
81 lines (70 loc) · 2.86 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
72
73
74
75
76
77
78
79
80
81
SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
REPO_ROOT := $(CURDIR)
LOCAL_BIN := $(HOME)/.local/bin
DATA_ROOT := $(HOME)/.local/lib/autoclawdev
PROJECTS_DIR := $(DATA_ROOT)/projects
WORKSPACE := $(HOME)/.openclaw/workspace/autoresearch
INSTALL_LINKS := \
"$(REPO_ROOT)/bin/autoclawdev $(LOCAL_BIN)/autoclawdev" \
"$(REPO_ROOT)/bin/autoclawdev $(LOCAL_BIN)/autoclaw" \
"$(REPO_ROOT)/bin/autoclawdev-ui $(LOCAL_BIN)/autoclawdev-ui" \
"$(REPO_ROOT)/scripts/runner.sh $(WORKSPACE)/runner.sh"
.PHONY: help dirs build install install-links update uninstall doctor smoke
help:
@printf "Targets:\n"
@printf " make install Build and install repo-managed symlinks\n"
@printf " make update Rebuild and refresh symlinks\n"
@printf " make uninstall Remove repo-managed symlinks only\n"
@printf " make build Build web and server apps\n"
@printf " make doctor Verify local prerequisites and install state\n"
@printf " make smoke Run a non-destructive installed-command smoke test\n"
dirs:
@mkdir -p "$(LOCAL_BIN)" "$(PROJECTS_DIR)" "$(WORKSPACE)"
build:
@pnpm build
install-links: dirs
@chmod +x "$(REPO_ROOT)/bin/autoclawdev" "$(REPO_ROOT)/bin/autoclawdev-ui" "$(REPO_ROOT)/scripts/runner.sh"
@for spec in $(INSTALL_LINKS); do \
source_path="$${spec%% *}"; \
target_path="$${spec#* }"; \
if [ -e "$$target_path" ] && [ ! -L "$$target_path" ]; then \
backup_path="$$target_path.pre-autoclawdev.$$(date +%Y%m%d%H%M%S).bak"; \
mv "$$target_path" "$$backup_path"; \
printf "Backed up %s -> %s\n" "$$target_path" "$$backup_path"; \
fi; \
ln -sfn "$$source_path" "$$target_path"; \
printf "Linked %s -> %s\n" "$$target_path" "$$source_path"; \
done
install: build install-links
@"$(REPO_ROOT)/bin/autoclawdev" doctor
update: install
uninstall:
@for spec in $(INSTALL_LINKS); do \
source_path="$${spec%% *}"; \
target_path="$${spec#* }"; \
if [ -L "$$target_path" ] && [ "$$(readlink "$$target_path")" = "$$source_path" ]; then \
rm -f "$$target_path"; \
printf "Removed %s\n" "$$target_path"; \
else \
printf "Skipped %s (not a repo-managed symlink)\n" "$$target_path"; \
fi; \
done
doctor: dirs
@command -v bash >/dev/null
@command -v node >/dev/null
@command -v pnpm >/dev/null
@command -v python3 >/dev/null
@"$(REPO_ROOT)/bin/autoclawdev" doctor
smoke: install
@command -v autoclawdev >/dev/null
@command -v autoclawdev-ui >/dev/null
@autoclawdev help >/dev/null
@autoclawdev doctor >/dev/null
@autoclawdev list >/dev/null
@autoclawdev status >/dev/null
@AUTOCLAWDEV_UI_PID_FILE="$(WORKSPACE)/autoclawdev-ui-smoke.pid" autoclawdev-ui --background --no-open >/dev/null
@curl -fsS "http://localhost:4100/api/projects" >/dev/null
@curl -fsS "http://localhost:4100/api/active" >/dev/null
@AUTOCLAWDEV_UI_PID_FILE="$(WORKSPACE)/autoclawdev-ui-smoke.pid" autoclawdev-ui --stop >/dev/null || true
@printf "Smoke checks passed.\n"