Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions plugins/prompt-forge/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 1.7.0 - 2026-11-16

### ✨ Features

* **提示词描述字段** — 管理页、新建向导、快速保存均支持编辑描述(仅自己可见,用于记录用途/使用场景);提示词卡片与变量填写页会展示描述,全局搜索覆盖描述字段
* **内置「通用:提示词优化器」** — 新增可直接使用的元提示词种子:粘贴原始提示词即可让 AI 输出结构化优化版本与改动说明;新增 `seedVersion` 批次机制,老用户升级后自动补齐新增内置条目,已删除或已清空的条目不会重复注入
* **面板宽度拖拽调节** — 空间侧栏、管理页列表、组合页两侧栏均支持拖拽调宽,松手自动保存、下次启动恢复,双击手柄恢复默认;宽度随设置导出/导入,导入时校验合法性
* **插件窗口响应式布局** — 管理页窄窗口切换为列表/编辑器单栏工作流;空间侧栏可收为图标栏、项目面板变为抽屉;组合页窄窗口下中央画布优先、资源列表收进抽屉

### 🎨 Design

* **整体紧凑化** — 顶部导航 52px → 44px,搜索/筛选/多选合并一行,卡片与操作栏密度收紧
* **正文编辑体验** — 正文编辑器改用常规字体与更舒展的行高,描述输入框默认更矮

### 🐛 Bug Fixes

* **面板拖拽在插件中失效** — 拖拽实现从 Pointer Events 切换为 mouse 事件(ZTools WebView 中 pointermove 不可靠),并下调各面板折叠断点,避免插件窗口下手柄被隐藏
* **填写页布局回退** — 变量填写页改为左右分栏,仅视口 ≤560px 时才上下堆叠

## 1.6.1 - 2026-11-09

### 🐛 Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion plugins/prompt-forge/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PromptForge(词匠)开发路线图

> 本文档统一维护:已实现功能、已修复问题、未来待实现功能。
> 当前版本:v1.6.1(2026-11)
> 当前版本:v1.7.0(2026-11)

---

Expand Down
3 changes: 3 additions & 0 deletions plugins/prompt-forge/docs/需求.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
* [X] 提示词中变量,如果在二次编辑提示词中变量时,删除了某个变量,但是打开提示词后,发现还是要输入之前已经删除的变量内容,经过查看发现是在提示的设置中,变量选项卡中还是有这个变量,就是这个提示词正文的变量没有同步到变量选项卡中,这里应该是按正文为主
* [X] 提示词使用历史中,对于有变量的提示词,不会显示变量内容,应该就是把变量内容也加入其中,这样才算一个完整的提示词历史吧,因为变量时历史内容
* [ ] 提示词变量的默认值,就是变量可以设置是否是必填的,以及默认值,如果不填就是默认值等,这一块你看如何设计比较好
* [X] 添加提示词描述内容,用户自己设置,可以作为描述或者是解释提示使用场景等,给自己看的
* [X] 内置一个优化提示词的通用提示词,让用户可以直接拿来用的优秀提示词
* [ ] UI优化,目前提示词空间太小
4 changes: 2 additions & 2 deletions plugins/prompt-forge/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/prompt-forge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prompt-forge",
"version": "1.6.1",
"version": "1.7.0",
"description": "词匠 (PromptForge) 是一款专为AI创作者与开发者打造的提示词资产管理插件,集模板化编排、变量注入、版本控制与一键调用为一体,助你像工匠打磨作品一样,系统化地沉淀、优化并复用高质量提示词。",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/prompt-forge/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "词匠",
"description": "词匠 (PromptForge) 是一款专为AI创作者与开发者打造的提示词资产管理插件,集模板化编排、变量注入、版本控制与一键调用为一体,助你像工匠打磨作品一样,系统化地沉淀、优化并复用高质量提示词。",
"author": "lunan",
"version": "1.6.1",
"version": "1.7.0",
"main": "dist/index.html",
"preload": "dist/preload/services.js",
"logo": "dist/logo.png",
Expand Down
2 changes: 1 addition & 1 deletion plugins/prompt-forge/public/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "词匠",
"description": "词匠 (PromptForge) 是一款专为AI创作者与开发者打造的提示词资产管理插件,集模板化编排、变量注入、版本控制与一键调用为一体,助你像工匠打磨作品一样,系统化地沉淀、优化并复用高质量提示词。",
"author": "lunan",
"version": "1.6.1",
"version": "1.7.0",
"main": "index.html",
"preload": "preload/services.js",
"logo": "logo.png",
Expand Down
25 changes: 25 additions & 0 deletions plugins/prompt-forge/scripts/bump-lock-version.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// 将 package-lock.json 的根版本号(顶层 version 与 packages."" 条目)更新为指定版本。
// 用法:node scripts/bump-lock-version.mjs <version>
// 独立成脚本是为了避开 PowerShell 内联 node -e 的引号/转义陷阱。
import { readFileSync, writeFileSync } from 'node:fs'

const version = process.argv[2]
if (!version || !/^\d+\.\d+\.\d+$/.test(version)) {
console.error('用法:node scripts/bump-lock-version.mjs <x.y.z>')
process.exit(1)
}

const path = 'package-lock.json'
let content = readFileSync(path, 'utf8')

// 顶层 "version"(仅 2 空格缩进),不动依赖包的版本号
content = content.replace(/^ {2}"version": "[^"]+"/m, ` "version": "${version}"`)

// packages."" 根条目的版本号
content = content.replace(
/(""\s*:\s*\{\s*"name"\s*:\s*"prompt-forge",\s*"version"\s*:\s*")[^"]+(")/,
`$1${version}$2`,
)

writeFileSync(path, content)
console.log(`package-lock.json → ${version}`)
8 changes: 3 additions & 5 deletions plugins/prompt-forge/scripts/release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,9 @@ if ($Version) {
Set-Content $f $content -NoNewline
Write-Host " ✓ $f" -ForegroundColor Green
}
# package-lock.json
$lock = Get-Content "package-lock.json" -Raw | ConvertFrom-Json
$lock.version = $Version
if ($lock.packages.'') { $lock.packages.''.version = $Version }
$lock | ConvertTo-Json -Depth 10 | Set-Content "package-lock.json" -NoNewline
# package-lock.json(独立 node 脚本处理:PS Core 的 ConvertFrom-Json 不支持空属性名 "",
# PowerShell 内联 node -e 的引号转义极易踩坑)
node scripts/bump-lock-version.mjs $Version
Write-Host " ✓ package-lock.json" -ForegroundColor Green
# ROADMAP.md
$roadmap = Get-Content "ROADMAP.md" -Raw
Expand Down
15 changes: 8 additions & 7 deletions plugins/prompt-forge/src/components/CommandBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ async function toggleTheme() {

<style scoped>
.header {
height: 52px; flex-shrink: 0;
height: 44px; flex-shrink: 0;
display: flex; align-items: center;
gap: 16px; padding: 0 20px;
gap: 12px; padding: 0 12px;
background: var(--pf-bg-elevated);
border-bottom: 1px solid var(--pf-border);
transition: background 0.3s, border-color 0.3s;
}
.nav-left { display: flex; gap: 2px; flex-shrink: 0; }
.nav-btn {
display: flex; align-items: center; gap: 6px;
padding: 6px 14px;
height: 32px; padding: 0 12px;
border-radius: var(--pf-radius-sm);
font-size: 13px; font-weight: 500;
color: var(--pf-text-muted);
Expand All @@ -89,7 +89,7 @@ async function toggleTheme() {

.nav-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; margin-left: auto; }
.icon-btn {
width: 34px; height: 34px;
width: 30px; height: 30px;
border-radius: var(--pf-radius-sm);
display: flex; align-items: center; justify-content: center;
color: var(--pf-text-muted);
Expand All @@ -98,8 +98,9 @@ async function toggleTheme() {
.icon-btn:hover { background: var(--pf-surface-raised); color: var(--pf-text); }
.theme-toggle:hover { color: var(--pf-accent); }

@media (max-width: 620px) {
.header { gap: 8px; padding: 0 8px; }
.nav-btn { width: 38px; padding: 6px; justify-content: center; font-size: 0; }
@media (max-width: 700px) {
.header { gap: 6px; padding: 0 8px; }
.nav-btn { width: 36px; padding: 0; justify-content: center; font-size: 0; }
.nav-btn svg { opacity: 0.8; }
}
</style>
17 changes: 14 additions & 3 deletions plugins/prompt-forge/src/components/FillPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function onTextareaInput(name: string, e: Event) {
<button :class="['mode-btn', { active: previewMode === 'markdown' }]" @click="previewMode = 'markdown'">Markdown</button>
</div>
</div>
<div v-if="unit?.description" class="preview-desc">{{ unit.description }}</div>
<div v-if="previewMode === 'text'" class="preview-body">{{ preview }}</div>
<div v-else class="preview-body markdown-body" v-html="markdownHtml"></div>
</div>
Expand Down Expand Up @@ -207,8 +208,8 @@ function onTextareaInput(name: string, e: Event) {
}
.var-textarea::placeholder { color: var(--pf-text-faint); }
.form-actions {
height: 52px; min-height: 52px;
padding: 12px 20px;
height: 46px; min-height: 46px;
padding: 8px 16px;
display: flex; align-items: center; gap: 10px;
border-top: 1px solid var(--pf-border);
background: var(--pf-bg-elevated);
Expand All @@ -234,6 +235,16 @@ function onTextareaInput(name: string, e: Event) {
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview-meta { display: flex; gap: 4px; flex-shrink: 0; }
.preview-desc {
flex-shrink: 0;
padding: 8px 20px;
font-size: 12px; line-height: 1.5;
color: var(--pf-text-muted);
background: var(--pf-surface-raised);
border-bottom: 1px solid var(--pf-border);
white-space: pre-wrap; word-break: break-word;
max-height: 84px; overflow-y: auto;
}
.tag {
font-size: 10px; font-weight: 500;
padding: 2px 7px; border-radius: var(--pf-radius-pill);
Expand All @@ -257,7 +268,7 @@ function onTextareaInput(name: string, e: Event) {
line-height: 1.7;
}

@media (max-width: 700px) {
@media (max-width: 560px) {
.fill-body:not(.single) {
grid-template-columns: 1fr;
grid-template-rows: minmax(180px, 1fr) minmax(180px, 1fr);
Expand Down
24 changes: 20 additions & 4 deletions plugins/prompt-forge/src/components/ManageContentTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import { renderMarkdown } from '../utils/markdown'
const props = defineProps<{
editTitle: string
editBody: string
editDescription: string
}>()

const emit = defineEmits<{
(e: 'update:editTitle', v: string): void
(e: 'update:editBody', v: string): void
(e: 'update:editDescription', v: string): void
}>()

// 正文视图模式:edit 编辑 / preview 预览
Expand All @@ -19,6 +21,18 @@ const markdownHtml = computed(() => renderMarkdown(props.editBody))

<template>
<div class="field"><label>标题</label><input :value="editTitle" @input="emit('update:editTitle', ($event.target as HTMLInputElement).value)" /></div>
<div class="field">
<div class="body-label-row">
<label>描述</label>
<span class="field-hint">仅自己可见 · 记录用途或使用场景</span>
</div>
<textarea
:value="editDescription"
class="desc-editor"
placeholder="例如:给后端做接口评审时用,重点让 AI 关注错误码与幂等"
@input="emit('update:editDescription', ($event.target as HTMLTextAreaElement).value)"
/>
</div>
<div class="field">
<div class="body-label-row">
<label>正文</label>
Expand All @@ -38,13 +52,15 @@ const markdownHtml = computed(() => renderMarkdown(props.editBody))
</template>

<style scoped>
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--pf-text-secondary); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.field input, .field textarea { width: 100%; border: 1px solid var(--pf-border); background: var(--pf-surface); border-radius: var(--pf-radius-sm); padding: 10px 14px; font-size: 13.5px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--pf-text-secondary); margin-bottom: 5px; }
.field input, .field textarea { width: 100%; border: 1px solid var(--pf-border); background: var(--pf-surface); border-radius: var(--pf-radius-sm); padding: 9px 12px; font-size: 13.5px; }
.field input:focus, .field textarea:focus { border-color: var(--pf-accent); outline: none; box-shadow: 0 0 0 3px var(--pf-accent-soft); }
.body-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.body-label-row label { margin-bottom: 0; }
.body-editor { min-height: 250px; max-height: 50vh; resize: vertical; font-family: var(--pf-font-mono); line-height: 1.6; }
.field-hint { font-size: 11px; font-weight: 400; color: var(--pf-text-faint); }
.desc-editor { min-height: 52px; max-height: 120px; resize: vertical; line-height: 1.5; }
.body-editor { min-height: 240px; max-height: 55vh; resize: vertical; font-family: var(--pf-font); line-height: 1.65; }
.body-preview {
min-height: 250px; max-height: 50vh; overflow-y: auto;
border: 1px solid var(--pf-border); border-radius: var(--pf-radius-sm);
Expand Down
51 changes: 39 additions & 12 deletions plugins/prompt-forge/src/components/ProjectPanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref } from 'vue'
import { computed, ref } from 'vue'
import { FolderInput, Trash2, Check, ArrowLeft } from 'lucide-vue-next'
import { usePromptStore } from '../stores/prompt'
import { useProjectStore } from '../stores/project'
Expand All @@ -10,6 +10,8 @@ const prompt = usePromptStore()
const projectStore = useProjectStore()

const showNewProject = ref(false)
const projectListOpen = ref(false)
const currentProjectName = computed(() => projectStore.items.value.find(p => p.id === prompt.filterProjectId.value)?.name || '全部项目提示词')
const newProjectName = ref('')
const newProjectGroup = ref<ProjectGroup>('开发')
const newProjectDesc = ref('')
Expand All @@ -31,6 +33,12 @@ function closeCtxMenu() {
showMoveGroup.value = false
}

function selectProject(id: string) {
prompt.filterProjectId.value = id
prompt.keyboardIndex.value = 0
projectListOpen.value = false
}

async function createProject() {
if (!newProjectName.value.trim()) return
try {
Expand Down Expand Up @@ -76,7 +84,8 @@ defineExpose({ closeCtxMenu })

<template>
<div class="project-layout">
<div class="project-panel">
<button v-if="projectListOpen" class="project-mask" aria-label="关闭项目列表" @click="projectListOpen = false"></button>
<div :class="['project-panel', { open: projectListOpen }]">
<div class="project-header">
<span class="ph-title">项目</span>
<button class="btn" @click="showNewProject = !showNewProject">+ 新建</button>
Expand All @@ -92,7 +101,7 @@ defineExpose({ closeCtxMenu })
<div class="group-label">{{ group }}</div>
<div v-for="p in projectStore.groupedProjects.value[group]" :key="p.id"
:class="['project-item', { active: prompt.filterProjectId.value === p.id }]"
@click="prompt.filterProjectId.value = p.id; prompt.keyboardIndex.value = 0"
@click="selectProject(p.id)"
@contextmenu="onProjectContextMenu($event, p)">
<span class="pi-name">{{ p.name }}</span>
<span class="pi-count">{{ prompt.liveItems.value.filter(i => i.projectId === p.id).length }}</span>
Expand All @@ -101,13 +110,20 @@ defineExpose({ closeCtxMenu })
</div>
<div
:class="['project-item', { active: !prompt.filterProjectId.value }]"
@click="prompt.filterProjectId.value = ''; prompt.keyboardIndex.value = 0">
@click="selectProject('')">
<span class="pi-name">全部项目提示词</span>
<span class="pi-count">{{ prompt.liveItems.value.filter(i => i.projectId).length }}</span>
</div>
</div>
</div>
<div class="project-content">
<div class="project-compact-bar">
<button class="project-picker" @click="projectListOpen = true">
<FolderInput :size="14" />
<span>{{ currentProjectName }}</span>
<span class="picker-action">切换</span>
</button>
</div>
<slot />
</div>

Expand All @@ -133,9 +149,9 @@ defineExpose({ closeCtxMenu })
</template>

<style scoped>
.project-layout { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.project-layout { flex: 1; min-height: 0; display: flex; overflow: hidden; position: relative; }
.project-panel {
width: 200px; flex-shrink: 0;
width: 180px; flex-shrink: 0;
display: flex; flex-direction: column;
border-right: 1px solid var(--pf-border);
background: var(--pf-bg-elevated);
Expand All @@ -148,6 +164,11 @@ defineExpose({ closeCtxMenu })
.np-select { height: 32px; padding: 0 8px; border: 1px solid var(--pf-border); border-radius: var(--pf-radius-sm); background: var(--pf-surface); font-size: 12px; }
.project-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.project-content { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.project-compact-bar { display: none; flex-shrink: 0; padding: 8px 12px 0; }
.project-picker { width: 100%; height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--pf-border); border-radius: var(--pf-radius-sm); background: var(--pf-surface); color: var(--pf-text-secondary); font-size: 12px; }
.project-picker span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.picker-action { color: var(--pf-accent); font-size: 11px; }
.project-mask { display: none; }
.group-label { font-size: 10.5px; font-weight: 700; color: var(--pf-text-faint); text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 4px 4px; }
.project-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-radius: var(--pf-radius-sm); cursor: pointer; transition: all 0.12s; }
.project-item:hover { background: var(--pf-surface-hover); }
Expand All @@ -164,11 +185,17 @@ defineExpose({ closeCtxMenu })
.ctx-menu-item.danger { color: var(--pf-danger, #ef4444); }
.ctx-menu-item.danger:hover { background: rgba(239, 68, 68, 0.08); }

@media (max-width: 700px) {
.project-panel { width: 150px; }
.project-header, .new-project-form { padding: 8px; }
.project-header .btn { padding: 0 8px; }
.project-list { padding: 4px; }
.project-item { padding: 7px 6px; }
@media (max-width: 900px) {
.project-compact-bar { display: block; }
.project-panel {
position: absolute; z-index: 20; inset: 0 auto 0 0;
width: min(260px, 82%);
transform: translateX(-102%);
transition: transform 0.18s ease;
box-shadow: var(--pf-shadow-lg);
}
.project-panel.open { transform: translateX(0); }
.project-mask { display: block; position: absolute; z-index: 19; inset: 0; background: rgba(0, 0, 0, 0.2); }
.project-header, .new-project-form { padding: 8px 12px; }
}
</style>
Loading
Loading