Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/assistant-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

<!-- Note: Adding a version here, also edit README.md pre-commit template. -->

## 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
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion ai_prompt_auto_commit/data/assistant-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
28 changes: 28 additions & 0 deletions tests/test_prepare_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
# ---------------------------------------------------------------------------
Expand Down
Loading