Skip to content

Commit 6a8a569

Browse files
committed
add AI tags
1 parent 8324129 commit 6a8a569

3 files changed

Lines changed: 46 additions & 7 deletions

File tree

skills/aiven-kafka-setup-avn/SKILL.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: >
88
no need to specify it explicitly. This skill covers the avn CLI workflow; other skills
99
cover Terraform, MCP, and REST API approaches. Use when the user mentions Kafka —
1010
e.g. "create a Kafka cluster", "set up Kafka", "start a Kafka", or "start a Kafka service".
11-
version: "0.1"
11+
version: "0.1.1"
1212
license: Apache-2.0
1313
allowed-tools: Bash(avn:*) Bash(jq:*) Bash(curl:*) Read
1414
---
@@ -36,13 +36,22 @@ Run the following to check if the user is logged in:
3636
avn user info
3737
```
3838

39-
**If the command fails**, instruct the user:
39+
**If the command fails**, inspect the error and guide the user accordingly:
4040

4141
```
42-
You are not logged in to the Aiven CLI. Please run:
42+
If the error contains "Expired db token":
4343
44+
Your Aiven login token expired. Please run:
4445
avn user login <your-email>
4546
47+
If the error contains "ERROR: Not logged in" or "UserError: not authenticated":
48+
49+
You are not logged in to the Aiven CLI. Please run:
50+
avn user login <your-email>
51+
52+
If you are a new user, create an account via:
53+
https://console.aiven.io/login
54+
4655
Then confirm when you are logged in.
4756
```
4857

@@ -68,8 +77,9 @@ Follow **[SERVICE_CREATION_AVN.md](SERVICE_CREATION_AVN.md)** sections 1–4 in
6877

6978
1. **Choose a region** — ask the user with AskQuestion, mapping their choice to the **EXACT** `CLOUD_NAME` from the table in **[SERVICE_CREATION_AVN.md](SERVICE_CREATION_AVN.md)**.
7079
2. **Choose a plan** — default `startup-4`; **never** use `free-0` or `startup-2`.
71-
3. **Run the setup script** — a single command creates the service, users, ACLs,
72-
schema, extracts all connection details, and writes them to `env.sh`.
80+
3. **Run the setup script** — a single command creates the service, tags it with
81+
`AI-skill-generated=true`, creates users and ACLs, registers the schema,
82+
extracts all connection details, and writes them to `env.sh`.
7383
4. **Source `env.sh`** — loads `KAFKA_HOST`, `KAFKA_PORT`, `SCHEMA_REGISTRY_URL`,
7484
`AVNADMIN_PASS`, `PRODUCER_PASSWORD`, `CONSUMER_PASSWORD` into the shell.
7585

skills/aiven-kafka-setup-avn/reference.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ avn service create <SERVICE_NAME> \
4545
# Wait until service is RUNNING
4646
avn service wait <SERVICE_NAME>
4747

48+
# Tag the service for AI-generated demo environments
49+
avn service tags update <SERVICE_NAME> --add-tag AI-skill-generated=true
50+
4851
# Get service details as JSON (preferred — use jq to extract fields)
4952
avn service get <SERVICE_NAME> --json | jq '{service_uri, service_uri_params, components: [.components[] | {component, route, host, port}]}'
5053

@@ -150,7 +153,8 @@ avn service schema get <SERVICE_NAME> --subject <SUBJECT> --version latest
150153

151154
| Problem | Cause | Fix |
152155
|---------|-------|-----|
153-
| `avn user info` fails | Not logged in | Run `avn user login <email>` |
156+
| `avn user info` fails with `Expired db token` | Login token expired | Run `avn user login <email>` again |
157+
| `avn user info` fails with `ERROR: Not logged in` or `UserError: not authenticated` | Not authenticated yet | Run `avn user login <email>` or create an account via `https://console.aiven.io/login` |
154158
| Service stuck in POWERING_OFF | Ongoing operations | Wait or contact Aiven support |
155159
| `SASL authentication failed` | Wrong password or user not created | Re-run `avn service user-password-reset` and re-export env var |
156160
| `SSL: CERTIFICATE_VERIFY_FAILED` | Missing or wrong CA cert | Re-download certs: `avn service user-creds-download` |

skills/aiven-kafka-setup-avn/scripts/setup_aiven_kafka.sh

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,28 @@ KAFKA_VERSION="${4:-4.1}"
2323
TOPIC="orders"
2424

2525
echo "==> Checking avn login..."
26-
avn user info || { echo "ERROR: Not logged in. Run: avn user login <email>"; exit 1; }
26+
set +e
27+
AVN_USER_INFO_OUTPUT=$(avn user info 2>&1)
28+
AVN_USER_INFO_EXIT=$?
29+
set -e
30+
31+
if [ "$AVN_USER_INFO_EXIT" -ne 0 ]; then
32+
# Reason: `avn user info` uses different error messages for expired tokens
33+
# and users who have not authenticated yet, so surface the right next step.
34+
case "$AVN_USER_INFO_OUTPUT" in
35+
*"Expired db token"*)
36+
echo "ERROR: Aiven login token expired. Run: avn user login <email>" >&2
37+
;;
38+
*"ERROR: Not logged in"*|*"UserError: not authenticated"*)
39+
echo "ERROR: Not authenticated. Run: avn user login <email> or, if you are a new user, create an account via https://console.aiven.io/login" >&2
40+
;;
41+
*)
42+
printf '%s\n' "$AVN_USER_INFO_OUTPUT" >&2
43+
echo "ERROR: Failed to verify avn login. Run: avn user login <email> if needed." >&2
44+
;;
45+
esac
46+
exit 1
47+
fi
2748

2849
echo "==> Creating Kafka service: $KAFKA_SERVICE (cloud=$CLOUD_NAME, plan=$PLAN, kafka=$KAFKA_VERSION)"
2950
if ! avn service get "$KAFKA_SERVICE" >/dev/null 2>&1; then
@@ -40,6 +61,10 @@ fi
4061
echo "==> Waiting for service to be RUNNING..."
4162
avn service wait "$KAFKA_SERVICE"
4263

64+
echo "==> Tagging service..."
65+
# Reason: `avn` expects tags in `key=value` form rather than a bare label.
66+
avn service tags update "$KAFKA_SERVICE" --add-tag AI-skill-generated=true
67+
4368
echo "==> Downloading certificates..."
4469
mkdir -p cert
4570
avn service user-creds-download "$KAFKA_SERVICE" --username avnadmin -d cert/

0 commit comments

Comments
 (0)