diff --git a/CLAUDE.md b/CLAUDE.md index 892e4c30..d7fa7458 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -222,7 +222,7 @@ interface Block { - Horizontal rules (`---`) - Paragraphs (default) -`exportDiff(blocks, annotations, globalAttachments)` generates human-readable feedback for Claude. Images are referenced by name: `[image-name] /tmp/path...`. +`exportAnnotations(blocks, annotations, globalAttachments)` generates human-readable feedback for Claude. Images are referenced by name: `[image-name] /tmp/path...`. ## Annotation System diff --git a/apps/marketing/src/content/docs/getting-started/ui-settings.md b/apps/marketing/src/content/docs/getting-started/ui-settings.md index 2f182d6b..3a0075df 100644 --- a/apps/marketing/src/content/docs/getting-started/ui-settings.md +++ b/apps/marketing/src/content/docs/getting-started/ui-settings.md @@ -92,7 +92,7 @@ Controls what the **Cmd/Ctrl+S** keyboard shortcut does. | Option | Behavior | |--------|----------| | **Ask each time** (default) | Opens the Export dialog | -| **Download Diff** | Downloads the diff file directly | +| **Download Annotations** | Downloads the annotations file directly | | **Obsidian** | Saves directly to your Obsidian vault (only shown if Obsidian is enabled) | | **Bear** | Saves directly to Bear (only shown if Bear is enabled) | diff --git a/apps/portal/ANNOTATE.md b/apps/portal/ANNOTATE.md index 1a78c55d..3c346aa9 100644 --- a/apps/portal/ANNOTATE.md +++ b/apps/portal/ANNOTATE.md @@ -85,7 +85,7 @@ Users can also paste or upload images and attach them to annotations. When the user clicks "Send Annotations" (or presses `Cmd+Enter`), the frontend: -1. Calls `exportDiff(blocks, annotations, globalAttachments)` from `packages/ui/utils/parser.ts` to generate a structured markdown summary +1. Calls `exportAnnotations(blocks, annotations, globalAttachments)` from `packages/ui/utils/parser.ts` to generate a structured markdown summary 2. POSTs the result to `/api/feedback` The export format looks like: @@ -165,7 +165,7 @@ Agent receives structured feedback, acts on it | `packages/server/annotate.ts` | Annotate server implementation | | `packages/editor/App.tsx` | Frontend — detects `annotateMode`, adjusts UI | | `packages/ui/components/Viewer.tsx` | Markdown renderer + web-highlighter annotation | -| `packages/ui/utils/parser.ts` | `parseMarkdownToBlocks()` and `exportDiff()` | +| `packages/ui/utils/parser.ts` | `parseMarkdownToBlocks()` and `exportAnnotations()` | | `apps/hook/commands/plannotator-annotate.md` | Claude Code slash command definition | | `apps/opencode-plugin/commands/plannotator-annotate.md` | OpenCode slash command definition | diff --git a/packages/editor/App.tsx b/packages/editor/App.tsx index c50255e7..281833a1 100644 --- a/packages/editor/App.tsx +++ b/packages/editor/App.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, useMemo, useRef } from 'react'; -import { parseMarkdownToBlocks, exportDiff, extractFrontmatter, Frontmatter } from '@plannotator/ui/utils/parser'; +import { parseMarkdownToBlocks, exportAnnotations, extractFrontmatter, Frontmatter } from '@plannotator/ui/utils/parser'; import { Viewer, ViewerHandle } from '@plannotator/ui/components/Viewer'; import { AnnotationPanel } from '@plannotator/ui/components/AnnotationPanel'; import { ExportModal } from '@plannotator/ui/components/ExportModal'; @@ -365,7 +365,7 @@ const App: React.FC = () => { const [shareBaseUrl, setShareBaseUrl] = useState(undefined); const [repoInfo, setRepoInfo] = useState<{ display: string; branch?: string } | null>(null); const [showExportDropdown, setShowExportDropdown] = useState(false); - const [initialExportTab, setInitialExportTab] = useState<'share' | 'diff' | 'notes'>(); + const [initialExportTab, setInitialExportTab] = useState<'share' | 'annotations' | 'notes'>(); const [noteSaveToast, setNoteSaveToast] = useState<{ type: 'success' | 'error'; message: string } | null>(null); const viewerRef = useRef(null); const containerRef = useRef(null); @@ -584,7 +584,7 @@ const App: React.FC = () => { // Include annotations as feedback if any exist (for OpenCode "approve with notes") if (annotations.length > 0 || globalAttachments.length > 0) { - body.feedback = diffOutput; + body.feedback = annotationsOutput; } await fetch('/api/approve', { @@ -606,7 +606,7 @@ const App: React.FC = () => { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ - feedback: diffOutput, + feedback: annotationsOutput, planSave: { enabled: planSaveSettings.enabled, ...(planSaveSettings.customPath && { customPath: planSaveSettings.customPath }), @@ -627,7 +627,7 @@ const App: React.FC = () => { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ - feedback: diffOutput, + feedback: annotationsOutput, annotations, }), }); @@ -733,19 +733,19 @@ const App: React.FC = () => { // This is just a placeholder for future custom logic }; - const diffOutput = useMemo(() => exportDiff(blocks, annotations, globalAttachments), [blocks, annotations, globalAttachments]); + const annotationsOutput = useMemo(() => exportAnnotations(blocks, annotations, globalAttachments), [blocks, annotations, globalAttachments]); // Quick-save handlers for export dropdown and keyboard shortcut - const handleDownloadDiff = () => { + const handleDownloadAnnotations = () => { setShowExportDropdown(false); - const blob = new Blob([diffOutput], { type: 'text/plain' }); + const blob = new Blob([annotationsOutput], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; - a.download = 'annotations.diff'; + a.download = 'annotations.md'; a.click(); URL.revokeObjectURL(url); - setNoteSaveToast({ type: 'success', message: 'Downloaded diff' }); + setNoteSaveToast({ type: 'success', message: 'Downloaded annotations' }); setTimeout(() => setNoteSaveToast(null), 3000); }; @@ -803,7 +803,7 @@ const App: React.FC = () => { const bearOk = getBearSettings().enabled; if (defaultApp === 'download') { - handleDownloadDiff(); + handleDownloadAnnotations(); } else if (defaultApp === 'obsidian' && obsOk) { handleQuickSaveToNotes('obsidian'); } else if (defaultApp === 'bear' && bearOk) { @@ -819,7 +819,7 @@ const App: React.FC = () => { }, [ showExport, showFeedbackPrompt, showClaudeCodeWarning, showAgentWarning, showPermissionModeSetup, showUIFeaturesSetup, pendingPasteImage, - submitted, isApiMode, markdown, diffOutput, + submitted, isApiMode, markdown, annotationsOutput, ]); // Close export dropdown on click outside @@ -1009,13 +1009,13 @@ const App: React.FC = () => { )} {isApiMode && isObsidianConfigured() && ( )} {showNotesTab && ( )} diff --git a/packages/ui/components/Settings.tsx b/packages/ui/components/Settings.tsx index d88f394c..cc39e172 100644 --- a/packages/ui/components/Settings.tsx +++ b/packages/ui/components/Settings.tsx @@ -534,7 +534,7 @@ export const Settings: React.FC = ({ taterMode, onTaterModeChange className="w-full px-3 py-2 bg-muted rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-primary/50 cursor-pointer" > - + {obsidian.enabled && } {bear.enabled && } @@ -542,7 +542,7 @@ export const Settings: React.FC = ({ taterMode, onTaterModeChange {defaultNotesApp === 'ask' ? 'Opens Export dialog with Notes tab' : defaultNotesApp === 'download' - ? `${navigator.platform?.includes('Mac') ? 'Cmd' : 'Ctrl'}+S downloads the diff file` + ? `${navigator.platform?.includes('Mac') ? 'Cmd' : 'Ctrl'}+S downloads the annotations file` : `${navigator.platform?.includes('Mac') ? 'Cmd' : 'Ctrl'}+S saves directly to ${defaultNotesApp === 'obsidian' ? 'Obsidian' : 'Bear'}`} diff --git a/packages/ui/utils/parser.ts b/packages/ui/utils/parser.ts index 7e0b454a..f29e76c7 100644 --- a/packages/ui/utils/parser.ts +++ b/packages/ui/utils/parser.ts @@ -243,7 +243,7 @@ export const parseMarkdownToBlocks = (markdown: string): Block[] => { return blocks; }; -export const exportDiff = (blocks: Block[], annotations: any[], globalAttachments: ImageAttachment[] = []): string => { +export const exportAnnotations = (blocks: Block[], annotations: any[], globalAttachments: ImageAttachment[] = []): string => { if (annotations.length === 0 && globalAttachments.length === 0) { return 'No changes detected.'; } diff --git a/tests/UI-TESTING-CHECKLIST.md b/tests/UI-TESTING-CHECKLIST.md index e57e39c5..75f84eaf 100644 --- a/tests/UI-TESTING-CHECKLIST.md +++ b/tests/UI-TESTING-CHECKLIST.md @@ -103,7 +103,7 @@ The TOC sidebar provides navigation for long documents. **Export & Formatting:** -- [ ] Export diff shows annotations in readable format +- [ ] Export shows annotations in readable format - [ ] Format follows: "- **DELETION** (line X): [original text]" - [ ] Global comments appear at top of export - [ ] All annotation types exported correctly