feat(prompts+i18n): add prompt management and improve prompt editor i18n (#193)

* feat(prompts): add prompt management across Tauri service and React UI

- backend: add commands/prompt.rs, services/prompt.rs, register in commands/mod.rs and lib.rs, refine app_config.rs
- frontend: add PromptPanel, PromptFormModal, PromptListItem, MarkdownEditor, usePromptActions, integrate in App.tsx
- api: add src/lib/api/prompts.ts
- i18n: update src/i18n/locales/{en,zh}.json
- build: update package.json and pnpm-lock.yaml

* feat(i18n): improve i18n for prompts and Markdown editor

- update src/i18n/locales/{en,zh}.json keys and strings
- apply i18n in PromptFormModal, PromptPanel, and MarkdownEditor
- align prompt text with src-tauri/src/services/prompt.rs

* feat(prompts): add enable/disable toggle and simplify panel UI

- Add PromptToggle component and integrate in prompt list items
- Implement toggleEnabled with optimistic update; enable via API, disable via upsert with enabled=false;
  reload after success
- Simplify PromptPanel: remove file import and current-file preview to keep CRUD flow focused
- Tweak header controls style (use mcp variant) and minor copy: rename “Prompt Management” to “Prompts”
- i18n: add disableSuccess/disableFailed messages
- Backend (Tauri): prevent duplicate backups when importing original prompt content

* style: unify code formatting with trailing commas

* feat(prompts): add Gemini filename support to PromptFormModal

Update filename mapping to use Record<AppId, string> pattern, supporting
GEMINI.md alongside CLAUDE.md and AGENTS.md.

* fix(prompts): sync enabled prompt to file when updating

When updating a prompt that is currently enabled, automatically sync
the updated content to the corresponding live file (CLAUDE.md/AGENTS.md/GEMINI.md).

This ensures the active prompt file always reflects the latest content
when editing enabled prompts.
This commit is contained in:
YoVinchen
2025-11-12 16:41:41 +08:00
committed by GitHub
parent 346f916048
commit 155532ea8c
20 changed files with 1302 additions and 1 deletions

View File

@@ -550,5 +550,46 @@
"description": "Context7 documentation search tool providing latest library docs and code examples, with higher limits when configured with a key"
}
}
},
"prompts": {
"manage": "Prompts",
"title": "{{appName}} Prompt Management",
"claudeTitle": "Claude Prompt Management",
"codexTitle": "Codex Prompt Management",
"add": "Add Prompt",
"edit": "Edit Prompt",
"addTitle": "Add {{appName}} Prompt",
"editTitle": "Edit {{appName}} Prompt",
"import": "Import Existing",
"count": "{{count}} prompts",
"enabled": "Enabled",
"enable": "Enable",
"enabledName": "Enabled: {{name}}",
"noneEnabled": "No prompt enabled",
"currentFile": "Current {{filename}} Content",
"empty": "No prompts yet",
"emptyDescription": "Click the button above to add or import prompts",
"loading": "Loading...",
"name": "Name",
"namePlaceholder": "e.g., Default Project Prompt",
"description": "Description",
"descriptionPlaceholder": "Optional description",
"content": "Content",
"contentPlaceholder": "# {{filename}}\n\nEnter prompt content here...",
"loadFailed": "Failed to load prompts",
"saveSuccess": "Saved successfully",
"saveFailed": "Failed to save",
"deleteSuccess": "Deleted successfully",
"deleteFailed": "Failed to delete",
"enableSuccess": "Enabled successfully",
"enableFailed": "Failed to enable",
"disableSuccess": "Disabled successfully",
"disableFailed": "Failed to disable",
"importSuccess": "Imported successfully",
"importFailed": "Failed to import",
"confirm": {
"deleteTitle": "Confirm Delete",
"deleteMessage": "Are you sure you want to delete prompt \"{{name}}\"?"
}
}
}