Simple cross‑language CLI task manager with AI‑authored documentation. The app lets you add, edit, mark done, view, save, and load tasks grouped by weekday. It’s designed for educational purposes: building features in a “source” language and translating them to a “target” language while keeping behavior consistent and testable.
This repository contains only the target‑language implementation used by tests and a comprehensive README generated and refined with AI assistance.
- Add tasks to a weekday (Monday–Sunday)
- Edit a task’s description by index
- Mark a task as Done
- View tasks for a specific day or all days (ordered Monday→Sunday)
- Save tasks to a JSON file
- Load tasks from a JSON file
- Minimal, predictable console I/O suitable for automated testing
- Python 3.10+ (tested on Python 3.13)
Optional (only if you want to run the provided test suite):
pip install -r requirements.txt
- Clone or download this repository.
- Open a terminal in the project root.
- Run the CLI:
python "Python-JS AI-documented CLI Task Manager/task/main.py"
You will see a prompt like:
Enter command (add/edit/done/view/save/load/quit):
Type a command and press Enter. The menu is re‑shown after each command to guide you.
- add
- Prompts:
- Enter day:
- Enter task:
- Prompts:
- edit
- Prompts:
- Enter day:
- Enter task index:
- Enter new task:
- Prompts:
- done
- Prompts:
- Enter day:
- Enter task index:
- Prompts:
- view
- Prompts:
- Enter day (or press Enter for all):
- Behavior:
- If a valid weekday is entered: prints tasks for that day only.
- If left blank: prints all weekdays (Monday→Sunday) followed by a
General:header.
- Prompts:
- save
- Prompts:
- Enter filename (default: tasks.json):
- Writes JSON with the schema described below.
- Prompts:
- load
- Prompts:
- Enter filename (default: tasks.json):
- Loads JSON and replaces the in‑memory tasks with the file contents.
- Prompts:
- quit
- Exits the program.
Notes
- Weekday validation is strict; only Monday…Sunday are accepted (case‑insensitive input is normalized to Title case).
- Task statuses are exactly
PendingorDone(capitalized).
Enter command (add/edit/done/view/save/load/quit):
add
Enter day:
Monday
Enter task:
Task 1
Enter command (add/edit/done/view/save/load/quit):
view
Enter day (or press Enter for all):
Monday
Monday:
0: Task 1 - Pending
Enter command (add/edit/done/view/save/load/quit):
done
Enter day:
Monday
Enter task index:
0
Enter command (add/edit/done/view/save/load/quit):
view
Enter day (or press Enter for all):
Monday
Monday:
0: Task 1 - Done
Enter command (add/edit/done/view/save/load/quit):
save
Enter filename (default: tasks.json):
tasks.json
Enter command (add/edit/done/view/save/load/quit):
quit
When saving, the CLI writes a JSON object with all weekdays plus General:
{
"Monday": [{"task": "First Task", "status": "Done"}],
"Tuesday": [],
"Wednesday": [],
"Thursday": [],
"Friday": [{"task": "Task 2", "status": "Pending"}],
"Saturday": [],
"Sunday": [],
"General": []
}
- Each item is an object with keys:
task: the task description (string)status:PendingorDone
On load, the program maps back into its internal structure with fields description and status per task.
Error handling
- File I/O or JSON decode errors are ignored silently; current in‑memory tasks remain unchanged.
Main entry point: task/main.py
print_menu()— prints the command menu.normalize_day(day)— normalizes a string to a canonical weekday (Title case).validate_day_input(raw_day)— returns a valid weekday orNone.show_tasks(tasks_by_day, day=None)— prints tasks (specific day or all).main()— interactive loop that implements all commands.
Docstrings have been added to key functions to aid understanding and IDE hints.
The project includes automated tests used in the course environment.
pip install -r requirements.txt
python -m hstest Python-JS AI-documented CLI Task Manager/task/main.py
Note: In some environments, the course platform runs the tests for you.
-
Why is there a
Generalsection?
It is part of the expected output format. The CLI currently does not store General tasks; it prints theGeneral:header after listing all weekdays in “view all” mode and saves"General": []in JSON for schema completeness. -
Why are errors on save/load silent?
To keep the I/O predictable for automated tests. You can add explicit error reporting for real‑world usage.
- “Invalid day” message appears repeatedly
- Ensure the day is one of Monday–Sunday. Input is case‑insensitive; leading/trailing spaces are ignored.
- Loading does nothing
- Verify the filename and that it contains valid JSON matching the documented schema.
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-change - Commit with a clear message
- Open a Pull Request describing your change and motivation
Specify your preferred license here (e.g., MIT). For classroom use, licensing may be set by the course platform.
To publish to GitHub:
git init
git add .
git commit -m "Initial commit: CLI Task Manager with AI-generated docs"
git branch -M main
git remote add origin https://github.com/<your-user>/<your-repo>.git
git push -u origin main
Consider adding a .gitignore for Python and Node artifacts.