Files
cc-connect/Makefile
T
quabugandClaude Opus 4.6 aef607b536 feat(agent): add pi coding agent adapter
Add support for the pi coding agent CLI (@mariozechner/pi-coding-agent)
as a new agent backend. Pi uses `--mode json` for NDJSON streaming
output and supports multi-turn sessions via `--session <id>`.

Features:
- Parse pi's streaming events (text, thinking, tool calls, tool results)
- Accumulate thinking deltas into a single event to avoid message spam
- Pass images and files as @file arguments (pi's native attachment syntax)
- Support model selection, session resumption, and mode switching
- Implement AgentDoctorInfo, ModeSwitcher, and MemoryFileProvider interfaces

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 07:58:49 -07:00

117 lines
3.4 KiB
Makefile

APP := cc-connect
MODULE := github.com/chenhg5/cc-connect
CMD := ./cmd/cc-connect
DIST := dist
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
BUILD_TIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
LDFLAGS := -s -w \
-X main.version=$(VERSION) \
-X main.commit=$(COMMIT) \
-X main.buildTime=$(BUILD_TIME)
PLATFORMS := \
linux/amd64 \
linux/arm64 \
darwin/amd64 \
darwin/arm64 \
windows/amd64 \
windows/arm64
# ---------------------------------------------------------------------------
# Selective compilation via build tags.
#
# By default all agents and platforms are included. To build with only
# specific ones, set AGENTS and/or PLATFORMS_INCLUDE:
#
# make build AGENTS=claudecode PLATFORMS_INCLUDE=feishu,telegram
#
# You can also exclude specific ones:
#
# make build EXCLUDE=discord,dingtalk,qq,qqbot,line
# ---------------------------------------------------------------------------
ALL_AGENTS := claudecode codex cursor gemini iflow opencode pi qoder
ALL_PLATFORMS := feishu telegram discord slack dingtalk wecom qq qqbot line
COMMA := ,
# Compute exclusion tags from AGENTS / PLATFORMS_INCLUDE / EXCLUDE variables
_EXCLUDE_TAGS :=
ifdef AGENTS
_WANTED_AGENTS := $(subst $(COMMA), ,$(AGENTS))
_EXCLUDE_AGENTS := $(filter-out $(_WANTED_AGENTS),$(ALL_AGENTS))
_EXCLUDE_TAGS += $(addprefix no_,$(_EXCLUDE_AGENTS))
endif
ifdef PLATFORMS_INCLUDE
_WANTED_PLATFORMS := $(subst $(COMMA), ,$(PLATFORMS_INCLUDE))
_EXCLUDE_PLATFORMS := $(filter-out $(_WANTED_PLATFORMS),$(ALL_PLATFORMS))
_EXCLUDE_TAGS += $(addprefix no_,$(_EXCLUDE_PLATFORMS))
endif
ifdef EXCLUDE
_EXCLUDE_TAGS += $(addprefix no_,$(subst $(COMMA), ,$(EXCLUDE)))
endif
_BUILD_TAGS := $(strip $(_EXCLUDE_TAGS))
_TAGS_FLAG := $(if $(_BUILD_TAGS),-tags '$(_BUILD_TAGS)',)
.PHONY: build run clean test lint release release-all
build:
go build $(_TAGS_FLAG) -ldflags "$(LDFLAGS)" -o $(APP) $(CMD)
run: build
./$(APP)
clean:
rm -f $(APP)
rm -rf $(DIST)
test:
go test -v ./...
lint:
golangci-lint run ./...
release-all: clean
@mkdir -p $(DIST)
@$(foreach platform,$(PLATFORMS), \
$(eval GOOS := $(word 1,$(subst /, ,$(platform)))) \
$(eval GOARCH := $(word 2,$(subst /, ,$(platform)))) \
$(eval EXT := $(if $(filter windows,$(GOOS)),.exe,)) \
$(eval OUT := $(DIST)/$(APP)-$(VERSION)-$(GOOS)-$(GOARCH)$(EXT)) \
echo "Building $(OUT)" && \
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 \
go build $(_TAGS_FLAG) -ldflags "$(LDFLAGS)" -o $(OUT) $(CMD) && \
) true
@echo "Packaging archives..."
@cd $(DIST) && for f in $(APP)-*; do \
case "$$f" in \
*.tar.gz|*.zip) continue ;; \
*.exe) zip "$${f%.exe}.zip" "$$f" ;; \
*) tar czf "$$f.tar.gz" "$$f" ;; \
esac; \
done
@cd $(DIST) && sha256sum * > checksums.txt
@echo "Done. Binaries and archives in $(DIST)/"
release:
@if [ -z "$(TARGET)" ]; then \
echo "Usage: make release TARGET=linux/amd64"; \
echo "Available: $(PLATFORMS)"; \
exit 1; \
fi
@mkdir -p $(DIST)
$(eval GOOS := $(word 1,$(subst /, ,$(TARGET))))
$(eval GOARCH := $(word 2,$(subst /, ,$(TARGET))))
$(eval EXT := $(if $(filter windows,$(GOOS)),.exe,))
$(eval OUT := $(DIST)/$(APP)-$(VERSION)-$(GOOS)-$(GOARCH)$(EXT))
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 \
go build $(_TAGS_FLAG) -ldflags "$(LDFLAGS)" -o $(OUT) $(CMD)
@echo "Built: $(OUT)"