-
Notifications
You must be signed in to change notification settings - Fork 154
feature/aio example script #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,6 +202,7 @@ type Model struct { | |
| eventsViewport components.Viewport | ||
| summaryViewport components.Viewport | ||
| reportViewport components.Viewport | ||
| helpViewport components.Viewport | ||
| focusedViewport int // 0 = events, 1 = summary | ||
| eventsAutoScroll bool // Track if events should auto-scroll to bottom | ||
|
|
||
|
|
@@ -273,7 +274,7 @@ func (a *App) Run() error { | |
| Theme: "aura", | ||
| APIKeys: make(map[string]string), | ||
| }, | ||
| version: "v0.1.5", | ||
| version: "v0.1.6", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify version consistency across the codebase. The version has been updated to "v0.1.6". Ensure this is consistent with other version references (e.g., package.json, setup.py, README, etc.). Run the following script to check for version references: 🏁 Script executed: #!/bin/bash
# Search for version references in common files
rg -n --type-add 'config:*.{json,toml,yaml,yml}' --type config -C2 "version.*0\.1\.[0-9]"
rg -n --type py -C2 "version.*0\.1\.[0-9]"
rg -n --type md -C2 "version.*0\.1\.[0-9]|v0\.1\.[0-9]"Length of output: 3411 🏁 Script executed: #!/bin/bash
# List version fields from all package.json files
rg -n '"version"\s*:' -g "package.json"Length of output: 239 Sync Python SDK version
🤖 Prompt for AI Agents |
||
| commandInput: components.NewCommandInput(), | ||
| scenarioEditor: components.NewScenarioEditor(), | ||
|
|
||
|
|
@@ -286,6 +287,7 @@ func (a *App) Run() error { | |
| eventsViewport: components.NewViewport(1, 80, 20), | ||
| summaryViewport: components.NewViewport(2, 80, 20), | ||
| reportViewport: components.NewViewport(3, 80, 15), | ||
| helpViewport: components.NewViewport(4, 80, 20), | ||
| focusedViewport: 0, // Start with events viewport focused | ||
| eventsAutoScroll: true, // Start with auto-scroll enabled | ||
| } | ||
|
|
@@ -423,6 +425,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |
| m.eventsViewport.SetSize(viewportWidth, viewportHeight) | ||
| m.summaryViewport.SetSize(viewportWidth, viewportHeight) | ||
| m.reportViewport.SetSize(viewportWidth, viewportHeight) | ||
| m.helpViewport.SetSize(viewportWidth, viewportHeight) | ||
| return m, nil | ||
|
|
||
| case AutoRefreshMsg: | ||
|
|
@@ -1226,6 +1229,28 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |
| } | ||
| } | ||
|
|
||
| // Help screen keys | ||
| if m.currentScreen == HelpScreen { | ||
| switch msg.String() { | ||
| case "home": | ||
| // Go to top of help content | ||
| m.helpViewport.GotoTop() | ||
| return m, nil | ||
| case "end": | ||
| // Go to bottom of help content | ||
| m.helpViewport.GotoBottom() | ||
| return m, nil | ||
| default: | ||
| // Update the help viewport for scrolling | ||
| helpViewportPtr, cmd := m.helpViewport.Update(msg) | ||
| if cmd != nil { | ||
| cmds = append(cmds, cmd) | ||
| } | ||
| m.helpViewport = *helpViewportPtr | ||
| return m, tea.Batch(cmds...) | ||
| } | ||
| } | ||
|
|
||
| // Let the command input handle non-shortcut keys if it's focused | ||
| if m.commandInput.IsFocused() { | ||
| m.commandInput, cmd = m.commandInput.Update(msg) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,35 +7,33 @@ import ( | |
| "github.com/rogue/tui/internal/theme" | ||
| ) | ||
|
|
||
| // RenderHelp renders the help screen | ||
| // RenderHelp renders the help screen with viewport for scrollable content | ||
| func (m Model) RenderHelp() string { | ||
| t := theme.CurrentTheme() | ||
|
|
||
| // Main container style | ||
| containerStyle := lipgloss.NewStyle(). | ||
| Border(lipgloss.RoundedBorder()). | ||
| BorderForeground(t.Border()). | ||
| BorderBackground(t.BackgroundPanel()). | ||
| Padding(1, 2). | ||
| Width(m.width - 4). | ||
| Height(m.height - 4). | ||
| Background(t.BackgroundPanel()) | ||
| // Main container style with full width and height background | ||
| mainStyle := lipgloss.NewStyle(). | ||
| Width(m.width). | ||
| Height(m.height - 1). | ||
| Background(t.Background()) | ||
|
|
||
| // Title style | ||
| titleStyle := lipgloss.NewStyle(). | ||
| Foreground(t.Primary()). | ||
| Background(t.BackgroundPanel()). | ||
| Background(t.Background()). | ||
| Bold(true). | ||
| Width(m.width). | ||
| Align(lipgloss.Center). | ||
| Width(m.width - 8) | ||
| Padding(1, 0) | ||
|
|
||
| header := titleStyle.Render("❓ Rogue") | ||
|
|
||
| // Section header style | ||
| sectionHeaderStyle := lipgloss.NewStyle(). | ||
| Foreground(t.Accent()). | ||
| Background(t.BackgroundPanel()). | ||
| Bold(true). | ||
| MarginTop(1). | ||
| MarginBottom(1) | ||
| MarginTop(1) | ||
|
|
||
| // Content style | ||
| contentStyle := lipgloss.NewStyle(). | ||
|
|
@@ -60,12 +58,9 @@ func (m Model) RenderHelp() string { | |
| Background(t.BackgroundPanel()). | ||
| Bold(true) | ||
|
|
||
| // Build content sections | ||
| // Build content sections for viewport | ||
| var sections []string | ||
|
|
||
| // Title | ||
| sections = append(sections, titleStyle.Render("❓ Rogue")) | ||
|
|
||
| // About section | ||
| sections = append(sections, sectionHeaderStyle.Render("📖 About Rogue")) | ||
| aboutText := `Rogue is a powerful tool designed to evaluate the performance, compliance, and reliability | ||
|
|
@@ -117,15 +112,74 @@ Key Features: | |
| 4. View Report - Review detailed Markdown report with findings and recommendations` | ||
| sections = append(sections, contentStyle.Render(workflowText)) | ||
|
|
||
| // Footer | ||
| footerStyle := lipgloss.NewStyle(). | ||
| Foreground(t.TextMuted()). | ||
| helpContent := strings.Join(sections, "\n") | ||
|
|
||
| // Calculate viewport dimensions | ||
| viewportWidth := m.width - 8 | ||
| viewportHeight := m.height - 6 | ||
|
|
||
| // Create a temporary copy of the viewport to avoid modifying the original | ||
| viewport := m.helpViewport | ||
| viewport.SetSize(viewportWidth-4, viewportHeight-4) | ||
| viewport.SetContent(helpContent) | ||
|
Comment on lines
+117
to
+124
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flag viewport sizing inconsistency between render and resize handler. The viewport is sized twice with different dimensions:
This inconsistency could cause visual glitches or unexpected behavior. Consider either:
Apply this approach to simplify and use the resize handler's dimensions: - // Calculate viewport dimensions
- viewportWidth := m.width - 8
- viewportHeight := m.height - 6
-
// Create a temporary copy of the viewport to avoid modifying the original
viewport := m.helpViewport
- viewport.SetSize(viewportWidth-4, viewportHeight-4)
viewport.SetContent(helpContent)
+
+ // Get dimensions from the already-sized viewport
+ viewportWidth := viewport.Width + 8 // Add back the margins/borders
+ viewportHeight := viewport.Height + 6🤖 Prompt for AI Agents |
||
|
|
||
| // Style the viewport with border | ||
| viewportStyle := lipgloss.NewStyle(). | ||
| Height(viewportHeight). | ||
| Border(lipgloss.RoundedBorder()). | ||
| BorderForeground(t.Border()). | ||
| BorderBackground(t.BackgroundPanel()). | ||
| Background(t.BackgroundPanel()) | ||
|
|
||
| // Apply viewport styling | ||
| viewport.Style = lipgloss.NewStyle(). | ||
| Foreground(t.Text()). | ||
| Background(t.BackgroundPanel()). | ||
| Width(viewportWidth-4). | ||
| Height(viewportHeight-4). | ||
| Padding(1, 2) | ||
|
|
||
| // Help text style | ||
| helpStyle := lipgloss.NewStyle(). | ||
| Foreground(t.TextMuted()). | ||
| Background(t.Background()). | ||
| Width(m.width). | ||
| Align(lipgloss.Center). | ||
| MarginTop(2). | ||
| Width(m.width - 8) | ||
| sections = append(sections, footerStyle.Render("Press Esc to return to dashboard")) | ||
| Padding(0, 1) | ||
|
|
||
| content := strings.Join(sections, "\n") | ||
| return containerStyle.Render(content) | ||
| // Include scroll indicators in help text | ||
| scrollInfo := "" | ||
| if !viewport.AtTop() || !viewport.AtBottom() { | ||
| scrollInfo = "↑↓ Scroll " | ||
| } | ||
| helpText := helpStyle.Render(scrollInfo + "Esc Back to Dashboard") | ||
|
|
||
| // Create the viewport content area | ||
| viewportContent := viewportStyle.Render(viewport.View()) | ||
|
|
||
| // Center the viewport in the available space | ||
| contentArea := lipgloss.NewStyle(). | ||
| Width(m.width). | ||
| Height(viewportHeight). | ||
| Background(t.Background()) | ||
|
|
||
| centeredViewport := contentArea.Render( | ||
| lipgloss.Place( | ||
| m.width, | ||
| viewportHeight, | ||
| lipgloss.Center, | ||
| lipgloss.Top, | ||
| viewportContent, | ||
| lipgloss.WithWhitespaceStyle(lipgloss.NewStyle().Background(t.Background())), | ||
| ), | ||
| ) | ||
|
|
||
| // Combine all sections | ||
| fullLayout := lipgloss.JoinVertical(lipgloss.Left, | ||
| header, | ||
| centeredViewport, | ||
| helpText, | ||
| ) | ||
|
|
||
| return mainStyle.Render(fullLayout) | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify package structure to resolve ImportError.
The pipeline failure indicates
ImportError: attempted relative import with no known parent packageon line 19. Relative imports require thatexamples/tshirt_store_agent/is a proper Python package with an__init__.pyfile.Ensure the following:
examples/__init__.pyandexamples/tshirt_store_agent/__init__.pyexist (even if empty) to establish the package hierarchy.python -m examples.tshirt_store_agent) or via the new script entry (rogue-ai-example-tshirt), not as a standalone script (python examples/tshirt_store_agent/__main__.py).Run this script to verify the package structure:
🏁 Script executed:
Length of output: 203
Add missing
examples/__init__.pyto fix relative imports.The top‐level
examplesdirectory needs an (even empty)__init__.pyso thatfrom .tshirt_store_agent import …works. After adding it, run the agent viapython -m examples.tshirt_store_agentor the CLI entry, not by executing__main__.pydirectly.🧰 Tools
🪛 GitHub Actions: Rogue
[error] 19-19: ImportError: attempted relative import with no known parent package.
🤖 Prompt for AI Agents