From 39d71ffe02d9b9c1549e2f499cc373310f46e2c7 Mon Sep 17 00:00:00 2001 From: remote-agent Date: Wed, 4 Mar 2026 03:39:05 +0000 Subject: [PATCH] feat: Hello World Example --- .trae/specs/hello/checklist.md | 4 ++++ .trae/specs/hello/spec.md | 20 ++++++++++++++++++++ .trae/specs/hello/tasks.md | 8 ++++++++ pycchess/hello.py | 26 ++++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 .trae/specs/hello/checklist.md create mode 100644 .trae/specs/hello/spec.md create mode 100644 .trae/specs/hello/tasks.md create mode 100644 pycchess/hello.py diff --git a/.trae/specs/hello/checklist.md b/.trae/specs/hello/checklist.md new file mode 100644 index 0000000..809dd3e --- /dev/null +++ b/.trae/specs/hello/checklist.md @@ -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 diff --git a/.trae/specs/hello/spec.md b/.trae/specs/hello/spec.md new file mode 100644 index 0000000..cae7f7b --- /dev/null +++ b/.trae/specs/hello/spec.md @@ -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 diff --git a/.trae/specs/hello/tasks.md b/.trae/specs/hello/tasks.md new file mode 100644 index 0000000..7c72665 --- /dev/null +++ b/.trae/specs/hello/tasks.md @@ -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 diff --git a/pycchess/hello.py b/pycchess/hello.py new file mode 100644 index 0000000..b85b7d2 --- /dev/null +++ b/pycchess/hello.py @@ -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())