opencode-prompt-recorder 1.7.9 → 1.8.1

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
@@ -31,10 +31,11 @@ bun add -g opencode-prompt-recorder
31
31
 
32
32
  ## 工作原理
33
33
 
34
- 1. 插件监听 OpenCode 消息事件(`message.updated` 和 `message.part.updated`)
34
+ 1. 插件监听 OpenCode 事件(`message.updated`、`message.part.updated`、`session.created`、`session.updated`)
35
35
  2. 每次用户消息时,提取提示词文本和会话 ID
36
36
  3. 同一 session 的消息合并到同一个文件,按日期组织存储
37
- 4. 文件首行记录 SessionID,每条消息带有时间戳
37
+ 4. task 工具创建的子 agent 会话自动存入 `task/` 子目录,与主会话隔离
38
+ 5. 文件首行记录 SessionID,每条消息带有时间戳
38
39
 
39
40
  ## 文件结构
40
41
 
@@ -43,6 +44,11 @@ bun add -g opencode-prompt-recorder
43
44
  ```
44
45
  .agent/
45
46
  └── prompts/
47
+ ├── task/
48
+ │ └── 2026/
49
+ │ └── 06/
50
+ │ └── 05/
51
+ │ └── 2606051003-子任务分析.txt
46
52
  └── 2026/
47
53
  └── 06/
48
54
  └── 05/
@@ -66,11 +72,11 @@ bun add -g opencode-prompt-recorder
66
72
  ```markdown
67
73
  ============ SessionID: ses_xxxxx ============
68
74
 
69
- ============ 2026-06-05 10:05 ============
75
+ ============ 2026-06-05 10:05:30 ============
70
76
 
71
77
  什么是 AI?
72
78
 
73
- ============ 2026-06-05 10:50 ============
79
+ ============ 2026-06-05 10:50:15 ============
74
80
 
75
81
  如何编写 hello world 程序?
76
82
  ```
@@ -90,6 +96,7 @@ bun add -g opencode-prompt-recorder
90
96
  - 同一 session 的后续消息追加到同一文件,文件名不变
91
97
  - 文件名中的特殊字符会被自动清理(移除 `<>:"/\|?*` 及控制字符)
92
98
  - 文件名截断至最多 40 个字符
99
+ - 若目标文件名已存在(极低概率),自动附加 `-xxxx` 随机后缀以避免覆盖
93
100
 
94
101
  ## 使用场景
95
102
 
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- import{mkdir as T,appendFile as V,writeFile as W,readFile as z,rename as lt}from"fs/promises";import{join as l,dirname as B,basename as gt}from"path";import{fileURLToPath as mt}from"url";import{readFile as et,rm as nt}from"fs/promises";import{basename as h,dirname as y,join as I}from"path";import{fileURLToPath as rt}from"url";var it="opencode-prompt-recorder";function st(n){console.error(`[prompt-recorder][autoUpdate] ${n}`)}var H=!1;function J(n,t){if(!t||H)return;H=!0;let r=new AbortController,i=setTimeout(()=>r.abort(),1e4);ot(r.signal).then(e=>{e.updated&&(st(`\u53D1\u73B0\u65B0\u7248\u672C: ${e.current} \u2192 ${e.latest}`),setTimeout(()=>{n.client.tui.showToast({body:{title:"Prompt Recorder \u66F4\u65B0",message:`${e.name} \u5DF2\u4ECE ${e.current} \u66F4\u65B0\u5230 ${e.latest}\uFF0C\u91CD\u542F OpenCode \u5B8C\u6210\u66F4\u65B0`,variant:"info"}})},5e3))}).catch(()=>{}).finally(()=>clearTimeout(i))}async function ot(n){let t=await at(it);if(!t)return{updated:!1};let r=await R(I(t,"package.json"));if(!r?.name||!r.version)return{updated:!1};let i=await pt(r.name,n);if(!i||!ft(i,r.version))return{updated:!1};let e=await ct(t,r.name);if(!e)return{updated:!1};try{await nt(e,{recursive:!0,force:!0})}catch{return{updated:!1,error:"remove_failed",name:r.name,current:r.version,latest:i}}return{updated:!0,name:r.name,current:r.version,latest:i}}async function at(n){let t=y(rt(import.meta.url));for(;;){if((await R(I(t,"package.json")))?.name===n)return h(t)==="dist"?y(t):t;let i=y(t);if(i===t)return;t=i}}async function ct(n,t){let r=y(n),i=h(r).startsWith("@")?y(r):r;if(h(i)!=="node_modules")return;let e=y(i),c=await R(I(e,"package.json")),d=ut(e,t)??c?.dependencies?.[t];if(!(!d||!dt(d)))return e}function ut(n,t){if(t.startsWith("@")){let[e,c]=t.split("/");if(!e||!c||h(y(n))!==e)return;let d=`${c}@`,m=h(n);return m.startsWith(d)?m.slice(d.length):void 0}let r=`${t}@`,i=h(n);return i.startsWith(r)?i.slice(r.length):void 0}function dt(n){let t=n.trim();return t?!!(t==="latest"||t==="*"||/^[~^]/.test(t)||/^(?:>=|>|<=|<)/.test(t)||/\s+(?:\|\||-|[<>=])\s+/.test(t)):!1}async function R(n){try{let t=JSON.parse(await et(n,"utf-8"));return t&&typeof t=="object"?t:void 0}catch{return}}async function pt(n,t){try{let r=await fetch(`https://registry.npmjs.org/${encodeURIComponent(n)}/latest`,{signal:t});if(!r.ok)return;let i=await r.json();if(!i||typeof i!="object")return;let e=i.version;return typeof e=="string"?e:void 0}catch{return}}function ft(n,t){let r=O(n),i=O(t);if(!r||!i)return!1;for(let e=0;e<3;e++)if(r.parts[e]!==i.parts[e])return r.parts[e]>i.parts[e];if(!r.pre.length&&i.pre.length)return!0;if(r.pre.length&&!i.pre.length)return!1;for(let e=0;e<Math.max(r.pre.length,i.pre.length);e++){let c=r.pre[e],d=i.pre[e];if(c===void 0)return!1;if(d===void 0)return!0;if(c===d)continue;let m=/^\d+$/.test(c)?Number(c):void 0,w=/^\d+$/.test(d)?Number(d):void 0;return m!==void 0&&w!==void 0?m>w:m!==void 0?!1:w!==void 0?!0:c>d}return!1}function O(n){let t=n.match(/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+.+)?$/);if(t)return{parts:[Number(t[1]),Number(t[2]),Number(t[3])],pre:t[4]?.split(".")??[]}}var yt=B(mt(import.meta.url));async function A(n,t){if(process.env.PROMPT_RECORDER_DEBUG!=="1"&&process.env.PROMPT_RECORDER_DEBUG!=="true")return;let i=`[${new Date().toISOString()}] ${t}
2
- `;try{let e=l(n,".agent","prompts-log");await T(e,{recursive:!0}),await V(l(e,"log.txt"),i)}catch(e){console.error("debugLog failed:",e)}}async function ht(){try{return JSON.parse(await z(l(yt,"package.json"),"utf-8")).version}catch{return"unknown"}}var wt=/[<>:"/\\|?*\x00-\x1f]/g;function G(n){return n.split(`
3
- `)[0].trim().replace(/<[^>]*>/g,"").replace(/\s+/g," ").trim().replace(wt,"").substring(0,40).trim()||"untitled"}function $t(n){let t=n.trimStart();return t.startsWith("<system-reminder>")||t.startsWith("<system>")}function kt(n){let t=n.getFullYear().toString(),r=String(n.getMonth()+1).padStart(2,"0"),i=String(n.getDate()).padStart(2,"0"),e=String(n.getHours()).padStart(2,"0"),c=String(n.getMinutes()).padStart(2,"0");return{yyyy:t,MM:r,dd:i,HH:e,mm:c}}var bt=async n=>{J(n,!0);let{directory:t}=n,r=!1,i=new Map,e=new Map,c=new Set,d=new Set,m=1440*60*1e3,w=200,g=new Map,P=new Map;function K(){if(g.size<w)return;let a=Date.now();for(let[s,o]of g)a-o.time>m&&g.delete(s)}async function $(a,s){let o=B(a.filepath),p=gt(a.filepath).match(/^(\d{10})-/);if(!p)return;let u=l(o,`${p[1]}-${G(s)}.txt`);if(u!==a.filepath)try{await lt(a.filepath,u),a.filepath=u}catch{}}return{event:async({event:a})=>{if(a.type==="message.updated"){let s=a.properties.info,o=s?.role||s?.message?.role;s?.id&&o&&e.set(s.id,o)}if(a.type==="message.part.updated"){let s=a.properties.part;if(s?.type==="tool"&&s?.tool==="task"){let o=s.state?.metadata??s.metadata;if(o){let f=o.sessionId??o.sessionID;f&&(d.add(f),await A(t,`[prompt-recorder] tracked task session: ${f}`))}}if(s?.type==="text"&&s?.text){if(s.synthetic||s.ignored)return;let o=s.sessionID,f=s.messageID,p=s.text,u=e.get(f);if(u||(u=s.message?.role),u||(u=a.properties.info?.role),u||(u=a.properties.info?.message?.role),u==="user"&&p&&o){if($t(p)){await A(t,`[prompt-recorder] filtered system-injected: sessionID=${o}`);return}let M=`${f}:${p}`;if(c.has(M))return;c.add(M),await A(t,`[prompt-recorder] event=${a.type}, role=${u}, sessionID=${o}, textLength=${p.length}, textPreview=${p.substring(0,50)}`);let X=new Date,{yyyy:k,MM:b,dd:D,HH:_,mm:E}=kt(X),C=l(t,".agent","prompts"),L=d.has(o)?l(C,"task",k,b,D):l(C,k,b,D);await T(L,{recursive:!0});let Z=k.slice(-2),U=`============ ${k}-${b}-${D} ${_}:${E} ============`,x=g.get(o);if(x)x.time=Date.now(),await V(x.filepath,`
1
+ import{mkdir as j,appendFile as ee,writeFile as q,readFile as te,rename as Q}from"fs/promises";import{join as l,dirname as ne,basename as Ee}from"path";import{fileURLToPath as Ae}from"url";import{readFile as ye,rm as we}from"fs/promises";import{basename as $,dirname as w,join as U}from"path";import{fileURLToPath as he}from"url";var ke="opencode-prompt-recorder",K=!1;function Y(s,e){if(!e||K)return;K=!0;let n=new AbortController,o=setTimeout(()=>n.abort(),1e4);$e(n.signal).then(i=>{i.updated&&setTimeout(()=>{s.client.tui.showToast({body:{title:"Prompt Recorder \u66F4\u65B0",message:`${i.name} \u5DF2\u4ECE ${i.current} \u66F4\u65B0\u5230 ${i.latest}\uFF0C\u91CD\u542F OpenCode \u5B8C\u6210\u66F4\u65B0`,variant:"info"}})},5e3)}).catch(i=>{console.error("[prompt-recorder] auto-update check failed:",i)}).finally(()=>clearTimeout(o))}async function $e(s){let e=await be(ke);if(!e)return{updated:!1};let n=await F(U(e,"package.json"));if(!n?.name||!n.version)return{updated:!1};let o=await Pe(n.name,s);if(!o||!ve(o,n.version))return{updated:!1};let i=await De(e,n.name);if(!i)return{updated:!1};try{await we(i,{recursive:!0,force:!0})}catch{return{updated:!1,error:"remove_failed",name:n.name,current:n.version,latest:o}}return{updated:!0,name:n.name,current:n.version,latest:o}}async function be(s){let e=w(he(import.meta.url));for(;;){if((await F(U(e,"package.json")))?.name===s)return $(e)==="dist"?w(e):e;let o=w(e);if(o===e)return;e=o}}async function De(s,e){let n=w(s),o=$(n).startsWith("@")?w(n):n;if($(o)!=="node_modules")return;let i=w(o),c=await F(U(i,"package.json")),u=Me(i,e)??c?.dependencies?.[e];if(!(!u||!Se(u)))return i}function Me(s,e){if(e.startsWith("@")){let[i,c]=e.split("/");if(!i||!c||$(w(s))!==i)return;let u=`${c}@`,g=$(s);return g.startsWith(u)?g.slice(u.length):void 0}let n=`${e}@`,o=$(s);return o.startsWith(n)?o.slice(n.length):void 0}function Se(s){let e=s.trim();return e?!!(e==="latest"||e==="*"||/^[~^]/.test(e)||/^(?:>=|>|<=|<)/.test(e)||/\s+(?:\|\||-|[<>=])\s+/.test(e)):!1}async function F(s){try{let e=JSON.parse(await ye(s,"utf-8"));return e&&typeof e=="object"?e:void 0}catch{return}}async function Pe(s,e){try{let n=await fetch(`https://registry.npmjs.org/${encodeURIComponent(s)}/latest`,{signal:e});if(!n.ok)return;let o=await n.json();if(!o||typeof o!="object")return;let i=o.version;return typeof i=="string"?i:void 0}catch{return}}function ve(s,e){let n=Z(s),o=Z(e);if(!n||!o)return!1;for(let i=0;i<3;i++)if(n.parts[i]!==o.parts[i])return n.parts[i]>o.parts[i];if(!n.pre.length&&o.pre.length)return!0;if(n.pre.length&&!o.pre.length)return!1;for(let i=0;i<Math.max(n.pre.length,o.pre.length);i++){let c=n.pre[i],u=o.pre[i];if(c===void 0)return!1;if(u===void 0)return!0;if(c===u)continue;let g=/^\d+$/.test(c)?Number(c):void 0,y=/^\d+$/.test(u)?Number(u):void 0;return g!==void 0&&y!==void 0?g>y:g!==void 0?!1:y!==void 0?!0:c>u}return!1}function Z(s){let e=s.match(/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+.+)?$/);if(e)return{parts:[Number(e[1]),Number(e[2]),Number(e[3])],pre:e[4]?.split(".")??[]}}var _e=ne(Ae(import.meta.url));async function L(s,e){if(process.env.PROMPT_RECORDER_DEBUG!=="1"&&process.env.PROMPT_RECORDER_DEBUG!=="true")return;let o=`[${new Date().toISOString()}] ${e}
2
+ `;try{let i=l(s,".agent","prompts-log");await j(i,{recursive:!0}),await ee(l(i,"log.txt"),o)}catch(i){console.error("debugLog failed:",i)}}var I="";async function Ie(){if(I)return I;try{return I=JSON.parse(await te(l(_e,"package.json"),"utf-8")).version||"unknown",I}catch{return"unknown"}}var Re=/[<>:"/\\|?*\x00-\x1f\u200B-\u200F\u2028-\u202E\uFEFF]/g;function N(s){return s.split(`
3
+ `)[0].trim().replace(/<[^>]*>/g,"").replace(/\s+/g," ").trim().replace(Re,"").substring(0,40).trim()||"untitled"}function Te(s){let e=s.trimStart();return e.startsWith("<system-reminder>")||e.startsWith("<system>")}function xe(s){let e=s.getFullYear().toString(),n=String(s.getMonth()+1).padStart(2,"0"),o=String(s.getDate()).padStart(2,"0"),i=String(s.getHours()).padStart(2,"0"),c=String(s.getMinutes()).padStart(2,"0"),u=String(s.getSeconds()).padStart(2,"0");return{yyyy:e,MM:n,dd:o,HH:i,mm:c,ss:u}}var Ce=async s=>{Y(s,!0);let{directory:e}=s;ue();let n=new Map,o=new Map,i=new Map,c=new Map,u=1440*60*1e3,g=200,y=2e3,M=1440*60*1e3,re=3600*1e3,m=new Map,h=new Map,R=".txt",T=new Map;function ie(){if(m.size<g)return;let a=Date.now();for(let[t,r]of m)a-r.time>u&&m.delete(t)}function se(){let a=Date.now();if(i.size>y)for(let[t,r]of i)a-r>M&&i.delete(t);if(o.size>y)for(let[t,r]of o)a-r.time>M&&o.delete(t);if(c.size>y)for(let[t,r]of c)a-r>M&&c.delete(t);if(n.size>y)for(let[t,r]of n)a-r.time>M&&n.delete(t);if(h.size>0)for(let[t,r]of h)a-r.time>re&&h.delete(t)}async function S(a,t){let r=ne(a.filepath),d=Ee(a.filepath).match(/^(\d{10})-/);if(!d)return;let f=l(r,`${d[1]}-${N(t)}${R}`);if(f!==a.filepath)try{await Q(a.filepath,f),a.filepath=f}catch{let P=crypto.randomUUID().slice(0,8),v=l(r,`${d[1]}-${N(t)}-${P}${R}`);try{await Q(a.filepath,v),a.filepath=v}catch(k){console.error(`[prompt-recorder] rename failed: ${a.filepath}`,k)}}}async function oe(a){let t=a.properties.info,r=t?.id,p=t?.role||t?.message?.role;r&&p==="user"&&o.set(r,{role:p,time:Date.now()})}async function ae(a){let t=a.properties.part;if(t?.type==="tool"&&t?.tool==="task"){let b=t.state?.metadata??t.metadata;if(b){let D=b.sessionId??b.sessionID;D&&(c.set(D,Date.now()),await L(e,`[prompt-recorder] tracked task session: ${D}`))}}if(t?.type!=="text"||!t?.text||t.synthetic||t.ignored)return;let r=t.sessionID,p=t.messageID,d=t.text,f=o.get(p)?.role;if(f||(f=t.message?.role),f||(f=a.properties.info?.role),f||(f=a.properties.info?.message?.role),f!=="user"||!d||!r)return;if(Te(d)){await L(e,`[prompt-recorder] filtered system-injected: sessionID=${r}`);return}let P=p?`${p}:${d}`:`${r}:${d}`;if(i.has(P))return;i.set(P,Date.now()),se(),await L(e,`[prompt-recorder] event=${a.type}, role=${f}, sessionID=${r}, textLength=${d.length}, textPreview=${d.substring(0,50)}`);let v=new Date,{yyyy:k,MM:E,dd:A,HH:O,mm:H,ss:pe}=xe(v),z=l(e,".agent","prompts"),J=c.has(r)?l(z,"task",k,E,A):l(z,k,E,A);await j(J,{recursive:!0});let fe=k.slice(-2),G=`============ ${k}-${E}-${A} ${O}:${H}:${pe} ============`,x=m.get(r);if(x)x.time=Date.now(),await ee(x.filepath,`
4
4
 
5
- ${U}
5
+ ${G}
6
6
 
7
- ${p}`);else{let Y=G(i.get(o)??p),q=`${Z}${b}${D}${_}${E}-${Y}.txt`,j=l(L,q),Q=`============ SessionID: ${o} ============`;await W(j,`${Q}
7
+ ${d}`);else{let b=N(n.get(r)?.title??d),D=`${fe}${E}${A}${O}${H}-${b}${R}`,W=l(J,D),le=`============ SessionID: ${r} ============`;await q(W,`${le}
8
8
 
9
- ${U}
9
+ ${G}
10
10
 
11
- ${p}`),g.set(o,{filepath:j,time:Date.now()}),K();let F=P.get(o);if(F){P.delete(o);let v=g.get(o);v&&await $(v,F)}setTimeout(async()=>{try{let S=(await n.client.session.get({path:{id:o}}))?.data?.title;if(!S)return;let tt=i.get(o);if(S===tt)return;i.set(o,S);let N=g.get(o);N&&await $(N,S)}catch{}},5e3)}}}}if(a.type==="session.created"){let s=a.properties.info;if(s?.id&&s?.title){i.set(s.id,s.title);let o=g.get(s.id);o&&await $(o,s.title)}}if(a.type==="session.updated"){let s=a.properties.info;if(s?.id&&s?.title){let o=i.get(s.id);if(i.set(s.id,s.title),o!==s.title){let f=g.get(s.id);f?await $(f,s.title):P.set(s.id,s.title)}}if(!r)try{let o=await ht(),f=l(t,".agent"),p=l(f,"opencode-prompt-recorder-readme.txt"),u=`# OpenCode Prompt Recorder
11
+ ${d}`),m.set(r,{filepath:W,time:Date.now()}),ie();let V=h.get(r);if(V){h.delete(r);let C=m.get(r);C&&await S(C,V.title)}let X=T.get(r);X&&clearTimeout(X);let me=setTimeout(async()=>{T.delete(r);try{let _=(await s.client.session.get({path:{id:r}}))?.data?.title;if(!_)return;let ge=n.get(r)?.title;if(_===ge)return;n.set(r,{title:_,time:Date.now()});let B=m.get(r);B&&await S(B,_)}catch{}},5e3);T.set(r,me)}}async function ce(a){let t=a.properties.info;if(t?.id&&t?.title){n.set(t.id,{title:t.title,time:Date.now()});let r=m.get(t.id);r&&await S(r,t.title)}}async function ue(){try{let a=await Ie(),t=l(e,".agent"),r=l(t,"opencode-prompt-recorder-readme.txt"),p=`# OpenCode Prompt Recorder
12
12
 
13
13
  \u81EA\u52A8\u8BB0\u5F55\u7528\u6237\u63D0\u793A\u8BCD\u5230 .agent/prompts \u76EE\u5F55\u7684\u63D2\u4EF6\u3002
14
14
 
15
- \u7248\u672C\uFF1A${o}
15
+ \u7248\u672C\uFF1A${a}
16
16
  \u4F5C\u8005\uFF1Aanarckk
17
- \u9879\u76EE\u5730\u5740\uFF1Ahttps://github.com/anarckk/opencode-prompt-recorder`;try{if(await z(p,"utf-8")===u){r=!0;return}}catch{}await T(f,{recursive:!0}),await W(p,u),r=!0}catch{}}}}},Tt=bt;export{bt as OpenCodePromptRecorder,Tt as default};
17
+ \u9879\u76EE\u5730\u5740\uFF1Ahttps://github.com/anarckk/opencode-prompt-recorder`;try{if(await te(r,"utf-8")===p)return}catch{}await j(t,{recursive:!0}),await q(r,p)}catch{}}async function de(a){let t=a.properties.info;if(t?.id&&t?.title){let r=n.get(t.id)?.title;if(n.set(t.id,{title:t.title,time:Date.now()}),r!==t.title){let p=m.get(t.id);p?await S(p,t.title):h.set(t.id,{title:t.title,time:Date.now()})}}}return{event:async({event:a})=>{switch(a.type){case"message.updated":await oe(a);break;case"message.part.updated":await ae(a);break;case"session.created":await ce(a);break;case"session.updated":await de(a);break}}}},Ge=Ce;export{Ge as default};
package/dist/package.json CHANGED
@@ -1,25 +1,23 @@
1
1
  {
2
2
  "name": "opencode-prompt-recorder",
3
- "version": "1.7.9",
3
+ "version": "1.8.1",
4
4
  "description": "OpenCode plugin for recording user prompts. Automatically saves user messages to a local file system with organized directory structure.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./dist/index.js",
11
- "require": "./dist/index.js"
10
+ "import": "./dist/index.js"
12
11
  }
13
12
  },
14
13
  "files": [
15
14
  "dist"
16
15
  ],
17
16
  "scripts": {
18
- "build": "if (Test-Path dist) { Remove-Item -Recurse -Force dist }; npx esbuild index.ts --bundle --platform=node --outdir=dist --format=esm --external:@opencode-ai/plugin --minify; Copy-Item package.json dist/",
19
- "build:uncompressed": "if (Test-Path dist) { Remove-Item -Recurse -Force dist }; npx esbuild index.ts --bundle --platform=node --outdir=dist --format=esm --external:@opencode-ai/plugin; Copy-Item package.json dist/",
17
+ "build": "node -e \"fs.rmSync('dist',{force:true,recursive:true})\" && npx esbuild index.ts --bundle --platform=node --outdir=dist --format=esm --external:@opencode-ai/plugin --minify && node -e \"fs.copyFileSync('package.json','dist/package.json')\"",
18
+ "build:uncompressed": "node -e \"fs.rmSync('dist',{force:true,recursive:true})\" && npx esbuild index.ts --bundle --platform=node --outdir=dist --format=esm --external:@opencode-ai/plugin && node -e \"fs.copyFileSync('package.json','dist/package.json')\"",
20
19
  "prepublishOnly": "npm run build",
21
- "publish": "node scripts/publish-npmjs.js",
22
- "test": "npx tsx test/index.ts"
20
+ "publish": "node scripts/publish-npmjs.js"
23
21
  },
24
22
  "keywords": [
25
23
  "opencode",
@@ -46,7 +44,6 @@
46
44
  },
47
45
  "devDependencies": {
48
46
  "@opencode-ai/plugin": "^0.15.0",
49
- "@types/bun": "^1.3.1",
50
47
  "esbuild": "^0.25.0",
51
48
  "typescript": "^5.9.3"
52
49
  }
package/package.json CHANGED
@@ -1,25 +1,23 @@
1
1
  {
2
2
  "name": "opencode-prompt-recorder",
3
- "version": "1.7.9",
3
+ "version": "1.8.1",
4
4
  "description": "OpenCode plugin for recording user prompts. Automatically saves user messages to a local file system with organized directory structure.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./dist/index.js",
11
- "require": "./dist/index.js"
10
+ "import": "./dist/index.js"
12
11
  }
13
12
  },
14
13
  "files": [
15
14
  "dist"
16
15
  ],
17
16
  "scripts": {
18
- "build": "if (Test-Path dist) { Remove-Item -Recurse -Force dist }; npx esbuild index.ts --bundle --platform=node --outdir=dist --format=esm --external:@opencode-ai/plugin --minify; Copy-Item package.json dist/",
19
- "build:uncompressed": "if (Test-Path dist) { Remove-Item -Recurse -Force dist }; npx esbuild index.ts --bundle --platform=node --outdir=dist --format=esm --external:@opencode-ai/plugin; Copy-Item package.json dist/",
17
+ "build": "node -e \"fs.rmSync('dist',{force:true,recursive:true})\" && npx esbuild index.ts --bundle --platform=node --outdir=dist --format=esm --external:@opencode-ai/plugin --minify && node -e \"fs.copyFileSync('package.json','dist/package.json')\"",
18
+ "build:uncompressed": "node -e \"fs.rmSync('dist',{force:true,recursive:true})\" && npx esbuild index.ts --bundle --platform=node --outdir=dist --format=esm --external:@opencode-ai/plugin && node -e \"fs.copyFileSync('package.json','dist/package.json')\"",
20
19
  "prepublishOnly": "npm run build",
21
- "publish": "node scripts/publish-npmjs.js",
22
- "test": "npx tsx test/index.ts"
20
+ "publish": "node scripts/publish-npmjs.js"
23
21
  },
24
22
  "keywords": [
25
23
  "opencode",
@@ -46,7 +44,6 @@
46
44
  },
47
45
  "devDependencies": {
48
46
  "@opencode-ai/plugin": "^0.15.0",
49
- "@types/bun": "^1.3.1",
50
47
  "esbuild": "^0.25.0",
51
48
  "typescript": "^5.9.3"
52
49
  }