kelos-dev / kelos-dev/kelos

CLI UX: 'axon run' should validate that --prompt is not empty

Open Beginner friendly
#199 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

generated-by-kelos good first issue kelos/needs-input kind/feature needs-actor priority/important-longterm triage-accepted
Dominant language
Go
Stars
331
Forks
40
Avg merge
1d 21h
Merged PRs (30d)
70

Description

Problem

The `axon run` command accepts an empty string for the required `--prompt` flag, creating invalid Tasks that will fail at the API level.

Current Behavior
# Empty prompt is accepted
axon run -p "" --secret dummy --dry-run
# Output:
apiVersion: axon.io/v1alpha1
kind: Task
metadata:
  name: task-twq97
spec:
  prompt: ""  # Empty!
  ...

If submitted to the cluster (without `--dry-run`), this would fail at the Kubernetes API validation level, but only after:

  1. The task resource is attempted to be created
  2. Network round-trip to the API server
  3. API-level validation runs
Why This is a Problem
  1. Late failure: Error happens at API submission, not immediately
  2. Poor error location: Users don't get helpful context about which CLI flag is the problem
  3. Wasted resources: Unnecessary API call for an obvious client-side issue
  4. Incomplete client validation: The CLI marks `--prompt` as required (`cmd.MarkFlagRequired("prompt")`) but doesn't validate it's non-empty
Expected Behavior

The CLI should validate that the prompt is not empty or whitespace-only:

axon run -p "" --secret dummy
Error: --prompt cannot be empty

axon run -p "   " --secret dummy
Error: --prompt cannot be empty or contain only whitespace
Impact
  • Delayed error feedback: Users don't discover the issue until API submission
  • Less helpful errors: API errors are less specific than CLI validation errors
  • Inconsistent UX: Other validations happen client-side, but this one doesn't
Suggested Fix

Add validation in the `RunE` function after flag parsing:

prompt = strings.TrimSpace(prompt)
if prompt == "" {
    return fmt.Errorf("--prompt cannot be empty")
}

This should happen early, before any resource creation logic.

Additional Context
  • The prompt field is marked as required in the API: `+kubebuilder:validation:Required`
  • Found during developer experience testing
  • Empty validation is a common CLI pattern (e.g., git commit requires non-empty messages)
  • Related to #182 (client-side validation patterns)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the axon run command's RunE function, after flag parsing and before resource creation logic. Review the existing client-side validation patterns, then run the relevant CLI tests or reproduce the empty and whitespace-only examples. Done means both inputs fail immediately with a helpful --prompt error before any API request or resource creation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.