diff --git a/.github/assistant-guidelines.md b/.github/assistant-guidelines.md index a8fd9ff..3cb7067 100644 --- a/.github/assistant-guidelines.md +++ b/.github/assistant-guidelines.md @@ -19,7 +19,7 @@ These guidelines tell the assistant exactly how to write prompt files in this re - `HH-MM-SS` is the current time. - `raptor-mini-preview` is the model name. Replace this model name with the actual AI model that you use. - - Use `date +%Y-%m-%d%H-%M-%S` to get the current date and time. + - Use `date +%Y-%m-%dT%H-%M-%S` to get the current date and time. - File content must contain only the raw prompt text from the user. - Do not add headings, bullets, annotations, or any markup. - Do not store assistant responses or metadata inside these files. diff --git a/CHANGES.md b/CHANGES.md index 65d53ce..7637ee5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,12 @@ +## v0.0.11 + +- fix: `.github/assistant-guidelines.md` names the right `date` command. + It left out the `T`, so a model following it wrote prompt files that do + not match the documented `YYYY-MM-DDTHH-MM-SS` name. + ## v0.0.10 - fix: the recorded model is now the model that actually answered. Every diff --git a/README.md b/README.md index dc7701e..50515af 100644 --- a/README.md +++ b/README.md @@ -80,10 +80,13 @@ To update the hooks: ```shell pre-commit autoupdate -git add . +git add .pre-commit-config.yaml pre-commit run --hook-stage manual prepare-ai-repository ``` +pre-commit refuses to run while `.pre-commit-config.yaml` has unstaged +changes, hence the `git add` between the two. + ## Contributing prompt recording for another AI `.github/assistant-guidelines.md` tells AI models how to record each of your prompts. diff --git a/ai_prompt_auto_commit/data/assistant-guidelines.md b/ai_prompt_auto_commit/data/assistant-guidelines.md index a8fd9ff..3cb7067 100644 --- a/ai_prompt_auto_commit/data/assistant-guidelines.md +++ b/ai_prompt_auto_commit/data/assistant-guidelines.md @@ -19,7 +19,7 @@ These guidelines tell the assistant exactly how to write prompt files in this re - `HH-MM-SS` is the current time. - `raptor-mini-preview` is the model name. Replace this model name with the actual AI model that you use. - - Use `date +%Y-%m-%d%H-%M-%S` to get the current date and time. + - Use `date +%Y-%m-%dT%H-%M-%S` to get the current date and time. - File content must contain only the raw prompt text from the user. - Do not add headings, bullets, annotations, or any markup. - Do not store assistant responses or metadata inside these files. diff --git a/tests/test_prepare_repository.py b/tests/test_prepare_repository.py index 1f53592..295cd5f 100644 --- a/tests/test_prepare_repository.py +++ b/tests/test_prepare_repository.py @@ -5,8 +5,12 @@ import importlib.metadata import json import os +import re +from datetime import datetime from pathlib import Path +import pytest + from ai_prompt_auto_commit.common import PROMPTS_DIRECTORY from ai_prompt_auto_commit.prepare_repository import ( HOOK_SCRIPT_FILENAME, @@ -100,6 +104,30 @@ def test_get_default_assistant_guidelines_only_one_header() -> None: next_header = content.find("---", header_end + 3) assert next_header == -1, "Multiple headers found in assistant guidelines" + +@pytest.mark.parametrize( + "guidelines", + [ + # ./release copies the .github file over the bundled one + Path(__file__).parent.parent / ".github" / "assistant-guidelines.md", + "bundled", + ], +) +def test_assistant_guidelines_date_command_matches_filename_pattern( + guidelines: Path | str, +) -> None: + """The guidelines tell other AI models which `date` command produces the + timestamp; it has to be the format the hooks write, `T` included.""" + if guidelines == "bundled": + content = get_default_assistant_guidelines() + else: + content = guidelines.read_text(encoding="utf-8") + match = re.search(r"`date \+([^`]+)`", content) + assert match, "the guidelines name no date command" + timestamp = datetime(2026, 10, 7, 9, 5, 3).strftime(match.group(1)) + assert timestamp == "2026-10-07T09-05-03" + + # --------------------------------------------------------------------------- # .claude/settings.json # ---------------------------------------------------------------------------