Skip to content
Merged
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
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.12
4 changes: 2 additions & 2 deletions packages/tui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
BINARY_NAME=rogue-tui
BUILD_DIR?=dist
CMD_DIR=cmd/rogue
VERSION?=dev
VERSION?=$(shell cat ../../VERSION 2>/dev/null || echo "dev")
COMMIT?=$(shell git rev-parse --short HEAD)
DATE?=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")

# Build flags
LDFLAGS=-ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)"
LDFLAGS=-ldflags "-X github.com/rogue/tui/internal/tui.Version=v$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)"

# Default target
all: build
Expand Down
27 changes: 26 additions & 1 deletion packages/tui/cmd/rogue/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"

"github.com/rogue/tui/internal/commands"
"github.com/rogue/tui/internal/tui"
"github.com/spf13/cobra"
)

Expand All @@ -18,16 +19,40 @@ func main() {
commands.RunTUI()
},
}

// Global flags
rootCmd.PersistentFlags().String("server-url", "http://localhost:8000", "Rogue server URL")
rootCmd.PersistentFlags().Bool("debug", false, "Enable debug mode")
rootCmd.PersistentFlags().Bool("no-color", false, "Disable colors")
rootCmd.PersistentFlags().String("model", "", "Default LLM model")
rootCmd.PersistentFlags().String("theme", "aura", "UI theme")

// Add subcommands
// Add version flag to root command
var showVersion bool
rootCmd.Flags().BoolVarP(&showVersion, "version", "v", false, "Show version information")

// Add version command
versionCmd := &cobra.Command{
Use: "version",
Short: "Show version information",
Long: "Display the current version of rogue-tui",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("rogue-tui %s\n", tui.Version)
},
}
rootCmd.AddCommand(versionCmd)

// Add existing subcommands
rootCmd.AddCommand(commands.NewTUICommand())

// Handle version flag on root command before execution
rootCmd.PreRun = func(cmd *cobra.Command, args []string) {
if showVersion {
fmt.Printf("rogue-tui %s\n", tui.Version)
os.Exit(0)
}
}

if err := rootCmd.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion packages/tui/internal/tui/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func (a *App) Run() error {
Theme: "aura",
APIKeys: make(map[string]string),
},
version: "v0.1.12",
version: Version,
commandInput: components.NewCommandInput(),
scenarioEditor: components.NewScenarioEditor(),

Expand Down
5 changes: 5 additions & 0 deletions packages/tui/internal/tui/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package tui

// Version will be set at build time via ldflags
// Default to "dev" if not set during build
var Version = "vdev"
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "rogue-ai"
version = "0.1.12"
dynamic = ["version"]
description = "Rogue agent evaluator by Qualifire"
readme = "README.md"
requires-python = ">=3.10"
Expand Down Expand Up @@ -45,13 +45,21 @@ examples = ["langchain==0.3.26", "langchain-openai==0.3.27", "langgraph==0.5.2"]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.version]
path = "VERSION"
pattern = "(?P<version>^\\s*[^\\r\\n\\s]+)"

[tool.hatch.build.targets.wheel]
packages = ["rogue", "examples"]

[tool.hatch.build.targets.wheel.sources]
"rogue" = "rogue"
"examples" = "examples"

[tool.uv.sources]
rogue-ai-sdk = { path = "sdks/python", editable = true }

[project.scripts]
rogue-ai = "rogue.__main__:main"
rogue-ai-example-tshirt = "examples.tshirt_store_agent.__main__:main"

6 changes: 5 additions & 1 deletion rogue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
This module provides a clean, library-oriented API for agent evaluation.
"""

from pathlib import Path

# Import submodules for backward compatibility
from . import (
common,
Expand All @@ -18,6 +20,7 @@

# Import the new library interface
from .server.services.evaluation_library import EvaluationLibrary
from .common.version import get_version

# Main library interface
evaluate_agent = EvaluationLibrary.evaluate_agent
Expand All @@ -43,7 +46,8 @@
"ui",
]


# Version info
__version__ = "0.1.12"
__version__ = get_version("rogue-ai")
__author__ = "Qualifire"
__description__ = "Library for evaluating AI agents against scenarios"
42 changes: 42 additions & 0 deletions rogue/common/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
Shared version retrieval logic.
"""

from pathlib import Path


def get_version(package_name: str) -> str:
"""
Retrieves the package version.

It first tries to find a 'VERSION' file by traversing up from the current
file's location. If found, its content is returned.

As a fallback, it tries to get the version from the installed package
metadata using importlib.metadata.

If both methods fail, it returns a default development version string.

Args:
package_name: The name of the package to look up in the metadata.

Returns:
The version string.
"""
try:
# Find project root by looking for the VERSION file
current_path = Path(__file__).resolve()
for parent in current_path.parents:
version_file = parent / "VERSION"
if version_file.exists():
return version_file.read_text().strip()
except Exception:
pass # nosec B110

try:
# Fall back to installed package metadata
from importlib.metadata import version

return version(package_name)
except Exception:
return "0.0.0-dev"
8 changes: 7 additions & 1 deletion sdks/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "rogue-ai-sdk"
version = "0.1.4"
dynamic = ["version"]
description = "Python SDK for Rogue Agent Evaluator"
readme = "README.md"
requires-python = ">=3.9"
Expand All @@ -25,6 +25,8 @@ dependencies = [
"pydantic>=2.0.0",
"websockets>=11.0.0",
"typing-extensions>=4.0.0",
"loguru>=0.7.0",
"backoff>=2.2.1",
]

[project.optional-dependencies]
Expand All @@ -46,5 +48,9 @@ Issues = "https://github.com/qualifire/rogue-agent-evaluator/issues"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.version]
path = "../../VERSION"
pattern = "(?P<version>^\\s*[^\\r\\n\\s]+)"

[tool.hatch.build.targets.wheel]
packages = ["rogue_sdk"]
9 changes: 8 additions & 1 deletion sdks/python/rogue_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ async def main():
from .websocket import RogueWebSocketClient

# Version
__version__ = "1.0.0"
__version__: str
try:
from importlib.metadata import PackageNotFoundError, version

__version__ = version("rogue-ai-sdk")
except PackageNotFoundError:
# Fallback for development environments where the package isn't installed
__version__ = "0.0.0-dev"

# Default export
__all__ = [
Expand Down
36 changes: 35 additions & 1 deletion sdks/python/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 22 additions & 9 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading