This file is for coding agents and AI assistants working in this repository.
Make small, focused, typed, tested, and documented changes.
- Python 3.12+
- CLI: typer + rich
- Config/models: pydantic + pydantic-settings
- HTTP: httpx
- Fuzzy: rapidfuzz
- Quality gates: ruff (format+lint) + ty (typecheck) + pytest
- Keep changes small, typed, tested, and documented.
- Use
uvas the project package and task runner. - Maintain offline, deterministic tests.
- Keep licensing and secret-handling requirements intact.
- Create a dedicated git branch for the work before making code changes.
- Sync dependencies with
uv sync. - Implement changes with full type annotations and meaningful Google-style docstrings.
- Keep tests offline and use mocks from
clocky/testing.py(do not place mocks inapi.py). - Run full checks with
./check.sh. - Update documentation after each major code change (see Documentation).
- Commit only after checks and docs pass (see Commit style).
- Before opening a pull request, squash the branch history into a clean, reviewable set of commits.
- Prepare a clear pull request summary that explains the problem, approach, validation, and any follow-up work.
- Open and submit the pull request once the branch is ready for review.
- Use
uvonly (no pip/poetry/conda); useuvxfor tool execution instead ofuv pip. - Add
from __future__ import annotationsin every.pyfile. - Do not commit secrets; keep
.envignored and maintain.env.example. - Preserve SPDX license headers in
.py/.shfiles:SPDX-License-Identifier: MIT.
check.sh must remain green and runs:
uv sync --quietruff format .ruff check . --fixty check .pytest
Follow these rules when adding or changing CLI commands, flags, or output:
| Rule | Detail |
|---|---|
| Long options preferred | --description not -d (short aliases allowed as extras) |
| stdout for data | stderr for progress/errors |
| Exit codes | 0 = success, 1 = runtime error, 2 = usage error |
| Standard flags | Every command must support --help; top-level supports --json, --quiet |
| Validate early | Fail fast on bad input before making API calls |
NO_COLOR |
Respect the NO_COLOR env variable — disable colour when set |
- Default: human-readable Rich tables/messages.
--json: JSON to stdout, implies--quiet. Must be valid, parseable JSON.--quiet/-q: suppress informational output; errors still go to stderr.
- Confirm on TTY (e.g.
delete, long-runningstop). --force/-fskips confirmation.--dry-runpreviews the action without side-effects.
Errors printed to stderr should follow:
clocky: <message>
Try 'clocky <command> --help'
Ubuntu .desktop launchers and shell scripts in launchers/ depend on:
--non-interactiveflag behaviour and best-fuzzy-match auto-pick.CLOCKY_ERROR_MISSING_TAG_MAPsentinel on stderr.- Stdout lines matching
Project:andTag:parsed bysed.
Do not change these contracts without updating every launcher script.
After every major code change (new command, new flag, changed behaviour), update docs:
- Max 150 lines per doc file, one concept per file.
- Start each doc with a YAML
description:frontmatter or a TL;DR section. - No duplicated content — define once, link elsewhere.
- Use tables for structured data (parameters, config, flags).
- Include concrete, copy-pasteable examples.
- Name files by task:
{verb}-{noun}.mdfor how-tos,{noun}.mdfor reference. - Keep
README.mdas the directory overview and entry point. - Update
README.mdwhenever the CLI surface changes (new commands, removed flags, etc.).
Use Conventional Commits format: <type>(<scope>): <summary>
| Field | Rule |
|---|---|
type |
Required. One of: feat, fix, refactor, test, docs, chore, perf |
scope |
Optional. Short noun for the affected area, e.g. cli, api, display |
summary |
Required. Imperative, ≤ 72 chars, no trailing period |
| Body | Optional. Blank line after subject, then short paragraphs |
- Create and switch to a focused branch, for example
git switch -c feat/short-name. - Review
git statusandgit diffto understand what changed. - Stage only the intended files (
git add -pwhen mixing concerns). - Run
git commit -m "<type>(<scope>): <summary>". - Keep branch history tidy; squash or reword intermediate commits before review.
- Do not add
Signed-off-byor breaking-change footers.
- Ensure
./check.shpasses and docs are up to date. - Push the branch and prepare a pull request.
- Write a concise, high-signal PR summary covering:
- what changed
- why it changed
- how it was validated
- any risks, limitations, or follow-up tasks
- Squash commit history as needed so reviewers see a clean final history.
- Submit the pull request when the branch is ready for review.
- Remote operations are allowed when explicitly requested, including pushing branches, deleting fully merged remote branches, and other necessary remote-state updates related to the task.
| Task | Command |
|---|---|
| Dev sync | uv sync |
| Run CLI | uv run clocky --help |
| Full checks | ./check.sh |
| Run single test | uv run pytest tests/test_foo.py -v |