kubeagent-cli 1.0.0__tar.gz
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.
- kubeagent_cli-1.0.0/.dockerignore +17 -0
- kubeagent_cli-1.0.0/.github/workflows/ci.yml +32 -0
- kubeagent_cli-1.0.0/.github/workflows/release.yml +169 -0
- kubeagent_cli-1.0.0/.gitignore +35 -0
- kubeagent_cli-1.0.0/.pre-commit-config.yaml +16 -0
- kubeagent_cli-1.0.0/AGENTS.md +224 -0
- kubeagent_cli-1.0.0/Dockerfile +27 -0
- kubeagent_cli-1.0.0/LICENSE +21 -0
- kubeagent_cli-1.0.0/PKG-INFO +114 -0
- kubeagent_cli-1.0.0/README.md +83 -0
- kubeagent_cli-1.0.0/docs/plans/00-master-plan.md +86 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-01_project-scaffold.md +168 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-02_cluster-context.md +55 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-03_k8s-executor-read-tools.md +61 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-04_k8s-write-tools-kubectl.md +59 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-05_llm-integration-agent-core.md +59 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-06_interactive-cli.md +61 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-07_prompt-engine-policy.md +66 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-08_memory-system.md +77 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-09_subagent-model-router.md +73 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-10_skill-hook-headless.md +77 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-11_plugin-system.md +66 -0
- kubeagent_cli-1.0.0/docs/plans/Phase-12_mcp-server-ecosystem.md +77 -0
- kubeagent_cli-1.0.0/docs/specs/2026-04-09-kubeagent-design.md +620 -0
- kubeagent_cli-1.0.0/docs/superpowers/plans/2026-04-10-memory-system.md +1414 -0
- kubeagent_cli-1.0.0/docs/superpowers/specs/2026-04-10-memory-system-design.md +218 -0
- kubeagent_cli-1.0.0/docs/superpowers/specs/2026-04-13-distribution-design.md +133 -0
- kubeagent_cli-1.0.0/homebrew/kubeagent.rb +19 -0
- kubeagent_cli-1.0.0/justfile +42 -0
- kubeagent_cli-1.0.0/pyproject.toml +64 -0
- kubeagent_cli-1.0.0/src/kubeagent/__init__.py +4 -0
- kubeagent_cli-1.0.0/src/kubeagent/__main__.py +6 -0
- kubeagent_cli-1.0.0/src/kubeagent/agent/__init__.py +0 -0
- kubeagent_cli-1.0.0/src/kubeagent/agent/agent.py +615 -0
- kubeagent_cli-1.0.0/src/kubeagent/agent/deps.py +17 -0
- kubeagent_cli-1.0.0/src/kubeagent/agent/memory.py +171 -0
- kubeagent_cli-1.0.0/src/kubeagent/agent/model.py +83 -0
- kubeagent_cli-1.0.0/src/kubeagent/agent/policy.py +212 -0
- kubeagent_cli-1.0.0/src/kubeagent/agent/prompt_engine.py +133 -0
- kubeagent_cli-1.0.0/src/kubeagent/agent/prompts.py +22 -0
- kubeagent_cli-1.0.0/src/kubeagent/agent/subagent.py +359 -0
- kubeagent_cli-1.0.0/src/kubeagent/cli/__init__.py +0 -0
- kubeagent_cli-1.0.0/src/kubeagent/cli/headless.py +122 -0
- kubeagent_cli-1.0.0/src/kubeagent/cli/main.py +176 -0
- kubeagent_cli-1.0.0/src/kubeagent/cli/output.py +151 -0
- kubeagent_cli-1.0.0/src/kubeagent/cli/repl.py +295 -0
- kubeagent_cli-1.0.0/src/kubeagent/cli/setup_wizard.py +243 -0
- kubeagent_cli-1.0.0/src/kubeagent/config/__init__.py +0 -0
- kubeagent_cli-1.0.0/src/kubeagent/config/settings.py +110 -0
- kubeagent_cli-1.0.0/src/kubeagent/hooks/__init__.py +5 -0
- kubeagent_cli-1.0.0/src/kubeagent/hooks/engine.py +224 -0
- kubeagent_cli-1.0.0/src/kubeagent/infra/__init__.py +0 -0
- kubeagent_cli-1.0.0/src/kubeagent/infra/cluster.py +175 -0
- kubeagent_cli-1.0.0/src/kubeagent/infra/executor.py +726 -0
- kubeagent_cli-1.0.0/src/kubeagent/infra/kubectl.py +152 -0
- kubeagent_cli-1.0.0/src/kubeagent/infra/model_router.py +312 -0
- kubeagent_cli-1.0.0/src/kubeagent/infra/storage.py +78 -0
- kubeagent_cli-1.0.0/src/kubeagent/mcp/__init__.py +5 -0
- kubeagent_cli-1.0.0/src/kubeagent/mcp/cli.py +115 -0
- kubeagent_cli-1.0.0/src/kubeagent/mcp/ecosystem/__init__.py +1 -0
- kubeagent_cli-1.0.0/src/kubeagent/mcp/ecosystem/argocd.py +143 -0
- kubeagent_cli-1.0.0/src/kubeagent/mcp/ecosystem/grafana.py +132 -0
- kubeagent_cli-1.0.0/src/kubeagent/mcp/ecosystem/helm.py +207 -0
- kubeagent_cli-1.0.0/src/kubeagent/mcp/ecosystem/istio.py +94 -0
- kubeagent_cli-1.0.0/src/kubeagent/mcp/ecosystem/prometheus.py +137 -0
- kubeagent_cli-1.0.0/src/kubeagent/mcp/server.py +192 -0
- kubeagent_cli-1.0.0/src/kubeagent/plugins/__init__.py +10 -0
- kubeagent_cli-1.0.0/src/kubeagent/plugins/cli.py +243 -0
- kubeagent_cli-1.0.0/src/kubeagent/plugins/interface.py +101 -0
- kubeagent_cli-1.0.0/src/kubeagent/plugins/manager.py +208 -0
- kubeagent_cli-1.0.0/src/kubeagent/plugins/sandbox.py +107 -0
- kubeagent_cli-1.0.0/src/kubeagent/plugins/user_tools.py +164 -0
- kubeagent_cli-1.0.0/src/kubeagent/skills/__init__.py +6 -0
- kubeagent_cli-1.0.0/src/kubeagent/skills/base.py +47 -0
- kubeagent_cli-1.0.0/src/kubeagent/skills/builtin/__init__.py +8 -0
- kubeagent_cli-1.0.0/src/kubeagent/skills/builtin/deploy.py +86 -0
- kubeagent_cli-1.0.0/src/kubeagent/skills/builtin/diagnose.py +45 -0
- kubeagent_cli-1.0.0/src/kubeagent/skills/builtin/rollback.py +61 -0
- kubeagent_cli-1.0.0/src/kubeagent/skills/builtin/security_audit.py +46 -0
- kubeagent_cli-1.0.0/src/kubeagent/skills/loader.py +92 -0
- kubeagent_cli-1.0.0/src/kubeagent/skills/registry.py +66 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/__init__.py +0 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/base.py +31 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/__init__.py +0 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/apply.py +23 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/configmaps.py +16 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/delete.py +24 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/describe.py +23 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/events.py +32 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/kubectl.py +76 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/logs.py +33 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/namespaces.py +16 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/nodes.py +27 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/nodes_ops.py +40 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/pods.py +33 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/restart.py +22 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/scale.py +27 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/builtin/services.py +27 -0
- kubeagent_cli-1.0.0/src/kubeagent/tools/registry.py +100 -0
- kubeagent_cli-1.0.0/tests/__init__.py +0 -0
- kubeagent_cli-1.0.0/tests/unit/__init__.py +0 -0
- kubeagent_cli-1.0.0/tests/unit/test_cli.py +58 -0
- kubeagent_cli-1.0.0/tests/unit/test_cluster.py +40 -0
- kubeagent_cli-1.0.0/tests/unit/test_executor.py +135 -0
- kubeagent_cli-1.0.0/tests/unit/test_phase04.py +334 -0
- kubeagent_cli-1.0.0/tests/unit/test_phase05.py +186 -0
- kubeagent_cli-1.0.0/tests/unit/test_phase06.py +179 -0
- kubeagent_cli-1.0.0/tests/unit/test_phase07.py +323 -0
- kubeagent_cli-1.0.0/tests/unit/test_phase08.py +451 -0
- kubeagent_cli-1.0.0/tests/unit/test_phase09.py +327 -0
- kubeagent_cli-1.0.0/tests/unit/test_phase10.py +281 -0
- kubeagent_cli-1.0.0/tests/unit/test_phase11.py +261 -0
- kubeagent_cli-1.0.0/tests/unit/test_phase12.py +425 -0
- kubeagent_cli-1.0.0/tests/unit/test_tools.py +329 -0
- kubeagent_cli-1.0.0/uv.lock +3370 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.12"
|
|
17
|
+
- run: pip install ruff
|
|
18
|
+
- run: ruff check src/ tests/
|
|
19
|
+
- run: ruff format --check src/ tests/
|
|
20
|
+
|
|
21
|
+
test:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
strategy:
|
|
24
|
+
matrix:
|
|
25
|
+
python-version: ["3.12", "3.13"]
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
- uses: actions/setup-python@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: ${{ matrix.python-version }}
|
|
31
|
+
- run: pip install -e ".[dev]"
|
|
32
|
+
- run: pytest tests/ -v --tb=short
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
packages: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
- run: pip install -e ".[dev]"
|
|
20
|
+
- run: pytest tests/ -v --tb=short
|
|
21
|
+
|
|
22
|
+
publish-pypi:
|
|
23
|
+
needs: test
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.12"
|
|
30
|
+
- run: pip install build
|
|
31
|
+
- run: python -m build
|
|
32
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
33
|
+
with:
|
|
34
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
35
|
+
|
|
36
|
+
publish-docker:
|
|
37
|
+
needs: test
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
|
|
42
|
+
- name: Extract version from tag
|
|
43
|
+
id: version
|
|
44
|
+
run: |
|
|
45
|
+
VERSION=${GITHUB_REF_NAME#v}
|
|
46
|
+
MAJOR=$(echo $VERSION | cut -d. -f1)
|
|
47
|
+
MINOR=$(echo $VERSION | cut -d. -f1-2)
|
|
48
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
49
|
+
echo "major=$MAJOR" >> $GITHUB_OUTPUT
|
|
50
|
+
echo "minor=$MINOR" >> $GITHUB_OUTPUT
|
|
51
|
+
|
|
52
|
+
- uses: docker/setup-buildx-action@v3
|
|
53
|
+
|
|
54
|
+
- name: Login to GHCR
|
|
55
|
+
uses: docker/login-action@v3
|
|
56
|
+
with:
|
|
57
|
+
registry: ghcr.io
|
|
58
|
+
username: ${{ github.actor }}
|
|
59
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
60
|
+
|
|
61
|
+
- name: Login to Docker Hub
|
|
62
|
+
uses: docker/login-action@v3
|
|
63
|
+
with:
|
|
64
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
65
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
66
|
+
|
|
67
|
+
- name: Build and push
|
|
68
|
+
uses: docker/build-push-action@v6
|
|
69
|
+
with:
|
|
70
|
+
context: .
|
|
71
|
+
push: true
|
|
72
|
+
platforms: linux/amd64,linux/arm64
|
|
73
|
+
tags: |
|
|
74
|
+
ghcr.io/ghostwritten/kubeagent:latest
|
|
75
|
+
ghcr.io/ghostwritten/kubeagent:${{ steps.version.outputs.version }}
|
|
76
|
+
ghcr.io/ghostwritten/kubeagent:${{ steps.version.outputs.minor }}
|
|
77
|
+
ghcr.io/ghostwritten/kubeagent:${{ steps.version.outputs.major }}
|
|
78
|
+
ghostwritten/kubeagent:latest
|
|
79
|
+
ghostwritten/kubeagent:${{ steps.version.outputs.version }}
|
|
80
|
+
ghostwritten/kubeagent:${{ steps.version.outputs.minor }}
|
|
81
|
+
ghostwritten/kubeagent:${{ steps.version.outputs.major }}
|
|
82
|
+
|
|
83
|
+
github-release:
|
|
84
|
+
needs: test
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
steps:
|
|
87
|
+
- uses: actions/checkout@v4
|
|
88
|
+
with:
|
|
89
|
+
fetch-depth: 0
|
|
90
|
+
- uses: actions/setup-python@v5
|
|
91
|
+
with:
|
|
92
|
+
python-version: "3.12"
|
|
93
|
+
- run: pip install build
|
|
94
|
+
- run: python -m build
|
|
95
|
+
|
|
96
|
+
- name: Generate changelog
|
|
97
|
+
id: changelog
|
|
98
|
+
run: |
|
|
99
|
+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
|
100
|
+
if [ -n "$PREV_TAG" ]; then
|
|
101
|
+
CHANGES=$(git log ${PREV_TAG}..HEAD --pretty=format:"- %s" --no-merges)
|
|
102
|
+
else
|
|
103
|
+
CHANGES=$(git log --pretty=format:"- %s" --no-merges -20)
|
|
104
|
+
fi
|
|
105
|
+
echo "changes<<EOF" >> $GITHUB_OUTPUT
|
|
106
|
+
echo "$CHANGES" >> $GITHUB_OUTPUT
|
|
107
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
108
|
+
|
|
109
|
+
- uses: softprops/action-gh-release@v2
|
|
110
|
+
with:
|
|
111
|
+
generate_release_notes: true
|
|
112
|
+
body: |
|
|
113
|
+
## What's Changed
|
|
114
|
+
${{ steps.changelog.outputs.changes }}
|
|
115
|
+
|
|
116
|
+
## Installation
|
|
117
|
+
```bash
|
|
118
|
+
pip install kubeagent-cli==${{ github.ref_name }}
|
|
119
|
+
# or
|
|
120
|
+
docker pull ghcr.io/ghostwritten/kubeagent:${{ github.ref_name }}
|
|
121
|
+
```
|
|
122
|
+
files: dist/*
|
|
123
|
+
|
|
124
|
+
update-homebrew:
|
|
125
|
+
needs: publish-pypi
|
|
126
|
+
runs-on: ubuntu-latest
|
|
127
|
+
steps:
|
|
128
|
+
- uses: actions/checkout@v4
|
|
129
|
+
|
|
130
|
+
- name: Extract version
|
|
131
|
+
id: version
|
|
132
|
+
run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
|
|
133
|
+
|
|
134
|
+
- name: Wait for PyPI availability
|
|
135
|
+
run: |
|
|
136
|
+
for i in $(seq 1 30); do
|
|
137
|
+
if pip index versions kubeagent-cli 2>/dev/null | grep -q "${{ steps.version.outputs.version }}"; then
|
|
138
|
+
echo "Version available on PyPI"
|
|
139
|
+
exit 0
|
|
140
|
+
fi
|
|
141
|
+
echo "Waiting for PyPI... ($i/30)"
|
|
142
|
+
sleep 10
|
|
143
|
+
done
|
|
144
|
+
echo "Warning: PyPI version not yet available, proceeding anyway"
|
|
145
|
+
|
|
146
|
+
- name: Download sdist and compute sha256
|
|
147
|
+
id: sha
|
|
148
|
+
run: |
|
|
149
|
+
pip download kubeagent-cli==${{ steps.version.outputs.version }} --no-binary :all: --no-deps -d /tmp/dist || true
|
|
150
|
+
SDIST=$(ls /tmp/dist/kubeagent_cli-*.tar.gz 2>/dev/null | head -1)
|
|
151
|
+
if [ -n "$SDIST" ]; then
|
|
152
|
+
SHA=$(sha256sum "$SDIST" | cut -d' ' -f1)
|
|
153
|
+
else
|
|
154
|
+
SHA="PLACEHOLDER_SHA256"
|
|
155
|
+
fi
|
|
156
|
+
echo "sha256=$SHA" >> $GITHUB_OUTPUT
|
|
157
|
+
|
|
158
|
+
- name: Update Homebrew tap
|
|
159
|
+
uses: peter-evans/repository-dispatch@v3
|
|
160
|
+
with:
|
|
161
|
+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
|
162
|
+
repository: Ghostwritten/homebrew-tap
|
|
163
|
+
event-type: update-formula
|
|
164
|
+
client-payload: |
|
|
165
|
+
{
|
|
166
|
+
"formula": "kubeagent",
|
|
167
|
+
"version": "${{ steps.version.outputs.version }}",
|
|
168
|
+
"sha256": "${{ steps.sha.outputs.sha256 }}"
|
|
169
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
*.egg
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
ENV/
|
|
16
|
+
|
|
17
|
+
# IDE
|
|
18
|
+
.idea/
|
|
19
|
+
.vscode/
|
|
20
|
+
*.swp
|
|
21
|
+
|
|
22
|
+
# OS
|
|
23
|
+
.DS_Store
|
|
24
|
+
Thumbs.db
|
|
25
|
+
|
|
26
|
+
# Testing
|
|
27
|
+
.pytest_cache/
|
|
28
|
+
.coverage
|
|
29
|
+
htmlcov/
|
|
30
|
+
|
|
31
|
+
# Superpowers
|
|
32
|
+
.superpowers/
|
|
33
|
+
|
|
34
|
+
# Worktrees
|
|
35
|
+
.worktrees/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.9.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: ruff
|
|
6
|
+
args: [--fix]
|
|
7
|
+
- id: ruff-format
|
|
8
|
+
|
|
9
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
10
|
+
rev: v5.0.0
|
|
11
|
+
hooks:
|
|
12
|
+
- id: trailing-whitespace
|
|
13
|
+
- id: end-of-file-fixer
|
|
14
|
+
- id: check-yaml
|
|
15
|
+
- id: check-added-large-files
|
|
16
|
+
args: ['--maxkb=500']
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# KubeAgent — AGENTS.md
|
|
2
|
+
|
|
3
|
+
> This document defines the identity, capabilities, behavior rules, and constraints for the KubeAgent project.
|
|
4
|
+
> It serves as the foundational context for all development and contribution activities.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Project Identity
|
|
9
|
+
|
|
10
|
+
**Name**: KubeAgent
|
|
11
|
+
**Type**: Open-source CLI intelligent agent
|
|
12
|
+
**Purpose**: Manage Kubernetes clusters through natural language conversation
|
|
13
|
+
**Repository**: github.com/user/kubeagent
|
|
14
|
+
**License**: MIT
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Core Architecture
|
|
19
|
+
|
|
20
|
+
KubeAgent is built on a **four-layer architecture**:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Interface Layer → Agent Layer → Capability Layer → Infrastructure Layer
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
| Layer | Components |
|
|
27
|
+
|-------|-----------|
|
|
28
|
+
| **Interface** | CLI REPL, Headless mode, Shell passthrough (`!`), Skill dispatch (`/`), Prompt Engine |
|
|
29
|
+
| **Agent** | Main Agent (Pydantic AI), SubAgent Dispatcher, Memory Manager, Hook Engine, Policy Engine |
|
|
30
|
+
| **Capability** | Tool Registry, Skill Registry — Built-in / User-defined / Plugin tools |
|
|
31
|
+
| **Infrastructure** | Model Router (LiteLLM), Cluster Context, K8s Executor (Python Client + kubectl), Storage (SQLite) |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Technology Stack
|
|
36
|
+
|
|
37
|
+
| Component | Technology |
|
|
38
|
+
|-----------|-----------|
|
|
39
|
+
| Language | Python 3.11+ |
|
|
40
|
+
| Agent Framework | Pydantic AI |
|
|
41
|
+
| Model Interface | LiteLLM (100+ models: Ollama / Claude / GPT / Gemini) |
|
|
42
|
+
| K8s SDK | kubernetes (official Python client) |
|
|
43
|
+
| K8s CLI | kubectl (subprocess, supplementary) |
|
|
44
|
+
| CLI UI | Rich + prompt_toolkit |
|
|
45
|
+
| Config | Pydantic + YAML |
|
|
46
|
+
| Storage | SQLite + local files |
|
|
47
|
+
| Packaging | pip / pipx |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Design Principles
|
|
52
|
+
|
|
53
|
+
1. **Natural Language First** — Conversation-driven interaction, like Claude Code
|
|
54
|
+
2. **Professional Output** — Rich tables for data, Markdown for analysis, mixed rendering
|
|
55
|
+
3. **Safety by Design** — Three-tier operation classification, RBAC, dry-run, confirmation flows
|
|
56
|
+
4. **Model Agnostic** — Local (Ollama) and cloud (Claude/GPT/Gemini) with intelligent routing
|
|
57
|
+
5. **Open & Extensible** — Plugin system, community Skills, user-defined Tools
|
|
58
|
+
6. **Incremental Delivery** — 12 lightweight phases, each producing a usable increment
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
| Method | Command | Note |
|
|
65
|
+
|--------|---------|------|
|
|
66
|
+
| **pipx (recommended)** | `pipx install kubeagent` | Isolated environment, no system pollution |
|
|
67
|
+
| **pip** | `pip install kubeagent` | Traditional |
|
|
68
|
+
| **Homebrew** | `brew install kubeagent` | macOS (later phase) |
|
|
69
|
+
|
|
70
|
+
## First-Run Experience
|
|
71
|
+
|
|
72
|
+
**Hybrid mode: auto-detect + guided setup (like Claude Code)**
|
|
73
|
+
|
|
74
|
+
- **Auto-trigger**: First run detects environment, guides only missing items
|
|
75
|
+
- **`kubeagent init`**: Full re-configuration
|
|
76
|
+
- **`kubeagent doctor`**: Diagnose + fix issues
|
|
77
|
+
|
|
78
|
+
**Pre-flight check on every run:**
|
|
79
|
+
- Detect `~/.kube/config` and current context
|
|
80
|
+
- Detect API keys via env vars (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `KUBEAGENT_API_KEY`)
|
|
81
|
+
- Detect `~/.kubeagent/config.yaml`
|
|
82
|
+
|
|
83
|
+
**Configuration storage:**
|
|
84
|
+
- Path: `~/.kubeagent/`
|
|
85
|
+
- Config: `~/.kubeagent/config.yaml`
|
|
86
|
+
- Env var overrides: `KUBEAGENT_API_KEY`, `KUBEAGENT_MODEL_ENDPOINT`, `KUBEAGENT_MODEL`
|
|
87
|
+
|
|
88
|
+
## Interaction Model
|
|
89
|
+
|
|
90
|
+
- **Primary**: Conversational dialogue (natural language)
|
|
91
|
+
- **Shell passthrough**: `!command` executes shell commands directly
|
|
92
|
+
- **Skill invocation**: `/skill-name` triggers predefined workflows (e.g., `/diagnose`, `/deploy`)
|
|
93
|
+
- **Headless**: `kubeagent --headless "query"` for CI/CD and scripting
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Component Overview
|
|
98
|
+
|
|
99
|
+
### Prompt Engine
|
|
100
|
+
Composes system prompts from: base template + KUBEAGENT.md rules + cluster context + user preferences.
|
|
101
|
+
Priority: KUBEAGENT.md > config.yaml > defaults.
|
|
102
|
+
|
|
103
|
+
### Main Agent
|
|
104
|
+
Central reasoning engine using Pydantic AI. Workflow: intent recognition → memory query → policy check → task planning → tool selection → result synthesis.
|
|
105
|
+
|
|
106
|
+
### SubAgent System
|
|
107
|
+
Dynamic creation at runtime. Independent tool sets and model selection. Parallel execution via asyncio. Ephemeral lifecycle.
|
|
108
|
+
|
|
109
|
+
### Tool System
|
|
110
|
+
- **Built-in**: get_pods, describe_resource, read_logs, apply_yaml, delete_resource, scale, exec, etc.
|
|
111
|
+
- **User-defined**: custom scripts, kubectl plugins
|
|
112
|
+
- **Plugin**: Helm, Istio, ArgoCD ecosystem tools
|
|
113
|
+
- Each tool declares security level: `safe` / `sensitive` / `dangerous`
|
|
114
|
+
|
|
115
|
+
### Skill System
|
|
116
|
+
Reusable workflows: `/diagnose`, `/deploy`, `/rollback`, `/security-audit`, `/migrate`, etc.
|
|
117
|
+
Markdown-based definitions, community-contributable.
|
|
118
|
+
|
|
119
|
+
### Hook Engine
|
|
120
|
+
Event-driven automation: `pre-apply`, `post-deploy`, `on-error`, `on-connect`, etc.
|
|
121
|
+
Can abort operations on failure.
|
|
122
|
+
|
|
123
|
+
### Memory Manager
|
|
124
|
+
Five types: session context, user preferences, cluster profiles, fault knowledge, audit log.
|
|
125
|
+
SQLite storage with expiration and privacy controls.
|
|
126
|
+
|
|
127
|
+
### Policy Engine
|
|
128
|
+
- Three-tier: safe (immediate) → sensitive (confirm) → dangerous (double-confirm + warning)
|
|
129
|
+
- RBAC: admin / operator / viewer
|
|
130
|
+
- Whitelist/blacklist per operation and resource
|
|
131
|
+
- Dry-run mode for all mutations
|
|
132
|
+
|
|
133
|
+
### Model Router
|
|
134
|
+
Four strategies (user-selectable): complexity-based, cost-based, availability-fallback, manual.
|
|
135
|
+
SubAgents can use lighter models than Main Agent.
|
|
136
|
+
|
|
137
|
+
### K8s Executor
|
|
138
|
+
Unified interface: Python Client (primary) + kubectl (supplementary).
|
|
139
|
+
Auto-detect kubectl, graceful degradation if absent.
|
|
140
|
+
All outputs normalized to structured data models.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Security Rules
|
|
145
|
+
|
|
146
|
+
1. **Operation classification**: Every K8s operation is tagged safe/sensitive/dangerous
|
|
147
|
+
2. **Confirmation flow**: Sensitive → "Proceed? [y/N]", Dangerous → type resource name to confirm
|
|
148
|
+
3. **Dry-run**: `--dry-run` shows preview without executing any mutations
|
|
149
|
+
4. **No secret storage**: Memory system never stores K8s secrets, tokens, or credentials
|
|
150
|
+
5. **Injection prevention**: kubectl calls use argument lists, never shell string interpolation
|
|
151
|
+
6. **Audit trail**: All mutating operations logged with timestamp, user, cluster, resource, result
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Model Configuration
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
model:
|
|
159
|
+
default: claude-sonnet-4-20250514
|
|
160
|
+
fallback: [gpt-4o, ollama/qwen2.5]
|
|
161
|
+
strategy: complexity # complexity | cost | availability | manual
|
|
162
|
+
subagent_model: claude-haiku-4-5-20251001
|
|
163
|
+
cost:
|
|
164
|
+
monthly_budget: 50
|
|
165
|
+
currency: USD
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Configuration Hierarchy
|
|
171
|
+
|
|
172
|
+
| File | Purpose | Format |
|
|
173
|
+
|------|---------|--------|
|
|
174
|
+
| `KUBEAGENT.md` | Project-level behavioral rules | Natural language (Markdown) |
|
|
175
|
+
| `~/.kubeagent/config.yaml` | Global technical settings | Structured YAML |
|
|
176
|
+
| `~/.kubeagent/hooks.yaml` | Hook definitions | Structured YAML |
|
|
177
|
+
|
|
178
|
+
**Priority**: KUBEAGENT.md > config.yaml > defaults
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Implementation Roadmap
|
|
183
|
+
|
|
184
|
+
12 phases with three milestones:
|
|
185
|
+
|
|
186
|
+
| Milestone | After Phase | Status |
|
|
187
|
+
|-----------|-------------|--------|
|
|
188
|
+
| **MVP Alpha** | Phase 07 — Prompt Engine + Policy | `pending` |
|
|
189
|
+
| **MVP Beta** | Phase 10 — Skill + Hook + Headless | `pending` |
|
|
190
|
+
| **v1.0 小满贯** | Phase 12 — MCP Server + Ecosystem | `pending` |
|
|
191
|
+
|
|
192
|
+
**Full plan**: `docs/plans/00-master-plan.md`
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## File Structure
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
kubeagent/
|
|
200
|
+
├── src/kubeagent/
|
|
201
|
+
│ ├── cli/ # Interface Layer
|
|
202
|
+
│ ├── agent/ # Agent Layer
|
|
203
|
+
│ ├── tools/ # Capability Layer (builtin/, kubectl.py)
|
|
204
|
+
│ ├── infra/ # Infrastructure Layer
|
|
205
|
+
│ └── config/ # Configuration
|
|
206
|
+
├── skills/ # Built-in skills
|
|
207
|
+
├── plugins/ # Plugin directory
|
|
208
|
+
├── tests/ # unit/, integration/, fixtures/
|
|
209
|
+
└── docs/
|
|
210
|
+
├── specs/ # Architecture design (WHY & WHAT)
|
|
211
|
+
├── plans/ # Phase plans (HOW & WHEN)
|
|
212
|
+
└── decisions/ # Architecture Decision Records
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Key Documentation
|
|
218
|
+
|
|
219
|
+
| Document | Purpose |
|
|
220
|
+
|----------|---------|
|
|
221
|
+
| `docs/specs/2026-04-09-kubeagent-design.md` | Architecture design: WHY and WHAT |
|
|
222
|
+
| `docs/plans/00-master-plan.md` | Roadmap: phase overview, dependency graph, execution rules |
|
|
223
|
+
| `docs/plans/Phase-XX_*.md` | Phase details: tasks, acceptance criteria, status |
|
|
224
|
+
| `docs/decisions/` | ADR: architecture decisions and rationale |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Stage 1: Builder
|
|
2
|
+
FROM python:3.12-slim AS builder
|
|
3
|
+
|
|
4
|
+
WORKDIR /build
|
|
5
|
+
|
|
6
|
+
COPY pyproject.toml README.md ./
|
|
7
|
+
COPY src/ src/
|
|
8
|
+
|
|
9
|
+
RUN pip install --no-cache-dir build \
|
|
10
|
+
&& python -m build --wheel \
|
|
11
|
+
&& pip install --no-cache-dir --prefix=/install dist/*.whl
|
|
12
|
+
|
|
13
|
+
# Stage 2: Runtime
|
|
14
|
+
FROM python:3.12-slim
|
|
15
|
+
|
|
16
|
+
LABEL org.opencontainers.image.source="https://github.com/Ghostwritten/kubeagent"
|
|
17
|
+
LABEL org.opencontainers.image.description="Natural language CLI for Kubernetes cluster management"
|
|
18
|
+
LABEL org.opencontainers.image.licenses="MIT"
|
|
19
|
+
|
|
20
|
+
COPY --from=builder /install /usr/local
|
|
21
|
+
|
|
22
|
+
# Create non-root user
|
|
23
|
+
RUN useradd --create-home kubeagent
|
|
24
|
+
USER kubeagent
|
|
25
|
+
WORKDIR /home/kubeagent
|
|
26
|
+
|
|
27
|
+
ENTRYPOINT ["kubeagent"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 KubeAgent Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kubeagent-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A natural language CLI agent for Kubernetes cluster management
|
|
5
|
+
Author: KubeAgent Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: agent,ai,cli,k8s,kubernetes
|
|
9
|
+
Classifier: Development Status :: 1 - Planning
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Intended Audience :: System Administrators
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: System :: Systems Administration
|
|
16
|
+
Requires-Python: >=3.12
|
|
17
|
+
Requires-Dist: click>=8.1.0
|
|
18
|
+
Requires-Dist: kubernetes>=31.0.0
|
|
19
|
+
Requires-Dist: litellm>=1.0.0
|
|
20
|
+
Requires-Dist: pydantic-ai>=0.2.0
|
|
21
|
+
Requires-Dist: pydantic>=2.0.0
|
|
22
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
23
|
+
Requires-Dist: requests>=2.31.0
|
|
24
|
+
Requires-Dist: rich>=13.0.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pre-commit>=4.0.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.25.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff>=0.9.0; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# KubeAgent
|
|
33
|
+
|
|
34
|
+
> Natural language CLI for Kubernetes cluster management
|
|
35
|
+
|
|
36
|
+
KubeAgent is an AI-powered CLI tool that lets you manage Kubernetes clusters through natural language conversation.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
### PyPI (Recommended)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pipx install kubeagent
|
|
44
|
+
# or
|
|
45
|
+
pip install kubeagent
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Homebrew (macOS / Linux)
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
brew tap Ghostwritten/tap
|
|
52
|
+
brew install kubeagent
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Docker
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# GHCR
|
|
59
|
+
docker pull ghcr.io/ghostwritten/kubeagent:latest
|
|
60
|
+
|
|
61
|
+
# Docker Hub
|
|
62
|
+
docker pull ghostwritten/kubeagent:latest
|
|
63
|
+
|
|
64
|
+
# Run
|
|
65
|
+
docker run --rm -v ~/.kube:/home/kubeagent/.kube:ro ghcr.io/ghostwritten/kubeagent
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### GitHub Releases
|
|
69
|
+
|
|
70
|
+
Download the latest wheel or source tarball from
|
|
71
|
+
[Releases](https://github.com/Ghostwritten/kubeagent/releases).
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install kubeagent-*.whl
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Quick Start
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# First run triggers setup wizard
|
|
81
|
+
kubeagent
|
|
82
|
+
|
|
83
|
+
# Re-configure anytime
|
|
84
|
+
kubeagent init
|
|
85
|
+
|
|
86
|
+
# Diagnose issues
|
|
87
|
+
kubeagent doctor
|
|
88
|
+
|
|
89
|
+
# Start MCP server
|
|
90
|
+
kubeagent mcp start
|
|
91
|
+
|
|
92
|
+
# Check version
|
|
93
|
+
kubeagent --version
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Install with dev dependencies
|
|
100
|
+
just install
|
|
101
|
+
|
|
102
|
+
# Format, lint, test
|
|
103
|
+
just check
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Architecture
|
|
107
|
+
|
|
108
|
+
Four-layer architecture: Interface -> Agent -> Capability -> Infrastructure
|
|
109
|
+
|
|
110
|
+
See [AGENTS.md](AGENTS.md) for full specification.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
MIT
|