Why: Foundation task T0 of the UI/interaction base (proposal 2026-09-30, D25-D33): add the new UI component library and command-bus ecosystem repos, extend build/test/pin orchestration to twelve submodules. Evidence: make test green on the pinned combo (core + backend 13 pkgs + frontend 9 + ui 6 tests); make build produces bin/agent-system with combo version string including ui; make contracts now generates to frontend and ui with submodules staying clean; renderer/tokens migration verified CSS-rule-identical (zero behavior change). Impact: New modules/ui and deps/agent-command gitlinks; frontend consumes ui via source alias; backend vendors agent-command (replace only, no import yet); follows provider-first merges (ui PR#1/#2, agent-command PR#1, documents PR#8, frontend PR#2, backend PR#6). Refs: modules/documents docs/proposals/2026-09-30-ui-inbox-command-workspace.md
109 lines
4.8 KiB
Makefile
109 lines
4.8 KiB
Makefile
# Agent-System-Dev 顶层编排
|
||
# 部署约束:非容器化;默认产物为单二进制(modules/backend,内嵌前端与嵌入式存储)。
|
||
|
||
SHELL := /bin/bash
|
||
CORE := modules/core
|
||
BACKEND := modules/backend
|
||
FRONTEND := modules/frontend
|
||
UI := modules/ui
|
||
BIN := bin/agent-system
|
||
EMBED_DIR := $(BACKEND)/web/dist
|
||
PLUGINS := plugins
|
||
# 版本溯源(release-operations:运行制品须可对上固定组合)。无 tag 时 --always 给短 SHA。
|
||
COMBO := core=$(shell git -C $(CORE) rev-parse --short HEAD 2>/dev/null)+backend=$(shell git -C $(BACKEND) rev-parse --short HEAD 2>/dev/null)+frontend=$(shell git -C $(FRONTEND) rev-parse --short HEAD 2>/dev/null)+ui=$(shell git -C $(UI) rev-parse --short HEAD 2>/dev/null)+documents=$(shell git -C modules/documents rev-parse --short HEAD 2>/dev/null)
|
||
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null)+$(COMBO)
|
||
|
||
.PHONY: help sync status build frontend test test-backend test-frontend test-ui test-core dev pin clean setup precheck task-start task-sync task-finish version
|
||
|
||
version:
|
||
@echo "agent-system $(VERSION)"
|
||
|
||
TASK := scripts/task.sh
|
||
|
||
setup:
|
||
git config core.hooksPath scripts/hooks
|
||
chmod +x scripts/hooks/pre-commit scripts/task.sh
|
||
@echo "OK: pre-commit 钩子已启用(core.hooksPath=scripts/hooks)"
|
||
|
||
precheck:
|
||
@bash $(TASK) precheck
|
||
|
||
task-start:
|
||
@if [ -z "$(NAME)" ]; then echo "usage: make task-start NAME=feature/<slug>"; exit 2; fi
|
||
@bash $(TASK) start "$(NAME)"
|
||
|
||
task-sync:
|
||
@bash $(TASK) sync
|
||
|
||
task-finish:
|
||
@bash $(TASK) finish $(ABANDON)
|
||
|
||
help:
|
||
@echo "make sync 物化全部 submodule(递归)"
|
||
@echo "make build 构建单二进制 bin/agent-system(契约同步→前端构建→embed→静态链接)"
|
||
@echo "make test 全量测试(core + backend + frontend)"
|
||
@echo "make dev 开发模式说明(前后端分离热更新)"
|
||
@echo "make pin 推进 submodule 指针到各仓远端 main(提交前须 make test 通过)"
|
||
@echo "make status submodule 状态"
|
||
|
||
sync:
|
||
git submodule update --init --recursive
|
||
|
||
status:
|
||
@git submodule status
|
||
|
||
# 契约同步:Core 的 TS 类型镜像到前端与 UI 组件库(Core 为权威,单一来源)。
|
||
contracts:
|
||
cp $(CORE)/ts/types.ts $(FRONTEND)/src/contracts.ts.tmp
|
||
{ echo "// 从 Agent-System-Core ts/types.ts 同步(make contracts 生成;Core 为权威)。"; cat $(FRONTEND)/src/contracts.ts.tmp; } > $(FRONTEND)/src/contracts.ts
|
||
rm $(FRONTEND)/src/contracts.ts.tmp
|
||
cp $(CORE)/ts/types.ts $(UI)/src/contracts.ts.tmp
|
||
{ echo "// 从 Agent-System-Core ts/types.ts 同步(make contracts 生成;Core 为权威)。"; cat $(UI)/src/contracts.ts.tmp; } > $(UI)/src/contracts.ts
|
||
rm $(UI)/src/contracts.ts.tmp
|
||
|
||
frontend: contracts
|
||
cd $(UI) && npm ci --no-fund --no-audit
|
||
cd $(FRONTEND) && npm ci --no-fund --no-audit && npm run build
|
||
rm -rf $(EMBED_DIR) && mkdir -p $(EMBED_DIR) && cp -r $(FRONTEND)/dist/* $(EMBED_DIR)/ && touch $(EMBED_DIR)/.gitkeep
|
||
|
||
build: frontend
|
||
cd $(BACKEND) && CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$(VERSION)" -o ../../$(BIN) ./cmd/agent-system
|
||
@echo "OK: $(BIN)(版本 $(VERSION);随附插件目录 $(PLUGINS)/)"
|
||
|
||
test-core:
|
||
cd $(CORE) && go test ./...
|
||
|
||
test-backend:
|
||
cd $(BACKEND) && go test ./...
|
||
|
||
test-frontend: contracts
|
||
cd $(FRONTEND) && npm ci --no-fund --no-audit && npx vitest run
|
||
|
||
test-ui: contracts
|
||
cd $(UI) && npm ci --no-fund --no-audit && npx tsc --noEmit && npx vitest run
|
||
|
||
test: test-core test-backend test-frontend test-ui
|
||
|
||
# 运行演示(mock 模式):单二进制 + 示例插件 + 嵌入式存储,浏览器 http://127.0.0.1:8787
|
||
demo: build
|
||
$(BIN) serve --addr 127.0.0.1:8787 --data ./data --plugins $(PLUGINS) --mock
|
||
|
||
dev:
|
||
@echo "开发模式(原生,非容器):"
|
||
@echo " 1. make sync && make contracts"
|
||
@echo " 2. 终端 A:cd $(BACKEND) && go run ./cmd/agent-system serve --addr 127.0.0.1:8787 --data ./data --plugins ../$(PLUGINS)"
|
||
@echo " 3. 终端 B:cd $(FRONTEND) && npm ci && npm run dev # Vite 代理到 8787"
|
||
@echo " 4. mock 演示:设置→运行时→演示模式;或终端 A 加 --mock"
|
||
|
||
# 推进指针(多仓纪律:先验证后固定)。
|
||
pin:
|
||
@for m in modules/core modules/backend modules/frontend modules/ui modules/documents deps/agent-native deps/agent-squad deps/agent-intent deps/error-code-system deps/logging-system deps/development-guidelines deps/agent-command; do \
|
||
(git -C $$m fetch -q origin && git -C $$m checkout -q origin/main) || echo "skip $$m"; \
|
||
done
|
||
@cd $(BACKEND)/deps/agent-system-core && git fetch -q origin && git checkout -q origin/main || true
|
||
@cd $(BACKEND)/deps/agent-command && git fetch -q origin && git checkout -q origin/main || true
|
||
@echo "submodule 指针已推进;请 make test 后 git add .gitmodules modules deps && git commit"
|
||
|
||
clean:
|
||
rm -rf $(BIN) $(FRONTEND)/dist $(FRONTEND)/node_modules $(UI)/node_modules data
|