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
4 changes: 4 additions & 0 deletions .trae/specs/hello/checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Checklist
- [x] Hello function exists and is accessible
- [x] Hello function returns a friendly greeting message
- [x] Error handling is implemented for edge cases
20 changes: 20 additions & 0 deletions .trae/specs/hello/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Hello Feature Spec

## Why
Provide a simple greeting mechanism to demonstrate basic functionality and establish a foundation for user interaction features.

## What Changes
- Add a hello greeting endpoint/function
- Implement basic response handling

## Impact
- Affected specs: User interaction, greeting system
- Affected code: New greeting module

## ADDED Requirements
### Requirement: Hello Greeting
The system SHALL provide a hello greeting function that returns a friendly greeting message.

#### Scenario: Success case
- **WHEN** user requests a hello greeting
- **THEN** system returns a friendly greeting message
8 changes: 8 additions & 0 deletions .trae/specs/hello/tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Tasks
- [x] Task 1: Create hello greeting function
- [x] SubTask 1.1: Create hello module/file
- [x] SubTask 1.2: Implement hello function that returns greeting message
- [x] SubTask 1.3: Add basic error handling

# Task Dependencies
- No dependencies between tasks
26 changes: 26 additions & 0 deletions pycchess/hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-

def hello(name=None):
"""
Returns a friendly greeting message.

Args:
name: Optional name to personalize the greeting

Returns:
A greeting string

Raises:
ValueError: If name is empty string
"""
if name is None:
return "Hello! Welcome to pycchess."

if not isinstance(name, str):
raise ValueError("Name must be a string")

if name.strip() == "":
raise ValueError("Name cannot be empty")

return "Hello, {}! Welcome to pycchess.".format(name.strip())