Skip to content

Commit 4115335

Browse files
committed
cleanup readme, new claude.md, cursor rules, etc
1 parent 81e6ffa commit 4115335

76 files changed

Lines changed: 8137 additions & 4376 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursorrules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CLAUDE.md

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
# Generated files
1010
acp_commands.sh
1111

12+
13+
acp/config/tmp/

CLAUDE.md

Lines changed: 0 additions & 135 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 0 additions & 23 deletions
This file was deleted.

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,44 @@ example-%: ## Run any acp-example Makefile target: make example-<target>
2727

2828
build: acp-build ## Build acp components
2929

30+
31+
branchname := $(shell git branch --show-current)
32+
dirname := $(shell basename ${PWD})
33+
setup:
34+
@echo "BRANCH: ${branchname}"
35+
@echo "DIRNAME: ${dirname}"
36+
37+
$(MAKE) -C $(ACP_DIR) mocks deps
38+
39+
worktree-cluster:
40+
# replicated cluster create --distribution kind --instance-type r1.small --disk 50 --version 1.33.1 --wait 5m --name ${dirname}
41+
# replicated cluster kuebconfig ${dirname} --output ./kubeconfig
42+
# kubectl --kubeconfig ./kubeconfig get node
43+
# kubectl --kubeconfig ./kubeconfig create secret generic openai --from-literal=OPENAI_API_KEY=${OPENAI_API_KEY}
44+
# kubectl --kubeconfig ./kubeconfig create secret generic anthropic --from-literal=ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
45+
# kubectl --kubeconfig ./kubeconfig create secret generic humanlayer --from-literal=HUMANLAYER_API_KEY=${HUMANLAYER_API_KEY}
46+
# KUBECONFIG=./kubeconfig $(MAKE) -C $(ACP_DIR) generate deploy-local-kind
47+
48+
check:
49+
# $(MAKE) -C $(ACP_DIR) fmt vet lint test generate
50+
3051
test: acp-test ## Run tests for acp components
3152

53+
check-keys-set:
54+
@if [ -z "${HUMANLAYER_API_KEY}" ]; then \
55+
echo "HUMANLAYER_API_KEY is not set"; \
56+
exit 1; \
57+
fi
58+
@if [ -z "${OPENAI_API_KEY}" ]; then \
59+
echo "OPENAI_API_KEY is not set"; \
60+
exit 1; \
61+
fi
62+
@if [ -z "${ANTHROPIC_API_KEY}" ]; then \
63+
echo "ANTHROPIC_API_KEY is not set"; \
64+
exit 1; \
65+
fi
66+
@echo "Keys are set"
67+
3268
##@ Cluster Management
3369

3470
cluster-up: ## Create the Kind cluster

acp/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,11 @@ go.work
3232
# macOS system files
3333
.DS_Store
3434
**/.DS_Store
35+
36+
# Generated mock files
37+
**/mocks/
38+
internal/**/mocks/
39+
internal/controller/toolcall/services/mocks/
40+
internal/humanlayer/mocks/
41+
internal/llmclient/mocks/
42+
internal/mcpmanager/mocks/

acp/Makefile

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,29 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
9393
lint-config: golangci-lint ## Verify golangci-lint linter configuration
9494
$(GOLANGCI_LINT) config verify
9595

96-
.PHONY: ask-dex
97-
ask-dex: ## Ask Dex a question about the project
98-
cd hack/ask-dex && bun ask-dex.js $(filter-out $@,$(MAKECMDGOALS))
99-
96+
.PHONY: mocks
97+
mocks: mockgen ## Generate all mocks using mockgen
98+
@echo "Generating mocks..."
99+
$(MOCKGEN) -source=internal/humanlayer/hlclient.go -destination=internal/humanlayer/mocks/mock_hlclient.go -package=mocks
100+
$(MOCKGEN) -source=internal/llmclient/llm_client.go -destination=internal/llmclient/mocks/mock_llm_client.go -package=mocks
101+
$(MOCKGEN) -source=internal/mcpmanager/mcpmanager.go -destination=internal/mcpmanager/mocks/mock_mcpmanager.go -package=mocks
102+
@echo "Mock generation complete"
103+
104+
.PHONY: clean-mocks
105+
clean-mocks: ## Remove all generated mock files
106+
@echo "Cleaning mocks..."
107+
rm -rf internal/humanlayer/mocks/
108+
rm -rf internal/llmclient/mocks/
109+
rm -rf internal/mcpmanager/mocks/
110+
@echo "Mock cleanup complete"
100111
##@ Build
101112

113+
.PHONY: deps
114+
deps: ## Install dependencies
115+
go mod tidy
116+
go mod download
117+
go mod verify
118+
102119
.PHONY: build
103120
build: manifests generate fmt vet ## Build manager binary.
104121
go build -o bin/manager cmd/main.go
@@ -192,10 +209,11 @@ deploy: manifests docker-build kustomize ## Deploy controller to the K8s cluster
192209
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
193210
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
194211

212+
namespace ?= default
195213
.PHONY: deploy-local-kind
196214
deploy-local-kind: manifests docker-build docker-load-kind kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
197215
cd config/localdev && $(KUSTOMIZE) edit set image controller=${IMG}
198-
$(KUSTOMIZE) build config/localdev | $(KUBECTL) apply -f -
216+
$(KUSTOMIZE) build config/localdev | $(KUBECTL) apply -f - --namespace=$(namespace)
199217

200218
.PHONY: deploy-samples
201219
deploy-samples: kustomize ## Deploy samples to the K8s cluster specified in ~/.kube/config.
@@ -232,6 +250,7 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
232250
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
233251
ENVTEST ?= $(LOCALBIN)/setup-envtest
234252
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
253+
MOCKGEN = $(LOCALBIN)/mockgen
235254

236255
## Tool Versions
237256
KUSTOMIZE_VERSION ?= v5.5.0
@@ -241,6 +260,7 @@ ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller
241260
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
242261
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
243262
GOLANGCI_LINT_VERSION ?= v1.63.4
263+
MOCKGEN_VERSION ?= v0.5.0
244264

245265
.PHONY: kustomize
246266
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -270,6 +290,11 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
270290
$(GOLANGCI_LINT): $(LOCALBIN)
271291
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
272292

293+
.PHONY: mockgen
294+
mockgen: $(MOCKGEN) ## Download mockgen locally if necessary.
295+
$(MOCKGEN): $(LOCALBIN)
296+
$(call go-install-tool,$(MOCKGEN),go.uber.org/mock/mockgen,$(MOCKGEN_VERSION))
297+
273298
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
274299
# $1 - target path with name of binary
275300
# $2 - package url which can be installed
@@ -282,6 +307,7 @@ echo "Downloading $${package}" ;\
282307
rm -f $(1) || true ;\
283308
GOBIN=$(LOCALBIN) go install $${package} ;\
284309
mv $(1) $(1)-$(3) ;\
310+
chmod 755 $(1)-$(3) ;\
285311
} ;\
286312
ln -sf $(1)-$(3) $(1)
287313
endef

acp/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,21 @@ Run `make help` for more information on all potential `make` targets. Common tar
132132
- `make manifests` - Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects
133133
- `make generate` - Generate code (DeepCopy methods)
134134
- `make test` - Run tests
135+
- `make mocks` - Generate mock implementations for testing (not committed to git)
135136
- `make docker-build` - Build the Docker image
136137

138+
#### Mock Generation
139+
140+
The project uses generated mocks for testing interfaces. Mock files are automatically generated via `make mocks` and are **not committed to version control**. They are recreated locally as needed for testing.
141+
142+
```sh
143+
# Generate all mock files
144+
make mocks
145+
146+
# Clean and regenerate mocks
147+
make clean-mocks && make mocks
148+
```
149+
137150
### Resources
138151

139152
- [Kubebuilder Book](https://book.kubebuilder.io/introduction.html) - Official Kubebuilder documentation

acp/cmd/main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,12 @@ func main() {
240240
// Create a shared MCPManager that all controllers will use
241241
mcpManagerInstance := mcpmanager.NewMCPServerManagerWithClient(mgr.GetClient())
242242

243-
if err = (&agent.AgentReconciler{
244-
Client: mgr.GetClient(),
245-
Scheme: mgr.GetScheme(),
246-
MCPManager: mcpManagerInstance,
247-
}).SetupWithManager(mgr); err != nil {
243+
agentReconciler, err := agent.NewAgentReconcilerForManager(mgr)
244+
if err != nil {
245+
setupLog.Error(err, "unable to create agent reconciler")
246+
os.Exit(1)
247+
}
248+
if err = agentReconciler.SetupWithManager(mgr); err != nil {
248249
setupLog.Error(err, "unable to create controller", "controller", "Agent")
249250
os.Exit(1)
250251
}

acp/config/localdev/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ patches:
2626
images:
2727
- name: controller
2828
newName: controller
29-
newTag: "202505211432"
29+
newTag: "202506131406"

0 commit comments

Comments
 (0)