Skip to content

Commit f3f0400

Browse files
committed
Reapply "Merge pull request #14 from Smartling/settings-extraction"
This reverts commit 002453a.
1 parent 9db163e commit f3f0400

35 files changed

Lines changed: 2810 additions & 163 deletions

.env.example

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,33 @@ LLM_CONCURRENCY=5
5151
# SMARTLING_ACCOUNT_UID=your_account_uid
5252
# SMARTLING_USER_IDENTIFIER=your_user_identifier
5353
# SMARTLING_USER_SECRET=your_user_secret
54+
55+
# -----------------------------------------------------------------------------
56+
# Prompt Templates (optional — defaults shown)
57+
# -----------------------------------------------------------------------------
58+
# Directory containing prompt template files
59+
# PROMPTS_DIR=./prompts
60+
61+
# -----------------------------------------------------------------------------
62+
# Per-Service LLM Settings (optional — defaults shown)
63+
# -----------------------------------------------------------------------------
64+
# Commit Analyzer
65+
# ANALYZER_TEMPERATURE=0
66+
# ANALYZER_MAX_TOKENS=256
67+
68+
# Chat Agent (conversational assistant)
69+
# CHAT_AGENT_TEMPERATURE=0.3
70+
# CHAT_AGENT_MAX_TOKENS=1500
71+
# CHAT_AGENT_MAX_ITERATIONS=5
72+
73+
# Developer Summary
74+
# SUMMARY_TEMPERATURE=0.7
75+
# SUMMARY_MAX_TOKENS=512
76+
77+
# Report Highlights (report-over-report comparison)
78+
# HIGHLIGHTS_TEMPERATURE=0.5
79+
# HIGHLIGHTS_MAX_TOKENS=512
80+
81+
# LLM Connection Test
82+
# LLM_TEST_TEMPERATURE=0
83+
# LLM_TEST_MAX_TOKENS=32

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Glooker is a Next.js 15 web app that generates developer impact reports for a Gi
2323
- **Dual DB support** — SQLite (default, zero config) and MySQL (opt-in via `DB_TYPE=mysql`). The SQLite wrapper translates MySQL-dialect SQL on the fly
2424
- **In-memory progress store** (globalThis Map) — survives Next.js HMR, acceptable for single-user local use
2525
- **AI detection** has two layers: trailer parsing (confirmed) and LLM heuristic (maybe_ai)
26+
- **Prompt template system** — LLM prompts live in `prompts/` dir (configurable via `PROMPTS_DIR`), loaded by `prompt-loader.ts` with in-memory caching. Templates use `{{PLACEHOLDER}}` syntax. All LLM settings (temperature, max_tokens, max_iterations) are configurable via env vars with hardcoded defaults.
2627

2728
## Environment
2829

@@ -45,3 +46,6 @@ Glooker is a Next.js 15 web app that generates developer impact reports for a Gi
4546
- `@octokit/rest` is ESM-only — any test file that imports from `github.ts` (directly or transitively) must `jest.mock('@octokit/rest')` before the import
4647
- Tests use Jest + ts-jest with `@/` path alias — config in `jest.config.ts`
4748
- CI runs on all pull requests and pushes to main (`.github/workflows/test.yml`)
49+
- `PROMPTS_DIR` defaults to `./prompts` relative to CWD — in Docker, ensure the directory is mounted or `outputFileTracingIncludes` is configured in `next.config.ts`
50+
- Prompt loader caches template files in memory — restart the server after changing prompt template files (or call `clearPromptCache()` in dev)
51+
- Prompt template files have Jest snapshot tests that assert exact text — after editing any file in `prompts/`, run `npm test -- -u` to update snapshots (or `npm test -- --testPathPattern="analyzer" -u` for a specific service). Review the snapshot diff to confirm the change is intentional.

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,34 @@ DB_NAME=glooker
113113
```
114114
Then initialize: `mysql -u root < schema.sql`
115115

116+
### Prompt Customization
117+
118+
LLM prompts are stored as template files in the `prompts/` directory. You can customize prompts by editing these files or pointing to a different directory:
119+
120+
```env
121+
PROMPTS_DIR=./my-custom-prompts
122+
```
123+
124+
Template files use `{{PLACEHOLDER}}` syntax for dynamic values injected at runtime.
125+
126+
Each LLM-powered service has configurable temperature and max_tokens settings:
127+
128+
| Setting | Default | Description |
129+
|---------|---------|-------------|
130+
| `ANALYZER_TEMPERATURE` | 0 | Commit analysis (deterministic) |
131+
| `ANALYZER_MAX_TOKENS` | 256 | Commit analysis response limit |
132+
| `CHAT_AGENT_TEMPERATURE` | 0.3 | Chat assistant |
133+
| `CHAT_AGENT_MAX_TOKENS` | 1500 | Chat assistant response limit |
134+
| `CHAT_AGENT_MAX_ITERATIONS` | 5 | Max tool-call rounds per chat |
135+
| `SUMMARY_TEMPERATURE` | 0.7 | Developer summaries |
136+
| `SUMMARY_MAX_TOKENS` | 512 | Developer summary response limit |
137+
| `HIGHLIGHTS_TEMPERATURE` | 0.5 | Report comparison highlights |
138+
| `HIGHLIGHTS_MAX_TOKENS` | 512 | Highlights response limit |
139+
140+
All settings are optional — defaults match the original hardcoded values.
141+
142+
> **After editing prompt templates:** Run `npm test -- -u` to update Jest snapshots, then review the diff to confirm the change is intentional. Snapshots assert the exact prompt text to prevent accidental regressions.
143+
116144
## Docker
117145

118146
```bash

0 commit comments

Comments
 (0)