Files
Momento/memento-note/app/actions/paragraph-refactor.ts
Sepehr Ramezani e4d4e23dc7 chore: clean up repo for public release
- Remove BMAD framework, IDE configs, dev screenshots, test files,
  internal docs, and backup files
- Rename keep-notes/ to memento-note/
- Update all references from keep-notes to memento-note
- Add Apache 2.0 license with Commons Clause (non-commercial restriction)
- Add clean .gitignore and .env.docker.example
2026-04-20 22:48:06 +02:00

50 lines
1.1 KiB
TypeScript

'use server'
import { paragraphRefactorService, RefactorMode, RefactorResult } from '@/lib/ai/services/paragraph-refactor.service'
export interface RefactorResponse {
result: RefactorResult
}
/**
* Refactor a paragraph with a specific mode
*/
export async function refactorParagraph(
content: string,
mode: RefactorMode
): Promise<RefactorResponse> {
try {
const result = await paragraphRefactorService.refactor(content, mode)
return { result }
} catch (error) {
console.error('Error refactoring paragraph:', error)
throw error
}
}
/**
* Get all 3 refactor options at once
*/
export async function refactorParagraphAllModes(
content: string
): Promise<{ results: RefactorResult[] }> {
try {
const results = await paragraphRefactorService.refactorAllModes(content)
return { results }
} catch (error) {
console.error('Error refactoring paragraph in all modes:', error)
throw error
}
}
/**
* Validate word count before refactoring
*/
export async function validateRefactorWordCount(
content: string
): Promise<{ valid: boolean; error?: string }> {
return paragraphRefactorService.validateWordCount(content)
}