Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Show the opening turn in `list-cases` for multi-turn cases and keep multiline
prompt previews on a single row. A simulated opening turn is labelled.
- `skill-up run --dry-run` now prints the planned case executions as cases
times configurations times iterations. A benchmark over four cases with
`--iteration 5` previously reported only `Would run 4 case(s)` for 40
Expand Down
15 changes: 15 additions & 0 deletions internal/cli/command_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,21 @@ func TestListCasesCommandRunEPrintsDefaultsAndTruncatesPrompt(t *testing.T) {
}
}

func TestListCasesShowsMultilineOpeningTurnOnOneRow(t *testing.T) {
root := t.TempDir()
writeAutoModeSkill(t, root)
writeAutoModeEvalYAML(t, root, "conversation")
writeSkillFile(t, root, "evals/cases/conversation.yaml", "id: conversation\ninput:\n turns:\n - role: user\n content: |\n Read this file.\n Summarize it.\n")
cmd := &cobra.Command{}
cmd.SetContext(t.Context())
output, err := captureStdout(t, func() error {
return listCasesCmd.RunE(cmd, []string{filepath.Join(root, "evals", "eval.yaml")})
})
if err != nil || !strings.Contains(output, "Read this file. Summarize it.") || strings.Count(strings.TrimSpace(output), "\n") != 1 {
t.Fatalf("list-cases output = %q, err = %v", output, err)
}
}

func TestListCasesCommandRunEPreservesUnicodePrompt(t *testing.T) {
root := t.TempDir()
writeAutoModeSkill(t, root)
Expand Down
25 changes: 19 additions & 6 deletions internal/cli/listcases.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cli
import (
"fmt"
"os"
"strings"
"text/tabwriter"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -40,16 +41,28 @@ var listCasesCmd = &cobra.Command{
if tag == "" {
tag = "functional_test"
}
const promptPreviewLen = 50
promptPreview := c.Input.Prompt
if previewRunes := []rune(promptPreview); len(previewRunes) > promptPreviewLen {
promptPreview = string(previewRunes[:promptPreviewLen-3]) + "..."
}
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", c.ID, title, tag, promptPreview)
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", c.ID, title, tag, promptPreview(c.Input))
}

_ = w.Flush()

return nil
},
}

func promptPreview(input config.Input) string {
const maxRunes = 50
text := input.Prompt
if text == "" && len(input.Turns) > 0 {
first := input.Turns[0]
text = first.Content
if first.Respond != "" {
text = "[simulated] " + first.Respond
}
}
text = strings.Join(strings.Fields(text), " ")
if runes := []rune(text); len(runes) > maxRunes {
return string(runes[:maxRunes-3]) + "..."
}
return text
}
7 changes: 7 additions & 0 deletions internal/cli/listcases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import (
"github.com/alibaba/skill-up/internal/config"
)

func TestPromptPreviewLabelsSimulatedOpeningTurn(t *testing.T) {
input := config.Input{Turns: []config.Turn{{Respond: "Ask about the result"}}}
if got := promptPreview(input); got != "[simulated] Ask about the result" {
t.Fatalf("promptPreview = %q", got)
}
}

func TestListCasesCommand_ValidConfig(t *testing.T) {
if _, err := os.Stat(testEvalPath); os.IsNotExist(err) {
t.Skip("examples/code-stats/evals/eval.yaml not found")
Expand Down
Loading