Add CLAUDE.md with versioned changelog, update README
- Created CLAUDE.md with instructions to update changelog and README on every commit, version number (v1.2.0), and full changelog from v1.0.0 - Updated README: document-scope BLIGHT:: syntax, processing order, two-line failure format, complete_document() in AI provider section Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
38
README.md
38
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
A module in the **BLIGHT** ecosystem.
|
||||
|
||||
BLIGHT: CUE monitors Gitea repositories containing markdown files. When a push is received, it scans changed files for `BLIGHT:` trigger lines, sends the surrounding document to an AI model along with the instruction, and writes the result back to the file in-place — fully automated.
|
||||
BLIGHT: CUE monitors Gitea repositories containing markdown files. When a push is received, it scans changed files for `BLIGHT:` trigger lines, sends the document to an AI model along with the instruction, and writes the result back to the file in-place — fully automated.
|
||||
|
||||
---
|
||||
|
||||
@@ -10,16 +10,25 @@ BLIGHT: CUE monitors Gitea repositories containing markdown files. When a push i
|
||||
|
||||
1. You write a `BLIGHT:` trigger anywhere in a markdown file and push it to Gitea.
|
||||
2. Gitea sends a webhook POST to this server.
|
||||
3. The server fetches the file, finds all `BLIGHT:` triggers, and processes them one by one.
|
||||
4. Each trigger is replaced with the AI's response at the exact position of the trigger line.
|
||||
5. The updated file is committed back to the repo automatically.
|
||||
3. The server fetches the file, finds all `BLIGHT:` triggers, and processes them.
|
||||
4. Each trigger is replaced with the AI's response, then the updated file is committed back automatically.
|
||||
|
||||
### Trigger Syntax
|
||||
|
||||
Triggers are case-insensitive — `BLIGHT:`, `blight:`, `Blight::`, etc. all work.
|
||||
|
||||
**Inline trigger** — replaces only the trigger line with the AI's response:
|
||||
|
||||
```
|
||||
BLIGHT: <your instruction here>
|
||||
```
|
||||
|
||||
**Document-scope trigger** — replaces the entire file with the AI's rewritten version:
|
||||
|
||||
```
|
||||
BLIGHT:: <your instruction here>
|
||||
```
|
||||
|
||||
Examples:
|
||||
|
||||
```markdown
|
||||
@@ -31,22 +40,30 @@ BLIGHT: Explain the key differences between は and が based on the paragraph a
|
||||
```
|
||||
|
||||
```markdown
|
||||
BLIGHT: Spell check this entire document and list any errors found.
|
||||
BLIGHT: Write a conclusion paragraph for this document.
|
||||
```
|
||||
|
||||
```markdown
|
||||
BLIGHT: Write a conclusion paragraph for this document.
|
||||
BLIGHT:: Spellcheck and lightly reformat this entire document.
|
||||
```
|
||||
|
||||
### Processing Order
|
||||
|
||||
When a file contains multiple triggers:
|
||||
|
||||
1. All inline (`BLIGHT:`) triggers are processed first, in document order.
|
||||
2. All document-scope (`BLIGHT::`) triggers are processed next, in document order — each one operates on the result of the previous.
|
||||
|
||||
### Failure Behavior
|
||||
|
||||
If the AI call fails after 3 attempts, the trigger is replaced with:
|
||||
|
||||
```html
|
||||
<!-- BLIGHT_FAILED: your original instruction -->
|
||||
<!-- BLIGHT_ERROR: <error message> -->
|
||||
```
|
||||
|
||||
You can re-trigger processing by editing the file to restore the original `BLIGHT:` line and pushing again.
|
||||
You can re-trigger processing by editing the file to restore the original trigger line and pushing again.
|
||||
|
||||
---
|
||||
|
||||
@@ -224,12 +241,17 @@ from abc import ABC, abstractmethod
|
||||
|
||||
class AIProvider(ABC):
|
||||
def complete(self, document: str, instruction: str) -> str:
|
||||
"""Return text to insert in place of an inline BLIGHT: trigger."""
|
||||
...
|
||||
|
||||
def complete_document(self, document: str, instruction: str) -> str:
|
||||
"""Return the full rewritten document for a BLIGHT:: trigger."""
|
||||
...
|
||||
```
|
||||
|
||||
To add a new provider (e.g. OpenRouter):
|
||||
|
||||
1. Create `ai/openrouter.py` and implement `AIProvider`.
|
||||
1. Create `ai/openrouter.py` and implement both methods of `AIProvider`.
|
||||
2. In `processor.py`, replace `GeminiProvider()` with your new class.
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user