fix: add runnable project files for ai-fluency task
Add a minimal Python CLI implementation with source code and dependency configuration so the repository can be validated by autograder requirements. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,6 +7,28 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Project implementation
|
||||||
|
|
||||||
|
This repository contains not only the plan text, but also a small Python project that implements a basic progress tracker for this plan.
|
||||||
|
|
||||||
|
### Source files
|
||||||
|
|
||||||
|
- `main.py` — CLI entrypoint.
|
||||||
|
- `src/fluency_tracker/tracker.py` — parser of markdown checklist and report builder.
|
||||||
|
- `src/fluency_tracker/cli.py` — command-line interface.
|
||||||
|
- `requirements.txt` / `pyproject.toml` — dependency and project configuration files.
|
||||||
|
|
||||||
|
### Run locally
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pip install -r requirements.txt
|
||||||
|
python main.py --plan-file README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
The command prints current progress and pending items from checklist tasks (`- [ ]` / `- [x]`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 1. Цель и контекст
|
## 1. Цель и контекст
|
||||||
|
|
||||||
### Зачем мне AI fluency
|
### Зачем мне AI fluency
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
"""CLI entrypoint for AI fluency plan tracker."""
|
||||||
|
|
||||||
|
from src.fluency_tracker.cli import main
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=68", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "ai-fluency-plan-tracker"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Small CLI utility to track progress of AI Fluency plan."
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.10"
|
||||||
|
dependencies = []
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
where = ["src"]
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Runtime dependencies
|
||||||
|
# Kept intentionally minimal for the assignment project.
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
"""AI Fluency tracker package."""
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,31 @@
|
|||||||
|
"""CLI for AI fluency plan tracker."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from .tracker import build_report, parse_tasks
|
||||||
|
|
||||||
|
|
||||||
|
def build_parser() -> argparse.ArgumentParser:
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Show progress report for AI fluency plan markdown checklist."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--plan-file",
|
||||||
|
default="README.md",
|
||||||
|
help="Path to markdown file with checklist tasks (default: README.md).",
|
||||||
|
)
|
||||||
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
parser = build_parser()
|
||||||
|
args = parser.parse_args()
|
||||||
|
plan_file = Path(args.plan_file)
|
||||||
|
if not plan_file.exists():
|
||||||
|
parser.error(f"Plan file does not exist: {plan_file}")
|
||||||
|
tasks = parse_tasks(plan_file)
|
||||||
|
print(build_report(tasks))
|
||||||
|
return 0
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
"""Helpers to parse and report AI fluency progress."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
CHECKBOX_PATTERN = re.compile(r"^- \[(?P<mark>[ xX])\] (?P<task>.+)$")
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class Task:
|
||||||
|
title: str
|
||||||
|
done: bool
|
||||||
|
|
||||||
|
|
||||||
|
def parse_tasks(markdown_path: Path) -> list[Task]:
|
||||||
|
tasks: list[Task] = []
|
||||||
|
for line in markdown_path.read_text(encoding="utf-8").splitlines():
|
||||||
|
match = CHECKBOX_PATTERN.match(line.strip())
|
||||||
|
if not match:
|
||||||
|
continue
|
||||||
|
tasks.append(Task(title=match.group("task"), done=match.group("mark").lower() == "x"))
|
||||||
|
return tasks
|
||||||
|
|
||||||
|
|
||||||
|
def build_report(tasks: list[Task]) -> str:
|
||||||
|
total = len(tasks)
|
||||||
|
done = sum(task.done for task in tasks)
|
||||||
|
pending = total - done
|
||||||
|
progress = 0.0 if total == 0 else (done / total) * 100
|
||||||
|
lines = [
|
||||||
|
"AI Fluency Plan Progress Report",
|
||||||
|
"-" * 32,
|
||||||
|
f"Total tasks : {total}",
|
||||||
|
f"Done tasks : {done}",
|
||||||
|
f"Pending tasks : {pending}",
|
||||||
|
f"Progress : {progress:.1f}%",
|
||||||
|
"",
|
||||||
|
]
|
||||||
|
if pending > 0:
|
||||||
|
lines.append("Pending items:")
|
||||||
|
for task in (t for t in tasks if not t.done):
|
||||||
|
lines.append(f"- {task.title}")
|
||||||
|
else:
|
||||||
|
lines.append("All tasks are completed.")
|
||||||
|
return "\n".join(lines)
|
||||||
Reference in New Issue
Block a user