@muyichengshayu/promptx 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -54,6 +54,11 @@ promptx doctor
54
54
 
55
55
  仓库内置了禅道 Chrome 扩展:`apps/zentao-extension`
56
56
 
57
+ 注意:
58
+
59
+ - 目前 `npm install -g @muyichengshayu/promptx` 安装的正式包不包含这个扩展目录
60
+ - 如需使用禅道扩展,请先下载或克隆本仓库源码,再按下面方式手动加载
61
+
57
62
  1. 打开 `chrome://extensions`
58
63
  2. 开启开发者模式
59
64
  3. 点击“加载已解压的扩展程序”
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs'
2
2
  import path from 'node:path'
3
3
  import { pipeline } from 'node:stream/promises'
4
- import Fastify from 'fastify'
4
+ import Fastify from 'fastify'
5
5
  import cors from '@fastify/cors'
6
6
  import multipart from '@fastify/multipart'
7
7
  import fastifyStatic from '@fastify/static'
@@ -68,6 +68,18 @@ const workspaceParentDir = path.dirname(workspaceRootDir)
68
68
  const webDistDir = path.resolve(serverRootDir, '..', 'web', 'dist')
69
69
  const webIndexFile = path.join(webDistDir, 'index.html')
70
70
  const hasBuiltWebApp = fs.existsSync(webIndexFile)
71
+ const packageJsonPath = path.resolve(workspaceRootDir, 'package.json')
72
+
73
+ function readPromptxVersion() {
74
+ try {
75
+ const payload = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
76
+ return String(payload.version || '').trim() || '0.0.0'
77
+ } catch {
78
+ return '0.0.0'
79
+ }
80
+ }
81
+
82
+ const promptxVersion = readPromptxVersion()
71
83
 
72
84
  let lastExpiredPurgeAt = 0
73
85
  const sseHub = createSseHub()
@@ -321,6 +333,7 @@ if (hasBuiltWebApp) {
321
333
  app.get('/health', async () => ({ ok: true }))
322
334
 
323
335
  app.get('/api/meta', async () => ({
336
+ version: promptxVersion,
324
337
  expiryOptions: EXPIRY_OPTIONS,
325
338
  visibilityOptions: VISIBILITY_OPTIONS,
326
339
  }))
@@ -1,4 +1,4 @@
1
- import{w as oe,o as Pe,a as r,c as re,b as c,d as e,e as x,u as w,t as g,G as Fe,I as Be,n as _,F as de,m as ye,f as L,l as Ne,g as ke,T as Re,p as S,q as M,A as Me,v as ze}from"./index-D4f0mLRK.js";import{c as Ee,f as ie,X as De,S as $e,L as Se,i as Ae,d as je,s as He,j as Ce,P as Ue,b as Oe,k as Ve,B as qe,m as We,e as _e,T as Ke,A as Xe}from"./WorkbenchView-C6IvKkyE.js";/**
1
+ import{w as oe,o as Pe,a as r,c as re,b as c,d as e,e as x,u as w,t as g,G as Fe,I as Be,n as _,F as de,m as ye,f as L,l as Ne,g as ke,T as Re,p as S,q as M,A as Me,v as ze}from"./index-CJNRF_I8.js";import{c as Ee,f as ie,X as De,S as $e,L as Se,j as Ae,d as je,s as He,k as Ce,P as Ue,b as Oe,m as Ve,B as qe,n as We,e as _e,T as Ke,A as Xe}from"./WorkbenchView-361Ud4iT.js";/**
2
2
  * @license lucide-vue-next v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{w as H,q as j,p as C,i as Ue,a as c,b as v,d as a,F as Q,m as ge,n as w,t as h,e as k,u as s,G as Fe,I as qe,f as T,c as Ce,s as we,x as Oe,H as Te,o as We,g as Ke,T as Ge}from"./index-D4f0mLRK.js";import{c as Ve,u as Je,g as Se,l as Qe,S as Xe,C as He,a as Me,b as Ye,d as Ze,_ as et,e as tt,F as Be,f as De,X as st}from"./WorkbenchView-C6IvKkyE.js";/**
1
+ import{w as H,q as j,p as C,i as Ue,a as c,b as v,d as a,F as Q,m as ge,n as w,t as h,e as k,u as s,G as Fe,I as qe,f as T,c as Ce,s as we,x as Oe,H as Te,o as We,g as Ke,T as Ge}from"./index-CJNRF_I8.js";import{c as Ve,u as Je,g as Se,l as Qe,S as Xe,C as He,a as Me,b as Ye,d as Ze,_ as et,e as tt,F as Be,f as De,X as st}from"./WorkbenchView-361Ud4iT.js";/**
2
2
  * @license lucide-vue-next v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{a as o,b as d,d as e,t as c,u as m,F as x,m as b,J as k,q as $,n as S,l as C,c as y,f as w,w as T,o as L,e as g,g as B,T as E,p as _}from"./index-CJNRF_I8.js";import{d as j,h as D,X as M,i as P}from"./WorkbenchView-361Ud4iT.js";const N={class:"space-y-4"},V={class:"flex items-center justify-between gap-3"},z={class:"theme-muted-text rounded-sm border border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelStrong)] px-2 py-1 text-[11px]"},F={class:"space-y-4"},X={class:"theme-muted-text px-1 text-[10px] font-medium uppercase tracking-[0.16em]"},q=["onClick"],G={class:"flex items-start gap-3"},J={class:"mt-0.5 flex items-center gap-1.5"},K={class:"min-w-0 flex-1"},U={class:"flex items-center justify-between gap-2"},W={class:"truncate text-sm font-medium"},A={class:"theme-muted-text mt-1 text-[11px] leading-5"},H={__name:"ThemeToggle",setup(v){const{currentTheme:u,setTheme:h,themes:r}=k(),l=$(()=>{const i=r.filter(n=>n.mode==="light"),a=r.filter(n=>n.mode==="dark");return[{id:"light",label:"浅色主题",items:i},{id:"dark",label:"深色主题",items:a}].filter(n=>n.items.length)});function p(i){h(i)}return(i,a)=>(o(),d("div",N,[e("div",null,[e("div",V,[a[0]||(a[0]=e("div",{class:"theme-heading text-sm font-medium"},"界面主题",-1)),e("div",z," 当前:"+c(m(u).shortName),1)]),a[1]||(a[1]=e("div",{class:"theme-muted-text mt-1 text-xs leading-5"},"像编辑器一样切换整套配色,而不只是深浅模式。",-1))]),e("div",F,[(o(!0),d(x,null,b(l.value,n=>(o(),d("section",{key:n.id,class:"space-y-1.5"},[e("div",X,c(n.label),1),(o(!0),d(x,null,b(n.items,t=>(o(),d("button",{key:t.id,type:"button",class:S(["theme-option w-full rounded-sm border px-3 py-2 text-left transition",t.id===m(u).id?"theme-option-active":"theme-option-idle"]),onClick:s=>p(t.id)},[e("div",G,[e("div",J,[(o(!0),d(x,null,b(t.swatches,(s,f)=>(o(),d("span",{key:`${t.id}-${f}`,class:"h-3 w-3 rounded-full border border-black/10",style:C({backgroundColor:s})},null,4))),128))]),e("div",K,[e("div",U,[e("span",W,c(t.name),1),t.id===m(u).id?(o(),y(m(j),{key:0,class:"h-4 w-4 shrink-0"})):w("",!0)]),e("div",A,c(t.description),1)])])],10,q))),128))]))),128))])]))}},I={class:"panel flex w-full max-w-xl flex-col overflow-hidden"},O={class:"theme-divider flex items-start justify-between gap-4 border-b px-5 py-4"},Q={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},R={class:"space-y-6 px-5 py-5"},Y={class:"rounded-sm border border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelMuted)] px-4 py-4"},Z={class:"rounded-sm border border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelMuted)] px-4 py-4"},ee={class:"flex items-center justify-between gap-3"},te={class:"theme-muted-text mt-1 text-xs leading-5"},se={class:"rounded-sm border border-dashed border-[var(--theme-borderStrong)] bg-[var(--theme-appPanelStrong)] px-2.5 py-1 text-xs font-medium text-[var(--theme-textSecondary)]"},ie={__name:"WorkbenchSettingsDialog",props:{open:{type:Boolean,default:!1}},emits:["close"],setup(v,{emit:u}){const h=v,r=u,l=_(""),p=_(!1),i=_("");async function a(){p.value=!0,i.value="";try{const t=await P(),s=String((t==null?void 0:t.version)||"").trim();l.value=s,s||(i.value="当前服务暂未返回版本号,请确认已重启到最新版本。")}catch(t){l.value="",i.value=(t==null?void 0:t.message)||"版本信息读取失败。"}finally{p.value=!1}}function n(t){h.open&&t.key==="Escape"&&r("close")}return T(()=>h.open,t=>{if(document.body.classList.toggle("overflow-hidden",t),t){window.addEventListener("keydown",n),a();return}window.removeEventListener("keydown",n)},{immediate:!0}),L(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",n)}),(t,s)=>(o(),y(E,{to:"body"},[v.open?(o(),d("div",{key:0,class:"fixed inset-0 z-[70] flex items-center justify-center bg-black/45 px-4 py-6 backdrop-blur-sm",onClick:s[1]||(s[1]=B(f=>r("close"),["self"]))},[e("section",I,[e("div",O,[e("div",null,[e("div",Q,[g(m(D),{class:"h-4 w-4"}),s[2]||(s[2]=e("span",null,"设置",-1))]),s[3]||(s[3]=e("p",{class:"theme-muted-text mt-1 text-xs leading-5"},"先把界面主题收到这里,后面其他偏好也可以继续往里放。",-1))]),e("button",{type:"button",class:"theme-icon-button h-8 w-8 shrink-0",onClick:s[0]||(s[0]=f=>r("close"))},[g(m(M),{class:"h-4 w-4"})])]),e("div",R,[e("section",Y,[g(H)]),e("section",Z,[e("div",ee,[e("div",null,[s[4]||(s[4]=e("div",{class:"theme-heading text-sm font-medium"},"版本信息",-1)),e("p",te,c(i.value||"当前已安装的 PromptX 版本。"),1)]),e("span",se,c(p.value?"读取中...":l.value?`v${l.value}`:"不可用"),1)])])])])])):w("",!0)]))}};export{ie as default};