Initial commit: Brachnha Insight project setup

- Next.js 14+ with App Router and TypeScript
- Tailwind CSS and ShadCN UI styling
- Zustand state management
- Dexie.js for IndexedDB (local-first data)
- Auth.js v5 for authentication
- BMAD framework integration

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Max
2026-01-26 12:28:43 +07:00
commit 3fbbb1a93b
812 changed files with 150531 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import { describe, it, expect } from 'vitest';
// @ts-ignore - Module likely not created yet
import { PromptEngine } from '@/lib/llm/prompt-engine';
describe('PromptEngine (Ghostwriter)', () => {
it('should construct a grounded prompt with user insight', () => {
// GIVEN: A user insight and chat history
const history = [
{ role: 'user', content: 'I feel stupid.' },
{ role: 'assistant', content: 'Why?' },
{ role: 'user', content: 'I made a typo.' }
];
const insight = "I need a checklist for typos.";
// WHEN: Constructing the prompt
// @ts-ignore
const prompt = PromptEngine.constructGhostwriterPrompt(history, insight);
// THEN: The system prompt should enforce grounding
expect(prompt[0].role).toBe('system');
expect(prompt[0].content).toContain('You are an expert Ghostwriter');
expect(prompt[0].content).toContain('Ground your answer in the user insight'); // R-2.1 Mitigation
// AND: The user insight should be clearly labeled
const lastMessage = prompt[prompt.length - 1];
expect(lastMessage.content).toContain(`INSIGHT: ${insight}`);
});
});