An open API service indexing awesome lists of open source software.

https://github.com/stuttgart-things/k2n

/ˈkæf.kən/ - ai based claim/code generation
https://github.com/stuttgart-things/k2n

ai cicd generator platform-engineering

Last synced: about 2 months ago
JSON representation

/ˈkæf.kən/ - ai based claim/code generation

Awesome Lists containing this project

README

          

# /ˈkæf.kən/ (k2n)

kaeffken, or in short k2n (/keɪ tuː ɛn/ ) is a cli for generating ai based claims or include statements. The generation is based on examples and rulesets. claims are user-facing Kubernetes custom resources (CRDs) that allow application teams (developers, workloads) to request infrastructure or services without knowing the underlying implementation details.

## FEATURES

- AI-powered code/claim generation from examples and rulesets (`gen`)
- AI-powered conversational claim rendering via claim-machinery-api (`talk`)
- Support for multiple AI providers (OpenRouter, Gemini)
- Interactive TUI menu for guided configuration
- Output to stdout, file, or directory

## DEV

LINTING

```bash
# RUN LINTING w/ DEFAULTS
task go-lint:lint-go

# FOR CONFIGURE OPTIONS
task go-lint:lint-go-interactive
```

## USAGE-EXAMPLES

### AI Provider Configuration

OPENROUTER

```bash
export AI_PROVIDER="openrouter"
export AI_MODEL="deepseek/deepseek-r1-0528:free" # pragma: allowlist secret
export AI_API_KEY="sk-or.." # pragma: allowlist secret
# AI_BASE_URL is optional (defaults to https://openrouter.ai/api/v1/chat/completions)
# export AI_BASE_URL="https://openrouter.ai/api/v1/chat/completions"
```

GEMINI

```bash
export AI_PROVIDER="gemini"
export AI_API_KEY="your-gemini-api-key" # pragma: allowlist secret
```

### Gen Command

VERBOSE OUTPUT OF THE PROMPT (w/o SENDING IT)

```bash
k2n gen \
--examples-dirs _examples/examples \
--ruleset-env-dir _examples/ruleset-env \
--ruleset-usecase-dir _examples/ruleset-runner \
--usecase crosssplane \
--instruction "give me a runner-claim for the repository dagger for the cluster sthings" \
--verbose=true \
--prompt-to-ai=false
```

PROMPT AI + OUTPUT TO STDOUT

```bash
export AI_PROVIDER="gemini"
export AI_API_KEY="your-gemini-api-key" # pragma: allowlist secret

k2n gen \
--examples-dirs _examples/examples \
--ruleset-env-dir _examples/ruleset-env \
--ruleset-usecase-dir _examples/ruleset-runner \
--usecase crosssplane \
--instruction "give me a runner-claim for the repository dagger for the cluster sthings"
```

PROMPT AI + OUTPUT TO FOLDER

```bash
k2n gen \
--examples-dirs _examples/examples \
--ruleset-env-dir _examples/ruleset-env \
--ruleset-usecase-dir _examples/ruleset-runner \
--usecase crosssplane \
--instruction "give me a runner-claim for the repository dagger for the cluster sthings. add also a proposal for a branch name and a pr title" \
--destination "/tmp/runner/" \
--verbose=true
```

### Talk Command

TALK TO CLAIM-MACHINERY-API (OPENROUTER)

```bash
export AI_PROVIDER="openrouter"
export AI_MODEL="openai/gpt-4"
export AI_API_KEY="sk-or.." # pragma: allowlist secret

k2n talk \
--api-url http://localhost:8080 \
--instruction "I need a 50Gi persistent volume in namespace production with fast-ssd storage class"
```

TALK TO CLAIM-MACHINERY-API (GEMINI)

```bash
export AI_PROVIDER="gemini"
export AI_API_KEY="your-gemini-api-key" # pragma: allowlist secret

k2n talk \
--api-url http://localhost:8080 \
--instruction "create a harbor project for team-alpha" \
--destination /tmp/claim.yaml \
--verbose
```

TALK WITH ENV VARS

```bash
export AI_PROVIDER="openrouter"
export AI_MODEL="deepseek/deepseek-r1-0528:free"
export AI_API_KEY="sk-or.." # pragma: allowlist secret
export CLAIM_API_URL="http://localhost:8080"

k2n talk --instruction "give me a vsphere vm with 4 cpus and 8gb ram"
```

## AUTHOR

```bash
Patrick Hermann, stuttgart-things 07/2025
```

## LICENSE

Licensed under the Apache License, Version 2.0 (the "License").

You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an _"AS IS"_ basis, without WARRANTIES or conditions of any kind, either express or implied.

See the License for the specific language governing permissions and limitations under the License.