@agents-at-scale/ark 0.1.36 → 0.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +53 -70
  2. package/dist/arkServices.d.ts +3 -27
  3. package/dist/arkServices.js +31 -3
  4. package/dist/arkServices.spec.js +118 -10
  5. package/dist/commands/chat/index.js +1 -2
  6. package/dist/commands/completion/index.js +0 -2
  7. package/dist/commands/generate/generators/project.js +33 -26
  8. package/dist/commands/generate/index.js +2 -2
  9. package/dist/commands/generate/templateDiscovery.js +13 -4
  10. package/dist/commands/install/index.js +49 -58
  11. package/dist/commands/models/create.d.ts +9 -1
  12. package/dist/commands/models/create.js +97 -90
  13. package/dist/commands/models/create.spec.js +9 -37
  14. package/dist/commands/models/index.js +8 -2
  15. package/dist/commands/models/index.spec.js +1 -1
  16. package/dist/commands/status/index.d.ts +3 -1
  17. package/dist/commands/status/index.js +54 -2
  18. package/dist/components/AsyncOperation.d.ts +54 -0
  19. package/dist/components/AsyncOperation.js +110 -0
  20. package/dist/components/ChatUI.js +39 -72
  21. package/dist/components/SelectMenu.d.ts +17 -0
  22. package/dist/components/SelectMenu.js +21 -0
  23. package/dist/components/StatusMessage.d.ts +20 -0
  24. package/dist/components/StatusMessage.js +13 -0
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/lib/arkApiClient.d.ts +1 -2
  28. package/dist/lib/arkApiClient.js +5 -6
  29. package/dist/lib/config.d.ts +4 -0
  30. package/dist/lib/config.js +9 -0
  31. package/dist/lib/nextSteps.js +1 -1
  32. package/dist/lib/nextSteps.spec.js +1 -1
  33. package/dist/lib/security.js +4 -0
  34. package/dist/lib/startup.js +6 -2
  35. package/dist/lib/startup.spec.js +1 -1
  36. package/dist/lib/timeout.d.ts +1 -0
  37. package/dist/lib/timeout.js +20 -0
  38. package/dist/lib/timeout.spec.d.ts +1 -0
  39. package/dist/lib/timeout.spec.js +14 -0
  40. package/dist/lib/waitForReady.d.ts +8 -0
  41. package/dist/lib/waitForReady.js +32 -0
  42. package/dist/lib/waitForReady.spec.d.ts +1 -0
  43. package/dist/lib/waitForReady.spec.js +104 -0
  44. package/dist/types/arkService.d.ts +27 -0
  45. package/dist/types/arkService.js +1 -0
  46. package/dist/ui/asyncOperations/connectingToArk.d.ts +15 -0
  47. package/dist/ui/asyncOperations/connectingToArk.js +63 -0
  48. package/package.json +7 -5
  49. package/templates/agent/agent.template.yaml +27 -0
  50. package/templates/marketplace/.editorconfig +24 -0
  51. package/templates/marketplace/.github/.keep +11 -0
  52. package/templates/marketplace/.github/workflows/.keep +16 -0
  53. package/templates/marketplace/.helmignore +23 -0
  54. package/templates/marketplace/.prettierrc.json +20 -0
  55. package/templates/marketplace/.yamllint.yml +53 -0
  56. package/templates/marketplace/README.md +197 -0
  57. package/templates/marketplace/agents/.keep +29 -0
  58. package/templates/marketplace/docs/.keep +19 -0
  59. package/templates/marketplace/mcp-servers/.keep +32 -0
  60. package/templates/marketplace/models/.keep +23 -0
  61. package/templates/marketplace/projects/.keep +43 -0
  62. package/templates/marketplace/queries/.keep +25 -0
  63. package/templates/marketplace/teams/.keep +29 -0
  64. package/templates/marketplace/tools/.keep +32 -0
  65. package/templates/marketplace/tools/examples/.keep +17 -0
  66. package/templates/mcp-server/Dockerfile +133 -0
  67. package/templates/mcp-server/Makefile +186 -0
  68. package/templates/mcp-server/README.md +178 -0
  69. package/templates/mcp-server/build.sh +76 -0
  70. package/templates/mcp-server/chart/Chart.yaml +22 -0
  71. package/templates/mcp-server/chart/templates/_helpers.tpl +62 -0
  72. package/templates/mcp-server/chart/templates/deployment.yaml +80 -0
  73. package/templates/mcp-server/chart/templates/hpa.yaml +32 -0
  74. package/templates/mcp-server/chart/templates/mcpserver.yaml +21 -0
  75. package/templates/mcp-server/chart/templates/secret.yaml +11 -0
  76. package/templates/mcp-server/chart/templates/service.yaml +15 -0
  77. package/templates/mcp-server/chart/templates/serviceaccount.yaml +13 -0
  78. package/templates/mcp-server/chart/values.yaml +84 -0
  79. package/templates/mcp-server/example-values.yaml +74 -0
  80. package/templates/mcp-server/examples/{{ .Values.mcpServerName }}-agent.yaml +33 -0
  81. package/templates/mcp-server/examples/{{ .Values.mcpServerName }}-query.yaml +24 -0
  82. package/templates/models/azure.yaml +33 -0
  83. package/templates/models/claude.yaml +28 -0
  84. package/templates/models/gemini.yaml +28 -0
  85. package/templates/models/openai.yaml +39 -0
  86. package/templates/project/.editorconfig +24 -0
  87. package/templates/project/.helmignore +24 -0
  88. package/templates/project/.prettierrc.json +16 -0
  89. package/templates/project/.yamllint.yml +50 -0
  90. package/templates/project/Chart.yaml +19 -0
  91. package/templates/project/Makefile +360 -0
  92. package/templates/project/README.md +377 -0
  93. package/templates/project/agents/.keep +11 -0
  94. package/templates/project/docs/.keep +14 -0
  95. package/templates/project/mcp-servers/.keep +34 -0
  96. package/templates/project/models/.keep +17 -0
  97. package/templates/project/queries/.keep +11 -0
  98. package/templates/project/scripts/setup.sh +108 -0
  99. package/templates/project/teams/.keep +11 -0
  100. package/templates/project/templates/00-rbac.yaml +168 -0
  101. package/templates/project/templates/01-models.yaml +11 -0
  102. package/templates/project/templates/02-mcp-servers.yaml +22 -0
  103. package/templates/project/templates/03-tools.yaml +12 -0
  104. package/templates/project/templates/04-agents.yaml +12 -0
  105. package/templates/project/templates/05-teams.yaml +11 -0
  106. package/templates/project/templates/06-queries.yaml +11 -0
  107. package/templates/project/templates/_helpers.tpl +91 -0
  108. package/templates/project/tests/e2e/.keep +10 -0
  109. package/templates/project/tests/unit/.keep +10 -0
  110. package/templates/project/tools/.keep +25 -0
  111. package/templates/project/tools/example-tool.yaml.disabled +94 -0
  112. package/templates/project/tools/examples/data-tool/Dockerfile +32 -0
  113. package/templates/project/values.yaml +141 -0
  114. package/templates/query/query.template.yaml +13 -0
  115. package/templates/team/team.template.yaml +17 -0
  116. package/templates/tool/.python-version +1 -0
  117. package/templates/tool/Dockerfile +23 -0
  118. package/templates/tool/README.md +238 -0
  119. package/templates/tool/agent.yaml +19 -0
  120. package/templates/tool/deploy.sh +10 -0
  121. package/templates/tool/deployment/deployment.yaml +31 -0
  122. package/templates/tool/deployment/kustomization.yaml +7 -0
  123. package/templates/tool/deployment/mcpserver.yaml +12 -0
  124. package/templates/tool/deployment/service.yaml +12 -0
  125. package/templates/tool/deployment/serviceaccount.yaml +8 -0
  126. package/templates/tool/deployment/values.yaml +3 -0
  127. package/templates/tool/pyproject.toml +9 -0
  128. package/templates/tool/src/main.py +36 -0
  129. package/templates/tool/uv.lock +498 -0
@@ -0,0 +1,33 @@
1
+ apiVersion: ark.mckinsey.com/v1alpha1
2
+ kind: Agent
3
+ metadata:
4
+ name: sample-{{ .Values.mcpServerName }}-agent
5
+ labels:
6
+ app.kubernetes.io/name: {{ .Values.mcpServerName }}
7
+ app.kubernetes.io/component: agent
8
+ spec:
9
+ model:
10
+ name: default
11
+ system: |
12
+ You are an AI assistant that can use {{ .Values.mcpServerName }} tools to help users.
13
+
14
+ Available tools from {{ .Values.mcpServerName }}:
15
+ {{- range .Values.tools }}
16
+ - {{ .name }}: {{ .description }}
17
+ {{- end }}
18
+
19
+ Use these tools when appropriate to help users with their requests.
20
+
21
+ tools:
22
+ - mcpServers:
23
+ - name: {{ .Values.mcpServerName }}-server
24
+ {{- if .Values.toolConfigurations }}
25
+ {{- range .Values.toolConfigurations }}
26
+ - name: {{ .name }}
27
+ description: {{ .description }}
28
+ {{- if .parameters }}
29
+ parameters:
30
+ {{- toYaml .parameters | nindent 8 }}
31
+ {{- end }}
32
+ {{- end }}
33
+ {{- end }}
@@ -0,0 +1,24 @@
1
+ apiVersion: ark.mckinsey.com/v1alpha1
2
+ kind: Query
3
+ metadata:
4
+ name: test-{{ .Values.mcpServerName }}-query
5
+ labels:
6
+ app.kubernetes.io/name: {{ .Values.mcpServerName }}
7
+ app.kubernetes.io/component: query
8
+ spec:
9
+ agents:
10
+ - name: sample-{{ .Values.mcpServerName }}-agent
11
+
12
+ query: |
13
+ {{- if .Values.sampleQuery }}
14
+ {{ .Values.sampleQuery }}
15
+ {{- else }}
16
+ Test the {{ .Values.mcpServerName }} MCP server by using its available tools.
17
+ {{- range .Values.tools }}
18
+ Please try using the {{ .name }} tool.
19
+ {{- end }}
20
+ {{- end }}
21
+
22
+ parameters:
23
+ timeout: "5m"
24
+ maxTokens: 1000
@@ -0,0 +1,33 @@
1
+ apiVersion: v1
2
+ kind: Secret
3
+ metadata:
4
+ name: {{ .Values.modelName }}-model-token
5
+ type: Opaque
6
+ stringData:
7
+ # IMPORTANT: Environment variables must be substituted before applying
8
+ # Use one of these methods:
9
+ # 1. make models-apply (recommended)
10
+ # 2. make quickstart (full deployment)
11
+ # 3. make fix-models (if you have broken queries)
12
+ # Manual: export AZURE_API_KEY="key" && envsubst < models/{{ .Values.modelName }}.yaml | kubectl apply -f -
13
+ token: ${AZURE_API_KEY}
14
+ ---
15
+ apiVersion: ark.mckinsey.com/v1alpha1
16
+ kind: Model
17
+ metadata:
18
+ name: {{ .Values.modelName }}
19
+ spec:
20
+ type: azure
21
+ model:
22
+ value: gpt-4.1-mini
23
+ config:
24
+ azure:
25
+ baseUrl:
26
+ value: ${AZURE_BASE_URL}
27
+ apiKey:
28
+ valueFrom:
29
+ secretKeyRef:
30
+ name: {{ .Values.modelName }}-model-token
31
+ key: token
32
+ apiVersion:
33
+ value: ${AZURE_API_VERSION}
@@ -0,0 +1,28 @@
1
+ apiVersion: v1
2
+ kind: Secret
3
+ metadata:
4
+ name: {{ .Values.modelName }}-api-key
5
+ type: Opaque
6
+ stringData:
7
+ # Make sure to use
8
+ # export CLAUDE_API_KEY="key"
9
+ # envsubst < models/{{ .Values.modelName }}.yaml | kubectl apply -f -
10
+ apiKey: ${CLAUDE_API_KEY}
11
+ ---
12
+ apiVersion: ark.mckinsey.com/v1alpha1
13
+ kind: Model
14
+ metadata:
15
+ name: {{ .Values.modelName }}
16
+ spec:
17
+ type: openai
18
+ model:
19
+ value: claude-opus-4-20250514
20
+ config:
21
+ openai:
22
+ baseUrl:
23
+ value: ${CLAUDE_BASE_URL}
24
+ apiKey:
25
+ valueFrom:
26
+ secretKeyRef:
27
+ name: {{ .Values.modelName }}-api-key
28
+ key: apiKey
@@ -0,0 +1,28 @@
1
+ apiVersion: v1
2
+ kind: Secret
3
+ metadata:
4
+ name: {{ .Values.modelName }}-model-token
5
+ type: Opaque
6
+ stringData:
7
+ # Make sure to use
8
+ # export GEMINI_API_KEY="key"
9
+ # envsubst < models/{{ .Values.modelName }}.yaml | kubectl apply -f -
10
+ token: ${GEMINI_API_KEY}
11
+ ---
12
+ apiVersion: ark.mckinsey.com/v1alpha1
13
+ kind: Model
14
+ metadata:
15
+ name: {{ .Values.modelName }}
16
+ spec:
17
+ type: openai
18
+ model:
19
+ value: gemini-2.0-flash
20
+ config:
21
+ openai:
22
+ baseUrl:
23
+ value: ${GEMINI_BASE_URL}
24
+ apiKey:
25
+ valueFrom:
26
+ secretKeyRef:
27
+ name: {{ .Values.modelName }}-model-token
28
+ key: token
@@ -0,0 +1,39 @@
1
+ apiVersion: v1
2
+ kind: Secret
3
+ metadata:
4
+ name: {{ .Values.modelName }}-secret
5
+ type: Opaque
6
+ stringData:
7
+ # Make sure to use
8
+ # export OPENAI_API_KEY="key"
9
+ # envsubst < models/{{ .Values.modelName }}.yaml | kubectl apply -f -
10
+ token: ${OPENAI_API_KEY}
11
+ ---
12
+ apiVersion: ark.mckinsey.com/v1alpha1
13
+ kind: Model
14
+ metadata:
15
+ name: {{ .Values.modelName }}
16
+ spec:
17
+ type: openai
18
+ model:
19
+ value: gpt-4.1-mini
20
+ config:
21
+ openai:
22
+ properties:
23
+ temperature:
24
+ value: "0.7"
25
+ max_tokens:
26
+ value: "2000"
27
+ top_p:
28
+ value: "0.95"
29
+ logprobs:
30
+ value: "true"
31
+ top_logprobs:
32
+ value: "5"
33
+ baseUrl:
34
+ value: ${OPENAI_BASE_URL}
35
+ apiKey:
36
+ valueFrom:
37
+ secretKeyRef:
38
+ name: {{ .Values.modelName }}-secret
39
+ key: token
@@ -0,0 +1,24 @@
1
+ # EditorConfig is awesome: https://EditorConfig.org
2
+
3
+ # top-most EditorConfig file
4
+ root = true
5
+
6
+ [*]
7
+ indent_style = space
8
+ indent_size = 2
9
+ end_of_line = lf
10
+ charset = utf-8
11
+ trim_trailing_whitespace = true
12
+ insert_final_newline = true
13
+
14
+ [*.md]
15
+ trim_trailing_whitespace = false
16
+
17
+ [*.{yaml,yml}]
18
+ indent_size = 2
19
+
20
+ [*.{js,ts,jsx,tsx}]
21
+ indent_size = 2
22
+
23
+ [Makefile]
24
+ indent_style = tab
@@ -0,0 +1,24 @@
1
+ # Patterns to ignore when building packages.
2
+ # This supports shell glob matching, relative path matching, and
3
+ # negation (prefixed with !). Only one pattern per line.
4
+ .DS_Store
5
+ # Common VCS dirs
6
+ .git/
7
+ .gitignore
8
+ .bzr/
9
+ .bzrignore
10
+ .hg/
11
+ .hgignore
12
+ .svn/
13
+ # Common backup files
14
+ *.swp
15
+ *.bak
16
+ *.tmp
17
+ *~
18
+ # Various IDEs
19
+ .project
20
+ .idea/
21
+ *.tmproj
22
+ .vscode/
23
+ # Build artifacts
24
+ resources/
@@ -0,0 +1,16 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "tabWidth": 2,
5
+ "trailingComma": "es5",
6
+ "bracketSpacing": false,
7
+ "overrides": [
8
+ {
9
+ "files": ["*.yaml", "*.yml"],
10
+ "options": {
11
+ "bracketSpacing": false,
12
+ "singleQuote": false
13
+ }
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,50 @@
1
+ # YAML Lint configuration for agent project
2
+
3
+ extends: default
4
+
5
+ rules:
6
+ # Allow longer lines for readability
7
+ line-length:
8
+ max: 120
9
+ level: warning
10
+
11
+ # Allow indentation for readability in YAML
12
+ indentation:
13
+ spaces: 2
14
+ indent-sequences: true
15
+ check-multi-line-strings: false
16
+
17
+ # Be more flexible with comments
18
+ comments:
19
+ min-spaces-from-content: 1
20
+
21
+ # Allow empty values for optional fields
22
+ empty-values:
23
+ forbid-in-block-mappings: false
24
+ forbid-in-flow-mappings: true
25
+
26
+ # Allow truthy values (on/off, yes/no)
27
+ truthy:
28
+ allowed-values: ["true", "false", "on", "off", "yes", "no"]
29
+
30
+ # Allow document start/end markers
31
+ document-start:
32
+ present: false
33
+
34
+ # Allow multiple documents in one file
35
+ document-end:
36
+ present: false
37
+
38
+ # Allow braces for Golang template syntax (Helm templates)
39
+ braces:
40
+ min-spaces-inside: 0
41
+ max-spaces-inside: 1
42
+ min-spaces-inside-empty: 0
43
+ max-spaces-inside-empty: 0
44
+
45
+ # Don't enforce bracket spacing for template syntax
46
+ brackets:
47
+ min-spaces-inside: 0
48
+ max-spaces-inside: 1
49
+ min-spaces-inside-empty: 0
50
+ max-spaces-inside-empty: 0
@@ -0,0 +1,19 @@
1
+ apiVersion: v2
2
+ name: {{.Values.projectName}}
3
+ description: A Helm chart for {{ .Values.projectName }} - Agents at Scale project
4
+ type: application
5
+ version: 0.1.0
6
+ appVersion: "1.0.0"
7
+ home: https://github.com/your-org/{{ .Values.projectName }}
8
+ sources:
9
+ - https://github.com/your-org/{{ .Values.projectName }}
10
+ maintainers:
11
+ - name: {{.Values.authorName}}
12
+ email: {{.Values.authorEmail}}
13
+ keywords:
14
+ - agents
15
+ - ai
16
+ - automation
17
+ - ark
18
+ annotations:
19
+ category: AI/ML
@@ -0,0 +1,360 @@
1
+ # Makefile for Agent Project Template
2
+ #
3
+ # This Makefile provides commands for building, testing, and deploying
4
+ # your agent project to the Agents at Scale platform.
5
+
6
+ # Load environment variables from .env file if it exists
7
+ -include .env
8
+ export
9
+
10
+ # Configuration
11
+ PROJECT_NAME ?= {{ .Values.projectName }}
12
+ NAMESPACE ?= $(PROJECT_NAME)
13
+ CHART_VERSION ?= 0.1.0
14
+ IMAGE_TAG ?= latest
15
+ REGISTRY ?= localhost:5000
16
+
17
+ # Helm and kubectl
18
+ HELM := helm
19
+ KUBECTL := kubectl
20
+
21
+ # Tool directories
22
+ TOOLS_DIR := tools
23
+ CHART_DIR := .
24
+
25
+ # Build output
26
+ OUT_DIR := out
27
+ DOCKER_BUILD_DIR := $(OUT_DIR)/docker
28
+
29
+ .PHONY: help
30
+ help: ## Show this help message
31
+ @echo "🚀 Quick Commands:"
32
+ @echo " make quickstart # 5-minute setup with proper resource dependency handling"
33
+ @echo " make resources-apply # Apply all custom resources in correct order"
34
+ @echo " make fix-models # Fix broken models (if you have query errors)"
35
+ @echo ""
36
+ @echo "📚 All Commands:"
37
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
38
+
39
+ .PHONY: quickstart
40
+ quickstart: ## 5-minute setup and deploy to ARK
41
+ @echo "🚀 Quick Start - Deploying to Agents at Scale..."
42
+ @echo "📋 Checking prerequisites..."
43
+ @if [ -z "$$OPENAI_API_KEY" ] && [ -z "$$AZURE_API_KEY" ] && [ -z "$$AZURE_OPENAI_API_KEY" ]; then echo "❌ Please set OPENAI_API_KEY, AZURE_API_KEY, or AZURE_OPENAI_API_KEY in .env file"; exit 1; fi
44
+ @$(KUBECTL) version --client > /dev/null || (echo "❌ kubectl not found" && exit 1)
45
+ @$(HELM) version > /dev/null || (echo "❌ helm not found" && exit 1)
46
+ @command -v envsubst >/dev/null 2>&1 || (echo "❌ envsubst not found (install gettext package)" && exit 1)
47
+ @echo "✅ Prerequisites check passed"
48
+ @echo "🔐 Creating namespace..."
49
+ @$(KUBECTL) create namespace $(NAMESPACE) --dry-run=client -o yaml | $(KUBECTL) apply -f -
50
+ @echo "🚀 Deploying infrastructure (without custom resources)..."
51
+ @$(MAKE) build install-no-resources
52
+ @echo "🚀 Deploying custom resources in dependency order..."
53
+ @$(MAKE) resources-apply
54
+ @echo "✅ Quick start complete! Your agents are running on Kubernetes."
55
+ @if [ -d queries ] && [ -n "$$(find queries -name "*.yaml" -type f | head -1)" ]; then \
56
+ FIRST_QUERY=$$(find queries -name "*.yaml" -type f | head -1); \
57
+ QUERY_NAME=$$(grep -E "^[[:space:]]*name:" $$FIRST_QUERY | head -1 | sed 's/.*name:[[:space:]]*//'); \
58
+ echo " Try: fark query $$QUERY_NAME --namespace $(NAMESPACE)"; \
59
+ fi
60
+
61
+ .PHONY: all
62
+ all: build test ## Build and test everything
63
+
64
+ # Setup and initialization
65
+ .PHONY: init
66
+ init: ## Initialize project dependencies
67
+ @echo "Initializing project..."
68
+ @mkdir -p $(OUT_DIR) $(DOCKER_BUILD_DIR)
69
+ @if [ -f scripts/setup.sh ]; then ./scripts/setup.sh; fi
70
+
71
+ .PHONY: clean
72
+ clean: ## Clean build artifacts
73
+ @echo "Cleaning build artifacts..."
74
+ @rm -rf $(OUT_DIR)
75
+ @docker system prune -f
76
+
77
+ # Building
78
+ .PHONY: build
79
+ build: tools-build chart-package ## Build all components
80
+
81
+ .PHONY: tools-build
82
+ tools-build: ## Build all custom tools
83
+ @echo "Building custom tools..."
84
+ @for tool in $(shell find $(TOOLS_DIR) -mindepth 1 -maxdepth 1 -type d -not -name examples); do \
85
+ if [ -f "$$tool/Dockerfile" ]; then \
86
+ echo "Building tool: $$(basename $$tool)"; \
87
+ docker build -t $(REGISTRY)/$(PROJECT_NAME)-$$(basename $$tool):$(IMAGE_TAG) $$tool; \
88
+ fi; \
89
+ done
90
+
91
+ .PHONY: chart-package
92
+ chart-package: ## Package Helm chart
93
+ @echo "Packaging Helm chart..."
94
+ @$(HELM) package $(CHART_DIR) -d $(OUT_DIR) --version $(CHART_VERSION)
95
+
96
+ # Testing
97
+ .PHONY: test
98
+ test: test-lint test-tools test-manifests ## Run all tests
99
+
100
+ .PHONY: test-lint
101
+ test-lint: ## Run linting on YAML files
102
+ @echo "Linting YAML files..."
103
+ @find agents teams queries models -name "*.yaml" -exec yamllint {} \; || true
104
+
105
+ .PHONY: test-tools
106
+ test-tools: ## Test custom tools
107
+ @echo "Testing custom tools..."
108
+ @for tool in $(shell find $(TOOLS_DIR) -mindepth 1 -maxdepth 1 -type d -not -name examples); do \
109
+ if [ -f "$$tool/test.py" ]; then \
110
+ echo "Testing tool: $$(basename $$tool)"; \
111
+ cd $$tool && python test.py; \
112
+ fi; \
113
+ done
114
+
115
+ .PHONY: test-manifests
116
+ test-manifests: ## Validate Kubernetes manifests
117
+ @echo "Validating Kubernetes manifests..."
118
+ @find agents teams queries models -name "*.yaml" -exec $(KUBECTL) apply --dry-run=client -f {} \; || true
119
+
120
+ .PHONY: test-e2e
121
+ test-e2e: ## Run end-to-end tests
122
+ @echo "Running end-to-end tests..."
123
+ @if [ -d tests/e2e ]; then \
124
+ $(KUBECTL) apply -f tests/e2e/; \
125
+ echo "E2E tests applied. Check results with: kubectl get queries -w"; \
126
+ fi
127
+
128
+ # Development
129
+ .PHONY: dev
130
+ dev: dev-tools ## Run in development mode
131
+ @echo "Running in development mode..."
132
+ @echo "Use 'make dev-apply' to deploy manifests for testing"
133
+
134
+ .PHONY: dev-tools
135
+ dev-tools: ## Start tools in development mode
136
+ @echo "Starting tools in development mode..."
137
+ @for tool in $(shell find $(TOOLS_DIR) -mindepth 1 -maxdepth 1 -type d -not -name examples); do \
138
+ if [ -f "$$tool/main.py" ]; then \
139
+ echo "Starting tool: $$(basename $$tool) on port $$(( 8000 + $$(basename $$tool | wc -c) ))"; \
140
+ cd $$tool && python main.py --port $$(( 8000 + $$(basename $$tool | wc -c) )) & \
141
+ fi; \
142
+ done
143
+
144
+ .PHONY: dev-apply
145
+ dev-apply: ## Apply manifests for development testing
146
+ @echo "Applying development manifests..."
147
+ @find agents teams queries models -name "*.yaml" -exec $(KUBECTL) apply -f {} \;
148
+
149
+ .PHONY: dev-clean
150
+ dev-clean: ## Clean development resources
151
+ @echo "Cleaning development resources..."
152
+ @find agents teams queries models -name "*.yaml" -exec $(KUBECTL) delete -f {} \; || true
153
+
154
+ # Deployment
155
+ .PHONY: install
156
+ install: check-env build ## Deploy to ARK cluster
157
+ @echo "Deploying to ARK cluster..."
158
+ @$(HELM) upgrade --install $(PROJECT_NAME) $(CHART_DIR) \
159
+ --namespace $(NAMESPACE) \
160
+ --create-namespace \
161
+ --set image.tag=$(IMAGE_TAG) \
162
+ --set project.name=$(PROJECT_NAME) \
163
+ --wait
164
+
165
+ .PHONY: install-no-resources
166
+ install-no-resources: check-env build ## Deploy to ARK cluster without custom resources (resources handled separately)
167
+ @echo "Deploying to ARK cluster (excluding custom resources)..."
168
+ @$(HELM) upgrade --install $(PROJECT_NAME) $(CHART_DIR) \
169
+ --namespace $(NAMESPACE) \
170
+ --create-namespace \
171
+ --set image.tag=$(IMAGE_TAG) \
172
+ --set project.name=$(PROJECT_NAME) \
173
+ --set excludeResources=true \
174
+ --wait
175
+
176
+ .PHONY: uninstall
177
+ uninstall: ## Remove from ARK cluster
178
+ @echo "Removing from ARK cluster..."
179
+ @$(HELM) uninstall $(PROJECT_NAME) --namespace $(NAMESPACE) || true
180
+
181
+ .PHONY: upgrade
182
+ upgrade: build ## Upgrade deployment
183
+ @echo "Upgrading deployment..."
184
+ @$(HELM) upgrade $(PROJECT_NAME) $(CHART_DIR) \
185
+ --namespace $(NAMESPACE) \
186
+ --set image.tag=$(IMAGE_TAG) \
187
+ --set project.name=$(PROJECT_NAME) \
188
+ --wait
189
+
190
+ .PHONY: status
191
+ status: ## Check deployment status
192
+ @echo "Deployment status:"
193
+ @$(HELM) status $(PROJECT_NAME) --namespace $(NAMESPACE) || echo "Not deployed"
194
+ @echo "\nResources:"
195
+ @$(KUBECTL) get agents,teams,queries,models,mcpservers -n $(NAMESPACE) -l project=$(PROJECT_NAME) || true
196
+
197
+ # Image management
198
+ .PHONY: images-push
199
+ images-push: tools-build ## Push images to registry
200
+ @echo "Pushing images to registry..."
201
+ @for tool in $(shell find $(TOOLS_DIR) -mindepth 1 -maxdepth 1 -type d -not -name examples); do \
202
+ if [ -f "$$tool/Dockerfile" ]; then \
203
+ echo "Pushing: $(REGISTRY)/$(PROJECT_NAME)-$$(basename $$tool):$(IMAGE_TAG)"; \
204
+ docker push $(REGISTRY)/$(PROJECT_NAME)-$$(basename $$tool):$(IMAGE_TAG); \
205
+ fi; \
206
+ done
207
+
208
+ .PHONY: images-load
209
+ images-load: tools-build ## Load images into local cluster (kind/minikube)
210
+ @echo "Loading images into local cluster..."
211
+ @for tool in $(shell find $(TOOLS_DIR) -mindepth 1 -maxdepth 1 -type d -not -name examples); do \
212
+ if [ -f "$$tool/Dockerfile" ]; then \
213
+ echo "Loading: $(REGISTRY)/$(PROJECT_NAME)-$$(basename $$tool):$(IMAGE_TAG)"; \
214
+ kind load docker-image $(REGISTRY)/$(PROJECT_NAME)-$$(basename $$tool):$(IMAGE_TAG) || \
215
+ minikube image load $(REGISTRY)/$(PROJECT_NAME)-$$(basename $$tool):$(IMAGE_TAG) || \
216
+ echo "Could not load image (not using kind or minikube?)"; \
217
+ fi; \
218
+ done
219
+
220
+ # Utilities
221
+ .PHONY: check-env
222
+ check-env: ## Check required environment variables
223
+ @echo "Checking environment..."
224
+ @if [ -z "$$OPENAI_API_KEY" ] && [ -z "$$AZURE_API_KEY" ] && [ -z "$$AZURE_OPENAI_API_KEY" ] && [ -z "$$ANTHROPIC_API_KEY" ]; then \
225
+ echo "Warning: No model API keys set. Set at least one of:"; \
226
+ echo " AZURE_API_KEY, OPENAI_API_KEY, AZURE_OPENAI_API_KEY, ANTHROPIC_API_KEY"; \
227
+ echo " (preferably in .env file)"; \
228
+ fi
229
+ @$(KUBECTL) version --client > /dev/null || (echo "Error: kubectl not found" && exit 1)
230
+ @$(HELM) version > /dev/null || (echo "Error: helm not found" && exit 1)
231
+ @command -v envsubst >/dev/null 2>&1 || (echo "Warning: envsubst not found (install gettext package for .env substitution)")
232
+
233
+ .PHONY: models-apply
234
+ models-apply: ## Apply model configurations with environment variable substitution (requires .env file)
235
+ @echo "Applying models with environment variable substitution..."
236
+ @echo "ℹ️ This substitutes environment variables like \$$AZURE_BASE_URL, \$$AZURE_API_VERSION from .env file"
237
+ @for model_file in models/*.yaml; do \
238
+ if [ -f "$$model_file" ]; then \
239
+ echo "Applying $$model_file..."; \
240
+ envsubst < "$$model_file" | $(KUBECTL) apply -f - --namespace=$(NAMESPACE); \
241
+ fi; \
242
+ done
243
+ @echo "✅ Models applied successfully. Any existing queries will need to be recreated to use the updated models."
244
+
245
+ .PHONY: models-delete
246
+ models-delete: ## Delete model configurations
247
+ @echo "Deleting model configurations..."
248
+ @for model_file in models/*.yaml; do \
249
+ if [ -f "$$model_file" ]; then \
250
+ echo "Deleting resources from $$model_file..."; \
251
+ envsubst < "$$model_file" | $(KUBECTL) delete -f - --namespace=$(NAMESPACE) || true; \
252
+ fi; \
253
+ done
254
+
255
+ .PHONY: fix-models
256
+ fix-models: ## Fix models with proper environment variable substitution and restart queries
257
+ @echo "🔧 Fixing model configurations..."
258
+ @$(MAKE) models-apply
259
+ @echo "🔄 Restarting any existing queries to use updated models..."
260
+ @$(KUBECTL) get queries -n $(NAMESPACE) --no-headers -o custom-columns=NAME:.metadata.name 2>/dev/null | xargs -r -I {} $(KUBECTL) delete query {} -n $(NAMESPACE) --ignore-not-found=true || true
261
+ @echo "✅ Models fixed! You can now recreate your queries and they should work properly."
262
+
263
+ .PHONY: resources-apply
264
+ resources-apply: ## Apply all custom resources in dependency order (models → mcp-servers → tools → agents → teams → queries)
265
+ @echo "🚀 Applying custom resources in dependency order..."
266
+ @echo "📋 Step 1: Applying models with environment substitution..."
267
+ @for model_file in models/*.yaml; do \
268
+ if [ -f "$$model_file" ]; then \
269
+ echo "Applying $$model_file..."; \
270
+ envsubst < "$$model_file" | $(KUBECTL) apply -f - --namespace=$(NAMESPACE); \
271
+ fi; \
272
+ done
273
+ @echo "📋 Step 2: Applying MCP servers with environment substitution..."
274
+ @for mcp_file in mcp-servers/*.yaml; do \
275
+ if [ -f "$$mcp_file" ]; then \
276
+ echo "Applying $$mcp_file..."; \
277
+ envsubst < "$$mcp_file" | $(KUBECTL) apply -f - --namespace=$(NAMESPACE); \
278
+ fi; \
279
+ done
280
+ @echo "📋 Step 3: Applying tools with environment substitution..."
281
+ @for tool_file in tools/*.yaml; do \
282
+ if [ -f "$$tool_file" ]; then \
283
+ echo "Applying $$tool_file..."; \
284
+ envsubst < "$$tool_file" | $(KUBECTL) apply -f - --namespace=$(NAMESPACE); \
285
+ fi; \
286
+ done
287
+ @echo "📋 Step 4: Applying agents..."
288
+ @for agent_file in agents/*.yaml; do \
289
+ if [ -f "$$agent_file" ]; then \
290
+ echo "Applying $$agent_file..."; \
291
+ $(KUBECTL) apply -f "$$agent_file" --namespace=$(NAMESPACE); \
292
+ fi; \
293
+ done
294
+ @echo "📋 Step 5: Applying teams..."
295
+ @for team_file in teams/*.yaml; do \
296
+ if [ -f "$$team_file" ]; then \
297
+ echo "Applying $$team_file..."; \
298
+ $(KUBECTL) apply -f "$$team_file" --namespace=$(NAMESPACE); \
299
+ fi; \
300
+ done
301
+ @echo "📋 Step 6: Applying queries..."
302
+ @for query_file in queries/*.yaml; do \
303
+ if [ -f "$$query_file" ]; then \
304
+ echo "Applying $$query_file..."; \
305
+ $(KUBECTL) apply -f "$$query_file" --namespace=$(NAMESPACE); \
306
+ fi; \
307
+ done
308
+ @echo "✅ All custom resources applied successfully in dependency order."
309
+
310
+ .PHONY: logs
311
+ logs: ## Show logs from deployed components
312
+ @echo "Showing logs..."
313
+ @$(KUBECTL) logs -l project=$(PROJECT_NAME) -n $(NAMESPACE) --tail=100 -f
314
+
315
+ .PHONY: shell
316
+ shell: ## Open shell in a tool pod
317
+ @echo "Opening shell in tool pod..."
318
+ @$(KUBECTL) exec -it -n $(NAMESPACE) $$($(KUBECTL) get pods -l project=$(PROJECT_NAME) -n $(NAMESPACE) -o jsonpath='{.items[0].metadata.name}') -- /bin/bash
319
+
320
+ .PHONY: port-forward
321
+ port-forward: ## Forward ports for local development
322
+ @echo "Setting up port forwarding..."
323
+ @$(KUBECTL) port-forward -n $(NAMESPACE) svc/$(PROJECT_NAME)-tools 8000:8000 &
324
+ @echo "Tools available at http://localhost:8000"
325
+
326
+ # Documentation
327
+ .PHONY: docs
328
+ docs: ## Generate documentation
329
+ @echo "Generating documentation..."
330
+ @if [ -f scripts/generate-docs.sh ]; then ./scripts/generate-docs.sh; fi
331
+
332
+ .PHONY: examples
333
+ examples: ## Deploy example configurations
334
+ @echo "Deploying examples..."
335
+ @find agents teams queries models -name "*.yaml" -exec $(KUBECTL) apply -f {} \;
336
+
337
+ # Monitoring and debugging
338
+ .PHONY: debug
339
+ debug: ## Show debugging information
340
+ @echo "=== Debugging Information ==="
341
+ @echo "Project: $(PROJECT_NAME)"
342
+ @echo "Namespace: $(NAMESPACE)"
343
+ @echo "Chart Version: $(CHART_VERSION)"
344
+ @echo "Image Tag: $(IMAGE_TAG)"
345
+ @echo ""
346
+ @echo "=== Kubernetes Resources ==="
347
+ @$(KUBECTL) get agents,teams,queries,models,mcpservers -n $(NAMESPACE) || true
348
+ @echo ""
349
+ @echo "=== Recent Events ==="
350
+ @$(KUBECTL) get events -n $(NAMESPACE) --sort-by='.lastTimestamp' | tail -10 || true
351
+
352
+ .PHONY: validate
353
+ validate: ## Validate all configurations
354
+ @echo "Validating configurations..."
355
+ @$(HELM) lint $(CHART_DIR)
356
+ @find agents teams queries models -name "*.yaml" -exec $(KUBECTL) apply --dry-run=server -f {} \;
357
+
358
+ # Include custom makefiles if they exist
359
+ -include Makefile.local
360
+ -include scripts/Makefile.custom